@pasko70/pibo 1.16.6 → 2.0.0

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 (145) hide show
  1. package/dist/agent-runtime/auth.js +28 -0
  2. package/dist/agent-runtime/capabilities.js +221 -0
  3. package/dist/agent-runtime/context-build.js +313 -0
  4. package/dist/agent-runtime/contract.js +45 -0
  5. package/dist/agent-runtime/errors.js +57 -0
  6. package/dist/agent-runtime/events.js +1 -0
  7. package/dist/agent-runtime/history.js +1 -0
  8. package/dist/agent-runtime/profile-validation.js +109 -0
  9. package/dist/agent-runtime/registry.js +608 -0
  10. package/dist/agent-runtime/resource-files.js +87 -0
  11. package/dist/agent-runtime/resource-service.js +635 -0
  12. package/dist/agent-runtime/resources.js +1 -0
  13. package/dist/agent-runtime/routed-session.js +931 -0
  14. package/dist/agent-runtime/testing/contract.js +51 -0
  15. package/dist/agent-runtime/testing/fake-adapter.js +192 -0
  16. package/dist/agent-runtime/types.js +3 -0
  17. package/dist/agent-runtimes/codex-native/adapter.js +905 -0
  18. package/dist/agent-runtimes/codex-native/auth.js +476 -0
  19. package/dist/agent-runtimes/codex-native/client.js +734 -0
  20. package/dist/agent-runtimes/codex-native/config.js +152 -0
  21. package/dist/agent-runtimes/codex-native/history.js +283 -0
  22. package/dist/agent-runtimes/codex-native/mcp-stdio-launcher.js +89 -0
  23. package/dist/agent-runtimes/codex-native/models.js +581 -0
  24. package/dist/agent-runtimes/codex-native/process.js +459 -0
  25. package/dist/agent-runtimes/codex-native/protocol-types.js +1 -0
  26. package/dist/agent-runtimes/codex-native/protocol-version.js +7 -0
  27. package/dist/agent-runtimes/codex-native/redaction.js +31 -0
  28. package/dist/agent-runtimes/codex-native/requests.js +378 -0
  29. package/dist/agent-runtimes/codex-native/resource-delivery.js +445 -0
  30. package/dist/agent-runtimes/codex-native/thread.js +388 -0
  31. package/dist/agent-runtimes/codex-native/turn.js +849 -0
  32. package/dist/agent-runtimes/pi/adapter.js +653 -0
  33. package/dist/agent-runtimes/pi/auth.js +455 -0
  34. package/dist/agent-runtimes/pi/history.js +640 -0
  35. package/dist/agent-runtimes/pi/model-catalog.js +87 -0
  36. package/dist/agent-runtimes/pi/routed-session.js +1464 -0
  37. package/dist/agent-runtimes/pi/runtime.js +534 -0
  38. package/dist/agent-runtimes/pi/tool-compiler.js +69 -0
  39. package/dist/apps/chat/agent-profiles.js +40 -23
  40. package/dist/apps/chat/agent-store.js +111 -64
  41. package/dist/apps/chat/chat-api-routes.js +1 -1
  42. package/dist/apps/chat/chat-request-normalizers.js +47 -0
  43. package/dist/apps/chat/data/chat-data-mappers.js +25 -9
  44. package/dist/apps/chat/data/history-query-service.js +108 -0
  45. package/dist/apps/chat/data/session-query-service.js +24 -3
  46. package/dist/apps/chat/data/timeline-query-service.js +3 -3
  47. package/dist/apps/chat/model-catalog.js +1 -55
  48. package/dist/apps/chat/provider-auth-actions.js +171 -23
  49. package/dist/apps/chat/stream.js +12 -0
  50. package/dist/apps/chat/trace-v2.js +1 -0
  51. package/dist/apps/chat/trace.js +126 -415
  52. package/dist/apps/chat/web-app.js +582 -157
  53. package/dist/apps/chat-ui/assets/{dist-BTLtT_Vf.js → dist-9v2ZXT6V.js} +1 -1
  54. package/dist/apps/chat-ui/assets/{dist-CMk1aPug.js → dist-B1LVAytl.js} +1 -1
  55. package/dist/apps/chat-ui/assets/{dist-CcwA_IWN.js → dist-C6LPDFXU.js} +1 -1
  56. package/dist/apps/chat-ui/assets/{dist-DKOthbxr.js → dist-DVtXxfHc.js} +1 -1
  57. package/dist/apps/chat-ui/assets/{dist-ls2I6BIw.js → dist-DW4Qrfbd.js} +1 -1
  58. package/dist/apps/chat-ui/assets/{dist-D1rAtRWs.js → dist-DmbsHdMC.js} +1 -1
  59. package/dist/apps/chat-ui/assets/{dist-C1JQRskW.js → dist-DyvwuSFO.js} +1 -1
  60. package/dist/apps/chat-ui/assets/{dist-DfpaylQ-.js → dist-I26VB0QO.js} +1 -1
  61. package/dist/apps/chat-ui/assets/{dist-D10bTFD5.js → dist-RtHbJRPV.js} +1 -1
  62. package/dist/apps/chat-ui/assets/{dist-5KpmmBBZ.js → dist-sZgJkWZb.js} +1 -1
  63. package/dist/apps/chat-ui/assets/index-BPbNvcZe.css +1 -0
  64. package/dist/apps/chat-ui/assets/index-CIOf2uL2.js +237 -0
  65. package/dist/apps/chat-ui/index.html +2 -2
  66. package/dist/apps/chat-vscode-web/assets/index-1ivRyjFs.js +41 -0
  67. package/dist/apps/chat-vscode-web/index.html +1 -1
  68. package/dist/apps/vscode-artifacts/latest.vsix +0 -0
  69. package/dist/apps/vscode-artifacts/pibo-vscode-ext-2.0.0.vsix +0 -0
  70. package/dist/auth/login-actions.js +5 -251
  71. package/dist/cli-session/localSessionSource.js +8 -1
  72. package/dist/core/context-build.js +124 -20
  73. package/dist/core/default-profile.js +8 -0
  74. package/dist/core/profiles.js +30 -3
  75. package/dist/core/routed-session.js +5 -1446
  76. package/dist/core/runtime.js +5 -561
  77. package/dist/core/session-router.js +637 -83
  78. package/dist/data/cli.js +20 -3
  79. package/dist/data/schema.js +104 -1
  80. package/dist/data/session-store.js +24 -1
  81. package/dist/debug/events.js +25 -10
  82. package/dist/debug/failures.js +23 -3
  83. package/dist/debug/index.js +24 -6
  84. package/dist/debug/messages.js +87 -7
  85. package/dist/debug/persisted-payloads.js +31 -0
  86. package/dist/debug/pty.js +7 -6
  87. package/dist/debug/runtime-binding.js +29 -0
  88. package/dist/debug/session.js +137 -0
  89. package/dist/debug/summary.js +12 -0
  90. package/dist/debug/telemetry.js +28 -0
  91. package/dist/debug/tools.js +12 -2
  92. package/dist/debug/trace.js +154 -76
  93. package/dist/gateway/server.js +87 -2
  94. package/dist/gateway/tool.js +5 -5
  95. package/dist/index.js +21 -2
  96. package/dist/loops/tools.js +13 -12
  97. package/dist/mcp/agent-context.js +13 -4
  98. package/dist/mcp/client.js +10 -6
  99. package/dist/mcp/config.js +5 -2
  100. package/dist/mcp/runtime-session.js +166 -0
  101. package/dist/plugins/builtin.js +191 -53
  102. package/dist/plugins/codex-native.js +29 -0
  103. package/dist/plugins/registry.js +66 -2
  104. package/dist/runs/tools.js +26 -25
  105. package/dist/session-ui/terminalRows.js +2 -2
  106. package/dist/sessions/pibo-data-store.js +125 -16
  107. package/dist/sessions/runtime-binding.js +107 -0
  108. package/dist/sessions/sqlite-store.js +239 -18
  109. package/dist/sessions/store.js +86 -7
  110. package/dist/shared/trace-engine.js +18 -9
  111. package/dist/shared/trace-event-projection.js +29 -11
  112. package/dist/shared/{trace-transcript.js → trace-history.js} +193 -195
  113. package/dist/shared/trace-order.js +9 -4
  114. package/dist/shared/trace-page-merge.js +1 -1
  115. package/dist/signals/projector.js +20 -2
  116. package/dist/signals/registry.js +11 -0
  117. package/dist/subagents/tool.js +8 -6
  118. package/dist/tools/codex-browser.js +20 -19
  119. package/dist/tools/codex-compat.js +10 -9
  120. package/dist/tools/codex-image-generation.js +8 -6
  121. package/dist/tools/contract.js +45 -0
  122. package/dist/tools/credential-registry.js +182 -0
  123. package/dist/tools/mcp-bridge.js +511 -0
  124. package/dist/tools/payload-writer.js +17 -0
  125. package/dist/tools/runtime/tool.js +10 -9
  126. package/dist/tools/schema.js +9 -0
  127. package/dist/tools/session-service.js +193 -0
  128. package/dist/tools/session-tool-set.js +85 -0
  129. package/dist/web-annotations/tools.js +17 -16
  130. package/docs/README.md +11 -0
  131. package/package.json +3 -2
  132. package/skills/builtin/pibo-agent-runtime-adapter/SKILL.md +183 -0
  133. package/skills/builtin/pibo-agent-runtime-adapter/evals/README.md +10 -0
  134. package/skills/builtin/pibo-agent-runtime-adapter/evals/evals.json +45 -0
  135. package/skills/builtin/pibo-agent-runtime-adapter/evals/fixtures/orion-full-harness.md +60 -0
  136. package/skills/builtin/pibo-agent-runtime-adapter/evals/fixtures/relay-partial-harness.md +52 -0
  137. package/skills/builtin/pibo-agent-runtime-adapter/references/capabilities-and-designer.md +194 -0
  138. package/skills/builtin/pibo-agent-runtime-adapter/references/history-debug-and-security.md +213 -0
  139. package/skills/builtin/pibo-agent-runtime-adapter/references/interfaces-and-registration.md +214 -0
  140. package/skills/builtin/pibo-agent-runtime-adapter/references/lifecycle-bindings-and-events.md +193 -0
  141. package/skills/builtin/pibo-agent-runtime-adapter/references/portable-delivery-and-native-behavior.md +226 -0
  142. package/skills/builtin/pibo-agent-runtime-adapter/references/testing-migration-and-validation.md +256 -0
  143. package/dist/apps/chat-ui/assets/index-C2YI0xfw.js +0 -237
  144. package/dist/apps/chat-ui/assets/index-E0RmuCkY.css +0 -1
  145. package/dist/apps/chat-vscode-web/assets/index-D-tSsXLG.js +0 -41
