orizu 0.5.30 → 0.5.32

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.
Files changed (82) hide show
  1. package/dist/app-commands.d.ts +2 -0
  2. package/dist/app-commands.d.ts.map +1 -1
  3. package/dist/app-commands.js +10 -4
  4. package/dist/gepa-engine-dispatch.d.ts.map +1 -1
  5. package/dist/gepa-engine-dispatch.js +16 -1
  6. package/dist/help.js +7 -7
  7. package/dist/hosted-agent-prompt.d.ts +14 -0
  8. package/dist/hosted-agent-prompt.d.ts.map +1 -0
  9. package/dist/hosted-agent-prompt.js +17 -0
  10. package/dist/hosted-gepa-cli.d.ts.map +1 -1
  11. package/dist/hosted-gepa-cli.js +7 -1
  12. package/dist/hosted-harness-claude.d.ts.map +1 -1
  13. package/dist/hosted-harness-claude.js +4 -1
  14. package/dist/hosted-harness-opencode.d.ts +1 -0
  15. package/dist/hosted-harness-opencode.d.ts.map +1 -1
  16. package/dist/hosted-harness-opencode.js +27 -7
  17. package/dist/hosted-harness.d.ts +30 -1
  18. package/dist/hosted-harness.d.ts.map +1 -1
  19. package/dist/hosted-harness.js +5 -0
  20. package/dist/hosted-optimization-prebaked-marker.d.ts +9 -0
  21. package/dist/hosted-optimization-prebaked-marker.d.ts.map +1 -0
  22. package/dist/hosted-optimization-prebaked-marker.js +22 -0
  23. package/dist/hosted-tool-hints.d.ts +56 -0
  24. package/dist/hosted-tool-hints.d.ts.map +1 -0
  25. package/dist/hosted-tool-hints.js +105 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +2 -5
  28. package/dist/instruction-set-gepa-launch.d.ts +21 -2
  29. package/dist/instruction-set-gepa-launch.d.ts.map +1 -1
  30. package/dist/instruction-set-gepa-launch.js +123 -3
  31. package/dist/markdown-report-input.d.ts.map +1 -1
  32. package/dist/markdown-report-input.js +1 -1
  33. package/dist/optimizations-promote-cli.d.ts.map +1 -1
  34. package/dist/optimizations-promote-cli.js +19 -0
  35. package/dist/preview-runtime.d.ts +7 -0
  36. package/dist/preview-runtime.d.ts.map +1 -1
  37. package/dist/preview-runtime.js +49 -5
  38. package/dist/provider-refusals.js +2 -2
  39. package/dist/report-markdown-blankness.d.ts +6 -0
  40. package/dist/report-markdown-blankness.d.ts.map +1 -1
  41. package/dist/report-markdown-blankness.js +47 -4
  42. package/dist/seed-against-production.d.ts +11 -0
  43. package/dist/seed-against-production.d.ts.map +1 -0
  44. package/dist/seed-against-production.js +1 -0
  45. package/dist/setup-and-skills-commands.d.ts.map +1 -1
  46. package/dist/setup-and-skills-commands.js +123 -9
  47. package/dist/skill-installer.d.ts +32 -0
  48. package/dist/skill-installer.d.ts.map +1 -1
  49. package/dist/skill-installer.js +228 -1
  50. package/package.json +1 -1
  51. package/src/app-commands.ts +13 -3
  52. package/src/gepa-engine-dispatch.ts +18 -1
  53. package/src/help.ts +7 -7
  54. package/src/hosted-agent-prompt.ts +18 -0
  55. package/src/hosted-gepa-cli.ts +7 -1
  56. package/src/hosted-harness-claude.ts +4 -1
  57. package/src/hosted-harness-opencode.ts +28 -7
  58. package/src/hosted-harness.ts +32 -1
  59. package/src/hosted-optimization-prebaked-marker.ts +20 -0
  60. package/src/hosted-tool-hints.ts +153 -0
  61. package/src/index.ts +2 -5
  62. package/src/instruction-set-gepa-launch.ts +161 -3
  63. package/src/markdown-report-input.ts +3 -1
  64. package/src/optimizations-promote-cli.ts +20 -2
  65. package/src/preview-runtime.ts +44 -5
  66. package/src/provider-refusals.ts +2 -2
  67. package/src/report-markdown-blankness.ts +59 -4
  68. package/src/seed-against-production.ts +10 -0
  69. package/src/setup-and-skills-commands.ts +160 -8
  70. package/src/skill-installer.ts +315 -0
  71. package/vendor/skills/orizu/SKILL.md +3 -3
  72. package/vendor/skills/orizu/flows/first-win.md +3 -1
  73. package/vendor/skills/orizu/flows/promote.md +2 -1
  74. package/vendor/skills/orizu/references/building-apps.md +2 -0
  75. package/vendor/skills/orizu/references/building-judges.md +138 -8
  76. package/vendor/skills/orizu/references/cli-reference.md +2 -2
  77. package/vendor/skills/orizu/references/migrate-existing-gepa-setup.md +1 -2
  78. package/vendor/skills/orizu/references/optimization-reports.md +1 -1
  79. package/vendor/skills/orizu/references/optimization-with-gepa.md +22 -4
  80. package/vendor/skills/orizu/references/primer.md +2 -2
  81. package/vendor/skills/orizu/references/prompt-control-plane.md +6 -1
  82. package/vendor/skills/orizu/scripts/test-app.mjs +53 -4
@@ -24,6 +24,8 @@ declare function previewAppFromFile(): Promise<void>;
24
24
  declare function updateAppFromFile(): Promise<void>;
25
25
  declare function linkAppDataset(): Promise<void>;
26
26
  declare function appDetail(): Promise<void>;
