orizu 0.5.41 → 0.5.43
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/account-directory.d.ts.map +1 -1
- package/dist/account-directory.js +6 -32
- package/dist/app-publish-workspace.js +1 -1
- package/dist/archive-artifact-workflow.d.ts +23 -0
- package/dist/archive-artifact-workflow.d.ts.map +1 -0
- package/dist/archive-artifact-workflow.js +100 -0
- package/dist/archive-artifacts-cli.d.ts.map +1 -1
- package/dist/archive-artifacts-cli.js +7 -11
- package/dist/artifact-archive.d.ts.map +1 -1
- package/dist/artifact-archive.js +2 -0
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +2 -0
- package/dist/dataset-commands.d.ts.map +1 -1
- package/dist/dataset-commands.js +19 -29
- package/dist/dataset-split-create-workflow.d.ts +16 -0
- package/dist/dataset-split-create-workflow.d.ts.map +1 -0
- package/dist/dataset-split-create-workflow.js +115 -0
- package/dist/git-credential.js +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +10 -2
- package/dist/hosted-boot.d.ts +7 -0
- package/dist/hosted-boot.d.ts.map +1 -1
- package/dist/hosted-boot.js +290 -60
- package/dist/hosted-harness.d.ts +1 -0
- package/dist/hosted-harness.d.ts.map +1 -1
- package/dist/hosted-harness.js +2 -0
- package/dist/hosted-harvest.d.ts +2 -1
- package/dist/hosted-harvest.d.ts.map +1 -1
- package/dist/hosted-harvest.js +29 -17
- package/dist/hosted-live-channel.d.ts +31 -0
- package/dist/hosted-live-channel.d.ts.map +1 -0
- package/dist/hosted-live-channel.js +147 -0
- package/dist/hosted-loop.d.ts +8 -1
- package/dist/hosted-loop.d.ts.map +1 -1
- package/dist/hosted-loop.js +45 -0
- package/dist/hosted-run-event-sink.d.ts +19 -0
- package/dist/hosted-run-event-sink.d.ts.map +1 -1
- package/dist/hosted-run-event-sink.js +106 -3
- package/dist/hosted-runtime-assets.js +1 -1
- package/dist/hosted-session-cli.d.ts.map +1 -1
- package/dist/hosted-session-cli.js +4 -0
- package/dist/hosted-session-seed.d.ts +46 -6
- package/dist/hosted-session-seed.d.ts.map +1 -1
- package/dist/hosted-session-seed.js +95 -9
- package/dist/hosted-skill-staging.d.ts +36 -12
- package/dist/hosted-skill-staging.d.ts.map +1 -1
- package/dist/hosted-skill-staging.js +96 -34
- package/dist/http.d.ts +2 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -16
- package/dist/orizu-skill-links.d.ts +48 -0
- package/dist/orizu-skill-links.d.ts.map +1 -0
- package/dist/orizu-skill-links.js +99 -0
- package/dist/preview-runtime.d.ts +1 -0
- package/dist/preview-runtime.d.ts.map +1 -1
- package/dist/preview-runtime.js +15 -0
- package/dist/repository-backup-core.d.ts.map +1 -1
- package/dist/repository-backup-core.js +2 -0
- package/dist/request-outcome.d.ts +5 -0
- package/dist/request-outcome.d.ts.map +1 -0
- package/dist/request-outcome.js +27 -0
- package/dist/score-save-workflow.d.ts +26 -0
- package/dist/score-save-workflow.d.ts.map +1 -0
- package/dist/score-save-workflow.js +120 -0
- package/dist/setup-and-skills-commands.d.ts.map +1 -1
- package/dist/setup-and-skills-commands.js +52 -7
- package/dist/setup-onboarding.d.ts.map +1 -1
- package/dist/setup-onboarding.js +6 -2
- package/dist/skill-installer.d.ts +16 -0
- package/dist/skill-installer.d.ts.map +1 -1
- package/dist/skill-installer.js +35 -5
- package/dist/team-create-workflow.d.ts +16 -0
- package/dist/team-create-workflow.d.ts.map +1 -0
- package/dist/team-create-workflow.js +107 -0
- package/dist/team-member-change-workflow.d.ts +25 -0
- package/dist/team-member-change-workflow.d.ts.map +1 -0
- package/dist/team-member-change-workflow.js +132 -0
- package/dist/workbench-cli.d.ts.map +1 -1
- package/dist/workbench-cli.js +24 -4
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +2 -0
- package/package.json +1 -1
- package/src/account-directory.ts +6 -41
- package/src/app-publish-workspace.ts +1 -1
- package/src/archive-artifact-workflow.ts +101 -0
- package/src/archive-artifacts-cli.ts +7 -28
- package/src/artifact-archive.ts +2 -0
- package/src/credentials.ts +2 -0
- package/src/dataset-commands.ts +19 -31
- package/src/dataset-split-create-workflow.ts +128 -0
- package/src/git-credential.ts +1 -1
- package/src/help.ts +10 -2
- package/src/hosted-boot.ts +292 -59
- package/src/hosted-harness.ts +2 -0
- package/src/hosted-harvest.ts +30 -17
- package/src/hosted-live-channel.ts +167 -0
- package/src/hosted-loop.ts +50 -0
- package/src/hosted-run-event-sink.ts +118 -3
- package/src/hosted-runtime-assets.ts +1 -1
- package/src/hosted-session-cli.ts +4 -0
- package/src/hosted-session-seed.ts +111 -10
- package/src/hosted-skill-staging.ts +110 -36
- package/src/http.ts +12 -7
- package/src/index.ts +17 -21
- package/src/orizu-skill-links.ts +114 -0
- package/src/preview-runtime.ts +16 -0
- package/src/repository-backup-core.ts +2 -0
- package/src/request-outcome.ts +28 -0
- package/src/score-save-workflow.ts +132 -0
- package/src/setup-and-skills-commands.ts +60 -6
- package/src/setup-onboarding.ts +6 -2
- package/src/skill-installer.ts +46 -5
- package/src/team-create-workflow.ts +109 -0
- package/src/team-member-change-workflow.ts +146 -0
- package/src/workbench-cli.ts +24 -4
- package/src/workspace.ts +2 -0
package/dist/hosted-harvest.js
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* 1. `git status --porcelain` (plumbing) decides if the clone is dirty. Ignored
|
|
9
9
|
* files never appear in porcelain output, so a checkpoint is skipped when the
|
|
10
10
|
* only changes are ignored files.
|
|
11
|
-
* 2. If dirty: `git add -A
|
|
11
|
+
* 2. If dirty: `git add -A`, unstage the staged Orizu skill links
|
|
12
|
+
* (orizu-skill-links.ts), and if anything is still staged, `git commit` attributed to the agent identity
|
|
12
13
|
* (AGENT_GIT_IDENTITY) with message `checkpoint: run <runId> auto-harvest`.
|
|
13
14
|
* 3. If there is anything unpushed (a fresh checkpoint OR pre-existing local
|
|
14
15
|
* commits the agent made but did not push), push the exact HEAD SHA to the
|
|
@@ -30,6 +31,7 @@ import { mkdtempSync, readdirSync, rmSync, statSync } from 'fs';
|
|
|
30
31
|
import { tmpdir } from 'os';
|
|
31
32
|
import { join } from 'path';
|
|
32
33
|
import { isValidCloudflareArtifactsGitRemote, parseCanonicalCredentialFreeHttpsUrl, } from './cloudflare-artifacts-git-remote.js';
|
|
34
|
+
import { hasStagedChanges, NOTHING_STAGED_ERROR, unstageOrizuSkillLinks } from './orizu-skill-links.js';
|
|
33
35
|
export const HOSTED_HARVEST_CA_BUNDLE_CANDIDATES = [
|
|
34
36
|
'/etc/pki/tls/certs/ca-bundle.crt',
|
|
35
37
|
'/etc/ssl/certs/ca-certificates.crt',
|
|
@@ -224,31 +226,41 @@ export function harvestWorkspace(opts) {
|
|
|
224
226
|
return { kind: 'work_persist_failed', error: 'hosted_harvest_ca_path_policy_ineffective' };
|
|
225
227
|
}
|
|
226
228
|
}
|
|
227
|
-
//
|
|
228
|
-
//
|
|
229
|
-
//
|
|
230
|
-
//
|
|
231
|
-
const
|
|
232
|
-
const status = exec(['status', '--porcelain', '--', '.', ...excludeScaffold]);
|
|
229
|
+
// `git status` is only the cheap first look; whether there is anything to
|
|
230
|
+
// save is decided from the index after the staged skill links are taken
|
|
231
|
+
// back out (ALI-1051, ORI-2442). A sandbox where the ignore lines did not
|
|
232
|
+
// run shows the links here and still saves nothing.
|
|
233
|
+
const status = exec(['status', '--porcelain']);
|
|
233
234
|
if (status.exitCode !== 0) {
|
|
234
235
|
return { kind: 'work_persist_failed', error: `git status failed: ${detail(status)}` };
|
|
235
236
|
}
|
|
236
|
-
|
|
237
|
+
let dirty = status.stdout.trim().length > 0;
|
|
237
238
|
if (dirty) {
|
|
238
|
-
// Add everything, then unstage the staged skill
|
|
239
|
-
// pathspec on add makes git exit 1
|
|
240
|
-
// .
|
|
241
|
-
//
|
|
242
|
-
//
|
|
243
|
-
// reset, unlike rm --cached, never deletes a tracked file.
|
|
239
|
+
// Add everything, then unstage the staged skill links. An exclude
|
|
240
|
+
// pathspec on add makes git exit 1 for ignored paths (ORI-2441, git 2.49
|
|
241
|
+
// in the sandbox). Only the links themselves are reset, so an agent's
|
|
242
|
+
// edits to a team's own skills next to them are saved; reset, unlike
|
|
243
|
+
// rm --cached, never deletes a tracked file.
|
|
244
244
|
const add = exec(['add', '-A', '--', '.']);
|
|
245
245
|
if (add.exitCode !== 0) {
|
|
246
246
|
return { kind: 'work_persist_failed', error: `git add failed: ${detail(add)}` };
|
|
247
247
|
}
|
|
248
|
-
const unstage = exec
|
|
249
|
-
if (unstage.
|
|
250
|
-
return { kind: 'work_persist_failed', error:
|
|
248
|
+
const unstage = unstageOrizuSkillLinks(exec);
|
|
249
|
+
if (!unstage.ok) {
|
|
250
|
+
return { kind: 'work_persist_failed', error: unstage.error };
|
|
251
251
|
}
|
|
252
|
+
const staged = hasStagedChanges(exec);
|
|
253
|
+
if (typeof staged !== 'boolean') {
|
|
254
|
+
return { kind: 'work_persist_failed', error: staged.error };
|
|
255
|
+
}
|
|
256
|
+
// Dirty with nothing staged and no link taken out means the work cannot
|
|
257
|
+
// be committed here; say so rather than report nothing to save.
|
|
258
|
+
if (!staged && unstage.unstaged.length === 0) {
|
|
259
|
+
return { kind: 'work_persist_failed', error: NOTHING_STAGED_ERROR };
|
|
260
|
+
}
|
|
261
|
+
dirty = staged;
|
|
262
|
+
}
|
|
263
|
+
if (dirty) {
|
|
252
264
|
const commit = exec([
|
|
253
265
|
'-c',
|
|
254
266
|
`user.name=${opts.author.name}`,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ORI-2200 slice 2 (ADR-040): the sandbox's socket to its session coordinator.
|
|
3
|
+
* The coordinator sends "check now" when someone presses Stop; the sandbox
|
|
4
|
+
* then reads its session at once instead of waiting for the next regular read.
|
|
5
|
+
* The message carries no instruction of its own: the session record decides
|
|
6
|
+
* whether this run was interrupted, so a forged or stray check costs one read.
|
|
7
|
+
*
|
|
8
|
+
* Best effort. If the socket cannot open (an older coordinator, a network
|
|
9
|
+
* rule), the regular read every few seconds still catches the Stop.
|
|
10
|
+
*
|
|
11
|
+
* ORI-2594: the sandbox also sends its reply text here, so the chat sees it
|
|
12
|
+
* before each save lands. Also best effort: the saves still carry every reply.
|
|
13
|
+
*/
|
|
14
|
+
import type { LiveTextSnapshot } from './hosted-run-event-sink.js';
|
|
15
|
+
export interface HostedLiveChannel {
|
|
16
|
+
/** Resolves on the next "check now" (or at once if one arrived since the last call), or when `signal` aborts. */
|
|
17
|
+
nextCheck(signal: AbortSignal): Promise<void>;
|
|
18
|
+
/** How many checks have arrived so far, read or not. */
|
|
19
|
+
checkCount(): number;
|
|
20
|
+
/** Sends one reply snapshot now if the socket is open and the coordinator takes text; true when sent (a socket still opening refuses it). */
|
|
21
|
+
sendText(snapshot: LiveTextSnapshot): boolean;
|
|
22
|
+
close(): void;
|
|
23
|
+
}
|
|
24
|
+
export declare function openHostedLiveChannel(opts: {
|
|
25
|
+
/** `<coordinator>/sessions/<id>/live/sandbox-pass`. */
|
|
26
|
+
sandboxPassUrl: string;
|
|
27
|
+
bootSecret: string;
|
|
28
|
+
fetchImpl?: (url: string, init?: RequestInit) => Promise<Response>;
|
|
29
|
+
log?: (line: string) => void;
|
|
30
|
+
}): HostedLiveChannel;
|
|
31
|
+
//# sourceMappingURL=hosted-live-channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-live-channel.d.ts","sourceRoot":"","sources":["../src/hosted-live-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAelE,MAAM,WAAW,iBAAiB;IAChC,iHAAiH;IACjH,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7C,wDAAwD;IACxD,UAAU,IAAI,MAAM,CAAA;IACpB,6IAA6I;IAC7I,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAA;IAC7C,KAAK,IAAI,IAAI,CAAA;CACd;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IAClE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7B,GAAG,iBAAiB,CA0HpB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
const RECONNECT_MAX_MS = 30_000;
|
|
2
|
+
const PASS_TIMEOUT_MS = 10_000;
|
|
3
|
+
// The coordinator closes an old socket with this code instead of sending it the
|
|
4
|
+
// update that arrived, so the close counts as a check; reconnect at once.
|
|
5
|
+
const RECHECK_CLOSE_CODE = 4001;
|
|
6
|
+
// An older coordinator closes a socket that sends anything with this code; the
|
|
7
|
+
// channel then keeps the socket for checks only.
|
|
8
|
+
const LISTEN_ONLY_CLOSE_CODE = 1008;
|
|
9
|
+
// A socket this backed up is on a slow network; skip snapshots rather than
|
|
10
|
+
// queue them, since the next one carries the whole reply.
|
|
11
|
+
const MAX_BUFFERED_BYTES = 256 * 1024;
|
|
12
|
+
export function openHostedLiveChannel(opts) {
|
|
13
|
+
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
14
|
+
let isClosed = false;
|
|
15
|
+
let socket = null;
|
|
16
|
+
let timer = null;
|
|
17
|
+
let failures = 0;
|
|
18
|
+
let hasPendingCheck = false;
|
|
19
|
+
let checks = 0;
|
|
20
|
+
let isTextRefused = false;
|
|
21
|
+
let textSocket = null;
|
|
22
|
+
const waiters = new Set();
|
|
23
|
+
const diagnose = (line) => {
|
|
24
|
+
try {
|
|
25
|
+
opts.log?.(line);
|
|
26
|
+
}
|
|
27
|
+
catch { /* diagnostics are best-effort */ }
|
|
28
|
+
};
|
|
29
|
+
const retry = (delayMs) => {
|
|
30
|
+
if (isClosed)
|
|
31
|
+
return;
|
|
32
|
+
timer = setTimeout(() => { void connect(); }, delayMs);
|
|
33
|
+
};
|
|
34
|
+
const backoff = () => Math.min(1_000 * (2 ** failures++), RECONNECT_MAX_MS);
|
|
35
|
+
const deliverCheck = () => {
|
|
36
|
+
checks += 1;
|
|
37
|
+
if (waiters.size === 0) {
|
|
38
|
+
hasPendingCheck = true;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
for (const wake of [...waiters])
|
|
42
|
+
wake();
|
|
43
|
+
};
|
|
44
|
+
const connect = async () => {
|
|
45
|
+
let url;
|
|
46
|
+
try {
|
|
47
|
+
const response = await fetchImpl(opts.sandboxPassUrl, {
|
|
48
|
+
method: 'POST',
|
|
49
|
+
headers: { authorization: `Bearer ${opts.bootSecret}` },
|
|
50
|
+
signal: AbortSignal.timeout(PASS_TIMEOUT_MS),
|
|
51
|
+
});
|
|
52
|
+
if (!response.ok) {
|
|
53
|
+
await response.body?.cancel();
|
|
54
|
+
// Fixed, value-free diagnostics: no secret, pass or URL is logged.
|
|
55
|
+
diagnose(`hosted live channel refused (${response.status}); the regular session read continues`);
|
|
56
|
+
return retry(backoff());
|
|
57
|
+
}
|
|
58
|
+
url = (await response.json()).url;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
diagnose('hosted live channel unavailable; the regular session read continues');
|
|
62
|
+
return retry(backoff());
|
|
63
|
+
}
|
|
64
|
+
if (isClosed)
|
|
65
|
+
return;
|
|
66
|
+
let opened;
|
|
67
|
+
try {
|
|
68
|
+
opened = new WebSocket(url);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return retry(backoff());
|
|
72
|
+
}
|
|
73
|
+
socket = opened;
|
|
74
|
+
opened.onopen = () => { failures = 0; };
|
|
75
|
+
opened.onmessage = event => {
|
|
76
|
+
let message;
|
|
77
|
+
try {
|
|
78
|
+
message = JSON.parse(String(event.data));
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (message && typeof message === 'object' && message.kind === 'check')
|
|
84
|
+
deliverCheck();
|
|
85
|
+
};
|
|
86
|
+
opened.onclose = event => {
|
|
87
|
+
if (socket !== opened)
|
|
88
|
+
return;
|
|
89
|
+
socket = null;
|
|
90
|
+
if (event.code === LISTEN_ONLY_CLOSE_CODE && textSocket === opened) {
|
|
91
|
+
isTextRefused = true;
|
|
92
|
+
diagnose('hosted live channel does not take reply text; the saves carry it');
|
|
93
|
+
}
|
|
94
|
+
if (event.code === RECHECK_CLOSE_CODE) {
|
|
95
|
+
deliverCheck();
|
|
96
|
+
return retry(0);
|
|
97
|
+
}
|
|
98
|
+
retry(backoff());
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
void connect();
|
|
102
|
+
return {
|
|
103
|
+
nextCheck(signal) {
|
|
104
|
+
if (hasPendingCheck) {
|
|
105
|
+
hasPendingCheck = false;
|
|
106
|
+
return Promise.resolve();
|
|
107
|
+
}
|
|
108
|
+
return new Promise(resolve => {
|
|
109
|
+
if (signal.aborted)
|
|
110
|
+
return resolve();
|
|
111
|
+
const wake = () => {
|
|
112
|
+
waiters.delete(wake);
|
|
113
|
+
signal.removeEventListener('abort', wake);
|
|
114
|
+
resolve();
|
|
115
|
+
};
|
|
116
|
+
waiters.add(wake);
|
|
117
|
+
signal.addEventListener('abort', wake, { once: true });
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
checkCount: () => checks,
|
|
121
|
+
sendText(snapshot) {
|
|
122
|
+
const open = socket;
|
|
123
|
+
if (isClosed || isTextRefused || !open)
|
|
124
|
+
return false;
|
|
125
|
+
if (open.bufferedAmount > MAX_BUFFERED_BYTES)
|
|
126
|
+
return false;
|
|
127
|
+
try {
|
|
128
|
+
open.send(JSON.stringify({ v: 1, kind: 'text', ...snapshot }));
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
textSocket = open;
|
|
134
|
+
return true;
|
|
135
|
+
},
|
|
136
|
+
close() {
|
|
137
|
+
isClosed = true;
|
|
138
|
+
if (timer)
|
|
139
|
+
clearTimeout(timer);
|
|
140
|
+
const open = socket;
|
|
141
|
+
socket = null;
|
|
142
|
+
open?.close(1000);
|
|
143
|
+
for (const wake of [...waiters])
|
|
144
|
+
wake();
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
package/dist/hosted-loop.d.ts
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
import { type AgentHarness } from './hosted-harness.js';
|
|
38
38
|
import { type HarvestExec } from './hosted-harvest.js';
|
|
39
39
|
import { type ModelValidationOutcome, type SpawnOpenCodeOptions, type SpawnedOpenCode } from './hosted-harness-opencode.js';
|
|
40
|
-
import { type HostedFetch, type TerminalStatus } from './hosted-run-event-sink.js';
|
|
40
|
+
import { type HostedFetch, type LiveTextSnapshot, type TerminalStatus } from './hosted-run-event-sink.js';
|
|
41
41
|
import { type EgressProbeResult, type HostedLoopContext, type SetupHookOutcome } from './hosted-loop-lifecycle.js';
|
|
42
42
|
export { DEFAULT_EGRESS_CANARY_HOST, DEFAULT_HOSTED_MODEL, buildOpenCodeSpawnEnv, egressCanaryAllowedHost, runEgressCanary, } from './hosted-loop-lifecycle.js';
|
|
43
43
|
export type { EgressCanaryDecision, EgressCanaryTargets, EgressProbeResult, HostedLoopContext, SetupHookOutcome, } from './hosted-loop-lifecycle.js';
|
|
@@ -125,6 +125,8 @@ export interface RunHostedLoopOptions {
|
|
|
125
125
|
interruptSignal?: AbortSignal;
|
|
126
126
|
/** Extra verbatim secrets to redact (the bearer is added by the sink itself). */
|
|
127
127
|
redactSecretsList?: readonly string[];
|
|
128
|
+
/** ORI-2594: each reply snapshot for the sandbox's coordinator socket (see the sink's `onLiveText`). */
|
|
129
|
+
onLiveText?: (snapshot: LiveTextSnapshot) => boolean | void;
|
|
128
130
|
/** Egress-canary probe (default: a bounded `fetch` to https://<host>/).
|
|
129
131
|
* Injectable so tests exercise both the blocked and reachable branches with
|
|
130
132
|
* no real network. Called once per host (allowed + denied) by the canary. */
|
|
@@ -147,6 +149,11 @@ export interface RunHostedLoopOptions {
|
|
|
147
149
|
* real `git` via child_process in `context.workspaceDir`.
|
|
148
150
|
*/
|
|
149
151
|
harvestExec?: HarvestExec;
|
|
152
|
+
/** ORI-2512: the boot's background fill of the session copy. Awaited
|
|
153
|
+
* (at most BEFORE_SAVE_WAIT_MS each time) before the end-of-run save, so
|
|
154
|
+
* two pushes never race, and before a customer setup hook, which may pull
|
|
155
|
+
* from the session copy. */
|
|
156
|
+
beforeSave?: () => Promise<void>;
|
|
150
157
|
/**
|
|
151
158
|
* Idle watchdog window (ALI-1037): abort the prompt + fail the run
|
|
152
159
|
* `agent_stalled` if NO progress event arrives for this many ms. Default: env
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-loop.d.ts","sourceRoot":"","sources":["../src/hosted-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAOH,OAAO,EAAyB,KAAK,YAAY,EAAyC,MAAM,qBAAqB,CAAA;AAQrH,OAAO,EAAoB,KAAK,WAAW,EAAuB,MAAM,qBAAqB,CAAA;AAE7F,OAAO,EAOL,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,8BAA8B,CAAA;AAIrC,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAOL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,4BAA4B,CAAA;AAKnC,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,qBAAqB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CAAA;AAiC/D;;;;;0CAK0C;AAC1C,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,aAAa,CAW7F;AAwDD,wBAAsB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAujBzF;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CAalC;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,uBAAuB,EAChC,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,YAAY,GAAG,eAAe,CAAC,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GACvG,OAAO,CAAC,gBAAgB,CAAC,CAe3B;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAU5F;AAID,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAyCD;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,EAAE,mBAAmB,GACtB,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
|
package/dist/hosted-loop.js
CHANGED
|
@@ -201,6 +201,25 @@ function nodeChildSpawner(cmd, opts) {
|
|
|
201
201
|
}
|
|
202
202
|
return { kill: () => child.kill() };
|
|
203
203
|
}
|
|
204
|
+
/** ORI-2512: the longest the end-of-turn save waits for the boot's
|
|
205
|
+
* background fill of the session copy before saving anyway. */
|
|
206
|
+
const BEFORE_SAVE_WAIT_MS = 60_000;
|
|
207
|
+
// Bounded: a stalled background push must never hold the turn's work.
|
|
208
|
+
async function waitForSessionCopyFill(fill, diagnose) {
|
|
209
|
+
let timer;
|
|
210
|
+
try {
|
|
211
|
+
await Promise.race([
|
|
212
|
+
fill(),
|
|
213
|
+
new Promise(resolve => { timer = setTimeout(resolve, BEFORE_SAVE_WAIT_MS); }),
|
|
214
|
+
]);
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
diagnose('hosted pre-save wait failed');
|
|
218
|
+
}
|
|
219
|
+
finally {
|
|
220
|
+
clearTimeout(timer);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
204
223
|
export async function runHostedLoop(opts) {
|
|
205
224
|
const { context, taskPrompt } = opts;
|
|
206
225
|
const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
|
|
@@ -231,6 +250,7 @@ export async function runHostedLoop(opts) {
|
|
|
231
250
|
now: opts.now,
|
|
232
251
|
redactSecretsList: [...(opts.redactSecretsList ?? []), ...redactionListFromEnv()],
|
|
233
252
|
onDiagnostic: diagnose,
|
|
253
|
+
onLiveText: opts.onLiveText,
|
|
234
254
|
});
|
|
235
255
|
// G5 startup canary (fail-closed, POSITIVE CONTROL): when the host applied an
|
|
236
256
|
// enforced egress policy it sets `egressCanaryHost`; probe BOTH the denied host
|
|
@@ -296,6 +316,11 @@ export async function runHostedLoop(opts) {
|
|
|
296
316
|
if (context.runSetupHook && !opts.sharedRuntime?.startupComplete) {
|
|
297
317
|
try {
|
|
298
318
|
const runHook = opts.runSetupHook ?? defaultRunSetupHook;
|
|
319
|
+
// A customer hook may pull from origin, which is the session copy and
|
|
320
|
+
// stays empty until the boot's background fill lands.
|
|
321
|
+
if (opts.beforeSave && existsSync(join(context.workspaceDir, SETUP_HOOK_RELATIVE_PATH))) {
|
|
322
|
+
await waitForSessionCopyFill(opts.beforeSave, diagnose);
|
|
323
|
+
}
|
|
299
324
|
const outcome = await runHook({ workspaceDir: context.workspaceDir });
|
|
300
325
|
await sink.append({
|
|
301
326
|
kind: 'artifact',
|
|
@@ -338,6 +363,26 @@ export async function runHostedLoop(opts) {
|
|
|
338
363
|
if (harvested)
|
|
339
364
|
return checkpointFinishPatch;
|
|
340
365
|
harvested = true;
|
|
366
|
+
// ORI-2517: the model is done; tell the chat before the save starts so the
|
|
367
|
+
// reply shows finished instead of "Thinking" through the save. The append
|
|
368
|
+
// also posts the reply's last buffered text, which the save would hold
|
|
369
|
+
// back: harvestWorkspace runs git synchronously and blocks the flush timer.
|
|
370
|
+
// Best-effort: if it does not land, the chat waits for the terminal state
|
|
371
|
+
// as before. It is posted only once the reply's last text is confirmed
|
|
372
|
+
// delivered; otherwise the chat would show a cut-off reply as finished for
|
|
373
|
+
// the whole save.
|
|
374
|
+
if (!sink.sealed) {
|
|
375
|
+
try {
|
|
376
|
+
await sink.flushTokens();
|
|
377
|
+
if (!sink.hasUndeliveredTokens)
|
|
378
|
+
await sink.append({ kind: 'work_saving', payload: {} });
|
|
379
|
+
}
|
|
380
|
+
catch {
|
|
381
|
+
diagnose('hosted saving event delivery failed');
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (opts.beforeSave)
|
|
385
|
+
await waitForSessionCopyFill(opts.beforeSave, diagnose);
|
|
341
386
|
let outcome;
|
|
342
387
|
try {
|
|
343
388
|
const markerValid = hasValidPrebakedMarker(prebakedMarkerPath);
|
|
@@ -72,6 +72,9 @@ export interface RunEventSink {
|
|
|
72
72
|
finish(status: TerminalStatus, opts?: FinishOptions): Promise<void>;
|
|
73
73
|
/** True once a terminal transition has landed and the sink is sealed. */
|
|
74
74
|
readonly sealed: boolean;
|
|
75
|
+
/** True while a token snapshot is still buffered: its last POST was not
|
|
76
|
+
* confirmed delivered (ORI-2517). */
|
|
77
|
+
readonly hasUndeliveredTokens: boolean;
|
|
75
78
|
/** True when an append met 404/410, i.e. the server ended the run, not this
|
|
76
79
|
* writer's PATCH. A timer flush can learn this with no caller awaiting it. */
|
|
77
80
|
readonly terminatedServerSide: boolean;
|
|
@@ -169,10 +172,26 @@ export interface CreateRunEventSinkOptions {
|
|
|
169
172
|
/** How often buffered token snapshots are flushed while a reply is being
|
|
170
173
|
* written (ORI-2340). Default TOKEN_FLUSH_MS. */
|
|
171
174
|
tokenFlushMs?: number;
|
|
175
|
+
/** ORI-2594: given each reply snapshot, scrubbed like the saved copy, at most
|
|
176
|
+
* once per `liveTextMs`, for the sandbox's coordinator socket. Never awaited
|
|
177
|
+
* and never retried: the next snapshot carries the whole reply. Returns false
|
|
178
|
+
* when the socket declined it, so an unchanged snapshot is offered again. */
|
|
179
|
+
onLiveText?: (snapshot: LiveTextSnapshot) => boolean | void;
|
|
180
|
+
/** Spacing of `onLiveText` calls. Default LIVE_TEXT_MS. */
|
|
181
|
+
liveTextMs?: number;
|
|
182
|
+
}
|
|
183
|
+
/** One reply snapshot for the coordinator socket. `sequence` is the next one
|
|
184
|
+
* the sink will save, so the chat places it where the saved copy will land. */
|
|
185
|
+
export interface LiveTextSnapshot {
|
|
186
|
+
runId: string;
|
|
187
|
+
messageId: string;
|
|
188
|
+
sequence: number;
|
|
189
|
+
text: string;
|
|
172
190
|
}
|
|
173
191
|
/** A text-only reply reaches the browser as growing snapshots at this cadence
|
|
174
192
|
* instead of whole at the end of the turn (ORI-2340). */
|
|
175
193
|
export declare const TOKEN_FLUSH_MS = 250;
|
|
194
|
+
export declare const LIVE_TEXT_MAX_CHARS = 16384;
|
|
176
195
|
export declare function createRunEventSink(options: CreateRunEventSinkOptions): RunEventSink;
|
|
177
196
|
export interface ResumeRunEventSinkOptions extends Omit<CreateRunEventSinkOptions, 'startSequence'> {
|
|
178
197
|
/** Page size for the cursor tail while discovering the latest sequence. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-run-event-sink.d.ts","sourceRoot":"","sources":["../src/hosted-run-event-sink.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK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c,MAAM,CAAA;AAQjC,eAAO,MAAM,mBAAmB,QAAS,CAAA;AAkBzC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,YAAY,CAodnF;AAID,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC;IACjG,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,YAAY,CAAC,CAyBvB;AAID,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAA;CACxD;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,EACnC,IAAI,EAAE,YAAY,EAClB,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC,cAAc,CAAC,CAyFzB"}
|
|
@@ -74,6 +74,7 @@ const EVENT_TYPE_BY_KIND = {
|
|
|
74
74
|
// Durability + headless (ALI-1036 / ALI-1037), emitted by the in-sandbox loop
|
|
75
75
|
// through this SAME sink (single writer): auto-harvest results + headless
|
|
76
76
|
// question auto-handling record.
|
|
77
|
+
work_saving: 'work_saving',
|
|
77
78
|
work_persisted: 'work_persisted',
|
|
78
79
|
work_none: 'work_none',
|
|
79
80
|
work_not_inspected: 'work_not_inspected',
|
|
@@ -159,6 +160,13 @@ function isTerminalStatus(status) {
|
|
|
159
160
|
/** A text-only reply reaches the browser as growing snapshots at this cadence
|
|
160
161
|
* instead of whole at the end of the turn (ORI-2340). */
|
|
161
162
|
export const TOKEN_FLUSH_MS = 250; // held equal to SESSION_TIMERS.agentTokenFlushMs by test
|
|
163
|
+
/** ORI-2594: the chat follows the model about this closely over the socket,
|
|
164
|
+
* while saves keep their own TOKEN_FLUSH_MS pace. */
|
|
165
|
+
const LIVE_TEXT_MS = 75;
|
|
166
|
+
// The session read shows at most this much of a reply (activity-projection.ts),
|
|
167
|
+
// and the coordinator cuts live text the same way; cutting here keeps every
|
|
168
|
+
// socket message well under the coordinator's size limit.
|
|
169
|
+
export const LIVE_TEXT_MAX_CHARS = 16_384;
|
|
162
170
|
const DEFAULT_MAX_CRITICAL_ATTEMPTS = 4;
|
|
163
171
|
// Non-critical appends get a SMALL bounded retry so a single transient blip
|
|
164
172
|
// (network reset / 5xx) does not drop the event — but on exhaustion they are
|
|
@@ -259,6 +267,50 @@ export function createRunEventSink(options) {
|
|
|
259
267
|
diag(`timer token flush failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
260
268
|
});
|
|
261
269
|
}
|
|
270
|
+
// ORI-2594: live text for the coordinator socket. The first snapshot goes at
|
|
271
|
+
// once, later ones at most once per liveTextMs, and the latest always goes.
|
|
272
|
+
const liveTextMs = options.liveTextMs ?? LIVE_TEXT_MS;
|
|
273
|
+
const livePending = new Map();
|
|
274
|
+
// The last text sent per reply: past the cut, or on a repeated update, the
|
|
275
|
+
// snapshot does not change and is not sent again.
|
|
276
|
+
const liveSent = new Map();
|
|
277
|
+
let liveTimer = null;
|
|
278
|
+
let lastLiveAt = Number.NEGATIVE_INFINITY;
|
|
279
|
+
function sendLiveText() {
|
|
280
|
+
liveTimer = null;
|
|
281
|
+
const pending = [...livePending];
|
|
282
|
+
livePending.clear();
|
|
283
|
+
if (sealed || !options.onLiveText)
|
|
284
|
+
return;
|
|
285
|
+
lastLiveAt = Date.now();
|
|
286
|
+
for (const [messageId, raw] of pending) {
|
|
287
|
+
// Guarded whole: a late send can find the bearer file already gone.
|
|
288
|
+
try {
|
|
289
|
+
const scrubbed = redactSecrets({ text: raw }, { secrets: currentSecrets() }).text;
|
|
290
|
+
const text = scrubbed.length > LIVE_TEXT_MAX_CHARS ? `${scrubbed.slice(0, LIVE_TEXT_MAX_CHARS)}…` : scrubbed;
|
|
291
|
+
if (liveSent.get(messageId) === text)
|
|
292
|
+
continue;
|
|
293
|
+
if (options.onLiveText({ runId: options.runId, messageId, sequence: nextSequence, text }) !== false)
|
|
294
|
+
liveSent.set(messageId, text);
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
diag(`live text not sent: ${error instanceof Error ? error.message : String(error)}`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function queueLiveText(messageId, text) {
|
|
302
|
+
// A reply with no id or no text yet has nothing the chat could place.
|
|
303
|
+
if (!options.onLiveText || !messageId || !text)
|
|
304
|
+
return;
|
|
305
|
+
livePending.set(messageId, text);
|
|
306
|
+
if (liveTimer)
|
|
307
|
+
return;
|
|
308
|
+
const waitMs = lastLiveAt + liveTextMs - Date.now();
|
|
309
|
+
if (waitMs <= 0)
|
|
310
|
+
return sendLiveText();
|
|
311
|
+
liveTimer = setTimeout(sendLiveText, waitMs);
|
|
312
|
+
liveTimer.unref?.();
|
|
313
|
+
}
|
|
262
314
|
function assertWritable() {
|
|
263
315
|
if (sealed) {
|
|
264
316
|
throw new RunTerminalError('run is terminal server-side — refusing to append (Orizu records win)');
|
|
@@ -525,13 +577,64 @@ export function createRunEventSink(options) {
|
|
|
525
577
|
throw error;
|
|
526
578
|
}
|
|
527
579
|
}
|
|
580
|
+
// Tokens waiting behind a save, latest per reply. One batch per stretch of
|
|
581
|
+
// tokens joins the queue; any other event closes the batch, so a token
|
|
582
|
+
// written after it lands after it. Bounded however long a save stalls.
|
|
583
|
+
let tokenBatch = null;
|
|
584
|
+
function queueToken(event) {
|
|
585
|
+
if (!tokenBatch) {
|
|
586
|
+
const batch = new Map();
|
|
587
|
+
tokenBatch = batch;
|
|
588
|
+
serialize(async () => {
|
|
589
|
+
if (tokenBatch === batch)
|
|
590
|
+
tokenBatch = null;
|
|
591
|
+
for (const queued of batch.values())
|
|
592
|
+
await append(queued);
|
|
593
|
+
}).catch(error => {
|
|
594
|
+
diag(`token not buffered: ${error instanceof Error ? error.message : String(error)}`);
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
tokenBatch.set(event.messageId ?? '_', event);
|
|
598
|
+
}
|
|
528
599
|
return {
|
|
529
|
-
append: event =>
|
|
530
|
-
|
|
531
|
-
|
|
600
|
+
append: event => {
|
|
601
|
+
if (event.kind !== 'token') {
|
|
602
|
+
tokenBatch = null;
|
|
603
|
+
return serialize(() => append(event));
|
|
604
|
+
}
|
|
605
|
+
// ORI-2594: a token is only buffered, so the harness reader does not wait
|
|
606
|
+
// behind a save in flight (measured: each word waited for the previous
|
|
607
|
+
// save). It still joins the queue in order, and its text goes to the
|
|
608
|
+
// coordinator socket now. A sealed sink still refuses it at once.
|
|
609
|
+
try {
|
|
610
|
+
assertWritable();
|
|
611
|
+
}
|
|
612
|
+
catch (error) {
|
|
613
|
+
return Promise.reject(error);
|
|
614
|
+
}
|
|
615
|
+
queueLiveText(event.messageId ?? '', typeof event.payload.text === 'string' ? event.payload.text : '');
|
|
616
|
+
queueToken(event);
|
|
617
|
+
return Promise.resolve();
|
|
618
|
+
},
|
|
619
|
+
flushTokens: () => {
|
|
620
|
+
tokenBatch = null;
|
|
621
|
+
return serialize(flushTokens);
|
|
622
|
+
},
|
|
623
|
+
finish: (status, opts) => {
|
|
624
|
+
tokenBatch = null;
|
|
625
|
+
// The last snapshot still waiting for its interval goes now, before the run is sealed.
|
|
626
|
+
if (liveTimer) {
|
|
627
|
+
clearTimeout(liveTimer);
|
|
628
|
+
sendLiveText();
|
|
629
|
+
}
|
|
630
|
+
return serialize(() => finish(status, opts));
|
|
631
|
+
},
|
|
532
632
|
get sealed() {
|
|
533
633
|
return sealed;
|
|
534
634
|
},
|
|
635
|
+
get hasUndeliveredTokens() {
|
|
636
|
+
return tokenBuffer.size > 0;
|
|
637
|
+
},
|
|
535
638
|
get terminatedServerSide() {
|
|
536
639
|
return terminatedServerSide;
|
|
537
640
|
},
|
|
@@ -270,7 +270,7 @@ function isArtifactsCredentialKey(credentialKey) {
|
|
|
270
270
|
async function requestToken(url, bearer, purpose, sessionId, expectedCredentialKey) {
|
|
271
271
|
const res = await fetch(url, {
|
|
272
272
|
method: 'POST',
|
|
273
|
-
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + bearer },
|
|
273
|
+
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + bearer, 'X-Orizu-Session-Seed-Protocol': '1' },
|
|
274
274
|
body: JSON.stringify({ purpose: purpose, sessionId: sessionId }),
|
|
275
275
|
})
|
|
276
276
|
if (res.ok) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-session-cli.d.ts","sourceRoot":"","sources":["../src/hosted-session-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAKH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAA;AAK9B,OAAO,EAAE,oBAAoB,EAAqB,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAWlG,OAAO,EAKL,KAAK,sBAAsB,EAC5B,MAAM,mBAAmB,CAAA;AAQ1B,OAAO,EAAE,oBAAoB,EAAE,CAAA;AAC/B,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAC1C,eAAO,MAAM,oBAAo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IAC5C,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,eAAe,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC9H;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,EAAE,eAAe,EACnB,IAAI,GAAE,iBAAsB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAkMjB"}
|
|
@@ -1171,6 +1171,10 @@ export async function hostedCommand(args, io, deps = {}) {
|
|
|
1171
1171
|
}
|
|
1172
1172
|
// ALI-1057: the DO-path in-sandbox boot entrypoint (ORIZU_SANDBOX_ENTRYPOINT).
|
|
1173
1173
|
if (positional[1] === 'hosted-boot') {
|
|
1174
|
+
if (args.includes('--capability-check')) {
|
|
1175
|
+
io.print('orizu-hosted-source-copy-v1');
|
|
1176
|
+
return 0;
|
|
1177
|
+
}
|
|
1174
1178
|
return hostedBootCommand(io);
|
|
1175
1179
|
}
|
|
1176
1180
|
// ALI-1084: the one-shot merge sandbox entrypoint (MergeJobCoordinator DO).
|