pi-harness-runtime 1.1.461 → 1.1.463

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 (64) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/harness/pending-wait.ts +34 -14
  3. package/index.ts +63 -41
  4. package/package.json +1 -1
  5. package/packages/agent-policy/package.json +1 -1
  6. package/packages/auth/package.json +1 -1
  7. package/packages/autonomous-runtime/package.json +1 -1
  8. package/packages/checkpoint/package.json +1 -1
  9. package/packages/clipboard/package.json +1 -1
  10. package/packages/codex-watcher/package.json +1 -1
  11. package/packages/config-capture/package.json +1 -1
  12. package/packages/contracts/package.json +1 -1
  13. package/packages/cookie-sanitizer/package.json +1 -1
  14. package/packages/evaluation-engine/package.json +1 -1
  15. package/packages/event-bus/package.json +1 -1
  16. package/packages/event-store/package.json +1 -1
  17. package/packages/experience-replay/package.json +1 -1
  18. package/packages/file-copy-helper/package.json +1 -1
  19. package/packages/intent-analyzer/package.json +1 -1
  20. package/packages/jev-judge/dist/auto-continue.d.ts.map +1 -1
  21. package/packages/jev-judge/dist/auto-continue.js +40 -5
  22. package/packages/jev-judge/dist/auto-continue.js.map +1 -1
  23. package/packages/jev-judge/dist/decision-context.d.ts +211 -0
  24. package/packages/jev-judge/dist/decision-context.d.ts.map +1 -0
  25. package/packages/jev-judge/dist/decision-context.js +633 -0
  26. package/packages/jev-judge/dist/decision-context.js.map +1 -0
  27. package/packages/jev-judge/dist/index.d.ts +2 -0
  28. package/packages/jev-judge/dist/index.d.ts.map +1 -1
  29. package/packages/jev-judge/dist/index.js +1 -0
  30. package/packages/jev-judge/dist/index.js.map +1 -1
  31. package/packages/jev-judge/package.json +1 -1
  32. package/packages/jev-judge/src/auto-continue.ts +52 -5
  33. package/packages/jev-judge/src/decision-context.ts +900 -0
  34. package/packages/jev-judge/src/index.ts +20 -0
  35. package/packages/knowledge-retrieval/package.json +1 -1
  36. package/packages/learning-engine/package.json +1 -1
  37. package/packages/logging/package.json +1 -1
  38. package/packages/memory-engine/package.json +1 -1
  39. package/packages/notification/dist/pending-question.d.ts +4 -2
  40. package/packages/notification/dist/pending-question.d.ts.map +1 -1
  41. package/packages/notification/dist/pending-question.js +30 -15
  42. package/packages/notification/dist/pending-question.js.map +1 -1
  43. package/packages/notification/package.json +1 -1
  44. package/packages/notification/src/pending-question.ts +31 -15
  45. package/packages/paperclip-integration/package.json +1 -1
  46. package/packages/performance-optimizer/package.json +1 -1
  47. package/packages/privilege-broker/package.json +1 -1
  48. package/packages/prompt-compiler/package.json +1 -1
  49. package/packages/providers/package.json +1 -1
  50. package/packages/qdrant-skills/package.json +1 -1
  51. package/packages/quota-manager/package.json +1 -1
  52. package/packages/relay/package.json +1 -1
  53. package/packages/skill-mcp-client/package.json +1 -1
  54. package/packages/skills/package.json +1 -1
  55. package/packages/todo-bd-sync/package.json +1 -1
  56. package/packages/token-estimation/package.json +1 -1
  57. package/packages/tooling-preference/package.json +1 -1
  58. package/packages/trajectory/package.json +1 -1
  59. package/packages/tui/package.json +1 -1
  60. package/packages/two-phase-review/package.json +1 -1
  61. package/packages/types/package.json +1 -1
  62. package/packages/webmcp-tester/package.json +1 -1
  63. package/packages/wiki/package.json +1 -1
  64. package/packages/write-review/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,85 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.463](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.463) (2026-11-07)
