@mquan/portal 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -0
- package/dist/src/api.d.ts +5 -0
- package/dist/src/api.js +357 -0
- package/dist/src/api.js.map +1 -0
- package/dist/src/cli.d.ts +17 -0
- package/dist/src/cli.js +618 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/daemon-lifecycle.d.ts +24 -0
- package/dist/src/daemon-lifecycle.js +107 -0
- package/dist/src/daemon-lifecycle.js.map +1 -0
- package/dist/src/daemon.d.ts +17 -0
- package/dist/src/daemon.js +90 -0
- package/dist/src/daemon.js.map +1 -0
- package/dist/src/doctor.d.ts +14 -0
- package/dist/src/doctor.js +51 -0
- package/dist/src/doctor.js.map +1 -0
- package/dist/src/entrypoint.d.ts +2 -0
- package/dist/src/entrypoint.js +14 -0
- package/dist/src/entrypoint.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/launch.d.ts +41 -0
- package/dist/src/launch.js +186 -0
- package/dist/src/launch.js.map +1 -0
- package/dist/src/mcp.d.ts +9 -0
- package/dist/src/mcp.js +132 -0
- package/dist/src/mcp.js.map +1 -0
- package/dist/src/network/client.d.ts +67 -0
- package/dist/src/network/client.js +540 -0
- package/dist/src/network/client.js.map +1 -0
- package/dist/src/network/coordinator.d.ts +83 -0
- package/dist/src/network/coordinator.js +225 -0
- package/dist/src/network/coordinator.js.map +1 -0
- package/dist/src/network/protocol.d.ts +1352 -0
- package/dist/src/network/protocol.js +360 -0
- package/dist/src/network/protocol.js.map +1 -0
- package/dist/src/network/server.d.ts +28 -0
- package/dist/src/network/server.js +474 -0
- package/dist/src/network/server.js.map +1 -0
- package/dist/src/network/tasks.d.ts +65 -0
- package/dist/src/network/tasks.js +276 -0
- package/dist/src/network/tasks.js.map +1 -0
- package/dist/src/portal-index.d.ts +21 -0
- package/dist/src/portal-index.js +140 -0
- package/dist/src/portal-index.js.map +1 -0
- package/dist/src/provider/claude-managed.d.ts +34 -0
- package/dist/src/provider/claude-managed.js +125 -0
- package/dist/src/provider/claude-managed.js.map +1 -0
- package/dist/src/provider/claude.d.ts +24 -0
- package/dist/src/provider/claude.js +114 -0
- package/dist/src/provider/claude.js.map +1 -0
- package/dist/src/provider/codex/app-server-client.d.ts +43 -0
- package/dist/src/provider/codex/app-server-client.js +143 -0
- package/dist/src/provider/codex/app-server-client.js.map +1 -0
- package/dist/src/provider/codex/index.d.ts +3 -0
- package/dist/src/provider/codex/index.js +4 -0
- package/dist/src/provider/codex/index.js.map +1 -0
- package/dist/src/provider/codex/managed-runner.d.ts +12 -0
- package/dist/src/provider/codex/managed-runner.js +162 -0
- package/dist/src/provider/codex/managed-runner.js.map +1 -0
- package/dist/src/provider/codex/probe.d.ts +2 -0
- package/dist/src/provider/codex/probe.js +33 -0
- package/dist/src/provider/codex/probe.js.map +1 -0
- package/dist/src/provider/codex/protocol.d.ts +193 -0
- package/dist/src/provider/codex/protocol.js +10 -0
- package/dist/src/provider/codex/protocol.js.map +1 -0
- package/dist/src/provider/codex/provider.d.ts +35 -0
- package/dist/src/provider/codex/provider.js +289 -0
- package/dist/src/provider/codex/provider.js.map +1 -0
- package/dist/src/provider/codex/remote-app-server.d.ts +16 -0
- package/dist/src/provider/codex/remote-app-server.js +80 -0
- package/dist/src/provider/codex/remote-app-server.js.map +1 -0
- package/dist/src/provider/codex/websocket-client.d.ts +40 -0
- package/dist/src/provider/codex/websocket-client.js +174 -0
- package/dist/src/provider/codex/websocket-client.js.map +1 -0
- package/dist/src/provider/types.d.ts +35 -0
- package/dist/src/provider/types.js +2 -0
- package/dist/src/provider/types.js.map +1 -0
- package/dist/src/recall/embedding.d.ts +28 -0
- package/dist/src/recall/embedding.js +142 -0
- package/dist/src/recall/embedding.js.map +1 -0
- package/dist/src/recall/types.d.ts +35 -0
- package/dist/src/recall/types.js +2 -0
- package/dist/src/recall/types.js.map +1 -0
- package/dist/src/rpc/client.d.ts +6 -0
- package/dist/src/rpc/client.js +58 -0
- package/dist/src/rpc/client.js.map +1 -0
- package/dist/src/rpc/protocol.d.ts +21 -0
- package/dist/src/rpc/protocol.js +11 -0
- package/dist/src/rpc/protocol.js.map +1 -0
- package/dist/src/rpc/server.d.ts +12 -0
- package/dist/src/rpc/server.js +154 -0
- package/dist/src/rpc/server.js.map +1 -0
- package/dist/src/runtime/paths.d.ts +8 -0
- package/dist/src/runtime/paths.js +18 -0
- package/dist/src/runtime/paths.js.map +1 -0
- package/dist/src/service.d.ts +127 -0
- package/dist/src/service.js +637 -0
- package/dist/src/service.js.map +1 -0
- package/dist/src/session-profile.d.ts +39 -0
- package/dist/src/session-profile.js +186 -0
- package/dist/src/session-profile.js.map +1 -0
- package/dist/src/storage/database.d.ts +9 -0
- package/dist/src/storage/database.js +354 -0
- package/dist/src/storage/database.js.map +1 -0
- package/dist/src/storage/repository.d.ts +275 -0
- package/dist/src/storage/repository.js +1291 -0
- package/dist/src/storage/repository.js.map +1 -0
- package/dist/src/version.d.ts +1 -0
- package/dist/src/version.js +2 -0
- package/dist/src/version.js.map +1 -0
- package/docs/architecture-plan.md +191 -0
- package/docs/mvp-plan.md +111 -0
- package/docs/remote-demo.md +346 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Portal
|
|
2
|
+
|
|
3
|
+
Portal is a local-first control plane for coding-agent sessions. It discovers
|
|
4
|
+
Codex and Claude histories, recalls cited context across sessions, routes
|
|
5
|
+
durable local messages, and lets Portal-managed Codex agents collaborate over
|
|
6
|
+
a shared WebSocket relay.
|
|
7
|
+
|
|
8
|
+
## Current checkpoint
|
|
9
|
+
|
|
10
|
+
Implemented:
|
|
11
|
+
|
|
12
|
+
- Codex app-server and Claude Agent SDK discovery/history adapters;
|
|
13
|
+
- stable Portal session IDs with explicit `indexed`, `connected`, and
|
|
14
|
+
`messageable` capabilities;
|
|
15
|
+
- SQLite/WAL persistence, incremental content hashing, FTS5, and bounded local
|
|
16
|
+
semantic retrieval;
|
|
17
|
+
- a user-only Unix-socket daemon with a separate control credential for CLI
|
|
18
|
+
operations;
|
|
19
|
+
- active, attributed Codex-to-Codex delivery with durable offline fallback;
|
|
20
|
+
- authenticated MCP tools for sessions, recall, local messaging, remote peer
|
|
21
|
+
discovery, asynchronous delegation, and task updates;
|
|
22
|
+
- `portal run codex` and `portal run claude` with real vendor identity and
|
|
23
|
+
per-run Portal MCP injection. Codex launches through a dedicated loopback
|
|
24
|
+
app-server so the created thread, first turn, MCP tools, and TUI share one
|
|
25
|
+
runtime;
|
|
26
|
+
- leased/acknowledged inbox delivery, payload-bound idempotency, participant-
|
|
27
|
+
bound replies, and message size/rate/depth limits; and
|
|
28
|
+
- transcript secret redaction and bounded embedding work.
|
|
29
|
+
- an in-memory presence registry and WebSocket relay, reconnecting daemon
|
|
30
|
+
clients, durable remote task events, and automatic visible-turn delivery.
|
|
31
|
+
|
|
32
|
+
Still to validate before expanding scope:
|
|
33
|
+
|
|
34
|
+
- active delivery for managed Claude sessions (Claude currently uses the inbox fallback);
|
|
35
|
+
- five multi-session dogfood workflows and an 80% top-five recall benchmark.
|
|
36
|
+
|
|
37
|
+
Observed sessions are deliberately not described as live or directly
|
|
38
|
+
controllable. A Codex app-server's loaded set is local to that app-server, and
|
|
39
|
+
Claude history has no liveness signal. Sessions become Portal-connected only
|
|
40
|
+
while using authenticated Portal MCP.
|
|
41
|
+
|
|
42
|
+
For a live `portal run codex` target, `portal.send` automatically creates a new,
|
|
43
|
+
visible turn in that target. The send call waits for the correlated turn to
|
|
44
|
+
finish and returns the target's final answer plus a bounded tool-result summary.
|
|
45
|
+
No inbox check is required. If the target runner is unavailable, Portal keeps
|
|
46
|
+
the message in its durable inbox for later delivery. Peer messages are clearly
|
|
47
|
+
attributed and remain subject to the target session's existing approval and
|
|
48
|
+
sandbox policy; Portal never auto-approves a tool action.
|
|
49
|
+
|
|
50
|
+
## Run from source
|
|
51
|
+
|
|
52
|
+
Requires Node.js 22.13 or newer plus locally installed Codex and/or Claude Code.
|
|
53
|
+
The managed Codex path is tested with Codex CLI 0.151.0.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install
|
|
57
|
+
npm run build
|
|
58
|
+
node dist/src/cli.js doctor
|
|
59
|
+
node dist/src/cli.js up --foreground
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
In another terminal:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
node dist/src/cli.js sessions --workspace "$PWD"
|
|
66
|
+
node dist/src/cli.js recall "what did another session learn?" --workspace "$PWD"
|
|
67
|
+
node dist/src/cli.js run claude "Review the migration" --name review-agent
|
|
68
|
+
node dist/src/cli.js run codex "Implement the fix" --name api-agent
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Names are optional. Portal derives a mutable display name, description, and
|
|
72
|
+
topics from the initial prompt and later transcript updates while retaining the
|
|
73
|
+
stable Portal session ID:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
node dist/src/cli.js run codex "Review migration rollback safety"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Provider-specific flags go after `--`, for example:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
node dist/src/cli.js run codex "Implement the fix" --name api-agent -- --yolo
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`--yolo` is Portal's short alias for Codex's
|
|
86
|
+
`--dangerously-bypass-approvals-and-sandbox`; it applies to the initial turn too.
|
|
87
|
+
|
|
88
|
+
An initial prompt is optional. Portal creates a real Codex thread and attaches
|
|
89
|
+
the interactive TUI; an idle named agent remains available for local or remote
|
|
90
|
+
work. The loopback app-server and session credential are removed when the TUI
|
|
91
|
+
exits.
|
|
92
|
+
|
|
93
|
+
## Remote collaboration demo
|
|
94
|
+
|
|
95
|
+
Start the temporary in-memory registry and relay:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
node dist/src/cli.js serve --listen 127.0.0.1:8787
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
On two machines (or two isolated local environments), point named Codex agents
|
|
102
|
+
at the same WebSocket URL:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx -y @mquan/portal@demo codex --agent kai --server ws://127.0.0.1:8787/ws
|
|
106
|
+
npx -y @mquan/portal@demo codex --agent leo --server ws://127.0.0.1:8787/ws
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Kai can call `portal.peers`, then `portal.delegate` with target
|
|
110
|
+
`leo`. Leo receives a visible Codex turn automatically, calls
|
|
111
|
+
`portal.task.update` to accept or decline, and can send progress, questions, or
|
|
112
|
+
results. After an accepted offer, Leo's final response is automatically routed
|
|
113
|
+
back as a visible turn in Kai's session. The delegation call returns
|
|
114
|
+
after durable receipt, so both sessions remain free to work independently.
|
|
115
|
+
|
|
116
|
+
This demo has deliberately no authentication: names, routes, and content are
|
|
117
|
+
self-asserted and shown as unauthenticated. Use only a controlled, short-lived
|
|
118
|
+
relay URL and preserve Codex's normal sandbox and approval policy. See
|
|
119
|
+
[the remote demo plan](docs/remote-demo.md) for the protocol and trust boundary.
|
|
120
|
+
|
|
121
|
+
With two managed Codex sessions running, send by stable managed name:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
node dist/src/cli.js send review-agent "Review the current implementation" \
|
|
125
|
+
--from api-agent --workspace "$PWD"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Names are normalized across case, spaces, underscores, and hyphens, so
|
|
129
|
+
`review agent`, `review_agent`, and `review-agent` are equivalent when the match
|
|
130
|
+
is unique. A sender may also omit the receiver when its message clearly
|
|
131
|
+
identifies one active peer:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
node dist/src/cli.js send --auto \
|
|
135
|
+
"Ask whoever is reviewing the migration to check rollback safety" \
|
|
136
|
+
--from api-agent --workspace "$PWD"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The MCP `portal.send` tool likewise accepts only `message`. Portal searches the
|
|
140
|
+
small persisted session-profile index and sends only when one active same-
|
|
141
|
+
workspace runner has positive relevance and a clear lead. Otherwise it returns
|
|
142
|
+
`delivery: not_sent` with ranked candidates and creates no message. Explicitly
|
|
143
|
+
targeted unavailable sessions retain the durable queue behavior.
|
|
144
|
+
|
|
145
|
+
The target terminal receives a new turn automatically. The sender prints
|
|
146
|
+
`completed` and the target response. Use `--json` to include the target turn ID,
|
|
147
|
+
timestamps, and captured tool results. A result of `queued_unavailable` means
|
|
148
|
+
the exact target was resolved but its managed runner was not active; the
|
|
149
|
+
message remains durable.
|
|
150
|
+
|
|
151
|
+
For MCP, mint a credential for an indexed session:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
node dist/src/cli.js auth --session <portal-session-id> --json
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Configure `dist/src/mcp.js` as a stdio MCP server with the returned
|
|
158
|
+
`PORTAL_SESSION_ID` and `PORTAL_SESSION_TOKEN`. Tokens are stored only as hashes;
|
|
159
|
+
agent identity and workspace are derived by the daemon, not accepted from tool
|
|
160
|
+
arguments.
|
|
161
|
+
|
|
162
|
+
The control token protects the CLI plane from agents that can reach the socket
|
|
163
|
+
but cannot read Portal's private runtime directory. It is not an isolation
|
|
164
|
+
boundary against an unrestricted same-UID process; strong isolation requires
|
|
165
|
+
an OS sandbox or separate service identity.
|
|
166
|
+
|
|
167
|
+
See [the MVP checkpoint plan](docs/mvp-plan.md) and the concise
|
|
168
|
+
[long-term architecture](docs/architecture-plan.md).
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RpcRequest } from "./rpc/protocol.js";
|
|
2
|
+
import type { PortalService } from "./service.js";
|
|
3
|
+
import type { RemoteCoordinator } from "./network/coordinator.js";
|
|
4
|
+
import type { RemoteTaskManager } from "./network/tasks.js";
|
|
5
|
+
export declare function createPortalRpcHandler(service: PortalService, daemonInfo: () => unknown, controlToken: string, remote?: RemoteCoordinator, tasks?: RemoteTaskManager): (request: RpcRequest) => Promise<unknown>;
|
package/dist/src/api.js
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { timingSafeEqual } from "node:crypto";
|
|
2
|
+
export function createPortalRpcHandler(service, daemonInfo, controlToken, remote, tasks) {
|
|
3
|
+
return async (request) => {
|
|
4
|
+
const params = record(request.params);
|
|
5
|
+
if (!request.method.startsWith("agent.") &&
|
|
6
|
+
!request.method.startsWith("managed.runner.") &&
|
|
7
|
+
!request.method.startsWith("managed.remote.") &&
|
|
8
|
+
request.method !== "daemon.ping" &&
|
|
9
|
+
request.method !== "managed.finish" &&
|
|
10
|
+
request.method !== "managed.bind") {
|
|
11
|
+
requireControlToken(params, controlToken);
|
|
12
|
+
}
|
|
13
|
+
switch (request.method) {
|
|
14
|
+
case "daemon.ping":
|
|
15
|
+
return daemonInfo();
|
|
16
|
+
case "sessions.refresh": {
|
|
17
|
+
const workspace = optionalString(params.workspace);
|
|
18
|
+
const providers = optionalProviders(params.providers);
|
|
19
|
+
return service.refresh({
|
|
20
|
+
...(workspace === undefined ? {} : { workspace }),
|
|
21
|
+
...(providers === undefined ? {} : { providers }),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
case "sessions.list": {
|
|
25
|
+
const workspace = optionalString(params.workspace);
|
|
26
|
+
const providers = optionalProviders(params.providers);
|
|
27
|
+
if (params.refresh !== false) {
|
|
28
|
+
await service.refresh({
|
|
29
|
+
...(workspace === undefined ? {} : { workspace }),
|
|
30
|
+
...(providers === undefined ? {} : { providers }),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const sessions = service.listSessions(workspace);
|
|
34
|
+
return providers === undefined ? sessions : sessions.filter(({ provider }) => providers.includes(provider));
|
|
35
|
+
}
|
|
36
|
+
case "recall": {
|
|
37
|
+
const providers = optionalProviders(params.providers);
|
|
38
|
+
const limit = optionalInteger(params.limit, "limit");
|
|
39
|
+
const maxPerSession = optionalInteger(params.maxPerSession, "maxPerSession");
|
|
40
|
+
const occurredAfter = optionalDate(params.occurredAfter, "occurredAfter");
|
|
41
|
+
const occurredBefore = optionalDate(params.occurredBefore, "occurredBefore");
|
|
42
|
+
return service.recall(requiredString(params.query, "query"), {
|
|
43
|
+
workspace: requiredString(params.workspace, "workspace"),
|
|
44
|
+
...(providers === undefined ? {} : { providers }),
|
|
45
|
+
...(limit === undefined ? {} : { limit }),
|
|
46
|
+
...(maxPerSession === undefined ? {} : { maxPerSession }),
|
|
47
|
+
...(occurredAfter === undefined ? {} : { occurredAfter }),
|
|
48
|
+
...(occurredBefore === undefined ? {} : { occurredBefore }),
|
|
49
|
+
refresh: params.refresh !== false,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
case "message.send": {
|
|
53
|
+
const idempotencyKey = optionalString(params.idempotencyKey);
|
|
54
|
+
const replyTo = optionalString(params.replyTo);
|
|
55
|
+
const workspace = optionalString(params.workspace);
|
|
56
|
+
const senderSessionId = optionalString(params.senderSessionId) ??
|
|
57
|
+
service.resolveSession(requiredString(params.sender, "sender"), workspace).portalSessionId;
|
|
58
|
+
const targetSessionId = optionalString(params.targetSessionId);
|
|
59
|
+
const targetReference = optionalString(params.target);
|
|
60
|
+
return service.send({
|
|
61
|
+
senderSessionId,
|
|
62
|
+
body: requiredString(params.body, "body"),
|
|
63
|
+
...(targetSessionId === undefined ? {} : { targetSessionId }),
|
|
64
|
+
...(targetReference === undefined ? {} : { targetReference }),
|
|
65
|
+
...(idempotencyKey === undefined ? {} : { idempotencyKey }),
|
|
66
|
+
...(replyTo === undefined ? {} : { replyTo }),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
case "message.inbox":
|
|
70
|
+
return service.inbox(requiredString(params.targetSessionId, "targetSessionId"));
|
|
71
|
+
case "credentials.issue":
|
|
72
|
+
return service.issueSessionCredential(requiredString(params.session, "session"), optionalString(params.workspace));
|
|
73
|
+
case "managed.prepare": {
|
|
74
|
+
const provider = requiredProvider(params.provider);
|
|
75
|
+
const title = params.title === null ? null : optionalString(params.title);
|
|
76
|
+
const managedName = params.managedName === null ? null : optionalString(params.managedName);
|
|
77
|
+
const initialPrompt = optionalString(params.initialPrompt);
|
|
78
|
+
return service.prepareManagedSession({
|
|
79
|
+
provider,
|
|
80
|
+
vendorSessionId: requiredString(params.vendorSessionId, "vendorSessionId"),
|
|
81
|
+
workspace: requiredString(params.workspace, "workspace"),
|
|
82
|
+
...(title === undefined ? {} : { title }),
|
|
83
|
+
...(managedName === undefined ? {} : { managedName }),
|
|
84
|
+
...(initialPrompt === undefined ? {} : { initialPrompt }),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
case "agent.sessions": {
|
|
88
|
+
const caller = authenticateAgent(service, params);
|
|
89
|
+
if (caller.workspace === null)
|
|
90
|
+
throw new Error("calling session has no workspace");
|
|
91
|
+
if (params.refresh === true)
|
|
92
|
+
await service.refresh({ workspace: caller.workspace });
|
|
93
|
+
return service.listSessions(caller.workspace);
|
|
94
|
+
}
|
|
95
|
+
case "agent.connect": {
|
|
96
|
+
const caller = authenticateAgent(service, params);
|
|
97
|
+
return {
|
|
98
|
+
sessionId: caller.portalSessionId,
|
|
99
|
+
workspace: caller.workspace,
|
|
100
|
+
connected: true,
|
|
101
|
+
leaseSeconds: 120,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
case "agent.disconnect":
|
|
105
|
+
service.disconnectSession(requiredString(params.sessionId, "sessionId"), requiredString(params.token, "token"));
|
|
106
|
+
return { disconnected: true };
|
|
107
|
+
case "managed.finish":
|
|
108
|
+
service.finishManagedSession(requiredString(params.sessionId, "sessionId"), requiredString(params.token, "token"));
|
|
109
|
+
return { finished: true };
|
|
110
|
+
case "managed.bind":
|
|
111
|
+
return service.bindManagedSession(requiredString(params.sessionId, "sessionId"), requiredString(params.token, "token"), requiredString(params.vendorSessionId, "vendorSessionId"));
|
|
112
|
+
case "managed.runner.next":
|
|
113
|
+
return service.nextRunnerMessage(requiredString(params.sessionId, "sessionId"), requiredString(params.token, "token"), optionalInteger(params.waitMs, "waitMs") ?? 25_000);
|
|
114
|
+
case "managed.runner.received":
|
|
115
|
+
return service.runnerMessageReceived(requiredString(params.sessionId, "sessionId"), requiredString(params.token, "token"), requiredString(params.messageId, "messageId"), requiredString(params.turnId, "turnId"));
|
|
116
|
+
case "managed.runner.starting":
|
|
117
|
+
return service.runnerMessageStarting(requiredString(params.sessionId, "sessionId"), requiredString(params.token, "token"), requiredString(params.messageId, "messageId"));
|
|
118
|
+
case "managed.runner.heartbeat":
|
|
119
|
+
return service.heartbeatRunner(requiredString(params.sessionId, "sessionId"), requiredString(params.token, "token"));
|
|
120
|
+
case "managed.runner.completed": {
|
|
121
|
+
const completion = service.runnerMessageCompleted(requiredString(params.sessionId, "sessionId"), requiredString(params.token, "token"), requiredString(params.messageId, "messageId"), {
|
|
122
|
+
turnId: requiredString(params.turnId, "turnId"),
|
|
123
|
+
answer: nullableString(params.answer, "answer"),
|
|
124
|
+
toolResults: unknownArray(params.toolResults, "toolResults"),
|
|
125
|
+
});
|
|
126
|
+
await tasks?.runnerCompleted(completion);
|
|
127
|
+
return completion;
|
|
128
|
+
}
|
|
129
|
+
case "managed.runner.failed": {
|
|
130
|
+
const completion = service.runnerMessageFailed(requiredString(params.sessionId, "sessionId"), requiredString(params.token, "token"), requiredString(params.messageId, "messageId"), requiredString(params.error, "error"));
|
|
131
|
+
await tasks?.runnerFailed(completion);
|
|
132
|
+
return completion;
|
|
133
|
+
}
|
|
134
|
+
case "managed.runner.disconnect":
|
|
135
|
+
service.disconnectRunner(requiredString(params.sessionId, "sessionId"), requiredString(params.token, "token"));
|
|
136
|
+
return { disconnected: true };
|
|
137
|
+
case "managed.remote.register": {
|
|
138
|
+
const caller = authenticateAgent(service, params);
|
|
139
|
+
if (remote === undefined)
|
|
140
|
+
throw new Error("remote Portal networking is unavailable");
|
|
141
|
+
return remote.advertise({
|
|
142
|
+
serverUrl: requiredString(params.serverUrl, "serverUrl"),
|
|
143
|
+
sessionId: caller.portalSessionId,
|
|
144
|
+
agentName: requiredString(params.agentName, "agentName"),
|
|
145
|
+
provider: caller.provider,
|
|
146
|
+
description: optionalString(params.description) ?? `${requiredString(params.agentName, "agentName")} ${caller.provider} agent`,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
case "managed.remote.unregister": {
|
|
150
|
+
const caller = authenticateAgent(service, params);
|
|
151
|
+
if (remote === undefined)
|
|
152
|
+
throw new Error("remote Portal networking is unavailable");
|
|
153
|
+
const serverUrl = remote.serverForSession(caller.portalSessionId);
|
|
154
|
+
if (serverUrl !== null)
|
|
155
|
+
await remote.unadvertise(serverUrl, caller.portalSessionId);
|
|
156
|
+
return { unregistered: true };
|
|
157
|
+
}
|
|
158
|
+
case "agent.peers": {
|
|
159
|
+
const caller = authenticateAgent(service, params);
|
|
160
|
+
if (remote === undefined)
|
|
161
|
+
throw new Error("remote Portal networking is unavailable");
|
|
162
|
+
const capability = optionalCapability(params.capability);
|
|
163
|
+
const limit = optionalInteger(params.limit, "limit");
|
|
164
|
+
const query = optionalString(params.query);
|
|
165
|
+
return remote.discoverForSession(caller.portalSessionId, {
|
|
166
|
+
...(query === undefined ? {} : { query }),
|
|
167
|
+
...(capability === undefined ? {} : { capability }),
|
|
168
|
+
...(limit === undefined ? {} : { limit }),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
case "agent.delegate": {
|
|
172
|
+
const caller = authenticateAgent(service, params);
|
|
173
|
+
if (tasks === undefined)
|
|
174
|
+
throw new Error("remote Portal tasks are unavailable");
|
|
175
|
+
const ttlSeconds = optionalInteger(params.ttlSeconds, "ttlSeconds");
|
|
176
|
+
const context = optionalString(params.context);
|
|
177
|
+
const expectedResult = optionalString(params.expectedResult);
|
|
178
|
+
return tasks.delegate({
|
|
179
|
+
senderSessionId: caller.portalSessionId,
|
|
180
|
+
target: requiredString(params.target, "target"),
|
|
181
|
+
objective: requiredString(params.objective, "objective"),
|
|
182
|
+
...(context === undefined ? {} : { context }),
|
|
183
|
+
...(expectedResult === undefined ? {} : { expectedResult }),
|
|
184
|
+
...(ttlSeconds === undefined ? {} : { ttlSeconds }),
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
case "agent.task.update": {
|
|
188
|
+
const caller = authenticateAgent(service, params);
|
|
189
|
+
if (tasks === undefined)
|
|
190
|
+
throw new Error("remote Portal tasks are unavailable");
|
|
191
|
+
return tasks.update(caller.portalSessionId, requiredString(params.taskId, "taskId"), remoteTaskUpdate(params));
|
|
192
|
+
}
|
|
193
|
+
case "agent.recall": {
|
|
194
|
+
const caller = authenticateAgent(service, params);
|
|
195
|
+
if (caller.workspace === null)
|
|
196
|
+
throw new Error("calling session has no workspace");
|
|
197
|
+
const providers = optionalProviders(params.providers);
|
|
198
|
+
const limit = optionalInteger(params.limit, "limit");
|
|
199
|
+
return service.recall(requiredString(params.query, "query"), {
|
|
200
|
+
workspace: caller.workspace,
|
|
201
|
+
...(providers === undefined ? {} : { providers }),
|
|
202
|
+
...(limit === undefined ? {} : { limit }),
|
|
203
|
+
refresh: params.refresh !== false,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
case "agent.send": {
|
|
207
|
+
const caller = authenticateAgent(service, params);
|
|
208
|
+
if (caller.workspace === null)
|
|
209
|
+
throw new Error("calling session has no workspace");
|
|
210
|
+
const targetReference = optionalString(params.target);
|
|
211
|
+
const idempotencyKey = optionalString(params.idempotencyKey);
|
|
212
|
+
const replyTo = optionalString(params.replyTo);
|
|
213
|
+
const body = requiredString(params.body, "body");
|
|
214
|
+
const local = await service.send({
|
|
215
|
+
senderSessionId: caller.portalSessionId,
|
|
216
|
+
body,
|
|
217
|
+
...(targetReference === undefined ? {} : { targetReference }),
|
|
218
|
+
...(idempotencyKey === undefined ? {} : { idempotencyKey }),
|
|
219
|
+
...(replyTo === undefined ? {} : { replyTo }),
|
|
220
|
+
});
|
|
221
|
+
if (local.delivery !== "not_sent" || targetReference === undefined || tasks === undefined)
|
|
222
|
+
return local;
|
|
223
|
+
return tasks.delegate({
|
|
224
|
+
senderSessionId: caller.portalSessionId,
|
|
225
|
+
target: targetReference,
|
|
226
|
+
objective: body,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
case "agent.inbox": {
|
|
230
|
+
const caller = authenticateAgent(service, params);
|
|
231
|
+
return service.receiveInbox(caller.portalSessionId, optionalStrings(params.acknowledge, "acknowledge") ?? []);
|
|
232
|
+
}
|
|
233
|
+
default:
|
|
234
|
+
throw new Error(`Unknown RPC method: ${request.method}`);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function requireControlToken(params, expected) {
|
|
239
|
+
const provided = params.controlToken;
|
|
240
|
+
const expectedBytes = Buffer.from(expected);
|
|
241
|
+
const providedBytes = typeof provided === "string" ? Buffer.from(provided) : Buffer.alloc(expectedBytes.length);
|
|
242
|
+
if (providedBytes.length !== expectedBytes.length || !timingSafeEqual(providedBytes, expectedBytes)) {
|
|
243
|
+
throw new Error("invalid Portal control credential");
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function authenticateAgent(service, params) {
|
|
247
|
+
return service.authenticateSession(requiredString(params.sessionId, "sessionId"), requiredString(params.token, "token"));
|
|
248
|
+
}
|
|
249
|
+
function record(value) {
|
|
250
|
+
if (value === undefined)
|
|
251
|
+
return {};
|
|
252
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
253
|
+
throw new TypeError("RPC params must be an object");
|
|
254
|
+
}
|
|
255
|
+
return value;
|
|
256
|
+
}
|
|
257
|
+
function requiredString(value, name) {
|
|
258
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
259
|
+
throw new TypeError(`${name} must be a non-empty string`);
|
|
260
|
+
}
|
|
261
|
+
return value;
|
|
262
|
+
}
|
|
263
|
+
function optionalString(value) {
|
|
264
|
+
if (value === undefined || value === null)
|
|
265
|
+
return undefined;
|
|
266
|
+
if (typeof value !== "string" || value.trim().length === 0)
|
|
267
|
+
throw new TypeError("expected a non-empty string");
|
|
268
|
+
return value;
|
|
269
|
+
}
|
|
270
|
+
function nullableString(value, name) {
|
|
271
|
+
if (value === null || value === undefined)
|
|
272
|
+
return null;
|
|
273
|
+
if (typeof value !== "string")
|
|
274
|
+
throw new TypeError(`${name} must be a string or null`);
|
|
275
|
+
return value;
|
|
276
|
+
}
|
|
277
|
+
function unknownArray(value, name) {
|
|
278
|
+
if (!Array.isArray(value))
|
|
279
|
+
throw new TypeError(`${name} must be an array`);
|
|
280
|
+
return value;
|
|
281
|
+
}
|
|
282
|
+
function optionalProviders(value) {
|
|
283
|
+
if (value === undefined || value === null)
|
|
284
|
+
return undefined;
|
|
285
|
+
if (!Array.isArray(value) || value.some((provider) => provider !== "codex" && provider !== "claude")) {
|
|
286
|
+
throw new TypeError("providers must contain only codex or claude");
|
|
287
|
+
}
|
|
288
|
+
return [...new Set(value)];
|
|
289
|
+
}
|
|
290
|
+
function optionalStrings(value, name) {
|
|
291
|
+
if (value === undefined || value === null)
|
|
292
|
+
return undefined;
|
|
293
|
+
if (!Array.isArray(value) || value.some((item) => typeof item !== "string" || item.trim().length === 0)) {
|
|
294
|
+
throw new TypeError(`${name} must contain only non-empty strings`);
|
|
295
|
+
}
|
|
296
|
+
return [...new Set(value)];
|
|
297
|
+
}
|
|
298
|
+
function requiredProvider(value) {
|
|
299
|
+
if (value !== "codex" && value !== "claude")
|
|
300
|
+
throw new TypeError("provider must be codex or claude");
|
|
301
|
+
return value;
|
|
302
|
+
}
|
|
303
|
+
function optionalInteger(value, name) {
|
|
304
|
+
if (value === undefined || value === null)
|
|
305
|
+
return undefined;
|
|
306
|
+
if (!Number.isInteger(value))
|
|
307
|
+
throw new TypeError(`${name} must be an integer`);
|
|
308
|
+
return value;
|
|
309
|
+
}
|
|
310
|
+
function optionalCapability(value) {
|
|
311
|
+
if (value === undefined || value === null)
|
|
312
|
+
return undefined;
|
|
313
|
+
if (value !== "message" && value !== "task")
|
|
314
|
+
throw new TypeError("capability must be message or task");
|
|
315
|
+
return value;
|
|
316
|
+
}
|
|
317
|
+
function remoteTaskUpdate(params) {
|
|
318
|
+
const action = requiredString(params.action, "action");
|
|
319
|
+
switch (action) {
|
|
320
|
+
case "accepted": {
|
|
321
|
+
const message = optionalString(params.message);
|
|
322
|
+
return { action, ...(message === undefined ? {} : { message }) };
|
|
323
|
+
}
|
|
324
|
+
case "declined": {
|
|
325
|
+
const reason = optionalString(params.reason);
|
|
326
|
+
return { action, ...(reason === undefined ? {} : { reason }) };
|
|
327
|
+
}
|
|
328
|
+
case "running": {
|
|
329
|
+
const message = optionalString(params.message);
|
|
330
|
+
return { action, ...(message === undefined ? {} : { message }) };
|
|
331
|
+
}
|
|
332
|
+
case "progress": return { action, message: requiredString(params.message, "message") };
|
|
333
|
+
case "question": return { action, question: requiredString(params.question, "question") };
|
|
334
|
+
case "answer": return { action, answer: requiredString(params.answer, "answer") };
|
|
335
|
+
case "completed": {
|
|
336
|
+
const artifactReferences = optionalStrings(params.artifactReferences, "artifactReferences");
|
|
337
|
+
return {
|
|
338
|
+
action,
|
|
339
|
+
result: requiredString(params.result, "result"),
|
|
340
|
+
...(artifactReferences === undefined ? {} : { artifactReferences }),
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
case "failed": return { action, error: requiredString(params.error, "error") };
|
|
344
|
+
default: throw new TypeError("action must be accepted, declined, running, progress, question, answer, completed, or failed");
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function optionalDate(value, name) {
|
|
348
|
+
if (value === undefined || value === null)
|
|
349
|
+
return undefined;
|
|
350
|
+
if (typeof value !== "string")
|
|
351
|
+
throw new TypeError(`${name} must be an ISO date string`);
|
|
352
|
+
const date = new Date(value);
|
|
353
|
+
if (Number.isNaN(date.getTime()))
|
|
354
|
+
throw new TypeError(`${name} must be an ISO date string`);
|
|
355
|
+
return date;
|
|
356
|
+
}
|
|
357
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@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AAE,kBAAkB,EAAE,CAAC;aACpE,CAAC;QACJ,CAAC;QACD,KAAK,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;QAC/E,SAAS,MAAM,IAAI,SAAS,CAAC,8FAA8F,CAAC,CAAC;IAC/H,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAAc,EAAE,IAAY;IAChD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,6BAA6B,CAAC,CAAC;IACzF,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,6BAA6B,CAAC,CAAC;IAC5F,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import type { ProviderName } from "./provider/types.js";
|
|
3
|
+
export declare function main(argv?: string[]): Promise<number>;
|
|
4
|
+
export interface ManagedAgentArguments {
|
|
5
|
+
provider: ProviderName;
|
|
6
|
+
cwd: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
server?: string;
|
|
9
|
+
prompt?: string;
|
|
10
|
+
providerArgs: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare function parseRunArguments(args: string[]): ManagedAgentArguments;
|
|
13
|
+
export declare function normalizeRemoteServerUrl(value: string): string;
|
|
14
|
+
export declare function parseListenAddress(value: string): {
|
|
15
|
+
host: string;
|
|
16
|
+
port: number;
|
|
17
|
+
};
|