thoth-agents 0.9.7 → 0.9.9

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 (49) hide show
  1. package/dist/agents/prompt-dialects.d.ts +1 -0
  2. package/dist/{chunk-EDGQVTV3.js → chunk-2ER6FKVC.js} +52 -5
  3. package/dist/{chunk-V5GDCWFR.js → chunk-RN2ERZLZ.js} +1 -1
  4. package/dist/{chunk-ARUBELNT.js → chunk-RVQ6IIBR.js} +10 -4
  5. package/dist/chunk-RWQPMWEM.js +624 -0
  6. package/dist/{chunk-QQV5S3TW.js → chunk-VHQMTZ5O.js} +5 -24
  7. package/dist/cli/index.js +4 -4
  8. package/dist/cli/pi-tool-config.d.ts +0 -1
  9. package/dist/cli/tui/index.js +3 -3
  10. package/dist/harness/gate-hook-script.d.ts +2 -0
  11. package/dist/harness/writers/claude-code-plugin-package.d.ts +4 -4
  12. package/dist/harness/writers/pi-agent.d.ts +0 -1
  13. package/dist/hooks/index.d.ts +1 -0
  14. package/dist/hooks/oracle-gate-verdict/hook.d.ts +11 -0
  15. package/dist/hooks/oracle-gate-verdict/index.d.ts +1 -0
  16. package/dist/index.js +42 -3
  17. package/dist/pi-gate-verdict.d.ts +4 -0
  18. package/dist/pi.d.ts +2 -1
  19. package/dist/pi.js +101 -2
  20. package/package.json +1 -1
  21. package/pi/.thoth-agents-assets.json +5 -5
  22. package/pi/agents/thoth-designer.md +0 -1
  23. package/pi/agents/thoth-explorer.md +0 -1
  24. package/pi/agents/thoth-librarian.md +0 -1
  25. package/pi/agents/thoth-oracle.md +0 -1
  26. package/pi/agents/thoth-worker.md +0 -1
  27. package/plugin/.claude-plugin/.thoth-agents-plugin-assets.json +6 -1
  28. package/plugin/.claude-plugin/plugin.json +3 -2
  29. package/plugin/.codex-plugin/.thoth-agents-plugin-assets.json +2 -2
  30. package/plugin/.codex-plugin/plugin.json +1 -1
  31. package/plugin/agents/orchestrator.md +5 -3
  32. package/plugin/claude-hooks/hooks.json +27 -0
  33. package/plugin/codex-hooks/hooks.json +14 -0
  34. package/plugin/codex-hooks/payloads/root.md +5 -3
  35. package/plugin/skills/plan-reviewer/SKILL.md +16 -5
  36. package/plugin/skills/thoth-sdd/SKILL.md +69 -23
  37. package/plugin/skills/thoth-sdd/references/phases/verify.md +6 -2
  38. package/plugin/skills/thoth-sdd/scripts/record-digest.mjs +15 -0
  39. package/plugin/skills/thoth-sdd/scripts/validate-result.d.mts +19 -0
  40. package/plugin/skills/thoth-sdd/scripts/validate-result.mjs +110 -41
  41. package/plugin/skills/thoth-sdd/scripts/validate.mjs +7 -16
  42. package/plugin/thoth-hooks/gate-verdict.mjs +80 -0
  43. package/skills/plan-reviewer/SKILL.md +16 -5
  44. package/skills/thoth-sdd/SKILL.md +69 -23
  45. package/skills/thoth-sdd/references/phases/verify.md +6 -2
  46. package/skills/thoth-sdd/scripts/record-digest.mjs +15 -0
  47. package/skills/thoth-sdd/scripts/validate-result.d.mts +19 -0
  48. package/skills/thoth-sdd/scripts/validate-result.mjs +110 -41
  49. package/skills/thoth-sdd/scripts/validate.mjs +7 -16
