orizu 0.5.46 → 0.5.48

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.
@@ -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":"AAgCA,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;AAgCD;2CAC2C;AAC3C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAStE"}
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
@@ -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,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,E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AM,YAAY,EAAE,aAAa,EAszCvC,CAAA;AAUD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,GAAG,SAAS,CAMxE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAWrE;AAOD,wBAAgB,cAAc,IAAI,MAAM,CA0CvC;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAoBtD;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]',
@@ -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,CAAC,QAAQ,CAAC,CAAA;AAW9E,eAAO,MAAM,sBAAs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AAW,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;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0ChF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,aAAa,CAAA;IAClB,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B,MAAM,CAAC,EAAE,QAAQ,GAAG,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"}
@@ -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
- if (!opts.runLoop && !currentNonTerminalRunId) {
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-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;A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CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAA;IACZ,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAA;IAClB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAA;IACjB;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,cAAc,CAAC,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
@@ -55,12 +62,15 @@ export const HOSTED_TASK_PREAMBLE = 'You are in a hosted sandbox. Work autonomou
55
62
  'the human. Never infer approval from silence or a recommended option. Commit your work to the current ' +
56
63
  'branch in logical units as you go (an automatic ' +
57
64
  'checkpoint will also save anything uncommitted at the end). Never switch branches. ' +
65
+ HOSTED_PUSH_SCOPE +
66
+ "To put work on the team's main, run `orizu session publish`. " +
58
67
  'Production/default pointers and run metadata live in Orizu, not this repo.';
59
68
  /** Pre-ALI-1758 unattended behavior retained for CLI-originated sessions. */
60
69
  export const HOSTED_TASK_PREAMBLE_CLI = 'You are running unattended in a hosted sandbox. Work autonomously: never ask the user ' +
61
70
  'questions — when uncertain, choose the most reasonable/reversible option and note the ' +
62
71
  'decision. Commit your work to the current branch in logical units as you go (an automatic ' +
63
72
  'checkpoint will also save anything uncommitted at the end). Never switch branches. ' +
73
+ HOSTED_PUSH_SCOPE +
64
74
  'Production/default pointers and run metadata live in Orizu, not this repo.';
65
75
  /** Fail safe: only the exact server-stamped web origin enables interactive custody. */
66
76
  export function resolveHostedTaskPreamble(origin) {
@@ -0,0 +1,8 @@
1
+ export interface SessionPublishIo {
2
+ json: boolean;
3
+ print: (line: string) => void;
4
+ }
5
+ export declare function runSessionPublish(io: SessionPublishIo, options?: {
6
+ message?: string | null;
7
+ }): Promise<number>;
8
+ //# sourceMappingURL=session-publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-publish.d.ts","sourceRoot":"","sources":["../src/session-publish.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9B;AA6BD,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CA4ExH"}
@@ -0,0 +1,118 @@
1
+ /** ORI-2653: `orizu session publish`. In a hosted session, `git push` reaches
2
+ * only the session's own copy; this command saves the work there, then asks the
3
+ * web app to merge that commit into the team's main (the publish merge job app
4
+ * publishing already uses). It says "Published" only when the merge landed. */
5
+ import { spawnSync } from 'node:child_process';
6
+ import { isValidCloudflareArtifactsGitRemote } from './cloudflare-artifacts-git-remote.js';
7
+ import { authedFetch } from './http.js';
8
+ import { sanitizeTerminalText } from './json-response.js';
9
+ import { findWorkspaceRoot } from './workspace.js';
10
+ const DEFAULT_MESSAGE = 'Publish from session';
11
+ // The web app waits up to 100 s for the merge; leave room for the reply.
12
+ const PUBLISH_TIMEOUT_MS = 170_000;
13
+ // The codes the publish route words itself; their text already says what to do.
14
+ const PUBLISH_CODES = new Set(['publish_conflict', 'publish_race_lost', 'publish_still_running', 'publish_denied', 'publish_unavailable', 'publish_failed']);
15
+ const CHECK_AGAIN = 'It may have landed: wait a moment, then run `orizu session publish` again to check.';
16
+ function isRecord(value) {
17
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
18
+ }
19
+ function loadAppPublishWorkspace() {
20
+ return import('./app-publish-workspace.js');
21
+ }
22
+ /** Every answer that is not a confirmed merge: its text already leads with
23
+ * "Not published" or "Not confirmed" and ends with what to do. */
24
+ function refuse(io, text, code) {
25
+ const safe = sanitizeTerminalText(text);
26
+ io.print(io.json ? JSON.stringify({ error: safe, code }) : safe);
27
+ return 1;
28
+ }
29
+ /** True when `origin` is this session's own Artifacts copy. In an older
30
+ * GitHub-backed session `origin` is the team's repository itself, where a push
31
+ * of main would skip the merge and its checks. Reads the configured URL, not
32
+ * one rewritten by git's `insteadOf`. */
33
+ function originIsThisSessionCopy(root, sessionId) {
34
+ const read = spawnSync('git', ['config', '--get', 'remote.origin.url'], { cwd: root, encoding: 'utf8' });
35
+ const remote = read.status === 0 ? read.stdout.trim() : '';
36
+ return isValidCloudflareArtifactsGitRemote(remote) &&
37
+ new URL(remote).pathname.endsWith(`/hosted-session-${sessionId.replaceAll('-', '')}.git`);
38
+ }
39
+ export async function runSessionPublish(io, options = {}) {
40
+ const sessionId = process.env.ORIZU_SESSION_ID?.trim();
41
+ const root = sessionId ? findWorkspaceRoot(process.cwd()) : null;
42
+ if (!sessionId || !root) {
43
+ return refuse(io, 'Not published: orizu session publish runs inside a hosted session, from its workspace. In your own clone, push to your team repository instead.', 'publish_not_hosted');
44
+ }
45
+ if (!originIsThisSessionCopy(root, sessionId)) {
46
+ return refuse(io, "Not published: this workspace's origin is not this session's own copy, so publishing from here could write to the team's repository directly. Stop and tell the user.", 'publish_not_session_copy');
47
+ }
48
+ const { addTeamCopyRemote, pushSessionCopy } = await loadAppPublishWorkspace();
49
+ let pushed;
50
+ try {
51
+ pushed = await pushSessionCopy(root, options.message?.trim() || DEFAULT_MESSAGE);
52
+ }
53
+ catch (error) {
54
+ return refuse(io, `Not published: ${error instanceof Error ? error.message : String(error)}`, 'publish_not_sent');
55
+ }
56
+ let response;
57
+ let text;
58
+ try {
59
+ response = await authedFetch(`/api/cli/sessions/${encodeURIComponent(sessionId)}/publish`, {
60
+ method: 'POST',
61
+ headers: { 'Content-Type': 'application/json' },
62
+ body: JSON.stringify({ sessionCommitSha: pushed.sha }),
63
+ signal: AbortSignal.timeout(PUBLISH_TIMEOUT_MS),
64
+ });
65
+ }
66
+ catch (error) {
67
+ const reason = error instanceof Error ? error.message : String(error);
68
+ return refuse(io, `Not confirmed: could not reach Orizu (${reason}). Your work is saved in this session's copy. ${CHECK_AGAIN}`, 'publish_unreachable');
69
+ }
70
+ try {
71
+ text = await response.text();
72
+ }
73
+ catch (error) {
74
+ // The merge may have run before the answer was cut off.
75
+ const reason = error instanceof Error ? error.message : String(error);
76
+ return refuse(io, `Not confirmed: could not read the answer from Orizu (${reason}). Your work is saved in this session's copy. ${CHECK_AGAIN}`, 'publish_unreachable');
77
+ }
78
+ let body = null;
79
+ try {
80
+ body = JSON.parse(text);
81
+ }
82
+ catch {
83
+ // An answer that is not JSON is reported below as it came.
84
+ }
85
+ if (response.ok && isRecord(body) && (body.outcome === 'merged' || body.outcome === 'already_merged') && typeof body.sha === 'string') {
86
+ const sha = sanitizeTerminalText(body.sha);
87
+ if (io.json) {
88
+ io.print(JSON.stringify({ outcome: body.outcome, sha }));
89
+ }
90
+ else if (body.outcome === 'merged') {
91
+ const files = pushed.committed.map(file => `\n ${sanitizeTerminalText(file)}`).join('');
92
+ io.print(`Published: merged into the team's main as ${sha.slice(0, 7)}. New sessions on this project will see it.${files ? `\nCommitted first:${files}` : ''}`);
93
+ }
94
+ else {
95
+ io.print(`Already on the team's main (${sha.slice(0, 7)}). Nothing new to publish.`);
96
+ }
97
+ return 0;
98
+ }
99
+ if (isRecord(body) && typeof body.error === 'string' && typeof body.code === 'string' && PUBLISH_CODES.has(body.code)) {
100
+ const code = body.code;
101
+ let message = body.error;
102
+ if (code === 'publish_conflict') {
103
+ const remoteNote = await addTeamCopyRemote(root);
104
+ // Its own line: the recovery line above must stay a runnable command.
105
+ if (remoteNote)
106
+ message = `${message}\n${remoteNote}`;
107
+ }
108
+ return refuse(io, message, code);
109
+ }
110
+ // Any other answer is not worded for this command. A 4xx refused the request
111
+ // before any merge; a 5xx, or a 2xx that is not the route's answer, may have
112
+ // come after one.
113
+ const said = sanitizeTerminalText(isRecord(body) && typeof body.error === 'string' ? body.error : text.slice(0, 300));
114
+ if (response.status >= 400 && response.status < 500) {
115
+ return refuse(io, `Not published: Orizu refused the request (${response.status}: ${said}). Stop and tell the user.`, `http_${response.status}`);
116
+ }
117
+ return refuse(io, `Not confirmed: Orizu answered ${response.status} (${said}). ${CHECK_AGAIN}`, `http_${response.status}`);
118
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"workbench-cli.d.ts","sourceRoot":"","sources":["../src/workbench-cli.ts"],"names":[],"mappings":"AAAA;;;;;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AAM,EAAE,EAAE,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqB9F"}
@@ -77,6 +77,7 @@ const SESSION_START_OPTIONS = new Set([
77
77
  '--session',
78
78
  '--json',
79
79
  ]);
80
+ const SESSION_PUBLISH_OPTIONS = new Set(['--message', '--json']);
80
81
  const WORKBENCH_VALUE_OPTIONS = new Set([
81
82
  '--after',
82
83
  '--interval',
@@ -846,7 +847,7 @@ function terminalStatusForCommand(command) {
846
847
  return 'cancelled';
847
848
  return null;
848
849
  }
849
- const USAGE_LINE = 'Usage: orizu session <start|status|end|finish> ... | orizu run <start|status|tail|complete|fail|cancel> ... (run tail --once drains all currently persisted events, then exits without following)';
850
+ const USAGE_LINE = 'Usage: orizu session <start|status|end|finish|publish> ... | orizu run <start|status|tail|complete|fail|cancel> ... (run tail --once drains all currently persisted events, then exits without following)';
850
851
  // In --json mode ANY command failure — bad usage, or an operational failure
851
852
  // such as a 401/403/404/409/network error surfaced by assertOk — must still
852
853
  // land as a single machine-readable document (`{"error": ...}`) on stdout,
@@ -888,6 +889,18 @@ async function dispatchWorkbenchCommand(args, io) {
888
889
  // `--workspace <dir>`: the workbench clone directory when the command is
889
890
  // not run from inside it (defaults to cwd).
890
891
  const workspaceDir = argValue(args, '--workspace') ?? undefined;
892
+ if (subcommand === 'publish') {
893
+ const unknownOption = findUnknownOption(args, SESSION_PUBLISH_OPTIONS, WORKBENCH_VALUE_OPTIONS);
894
+ if (unknownOption) {
895
+ return emitJsonError(io, `unknown option ${unknownOption}\nUsage: orizu session publish [--message <text>] [--json]`);
896
+ }
897
+ const stray = positional[2];
898
+ if (stray !== undefined) {
899
+ return emitJsonError(io, `unexpected argument ${stray}\nUsage: orizu session publish [--message <text>] [--json]`);
900
+ }
901
+ const { runSessionPublish } = await import('./session-publish.js');
902
+ return runSessionPublish(io, { message: argValue(args, '--message') });
903
+ }
891
904
  if (subcommand === 'start') {
892
905
  const unknownOption = findUnknownOption(args, SESSION_START_OPTIONS, WORKBENCH_VALUE_OPTIONS);
893
906
  if (unknownOption) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orizu",
3
- "version": "0.5.46",
3
+ "version": "0.5.48",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -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
 
@@ -16,6 +16,7 @@ import { AppPublishFailure } from './app-publish-failure.js'
16
16
  import { inspectAppDestination } from './app-publish-paths.js'
17
17
  import { resolveAttachedWorkspaceId } from './git-credential.js'
18
18
  import { authedFetch, getBaseUrl } from './http.js'
19
+ import { hasStagedChanges, NOTHING_STAGED_ERROR, unstageOrizuSkillLinks } from './orizu-skill-links.js'
19
20
 
20
21
  /** The session copy's branch, which the publish merge reads (ORI-2279). */
21
22
  const SESSION_BRANCH_REF = 'refs/heads/main'
@@ -163,6 +164,61 @@ export async function pushAppToSessionCopy(root: string, input: { projectSlug: s
163
164
  }
164
165
  }
165
166
 
167
+ // -- A whole-session publish (ORI-2653) -------------------------------------------
168
+
169
+ /** Commits everything uncommitted by the automatic save's rules (the staged
170
+ * Orizu skill links are left out), then pushes the session copy. Answers the
171
+ * commit to publish and the files this commit added. */
172
+ const commitAllAndPush = (root: string, message: string) =>
173
+ Effect.gen(function* () {
174
+ const git = yield* WorkspaceGit
175
+ const status = yield* gitOrFail('read the workspace status', ['status', '--porcelain'])
176
+ let committed: string[] = []
177
+ if (status.stdout.trim().length > 0) {
178
+ // `git add -A` would mark conflicted files resolved and publish the markers.
179
+ const unmerged = yield* gitOrFail('read the merge state', ['diff', '--name-only', '--diff-filter=U', '-z'])
180
+ if (unmerged.stdout.split('\0').some(Boolean)) {
181
+ return yield* new GitFailed({ step: 'stage the work', detail: 'the workspace has unresolved conflicts; fix those files and commit first' })
182
+ }
183
+ yield* gitOrFail('stage the work', ['add', '-A', '--', '.'])
184
+ const syncGit = (args: readonly string[]) => {
185
+ const result = spawnSync('git', args, { cwd: root, encoding: 'utf8' })
186
+ return { exitCode: result.status ?? 1, stdout: result.stdout ?? '', stderr: result.stderr ?? result.error?.message ?? '' }
187
+ }
188
+ const unstaged = unstageOrizuSkillLinks(syncGit)
189
+ if (!unstaged.ok) return yield* new GitFailed({ step: 'leave out the Orizu skill links', detail: unstaged.error })
190
+ const staged = hasStagedChanges(syncGit)
191
+ if (typeof staged !== 'boolean') return yield* new GitFailed({ step: 'read the staged work', detail: staged.error })
192
+ if (!staged && unstaged.unstaged.length === 0) return yield* new GitFailed({ step: 'stage the work', detail: NOTHING_STAGED_ERROR })
193
+ if (staged) {
194
+ committed = (yield* gitOrFail('list the staged work', ['diff', '--cached', '--name-only', '-z'])).stdout.split('\0').filter(Boolean)
195
+ // As the automatic save does: a team's hooks or a signing setting
196
+ // must not block or rewrite the agent's commit.
197
+ yield* gitOrFail('commit the work', ['-c', 'core.hooksPath=/dev/null', '-c', 'commit.gpgsign=false', 'commit', '-q', '-m', message])
198
+ }
199
+ }
200
+ const sha = (yield* gitOrFail('read the commit', ['rev-parse', 'HEAD'])).stdout.trim()
201
+ const pushed = yield* git.run(['push', '-q', 'origin', `HEAD:${SESSION_BRANCH_REF}`])
202
+ if (pushed.code !== 0) {
203
+ if (/\[rejected\]|non-fast-forward|fetch first/.test(pushed.stderr)) return yield* new PushRejected()
204
+ return yield* new GitFailed({ step: 'push the session copy', detail: pushed.stderr.trim() })
205
+ }
206
+ return { sha, committed }
207
+ })
208
+
209
+ /** Commits all uncommitted work and pushes the session copy. Throws the
210
+ * message the agent should act on; nothing has been published then. */
211
+ export async function pushSessionCopy(root: string, message: string): Promise<{ sha: string; committed: string[] }> {
212
+ const program = commitAllAndPush(root, message).pipe(
213
+ Effect.catchTags({
214
+ PushRejected: () =>
215
+ 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.')),
216
+ GitFailed: (failure) => Effect.fail(new Error(`could not ${failure.step} (${failure.detail}).`)),
217
+ })
218
+ )
219
+ return Effect.runPromise(Effect.provide(program, liveLayer(root)))
220
+ }
221
+
166
222
  // -- The team copy, after a conflict ---------------------------------------------
167
223
 
168
224
  /** Adds the `orizu-team` remote so the agent can pull the team copy and fix a
package/src/help.ts CHANGED
@@ -52,7 +52,7 @@ const GROUPS: CliGroupDoc[] = [
52
52
  { name: 'Tasks', summary: 'Create review tasks, mutate task status, assign reviewers, and export labels.' },
53
53
  { name: 'Datasets', summary: 'Upload, version, split, mutate, export, lock, clone, and delete datasets.' },
54
54
  { name: 'Workspace', summary: 'Metadata-first sync of the workbench contract: inspect status, reconcile, pull, and apply.' },
55
- { name: 'Sessions', summary: 'Start, inspect, and end durable workspace sessions for agent/operator work.' },
55
+ { name: 'Sessions', summary: 'Start, inspect, publish, and end durable workspace sessions for agent/operator work.' },
56
56
  { name: 'Workbench runs', summary: 'Start, inspect, tail, and finish resumable workbench runs.' },
57
57
  { name: 'Connectors', summary: 'Inspect project connector/integration readiness (read-only; secrets redacted).' },
58
58
  { name: 'Promotion manifests', summary: 'List, inspect, approve, reject, and idempotently apply promotion manifests.' },
@@ -1138,6 +1138,18 @@ export const COMMAND_DOCS: CliCommandDoc[] = [
1138
1138
  ],
1139
1139
  examples: ['orizu session finish --session sess_123', 'orizu session finish --session sess_123 --push --message "tune judge prompt"'],
1140
1140
  },
1141
+ {
1142
+ path: ['session', 'publish'],
1143
+ usage: 'orizu session publish [--message <text>] [--json]',
1144
+ summary:
1145
+ "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.",
1146
+ group: 'Sessions',
1147
+ options: [
1148
+ { name: '--message <text>', help: 'Commit message for uncommitted work (a default is used when omitted).' },
1149
+ { name: '--json', help: 'Emit {outcome, sha} on success, or {error, code} when it was not published.' },
1150
+ ],
1151
+ examples: ['orizu session publish', 'orizu session publish --message "benchmark demo notes"'],
1152
+ },
1141
1153
  {
1142
1154
  path: ['run', 'start'],
1143
1155
  usage: 'orizu run start --session <id> --title <title> [--project <team/project>] [--json]',
@@ -197,6 +197,8 @@ export async function postBootStatus(opts: {
197
197
  status: 'ready' | 'failed' | 'complete' | 'turn_failed'
198
198
  runId: string | null
199
199
  reason?: string | null
200
+ /** ORI-2512: how long each boot step took, sent with `ready`. */
201
+ bootSteps?: readonly BootStep[]
200
202
  fetchImpl: BootFetch
201
203
  log?: (line: string) => void
202
204
  }): Promise<void> {
@@ -208,6 +210,7 @@ export async function postBootStatus(opts: {
208
210
  status: opts.status,
209
211
  ...(opts.runId ? { runId: opts.runId } : {}),
210
212
  ...(opts.reason ? { reason: opts.reason } : {}),
213
+ ...(opts.bootSteps?.length ? { bootSteps: opts.bootSteps } : {}),
211
214
  }),
212
215
  })
213
216
  opts.log?.(`boot-status ${opts.status} reported (${res.status})`)
@@ -216,9 +219,31 @@ export async function postBootStatus(opts: {
216
219
  }
217
220
  }
218
221
 
222
+ /** ORI-2512: one step of the in-sandbox boot and how long it took. */
223
+ interface BootStep {
224
+ step: string
225
+ ms: number
226
+ }
227
+
228
+ /** Times the boot's steps, each from the end of the one before. */
229
+ function bootStepClock(now: () => number): { mark: (step: string) => void; steps: BootStep[] } {
230
+ const steps: BootStep[] = []
231
+ let last = now()
232
+ return {
233
+ steps,
234
+ mark: step => {
235
+ const at = now()
236
+ // Timing only describes the boot: a clock that goes back skips a step.
237
+ if (at >= last) steps.push({ step, ms: Math.round(at - last) })
238
+ last = at
239
+ },
240
+ }
241
+ }
242
+
219
243
  async function postRequiredIdleReady(opts: {
220
244
  bootStatusUrl: string
221
245
  bootSecret: string
246
+ bootSteps: readonly BootStep[]
222
247
  fetchImpl: BootFetch
223
248
  sleep: (ms: number) => Promise<void>
224
249
  attemptTimeoutMs?: number
@@ -229,7 +254,7 @@ async function postRequiredIdleReady(opts: {
229
254
  const response = await opts.fetchImpl(opts.bootStatusUrl, {
230
255
  method: 'POST',
231
256
  headers: { Authorization: `Bearer ${opts.bootSecret}`, 'Content-Type': 'application/json' },
232
- body: JSON.stringify({ status: 'ready' }),
257
+ body: JSON.stringify({ status: 'ready', ...(opts.bootSteps.length ? { bootSteps: opts.bootSteps } : {}) }),
233
258
  signal: AbortSignal.timeout(opts.attemptTimeoutMs ?? TURN_STATUS_ATTEMPT_TIMEOUT_MS),
234
259
  })
235
260
  if (response.ok) return
@@ -1015,6 +1040,7 @@ async function runHostedBootWithLive(
1015
1040
  delete processEnv.ORIZU_BOOT_SECRET
1016
1041
  processEnv.ORIZU_NO_UPDATE_CHECK = '1'
1017
1042
  if (env.runId) assertSafeRunId(env.runId)
1043
+ const bootClock = bootStepClock(now)
1018
1044
 
1019
1045
  // 1 — Pull the agent bearer (retry/backoff — the DO may still be arming).
1020
1046
  let bearer = await pullAgentBearer({
@@ -1027,24 +1053,29 @@ async function runHostedBootWithLive(
1027
1053
  log,
1028
1054
  })
1029
1055
  log('agent bearer pulled')
1056
+ bootClock.mark('boot_agent_token')
1030
1057
 
1031
1058
  // 2 — Pull the connector env bundle and export it (+ register redaction).
1032
1059
  const bundle = await fetchEnvBundle({ envBundleUrl: env.envBundleUrl, bearer: bearer.token, fetchImpl })
1033
1060
  const redacted = applyEnvBundle(bundle, processEnv)
1034
1061
  log(`env bundle applied (${bundle.connectors.length} connectors, ${redacted.length} redacted vars)`)
1062
+ bootClock.mark('boot_env_bundle')
1035
1063
 
1036
1064
  // 3 — Resolve the session (workspace/branch/task) + run + repo from the plane.
1037
1065
  let session = await resolveSession({ baseUrl: env.baseUrl, sessionId: env.sessionId, bearer: bearer.token, fetchImpl })
1038
1066
  let currentNonTerminalRunId = session.runStatus === 'pending' || session.runStatus === 'running'
1039
1067
  ? session.runId
1040
1068
  : null
1069
+ bootClock.mark('boot_session')
1041
1070
  // Production restarts with no live run are between turns. Prove this boot is
1042
1071
  // live before waiting so the coordinator's readiness timeout cannot reap an
1043
1072
  // intentionally idle sandbox before the longer hosted idle policy applies.
1044
- if (!opts.runLoop && !currentNonTerminalRunId) {
1073
+ const bootsIdle = !opts.runLoop && !currentNonTerminalRunId
1074
+ if (bootsIdle) {
1045
1075
  await postRequiredIdleReady({
1046
1076
  bootStatusUrl: env.bootStatusUrl,
1047
1077
  bootSecret: env.bootSecret,
1078
+ bootSteps: bootClock.steps,
1048
1079
  fetchImpl,
1049
1080
  sleep,
1050
1081
  attemptTimeoutMs: turnStatusAttemptTimeoutMs,
@@ -1144,6 +1175,7 @@ async function runHostedBootWithLive(
1144
1175
  const repo = await resolveRepo({ baseUrl: env.baseUrl, workspaceId, sessionId: env.sessionId, bearer: bearer.token, fetchImpl })
1145
1176
  const repositoryHost = new URL(repo.cloneUrl).host.toLowerCase()
1146
1177
  log(`resolved run ${runId} on ${repo.repoFullName}@${session.repoBranch}`)
1178
+ bootClock.mark('boot_repo')
1147
1179
 
1148
1180
  // 4 — Write the run-scoped assets: boot secret + initial bearer (0600), the
1149
1181
  // PULL-MODE credential helper + its boot context. The bearer file feeds the
@@ -1347,6 +1379,7 @@ const c = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
1347
1379
  exec('git', ['-C', workspaceDir, 'config', 'user.name', AGENT_GIT_IDENTITY.name])
1348
1380
  exec('git', ['-C', workspaceDir, 'config', 'user.email', AGENT_GIT_IDENTITY.email])
1349
1381
  if (!wokenDisk && !sessionCopyFilled) log(`cloned ${session.repoBranch}`)
1382
+ bootClock.mark('boot_clone')
1350
1383
 
1351
1384
  // 5a — ORI-2609: the team copy holds only the projects the team seed knew
1352
1385
  // about. Write this session's project folder if it is missing, before the
@@ -1359,6 +1392,7 @@ const c = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
1359
1392
  project: { id: session.projectId, slug: session.projectSlug, name: session.projectName },
1360
1393
  exec: (cmd, args) => exec(cmd, args),
1361
1394
  }))
1395
+ bootClock.mark('boot_project_folder')
1362
1396
 
1363
1397
  // 5b — Stage the orizu skill into the cloned repo so the agent discovers the
1364
1398
  // Orizu workflows (ALI-1059). SHARED with the operator path via `stageOrizuSkill`
@@ -1377,6 +1411,7 @@ const c = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
1377
1411
  } catch (error) {
1378
1412
  log(`orizu skill staging failed: ${error instanceof Error ? error.message : String(error)}`)
1379
1413
  }
1414
+ bootClock.mark('boot_skill_stage')
1380
1415
 
1381
1416
  // ALI-1060: the agent is now genuinely LIVE — bearer minted, connectors
1382
1417
  // applied, session/run resolved, repo cloned, skill staged. Signal the
@@ -1388,6 +1423,9 @@ const c = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
1388
1423
  bootSecret: env.bootSecret,
1389
1424
  status: 'ready',
1390
1425
  runId,
1426
+ // An idle boot sent its steps before it waited for work; the wait is not
1427
+ // a boot step.
1428
+ ...(bootsIdle ? {} : { bootSteps: bootClock.steps }),
1391
1429
  fetchImpl,
1392
1430
  log,
1393
1431
  })
@@ -51,6 +51,15 @@ export const AGENT_GIT_IDENTITY = { name: 'Orizu Agent', email: 'agent@orizu.ai'
51
51
 
52
52
  // -- Hosted task prompt scaffolding (ALI-1036) -------------------------------
53
53
 
54
+ /** ORI-2653: where a push lands, shared by both preambles. A web session's
55
+ * `origin` is its own copy of the team repository; a legacy GitHub session's
56
+ * current branch is its session branch. Only an Orizu publish puts work on the
57
+ * team's main. */
58
+ const HOSTED_PUSH_SCOPE =
59
+ "Push only the current branch. That push and the automatic save keep work in this session's copy, " +
60
+ "not on the team's main. Never say work is published or on the team's main unless an Orizu " +
61
+ 'publish command reported that it merged or was already there. '
62
+
54
63
  /**
55
64
  * Origin-specific standing preambles wrap hosted task prompts. Web sessions get
56
65
  * `HOSTED_TASK_PREAMBLE`, which directs the agent to use the question tool and
@@ -66,6 +75,8 @@ export const HOSTED_TASK_PREAMBLE =
66
75
  'the human. Never infer approval from silence or a recommended option. Commit your work to the current ' +
67
76
  'branch in logical units as you go (an automatic ' +
68
77
  'checkpoint will also save anything uncommitted at the end). Never switch branches. ' +
78
+ HOSTED_PUSH_SCOPE +
79
+ "To put work on the team's main, run `orizu session publish`. " +
69
80
  'Production/default pointers and run metadata live in Orizu, not this repo.'
70
81
 
71
82
  /** Pre-ALI-1758 unattended behavior retained for CLI-originated sessions. */
@@ -74,6 +85,7 @@ export const HOSTED_TASK_PREAMBLE_CLI =
74
85
  'questions — when uncertain, choose the most reasonable/reversible option and note the ' +
75
86
  'decision. Commit your work to the current branch in logical units as you go (an automatic ' +
76
87
  'checkpoint will also save anything uncommitted at the end). Never switch branches. ' +
88
+ HOSTED_PUSH_SCOPE +
77
89
  'Production/default pointers and run metadata live in Orizu, not this repo.'
78
90
 
79
91
  export type HostedSessionOrigin = 'hosted-web' | 'cli'
@@ -0,0 +1,127 @@
1
+ /** ORI-2653: `orizu session publish`. In a hosted session, `git push` reaches
2
+ * only the session's own copy; this command saves the work there, then asks the
3
+ * web app to merge that commit into the team's main (the publish merge job app
4
+ * publishing already uses). It says "Published" only when the merge landed. */
5
+ import { spawnSync } from 'node:child_process'
6
+
7
+ import { isValidCloudflareArtifactsGitRemote } from './cloudflare-artifacts-git-remote.js'
8
+ import { authedFetch } from './http.js'
9
+ import { sanitizeTerminalText } from './json-response.js'
10
+ import { findWorkspaceRoot } from './workspace.js'
11
+
12
+ const DEFAULT_MESSAGE = 'Publish from session'
13
+ // The web app waits up to 100 s for the merge; leave room for the reply.
14
+ const PUBLISH_TIMEOUT_MS = 170_000
15
+ // The codes the publish route words itself; their text already says what to do.
16
+ const PUBLISH_CODES = new Set(['publish_conflict', 'publish_race_lost', 'publish_still_running', 'publish_denied', 'publish_unavailable', 'publish_failed'])
17
+ const CHECK_AGAIN = 'It may have landed: wait a moment, then run `orizu session publish` again to check.'
18
+
19
+ export interface SessionPublishIo {
20
+ json: boolean
21
+ print: (line: string) => void
22
+ }
23
+
24
+ function isRecord(value: unknown): value is Record<string, unknown> {
25
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
26
+ }
27
+
28
+ function loadAppPublishWorkspace() {
29
+ return import('./app-publish-workspace.js')
30
+ }
31
+
32
+ /** Every answer that is not a confirmed merge: its text already leads with
33
+ * "Not published" or "Not confirmed" and ends with what to do. */
34
+ function refuse(io: SessionPublishIo, text: string, code: string): number {
35
+ const safe = sanitizeTerminalText(text)
36
+ io.print(io.json ? JSON.stringify({ error: safe, code }) : safe)
37
+ return 1
38
+ }
39
+
40
+ /** True when `origin` is this session's own Artifacts copy. In an older
41
+ * GitHub-backed session `origin` is the team's repository itself, where a push
42
+ * of main would skip the merge and its checks. Reads the configured URL, not
43
+ * one rewritten by git's `insteadOf`. */
44
+ function originIsThisSessionCopy(root: string, sessionId: string): boolean {
45
+ const read = spawnSync('git', ['config', '--get', 'remote.origin.url'], { cwd: root, encoding: 'utf8' })
46
+ const remote = read.status === 0 ? read.stdout.trim() : ''
47
+ return isValidCloudflareArtifactsGitRemote(remote) &&
48
+ new URL(remote).pathname.endsWith(`/hosted-session-${sessionId.replaceAll('-', '')}.git`)
49
+ }
50
+
51
+ export async function runSessionPublish(io: SessionPublishIo, options: { message?: string | null } = {}): Promise<number> {
52
+ const sessionId = process.env.ORIZU_SESSION_ID?.trim()
53
+ const root = sessionId ? findWorkspaceRoot(process.cwd()) : null
54
+ if (!sessionId || !root) {
55
+ return refuse(io, 'Not published: orizu session publish runs inside a hosted session, from its workspace. In your own clone, push to your team repository instead.', 'publish_not_hosted')
56
+ }
57
+ if (!originIsThisSessionCopy(root, sessionId)) {
58
+ return refuse(io, "Not published: this workspace's origin is not this session's own copy, so publishing from here could write to the team's repository directly. Stop and tell the user.", 'publish_not_session_copy')
59
+ }
60
+
61
+ const { addTeamCopyRemote, pushSessionCopy } = await loadAppPublishWorkspace()
62
+ let pushed: { sha: string; committed: string[] }
63
+ try {
64
+ pushed = await pushSessionCopy(root, options.message?.trim() || DEFAULT_MESSAGE)
65
+ } catch (error) {
66
+ return refuse(io, `Not published: ${error instanceof Error ? error.message : String(error)}`, 'publish_not_sent')
67
+ }
68
+
69
+ let response: Response
70
+ let text: string
71
+ try {
72
+ response = await authedFetch(`/api/cli/sessions/${encodeURIComponent(sessionId)}/publish`, {
73
+ method: 'POST',
74
+ headers: { 'Content-Type': 'application/json' },
75
+ body: JSON.stringify({ sessionCommitSha: pushed.sha }),
76
+ signal: AbortSignal.timeout(PUBLISH_TIMEOUT_MS),
77
+ })
78
+ } catch (error) {
79
+ const reason = error instanceof Error ? error.message : String(error)
80
+ return refuse(io, `Not confirmed: could not reach Orizu (${reason}). Your work is saved in this session's copy. ${CHECK_AGAIN}`, 'publish_unreachable')
81
+ }
82
+ try {
83
+ text = await response.text()
84
+ } catch (error) {
85
+ // The merge may have run before the answer was cut off.
86
+ const reason = error instanceof Error ? error.message : String(error)
87
+ return refuse(io, `Not confirmed: could not read the answer from Orizu (${reason}). Your work is saved in this session's copy. ${CHECK_AGAIN}`, 'publish_unreachable')
88
+ }
89
+ let body: unknown = null
90
+ try {
91
+ body = JSON.parse(text)
92
+ } catch {
93
+ // An answer that is not JSON is reported below as it came.
94
+ }
95
+
96
+ if (response.ok && isRecord(body) && (body.outcome === 'merged' || body.outcome === 'already_merged') && typeof body.sha === 'string') {
97
+ const sha = sanitizeTerminalText(body.sha)
98
+ if (io.json) {
99
+ io.print(JSON.stringify({ outcome: body.outcome, sha }))
100
+ } else if (body.outcome === 'merged') {
101
+ const files = pushed.committed.map(file => `\n ${sanitizeTerminalText(file)}`).join('')
102
+ io.print(`Published: merged into the team's main as ${sha.slice(0, 7)}. New sessions on this project will see it.${files ? `\nCommitted first:${files}` : ''}`)
103
+ } else {
104
+ io.print(`Already on the team's main (${sha.slice(0, 7)}). Nothing new to publish.`)
105
+ }
106
+ return 0
107
+ }
108
+
109
+ if (isRecord(body) && typeof body.error === 'string' && typeof body.code === 'string' && PUBLISH_CODES.has(body.code)) {
110
+ const code = body.code
111
+ let message = body.error
112
+ if (code === 'publish_conflict') {
113
+ const remoteNote = await addTeamCopyRemote(root)
114
+ // Its own line: the recovery line above must stay a runnable command.
115
+ if (remoteNote) message = `${message}\n${remoteNote}`
116
+ }
117
+ return refuse(io, message, code)
118
+ }
119
+ // Any other answer is not worded for this command. A 4xx refused the request
120
+ // before any merge; a 5xx, or a 2xx that is not the route's answer, may have
121
+ // come after one.
122
+ const said = sanitizeTerminalText(isRecord(body) && typeof body.error === 'string' ? body.error : text.slice(0, 300))
123
+ if (response.status >= 400 && response.status < 500) {
124
+ return refuse(io, `Not published: Orizu refused the request (${response.status}: ${said}). Stop and tell the user.`, `http_${response.status}`)
125
+ }
126
+ return refuse(io, `Not confirmed: Orizu answered ${response.status} (${said}). ${CHECK_AGAIN}`, `http_${response.status}`)
127
+ }
@@ -336,6 +336,7 @@ const SESSION_START_OPTIONS = new Set([
336
336
  '--session',
337
337
  '--json',
338
338
  ])
339
+ const SESSION_PUBLISH_OPTIONS = new Set(['--message', '--json'])
339
340
  const WORKBENCH_VALUE_OPTIONS = new Set([
340
341
  '--after',
341
342
  '--interval',
@@ -1221,7 +1222,7 @@ function terminalStatusForCommand(command: string): string | null {
1221
1222
  }
1222
1223
 
1223
1224
  const USAGE_LINE =
1224
- 'Usage: orizu session <start|status|end|finish> ... | orizu run <start|status|tail|complete|fail|cancel> ... (run tail --once drains all currently persisted events, then exits without following)'
1225
+ 'Usage: orizu session <start|status|end|finish|publish> ... | orizu run <start|status|tail|complete|fail|cancel> ... (run tail --once drains all currently persisted events, then exits without following)'
1225
1226
 
1226
1227
  // In --json mode ANY command failure — bad usage, or an operational failure
1227
1228
  // such as a 401/403/404/409/network error surfaced by assertOk — must still
@@ -1268,6 +1269,18 @@ async function dispatchWorkbenchCommand(args: string[], io: WorkbenchCommandIo):
1268
1269
  // `--workspace <dir>`: the workbench clone directory when the command is
1269
1270
  // not run from inside it (defaults to cwd).
1270
1271
  const workspaceDir = argValue(args, '--workspace') ?? undefined
1272
+ if (subcommand === 'publish') {
1273
+ const unknownOption = findUnknownOption(args, SESSION_PUBLISH_OPTIONS, WORKBENCH_VALUE_OPTIONS)
1274
+ if (unknownOption) {
1275
+ return emitJsonError(io, `unknown option ${unknownOption}\nUsage: orizu session publish [--message <text>] [--json]`)
1276
+ }
1277
+ const stray = positional[2]
1278
+ if (stray !== undefined) {
1279
+ return emitJsonError(io, `unexpected argument ${stray}\nUsage: orizu session publish [--message <text>] [--json]`)
1280
+ }
1281
+ const { runSessionPublish } = await import('./session-publish.js')
1282
+ return runSessionPublish(io, { message: argValue(args, '--message') })
1283
+ }
1271
1284
  if (subcommand === 'start') {
1272
1285
  const unknownOption = findUnknownOption(args, SESSION_START_OPTIONS, WORKBENCH_VALUE_OPTIONS)
1273
1286
  if (unknownOption) {
@@ -10,7 +10,7 @@ This is the single source of truth for who runs each action. Replace placeholder
10
10
  | Local agent under the user's token | Workflow | Survey the customer codebase, resolve state, prepare the plan, files, manifests, diffs, and evidence, then ask the human to ratify the workflow design. | The human moments are plan ratification and execution of all production/default pointer moves. |
11
11
  | Local agent under the user's token | Catalog mutations and pointer preparation | After plan ratification, pull instruction material from the customer codebase and run `orizu instructions create <manifest> --project <team/project>`, `orizu instructions push <manifest> --project <team/project> --set <slug-or-exact-name>`, shape add/remove before first promotion, archive/restore itself under the user's token. For pointer changes, gather only read-only resolution and binding evidence, prepare the exact commands, then hand them off. | Per the Micro-round 3 custody ruling, a human admin or curator using a user token executes every runner default-label move, optimizer-label move, scorer production-label move, profile promote/rollback, default move, and labeled optimization promotion on every surface. |
12
12
  | Hosted session | Start and scope | Use the pre-authenticated CLI from `ORIZU_TOKEN_FILE` and `ORIZU_BASE_URL`; resolve only the session's signed team with `orizu teams list`, then list or create projects only within it. Run `orizu projects create --name "<project name>" --team <signed-team>` when needed. | Team creation is platform-enforced human-only. Hand off: `orizu teams create --name "<team name>"`, then ask the human to start a new hosted session scoped to that team; the current session cannot switch teams. |
13
- | Hosted session | Team-wide curator work | While the hosted session is active and its kill switch is clear, perform setup plus ordinary curator reads and writes within the signed team. Run `orizu instructions profiles new <set> --project <team/project> --model-config <identity>` and `orizu instructions sync <set> --project <team/project> --out <app-root>`; synced material lands under `<app-root>/orizu/`. For git-canonical judges, scorers, runners, and optimizers, write with `--session <session-id>`, keep bytes as commits on the session branch, then verify with `git ls-files <path>` and inspect the commit. | The agent executes this work; an Orizu version id alone is not proof of committed bytes. Signed-project exceptions are in the next row. |
13
+ | Hosted session | Team-wide curator work | While the hosted session is active and its kill switch is clear, perform setup plus ordinary curator reads and writes within the signed team. Run `orizu instructions profiles new <set> --project <team/project> --model-config <identity>` and `orizu instructions sync <set> --project <team/project> --out <app-root>`; synced material lands under `<app-root>/orizu/`. For git-canonical judges, scorers, runners, and optimizers, write with `--session <session-id>`, keep bytes as commits on the session branch, then verify with `git ls-files <path>` and inspect the commit. Run `orizu session publish` to put committed work on the team's main; `git push` reaches only the session's copy. | The agent executes this work; an Orizu version id alone is not proof of committed bytes. Signed-project exceptions are in the next row. |
14
14
  | Hosted session | Signed-project work | Run optimization mutations only for the JWT's project, keep git-canonical draft writes on that session and project, and read diff comments only for that project. | Sibling-project optimization mutations, draft writes, and diff-comment reads are out of scope even where ordinary curator access is team-wide. |
15
15
  | Hosted session | Materialize an instruction set | When the survey finds only a candidate seed, turn it into the complete manifest. | ADR-008 requires a human curator using a local CLI user token. Create/push are hosted CLI route-enforced; direct RPC remains agent-writable and is a fix-forward gap. Hand off `orizu instructions create <manifest> --project <team/project>` for a fresh set, or `orizu instructions push <manifest> --project <team/project> --set <slug-or-exact-name>` for an existing set. Their measured 403 is `Sessionless registration is not available to the hosted agent: this artifact class is git-canonical (ADR-007) and its bytes must be committed to the session branch. Re-run with --session <session-id>.` Neither create nor push accepts `--session`. |
16
16
  | Hosted session | Profiles and component shape | Run `orizu instructions profiles new <set> --project <team/project> --model-config <identity>`, `orizu instructions shape add <set> --project <team/project> --key <key> --from <manifest>`, and `orizu instructions shape remove <set> --project <team/project> --key <key>` with team-scoped curator authority. Shape add/remove works only until the first promotion of any profile, creates unpromoted profile heads, and does not move pointers. First promotion permanently freezes the shape, and sets that existed when this rule shipped are frozen too; a changed frozen shape requires a new instruction set. | A human admin or curator with `can_manage_project` runs every profile promote/rollback, instruction-set default move, and other production/default pointer move. |
@@ -1620,7 +1620,7 @@ In a hosted session, `orizu apps create` and `orizu apps update` publish through
1620
1620
 
1621
1621
  Edit an existing app in its folder and pass those files to `apps update`. A new app can live anywhere until `apps create` places it.
1622
1622
 
1623
- The merge includes all earlier committed work on the session branch, including files outside the app folder. Review that work before publishing. Unrelated uncommitted work stays local. A conflict may name files outside the app folder; resolve and commit those files too.
1623
+ The merge includes all earlier committed work on the session branch, including files outside the app folder. Review that work before publishing. Unrelated uncommitted work stays local. To publish work that is not an app (notes, memory, other files), use `orizu session publish` (see [cli-reference.md](cli-reference.md#publishing-hosted-work)). A conflict may name files outside the app folder; resolve and commit those files too.
1624
1624
 
1625
1625
  When a hosted `apps create` or `apps update` stops after its folder is known, its error prints `App ID`, `Folder`, and a full `Retry` command. Keep that ID and folder. After all three app files have been written, the retry uses safe canonical files, preserving committed conflict resolutions. If the attempt stops before all three files are written, the retry keeps the original input paths. Both retries preserve the selected server. After following the error's instructions, run the printed retry command; create keeps its original `--id`, and update keeps its `--app`. This also applies when the push is rejected, the API refuses the create, or the merge is still running. The files and commits already made stay in the workspace; a refused push has not sent them to the server.
1626
1626
 
@@ -35,6 +35,22 @@ Behavior:
35
35
  - PAT authorization follows the owning user's current team/project roles, so demotion or removal takes effect without rotating the token.
36
36
  - A hosted session is pre-authenticated via `ORIZU_TOKEN_FILE` (no `orizu login` needed); an explicit `ORIZU_TOKEN` env var overrides both the token file and stored credentials when set.
37
37
 
38
+ ### Publishing hosted work
39
+
40
+ In a hosted session, `git push` and the automatic save reach only the session's own copy of the team repository. Run this to put the work on the team's main:
41
+
42
+ ```bash
43
+ orizu session publish [--message <text>] [--json]
44
+ ```
45
+
46
+ - It commits any uncommitted work (the staged Orizu skill links are left out), pushes the session's copy, then merges it into the team's main. New sessions on the project start from that main. The merge includes all earlier committed work on the session branch, including the automatic saves; review that work before publishing.
47
+ - It prints `Published: merged into the team's main as <sha>` or `Already on the team's main (<sha>)` only when the work is there. Never tell the user work is published without one of those lines.
48
+ - Anything else starts with `Not published:` (the work cannot have landed) or `Not confirmed:` (it may have), and ends with what to do:
49
+ - **Conflict** (names the files): run the printed `Recovery` command, resolve those files, commit, then run `orizu session publish` again.
50
+ - **Session copy has commits this workspace does not**: run `git pull --no-rebase --no-edit`, then publish again.
51
+ - **Not confirmed, or other publishes landed first**: wait a moment and publish again; a merge that landed answers `Already on the team's main`.
52
+ - **Stop and tell the user**: the session ended, the team paused agents, publishing is not available for this session, or the workspace's origin is not the session's own copy.
53
+
38
54
  ### Product feedback
39
55
 
40
56
  ```bash