27
+ /** `--out` may be a file path or a directory; a directory gets the default file name. */
28
+ export declare function resolveAppExportPath(outPathArg: string | null | undefined, defaultFilename: string): string;
27
29
  declare function exportAppSource(): Promise<void>;
28
30
  export { readSourceFile, readJsonFile, readManifestFile, readPromptPrimaryText, readPromptSidecars, stringFromRecord, isRecord, safeRelativePath, writeTextFileEnsuringDir, sha256Hex, readSourceBytes, listApps, createAppFromFile, previewAppFromFile, updateAppFromFile, linkAppDataset, appDetail, exportAppSource, };
29
31
  //# sourceMappingURL=app-commands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-commands.d.ts","sourceRoot":"","sources":["../src/app-commands.ts"],"names":[],"mappings":"AAgCA,iBAAe,QAAQ,kBAQtB;AAED,iBAAS,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAU/C;AAED,iBAAS,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUhD;AAED,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAY9D;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAElE;AAED,iBAAS,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAA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c,kBAgD5B;AA+CD,iBAAe,SAAS,kBA2CvB;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAK3G;AAED,iBAAe,eAAe,kBAmD7B;AAED,OAAO,EACL,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,eAAe,EACf,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,eAAe,GAChB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  // ORI-2044: moved from index.ts to keep app commands together.
2
- import { readFileSync, mkdirSync, writeFileSync, realpathSync, } from 'fs';
2
+ import { readFileSync, statSync, mkdirSync, writeFileSync, realpathSync, } from 'fs';
3
3
  import { normalize, isAbsolute, join, dirname, } from 'path';
4
4
  import { createHash } from 'crypto';
5
5
  import { getArg, getArchiveListStatus, hasJsonFlag, expandHomePath, hasArg, } from './command-line-arguments.js';
@@ -330,6 +330,14 @@ async function appDetail() {
330
330
  printLine(` Created: ${sanitizeTerminalText(detail.createdAt)}`);
331
331
  printLine(` Updated: ${sanitizeTerminalText(detail.updatedAt)}`);
332
332
  }
