@evandu/super-pi 0.1.174 → 0.1.176

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.
@@ -1187,7 +1187,7 @@ Usage notes:
1187
1187
  1. Spawning is ASYNCHRONOUS by default: it creates the conversation, enqueues the initial task, and returns the new conversationId immediately. The sibling session runs in the background.
1188
1188
  2. The initial task should provide clear context and goals since the new session starts with a fresh conversation history.
1189
1189
  3. Use session_status with the returned conversationId to check progress, or session_dispatch to send further messages.
1190
- 4. The new session reports completion to its DIRECT parent automatically. 'parentConversationId' optionally selects that parent; by default it is the calling session.
1190
+ 4. The new session reports completion to its DIRECT parent automatically, and that parent is always the calling session. 'parentConversationId' may only repeat the calling session's own id - the server refuses (403) any other session as the parent and creates nothing.
1191
1191
  5. The new session always belongs to the calling session's workspace. Pass 'cwd' as a workspace-relative subdirectory (for example, 'packages/a') when it should work below the workspace root; absolute paths and traversal are rejected.
1192
1192
  6. Optionally pass 'model' to choose which model the NEW session runs on: {"provider":"...","modelId":"..."} - the same "provider/modelId" pair the model picker shows, and BOTH halves are required. Leave 'model' out and the new session starts on the workspace default model.
1193
1193
  7. Optionally pass 'watchdogTimeoutSeconds' to declare how long YOU are willing to wait for a report before you want to be reminded: a positive number of seconds. If the new session stays silent that long, you receive a '[Watchdog 提醒]' message naming it. A report from the child (session_report) restarts the clock; the watchdog never stops the child. Leave it out to run without a watchdog.`;
@@ -1525,7 +1525,7 @@ export async function executeSessionSpawn(
1525
1525
  });
1526
1526
 
1527
1527
  const bodyText = await response.text();
1528
- let payload: { ok?: boolean; conversationId?: string; error?: string };
1528
+ let payload: { ok?: boolean; conversationId?: string; status?: string; error?: string };
1529
1529
  try {
1530
1530
  payload = JSON.parse(bodyText);
1531
1531
  } catch {
@@ -1537,11 +1537,23 @@ export async function executeSessionSpawn(
1537
1537
  }
1538
1538
 
1539
1539
  const convId = payload.conversationId;
1540
+ // THE STATE IS THE SERVER'S ANSWER, NOT A WORD WRITTEN HERE.
1541
+ //
1542
+ // The server reads the child's real status out of its store at the moment it answers, and sends
1543
+ // it along; the envelope prints THAT. A literal "running" would be a claim about a child that
1544
+ // may already have finished its turn, and a model that believes the child is running will wait
1545
+ // for something that has already happened.
1546
+ //
1547
+ // IT IS A SNAPSHOT, AND THE ENVELOPE SAYS SO. An asynchronous spawn races its own child: this
1548
+ // is the state at this instant, and the child keeps moving after the answer is written. So the
1549
+ // envelope does not promise anything - it points at `session_status`, which is where the present
1550
+ // is. A server that reports no state at all gets "unknown" rather than an invented one.
1551
+ const childState = payload.status ?? "unknown";
1540
1552
  return text(
1541
- `<session id="${convId}" state="running">\n` +
1553
+ `<session id="${convId}" state="${childState}">\n` +
1542
1554
  `<title>${params.title?.trim() || `任务:${params.task.trim().slice(0, 30)}`}</title>\n` +
1543
1555
  `<task>${params.task.trim()}</task>\n` +
1544
- `<session_result>Sibling session created and initial task enqueued successfully. Use session_status with conversationId="${convId}" to monitor progress, or session_dispatch to send follow-up instructions.</session_result>\n` +
1556
+ `<session_result>Sibling session created and initial task enqueued successfully. The state above is the child's status at the moment this answer was written - use session_status with conversationId="${convId}" for the current progress, or session_dispatch to send follow-up instructions.</session_result>\n` +
1545
1557
  `</session>`
1546
1558
  );
1547
1559
  } catch (error) {
@@ -510,7 +510,7 @@ const extension = (pi: ExtensionApi): void => {
510
510
  description: "The high-level task or instructions to be performed by the new sibling session. This is sent as the initial prompt.",
511
511
  }),
512
512
  parentConversationId: Type.Optional(Type.String({
513
- description: "Optional explicit parent conversation. Defaults to the calling session; completion is reported to this direct parent.",
513
+ description: "The parent is always the calling session; pass the calling session's own id to repeat it. Any other session is refused and nothing is created.",
514
514
  })),
