@pasko70/pibo 1.0.5 → 1.2.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.
- package/README.md +106 -250
- package/context/codex-base-prompt.md +4 -0
- package/context/compute-worker.md +23 -0
- package/context/pibo-native-tooling.md +18 -0
- package/context/pibo-system-prompt.md +69 -8
- package/dist/api/simple-agent-api.js +136 -0
- package/dist/app-context.js +4 -0
- package/dist/apps/chat/agent-profiles.js +42 -5
- package/dist/apps/chat/agent-store.js +113 -16
- package/dist/apps/chat/chat-api-routes.js +311 -0
- package/dist/apps/chat/chat-capability-routes.js +90 -0
- package/dist/apps/chat/chat-files.js +178 -0
- package/dist/apps/chat/chat-request-normalizers.js +681 -0
- package/dist/apps/chat/chat-settings-routes.js +75 -0
- package/dist/apps/chat/chat-trace-helpers.js +94 -0
- package/dist/apps/chat/chat-user-skill-routes.js +149 -0
- package/dist/apps/chat/cron-api.js +213 -0
- package/dist/apps/chat/data/chat-data-mappers.js +74 -0
- package/dist/apps/chat/data/event-command-service.js +75 -0
- package/dist/apps/chat/data/navigation-query-service.js +11 -0
- package/dist/apps/chat/data/project-service.js +844 -0
- package/dist/apps/chat/data/read-state-service.js +42 -0
- package/dist/apps/chat/data/room-service.js +52 -0
- package/dist/apps/chat/data/session-query-service.js +63 -0
- package/dist/apps/chat/data/timeline-query-service.js +96 -0
- package/dist/apps/chat/event-log.js +1 -307
- package/dist/apps/chat/model-catalog.js +47 -0
- package/dist/apps/chat/output-compactor.js +126 -0
- package/dist/apps/chat/output-event-policy.js +17 -0
- package/dist/apps/chat/project-workflow-human-actions.js +347 -0
- package/dist/apps/chat/project-workflow-sessions.js +260 -0
- package/dist/apps/chat/provider-auth-actions.js +43 -0
- package/dist/apps/chat/ralph-api.js +156 -0
- package/dist/apps/chat/read-model.js +1 -218
- package/dist/apps/chat/rooms.js +1 -321
- package/dist/apps/chat/static-assets.js +996 -0
- package/dist/apps/chat/stream.js +29 -6
- package/dist/apps/chat/trace.js +179 -1003
- package/dist/apps/chat/types/event-store.js +1 -0
- package/dist/apps/chat/types/read-model.js +1 -0
- package/dist/apps/chat/types/rooms.js +36 -0
- package/dist/apps/chat/web-app.js +3168 -1811
- package/dist/apps/chat/workflow-catalog.js +572 -0
- package/dist/apps/chat/workflow-edge-compatibility.js +51 -0
- package/dist/apps/chat/workflow-json-schema-validation.js +335 -0
- package/dist/apps/chat/workflow-persistence-model.js +140 -0
- package/dist/apps/chat/workflow-persistence.js +633 -0
- package/dist/apps/chat/workflow-registered-ref-params.js +130 -0
- package/dist/apps/chat/workflow-registered-ref-pickers.js +179 -0
- package/dist/apps/chat/workflow-registered-ref-validation.js +210 -0
- package/dist/apps/chat/workflow-v2-security-validation.js +93 -0
- package/dist/apps/chat/workflow-validation-helpers.js +114 -0
- package/dist/apps/chat-ui/assets/{dist-CI0Xj2Cp.js → dist-B4lw9z4F.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-aMr2VYOu.js → dist-BbTaHWON.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-u2OzzOTm.js → dist-BcT_c1EJ.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-Di1ScJ22.js → dist-CGINd7XU.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-wiRpAHIv.js → dist-CrBzZkUp.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CaNOvqMY.js → dist-CyyISotB.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-zgYUl2B-.js → dist-DFbnFNpX.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CNlhGq5i.js → dist-DGLWQLX8.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-BGxHKHPX.js → dist-DfcIkFSN.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DrM-H3e1.js → dist-sKDHTwaT.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DpmEro5R.js → dist-y9D6la48.js} +1 -1
- package/dist/apps/chat-ui/assets/index-C25VYnyb.css +1 -0
- package/dist/apps/chat-ui/assets/index-CUkuvI3v.js +165 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-144x144.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-192x192.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-48x48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-512x512.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-72x72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-96x96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/1024.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/114.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/120.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/128.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/144.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/152.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/167.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/180.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/192.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/29.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/50.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/512.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/57.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/58.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/76.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/87.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/index.html +8 -3
- package/dist/apps/chat-ui/manifest.webmanifest +25 -0
- package/dist/apps/chat-ui/sw.js +41 -0
- package/dist/apps/cli-ui/InkSessionApp.js +1218 -0
- package/dist/apps/cli-ui/InkTerminalLine.js +53 -0
- package/dist/apps/cli-ui/InkTerminalRow.js +304 -0
- package/dist/apps/cli-ui/InkTerminalView.js +25 -0
- package/dist/apps/cli-ui/cliSessionsCommand.js +232 -0
- package/dist/apps/cli-ui/index.js +8 -0
- package/dist/apps/cli-ui/inkColors.js +67 -0
- package/dist/apps/cli-ui/inkJson.js +244 -0
- package/dist/apps/cli-ui/inkMarkdown.js +122 -0
- package/dist/apps/context-files-ui/assets/{dist-DFi2YGux.js → dist-BOiGdrG-.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-DyfSeBMu.js → dist-DK01b7x4.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-CwbH_3RN.js → dist-DPG9jOQ-.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-dTBsFYAl.js → dist-Dp5AH00p.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-CxRLRmMx.js → dist-DqYw0LH7.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-MyZgX9K2.js → dist-TF5iO5ML.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-DQXzt2Ng.js → dist-TbjAhles.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-YwR9dpb-.js → dist-ZsBbt0uY.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-CKQF1zEu.js → dist-kmsvtHkH.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-BJW3917N.js → dist-vnd7PMu3.js} +1 -1
- package/dist/apps/context-files-ui/assets/{index-BwRDoHMC.css → index-B92tL3Pp.css} +1 -1
- package/dist/apps/context-files-ui/assets/{index-GwvjXytt.js → index-BhAWD3dv.js} +2 -2
- package/dist/apps/context-files-ui/index.html +2 -2
- package/dist/auth/better-auth.js +2 -1
- package/dist/auth/login-actions.js +251 -0
- package/dist/auth/openai-codex-usage.js +147 -0
- package/dist/bin/pibo.js +0 -0
- package/dist/bin/rg.js +15 -0
- package/dist/cli-session/fakeSessionSource.js +804 -0
- package/dist/cli-session/index.js +3 -0
- package/dist/cli-session/localSessionSource.js +1144 -0
- package/dist/cli-session/sessionSource.js +13 -0
- package/dist/cli.js +142 -14
- package/dist/compute/cli.js +415 -0
- package/dist/compute/docker.js +827 -0
- package/dist/compute/resource-health.js +333 -0
- package/dist/compute/resource-policy.js +98 -0
- package/dist/config/config.js +9 -5
- package/dist/core/context-build.js +677 -0
- package/dist/core/model-defaults.js +51 -9
- package/dist/core/pibo-home.js +8 -0
- package/dist/core/profiles.js +48 -0
- package/dist/core/provider-telemetry.js +222 -0
- package/dist/core/routed-session.js +441 -47
- package/dist/core/runtime-telemetry.js +853 -0
- package/dist/core/runtime.js +103 -15
- package/dist/core/session-errors.js +47 -0
- package/dist/core/session-model.js +39 -0
- package/dist/core/session-router.js +292 -62
- package/dist/core/shared-app.js +17 -0
- package/dist/core/skill-expansion.js +43 -0
- package/dist/core/system-prompt-template.js +9 -9
- package/dist/core/telemetry-staleness.js +128 -0
- package/dist/core/test-output-compaction.js +145 -0
- package/dist/core/user-settings.js +73 -0
- package/dist/cron/channel.js +28 -0
- package/dist/cron/cli.js +230 -0
- package/dist/cron/plugin.js +11 -0
- package/dist/cron/schedule.js +214 -0
- package/dist/cron/service.js +177 -0
- package/dist/cron/store.js +349 -0
- package/dist/cron/types.js +1 -0
- package/dist/data/cli.js +184 -0
- package/dist/data/event-log.js +106 -0
- package/dist/data/final-app-space-cutover-migration.js +728 -0
- package/dist/data/ingest-service.js +389 -0
- package/dist/data/message-store.js +62 -0
- package/dist/data/navigation-store.js +75 -0
- package/dist/data/observation-store.js +46 -0
- package/dist/data/payload-store.js +144 -0
- package/dist/data/pibo-store.js +59 -0
- package/dist/data/schema.js +434 -0
- package/dist/data/session-store.js +63 -0
- package/dist/data/shared-app-migration.js +757 -0
- package/dist/data/sqlite-schema.js +12 -0
- package/dist/data/telemetry-preview.js +65 -0
- package/dist/data/telemetry-queries.js +212 -0
- package/dist/data/telemetry-retention.js +50 -0
- package/dist/data/telemetry-rows.js +158 -0
- package/dist/data/telemetry.js +357 -0
- package/dist/debug/delta-compaction.js +99 -0
- package/dist/debug/detail-format.js +86 -0
- package/dist/debug/events.js +149 -29
- package/dist/debug/failures.js +162 -0
- package/dist/debug/index.js +655 -30
- package/dist/debug/messages.js +185 -0
- package/dist/debug/next-commands.js +6 -0
- package/dist/debug/payloads.js +123 -0
- package/dist/debug/pty.js +924 -0
- package/dist/debug/session.js +45 -15
- package/dist/debug/sql.js +1 -1
- package/dist/debug/stores.js +18 -13
- package/dist/debug/summary.js +72 -0
- package/dist/debug/telemetry.js +649 -0
- package/dist/debug/tools.js +168 -0
- package/dist/debug/trace-render-check.js +151 -0
- package/dist/debug/trace.js +152 -27
- package/dist/debug/web-artifacts.js +63 -0
- package/dist/debug/web-options.js +313 -0
- package/dist/debug/web-render-analysis.js +310 -0
- package/dist/debug/web-snapshot-browser-scripts.js +303 -0
- package/dist/debug/web-streaming-benchmark-analysis.js +605 -0
- package/dist/debug/web-streaming-browser-library.js +928 -0
- package/dist/debug/web-streaming-browser-scripts.js +242 -0
- package/dist/debug/web-streaming-provider-telemetry.js +194 -0
- package/dist/debug/web-streaming-report.js +493 -0
- package/dist/debug/web-streaming-types.js +1 -0
- package/dist/debug/web.js +574 -0
- package/dist/gateway/backup.js +83 -0
- package/dist/gateway/cli.js +511 -0
- package/dist/gateway/fallback.js +155 -0
- package/dist/gateway/pidfile.js +84 -0
- package/dist/gateway/protocol.js +16 -0
- package/dist/gateway/server.js +174 -17
- package/dist/gateway/tool.js +54 -51
- package/dist/gateway/web.js +74 -2
- package/dist/index.js +3 -1
- package/dist/local/client.js +3 -3
- package/dist/local/extension.js +8 -5
- package/dist/plugins/builtin.js +252 -49
- package/dist/plugins/chat-vscode-web.js +28 -0
- package/dist/plugins/codex-compat.js +0 -41
- package/dist/plugins/context-files.js +98 -18
- package/dist/plugins/dev-auth.js +124 -0
- package/dist/plugins/native-tooling.js +15 -0
- package/dist/plugins/registry.js +66 -2
- package/dist/plugins/web-annotations.js +27 -0
- package/dist/providers/minimax.js +70 -0
- package/dist/providers/openai-compat.js +48 -0
- package/dist/ralph/channel.js +8 -0
- package/dist/ralph/cli.js +152 -0
- package/dist/ralph/plugin.js +14 -0
- package/dist/ralph/service.js +271 -0
- package/dist/ralph/stopping.js +151 -0
- package/dist/ralph/store.js +450 -0
- package/dist/ralph/templates.js +200 -0
- package/dist/ralph/types.js +1 -0
- package/dist/reliability/store.js +42 -26
- package/dist/runs/registry.js +72 -35
- package/dist/session-ui/commandCatalog.js +193 -0
- package/dist/session-ui/commandResults.js +95 -0
- package/dist/session-ui/index.js +7 -0
- package/dist/session-ui/ownerViewModel.js +27 -0
- package/dist/session-ui/roomSessionViewModel.js +69 -0
- package/dist/session-ui/statusViewModel.js +127 -0
- package/dist/session-ui/terminalCards.js +210 -0
- package/dist/session-ui/terminalRows.js +937 -0
- package/dist/session-ui/terminalValue.js +45 -0
- package/dist/sessions/pibo-data-store.js +178 -0
- package/dist/sessions/sqlite-store.js +78 -12
- package/dist/sessions/store.js +11 -4
- package/dist/sessions/workflow-session-kind.js +20 -0
- package/dist/setup/cli.js +567 -0
- package/dist/shared/trace-async-agent-runs.js +127 -0
- package/dist/shared/trace-engine.js +96 -0
- package/dist/shared/trace-event-projection.js +679 -0
- package/dist/shared/trace-live-reducer.js +191 -0
- package/dist/shared/trace-nodes.js +76 -0
- package/dist/shared/trace-order.js +11 -10
- package/dist/shared/trace-patch-nodes.js +83 -0
- package/dist/shared/trace-run-notifications.js +69 -0
- package/dist/shared/trace-subagent-links.js +46 -0
- package/dist/shared/trace-transcript.js +303 -0
- package/dist/shared/trace-types.js +1 -0
- package/dist/shared-app.js +4 -0
- package/dist/signals/aggregate.js +65 -0
- package/dist/signals/events.js +1 -0
- package/dist/signals/projector.js +158 -0
- package/dist/signals/registry.js +513 -0
- package/dist/signals/store.js +1 -0
- package/dist/signals/types.js +1 -0
- package/dist/skills/cli.js +117 -0
- package/dist/tools/agent-browser-leases.js +219 -0
- package/dist/tools/agent-browser-wrapper.js +99 -0
- package/dist/tools/browser-pool.js +623 -0
- package/dist/tools/browser-use-cdp.js +56 -4
- package/dist/tools/browser-use-leases.js +215 -37
- package/dist/tools/browser-use-wrapper.js +508 -65
- package/dist/tools/cdp-client.js +189 -0
- package/dist/tools/guides.js +203 -4
- package/dist/tools/index.js +666 -16
- package/dist/tools/npm-runtime.js +136 -0
- package/dist/tools/registry.js +107 -8
- package/dist/tools/runtime/index.js +3 -0
- package/dist/tools/runtime/node-backend.js +225 -0
- package/dist/tools/runtime/node-worker-source.js +206 -0
- package/dist/tools/runtime/python-backend.js +227 -0
- package/dist/tools/runtime/python-worker-source.js +178 -0
- package/dist/tools/runtime/registry.js +255 -0
- package/dist/tools/runtime/tool.js +168 -0
- package/dist/tools/runtime/types.js +1 -0
- package/dist/tools/web-search.js +2 -1
- package/dist/user-skills/installer.js +214 -0
- package/dist/user-skills/manager.js +35 -0
- package/dist/user-skills/store.js +267 -0
- package/dist/user-skills/types.js +1 -0
- package/dist/web/auth.js +5 -1
- package/dist/web/channel.js +86 -0
- package/dist/web/http.js +79 -14
- package/dist/web-annotations/api.js +348 -0
- package/dist/web-annotations/attachments.js +201 -0
- package/dist/web-annotations/cdp.js +1107 -0
- package/dist/web-annotations/index.js +7 -0
- package/dist/web-annotations/store.js +407 -0
- package/dist/web-annotations/tools.js +350 -0
- package/dist/web-annotations/types.js +34 -0
- package/dist/web-annotations/validation.js +288 -0
- package/docs/README.md +23 -0
- package/docs/ops/install-developer-host.md +112 -0
- package/docs/ops/install-user-host.md +76 -0
- package/docs/ops/upgrade-user-to-developer-host.md +69 -0
- package/package.json +24 -10
- package/{.codex/skills → skills/builtin}/pi-agent-harness/SKILL.md +24 -24
- package/skills/builtin/pibo-docker-system/SKILL.md +170 -0
- package/skills/builtin/pibo-spec-writing/SKILL.md +330 -0
- package/skills/builtin/prd/SKILL.md +143 -0
- package/skills/builtin/ralph-loop/SKILL.md +359 -0
- package/skills/builtin/ralph-prd-json/SKILL.md +123 -0
- package/skills/builtin/skill-creator/LICENSE.txt +202 -0
- package/skills/builtin/skill-creator/SKILL.md +513 -0
- package/skills/builtin/skill-creator/agents/analyzer.md +274 -0
- package/skills/builtin/skill-creator/agents/comparator.md +202 -0
- package/skills/builtin/skill-creator/agents/grader.md +223 -0
- package/skills/builtin/skill-creator/assets/eval_review.html +146 -0
- package/skills/builtin/skill-creator/eval-viewer/generate_review.py +471 -0
- package/skills/builtin/skill-creator/eval-viewer/viewer.html +1325 -0
- package/skills/builtin/skill-creator/references/schemas.md +430 -0
- package/skills/builtin/skill-creator/scripts/__init__.py +0 -0
- package/skills/builtin/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/skills/builtin/skill-creator/scripts/generate_report.py +326 -0
- package/skills/builtin/skill-creator/scripts/improve_description.py +247 -0
- package/skills/builtin/skill-creator/scripts/package_skill.py +136 -0
- package/skills/builtin/skill-creator/scripts/quick_validate.py +103 -0
- package/skills/builtin/skill-creator/scripts/run_eval.py +310 -0
- package/skills/builtin/skill-creator/scripts/run_loop.py +328 -0
- package/skills/builtin/skill-creator/scripts/utils.py +47 -0
- package/skills/builtin/web-annotations/SKILL.md +93 -0
- package/dist/apps/chat-ui/assets/index-B_E935fP.js +0 -151
- package/dist/apps/chat-ui/assets/index-Dk-opWl3.css +0 -1
- package/dist/env.js +0 -32
- package/dist/plugins/core-tools.js +0 -94
- package/dist/plugins/example.js +0 -67
- package/dist/plugins/remote-agent.js +0 -9
- package/dist/remote/channel.js +0 -176
- package/dist/remote/client.js +0 -92
- package/dist/remote/examples/tui-controller.js +0 -263
- package/dist/remote/protocol.js +0 -55
- package/dist/remote/session-client.js +0 -189
- package/dist/sessions/bindings.js +0 -41
- /package/{.codex/skills → skills/builtin}/pi-agent-harness/agents/openai.yaml +0 -0
|
@@ -0,0 +1,649 @@
|
|
|
1
|
+
import { DatabaseSync } from "node:sqlite";
|
|
2
|
+
import { TelemetryStaleDetector } from "../core/telemetry-staleness.js";
|
|
3
|
+
import { TelemetryStore as PiboTelemetryStore } from "../data/telemetry.js";
|
|
4
|
+
import { formatRows, openReadOnlyDebugDatabase } from "./sql.js";
|
|
5
|
+
const DEFAULT_TELEMETRY_CLI_LIMIT = 20;
|
|
6
|
+
const MAX_TELEMETRY_CLI_LIMIT = 200;
|
|
7
|
+
const TELEMETRY_RETENTION_CLASSES = ["live", "diagnostic", "provider_event", "payload_preview", "incident"];
|
|
8
|
+
export function inspectTelemetrySessions(store, options = {}) {
|
|
9
|
+
const limit = parseTelemetryLimit(options.limit);
|
|
10
|
+
return withTelemetryStore(store, (telemetry) => {
|
|
11
|
+
const readLimit = options.active || options.stale ? MAX_TELEMETRY_CLI_LIMIT : limit;
|
|
12
|
+
const rows = telemetry.listSessions({ limit: readLimit })
|
|
13
|
+
.filter((row) => !options.active || row.status === "queued" || row.status === "running")
|
|
14
|
+
.filter((row) => !options.stale || row.isStale)
|
|
15
|
+
.slice(0, limit);
|
|
16
|
+
return {
|
|
17
|
+
available: true,
|
|
18
|
+
command: "sessions",
|
|
19
|
+
filters: { active: options.active === true, stale: options.stale === true },
|
|
20
|
+
limit,
|
|
21
|
+
rowCount: rows.length,
|
|
22
|
+
truncated: rows.length >= limit,
|
|
23
|
+
rows,
|
|
24
|
+
nextCommands: [
|
|
25
|
+
"pibo debug telemetry session <pibo-session-id>",
|
|
26
|
+
"pibo debug telemetry stale",
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export function inspectTelemetrySession(store, piboSessionId, options = {}) {
|
|
32
|
+
const limit = parseTelemetryLimit(options.limit);
|
|
33
|
+
return withTelemetryStore(store, (telemetry) => {
|
|
34
|
+
const detail = telemetry.getSessionTelemetry(piboSessionId, { limit });
|
|
35
|
+
if (!detail)
|
|
36
|
+
return notFound(`No telemetry found for Pibo Session ${piboSessionId}.`, piboSessionId);
|
|
37
|
+
return {
|
|
38
|
+
available: true,
|
|
39
|
+
command: "session",
|
|
40
|
+
piboSessionId,
|
|
41
|
+
limit,
|
|
42
|
+
truncated: {
|
|
43
|
+
recentTurns: detail.recentTurns.length >= limit,
|
|
44
|
+
providerRequests: detail.providerRequests.length >= limit,
|
|
45
|
+
toolCalls: detail.toolCalls.length >= limit,
|
|
46
|
+
},
|
|
47
|
+
detail,
|
|
48
|
+
nextCommands: detail.nextCommands,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export function inspectTelemetryTurn(store, turnIdOrEventId, options = {}) {
|
|
53
|
+
const limit = parseTelemetryLimit(options.limit);
|
|
54
|
+
return withTelemetryStore(store, (telemetry) => {
|
|
55
|
+
const timeline = telemetry.getTurnTimeline(turnIdOrEventId, { limit });
|
|
56
|
+
if (!timeline)
|
|
57
|
+
return notFound(`No telemetry found for turn or event ${turnIdOrEventId}.`, undefined, turnIdOrEventId);
|
|
58
|
+
const openPhases = timeline.phases.filter((phase) => phase.status === "open").length;
|
|
59
|
+
const missingTerminalEvent = timeline.turn.status === "running" && !timeline.phases.some((phase) => phase.name === "finish" && phase.status === "ok");
|
|
60
|
+
return {
|
|
61
|
+
available: true,
|
|
62
|
+
command: "turn",
|
|
63
|
+
turnIdOrEventId,
|
|
64
|
+
limit,
|
|
65
|
+
includeEventRefs: options.events === true,
|
|
66
|
+
truncated: {
|
|
67
|
+
phases: timeline.phases.length >= limit,
|
|
68
|
+
providerRequests: timeline.providerRequests.length >= limit,
|
|
69
|
+
toolCalls: timeline.toolCalls.length >= limit,
|
|
70
|
+
},
|
|
71
|
+
timeline,
|
|
72
|
+
openPhases,
|
|
73
|
+
missingTerminalEvent,
|
|
74
|
+
nextCommands: timeline.nextCommands,
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export function inspectTelemetryProvider(store, providerRequestId) {
|
|
79
|
+
return withTelemetryStore(store, (telemetry) => {
|
|
80
|
+
const request = telemetry.getProviderRequest(providerRequestId);
|
|
81
|
+
if (!request)
|
|
82
|
+
return notFound(`No telemetry found for provider request ${providerRequestId}.`);
|
|
83
|
+
return {
|
|
84
|
+
available: true,
|
|
85
|
+
command: "provider",
|
|
86
|
+
providerRequestId,
|
|
87
|
+
request,
|
|
88
|
+
eventTypeRows: providerEventTypeRows(request),
|
|
89
|
+
nextCommands: providerNextCommands(request),
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export function inspectTelemetryProviderEvents(store, providerRequestId, options = {}) {
|
|
94
|
+
const limit = parseTelemetryLimit(options.limit);
|
|
95
|
+
const afterSequence = parseTelemetryCursor(options.after);
|
|
96
|
+
return withTelemetryStore(store, (telemetry) => {
|
|
97
|
+
const request = telemetry.getProviderRequest(providerRequestId);
|
|
98
|
+
if (!request)
|
|
99
|
+
return notFound(`No telemetry found for provider request ${providerRequestId}.`);
|
|
100
|
+
const requestedFields = normalizeSafeFields(options.fields);
|
|
101
|
+
const page = telemetry.listProviderEventsPage(providerRequestId, { limit, afterSequence });
|
|
102
|
+
const rows = page.rows.map((row) => ({
|
|
103
|
+
...row,
|
|
104
|
+
selectedSafeFields: selectSafeFields(row.safeFields, requestedFields),
|
|
105
|
+
}));
|
|
106
|
+
return {
|
|
107
|
+
available: true,
|
|
108
|
+
command: "provider events",
|
|
109
|
+
providerRequestId,
|
|
110
|
+
limit,
|
|
111
|
+
afterSequence,
|
|
112
|
+
requestedFields,
|
|
113
|
+
page,
|
|
114
|
+
rows,
|
|
115
|
+
nextCommands: providerNextCommands(request, page.nextAfterSequence),
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
export function inspectTelemetryProviderPayload(store, providerRequestId, payloadRef) {
|
|
120
|
+
return withTelemetryStore(store, (telemetry) => {
|
|
121
|
+
const request = telemetry.getProviderRequest(providerRequestId);
|
|
122
|
+
if (!request)
|
|
123
|
+
return notFound(`No telemetry found for provider request ${providerRequestId}.`);
|
|
124
|
+
return {
|
|
125
|
+
available: true,
|
|
126
|
+
command: "provider payload",
|
|
127
|
+
providerRequestId,
|
|
128
|
+
payloadRef,
|
|
129
|
+
preview: telemetry.getPayloadPreview(payloadRef),
|
|
130
|
+
nextCommands: providerNextCommands(request),
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
export function inspectTelemetryTool(store, toolCallId) {
|
|
135
|
+
return withTelemetryStore(store, (telemetry) => {
|
|
136
|
+
const tool = telemetry.getToolCall(toolCallId);
|
|
137
|
+
if (!tool)
|
|
138
|
+
return notFound(`No telemetry found for tool call ${toolCallId}.`);
|
|
139
|
+
return {
|
|
140
|
+
available: true,
|
|
141
|
+
command: "tool",
|
|
142
|
+
toolCallId,
|
|
143
|
+
tool,
|
|
144
|
+
noExecutionStart: !tool.executionStartedAt,
|
|
145
|
+
nextCommands: toolNextCommands(tool),
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
export function inspectTelemetryStale(store, options = {}) {
|
|
150
|
+
const limit = parseTelemetryLimit(options.limit);
|
|
151
|
+
const thresholdOverrideMs = parseTelemetryThresholdMs(options.thresholdMs);
|
|
152
|
+
return withTelemetryStore(store, (telemetry) => {
|
|
153
|
+
const detector = new TelemetryStaleDetector(telemetry);
|
|
154
|
+
const rows = detector.listStaleWork({ limit, thresholdMs: thresholdOverrideMs });
|
|
155
|
+
return {
|
|
156
|
+
available: true,
|
|
157
|
+
command: "stale",
|
|
158
|
+
limit,
|
|
159
|
+
thresholdOverrideMs,
|
|
160
|
+
rowCount: rows.length,
|
|
161
|
+
rows,
|
|
162
|
+
nextCommands: ["pibo debug telemetry sessions --active", "pibo debug telemetry session <pibo-session-id>"],
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
export function inspectTelemetryStats(store, options = {}) {
|
|
167
|
+
const retentionClass = options.retention ? parseTelemetryRetentionClass(options.retention) : undefined;
|
|
168
|
+
return withTelemetryStore(store, (telemetry) => {
|
|
169
|
+
const stats = telemetry.getStats();
|
|
170
|
+
const filteredStats = retentionClass
|
|
171
|
+
? {
|
|
172
|
+
rows: stats.rows.filter((row) => row.retentionClass === retentionClass),
|
|
173
|
+
totalRows: stats.rows.filter((row) => row.retentionClass === retentionClass).reduce((sum, row) => sum + row.rowCount, 0),
|
|
174
|
+
totalBytes: stats.rows.filter((row) => row.retentionClass === retentionClass).reduce((sum, row) => sum + row.byteCount, 0),
|
|
175
|
+
}
|
|
176
|
+
: stats;
|
|
177
|
+
return {
|
|
178
|
+
available: true,
|
|
179
|
+
command: "stats",
|
|
180
|
+
retentionClass,
|
|
181
|
+
stats: filteredStats,
|
|
182
|
+
nextCommands: ["pibo debug telemetry prune --retention diagnostic --before <iso-date>", "pibo debug telemetry sessions --active"],
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
export function inspectTelemetryPrune(store, options = {}) {
|
|
187
|
+
if (!options.retention)
|
|
188
|
+
throw new Error("pibo debug telemetry prune requires --retention <class>");
|
|
189
|
+
if (!options.before)
|
|
190
|
+
throw new Error("pibo debug telemetry prune requires --before <iso-date>");
|
|
191
|
+
const retentionClass = parseTelemetryRetentionClass(options.retention);
|
|
192
|
+
const before = parseTelemetryBefore(options.before);
|
|
193
|
+
return withTelemetryStore(store, (telemetry) => {
|
|
194
|
+
const result = telemetry.prune({ retentionClass, before, apply: options.apply === true });
|
|
195
|
+
return {
|
|
196
|
+
available: true,
|
|
197
|
+
command: "prune",
|
|
198
|
+
retentionClass,
|
|
199
|
+
before,
|
|
200
|
+
dryRun: options.apply !== true,
|
|
201
|
+
result,
|
|
202
|
+
nextCommands: ["pibo debug telemetry stats", "pibo debug telemetry sessions --active"],
|
|
203
|
+
};
|
|
204
|
+
}, { readOnly: false });
|
|
205
|
+
}
|
|
206
|
+
export function formatTelemetrySessions(result) {
|
|
207
|
+
if (!result.available)
|
|
208
|
+
return formatUnavailable(result);
|
|
209
|
+
const rows = result.rows.map((row) => ({
|
|
210
|
+
piboSessionId: row.piboSessionId,
|
|
211
|
+
status: row.status,
|
|
212
|
+
activeTurnId: row.activeTurnId,
|
|
213
|
+
activePhase: formatPhaseRef(row.activePhase),
|
|
214
|
+
queueDepth: row.queueDepth,
|
|
215
|
+
lastProgressAt: row.lastProgressAt,
|
|
216
|
+
staleForMs: row.staleForMs,
|
|
217
|
+
isStale: row.isStale,
|
|
218
|
+
next: row.nextCommands[0],
|
|
219
|
+
}));
|
|
220
|
+
return [
|
|
221
|
+
"pibo debug telemetry sessions",
|
|
222
|
+
`filters\tactive=${result.filters.active}\tstale=${result.filters.stale}\tlimit=${result.limit}`,
|
|
223
|
+
formatRows(rows),
|
|
224
|
+
`truncated\t${result.truncated}`,
|
|
225
|
+
"Next:",
|
|
226
|
+
...result.nextCommands.map((command) => ` ${command}`),
|
|
227
|
+
].join("\n");
|
|
228
|
+
}
|
|
229
|
+
export function formatTelemetrySession(result) {
|
|
230
|
+
if (!result.available)
|
|
231
|
+
return formatUnavailable(result);
|
|
232
|
+
const detail = result.detail;
|
|
233
|
+
const activeTurn = detail.activeTurn;
|
|
234
|
+
const activePhase = detail.activePhase;
|
|
235
|
+
const providerRequestId = firstId(detail.providerRequests, "providerRequestId");
|
|
236
|
+
const toolCallId = firstId(detail.toolCalls, "toolCallId");
|
|
237
|
+
return [
|
|
238
|
+
`pibo debug telemetry session ${result.piboSessionId}`,
|
|
239
|
+
`status\t${activeTurn?.status ?? "idle"}`,
|
|
240
|
+
`queueDepth\t${activeTurn?.queueDepth ?? "-"}`,
|
|
241
|
+
`activeTurn\t${activeTurn?.turnId ?? "-"}`,
|
|
242
|
+
`activePhase\t${formatPhaseRef(activePhase)}`,
|
|
243
|
+
`lastProgressAt\t${activePhase?.lastProgressAt ?? activeTurn?.lastProgressAt ?? "-"}`,
|
|
244
|
+
`staleForMs\t${formatAgeMs(activePhase?.lastProgressAt ?? activeTurn?.lastProgressAt)}`,
|
|
245
|
+
`providerRequestId\t${providerRequestId ?? "-"}`,
|
|
246
|
+
`toolCallId\t${toolCallId ?? "-"}`,
|
|
247
|
+
"recent_turns:",
|
|
248
|
+
formatRows(detail.recentTurns.map(compactTurnRow)),
|
|
249
|
+
"providers:",
|
|
250
|
+
formatRows(detail.providerRequests.map(compactProviderRow)),
|
|
251
|
+
"tools:",
|
|
252
|
+
formatRows(detail.toolCalls.map(compactToolRow)),
|
|
253
|
+
`truncated\trecentTurns=${result.truncated.recentTurns}\tproviderRequests=${result.truncated.providerRequests}\ttoolCalls=${result.truncated.toolCalls}`,
|
|
254
|
+
"Next:",
|
|
255
|
+
...(result.nextCommands.length > 0 ? result.nextCommands.map((command) => ` ${command}`) : [" pibo debug telemetry sessions"]),
|
|
256
|
+
].join("\n");
|
|
257
|
+
}
|
|
258
|
+
export function formatTelemetryTurn(result) {
|
|
259
|
+
if (!result.available)
|
|
260
|
+
return formatUnavailable(result);
|
|
261
|
+
const timeline = result.timeline;
|
|
262
|
+
const phaseRows = timeline.phases.map((phase) => compactPhaseRow(phase, result.includeEventRefs));
|
|
263
|
+
return [
|
|
264
|
+
`pibo debug telemetry turn ${timeline.turn.turnId}`,
|
|
265
|
+
`session\t${timeline.turn.piboSessionId}`,
|
|
266
|
+
`status\t${timeline.turn.status}`,
|
|
267
|
+
`currentPhase\t${timeline.turn.currentPhase ?? "-"}`,
|
|
268
|
+
`openPhases\t${result.openPhases}`,
|
|
269
|
+
`missingTerminalEvent\t${result.missingTerminalEvent}`,
|
|
270
|
+
"phases:",
|
|
271
|
+
formatRows(phaseRows),
|
|
272
|
+
"providers:",
|
|
273
|
+
formatRows(timeline.providerRequests.map(compactProviderRow)),
|
|
274
|
+
"tools:",
|
|
275
|
+
formatRows(timeline.toolCalls.map(compactToolRow)),
|
|
276
|
+
`truncated\tphases=${result.truncated.phases}\tproviderRequests=${result.truncated.providerRequests}\ttoolCalls=${result.truncated.toolCalls}`,
|
|
277
|
+
"Next:",
|
|
278
|
+
...(result.nextCommands.length > 0 ? result.nextCommands.map((command) => ` ${command}`) : [` pibo debug telemetry session ${timeline.turn.piboSessionId}`]),
|
|
279
|
+
].join("\n");
|
|
280
|
+
}
|
|
281
|
+
export function formatTelemetryProvider(result) {
|
|
282
|
+
if (!result.available)
|
|
283
|
+
return formatUnavailable(result);
|
|
284
|
+
const request = result.request;
|
|
285
|
+
return [
|
|
286
|
+
`pibo debug telemetry provider ${result.providerRequestId}`,
|
|
287
|
+
`session\t${request.piboSessionId}`,
|
|
288
|
+
`turn\t${request.turnId}`,
|
|
289
|
+
`phase\t${request.phaseId ?? "-"}`,
|
|
290
|
+
`status\t${request.status}`,
|
|
291
|
+
`provider\t${request.provider}`,
|
|
292
|
+
`api\t${request.api}`,
|
|
293
|
+
`model\t${request.model}`,
|
|
294
|
+
`transport\t${request.transport}`,
|
|
295
|
+
`serviceTier\t${request.serviceTier ?? "-"}`,
|
|
296
|
+
`httpStatus\t${request.httpStatus ?? "-"}`,
|
|
297
|
+
`startedAt\t${request.startedAt}`,
|
|
298
|
+
`responseHeadersAt\t${request.responseHeadersAt ?? "-"}`,
|
|
299
|
+
`firstByteAt\t${request.firstByteAt ?? "-"}`,
|
|
300
|
+
`lastRawEventAt\t${request.lastRawEventAt ?? "-"}`,
|
|
301
|
+
`lastNormalizedEventAt\t${request.lastNormalizedEventAt ?? "-"}`,
|
|
302
|
+
`completedAt\t${request.completedAt ?? "-"}`,
|
|
303
|
+
`upstreamResponseId\t${request.upstreamResponseId ?? "-"}`,
|
|
304
|
+
`captureMode\t${request.captureMode}`,
|
|
305
|
+
`rawEventCount\t${request.rawEventCount}`,
|
|
306
|
+
`normalizedEventCount\t${request.normalizedEventCount}`,
|
|
307
|
+
`parseErrorCount\t${request.parseErrorCount}`,
|
|
308
|
+
`unknownEventCount\t${request.unknownEventCount}`,
|
|
309
|
+
`bytesReceived\t${request.bytesReceived ?? 0}`,
|
|
310
|
+
"event_types:",
|
|
311
|
+
formatRows(result.eventTypeRows),
|
|
312
|
+
"Next:",
|
|
313
|
+
...result.nextCommands.map((command) => ` ${command}`),
|
|
314
|
+
].join("\n");
|
|
315
|
+
}
|
|
316
|
+
export function formatTelemetryProviderEvents(result) {
|
|
317
|
+
if (!result.available)
|
|
318
|
+
return formatUnavailable(result);
|
|
319
|
+
return [
|
|
320
|
+
`pibo debug telemetry provider ${result.providerRequestId} events`,
|
|
321
|
+
`limit\t${result.limit}`,
|
|
322
|
+
`afterSequence\t${result.afterSequence}`,
|
|
323
|
+
`storageMode\t${result.page.storageMode}`,
|
|
324
|
+
`hasMore\t${result.page.hasMore}`,
|
|
325
|
+
`nextAfterSequence\t${result.page.nextAfterSequence ?? "-"}`,
|
|
326
|
+
`fields\t${result.requestedFields.length > 0 ? result.requestedFields.join(",") : "all-safe"}`,
|
|
327
|
+
formatRows(result.rows.map(compactProviderEventRow)),
|
|
328
|
+
`truncated\t${result.page.truncated}`,
|
|
329
|
+
"Next:",
|
|
330
|
+
...result.nextCommands.map((command) => ` ${command}`),
|
|
331
|
+
].join("\n");
|
|
332
|
+
}
|
|
333
|
+
export function formatTelemetryProviderPayload(result) {
|
|
334
|
+
if (!result.available)
|
|
335
|
+
return formatUnavailable(result);
|
|
336
|
+
return [
|
|
337
|
+
`pibo debug telemetry provider ${result.providerRequestId} payload ${result.payloadRef}`,
|
|
338
|
+
`status\t${result.preview.status}`,
|
|
339
|
+
`reason\t${result.preview.reason}`,
|
|
340
|
+
`captureMode\t${result.preview.captureMode}`,
|
|
341
|
+
result.preview.message,
|
|
342
|
+
"Next:",
|
|
343
|
+
...result.nextCommands.map((command) => ` ${command}`),
|
|
344
|
+
].join("\n");
|
|
345
|
+
}
|
|
346
|
+
export function formatTelemetryTool(result) {
|
|
347
|
+
if (!result.available)
|
|
348
|
+
return formatUnavailable(result);
|
|
349
|
+
const tool = result.tool;
|
|
350
|
+
return [
|
|
351
|
+
`pibo debug telemetry tool ${result.toolCallId}`,
|
|
352
|
+
`session\t${tool.piboSessionId}`,
|
|
353
|
+
`turn\t${tool.turnId}`,
|
|
354
|
+
`providerRequestId\t${tool.providerRequestId ?? "-"}`,
|
|
355
|
+
`toolName\t${tool.toolName}`,
|
|
356
|
+
`status\t${tool.status}`,
|
|
357
|
+
`argsBytes\t${tool.argsBytes}`,
|
|
358
|
+
`parseStatus\t${tool.parseStatus}`,
|
|
359
|
+
`safeArgKeys\t${tool.safeArgKeys.length > 0 ? tool.safeArgKeys.join(",") : "-"}`,
|
|
360
|
+
`argsStartedAt\t${tool.argsStartedAt ?? "-"}`,
|
|
361
|
+
`firstDeltaAt\t${tool.firstDeltaAt ?? "-"}`,
|
|
362
|
+
`lastDeltaAt\t${tool.lastDeltaAt ?? "-"}`,
|
|
363
|
+
`argsCompletedAt\t${tool.argsCompletedAt ?? "-"}`,
|
|
364
|
+
`executionStartedAt\t${tool.executionStartedAt ?? "-"}`,
|
|
365
|
+
`executionEndedAt\t${tool.executionEndedAt ?? "-"}`,
|
|
366
|
+
`durationMs\t${tool.durationMs ?? "-"}`,
|
|
367
|
+
`noExecutionStart\t${result.noExecutionStart}`,
|
|
368
|
+
`runId\t${tool.runId ?? "-"}`,
|
|
369
|
+
`errorCategory\t${tool.errorCategory ?? "-"}`,
|
|
370
|
+
`errorMessage\t${tool.errorMessage ?? "-"}`,
|
|
371
|
+
`eventId\t${tool.eventId ?? "-"}`,
|
|
372
|
+
`eventStreamId\t${tool.eventStreamId ?? "-"}`,
|
|
373
|
+
`payloadRef\t${tool.payloadRef ?? "-"}`,
|
|
374
|
+
"Next:",
|
|
375
|
+
...result.nextCommands.map((command) => ` ${command}`),
|
|
376
|
+
].join("\n");
|
|
377
|
+
}
|
|
378
|
+
export function formatTelemetryStale(result) {
|
|
379
|
+
if (!result.available)
|
|
380
|
+
return formatUnavailable(result);
|
|
381
|
+
return [
|
|
382
|
+
"pibo debug telemetry stale",
|
|
383
|
+
`limit\t${result.limit}`,
|
|
384
|
+
`thresholdOverrideMs\t${result.thresholdOverrideMs ?? "-"}`,
|
|
385
|
+
formatRows(result.rows.map(compactStaleRow)),
|
|
386
|
+
"Next:",
|
|
387
|
+
...result.nextCommands.map((command) => ` ${command}`),
|
|
388
|
+
].join("\n");
|
|
389
|
+
}
|
|
390
|
+
export function formatTelemetryStats(result) {
|
|
391
|
+
if (!result.available)
|
|
392
|
+
return formatUnavailable(result);
|
|
393
|
+
return [
|
|
394
|
+
"pibo debug telemetry stats",
|
|
395
|
+
`retentionClass\t${result.retentionClass ?? "all"}`,
|
|
396
|
+
`totalRows\t${result.stats.totalRows}`,
|
|
397
|
+
`totalBytes\t${result.stats.totalBytes}`,
|
|
398
|
+
formatRows(result.stats.rows),
|
|
399
|
+
"Next:",
|
|
400
|
+
...result.nextCommands.map((command) => ` ${command}`),
|
|
401
|
+
].join("\n");
|
|
402
|
+
}
|
|
403
|
+
export function formatTelemetryPrune(result) {
|
|
404
|
+
if (!result.available)
|
|
405
|
+
return formatUnavailable(result);
|
|
406
|
+
return [
|
|
407
|
+
"pibo debug telemetry prune",
|
|
408
|
+
`retentionClass\t${result.retentionClass}`,
|
|
409
|
+
`before\t${result.before}`,
|
|
410
|
+
`dryRun\t${result.dryRun}`,
|
|
411
|
+
formatRows([result.result]),
|
|
412
|
+
"Next:",
|
|
413
|
+
...result.nextCommands.map((command) => ` ${command}`),
|
|
414
|
+
].join("\n");
|
|
415
|
+
}
|
|
416
|
+
function withTelemetryStore(store, action, options = {}) {
|
|
417
|
+
if (!store.exists) {
|
|
418
|
+
return {
|
|
419
|
+
available: false,
|
|
420
|
+
reason: "store_missing",
|
|
421
|
+
message: `Debug store "${store.name}" not found at ${store.path}`,
|
|
422
|
+
nextCommands: ["pibo debug db stores"],
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
const db = options.readOnly === false ? openWritableDebugDatabase(store) : openReadOnlyDebugDatabase(store);
|
|
426
|
+
try {
|
|
427
|
+
const tables = db.prepare("SELECT name FROM sqlite_schema WHERE type = 'table' AND name LIKE 'telemetry_%'").all();
|
|
428
|
+
if (tables.length === 0) {
|
|
429
|
+
return {
|
|
430
|
+
available: false,
|
|
431
|
+
reason: "tables_missing",
|
|
432
|
+
message: "Telemetry tables are not present in pibo.sqlite; no telemetry is available for this store.",
|
|
433
|
+
nextCommands: ["pibo debug db schema pibo-data"],
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
return action(new PiboTelemetryStore(db));
|
|
437
|
+
}
|
|
438
|
+
finally {
|
|
439
|
+
db.close();
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
function openWritableDebugDatabase(store) {
|
|
443
|
+
if (!store.exists)
|
|
444
|
+
throw new Error(`Debug store "${store.name}" not found at ${store.path}`);
|
|
445
|
+
const db = new DatabaseSync(store.path);
|
|
446
|
+
db.exec("PRAGMA busy_timeout = 5000");
|
|
447
|
+
return db;
|
|
448
|
+
}
|
|
449
|
+
function parseTelemetryLimit(value) {
|
|
450
|
+
if (value === undefined)
|
|
451
|
+
return DEFAULT_TELEMETRY_CLI_LIMIT;
|
|
452
|
+
const parsed = Number(value);
|
|
453
|
+
if (!Number.isInteger(parsed) || parsed < 1)
|
|
454
|
+
throw new Error("Limit must be a positive integer");
|
|
455
|
+
return Math.min(parsed, MAX_TELEMETRY_CLI_LIMIT);
|
|
456
|
+
}
|
|
457
|
+
function parseTelemetryThresholdMs(value) {
|
|
458
|
+
if (value === undefined)
|
|
459
|
+
return undefined;
|
|
460
|
+
const parsed = Number(value);
|
|
461
|
+
if (!Number.isInteger(parsed) || parsed < 1)
|
|
462
|
+
throw new Error("--threshold-ms must be a positive integer");
|
|
463
|
+
return parsed;
|
|
464
|
+
}
|
|
465
|
+
function parseTelemetryRetentionClass(value) {
|
|
466
|
+
if (TELEMETRY_RETENTION_CLASSES.includes(value))
|
|
467
|
+
return value;
|
|
468
|
+
throw new Error(`Unknown telemetry retention class "${value}". Use one of: ${TELEMETRY_RETENTION_CLASSES.join(", ")}`);
|
|
469
|
+
}
|
|
470
|
+
function parseTelemetryBefore(value) {
|
|
471
|
+
if (!Number.isFinite(Date.parse(value)))
|
|
472
|
+
throw new Error("--before must be a valid ISO date/time");
|
|
473
|
+
return value;
|
|
474
|
+
}
|
|
475
|
+
function notFound(message, piboSessionId, turnId) {
|
|
476
|
+
return {
|
|
477
|
+
available: false,
|
|
478
|
+
reason: "not_found",
|
|
479
|
+
message,
|
|
480
|
+
nextCommands: [
|
|
481
|
+
piboSessionId ? `pibo debug session ${piboSessionId}` : undefined,
|
|
482
|
+
turnId ? "pibo debug telemetry sessions" : undefined,
|
|
483
|
+
"pibo debug events <pibo-session-id> --limit 20",
|
|
484
|
+
].filter((command) => typeof command === "string"),
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
function formatUnavailable(result) {
|
|
488
|
+
return [
|
|
489
|
+
result.message,
|
|
490
|
+
"Next:",
|
|
491
|
+
...result.nextCommands.map((command) => ` ${command}`),
|
|
492
|
+
].join("\n");
|
|
493
|
+
}
|
|
494
|
+
function compactTurnRow(turn) {
|
|
495
|
+
return {
|
|
496
|
+
turnId: turn.turnId,
|
|
497
|
+
status: turn.status,
|
|
498
|
+
currentPhase: turn.currentPhase,
|
|
499
|
+
queuedAt: turn.queuedAt,
|
|
500
|
+
startedAt: turn.startedAt,
|
|
501
|
+
completedAt: turn.completedAt,
|
|
502
|
+
lastProgressAt: turn.lastProgressAt,
|
|
503
|
+
queueDepth: turn.queueDepth,
|
|
504
|
+
next: `pibo debug telemetry turn ${turn.turnId}`,
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
function compactPhaseRow(phase, includeEventRefs) {
|
|
508
|
+
return {
|
|
509
|
+
phaseId: phase.phaseId,
|
|
510
|
+
name: phase.name,
|
|
511
|
+
status: phase.status,
|
|
512
|
+
startedAt: phase.startedAt,
|
|
513
|
+
endedAt: phase.endedAt ?? "open",
|
|
514
|
+
durationMs: phase.durationMs,
|
|
515
|
+
lastProgressAt: phase.lastProgressAt,
|
|
516
|
+
staleForMs: formatAgeMs(phase.lastProgressAt ?? phase.startedAt),
|
|
517
|
+
providerRequestId: phase.providerRequestId,
|
|
518
|
+
toolCallId: phase.toolCallId,
|
|
519
|
+
...(includeEventRefs ? { eventId: phase.eventId, eventStreamId: phase.eventStreamId, payloadRef: phase.payloadRef } : {}),
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
function compactProviderRow(provider) {
|
|
523
|
+
return {
|
|
524
|
+
providerRequestId: provider.providerRequestId,
|
|
525
|
+
status: provider.status,
|
|
526
|
+
provider: provider.provider,
|
|
527
|
+
api: provider.api,
|
|
528
|
+
model: provider.model,
|
|
529
|
+
firstByteAt: provider.firstByteAt,
|
|
530
|
+
lastRawEventAt: provider.lastRawEventAt,
|
|
531
|
+
lastNormalizedEventAt: provider.lastNormalizedEventAt,
|
|
532
|
+
rawEventCount: provider.rawEventCount,
|
|
533
|
+
parseErrorCount: provider.parseErrorCount,
|
|
534
|
+
unknownEventCount: provider.unknownEventCount,
|
|
535
|
+
next: `pibo debug telemetry provider ${provider.providerRequestId}`,
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function compactProviderEventRow(event) {
|
|
539
|
+
return {
|
|
540
|
+
sequence: event.sequence,
|
|
541
|
+
rawEventId: event.rawEventId,
|
|
542
|
+
receivedAt: event.receivedAt,
|
|
543
|
+
eventType: event.eventType,
|
|
544
|
+
byteSize: event.byteSize,
|
|
545
|
+
parseStatus: event.parseStatus,
|
|
546
|
+
normalizedType: event.normalizedType,
|
|
547
|
+
itemId: event.itemId,
|
|
548
|
+
toolCallId: event.toolCallId,
|
|
549
|
+
eventId: event.eventId,
|
|
550
|
+
eventStreamId: event.eventStreamId,
|
|
551
|
+
payloadPreviewRef: event.payloadPreviewRef,
|
|
552
|
+
safeFields: formatSafeFields(event.selectedSafeFields),
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
function compactStaleRow(item) {
|
|
556
|
+
return {
|
|
557
|
+
piboSessionId: item.piboSessionId,
|
|
558
|
+
turnId: item.turnId,
|
|
559
|
+
activePhase: item.activePhase ?? item.phase,
|
|
560
|
+
staleForMs: item.staleForMs,
|
|
561
|
+
lastProgressAt: item.lastProgressAt,
|
|
562
|
+
queueDepth: item.queueDepth,
|
|
563
|
+
appliedThresholdMs: item.appliedThresholdMs,
|
|
564
|
+
thresholdSource: item.thresholdSource,
|
|
565
|
+
thresholdKey: item.thresholdKey,
|
|
566
|
+
provider: item.provider,
|
|
567
|
+
model: item.model,
|
|
568
|
+
profile: item.profile,
|
|
569
|
+
next: item.nextCommands[0],
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
function compactToolRow(tool) {
|
|
573
|
+
return {
|
|
574
|
+
toolCallId: tool.toolCallId,
|
|
575
|
+
status: tool.status,
|
|
576
|
+
toolName: tool.toolName,
|
|
577
|
+
argsBytes: tool.argsBytes,
|
|
578
|
+
parseStatus: tool.parseStatus,
|
|
579
|
+
argsCompletedAt: tool.argsCompletedAt,
|
|
580
|
+
executionStartedAt: tool.executionStartedAt,
|
|
581
|
+
executionEndedAt: tool.executionEndedAt,
|
|
582
|
+
next: `pibo debug telemetry tool ${tool.toolCallId}`,
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
function formatPhaseRef(phase) {
|
|
586
|
+
return phase ? `${phase.name}:${phase.status}` : "-";
|
|
587
|
+
}
|
|
588
|
+
function formatAgeMs(timestamp) {
|
|
589
|
+
if (!timestamp)
|
|
590
|
+
return "-";
|
|
591
|
+
const parsed = Date.parse(timestamp);
|
|
592
|
+
if (!Number.isFinite(parsed))
|
|
593
|
+
return "-";
|
|
594
|
+
return Math.max(0, Date.now() - parsed);
|
|
595
|
+
}
|
|
596
|
+
function firstId(items, key) {
|
|
597
|
+
return items.length > 0 ? items[0]?.[key] : undefined;
|
|
598
|
+
}
|
|
599
|
+
function parseTelemetryCursor(value) {
|
|
600
|
+
if (value === undefined)
|
|
601
|
+
return -1;
|
|
602
|
+
const parsed = Number(value);
|
|
603
|
+
if (!Number.isInteger(parsed) || parsed < 0)
|
|
604
|
+
throw new Error("--after must be a non-negative provider event sequence");
|
|
605
|
+
return parsed;
|
|
606
|
+
}
|
|
607
|
+
const SAFE_FIELD_NAME_PATTERN = /^[A-Za-z0-9_.:-]{1,128}$/;
|
|
608
|
+
function normalizeSafeFields(fields) {
|
|
609
|
+
return [...new Set((fields ?? []).filter((field) => SAFE_FIELD_NAME_PATTERN.test(field)))];
|
|
610
|
+
}
|
|
611
|
+
function selectSafeFields(value, requestedFields) {
|
|
612
|
+
const selected = {};
|
|
613
|
+
const entries = requestedFields.length > 0
|
|
614
|
+
? requestedFields.map((field) => [field, value[field]])
|
|
615
|
+
: Object.entries(value).slice(0, 20);
|
|
616
|
+
for (const [key, raw] of entries) {
|
|
617
|
+
if (typeof raw === "string" || typeof raw === "number" || typeof raw === "boolean" || raw === null)
|
|
618
|
+
selected[key] = raw;
|
|
619
|
+
}
|
|
620
|
+
return selected;
|
|
621
|
+
}
|
|
622
|
+
function formatSafeFields(value) {
|
|
623
|
+
const entries = Object.entries(value);
|
|
624
|
+
if (entries.length === 0)
|
|
625
|
+
return "-";
|
|
626
|
+
return entries.map(([key, raw]) => `${key}=${String(raw)}`).join(",");
|
|
627
|
+
}
|
|
628
|
+
function providerEventTypeRows(provider) {
|
|
629
|
+
return Object.entries(provider.eventTypeCounts)
|
|
630
|
+
.filter((entry) => typeof entry[1] === "number")
|
|
631
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
632
|
+
.map(([eventType, count]) => ({ eventType, count }));
|
|
633
|
+
}
|
|
634
|
+
function providerNextCommands(provider, nextAfterSequence) {
|
|
635
|
+
return [
|
|
636
|
+
`pibo debug telemetry turn ${provider.turnId}`,
|
|
637
|
+
`pibo debug telemetry provider ${provider.providerRequestId} events --limit 20`,
|
|
638
|
+
typeof nextAfterSequence === "number" ? `pibo debug telemetry provider ${provider.providerRequestId} events --after ${nextAfterSequence} --limit 20` : undefined,
|
|
639
|
+
`pibo debug telemetry session ${provider.piboSessionId}`,
|
|
640
|
+
].filter((command) => typeof command === "string");
|
|
641
|
+
}
|
|
642
|
+
function toolNextCommands(tool) {
|
|
643
|
+
return [
|
|
644
|
+
`pibo debug telemetry turn ${tool.turnId}`,
|
|
645
|
+
tool.providerRequestId ? `pibo debug telemetry provider ${tool.providerRequestId}` : undefined,
|
|
646
|
+
tool.providerRequestId ? `pibo debug telemetry provider ${tool.providerRequestId} events --limit 20` : undefined,
|
|
647
|
+
`pibo debug telemetry session ${tool.piboSessionId}`,
|
|
648
|
+
].filter((command) => typeof command === "string");
|
|
649
|
+
}
|