6
+
7
+
8
+ ### Features
9
+
10
+ * **delegation:** a child is only a child when it really ran ([ac4e678](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ac4e6782d7d4bc4941e458425c8a9f38a51fc9d4))
11
+ * **delegation:** the scope of a request is measured before it is judged ([684b6a5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/684b6a55184f63d3be24c48dcecfb0b13410dc15))
12
+ * **honcho:** the memory service speaks the native MCP of Pi ([f9f740c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f9f740c12869bae4c4380afbe8c76e12388bb744))
13
+ * **jev:** the evaluation of a choice sees what the options mean ([f0c207e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f0c207e074701e6b7dab0965170ec39453d9d502))
14
+ * **jev:** the pending question carries the ask and the answer ([a792133](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a792133e517fb8c12d3363e98942f3af30270f27))
15
+ * **jev:** the pending question counts down to the decision ([d0cc171](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0cc171223986b2d32c670b6c1c74712fe0a4ad8))
16
+ * **keys:** the key files are repaired when their permissions are unsafe ([e9c2c26](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9c2c26b287665b56ed749de269737e8403bb8af))
17
+ * **merge:** a manual run can leave the merge to the pull request event ([b3d1950](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b3d1950b5941c78ccd56951acdafd1d4afbe1bff))
18
+ * **phase:** the agent owns the todo list and the harness says so ([c489370](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c489370bd7926aece8cb1a77aa20ca2d2672f1fb))
19
+ * **review:** the review starts on its own when the implementation is done ([04f51f5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/04f51f599cd3222b6c74dd8fadb1373bd72d9bd7))
20
+ * **status:** the status line names the phase, the progress and the children ([0167bf3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0167bf396a0b987c1d44f3b869351976a951dd65))
21
+ * **test:** the task waits for the final tier of the validation plan ([fa147db](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa147dbf7d50d56e6ea48c6d8fbb4fcb190caf8a))
22
+ * **validation:** a large job starts with a measured pilot ([425964b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/425964b04a3d4fa02adfabed47ff62c5ec2b9c28))
23
+ * **validation:** the size of a job is a fact, not a phrase ([8aa6c11](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8aa6c119565d0f8412dc8aeafa6b295d47d3f093))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * **ci:** every run of a required check counts, and the worst one decides ([da9e0da](https://github.com/ManotLuijiu/pi-harness-runtime/commit/da9e0da6b0ca29cb320764fd5fc1b8a8dee8b1e0))
29
+ * **ci:** the newest attempt of a run decides, not the attempt that failed ([9d7adcc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d7adcc31cbacc517c3c1a9bcd3956be94c908ef))
30
+ * **hooks:** a tag is checked through the commit behind it ([c823e8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c823e8e1f6973c62b5449a97c101759a4d5cbba5))
31
+ * **jev:** a session switch ends the wait of the old session ([ca03d39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ca03d399c0d4a1b2dd428ac39836ab53c0e51ab6))
32
+ * **jev:** the alternatives of a question are parsed without a quadratic pattern ([63016a3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/63016a3f0488acb801990dd46770c00d382b5858))
33
+ * **keys:** the key directory is audited as a tree ([081cc75](https://github.com/ManotLuijiu/pi-harness-runtime/commit/081cc75ac8ceff36b0d619c3f76371dc08459d3c))
34
+ * **merge:** the boolean input is read as a boolean ([971b716](https://github.com/ManotLuijiu/pi-harness-runtime/commit/971b7169a43db382dbdeb6bb9bab02ab56e0351c))
35
+ * **merge:** the manual job needs the right of the merge ([7ba685e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7ba685ec43d815f90aa35b742579e87e76c69209))
36
+ * **merge:** the merge of the pull request is the GraphQL mutation ([972bab4](https://github.com/ManotLuijiu/pi-harness-runtime/commit/972bab4b0f7faf1b0047f3bb767ef6db3de4b2fa))
37
+ * **merge:** the workflow merges the pull request the gates cleared ([d7639ec](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7639ec9b83723510acb4a5c4e23d5d6167c3af6))
38
+ * **release:** a manual release keeps the version of its manifest ([122e661](https://github.com/ManotLuijiu/pi-harness-runtime/commit/122e661ea48cb8aff14c71dbd0221a4cf0ba4c8e))
39
+ * **release:** the alignment names the reason of a failure ([5814dd0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5814dd0b780f5839cf8011ed0cbbbb31e7eb0418))
40
+ * **release:** the channels of the package name the release ([a7a273f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a7a273ffe8398e2b5b07ef1c321777de41792c6e))
41
+ * **release:** the release publishes and leaves the channels alone ([5871746](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5871746589c1281d855dbeb591b02419fa43f22e))
42
+ * **release:** the release pull request names the version of its branch ([a846e83](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a846e83e6de6e529f4bca05e869db0b5eebb37c5))
43
+ * **release:** the release scans the tree of the commit it publishes ([7d47a0b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7d47a0b5406480a1e1d3a52623a76aabd1e2d0ba))
44
+
45
+ ### [1.1.462](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.462) (2026-10-28)
46
+
47
+
48
+ ### Features
49
+
50
+ * **delegation:** a child is only a child when it really ran ([ac4e678](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ac4e6782d7d4bc4941e458425c8a9f38a51fc9d4))
51
+ * **delegation:** the scope of a request is measured before it is judged ([684b6a5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/684b6a55184f63d3be24c48dcecfb0b13410dc15))
52
+ * **honcho:** the memory service speaks the native MCP of Pi ([f9f740c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f9f740c12869bae4c4380afbe8c76e12388bb744))
53
+ * **jev:** the pending question carries the ask and the answer ([a792133](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a792133e517fb8c12d3363e98942f3af30270f27))
54
+ * **jev:** the pending question counts down to the decision ([d0cc171](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0cc171223986b2d32c670b6c1c74712fe0a4ad8))
55
+ * **keys:** the key files are repaired when their permissions are unsafe ([e9c2c26](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9c2c26b287665b56ed749de269737e8403bb8af))
56
+ * **merge:** a manual run can leave the merge to the pull request event ([b3d1950](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b3d1950b5941c78ccd56951acdafd1d4afbe1bff))
57
+ * **phase:** the agent owns the todo list and the harness says so ([c489370](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c489370bd7926aece8cb1a77aa20ca2d2672f1fb))
58
+ * **review:** the review starts on its own when the implementation is done ([04f51f5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/04f51f599cd3222b6c74dd8fadb1373bd72d9bd7))
59
+ * **status:** the status line names the phase, the progress and the children ([0167bf3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0167bf396a0b987c1d44f3b869351976a951dd65))
60
+ * **test:** the task waits for the final tier of the validation plan ([fa147db](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa147dbf7d50d56e6ea48c6d8fbb4fcb190caf8a))
61
+ * **validation:** a large job starts with a measured pilot ([425964b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/425964b04a3d4fa02adfabed47ff62c5ec2b9c28))
62
+ * **validation:** the size of a job is a fact, not a phrase ([8aa6c11](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8aa6c119565d0f8412dc8aeafa6b295d47d3f093))
63
+
64
+
65
+ ### Bug Fixes
66
+
67
+ * **ci:** every run of a required check counts, and the worst one decides ([da9e0da](https://github.com/ManotLuijiu/pi-harness-runtime/commit/da9e0da6b0ca29cb320764fd5fc1b8a8dee8b1e0))
68
+ * **ci:** the newest attempt of a run decides, not the attempt that failed ([9d7adcc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d7adcc31cbacc517c3c1a9bcd3956be94c908ef))
69
+ * **hooks:** a tag is checked through the commit behind it ([c823e8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c823e8e1f6973c62b5449a97c101759a4d5cbba5))
70
+ * **jev:** a session switch ends the wait of the old session ([ca03d39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ca03d399c0d4a1b2dd428ac39836ab53c0e51ab6))
71
+ * **jev:** the alternatives of a question are parsed without a quadratic pattern ([63016a3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/63016a3f0488acb801990dd46770c00d382b5858))
72
+ * **keys:** the key directory is audited as a tree ([081cc75](https://github.com/ManotLuijiu/pi-harness-runtime/commit/081cc75ac8ceff36b0d619c3f76371dc08459d3c))
73
+ * **merge:** the boolean input is read as a boolean ([971b716](https://github.com/ManotLuijiu/pi-harness-runtime/commit/971b7169a43db382dbdeb6bb9bab02ab56e0351c))
74
+ * **merge:** the manual job needs the right of the merge ([7ba685e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7ba685ec43d815f90aa35b742579e87e76c69209))
75
+ * **merge:** the merge of the pull request is the GraphQL mutation ([972bab4](https://github.com/ManotLuijiu/pi-harness-runtime/commit/972bab4b0f7faf1b0047f3bb767ef6db3de4b2fa))
76
+ * **merge:** the workflow merges the pull request the gates cleared ([d7639ec](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7639ec9b83723510acb4a5c4e23d5d6167c3af6))
77
+ * **release:** a manual release keeps the version of its manifest ([122e661](https://github.com/ManotLuijiu/pi-harness-runtime/commit/122e661ea48cb8aff14c71dbd0221a4cf0ba4c8e))
78
+ * **release:** the alignment names the reason of a failure ([5814dd0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5814dd0b780f5839cf8011ed0cbbbb31e7eb0418))
79
+ * **release:** the channels of the package name the release ([a7a273f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a7a273ffe8398e2b5b07ef1c321777de41792c6e))
80
+ * **release:** the release publishes and leaves the channels alone ([5871746](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5871746589c1281d855dbeb591b02419fa43f22e))
81
+ * **release:** the release pull request names the version of its branch ([a846e83](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a846e83e6de6e529f4bca05e869db0b5eebb37c5))
82
+ * **release:** the release scans the tree of the commit it publishes ([7d47a0b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7d47a0b5406480a1e1d3a52623a76aabd1e2d0ba))
83
+
5
84
  ### [1.1.461](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.461) (2026-10-28)
6
85
 
7
86
 
@@ -11,6 +11,35 @@
11
11
  * way.
12
12
  */
13
13
 
14
+ /**
15
+ * The pieces of the wait that a release touches.
16
+ */
17
+ export interface WaitRelease {
18
+ /**
19
+ * Clear the wait state.
20
+ *
21
+ * The state is the moment the wait began and the marker of the
22
+ * question that was notified. Both belong to the wait: a question that
23
+ * is closed must not keep the harness from noticing it again.
24
+ */
25
+ clearWaitState(): void;
26
+ /** Stop the countdown of the wait and release its timer. */
27
+ stopCountdown(): void;
28
+ }
29
+
30
+ /**
31
+ * Release a wait.
32
+ *
33
+ * The state and the countdown of the wait die together: a live countdown
34
+ * without a wait draws a row for a question that is not waiting any more,
35
+ * and a wait without a stopped countdown leaves a tick that can fire for a
36
+ * question that is gone.
37
+ */
38
+ export function releaseWait(release: WaitRelease): void {
39
+ release.clearWaitState();
40
+ release.stopCountdown();
41
+ }
42
+
14
43
  /** The question that is waiting for an answer. */
15
44
  export interface PendingWaitQuestion {
16
45
  requestId: string;
@@ -18,7 +47,7 @@ export interface PendingWaitQuestion {
18
47
  }
19
48
 
20
49
  /** The pieces of the harness that the release of a wait touches. */
21
- export interface PendingWaitOwner {
50
+ export interface PendingWaitOwner extends WaitRelease {
22
51
  /** The question that is waiting for an answer, if there is one. */
23
52
  currentQuestion(): PendingWaitQuestion | null | undefined;
24
53
  /**
@@ -28,10 +57,6 @@ export interface PendingWaitOwner {
28
57
  * pending any more needs no closing.
29
58
  */
30
59
  expireQuestion(requestId: string, reason: string): boolean;
31
- /** Clear the wait state: the wait is over. */
32
- clearWait(): void;
33
- /** Stop the countdown of the wait and release its timer. */
34
- stopCountdown(): void;
35
60
  /** Clear the status row of the wait. */
36
61
  clearStatus(): void;
37
62
  /** Record the transition of the question. */
@@ -46,12 +71,8 @@ export interface PendingWaitOwner {
46
71
  * the transition says why the question was closed.
47
72
  */
48
73
  export function endPendingWait(reason: string, owner: PendingWaitOwner): void {
49
- // The countdown of the question is over with the wait: a tick of it
50
- // must not draw a status and must not start a decision.
51
- owner.stopCountdown();
52
-
53
- // The question is closed explicitly, so the buttons of that request do
54
- // not stay open and look like a request that is still waiting.
74
+ // The question is closed before the wait is cleared: nothing can
75
+ // decide about it in between.
55
76
  const question = owner.currentQuestion();
56
77
  if (question && question.state === "pending") {
57
78
  const expired = owner.expireQuestion(question.requestId, reason) === true;
@@ -62,8 +83,7 @@ export function endPendingWait(reason: string, owner: PendingWaitOwner): void {
62
83
  );
63
84
  }
64
85
 
65
- // The wait state is over with the question: the judge is not asked
66
- // about a question of a session that is gone.
67
- owner.clearWait();
86
+ // The wait and the countdown of the wait die together.
87
+ releaseWait(owner);
68
88
  owner.clearStatus();
69
89
  }
package/index.ts CHANGED
@@ -46,7 +46,7 @@ import {
46
46
  PendingQuestionCountdown,
47
47
  type CountdownView,
48
48
  } from "./harness/pending-countdown.ts";
49
- import { endPendingWait } from "./harness/pending-wait.ts";
49
+ import { endPendingWait, releaseWait } from "./harness/pending-wait.ts";
50
50
  import { isChannelDisabled, setChannelDisabled } from "./harness/notification-settings.ts";
51
51
  // The Honcho contract lives with the Honcho integration. A type-only import
52
52
  // is erased at runtime, so the startup keeps loading the module lazily.
@@ -116,7 +116,7 @@ import {
116
116
  // Centralized application logging: R2 (durable archive) + webhook (live),
117
117
  // with a local spool as the fallback. Optional - without credentials the
118
118
  // logs simply stay local.
119
- import { centralInfo, initCentralLogging } from "./packages/logging/dist/index.js";
119
+ import { centralInfo, initCentralLogging, redactText } from "./packages/logging/dist/index.js";
120
120
 
121
121
  // --- Jev Auto-Continue: Agent autonomous decision-making --------------------
122
122
  // Lazy import - only loads when packages/jev-judge exists and API key available
@@ -1209,6 +1209,33 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
1209
1209
  }
1210
1210
  }
1211
1211
 
1212
+ /**
1213
+ * Clear the state of a wait.
1214
+ *
1215
+ * The moment the wait began and the marker of the question that
1216
+ * was notified belong to the wait: a question that is closed must
1217
+ * not keep the harness from noticing the same question again.
1218
+ */
1219
+ function clearWaitState(): void {
1220
+ waitingForUserSince = null;
1221
+ sharedState.waitingForUserSince = null;
1222
+ _lastNotifiedQuestion = "";
1223
+ }
1224
+
1225
+ /**
1226
+ * Release a wait whose question is closed already.
1227
+ *
1228
+ * The state of the wait and the countdown of the wait die
1229
+ * together: a live countdown without a wait draws a row for a
1230
+ * question that is not waiting any more.
1231
+ */
1232
+ function clearWait(): void {
1233
+ releaseWait({
1234
+ clearWaitState,
1235
+ stopCountdown: () => pendingCountdown.stop(),
1236
+ });
1237
+ }
1238
+
1212
1239
  /**
1213
1240
  * End the wait for a pending question.
1214
1241
  *
@@ -1222,11 +1249,7 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
1222
1249
  currentQuestion: () => sharedState.pqController?.getCurrentQuestion?.(),
1223
1250
  expireQuestion: (requestId: string, why: string) =>
1224
1251
  sharedState.pqController?.expireByTimeout?.(requestId, why) === true,
1225
- clearWait: () => {
1226
- waitingForUserSince = null;
1227
- sharedState.waitingForUserSince = null;
1228
- _lastNotifiedQuestion = "";
1229
- },
1252
+ clearWaitState,
1230
1253
  stopCountdown: () => pendingCountdown.stop(),
1231
1254
  clearStatus: () => updateAutoContinueStatus("IDLE"),
1232
1255
  logTransition: (requestId: string, outcome: string, why: string) =>
@@ -1311,12 +1334,9 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
1311
1334
  logQuestionTransition(question.requestId, "answered", answer);
1312
1335
  // The question is answered, so the wait is over. The wait state
1313
1336
  // is cleared here, after a successful resolution: a stale click
1314
- // must never clear a valid pending wait.
1315
- waitingForUserSince = null;
1316
- sharedState.waitingForUserSince = null;
1317
- _lastNotifiedQuestion = "";
1318
- // The question is answered: the countdown of the wait is over.
1319
- pendingCountdown.stop();
1337
+ // must never clear a valid pending wait. The wait and the
1338
+ // countdown of the wait are over with it.
1339
+ clearWait();
1320
1340
  updateAutoContinueStatus("IDLE");
1321
1341
  // Dispatch answer to Pi
1322
1342
  const message = answer === "yes" ? "yes" : "not yet";
@@ -1557,11 +1577,9 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
1557
1577
  }
1558
1578
  lastUserMessage = new Date();
1559
1579
  if (waitingForUserSince) {
1560
- waitingForUserSince = null;
1561
- _lastNotifiedQuestion = "";
1562
- // The user answered in Pi: the countdown of the wait is
1563
- // over with it.
1564
- pendingCountdown.stop();
1580
+ // The user answered in Pi: the wait and the countdown of
1581
+ // the wait are over with it.
1582
+ clearWait();
1565
1583
  updateAutoContinueStatus("IDLE");
1566
1584
  // Cancel pending question on user response
1567
1585
  // (User answered via Pi instead of button)
@@ -1767,7 +1785,7 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
1767
1785
  // decision, so the next check can still decide about it.
1768
1786
  logToFile(
1769
1787
  "[auto-continue]",
1770
- `Jev decided to wait (${Math.round(waitMinutes)}m waited, deadline ${MAX_WAIT_MINUTES}m)`,
1788
+ `Jev decided to wait (${Math.round(waitMinutes)}m waited, deadline ${MAX_WAIT_MINUTES}m): ${logReasoning(decision.reasoning)}`,
1771
1789
  );
1772
1790
  logQuestionTransition(
1773
1791
  questionContext?.requestId,
@@ -1803,11 +1821,9 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
1803
1821
  // The deadline belongs to the captured question: a newer
1804
1822
  // question keeps its own wait state.
1805
1823
  if (waitBelongsToRequest(questionContext?.requestId)) {
1806
- waitingForUserSince = null;
1807
- sharedState.waitingForUserSince = null;
1808
- // The request expired: the countdown of the wait
1809
- // is over with it.
1810
- pendingCountdown.stop();
1824
+ // The request expired: the wait and the countdown
1825
+ // of the wait are over with it.
1826
+ clearWait();
1811
1827
  updateAutoContinueStatus("IDLE");
1812
1828
  }
1813
1829
  } else {
@@ -1852,12 +1868,9 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
1852
1868
  // The wait state belongs to the captured question: a
1853
1869
  // newer question keeps its own wait.
1854
1870
  if (waitBelongsToRequest(questionContext?.requestId)) {
1855
- waitingForUserSince = null;
1856
- sharedState.waitingForUserSince = null;
1857
- _lastNotifiedQuestion = "";
1858
- // The stale decision is discarded: the countdown
1859
- // of the wait is over with it.
1860
- pendingCountdown.stop();
1871
+ // The stale decision is discarded: the wait and
1872
+ // the countdown of the wait are over with it.
1873
+ clearWait();
1861
1874
  updateAutoContinueStatus("IDLE");
1862
1875
  } else {
1863
1876
  logToFile(
@@ -1878,12 +1891,9 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
1878
1891
  );
1879
1892
  (sharedState.todoContinuationController as any)?.explicitPause?.();
1880
1893
  if (waitBelongsToRequest(questionContext?.requestId)) {
1881
- waitingForUserSince = null;
1882
- sharedState.waitingForUserSince = null;
1883
- _lastNotifiedQuestion = "";
1884
- // The work pauses for a human: the countdown of
1885
- // the wait is over with it.
1886
- pendingCountdown.stop();
1894
+ // The work pauses for a human: the wait and the
1895
+ // countdown of the wait are over with it.
1896
+ clearWait();
1887
1897
  updateAutoContinueStatus("IDLE");
1888
1898
  }
1889
1899
  return;
@@ -1914,11 +1924,9 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
1914
1924
  deadlineMinutes: MAX_WAIT_MINUTES,
1915
1925
  });
1916
1926
  pi.sendUserMessage(instruction, { deliverAs: "steer" });
1917
- waitingForUserSince = null;
1918
- sharedState.waitingForUserSince = null;
1919
- _lastNotifiedQuestion = "";
1920
- // The question is closed: the countdown of the wait is over.
1921
- pendingCountdown.stop();
1927
+ // The question is closed: the wait and the countdown of
1928
+ // the wait are over with it.
1929
+ clearWait();
1922
1930
 
1923
1931
  // The status stays "RUN" until the turn that the steer
1924
1932
  // started has settled. A timer would clear it while the
@@ -4405,6 +4413,20 @@ const HARNESS_LOG_MAX_BYTES = 5 * 1024 * 1024;
4405
4413
  let harnessLogFileSecured = false;
4406
4414
  let harnessLogWrites = 0;
4407
4415
 
4416
+ /**
4417
+ * The reasoning of a decision, bounded and redacted for the log.
4418
+ *
4419
+ * The reasoning is the text of the model, and it can quote the question it
4420
+ * answered. The log keeps a readable excerpt without a credential.
4421
+ */
4422
+ function logReasoning(reasoning: unknown, maxLength = 300): string {
4423
+ const text = redactText(String(reasoning ?? ""))
4424
+ .replace(/\s+/g, " ")
4425
+ .trim();
4426
+ if (text.length <= maxLength) return text;
4427
+ return `${text.slice(0, maxLength)}...[truncated:${text.length - maxLength}]`;
4428
+ }
4429
+
4408
4430
  /** Log a harness message to file (not stderr - bypasses Pi's cursor tracking) */
4409
4431
  function logToFile(...parts: string[]): void {
4410
4432
  const msg = parts.join(" ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-harness-runtime",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "description": "[BETA] Codex-style /usage status + autonomous coding harness for pi. Not production ready — expect breaking changes.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/agent-policy",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "description": "Agent policy runtime for pi-harness - enforces mandatory rule delivery and mutation gating",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/auth",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "description": "pi-harness-runtime — auth",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/autonomous-runtime",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "description": "Autonomous Operations Runtime — task inbox, lease management, and worker lifecycle (RFC-0101)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/checkpoint",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "description": "Enhanced checkpoint system with incremental snapshots, diff-based storage, and recovery strategies",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/clipboard",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/codex-watcher",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "description": "Watches Codex CLI sessions and emits visible messages for PING-PONG monitoring",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moocoding/config-capture",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "description": "Auto-capture API-fetched configuration values to AGENTS.md",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/contracts",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "type": "module",
5
5
  "description": "RPC schema definitions for pi-harness runtime",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/cookie-sanitizer",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "description": "pi-harness-runtime — cookie sanitizer (provider-quota cookie file normaliser)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/evaluation-engine",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "description": "Evaluation engine for pi-harness runtime (RFC-0057)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/event-bus",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/event-store",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/experience-replay",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "description": "Experience replay for debugging and reproducibility (RFC-0059)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moocoding/file-copy-helper",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "description": "Injects cp/sudo cp rule when user asks to mimic/copy files",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/intent-analyzer",
3
- "version": "1.1.461",
3
+ "version": "1.1.463",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"auto-continue.d.ts","sourceRoot":"","sources":["../src/auto-continue.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAqC,MAAM,YAAY,CAAC;AAGpF;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,gBAAgB,EAAE,IAAI,CAAC;IACvB,iEAAiE;IACjE,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,QAAQ,GACR,MAAM,GACN,sBAAsB,CAAC;AAE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H,OAAO,CAAC,aAAa;IAsHrB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CA8BzB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,GACrB,OAAO,CAET;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsFhF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EAAE,EACxB,gBAAgB,CAAC,EAAE,IAAI,EACvB,gBAAgB,CAAC,EAAE,IAAI,EACvB,OAAO,CAAC,EAAE,eAAe,GACxB,SAAS,CAeX"}
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import { JevJudge } from "./index.js";
11
11
  import { logError } from "./file-logger.js";
12
+ import { buildChoiceDecisionContext, describeChoiceOption, renderChoiceExcerpt, MAX_CHOICE_OPTIONS, } from "./decision-context.js";
12
13
  /** How many task titles reach the evaluation. */
13
14
  export const MAX_LISTED_TASKS = 10;
14
15
  /** How much of the question text reaches the evaluation. */
@@ -283,11 +284,22 @@ export class AutoContinueJudge {
283
284
  // A choice is only decidable with the alternatives in front of the
284
285
  // evaluation: the decision has to pick one of them, and it has to
285
286
  // say how far the work goes with it.
286
- const alternatives = (taskState.context?.question?.alternatives ?? []).slice(0, MAX_LISTED_TASKS);
287
+ const alternatives = (taskState.context?.question?.alternatives ?? []).slice(0, MAX_CHOICE_OPTIONS);
287
288
  if (alternatives.length >= 2) {
288
289
  const criteria = {};
290
+ // The criterion carries the meaning of the option, not only its
291
+ // label: "implement A" alone does not tell the evaluation what
292
+ // A does.
293
+ const choiceContext = buildChoiceDecisionContext({
294
+ question: taskState.context?.question?.text ?? "",
295
+ alternatives,
296
+ contextText: taskState.context?.question?.contextText,
297
+ });
289
298
  alternatives.forEach((alternative, index) => {
290
- criteria[`option_${index + 1}`] = alternative;
299
+ const option = choiceContext.options[index];
300
+ criteria[`option_${index + 1}`] = option
301
+ ? describeChoiceOption(option.id, option.label, option.description, option.constraints)
302
+ : alternative;
291
303
  });
292
304
  criteria["none_of_these"] = "none of the alternatives is the right one";
293
305
  questions.selectedOption = {
@@ -528,6 +540,19 @@ export function buildDecisionState(taskState) {
528
540
  const completionPercent = Math.round((taskState.completedTasks.length / taskState.totalTasks) * 100);
529
541
  const context = taskState.context;
530
542
  const question = context?.question;
543
+ // A choice is only decidable when the evaluation sees what the
544
+ // alternatives MEAN. The helper owns that policy: the short labels do
545
+ // not carry the meaning, and the beginning of a long message is not
546
+ // where the decisive facts stand.
547
+ const choiceContext = question &&
548
+ question.kind === "choice" &&
549
+ (question.alternatives ?? []).length >= 2
550
+ ? buildChoiceDecisionContext({
551
+ question: question.text,
552
+ alternatives: question.alternatives ?? [],
553
+ contextText: question.contextText,
554
+ })
555
+ : undefined;
531
556
  return {
532
557
  task_summary: {
533
558
  completed: taskState.completedTasks.length,
@@ -554,10 +579,20 @@ export function buildDecisionState(taskState) {
554
579
  text: question.text.slice(0, MAX_QUESTION_CHARS),
555
580
  // The alternatives of a choice question: without them the
556
581
  // decision cannot pick one.
557
- alternatives: (question.alternatives ?? []).slice(0, MAX_LISTED_TASKS),
582
+ // The alternatives the evaluation may choose from. The bound is
583
+ // the one of the criteria, so every listed alternative has a
584
+ // criterion of its own.
585
+ alternatives: (question.alternatives ?? []).slice(0, MAX_CHOICE_OPTIONS),
558
586
  // The surrounding message: the question sentence often leaves
559
- // out what the agent is really waiting for.
560
- context_excerpt: (question.contextText ?? "").slice(0, MAX_QUESTION_CHARS),
587
+ // out what the agent is really waiting for. A choice carries the
588
+ // facts of the alternatives instead of the first characters of
589
+ // the message.
590
+ context_excerpt: choiceContext
591
+ ? renderChoiceExcerpt(choiceContext)
592
+ : (question.contextText ?? "").slice(0, MAX_QUESTION_CHARS),
593
+ // The facts of a choice: the labels alone do not say what the
594
+ // alternatives mean.
595
+ choice_context: choiceContext ?? null,
561
596
  proposed_action: question.proposedAction ?? "unknown",
562
597
  consequence_of_approval: question.consequence ?? "unknown",
563
598
  // The risk facts are unknown when they were not determined: an