cohorte 3.0.0-dev.4 → 3.0.0-dev.6

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 (48) hide show
  1. package/assets/manifest.json +4 -4
  2. package/assets/schemas/config.schema.json +22 -0
  3. package/dist/bundle-manifest.json +42 -40
  4. package/dist/chunks/{brainstorm-BwKA6yZP.mjs → brainstorm-kBUiZLce.mjs} +2 -2
  5. package/dist/chunks/{brainstorm-BwKA6yZP.mjs.map → brainstorm-kBUiZLce.mjs.map} +1 -1
  6. package/dist/chunks/{catalogue-B5uFqfzJ.mjs → catalogue-DzsslCSN.mjs} +3 -3
  7. package/dist/chunks/{catalogue-B5uFqfzJ.mjs.map → catalogue-DzsslCSN.mjs.map} +1 -1
  8. package/dist/chunks/{compose-CC9_NMzm.mjs → compose-ckM7eAJ_.mjs} +10 -10
  9. package/dist/chunks/{compose-CC9_NMzm.mjs.map → compose-ckM7eAJ_.mjs.map} +1 -1
  10. package/dist/chunks/{config-DefHA2Lw.mjs → config-DcGPL3i7.mjs} +2 -2
  11. package/dist/chunks/{config-DefHA2Lw.mjs.map → config-DcGPL3i7.mjs.map} +1 -1
  12. package/dist/chunks/{contract-BkMjU1kR.mjs → contract-DiWla5G9.mjs} +22 -2
  13. package/dist/chunks/{contract-BkMjU1kR.mjs.map → contract-DiWla5G9.mjs.map} +1 -1
  14. package/dist/chunks/{discover-eS01-me1.mjs → discover-BBiluyl4.mjs} +3 -3
  15. package/dist/chunks/{discover-eS01-me1.mjs.map → discover-BBiluyl4.mjs.map} +1 -1
  16. package/dist/chunks/{doctor-CginW8y8.mjs → doctor-BAcemCDr.mjs} +5 -5
  17. package/dist/chunks/{doctor-CginW8y8.mjs.map → doctor-BAcemCDr.mjs.map} +1 -1
  18. package/dist/chunks/{init-BUnzIkeE.mjs → init-DfOKw-rD.mjs} +3 -3
  19. package/dist/chunks/{init-BUnzIkeE.mjs.map → init-DfOKw-rD.mjs.map} +1 -1
  20. package/dist/chunks/{migrate-DybihKzZ.mjs → migrate-D3-4beNR.mjs} +2 -2
  21. package/dist/chunks/{migrate-DybihKzZ.mjs.map → migrate-D3-4beNR.mjs.map} +1 -1
  22. package/dist/chunks/obsidian-D1jf1sTR.mjs +191 -0
  23. package/dist/chunks/obsidian-D1jf1sTR.mjs.map +1 -0
  24. package/dist/chunks/{policy-Clypo20s.mjs → policy-Y65MYKzn.mjs} +4 -4
  25. package/dist/chunks/{policy-Clypo20s.mjs.map → policy-Y65MYKzn.mjs.map} +1 -1
  26. package/dist/chunks/{reconcile-Bhy3IIYo.mjs → reconcile-B6mGZWtp.mjs} +4 -4
  27. package/dist/chunks/{reconcile-Bhy3IIYo.mjs.map → reconcile-B6mGZWtp.mjs.map} +1 -1
  28. package/dist/chunks/{run-CgTWYlcd.mjs → run-BInPXOcm.mjs} +2 -2
  29. package/dist/chunks/{run-CgTWYlcd.mjs.map → run-BInPXOcm.mjs.map} +1 -1
  30. package/dist/chunks/{scan-8Gy_B6kI.mjs → scan-C5uDr7Yq.mjs} +51 -6
  31. package/dist/chunks/scan-C5uDr7Yq.mjs.map +1 -0
  32. package/dist/chunks/{schema-C9QbUW4H.mjs → schema-hSyIURjN.mjs} +8 -3
  33. package/dist/chunks/schema-hSyIURjN.mjs.map +1 -0
  34. package/dist/chunks/{spec-Bq0P3jVh.mjs → spec-MVP9y8dN.mjs} +2 -2
  35. package/dist/chunks/{spec-Bq0P3jVh.mjs.map → spec-MVP9y8dN.mjs.map} +1 -1
  36. package/dist/chunks/{src-DcU4IXMe.mjs → src-BnlNkd3S.mjs} +2 -2
  37. package/dist/chunks/{src-DcU4IXMe.mjs.map → src-BnlNkd3S.mjs.map} +1 -1
  38. package/dist/chunks/{src-r0ECB1UJ.mjs → src-C7hs8Bjw.mjs} +2 -2
  39. package/dist/chunks/{src-r0ECB1UJ.mjs.map → src-C7hs8Bjw.mjs.map} +1 -1
  40. package/dist/chunks/{src-CmFjh4M0.mjs → src-DMrQ5m6I.mjs} +2 -2
  41. package/dist/chunks/{src-CmFjh4M0.mjs.map → src-DMrQ5m6I.mjs.map} +1 -1
  42. package/dist/chunks/{src-DZazJCp1.mjs → src-Daa5lIcP.mjs} +2 -2
  43. package/dist/chunks/{src-DZazJCp1.mjs.map → src-Daa5lIcP.mjs.map} +1 -1
  44. package/dist/cli.mjs +14 -13
  45. package/dist/cli.mjs.map +1 -1
  46. package/package.json +1 -1
  47. package/dist/chunks/scan-8Gy_B6kI.mjs.map +0 -1
  48. package/dist/chunks/schema-C9QbUW4H.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { F as EXIT_CODE_BY_CLASS, P as toErrorInfo } from "./chunks/src-Cu3TxNob.mjs";
3
- import { n as formatExitCodesHelp, t as VERBS } from "./chunks/contract-BkMjU1kR.mjs";
3
+ import { n as formatExitCodesHelp, t as VERBS } from "./chunks/contract-DiWla5G9.mjs";
4
4
  import { r as CONTROLLER_EXIT_CODES } from "./chunks/src-s7YRvk0t.mjs";
5
5
  import { Command, CommanderError } from "commander";
6
6
  //#region src/lazy.ts
@@ -13,10 +13,10 @@ import { Command, CommanderError } from "commander";
13
13
  * registry without a loader — or the reverse — fails Wave 0's own check.
14
14
  */