515
515
  title: Type.Optional(Type.String({
516
516
  description: "An optional title for the new sibling conversation in the sidebar. If omitted, derived from task.",
@@ -40,5 +40,5 @@
40
40
  "src/client/types.ts": "34a933e47e37a8fab6b0b33a5e325d0e504cceada95e13b0a45a00c489767388",
41
41
  "src/client/vite-env.d.ts": "65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5"
42
42
  },
43
- "recordedAt": "2026-11-08T14:24:24.496Z"
43
+ "recordedAt": "2026-11-09T11:37:14.663Z"
44
44
  }
@@ -1389,7 +1389,7 @@ export class RunService {
1389
1389
  // The offset says whether the reasoning grew after this call was initiated. The captured
1390
1390
  // `thinkingActive` flag covers the final-moment case, unless answer text later appeared after
1391
1391
  // thinking_end. That exclusion keeps after-body questions out of the previous reasoning fold.
1392
- const callThinkingBlock = prepared[1].thinkingAt < thought || (prepared[1].thinkingActive && !answerAfterThinking) ? prepared[1].thinkingBlock : null;
1392
+ const callThinkingBlock = !answerAfterThinking && (prepared[1].thinkingAt < thought || prepared[1].thinkingActive) ? prepared[1].thinkingBlock : null;
1393
1393
  // `at` is corrected to the execution position; `thinkingAt` stays at initiation so calls
1394
1394
  // inside one reasoning block do not all collapse onto the final reasoning offset.
1395
1395
  enqueueTools("a tool call", () => this.store.updateToolCall(conversation.id, assistant.id, row, { label: call.name, detail: call.detail, args: call.args, live: "", preparing: false, at, thinkingBlock: callThinkingBlock, ...(call.question ? { question: call.question } : {}) }));
@@ -1736,7 +1736,19 @@ export function createHttpServer(options) {
1736
1736
  cwd: body.cwd,
1737
1737
  watchdogTimeoutSeconds: body.watchdogTimeoutSeconds ?? body.watchdog_timeout_seconds ?? body.watchdogSeconds,
1738
1738
  });
1739
- json(200, { ok: true, ...result });
1739
+ // THE ANSWER CARRIES THE CHILD'S REAL STATE, NOT A LITERAL.
1740
+ //
1741
+ // This is the child's first appearance in the world, and the state that goes with it is
1742
+ // read out of the store AT THIS INSTANT rather than written down here. A literal would be
1743
+ // a claim: the child may already have finished its turn, or may not have started one yet,
1744
+ // and neither of those is "running" by the time anybody reads the answer.
1745
+ //
1746
+ // WHAT IT IS, EXACTLY: a snapshot of one moment. An asynchronous spawn races its own
1747
+ // child - the state here is whatever the store holds when this line runs, and the child
1748
+ // keeps moving after it. So the caller that renders this must not treat it as a promise;
1749
+ // `session_status` is how anybody asks for the present.
1750
+ const spawnedStatus = context.store.conversationStatus(result.conversationId);
1751
+ json(200, { ok: true, ...result, status: spawnedStatus });
1740
1752
  return;
1741
1753
  }
1742
1754
  // THE SCOPE RULE, IN ONE PLACE, FOR EVERY ACTION THAT TOUCHES ANOTHER SESSION.
@@ -262,7 +262,7 @@ export declare const SESSION_STOP_TOOL_NAME = "session_stop";
262
262
  export declare const SESSION_REPORT_TOOL_NAME = "session_report";
263
263
  export declare const SESSION_STOP_SUBTREE_TOOL_NAME = "session_stop_subtree";
264
264
  /** Model-facing description for session_spawn. */
