@evandu/super-pi 0.1.145 → 0.1.147

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 (93) hide show
  1. package/agents/super-pi-task/core.ts +74 -2
  2. package/agents/super-pi-task/index.ts +7 -0
  3. package/dist/.super-pi-check-inputs.json +2 -2
  4. package/dist/client/.super-pi-client-sources.json +11 -11
  5. package/dist/client/assets/{CodeMirrorEditor-A9KvbIkm.js → CodeMirrorEditor-DQCjEnxG.js} +2 -2
  6. package/dist/client/assets/{dist-DM4Olwfx.js → dist-1Innu17E.js} +1 -1
  7. package/dist/client/assets/{dist-bIDce5j-.js → dist-1lynFOc5.js} +1 -1
  8. package/dist/client/assets/{dist-BlxwDnWr.js → dist-B1qLZVMK.js} +1 -1
  9. package/dist/client/assets/{dist-BTVbZigv.js → dist-B4pz_xdd.js} +1 -1
  10. package/dist/client/assets/{dist-UJ46aPS3.js → dist-B6KwDpeI.js} +1 -1
  11. package/dist/client/assets/{dist-CK2KFFtT.js → dist-BJVI1Unv.js} +1 -1
  12. package/dist/client/assets/{dist-CRnm1rnO.js → dist-BWvzD8Pe.js} +1 -1
  13. package/dist/client/assets/{dist-DSHM-PAs.js → dist-BayWssd0.js} +1 -1
  14. package/dist/client/assets/{dist-B9DE7sc5.js → dist-Bk_pkBVH.js} +1 -1
  15. package/dist/client/assets/{dist-D-o7iQ8c.js → dist-BpeClAv0.js} +1 -1
  16. package/dist/client/assets/{dist-CQFASxyb.js → dist-BsmJg5PX.js} +1 -1
  17. package/dist/client/assets/{dist-Ds5gfeAi.js → dist-Bx7s4rni.js} +1 -1
  18. package/dist/client/assets/{dist-UPJPMjWv.js → dist-CDBKM9tL.js} +1 -1
  19. package/dist/client/assets/{dist-CIgjifH-.js → dist-CGzXCzCG.js} +1 -1
  20. package/dist/client/assets/{dist-BAiV8I_O.js → dist-CRxCwn-Z.js} +1 -1
  21. package/dist/client/assets/{dist-Br-AuQUG.js → dist-CTDgUnBG.js} +1 -1
  22. package/dist/client/assets/{dist-4JbFTwg2.js → dist-D1VfMWmf.js} +1 -1
  23. package/dist/client/assets/{dist-BYOpvW02.js → dist-DTZLNEci.js} +1 -1
  24. package/dist/client/assets/{dist-CQV5kOCE.js → dist-DuUi29km.js} +1 -1
  25. package/dist/client/assets/{dist-CjszAoXk.js → dist-F3S0t1oM.js} +1 -1
  26. package/dist/client/assets/{dist-2boAf_pN.js → dist-QZ-FAVJV.js} +1 -1
  27. package/dist/client/assets/{dist-B1p4YF9C.js → dist-u0nBg0fZ.js} +1 -1
  28. package/dist/client/assets/index-BMpqviwU.css +1 -0
  29. package/dist/client/assets/index-Dzyp_7sf.js +102 -0
  30. package/dist/client/index.html +2 -2
  31. package/dist/server/active-memory.d.ts +17 -0
  32. package/dist/server/active-memory.js +39 -0
  33. package/dist/server/agents.d.ts +1 -1
  34. package/dist/server/agents.js +3 -1
  35. package/dist/server/application/conversation-service.d.ts +1 -1
  36. package/dist/server/application/conversation-service.js +12 -4
  37. package/dist/server/application/run-service.d.ts +32 -2
  38. package/dist/server/application/run-service.js +296 -40
  39. package/dist/server/application/scheduled-task-service.d.ts +14 -1
  40. package/dist/server/application/scheduled-task-service.js +27 -2
  41. package/dist/server/application/session-orchestrator-service.d.ts +114 -3
  42. package/dist/server/application/session-orchestrator-service.js +406 -35
  43. package/dist/server/application/session-watchdog.d.ts +159 -0
  44. package/dist/server/application/session-watchdog.js +244 -0
  45. package/dist/server/command-handler.js +1 -1
  46. package/dist/server/conversation-usage.d.ts +19 -0
  47. package/dist/server/conversation-usage.js +40 -0
  48. package/dist/server/file-diff.d.ts +3 -0
  49. package/dist/server/file-diff.js +4 -4
  50. package/dist/server/file-index.d.ts +4 -2
  51. package/dist/server/file-index.js +14 -9
  52. package/dist/server/file-name-index.d.ts +5 -2
  53. package/dist/server/file-name-index.js +22 -5
  54. package/dist/server/git.d.ts +3 -3
  55. package/dist/server/git.js +10 -9
  56. package/dist/server/http-server.js +256 -34
  57. package/dist/server/index.js +3 -0
  58. package/dist/server/knowledge-vectors.d.ts +15 -0
  59. package/dist/server/knowledge-vectors.js +118 -37
  60. package/dist/server/knowledge.d.ts +7 -8
  61. package/dist/server/knowledge.js +133 -55
  62. package/dist/server/length-continuation.d.ts +50 -0
  63. package/dist/server/length-continuation.js +55 -0
  64. package/dist/server/model-context-window.d.ts +46 -0
  65. package/dist/server/model-context-window.js +121 -0
  66. package/dist/server/pi-session-events.js +5 -1
  67. package/dist/server/pi-session-pool.d.ts +2 -0
  68. package/dist/server/pi-session-pool.js +16 -0
  69. package/dist/server/pi-session.d.ts +6 -0
  70. package/dist/server/pi-session.js +15 -1
  71. package/dist/server/runtime.d.ts +3 -0
  72. package/dist/server/runtime.js +23 -7
  73. package/dist/server/session-cwd.d.ts +17 -0
  74. package/dist/server/session-cwd.js +43 -0
  75. package/dist/server/session-ledger.d.ts +7 -0
  76. package/dist/server/session-tree-scope.d.ts +125 -0
  77. package/dist/server/session-tree-scope.js +337 -0
  78. package/dist/server/store.d.ts +35 -0
  79. package/dist/server/store.js +87 -2
  80. package/dist/server/task-tool.d.ts +2 -1
  81. package/dist/server/task-tool.js +4 -1
  82. package/dist/server/terminal.d.ts +1 -0
  83. package/dist/server/terminal.js +5 -3
  84. package/dist/server/turn-failure.d.ts +26 -0
  85. package/dist/server/turn-failure.js +67 -1
  86. package/dist/server/types.d.ts +33 -1
  87. package/dist/server/version.d.ts +25 -2
  88. package/dist/server/version.js +98 -26
  89. package/dist/server/ws-server.d.ts +1 -1
  90. package/dist/server/ws-server.js +7 -5
  91. package/package.json +36 -3
  92. package/dist/client/assets/index-BGsP8pt_.js +0 -100
  93. package/dist/client/assets/index-CiIc734l.css +0 -1
