cohorte 3.0.0-dev.6 → 3.0.0-dev.8

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 (95) hide show
  1. package/README.md +59 -392
  2. package/assets/manifest.json +14 -4
  3. package/assets/prompts/agents/brainstormer.md +3 -0
  4. package/assets/prompts/agents/spec-author.md +3 -0
  5. package/assets/schemas/commands.schema.json +7 -0
  6. package/dist/bundle-manifest.json +72 -50
  7. package/dist/chunks/align-ds-r_X_1aQ_.mjs +93 -0
  8. package/dist/chunks/align-ds-r_X_1aQ_.mjs.map +1 -0
  9. package/dist/chunks/audit-B4ZWQ_DI.mjs +179 -0
  10. package/dist/chunks/audit-B4ZWQ_DI.mjs.map +1 -0
  11. package/dist/chunks/brainstorm-SJwOIEif.mjs +123 -0
  12. package/dist/chunks/brainstorm-SJwOIEif.mjs.map +1 -0
  13. package/dist/chunks/build-C_-mbZfD.mjs +19 -0
  14. package/dist/chunks/build-C_-mbZfD.mjs.map +1 -0
  15. package/dist/chunks/{catalogue-DzsslCSN.mjs → catalogue-IaCJdfB8.mjs} +4 -4
  16. package/dist/chunks/{catalogue-DzsslCSN.mjs.map → catalogue-IaCJdfB8.mjs.map} +1 -1
  17. package/dist/chunks/{compose-ckM7eAJ_.mjs → compose-DRKjQcn0.mjs} +42 -23
  18. package/dist/chunks/compose-DRKjQcn0.mjs.map +1 -0
  19. package/dist/chunks/{config-DcGPL3i7.mjs → config-Cqu5XQoP.mjs} +2 -2
  20. package/dist/chunks/{config-DcGPL3i7.mjs.map → config-Cqu5XQoP.mjs.map} +1 -1
  21. package/dist/chunks/{contract-DiWla5G9.mjs → contract-DjssDPpS.mjs} +45 -25
  22. package/dist/chunks/contract-DjssDPpS.mjs.map +1 -0
  23. package/dist/chunks/{diff-D_0hBwHl.mjs → diff-Qw0II0sj.mjs} +2 -2
  24. package/dist/chunks/{diff-D_0hBwHl.mjs.map → diff-Qw0II0sj.mjs.map} +1 -1
  25. package/dist/chunks/{discover-BBiluyl4.mjs → discover-BZPolSZG.mjs} +2 -2
  26. package/dist/chunks/{discover-BBiluyl4.mjs.map → discover-BZPolSZG.mjs.map} +1 -1
  27. package/dist/chunks/{doctor-BAcemCDr.mjs → doctor-DcDFPvQM.mjs} +6 -6
  28. package/dist/chunks/{doctor-BAcemCDr.mjs.map → doctor-DcDFPvQM.mjs.map} +1 -1
  29. package/dist/chunks/fix-C9roGiQz.mjs +82 -0
  30. package/dist/chunks/fix-C9roGiQz.mjs.map +1 -0
  31. package/dist/chunks/fleet-yWHQY2ya.mjs +297 -0
  32. package/dist/chunks/fleet-yWHQY2ya.mjs.map +1 -0
  33. package/dist/chunks/{init-DfOKw-rD.mjs → init--FxxkrcT.mjs} +2 -2
  34. package/dist/chunks/{init-DfOKw-rD.mjs.map → init--FxxkrcT.mjs.map} +1 -1
  35. package/dist/chunks/intake-C1pesxCJ.mjs +12 -0
  36. package/dist/chunks/intake-C1pesxCJ.mjs.map +1 -0
  37. package/dist/chunks/loop-BWsUpyus.mjs +212 -0
  38. package/dist/chunks/loop-BWsUpyus.mjs.map +1 -0
  39. package/dist/chunks/{migrate-D3-4beNR.mjs → migrate-DuYCAbE3.mjs} +2 -2
  40. package/dist/chunks/{migrate-D3-4beNR.mjs.map → migrate-DuYCAbE3.mjs.map} +1 -1
  41. package/dist/chunks/{obsidian-D1jf1sTR.mjs → obsidian-BHLkXx_H.mjs} +50 -6
  42. package/dist/chunks/obsidian-BHLkXx_H.mjs.map +1 -0
  43. package/dist/chunks/patch-sAgVqjpx.mjs +50 -0
  44. package/dist/chunks/patch-sAgVqjpx.mjs.map +1 -0
  45. package/dist/chunks/{policy-Y65MYKzn.mjs → policy-Du7WVBFX.mjs} +4 -4
  46. package/dist/chunks/{policy-Y65MYKzn.mjs.map → policy-Du7WVBFX.mjs.map} +1 -1
  47. package/dist/chunks/{reconcile-B6mGZWtp.mjs → reconcile-BHn66X3C.mjs} +3 -3
  48. package/dist/chunks/{reconcile-B6mGZWtp.mjs.map → reconcile-BHn66X3C.mjs.map} +1 -1
  49. package/dist/chunks/refactor-DV3RfGjk.mjs +153 -0
  50. package/dist/chunks/refactor-DV3RfGjk.mjs.map +1 -0
  51. package/dist/chunks/retro-Dr-2RTNN.mjs +78 -0
  52. package/dist/chunks/retro-Dr-2RTNN.mjs.map +1 -0
  53. package/dist/chunks/review-ZsBqp3vZ.mjs +35 -0
  54. package/dist/chunks/review-ZsBqp3vZ.mjs.map +1 -0
  55. package/dist/chunks/{run-BInPXOcm.mjs → run-BGabwbDL.mjs} +32 -5
  56. package/dist/chunks/run-BGabwbDL.mjs.map +1 -0
  57. package/dist/chunks/{schema-hSyIURjN.mjs → schema-Bq9qtgsd.mjs} +2 -2
  58. package/dist/chunks/{schema-hSyIURjN.mjs.map → schema-Bq9qtgsd.mjs.map} +1 -1
  59. package/dist/chunks/ship-BizfUe62.mjs +140 -0
  60. package/dist/chunks/ship-BizfUe62.mjs.map +1 -0
  61. package/dist/chunks/spec-C2h3U64g.mjs +65 -0
  62. package/dist/chunks/spec-C2h3U64g.mjs.map +1 -0
  63. package/dist/chunks/spec-path-tptqR7W8.mjs +10 -0
  64. package/dist/chunks/spec-path-tptqR7W8.mjs.map +1 -0
  65. package/dist/chunks/{src-C7hs8Bjw.mjs → src-Bfr1yzsn.mjs} +3 -3
  66. package/dist/chunks/{src-C7hs8Bjw.mjs.map → src-Bfr1yzsn.mjs.map} +1 -1
  67. package/dist/chunks/{src-Daa5lIcP.mjs → src-CPW2_Ons.mjs} +101 -17
  68. package/dist/chunks/src-CPW2_Ons.mjs.map +1 -0
  69. package/dist/chunks/{src-DMrQ5m6I.mjs → src-DNsLSxgm.mjs} +2 -2
  70. package/dist/chunks/{src-DMrQ5m6I.mjs.map → src-DNsLSxgm.mjs.map} +1 -1
  71. package/dist/chunks/{src-BnlNkd3S.mjs → src-DbS9gkJy.mjs} +2 -2
  72. package/dist/chunks/{src-BnlNkd3S.mjs.map → src-DbS9gkJy.mjs.map} +1 -1
  73. package/dist/chunks/{src-s7YRvk0t.mjs → src-yi5whv3n.mjs} +4 -2
  74. package/dist/chunks/src-yi5whv3n.mjs.map +1 -0
  75. package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs +56 -0
  76. package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs.map +1 -0
  77. package/dist/cli.mjs +29 -19
  78. package/dist/cli.mjs.map +1 -1
  79. package/package.json +1 -1
  80. package/dist/chunks/brainstorm-kBUiZLce.mjs +0 -7
  81. package/dist/chunks/brainstorm-kBUiZLce.mjs.map +0 -1
  82. package/dist/chunks/compose-ckM7eAJ_.mjs.map +0 -1
  83. package/dist/chunks/contract-DiWla5G9.mjs.map +0 -1
  84. package/dist/chunks/fix-D4Tj8RVA.mjs +0 -18
  85. package/dist/chunks/fix-D4Tj8RVA.mjs.map +0 -1
  86. package/dist/chunks/obsidian-D1jf1sTR.mjs.map +0 -1
  87. package/dist/chunks/review-BDdjb6kB.mjs +0 -17
  88. package/dist/chunks/review-BDdjb6kB.mjs.map +0 -1
  89. package/dist/chunks/run-BInPXOcm.mjs.map +0 -1
  90. package/dist/chunks/ship-DTuLGoaJ.mjs +0 -19
  91. package/dist/chunks/ship-DTuLGoaJ.mjs.map +0 -1
  92. package/dist/chunks/spec-MVP9y8dN.mjs +0 -20
  93. package/dist/chunks/spec-MVP9y8dN.mjs.map +0 -1
  94. package/dist/chunks/src-Daa5lIcP.mjs.map +0 -1
  95. package/dist/chunks/src-s7YRvk0t.mjs.map +0 -1
