orizu 0.5.47 → 0.5.49
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/app-publish-workspace.d.ts +6 -0
- package/dist/app-publish-workspace.d.ts.map +1 -1
- package/dist/app-publish-workspace.js +54 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +12 -1
- package/dist/hosted-boot.d.ts +7 -0
- package/dist/hosted-boot.d.ts.map +1 -1
- package/dist/hosted-boot.js +31 -2
- package/dist/hosted-optimization.d.ts.map +1 -1
- package/dist/hosted-optimization.js +40 -21
- package/dist/hosted-runtime-assets.d.ts +9 -0
- package/dist/hosted-runtime-assets.d.ts.map +1 -1
- package/dist/hosted-runtime-assets.js +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +83 -68
- package/dist/runner-folders.d.ts +61 -0
- package/dist/runner-folders.d.ts.map +1 -0
- package/dist/runner-folders.js +222 -0
- package/dist/runner-version-materialization.d.ts +1 -1
- package/dist/runner-version-materialization.d.ts.map +1 -1
- package/dist/runner-version-materialization.js +20 -38
- package/dist/session-publish.d.ts +8 -0
- package/dist/session-publish.d.ts.map +1 -0
- package/dist/session-publish.js +118 -0
- package/dist/skilled-proposer-launch.d.ts +11 -1
- package/dist/skilled-proposer-launch.d.ts.map +1 -1
- package/dist/skilled-proposer-launch.js +35 -4
- package/dist/workbench-cli.d.ts.map +1 -1
- package/dist/workbench-cli.js +14 -1
- package/package.json +1 -1
- package/scripts/build-cli-dist.mjs +46 -8
- package/scripts/vendor-orizu-skill.mjs +52 -7
- package/src/app-publish-workspace.ts +57 -1
- package/src/help.ts +13 -1
- package/src/hosted-boot.ts +40 -2
- package/src/hosted-optimization.ts +49 -31
- package/src/hosted-runtime-assets.ts +10 -9
- package/src/index.ts +79 -87
- package/src/runner-folders.ts +223 -0
- package/src/runner-version-materialization.ts +21 -34
- package/src/session-publish.ts +127 -0
- package/src/skilled-proposer-launch.ts +41 -3
- package/src/workbench-cli.ts +14 -1
- package/vendor/skills/orizu/references/authority-map.md +1 -1
- package/vendor/skills/orizu/references/building-apps.md +1 -1
- package/vendor/skills/orizu/references/cli-reference.md +16 -0
|
@@ -10,6 +10,12 @@ export declare function pushAppToSessionCopy(root: string, input: {
|
|
|
10
10
|
appId: string;
|
|
11
11
|
files: AppFiles;
|
|
12
12
|
}): Promise<string>;
|
|
13
|
+
/** Commits all uncommitted work and pushes the session copy. Throws the
|
|
14
|
+
* message the agent should act on; nothing has been published then. */
|
|
15
|
+
export declare function pushSessionCopy(root: string, message: string): Promise<{
|
|
16
|
+
sha: string;
|
|
17
|
+
committed: string[];
|
|
18
|
+
}>;
|
|
13
19
|
/** Adds the team copy remote; answers a sentence to add to the conflict
|
|
14
20
|
* message when it could not, else null. */
|
|
15
21
|
export declare function addTeamCopyRemote(root: string): Promise<string | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-publish-workspace.d.ts","sourceRoot":"","sources":["../src/app-publish-workspace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-publish-workspace.d.ts","sourceRoot":"","sources":["../src/app-publish-workspace.ts"],"names":[],"mappings":"AAiCA,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAC9B;AA+GD;sCACsC;AACtC,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAcxI;AA4CD;uEACuE;AACvE,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CASlH;AAgCD;2CAC2C;AAC3C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAStE"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* files and the web app are services, and each way this can stop is a tagged
|
|
6
6
|
* failure. It holds no key (the clone's credential helper asks for one per git
|
|
7
7
|
* command) and makes no temporary folder, so it has nothing to scope. */
|
|
8
|
-
import { spawn } from 'node:child_process';
|
|
8
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
9
9
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
import { Context, Data, Effect, Layer } from 'effect';
|
|
@@ -14,6 +14,7 @@ import { AppPublishFailure } from './app-publish-failure.js';
|
|
|
14
14
|
import { inspectAppDestination } from './app-publish-paths.js';
|
|
15
15
|
import { resolveAttachedWorkspaceId } from './git-credential.js';
|
|
16
16
|
import { authedFetch, getBaseUrl } from './http.js';
|
|
17
|
+
import { hasStagedChanges, NOTHING_STAGED_ERROR, unstageOrizuSkillLinks } from './orizu-skill-links.js';
|
|
17
18
|
/** The session copy's branch, which the publish merge reads (ORI-2279). */
|
|
18
19
|
const SESSION_BRANCH_REF = 'refs/heads/main';
|
|
19
20
|
const TEAM_REMOTE_NAME = 'orizu-team';
|
|
@@ -138,6 +139,58 @@ export async function pushAppToSessionCopy(root, input) {
|
|
|
138
139
|
throw new AppPublishFailure(error instanceof Error ? error.message : String(error), attempt.filesMaterialized);
|
|
139
140
|
}
|
|
140
141
|
}
|
|
142
|
+
// -- A whole-session publish (ORI-2653) -------------------------------------------
|
|
143
|
+
/** Commits everything uncommitted by the automatic save's rules (the staged
|
|
144
|
+
* Orizu skill links are left out), then pushes the session copy. Answers the
|
|
145
|
+
* commit to publish and the files this commit added. */
|
|
146
|
+
const commitAllAndPush = (root, message) => Effect.gen(function* () {
|
|
147
|
+
const git = yield* WorkspaceGit;
|
|
148
|
+
const status = yield* gitOrFail('read the workspace status', ['status', '--porcelain']);
|
|
149
|
+
let committed = [];
|
|
150
|
+
if (status.stdout.trim().length > 0) {
|
|
151
|
+
// `git add -A` would mark conflicted files resolved and publish the markers.
|
|
152
|
+
const unmerged = yield* gitOrFail('read the merge state', ['diff', '--name-only', '--diff-filter=U', '-z']);
|
|
153
|
+
if (unmerged.stdout.split('\0').some(Boolean)) {
|
|
154
|
+
return yield* new GitFailed({ step: 'stage the work', detail: 'the workspace has unresolved conflicts; fix those files and commit first' });
|
|
155
|
+
}
|
|
156
|
+
yield* gitOrFail('stage the work', ['add', '-A', '--', '.']);
|
|
157
|
+
const syncGit = (args) => {
|
|
158
|
+
const result = spawnSync('git', args, { cwd: root, encoding: 'utf8' });
|
|
159
|
+
return { exitCode: result.status ?? 1, stdout: result.stdout ?? '', stderr: result.stderr ?? result.error?.message ?? '' };
|
|
160
|
+
};
|
|
161
|
+
const unstaged = unstageOrizuSkillLinks(syncGit);
|
|
162
|
+
if (!unstaged.ok)
|
|
163
|
+
return yield* new GitFailed({ step: 'leave out the Orizu skill links', detail: unstaged.error });
|
|
164
|
+
const staged = hasStagedChanges(syncGit);
|
|
165
|
+
if (typeof staged !== 'boolean')
|
|
166
|
+
return yield* new GitFailed({ step: 'read the staged work', detail: staged.error });
|
|
167
|
+
if (!staged && unstaged.unstaged.length === 0)
|
|
168
|
+
return yield* new GitFailed({ step: 'stage the work', detail: NOTHING_STAGED_ERROR });
|
|
169
|
+
if (staged) {
|
|
170
|
+
committed = (yield* gitOrFail('list the staged work', ['diff', '--cached', '--name-only', '-z'])).stdout.split('\0').filter(Boolean);
|
|
171
|
+
// As the automatic save does: a team's hooks or a signing setting
|
|
172
|
+
// must not block or rewrite the agent's commit.
|
|
173
|
+
yield* gitOrFail('commit the work', ['-c', 'core.hooksPath=/dev/null', '-c', 'commit.gpgsign=false', 'commit', '-q', '-m', message]);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const sha = (yield* gitOrFail('read the commit', ['rev-parse', 'HEAD'])).stdout.trim();
|
|
177
|
+
const pushed = yield* git.run(['push', '-q', 'origin', `HEAD:${SESSION_BRANCH_REF}`]);
|
|
178
|
+
if (pushed.code !== 0) {
|
|
179
|
+
if (/\[rejected\]|non-fast-forward|fetch first/.test(pushed.stderr))
|
|
180
|
+
return yield* new PushRejected();
|
|
181
|
+
return yield* new GitFailed({ step: 'push the session copy', detail: pushed.stderr.trim() });
|
|
182
|
+
}
|
|
183
|
+
return { sha, committed };
|
|
184
|
+
});
|
|
185
|
+
/** Commits all uncommitted work and pushes the session copy. Throws the
|
|
186
|
+
* message the agent should act on; nothing has been published then. */
|
|
187
|
+
export async function pushSessionCopy(root, message) {
|
|
188
|
+
const program = commitAllAndPush(root, message).pipe(Effect.catchTags({
|
|
189
|
+
PushRejected: () => Effect.fail(new Error('your session copy has commits this workspace does not, or is still being set up on a first turn. Run "git pull --no-rebase --no-edit" in the workspace, then run `orizu session publish` again.')),
|
|
190
|
+
GitFailed: (failure) => Effect.fail(new Error(`could not ${failure.step} (${failure.detail}).`)),
|
|
191
|
+
}));
|
|
192
|
+
return Effect.runPromise(Effect.provide(program, liveLayer(root)));
|
|
193
|
+
}
|
|
141
194
|
// -- The team copy, after a conflict ---------------------------------------------
|
|
142
195
|
/** Adds the `orizu-team` remote so the agent can pull the team copy and fix a
|
|
143
196
|
* conflict. It reads with its own team_read key: an empty helper entry first
|
package/dist/help.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,EA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BtD;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CA4B5D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAgBxD;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;EAoB9C"}
|
package/dist/help.js
CHANGED
|
@@ -26,7 +26,7 @@ const GROUPS = [
|
|
|
26
26
|
{ name: 'Tasks', summary: 'Create review tasks, mutate task status, assign reviewers, and export labels.' },
|
|
27
27
|
{ name: 'Datasets', summary: 'Upload, version, split, mutate, export, lock, clone, and delete datasets.' },
|
|
28
28
|
{ name: 'Workspace', summary: 'Metadata-first sync of the workbench contract: inspect status, reconcile, pull, and apply.' },
|
|
29
|
-
{ name: 'Sessions', summary: 'Start, inspect, and end durable workspace sessions for agent/operator work.' },
|
|
29
|
+
{ name: 'Sessions', summary: 'Start, inspect, publish, and end durable workspace sessions for agent/operator work.' },
|
|
30
30
|
{ name: 'Workbench runs', summary: 'Start, inspect, tail, and finish resumable workbench runs.' },
|
|
31
31
|
{ name: 'Connectors', summary: 'Inspect project connector/integration readiness (read-only; secrets redacted).' },
|
|
32
32
|
{ name: 'Promotion manifests', summary: 'List, inspect, approve, reject, and idempotently apply promotion manifests.' },
|
|
@@ -1108,6 +1108,17 @@ export const COMMAND_DOCS = [
|
|
|
1108
1108
|
],
|
|
1109
1109
|
examples: ['orizu session finish --session sess_123', 'orizu session finish --session sess_123 --push --message "tune judge prompt"'],
|
|
1110
1110
|
},
|
|
1111
|
+
{
|
|
1112
|
+
path: ['session', 'publish'],
|
|
1113
|
+
usage: 'orizu session publish [--message <text>] [--json]',
|
|
1114
|
+
summary: "Inside a hosted session: commit any uncommitted work, save it to the session's copy, and merge it into the team's main so new sessions see it. git push alone reaches only the session's copy. Prints Published only when the merge landed; a conflict or failure prints Not published and what to do.",
|
|
1115
|
+
group: 'Sessions',
|
|
1116
|
+
options: [
|
|
1117
|
+
{ name: '--message <text>', help: 'Commit message for uncommitted work (a default is used when omitted).' },
|
|
1118
|
+
{ name: '--json', help: 'Emit {outcome, sha} on success, or {error, code} when it was not published.' },
|
|
1119
|
+
],
|
|
1120
|
+
examples: ['orizu session publish', 'orizu session publish --message "benchmark demo notes"'],
|
|
1121
|
+
},
|
|
1111
1122
|
{
|
|
1112
1123
|
path: ['run', 'start'],
|
|
1113
1124
|
usage: 'orizu run start --session <id> --title <title> [--project <team/project>] [--json]',
|
package/dist/hosted-boot.d.ts
CHANGED
|
@@ -81,9 +81,16 @@ export declare function postBootStatus(opts: {
|
|
|
81
81
|
status: 'ready' | 'failed' | 'complete' | 'turn_failed';
|
|
82
82
|
runId: string | null;
|
|
83
83
|
reason?: string | null;
|
|
84
|
+
/** ORI-2512: how long each boot step took, sent with `ready`. */
|
|
85
|
+
bootSteps?: readonly BootStep[];
|
|
84
86
|
fetchImpl: BootFetch;
|
|
85
87
|
log?: (line: string) => void;
|
|
86
88
|
}): Promise<void>;
|
|
89
|
+
/** ORI-2512: one step of the in-sandbox boot and how long it took. */
|
|
90
|
+
interface BootStep {
|
|
91
|
+
step: string;
|
|
92
|
+
ms: number;
|
|
93
|
+
}
|
|
87
94
|
export interface PulledBearer {
|
|
88
95
|
token: string;
|
|
89
96
|
/** Epoch ms, or null when the response omitted a parseable expiry. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-boot.d.ts","sourceRoot":"","sources":["../src/hosted-boot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAmBH,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAEtB,MAAM,kBAAkB,CAAA;AAMzB,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAExF,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAA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AG,aAAa,CAAA;IACjC,uEAAuE;IACvE,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAoEhB"}
|
package/dist/hosted-boot.js
CHANGED
|
@@ -140,6 +140,7 @@ export async function postBootStatus(opts) {
|
|
|
140
140
|
status: opts.status,
|
|
141
141
|
...(opts.runId ? { runId: opts.runId } : {}),
|
|
142
142
|
...(opts.reason ? { reason: opts.reason } : {}),
|
|
143
|
+
...(opts.bootSteps?.length ? { bootSteps: opts.bootSteps } : {}),
|
|
143
144
|
}),
|
|
144
145
|
});
|
|
145
146
|
opts.log?.(`boot-status ${opts.status} reported (${res.status})`);
|
|
@@ -148,6 +149,21 @@ export async function postBootStatus(opts) {
|
|
|
148
149
|
opts.log?.(`boot-status ${opts.status} report failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
149
150
|
}
|
|
150
151
|
}
|
|
152
|
+
/** Times the boot's steps, each from the end of the one before. */
|
|
153
|
+
function bootStepClock(now) {
|
|
154
|
+
const steps = [];
|
|
155
|
+
let last = now();
|
|
156
|
+
return {
|
|
157
|
+
steps,
|
|
158
|
+
mark: step => {
|
|
159
|
+
const at = now();
|
|
160
|
+
// Timing only describes the boot: a clock that goes back skips a step.
|
|
161
|
+
if (at >= last)
|
|
162
|
+
steps.push({ step, ms: Math.round(at - last) });
|
|
163
|
+
last = at;
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
151
167
|
async function postRequiredIdleReady(opts) {
|
|
152
168
|
let detail = 'not attempted';
|
|
153
169
|
for (let attempt = 0; attempt < 5; attempt += 1) {
|
|
@@ -155,7 +171,7 @@ async function postRequiredIdleReady(opts) {
|
|
|
155
171
|
const response = await opts.fetchImpl(opts.bootStatusUrl, {
|
|
156
172
|
method: 'POST',
|
|
157
173
|
headers: { Authorization: `Bearer ${opts.bootSecret}`, 'Content-Type': 'application/json' },
|
|
158
|
-
body: JSON.stringify({ status: 'ready' }),
|
|
174
|
+
body: JSON.stringify({ status: 'ready', ...(opts.bootSteps.length ? { bootSteps: opts.bootSteps } : {}) }),
|
|
159
175
|
signal: AbortSignal.timeout(opts.attemptTimeoutMs ?? TURN_STATUS_ATTEMPT_TIMEOUT_MS),
|
|
160
176
|
});
|
|
161
177
|
if (response.ok)
|
|
@@ -720,6 +736,7 @@ async function runHostedBootWithLive(opts, liveChannels, idleWaitSignal) {
|
|
|
720
736
|
processEnv.ORIZU_NO_UPDATE_CHECK = '1';
|
|
721
737
|
if (env.runId)
|
|
722
738
|
assertSafeRunId(env.runId);
|
|
739
|
+
const bootClock = bootStepClock(now);
|
|
723
740
|
// 1 — Pull the agent bearer (retry/backoff — the DO may still be arming).
|
|
724
741
|
let bearer = await pullAgentBearer({
|
|
725
742
|
agentTokenUrl: env.agentTokenUrl,
|
|
@@ -731,22 +748,27 @@ async function runHostedBootWithLive(opts, liveChannels, idleWaitSignal) {
|
|
|
731
748
|
log,
|
|
732
749
|
});
|
|
733
750
|
log('agent bearer pulled');
|
|
751
|
+
bootClock.mark('boot_agent_token');
|
|
734
752
|
// 2 — Pull the connector env bundle and export it (+ register redaction).
|
|
735
753
|
const bundle = await fetchEnvBundle({ envBundleUrl: env.envBundleUrl, bearer: bearer.token, fetchImpl });
|
|
736
754
|
const redacted = applyEnvBundle(bundle, processEnv);
|
|
737
755
|
log(`env bundle applied (${bundle.connectors.length} connectors, ${redacted.length} redacted vars)`);
|
|
756
|
+
bootClock.mark('boot_env_bundle');
|
|
738
757
|
// 3 — Resolve the session (workspace/branch/task) + run + repo from the plane.
|
|
739
758
|
let session = await resolveSession({ baseUrl: env.baseUrl, sessionId: env.sessionId, bearer: bearer.token, fetchImpl });
|
|
740
759
|
let currentNonTerminalRunId = session.runStatus === 'pending' || session.runStatus === 'running'
|
|
741
760
|
? session.runId
|
|
742
761
|
: null;
|
|
762
|
+
bootClock.mark('boot_session');
|
|
743
763
|
// Production restarts with no live run are between turns. Prove this boot is
|
|
744
764
|
// live before waiting so the coordinator's readiness timeout cannot reap an
|
|
745
765
|
// intentionally idle sandbox before the longer hosted idle policy applies.
|
|
746
|
-
|
|
766
|
+
const bootsIdle = !opts.runLoop && !currentNonTerminalRunId;
|
|
767
|
+
if (bootsIdle) {
|
|
747
768
|
await postRequiredIdleReady({
|
|
748
769
|
bootStatusUrl: env.bootStatusUrl,
|
|
749
770
|
bootSecret: env.bootSecret,
|
|
771
|
+
bootSteps: bootClock.steps,
|
|
750
772
|
fetchImpl,
|
|
751
773
|
sleep,
|
|
752
774
|
attemptTimeoutMs: turnStatusAttemptTimeoutMs,
|
|
@@ -848,6 +870,7 @@ async function runHostedBootWithLive(opts, liveChannels, idleWaitSignal) {
|
|
|
848
870
|
const repo = await resolveRepo({ baseUrl: env.baseUrl, workspaceId, sessionId: env.sessionId, bearer: bearer.token, fetchImpl });
|
|
849
871
|
const repositoryHost = new URL(repo.cloneUrl).host.toLowerCase();
|
|
850
872
|
log(`resolved run ${runId} on ${repo.repoFullName}@${session.repoBranch}`);
|
|
873
|
+
bootClock.mark('boot_repo');
|
|
851
874
|
// 4 — Write the run-scoped assets: boot secret + initial bearer (0600), the
|
|
852
875
|
// PULL-MODE credential helper + its boot context. The bearer file feeds the
|
|
853
876
|
// loop's event sink; the boot secret feeds the credential helper's per-op pull.
|
|
@@ -1055,6 +1078,7 @@ const c = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
|
|
|
1055
1078
|
exec('git', ['-C', workspaceDir, 'config', 'user.email', AGENT_GIT_IDENTITY.email]);
|
|
1056
1079
|
if (!wokenDisk && !sessionCopyFilled)
|
|
1057
1080
|
log(`cloned ${session.repoBranch}`);
|
|
1081
|
+
bootClock.mark('boot_clone');
|
|
1058
1082
|
// 5a — ORI-2609: the team copy holds only the projects the team seed knew
|
|
1059
1083
|
// about. Write this session's project folder if it is missing, before the
|
|
1060
1084
|
// agent starts. Never fails the boot. A woken disk is the agent's own saved
|
|
@@ -1066,6 +1090,7 @@ const c = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
|
|
|
1066
1090
|
project: { id: session.projectId, slug: session.projectSlug, name: session.projectName },
|
|
1067
1091
|
exec: (cmd, args) => exec(cmd, args),
|
|
1068
1092
|
}));
|
|
1093
|
+
bootClock.mark('boot_project_folder');
|
|
1069
1094
|
// 5b — Stage the orizu skill into the cloned repo so the agent discovers the
|
|
1070
1095
|
// Orizu workflows (ALI-1059). SHARED with the operator path via `stageOrizuSkill`
|
|
1071
1096
|
// (one resolution chain + the harvest-safe .git/info/exclude append). Non-fatal:
|
|
@@ -1084,6 +1109,7 @@ const c = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
|
|
|
1084
1109
|
catch (error) {
|
|
1085
1110
|
log(`orizu skill staging failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
1086
1111
|
}
|
|
1112
|
+
bootClock.mark('boot_skill_stage');
|
|
1087
1113
|
// ALI-1060: the agent is now genuinely LIVE — bearer minted, connectors
|
|
1088
1114
|
// applied, session/run resolved, repo cloned, skill staged. Signal the
|
|
1089
1115
|
// coordinator's readiness gate BEFORE the loop so the DO stops waiting (and
|
|
@@ -1094,6 +1120,9 @@ const c = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
|
|
|
1094
1120
|
bootSecret: env.bootSecret,
|
|
1095
1121
|
status: 'ready',
|
|
1096
1122
|
runId,
|
|
1123
|
+
// An idle boot sent its steps before it waited for work; the wait is not
|
|
1124
|
+
// a boot step.
|
|
1125
|
+
...(bootsIdle ? {} : { bootSteps: bootClock.steps }),
|
|
1097
1126
|
fetchImpl,
|
|
1098
1127
|
log,
|
|
1099
1128
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-optimization.d.ts","sourceRoot":"","sources":["../src/hosted-optimization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hosted-optimization.d.ts","sourceRoot":"","sources":["../src/hosted-optimization.ts"],"names":[],"mappings":"AAcA,UAAU,oBAAoB;IAAG,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE;AAgZrF,wBAAsB,yBAAyB,CAAC,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoHzF"}
|
|
@@ -3,11 +3,9 @@ import { existsSync, readFileSync, rmSync } from 'node:fs';
|
|
|
3
3
|
import { createServer } from 'node:http';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
5
|
import { delimiter, join } from 'node:path';
|
|
6
|
-
import { runPipedChild } from './child-output-tee.js';
|
|
7
6
|
import { getGepaPythonPathEntries } from './gepa-python-paths.js';
|
|
8
7
|
import { deliveredProviderLookup, HOSTED_PROVIDER_FAILURE, INJECTED_ENV_VARS_ENV, PROVIDER_REGISTRY_EXTRA_ENV } from './hosted-environment.js';
|
|
9
8
|
import { credentialEnvFor, parseModelIdentity } from './provider-registry.js';
|
|
10
|
-
import { materializeRunnerVersion, cleanupMaterializedRunners } from './runner-version-materialization.js';
|
|
11
9
|
import { prepareSkilledProposerLaunch, spawnSkilledProposerChild } from './skilled-proposer-launch.js';
|
|
12
10
|
import { hostedProviderFromModel } from './hosted-provider-settings.js';
|
|
13
11
|
import { validNormalizedSkilledProposerConfig } from './skilled-proposer-wire.js';
|
|
@@ -331,22 +329,20 @@ async function startTokenBroker(boot, initial) {
|
|
|
331
329
|
}
|
|
332
330
|
return {
|
|
333
331
|
url: `http://127.0.0.1:${address.port}/${nonce}`,
|
|
334
|
-
|
|
332
|
+
// Also drop open keep-alive connections, so no refresh succeeds after stop.
|
|
333
|
+
stop: () => { server.close(); server.closeAllConnections(); },
|
|
335
334
|
token: () => activeToken,
|
|
336
335
|
secrets: () => [...tokens],
|
|
337
336
|
};
|
|
338
337
|
}
|
|
339
|
-
async function spawnOfficial(python, environment, ready, output) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
return runPipedChild(python, ['-m', 'orizu_gepa_connector'], environment, ready, {
|
|
338
|
+
async function spawnOfficial(python, environment, ready, output, stopOptions) {
|
|
339
|
+
// ORI-2429: both proposers start through the launcher (ORI-2402), so a stop
|
|
340
|
+
// signal reaches the optimizer, which then ends instead of outliving the
|
|
341
|
+
// CLI, and the CLI cleans up before it ends by that signal.
|
|
342
|
+
return spawnSkilledProposerChild(python, ['-m', 'orizu_gepa_connector'], 'official', environment, ready, {
|
|
347
343
|
stdout: chunk => output.stdout.append(chunk),
|
|
348
344
|
stderr: chunk => output.stderr.append(chunk),
|
|
349
|
-
});
|
|
345
|
+
}, stopOptions);
|
|
350
346
|
}
|
|
351
347
|
async function ensureFailedRun(boot, token, engineError, diagnostics) {
|
|
352
348
|
const headers = { authorization: `Bearer ${token}`, 'content-type': 'application/json' };
|
|
@@ -385,7 +381,13 @@ export async function hostedOptimizationCommand(io) {
|
|
|
385
381
|
}
|
|
386
382
|
delete process.env.ORIZU_BOOT_SECRET;
|
|
387
383
|
let reason = 'hosted_optimization_mint_refused';
|
|
388
|
-
|
|
384
|
+
// ORI-2429: one Effect scope owns the runner copies, the result file and the
|
|
385
|
+
// token broker, so a stop signal removes them too (see runner-folders.ts).
|
|
386
|
+
const { Effect, Scope } = await import('effect');
|
|
387
|
+
const { downloadedRunner, removeOnClose, RemovalLedger, stopClosesScope } = await import('./runner-folders.js');
|
|
388
|
+
const ledger = new RemovalLedger();
|
|
389
|
+
const { scope, close, stop, listen, removeHandlers } = stopClosesScope();
|
|
390
|
+
const inScope = (effect) => Effect.runPromise(effect.pipe(Effect.provideService(Scope.Scope, scope)));
|
|
389
391
|
let broker;
|
|
390
392
|
const resultFile = join(tmpdir(), `orizu-hosted-optimization-result-${boot.runId}-${randomUUID()}.json`);
|
|
391
393
|
const diagnosticSecrets = () => injectedSecrets(boot, broker);
|
|
@@ -393,6 +395,7 @@ export async function hostedOptimizationCommand(io) {
|
|
|
393
395
|
const bootOutput = new BoundedTextCapture(diagnosticSecrets);
|
|
394
396
|
let failureDiagnostics;
|
|
395
397
|
try {
|
|
398
|
+
listen();
|
|
396
399
|
const first = await mint(boot);
|
|
397
400
|
if (first.response.status === 422)
|
|
398
401
|
reason = 'hosted_optimization_spec_missing';
|
|
@@ -416,15 +419,23 @@ export async function hostedOptimizationCommand(io) {
|
|
|
416
419
|
process.env.ORIZU_BASE_URL = boot.baseUrl.origin;
|
|
417
420
|
process.env.ORIZU_TOKEN = minted.token;
|
|
418
421
|
reason = 'hosted_optimization_materialization_failed';
|
|
419
|
-
const candidate = await
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
cleanups.push(scorer.cleanup);
|
|
422
|
+
const candidate = await inScope(downloadedRunner(String(minted.jobSpec.runnerVersionId), ledger));
|
|
423
|
+
const scorer = await inScope(downloadedRunner(String(minted.jobSpec.scorerRunnerVersionId), ledger));
|
|
424
|
+
await inScope(removeOnClose(ledger, 'other', () => rmSync(resultFile, { force: true })));
|
|
423
425
|
broker = await startTokenBroker(boot, minted);
|
|
426
|
+
const startedBroker = broker;
|
|
427
|
+
await inScope(removeOnClose(ledger, 'other', () => startedBroker.stop()));
|
|
424
428
|
const environment = childEnvironment(boot, minted, candidate.runnerDir, scorer.runnerDir, broker.url, resultFile);
|
|
425
429
|
const launch = prepareSkilledProposerLaunch(process.env.PYTHON || 'python3', 'official', environment);
|
|
426
430
|
reason = 'hosted_optimization_process_failed';
|
|
427
|
-
|
|
431
|
+
stop.launcherOwnsStop();
|
|
432
|
+
let result;
|
|
433
|
+
try {
|
|
434
|
+
result = await spawnOfficial(launch.python, launch.environment, () => postBoot(boot, 'ready', { status: 'ready' }), processOutput, { beforeSignalExit: stop.beforeSignalExit });
|
|
435
|
+
}
|
|
436
|
+
finally {
|
|
437
|
+
stop.launcherDone();
|
|
438
|
+
}
|
|
428
439
|
if (result.error || result.status !== 0) {
|
|
429
440
|
const processFailure = result.error?.message || `optimizer exited with status ${result.status}`;
|
|
430
441
|
const secrets = injectedSecrets(boot, broker);
|
|
@@ -459,8 +470,16 @@ export async function hostedOptimizationCommand(io) {
|
|
|
459
470
|
return 1;
|
|
460
471
|
}
|
|
461
472
|
finally {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
473
|
+
removeHandlers();
|
|
474
|
+
// Closing stops the broker, deletes the result file and removes the copies.
|
|
475
|
+
close();
|
|
476
|
+
// As before: a broker or result-file failure is thrown first, then runner removals.
|
|
477
|
+
const otherFailure = ledger.failures.find(failure => failure.group === 'other');
|
|
478
|
+
if (otherFailure)
|
|
479
|
+
throw otherFailure.error;
|
|
480
|
+
const runnerFailures = ledger.failures.filter(failure => failure.group === 'downloads').map(failure => failure.error);
|
|
481
|
+
if (runnerFailures.length > 0) {
|
|
482
|
+
throw new AggregateError(runnerFailures, 'Failed to clean materialized runner directories');
|
|
483
|
+
}
|
|
465
484
|
}
|
|
466
485
|
}
|
|
@@ -42,6 +42,15 @@ export declare const AGENT_GIT_IDENTITY: {
|
|
|
42
42
|
readonly name: "Orizu Agent";
|
|
43
43
|
readonly email: "agent@orizu.ai";
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Origin-specific standing preambles wrap hosted task prompts. Web sessions get
|
|
47
|
+
* `HOSTED_TASK_PREAMBLE`, which directs the agent to use the question tool and
|
|
48
|
+
* wait for the human. CLI-origin sessions get `HOSTED_TASK_PREAMBLE_CLI`, where
|
|
49
|
+
* questions remain auto-answered for unattended operation. Undefined or unknown
|
|
50
|
+
* origins fail safely to the CLI preamble. Both variants tell the agent to
|
|
51
|
+
* commit as it goes; end-of-run auto-harvest (ALI-1036, `harvestWorkspace`)
|
|
52
|
+
* preserves anything left uncommitted.
|
|
53
|
+
*/
|
|
45
54
|
export declare const HOSTED_TASK_PREAMBLE: string;
|
|
46
55
|
/** Pre-ALI-1758 unattended behavior retained for CLI-originated sessions. */
|
|
47
56
|
export declare const HOSTED_TASK_PREAMBLE_CLI: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-runtime-assets.d.ts","sourceRoot":"","sources":["../src/hosted-runtime-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,eAAO,MAAM,sBAAsB,oCAAoC,CAAA;AACvE,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAChD,eAAO,MAAM,eAAe,WAAW,CAAA;AACvC,eAAO,MAAM,wBAAwB,mBAAmB,CAAA;AAExD,6EAA6E;AAC7E,eAAO,MAAM,+BAA+B,QAAgB,CAAA;AAE5D;8EAC8E;AAC9E,eAAO,MAAM,wBAAwB,oBAAoB,CAAA;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;CAA4D,CAAA;
|
|
1
|
+
{"version":3,"file":"hosted-runtime-assets.d.ts","sourceRoot":"","sources":["../src/hosted-runtime-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,eAAO,MAAM,sBAAsB,oCAAoC,CAAA;AACvE,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAChD,eAAO,MAAM,eAAe,WAAW,CAAA;AACvC,eAAO,MAAM,wBAAwB,mBAAmB,CAAA;AAExD,6EAA6E;AAC7E,eAAO,MAAM,+BAA+B,QAAgB,CAAA;AAE5D;8EAC8E;AAC9E,eAAO,MAAM,wBAAwB,oBAAoB,CAAA;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;CAA4D,CAAA;AAa3F;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,QAQ6C,CAAA;AAE9E,6EAA6E;AAC7E,eAAO,MAAM,wBAAwB,QAMyC,CAAA;AAE9E,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,KAAK,CAAA;AAEtD,uFAAuF;AACvF,wB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EAAE,MAAM,CAAA;IACvB;;;;;;OAMG;IACH,aAAa,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IACpD;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACrC,uEAAuE;IACvE,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAEnE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iCAAiC,4CACH,CAAA;AAE3C,eAAO,MAAM,0BAA0B,QAEtC,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CA+QrD"}
|
|
@@ -41,6 +41,13 @@ export const SETUP_HOOK_RELATIVE_PATH = '.orizu/setup.sh';
|
|
|
41
41
|
*/
|
|
42
42
|
export const AGENT_GIT_IDENTITY = { name: 'Orizu Agent', email: 'agent@orizu.ai' };
|
|
43
43
|
// -- Hosted task prompt scaffolding (ALI-1036) -------------------------------
|
|
44
|
+
/** ORI-2653: where a push lands, shared by both preambles. A web session's
|
|
45
|
+
* `origin` is its own copy of the team repository; a legacy GitHub session's
|
|
46
|
+
* current branch is its session branch. Only an Orizu publish puts work on the
|
|
47
|
+
* team's main. */
|
|
48
|
+
const HOSTED_PUSH_SCOPE = "Push only the current branch. That push and the automatic save keep work in this session's copy, " +
|
|
49
|
+
"not on the team's main. Never say work is published or on the team's main unless an Orizu " +
|
|
50
|
+
'publish command reported that it merged or was already there. ';
|
|
44
51
|
/**
|
|
45
52
|
* Origin-specific standing preambles wrap hosted task prompts. Web sessions get
|
|
46
53
|
* `HOSTED_TASK_PREAMBLE`, which directs the agent to use the question tool and
|
|
@@ -50,19 +57,13 @@ export const AGENT_GIT_IDENTITY = { name: 'Orizu Agent', email: 'agent@orizu.ai'
|
|
|
50
57
|
* commit as it goes; end-of-run auto-harvest (ALI-1036, `harvestWorkspace`)
|
|
51
58
|
* preserves anything left uncommitted.
|
|
52
59
|
*/
|
|
53
|
-
/** ORI-2653: where a push lands, shared by both preambles. A web session's
|
|
54
|
-
* `origin` is its own copy of the team repository; a legacy GitHub session's
|
|
55
|
-
* current branch is its session branch. Only an Orizu publish puts work on the
|
|
56
|
-
* team's main. */
|
|
57
|
-
const HOSTED_PUSH_SCOPE = "Push only the current branch. That push and the automatic save keep work in this session's copy, " +
|
|
58
|
-
"not on the team's main. Never say work is published or on the team's main unless an Orizu " +
|
|
59
|
-
'publish command reported that it merged or was already there. ';
|
|
60
60
|
export const HOSTED_TASK_PREAMBLE = 'You are in a hosted sandbox. Work autonomously. When blocked on human input, call the built-in ' +
|
|
61
61
|
'question tool with exactly one clear question and at most eight bounded options, then wait for ' +
|
|
62
62
|
'the human. Never infer approval from silence or a recommended option. Commit your work to the current ' +
|
|
63
63
|
'branch in logical units as you go (an automatic ' +
|
|
64
64
|
'checkpoint will also save anything uncommitted at the end). Never switch branches. ' +
|
|
65
65
|
HOSTED_PUSH_SCOPE +
|
|
66
|
+
"To put work on the team's main, run `orizu session publish`. " +
|
|
66
67
|
'Production/default pointers and run metadata live in Orizu, not this repo.';
|
|
67
68
|
/** Pre-ALI-1758 unattended behavior retained for CLI-originated sessions. */
|
|
68
69
|
export const HOSTED_TASK_PREAMBLE_CLI = 'You are running unattended in a hosted sandbox. Work autonomously: never ask the user ' +
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAsLA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAEhE,eAAO,MAAM,wBAAwB,GAAI,iBAAiB,MAAM;;;EACJ,CAAA;AAE5D,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AA+sCtD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CA0B1G;AAED,eAAO,MAAM,iBAAiB,SAAU,CAAA;AACxC,eAAO,MAAM,uBAAuB,QAAkB,CAAA;AACtD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAexH;AAmMD,wBAAsB,IAAI,CAAC,OAAO,WAAwB,iBAiiBzD;AA8DD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAEhF,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA"}
|