@lannguyensi/harness 0.56.0 → 0.58.0

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 (126) hide show
  1. package/CHANGELOG.md +186 -0
  2. package/README.md +1 -1
  3. package/dist/cli/apply/apply.js +4 -3
  4. package/dist/cli/apply/apply.js.map +1 -1
  5. package/dist/cli/apply/generate-codex-config.js +3 -3
  6. package/dist/cli/apply/generate-codex-config.js.map +1 -1
  7. package/dist/cli/apply/generate-memory-index.js +20 -10
  8. package/dist/cli/apply/generate-memory-index.js.map +1 -1
  9. package/dist/cli/apply/generate-settings.d.ts +7 -0
  10. package/dist/cli/apply/generate-settings.js +10 -1
  11. package/dist/cli/apply/generate-settings.js.map +1 -1
  12. package/dist/cli/approve/understanding.d.ts +4 -4
  13. package/dist/cli/doctor/format.js +68 -2
  14. package/dist/cli/doctor/format.js.map +1 -1
  15. package/dist/cli/doctor/index.d.ts +6 -0
  16. package/dist/cli/doctor/index.js +214 -28
  17. package/dist/cli/doctor/index.js.map +1 -1
  18. package/dist/cli/doctor/session-start-preflight-setup-version.d.ts +83 -0
  19. package/dist/cli/doctor/session-start-preflight-setup-version.js +114 -0
  20. package/dist/cli/doctor/session-start-preflight-setup-version.js.map +1 -0
  21. package/dist/cli/doctor/types.d.ts +35 -4
  22. package/dist/cli/doctor/types.js +2 -1
  23. package/dist/cli/doctor/types.js.map +1 -1
  24. package/dist/cli/doctor/ug-delegations.js +9 -0
  25. package/dist/cli/doctor/ug-delegations.js.map +1 -1
  26. package/dist/cli/explain-policy.d.ts +67 -0
  27. package/dist/cli/explain-policy.js +140 -3
  28. package/dist/cli/explain-policy.js.map +1 -1
  29. package/dist/cli/gc/index.js +28 -14
  30. package/dist/cli/gc/index.js.map +1 -1
  31. package/dist/cli/index.d.ts +1 -0
  32. package/dist/cli/index.js +10 -7
  33. package/dist/cli/index.js.map +1 -1
  34. package/dist/cli/init/composer.js +4 -3
  35. package/dist/cli/init/composer.js.map +1 -1
  36. package/dist/cli/init/dependencies.js +15 -9
  37. package/dist/cli/init/dependencies.js.map +1 -1
  38. package/dist/cli/init/templates.d.ts +1 -0
  39. package/dist/cli/init/templates.js +30 -4
  40. package/dist/cli/init/templates.js.map +1 -1
  41. package/dist/cli/list.js +19 -0
  42. package/dist/cli/list.js.map +1 -1
  43. package/dist/cli/loader.js +16 -1
  44. package/dist/cli/loader.js.map +1 -1
  45. package/dist/cli/pack/hook-bootstrap.js +2 -1
  46. package/dist/cli/pack/hook-bootstrap.js.map +1 -1
  47. package/dist/cli/pack/hook-codex-user-prompt-submit.d.ts +0 -32
  48. package/dist/cli/pack/hook-codex-user-prompt-submit.js +11 -118
  49. package/dist/cli/pack/hook-codex-user-prompt-submit.js.map +1 -1
  50. package/dist/cli/pack/hook-pre-tool-use.js +34 -7
  51. package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
  52. package/dist/cli/pack/hook-solution-acceptance.d.ts +55 -0
  53. package/dist/cli/pack/hook-solution-acceptance.js +222 -16
  54. package/dist/cli/pack/hook-solution-acceptance.js.map +1 -1
  55. package/dist/cli/pack/hook-stay-in-scope.d.ts +5 -26
  56. package/dist/cli/pack/hook-stay-in-scope.js +62 -274
  57. package/dist/cli/pack/hook-stay-in-scope.js.map +1 -1
  58. package/dist/cli/pack/hook-track-active-claim.d.ts +1 -0
  59. package/dist/cli/pack/hook-track-active-claim.js +107 -43
  60. package/dist/cli/pack/hook-track-active-claim.js.map +1 -1
  61. package/dist/cli/session-start/index.d.ts +32 -1
  62. package/dist/cli/session-start/index.js +142 -12
  63. package/dist/cli/session-start/index.js.map +1 -1
  64. package/dist/cli/validate/checks.d.ts +0 -2
  65. package/dist/cli/validate/checks.js +30 -30
  66. package/dist/cli/validate/checks.js.map +1 -1
  67. package/dist/io/harness-lock.js +11 -1
  68. package/dist/io/harness-lock.js.map +1 -1
  69. package/dist/io/lock.d.ts +26 -0
  70. package/dist/io/lock.js +25 -0
  71. package/dist/io/lock.js.map +1 -1
  72. package/dist/io/project-name.d.ts +115 -0
  73. package/dist/io/project-name.js +158 -0
  74. package/dist/io/project-name.js.map +1 -0
  75. package/dist/io/read-json-dir-entries.js +10 -0
  76. package/dist/io/read-json-dir-entries.js.map +1 -1
  77. package/dist/io/version-compare.d.ts +59 -0
  78. package/dist/io/version-compare.js +67 -0
  79. package/dist/io/version-compare.js.map +1 -1
  80. package/dist/policy-packs/builtin/solution-acceptance-reconnect.d.ts +50 -0
  81. package/dist/policy-packs/builtin/solution-acceptance-reconnect.js +151 -0
  82. package/dist/policy-packs/builtin/solution-acceptance-reconnect.js.map +1 -0
  83. package/dist/policy-packs/builtin/solution-acceptance-runtime.d.ts +43 -4
  84. package/dist/policy-packs/builtin/solution-acceptance-runtime.js +43 -39
  85. package/dist/policy-packs/builtin/solution-acceptance-runtime.js.map +1 -1
  86. package/dist/policy-packs/builtin/solution-acceptance.js +4 -2
  87. package/dist/policy-packs/builtin/solution-acceptance.js.map +1 -1
  88. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js +15 -0
  89. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js.map +1 -1
  90. package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js +5 -7
  91. package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js.map +1 -1
  92. package/dist/policy-packs/builtin/understanding-before-execution/markers.js +23 -0
  93. package/dist/policy-packs/builtin/understanding-before-execution/markers.js.map +1 -1
  94. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js +8 -17
  95. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js.map +1 -1
  96. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.d.ts +129 -0
  97. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js +166 -0
  98. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js.map +1 -0
  99. package/dist/policy-packs/builtin/understanding-before-execution.d.ts +129 -0
  100. package/dist/policy-packs/builtin/understanding-before-execution.js +44 -57
  101. package/dist/policy-packs/builtin/understanding-before-execution.js.map +1 -1
  102. package/dist/policy-packs/version-check.d.ts +8 -1
  103. package/dist/policy-packs/version-check.js +10 -6
  104. package/dist/policy-packs/version-check.js.map +1 -1
  105. package/dist/probes/memory.d.ts +34 -0
  106. package/dist/probes/memory.js +87 -14
  107. package/dist/probes/memory.js.map +1 -1
  108. package/dist/runtime/git-context.d.ts +125 -0
  109. package/dist/runtime/git-context.js +164 -1
  110. package/dist/runtime/git-context.js.map +1 -1
  111. package/dist/runtime/index.d.ts +1 -1
  112. package/dist/runtime/index.js +1 -1
  113. package/dist/runtime/index.js.map +1 -1
  114. package/dist/runtime/task-providers/agent-tasks.d.ts +90 -0
  115. package/dist/runtime/task-providers/agent-tasks.js +231 -0
  116. package/dist/runtime/task-providers/agent-tasks.js.map +1 -0
  117. package/dist/runtime/workflow-policies.d.ts +1 -0
  118. package/dist/runtime/workflow-policies.js +8 -8
  119. package/dist/runtime/workflow-policies.js.map +1 -1
  120. package/dist/schema/index.d.ts +19 -0
  121. package/dist/schema/index.js +5 -0
  122. package/dist/schema/index.js.map +1 -1
  123. package/dist/schema/session-start-preflight.d.ts +10 -0
  124. package/dist/schema/session-start-preflight.js +106 -0
  125. package/dist/schema/session-start-preflight.js.map +1 -0
  126. package/package.json +7 -2
