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 CHANGED
@@ -398,7 +398,7 @@ opening an issue or pull request.
398
398
 
399
399
  ```bash
400
400
  npm install
401
- npm test # 191 tests
401
+ npm test # 197 tests
402
402
  npm run typecheck # tsc --noEmit
403
403
  ```
404
404
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-open-agents",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Unified agent and subagent management for pi coding agent, with OpenCode-compatible agent definitions.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -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 model = (message as { model?: unknown }).model;
446
- return typeof model === "string" ? model : undefined;
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) {