@@ -1,20 +1,20 @@
1
1
  import { n as sha256Hex, t as canonicalJson } from "./canonical-C8UxeEmB.mjs";
2
2
  import { A as toIsoInstant, B as ErrorInfo, I as isErrorCode, N as errorOf, P as toErrorInfo, R as ERROR_CODE_PATTERN, S as IsoInstant, T as Sha256, V as JsonValueSchema, a as createUuidV7IdSource, c as systemClock, j as CohorteError, n as QuotaInfo, o as err, r as TokenUsage, s as ok, z as ErrorClass } from "./src-Cu3TxNob.mjs";
3
3
  import { i as computeAnchorMac, n as createKeyStore, r as createTrustStore, t as createCommandAuthenticator } from "./auth-BT5oVp76.mjs";
4
- import { a as compileSchema, c as AgentOutput, i as canonicalCommandBody, s as compareOrder } from "./src-s7YRvk0t.mjs";
5
- import { a as literalPrefixOf } from "./schema-hSyIURjN.mjs";
6
- import { i as resolveConfig, n as loadConfig } from "./src-BnlNkd3S.mjs";
7
- import { a as RUNTIME_EVENT_TYPE_NAMES, c as toolGrantProblems, g as createRedactor, i as RUNTIME_EVENT_TYPES, l as AgentExit, n as ProviderAuthStatus, o as ToolContent, t as SpawnRequest, v as createExecutor, y as createNoneBackend } from "./src-C7hs8Bjw.mjs";
8
- import { _ as resolveTable, a as createToolHost, b as createApprovalService, c as createResumer, d as createPipelineGuards, f as createFactCollector, g as createEngine, h as createEventWriter, i as createRunSnapshotter, m as createGrantComputer, n as createAgentSupervisor, o as createTransitionEffectRunner, p as createPhaseContracts, r as createProvisioner, s as createWorktreeService, t as createPhaseExecutor, u as initialRunState, v as createLeaseManager, x as createToolHostReplay, y as createEffectJournal } from "./src-Daa5lIcP.mjs";
4
+ import { a as compileSchema, c as AgentOutput, i as canonicalCommandBody, s as compareOrder } from "./src-yi5whv3n.mjs";
5
+ import { a as literalPrefixOf } from "./schema-Bq9qtgsd.mjs";
6
+ import { i as resolveConfig, n as loadConfig } from "./src-DbS9gkJy.mjs";
7
+ import { a as RUNTIME_EVENT_TYPE_NAMES, c as toolGrantProblems, g as createRedactor, i as RUNTIME_EVENT_TYPES, l as AgentExit, n as ProviderAuthStatus, o as ToolContent, t as SpawnRequest, v as createExecutor, y as createNoneBackend } from "./src-Bfr1yzsn.mjs";
8
+ import { _ as resolveTable, a as createToolHost, b as createApprovalService, c as createResumer, d as createPipelineGuards, f as createFactCollector, g as createEngine, h as createEventWriter, i as createRunSnapshotter, m as createGrantComputer, n as createAgentSupervisor, o as createTransitionEffectRunner, p as createPhaseContracts, r as createProvisioner, s as createWorktreeService, t as createPhaseExecutor, u as initialRunState, v as createLeaseManager, x as createToolHostReplay, y as createEffectJournal } from "./src-CPW2_Ons.mjs";
9
9
  import { t as createRenderer } from "./render-DyZr5Lgi.mjs";
