@intentic/sandbox-contract 1.157.0 → 1.159.0
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/dist/agent-catalog.d.ts +9 -0
- package/dist/agent-catalog.d.ts.map +1 -1
- package/dist/agent-catalog.js +13 -1
- package/dist/agent-catalog.js.map +1 -1
- package/dist/contracts/agent.contract.d.ts +55 -2
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.d.ts +53 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/automations.contract.d.ts +7 -0
- package/dist/contracts/automations.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +20 -4
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.d.ts +5 -0
- package/dist/contracts/workspace.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.js +2 -1
- package/dist/contracts/workspace.contract.js.map +1 -1
- package/dist/events.d.ts +76 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +5 -3
- package/dist/events.js.map +1 -1
- package/dist/hostnames.d.ts +2 -0
- package/dist/hostnames.d.ts.map +1 -1
- package/dist/hostnames.js +27 -1
- package/dist/hostnames.js.map +1 -1
- package/dist/index.d.ts +143 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/model-order.d.ts +10 -0
- package/dist/model-order.d.ts.map +1 -0
- package/dist/model-order.js +62 -0
- package/dist/model-order.js.map +1 -0
- package/dist/path-refs.d.ts +4 -0
- package/dist/path-refs.d.ts.map +1 -0
- package/dist/path-refs.js +18 -0
- package/dist/path-refs.js.map +1 -0
- package/dist/routes.d.ts +8 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +39 -0
- package/dist/routes.js.map +1 -0
- package/dist/schemas.d.ts +60 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +27 -3
- package/dist/schemas.js.map +1 -1
- package/package.json +2 -2
- package/src/agent-catalog.ts +45 -1
- package/src/contracts/workspace.contract.ts +6 -0
- package/src/events.ts +42 -5
- package/src/hostnames.test.ts +22 -0
- package/src/hostnames.ts +40 -1
- package/src/index.ts +15 -0
- package/src/model-order.test.ts +137 -0
- package/src/model-order.ts +140 -0
- package/src/path-refs.test.ts +42 -0
- package/src/path-refs.ts +43 -0
- package/src/routes.test.ts +83 -0
- package/src/routes.ts +84 -0
- package/src/schemas.ts +63 -5
package/src/schemas.ts
CHANGED
|
@@ -54,6 +54,24 @@ export type EditorContext = z.infer<typeof EditorContextSchema>;
|
|
|
54
54
|
// and filesystem paths — the regex is the injection guard. Shared by the turn input and the attach input.
|
|
55
55
|
const ConversationIdSchema = z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/);
|
|
56
56
|
|
|
57
|
+
// Where a conversation came from when nobody typed it into the browser: an automation wake carrying a message
|
|
58
|
+
// from OUTSIDE the sandbox (a Discord mention, a web-chat visitor, a webhook). Such a wake runs as an ordinary
|
|
59
|
+
// isolated conversation — registry entry, worktree, chat tab, land flow — and this is the only thing that
|
|
60
|
+
// distinguishes it on the surface: the card's provenance line and the reason its first prompt is not the
|
|
61
|
+
// user's. Set daemon-side by the dispatcher that received the message; the browser never sends one.
|
|
62
|
+
export const AgentOriginSchema = z.object({
|
|
63
|
+
// The automation whose configured prompt opened the conversation.
|
|
64
|
+
automationId: z.string(),
|
|
65
|
+
// The listener provider that received the message ("discord", "webchat", …) or "webhook" for an event
|
|
66
|
+
// trigger. An open string for the same reason Trigger.provider is: sources are extension-declared.
|
|
67
|
+
provider: z.string(),
|
|
68
|
+
// The external thread it arrived on — a Discord channel id, a widget conversation id. Absent for webhooks.
|
|
69
|
+
channelId: z.string().optional(),
|
|
70
|
+
// Who sent it, as the source names them.
|
|
71
|
+
author: z.string().optional(),
|
|
72
|
+
});
|
|
73
|
+
export type AgentOrigin = z.infer<typeof AgentOriginSchema>;
|
|
74
|
+
|
|
57
75
|
// How tool calls are gated — the Claude Agent SDK's PermissionMode, narrowed to the four the composer offers
|
|
58
76
|
// (the SDK also has 'dontAsk'/'auto', which have no UI here). The user picks one per turn AND the agent can
|
|
59
77
|
// move itself between them mid-turn, so this is both a turn input and the payload of the `mode` frame.
|
|
@@ -89,6 +107,10 @@ export const AgentTurnSchema = z
|
|
|
89
107
|
// When true, the turn runs in the conversation's isolated git worktree (created lazily on first use)
|
|
90
108
|
// instead of the shared /work tree — the parallel-agents mode. Requires conversationId.
|
|
91
109
|
isolated: z.boolean().optional(),
|
|
110
|
+
// Set ONLY by the daemon's own automation dispatchers: this turn opens a conversation on behalf of an
|
|
111
|
+
// outside message rather than a user. Recorded on the registry entry so the fleet can say where the
|
|
112
|
+
// agent came from. Requires conversationId — there is nothing to record it on otherwise.
|
|
113
|
+
origin: AgentOriginSchema.optional(),
|
|
92
114
|
// The client-held transcript of a conversation that just switched provider/account: seeds the FIRST
|
|
93
115
|
// turn of the replacement session. The daemon folds it into the prompt as one role-attributed context
|
|
94
116
|
// preamble for every runtime. Mutually exclusive with sessionId — a resumed session has its context.
|
|
@@ -114,6 +136,9 @@ export const AgentTurnSchema = z
|
|
|
114
136
|
})
|
|
115
137
|
.refine((turn) => turn.isolated !== true || turn.conversationId !== undefined, {
|
|
116
138
|
message: "isolated requires conversationId",
|
|
139
|
+
})
|
|
140
|
+
.refine((turn) => turn.origin === undefined || turn.conversationId !== undefined, {
|
|
141
|
+
message: "origin requires conversationId",
|
|
117
142
|
});
|
|
118
143
|
export type AgentTurn = z.infer<typeof AgentTurnSchema>;
|
|
119
144
|
|
|
@@ -169,6 +194,9 @@ export const AgentSummarySchema = z.object({
|
|
|
169
194
|
account: z.string().optional(),
|
|
170
195
|
// The worktree branch (agent/<id>); absent for a non-isolated (main-tree) conversation.
|
|
171
196
|
branch: z.string().optional(),
|
|
197
|
+
// Present when the conversation was opened by an outside message rather than by the user (see
|
|
198
|
+
// AgentOriginSchema) — the card's provenance line. Absent ⇒ the user started it.
|
|
199
|
+
origin: AgentOriginSchema.optional(),
|
|
172
200
|
// The ROOT repo's short base sha — the checkout moment's display identity. Per-repo bases stay
|
|
173
201
|
// daemon-internal (agents.diff already reports against them).
|
|
174
202
|
base: z.string().optional(),
|
|
@@ -200,7 +228,12 @@ export const AgentSummarySchema = z.object({
|
|
|
200
228
|
archivedAt: z.number().optional(),
|
|
201
229
|
});
|
|
202
230
|
export type AgentSummary = z.infer<typeof AgentSummarySchema>;
|
|
203
|
-
|
|
231
|
+
// `rev` is the registry revision this roster was read at — a counter the daemon bumps on every registry change.
|
|
232
|
+
// It is what makes the browser's optimistic writes safe: the fleet is published as full snapshots (last frame
|
|
233
|
+
// wins), so without an ordering stamp a roster READ before a mutation but delivered after it silently puts the
|
|
234
|
+
// mutated agents back. The browser drops any roster older than the newest it has applied, and holds its own
|
|
235
|
+
// pending change until a roster at or past the revision that applied it arrives. See useAgents.ts.
|
|
236
|
+
export const AgentsListSchema = z.object({ agents: z.array(AgentSummarySchema), rev: z.number() });
|
|
204
237
|
export const AgentIdSchema = z.object({ id: z.string().min(1) });
|
|
205
238
|
// archive's input: the agents to take off the board. Absent `ids` ⇒ every finished agent that is archivable
|
|
206
239
|
// right now (the lane header's "Clear"); unarchive always names its ids (a restore, or a bulk archive's undo).
|
|
@@ -211,7 +244,9 @@ export const AgentIdsSchema = z.object({ ids: z.array(z.string().min(1)).min(1).
|
|
|
211
244
|
// the slower response resurrect what the faster one just filed away — a delta composes where a snapshot races.
|
|
212
245
|
// Whole summaries rather than ids because the receiving side has to SHOW them (the archive list, and the agent
|
|
213
246
|
// detail page addressed by id); the ids "Undo" needs come off them for free.
|
|
214
|
-
|
|
247
|
+
// The agents an archive/unarchive actually moved, plus the registry revision that applied the move — the
|
|
248
|
+
// browser holds its optimistic add/remove of exactly these ids until it sees a roster at or past `rev`.
|
|
249
|
+
export const AgentsMovedSchema = z.object({ moved: z.array(AgentSummarySchema), rev: z.number() });
|
|
215
250
|
export type AgentsMoved = z.infer<typeof AgentsMovedSchema>;
|
|
216
251
|
// rename's input: the user-chosen display title (bounded like sanitizeTitle's cap).
|
|
217
252
|
export const AgentRenameSchema = z.object({ id: z.string().min(1), title: z.string().trim().min(1).max(80) });
|
|
@@ -276,8 +311,20 @@ export const AgentReplySchema = z.discriminatedUnion("kind", [
|
|
|
276
311
|
export type AgentReply = z.infer<typeof AgentReplySchema>;
|
|
277
312
|
// Steering: a user message delivered INTO the running turn (injected between tool calls, Claude Code style),
|
|
278
313
|
// keyed by the conversation whose turn is in flight. NOT_FOUND when no steerable turn is running — the client
|
|
279
|
-
// then
|
|
280
|
-
|
|
314
|
+
// then holds the message in its queue and sends it as the next turn instead. Carries everything a turn's own
|
|
315
|
+
// prompt can carry (files, the editor-context chip), because "add more while it works" is worth nothing if it
|
|
316
|
+
// only takes bare text: the daemon folds the same notes into the injected message that a fresh turn gets.
|
|
317
|
+
export const SteerSchema = z
|
|
318
|
+
.object({
|
|
319
|
+
conversationId: z.string().min(1),
|
|
320
|
+
text: z.string().max(20_000),
|
|
321
|
+
attachments: z.array(z.string().min(1)).max(20).optional(),
|
|
322
|
+
editorContext: EditorContextSchema.optional(),
|
|
323
|
+
})
|
|
324
|
+
// An attachment-only steer (a screenshot dropped in mid-turn) is legal; an entirely empty one is not.
|
|
325
|
+
.refine((steer) => steer.text.trim().length > 0 || (steer.attachments?.length ?? 0) > 0, {
|
|
326
|
+
message: "text or attachments required",
|
|
327
|
+
});
|
|
281
328
|
// True cancel for the conversation's in-flight turn — aborts the agent daemon-side, unlike closing the
|
|
282
329
|
// /agent fetch (which sends no cancel frame).
|
|
283
330
|
export const StopTurnSchema = z.object({ conversationId: z.string().min(1) });
|
|
@@ -783,6 +830,12 @@ export const WorkspaceChildrenSchema = z.object({
|
|
|
783
830
|
export type WorkspaceChildren = z.infer<typeof WorkspaceChildrenSchema>;
|
|
784
831
|
export const WorkspaceFileQuerySchema = z.object({ path: z.string().min(1) });
|
|
785
832
|
export const WorkspaceFileSchema = z.object({ path: z.string(), content: z.string() });
|
|
833
|
+
// Resolve a file reference an agent (or a compiler, or a terminal) NAMED to the workspace path it means. Prose
|
|
834
|
+
// paths are routinely partial — a model that has been discussing `_apps/web/src` writes
|
|
835
|
+
// `pages/workspace/Foo.vue` — so a clickable mention has to be matched as a path SUFFIX against the real tree,
|
|
836
|
+
// not read as root-relative. `path` is absent when nothing in the workspace ends in that reference.
|
|
837
|
+
export const WorkspaceResolveQuerySchema = z.object({ path: z.string().min(1).max(512) });
|
|
838
|
+
export const WorkspaceResolveSchema = z.object({ path: z.string().optional() });
|
|
786
839
|
// Direct file management over the /work tree (delete / new folder / rename+move / copy). Byte writes + the
|
|
787
840
|
// editor's text save go through the plain POST /workspace/upload route (a body doesn't fit oRPC), not here.
|
|
788
841
|
export const WorkspaceDirSchema = z.object({ path: z.string().min(1) });
|
|
@@ -1534,6 +1587,10 @@ export const AutomationApprovalSchema = z.object({
|
|
|
1534
1587
|
automationId: z.string(),
|
|
1535
1588
|
// The event/listener payload the wake would have carried; absent for schedule triggers.
|
|
1536
1589
|
payload: z.string().optional(),
|
|
1590
|
+
// The provenance + title the held wake would have opened its conversation with — snapshotted alongside the
|
|
1591
|
+
// payload so an approved external wake surfaces on the fleet exactly as an auto one would have.
|
|
1592
|
+
origin: AgentOriginSchema.optional(),
|
|
1593
|
+
title: z.string().optional(),
|
|
1537
1594
|
createdAt: z.number(),
|
|
1538
1595
|
});
|
|
1539
1596
|
export type AutomationApproval = z.infer<typeof AutomationApprovalSchema>;
|
|
@@ -1684,7 +1741,8 @@ export type PortForwardResult = z.infer<typeof PortForwardResultSchema>;
|
|
|
1684
1741
|
// is the /system/terminal WebSocket, not oRPC): `shell` = a web-* session the user opened (numbered pill),
|
|
1685
1742
|
// `panel` = a panel-* dev-server session (labeled by its panel key, started via Start; running:false =
|
|
1686
1743
|
// untracked, e.g. a finished one-shot job's lingering shell), `agent` = an agent-* session the Claude agent's
|
|
1687
|
-
// Bash commands run in (live-watchable, AI-marked in the UI
|
|
1744
|
+
// Bash commands run in (live-watchable, AI-marked in the UI; running:false once every window is a finished
|
|
1745
|
+
// command's dead pane, which is what lets the panel sweep it), `job` = a job-* session the daemon's terminal
|
|
1688
1746
|
// runner executes user-triggered flows in (capability adds, infra check), `process` = a managed background
|
|
1689
1747
|
// process riding a panel session (an extension's declared processes, dockerd) — surfaced in the panel's
|
|
1690
1748
|
// background-processes popover with read-only log views, never as a killable tab; running is the actual
|