ultimate-pi 0.22.1 → 0.23.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 (44) hide show
  1. package/.pi/extensions/agt-kill-switch.ts +7 -1
  2. package/.pi/extensions/harness-plan-approval.ts +9 -1
  3. package/.pi/extensions/harness-run-context.ts +587 -86
  4. package/.pi/extensions/policy-gate.ts +15 -2
  5. package/.pi/harness/agents.manifest.json +3 -3
  6. package/.pi/harness/agents.policy.yaml +82 -3
  7. package/.pi/harness/specs/plan-task-clarification.schema.json +10 -1
  8. package/.pi/lib/agents-policy.mjs +42 -1
  9. package/.pi/lib/agt/build-evaluation-context.ts +3 -1
  10. package/.pi/lib/agt/kill-switch-state.ts +14 -0
  11. package/.pi/lib/agt/legacy-evaluate.ts +3 -1
  12. package/.pi/lib/ask-user/index.ts +2 -0
  13. package/.pi/lib/ask-user/merge-task-clarification.ts +5 -0
  14. package/.pi/lib/ask-user/policy.ts +23 -0
  15. package/.pi/lib/ask-user/presenters/glimpse.ts +8 -1
  16. package/.pi/lib/ask-user/presenters/headless.ts +15 -0
  17. package/.pi/lib/ask-user/presenters/select.ts +11 -2
  18. package/.pi/lib/ask-user/validate-core.mjs +16 -0
  19. package/.pi/lib/harness-artifact-gate.ts +75 -5
  20. package/.pi/lib/harness-repair-brief.ts +30 -4
  21. package/.pi/lib/harness-run-context.ts +842 -17
  22. package/.pi/lib/harness-schema-validate.ts +147 -38
  23. package/.pi/lib/harness-spawn-policy.ts +9 -0
  24. package/.pi/lib/harness-spawn-topology.ts +109 -7
  25. package/.pi/lib/harness-subagent-precheck.ts +21 -0
  26. package/.pi/lib/harness-subagent-submit-pipeline.ts +95 -21
  27. package/.pi/lib/harness-subagent-submit-register.ts +6 -1
  28. package/.pi/lib/harness-subagents-bridge.ts +3 -0
  29. package/.pi/lib/harness-yaml.ts +11 -3
  30. package/.pi/lib/plan-approval/create-plan.ts +2 -6
  31. package/.pi/lib/plan-debate-gate.ts +87 -0
  32. package/.pi/lib/plan-debate-lane.ts +8 -2
  33. package/.pi/lib/plan-human-gates.ts +404 -0
  34. package/.pi/prompts/harness-clear.md +25 -0
  35. package/.pi/prompts/harness-plan.md +6 -0
  36. package/.pi/prompts/harness-review.md +2 -0
  37. package/.pi/prompts/harness-run.md +4 -3
  38. package/.pi/scripts/generate-agents-policy-yaml.mjs +73 -7
  39. package/.pi/scripts/harness-reconcile-run-context.mjs +62 -0
  40. package/.pi/scripts/harness-schema-compile-verify.mjs +29 -0
  41. package/.pi/scripts/harness-verify.mjs +27 -0
  42. package/CHANGELOG.md +13 -0
  43. package/README.md +4 -0
  44. package/package.json +1 -1
@@ -12,7 +12,11 @@ import {
12
12
 
13
13
  const killSwitch = new KillSwitch({ enabled: true });
14
14
 
15
- import { recordHarnessPolicyDeny } from "../lib/agt/kill-switch-state.js";
15
+ import {
16
+ armHarnessKillSwitch,
17
+ isHarnessKillSwitchDisarmed,
18
+ recordHarnessPolicyDeny,
19
+ } from "../lib/agt/kill-switch-state.js";
16
20
 
17
21
  export function getHarnessKillSwitch(): KillSwitch {
18
22
  return killSwitch;
@@ -34,6 +38,7 @@ export default function agtKillSwitch(pi: ExtensionAPI) {
34
38
  const prompt = userVisiblePromptSlice(event.prompt);
35
39
  if (hasHarnessAbortSignal(prompt)) {
36
40
  const sessionId = ctx.sessionManager.getSessionId();
41
+ armHarnessKillSwitch(sessionId);
37
42
  await killSwitch.kill(sessionId, {
38
43
  reason: "harness-abort command",
39
44
  });
@@ -43,6 +48,7 @@ export default function agtKillSwitch(pi: ExtensionAPI) {
43
48
 
44
49
  pi.on("tool_call", async (_event, ctx) => {
45
50
  const sessionId = ctx.sessionManager.getSessionId();
51
+ if (isHarnessKillSwitchDisarmed(sessionId)) return undefined;
46
52
  const history = killSwitch.getHistory();
47
53
  const armed = history.some((h) => h.agentId === sessionId);
48
54
  if (armed) {
@@ -192,11 +192,19 @@ export default function harnessPlanApproval(pi: ExtensionAPI) {
192
192
  if (runCtx?.run_id) {
193
193
  const gate = await validatePlanDebateGate(projectRoot, runCtx.run_id);
194
194
  if (!gate.ok) {
195
+ const { buildPlanDebateGateRecovery } = await import(
196
+ "../lib/plan-debate-gate.js"
197
+ );
198
+ const recovery = await buildPlanDebateGateRecovery(
199
+ projectRoot,
200
+ runCtx.run_id,
201
+ gate,
202
+ );
195
203
  return {
196
204
  content: [
197
205
  {
198
206
  type: "text",
199
- text: `approve_plan blocked — plan debate gate incomplete:\n- ${gate.errors.join("\n- ")}`,
207
+ text: `approve_plan blocked — plan debate gate incomplete:\n\n${recovery}`,
200
208
  },
201
209
  ],
202
210
  details: {