10
- import { a as buildPolicySnapshot, c as createCommandPolicy, i as createGlobMatcher, l as createProgramResolver, n as toolIntrospection, o as createPolicyEngine, r as createPathResolver, t as TOOL_CATALOGUE } from "./catalogue-DzsslCSN.mjs";
10
+ import { a as buildPolicySnapshot, c as createCommandPolicy, i as createGlobMatcher, l as createProgramResolver, n as toolIntrospection, o as createPolicyEngine, r as createPathResolver, t as TOOL_CATALOGUE } from "./catalogue-IaCJdfB8.mjs";
11
11
  import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
12
12
  import { Type } from "typebox";
13
13
  import { Compile } from "typebox/compile";
14
- import { execFile, spawn } from "node:child_process";
15
14
  import { copyFile, lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, stat, utimes, writeFile } from "node:fs/promises";
16
15
  import { dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
17
16
  import { parse } from "yaml";
17
+ import { execFile, spawn } from "node:child_process";
18
18
  import { appendFileSync, createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
19
19
  import { StringDecoder } from "node:string_decoder";
20
20
  import { DatabaseSync } from "node:sqlite";
@@ -1647,6 +1647,20 @@ var SqliteStateStore = class {
1647
1647
  async getArtifact(id, artifact) {
1648
1648
  return getRow(this.#db(), "artifacts", ["run_id", "artifact_id"], [id, artifact]);
1649
1649
  }
1650
+ async listFindings(id, q = {}) {
1651
+ const params = [id];
1652
+ let sql = "SELECT * FROM findings WHERE run_id=?";
1653
+ if (q.phaseRunId !== void 0) {
1654
+ sql += " AND phase_run_id=?";
1655
+ params.push(q.phaseRunId);
1656
+ }
1657
+ if (q.status !== void 0) {
1658
+ sql += " AND status=?";
1659
+ params.push(q.status);
1660
+ }
1661
+ sql += " ORDER BY created_at, finding_id";
1662
+ return this.#db().prepare(sql).all(...params).map((row) => fromRow("findings", row));
1663
+ }
1650
1664
  async verifyChain(id, key) {
1651
1665
  const db = this.#db();
1652
1666
  const run = getRow(db, "runs", ["run_id"], [id]);
@@ -5134,7 +5148,7 @@ function createAssetSource() {
5134
5148
  if (!existsSync(path) || !statSync(path).isFile()) return true;
5135
5149
  const bytes = readFileSync(path);
5136
5150
  return bytes.byteLength !== file.size || sha256Hex(bytes) !== file.sha256;
5137
- }).length > 0 || "8bfd45e8ceecc415af5a42381e8a066ab95e437600b9f4574f5231b81d9c4c18" !== manifest.treeSha256) return err(errorOf("security/asset-hash-mismatch", "embedded assets do not match their manifest"));
5151
+ }).length > 0 || "6c53a3c70941285ec350b879b77d54ebe2f7f50c869c6a9544d615efab4872b0" !== manifest.treeSha256) return err(errorOf("security/asset-hash-mismatch", "embedded assets do not match their manifest"));
5138
5152
  return ok(true);
