-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(daemon,cli): One handle for every agent #2184
feat(daemon,cli): One handle for every agent #2184
Conversation
9526387
to
90943df
Compare
let currentId = id; | ||
// eslint-disable-next-line no-constant-condition | ||
while (true) { | ||
const controller = provideController(currentId); | ||
// eslint-disable-next-line no-await-in-loop | ||
const internalFacet = await controller.internal; | ||
if (internalFacet === undefined || internalFacet === null) { | ||
return controller; | ||
} | ||
// @ts-expect-error We can't know the type of the internal facet. | ||
if (internalFacet.targetId === undefined) { | ||
return controller; | ||
} | ||
const handle = /** @type {import('./types.js').InternalHandle} */ ( | ||
internalFacet | ||
); | ||
currentId = handle.targetId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cha-ching
a37bb43
to
25c404e
Compare
2d604a1
to
72b7922
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some optional suggestions in here, but the familiar chat example is broken on this branch. No names are listed, the console is full of errors, and mailbox requests do not appear. Also, the instructions in cli/demo/README.md
are not update (see e.g. endo mkguest
).
handleId: string; | ||
guestId: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with hostAgentId
and hostHandleId
in the same interface:
handleId: string; | |
guestId: string; | |
guestHandleId: string; | |
guestAgentId: string; |
Would also accept agentId
/ handleId
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep these as present, or instead ownHandleId
and ownAgentId
. The role of handleId
and agentId
is the same between Host and Guest so I would like to use the same names. Whereas a guest has a host, but a host does not. (I would imagine adding PARENT
for hosts created by other hosts. If we explored that path, we’d have to consider how to accommodate the specialness of the root host. We could borrow the /..
== /
trick from *ix file systems.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I'd prefer the more explicit ownHandleId
/ ownAgentId
in that case, but I leave it up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I will circle back for this.
hostId: string; | ||
handleId: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on FormulateNumberedGuestParams
above.
72b7922
to
d08debf
Compare
@rekmarks This is ready for another review. I’ve appended a fixup commit with the necessary changes to the demo script to get it on the right path again. |
d08debf
to
53cc062
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The remaining optional suggestion left as an exercise to the author.
53cc062
to
5ed0d66
Compare
Toward delivering mail over the network, this change introduces a `deliver` method on guest and host agents that accepts arbitrary messages into the agent’s inbox. Any other agent can send mail to any other local agent for whom they have a handle and cannot spoof their sender handle. This is a net simplification, since it reduces our dependence on the internal facet of agents and requires less machinery because it treats messages as capabilities on the wire, freely exposing and carrying identifiers. We no longer have separate internal and external representations of messages and pet name “dubbing” is deferred to the UI. This in turn enables us to defer to the UI the question of whether to query the name for each identifier once or watch for changes. Stacked on #2184
Toward sending messages between mailboxes in separate nodes, this change gives every agent (both hosts and guests) a powerless handle that can be used to mention the agent without leaking agency.
This is somewhat tricky because this is the first cycle in the formula graph. The agent contains a handle and the handle identifier and formula are just ways of referring to the facet held by the agent. So, writing an agent formula generates a handle formula as a side-effect and populates the agent id for handle table.
This also means that
mkguest
andmkhost
need to designate the handle (so that messages from the other agent are visible) and might optionally also designate a pet name for the agent.