@@ -21,6 +21,7 @@
21
21
  // signal; those exotic overrides are out of scope.
22
22
  import * as fs from "node:fs";
23
23
  import * as path from "node:path";
24
+ import { isValidProjectName } from "../io/project-name.js";
24
25
  const EMPTY = { repo: "", branch: "", sha: "" };
25
26
  // A `.git` *file* (linked worktree / submodule) points at the real git
26
27
  // dir: `gitdir: <path>`.
@@ -248,7 +249,19 @@ export function resolveCommonDir(gitDir) {
248
249
  try {
249
250
  const raw = fs.readFileSync(path.join(gitDir, "commondir"), "utf8").trim();
250
251
  if (raw.length > 0) {
251
- return path.isAbsolute(raw) ? raw : path.resolve(gitDir, raw);
252
+ // `path.normalize` on the absolute branch (review round 3,
253
+ // decision D-028's security finding): the relative branch already
254
+ // normalizes via `path.resolve`, but an absolute `commondir`
255
+ // value was returned verbatim, `..` segments and all. A crafted
256
+ // `.git` FILE pointing at a private gitdir whose `commondir` file
257
+ // holds an absolute path ending in unresolved `..` segments (e.g.
258
+ // `<gitDir>/../..`) then reached `deriveProjectName` below with
259
+ // those segments still literally present, `path.basename` textually
260
+ // returning `..` instead of the intended ancestor directory's real
261
+ // name. Normalizing here closes that off at the source, before
262
+ // either caller (`resolveOriginHeadBase`, `deriveProjectName`)
263
+ // ever sees the raw value.
264
+ return path.isAbsolute(raw) ? path.normalize(raw) : path.resolve(gitDir, raw);
252
265
  }
253
266
  }
254
267
  catch {
@@ -256,4 +269,154 @@ export function resolveCommonDir(gitDir) {
256
269
  }
257
270
  return gitDir;
258
271
  }
272
+ // ---------------------------------------------------------------------------
273
+ // Repository-identity derivation for per-repo config scoping (task
274
+ // c88461c1, review round 2, decision D-021a).
275
+ //
276
+ // Round 1 fed `resolveGitContext(cwd).repo` (the WORK-TREE basename)
277
+ // into the `session_start_preflight.setup` project-layer lookup. That
278
+ // is wrong for a linked worktree: `git worktree add ../foo` gives the
279
+ // linked checkout its OWN directory name, so two worktrees of the SAME
280
+ // repository resolved two DIFFERENT project layers, and neither one
281
+ // matched the name an operator would naturally pick for the shared
282
+ // project override file. `repo` stays exactly as-is for its existing
283
+ // consumer (the `preflight:${REPO}` ledger tag, `src/cli/session-start/
284
+ // index.ts`), a ledger tag namespaced per CHECKOUT is a defensible,
285
+ // unrelated design choice, and changing it is out of this task's scope.
286
+ // This is a SEPARATE derivation for a SEPARATE purpose: naming the
287
+ // `<home>/projects/<name>/harness.overrides.yaml` layer that should
288
+ // apply to every linked worktree of one repository alike.
289
+ // ---------------------------------------------------------------------------
290
+ /**
291
+ * Derive the project-layer name for `cwd`: the basename of the
292
+ * directory that CONTAINS the repository's shared git common dir (the
293
+ * main checkout), so every linked worktree of one repository resolves
294
+ * the same name, unlike `resolveGitContext(cwd).repo`, which names the
295
+ * checkout directory itself and therefore differs per worktree. Feeds
296
+ * `LoaderOptions.project` (the same seam every command's own
297
+ * `--project <name>` flag already uses) for `harness session-start
298
+ * preflight`, `harness explain-policy`, and `harness doctor` alike (one
299
+ * helper, three consumers, so the three cannot silently disagree on
300
+ * what "this repository's project name" means).
301
+ *
302
+ * Resolution:
303
+ * - `findGitEntry(cwd)` walks up to the `.git` entry, exactly like
304
+ * `resolveGitContext`.
305
+ * - `resolveCommonDir(entry.gitDir)` follows a linked worktree's
306
+ * `commondir` file to the shared common dir (a no-op for the main
307
+ * checkout, which has none).
308
+ * - The COMMON DIR's basename is normally literally `.git` (a
309
+ * directory or, in a linked worktree's private gitdir, the resolved
310
+ * target of a `.git` FILE): in that shape the project name is one
311
+ * level further up, the basename of the directory THAT CONTAINS the
312
+ * common dir, i.e. the main checkout's own directory name.
313
+ * - For a BARE repository (`git init --bare`, or a linked worktree
314
+ * created FROM one), there is no `.git` wrapper at all, the common
315
+ * dir IS the bare directory itself (its basename is not `.git`), so
316
+ * that basename is the project name directly, with no extra `..`
317
+ * step. This is the one shape where going up an extra level would
318
+ * be wrong (it would name the bare directory's PARENT instead), and
319
+ * the `.git` SUFFIX in a conventionally-named bare directory (e.g.
320
+ * `myrepo.git`) is kept, not stripped.
321
+ * - A SUBMODULE checkout (`git submodule add`) derives the submodule's
322
+ * OWN name, not its superproject's: a submodule's `.git` FILE points
323
+ * at a private gitdir under the superproject's `.git/modules/<name>/`
324
+ * tree, which has no `commondir` file of its own (that mechanism is
325
+ * for linked worktrees, not submodules), so `resolveCommonDir` is a
326
+ * no-op and the submodule's own checkout directory basename applies
327
+ * directly, same as a normal (non-worktree) repo.
328
+ * - A `git init --separate-git-dir=<dir>` checkout derives the GIT
329
+ * DIR's own basename, NOT the work tree's: the `.git` file at the
330
+ * work tree root points at `<dir>` with no `commondir` file either
331
+ * (again a linked-worktree-only mechanism), so `resolveCommonDir` is
332
+ * a no-op and `<dir>`'s own basename (e.g. `sepgit.git`) is the
333
+ * derived name, exactly like the bare-repository shape above; the
334
+ * work tree's own directory name never enters into it.
335
+ *
336
+ * Returns `null` when `cwd` is not inside a git work tree (mirrors
337
+ * `resolveGitContext`'s "" for the same case), when `entry.gitDir`
338
+ * could not be resolved at all (an unreadable `.git` FILE, see
339
+ * `findGitEntry`'s doc comment; in that case this falls back to the
340
+ * checkout directory's own basename, the same value `repo` would
341
+ * carry, rather than guessing at a common dir it has no path to), or
342
+ * when the resolved name fails {@link isValidProjectName} (review
343
+ * round 3, decision D-028's security finding: an untrusted on-disk
344
+ * `commondir`/`.git` FILE value must never hand a caller a name like
345
+ * `""`, `"."`, `".."`, or one containing a path separator, since every
346
+ * consumer joins it straight into a filesystem path,
347
+ * `resolvePaths`/`src/cli/loader.ts`; task `e904f25a` extended the same
348
+ * exit to a name containing a control character, which no consumer could
349
+ * render safely). A rejection here is silent by design: no project
350
+ * override layer resolves for that repository and the base/machine value
351
+ * applies, exactly as for a repository that simply has no layer on disk.
352
+ * Never throws.
353
+ *
354
+ * REALPATH (task c88461c1, review round 3 residual; task `1c4eb3ea`
355
+ * of the batch-44 follow-up run): the common dir is resolved through
356
+ * `fs.realpathSync` BEFORE taking its basename, so a checkout reached
357
+ * through a symlink (an operator's own convenience symlink, or a
358
+ * second clone path) derives the SAME project name as the real
359
+ * directory it points at, matching D-021a's "repository identity is
360
+ * the common dir" rule: two paths to one repository must resolve one
361
+ * project layer, not two. Best-effort: `realpathSync` failing (a
362
+ * dangling symlink, a permissions error) falls back to the
363
+ * un-resolved common dir rather than throwing, so a repository that
364
+ * was reachable before this change stays reachable.
365
+ */
366
+ export function deriveProjectName(cwd) {
367
+ if (typeof cwd !== "string" || cwd.length === 0)
368
+ return null;
369
+ const entry = findGitEntry(cwd);
370
+ if (!entry)
371
+ return null;
372
+ if (!entry.gitDir) {
373
+ const fallback = path.basename(entry.worktreeRoot);
374
+ return isValidProjectName(fallback) ? fallback : null;
375
+ }
376
+ let commonDir = resolveCommonDir(entry.gitDir);
377
+ try {
378
+ commonDir = fs.realpathSync(commonDir);
379
+ }
380
+ catch {
381
+ /* dangling symlink or unreadable target, keep the un-resolved commonDir */
382
+ }
383
+ const commonDirBase = path.basename(commonDir);
384
+ const projectDir = commonDirBase === ".git" ? path.dirname(commonDir) : commonDir;
385
+ const name = path.basename(projectDir);
386
+ return isValidProjectName(name) ? name : null;
387
+ }
388
+ /**
389
+ * Shared `opts.project ?? deriveProjectName(cwd) ?? fallback` resolution,
390
+ * used by two of the three producers of a per-repo-scoped
391
+ * `session_start_preflight` project name: `harness doctor`'s second,
392
+ * project-scoped load and the `session_start_preflight` producer. Both
393
+ * surfaces agree on the first two terms (an explicit `--project`, then
394
+ * the cwd-derived name); only the fallback differs by call site, and
395
+ * this helper takes it as an explicit argument so that difference is
396
+ * named rather than duplicated inline. The third producer,
397
+ * `harness explain-policy` (`src/cli/explain-policy.ts`), keeps its own
398
+ * copy of the same expression with a third fallback (`undefined`);
399
+ * folding it into this helper is deliberately out of scope of task
400
+ * `f1eb1c5c`. No observable behaviour change versus either surface's
401
+ * own prior inline expression, other than doctor's `cwd` expression
402
+ * now being evaluated eagerly (see the call site): this only extracts
403
+ * the shared shape.
404
+ */
405
+ export function resolveScopedProjectName(opts) {
406
+ return opts.project ?? deriveProjectName(opts.cwd) ?? opts.fallback;
407
+ }
408
+ /**
409
+ * `{project}` value validation and safe display now live in
410
+ * `src/io/project-name.ts` (task `b5e6ccb0`): `buildLockEntries`
411
+ * (`src/io/harness-lock.ts`) is itself a `{project}` sink, and `io/` may
412
+ * not import from `runtime/` (`io-no-upward-imports`,
413
+ * `.dependency-cruiser.cjs`), so the shared logic moved down rather than
414
+ * `harness-lock.ts` re-implementing it. Re-exported here so every
415
+ * existing consumer that imports `isValidProjectName` /
416
+ * `sanitizeProjectForDisplay` from `../runtime/git-context.js` keeps
417
+ * working unchanged; see `src/io/project-name.ts` for the doc comments
418
+ * (the sink inventory, the two-screen rationale, the display-stripping
419
+ * invariant).
420
+ */
421
+ export { isValidProjectName, sanitizeProjectForDisplay } from "../io/project-name.js";
259
422
  //# sourceMappingURL=git-context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"git-context.js","sourceRoot":"","sources":["../../src/runtime/git-context.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,aAAa;AACb,EAAE;AACF,uEAAuE;AACvE,gEAAgE;AAChE,uEAAuE;AACvE,uEAAuE;AACvE,sEAAsE;AACtE,gEAAgE;AAChE,EAAE;AACF,mEAAmE;AACnE,mEAAmE;AACnE,sEAAsE;AACtE,gEAAgE;AAChE,sCAAsC;AACtC,EAAE;AACF,oEAAoE;AACpE,qEAAqE;AACrE,mEAAmE;AACnE,gEAAgE;AAChE,mDAAmD;AAEnD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAsBlC,MAAM,KAAK,GAAmB,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAEhE,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,SAAS,GAAG,kBAAkB,CAAC;AACrC,uEAAuE;AACvE,oDAAoD;AACpD,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACjD,sEAAsE;AACtE,MAAM,MAAM,GAAG,gBAAgB,CAAC;AAShC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACtC,IAAI,IAA0B,CAAC;QAC/B,IAAI,CAAC;YACH,IAAI,GAAG,EAAE,CAAC,QAAQ,CAA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AC,CAAC;IAC/C,MAAM,UAAU,GAAG,aAAa,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClF,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IACvC,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC;AAmBD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,wBAAwB,CAAI,IAAwC;IAClF,OAAO,IAAI,CAAC,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC;AACtE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -3,7 +3,7 @@ export { evaluateWhen, type WhenClauseKey, type WhenClauseResult, type WhenConte
3
3
  export { recordPolicyDecision, recordPolicyDecisionOnSession, payloadFromDecision, encodeLedgerContent, decodeLedgerContent, decisionSortKey, type LedgerRecordOptions, type PolicyDecisionPayload, } from "../io/ledger-record.js";
4
4
  export { resolveSessionId } from "./session-id.js";
5
5
  export { buildAgentFacingBlock, formatAgentFacingMessage, renderAgentFacing, type AgentFacingBlock, } from "./agent-facing.js";
6
- export { resolveGitContext, type GitRepoContext } from "./git-context.js";
6
+ export { resolveGitContext, deriveProjectName, isValidProjectName, resolveScopedProjectName, type GitRepoContext, type ResolveScopedProjectNameOptions, } from "./git-context.js";
7
7
  export { buildActionEnvelope, type ActionEnvelope, type ActionEnvelopeRuntime, type ActionEnvelopeSession, type EnvelopeContext, } from "./action-envelope.js";
8
8
  export { classifyRisk, type RiskConfidence, type RiskProfile, } from "./risk-classifier.js";
9
9
  export { resolveDeletionTarget, type DeletionTargetVerdict, } from "./deletion-target-resolve.js";
@@ -3,7 +3,7 @@ export { evaluateWhen, } from "./when-eval.js";
3
3
  export { recordPolicyDecision, recordPolicyDecisionOnSession, payloadFromDecision, encodeLedgerContent, decodeLedgerContent, decisionSortKey, } from "../io/ledger-record.js";
4
4
  export { resolveSessionId } from "./session-id.js";
5
5
  export { buildAgentFacingBlock, formatAgentFacingMessage, renderAgentFacing, } from "./agent-facing.js";
6
- export { resolveGitContext } from "./git-context.js";
6
+ export { resolveGitContext, deriveProjectName, isValidProjectName, resolveScopedProjectName, } from "./git-context.js";
7
7
  export { buildActionEnvelope, } from "./action-envelope.js";
8
8
  export { classifyRisk, } from "./risk-classifier.js";
9
9
  export { resolveDeletionTarget, } from "./deletion-target-resolve.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,GASvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,GAKb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,GAGhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,GAElB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAuB,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EACL,mBAAmB,GAKpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,YAAY,GAGb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,qBAAqB,GAEtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,kBAAkB,GAGnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,kBAAkB,GAInB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,GAGd,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,GASvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,GAKb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,GAGhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,GAElB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,GAGzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,mBAAmB,GAKpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,YAAY,GAGb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,qBAAqB,GAEtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,kBAAkB,GAGnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,kBAAkB,GAInB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,GAGd,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,90 @@
1
+ export declare const AGENT_TASKS_MCP_PREFIX = "mcp__agent-tasks__";
2
+ export declare const TASK_START_TOOL = "mcp__agent-tasks__task_start";
3
+ export declare const TASK_FINISH_TOOL = "mcp__agent-tasks__task_finish";
4
+ export declare const TASK_ABANDON_TOOL = "mcp__agent-tasks__task_abandon";
5
+ export declare const TASKS_TRANSITION_TOOL = "mcp__agent-tasks__tasks_transition";
6
+ export declare const TASK_MERGE_TOOL = "mcp__agent-tasks__task_merge";
7
+ export declare const PULL_REQUESTS_MERGE_TOOL = "mcp__agent-tasks__pull_requests_merge";
8
+ export declare const ACTIVE_CLAIM_TOOL_NAMES: readonly ["mcp__agent-tasks__task_start", "mcp__agent-tasks__task_finish", "mcp__agent-tasks__task_abandon", "mcp__agent-tasks__tasks_transition", "mcp__agent-tasks__task_merge"];
9
+ export declare const DEFAULT_BOUNDARY_TOOL_NAMES: readonly ["mcp__agent-tasks__task_finish", "mcp__agent-tasks__task_abandon", "mcp__agent-tasks__pull_requests_merge", "mcp__agent-tasks__tasks_transition"];
10
+ export declare const DEFAULT_PROTECTED_COMPLETION_TOOLS: readonly ["task_finish", "task_submit_pr", "task_merge", "pull_requests_merge"];
11
+ export declare const TASK_FINISH_AUTOMERGE_INPUT_MATCH: Record<string, boolean>;
12
+ export declare const TASK_ID_EXTRACT: Record<string, string>;
13
+ export declare const PR_NUMBER_EXTRACT: Record<string, string>;
14
+ export declare function taskIdFromInput(input: unknown): string;
15
+ export declare function tasksTransitionStatusFromInput(input: unknown): string;
16
+ export declare function tasksTransitionReleasesClaim(input: unknown): boolean;
17
+ /**
18
+ * Read the resulting status off a task_finish tool RESULT (not the
19
+ * request), unwrapping whichever transport shape it arrived in (see
20
+ * `unwrapToolResponseEnvelope`). Returns `null` when the result is
21
+ * absent, malformed, or carries no string status, so a caller can tell
22
+ * "the task landed on a known non-review status" apart from "we could
23
+ * not tell" (task c86e3c4a).
24
+ */
25
+ export declare function taskFinishResultingStatus(toolResponse: unknown): string | null;
26
+ /**
27
+ * Read the acted-on task id off a task_finish (or any agent-tasks) tool
28
+ * RESULT, unwrapping the same shapes as `taskFinishResultingStatus`.
29
+ * Used as a fallback when the tool_input did not carry a `taskId` (task
30
+ * c86e3c4a, id-equality guard on release verbs).
31
+ */
32
+ export declare function taskIdFromToolResponse(toolResponse: unknown): string;
33
+ /**
34
+ * Diagnostic-only companion to `claimEffectForAgentTasksTool`: was a
35
+ * task_finish's resulting status actually readable? This does NOT feed
36
+ * back into the release/keep decision (that stays the classifier's
37
+ * alone) -- it lets `hook-track-active-claim.ts` label its stderr line
38
+ * so a silent fail-safe fallback release does not look identical to an
39
+ * intentional `done` release in the operator's own trail (task
40
+ * c86e3c4a).
41
+ */
42
+ export declare function taskFinishReleaseIsUnreadable(toolResponse: unknown): boolean;
43
+ /**
44
+ * Coarse shape label for a tool_response, for the same stderr diagnostic
45
+ * above -- never used to decide anything, only to name what shape a
46
+ * fail-safe release fell back from.
47
+ */
48
+ export declare function describeToolResponseShape(toolResponse: unknown): "array" | "string" | "object" | "absent";
49
+ export declare function agentTasksToolName(verb: string): string;
50
+ /** Alias-aware for runtime events, including mcp__server.verb variants. */
51
+ export declare function matchesAgentTasksRuntimeVerb(toolName: string, verbs: readonly string[]): boolean;
52
+ /** Strict canonical parsing for Solution Acceptance's deliberately narrow gate. */
53
+ export declare function canonicalAgentTasksVerb(toolName: string, verbs: readonly string[]): string | null;
54
+ export type ClaimEffect = "acquire" | "release" | "none";
55
+ /**
56
+ * Claim lifecycle is separate from approval boundaries: only a completed
57
+ * legacy transition releases a claim, while abandon and merge always do.
58
+ *
59
+ * task_finish is decided from the RESULT, not the verb (task c86e3c4a):
60
+ * agent-tasks's own v2 semantics clear the work claim going to `done`
61
+ * and keep it going to `review`, so `toolResponse` (the tool RESULT
62
+ * envelope, optional third parameter -- the caller's PostToolUse event
63
+ * carries this alongside `tool_input`) is read via
64
+ * `taskFinishResultingStatus`. A resulting status of `review` returns
65
+ * `none` (keep); `done`, any other resolvable status, and an
66
+ * unresolvable result (no `toolResponse`, or a malformed one) all
67
+ * return `release`.
68
+ *
69
+ * Fail-safe rationale (task c86e3c4a -- corrected from an earlier
70
+ * wording of this comment that was wrong about what the marker feeds):
71
+ * the active-claim file
72
+ * this classifier feeds is read by the FAIL-CLOSED completion gate
73
+ * (`src/cli/pack/hook-solution-acceptance.ts`'s `readActiveClaim` call)
74
+ * to derive the verdict id it gates `task_finish` / `task_submit_pr` /
75
+ * `task_merge` / `pull_requests_merge` / `git push` on. Release-on-
76
+ * unreadable is chosen because a KEPT marker for a task that actually
77
+ * finished would fail OPEN: until the next `task_start` overwrites it,
78
+ * post-done completion-gated actions (git push, task_merge, PR merge)
79
+ * would pass on that finished task's already-accepted verdict, and the
80
+ * marker would override SOLUTION_VERDICT_ID. Releasing fails CLOSED
81
+ * instead, at the cost of a possible wedge (the gate refuses with "no
82
+ * active-claim task id recorded" until a fresh `task_start` or an
83
+ * operator clears the file). It is not costless, and it is not merely
84
+ * giving up an "ergonomic shortcut".
85
+ *
86
+ * This is the ONE place that decision is made: callers (e.g.
87
+ * `hook-track-active-claim.ts`) do not re-derive it locally.
88
+ */
89
+ export declare function claimEffectForAgentTasksTool(toolName: string, input: unknown, toolResponse?: unknown): ClaimEffect;
90
+ export declare function resolveProtectedCompletionTools(config: unknown): string[];
@@ -0,0 +1,231 @@
1
+ // Internal agent-tasks runtime adapter. Consumers keep their own event and
2
+ // diagnostic handling; this module owns provider-specific semantics only.
3
+ import { expandToolNameAliases } from "../tool-name-aliases.js";
4
+ export const AGENT_TASKS_MCP_PREFIX = "mcp__agent-tasks__";
5
+ export const TASK_START_TOOL = `${AGENT_TASKS_MCP_PREFIX}task_start`;
6
+ export const TASK_FINISH_TOOL = `${AGENT_TASKS_MCP_PREFIX}task_finish`;
7
+ export const TASK_ABANDON_TOOL = `${AGENT_TASKS_MCP_PREFIX}task_abandon`;
8
+ export const TASKS_TRANSITION_TOOL = `${AGENT_TASKS_MCP_PREFIX}tasks_transition`;
9
+ export const TASK_MERGE_TOOL = `${AGENT_TASKS_MCP_PREFIX}task_merge`;
10
+ export const PULL_REQUESTS_MERGE_TOOL = `${AGENT_TASKS_MCP_PREFIX}pull_requests_merge`;
11
+ export const ACTIVE_CLAIM_TOOL_NAMES = [
12
+ TASK_START_TOOL,
13
+ TASK_FINISH_TOOL,
14
+ TASK_ABANDON_TOOL,
15
+ TASKS_TRANSITION_TOOL,
16
+ TASK_MERGE_TOOL,
17
+ ];
18
+ export const DEFAULT_BOUNDARY_TOOL_NAMES = [
19
+ TASK_FINISH_TOOL,
20
+ TASK_ABANDON_TOOL,
21
+ PULL_REQUESTS_MERGE_TOOL,
22
+ TASKS_TRANSITION_TOOL,
23
+ ];
24
+ export const DEFAULT_PROTECTED_COMPLETION_TOOLS = [
25
+ "task_finish",
26
+ "task_submit_pr",
27
+ "task_merge",
28
+ "pull_requests_merge",
29
+ ];
30
+ export const TASK_FINISH_AUTOMERGE_INPUT_MATCH = {
31
+ "toolArgs.autoMerge": true,
32
+ };
33
+ export const TASK_ID_EXTRACT = { TASK_ID: "toolArgs.taskId" };
34
+ export const PR_NUMBER_EXTRACT = { PR_NUMBER: "toolArgs.prNumber" };
35
+ function inputRecord(input) {
36
+ if (typeof input !== "object" || input === null || Array.isArray(input))
37
+ return null;
38
+ return input;
39
+ }
40
+ export function taskIdFromInput(input) {
41
+ const taskId = inputRecord(input)?.["taskId"];
42
+ return typeof taskId === "string" ? taskId : "";
43
+ }
44
+ export function tasksTransitionStatusFromInput(input) {
45
+ const status = inputRecord(input)?.["status"];
46
+ return typeof status === "string" ? status : "";
47
+ }
48
+ export function tasksTransitionReleasesClaim(input) {
49
+ return tasksTransitionStatusFromInput(input) === "done";
50
+ }
51
+ /**
52
+ * Best-effort recursive unwrap of a task_finish tool RESULT into the
53
+ * mcp-server receipt object it ultimately carries, tolerating every
54
+ * transport shape observed or plausible for a PostToolUse event (task
55
+ * c86e3c4a: an earlier version of this function read only shape (a)
56
+ * below and was inert against the shape Claude Code actually sends):
57
+ *
58
+ * (a) the receipt object itself, `{ ok, task: { id, status } }` -- both
59
+ * the small default receipt and the `include:["task"]` full-object
60
+ * variant, since both nest the task under `task` and this function
61
+ * only reads that key, not the rest of the shape;
62
+ * (b) Claude Code's REAL PostToolUse `tool_response` for an MCP tool
63
+ * (live capture, claude 2.1.280): a content-block array
64
+ * `[{ type: "text", text: "<json>" }, ...]` -- the first `text`
65
+ * block is located and its `text` is JSON-parsed, then unwrapped
66
+ * again as (a). See `tests/fixtures/track-active-claim/
67
+ * real-posttooluse-task-finish-2.1.280.json` for the verbatim
68
+ * redacted capture;
69
+ * (c) an MCP `CallToolResult` object, `{ content: [{ type: "text",
70
+ * text: "<json>" }] }` -- plausible on Codex, UNMEASURED here (no
71
+ * Codex capture exists in this run; see
72
+ * `docs/policy-packs/understanding-before-execution.md`), handled
73
+ * defensively the same way as (b);
74
+ * (d) a bare JSON string -- parsed once, then unwrapped again.
75
+ *
76
+ * Anything else, a `JSON.parse` failure at any step, or a nesting depth
77
+ * past a small guard, returns `null` so the caller fails safe rather
78
+ * than throwing or silently misreading.
79
+ */
80
+ function unwrapToolResponseEnvelope(toolResponse, depth = 0) {
81
+ if (depth > 4)
82
+ return null;
83
+ if (typeof toolResponse === "string") {
84
+ let parsed;
85
+ try {
86
+ parsed = JSON.parse(toolResponse);
87
+ }
88
+ catch {
89
+ return null;
90
+ }
91
+ return unwrapToolResponseEnvelope(parsed, depth + 1);
92
+ }
93
+ if (Array.isArray(toolResponse)) {
94
+ const textBlock = toolResponse.find((block) => {
95
+ const rec = inputRecord(block);
96
+ return rec !== null && rec["type"] === "text" && typeof rec["text"] === "string";
97
+ });
98
+ const text = inputRecord(textBlock)?.["text"];
99
+ return typeof text === "string" ? unwrapToolResponseEnvelope(text, depth + 1) : null;
100
+ }
101
+ const record = inputRecord(toolResponse);
102
+ if (record === null)
103
+ return null;
104
+ if (Array.isArray(record["content"])) {
105
+ return unwrapToolResponseEnvelope(record["content"], depth + 1);
106
+ }
107
+ return record;
108
+ }
109
+ /**
110
+ * Read the resulting status off a task_finish tool RESULT (not the
111
+ * request), unwrapping whichever transport shape it arrived in (see
112
+ * `unwrapToolResponseEnvelope`). Returns `null` when the result is
113
+ * absent, malformed, or carries no string status, so a caller can tell
114
+ * "the task landed on a known non-review status" apart from "we could
115
+ * not tell" (task c86e3c4a).
116
+ */
117
+ export function taskFinishResultingStatus(toolResponse) {
118
+ const task = unwrapToolResponseEnvelope(toolResponse)?.["task"];
119
+ const status = inputRecord(task)?.["status"];
120
+ return typeof status === "string" && status.length > 0 ? status : null;
121
+ }
122
+ /**
123
+ * Read the acted-on task id off a task_finish (or any agent-tasks) tool
124
+ * RESULT, unwrapping the same shapes as `taskFinishResultingStatus`.
125
+ * Used as a fallback when the tool_input did not carry a `taskId` (task
126
+ * c86e3c4a, id-equality guard on release verbs).
127
+ */
128
+ export function taskIdFromToolResponse(toolResponse) {
129
+ const task = unwrapToolResponseEnvelope(toolResponse)?.["task"];
130
+ const id = inputRecord(task)?.["id"];
131
+ return typeof id === "string" ? id : "";
132
+ }
133
+ /**
134
+ * Diagnostic-only companion to `claimEffectForAgentTasksTool`: was a
135
+ * task_finish's resulting status actually readable? This does NOT feed
136
+ * back into the release/keep decision (that stays the classifier's
137
+ * alone) -- it lets `hook-track-active-claim.ts` label its stderr line
138
+ * so a silent fail-safe fallback release does not look identical to an
139
+ * intentional `done` release in the operator's own trail (task
140
+ * c86e3c4a).
141
+ */
142
+ export function taskFinishReleaseIsUnreadable(toolResponse) {
143
+ return taskFinishResultingStatus(toolResponse) === null;
144
+ }
145
+ /**
146
+ * Coarse shape label for a tool_response, for the same stderr diagnostic
147
+ * above -- never used to decide anything, only to name what shape a
148
+ * fail-safe release fell back from.
149
+ */
150
+ export function describeToolResponseShape(toolResponse) {
151
+ if (toolResponse === undefined || toolResponse === null)
152
+ return "absent";
153
+ if (Array.isArray(toolResponse))
154
+ return "array";
155
+ if (typeof toolResponse === "string")
156
+ return "string";
157
+ return "object";
158
+ }
159
+ export function agentTasksToolName(verb) {
160
+ return `${AGENT_TASKS_MCP_PREFIX}${verb}`;
161
+ }
162
+ /** Alias-aware for runtime events, including mcp__server.verb variants. */
163
+ export function matchesAgentTasksRuntimeVerb(toolName, verbs) {
164
+ const expected = new Set(verbs.map(agentTasksToolName));
165
+ return expandToolNameAliases(toolName).some((alias) => expected.has(alias));
166
+ }
167
+ /** Strict canonical parsing for Solution Acceptance's deliberately narrow gate. */
168
+ export function canonicalAgentTasksVerb(toolName, verbs) {
169
+ if (!toolName.startsWith(AGENT_TASKS_MCP_PREFIX))
170
+ return null;
171
+ const verb = toolName.slice(AGENT_TASKS_MCP_PREFIX.length);
172
+ return verbs.includes(verb) ? verb : null;
173
+ }
174
+ /**
175
+ * Claim lifecycle is separate from approval boundaries: only a completed
176
+ * legacy transition releases a claim, while abandon and merge always do.
177
+ *
178
+ * task_finish is decided from the RESULT, not the verb (task c86e3c4a):
179
+ * agent-tasks's own v2 semantics clear the work claim going to `done`
180
+ * and keep it going to `review`, so `toolResponse` (the tool RESULT
181
+ * envelope, optional third parameter -- the caller's PostToolUse event
182
+ * carries this alongside `tool_input`) is read via
183
+ * `taskFinishResultingStatus`. A resulting status of `review` returns
184
+ * `none` (keep); `done`, any other resolvable status, and an
185
+ * unresolvable result (no `toolResponse`, or a malformed one) all
186
+ * return `release`.
187
+ *
188
+ * Fail-safe rationale (task c86e3c4a -- corrected from an earlier
189
+ * wording of this comment that was wrong about what the marker feeds):
190
+ * the active-claim file
191
+ * this classifier feeds is read by the FAIL-CLOSED completion gate
192
+ * (`src/cli/pack/hook-solution-acceptance.ts`'s `readActiveClaim` call)
193
+ * to derive the verdict id it gates `task_finish` / `task_submit_pr` /
194
+ * `task_merge` / `pull_requests_merge` / `git push` on. Release-on-
195
+ * unreadable is chosen because a KEPT marker for a task that actually
196
+ * finished would fail OPEN: until the next `task_start` overwrites it,
197
+ * post-done completion-gated actions (git push, task_merge, PR merge)
198
+ * would pass on that finished task's already-accepted verdict, and the
199
+ * marker would override SOLUTION_VERDICT_ID. Releasing fails CLOSED
200
+ * instead, at the cost of a possible wedge (the gate refuses with "no
201
+ * active-claim task id recorded" until a fresh `task_start` or an
202
+ * operator clears the file). It is not costless, and it is not merely
203
+ * giving up an "ergonomic shortcut".
204
+ *
205
+ * This is the ONE place that decision is made: callers (e.g.
206
+ * `hook-track-active-claim.ts`) do not re-derive it locally.
207
+ */
208
+ export function claimEffectForAgentTasksTool(toolName, input, toolResponse) {
209
+ if (matchesAgentTasksRuntimeVerb(toolName, ["task_start"]))
210
+ return "acquire";
211
+ if (matchesAgentTasksRuntimeVerb(toolName, ["task_finish"])) {
212
+ return taskFinishResultingStatus(toolResponse) === "review" ? "none" : "release";
213
+ }
214
+ if (matchesAgentTasksRuntimeVerb(toolName, ["task_abandon", "task_merge"])) {
215
+ return "release";
216
+ }
217
+ if (matchesAgentTasksRuntimeVerb(toolName, ["tasks_transition"]) &&
218
+ tasksTransitionReleasesClaim(input)) {
219
+ return "release";
220
+ }
221
+ return "none";
222
+ }
223
+ export function resolveProtectedCompletionTools(config) {
224
+ if (Array.isArray(config) &&
225
+ config.length > 0 &&
226
+ config.every((verb) => typeof verb === "string" && verb.length > 0)) {
227
+ return config;
228
+ }
229
+ return [...DEFAULT_PROTECTED_COMPLETION_TOOLS];
230
+ }
231
+ //# sourceMappingURL=agent-tasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-tasks.js","sourceRoot":"","sources":["../../../src/runtime/task-providers/agent-tasks.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,0EAA0E;AAE1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAE3D,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,sBAAsB,YAAY,CAAC;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,sBAAsB,aAAa,CAAC;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,sBAAsB,cAAc,CAAC;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,sBAAsB,kBAAkB,CAAC;AACjF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,sBAAsB,YAAY,CAAC;AACrE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,sBAAsB,qBAAqB,CAA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A4B,CAAC,QAAQ,EAAE,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC;QAC3E,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IACE,4BAA4B,CAAC,QAAQ,EAAE,CAAC,kBAAkB,CAAC,CAAC;QAC5D,4BAA4B,CAAC,KAAK,CAAC,EACnC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,MAAe;IAC7D,IACE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QACrB,MAAM,CAAC,MAAM,GAAG,CAAC;QACjB,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EACnE,CAAC;QACD,OAAO,MAAkB,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,GAAG,kCAAkC,CAAC,CAAC;AACjD,CAAC"}
@@ -112,6 +112,7 @@ export declare const TASK_FINISH_MCP_MATCH = "mcp__agent-tasks__task_finish";
112
112
  export declare const TASK_FINISH_AUTOMERGE_INPUT_MATCH: Record<string, boolean>;
113
113
  /** `toolArgs.taskId` is the only identifier either task-scoped verb carries. */
114
114
  export declare const TASK_ID_EXTRACT: Record<string, string>;
115
+ export declare const PR_NUMBER_EXTRACT: Record<string, string>;
115
116
  /**
116
117
  * True when `workflow.steps` contains a `review_subagent` step with
117
118
  * `spawn: "required"` at an index earlier than some `merge` step
@@ -1,3 +1,4 @@
1
+ import { TASK_FINISH_AUTOMERGE_INPUT_MATCH as ADAPTER_TASK_FINISH_AUTOMERGE_INPUT_MATCH, TASK_FINISH_TOOL, TASK_ID_EXTRACT as ADAPTER_TASK_ID_EXTRACT, TASK_MERGE_TOOL, PULL_REQUESTS_MERGE_TOOL, PR_NUMBER_EXTRACT as ADAPTER_PR_NUMBER_EXTRACT, } from "./task-providers/agent-tasks.js";
1
2
  /**
2
3
  * Runtime enforcement for `workflows:` (99f47307, Slice 1).
3
4
  *
@@ -101,7 +102,7 @@ export const REVIEW_EVIDENCE_HOOK_TASK_FINISH = "require-review-evidence-task-fi
101
102
  // derivation binds to, instead of trusting the hook name alone. See
102
103
  // `checkWorkflowGateWiring`'s header for the "right name, wrong trigger"
103
104
  // gap this closes.
104
- export const MERGE_MCP_MATCH = "mcp__agent-tasks__pull_requests_merge";
105
+ export const MERGE_MCP_MATCH = PULL_REQUESTS_MERGE_TOOL;
105
106
  // Byte-identical to templates.ts's `review-before-merge-bash` trigger
106
107
  // (verified against the parsed FULL_TEMPLATE at authoring time; pinned
107
108
  // by tests/runtime/workflow-policies.test.ts's parity assertion so the
@@ -111,8 +112,8 @@ export const MERGE_BASH_MATCH = "(^|\\n|;|\\||&|\\()\\s*(\\w+=\\S+\\s+)*gh pr me
111
112
  // here the same way `MERGE_MCP_MATCH` / `MERGE_BASH_MATCH` are and held
112
113
  // byte-identical to templates.ts by this module's parity assertion in
113
114
  // tests/runtime/workflow-policies.test.ts.
114
- export const TASK_MERGE_MCP_MATCH = "mcp__agent-tasks__task_merge";
115
- export const TASK_FINISH_MCP_MATCH = "mcp__agent-tasks__task_finish";
115
+ export const TASK_MERGE_MCP_MATCH = TASK_MERGE_TOOL;
116
+ export const TASK_FINISH_MCP_MATCH = TASK_FINISH_TOOL;
116
117
  /**
117
118
  * The `trigger.input_match` predicate that separates the merging mode of
118
119
  * `task_finish` from the ordinary one. Both auto-merge modes the MCP
@@ -121,11 +122,10 @@ export const TASK_FINISH_MCP_MATCH = "mcp__agent-tasks__task_finish";
121
122
  * missing path never satisfies an `input_match` entry, so the gate stays
122
123
  * out of the way of the non-merging call.
123
124
  */
124
- export const TASK_FINISH_AUTOMERGE_INPUT_MATCH = {
125
- "toolArgs.autoMerge": true,
126
- };
125
+ export const TASK_FINISH_AUTOMERGE_INPUT_MATCH = ADAPTER_TASK_FINISH_AUTOMERGE_INPUT_MATCH;
127
126
  /** `toolArgs.taskId` is the only identifier either task-scoped verb carries. */
128
- export const TASK_ID_EXTRACT = { TASK_ID: "toolArgs.taskId" };
127
+ export const TASK_ID_EXTRACT = ADAPTER_TASK_ID_EXTRACT;
128
+ export const PR_NUMBER_EXTRACT = ADAPTER_PR_NUMBER_EXTRACT;
129
129
  /**
130
130
  * True when `workflow.steps` contains a `review_subagent` step with
131
131
  * `spawn: "required"` at an index earlier than some `merge` step
@@ -288,7 +288,7 @@ function buildMcpMergeGatePolicy(workflowName) {
288
288
  trigger: {
289
289
  event: "PreToolUse",
290
290
  match: MERGE_MCP_MATCH,
291
- extract: { PR_NUMBER: "toolArgs.prNumber" },
291
+ extract: { ...PR_NUMBER_EXTRACT },
292
292
  },
293
293
  requires: { ledger_tag: "review:${PR_NUMBER}" },
294
294
  hook: REVIEW_EVIDENCE_HOOK_MCP,