333
+ /** `--out` may be a file path or a directory; a directory gets the default file name. */
334
+ export function resolveAppExportPath(outPathArg, defaultFilename) {
335
+ if (!outPathArg)
336
+ return defaultFilename;
337
+ const expanded = expandHomePath(outPathArg);
338
+ const isDirectory = /[\\/]$/.test(outPathArg) || statSync(expanded, { throwIfNoEntry: false })?.isDirectory() === true;
339
+ return isDirectory ? join(expanded, defaultFilename) : expanded;
340
+ }
333
341
  async function exportAppSource() {
334
342
  const project = getArg('--project');
335
343
  const versionArg = getArg('--version');
@@ -358,9 +366,7 @@ async function exportAppSource() {
358
366
  throw new Error(`Failed to export app (${response.status}): ${await response.text()}`);
359
367
  }
360
368
  const data = await parseJsonResponse(response, 'App export');
361
- const filename = outPathArg
362
- ? expandHomePath(outPathArg)
363
- : defaultAppExportFilename(data.app.name, data.version.versionNum);
369
+ const filename = resolveAppExportPath(outPathArg, defaultAppExportFilename(data.app.name, data.version.versionNum));
364
370
  writeTextFileEnsuringDir(filename, data.version.code);
365
371
  if (hasJsonFlag()) {
366
372
  printJson({
@@ -1 +1 @@
1
- {"version":3,"file":"gepa-engine-dispatch.d.ts","sourceRoot":"","sources":["../src/gepa-engine-dispatch.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAA;AAE9C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,WAAW,EAAE,MAAM,CAAC,UAAU,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;CACf;AAsVD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,UAAU,GAAG,kBAAkB,CAmBtH"}
1
+ {"version":3,"file":"gepa-engine-dispatch.d.ts","sourceRoot":"","sources":["../src/gepa-engine-dispatch.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAA;AAE9C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,WAAW,EAAE,MAAM,CAAC,UAAU,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;CACf;AAsWD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,UAAU,GAAG,kBAAkB,CAmBtH"}
@@ -1,4 +1,5 @@
1
1
  import { existsSync, readFileSync } from 'fs';
2
+ import { gepaSeedSelector } from './instruction-set-gepa-launch.js';
2
3
  import { providerFromIdentity, protocolRequiresOutputCap } from './provider-registry.js';
3
4
  import { normalizedSkilledProposerConfig } from './skilled-proposer-config.js';
4
5
  const VALUE_OPTIONS = [
@@ -39,6 +40,7 @@ const VALUE_OPTIONS = [
39
40
  { flag: '--log-dir', environment: 'ORIZU_LOCAL_LOG_DIR' },
40
41
  { flag: '--instruction-set', environment: 'ORIZU_INSTRUCTION_SET_NAME' },
41
42
  { flag: '--model-config', environment: 'ORIZU_MODEL_CONFIG_IDENTITY' },
43
+ { flag: '--profile-version', environment: 'ORIZU_INSTRUCTION_SET_PROFILE_VERSION_NUMBER' },
42
44
  ];
43
45
  const BOOLEAN_OPTIONS = [
44
46
  ['--allow-degenerate-seed', 'ORIZU_ALLOW_DEGENERATE_SEED', '1'],
@@ -267,6 +269,19 @@ function translateOfficialOptions(args, project, environment) {
267
269
  }
268
270
  if (hasInstructionSet && hasCandidateVersion)
269
271
  throw new Error('--instruction-set and --candidate-version-id are mutually exclusive');
272
+ if (!hasInstructionSet && connectorEnvironment.ORIZU_INSTRUCTION_SET_PROFILE_VERSION_NUMBER !== undefined) {
273
+ throw new Error('--profile-version requires --instruction-set');
274
+ }
275
+ if (hasInstructionSet) {
276
+ // ORI-2128: the Seed may be named by a full specifier, by flags, or both;
277
+ // normalise to the set reference, the profile, and the version number.
278
+ const seed = gepaSeedSelector(connectorEnvironment.ORIZU_INSTRUCTION_SET_NAME, connectorEnvironment.ORIZU_MODEL_CONFIG_IDENTITY, connectorEnvironment.ORIZU_INSTRUCTION_SET_PROFILE_VERSION_NUMBER);
279
+ connectorEnvironment.ORIZU_INSTRUCTION_SET_NAME = seed.instructionSetName;
280
+ if (seed.modelConfigIdentity !== undefined)
281
+ connectorEnvironment.ORIZU_MODEL_CONFIG_IDENTITY = seed.modelConfigIdentity;
282
+ if (seed.versionNumber !== undefined)
283
+ connectorEnvironment.ORIZU_INSTRUCTION_SET_PROFILE_VERSION_NUMBER = String(seed.versionNumber);
284
+ }
270
285
  if (hasInstructionSet && connectorEnvironment.ORIZU_MODEL_CONFIG_IDENTITY === undefined)
271
286
  throw new Error('--instruction-set requires --model-config');
272
287
  if (hasInstructionSet && connectorEnvironment.ORIZU_COMPONENT_SELECTOR === undefined)
@@ -318,7 +333,7 @@ function validatedMetadata(raw) {
318
333
  export function dispatchGepaEngine(args, project, environment) {
319
334
  const selected = removeEngine(args);
320
335
  if (selected.engine === 'legacy') {
321
- for (const flag of ['--instruction-set', '--model-config', '--component-selector', '--max-candidate-proposals', '--candidate-proposer', '--candidate-proposer-config', '--proposal-max-calls', '--proposal-max-tokens']) {
336
+ for (const flag of ['--instruction-set', '--model-config', '--profile-version', '--component-selector', '--max-candidate-proposals', '--candidate-proposer', '--candidate-proposer-config', '--proposal-max-calls', '--proposal-max-tokens']) {
322
337
  if (selected.args.some(argument => argument === flag || argument.startsWith(`${flag}=`))) {
323
338
  throw new Error(`${flag} is supported by the official GEPA engine only`);
324
339
  }
package/dist/help.js CHANGED
@@ -280,13 +280,13 @@ export const COMMAND_DOCS = [
280
280
  options: [
281
281
  { name: '--team <slug>', help: 'Choose an existing accessible team.' },
282
282
  { name: '--create-team <name>', help: 'Create and select a new team; mutually exclusive with --team.' },
283
- { name: '--project <slug>', help: 'Choose the project to use as coding-agent handoff context. The workspace still materializes all team projects.' },
284
- { name: '--create-project <name>', help: 'Create and select a project in the chosen team; mutually exclusive with --project.' },
283
+ { name: '--project <slug>', help: 'Choose the project to work in. Only that project is set up in the workspace, and the team-project checklist is skipped, interactive or not.' },
284
+ { name: '--create-project <name>', help: 'Create and select a project in the chosen team, and set up only that project (no checklist); mutually exclusive with --project.' },
285
285
  { name: '--workspace [path]', help: 'Initialize or validate a workspace path, or the current directory when no path is provided. If provided, the value must be a filesystem path.' },
286
286
  { name: '--service-origin <url>', help: 'Service origin written to setup metadata. Defaults to the active CLI server.' },
287
287
  { name: '--attach-workspace <id>', help: 'Record an existing Orizu workspace id for future attachment.' },
288
288
  { name: '--validate', help: 'Inspect the workspace contract without writing files.' },
289
- { name: '--fix', help: 'Apply safe idempotent repairs only.' },
289
+ { name: '--fix', help: 'Apply safe idempotent repairs only, restoring every team project.' },
290
290
  { name: '--no-symlinks', help: 'Write CLAUDE.md as a pointer file instead of a symlink to AGENTS.md.' },
291
291
  { name: '--verbose', help: 'Show per-file setup actions. Default setup output is summary-oriented.' },
292
292
  { name: '--agent <agent>', help: 'Non-interactive opt-in to install the shared global Orizu skill plus any applicable native target. Repeat for multiple agents.', repeatable: true, choices: ['claude', 'codex', 'pi', 'devin', 'droid', 'grok', 'windsurf', 'opencode'] },
@@ -655,8 +655,8 @@ export const COMMAND_DOCS = [
655
655
  },
656
656
  {
657
657
  path: ['optimizations', 'run-gepa'],
658
- usage: 'orizu optimizations run-gepa [--hosted [--launch-intent-id <uuid>]] --project <team/project> --optimizer-version-id <id> (--candidate-version-id <id> | --instruction-set <name> --model-config <identity> [--component-selector round-robin|all]) --runner-version-id <id> [--candidate-runner-dir <dir>] --scorer-version-id <id> --scorer-runner-version-id <id> [--scorer-runner-dir <dir>] [--engine official|legacy] [--candidate-proposer skilled-proposer [--candidate-proposer-config <@file|path>] [--proposal-max-calls <n>] [--proposal-max-tokens <n>]] [--scorer-input-contract gepa|flat_row] [--scorer-candidate-field <row-field>] [--allow-degenerate-seed] [--seed <n>] --dataset-version-id <id> --split-set-id <id> [--train-split train] [--val-split validation] [--minibatch-size <n>] [--candidate-selection-strategy pareto|current_best|epsilon_greedy] [--epsilon <n>] [--objective <text>] [--budget auto|light|medium|heavy | --max-metric-calls <n> | --max-full-evals <n> | --max-iterations <n> | --max-candidate-proposals <n>] [--num-threads auto|N] [--reflection-model <provider/model>] [--reflection-temperature <n>] [--reflection-prompt-template <text|@file>] [--reflection-max-tokens N] [--reflection-provider-settings <json|@file>] [--reflection-retry-attempts N] [--reflection-http-timeout-seconds N] [--skip-perfect-parent-reflection|--no-skip-perfect-parent-reflection] [--disable-evaluation-cache] [--auto-promote] [--promotion-label <label>] [--log-row-snapshots] [--metadata <json>] [--python <command>] [--log-dir logs] [--no-local-log] [--json]',
659
- summary: 'Run official GEPA locally and stream events, or use --hosted for a queued Orizu-managed sandbox launch. Hosted eligibility requires a staff-enabled team, capacity below its concurrent-run cap, a launch-project optimizer version whose validated manifest.optimizer_family is gepa, registered candidate/scorer runners, a reflection model from a registered provider, and a named --budget preset within the team ceiling. Hosted eligibility catalog refusals use stable code/remediation JSON with optional bounded detail, and capacity refusals include monitor URLs for running runs. A successful launch prints a durable monitor URL; queued means accepted, not completed. Hosted mode does not require --candidate-runner-dir or --scorer-runner-dir; when supplied, those directories must byte-match their registered versions. Retry response loss with the same --launch-intent-id. Local runner version ids materialize registered bytes, while optional runner dirs are additionally byte-verified before execution. Pass --engine legacy only for the frozen safety hatch. Skilled-proposer is official-only, its config requires that selection, and the selection cannot be combined with --reflection-prompt-template. --instruction-set requires --model-config and cannot be combined with --candidate-version-id; round-robin updates one component-map entry per round and all updates every component. --max-candidate-proposals is official-engine-only. Validates the scorer contract on the seed before iterating; judge runners built for flat-row score runs need --scorer-input-contract flat_row (ALI-1158).',
658
+ usage: 'orizu optimizations run-gepa [--hosted [--launch-intent-id <uuid>]] --project <team/project> --optimizer-version-id <id> (--candidate-version-id <id> | --instruction-set <set[/profile[@vN]]> [--model-config <identity>] [--profile-version <N>] [--component-selector round-robin|all]) --runner-version-id <id> [--candidate-runner-dir <dir>] --scorer-version-id <id> --scorer-runner-version-id <id> [--scorer-runner-dir <dir>] [--engine official|legacy] [--candidate-proposer skilled-proposer [--candidate-proposer-config <@file|path>] [--proposal-max-calls <n>] [--proposal-max-tokens <n>]] [--scorer-input-contract gepa|flat_row] [--scorer-candidate-field <row-field>] [--allow-degenerate-seed] [--seed <n>] --dataset-version-id <id> --split-set-id <id> [--train-split train] [--val-split validation] [--minibatch-size <n>] [--candidate-selection-strategy pareto|current_best|epsilon_greedy] [--epsilon <n>] [--objective <text>] [--budget auto|light|medium|heavy | --max-metric-calls <n> | --max-full-evals <n> | --max-iterations <n> | --max-candidate-proposals <n>] [--num-threads auto|N] [--reflection-model <provider/model>] [--reflection-temperature <n>] [--reflection-prompt-template <text|@file>] [--reflection-max-tokens N] [--reflection-provider-settings <json|@file>] [--reflection-retry-attempts N] [--reflection-http-timeout-seconds N] [--skip-perfect-parent-reflection|--no-skip-perfect-parent-reflection] [--disable-evaluation-cache] [--auto-promote] [--promotion-label <label>] [--log-row-snapshots] [--metadata <json>] [--python <command>] [--log-dir logs] [--no-local-log] [--json]',
659
+ summary: 'Run official GEPA locally and stream events, or use --hosted for a queued Orizu-managed sandbox launch. Hosted eligibility requires a staff-enabled team, capacity below its concurrent-run cap, a launch-project optimizer version whose validated manifest.optimizer_family is gepa, registered candidate/scorer runners, a reflection model from a registered provider, and a named --budget preset within the team ceiling. Hosted eligibility catalog refusals use stable code/remediation JSON with optional bounded detail, and capacity refusals include monitor URLs for running runs. A successful launch prints a durable monitor URL; queued means accepted, not completed. Hosted mode does not require --candidate-runner-dir or --scorer-runner-dir; when supplied, those directories must byte-match their registered versions. Retry response loss with the same --launch-intent-id. Local runner version ids materialize registered bytes, while optional runner dirs are additionally byte-verified before execution. Pass --engine legacy only for the frozen safety hatch. Skilled-proposer is official-only, its config requires that selection, and the selection cannot be combined with --reflection-prompt-template. --instruction-set needs a profile, named by --model-config or a set/profile specifier, and cannot be combined with --candidate-version-id. The run starts from the production version of that profile unless @vN or --profile-version <N> names another version (the seed, promoted or not); a specifier and flags that name different values are refused; round-robin updates one component-map entry per round and all updates every component. --max-candidate-proposals is official-engine-only. Validates the scorer contract on the seed before iterating; judge runners built for flat-row score runs need --scorer-input-contract flat_row (ALI-1158).',
660
660
  group: 'Optimizations',
661
661
  },
662
662
  {
@@ -748,8 +748,8 @@ export const COMMAND_DOCS = [
748
748
  },
749
749
  {
750
750
  path: ['apps', 'export'],
751
- usage: 'orizu apps export [--app <appId>] [--project <team/project>] [--version <n>] [--out <path>]',
752
- summary: 'Export app source for the selected app version.',
751
+ usage: 'orizu apps export [--app <appId>] [--project <team/project>] [--version <n>] [--out <file-or-directory>]',
752
+ summary: 'Export app source for the selected app version. --out is a file path, or a directory (the file is named <app>.v<version>.tsx inside it).',
753
753
  group: 'Apps',
754
754
  },
755
755
  {
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The system prompt for the hosted agent (ORI-2207).
3
+ *
4
+ * OpenCode (the program that runs the agent in a hosted session) ships its own
5
+ * built-in prompt that starts "You are opencode, an interactive CLI tool…", so
6
+ * the agent used to introduce itself as OpenCode. We register our own "primary
7
+ * agent" in the OpenCode config with this text, and every prompt request picks
8
+ * it by name. That replaces OpenCode's built-in prompt entirely, so this text
9
+ * carries the working rules we still want: use the tools, keep answers short.
10
+ * AGENTS.md is still added after it, as before.
11
+ */
12
+ export declare const HOSTED_AGENT_NAME = "orizu";
13
+ export declare const HOSTED_AGENT_PROMPT = "You are the Orizu agent. You work in the person's repository inside an Orizu workbench, helping them with software engineering tasks. If asked who or what you are, say you are the Orizu agent. Never call yourself OpenCode.\n\n- Do the work with your tools: read files, search, edit, and run commands. Do not guess at what a file contains when you can look.\n- Keep answers short and plain. Say what you did and what the person needs to know next.\n- Follow the repository's own conventions and any instructions in its AGENTS.md.";
14
+ //# sourceMappingURL=hosted-agent-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-agent-prompt.d.ts","sourceRoot":"","sources":["../src/hosted-agent-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,UAAU,CAAA;AAExC,eAAO,MAAM,mBAAmB,qhBAIiD,CAAA"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The system prompt for the hosted agent (ORI-2207).
3
+ *
4
+ * OpenCode (the program that runs the agent in a hosted session) ships its own
5
+ * built-in prompt that starts "You are opencode, an interactive CLI tool…", so
6
+ * the agent used to introduce itself as OpenCode. We register our own "primary
7
+ * agent" in the OpenCode config with this text, and every prompt request picks
8
+ * it by name. That replaces OpenCode's built-in prompt entirely, so this text
9
+ * carries the working rules we still want: use the tools, keep answers short.
10
+ * AGENTS.md is still added after it, as before.
11
+ */
12
+ export const HOSTED_AGENT_NAME = 'orizu';
13
+ export const HOSTED_AGENT_PROMPT = `You are the Orizu agent. You work in the person's repository inside an Orizu workbench, helping them with software engineering tasks. If asked who or what you are, say you are the Orizu agent. Never call yourself OpenCode.
14
+
15
+ - Do the work with your tools: read files, search, edit, and run commands. Do not guess at what a file contains when you can look.
16
+ - Keep answers short and plain. Say what you did and what the person needs to know next.
17
+ - Follow the repository's own conventions and any instructions in its AGENTS.md.`;
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-gepa-cli.d.ts","sourceRoot":"","sources":["../src/hosted-gepa-cli.ts"],"names":[],"mappings":"AAYA,OAAO,EAGL,yBAAyB,EAC1B,MAAM,wBAAwB,CAAA;AAE/B,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAC,UAAU,CAAA;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACnD,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,6FAA6F;IAC7F,eAAe,CAAC,EAAE,OAAO,yBAAyB,CAAA;CACnD;AAmBD,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsMzF"}
1
+ {"version":3,"file":"hosted-gepa-cli.d.ts","sourceRoot":"","sources":["../src/hosted-gepa-cli.ts"],"names":[],"mappings":"AAaA,OAAO,EAGL,yBAAyB,EAC1B,MAAM,wBAAwB,CAAA;AAE/B,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAC,UAAU,CAAA;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACnD,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,6FAA6F;IAC7F,eAAe,CAAC,EAAE,OAAO,yBAAyB,CAAA;CACnD;AAmBD,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2MzF"}
@@ -1,5 +1,6 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { dispatchGepaEngine } from './gepa-engine-dispatch.js';
3
+ import { resolveGepaSeedFromEnvironment } from './instruction-set-gepa-launch.js';
3
4
  import { parseHostedGepaNumericValue } from './hosted-gepa-numeric-values.js';
4
5
  import { authedFetch } from './http.js';
5
6
  import { hostedProviderFromModel, hostedProviderSettingsError, unsupportedHostedProviderMessage } from './hosted-provider-settings.js';
@@ -193,11 +194,16 @@ export async function runHostedGepaOptimization(options) {
193
194
  : kind === 'json' ? JSON.parse(env[name]) : kind === 'boolean' ? env[name] === '1' : env[name];
194
195
  }
195
196
  const launchIntentId = explicitLaunchIntent || randomUUID();
197
+ // ORI-2128: a named Seed version is resolved here exactly as a local run
198
+ // resolves it, and pinned in the body; without one the server keeps its
199
+ // one-call production lookup.
200
+ const seedProfileVersionId = await resolveGepaSeedFromEnvironment(env, options.project, 'server');
196
201
  const body = {
197
202
  hosted: true, launchIntentId, optimizerVersionId: env.ORIZU_OPTIMIZER_VERSION_ID,
198
203
  promptVersionIds: env.ORIZU_PROMPT_VERSION_ID ? [env.ORIZU_PROMPT_VERSION_ID] : [],
199
204
  ...(env.ORIZU_INSTRUCTION_SET_NAME ? { instructionSetName: env.ORIZU_INSTRUCTION_SET_NAME,
200
- modelConfigIdentity: env.ORIZU_MODEL_CONFIG_IDENTITY, componentSelector: env.ORIZU_COMPONENT_SELECTOR } : {}),
205
+ modelConfigIdentity: env.ORIZU_MODEL_CONFIG_IDENTITY, componentSelector: env.ORIZU_COMPONENT_SELECTOR,
206
+ ...(seedProfileVersionId ? { instructionSetProfileVersionId: seedProfileVersionId } : {}) } : {}),
201
207
  runnerVersionId: env.ORIZU_RUNNER_VERSION_ID,
202
208
  scorers: [{ scorerVersionId: env.ORIZU_SCORER_VERSION_ID,
203
209
  scorerRunnerVersionId: env.ORIZU_SCORER_RUNNER_VERSION_ID, role: 'selection', scorerConfig: {} }],
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-harness-claude.d.ts","sourceRoot":"","sources":["../src/hosted-harness-claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AAIH,OAAO,KAAK,EACV,YAAY,EAKb,MAAM,qBAAqB,CAAA;AAW5B;6EAC6E;AAC7E,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IAEZ,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,UAAU,mBAAmB;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,eAAe,EAAE,GAAG,MAAM,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC;AAED;8EAC8E;AAC9E,UAAU,iBAAi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CAAA;IACxB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC7B;AAED,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;0FAEsF;IACtF,+BAA+B,CAAC,EAAE,OAAO,CAAA;IACzC,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAC/C;;qFAEiF;IACjF,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CACzC;AAED,oFAAoF;AACpF,UAAU,cAAe,SAAQ,aAAa,CAAC,UAAU,CAAC;IACxD,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAChC;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,eAAe,CAAA;KAAE,KAAK,cAAc,CAAA;CAC9E;AAwBD,MAAM,WAAW,yBAAyB;IACxC,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAA;IAChD;6DACyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AA+DD,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,yBAA8B,GACtC,YAAY,CAsTd"}
@@ -93,6 +93,7 @@
93
93
  * stripped). Other providers pass through unchanged for the SDK to judge.
94
94
  */
95
95
  import { parseModelIdentity } from './provider-registry.js';
96
+ import { HARNESS_NAMES } from './hosted-harness.js';
96
97
  // The package name lives in a variable so TypeScript treats the dynamic import as
97
98
  // `any` (no static module resolution / ts2307 at app-build time) and no bundler
98
99
  // traces it — this keeps the SDK genuinely optional, loaded only when the
@@ -193,7 +194,7 @@ export function createClaudeAgentHarness(options = {}) {
193
194
  return sdk;
194
195
  }
195
196
  return {
196
- name: 'claude-agent-sdk',
197
+ name: HARNESS_NAMES.claudeAgentSdk,
197
198
  async start(opts) {
198
199
  startModel = opts.model;
199
200
  startWorkspaceDir = opts.workspaceDir;
@@ -338,6 +339,7 @@ export function createClaudeAgentHarness(options = {}) {
338
339
  args: asRecord(block.input),
339
340
  callId,
340
341
  status: 'running',
342
+ harness: HARNESS_NAMES.claudeAgentSdk,
341
343
  },
342
344
  };
343
345
  }
@@ -363,6 +365,7 @@ export function createClaudeAgentHarness(options = {}) {
363
365
  callId,
364
366
  status: block.is_error === true ? 'error' : 'completed',
365
367
  output: toolResultOutput(block.content),
368
+ harness: HARNESS_NAMES.claudeAgentSdk,
366
369
  },
367
370
  };
368
371
  }
@@ -67,6 +67,7 @@ export interface OpenCodeHarnessOptions {
67
67
  /** Distinct terminal reason emitted when a prompt breaches PROMPT_MAX_DURATION,
68
68
  * so the bridge/tests can tell a duration abort from a model error. */
69
69
  export declare const PROMPT_MAX_DURATION_ERROR = "prompt exceeded max duration";
70
+ export declare function ascendingId(prefix: 'ses' | 'msg' | 'prt', nowMs?: number): string;
70
71
  /**
71
72
  * Split a possibly provider-qualified model string into provider + model id,
72
73
  * through THE registry parse (`parseModelIdentity`, ORI-2031): the provider is
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-harness-opencode.d.ts","sourceRoot":"","sources":["../src/hosted-harness-opencode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAMH,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,qBAAqB,CAAA;AAS5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,EAAE,MAAM,IAAI,CAAA;KAAE,CAAA;IACzB;;sDAEkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;6CAEyC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,uEAAuE;IACvE,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB;8DAC0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAkBD;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC,CA+DxF"}
@@ -49,7 +49,9 @@
49
49
  * would break both ports and must be re-verified.
50
50
  */
51
51
  import { readFileSync } from 'fs';
52
+ import { HOSTED_AGENT_NAME, HOSTED_AGENT_PROMPT } from './hosted-agent-prompt.js';
52
53
  import { findProvider, parseModelIdentity } from './provider-registry.js';
54
+ import { HARNESS_NAMES } from './hosted-harness.js';
53
55
  // OpenCode is HARD-PINNED to this version everywhere it is installed/launched.
54
56
  // AUDIT RISK #1 (SSE fragility): the entire event model rides OpenCode's
55
57
  // undocumented `/event` SSE part schema (`message.part.updated`, `session.idle`,
@@ -89,7 +91,9 @@ class PromptAbortedError extends Error {
89
91
  // -- OpenCode ascending id generator (port of OpenCode's id.ts) --------------
90
92
  // Monotonic so our user-message id always sorts AFTER any prior assistant
91
93
  // message id — this is what prevents OpenCode's prompt loop from early-exiting
92
- // on `lastUser.id < lastAssistant.id`.
94
+ // on `lastUser.id < lastAssistant.id`. Shape (opencode-ai@1.14.41): prefix, `_`,
95
+ // 12 hex digits holding the low 48 bits of `ms * 4096 + counter`, then 14
96
+ // base62 characters. `nowMs` is a parameter only so tests can pin the clock.
93
97
  const BASE62 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
94
98
  let idLastTimestamp = 0;
95
99
  let idCounter = 0;
@@ -100,14 +104,15 @@ function randomBase62(length) {
100
104
  }
101
105
  return out;
102
106
  }
103
- function ascendingId(prefix) {
104
- const nowMs = Date.now();
107
+ export function ascendingId(prefix, nowMs = Date.now()) {
105
108
  if (nowMs !== idLastTimestamp) {
106
109
  idLastTimestamp = nowMs;
107
110
  idCounter = 0;
108
111
  }
109
112
  idCounter += 1;
110
- const encoded = (nowMs * 0x1000 + idCounter) & 0xffffffffffff;
113
+ // BigInt, as OpenCode does: the JS `&` operator works on 32 bits, which made
114
+ // short, sometimes negative ids that sorted before OpenCode's own (ORI-2116).
115
+ const encoded = (BigInt(nowMs) * BigInt(0x1000) + BigInt(idCounter)) & BigInt(0xffffffffffff);
111
116
  const hex = encoded.toString(16).padStart(12, '0');
112
117
  return `${prefix}_${hex}${randomBase62(14)}`;
113
118
  }
@@ -146,6 +151,7 @@ export function buildPromptRequestBody(content, model, opencodeMessageId, reason
146
151
  const body = {
147
152
  parts: [{ type: 'text', text: content }],
148
153
  messageID: opencodeMessageId,
154
+ agent: HOSTED_AGENT_NAME,
149
155
  };
150
156
  if (!model)
151
157
  return body;
@@ -443,7 +449,7 @@ export function createOpenCodeHarness(options) {
443
449
  }
444
450
  }
445
451
  return {
446
- name: 'opencode',
452
+ name: HARNESS_NAMES.opencode,
447
453
  async start(opts) {
448
454
  startModel = opts.model;
449
455
  startReasoningEffort = opts.reasoningEffort;
@@ -541,9 +547,21 @@ export function createOpenCodeHarness(options) {
541
547
  args: input,
542
548
  callId,
543
549
  status,
550
+ harness: HARNESS_NAMES.opencode,
544
551
  };
545
- if (terminal)
546
- payload.output = typeof state.output === 'string' ? state.output : '';
552
+ // A failed call keeps its message in `state.error`, not `state.output`
553
+ // (opencode-ai@1.14.41 ToolStateError); it is that call's output.
554
+ if (terminal) {
555
+ payload.output = typeof state.output === 'string' ? state.output
556
+ : typeof state.error === 'string' ? state.error : '';
557
+ }
558
+ // OpenCode's own one-line title and structured extras (ORI-2160),
559
+ // passed through as given; absent when the state has none.
560
+ if (typeof state.title === 'string' && state.title.length > 0)
561
+ payload.title = state.title;
562
+ if (state.metadata && typeof state.metadata === 'object' && !Array.isArray(state.metadata)) {
563
+ payload.metadata = state.metadata;
564
+ }
547
565
  events.push({ kind: terminal ? 'tool_result' : 'tool_call', messageId: msgId, payload });
548
566
  }
549
567
  else if (partType === 'step-start') {
@@ -975,6 +993,8 @@ export function buildOpenCodeConfigContent(opts) {
975
993
  return JSON.stringify({
976
994
  model: opts.model,
977
995
  permission: opts.permission ?? defaultHeadlessPermission(),
996
+ // Replaces OpenCode's built-in "You are opencode…" prompt (ORI-2207).
997
+ agent: { [HOSTED_AGENT_NAME]: { mode: 'primary', prompt: HOSTED_AGENT_PROMPT } },
978
998
  });
979
999
  }
980
1000
  const OPENCODE_READY_TIMEOUT_MS = 180_000;
@@ -99,8 +99,36 @@ export interface HarnessEvent {
99
99
  /** Requires guaranteed delivery (execution_complete / error / push_*). */
100
100
  critical?: boolean;
101
101
  }
102
+ /** The drivers' stable names. A tool event's `harness` field is one of these. */
103
+ export declare const HARNESS_NAMES: {
104
+ readonly opencode: "opencode";
105
+ readonly claudeAgentSdk: "claude-agent-sdk";
106
+ };
107
+ type HarnessName = (typeof HARNESS_NAMES)[keyof typeof HARNESS_NAMES];
108
+ /**
109
+ * Payload of a `tool_call` / `tool_result` event (ORI-2160). One chat renderer
110
+ * shows every tool call whatever harness produced it, so the payload carries:
111
+ * • `title` — the harness's one-line summary of the call (OpenCode's
112
+ * `state.title`). Absent when the harness has none.
113
+ * • `metadata` — structured extras such as a diff, an exit code or match
114
+ * counts (OpenCode's `state.metadata`). Absent when none.
115
+ * • `harness` — which driver produced the event.
116
+ * All three are optional: an event without them is still a valid tool event.
117
+ * The sink and the digest pass them through unchanged.
118
+ */
119
+ export interface HarnessToolPayload {
120
+ [key: string]: unknown;
121
+ tool?: string;
122
+ args?: Record<string, unknown>;
123
+ callId: string;
124
+ status: string;
125
+ output?: string;
126
+ title?: string;
127
+ metadata?: Record<string, unknown>;
128
+ harness?: HarnessName;
129
+ }
102
130
  export interface AgentHarness {
103
- /** Stable driver name — "opencode" | "claude-agent-sdk". */
131
+ /** Stable driver name — one of HARNESS_NAMES. */
104
132
  readonly name: string;
105
133
  /** Boot the agent process/session; returns the resumable agent session id. */
106
134
  start(opts: HarnessStartOptions): Promise<{
@@ -118,4 +146,5 @@ export interface AgentHarness {
118
146
  /** Release all resources; the harness is unusable afterward. */
119
147
  shutdown(): Promise<void>;
120
148
  }
149
+ export {};
121
150
  //# sourceMappingURL=hosted-harness.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-harness.d.ts","sourceRoot":"","sources":["../src/hosted-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;8DAC8D;AAC9D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,CAAC,EAAE,SAAS,eAAe,EAAE,CAAA;IACvC,wEAAwE;IACxE,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,WAAW,aAAa;IAC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_KINDS;
72
72
  }
73
+ /** The drivers' stable names. A tool event's `harness` field is one of these. */
74
+ export const HARNESS_NAMES = {
75
+ opencode: 'opencode',
76
+ claudeAgentSdk: 'claude-agent-sdk',
77
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The check the session coordinator makes on `/opt/orizu/prebaked.json`, the
3
+ * first bootstrap command of a hosted optimization run. It lives here so the
4
+ * release bake's start check (hosted-runtime-image/check-snapshot-starts.mjs)
5
+ * rejects a snapshot on exactly the rules the coordinator would refuse it on.
6
+ * Worker code imports this module, so it must not use Node APIs.
7
+ */
8
+ export declare function isHostedOptimizationPrebakedMarker(raw: string): boolean;
9
+ //# sourceMappingURL=hosted-optimization-prebaked-marker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-optimization-prebaked-marker.d.ts","sourceRoot":"","sources":["../src/hosted-optimization-prebaked-marker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAYvE"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The check the session coordinator makes on `/opt/orizu/prebaked.json`, the
3
+ * first bootstrap command of a hosted optimization run. It lives here so the
4
+ * release bake's start check (hosted-runtime-image/check-snapshot-starts.mjs)
5
+ * rejects a snapshot on exactly the rules the coordinator would refuse it on.
6
+ * Worker code imports this module, so it must not use Node APIs.
7
+ */
8
+ export function isHostedOptimizationPrebakedMarker(raw) {
9
+ try {
10
+ const marker = JSON.parse(raw);
11
+ if (!marker || typeof marker !== 'object' || Array.isArray(marker))
12
+ return false;
13
+ const value = marker;
14
+ return value.builtFor === 'vercel-sandbox' &&
15
+ typeof value.cliVersion === 'string' && value.cliVersion.length > 0 &&
16
+ typeof value.opencodeVersion === 'string' && value.opencodeVersion.length > 0 &&
17
+ typeof value.claudeSdkVersion === 'string' && value.claudeSdkVersion.length > 0;
18
+ }
19
+ catch {
20
+ return false;
21
+ }
22
+ }
@@ -0,0 +1,56 @@
1
+ /** What kind of thing a tool does — the renderer picks an icon/layout from
2
+ * this, never from the tool name. */
3
+ export declare const TOOL_CATEGORIES: {
4
+ readonly file: "file";
5
+ readonly command: "command";
6
+ readonly search: "search";
7
+ readonly network: "network";
8
+ readonly question: "question";
9
+ readonly subAgent: "sub-agent";
10
+ readonly list: "list";
11
+ readonly plug: "plug";
12
+ readonly other: "other";
13
+ };
14
+ export type ToolCategory = (typeof TOOL_CATEGORIES)[keyof typeof TOOL_CATEGORIES];
15
+ /** How the tool's output text should be shown. */
16
+ export declare const TOOL_OUTPUT_KINDS: {
17
+ readonly text: "text";
18
+ readonly diff: "diff";
19
+ readonly markdown: "markdown";
20
+ readonly json: "json";
21
+ readonly list: "list";
22
+ };
23
+ type ToolOutputKind = (typeof TOOL_OUTPUT_KINDS)[keyof typeof TOOL_OUTPUT_KINDS];
24
+ /** Per-tool display hint. Each driver owns a table of these for its built-in
25
+ * tools, so tool-name knowledge lives behind the seam. */
26
+ export interface ToolHint {
27
+ category: ToolCategory;
28
+ /** The verb the chat row shows ("Read", "Ran"). A tool without a hint shows
29
+ * its own name instead. */
30
+ label?: string;
31
+ /** The input key whose value summarizes the call (e.g. `command`), or null
32
+ * when the tool takes no input worth summarizing. */
33
+ summaryKey: string | null;
34
+ outputKind: ToolOutputKind;
35
+ /** Input keys whose values must not be shown as-is (large bodies such as a
36
+ * file's full new content, or likely secrets). */
37
+ redactKeys: readonly string[];
38
+ }
39
+ export type ToolHintTable = Readonly<Record<string, ToolHint>>;
40
+ /**
41
+ * Look a tool up in a driver's hint table. A tool the table does not know (an
42
+ * MCP tool, a plug-in) falls back to the `plug` category, summarized by its
43
+ * first non-empty string argument that does not look like a secret.
44
+ */
45
+ export declare function resolveToolHint(table: ToolHintTable, tool: string, args?: Record<string, unknown>): ToolHint;
46
+ export declare const OPENCODE_TOOL_HINTS: ToolHintTable;
47
+ export declare const CLAUDE_TOOL_HINTS: ToolHintTable;
48
+ /**
49
+ * The hint table for the harness that produced an event. Events recorded
50
+ * before the seam named its harness came from OpenCode, the default driver.
51
+ * A harness with no table here (a future pi driver, say) gets none, so every
52
+ * tool falls back to its own name and first string argument.
53
+ */
54
+ export declare function toolHintsFor(harness: string | undefined): ToolHintTable;
55
+ export {};
56
+ //# sourceMappingURL=hosted-tool-hints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-tool-hints.d.ts","sourceRoot":"","sources":["../src/hosted-tool-hints.ts"],"names":[],"mappings":"AAmBA;sCACsC;AACtC,eAAO,MAAM,eAAe;;;;;;;;;;CAUlB,CAAA;AAEV,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAA;AAEjF,kDAAkD;AAClD,eAAO,MAAM,iBAAiB;;;;;;CAMpB,CAAA;AAEV,KAAK,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;AAEhF;2DAC2D;AAC3D,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,YAAY,CAAA;IACtB;gCAC4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;0DACsD;IACtD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,UAAU,EAAE,cAAc,CAAA;IAC1B;uDACmD;IACnD,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;CAC9B;AAED,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;AAM9D;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACjC,QAAQ,CAWV;AAKD,eAAO,MAAM,mBAAmB,EAAE,aAiBjC,CAAA;AAQD,eAAO,MAAM,iBAAiB,EAAE,aAoB/B,CAAA;AAID;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,CAIvE"}