@@ -3,21 +3,22 @@ import { compareTraceNodes, flattenTraceNodes } from "./trace-nodes.js";
3
3
  import { attachAsyncAgentRunNode, isRunStartToolNode } from "./trace-async-agent-runs.js";
4
4
  import { createRunNotificationNode, parseRunNotificationText } from "./trace-run-notifications.js";
5
5
  import { findLikelyTraceChildSession, isSubagentToolName, } from "./trace-subagent-links.js";
6
- export function applySingleEventToNodes(nodes, byId, piboSessionId, storedEvent, childByParent, linkedChildByToolCallId, hasPersistedTranscript, openTranscriptEventIds, sessionStatus) {
6
+ export function applySingleEventToNodes(nodes, byId, piboSessionId, storedEvent, childByParent, linkedChildByToolCallId, historyCoverage, openTranscriptEventIds, sessionStatus) {
7
7
  const payload = storedEvent.payload;
8
- const confirmedUserMessage = hasPersistedTranscript ? confirmedUserMessageEchoNode(nodes, storedEvent) : undefined;
8
+ const confirmedUserMessage = historyCoverage.mode !== "none" ? confirmedUserMessageEchoNode(nodes, storedEvent) : undefined;
9
9
  if (confirmedUserMessage) {
10
10
  if (payload.type === "message_steered" && payload.activeEventId) {
11
11
  confirmedUserMessage.parentId = messageTurnNodeId(payload.activeEventId);
12
12
  }
13
13
  return;
14
14
  }
15
- if (hasPersistedTranscript &&
16
- isTranscriptEchoEvent(payload) &&
15
+ if (((historyCoverage.mode === "native" && isTranscriptEchoEvent(payload))
16
+ || (historyCoverage.mode === "product" && isProductHistoryEchoEvent(payload))) &&
17
+ historyCoversEvent(payload, historyCoverage) &&
17
18
  !shouldKeepTranscriptEchoEvent(payload, openTranscriptEventIds)) {
18
19
  return;
19
20
  }
20
- if (hasPersistedTranscript && isStaleToolCallEchoEvent(payload, sessionStatus)) {
21
+ if (isNativeHistoryToolEchoEvent(payload, historyCoverage, sessionStatus)) {
21
22
  return;
22
23
  }
23
24
  if (payload.type === "assistant_delta") {
@@ -201,16 +202,16 @@ export function contentDeltaPatchNodeId(event) {
201
202
  return undefined;
202
203
  }
203
204
  export function reconcileTranscriptUserMessages(nodes, events, turnTimings = []) {
204
- const transcriptUsers = nodes.filter((node) => node.type === "user.message" && node.source === "transcript");
205
+ const transcriptUsers = nodes.filter((node) => node.type === "user.message" && isPersistedHistorySource(node.source));
205
206
  const timingByEventId = new Map(turnTimings.map((timing) => [timing.eventId, timing]));
206
207
  let latestTranscriptUser;
207
208
  for (const node of nodes) {
208
- if (node.type === "user.message" && node.source === "transcript") {
209
+ if (node.type === "user.message" && isPersistedHistorySource(node.source)) {
209
210
  latestTranscriptUser = node;
210
211
  continue;
211
212
  }
212
213
  if (node.type !== "assistant.message" ||
213
- node.source !== "transcript" ||
214
+ !isPersistedHistorySource(node.source) ||
214
215
  !node.eventId ||
215
216
  !latestTranscriptUser ||
216
217
  transcriptUserMessageHasCanonicalIdentity(latestTranscriptUser))
@@ -285,12 +286,15 @@ function confirmedUserMessageEchoNode(nodes, event) {
285
286
  const canonicalId = `event:${payload.type}:${payloadEventId ?? cryptoSafeId(payload)}`;
286
287
  const stableKey = eventStableKey(payload);
287
288
  const text = typeof payload.text === "string" ? payload.text : undefined;
288
- const transcriptUsers = flattenTraceNodes([...nodes]).filter((node) => node.type === "user.message" && node.source === "transcript");
289
+ const transcriptUsers = flattenTraceNodes([...nodes]).filter((node) => node.type === "user.message" && isPersistedHistorySource(node.source));
289
290
  const identityMatch = transcriptUsers.find((node) => transcriptUserMessageMatchesIdentity(node, canonicalId, stableKey, eventId));
290
291
  if (identityMatch)
291
292
  return identityMatch;
292
293
  return transcriptUsers.find((node) => !transcriptUserMessageHasCanonicalIdentity(node) && Boolean(text && traceNodeText(node) === text));
293
294
  }
295
+ function isPersistedHistorySource(source) {
296
+ return source === "transcript" || source === "product-history";
297
+ }
294
298
  function transcriptUserMessageMatchesIdentity(node, canonicalId, stableKey, eventId) {
295
299
  if (node.id === canonicalId || node.stableKey === stableKey)
296
300
  return true;
@@ -652,6 +656,9 @@ function isOptimisticUserMessageEvent(event) {
652
656
  function isInternalSessionOperation(action) {
653
657
  return action === "session.fork" || action === "session.clone" || action === "session.switch";
654
658
  }
659
+ function isProductHistoryEchoEvent(event) {
660
+ return event.type === "assistant_delta" || event.type === "assistant_message";
661
+ }
655
662
  function isTranscriptEchoEvent(event) {
656
663
  return (event.type === "message_queued" ||
657
664
  event.type === "message_started" ||
@@ -666,8 +673,19 @@ function shouldKeepTranscriptEchoEvent(event, openTranscriptEventIds) {
666
673
  const eventId = "eventId" in event && typeof event.eventId === "string" ? event.eventId : undefined;
667
674
  return Boolean(eventId && openTranscriptEventIds.has(eventId));
668
675
  }
669
- function isStaleToolCallEchoEvent(event, sessionStatus) {
670
- return sessionStatus !== "running" && event.type === "tool_call";
676
+ function historyCoversEvent(event, coverage) {
677
+ const eventId = "eventId" in event && typeof event.eventId === "string" ? event.eventId : undefined;
678
+ return eventId === undefined || coverage.eventIds.has(eventId);
679
+ }
680
+ function isNativeHistoryToolEchoEvent(event, coverage, sessionStatus) {
681
+ if (coverage.mode !== "native" || sessionStatus === "running")
682
+ return false;
683
+ if (event.type !== "tool_call" &&
684
+ event.type !== "tool_execution_started" &&
685
+ event.type !== "tool_execution_updated" &&
686
+ event.type !== "tool_execution_finished")
687
+ return false;
688
+ return coverage.toolCallIds.has(event.toolCallId) || historyCoversEvent(event, coverage);
671
689
  }
672
690
  export function mergeMessageTurnTimings(...groups) {
673
691
  const byEventId = new Map();