@intentic/sandbox-contract 1.394.0 → 1.395.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/README.md +20 -2
- package/dist/app-routes/app-pages.d.ts +97 -0
- package/dist/app-routes/app-pages.d.ts.map +1 -0
- package/dist/app-routes/app-pages.js +71 -0
- package/dist/app-routes/app-pages.js.map +1 -0
- package/dist/app-routes/index.d.ts +5 -0
- package/dist/app-routes/index.d.ts.map +1 -0
- package/dist/app-routes/index.js +5 -0
- package/dist/app-routes/index.js.map +1 -0
- package/dist/app-routes/legacy.d.ts +10 -0
- package/dist/app-routes/legacy.d.ts.map +1 -0
- package/dist/app-routes/legacy.js +92 -0
- package/dist/app-routes/legacy.js.map +1 -0
- package/dist/app-routes/paths.d.ts +38 -0
- package/dist/app-routes/paths.d.ts.map +1 -0
- package/dist/app-routes/paths.js +89 -0
- package/dist/app-routes/paths.js.map +1 -0
- package/dist/app-routes/patterns.d.ts +5 -0
- package/dist/app-routes/patterns.d.ts.map +1 -0
- package/dist/app-routes/patterns.js +94 -0
- package/dist/app-routes/patterns.js.map +1 -0
- package/dist/chores/stack.d.ts.map +1 -1
- package/dist/chores/stack.js +13 -2
- package/dist/chores/stack.js.map +1 -1
- package/dist/contracts/agent.contract.d.ts +115 -0
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.d.ts +1300 -11
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.js +11 -1
- package/dist/contracts/agents.contract.js.map +1 -1
- package/dist/contracts/capabilities.contract.d.ts +8 -0
- package/dist/contracts/capabilities.contract.d.ts.map +1 -1
- package/dist/contracts/endpoints.contract.d.ts +45 -0
- package/dist/contracts/endpoints.contract.d.ts.map +1 -1
- package/dist/contracts/endpoints.contract.js +9 -0
- package/dist/contracts/endpoints.contract.js.map +1 -1
- package/dist/contracts/git.contract.d.ts +5 -0
- package/dist/contracts/git.contract.d.ts.map +1 -1
- package/dist/contracts/org.contract.d.ts +8 -0
- package/dist/contracts/org.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +87 -0
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/seal.contract.d.ts +2760 -0
- package/dist/contracts/seal.contract.d.ts.map +1 -0
- package/dist/contracts/seal.contract.js +95 -0
- package/dist/contracts/seal.contract.js.map +1 -0
- package/dist/contracts/sessions.contract.d.ts +16 -0
- package/dist/contracts/sessions.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.d.ts +89 -2
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.js +21 -3
- package/dist/contracts/settings.contract.js.map +1 -1
- package/dist/contracts/system.contract.d.ts +419 -62
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/webext.contract.d.ts +4 -0
- package/dist/contracts/webext.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.d.ts +6 -0
- package/dist/contracts/workspace.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.js +11 -1
- package/dist/contracts/workspace.contract.js.map +1 -1
- package/dist/events/agent-events.d.ts +80 -1
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/agent-events.js +16 -0
- package/dist/events/agent-events.js.map +1 -1
- package/dist/events/agent-transcript.d.ts +16 -0
- package/dist/events/agent-transcript.d.ts.map +1 -1
- package/dist/events/requests.d.ts +2 -0
- package/dist/events/requests.d.ts.map +1 -1
- package/dist/events/requests.js +4 -0
- package/dist/events/requests.js.map +1 -1
- package/dist/events/system-events.d.ts +292 -62
- package/dist/events/system-events.d.ts.map +1 -1
- package/dist/events/system-events.js +3 -0
- package/dist/events/system-events.js.map +1 -1
- package/dist/events/transcript.d.ts +96 -0
- package/dist/events/transcript.d.ts.map +1 -1
- package/dist/events/transcript.js +7 -1
- package/dist/events/transcript.js.map +1 -1
- package/dist/ids/row-ids.d.ts.map +1 -1
- package/dist/ids/row-ids.js +7 -2
- package/dist/ids/row-ids.js.map +1 -1
- package/dist/index.d.ts +107 -34346
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/models/model-roles.d.ts +8 -0
- package/dist/models/model-roles.d.ts.map +1 -1
- package/dist/models/model-roles.js +8 -0
- package/dist/models/model-roles.js.map +1 -1
- 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 +9 -1
- package/dist/policy/org-locks.js.map +1 -1
- package/dist/policy/request-status.d.ts.map +1 -1
- package/dist/policy/request-status.js +26 -10
- package/dist/policy/request-status.js.map +1 -1
- package/dist/protocol/raw/raw-json-routes.d.ts +6 -0
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/routes.d.ts +6 -0
- package/dist/protocol/routes.d.ts.map +1 -1
- package/dist/protocol/routes.js +64 -8
- package/dist/protocol/routes.js.map +1 -1
- package/dist/protocol/sse.d.ts.map +1 -1
- package/dist/protocol/sse.js +5 -1
- package/dist/protocol/sse.js.map +1 -1
- package/dist/schemas/agent-land.d.ts +78 -0
- package/dist/schemas/agent-land.d.ts.map +1 -0
- package/dist/schemas/agent-land.js +47 -0
- package/dist/schemas/agent-land.js.map +1 -0
- package/dist/schemas/agent.d.ts +4 -0
- package/dist/schemas/agent.d.ts.map +1 -1
- package/dist/schemas/agent.js +1 -0
- package/dist/schemas/agent.js.map +1 -1
- package/dist/schemas/agents-list.d.ts +130 -0
- package/dist/schemas/agents-list.d.ts.map +1 -1
- package/dist/schemas/agents.d.ts +196 -76
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js +5 -46
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/capabilities.d.ts +4 -0
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/commit-attribution.d.ts +41 -0
- package/dist/schemas/commit-attribution.d.ts.map +1 -0
- package/dist/schemas/commit-attribution.js +16 -0
- package/dist/schemas/commit-attribution.js.map +1 -0
- package/dist/schemas/composer-drafts.d.ts +19 -0
- package/dist/schemas/composer-drafts.d.ts.map +1 -1
- package/dist/schemas/composer-drafts.js +10 -0
- package/dist/schemas/composer-drafts.js.map +1 -1
- package/dist/schemas/environment.d.ts +12 -0
- package/dist/schemas/environment.d.ts.map +1 -1
- package/dist/schemas/environment.js +1 -0
- package/dist/schemas/environment.js.map +1 -1
- package/dist/schemas/git/git-history.d.ts +10 -0
- package/dist/schemas/git/git-history.d.ts.map +1 -1
- package/dist/schemas/git/git-history.js +8 -0
- package/dist/schemas/git/git-history.js.map +1 -1
- package/dist/schemas/gpu-settings.d.ts +15 -0
- package/dist/schemas/gpu-settings.d.ts.map +1 -0
- package/dist/schemas/gpu-settings.js +18 -0
- package/dist/schemas/gpu-settings.js.map +1 -0
- package/dist/schemas/night-hours.d.ts +31 -0
- package/dist/schemas/night-hours.d.ts.map +1 -0
- package/dist/schemas/night-hours.js +33 -0
- package/dist/schemas/night-hours.js.map +1 -0
- package/dist/schemas/organisation.d.ts +33 -0
- package/dist/schemas/organisation.d.ts.map +1 -1
- package/dist/schemas/organisation.js +9 -0
- package/dist/schemas/organisation.js.map +1 -1
- package/dist/schemas/privacy.d.ts +1 -0
- package/dist/schemas/privacy.d.ts.map +1 -1
- package/dist/schemas/privacy.js +1 -0
- package/dist/schemas/privacy.js.map +1 -1
- package/dist/schemas/providers/plan-limits.d.ts +16 -0
- package/dist/schemas/providers/plan-limits.d.ts.map +1 -1
- package/dist/schemas/providers/plan-limits.js +3 -0
- package/dist/schemas/providers/plan-limits.js.map +1 -1
- package/dist/schemas/sandbox-mode.d.ts +20 -0
- package/dist/schemas/sandbox-mode.d.ts.map +1 -0
- package/dist/schemas/sandbox-mode.js +54 -0
- package/dist/schemas/sandbox-mode.js.map +1 -0
- package/dist/schemas/seal-proof.d.ts +20 -0
- package/dist/schemas/seal-proof.d.ts.map +1 -0
- package/dist/schemas/seal-proof.js +8 -0
- package/dist/schemas/seal-proof.js.map +1 -0
- package/dist/schemas/seal.d.ts +235 -0
- package/dist/schemas/seal.d.ts.map +1 -0
- package/dist/schemas/seal.js +97 -0
- package/dist/schemas/seal.js.map +1 -0
- package/dist/schemas/settings-experiments.d.ts.map +1 -1
- package/dist/schemas/settings-experiments.js +1 -1
- package/dist/schemas/settings-experiments.js.map +1 -1
- package/dist/schemas/settings-history.d.ts +2 -2
- package/dist/schemas/settings.d.ts +59 -15
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +23 -27
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/webext.d.ts +9 -0
- package/dist/schemas/webext.d.ts.map +1 -1
- package/dist/schemas/webext.js +2 -0
- package/dist/schemas/webext.js.map +1 -1
- package/dist/schemas/workspace/workspace-tree.d.ts +8 -0
- package/dist/schemas/workspace/workspace-tree.d.ts.map +1 -1
- package/dist/schemas/workspace/workspace-tree.js +16 -0
- package/dist/schemas/workspace/workspace-tree.js.map +1 -1
- package/dist/state/definition.d.ts +48 -8
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/text/mentions.d.ts.map +1 -1
- package/dist/text/mentions.js +8 -1
- package/dist/text/mentions.js.map +1 -1
- package/dist/text/transcript-fold.d.ts.map +1 -1
- package/dist/text/transcript-fold.js +1 -0
- package/dist/text/transcript-fold.js.map +1 -1
- package/package.json +16 -5
- package/src/app-routes/app-pages.ts +148 -0
- package/src/app-routes/app-routes.test.ts +183 -0
- package/src/app-routes/index.ts +6 -0
- package/src/app-routes/legacy.ts +144 -0
- package/src/app-routes/paths.ts +160 -0
- package/src/app-routes/patterns.ts +145 -0
- package/src/chores/stack.ts +14 -2
- package/src/contracts/agents.contract.ts +15 -1
- package/src/contracts/endpoints.contract.ts +12 -0
- package/src/contracts/seal.contract.ts +117 -0
- package/src/contracts/settings.contract.ts +30 -6
- package/src/contracts/workspace.contract.ts +16 -0
- package/src/events/agent-events.ts +20 -0
- package/src/events/requests.ts +8 -0
- package/src/events/system-events.ts +39 -4
- package/src/events/transcript.ts +9 -1
- package/src/ids/row-ids.test.ts +31 -0
- package/src/ids/row-ids.ts +10 -2
- package/src/index.ts +65 -5
- package/src/models/model-roles.ts +10 -0
- package/src/policy/org-locks.ts +9 -1
- package/src/policy/request-status.ts +38 -10
- package/src/protocol/routes.test.ts +75 -2
- package/src/protocol/routes.ts +119 -11
- package/src/protocol/sse.ts +6 -1
- package/src/schemas/agent-land.ts +98 -0
- package/src/schemas/agent.ts +3 -0
- package/src/schemas/agents.ts +6 -94
- package/src/schemas/capabilities.ts +1 -1
- package/src/schemas/commit-attribution.ts +38 -0
- package/src/schemas/composer-drafts.ts +17 -0
- package/src/schemas/environment.ts +4 -0
- package/src/schemas/git/git-history.ts +10 -0
- package/src/schemas/gpu-settings.ts +31 -0
- package/src/schemas/night-hours.test.ts +54 -0
- package/src/schemas/night-hours.ts +70 -0
- package/src/schemas/organisation.ts +15 -0
- package/src/schemas/privacy.test.ts +8 -1
- package/src/schemas/privacy.ts +10 -1
- package/src/schemas/providers/plan-limits.ts +5 -0
- package/src/schemas/sandbox-mode.test.ts +68 -0
- package/src/schemas/sandbox-mode.ts +93 -0
- package/src/schemas/seal-proof.ts +12 -0
- package/src/schemas/seal.ts +175 -0
- package/src/schemas/settings-experiments.ts +3 -1
- package/src/schemas/settings.test.ts +7 -0
- package/src/schemas/settings.ts +60 -48
- package/src/schemas/webext.ts +8 -0
- package/src/schemas/workspace/workspace-tree.ts +23 -0
- package/src/state/daemon-floor.test.ts +1 -0
- package/src/text/mentions.ts +10 -1
- package/src/text/pages.test.ts +1 -0
- package/src/text/transcript-fold.ts +1 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// THE PATH PATTERNS OF THE APP'S ADDRESSES, read and written by one small grammar: the subset of vue-router's that the
|
|
2
|
+
// route table (pages.ts) uses. Pure, so the daemon's push messages, the extension API and the native bridges can build
|
|
3
|
+
// and read an address without the router.
|
|
4
|
+
//
|
|
5
|
+
// A pattern is `/`-separated segments. A segment is static text or one parameter: `:name`, optionally a regex in
|
|
6
|
+
// parentheses (`(.*)` lets the value hold slashes; an alternation like `(chat|terminal)` names the values it takes),
|
|
7
|
+
// then a modifier: `?` optional, `*` zero or more segments, `+` one or more.
|
|
8
|
+
|
|
9
|
+
/** A parameter's values by name. A value that spans segments (a file's path, a repeatable parameter) holds its slashes. */
|
|
10
|
+
export type Params = Readonly<Record<string, string | undefined>>;
|
|
11
|
+
|
|
12
|
+
interface StaticPart {
|
|
13
|
+
readonly kind: `static`;
|
|
14
|
+
readonly text: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ParamPart {
|
|
18
|
+
readonly kind: `param`;
|
|
19
|
+
readonly name: string;
|
|
20
|
+
/** The value may run over several segments: `(.*)`, or a repeatable modifier. */
|
|
21
|
+
readonly spans: boolean;
|
|
22
|
+
readonly optional: boolean;
|
|
23
|
+
/** The source of an explicit regex other than `.*`, an alternation of the values it takes. */
|
|
24
|
+
readonly choices?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type Part = StaticPart | ParamPart;
|
|
28
|
+
|
|
29
|
+
const PARAM = /^:([A-Za-z_][A-Za-z0-9_]*)(?:\(([^)]*)\))?([?*+])?$/;
|
|
30
|
+
|
|
31
|
+
const parse = (pattern: string): readonly Part[] =>
|
|
32
|
+
pattern
|
|
33
|
+
.split(`/`)
|
|
34
|
+
.filter((segment) => segment !== ``)
|
|
35
|
+
.map((segment): Part => {
|
|
36
|
+
const param = PARAM.exec(segment);
|
|
37
|
+
if (param === null) {
|
|
38
|
+
return { kind: `static`, text: segment };
|
|
39
|
+
}
|
|
40
|
+
const [, name = ``, regex, modifier] = param;
|
|
41
|
+
const repeat = modifier === `*` || modifier === `+`;
|
|
42
|
+
const part: ParamPart = { kind: `param`, name, spans: repeat || regex === `.*`, optional: modifier === `?` || modifier === `*` };
|
|
43
|
+
return regex === undefined || regex === `.*` ? part : { ...part, choices: regex };
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const cache = new Map<string, readonly Part[]>();
|
|
47
|
+
const partsOf = (pattern: string): readonly Part[] => {
|
|
48
|
+
let parts = cache.get(pattern);
|
|
49
|
+
if (parts === undefined) {
|
|
50
|
+
parts = parse(pattern);
|
|
51
|
+
cache.set(pattern, parts);
|
|
52
|
+
}
|
|
53
|
+
return parts;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** The names of a pattern's parameters, in order. */
|
|
57
|
+
export const paramNames = (pattern: string): readonly string[] =>
|
|
58
|
+
partsOf(pattern).flatMap((part) => (part.kind === `param` ? [part.name] : []));
|
|
59
|
+
|
|
60
|
+
// A segment's text encoded as a path may carry it: what URI syntax reserves is escaped, while `:`, `@` and `,` (legal in
|
|
61
|
+
// a path segment, and in tab keys like `app:shop/web`) stay readable.
|
|
62
|
+
const encodeSegment = (text: string): string => encodeURIComponent(text).replace(/%3A/gi, `:`).replace(/%40/g, `@`).replace(/%2C/gi, `,`);
|
|
63
|
+
|
|
64
|
+
const segmentsOf = (value: string): readonly string[] => value.split(`/`).filter((segment) => segment !== ``);
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The address a pattern names with these values, without a leading slash: each segment percent-encoded, a spanning
|
|
68
|
+
* value's slashes kept. Throws on a required parameter left out, since a link that silently drops one opens a page
|
|
69
|
+
* the reader did not ask for.
|
|
70
|
+
*/
|
|
71
|
+
export const fillPattern = (pattern: string, params: Params = {}): string => {
|
|
72
|
+
const out: string[] = [];
|
|
73
|
+
for (const part of partsOf(pattern)) {
|
|
74
|
+
if (part.kind === `static`) {
|
|
75
|
+
out.push(part.text);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const value = params[part.name];
|
|
79
|
+
const segments = value === undefined ? [] : part.spans ? segmentsOf(value) : [value];
|
|
80
|
+
if (segments.length === 0 || segments[0] === ``) {
|
|
81
|
+
if (!part.optional) {
|
|
82
|
+
throw new Error(`The address ${pattern} needs its :${part.name}.`);
|
|
83
|
+
}
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
out.push(segments.map(encodeSegment).join(`/`));
|
|
87
|
+
}
|
|
88
|
+
return out.join(`/`);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const escape = (text: string): string => text.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`);
|
|
92
|
+
|
|
93
|
+
const regexCache = new Map<string, RegExp>();
|
|
94
|
+
const regexOf = (pattern: string): RegExp => {
|
|
95
|
+
let regex = regexCache.get(pattern);
|
|
96
|
+
if (regex === undefined) {
|
|
97
|
+
const body = partsOf(pattern)
|
|
98
|
+
.map((part) => {
|
|
99
|
+
if (part.kind === `static`) {
|
|
100
|
+
return `/${escape(part.text)}`;
|
|
101
|
+
}
|
|
102
|
+
const value = part.spans ? `(.+)` : part.choices === undefined ? `([^/]+)` : `(${part.choices})`;
|
|
103
|
+
return part.optional ? `(?:/${value})?` : `/${value}`;
|
|
104
|
+
})
|
|
105
|
+
.join(``);
|
|
106
|
+
regex = new RegExp(`^${body}/?$`);
|
|
107
|
+
regexCache.set(pattern, regex);
|
|
108
|
+
}
|
|
109
|
+
return regex;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const decode = (text: string): string => {
|
|
113
|
+
try {
|
|
114
|
+
return decodeURIComponent(text);
|
|
115
|
+
} catch {
|
|
116
|
+
// A stray `%` someone typed is the text it says, not a reason to refuse the address.
|
|
117
|
+
return text;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The values a path (no query, no hash, with or without its leading slash) gives a pattern's parameters, or undefined
|
|
123
|
+
* when it is not that pattern's. A spanning parameter reads as its decoded segments joined by slashes.
|
|
124
|
+
*/
|
|
125
|
+
export const matchPattern = (pattern: string, path: string): Record<string, string> | undefined => {
|
|
126
|
+
const normalized = path.startsWith(`/`) ? path : `/${path}`;
|
|
127
|
+
const found = regexOf(pattern).exec(normalized === `/` ? `` : normalized);
|
|
128
|
+
if (found === null) {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
const params: Record<string, string> = {};
|
|
132
|
+
let at = 1;
|
|
133
|
+
for (const part of partsOf(pattern)) {
|
|
134
|
+
if (part.kind === `static`) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const raw = found[at];
|
|
138
|
+
at += 1;
|
|
139
|
+
if (raw === undefined) {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
params[part.name] = part.spans ? raw.split(`/`).map(decode).join(`/`) : decode(raw);
|
|
143
|
+
}
|
|
144
|
+
return params;
|
|
145
|
+
};
|
package/src/chores/stack.ts
CHANGED
|
@@ -159,7 +159,19 @@ export const normalizePath = (path: string): string => path.replace(/^\.\//, ``)
|
|
|
159
159
|
const MIN_STEM = 3;
|
|
160
160
|
|
|
161
161
|
const QUALIFIER_PREFIX = /^(base|the)/;
|
|
162
|
-
|
|
162
|
+
// `/(v[0-9]+|new|old|legacy|copy|component|[0-9]+)$/` as a scan: that regex rescans a long digit run from each digit.
|
|
163
|
+
const QUALIFIER_WORDS = [`new`, `old`, `legacy`, `copy`, `component`];
|
|
164
|
+
const withoutQualifierSuffix = (base: string): string => {
|
|
165
|
+
let digits = base.length;
|
|
166
|
+
while (digits > 0 && /[0-9]/.test(base.charAt(digits - 1))) {
|
|
167
|
+
digits -= 1;
|
|
168
|
+
}
|
|
169
|
+
if (digits < base.length) {
|
|
170
|
+
return base.slice(0, base.charAt(digits - 1) === `v` ? digits - 1 : digits);
|
|
171
|
+
}
|
|
172
|
+
const word = QUALIFIER_WORDS.find((suffix) => base.endsWith(suffix));
|
|
173
|
+
return word === undefined ? base : base.slice(0, -word.length);
|
|
174
|
+
};
|
|
163
175
|
|
|
164
176
|
// Names the framework mandates per app or route; sharing one is never evidence of duplication.
|
|
165
177
|
const FRAMEWORK_NAMES = new Set([`index`, `app`, `main`, `root`, `page`, `layout`, `loading`, `error`, `template`, `default`, `notfound`]);
|
|
@@ -174,7 +186,7 @@ export const componentStem = (path: string): string | undefined => {
|
|
|
174
186
|
if (base === `` || FRAMEWORK_NAMES.has(base)) {
|
|
175
187
|
return undefined;
|
|
176
188
|
}
|
|
177
|
-
const withoutSuffix = base
|
|
189
|
+
const withoutSuffix = withoutQualifierSuffix(base);
|
|
178
190
|
const stem = (withoutSuffix.length >= MIN_STEM ? withoutSuffix : base).replace(QUALIFIER_PREFIX, ``);
|
|
179
191
|
return stem.length >= MIN_STEM ? stem : base;
|
|
180
192
|
};
|
|
@@ -10,7 +10,7 @@ import { AgentCloneSchema } from "../schemas/git/clone.js";
|
|
|
10
10
|
import { FileDiffSchema } from "../schemas/history.js";
|
|
11
11
|
import { OkSchema } from "../schemas/shared.js";
|
|
12
12
|
import { AgentPlacedSchema, AgentPlaceSchema } from "../schemas/agent-place.js";
|
|
13
|
-
import { ComposerDraftsSchema, DraftClearSchema, DraftWriteSchema, DraftWrittenSchema } from "../schemas/composer-drafts.js";
|
|
13
|
+
import { ComposerDraftsSchema, DraftClearSchema, DraftReactionsSchema, DraftWriteSchema, DraftWrittenSchema } from "../schemas/composer-drafts.js";
|
|
14
14
|
import { AgentKeepWarmSchema } from "../schemas/keep-warm.js";
|
|
15
15
|
import { ConversationPromptSchema } from "../schemas/system-prompt.js";
|
|
16
16
|
|
|
@@ -274,6 +274,20 @@ export const agentsContract = {
|
|
|
274
274
|
.meta({ floor: "collaborator", guest: true })
|
|
275
275
|
.input(DraftClearSchema)
|
|
276
276
|
.output(DraftWrittenSchema),
|
|
277
|
+
// A conversation no turn has started has no entry for `react` to mark, so its writer's marks wait beside their draft
|
|
278
|
+
// (composer-drafts.ts) and move onto the card with the first turn. Floored as the draft is: a mark here is on your
|
|
279
|
+
// own unsent conversation, which only someone who may start one ever holds.
|
|
280
|
+
reactDraft: procedure
|
|
281
|
+
.route({
|
|
282
|
+
method: "POST",
|
|
283
|
+
path: "/agents/{id}/draft/react",
|
|
284
|
+
summary: "Mark a conversation you have not started yet",
|
|
285
|
+
description:
|
|
286
|
+
"Puts your mark on a conversation no turn has started yet, or takes it back. Only you see it until the conversation's first turn, which carries your marks onto its card for everyone sharing the sandbox. Writing or clearing the draft's words leaves the marks alone. Refused for a conversation that has started: mark that one with `react`.",
|
|
287
|
+
})
|
|
288
|
+
.meta({ floor: "collaborator", guest: true })
|
|
289
|
+
.input(AgentReactSchema)
|
|
290
|
+
.output(DraftReactionsSchema),
|
|
277
291
|
// A finer-grained ask (watch this, not that) goes through the chat, not a per-watch id here.
|
|
278
292
|
stopWatching: procedure
|
|
279
293
|
.route({
|
|
@@ -154,4 +154,16 @@ export const endpointsContract = {
|
|
|
154
154
|
})
|
|
155
155
|
.input(z.object({ action: z.enum(["start", "stop"]) }))
|
|
156
156
|
.output(LocalModelPrefetchSchema),
|
|
157
|
+
// The way back from a download: a model's weights take gigabytes, and neither removing its card nor stopping a
|
|
158
|
+
// prefetch frees them (both keep the file so the next start costs nothing).
|
|
159
|
+
localModelDelete: procedure
|
|
160
|
+
.route({
|
|
161
|
+
method: "POST",
|
|
162
|
+
path: "/endpoints/local-model/delete",
|
|
163
|
+
summary: "Delete a local model's downloaded weights",
|
|
164
|
+
description:
|
|
165
|
+
"Deletes one curated model's weights from the workspace cache, a half-finished download included, and stops a transfer still running on them. Refused while a local model connection still runs on those weights: remove it first. Answers with the machine's fit as it now stands, so the lane redraws without asking again.",
|
|
166
|
+
})
|
|
167
|
+
.input(z.object({ model: z.string().min(1) }))
|
|
168
|
+
.output(LocalModelFitSchema),
|
|
157
169
|
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { procedure } from "../protocol/route-meta.js";
|
|
2
|
+
import { AgentSummarySchema } from "../schemas/agents.js";
|
|
3
|
+
import {
|
|
4
|
+
SealAnswerSchema,
|
|
5
|
+
SealApproveSchema,
|
|
6
|
+
SealHouseSchema,
|
|
7
|
+
SealIdSchema,
|
|
8
|
+
SealOpenCeremonySchema,
|
|
9
|
+
SealOpenPrepareSchema,
|
|
10
|
+
SealSetDefaultSchema,
|
|
11
|
+
SealSetHouseSchema,
|
|
12
|
+
SealSetSchema,
|
|
13
|
+
} from "../schemas/seal.js";
|
|
14
|
+
import { SealOpenProofSchema } from "../schemas/seal-proof.js";
|
|
15
|
+
|
|
16
|
+
// PRIVATE CONVERSATIONS (schemas/seal.ts). Every route here is a person's: none is open to the agent token, a panel or a
|
|
17
|
+
// control token, so no agent ever makes, reads past or opens a seal, the owner's own agents included. Each route
|
|
18
|
+
// decides inside whose hands it may be in (the author, a reader, the sandbox owner); the floors only keep a viewer to
|
|
19
|
+
// asking and answering.
|
|
20
|
+
export const sealContract = {
|
|
21
|
+
house: procedure
|
|
22
|
+
.route({
|
|
23
|
+
method: "GET",
|
|
24
|
+
path: "/seal",
|
|
25
|
+
summary: "Who reads whose conversations",
|
|
26
|
+
description:
|
|
27
|
+
"The house rule for private conversations, whether an organisation fixed it, and whether a conversation you start now begins private.",
|
|
28
|
+
})
|
|
29
|
+
.output(SealHouseSchema),
|
|
30
|
+
setHouse: procedure
|
|
31
|
+
.route({
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: "/seal/house",
|
|
34
|
+
summary: "Set who reads whose conversations",
|
|
35
|
+
description:
|
|
36
|
+
"Sets the house rule. It applies to conversations started from now on: a conversation that is already private stays private whatever the rule becomes, until its author shares it.",
|
|
37
|
+
})
|
|
38
|
+
.meta({ floor: "maintainer" })
|
|
39
|
+
.input(SealSetHouseSchema)
|
|
40
|
+
.output(SealHouseSchema),
|
|
41
|
+
setDefault: procedure
|
|
42
|
+
.route({
|
|
43
|
+
method: "POST",
|
|
44
|
+
path: "/seal/default",
|
|
45
|
+
summary: "Start my conversations private",
|
|
46
|
+
description: "Your own answer to whether the conversations you start begin private, where the house rule leaves it to each author.",
|
|
47
|
+
})
|
|
48
|
+
.meta({ floor: "viewer", guest: true })
|
|
49
|
+
.input(SealSetDefaultSchema)
|
|
50
|
+
.output(SealHouseSchema),
|
|
51
|
+
set: procedure
|
|
52
|
+
.route({
|
|
53
|
+
method: "POST",
|
|
54
|
+
path: "/seal/{id}",
|
|
55
|
+
summary: "Make a conversation private or shared",
|
|
56
|
+
description:
|
|
57
|
+
"Makes a conversation private to its author and the people they name, or shared again. Only its author may, or one of its readers when nobody answers for it. Its subagents and reviews follow it. What it already landed stays where it is.",
|
|
58
|
+
})
|
|
59
|
+
.meta({ floor: "viewer", guest: true })
|
|
60
|
+
.input(SealSetSchema)
|
|
61
|
+
.output(AgentSummarySchema),
|
|
62
|
+
ask: procedure
|
|
63
|
+
.route({
|
|
64
|
+
method: "POST",
|
|
65
|
+
path: "/seal/{id}/ask",
|
|
66
|
+
summary: "Ask to read a private conversation",
|
|
67
|
+
description: "Asks its author to show it to you. They can show it for a day, add you as a reader, or say no; nothing opens until they answer.",
|
|
68
|
+
})
|
|
69
|
+
.meta({ floor: "viewer" })
|
|
70
|
+
.input(SealIdSchema)
|
|
71
|
+
.output(AgentSummarySchema),
|
|
72
|
+
answer: procedure
|
|
73
|
+
.route({
|
|
74
|
+
method: "POST",
|
|
75
|
+
path: "/seal/{id}/answer",
|
|
76
|
+
summary: "Answer an ask to read",
|
|
77
|
+
description: "The author's answer to someone who asked to read their private conversation: for a day, for good, or no.",
|
|
78
|
+
})
|
|
79
|
+
.meta({ floor: "viewer", guest: true })
|
|
80
|
+
.input(SealAnswerSchema)
|
|
81
|
+
.output(AgentSummarySchema),
|
|
82
|
+
// The document is prepared here rather than in the browser so its nonce and expiry are the daemon's, and the reason
|
|
83
|
+
// the author is shown is exactly the one that was signed.
|
|
84
|
+
prepareOpen: procedure
|
|
85
|
+
.route({
|
|
86
|
+
method: "POST",
|
|
87
|
+
path: "/seal/{id}/open/prepare",
|
|
88
|
+
summary: "Prepare to open a private conversation without asking",
|
|
89
|
+
description:
|
|
90
|
+
"For the sandbox owner alone: writes the document their passkey signs to open a private conversation without asking its author, with the reason they gave. Nothing opens yet.",
|
|
91
|
+
})
|
|
92
|
+
.meta({ floor: "owner" })
|
|
93
|
+
.input(SealOpenPrepareSchema)
|
|
94
|
+
.output(SealOpenCeremonySchema),
|
|
95
|
+
open: procedure
|
|
96
|
+
.route({
|
|
97
|
+
method: "POST",
|
|
98
|
+
path: "/seal/{id}/open",
|
|
99
|
+
summary: "Open a private conversation without asking",
|
|
100
|
+
description:
|
|
101
|
+
"For the sandbox owner alone, with their passkey over the reason: lets them read a private conversation for a day without its author's yes. It is read-only, its author is told at once, and the reason stays on the conversation for good. Where an organisation asks for two people, it waits for a second person with Full access to agree.",
|
|
102
|
+
})
|
|
103
|
+
.meta({ floor: "owner" })
|
|
104
|
+
.input(SealOpenProofSchema)
|
|
105
|
+
.output(AgentSummarySchema),
|
|
106
|
+
approveOpen: procedure
|
|
107
|
+
.route({
|
|
108
|
+
method: "POST",
|
|
109
|
+
path: "/seal/{id}/open/approve",
|
|
110
|
+
summary: "Agree to an opening without asking",
|
|
111
|
+
description:
|
|
112
|
+
"The second person an organisation's two-person rule asks for: agrees to the owner opening a private conversation without asking, or refuses it. The owner cannot be their own second person.",
|
|
113
|
+
})
|
|
114
|
+
.meta({ floor: "maintainer" })
|
|
115
|
+
.input(SealApproveSchema)
|
|
116
|
+
.output(AgentSummarySchema),
|
|
117
|
+
};
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
AudienceAnswerSchema,
|
|
7
7
|
AudienceStateSchema,
|
|
8
8
|
BuiltinPromptSchema,
|
|
9
|
+
CommitIdentityAnswerSchema,
|
|
10
|
+
CommitIdentityStateSchema,
|
|
9
11
|
MemberAudienceSchema,
|
|
10
12
|
BuiltinPromptTextSchema,
|
|
11
13
|
FieldNotesStatusSchema,
|
|
@@ -124,8 +126,8 @@ export const settingsContract = {
|
|
|
124
126
|
})
|
|
125
127
|
.input(TimezoneOfferSchema)
|
|
126
128
|
.output(TimezoneStateSchema),
|
|
127
|
-
//
|
|
128
|
-
// sandbox on reads it
|
|
129
|
+
// The words follow the sandbox's mode; a person may choose their own, kept per member, so every device they open this
|
|
130
|
+
// sandbox on reads it and nobody's choice changes another member's screen. Anyone signed in may read and give their
|
|
129
131
|
// own, a guest included, since it changes nothing but the words they are shown.
|
|
130
132
|
audience: procedure
|
|
131
133
|
.route({
|
|
@@ -133,23 +135,45 @@ export const settingsContract = {
|
|
|
133
135
|
path: "/settings/audience",
|
|
134
136
|
summary: "Which words the editor uses for you here",
|
|
135
137
|
description:
|
|
136
|
-
"Whether your editor speaks git's own words (developer) or plain ones (maker) on this sandbox, in every browser and on every device
|
|
138
|
+
"Whether your editor speaks git's own words (developer) or plain ones (maker) on this sandbox, in every browser and on every device: your own choice when you made one, otherwise what the sandbox's mode speaks (plain on a hands-off sandbox). Also says which of the two it is, and the mode.",
|
|
137
139
|
})
|
|
138
140
|
.meta({ guest: true })
|
|
139
141
|
.output(MemberAudienceSchema),
|
|
140
|
-
// A
|
|
141
|
-
//
|
|
142
|
+
// A choice replaces the person's own, null forgets it; an `offer` (a browser from before the mode handing over what it
|
|
143
|
+
// kept) is always declined, and the words come back as the sandbox speaks them.
|
|
142
144
|
setAudience: procedure
|
|
143
145
|
.route({
|
|
144
146
|
method: "POST",
|
|
145
147
|
path: "/settings/audience",
|
|
146
148
|
summary: "Choose which words the editor uses for you here",
|
|
147
149
|
description:
|
|
148
|
-
"Sets whether your editor speaks git's own words (developer) or plain ones (maker) on this sandbox, for every browser and device you open it on. Other members keep their own.
|
|
150
|
+
"Sets whether your editor speaks git's own words (developer) or plain ones (maker) on this sandbox, for every browser and device you open it on, or with null follows the sandbox's mode again. Other members keep their own. An `offer` is never taken: the words come back as this sandbox speaks them to you.",
|
|
149
151
|
})
|
|
150
152
|
.meta({ guest: true, floor: "viewer" })
|
|
151
153
|
.input(AudienceAnswerSchema)
|
|
152
154
|
.output(AudienceStateSchema),
|
|
155
|
+
// A person's own, like the audience: the name and address commits made for them carry (settings.commitAttribution
|
|
156
|
+
// says whether they appear at all). Never another member's, and never their sign-in address unless they type it.
|
|
157
|
+
commitIdentity: procedure
|
|
158
|
+
.route({
|
|
159
|
+
method: "GET",
|
|
160
|
+
path: "/settings/commit-identity",
|
|
161
|
+
summary: "The name and address your commits here carry",
|
|
162
|
+
description:
|
|
163
|
+
"The commit name and address you set on this sandbox, a suggestion when you have none (the connected git account's, for the owner), and how this sandbox's commits use it. Until you set one, commits made for you name nobody.",
|
|
164
|
+
})
|
|
165
|
+
.output(CommitIdentityStateSchema),
|
|
166
|
+
setCommitIdentity: procedure
|
|
167
|
+
.route({
|
|
168
|
+
method: "POST",
|
|
169
|
+
path: "/settings/commit-identity",
|
|
170
|
+
summary: "Set the name and address your commits here carry",
|
|
171
|
+
description:
|
|
172
|
+
"Sets the commit name and address used for the work you do and ask for on this sandbox, when its settings name people in commits. Pushed commits publish the address; a provider's noreply address keeps yours private. Null forgets it. Other members keep their own.",
|
|
173
|
+
})
|
|
174
|
+
.meta({ floor: "viewer" })
|
|
175
|
+
.input(CommitIdentityAnswerSchema)
|
|
176
|
+
.output(CommitIdentityStateSchema),
|
|
153
177
|
// Like the audience, a person's own and not a sandbox setting: nobody's choice to put the checklist away or pass a
|
|
154
178
|
// step over changes another member's screen.
|
|
155
179
|
gettingStarted: procedure
|
|
@@ -35,6 +35,8 @@ import {
|
|
|
35
35
|
WorkspaceFileQuerySchema,
|
|
36
36
|
WorkspaceFileReadQuerySchema,
|
|
37
37
|
WorkspaceFileSchema,
|
|
38
|
+
WorkspaceFollowCheckoutSchema,
|
|
39
|
+
WorkspaceFollowLeaseSchema,
|
|
38
40
|
WorkspaceMediaTicketQuerySchema,
|
|
39
41
|
WorkspaceMediaTicketSchema,
|
|
40
42
|
WorkspaceDownloadTicketQuerySchema,
|
|
@@ -127,6 +129,20 @@ export const workspaceContract = {
|
|
|
127
129
|
.meta({ floor: "viewer", guest: true })
|
|
128
130
|
.input(WorkspaceDimensionsQuerySchema)
|
|
129
131
|
.output(WorkspaceDimensionsSchema),
|
|
132
|
+
// Keeps a conversation's own copy of a file watched while a reader has it open (WorkspaceFollowCheckoutSchema); the
|
|
133
|
+
// changes come as `checkoutChanged` on /events.
|
|
134
|
+
followCheckout: procedure
|
|
135
|
+
.route({
|
|
136
|
+
method: "POST",
|
|
137
|
+
path: "/workspace/follow-checkout",
|
|
138
|
+
summary: "Follow files in a conversation's own copy",
|
|
139
|
+
description:
|
|
140
|
+
"Watches the folders a conversation's own copy keeps these files in, so that while you look at one of them its changes reach you on the event stream as the agent writes, rather than when the turn ends. The watch is a lease: ask again before it runs out to keep it, and it lapses by itself when you stop. Watching is only reading, and only files you could read anyway.",
|
|
141
|
+
})
|
|
142
|
+
// Following is reading a folder's names as they change, and the watch is bounded and lapses on its own.
|
|
143
|
+
.meta({ floor: "viewer", guest: true })
|
|
144
|
+
.input(WorkspaceFollowCheckoutSchema)
|
|
145
|
+
.output(WorkspaceFollowLeaseSchema),
|
|
130
146
|
// Mints the ticket GET /workspace/media (a plain Hono byte-range route, no oRPC shape) requires to stream.
|
|
131
147
|
mediaTicket: procedure
|
|
132
148
|
.route({
|
|
@@ -361,6 +361,25 @@ export const AgentEventSchema = z.discriminatedUnion("kind", [
|
|
|
361
361
|
title: z.string().optional().describe("The page's title, once the call has written it."),
|
|
362
362
|
done: z.boolean().optional().describe("The draft is over: the page is published, or the call failed."),
|
|
363
363
|
}),
|
|
364
|
+
// A file as the model is still writing it into a call's arguments (a Write's whole content, an Edit's replacement),
|
|
365
|
+
// for a viewer open on that file to draw over it as a draft: `text` is what came at `at` in the streamed text, under
|
|
366
|
+
// the same append-or-replay rule as a page's draft. Speculative until the call settles (it may still be refused, fail
|
|
367
|
+
// or be rewritten), so live state, not transcript: `done` ends it, and every draft goes with the turn.
|
|
368
|
+
z.object({
|
|
369
|
+
kind: z.literal("file_draft"),
|
|
370
|
+
callId: z.string().describe("The tool call writing it."),
|
|
371
|
+
path: z.string().describe("The file being written, workspace-relative and forward-slash, as the call's card names it."),
|
|
372
|
+
op: z.enum(["write", "edit"]).describe("`write`: the text is the file's whole new content. `edit`: the text replaces `old` in the file."),
|
|
373
|
+
at: z.number().int().nonnegative().describe("Where in the streamed text this stretch starts."),
|
|
374
|
+
text: z.string().describe("The next stretch of the streamed text: a write's content, or an edit's replacement."),
|
|
375
|
+
old: z
|
|
376
|
+
.string()
|
|
377
|
+
.optional()
|
|
378
|
+
.describe("The text an edit replaces, sent once whole, on the first frame of an edit; absent on a write and on later frames."),
|
|
379
|
+
replaceAll: z.boolean().optional().describe("The edit replaces every occurrence of `old`, not only the first; sent once known."),
|
|
380
|
+
truncated: z.boolean().optional().describe("The draft outgrew what is streamed: nothing more of its text will come, and the file itself is the answer."),
|
|
381
|
+
done: z.boolean().optional().describe("The draft is over: the call settled (written, refused or failed)."),
|
|
382
|
+
}),
|
|
364
383
|
// The named card is released and the turn resumes; emitted the moment its waiter settles, since nothing else on
|
|
365
384
|
// this stream marks a park's end. `reply` is what a rebuilt transcript freezes the card with.
|
|
366
385
|
z.object({ kind: z.literal("resolved"), requestId: z.string(), reply: AgentReplySchema.optional() }),
|
|
@@ -470,6 +489,7 @@ export const TURN_FACT_KINDS = [
|
|
|
470
489
|
"mode",
|
|
471
490
|
"agent_status",
|
|
472
491
|
"page_draft",
|
|
492
|
+
"file_draft",
|
|
473
493
|
"error",
|
|
474
494
|
] as const;
|
|
475
495
|
export type TurnFact = Extract<AgentEvent, { kind: (typeof TURN_FACT_KINDS)[number] }>;
|
package/src/events/requests.ts
CHANGED
|
@@ -196,6 +196,14 @@ export const AgentCommandSchema = z.object({
|
|
|
196
196
|
name: z.string().describe("What to type, without the leading slash."),
|
|
197
197
|
description: z.string().describe("What it does."),
|
|
198
198
|
hint: z.string().optional().describe("What its argument should look like, shown after the name."),
|
|
199
|
+
// Claude Code's own `builtin` marker, and false for a skill a runtime published as one: a command someone wrote takes
|
|
200
|
+
// its name from the editor's own `/usage` or `/model`, a runtime's built-in gives it up (slashCommands.ts).
|
|
201
|
+
builtin: z
|
|
202
|
+
.boolean()
|
|
203
|
+
.optional()
|
|
204
|
+
.describe(
|
|
205
|
+
"True for the agent's own built-in command, false for one somebody wrote (a skill, a project or plugin command). Absent when the runtime does not say.",
|
|
206
|
+
),
|
|
199
207
|
});
|
|
200
208
|
export type AgentCommand = z.infer<typeof AgentCommandSchema>;
|
|
201
209
|
|
|
@@ -44,9 +44,32 @@ export type BootProgress = z.infer<typeof BootProgressSchema>;
|
|
|
44
44
|
export const BootSchema = z.object({ kind: z.literal("boot"), ...BootProgressSchema.shape });
|
|
45
45
|
export type Boot = z.infer<typeof BootSchema>;
|
|
46
46
|
|
|
47
|
+
// The hello's fields, named rather than inferred (agent-press.ts says the same of its press): spelled out inside the
|
|
48
|
+
// `/events` route the frame took the aggregated contract's type past what the declaration emitter will write (TS7056).
|
|
49
|
+
// A field added below is added here too, which the assignment checks.
|
|
50
|
+
type OptionalStrings = z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
+
type OptionalStringMap = z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
52
|
+
// A type rather than an interface: z.object needs the index signature only an object type literal is given.
|
|
53
|
+
export type HelloFields = {
|
|
54
|
+
readonly kind: z.ZodLiteral<"hello">;
|
|
55
|
+
readonly workspaceId: z.ZodString;
|
|
56
|
+
readonly routes: OptionalStrings;
|
|
57
|
+
readonly shapes: OptionalStringMap;
|
|
58
|
+
readonly rawRoutes: OptionalStrings;
|
|
59
|
+
readonly rawFingerprints: OptionalStringMap;
|
|
60
|
+
readonly prints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>>>;
|
|
61
|
+
readonly uploadEncodings: OptionalStrings;
|
|
62
|
+
readonly voiceCodecs: OptionalStrings;
|
|
63
|
+
readonly build: z.ZodOptional<z.ZodString>;
|
|
64
|
+
readonly boot: z.ZodOptional<typeof BootProgressSchema>;
|
|
65
|
+
readonly projectDir: z.ZodOptional<z.ZodString>;
|
|
66
|
+
readonly surface: z.ZodOptional<z.ZodEnum<{ sandbox: "sandbox"; folder: "folder" }>>;
|
|
67
|
+
readonly recordsSwitches: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
};
|
|
69
|
+
|
|
47
70
|
// The stream's first frame: `workspaceId` and `build` key the browser's persisted cache, so a wiped workspace or new
|
|
48
71
|
// image doesn't hydrate stale data. `routes`/`shapes` turn a version-skewed 404 or missing field into a named gap.
|
|
49
|
-
export const HelloSchema = z.object({
|
|
72
|
+
export const HelloSchema: z.ZodObject<HelloFields, z.core.$strip> = z.object({
|
|
50
73
|
kind: z.literal("hello"),
|
|
51
74
|
workspaceId: z.string(),
|
|
52
75
|
routes: z.array(z.string()).optional(),
|
|
@@ -58,6 +81,11 @@ export const HelloSchema = z.object({
|
|
|
58
81
|
// `rawFingerprints` is what `shapes` is for a procedure, under the name the rest of the code gives it.
|
|
59
82
|
rawRoutes: z.array(z.string()).optional(),
|
|
60
83
|
rawFingerprints: z.record(z.string(), z.string()).optional(),
|
|
84
|
+
// Every route's second print, procedures and hand-written routes in one map: `[wire, core]` (protocol/routes.ts
|
|
85
|
+
// `RoutePrints`). `wire` is the shape without its prose, `core` only what has to hold for a call to work, so a page
|
|
86
|
+
// ahead of the sandbox can tell a part that arrives with the next update from one that may misbehave. Absent means
|
|
87
|
+
// a daemon from before the field, which the browser compares on `shapes` and `rawFingerprints` as it always did.
|
|
88
|
+
prints: z.record(z.string(), z.tuple([z.string(), z.string()])).optional(),
|
|
61
89
|
// The codings `POST /workspace/upload` and `POST /workspace/upload-archive` decode a request body from
|
|
62
90
|
// (`Content-Encoding`). Absent means a daemon that writes whatever bytes arrive, so the browser sends them plain.
|
|
63
91
|
uploadEncodings: z.array(z.string()).optional(),
|
|
@@ -98,6 +126,12 @@ export type WorkspaceChanged = z.infer<typeof WorkspaceChangedSchema>;
|
|
|
98
126
|
export const DerivedChangedSchema = z.object({ kind: z.literal("derivedChanged"), paths: z.array(z.string()) });
|
|
99
127
|
export type DerivedChanged = z.infer<typeof DerivedChangedSchema>;
|
|
100
128
|
|
|
129
|
+
// Files that changed in one conversation's own copy, workspace-relative forward-slash, from the watch a reader holds on
|
|
130
|
+
// their folders (workspace.followCheckout). A checkout lives outside /work, so no `workspaceChanged` batch can carry
|
|
131
|
+
// these; never an empty "refetch everything" batch, since the watch names what it saw or says nothing.
|
|
132
|
+
export const CheckoutChangedSchema = z.object({ kind: z.literal("checkoutChanged"), agent: z.string(), paths: z.array(z.string()) });
|
|
133
|
+
export type CheckoutChanged = z.infer<typeof CheckoutChangedSchema>;
|
|
134
|
+
|
|
101
135
|
// Repos whose refs moved (commit, checkout, branch, rebase); a repo's git dir lives outside /work and the watcher
|
|
102
136
|
// ignores `.git`, so no workspace path can say this. Diff, not snapshot: an absent repo didn't move, it didn't vanish.
|
|
103
137
|
export const RefsChangedSchema = z.object({ kind: z.literal("refsChanged"), repos: z.array(z.string()) });
|
|
@@ -190,9 +224,9 @@ export const refusalsOf = (event: ProviderRefusalChanged): readonly ProviderRefu
|
|
|
190
224
|
export const TreeChangedSchema = WorkspaceTreeDeltaSchema.extend({ kind: z.literal("treeChanged") });
|
|
191
225
|
export type TreeChanged = z.infer<typeof TreeChangedSchema>;
|
|
192
226
|
|
|
193
|
-
// The /events stream union: hello, heartbeats, boot progress, workspace/repo/ref/runtime/shadow/tree changes,
|
|
194
|
-
// and fleet rosters (whole, or the cards that moved), account headroom and refusal changes. oRPC validates
|
|
195
|
-
// against this.
|
|
227
|
+
// The /events stream union: hello, heartbeats, boot progress, workspace/checkout/repo/ref/runtime/shadow/tree changes,
|
|
228
|
+
// presence and fleet rosters (whole, or the cards that moved), account headroom and refusal changes. oRPC validates
|
|
229
|
+
// every frame against this.
|
|
196
230
|
export const SystemEventSchema = z.discriminatedUnion("kind", [
|
|
197
231
|
HelloSchema,
|
|
198
232
|
HeartbeatSchema,
|
|
@@ -200,6 +234,7 @@ export const SystemEventSchema = z.discriminatedUnion("kind", [
|
|
|
200
234
|
WorkspaceChangedSchema,
|
|
201
235
|
TreeChangedSchema,
|
|
202
236
|
DerivedChangedSchema,
|
|
237
|
+
CheckoutChangedSchema,
|
|
203
238
|
ReposChangedSchema,
|
|
204
239
|
RefsChangedSchema,
|
|
205
240
|
RuntimeChangedSchema,
|
package/src/events/transcript.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ShareDetailSchema } from "../schemas/share.js";
|
|
|
3
3
|
import { TurnErrandSchema, TurnSpeakerSchema } from "../schemas/speaker.js";
|
|
4
4
|
import { SubagentKindSchema, SubagentSdkRecordSchema, SubagentStatusSchema, SubagentVerificationSchema } from "../schemas/terminal.js";
|
|
5
5
|
import { NeedSchema } from "../schemas/needs.js";
|
|
6
|
+
import { NightAnswerSchema } from "../schemas/night-hours.js";
|
|
6
7
|
import { HeldEndingSchema, RetryLadderSchema } from "../schemas/turn-break.js";
|
|
7
8
|
import { HandoffOfferSchema } from "../schemas/providers/handoff.js";
|
|
8
9
|
import { NoticeCodeSchema } from "./sandbox-notice.js";
|
|
@@ -52,7 +53,11 @@ export type OfferStatus = z.infer<typeof OfferStatusSchema>;
|
|
|
52
53
|
export const CapabilityOfferStatusSchema = z.enum(["pending", "connecting", "skipped", "cancelled"]);
|
|
53
54
|
export type CapabilityOfferStatus = z.infer<typeof CapabilityOfferStatusSchema>;
|
|
54
55
|
|
|
55
|
-
export const TranscriptPlanSchema = z.object({
|
|
56
|
+
export const TranscriptPlanSchema = z.object({
|
|
57
|
+
...planRequest,
|
|
58
|
+
status: PlanStatusSchema.describe("Where the decision stands."),
|
|
59
|
+
night: NightAnswerSchema.optional().describe("Present when night hours approved it with nobody at the editor, rather than a person."),
|
|
60
|
+
});
|
|
56
61
|
export type TranscriptPlan = z.infer<typeof TranscriptPlanSchema>;
|
|
57
62
|
export const TranscriptQuestionSchema = z.object({
|
|
58
63
|
...questionRequest,
|
|
@@ -65,6 +70,9 @@ export const TranscriptQuestionSchema = z.object({
|
|
|
65
70
|
.record(z.string(), z.array(z.string()))
|
|
66
71
|
.optional()
|
|
67
72
|
.describe("Files the user attached to their own-words answer, keyed by the question, as workspace-relative paths."),
|
|
73
|
+
night: NightAnswerSchema.optional().describe(
|
|
74
|
+
"Present when night hours answered it with nobody at the editor, rather than a person: with the agent's own recommendation, or by keeping it for the morning.",
|
|
75
|
+
),
|
|
68
76
|
});
|
|
69
77
|
export type TranscriptQuestion = z.infer<typeof TranscriptQuestionSchema>;
|
|
70
78
|
// `explain`, the judge's sentence, arrives via PermissionAskSchema at raise time; nothing patches it in after.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { newRowId, positionRowId } from "./row-ids.js";
|
|
2
|
+
|
|
3
|
+
describe("row ids", () => {
|
|
4
|
+
it("mints twelve base-36 characters, a fresh one each time", () => {
|
|
5
|
+
const ids = Array.from({ length: 200 }, () => newRowId());
|
|
6
|
+
for (const id of ids) {
|
|
7
|
+
expect(id).toMatch(/^[0-9a-z]{12}$/);
|
|
8
|
+
}
|
|
9
|
+
expect(new Set(ids).size).toBe(ids.length);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("draws a byte past the alphabet's last whole multiple again rather than folding it back", () => {
|
|
13
|
+
const draws = [new Uint8Array([255, 252, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), new Uint8Array([35, 251])];
|
|
14
|
+
const spy = jest.spyOn(globalThis.crypto, "getRandomValues").mockImplementation(<T extends ArrayBufferView | null>(array: T): T => {
|
|
15
|
+
const next = draws.shift();
|
|
16
|
+
if (array instanceof Uint8Array && next !== undefined) {
|
|
17
|
+
array.set(next.subarray(0, array.length));
|
|
18
|
+
}
|
|
19
|
+
return array;
|
|
20
|
+
});
|
|
21
|
+
try {
|
|
22
|
+
expect(newRowId()).toBe("0123456789zz");
|
|
23
|
+
} finally {
|
|
24
|
+
spy.mockRestore();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("names a row recorded before ids by its position", () => {
|
|
29
|
+
expect(positionRowId(7)).toBe("@7");
|
|
30
|
+
});
|
|
31
|
+
});
|