@intentic/sandbox-contract 1.408.0 → 1.409.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/contracts/agent.contract.d.ts +54 -0
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.d.ts +12 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/automations.contract.d.ts.map +1 -1
- package/dist/contracts/automations.contract.js +1 -0
- package/dist/contracts/automations.contract.js.map +1 -1
- package/dist/contracts/capabilities.contract.d.ts +508 -0
- package/dist/contracts/capabilities.contract.d.ts.map +1 -1
- package/dist/contracts/capabilities.contract.js +74 -1
- package/dist/contracts/capabilities.contract.js.map +1 -1
- package/dist/contracts/device.contract.d.ts +23 -0
- package/dist/contracts/device.contract.d.ts.map +1 -1
- package/dist/contracts/extensions.contract.d.ts +350 -4
- package/dist/contracts/extensions.contract.d.ts.map +1 -1
- package/dist/contracts/needs.contract.d.ts +9 -0
- package/dist/contracts/needs.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +288 -250
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/sessions.contract.d.ts +6 -0
- package/dist/contracts/sessions.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +27 -0
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/events/agent-events.d.ts +26 -0
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/agent-events.js +3 -0
- package/dist/events/agent-events.js.map +1 -1
- package/dist/events/agent-transcript.d.ts +6 -0
- package/dist/events/agent-transcript.d.ts.map +1 -1
- package/dist/events/prompt-origins.d.ts +54 -0
- package/dist/events/prompt-origins.d.ts.map +1 -0
- package/dist/events/prompt-origins.js +44 -0
- package/dist/events/prompt-origins.js.map +1 -0
- package/dist/events/transcript.d.ts +31 -45
- package/dist/events/transcript.d.ts.map +1 -1
- package/dist/events/transcript.js +3 -27
- package/dist/events/transcript.js.map +1 -1
- package/dist/netd/generated/wire.d.ts +4 -0
- package/dist/netd/generated/wire.d.ts.map +1 -1
- package/dist/oauth/google-workspace.d.ts +4 -0
- package/dist/oauth/google-workspace.d.ts.map +1 -0
- package/dist/oauth/google-workspace.js +6 -0
- package/dist/oauth/google-workspace.js.map +1 -0
- package/dist/policy/failure-codes.d.ts +4 -0
- package/dist/policy/failure-codes.d.ts.map +1 -1
- package/dist/policy/failure-codes.js +1 -0
- package/dist/policy/failure-codes.js.map +1 -1
- package/dist/policy/git/git-connections.d.ts +15 -0
- package/dist/policy/git/git-connections.d.ts.map +1 -0
- package/dist/policy/git/git-connections.js +34 -0
- package/dist/policy/git/git-connections.js.map +1 -0
- package/dist/policy/org-locks.d.ts +1 -1
- package/dist/policy/org-locks.d.ts.map +1 -1
- package/dist/policy/org-locks.js +1 -0
- package/dist/policy/org-locks.js.map +1 -1
- package/dist/protocol/doors/runner-protocol.d.ts.map +1 -1
- package/dist/protocol/doors/runner-protocol.js.map +1 -1
- package/dist/protocol/raw/raw-json-routes.d.ts +121 -0
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-json-routes.js +6 -1
- package/dist/protocol/raw/raw-json-routes.js.map +1 -1
- package/dist/protocol/raw/raw-routes.d.ts +27 -0
- package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.js +7 -0
- package/dist/protocol/raw/raw-routes.js.map +1 -1
- package/dist/schemas/capabilities.d.ts +8 -16
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/capabilities.js +12 -39
- package/dist/schemas/capabilities.js.map +1 -1
- package/dist/schemas/certificate-request.d.ts +38 -0
- package/dist/schemas/certificate-request.d.ts.map +1 -0
- package/dist/schemas/certificate-request.js +18 -0
- package/dist/schemas/certificate-request.js.map +1 -0
- package/dist/schemas/device-move.d.ts +46 -0
- package/dist/schemas/device-move.d.ts.map +1 -0
- package/dist/schemas/device-move.js +34 -0
- package/dist/schemas/device-move.js.map +1 -0
- package/dist/schemas/device-sign-in.d.ts +25 -0
- package/dist/schemas/device-sign-in.d.ts.map +1 -0
- package/dist/schemas/device-sign-in.js +24 -0
- package/dist/schemas/device-sign-in.js.map +1 -0
- package/dist/schemas/devices.d.ts +50 -0
- package/dist/schemas/devices.d.ts.map +1 -1
- package/dist/schemas/devices.js +6 -0
- package/dist/schemas/devices.js.map +1 -1
- package/dist/schemas/extension-updates.d.ts +700 -8
- package/dist/schemas/extension-updates.d.ts.map +1 -1
- package/dist/schemas/git/remote-refs.d.ts +1 -0
- package/dist/schemas/git/remote-refs.d.ts.map +1 -1
- package/dist/schemas/git/remote-refs.js +5 -0
- package/dist/schemas/git/remote-refs.js.map +1 -1
- package/dist/schemas/git-installs.d.ts +20 -0
- package/dist/schemas/git-installs.d.ts.map +1 -0
- package/dist/schemas/git-installs.js +46 -0
- package/dist/schemas/git-installs.js.map +1 -0
- package/dist/schemas/hosts.d.ts +2 -0
- package/dist/schemas/hosts.d.ts.map +1 -1
- package/dist/schemas/hosts.js +2 -0
- package/dist/schemas/hosts.js.map +1 -1
- package/dist/schemas/links.d.ts +89 -0
- package/dist/schemas/links.d.ts.map +1 -1
- package/dist/schemas/links.js +72 -0
- package/dist/schemas/links.js.map +1 -1
- package/dist/schemas/mcp-sign-in.d.ts +46 -0
- package/dist/schemas/mcp-sign-in.d.ts.map +1 -0
- package/dist/schemas/mcp-sign-in.js +54 -0
- package/dist/schemas/mcp-sign-in.js.map +1 -0
- package/dist/schemas/needs.d.ts +8 -0
- package/dist/schemas/needs.d.ts.map +1 -1
- package/dist/schemas/needs.js +5 -1
- package/dist/schemas/needs.js.map +1 -1
- package/dist/schemas/system.d.ts +4 -0
- package/dist/schemas/system.d.ts.map +1 -1
- package/dist/schemas/system.js +4 -0
- package/dist/schemas/system.js.map +1 -1
- package/dist/state/definition.d.ts +6 -0
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/text/mentions.d.ts +5 -0
- package/dist/text/mentions.d.ts.map +1 -1
- package/dist/text/mentions.js +15 -3
- package/dist/text/mentions.js.map +1 -1
- package/dist/text/transcript-fold.d.ts.map +1 -1
- package/dist/text/transcript-fold.js +4 -8
- package/dist/text/transcript-fold.js.map +1 -1
- package/package.json +5 -5
- package/src/contracts/automations.contract.ts +3 -0
- package/src/contracts/capabilities.contract.ts +98 -0
- package/src/events/agent-events.ts +5 -0
- package/src/events/prompt-origins.ts +65 -0
- package/src/events/transcript.ts +4 -40
- package/src/netd/generated/netd-wire.json +24 -0
- package/src/netd/generated/wire.ts +8 -2
- package/src/oauth/google-workspace.ts +16 -0
- package/src/policy/failure-codes.ts +1 -0
- package/src/policy/git/git-connections.test.ts +46 -0
- package/src/policy/git/git-connections.ts +68 -0
- package/src/policy/org-locks.ts +1 -0
- package/src/policy/tests/failure-codes.test.ts +3 -1
- package/src/protocol/doors/runner-protocol.ts +3 -1
- package/src/protocol/raw/raw-json-routes.ts +13 -0
- package/src/protocol/raw/raw-routes.ts +13 -0
- package/src/schemas/capabilities.ts +16 -58
- package/src/schemas/certificate-request.ts +28 -0
- package/src/schemas/device-move.ts +54 -0
- package/src/schemas/device-sign-in.ts +37 -0
- package/src/schemas/devices.ts +11 -0
- package/src/schemas/git/remote-refs.ts +7 -0
- package/src/schemas/git-installs.ts +72 -0
- package/src/schemas/hosts.ts +4 -0
- package/src/schemas/links.ts +106 -1
- package/src/schemas/mcp-sign-in.ts +72 -0
- package/src/schemas/needs.ts +8 -1
- package/src/schemas/system.ts +6 -0
- package/src/text/mentions.test.ts +16 -1
- package/src/text/mentions.ts +18 -4
- package/src/text/transcript-fold.test.ts +8 -0
- package/src/text/transcript-fold.ts +4 -8
package/src/schemas/links.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { SharedAccountRefSchema } from "./providers/account-sharing.js";
|
|
|
7
7
|
// `link` capability card (schemas/capabilities.ts LinkConfigSchema); the one that takes it holds an inbound link, minted
|
|
8
8
|
// by its owner, whose token is that card's credential. Everything the taking side does with a task is decided there, by
|
|
9
9
|
// the terms on its own link: which persona the work wears, whether each task waits for its owner, how many turns an hour.
|
|
10
|
-
// The handing side only asks, reads and stops.
|
|
10
|
+
// The handing side only asks, reads and stops, and operates this sandbox only while its terms say it may (`operate`).
|
|
11
11
|
|
|
12
12
|
// What a link token looks like: issuer-prefixed like a control token (`ict_`), and never the same credential.
|
|
13
13
|
export const LINK_TOKEN_PREFIX = "ilk_";
|
|
@@ -41,6 +41,11 @@ const recordsTerm = z
|
|
|
41
41
|
.describe(
|
|
42
42
|
"Whether the asking sandbox may read this sandbox's records without starting a turn: its conversations (every one but a private one) and their transcripts, its daemon's log and diagnostics. Read-only, and each read is logged here. For looking into a problem from the other sandbox; off unless its owner turns it on.",
|
|
43
43
|
);
|
|
44
|
+
const operateTerm = z
|
|
45
|
+
.boolean()
|
|
46
|
+
.describe(
|
|
47
|
+
"Whether the asking sandbox may operate this one as its owner does from their own terminal: run commands, and read and write files, in this sandbox's main checkout. They run as root, or, while conversations here can be private, inside the same jail every person's shell gets (the history volume out of reach). Anything the owner's terminal can do, including reading this sandbox's secrets. Every call is logged here. Off unless its owner turns it on.",
|
|
48
|
+
);
|
|
44
49
|
const accountsTerm = z
|
|
45
50
|
.array(SharedAccountRefSchema)
|
|
46
51
|
.max(64)
|
|
@@ -64,6 +69,7 @@ export const LinkTermsSchema = z.object({
|
|
|
64
69
|
turnsPerHour: turnsPerHourTerm.default(LINK_TURNS_PER_HOUR_DEFAULT),
|
|
65
70
|
tasks: tasksTerm.default(true),
|
|
66
71
|
records: recordsTerm.default(false),
|
|
72
|
+
operate: operateTerm.default(false),
|
|
67
73
|
accounts: accountsTerm.default([]),
|
|
68
74
|
});
|
|
69
75
|
export type LinkTerms = z.infer<typeof LinkTermsSchema>;
|
|
@@ -124,6 +130,7 @@ export const InboundLinkTermsUpdateSchema = z.object({
|
|
|
124
130
|
turnsPerHour: turnsPerHourTerm.optional(),
|
|
125
131
|
tasks: tasksTerm.optional(),
|
|
126
132
|
records: recordsTerm.optional(),
|
|
133
|
+
operate: operateTerm.optional(),
|
|
127
134
|
accounts: accountsTerm.optional(),
|
|
128
135
|
});
|
|
129
136
|
export type InboundLinkTermsUpdate = z.infer<typeof InboundLinkTermsUpdateSchema>;
|
|
@@ -146,6 +153,8 @@ export const LinkHelloSchema = z.object({
|
|
|
146
153
|
accounts: z.number().int().nonnegative().optional().describe("How many accounts the link may use."),
|
|
147
154
|
// Absent from a sandbox older than records over links, which shares none.
|
|
148
155
|
records: z.boolean().optional().describe("Whether the link may read this sandbox's records (its conversations, logs and diagnostics)."),
|
|
156
|
+
// Absent from a sandbox older than operating over links, which allows none.
|
|
157
|
+
operate: z.boolean().optional().describe("Whether the link may run commands and read and write files here, as this sandbox's owner would in their own terminal."),
|
|
149
158
|
}),
|
|
150
159
|
maxHops: z.number().int(),
|
|
151
160
|
});
|
|
@@ -223,3 +232,99 @@ export const LinkAnswerSchema = z.object({
|
|
|
223
232
|
answers: z.record(z.string(), z.array(z.string())),
|
|
224
233
|
});
|
|
225
234
|
export type LinkAnswer = z.infer<typeof LinkAnswerSchema>;
|
|
235
|
+
|
|
236
|
+
/* OPERATING OVER A LINK (schemas `operate`): the asking sandbox acting here as this sandbox's owner does in their own
|
|
237
|
+
terminal, while the link's terms allow it. Every door runs in the main checkout, as root or inside the jail a person's
|
|
238
|
+
shell gets while conversations here can be private, and answers `jailed` so the asking agent knows which. */
|
|
239
|
+
|
|
240
|
+
// The longest a command may run, and what it is given when the asking side names nothing.
|
|
241
|
+
export const LINK_EXEC_TIMEOUT_S_MAX = 600;
|
|
242
|
+
export const LINK_EXEC_TIMEOUT_S_DEFAULT = 120;
|
|
243
|
+
// How long one call may be held for a command to end: under every edge's own patience, so a long command is followed by
|
|
244
|
+
// reading it again (GET /link/operate/exec/{id}) rather than by one request held for minutes.
|
|
245
|
+
export const LINK_OPERATE_WAIT_S_MAX = 25;
|
|
246
|
+
// The most a written file may hold, and the most a command's input may carry.
|
|
247
|
+
export const LINK_WRITE_MAX_BYTES = 2_000_000;
|
|
248
|
+
|
|
249
|
+
const OperateFromSchema = z
|
|
250
|
+
.object({
|
|
251
|
+
conversation: z.string().max(100).optional(),
|
|
252
|
+
title: z.string().max(200).optional(),
|
|
253
|
+
})
|
|
254
|
+
.optional()
|
|
255
|
+
.describe("The asking conversation, for this sandbox's log of what the link did.");
|
|
256
|
+
|
|
257
|
+
const operatePath = z.string().min(1).max(4_096).describe("Absolute, or relative to the workspace root.");
|
|
258
|
+
|
|
259
|
+
// POST /link/operate/exec: one command line, run by bash as a login shell.
|
|
260
|
+
export const LinkExecSchema = z.object({
|
|
261
|
+
command: z.string().min(1).max(60_000),
|
|
262
|
+
cwd: operatePath.optional().describe("Where it runs: absolute, or relative to the workspace root, which is the default."),
|
|
263
|
+
timeoutS: z.number().int().min(1).max(LINK_EXEC_TIMEOUT_S_MAX).default(LINK_EXEC_TIMEOUT_S_DEFAULT),
|
|
264
|
+
waitS: z
|
|
265
|
+
.number()
|
|
266
|
+
.int()
|
|
267
|
+
.min(0)
|
|
268
|
+
.max(LINK_OPERATE_WAIT_S_MAX)
|
|
269
|
+
.default(LINK_OPERATE_WAIT_S_MAX)
|
|
270
|
+
.describe("How long this call may be held for the command to end; past it the answer says `running`."),
|
|
271
|
+
from: OperateFromSchema,
|
|
272
|
+
});
|
|
273
|
+
export type LinkExec = z.infer<typeof LinkExecSchema>;
|
|
274
|
+
|
|
275
|
+
// running: still going. exited: ended on its own (exitCode, or signal when something killed it). timeout: ended at its
|
|
276
|
+
// deadline. stopped: the asking side stopped it. failed: it could not start, or this sandbox could not place it.
|
|
277
|
+
export const LinkExecStateSchema = z.enum(["running", "exited", "timeout", "stopped", "failed"]);
|
|
278
|
+
export type LinkExecState = z.infer<typeof LinkExecStateSchema>;
|
|
279
|
+
|
|
280
|
+
export const LinkExecStatusSchema = z.object({
|
|
281
|
+
id: z.string().describe("The command's id here, to read it again or stop it."),
|
|
282
|
+
state: LinkExecStateSchema,
|
|
283
|
+
exitCode: z.number().int().optional(),
|
|
284
|
+
signal: z.string().optional(),
|
|
285
|
+
stdout: z.string().describe("Its standard output so far, the end kept when it ran long."),
|
|
286
|
+
stderr: z.string(),
|
|
287
|
+
truncated: z.boolean().describe("Whether either stream ran past what is kept, its beginning dropped."),
|
|
288
|
+
error: z.string().optional().describe("Why it could not start, when it could not."),
|
|
289
|
+
cwd: z.string(),
|
|
290
|
+
jailed: z.boolean().describe("Whether it ran inside the jail a person's shell gets here (no history volume), rather than as root."),
|
|
291
|
+
startedAt: z.number(),
|
|
292
|
+
endedAt: z.number().optional(),
|
|
293
|
+
});
|
|
294
|
+
export type LinkExecStatus = z.infer<typeof LinkExecStatusSchema>;
|
|
295
|
+
|
|
296
|
+
// POST /link/operate/read: a file's lines, or a directory's listing.
|
|
297
|
+
export const LinkReadSchema = z.object({
|
|
298
|
+
path: operatePath,
|
|
299
|
+
offset: z.number().int().min(1).optional().describe("The line to start from, counting from 1."),
|
|
300
|
+
limit: z.number().int().min(1).max(20_000).optional().describe("How many lines (default 2000)."),
|
|
301
|
+
from: OperateFromSchema,
|
|
302
|
+
});
|
|
303
|
+
export type LinkRead = z.infer<typeof LinkReadSchema>;
|
|
304
|
+
|
|
305
|
+
export const LinkReadAnswerSchema = z.object({
|
|
306
|
+
path: z.string(),
|
|
307
|
+
kind: z.enum(["file", "directory"]),
|
|
308
|
+
content: z.string().describe("The lines asked for, or the directory's `ls -la`."),
|
|
309
|
+
bytes: z.number().int().nonnegative().optional().describe("The file's whole size."),
|
|
310
|
+
lines: z.number().int().nonnegative().optional().describe("How many lines the whole file has."),
|
|
311
|
+
binary: z.boolean().optional().describe("The file is not text; `content` is empty."),
|
|
312
|
+
truncated: z.boolean().describe("Whether the file goes on past the lines answered (read on with `offset`), or the answer was cut at its size."),
|
|
313
|
+
jailed: z.boolean(),
|
|
314
|
+
});
|
|
315
|
+
export type LinkReadAnswer = z.infer<typeof LinkReadAnswerSchema>;
|
|
316
|
+
|
|
317
|
+
// POST /link/operate/write: a file's whole new contents, its folders made as needed.
|
|
318
|
+
export const LinkWriteSchema = z.object({
|
|
319
|
+
path: operatePath,
|
|
320
|
+
content: z.string().max(LINK_WRITE_MAX_BYTES),
|
|
321
|
+
from: OperateFromSchema,
|
|
322
|
+
});
|
|
323
|
+
export type LinkWrite = z.infer<typeof LinkWriteSchema>;
|
|
324
|
+
|
|
325
|
+
export const LinkWriteAnswerSchema = z.object({
|
|
326
|
+
path: z.string(),
|
|
327
|
+
bytes: z.number().int().nonnegative(),
|
|
328
|
+
jailed: z.boolean(),
|
|
329
|
+
});
|
|
330
|
+
export type LinkWriteAnswer = z.infer<typeof LinkWriteAnswerSchema>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
// Signing in to a remote MCP server that authenticates with OAuth (the MCP authorization spec: protected-resource
|
|
4
|
+
// metadata, authorization-server discovery, client registration, then an authorization code with PKCE). The sandbox
|
|
5
|
+
// runs every leg but the person's approval: the browser opens the authorization server's page and lands back on the
|
|
6
|
+
// sandbox's own callback, and the tokens never reach the browser. What the form gets back is a stash marker
|
|
7
|
+
// (`stashedMarker`, schemas/capabilities.ts) for the connection's `token`, the same way a generated SSH key arrives.
|
|
8
|
+
|
|
9
|
+
// POST /capabilities/mcp-auth: what an MCP URL asks of a client, read before anything is saved.
|
|
10
|
+
export const McpAuthCheckInputSchema = z.object({
|
|
11
|
+
url: z.url().describe("The MCP server's address, as the form holds it."),
|
|
12
|
+
});
|
|
13
|
+
export const McpAuthCheckSchema = z.object({
|
|
14
|
+
auth: z
|
|
15
|
+
.enum(["open", "token", "oauth", "unreachable"])
|
|
16
|
+
.describe(
|
|
17
|
+
"`open`: it answered without a credential. `token`: it refused one and names no sign-in, so it takes a token pasted from its own settings. `oauth`: it names an authorization server to sign in with. `unreachable`: it did not answer as an MCP server.",
|
|
18
|
+
),
|
|
19
|
+
server: z.string().optional().describe("What to call the place you sign in at: the server's own name for itself, or the authorization server's host."),
|
|
20
|
+
registers: z
|
|
21
|
+
.boolean()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe("Whether the authorization server registers this sandbox as a client by itself. False: a client ID made in its own settings is needed."),
|
|
24
|
+
redirectUri: z
|
|
25
|
+
.string()
|
|
26
|
+
.optional()
|
|
27
|
+
.describe("Where the authorization server sends the browser back: the redirect address a client made by hand must allow."),
|
|
28
|
+
detail: z.string().optional().describe("What went wrong, for `unreachable`, in words a person can act on."),
|
|
29
|
+
});
|
|
30
|
+
export type McpAuthCheck = z.infer<typeof McpAuthCheckSchema>;
|
|
31
|
+
|
|
32
|
+
// POST /capabilities/mcp-sign-in: starts a sign-in; the browser opens `authorizeUrl` and waits on `flow`.
|
|
33
|
+
export const McpSignInInputSchema = z.object({
|
|
34
|
+
url: z.url().describe("The MCP server's address."),
|
|
35
|
+
clientId: z
|
|
36
|
+
.string()
|
|
37
|
+
.trim()
|
|
38
|
+
.min(1)
|
|
39
|
+
.max(512)
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("A client ID made in the authorization server's own settings, for a server that registers no client by itself."),
|
|
42
|
+
keeping: z
|
|
43
|
+
.string()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("The connection being edited, whose registered client is reused when it signed in at the same authorization server."),
|
|
46
|
+
});
|
|
47
|
+
export const McpSignInStartSchema = z.object({
|
|
48
|
+
flow: z.string().describe("Stands for this sign-in, to wait on. Lapses after ten minutes."),
|
|
49
|
+
authorizeUrl: z.url().describe("The authorization server's page, for the person to approve in their browser."),
|
|
50
|
+
redirectUri: z.string().describe("Where the authorization server sends the browser back: this sandbox's own callback."),
|
|
51
|
+
server: z.string().describe("What to call the authorization server."),
|
|
52
|
+
});
|
|
53
|
+
export type McpSignInStart = z.infer<typeof McpSignInStartSchema>;
|
|
54
|
+
|
|
55
|
+
// POST /capabilities/mcp-sign-in/wait: answers as soon as the sign-in ends, or `waiting` after a while.
|
|
56
|
+
export const McpSignInWaitInputSchema = z.object({ flow: z.string().min(1).describe("The sign-in, as its start answered.") });
|
|
57
|
+
export const McpSignInWaitSchema = z.discriminatedUnion("state", [
|
|
58
|
+
z.object({ state: z.literal("waiting").describe("Nobody has come back from the authorization server yet. Ask again.") }),
|
|
59
|
+
z.object({
|
|
60
|
+
state: z.literal("done"),
|
|
61
|
+
token: z
|
|
62
|
+
.string()
|
|
63
|
+
.describe(
|
|
64
|
+
"Stands for the signed-in session, which never leaves the sandbox. Sent wrapped as a stash marker in the connection's `token`, it installs that session once, and it lapses after thirty minutes.",
|
|
65
|
+
),
|
|
66
|
+
server: z.string().describe("Where the sign-in happened."),
|
|
67
|
+
account: z.string().optional().describe("Who signed in, when the authorization server said."),
|
|
68
|
+
scope: z.string().optional().describe("The access granted, as the authorization server's own scope words."),
|
|
69
|
+
}),
|
|
70
|
+
z.object({ state: z.literal("failed"), message: z.string().describe("Why it did not finish, in words a person can act on.") }),
|
|
71
|
+
]);
|
|
72
|
+
export type McpSignInWait = z.infer<typeof McpSignInWaitSchema>;
|
package/src/schemas/needs.ts
CHANGED
|
@@ -65,7 +65,10 @@ export const SECRET_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
|
|
|
65
65
|
// `lastIndex` between callers: a site that replaces or spans every one derives its own /g copy from it. The terminal
|
|
66
66
|
// filter (@intentic/output-cleaners, builtins only) keeps a copy, pinned to this one by the daemon's
|
|
67
67
|
// src/secrets/terminal-masking-parity.test.ts.
|
|
68
|
-
|
|
68
|
+
// `{{secret:NAME|file}}` (the second capture) resolves to the path of a private file holding the value instead of the
|
|
69
|
+
// value itself: the way a multi-line value, or one with quotes, reaches a command without being spliced into its source.
|
|
70
|
+
// Group 1 is the name in both forms, so every reader that only needs the name reads both alike.
|
|
71
|
+
export const SECRET_REFERENCE = /\{\{secret:([A-Za-z0-9_./-]+)(?:\|(file))?\}\}/;
|
|
69
72
|
|
|
70
73
|
export const SecretNeedSchema = z.object({
|
|
71
74
|
kind: z.literal("secret"),
|
|
@@ -79,6 +82,10 @@ export const SecretNeedSchema = z.object({
|
|
|
79
82
|
.describe("Where a person gets one, shown as a link on the card."),
|
|
80
83
|
hint: z.string().max(120).optional().describe("What a valid one looks like, so a wrong paste is caught by eye."),
|
|
81
84
|
replace: z.boolean().optional().describe("One is stored under this name and is being refused: the ask is for a new value in its place."),
|
|
85
|
+
multiline: z
|
|
86
|
+
.boolean()
|
|
87
|
+
.optional()
|
|
88
|
+
.describe("A value with lines (a key file, a whole .env): the card takes it in a box with lines and keeps it exactly as pasted."),
|
|
82
89
|
});
|
|
83
90
|
export type SecretNeed = z.infer<typeof SecretNeedSchema>;
|
|
84
91
|
|
package/src/schemas/system.ts
CHANGED
|
@@ -141,6 +141,12 @@ export const InfoSchema = z.object({
|
|
|
141
141
|
"Whether and when this sandbox takes a downloaded update by itself, and what it is waiting on. Absent where it cannot: a hosted sandbox, one built from a checkout, or one older than automatic updates.",
|
|
142
142
|
),
|
|
143
143
|
// What answers now, for a page telling a swap it pressed from one still running; absent from a daemon older than it.
|
|
144
|
+
standby: z
|
|
145
|
+
.object({ host: z.string(), since: z.string() })
|
|
146
|
+
.optional()
|
|
147
|
+
.describe(
|
|
148
|
+
"Set while this copy is on standby (2026-11-11): the machine the platform holds to run the sandbox (`host`, its label and side) and since when this copy stood down (ISO). No turn starts here meanwhile. Absent on the active copy and from an older daemon.",
|
|
149
|
+
),
|
|
144
150
|
running: RunningSandboxSchema.optional().describe(
|
|
145
151
|
"Which build answers and when its daemon started, so a page that asked for a rebuild, an update or a rollback can tell when the new container is the one answering. Absent from a sandbox older than this field.",
|
|
146
152
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AgentTurnSchema } from "../schemas/agent.js";
|
|
2
|
-
import { MENTION_LIMIT, mentionedPathTokens, mentionPaths } from "./mentions.js";
|
|
2
|
+
import { MENTION_LIMIT, mentionedPathTokens, mentionPaths, mentionRanges } from "./mentions.js";
|
|
3
3
|
|
|
4
4
|
describe(`mentionPaths`, () => {
|
|
5
5
|
it(`extracts path-looking tokens, deduped, with trailing punctuation stripped`, () => {
|
|
@@ -37,3 +37,18 @@ describe(`mentionedPathTokens`, () => {
|
|
|
37
37
|
expect(mentionedPathTokens(`@intentic/iq-engine:test: failed\nsee @src/app.ts`)).toEqual([`intentic/iq-engine:test`, `src/app.ts`]);
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
|
+
|
|
41
|
+
describe(`mentionRanges`, () => {
|
|
42
|
+
it(`marks each sent mention where it stands, the @ included and trailing punctuation left out`, () => {
|
|
43
|
+
const text = `In @integra/bench/OPTIMIZATIONS.md, see @src/app.ts.`;
|
|
44
|
+
expect(mentionRanges(text).map(({ start, end, path }) => [text.slice(start, end), path])).toEqual([
|
|
45
|
+
[`@integra/bench/OPTIMIZATIONS.md`, `integra/bench/OPTIMIZATIONS.md`],
|
|
46
|
+
[`@src/app.ts`, `src/app.ts`],
|
|
47
|
+
]);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it(`marks every occurrence of a repeated mention and nothing that is not sent`, () => {
|
|
51
|
+
const text = `@a.ts then @a.ts, thanks @radarsu, curl --data @/tmp/x.json`;
|
|
52
|
+
expect(mentionRanges(text).map(({ start }) => start)).toEqual([0, 11]);
|
|
53
|
+
});
|
|
54
|
+
});
|
package/src/text/mentions.ts
CHANGED
|
@@ -33,7 +33,21 @@ const PACKAGE_SCRIPT = /^[^/]+\/[^/]+:[^/]+$/u;
|
|
|
33
33
|
const OUTSIDE_WORKSPACE = /^(?:[/~]|[A-Za-z]:[\\/]|\.\.(?:[/\\]|$))/u;
|
|
34
34
|
// How many a turn may carry; the tokenizer stops here rather than letting a pasted log's 21st token refuse the turn.
|
|
35
35
|
export const MENTION_LIMIT = 20;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
const isMention = (token: string): boolean => !PACKAGE_SCRIPT.test(token) && !OUTSIDE_WORKSPACE.test(token);
|
|
37
|
+
export const mentionPaths = (text: string): string[] => mentionedPathTokens(text).filter(isMention).slice(0, MENTION_LIMIT);
|
|
38
|
+
|
|
39
|
+
// Where each mention mentionPaths would send sits in the text, `@` included, so a composer can mark the very words that
|
|
40
|
+
// ride as files and no others. Past the limit nothing is marked, since nothing past it is sent.
|
|
41
|
+
export const mentionRanges = (text: string): { readonly start: number; readonly end: number; readonly path: string }[] => {
|
|
42
|
+
const sent = new Set(mentionPaths(text));
|
|
43
|
+
const ranges: { start: number; end: number; path: string }[] = [];
|
|
44
|
+
for (const match of text.matchAll(/(^|\s)@([^\s@]+)/g)) {
|
|
45
|
+
const [, lead = ``, token = ``] = match;
|
|
46
|
+
const path = withoutTrailingPunctuation(token);
|
|
47
|
+
if (sent.has(path)) {
|
|
48
|
+
const start = match.index + lead.length;
|
|
49
|
+
ranges.push({ start, end: start + 1 + path.length, path });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return ranges;
|
|
53
|
+
};
|
|
@@ -63,6 +63,14 @@ describe("foldTurn", () => {
|
|
|
63
63
|
]);
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
// The composer's "Viewing" chip rides a steer as a pointer, so the row can say what "this" meant.
|
|
67
|
+
it("keeps the file a person was looking at on their steer's row", () => {
|
|
68
|
+
const events: AgentEvent[] = [{ kind: "steer", text: "fix this", sentAt: SENT_AT + 1, editorContext: { file: "src/app.ts", startLine: 3, endLine: 9 } }];
|
|
69
|
+
expect(foldOf("ship it", events).slice(1)).toEqual([
|
|
70
|
+
{ role: "user", text: "fix this", sentAt: SENT_AT + 1, editorContext: { file: "src/app.ts", startLine: 3, endLine: 9 } },
|
|
71
|
+
]);
|
|
72
|
+
});
|
|
73
|
+
|
|
66
74
|
it("does not retire a bubble that has written no prose", () => {
|
|
67
75
|
const events: AgentEvent[] = [
|
|
68
76
|
{ kind: "tool_call", id: "t1", name: "Read", category: "read", status: "completed" },
|
|
@@ -397,20 +397,16 @@ export class TranscriptFold {
|
|
|
397
397
|
}
|
|
398
398
|
// A steer also closes the bubble, or the next answer would print over it mid-call.
|
|
399
399
|
const row: TranscriptRow = { role: "user", text: event.text, sentAt: event.sentAt };
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
row.messageId = event.messageId;
|
|
400
|
+
for (const key of ["attachments", "editorContext", "messageId", "errand"] as const) {
|
|
401
|
+
if (event[key] !== undefined) {
|
|
402
|
+
Object.assign(row, { [key]: structuredClone(event[key]) });
|
|
403
|
+
}
|
|
405
404
|
}
|
|
406
405
|
// The sandbox's own words say so on the row, so a reader never shows them as the owner's; an agent's words
|
|
407
406
|
// come as their own card (agentWords), which names the agent.
|
|
408
407
|
if (event.voice === "sandbox") {
|
|
409
408
|
row.speaker = { kind: "sandbox" };
|
|
410
409
|
}
|
|
411
|
-
if (event.errand !== undefined) {
|
|
412
|
-
row.errand = event.errand;
|
|
413
|
-
}
|
|
414
410
|
const patches = this.pushRow(row);
|
|
415
411
|
// Anchors pair by position with the checkpoints only a person's steer reserves.
|
|
416
412
|
if (event.voice === undefined) {
|