@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
@@ -0,0 +1,256 @@
1
+ # Testing, Migration, and Pibo2 Validation
2
+
3
+ Use this reference when planning adapter verification, writing full/partial harness evals, migrating existing sessions, packaging, or validating the exact candidate on Pibo2.
4
+
5
+ ## Verification layers
6
+
7
+ Do not substitute one layer for another.
8
+
9
+ 1. **Static contracts** — typecheck, config schema, capabilities, import boundaries.
10
+ 2. **Deterministic adapter tests** — fake/native protocol fixtures, lifecycle, events, failures.
11
+ 3. **Product integration tests** — router, binding store, profiles, Agent Designer, tools/resources, trace/debug.
12
+ 4. **Migration tests** — old stores, ids/revisions, rollback boundary.
13
+ 5. **Full regression suite** — preserve existing Pi and product behavior.
14
+ 6. **Package verification** — installed package contains runtime/skill/protocol assets.
15
+ 7. **Exact-candidate Pibo2 validation** — real gateway, auth, persistence, restart, browser, cleanup.
16
+ 8. **Real model proof** — required where streaming/model/tool parity is claimed; auth-failed turns do not count.
17
+
18
+ ## Shared adapter contract
19
+
20
+ Run `exerciseAgentRuntimeAdapterContract()` against the adapter with deterministic inputs. It checks:
21
+
22
+ - configured instance/adapter identity;
23
+ - diagnostics and profile validation;
24
+ - open-session identity and workspace;
25
+ - live session contract;
26
+ - binding identity;
27
+ - prompt lifecycle with turn start and terminal event;
28
+ - settled status;
29
+ - abort;
30
+ - unsubscribe;
31
+ - double disposal.
32
+
33
+ Add adapter-specific tests for every optional capability and protocol behavior not covered by the shared contract.
34
+
35
+ ## Deterministic protocol fixtures
36
+
37
+ For an RPC/process adapter, fixtures should cover:
38
+
39
+ - initialize/ready handshake and version negotiation;
40
+ - native session/thread create and resume;
41
+ - assistant deltas/final content;
42
+ - reasoning and content indexes;
43
+ - tool call/start/update/result;
44
+ - usage/context updates;
45
+ - model/reasoning option lists;
46
+ - approvals and structured user input;
47
+ - native history read/pagination;
48
+ - interrupt/abort;
49
+ - process crash and EOF;
50
+ - malformed JSON/message/schema;
51
+ - unknown notification/method;
52
+ - duplicate/out-of-order/late events;
53
+ - startup timeout and backpressure/overload;
54
+ - missing native session;
55
+ - cleanup after partial startup.
56
+
57
+ Pin fixtures to the exact official schema/version that generated them. Store provenance and supported version range.
58
+
59
+ ## Capability contract tests
60
+
61
+ For each `true` capability, assert the operation and method exist and work. For each delivery capability, assert selected contributions actually arrive by the declared mode.
62
+
63
+ For each unsupported capability:
64
+
65
+ - profile selection returns an error diagnostic with a reason;
66
+ - Agent Designer remains intelligible and does not silently drop existing selections;
67
+ - the live session does not expose a misleading control method;
68
+ - direct API calls fail with capability-unavailable behavior;
69
+ - Context Build reports unsupported/failed delivery accurately.
70
+
71
+ Test degraded behavior for the documented fidelity loss, not merely successful startup.
72
+
73
+ ## Full-harness evaluation
74
+
75
+ A full-harness assessment/scaffold should include:
76
+
77
+ - exact protocol/version evidence table;
78
+ - complete Pibo capability matrix;
79
+ - driver/config/adapter/session module map;
80
+ - binding state and resume design;
81
+ - semantic event and correlation map;
82
+ - native prompt/tool preservation plan;
83
+ - Pibo tool MCP and external MCP plan;
84
+ - selected skills/context delivery and verification;
85
+ - models/auth/reasoning/approvals/input/history mapping;
86
+ - Agent Designer and disabled-state behavior for any remaining gaps;
87
+ - contract/protocol/product/migration/full-suite tests;
88
+ - exact Pibo2 restart/resume/browser/failure/cleanup plan.
89
+
90
+ The output still may leave optional capabilities unsupported when evidence does not prove them.
91
+
92
+ ## Partial-harness evaluation
93
+
94
+ A partial-harness assessment must:
95
+
96
+ - classify unsupported and unknown surfaces explicitly;
97
+ - avoid invented native ids, resume, history, tools, MCP, skills, context, approvals, model catalog, or reasoning controls;
98
+ - use the smallest truthful capability matrix;
99
+ - explain useful supported scope;
100
+ - map unsupported selections to visible disabled reasons and validation errors;
101
+ - avoid terminal scraping or global config hacks;
102
+ - identify the exact evidence/API needed to enable each pending capability;
103
+ - add negative tests that prevent accidental support claims.
104
+
105
+ A prompt demanding "full support" does not override protocol facts.
106
+
107
+ ## Product integration matrix
108
+
109
+ At minimum test:
110
+
111
+ | Area | Required checks |
112
+ |---|---|
113
+ | Registry | duplicate ids, malformed config, unavailable instance, diagnostics |
114
+ | Router | selected instance, queue, events, abort, disposal, no hard-coded adapter branch |
115
+ | Binding | initial state, CAS bind, resume, missing/error, repair/rebind, restart |
116
+ | Profiles | default selection, frozen existing sessions, invalid options/resources |
117
+ | Designer | runtime catalog, support modes, disabled reasons, stale selection removal |
118
+ | Tools | direct/MCP delivery, non-portable rejection, progress, cancellation, payloads |
119
+ | MCP | selected-only, cross-session denial, revocation, actual connection inventory |
120
+ | Skills/context | selected-only, unselected absence, symlink/size bounds, native prompt intact |
121
+ | Subagents | child Pibo Session, cross-runtime target, correlation, cleanup |
122
+ | Events | assistant/reasoning/tool/usage/errors, ordering, duplicate/late handling |
123
+ | History | product-primary fresh trace, native provider, partial page, missing state, cursor scope |
124
+ | Debug/telemetry | runtime identity, payload hydration, redaction, native drill-down |
125
+ | Product jobs | Cron, Loop, workflow, run/goal control where supported |
126
+
127
+ Use the deterministic fake adapter for generic behavior so tests do not depend on a real harness.
128
+
129
+ ## Import-boundary tests
130
+
131
+ Prevent adapter dependencies from leaking into generic modules. Scan imports or enforce module boundaries so:
132
+
133
+ - generic runtime/router/history/trace/debug/data/tools code does not import Pi/Codex/other harness packages;
134
+ - adapter directories may import their own SDK/protocol;
135
+ - compatibility facades are narrow and allowlisted;
136
+ - product code does not branch on literal adapter ids where capability dispatch is sufficient.
137
+
138
+ ## Migration tests
139
+
140
+ When bindings or history metadata change, construct databases from prior schema versions and verify:
141
+
142
+ - schema upgrades once and is idempotent;
143
+ - every existing Pi session receives the correct compatibility binding/metadata;
144
+ - fresh sessions do not receive legacy fallback markers;
145
+ - Pibo Session ids remain unchanged;
146
+ - native ids and transcript paths remain unchanged;
147
+ - binding state and revision remain unchanged unless the migration explicitly requires it;
148
+ - message/event/payload counts and integrity remain stable;
149
+ - uniqueness is adapter-scoped;
150
+ - old binaries can ignore additive data within the documented rollback boundary;
151
+ - native non-Pi sessions are never silently converted to Pi during rollback.
152
+
153
+ Use row counts and stable digests before/after on real disposable data.
154
+
155
+ ## Package verification
156
+
157
+ Build and inspect the tarball:
158
+
159
+ ```text
160
+ npm run typecheck
161
+ npm run build
162
+ npm test
163
+ npm pack --dry-run --json
164
+ ```
165
+
166
+ Verify it contains:
167
+
168
+ - compiled adapter/runtime modules;
169
+ - protocol schemas/fixtures needed at runtime;
170
+ - built-in skills and every referenced skill resource;
171
+ - no local credentials, generated runtime state, eval workspaces, or server fixtures.
172
+
173
+ Import the installed tarball for package-level integration rather than importing the source worktree.
174
+
175
+ ## Exact Pibo2 workflow
176
+
177
+ Follow the server-development skill. The minimum sequence is:
178
+
179
+ 1. Inspect current version, gateway/process, deployment commit, browser target, database schema/counts/integrity, and host resources.
180
+ 2. Pack the clean exact implementation commit and record SHA-256.
181
+ 3. Install under a commit-addressed candidate path.
182
+ 4. Activate through the approved Pibo2 workflow.
183
+ 5. Verify the active executable path and deployment commit immediately before validation requests.
184
+ 6. Run authenticated API/CLI/browser scenarios through the real public gateway.
185
+ 7. Restart the gateway and prove the same native binding resumes where supported.
186
+ 8. Exercise missing native state, invalid profile/options, unsupported capability, abort/failure, and cleanup paths.
187
+ 9. Recheck active executable/commit after requests because another deployment can replace the candidate.
188
+ 10. Delete temporary sessions/agents/config/payloads/generated directories and restore disposable fixtures.
189
+ 11. Record final counts, integrity, active processes, and public health.
190
+
191
+ Do not hard-code server addresses or expose machine keys/cookies/tokens in docs or logs.
192
+
193
+ ## Pibo2 scenario checklist
194
+
195
+ For a full adapter, validate where supported:
196
+
197
+ - fresh native session/thread and first turn;
198
+ - resumed turn after gateway restart with identical native id;
199
+ - native assistant/reasoning/tool streaming;
200
+ - native standard tools unchanged;
201
+ - Pibo MCP tool in the same session;
202
+ - selected external MCP with actual connected inventory;
203
+ - selected built-in/plugin/user skill and selected context;
204
+ - unselected resource absence;
205
+ - model/reasoning/options and auth status;
206
+ - approvals/structured input;
207
+ - Pibo-managed and cross-runtime subagents;
208
+ - Cron/Loop/workflow compatibility;
209
+ - abort and process failure;
210
+ - missing native session diagnostic;
211
+ - product history, native history, trace, debug, telemetry;
212
+ - Agent Designer and Context Build;
213
+ - browser-visible rendering and performance;
214
+ - session/agent deletion and generation cleanup.
215
+
216
+ For a partial adapter, validate the supported path plus every visible disabled/rejected path. Do not run a scenario that assumes an unsupported feature and then count failure as support.
217
+
218
+ ## Parity evidence
219
+
220
+ When preserving an existing adapter such as Pi, parity requires:
221
+
222
+ - full existing suite and build;
223
+ - old native sessions reopen without id/path rewrite;
224
+ - routing, controls, tools, jobs, subagents, TUI, Chat Web, context, trace, debug, telemetry, and reliability behavior;
225
+ - real model streaming/tool behavior on Pibo2.
226
+
227
+ A turn that reaches queue/idle but fails provider authentication proves only routing/failure handling. It does not prove assistant streaming, tool calls, compaction, or model parity.
228
+
229
+ ## Validation report
230
+
231
+ Write `docs/reports/<adapter-or-milestone>-validation-YYYY-MM-DD.md` containing:
232
+
233
+ - status and scope;
234
+ - branch, PR, commits, package version/path/checksum;
235
+ - exact harness/protocol versions;
236
+ - local typecheck/build/focused/full-suite results;
237
+ - migration before/after counts/digests/integrity;
238
+ - exact Pibo2 process/commit checks;
239
+ - API, debug, telemetry, restart, browser, performance, failure, and cleanup evidence;
240
+ - screenshots cropped/redacted to omit identities and unrelated data;
241
+ - defects found and fixes made;
242
+ - remaining uncertainty and unsupported capabilities.
243
+
244
+ Do not write the report as if a blocked or untested capability passed.
245
+
246
+ ## Completion gate
247
+
248
+ An adapter milestone is ready for review only when:
249
+
250
+ - code and docs agree with the capability matrix;
251
+ - all declared capability paths have tests/evidence;
252
+ - all unsupported selections have negative tests and visible reasons;
253
+ - full regression checks pass;
254
+ - the exact candidate was validated where real integration matters;
255
+ - cleanup completed;
256
+ - branch is clean, pushed, and represented by a focused/stacked PR.