@@ -4,15 +4,30 @@ import type { RunService } from "./run-service.js";
4
4
  import type { SessionLedger } from "../session-ledger.js";
5
5
  import type { EventBroadcaster } from "../server-context.js";
6
6
  import type { RunStatus } from "../types.js";
7
+ import { SessionWatchdog } from "./session-watchdog.js";
7
8
  export declare const SESSION_OUTPUT_CHAR_LIMIT: number;
8
9
  export declare const sessionResultRelativePath: (conversationId: string) => string;
10
+ /**
11
+ * HOW MANY TIMES A CHILD MAY BE TOLD TO CONTINUE AFTER ITS OUTPUT WAS TRUNCATED.
12
+ *
13
+ * The bound is not about tokens - it is about a model that truncates on EVERY response. Three
14
+ * continuations cover the ordinary case (a long answer split across a few responses) and stop the
15
+ * pathological one. Past the bound the child is reported as unfinished, which is a true sentence
16
+ * about what happened, instead of a loop that never ends.
17
+ */
18
+ export declare const MAX_LENGTH_CONTINUATIONS = 3;
9
19
  export interface SpawnSessionOptions {
10
20
  /** The high-level task to be performed by the sibling session. */
11
21
  task: string;
12
22
  /** Parent conversation initiating the orchestration, if any. */
13
23
  parentConversationId?: string;
14
- /** Workspace ID for the new session. Inherited from parent if omitted. */
15
- workspaceId?: string;
24
+ /** Explicit target workspace. A parent conversation records only the session-tree relationship. */
25
+ workspaceId: string;
26
+ /**
27
+ * Optional workspace-root-relative subdirectory for the new session. Invalid or out-of-bounds
28
+ * values are rejected before the conversation is created.
29
+ */
30
+ cwd?: string;
16
31
  /** Optional custom title for the new session. */
17
32
  title?: string;
18
33
  /** Optional agent override for the new session. */
@@ -28,6 +43,18 @@ export interface SpawnSessionOptions {
28
43
  initialPrompt?: string;
29
44
  /** Whether to await turn completion before returning (default: false, asynchronous dispatch). */
30
45
  wait?: boolean;
46
+ /** Optional silence watchdog timeout in seconds. If set, parent is reminded if child goes quiet for this duration. */
47
+ watchdogTimeoutSeconds?: number;
48
+ }
49
+ export interface ReportSessionOptions {
50
+ /** The report content (milestone, findings, roadblock, or final output). */
51
+ content: string;
52
+ /**
53
+ * The status of the child session when reporting.
54
+ * "in_progress" (default): interim update; resets the watchdog timer.
55
+ * "completed" | "failed": terminal update; cancels the watchdog timer.
56
+ */
57
+ status?: "in_progress" | "completed" | "failed";
31
58
  }
32
59
  export interface StopSessionOptions {
33
60
  /** Stop mode: "active" (active turn), "queued" (waiting messages in queue), or "all" (both, default). */
@@ -72,7 +99,35 @@ export declare class SessionOrchestratorService {
72
99
  private readonly runService;
73
100
  private readonly ledger;
74
101
  private readonly broadcaster?;
75
- constructor(store: Store, conversationService: ConversationService, runService: RunService, ledger: SessionLedger, broadcaster?: EventBroadcaster | undefined);
102
+ readonly watchdog: SessionWatchdog;
103
+ /**
104
+ * HOW MANY TIMES EACH CHILD HAS BEEN TOLD TO CONTINUE AFTER A TRUNCATION.
105
+ *
106
+ * Per child rather than per dispatch, so a child that is given several tasks cannot extend itself
107
+ * indefinitely by being handed a new task each time it runs out of output budget. The entry is
108
+ * dropped as soon as the child finishes, so a child that continues successfully starts fresh on
109
+ * its next task.
110
+ */
111
+ private readonly lengthContinuations;
112
+ /**
113
+ * THE CHILDREN THAT HAVE ALREADY REPORTED THEIR OWN RESULT TO THEIR PARENT.
114
+ *
115
+ * A child can report explicitly - the `report` action - and that report is the child's own
116
+ * statement of what it did. When the child's turn then ends, the automatic completion report
117
+ * would deliver the same thing a second time, so the automatic path steps aside for a child that
118
+ * is in this set.
119
+ *
120
+ * The entry is added only by a TERMINAL report (`completed` / `failed`), because an interim
121
+ * update is not the child's final word: the task is still running, and the parent will want to
122
+ * hear how it ended.
123
+ */
124
+ private readonly reportedChildren;
125
+ constructor(store: Store, conversationService: ConversationService, runService: RunService, ledger: SessionLedger, broadcaster?: EventBroadcaster | undefined, watchdog?: SessionWatchdog);
126
+ /**
127
+ * The watchdog timer fired: the child has been silent for longer than the parent declared.
128
+ * Delivers a reminder message to the parent session. Does NOT interrupt or abort the child session.
129
+ */
130
+ private handleWatchdogTimeout;
76
131
  /**
77
132
  * Spawns a new sibling conversation and immediately dispatches its initial task.
78
133
  */
@@ -88,6 +143,58 @@ export declare class SessionOrchestratorService {
88
143
  }): Promise<{
89
144
  conversationId: string;
90
145
  }>;
146
+ /**
147
+ * THE CHILD'S OUTPUT WAS CUT OFF. TELL IT TO CARRY ON, AND LET IT.
148
+ *
149
+ * This is the recovery for a length stop, and it exists because a truncated answer is not a
150
+ * finished one. The child has already said most of what it had to say - that text is on its
151
+ * transcript - so the work left to do is the tail of the answer, not the whole of it.
152
+ *
153
+ * WHY THE CONTINUATION IS A NEW TURN RATHER THAN A RESUME OF THE SAME ONE. Pi has already settled
154
+ * the turn that was truncated: the model stopped, the message was written, the run ended. There is
155
+ * no live turn to resume, so the only way to get more output is to ask again - and asking again in
156
+ * the SAME conversation is what makes the continuation work, because the child's own partial
157
+ * answer is in its context and the model can see exactly where it stopped.
158
+ *
159
+ * WHY IT IS AN AGENT-SENT ORDER RATHER THAN A USER MESSAGE. The person never typed this, and the
160
+ * child's transcript must not show words under their name that they never said - the same reason
161
+ * `dispatch` uses `enqueueAndRunAsAgent` in the first place.
162
+ *
163
+ * Returns true when the child was continued (and the caller must NOT report a failure), and false
164
+ * when the continuation could not be made or the bound was reached - in which case the caller
165
+ * reports the original failure, which is then the honest description of what happened.
166
+ */
167
+ private continueAfterLengthStop;
168
+ /**
169
+ * Explicit report from a child session to its direct parent.
170
+ * Can be called multiple times at any point during execution.
171
+ */
172
+ report(childConversationId: string, options: ReportSessionOptions): Promise<{
173
+ delivered: boolean;
174
+ parentConversationId: string;
175
+ }>;
176
+ /**
177
+ * Sets or updates a silence watchdog timer on a child session.
178
+ */
179
+ setWatchdog(options: {
180
+ childConversationId: string;
181
+ parentConversationId: string;
182
+ timeoutSeconds: number;
183
+ }): Promise<{
184
+ ok: boolean;
185
+ childConversationId: string;
186
+ timeoutSeconds: number;
187
+ }>;
188
+ /**
189
+ * Cancels a silence watchdog timer on a child session.
190
+ */
191
+ cancelWatchdog(childConversationId: string): Promise<{
192
+ ok: boolean;
193
+ }>;
194
+ /**
195
+ * Re-arms persisted watchdogs from disk.
196
+ */
197
+ restoreWatchdogs(): Promise<void>;
91
198
  private persistSessionResult;
92
199
  /**
93
200
  * Returns a high-level summary of a session's progress without returning full transcripts.
@@ -98,6 +205,10 @@ export declare class SessionOrchestratorService {
98
205
  }): Promise<SessionSummary>;
99
206
  /**
100
207
  * Lists summaries of all sessions, optionally filtered by parent conversation.
208
+ *
209
+ * Persisted store conversations are the authoritative source for session tree
210
+ * parent-child relationships across server restarts, while SessionLedger
211
+ * enriches live in-memory task, progress, and activeTool state.
101
212
  */
102
213
  list(parentConversationId?: string): Promise<SessionSummary[]>;
103
214
  /**