@@ -30,6 +30,7 @@ export interface CapabilityProfile {
30
30
  }
31
31
  export interface HarnessPromptDialect {
32
32
  harness: HarnessId;
33
+ gateDeliveryInstruction: string;
33
34
  tools: ToolNomenclature;
34
35
  capabilities: CapabilityProfile;
35
36
  dispatchLabel(method: AgentDispatchMethod): string;
@@ -16,7 +16,7 @@ import {
16
16
  savePiModelConfig,
17
17
  syncPiSpecialists,
18
18
  writePiManagedText
19
- } from "./chunk-QQV5S3TW.js";
19
+ } from "./chunk-VHQMTZ5O.js";
20
20
  import {
21
21
  ALL_AGENT_NAMES,
22
22
  CLAUDE_CODE_PROMPT_DIALECT,
@@ -48,7 +48,7 @@ import {
48
48
  updateOpenCodeMainConfig,
49
49
  writeConfig,
50
50
  writeLiteConfig
51
- } from "./chunk-ARUBELNT.js";
51
+ } from "./chunk-RVQ6IIBR.js";
52
52
 
53
53
  // src/cli/model-effort.ts
54
54
  function normalizeEffortSelection(value) {
@@ -619,8 +619,9 @@ function validateCodexHookSurface(input) {
619
619
  )
620
620
  );
621
621
  }
622
+ const supportedOutputFields = input.event === "PostToolUse" ? ["additionalContext"] : SUPPORTED_CODEX_HOOK_OUTPUT_FIELDS;
622
623
  const unsupportedOutputField = input.outputFields?.find(
623
- (field) => !SUPPORTED_CODEX_HOOK_OUTPUT_FIELDS.includes(field)
624
+ (field) => !supportedOutputFields.includes(field)
624
625
  );
625
626
  if (unsupportedOutputField) {
626
627
  diagnostics.push(
@@ -1232,6 +1233,7 @@ function codexHookPackage(config) {
1232
1233
  (role) => role.name !== "orchestrator"
1233
1234
  );
1234
1235
  const command = `node -e "require(require('path').join(process.env.PLUGIN_ROOT,'codex-hooks','context.cjs'))"`;
1236
+ const gateCommand = `node -e "import(require('url').pathToFileURL(require('path').join(process.env.PLUGIN_ROOT,'thoth-hooks','gate-verdict.mjs')).href)"`;
1235
1237
  const handler = {
1236
1238
  type: "command",
1237
1239
  command,
@@ -1256,6 +1258,16 @@ function codexHookPackage(config) {
1256
1258
  matcher: `^(${roles.map((role) => role.name).join("|")})$`,
1257
1259
  handler,
1258
1260
  outputFields: ["additionalContext"]
1261
+ },
1262
+ {
1263
+ event: "PostToolUse",
1264
+ matcher: "^(multi_agent_v1)?wait_agent$",
1265
+ handler: {
1266
+ ...handler,
1267
+ command: gateCommand,
1268
+ commandWindows: gateCommand
1269
+ },
1270
+ outputFields: ["additionalContext"]
1259
1271
  }
1260
1272
  ]
1261
1273
  },
@@ -3625,7 +3637,8 @@ var CLAUDE_PLUGIN_MANIFEST_FIELDS = [
3625
3637
  "name",
3626
3638
  "version",
3627
3639
  "description",
3628
- "author"
3640
+ "author",
3641
+ "hooks"
3629
3642
  ];
3630
3643
  var PLUGIN_MANIFEST_PATH = ".claude-plugin/plugin.json";
3631
3644
  var PLUGIN_ASSETS_PATH = ".claude-plugin/.thoth-agents-plugin-assets.json";
@@ -3834,7 +3847,8 @@ function createPluginManifest(context2) {
3834
3847
  name: "thoth-agents",
3835
3848
  version: readRootPackageVersion2(context2),
3836
3849
  description: "Adaptive multi-harness agent pack with six roles and proportional SDD governance for Claude Code.",
3837
- author: { name: "thoth-agents" }
3850
+ author: { name: "thoth-agents" },
3851
+ hooks: "./claude-hooks/hooks.json"
3838
3852
  };
3839
3853
  }