15
15
  const COMMAND_MODULES = Object.freeze({
16
- init: () => import("./chunks/init-BUnzIkeE.mjs"),
17
- doctor: () => import("./chunks/doctor-CginW8y8.mjs"),
18
- discover: () => import("./chunks/discover-eS01-me1.mjs"),
19
- run: () => import("./chunks/run-CgTWYlcd.mjs"),
16
+ init: () => import("./chunks/init-DfOKw-rD.mjs"),
17
+ doctor: () => import("./chunks/doctor-BAcemCDr.mjs"),
18
+ discover: () => import("./chunks/discover-BBiluyl4.mjs"),
19
+ run: () => import("./chunks/run-BInPXOcm.mjs"),
20
20
  status: () => import("./chunks/status-SMjiOMYy.mjs"),
21
21
  inspect: () => import("./chunks/inspect-Buby4cQD.mjs"),
22
22
  resume: () => import("./chunks/resume-GJQRb2Eb.mjs"),
@@ -36,14 +36,15 @@ const COMMAND_MODULES = Object.freeze({
36
36
  auth: () => import("./chunks/auth-Dnlksuo5.mjs"),
37
37
  providers: () => import("./chunks/providers-Dx78imKj.mjs"),
38
38
  models: () => import("./chunks/models-Btp6X2YZ.mjs"),
39
- config: () => import("./chunks/config-DefHA2Lw.mjs"),
40
- migrate: () => import("./chunks/migrate-DybihKzZ.mjs"),
41
- reconcile: () => import("./chunks/reconcile-Bhy3IIYo.mjs"),
42
- spec: () => import("./chunks/spec-Bq0P3jVh.mjs"),
43
- policy: () => import("./chunks/policy-Clypo20s.mjs"),
39
+ config: () => import("./chunks/config-DcGPL3i7.mjs"),
40
+ migrate: () => import("./chunks/migrate-D3-4beNR.mjs"),
41
+ reconcile: () => import("./chunks/reconcile-B6mGZWtp.mjs"),
42
+ spec: () => import("./chunks/spec-MVP9y8dN.mjs"),
43
+ obsidian: () => import("./chunks/obsidian-D1jf1sTR.mjs"),
44
+ policy: () => import("./chunks/policy-Y65MYKzn.mjs"),
44
45
  gc: () => import("./chunks/gc-BBXlBF5w.mjs"),
45
46
  update: () => import("./chunks/update-BXIppsbi.mjs"),
46
- brainstorm: () => import("./chunks/brainstorm-BwKA6yZP.mjs"),
47
+ brainstorm: () => import("./chunks/brainstorm-kBUiZLce.mjs"),
47
48
  "run-tool": () => import("./chunks/run-tool-C3rAv4XF.mjs"),
48
49
  send: () => import("./chunks/send-BdnJ85Nz.mjs"),
49
50
  __host: () => import("./chunks/__host-DgGPyco9.mjs")
@@ -61,7 +62,7 @@ async function loadCommandModule(verb) {
61
62
  * only through here, so a read-only verb whose action never runs never pays for it either (DESIGN 1.3).
62
63
  */
63
64
  async function loadCliContext(inputs) {
64
- const mod = await import("./chunks/compose-CC9_NMzm.mjs");
65
+ const mod = await import("./chunks/compose-ckM7eAJ_.mjs");
65
66
  if (typeof mod.composeCliContext !== "function") throw new TypeError("lazy.ts: compose/index.ts has no composeCliContext export");
66
67
  return mod.composeCliContext(inputs);
67
68
  }
@@ -69,7 +70,7 @@ async function loadCliContext(inputs) {
69
70
  //#region src/cli.ts
70
71
  /** Mirrors `apps/cli/package.json` "version"; `apps/cli/test/registry/version.test.ts` reads that file and fails
71
72
  * if the two ever drift (a literal keeps `--version` free of any file read on the one-shot start-up path). */
72
- const COHORTE_VERSION = "3.0.0-dev.4";
73
+ const COHORTE_VERSION = "3.0.0-dev.6";
73
74
  function printError(deps, info) {
74
75
  deps.stderr.write(`error: ${info.code}: ${info.message}\n`);
75
76
  deps.stderr.write(`impact: ${info.impact}\n`);
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../../../apps/cli/src/lazy.ts","../../../apps/cli/src/cli.ts"],"sourcesContent":["// apps/cli/src/lazy.ts — the ONLY `import(` site of `apps/cli/src` (DESIGN 1.2 net 3 rule g, DESIGN 1.3, DESIGN\n// 6.3 §\"read-only verbs never load core/runtime\"). `check-layers` refuses `import(` anywhere else under\n// `apps/cli/src/**` (rule g is per FILE, not per occurrence), so a verb module that needs `compose`/`host`/etc.\n// reaches them only through here, which keeps `cli.ts` (and every module reachable from it without going through\n// `lazy.ts`) inside François' 10 s / 4 MiB one-shot budget for a verb that never needs the heavy ports.\nimport type { CliContext, CommandModule } from './contract/index.ts';\n\n/** What `compose/index.ts` (U4.01) exports: assembles the real `CliContext` from process-level inputs. */\nexport interface ComposeInputs {\n readonly cwd: string;\n readonly env: NodeJS.ProcessEnv;\n readonly stdio: {\n readonly stdout: NodeJS.WritableStream;\n readonly stderr: NodeJS.WritableStream;\n readonly stdin: NodeJS.ReadableStream;\n };\n}\n\n/**\n * One LITERAL specifier per verb, closed over a thunk. A computed specifier (`` import(`./commands/${verb}/…`) ``)\n * is invisible to every bundler: rolldown would leave the template in `dist/cli.mjs` and emit no verb chunk, so the\n * SHIPPED cli could not execute a single verb (it would try to load a `.ts` file next to `dist/`). Written out, each\n * specifier is statically analysable: rolldown code-splits one chunk per verb, laziness is preserved, and\n * `apps/cli/test/registry/lazy.test.ts` pins this map against `VERBS` in both directions so a verb added to the\n * registry without a loader — or the reverse — fails Wave 0's own check.\n */\nexport const COMMAND_MODULES: Readonly<Record<string, () => Promise<unknown>>> = Object.freeze({\n init: () => import('./commands/init/index.ts'),\n doctor: () => import('./commands/doctor/index.ts'),\n discover: () => import('./commands/discover/index.ts'),\n run: () => import('./commands/run/index.ts'),\n status: () => import('./commands/status/index.ts'),\n inspect: () => import('./commands/inspect/index.ts'),\n resume: () => import('./commands/resume/index.ts'),\n pause: () => import('./commands/pause/index.ts'),\n cancel: () => import('./commands/cancel/index.ts'),\n shutdown: () => import('./commands/shutdown/index.ts'),\n approve: () => import('./commands/approve/index.ts'),\n deny: () => import('./commands/deny/index.ts'),\n retry: () => import('./commands/retry/index.ts'),\n skip: () => import('./commands/skip/index.ts'),\n logs: () => import('./commands/logs/index.ts'),\n tail: () => import('./commands/tail/index.ts'),\n diff: () => import('./commands/diff/index.ts'),\n review: () => import('./commands/review/index.ts'),\n fix: () => import('./commands/fix/index.ts'),\n ship: () => import('./commands/ship/index.ts'),\n auth: () => import('./commands/auth/index.ts'),\n providers: () => import('./commands/providers/index.ts'),\n models: () => import('./commands/models/index.ts'),\n config: () => import('./commands/config/index.ts'),\n migrate: () => import('./commands/migrate/index.ts'),\n reconcile: () => import('./commands/reconcile/index.ts'),\n spec: () => import('./commands/spec/index.ts'),\n policy: () => import('./commands/policy/index.ts'),\n gc: () => import('./commands/gc/index.ts'),\n update: () => import('./commands/update/index.ts'),\n brainstorm: () => import('./commands/brainstorm/index.ts'),\n 'run-tool': () => import('./commands/run-tool/index.ts'),\n send: () => import('./commands/send/index.ts'),\n __host: () => import('./commands/__host/index.ts'),\n});\n\n/** Loads `commands/<verb>/index.ts` and returns its default export. */\nexport async function loadCommandModule(verb: string): Promise<CommandModule> {\n const load = COMMAND_MODULES[verb];\n if (!load) throw new RangeError(`lazy.ts: no command module registered for verb \"${verb}\"`);\n const loaded = await load();\n const mod = loaded as { default?: CommandModule };\n if (!mod.default || typeof mod.default.run !== 'function') {\n throw new TypeError(`lazy.ts: commands/${verb}/index.ts has no default CommandModule export`);\n }\n return mod.default;\n}\n\n/**\n * The one `import(` of `./compose/index.ts` (DESIGN 1.2 net 3 rule g): `cli.ts` reaches the real `CliContext`\n * only through here, so a read-only verb whose action never runs never pays for it either (DESIGN 1.3).\n */\nexport async function loadCliContext(inputs: ComposeInputs): Promise<CliContext> {\n const loaded: unknown = await import('./compose/index.ts');\n const mod = loaded as { composeCliContext?: (inputs: ComposeInputs) => Promise<CliContext> };\n if (typeof mod.composeCliContext !== 'function') {\n throw new TypeError('lazy.ts: compose/index.ts has no composeCliContext export');\n }\n return mod.composeCliContext(inputs);\n}\n","#!/usr/bin/env node\n// apps/cli/src/cli.ts — DESIGN §9 CLI row: the whole verb registry, built from `contract/verbs.ts` and nothing\n// else (PLAN §3 rule 3 \"cli.ts pre-registers every verb against commands/<verb>/index.ts; ... nobody edits the\n// registry\"). `cli.ts` never imports `core`/`runtime-*`/`security`/`persistence` directly: a verb's module, and the\n// real `CliContext`, are reached only through `lazy.ts`'s single `import()` site (DESIGN 1.2 net 3 rule g, DESIGN\n// 1.3 \"read-only verbs never load core/runtime\") — so `--help` and `--version`, which commander answers itself\n// without ever calling `dispatch`, pay nothing beyond this file and `commander`.\nimport { toErrorInfo } from '@cohorte/base';\nimport { Command, CommanderError } from 'commander';\nimport {\n type CliContext,\n CONTROLLER_EXIT_CODES,\n type CommandArgs,\n EXIT_CODE_BY_CLASS,\n formatExitCodesHelp,\n VERBS,\n type VerbSpec,\n} from './contract/index.ts';\nimport { loadCliContext, loadCommandModule } from './lazy.ts';\n\n/** Mirrors `apps/cli/package.json` \"version\"; `apps/cli/test/registry/version.test.ts` reads that file and fails\n * if the two ever drift (a literal keeps `--version` free of any file read on the one-shot start-up path). */\nexport const COHORTE_VERSION = '3.0.0-dev.4';\n\nexport interface RuntimeDeps {\n readonly stdout: NodeJS.WritableStream;\n readonly stderr: NodeJS.WritableStream;\n /** Built lazily: only a verb whose action actually runs calls this (never `--help`/`--version`, DESIGN 1.3). */\n readonly context: () => Promise<CliContext>;\n}\n\nfunction printError(deps: RuntimeDeps, info: ReturnType<typeof toErrorInfo>): void {\n // spec 21: \"cause / impact / run / next action / exit code\"\n deps.stderr.write(`error: ${info.code}: ${info.message}\\n`);\n deps.stderr.write(`impact: ${info.impact}\\n`);\n deps.stderr.write(`next action: ${info.remediation}\\n`);\n}\n\n/** Loads the verb's module, builds its `CliContext` and runs it, converting any throw at this one boundary\n * (DESIGN 2.8: \"Every error has ... an exit code\"; the module itself never writes to stdio on error). */\nasync function dispatch(deps: RuntimeDeps, verb: string, args: CommandArgs): Promise<number> {\n try {\n const mod = await loadCommandModule(verb);\n const ctx = await deps.context();\n return await mod.run(ctx, args);\n } catch (error) {\n // DESIGN 2.8: \"Unknown throwables -> `<nearest class>/unexpected`\". A `CohorteError` keeps its own code through\n // `toErrorInfo`, so the Wave-0 stubs still answer `configuration/phase-not-available`; anything else — a\n // TypeError in a filled-in verb, a failed store open, a module that will not load — is reported as what it is.\n const info = toErrorInfo(error, { code: 'configuration/unexpected', class: 'configuration' });\n printError(deps, info);\n return EXIT_CODE_BY_CLASS[info.class];\n }\n}\n\ninterface ExitBox {\n code: number;\n}\n\nfunction addAction(command: Command, deps: RuntimeDeps, exit: ExitBox, verb: VerbSpec, subVerb?: string): void {\n command.allowUnknownOption(true).allowExcessArguments(true);\n // `--json` only where DESIGN 2.3.5 gives the verb a published document (`JSON_OUTPUTS`): registering it on every\n // verb would promise a machine output that no schema backs, and the Wave-4 `--json validates` tests read that map.\n if (verb.json) command.option('--json', 'print the machine-readable document for this verb (DESIGN 2.3.5)');\n command.argument('[args...]', 'verb arguments').action(async (positionals: string[], options: { json?: boolean }) => {\n const args: CommandArgs = {\n positionals,\n options,\n json: Boolean(options.json),\n ...(subVerb === undefined ? {} : { subVerb }),\n };\n exit.code = await dispatch(deps, verb.name, args);\n });\n}\n\n/** Builds the whole commander tree. Exported so a test can assert on `--help` / registration without spawning a\n * process (PLAN U0.10 test list: \"every DESIGN §9 verb is registered exactly once and appears in --help\"). */\nexport function buildProgram(deps: RuntimeDeps, exit: ExitBox): Command {\n const program = new Command('cohorte')\n .description('Cohorte: a durable multi-agent development pipeline with a runtime-independent orchestrator.')\n .version(COHORTE_VERSION, '--version', 'print the Cohorte version')\n .exitOverride()\n .configureOutput({\n writeOut: (str) => deps.stdout.write(str),\n writeErr: (str) => deps.stderr.write(str),\n })\n .addHelpText('after', `\\n${formatExitCodesHelp()}\\n`);\n\n for (const verb of VERBS) {\n const sub = program.command(verb.name, verb.hidden ? { hidden: true } : undefined).description(verb.summary);\n if (verb.subVerbs && verb.subVerbs.length > 0) {\n addAction(sub, deps, exit, verb); // bare `cohorte <verb>` with no sub-verb\n for (const subVerb of verb.subVerbs) {\n addAction(sub.command(subVerb), deps, exit, verb, subVerb);\n }\n } else {\n addAction(sub, deps, exit, verb);\n }\n }\n return program;\n}\n\n/**\n * `CONTROLLER_EXIT_CODES.usage` (2) for anything commander itself refuses (bad flag, unknown command, no command at\n * all), `completed` (0) for the routes where commander did exactly what was asked and then stopped the parse.\n *\n * Keyed off commander's OWN `exitCode`, not off the code NAME: commander raises `commander.help` both for the\n * advertised `help [command]` route (which prints the help and means exit 0) and for a bare `cohorte` with no\n * command (exit 1 there — a usage error), and an allow-list of names got the first case wrong while `--help`,\n * raising `commander.helpDisplayed`, was right. `error.exitCode` already separates the two.\n */\nfunction commanderExitCode(error: CommanderError): number {\n return error.exitCode === 0 ? CONTROLLER_EXIT_CODES.completed : CONTROLLER_EXIT_CODES.usage;\n}\n\n/** Parses `argv` (no leading node/script entries) and runs the matched verb. Never calls `process.exit`: the\n * caller (`main()` below, or a test) owns that decision. */\nexport async function runCli(argv: readonly string[], deps: RuntimeDeps): Promise<number> {\n const exit: ExitBox = { code: CONTROLLER_EXIT_CODES.completed };\n const program = buildProgram(deps, exit);\n try {\n await program.parseAsync(argv, { from: 'user' });\n } catch (error) {\n if (error instanceof CommanderError) return commanderExitCode(error);\n throw error;\n }\n return exit.code;\n}\n\nasync function realContext(): Promise<CliContext> {\n return loadCliContext({\n cwd: process.cwd(),\n env: process.env,\n stdio: { stdout: process.stdout, stderr: process.stderr, stdin: process.stdin },\n });\n}\n\nasync function main(): Promise<void> {\n const deps: RuntimeDeps = { stdout: process.stdout, stderr: process.stderr, context: realContext };\n const code = await runCli(process.argv.slice(2), deps);\n process.exitCode = code;\n}\n\n// `import.meta.main` (node >= 24.2; `apps/cli` engines are `^24.16.0 || >=26.1.0`) and NOT a hand-rolled\n// `import.meta.url === \\`file://${process.argv[1]}\\``: npm installs `bin` as a SYMLINK\n// (`node_modules/.bin/cohorte` -> `../cohorte/dist/cli.mjs`), so the comparison is false for every real install and\n// the published CLI would print nothing and exit 0. It also breaks on any install path with a space or a non-ASCII\n// character (`import.meta.url` is percent-encoded, `argv[1]` is not).\nif (import.meta.main) {\n main().catch((error: unknown) => {\n process.stderr.write(`fatal: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}\\n`);\n process.exitCode = 1;\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BA,MAAa,kBAAoE,OAAO,OAAO;CAC7F,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,gBAAgB,OAAO;CACvB,WAAW,OAAO;CAClB,cAAc,OAAO;CACrB,eAAe,OAAO;CACtB,cAAc,OAAO;CACrB,aAAa,OAAO;CACpB,cAAc,OAAO;CACrB,gBAAgB,OAAO;CACvB,eAAe,OAAO;CACtB,YAAY,OAAO;CACnB,aAAa,OAAO;CACpB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,WAAW,OAAO;CAClB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,iBAAiB,OAAO;CACxB,cAAc,OAAO;CACrB,cAAc,OAAO;CACrB,eAAe,OAAO;CACtB,iBA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oC;CACxF,MAAM,OAAgB,EAAE,MAAM,sBAAsB,UAAU;CAC9D,MAAM,UAAU,aAAa,MAAM,IAAI;CACvC,IAAI;EACF,MAAM,QAAQ,WAAW,MAAM,EAAE,MAAM,OAAO,CAAC;CACjD,SAAS,OAAO;EACd,IAAI,iBAAiB,gBAAgB,OAAO,kBAAkB,KAAK;EACnE,MAAM;CACR;CACA,OAAO,KAAK;AACd;AAEA,eAAe,cAAmC;CAChD,OAAO,eAAe;EACpB,KAAK,QAAQ,IAAI;EACjB,KAAK,QAAQ;EACb,OAAO;GAAE,QAAQ,QAAQ;GAAQ,QAAQ,QAAQ;GAAQ,OAAO,QAAQ;EAAM;CAChF,CAAC;AACH;AAEA,eAAe,OAAsB;CACnC,MAAM,OAAoB;EAAE,QAAQ,QAAQ;EAAQ,QAAQ,QAAQ;EAAQ,SAAS;CAAY;CACjG,MAAM,OAAO,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC,GAAG,IAAI;CACrD,QAAQ,WAAW;AACrB;AAOA,IAAI,YAAY,MACd,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,OAAO,MAAM,UAAU,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK,EAAE,GAAG;CAC1G,QAAQ,WAAW;AACrB,CAAC"}
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../../../apps/cli/src/lazy.ts","../../../apps/cli/src/cli.ts"],"sourcesContent":["// apps/cli/src/lazy.ts — the ONLY `import(` site of `apps/cli/src` (DESIGN 1.2 net 3 rule g, DESIGN 1.3, DESIGN\n// 6.3 §\"read-only verbs never load core/runtime\"). `check-layers` refuses `import(` anywhere else under\n// `apps/cli/src/**` (rule g is per FILE, not per occurrence), so a verb module that needs `compose`/`host`/etc.\n// reaches them only through here, which keeps `cli.ts` (and every module reachable from it without going through\n// `lazy.ts`) inside François' 10 s / 4 MiB one-shot budget for a verb that never needs the heavy ports.\nimport type { CliContext, CommandModule } from './contract/index.ts';\n\n/** What `compose/index.ts` (U4.01) exports: assembles the real `CliContext` from process-level inputs. */\nexport interface ComposeInputs {\n readonly cwd: string;\n readonly env: NodeJS.ProcessEnv;\n readonly stdio: {\n readonly stdout: NodeJS.WritableStream;\n readonly stderr: NodeJS.WritableStream;\n readonly stdin: NodeJS.ReadableStream;\n };\n}\n\n/**\n * One LITERAL specifier per verb, closed over a thunk. A computed specifier (`` import(`./commands/${verb}/…`) ``)\n * is invisible to every bundler: rolldown would leave the template in `dist/cli.mjs` and emit no verb chunk, so the\n * SHIPPED cli could not execute a single verb (it would try to load a `.ts` file next to `dist/`). Written out, each\n * specifier is statically analysable: rolldown code-splits one chunk per verb, laziness is preserved, and\n * `apps/cli/test/registry/lazy.test.ts` pins this map against `VERBS` in both directions so a verb added to the\n * registry without a loader — or the reverse — fails Wave 0's own check.\n */\nexport const COMMAND_MODULES: Readonly<Record<string, () => Promise<unknown>>> = Object.freeze({\n init: () => import('./commands/init/index.ts'),\n doctor: () => import('./commands/doctor/index.ts'),\n discover: () => import('./commands/discover/index.ts'),\n run: () => import('./commands/run/index.ts'),\n status: () => import('./commands/status/index.ts'),\n inspect: () => import('./commands/inspect/index.ts'),\n resume: () => import('./commands/resume/index.ts'),\n pause: () => import('./commands/pause/index.ts'),\n cancel: () => import('./commands/cancel/index.ts'),\n shutdown: () => import('./commands/shutdown/index.ts'),\n approve: () => import('./commands/approve/index.ts'),\n deny: () => import('./commands/deny/index.ts'),\n retry: () => import('./commands/retry/index.ts'),\n skip: () => import('./commands/skip/index.ts'),\n logs: () => import('./commands/logs/index.ts'),\n tail: () => import('./commands/tail/index.ts'),\n diff: () => import('./commands/diff/index.ts'),\n review: () => import('./commands/review/index.ts'),\n fix: () => import('./commands/fix/index.ts'),\n ship: () => import('./commands/ship/index.ts'),\n auth: () => import('./commands/auth/index.ts'),\n providers: () => import('./commands/providers/index.ts'),\n models: () => import('./commands/models/index.ts'),\n config: () => import('./commands/config/index.ts'),\n migrate: () => import('./commands/migrate/index.ts'),\n reconcile: () => import('./commands/reconcile/index.ts'),\n spec: () => import('./commands/spec/index.ts'),\n obsidian: () => import('./commands/obsidian/index.ts'),\n policy: () => import('./commands/policy/index.ts'),\n gc: () => import('./commands/gc/index.ts'),\n update: () => import('./commands/update/index.ts'),\n brainstorm: () => import('./commands/brainstorm/index.ts'),\n 'run-tool': () => import('./commands/run-tool/index.ts'),\n send: () => import('./commands/send/index.ts'),\n __host: () => import('./commands/__host/index.ts'),\n});\n\n/** Loads `commands/<verb>/index.ts` and returns its default export. */\nexport async function loadCommandModule(verb: string): Promise<CommandModule> {\n const load = COMMAND_MODULES[verb];\n if (!load) throw new RangeError(`lazy.ts: no command module registered for verb \"${verb}\"`);\n const loaded = await load();\n const mod = loaded as { default?: CommandModule };\n if (!mod.default || typeof mod.default.run !== 'function') {\n throw new TypeError(`lazy.ts: commands/${verb}/index.ts has no default CommandModule export`);\n }\n return mod.default;\n}\n\n/**\n * The one `import(` of `./compose/index.ts` (DESIGN 1.2 net 3 rule g): `cli.ts` reaches the real `CliContext`\n * only through here, so a read-only verb whose action never runs never pays for it either (DESIGN 1.3).\n */\nexport async function loadCliContext(inputs: ComposeInputs): Promise<CliContext> {\n const loaded: unknown = await import('./compose/index.ts');\n const mod = loaded as { composeCliContext?: (inputs: ComposeInputs) => Promise<CliContext> };\n if (typeof mod.composeCliContext !== 'function') {\n throw new TypeError('lazy.ts: compose/index.ts has no composeCliContext export');\n }\n return mod.composeCliContext(inputs);\n}\n","#!/usr/bin/env node\n// apps/cli/src/cli.ts — DESIGN §9 CLI row: the whole verb registry, built from `contract/verbs.ts` and nothing\n// else (PLAN §3 rule 3 \"cli.ts pre-registers every verb against commands/<verb>/index.ts; ... nobody edits the\n// registry\"). `cli.ts` never imports `core`/`runtime-*`/`security`/`persistence` directly: a verb's module, and the\n// real `CliContext`, are reached only through `lazy.ts`'s single `import()` site (DESIGN 1.2 net 3 rule g, DESIGN\n// 1.3 \"read-only verbs never load core/runtime\") — so `--help` and `--version`, which commander answers itself\n// without ever calling `dispatch`, pay nothing beyond this file and `commander`.\nimport { toErrorInfo } from '@cohorte/base';\nimport { Command, CommanderError } from 'commander';\nimport {\n type CliContext,\n CONTROLLER_EXIT_CODES,\n type CommandArgs,\n EXIT_CODE_BY_CLASS,\n formatExitCodesHelp,\n VERBS,\n type VerbSpec,\n} from './contract/index.ts';\nimport { loadCliContext, loadCommandModule } from './lazy.ts';\n\n/** Mirrors `apps/cli/package.json` \"version\"; `apps/cli/test/registry/version.test.ts` reads that file and fails\n * if the two ever drift (a literal keeps `--version` free of any file read on the one-shot start-up path). */\nexport const COHORTE_VERSION = '3.0.0-dev.6';\n\nexport interface RuntimeDeps {\n readonly stdout: NodeJS.WritableStream;\n readonly stderr: NodeJS.WritableStream;\n /** Built lazily: only a verb whose action actually runs calls this (never `--help`/`--version`, DESIGN 1.3). */\n readonly context: () => Promise<CliContext>;\n}\n\nfunction printError(deps: RuntimeDeps, info: ReturnType<typeof toErrorInfo>): void {\n // spec 21: \"cause / impact / run / next action / exit code\"\n deps.stderr.write(`error: ${info.code}: ${info.message}\\n`);\n deps.stderr.write(`impact: ${info.impact}\\n`);\n deps.stderr.write(`next action: ${info.remediation}\\n`);\n}\n\n/** Loads the verb's module, builds its `CliContext` and runs it, converting any throw at this one boundary\n * (DESIGN 2.8: \"Every error has ... an exit code\"; the module itself never writes to stdio on error). */\nasync function dispatch(deps: RuntimeDeps, verb: string, args: CommandArgs): Promise<number> {\n try {\n const mod = await loadCommandModule(verb);\n const ctx = await deps.context();\n return await mod.run(ctx, args);\n } catch (error) {\n // DESIGN 2.8: \"Unknown throwables -> `<nearest class>/unexpected`\". A `CohorteError` keeps its own code through\n // `toErrorInfo`, so the Wave-0 stubs still answer `configuration/phase-not-available`; anything else — a\n // TypeError in a filled-in verb, a failed store open, a module that will not load — is reported as what it is.\n const info = toErrorInfo(error, { code: 'configuration/unexpected', class: 'configuration' });\n printError(deps, info);\n return EXIT_CODE_BY_CLASS[info.class];\n }\n}\n\ninterface ExitBox {\n code: number;\n}\n\nfunction addAction(command: Command, deps: RuntimeDeps, exit: ExitBox, verb: VerbSpec, subVerb?: string): void {\n command.allowUnknownOption(true).allowExcessArguments(true);\n // `--json` only where DESIGN 2.3.5 gives the verb a published document (`JSON_OUTPUTS`): registering it on every\n // verb would promise a machine output that no schema backs, and the Wave-4 `--json validates` tests read that map.\n if (verb.json) command.option('--json', 'print the machine-readable document for this verb (DESIGN 2.3.5)');\n command.argument('[args...]', 'verb arguments').action(async (positionals: string[], options: { json?: boolean }) => {\n const args: CommandArgs = {\n positionals,\n options,\n json: Boolean(options.json),\n ...(subVerb === undefined ? {} : { subVerb }),\n };\n exit.code = await dispatch(deps, verb.name, args);\n });\n}\n\n/** Builds the whole commander tree. Exported so a test can assert on `--help` / registration without spawning a\n * process (PLAN U0.10 test list: \"every DESIGN §9 verb is registered exactly once and appears in --help\"). */\nexport function buildProgram(deps: RuntimeDeps, exit: ExitBox): Command {\n const program = new Command('cohorte')\n .description('Cohorte: a durable multi-agent development pipeline with a runtime-independent orchestrator.')\n .version(COHORTE_VERSION, '--version', 'print the Cohorte version')\n .exitOverride()\n .configureOutput({\n writeOut: (str) => deps.stdout.write(str),\n writeErr: (str) => deps.stderr.write(str),\n })\n .addHelpText('after', `\\n${formatExitCodesHelp()}\\n`);\n\n for (const verb of VERBS) {\n const sub = program.command(verb.name, verb.hidden ? { hidden: true } : undefined).description(verb.summary);\n if (verb.subVerbs && verb.subVerbs.length > 0) {\n addAction(sub, deps, exit, verb); // bare `cohorte <verb>` with no sub-verb\n for (const subVerb of verb.subVerbs) {\n addAction(sub.command(subVerb), deps, exit, verb, subVerb);\n }\n } else {\n addAction(sub, deps, exit, verb);\n }\n }\n return program;\n}\n\n/**\n * `CONTROLLER_EXIT_CODES.usage` (2) for anything commander itself refuses (bad flag, unknown command, no command at\n * all), `completed` (0) for the routes where commander did exactly what was asked and then stopped the parse.\n *\n * Keyed off commander's OWN `exitCode`, not off the code NAME: commander raises `commander.help` both for the\n * advertised `help [command]` route (which prints the help and means exit 0) and for a bare `cohorte` with no\n * command (exit 1 there — a usage error), and an allow-list of names got the first case wrong while `--help`,\n * raising `commander.helpDisplayed`, was right. `error.exitCode` already separates the two.\n */\nfunction commanderExitCode(error: CommanderError): number {\n return error.exitCode === 0 ? CONTROLLER_EXIT_CODES.completed : CONTROLLER_EXIT_CODES.usage;\n}\n\n/** Parses `argv` (no leading node/script entries) and runs the matched verb. Never calls `process.exit`: the\n * caller (`main()` below, or a test) owns that decision. */\nexport async function runCli(argv: readonly string[], deps: RuntimeDeps): Promise<number> {\n const exit: ExitBox = { code: CONTROLLER_EXIT_CODES.completed };\n const program = buildProgram(deps, exit);\n try {\n await program.parseAsync(argv, { from: 'user' });\n } catch (error) {\n if (error instanceof CommanderError) return commanderExitCode(error);\n throw error;\n }\n return exit.code;\n}\n\nasync function realContext(): Promise<CliContext> {\n return loadCliContext({\n cwd: process.cwd(),\n env: process.env,\n stdio: { stdout: process.stdout, stderr: process.stderr, stdin: process.stdin },\n });\n}\n\nasync function main(): Promise<void> {\n const deps: RuntimeDeps = { stdout: process.stdout, stderr: process.stderr, context: realContext };\n const code = await runCli(process.argv.slice(2), deps);\n process.exitCode = code;\n}\n\n// `import.meta.main` (node >= 24.2; `apps/cli` engines are `^24.16.0 || >=26.1.0`) and NOT a hand-rolled\n// `import.meta.url === \\`file://${process.argv[1]}\\``: npm installs `bin` as a SYMLINK\n// (`node_modules/.bin/cohorte` -> `../cohorte/dist/cli.mjs`), so the comparison is false for every real install and\n// the published CLI would print nothing and exit 0. It also breaks on any install path with a space or a non-ASCII\n// character (`import.meta.url` is percent-encoded, `argv[1]` is not).\nif (import.meta.main) {\n main().catch((error: unknown) => {\n process.stderr.write(`fatal: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}\\n`);\n process.exitCode = 1;\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BA,MAAa,kBAAoE,OAAO,OAAO;CAC7F,YAAY,OAAO;CAC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K,EAAE,GAAG;CAC1G,QAAQ,WAAW;AACrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cohorte",
3
- "version": "3.0.0-dev.4",
3
+ "version": "3.0.0-dev.6",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"scan-8Gy_B6kI.mjs","names":[],"sources":["../../../../packages/project-model/src/scan/index.ts"],"sourcesContent":["// Deterministic repository scan: bounded filesystem observations, never guessed semantics.\n\nimport { readdir, readFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport type { Clock } from '@cohorte/base';\nimport type { ProjectModel } from '../contract.ts';\n\nexport interface ScanOptions {\n clock: Clock;\n /** stamped into `provenance.toolVersion` */\n toolVersion: string;\n}\n\nasync function filesUnder(root: string): Promise<string[]> {\n const found: string[] = [];\n const visit = async (dir: string): Promise<void> => {\n try {\n const entries = await readdir(dir, { withFileTypes: true });\n for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n if (\n entry.name === '.git' ||\n entry.name === 'node_modules' ||\n entry.name === '.cohorte' ||\n entry.name === '.pi' ||\n entry.name === '.build' ||\n entry.name === 'dist' ||\n entry.name === 'coverage'\n )\n continue;\n const path = join(dir, entry.name);\n if (entry.isDirectory()) await visit(path);\n else if (entry.isFile()) found.push(relative(root, path).split('\\\\').join('/'));\n }\n } catch {\n return;\n }\n };\n await visit(root);\n return found.sort();\n}\n\nfunction field<T>(\n value: T,\n detector: string,\n sources: string[],\n className: ProjectModel['project']['id']['class'] = 'observed',\n) {\n return { value, class: className, provenance: { detector, sources } };\n}\n\nexport async function scanRepository(root: string, options: ScanOptions): Promise<ProjectModel> {\n const files = await filesUnder(root);\n const packagePath = join(root, 'package.json');\n let pkg: {\n name?: string;\n packageManager?: string;\n scripts?: Record<string, string>;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n } = {};\n try {\n pkg = JSON.parse(await readFile(packagePath, 'utf8')) as typeof pkg;\n } catch {\n /* absent or invalid package.json is an observation */\n }\n const ext = new Map<string, string>([\n ['.ts', 'typescript'],\n ['.tsx', 'typescript'],\n ['.js', 'javascript'],\n ['.jsx', 'javascript'],\n ['.py', 'python'],\n ['.go', 'go'],\n ['.rs', 'rust'],\n ['.java', 'java'],\n ]);\n const languages = [\n ...new Set(\n files\n .map((file) => ext.get(file.slice(file.lastIndexOf('.'))))\n .filter((value): value is string => value !== undefined),\n ),\n ].sort();\n const supportedLocks = ['pnpm-lock.yaml', 'package-lock.json', 'yarn.lock', 'bun.lockb'];\n const locks = files.filter((file) => supportedLocks.includes(file));\n const lock = locks.length === 1 ? locks[0] : undefined;\n const packageManager =\n lock === undefined\n ? (pkg.packageManager?.split('@')[0] ?? null)\n : lock === 'pnpm-lock.yaml'\n ? 'pnpm'\n : lock === 'package-lock.json'\n ? 'npm'\n : lock === 'yarn.lock'\n ? 'yarn'\n : 'bun';\n const deps = { ...(pkg.dependencies ?? {}), ...(pkg.devDependencies ?? {}) };\n const frameworks = Object.keys(deps)\n .filter((name) =>\n /^(react|vue|angular|svelte|next|nuxt|express|nestjs|fastify|vite|vitest|jest|playwright)/i.test(name),\n )\n .sort();\n const scripts = pkg.scripts ?? {};\n const commands: Record<string, ReturnType<typeof field<string[]>>> = {};\n for (const name of Object.keys(scripts).sort()) {\n const command = scripts[name];\n if (command !== undefined) commands[name] = field(command.split(/\\s+/u), 'package-json', ['package.json']);\n }\n const testLocations = files.filter((file) => /(^|\\/)(test|tests|__tests__)(\\/|$)|\\.(test|spec)\\./u.test(file));\n const surfaces: ProjectModel['surfaces'] = {};\n const topLevel: string[] = [\n ...new Set(\n files.map((file) => file.split('/')[0]).filter((name): name is string => Boolean(name && !name.startsWith('.'))),\n ),\n ];\n for (const name of topLevel.sort()) {\n const paths = files.filter((file) => file === name || file.startsWith(`${name}/`));\n if (paths.length)\n surfaces[name.replace(/[^A-Za-z0-9_.-]/g, '_')] = { paths: field([`${name}/**`], 'workspace-layout', paths) };\n }\n const id =\n pkg.name?.replace(/^@[^/]+\\//u, '') ??\n (relative(process.cwd(), root).replace(/[^A-Za-z0-9_.-]/g, '_') || 'project');\n const unknowns =\n locks.length > 1\n ? [\n {\n id: 'package-manager',\n question: 'more than one supported lockfile was detected; which package manager is authoritative?',\n candidates: [...locks].sort(),\n sources: [...locks].sort(),\n },\n ]\n : [];\n return {\n schemaVersion: 1,\n project: { id: field(id, 'package-json', ['package.json'], 'human'), root: field(root, 'filesystem', []) },\n stack: {\n languages: field(languages, 'file-extensions', files),\n packageManager: field(packageManager, 'lockfile', lock ? [lock] : []),\n frameworks: field(frameworks, 'package-json', ['package.json']),\n },\n surfaces,\n commands,\n testStrategy: field(\n { runner: scripts.test ? (scripts.test.split(/\\s+/u)[0] ?? null) : null, locations: testLocations },\n 'package-json',\n ['package.json'],\n ),\n deploymentHints: field(\n files.filter((file) => /(^|\\/)(Dockerfile|Procfile|vercel\\.json|fly\\.toml)$/u.test(file)),\n 'file-presence',\n files,\n ),\n ownership: field(\n { codeowners: files.includes('.github/CODEOWNERS') ? '.github/CODEOWNERS' : null },\n 'file-presence',\n ['.github/CODEOWNERS'],\n ),\n risks:\n packageManager === null\n ? [{ id: 'missing-lockfile', severity: 'medium', message: 'no supported lockfile was detected', sources: [] }]\n : [],\n conventions: field(\n files.filter((file) => /(^|\\/)(CONTRIBUTING|conventions)\\.(md|yaml)$/iu.test(file)),\n 'file-presence',\n files,\n ),\n generatedArtifacts: field(['manifest.yaml', 'project.yaml'], 'manifest', ['.cohorte/manifest.yaml']),\n unknowns,\n provenance: { generatedAt: options.clock.now(), toolVersion: options.toolVersion, analysis: 'deterministic' },\n };\n}\n"],"mappings":";;;AAaA,eAAe,WAAW,MAAiC;CACzD,MAAM,QAAkB,CAAC;CACzB,MAAM,QAAQ,OAAO,QAA+B;EAClD,IAAI;GACF,MAAM,UAAU,MAAM,QAAQ,KAAK,EAAE,eAAe,KAAK,CAAC;GAC1D,KA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,GAClF,iBACA,KACF;EACA,oBAAoB,MAAM,CAAC,iBAAiB,cAAc,GAAG,YAAY,CAAC,wBAAwB,CAAC;EACnG;EACA,YAAY;GAAE,aAAa,QAAQ,MAAM,IAAI;GAAG,aAAa,QAAQ;GAAa,UAAU;EAAgB;CAC9G;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-C9QbUW4H.mjs","names":["closed","closed","closed","closed","names","closed"],"sources":["../../../../packages/config/src/schema/policy.ts","../../../../packages/config/src/schema/config.ts","../../../../packages/config/src/schema/manifest.ts","../../../../packages/config/src/schema/ownership.ts","../../../../packages/config/src/schema/skill.ts","../../../../packages/config/src/schema/spec.ts","../../../../packages/config/src/schema/trust.ts"],"sourcesContent":["// Policy DATA shapes (DESIGN 2.6.3, 2.6.4): declared here, evaluated by @cohorte/security. `config` never imports `security`.\nimport { type Static, type TUnsafe, Type } from 'typebox';\n\nconst closed = { additionalProperties: false } as const;\nconst tokens = () => Type.Array(Type.String({ minLength: 1 }));\n\nexport const COMMAND_RULE_ORIGINS = ['builtin', 'project-config', 'project-checks'] as const;\n\n/** DESIGN 2.6.4, verbatim. */\nexport interface CommandRule {\n id: string;\n program: string;\n /** exact tokens, e.g. ['run','test'] */\n subcommand?: readonly string[];\n /** anything not allowed is denied */\n flags?: { allow: readonly string[]; deny?: readonly string[] };\n positionals?:\n | { kind: 'none' }\n | { kind: 'paths-in-worktree'; max: number }\n | { kind: 'enum'; values: readonly string[]; max: number }\n | { kind: 'exact'; values: readonly string[] };\n decision: 'allow' | 'ask' | 'deny';\n when?: { branch?: 'any' | 'unprotected-only'; roles?: readonly string[]; phases?: readonly string[] };\n /** drives recovery (DESIGN 4.1) */\n replay: 'idempotent' | 'at-most-once';\n /** true => denied under L0; under L1 it fails closed in the sandbox */\n network: boolean;\n origin: (typeof COMMAND_RULE_ORIGINS)[number];\n}\n\nconst max = () => Type.Integer({ minimum: 0 });\n\nconst CommandRuleSchema = Type.Object(\n {\n id: Type.String({ minLength: 1 }),\n // A bare program name: a path separator can never name a program (DESIGN 2.6.4 step 1).\n program: Type.String({ pattern: '^[^/\\\\\\\\\\\\s]+$' }),\n subcommand: Type.Optional(tokens()),\n flags: Type.Optional(Type.Object({ allow: tokens(), deny: Type.Optional(tokens()) }, closed)),\n positionals: Type.Optional(\n Type.Union([\n Type.Object({ kind: Type.Literal('none') }, closed),\n Type.Object({ kind: Type.Literal('paths-in-worktree'), max: max() }, closed),\n Type.Object({ kind: Type.Literal('enum'), values: tokens(), max: max() }, closed),\n Type.Object({ kind: Type.Literal('exact'), values: Type.Array(Type.String()) }, closed),\n ]),\n ),\n decision: Type.Union([Type.Literal('allow'), Type.Literal('ask'), Type.Literal('deny')]),\n when: Type.Optional(\n Type.Object(\n {\n branch: Type.Optional(Type.Union([Type.Literal('any'), Type.Literal('unprotected-only')])),\n roles: Type.Optional(tokens()),\n phases: Type.Optional(tokens()),\n },\n closed,\n ),\n ),\n replay: Type.Union([Type.Literal('idempotent'), Type.Literal('at-most-once')]),\n network: Type.Boolean(),\n origin: Type.Union([Type.Literal('builtin'), Type.Literal('project-config'), Type.Literal('project-checks')]),\n },\n closed,\n);\n\n/** [S]. The explicit annotation keeps Biome's type inference out of the union (docs/v3/requests/U0.02.md R1). */\nexport const CommandRule: TUnsafe<CommandRule> = Type.Unsafe<CommandRule>(CommandRuleSchema);\n\n/** [S] DESIGN 2.6.3. Default: deny-outgoing + deny. */\nexport const SymlinkPolicy = Type.Object(\n {\n mode: Type.Union([Type.Literal('deny-outgoing'), Type.Literal('deny-all'), Type.Literal('allow')]),\n hardlinksOnWrite: Type.Union([Type.Literal('deny'), Type.Literal('allow')]),\n },\n closed,\n);\nexport type SymlinkPolicy = Static<typeof SymlinkPolicy>;\n\n/**\n * [S] What stage 4 evaluates for `network_request`. V3.0 has exactly one value: the tool is registered and always\n * denied (DESIGN 2.6.2, §9 \"proxy-based host allowlisting\" is out). The shape exists so a later version can add\n * an allowlist without moving the type.\n */\nexport const NetworkPolicyConfig = Type.Object({ default: Type.Literal('deny') }, closed);\nexport type NetworkPolicyConfig = Static<typeof NetworkPolicyConfig>;\n\nexport const DEFAULT_SYMLINK_POLICY: SymlinkPolicy = Object.freeze({ mode: 'deny-outgoing', hardlinksOnWrite: 'deny' });\nexport const DEFAULT_NETWORK_POLICY: NetworkPolicyConfig = Object.freeze({ default: 'deny' });\n","// `.cohorte/config.yaml` (DESIGN 2.10). NO open question of spec 32 is frozen as a literal type: `runtime.id`,\n// provider names and role keys are open strings; what 3.0 accepts among them is a LOADER rule, not a schema rule.\nimport { AuthMode, BudgetCounters, ID_PATTERN, ModelCapability, ModelRef, ThinkingLevel } from '@cohorte/base';\nimport { ActivePipelineState, type CohorteRole, EscalationPolicy } from '@cohorte/protocol';\nimport { type TUnsafe, Type } from 'typebox';\nimport { CommandRule, DEFAULT_SYMLINK_POLICY, SymlinkPolicy } from './policy.ts';\n\nconst closed = { additionalProperties: false } as const;\n\n/** The ONLY env channel of a provisioning effect (DESIGN 5.7): a closed allowlist of NAMES. */\nexport const PROVISION_ENV_NAMES = [\n 'npm_config_store_dir',\n 'npm_config_cache',\n 'YARN_CACHE_FOLDER',\n 'COREPACK_HOME',\n] as const;\nexport type ProvisionEnvName = (typeof PROVISION_ENV_NAMES)[number];\n\nexport interface TierTarget {\n ref: ModelRef;\n thinking: ThinkingLevel;\n}\nexport interface ApprovalsConfig {\n unattended: 'deny' | 'wait';\n expiryMinutes?: number;\n /** 10 */\n parkAfterMinutes: number;\n ship: 'human' | 'auto';\n notify: boolean;\n /** approve may spawn a host */\n autoResume: boolean;\n}\n\n/** DESIGN 2.10, verbatim. [S] schemas/config.schema.json */\nexport interface CohorteConfig {\n schemaVersion: 1;\n project: { id: string; defaultBranch: string; protectedBranches: string[] };\n runtime: { id: string /* 'pi' | 'fake' */; pi?: { loadFrom: 'package' | 'bundle' } };\n authentication: {\n mode: AuthMode;\n allowApiKeys: boolean;\n /** D2: all three true; accounted METERED (DESIGN 3.7) */\n anthropicSubscriptionViaPi?: {\n enabled: boolean;\n acknowledgePerTokenBilling: boolean;\n acknowledgeProviderTermsRisk: boolean;\n };\n };\n routing: {\n allowedProviders: string[];\n defaults: Partial<Record<CohorteRole, ModelCapability>>;\n tiers: Partial<Record<ModelCapability, TierTarget>>;\n escalation: EscalationPolicy;\n fallback: { enabled: boolean };\n };\n budgets: {\n run: BudgetCounters;\n phase: BudgetCounters;\n agent: BudgetCounters;\n provider: Record<string, BudgetCounters>;\n tool: Record<string, BudgetCounters>;\n /** 3 */\n concurrency: number;\n /** 5 */\n maxIncarnations: number;\n };\n loop: {\n maxFixRounds: number;\n noProgressWindow: number;\n maxDeniedCallsPerAgent: number;\n leftovers: Record<'major' | 'minor' | 'info', 'fix' | 'park' | 'ask'>;\n };\n /** argv arrays */\n checks: { typecheck?: string[]; lint?: string[]; test?: string[]; timeoutMs: number };\n provision: {\n argv?: string[];\n network: boolean;\n cacheDirs: string[];\n lockfiles: string[];\n env: Partial<Record<ProvisionEnvName, string>>;\n // default: every node_modules directory; read-only for agent commands and checks\n dependencyDirs: string[];\n /** writable, excluded from the dependency manifest, wiped before every check sequence */\n writableCaches: string[];\n };\n policy: {\n commands: { allow: CommandRule[]; ask: CommandRule[]; deny: CommandRule[] };\n dangerousCommands: CommandRule[];\n symlinks: SymlinkPolicy;\n approvals: ApprovalsConfig;\n /** default ask: an in-doubt effect needs a human ack before the agent continues (DESIGN 4.4) */\n inDoubt: 'ask' | 'continue';\n skip: ActivePipelineState[];\n steer: { enabled: boolean };\n admin: { runTool: boolean };\n quota: { autoResume: boolean };\n };\n host: { idleExitMinutes: number; pauseKeepAliveMinutes: number; pollMs: number };\n /** forward HTTP(S)_PROXY to the brain; default false */\n network: { proxyEnv: boolean };\n /** `require` absent = the computed default of DESIGN 2.6.6 */\n sandbox: { require?: 'native' | 'best-effort'; brain: 'os-if-available' | 'os' | 'process' };\n git: {\n worktreeRoot?: string;\n branchPrefix: string;\n commitIdentity: 'user' | 'cohorte';\n keepWorktrees: 'on-failure' | 'always' | 'never';\n };\n retention: {\n transcriptsDays: number;\n eventsDays: number | 'forever';\n artifactsDays: number;\n compressAfterDays: number;\n };\n /** default false; `true` is rejected by the LOADER in 3.0 (configuration/telemetry-remote-unavailable, ADR-0013) */\n telemetry: { remote: boolean };\n}\n\nconst oneOf = <const V extends readonly string[]>(values: V): TUnsafe<V[number]> =>\n Type.Unsafe<V[number]>({ type: 'string', enum: [...values] });\nconst count = (minimum = 0) => Type.Integer({ minimum });\nconst argv = () => Type.Array(Type.String(), { minItems: 1 });\nconst strings = () => Type.Array(Type.String({ minLength: 1 }));\nconst rules = () => Type.Array(CommandRule);\n// Explicit return types: a `Static<TRecord>` that Biome has to infer overflows its stack (docs/v3/requests/U0.03.md R1).\nconst budgetMap = (): TUnsafe<Record<string, BudgetCounters>> =>\n Type.Unsafe<Record<string, BudgetCounters>>(Type.Record(Type.String(), BudgetCounters));\nconst roleDefaults = (): TUnsafe<Partial<Record<CohorteRole, ModelCapability>>> =>\n Type.Unsafe<Partial<Record<CohorteRole, ModelCapability>>>(Type.Record(Type.String(), ModelCapability));\nconst tier = () => Type.Optional(Type.Object({ ref: ModelRef, thinking: ThinkingLevel }, closed));\nconst envValue = () => Type.Optional(Type.String({ minLength: 1 }));\nconst leftover = () => oneOf(['fix', 'park', 'ask']);\n\nconst CohorteConfigSchema = Type.Object(\n {\n schemaVersion: Type.Literal(1),\n project: Type.Object(\n {\n id: Type.String({ pattern: ID_PATTERN }),\n defaultBranch: Type.String({ minLength: 1 }),\n protectedBranches: strings(),\n },\n closed,\n ),\n runtime: Type.Object(\n {\n id: Type.String({ minLength: 1 }),\n pi: Type.Optional(Type.Object({ loadFrom: oneOf(['package', 'bundle']) }, closed)),\n },\n closed,\n ),\n authentication: Type.Object(\n {\n mode: AuthMode,\n allowApiKeys: Type.Boolean(),\n anthropicSubscriptionViaPi: Type.Optional(\n Type.Object(\n {\n enabled: Type.Boolean(),\n acknowledgePerTokenBilling: Type.Boolean(),\n acknowledgeProviderTermsRisk: Type.Boolean(),\n },\n closed,\n ),\n ),\n },\n closed,\n ),\n routing: Type.Object(\n {\n allowedProviders: strings(),\n defaults: roleDefaults(),\n tiers: Type.Object({ fast: tier(), coding: tier(), reasoning: tier(), vision: tier(), cheap: tier() }, closed),\n escalation: EscalationPolicy,\n fallback: Type.Object({ enabled: Type.Boolean() }, closed),\n },\n closed,\n ),\n budgets: Type.Object(\n {\n run: BudgetCounters,\n phase: BudgetCounters,\n agent: BudgetCounters,\n provider: budgetMap(),\n tool: budgetMap(),\n concurrency: count(1),\n maxIncarnations: count(1),\n },\n closed,\n ),\n loop: Type.Object(\n {\n maxFixRounds: count(),\n noProgressWindow: count(1),\n maxDeniedCallsPerAgent: count(),\n leftovers: Type.Object({ major: leftover(), minor: leftover(), info: leftover() }, closed),\n },\n closed,\n ),\n checks: Type.Object(\n {\n typecheck: Type.Optional(argv()),\n lint: Type.Optional(argv()),\n test: Type.Optional(argv()),\n timeoutMs: count(1),\n },\n closed,\n ),\n provision: Type.Object(\n {\n argv: Type.Optional(argv()),\n network: Type.Boolean(),\n cacheDirs: strings(),\n lockfiles: strings(),\n env: Type.Object(\n {\n npm_config_store_dir: envValue(),\n npm_config_cache: envValue(),\n YARN_CACHE_FOLDER: envValue(),\n COREPACK_HOME: envValue(),\n },\n closed,\n ),\n dependencyDirs: strings(),\n writableCaches: strings(),\n },\n closed,\n ),\n policy: Type.Object(\n {\n commands: Type.Object({ allow: rules(), ask: rules(), deny: rules() }, closed),\n dangerousCommands: rules(),\n symlinks: SymlinkPolicy,\n approvals: Type.Object(\n {\n unattended: oneOf(['deny', 'wait']),\n expiryMinutes: Type.Optional(count(1)),\n parkAfterMinutes: count(),\n ship: oneOf(['human', 'auto']),\n notify: Type.Boolean(),\n autoResume: Type.Boolean(),\n },\n closed,\n ),\n inDoubt: oneOf(['ask', 'continue']),\n skip: Type.Array(ActivePipelineState),\n steer: Type.Object({ enabled: Type.Boolean() }, closed),\n admin: Type.Object({ runTool: Type.Boolean() }, closed),\n quota: Type.Object({ autoResume: Type.Boolean() }, closed),\n },\n closed,\n ),\n host: Type.Object({ idleExitMinutes: count(), pauseKeepAliveMinutes: count(), pollMs: count(1) }, closed),\n network: Type.Object({ proxyEnv: Type.Boolean() }, closed),\n sandbox: Type.Object(\n {\n require: Type.Optional(oneOf(['native', 'best-effort'])),\n brain: oneOf(['os-if-available', 'os', 'process']),\n },\n closed,\n ),\n git: Type.Object(\n {\n worktreeRoot: Type.Optional(Type.String({ minLength: 1 })),\n branchPrefix: Type.String({ minLength: 1 }),\n commitIdentity: oneOf(['user', 'cohorte']),\n keepWorktrees: oneOf(['on-failure', 'always', 'never']),\n },\n closed,\n ),\n retention: Type.Object(\n {\n transcriptsDays: count(),\n eventsDays: Type.Union([count(), Type.Literal('forever')]),\n artifactsDays: count(),\n compressAfterDays: count(),\n },\n closed,\n ),\n telemetry: Type.Object({ remote: Type.Boolean() }, closed),\n },\n closed,\n);\n\n/** [S]. Annotated on purpose: Biome must not infer this type (docs/v3/requests/U0.02.md R1, U0.05.md R1). */\nexport const CohorteConfig: TUnsafe<CohorteConfig> = Type.Unsafe<CohorteConfig>(CohorteConfigSchema);\n\nfunction deepFreeze<T>(value: T): T {\n if (typeof value === 'object' && value !== null && !Object.isFrozen(value)) {\n Object.freeze(value);\n for (const member of Object.values(value)) deepFreeze(member);\n }\n return value;\n}\n\nconst MINUTE = 60_000;\n\n/**\n * The lowest layer of the load order (DESIGN 2.10): shipped defaults < user file < project file < CLI flags.\n * `project.id` is a placeholder that `cohorte init` always replaces. DESIGN gives the numbers it cares about\n * (concurrency 3, maxIncarnations 5, loop 5/3/5, host 30/30/250, parkAfterMinutes 10); the budget and retention\n * figures are provisional defaults of this file.\n */\nexport const DEFAULT_CONFIG: CohorteConfig = deepFreeze<CohorteConfig>({\n schemaVersion: 1,\n project: { id: 'project', defaultBranch: 'main', protectedBranches: ['main', 'master'] },\n runtime: { id: 'pi', pi: { loadFrom: 'package' } },\n authentication: { mode: 'subscription', allowApiKeys: false },\n routing: {\n allowedProviders: ['openai-codex'],\n defaults: { implementer: 'coding', fixer: 'coding', reviewer: 'reasoning', 'security-reviewer': 'reasoning' },\n tiers: {\n coding: { ref: { provider: 'openai-codex', model: 'gpt-5.5', capability: 'coding' }, thinking: 'medium' },\n reasoning: { ref: { provider: 'openai-codex', model: 'gpt-5.5', capability: 'reasoning' }, thinking: 'high' },\n fast: { ref: { provider: 'openai-codex', model: 'gpt-5.4-mini', capability: 'fast' }, thinking: 'low' },\n cheap: { ref: { provider: 'openai-codex', model: 'gpt-5.4-mini', capability: 'cheap' }, thinking: 'low' },\n },\n escalation: { sameFailureCount: 2, ladder: [{ kind: 'human' }], maxPerRun: 2 },\n fallback: { enabled: false },\n },\n budgets: {\n run: { modelRequests: 2000, toolCalls: 10_000, wallClockMs: 360 * MINUTE },\n phase: { wallClockMs: 120 * MINUTE },\n agent: { modelRequests: 200, toolCalls: 400, wallClockMs: 45 * MINUTE, contextTokens: 200_000 },\n provider: {},\n tool: {},\n concurrency: 3,\n maxIncarnations: 5,\n },\n loop: {\n maxFixRounds: 5,\n noProgressWindow: 3,\n maxDeniedCallsPerAgent: 5,\n leftovers: { major: 'fix', minor: 'park', info: 'park' },\n },\n checks: { timeoutMs: 10 * MINUTE },\n provision: {\n network: false,\n cacheDirs: [],\n lockfiles: ['pnpm-lock.yaml', 'package-lock.json', 'yarn.lock'],\n env: {},\n dependencyDirs: ['**/node_modules'],\n writableCaches: ['node_modules/.cache', 'node_modules/.vite', 'node_modules/.vitest', 'node_modules/.vite-temp'],\n },\n policy: {\n commands: { allow: [], ask: [], deny: [] },\n dangerousCommands: [],\n symlinks: { ...DEFAULT_SYMLINK_POLICY },\n approvals: { unattended: 'deny', parkAfterMinutes: 10, ship: 'human', notify: false, autoResume: false },\n inDoubt: 'ask',\n skip: [],\n steer: { enabled: false },\n admin: { runTool: false },\n quota: { autoResume: false },\n },\n host: { idleExitMinutes: 30, pauseKeepAliveMinutes: 30, pollMs: 250 },\n network: { proxyEnv: false },\n sandbox: { brain: 'os-if-available' },\n git: { branchPrefix: 'cohorte/', commitIdentity: 'user', keepWorktrees: 'on-failure' },\n retention: { transcriptsDays: 30, eventsDays: 'forever', artifactsDays: 90, compressAfterDays: 7 },\n telemetry: { remote: false },\n});\n","// `.cohorte/manifest.yaml` (DESIGN 2.10): the detection marker and the previous-hash guard of spec 14.\nimport { Sha256 } from '@cohorte/base';\nimport { type Static, Type } from 'typebox';\n\nconst closed = { additionalProperties: false } as const;\n\nexport const GeneratedFile = Type.Object(\n {\n /** `.cohorte`-relative POSIX path */\n path: Type.String({ minLength: 1 }),\n templateId: Type.String({ minLength: 1 }),\n templateSha256: Sha256,\n /** a generated file is replaced only if its CURRENT hash equals this one */\n renderedSha256: Sha256,\n },\n closed,\n);\nexport type GeneratedFile = Static<typeof GeneratedFile>;\n\n/** [S] */\nexport const Manifest = Type.Object(\n {\n schemaVersion: Type.Literal(1),\n cohorteVersion: Type.String({ minLength: 1 }),\n createdWith: Type.String({ minLength: 1 }),\n protocol: Type.Object({ min: Type.String({ minLength: 1 }), max: Type.String({ minLength: 1 }) }, closed),\n stateSchemaVersion: Type.Integer({ minimum: 0 }),\n generated: Type.Array(GeneratedFile),\n },\n closed,\n);\nexport type Manifest = Static<typeof Manifest>;\n","// `.cohorte/ownership.yaml` (DESIGN 2.10): surfaces, their paths, owners and reviewers.\nimport { ID_PATTERN } from '@cohorte/base';\nimport { type TUnsafe, Type } from 'typebox';\n\nconst closed = { additionalProperties: false } as const;\n\n/** The one surface whose paths may overlap any other surface's (DESIGN 2.10, 5.6). */\nexport const SHARED_SURFACE_ID = 'shared';\n\nexport interface Surface {\n /** worktree-relative POSIX globs */\n paths: string[];\n /** role ids allowed to WRITE the surface */\n owners: string[];\n reviewers: string[];\n /** a write to one of these paths is an `ask` (DESIGN 5.6) */\n approval?: 'human';\n}\nexport interface Ownership {\n surfaces: Record<string, Surface>;\n}\n\nconst names = () => Type.Array(Type.String({ minLength: 1 }));\nconst SurfaceSchema = Type.Object(\n {\n paths: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),\n owners: names(),\n reviewers: names(),\n approval: Type.Optional(Type.Literal('human')),\n },\n closed,\n);\nconst OwnershipSchema = Type.Object(\n { surfaces: Type.Record(Type.String({ pattern: ID_PATTERN }), SurfaceSchema) },\n closed,\n);\n\n/** [S]. Annotated: a `Static<TRecord>` inferred by Biome overflows its stack (docs/v3/requests/U0.03.md R1). */\nexport const Ownership: TUnsafe<Ownership> = Type.Unsafe<Ownership>(OwnershipSchema);\n\nconst GLOB_META = /[*?[\\]{}()!]/;\n\n/** The literal prefix of a glob, by path SEGMENT: the segments before the first one holding a glob metacharacter (DESIGN 5.6). */\nexport function literalPrefixOf(pattern: string): string[] {\n const prefix: string[] = [];\n for (const segment of pattern.split('/')) {\n if (segment === '' || segment === '.') continue;\n if (GLOB_META.test(segment)) break;\n prefix.push(segment);\n }\n return prefix;\n}\n\nconst isSegmentAncestorOrEqual = (a: readonly string[], b: readonly string[]): boolean =>\n a.length <= b.length && a.every((segment, index) => segment === b[index]);\n\n/** Two patterns overlap when one literal prefix is a segment-ancestor of (or equal to) the other; no literal prefix overlaps everything. */\nexport function patternsOverlap(a: string, b: string): boolean {\n const left = literalPrefixOf(a);\n const right = literalPrefixOf(b);\n return isSegmentAncestorOrEqual(left, right) || isSegmentAncestorOrEqual(right, left);\n}\n\nexport interface OwnershipProblem {\n /** JSON pointer into the ownership document */\n path: string;\n message: string;\n}\n\n/**\n * The rule a JSON Schema cannot say: every surface path is DISJOINT from the paths of every other surface, unless\n * one of the two surfaces is `shared`. Conservative on purpose (prefix overlap, not glob intersection): a false\n * \"overlap\" costs an edit of ownership.yaml, a missed one lets two agents write the same file.\n */\nexport function ownershipProblems(ownership: Ownership): OwnershipProblem[] {\n const problems: OwnershipProblem[] = [];\n const entries = Object.entries(ownership.surfaces).filter(([id]) => id !== SHARED_SURFACE_ID);\n entries.forEach(([id, surface], at) => {\n for (const [otherId, other] of entries.slice(at + 1)) {\n surface.paths.forEach((path, index) => {\n const clash = other.paths.find((candidate) => patternsOverlap(path, candidate));\n if (clash !== undefined) {\n problems.push({\n path: `/surfaces/${id}/paths/${index}`,\n message: `\"${path}\" of surface \"${id}\" overlaps \"${clash}\" of surface \"${otherId}\": make them disjoint or move the path to the \"${SHARED_SURFACE_ID}\" surface`,\n });\n }\n });\n }\n });\n return problems;\n}\n","// `.cohorte/skills/<id>/skill.yaml` (DESIGN 2.10, ADR-0011). Spec 8 with ONE change: `checks[].command`, a shell\n// string, becomes `argv` (D-25, I3). Checks are declarative in V3.0: never run, and they create no CommandRule.\nimport { ID_PATTERN } from '@cohorte/base';\nimport { type Static, Type } from 'typebox';\n\nconst closed = { additionalProperties: false } as const;\nconst names = () => Type.Optional(Type.Array(Type.String({ minLength: 1 })));\n\n/** [S] schemas/skill.schema.json */\nexport const SkillManifest = Type.Object(\n {\n id: Type.String({ pattern: ID_PATTERN }),\n version: Type.String({ minLength: 1 }),\n /** matched against the Project Model, deterministically */\n appliesWhen: Type.Object(\n { languages: names(), frameworks: names(), packageManagers: names(), roles: names() },\n closed,\n ),\n /** relative path of the Markdown, inside the skill directory */\n prompt: Type.String({ minLength: 1 }),\n checks: Type.Optional(\n Type.Array(\n Type.Object(\n { name: Type.Optional(Type.String({ minLength: 1 })), argv: Type.Array(Type.String(), { minItems: 1 }) },\n closed,\n ),\n ),\n ),\n /** reserved (ADR-0011): no signature is verified in V3.0 */\n signature: Type.Optional(Type.String()),\n /** reserved (ADR-0011) */\n source: Type.Optional(Type.String()),\n },\n closed,\n);\nexport type SkillManifest = Static<typeof SkillManifest>;\n","// `.cohorte/specs/<id>.yaml` (DESIGN 2.10): a feature or a patch, draft or frozen; immutable once frozen.\nimport { canonicalJson, ID_PATTERN, type JsonValue, Sha256, sha256Hex } from '@cohorte/base';\nimport { type TUnsafe, Type } from 'typebox';\n\nconst closed = { additionalProperties: false } as const;\n\ninterface SpecBody {\n id: string;\n kind: 'feature' | 'patch';\n title: string;\n acceptance: string[];\n surfaces: Record<string, { tasks: string[] }>;\n /** worktree-relative path of the contract file */\n contract?: string;\n openQuestions: string[];\n patch?: { repro: string; regressionTest: string; causeConfirmed: boolean };\n}\nexport interface DraftSpec extends SpecBody {\n status: 'draft';\n}\nexport interface FrozenSpec extends SpecBody {\n status: 'frozen';\n /** sha256 of the canonical JSON of the spec WITHOUT `status` and `sha256`: see {@link specContentSha256} */\n sha256: Sha256;\n}\nexport type Spec = DraftSpec | FrozenSpec;\n\nconst texts = () => Type.Array(Type.String({ minLength: 1 }));\nconst body = {\n id: Type.String({ pattern: ID_PATTERN }),\n kind: Type.Union([Type.Literal('feature'), Type.Literal('patch')]),\n title: Type.String({ minLength: 1 }),\n acceptance: texts(),\n surfaces: Type.Record(Type.String({ pattern: ID_PATTERN }), Type.Object({ tasks: texts() }, closed)),\n contract: Type.Optional(Type.String({ minLength: 1 })),\n openQuestions: texts(),\n patch: Type.Optional(\n Type.Object({ repro: Type.String(), regressionTest: Type.String(), causeConfirmed: Type.Boolean() }, closed),\n ),\n};\nconst SpecSchema = Type.Union([\n Type.Object({ ...body, status: Type.Literal('draft') }, closed),\n Type.Object({ ...body, status: Type.Literal('frozen'), sha256: Sha256 }, closed),\n]);\n\n/** [S]. A frozen spec WITHOUT a sha256, and a draft WITH one, are both invalid. */\nexport const Spec: TUnsafe<Spec> = Type.Unsafe<Spec>(SpecSchema);\n\n/** What freezing signs: everything a human wrote, nothing the freeze itself adds. */\nexport function specContentSha256(spec: Spec): Sha256 {\n const content: Record<string, JsonValue> = {};\n for (const [key, value] of Object.entries(spec)) {\n if (key !== 'status' && key !== 'sha256' && value !== undefined) content[key] = value as JsonValue;\n }\n return sha256Hex(canonicalJson(content));\n}\n\nexport interface SpecProblem {\n path: string;\n message: string;\n}\n\n/** A frozen spec rejects edits: its content must still hash to the sha256 it was frozen with. A draft has nothing to prove. */\nexport function frozenSpecProblems(spec: Spec): SpecProblem[] {\n if (spec.status !== 'frozen') return [];\n const actual = specContentSha256(spec);\n if (actual === spec.sha256) return [];\n return [\n {\n path: '/sha256',\n message: `spec \"${spec.id}\" is frozen and was edited: content hashes to ${actual}, frozen as ${spec.sha256}. Revert the edit, or write a new spec`,\n },\n ];\n}\n","// What the repository may decide, and what only the local user may decide (DESIGN 2.10.1, ADR-0026): the key-trust\n// classification as frozen DATA, the trust record, and the TrustStore PORT that `security` implements and the\n// loader consumes (`config` may not import `security`).\nimport { IsoInstant, type JsonValue, Sha256 } from '@cohorte/base';\nimport { type TUnsafe, Type } from 'typebox';\n\nexport const TRUST_CLASSES = ['tighten-only', 'loosen', 'neutral'] as const;\nexport type TrustClass = (typeof TRUST_CLASSES)[number];\n\nexport interface ConfigKeyTrustRule {\n /**\n * JSON pointer into `CohorteConfig`. A rule covers the key it names AND its whole subtree. Rules are prefix-disjoint:\n * no pointer is an ancestor of another one, so a key has exactly one class.\n */\n pointer: string;\n class: TrustClass;\n /**\n * Only on a `loosen` rule whose class depends on the VALUE (DESIGN 2.10.1: `sandbox.require: best-effort`,\n * `policy.symlinks` towards `allow`, ...): the values that loosen. Every other value of the key is `tighten-only`.\n */\n loosenOnly?: readonly JsonValue[];\n}\n\nconst tighten = (pointer: string): ConfigKeyTrustRule => Object.freeze({ pointer, class: 'tighten-only' });\nconst neutral = (pointer: string): ConfigKeyTrustRule => Object.freeze({ pointer, class: 'neutral' });\nconst loosen = (pointer: string, ...loosenOnly: JsonValue[]): ConfigKeyTrustRule =>\n Object.freeze(\n loosenOnly.length === 0\n ? { pointer, class: 'loosen' }\n : { pointer, class: 'loosen', loosenOnly: Object.freeze(loosenOnly) },\n );\n\n/** DESIGN 2.10.1, as data. TOTAL over `CohorteConfig` (a unit test enumerates the schema). */\nexport const CONFIG_KEY_TRUST: readonly ConfigKeyTrustRule[] = Object.freeze([\n neutral('/schemaVersion'),\n neutral('/project'),\n neutral('/runtime/id'),\n loosen('/runtime/pi'),\n neutral('/authentication/mode'),\n loosen('/authentication/allowApiKeys'),\n loosen('/authentication/anthropicSubscriptionViaPi'),\n loosen('/routing/allowedProviders'),\n neutral('/routing/defaults'),\n neutral('/routing/tiers'),\n neutral('/routing/escalation'),\n loosen('/routing/fallback'),\n tighten('/budgets'),\n tighten('/loop'),\n loosen('/checks'),\n loosen('/provision/argv'),\n loosen('/provision/network'),\n loosen('/provision/cacheDirs'),\n neutral('/provision/lockfiles'),\n loosen('/provision/env'),\n loosen('/provision/dependencyDirs'),\n loosen('/provision/writableCaches'),\n loosen('/policy/commands/allow'),\n tighten('/policy/commands/ask'),\n tighten('/policy/commands/deny'),\n loosen('/policy/dangerousCommands'),\n loosen('/policy/symlinks/mode', 'allow'),\n loosen('/policy/symlinks/hardlinksOnWrite', 'allow'),\n loosen('/policy/approvals/unattended', 'wait'),\n tighten('/policy/approvals/expiryMinutes'),\n tighten('/policy/approvals/parkAfterMinutes'),\n loosen('/policy/approvals/ship', 'auto'),\n neutral('/policy/approvals/notify'),\n loosen('/policy/approvals/autoResume'),\n loosen('/policy/inDoubt', 'continue'),\n loosen('/policy/skip'),\n loosen('/policy/steer'),\n loosen('/policy/admin'),\n neutral('/policy/quota'),\n neutral('/host'),\n loosen('/network/proxyEnv'),\n loosen('/sandbox/require', 'best-effort'),\n loosen('/sandbox/brain', 'process'),\n loosen('/git/worktreeRoot'),\n neutral('/git/branchPrefix'),\n neutral('/git/commitIdentity'),\n neutral('/git/keepWorktrees'),\n tighten('/retention'),\n neutral('/telemetry'),\n]);\n\nconst covers = (rule: ConfigKeyTrustRule, pointer: string): boolean =>\n pointer === rule.pointer || pointer.startsWith(`${rule.pointer}/`);\n\n/** Every rule that covers `pointer`. The data is total and prefix-disjoint, so this has exactly one member for a real key. */\nexport function trustRulesFor(pointer: string): ConfigKeyTrustRule[] {\n return CONFIG_KEY_TRUST.filter((rule) => covers(rule, pointer));\n}\n\n/**\n * The class of one key of the PROJECT file. `value` decides for the keys classed by value; without it such a key is\n * reported `loosen` (fail closed). An unknown key is `loosen` too: nothing unclassified is ever honoured silently.\n */\nexport function trustClassOf(pointer: string, value?: JsonValue): TrustClass {\n const [rule, ...others] = trustRulesFor(pointer);\n if (rule === undefined || others.length > 0) return 'loosen';\n if (rule.class !== 'loosen' || rule.loosenOnly === undefined || value === undefined) return rule.class;\n if (pointer !== rule.pointer) return 'loosen';\n return rule.loosenOnly.some((candidate) => candidate === value) ? 'loosen' : 'tighten-only';\n}\n\n/** One file per project: `~/.cohorte/trust/<projectKeyId>.json`, `0600` in a `0700` directory, a protected root. */\nexport interface TrustRecord {\n /** sha256(canonicalJson(the project file's values for every loosen-class key + ownership.yaml)) */\n policySha256: Sha256;\n /** JSON pointers of the loosening keys the user saw and accepted */\n loosenedKeys: string[];\n grantedAt: IsoInstant;\n /** a label for the audit trail (the OS user name); the MAC proves \"a key holder\", never which one (ADR-0022) */\n grantedBy: string;\n /** HMAC-SHA256 with the project key over the canonical JSON of the record minus `mac` */\n mac: string;\n}\n\n/**\n * [S]. The type is written by hand and the const annotated: a `Promise<Static<...>>` that Biome has to resolve for\n * nursery/noFloatingPromises overflows its stack, and a crashed Biome exits 0 (docs/v3/requests/U0.02.md R1).\n */\nexport const TrustRecord: TUnsafe<TrustRecord> = Type.Unsafe<TrustRecord>(\n Type.Object(\n {\n policySha256: Sha256,\n loosenedKeys: Type.Array(Type.String()),\n grantedAt: IsoInstant,\n grantedBy: Type.String({ minLength: 1 }),\n mac: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n ),\n);\n\nexport interface TrustGrant {\n policySha256: Sha256;\n loosenedKeys: string[];\n grantedBy: string;\n}\n\n/**\n * PORT (file implementation: `@cohorte/security/auth`, `createTrustStore`). A record with a bad MAC or wrong file\n * modes is ABSENT: `lookup` fails closed.\n */\nexport interface TrustStore {\n /** The record, only if it is authentic AND was granted for exactly this policy hash. */\n lookup(projectKeyId: string, policySha256: Sha256): Promise<TrustRecord | undefined>;\n grant(projectKeyId: string, grant: TrustGrant): Promise<TrustRecord>;\n /** false = there was nothing to revoke */\n revoke(projectKe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