265
- export declare const SESSION_SPAWN_DESCRIPTION = "Create a child conversation in the current workspace and immediately dispatch its initial task. You can specify a primary agent as the child's role.\n\nDIFFERENCE FROM THE 'task' TOOL:\n- The 'task' tool delegates to a transient, one-shot subagent process (scout, critic, patcher) that runs once, returns its final text, and terminates. It has no conversation history and does not appear in the workspace sidebar.\n- 'session_spawn' creates a real, persistent child CONVERSATION in Super Pi. It appears in the sidebar, retains multi-turn message history, can receive follow-up messages via session_dispatch, can be inspected via session_status, and can be stopped via session_stop. The user can also switch to it in the Web UI.\n\nWHEN TO USE THIS:\n- Long-running, multi-phase tracks of work that require ongoing context, multiple turns of dialogue, or independent user visibility.\n- Multi-phase or complex work where the user needs each step to be visible and available for inspection or intervention: create a child session with session_spawn.\n- Parallel work streams (e.g., Track A: backend refactor, Track B: frontend component update) where both need full conversational capabilities.\n- When the user asks you to act as an orchestrator/manager who delegates to multiple sessions.\n\nWHEN NOT TO USE THIS:\n- For one-off, focused delegation with a single answer: use 'task' (with scout/critic/patcher). It is faster, cheaper, and returns directly to your transcript.\n- For running shell commands or build watchers: use 'run_async'.\n- For a single one-off delegation with a single answer: use 'task'.\n\nUsage notes:\n1. Spawning is ASYNCHRONOUS by default: it creates the conversation, enqueues the initial task, and returns the new conversationId immediately. The sibling session runs in the background.\n2. The initial task should provide clear context and goals since the new session starts with a fresh conversation history.\n3. Use session_status with the returned conversationId to check progress, or session_dispatch to send further messages.\n4. The new session reports completion to its DIRECT parent automatically. 'parentConversationId' optionally selects that parent; by default it is the calling session.\n5. The new session always belongs to the calling session's workspace. Pass 'cwd' as a workspace-relative subdirectory (for example, 'packages/a') when it should work below the workspace root; absolute paths and traversal are rejected.\n6. Optionally pass 'model' to choose which model the NEW session runs on: {\"provider\":\"...\",\"modelId\":\"...\"} - the same \"provider/modelId\" pair the model picker shows, and BOTH halves are required. Leave 'model' out and the new session starts on the workspace default model.\n7. Optionally pass 'watchdogTimeoutSeconds' to declare how long YOU are willing to wait for a report before you want to be reminded: a positive number of seconds. If the new session stays silent that long, you receive a '[Watchdog \u63D0\u9192]' message naming it. A report from the child (session_report) restarts the clock; the watchdog never stops the child. Leave it out to run without a watchdog.";
265
+ export declare const SESSION_SPAWN_DESCRIPTION = "Create a child conversation in the current workspace and immediately dispatch its initial task. You can specify a primary agent as the child's role.\n\nDIFFERENCE FROM THE 'task' TOOL:\n- The 'task' tool delegates to a transient, one-shot subagent process (scout, critic, patcher) that runs once, returns its final text, and terminates. It has no conversation history and does not appear in the workspace sidebar.\n- 'session_spawn' creates a real, persistent child CONVERSATION in Super Pi. It appears in the sidebar, retains multi-turn message history, can receive follow-up messages via session_dispatch, can be inspected via session_status, and can be stopped via session_stop. The user can also switch to it in the Web UI.\n\nWHEN TO USE THIS:\n- Long-running, multi-phase tracks of work that require ongoing context, multiple turns of dialogue, or independent user visibility.\n- Multi-phase or complex work where the user needs each step to be visible and available for inspection or intervention: create a child session with session_spawn.\n- Parallel work streams (e.g., Track A: backend refactor, Track B: frontend component update) where both need full conversational capabilities.\n- When the user asks you to act as an orchestrator/manager who delegates to multiple sessions.\n\nWHEN NOT TO USE THIS:\n- For one-off, focused delegation with a single answer: use 'task' (with scout/critic/patcher). It is faster, cheaper, and returns directly to your transcript.\n- For running shell commands or build watchers: use 'run_async'.\n- For a single one-off delegation with a single answer: use 'task'.\n\nUsage notes:\n1. Spawning is ASYNCHRONOUS by default: it creates the conversation, enqueues the initial task, and returns the new conversationId immediately. The sibling session runs in the background.\n2. The initial task should provide clear context and goals since the new session starts with a fresh conversation history.\n3. Use session_status with the returned conversationId to check progress, or session_dispatch to send further messages.\n4. The new session reports completion to its DIRECT parent automatically, and that parent is always the calling session. 'parentConversationId' may only repeat the calling session's own id - the server refuses (403) any other session as the parent and creates nothing.\n5. The new session always belongs to the calling session's workspace. Pass 'cwd' as a workspace-relative subdirectory (for example, 'packages/a') when it should work below the workspace root; absolute paths and traversal are rejected.\n6. Optionally pass 'model' to choose which model the NEW session runs on: {\"provider\":\"...\",\"modelId\":\"...\"} - the same \"provider/modelId\" pair the model picker shows, and BOTH halves are required. Leave 'model' out and the new session starts on the workspace default model.\n7. Optionally pass 'watchdogTimeoutSeconds' to declare how long YOU are willing to wait for a report before you want to be reminded: a positive number of seconds. If the new session stays silent that long, you receive a '[Watchdog \u63D0\u9192]' message naming it. A report from the child (session_report) restarts the clock; the watchdog never stops the child. Leave it out to run without a watchdog.";
266
266
  /** Model-facing description for session_status. */
