@trim21/personal-pi-extensions 0.1.630 → 0.1.631
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.
- package/package.json +1 -1
- package/src/spawn-agent.ts +14 -2
package/package.json
CHANGED
package/src/spawn-agent.ts
CHANGED
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
* so one log entry is always exactly one rendered line. The final line is
|
|
25
25
|
* always the subagent name as a code span (`` `scout` ``), followed by the
|
|
26
26
|
* live usage stats when there are any; it rides outside the rolling window so
|
|
27
|
-
* it is never trimmed.
|
|
27
|
+
* it is never trimmed. The model name on that line is the model the session
|
|
28
|
+
* actually uses, which differs from the frontmatter string when the declared
|
|
29
|
+
* model resolved to nothing and the SDK fell back to a default. While the
|
|
30
|
+
* model is thinking, a transient
|
|
28
31
|
* `thinking ( N chars )` line sits between the log and the footer showing the
|
|
29
32
|
* live character count of the streamed thinking; it disappears when the
|
|
30
33
|
* thinking block ends.
|
|
@@ -177,6 +180,7 @@ interface SubagentResult {
|
|
|
177
180
|
messages: AgentMessage[];
|
|
178
181
|
stderr: string;
|
|
179
182
|
usage: UsageStats;
|
|
183
|
+
/** 实际生效的模型 id(fallback 之后),不是 frontmatter 里写的名字。 */
|
|
180
184
|
model?: string;
|
|
181
185
|
stopReason?: string;
|
|
182
186
|
errorMessage?: string;
|
|
@@ -378,6 +382,11 @@ function toolSegment(name: string, count: number): string {
|
|
|
378
382
|
/** The subset of AgentSession runAgent relies on (injectable for tests). */
|
|
379
383
|
export interface SubagentSession {
|
|
380
384
|
agent: { state: { messages: AgentMessage[] } };
|
|
385
|
+
/**
|
|
386
|
+
* Model the session actually runs (after any SDK fallback), shown in the
|
|
387
|
+
* progress footer. Optional: injected test sessions need not expose it.
|
|
388
|
+
*/
|
|
389
|
+
model?: { id: string };
|
|
381
390
|
subscribe(listener: AgentSessionEventListener): () => void;
|
|
382
391
|
prompt(text: string, options?: PromptOptions): Promise<void>;
|
|
383
392
|
abort(): Promise<void>;
|
|
@@ -453,7 +462,6 @@ export async function runAgent(
|
|
|
453
462
|
contextTokens: 0,
|
|
454
463
|
turns: 0,
|
|
455
464
|
},
|
|
456
|
-
model: agent.model,
|
|
457
465
|
};
|
|
458
466
|
|
|
459
467
|
let session: SubagentSession;
|
|
@@ -466,6 +474,10 @@ export async function runAgent(
|
|
|
466
474
|
return result;
|
|
467
475
|
}
|
|
468
476
|
|
|
477
|
+
// 面板显示实际生效的模型:frontmatter 里的模型名解析不到时,SDK 会静默
|
|
478
|
+
// fallback 到默认模型,回显配置原文会掩盖这次 fallback。
|
|
479
|
+
result.model = session.model?.id;
|
|
480
|
+
|
|
469
481
|
let logLines: string[] = [];
|
|
470
482
|
// 工具调用行合并:连续的 tool_execution_start 事件合并在同一 `tool:` 行
|
|
471
483
|
// (如 `tool: read x 2, glob`),相同工具名连续出现时计为 `name x N`,
|