5139
5153
  }
5140
5154
  };
@@ -5171,21 +5185,23 @@ function createController(options) {
5171
5185
  }
5172
5186
  };
5173
5187
  const store = await options.openStore();
5188
+ const startPayload = type === "start" ? payload : void 0;
5189
+ const specSha256 = startPayload?.spec && "path" in startPayload.spec ? sha256Hex(await readFile(startPayload.spec.path)) : sha256Hex("inline-spec");
5174
5190
  const result = type === "start" ? await store.transact("project", null, (tx) => {
5175
- const startPayload = payload;
5191
+ const start = payload;
5176
5192
  const status = tx.enqueueCommand(signed);
5177
5193
  if (status === "enqueued") {
5178
- const specPath = startPayload.spec && "path" in startPayload.spec ? startPayload.spec.path : "inline-spec";
5194
+ const specPath = start.spec && "path" in start.spec ? start.spec.path : "inline-spec";
5179
5195
  tx.putRun(initialRunState({
5180
5196
  runId: createdRunId,
5181
- profile: startPayload.profile,
5197
+ profile: start.profile,
5182
5198
  tableVersion: 1,
5183
- specId: startPayload.spec && "id" in startPayload.spec ? startPayload.spec.id : `spec_${sha256Hex(specPath).slice(0, 24)}`,
5184
- specSha256: sha256Hex(specPath),
5185
- title: `${startPayload.profile} run`,
5199
+ specId: start.spec && "id" in start.spec ? start.spec.id : `spec_${sha256Hex(specPath).slice(0, 24)}`,
5200
+ specSha256,
5201
+ title: `${start.profile} run`,
5186
5202
  pinnedInstallDir: options.pinnedInstallDir ?? options.cwd,
5187
5203
  baseBranch: "main",
5188
- cohorteVersion: "3.0.0-dev.6",
5204
+ cohorteVersion: "3.0.0-dev.7",
5189
5205
  schemaVersion: 1,
5190
5206
  startedAt: options.clock.now()
5191
5207
  }).run);
@@ -6729,10 +6745,12 @@ async function createProductionEngine(options) {
6729
6745
  });
6730
6746
  const assets = createAssetSource();
6731
6747
  const shippedPromptIds = [
6748
+ "agents/brainstormer",
6732
6749
  "agents/fixer",
6733
6750
  "agents/implementer",
6734
6751
  "agents/reviewer",
6735
- "agents/security-reviewer"
6752
+ "agents/security-reviewer",
6753
+ "agents/spec-author"
6736
6754
  ];
6737
6755
  const pinnedPromptPaths = /* @__PURE__ */ new Map();
6738
6756
  const pinStore = createBlobStore({ dir: join(loaded.projectRoot, ".cohorte", "state", "cas") });
@@ -6744,7 +6762,7 @@ async function createProductionEngine(options) {
6744
6762
  pinStore,
6745
6763
  metadata: {
6746
6764
  app: {
6747
- version: "3.0.0-dev.6",
6765
+ version: "3.0.0-dev.7",
6748
6766
  gitHash: null
6749
6767
  },
6750
6768
  packages: [],
@@ -6906,6 +6924,7 @@ async function createProductionEngine(options) {
6906
6924
  integration,
6907
6925
  events,
6908
6926
  store: options.store,
6927
+ redactor,
6909
6928
  checkRunner: { async run(ctx) {
6910
6929
  const argv = resolved.config.checks.test;
6911
6930
  if (!argv || argv.length === 0) return [];
@@ -6953,6 +6972,8 @@ async function createProductionEngine(options) {
6953
6972
  runId: options.runId,
6954
6973
  clock: systemClock,
6955
6974
  probes: {
6975
+ ...requestedStart?.phases?.includes("BRAINSTORM") ? { "input.is-idea": true } : {},
6976
+ ...requestedStart?.phases?.includes("SPEC") ? { "brainstorm.output-valid": true } : {},
6956
6977
  "config.trust-satisfied": true,
6957
6978
  "snapshot.captured": true,
6958
6979
  "runtime.pin-valid": true,
@@ -6971,9 +6992,6 @@ async function createProductionEngine(options) {
6971
6992
  "tree.digest-recorded": true,
6972
6993
  "checks.all-passed": true,
6973
6994
  "checks.digest-equals-integration": true,
6974
- "review.nothing-to-fix": true,
6975
- "review.no-unreviewed": true,
6976
- "review.leftovers-parked-or-waived": true,
6977
6995
  "reviewref.digest-equals-integration": true,
6978
6996
  "approval.ship-allowed": true,
6979
6997
  "tree.digest-equals-approved": true,
@@ -7143,7 +7161,8 @@ async function createProductionEngine(options) {
7143
7161
  filesystem: sandboxCapabilities.filesystem,
7144
7162
  network: sandboxCapabilities.network
7145
7163
  };
7146
- const zones = Object.entries(loaded.ownership.surfaces).filter(([surfaceId]) => surfaceId !== "shared").flatMap(([, surface]) => surface.paths.map((path) => literalPrefixOf(path).join("/")).filter(Boolean)).filter((path, index, paths) => paths.indexOf(path) === index).sort();
7164
+ const selectedSurfaces = requestedStart?.surfaces ? new Set(requestedStart.surfaces) : void 0;
7165
+ const zones = Object.entries(loaded.ownership.surfaces).filter(([surfaceId]) => selectedSurfaces === void 0 || selectedSurfaces.has(surfaceId)).filter(([surfaceId]) => surfaceId !== "shared").flatMap(([, surface]) => surface.paths.map((path) => literalPrefixOf(path).join("/")).filter(Boolean)).filter((path, index, paths) => paths.indexOf(path) === index).sort();
7147
7166
  return {
7148
7167
  snapshotDigest,
7149
7168
  runtimePin,
@@ -7203,7 +7222,7 @@ async function createProductionHostRunner(options) {
7203
7222
  hostIdentity
7204
7223
  }),
7205
7224
  runId,
7206
- cohorteVersion: "3.0.0-dev.6",
7225
+ cohorteVersion: "3.0.0-dev.7",
7207
7226
  cwd: options.cwd,
7208
7227
  hostId: hostIdentity.hostId
7209
7228
  }).run();
@@ -7311,4 +7330,4 @@ async function composeCliContext(inputs) {
7311
7330
  //#endregion
7312
7331
  export { composeCliContext };
7313
7332
 
7314
- //# sourceMappingURL=compose-ckM7eAJ_.mjs.map
7333
+ //# sourceMappingURL=compose-DRKjQcn0.mjs.map