267
267
  export declare const SESSION_STATUS_DESCRIPTION = "Inspect the progress, run state, and latest activity of sibling conversations created by the orchestrator.\n\nWHEN TO USE THIS:\n- To check whether a spawned sibling conversation is still running, has finished (idle), is stopped, or encountered an error.\n- To read the latest assistant progress snippet without bloating your context with the session's entire raw message transcript.\n- To list all sibling conversations under your coordination when conversationId is omitted.\n\nUsage notes:\n1. When 'conversationId' is provided: returns a compact summary for that specific session, including its run status ('idle', 'running', 'waiting', 'stopped', 'failed'), messageCount, turnCount, lastAssistantSnippet, lastUserSnippet, activeTool, and error (if any).\n2. When 'conversationId' is omitted: returns a summary list of sibling conversations whose direct parent is 'parentConversationId' (the calling session by default).\n3. By default it never returns full transcripts; concise summaries keep your context window lean. Set 'includeOutput' with a conversationId to read the final output from its result file, capped to the last 64Ki characters with an explicit truncation notice.";
268
268
  /** Model-facing description for session_dispatch. */
@@ -388,7 +388,7 @@ Usage notes:
388
388
  1. Spawning is ASYNCHRONOUS by default: it creates the conversation, enqueues the initial task, and returns the new conversationId immediately. The sibling session runs in the background.
389
389
  2. The initial task should provide clear context and goals since the new session starts with a fresh conversation history.
390
390
  3. Use session_status with the returned conversationId to check progress, or session_dispatch to send further messages.
391
- 4. The new session reports completion to its DIRECT parent automatically. 'parentConversationId' optionally selects that parent; by default it is the calling session.
391
+ 4. The new session reports completion to its DIRECT parent automatically, and that parent is always the calling session. 'parentConversationId' may only repeat the calling session's own id - the server refuses (403) any other session as the parent and creates nothing.
392
392
  5. The new session always belongs to the calling session's workspace. Pass 'cwd' as a workspace-relative subdirectory (for example, 'packages/a') when it should work below the workspace root; absolute paths and traversal are rejected.
393
393
  6. Optionally pass 'model' to choose which model the NEW session runs on: {"provider":"...","modelId":"..."} - the same "provider/modelId" pair the model picker shows, and BOTH halves are required. Leave 'model' out and the new session starts on the workspace default model.
394
394
  7. Optionally pass 'watchdogTimeoutSeconds' to declare how long YOU are willing to wait for a report before you want to be reminded: a positive number of seconds. If the new session stays silent that long, you receive a '[Watchdog 提醒]' message naming it. A report from the child (session_report) restarts the clock; the watchdog never stops the child. Leave it out to run without a watchdog.`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evandu/super-pi",
3
- "version": "0.1.174",
3
+ "version": "0.1.176",
4
4
  "description": "Web control plane and companion for Pi",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -52,6 +52,7 @@
52
52
  "scripts/agent-picker-order.test.mjs",
53
53
  "scripts/inline-thinking.test.mjs",
54
54
  "scripts/thinking-block-identity.test.mjs",
55
+ "scripts/question-in-thinking-block.test.mjs",
55
56
  "scripts/inline-thinking-close-tag.test.mjs",
56
57
  "scripts/pi-session.test.mjs",
57
58
  "scripts/length-continuation.test.mjs",
@@ -198,6 +199,7 @@
198
199
  "scripts/static-client-assets.test.mjs",
199
200
  "scripts/cli.test.mjs",
200
201
  "scripts/check-runner.test.mjs",
202
+ "scripts/gate-count-truth.test.mjs",
201
203
  "scripts/skills-discovery.test.mjs",
202
204
  "scripts/built-in-skills.test.mjs",
203
205
  "scripts/presentation-schema.test.mjs",
@@ -205,6 +207,7 @@
205
207
  "scripts/provider-fetch-models.test.mjs",
206
208
  "scripts/shared-chrome.test.mjs",
207
209
  "scripts/shared-chrome-recovery.test.mjs",
210
+ "scripts/shared-chrome-budget.test.mjs",
208
211
  "scripts/prompt-templates.test.mjs",
209
212
  "scripts/documents.test.mjs",
210
213
  "scripts/web-tools.test.mjs",
@@ -238,13 +241,15 @@
238
241
  "scripts/session-report-watchdog.test.mjs",
239
242
  "scripts/session-report-tool.test.mjs",
240
243
  "scripts/session-stop-subtree.test.mjs",
244
+ "scripts/session-tool-behaviour.test.mjs",
241
245
  "scripts/awaiting-background-status.test.mjs",
242
246
  "scripts/project-lifecycle-e2e.test.mjs",
243
247
  "scripts/agent-tiers.test.mjs",
244
248
  "scripts/design-principles.test.mjs",
245
249
  "scripts/primary-employee-guard.test.mjs",
246
250
  "scripts/interrupted-task-recovery.test.mjs",
247
- "scripts/child-session-lock.test.mjs"
251
+ "scripts/child-session-lock.test.mjs",
252
+ "scripts/mutation-lock-coverage.test.mjs"
248
253
  ],
249
254
  "check:browser": [
250
255
  "scripts/interrupt-browser.test.mjs",