pi-open-agents 0.1.28 → 0.1.29
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/README.md +1 -1
- package/package.json +1 -1
- package/src/subagent/executor.ts +20 -2
package/README.md
CHANGED
package/package.json
CHANGED
package/src/subagent/executor.ts
CHANGED
|
@@ -440,10 +440,28 @@ function usageFromMessage(
|
|
|
440
440
|
};
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
+
/**
|
|
444
|
+
* Extract the display model string from an assistant message (issue #27).
|
|
445
|
+
*
|
|
446
|
+
* `AssistantMessage` always carries both `provider` and `model`, so prefix the
|
|
447
|
+
* bare id (`provider/model`) to match the `model:` frontmatter format and the
|
|
448
|
+
* per-call override (`parseModelRef` splits on the first slash, so a
|
|
449
|
+
* namespaced id such as `anthropic/claude-opus-5.5` under `openrouter`
|
|
450
|
+
* round-trips exactly). No `provider` → bare id, as before.
|
|
451
|
+
*
|
|
452
|
+
* The `startsWith` guard prevents `provider/provider/...` when a host echoes
|
|
453
|
+
* an already-qualified id. Deliberately NOT `responseModel`: that is the
|
|
454
|
+
* provider-native answering snapshot (alias → dated version), a different
|
|
455
|
+
* granularity from "which provider ran the agent".
|
|
456
|
+
*/
|
|
443
457
|
function modelFromMessage(message: unknown): string | undefined {
|
|
444
458
|
if (!message || typeof message !== "object") return undefined;
|
|
445
|
-
const
|
|
446
|
-
|
|
459
|
+
const data = message as { provider?: unknown; model?: unknown };
|
|
460
|
+
if (typeof data.model !== "string") return undefined;
|
|
461
|
+
if (typeof data.provider === "string" && !data.model.startsWith(`${data.provider}/`)) {
|
|
462
|
+
return `${data.provider}/${data.model}`;
|
|
463
|
+
}
|
|
464
|
+
return data.model;
|
|
447
465
|
}
|
|
448
466
|
|
|
449
467
|
function updateUsage(target: AgentUsage, update: Partial<AgentUsage> | undefined) {
|