3840
3854
  function renderSubagentArtifacts(config) {
@@ -3887,6 +3901,39 @@ var claudeCodeAdapter = {
3887
3901
  const componentArtifacts = [
3888
3902
  ...renderSubagentArtifacts(config),
3889
3903
  renderOrchestratorArtifact(config),
3904
+ {
3905
+ harness: "claude",
3906
+ kind: "hook-config",
3907
+ path: "claude-hooks/hooks.json",
3908
+ description: "Claude Oracle gate verdict delivery hooks.",
3909
+ content: stableJson5({
3910
+ hooks: {
3911
+ UserPromptSubmit: [
3912
+ {
3913
+ hooks: [
3914
+ {
3915
+ type: "command",
3916
+ command: `node "\${CLAUDE_PLUGIN_ROOT}/thoth-hooks/gate-verdict.mjs"`,
3917
+ timeout: 10
3918
+ }
3919
+ ]
3920
+ }
3921
+ ],
3922
+ PostToolUse: [
3923
+ {
3924
+ matcher: "Agent",
3925
+ hooks: [
3926
+ {
3927
+ type: "command",
3928
+ command: `node "\${CLAUDE_PLUGIN_ROOT}/thoth-hooks/gate-verdict.mjs"`,
3929
+ timeout: 10
3930
+ }
3931
+ ]
3932
+ }
3933
+ ]
3934
+ }
3935
+ })
3936
+ },
3890
3937
  {
3891
3938
  harness: "claude",
3892
3939
  kind: "mcp-config",
@@ -16,7 +16,7 @@ import {
16
16
  loadAgentPrompt,
17
17
  renderAgentRoutingDescription,
18
18
  renderRolePrompt
19
- } from "./chunk-ARUBELNT.js";
19
+ } from "./chunk-RVQ6IIBR.js";
20
20
 
21
21
  // src/agents/designer.ts
22
22
  var DESIGNER_PROMPT = renderRolePrompt(
@@ -1380,6 +1380,7 @@ function piCapabilityDisclosure(capability) {
1380
1380
  }
1381
1381
  var OPENCODE_PROMPT_DIALECT = {
1382
1382
  harness: "opencode",
1383
+ gateDeliveryInstruction: "Delivery verdicts are appended to Oracle `task` output.",
1383
1384
  tools: {
1384
1385
  delegationTool: "task",
1385
1386
  backgroundDelegationTool: "task(background=true)",
@@ -1414,6 +1415,7 @@ var OPENCODE_PROMPT_DIALECT = {
1414
1415
  };
1415
1416
  var CODEX_PROMPT_DIALECT = {
1416
1417
  harness: "codex",
1418
+ gateDeliveryInstruction: "Verdicts: multi-agent v1 `wait_agent` + enabled/trusted plugin hooks only; `agent` = status-map key, not provenance. V2 `FINAL_ANSWER` inter-agent messages: no hook/verdict; use compact fallback.",
1417
1419
  tools: {
1418
1420
  delegationTool: "collaboration.spawn_agent",
1419
1421
  backgroundDelegationTool: "collaboration.spawn_agent",
@@ -1456,6 +1458,7 @@ function claudeCodeSubagentType(role) {
1456
1458
  }
1457
1459
  var CLAUDE_CODE_PROMPT_DIALECT = {
1458
1460
  harness: "claude",
1461
+ gateDeliveryInstruction: "Verdicts: Subagent hand-back reports (foreground or background; match `agent` to Agent `agentId`) or completed foreground `Agent` report content; otherwise (e.g. background without hand-back) compact fallback.",
1459
1462
  tools: {
1460
1463
  delegationTool: "Agent",
1461
1464
  backgroundDelegationTool: "Agent(run_in_background=true)",
@@ -1493,6 +1496,7 @@ var CLAUDE_CODE_PROMPT_DIALECT = {
1493
1496
  };
1494
1497
  var PI_PROMPT_DIALECT = {
1495
1498
  harness: "pi",
1499
+ gateDeliveryInstruction: "Delivery verdicts arrive on completion notifications, `subagent_result`, and task-mode `subagent_run`; match `taskId` to the assignment.",
1496
1500
  tools: {
1497
1501
  delegationTool: "subagent_run",
1498
1502
  backgroundDelegationTool: "subagent_run({ agent, task })",
@@ -1841,9 +1845,11 @@ ${renderTaskShapingPolicy(policy.taskShaping)}
1841
1845
  </artifacts>
1842
1846
 
1843
1847
  <delegation>
1844
- - Only Oracle gates (plan-review/final-verification): validate before recording OKAY/PASS: \`node "<skill-dir>/scripts/validate-result.mjs" --review-kind <kind> [--record-sha256 <hex>] [--no-record]\` (unchanged stdin; skill path).
1845
- - Invalid: no approval; at most one format-only repair; preserve findings/verdict. No validator: blocks only gate approvals; report drift.
1846
- - Non-gates (specialists, Oracle diagnosis/advice, user-defined agents): judge content, never reject for format, never approvals. Judge scope, evidence, checks, freshness/provenance.
1848
+ - Only Oracle gates: before recording plan-review OKAY / final-verification PASS, use harness-delivered \`thoth-gate-verdict\`: exactly one per delivered result (more than one, or one inside the envelope fence = invalid). Require \`valid:true\`, assigned \`kind\`, \`verdict\` = OKAY/PASS respectively. Plan review: \`record\` null or assigned record; ignore \`mode\`/\`recordDigest\`. Final verification only: record-bound requires \`record\` = assigned record, \`mode:"record"\` and \`recordDigest:"match"\` (if \`recordDigest:"unavailable"\`, independently hash the prefix before \`## Authorization\` and compare \`recordSha256\`; mismatch = no approval, no validator rerun). Recordless small-change final verification requires \`mode:"no-record"\`, null \`record\`/\`recordSha256\`, \`recordDigest:"none"\`. Copy verdict and \`recordSha256\` into the record. Never re-emit the envelope to validate it.
1849
+ - {{gateDeliveryInstruction}}
1850
+ - Only when no verdict was delivered (hook unavailable/untrusted, delivery gap): \`node "<skill-dir>/scripts/validate-result.mjs" --review-kind <kind> [--record-sha256 <hex>] [--no-record] [--input <path>]\` (installed skill path), unchanged result; it prints the compact summary. Use thoth-sdd fallback checks.
1851
+ - Invalid: no approval; at most one format-only repair; preserve findings/verdict (shared with runtime enforcement). No validator: blocks only gate approvals; report drift.
1852
+ - Non-gates (specialists, Oracle diagnosis/advice, user-defined agents): judge content, never reject for format, never approvals. Judge scope, evidence, checks, freshness/provenance; validation is not authorization.
1847
1853
  </delegation>`),
1848
1854
  createQuestionProtocolSection()
1849
1855
  ];
@@ -2037,7 +2043,7 @@ function renderModelFamily(section) {
2037
2043
  </model-profile>`;
2038
2044
  }
2039
2045
  function renderRoleText(section, dialect) {
2040
- return section.template.replaceAll(
2046
+ return section.template.replaceAll("{{gateDeliveryInstruction}}", dialect.gateDeliveryInstruction).replaceAll(
2041
2047
  "{{delegationLifecycle}}",
2042
2048
  dialect.tools.lifecycle.rootInstructions ?? DEFAULT_DELEGATION_LIFECYCLE
2043
2049
  ).replaceAll(