@pasko70/pibo 1.1.0 → 1.3.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 -254
- 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 +18 -3
- 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 +7 -2
- 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 +3131 -1959
- 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-CNLWH2qh.js → dist-B4lw9z4F.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-8e4L8ciw.js → dist-BbTaHWON.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CMZOa5ik.js → dist-BcT_c1EJ.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DNcnQRPF.js → dist-CGINd7XU.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CqqUC8Ce.js → dist-CrBzZkUp.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-D2N4-LIc.js → dist-CyyISotB.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CUqpST5w.js → dist-DFbnFNpX.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CspjOeBj.js → dist-DGLWQLX8.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-B7bbI3Qz.js → dist-DfcIkFSN.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-v4pjHlB7.js → dist-sKDHTwaT.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-D9L4MSRF.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/chat-vscode-web/assets/index-B5QK07zO.css +2 -0
- package/dist/apps/chat-vscode-web/assets/index-C3GTPyDo.js +41 -0
- package/dist/apps/chat-vscode-web/index.html +14 -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/apps/vscode-artifacts/latest.vsix +0 -0
- package/dist/apps/vscode-artifacts/pibo-vscode-1.3.0.vsix +0 -0
- 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 +159 -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 +172 -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 +251 -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 +49 -1
- 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 +39 -36
- package/dist/user-skills/store.js +50 -11
- package/dist/vscode/cli.js +90 -0
- package/dist/vscode/code-cli.js +119 -0
- package/dist/vscode/install.js +177 -0
- package/dist/vscode/status.js +80 -0
- package/dist/vscode/types.js +14 -0
- package/dist/vscode/uninstall.js +49 -0
- package/dist/vscode/vsix-fetcher.js +131 -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/docs/ops/vscode-extension-release.md +138 -0
- package/package.json +24 -9
- package/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-D2Qxambd.js +0 -151
- package/dist/apps/chat-ui/assets/index-DXx368XK.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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { piboHomePath } from "../core/pibo-home.js";
|
|
3
|
+
function gatewayPidPath() {
|
|
4
|
+
return piboHomePath("gateway.pid");
|
|
5
|
+
}
|
|
6
|
+
function fallbackGatewayPidPath() {
|
|
7
|
+
return piboHomePath("gateway-fallback.pid");
|
|
8
|
+
}
|
|
9
|
+
export function readPidFile() {
|
|
10
|
+
try {
|
|
11
|
+
const path = gatewayPidPath();
|
|
12
|
+
if (!existsSync(path))
|
|
13
|
+
return undefined;
|
|
14
|
+
const pid = parseInt(readFileSync(path, "utf-8").trim(), 10);
|
|
15
|
+
if (Number.isNaN(pid))
|
|
16
|
+
return undefined;
|
|
17
|
+
try {
|
|
18
|
+
process.kill(pid, 0);
|
|
19
|
+
return pid;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function clearPidFile() {
|
|
30
|
+
try {
|
|
31
|
+
const path = gatewayPidPath();
|
|
32
|
+
if (existsSync(path)) {
|
|
33
|
+
unlinkSync(path);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// ignore
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function writeGatewayPid() {
|
|
41
|
+
const existingPid = readPidFile();
|
|
42
|
+
if (existingPid !== undefined && existingPid !== process.pid) {
|
|
43
|
+
throw new Error(`Gateway already running (PID ${existingPid})`);
|
|
44
|
+
}
|
|
45
|
+
writeFileSync(gatewayPidPath(), String(process.pid), "utf-8");
|
|
46
|
+
}
|
|
47
|
+
export function readFallbackPidFile() {
|
|
48
|
+
try {
|
|
49
|
+
const path = fallbackGatewayPidPath();
|
|
50
|
+
if (!existsSync(path))
|
|
51
|
+
return undefined;
|
|
52
|
+
const pid = parseInt(readFileSync(path, "utf-8").trim(), 10);
|
|
53
|
+
if (Number.isNaN(pid))
|
|
54
|
+
return undefined;
|
|
55
|
+
try {
|
|
56
|
+
process.kill(pid, 0);
|
|
57
|
+
return pid;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export function clearFallbackPidFile() {
|
|
68
|
+
try {
|
|
69
|
+
const path = fallbackGatewayPidPath();
|
|
70
|
+
if (existsSync(path)) {
|
|
71
|
+
unlinkSync(path);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// ignore
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export function writeFallbackGatewayPid() {
|
|
79
|
+
const existingPid = readFallbackPidFile();
|
|
80
|
+
if (existingPid !== undefined && existingPid !== process.pid) {
|
|
81
|
+
throw new Error(`Fallback gateway already running (PID ${existingPid})`);
|
|
82
|
+
}
|
|
83
|
+
writeFileSync(fallbackGatewayPidPath(), String(process.pid), "utf-8");
|
|
84
|
+
}
|
package/dist/gateway/protocol.js
CHANGED
|
@@ -33,6 +33,22 @@ export function isGatewayRequestFrame(value) {
|
|
|
33
33
|
}
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
|
+
export function isGatewaySubscribeFrame(value) {
|
|
37
|
+
if (!value || typeof value !== "object")
|
|
38
|
+
return false;
|
|
39
|
+
const frame = value;
|
|
40
|
+
if (frame.type !== "subscribe" || typeof frame.id !== "string")
|
|
41
|
+
return false;
|
|
42
|
+
if (!frame.subscription || typeof frame.subscription !== "object")
|
|
43
|
+
return false;
|
|
44
|
+
const subscription = frame.subscription;
|
|
45
|
+
if (subscription.type === "legacy-all")
|
|
46
|
+
return true;
|
|
47
|
+
if (subscription.type === "session") {
|
|
48
|
+
return typeof subscription.piboSessionId === "string" && subscription.piboSessionId.length > 0;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
36
52
|
export function encodeFrame(frame) {
|
|
37
53
|
return `${JSON.stringify(frame)}\n`;
|
|
38
54
|
}
|
package/dist/gateway/server.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { createServer } from "node:net";
|
|
2
|
-
import { createDefaultPiboPluginRegistry } from "../plugins/builtin.js";
|
|
2
|
+
import { createDefaultPiboPluginRegistry, createPiboProfileFromRegistryOrDefault, resolvePiboProfileNameFromRegistryOrDefault } from "../plugins/builtin.js";
|
|
3
3
|
import { PiboSessionRouter } from "../core/session-router.js";
|
|
4
|
-
import {
|
|
4
|
+
import { loadPiboModelDefaults, selectRequestedModelProfile } from "../core/model-defaults.js";
|
|
5
|
+
import { DEFAULT_GATEWAY_HOST, DEFAULT_GATEWAY_PORT, encodeFrame, errorResponse, isGatewayRequestFrame, isGatewaySubscribeFrame, } from "./protocol.js";
|
|
6
|
+
import { clearFallbackPidFile, clearPidFile, writeFallbackGatewayPid, writeGatewayPid } from "./pidfile.js";
|
|
7
|
+
const DEFAULT_MAX_BACKPRESSURE_FRAMES = 1_000;
|
|
8
|
+
const DEFAULT_MAX_BACKPRESSURE_BYTES = 4 * 1024 * 1024;
|
|
5
9
|
function parseJsonLine(line) {
|
|
6
10
|
try {
|
|
7
11
|
return JSON.parse(line);
|
|
@@ -10,21 +14,110 @@ function parseJsonLine(line) {
|
|
|
10
14
|
throw new Error("Invalid JSON frame");
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
17
|
+
function classifyGatewayEvent(event) {
|
|
18
|
+
if (event.type === "assistant_delta" || event.type === "thinking_delta" || event.type === "tool_execution_updated") {
|
|
19
|
+
return "live-delta";
|
|
20
|
+
}
|
|
21
|
+
if (event.type === "pi_event")
|
|
22
|
+
return "debug";
|
|
23
|
+
if (event.type === "session_error" || event.type === "execution_result" || event.type.endsWith("_finished")) {
|
|
24
|
+
return "critical";
|
|
25
|
+
}
|
|
26
|
+
return "structural";
|
|
27
|
+
}
|
|
28
|
+
function isDroppableRouterEvent(event) {
|
|
29
|
+
const eventClass = classifyGatewayEvent(event);
|
|
30
|
+
return eventClass === "live-delta" || eventClass === "debug";
|
|
31
|
+
}
|
|
32
|
+
function createConnection(socket, options) {
|
|
33
|
+
const queue = [];
|
|
34
|
+
const diagnostics = {
|
|
35
|
+
slow: false,
|
|
36
|
+
queuedFrames: 0,
|
|
37
|
+
queuedBytes: 0,
|
|
38
|
+
droppedEvents: 0,
|
|
39
|
+
closedForBackpressure: false,
|
|
40
|
+
subscription: { type: "legacy-all" },
|
|
41
|
+
};
|
|
42
|
+
function syncDiagnostics() {
|
|
43
|
+
diagnostics.queuedFrames = queue.length;
|
|
44
|
+
diagnostics.queuedBytes = queue.reduce((sum, item) => sum + item.bytes, 0);
|
|
45
|
+
}
|
|
46
|
+
function recordDroppedEvent() {
|
|
47
|
+
diagnostics.droppedEvents += 1;
|
|
48
|
+
options.onDroppedEvent();
|
|
49
|
+
}
|
|
50
|
+
function closeForBackpressure() {
|
|
51
|
+
if (!diagnostics.closedForBackpressure) {
|
|
52
|
+
diagnostics.closedForBackpressure = true;
|
|
53
|
+
options.onClosedForBackpressure();
|
|
54
|
+
}
|
|
55
|
+
socket.destroy(new Error("Gateway client closed because its send backlog exceeded the backpressure limit"));
|
|
56
|
+
}
|
|
57
|
+
function tryFlush() {
|
|
58
|
+
if (socket.destroyed)
|
|
59
|
+
return;
|
|
60
|
+
diagnostics.slow = false;
|
|
61
|
+
while (queue.length > 0) {
|
|
62
|
+
const next = queue[0];
|
|
63
|
+
const accepted = socket.write(encodeFrame(next.frame));
|
|
64
|
+
queue.shift();
|
|
65
|
+
syncDiagnostics();
|
|
66
|
+
if (!accepted) {
|
|
67
|
+
diagnostics.slow = true;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
socket.on("drain", tryFlush);
|
|
73
|
+
const connection = {
|
|
15
74
|
socket,
|
|
16
|
-
|
|
75
|
+
subscription: diagnostics.subscription,
|
|
76
|
+
diagnostics,
|
|
77
|
+
send(frame, sendOptions = {}) {
|
|
17
78
|
if (socket.destroyed)
|
|
18
79
|
return;
|
|
19
|
-
|
|
80
|
+
const encoded = encodeFrame(frame);
|
|
81
|
+
if (!diagnostics.slow && queue.length === 0) {
|
|
82
|
+
const accepted = socket.write(encoded);
|
|
83
|
+
if (accepted)
|
|
84
|
+
return;
|
|
85
|
+
diagnostics.slow = true;
|
|
86
|
+
}
|
|
87
|
+
const queued = { frame, bytes: Buffer.byteLength(encoded), droppable: sendOptions.droppable === true };
|
|
88
|
+
if (queued.droppable && (queue.length >= options.maxBackpressureFrames || diagnostics.queuedBytes + queued.bytes > options.maxBackpressureBytes)) {
|
|
89
|
+
recordDroppedEvent();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
queue.push(queued);
|
|
93
|
+
syncDiagnostics();
|
|
94
|
+
if (queue.length > options.maxBackpressureFrames || diagnostics.queuedBytes > options.maxBackpressureBytes) {
|
|
95
|
+
const dropIndex = queue.findIndex((item) => item.droppable);
|
|
96
|
+
if (dropIndex >= 0) {
|
|
97
|
+
queue.splice(dropIndex, 1);
|
|
98
|
+
recordDroppedEvent();
|
|
99
|
+
syncDiagnostics();
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
closeForBackpressure();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
matches(event) {
|
|
107
|
+
if (connection.subscription.type === "legacy-all")
|
|
108
|
+
return true;
|
|
109
|
+
return event.piboSessionId === connection.subscription.piboSessionId;
|
|
20
110
|
},
|
|
21
111
|
};
|
|
112
|
+
return connection;
|
|
22
113
|
}
|
|
23
114
|
async function createGatewaySessionStore(options) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
115
|
+
if (options.sessionDbPath) {
|
|
116
|
+
const { SqlitePiboSessionStore } = await import("../sessions/sqlite-store.js");
|
|
117
|
+
return new SqlitePiboSessionStore(options.sessionDbPath);
|
|
118
|
+
}
|
|
119
|
+
const { createDefaultPiboDataSessionStore } = await import("../sessions/pibo-data-store.js");
|
|
120
|
+
return createDefaultPiboDataSessionStore();
|
|
28
121
|
}
|
|
29
122
|
export class PiboGatewayServer {
|
|
30
123
|
options;
|
|
@@ -34,6 +127,8 @@ export class PiboGatewayServer {
|
|
|
34
127
|
router;
|
|
35
128
|
startedChannels = [];
|
|
36
129
|
connections = new Set();
|
|
130
|
+
droppedRouterEvents = 0;
|
|
131
|
+
closedSlowClients = 0;
|
|
37
132
|
server;
|
|
38
133
|
unsubscribe;
|
|
39
134
|
constructor(options = {}) {
|
|
@@ -89,7 +184,16 @@ export class PiboGatewayServer {
|
|
|
89
184
|
this.ownsSessionStore = false;
|
|
90
185
|
}
|
|
91
186
|
handleSocket(socket) {
|
|
92
|
-
const connection = createConnection(socket
|
|
187
|
+
const connection = createConnection(socket, {
|
|
188
|
+
maxBackpressureFrames: this.options.maxBackpressureFrames ?? DEFAULT_MAX_BACKPRESSURE_FRAMES,
|
|
189
|
+
maxBackpressureBytes: this.options.maxBackpressureBytes ?? DEFAULT_MAX_BACKPRESSURE_BYTES,
|
|
190
|
+
onDroppedEvent: () => {
|
|
191
|
+
this.droppedRouterEvents += 1;
|
|
192
|
+
},
|
|
193
|
+
onClosedForBackpressure: () => {
|
|
194
|
+
this.closedSlowClients += 1;
|
|
195
|
+
},
|
|
196
|
+
});
|
|
93
197
|
this.connections.add(connection);
|
|
94
198
|
let buffer = "";
|
|
95
199
|
socket.setEncoding("utf-8");
|
|
@@ -116,14 +220,21 @@ export class PiboGatewayServer {
|
|
|
116
220
|
let frame;
|
|
117
221
|
try {
|
|
118
222
|
frame = parseJsonLine(line);
|
|
119
|
-
if (!isGatewayRequestFrame(frame)) {
|
|
120
|
-
throw new Error("Invalid request frame");
|
|
121
|
-
}
|
|
122
223
|
}
|
|
123
224
|
catch (error) {
|
|
124
225
|
connection.send(errorResponse("invalid", error));
|
|
125
226
|
return;
|
|
126
227
|
}
|
|
228
|
+
if (isGatewaySubscribeFrame(frame)) {
|
|
229
|
+
connection.subscription = frame.subscription;
|
|
230
|
+
connection.diagnostics.subscription = frame.subscription;
|
|
231
|
+
connection.send({ type: "res", id: frame.id, ok: true, payload: { subscription: frame.subscription } });
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (!isGatewayRequestFrame(frame)) {
|
|
235
|
+
connection.send(errorResponse("invalid", new Error("Invalid request frame")));
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
127
238
|
try {
|
|
128
239
|
const output = await this.requireRouter().emit(frame.event);
|
|
129
240
|
const response = {
|
|
@@ -140,9 +251,21 @@ export class PiboGatewayServer {
|
|
|
140
251
|
}
|
|
141
252
|
broadcastRouterEvent(event) {
|
|
142
253
|
for (const connection of this.connections) {
|
|
143
|
-
connection.
|
|
254
|
+
if (!connection.matches(event))
|
|
255
|
+
continue;
|
|
256
|
+
connection.send({ type: "event", event: "router", payload: event }, { droppable: isDroppableRouterEvent(event) });
|
|
144
257
|
}
|
|
145
258
|
}
|
|
259
|
+
getDiagnostics() {
|
|
260
|
+
const connectionDetails = [...this.connections].map((connection) => ({ ...connection.diagnostics }));
|
|
261
|
+
return {
|
|
262
|
+
connections: connectionDetails.length,
|
|
263
|
+
slowConnections: connectionDetails.filter((connection) => connection.slow).length,
|
|
264
|
+
droppedEvents: this.droppedRouterEvents,
|
|
265
|
+
closedSlowClients: this.closedSlowClients,
|
|
266
|
+
connectionDetails,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
146
269
|
async startChannels() {
|
|
147
270
|
const context = this.createChannelContext();
|
|
148
271
|
for (const channel of this.pluginRegistry.getChannels()) {
|
|
@@ -172,16 +295,29 @@ export class PiboGatewayServer {
|
|
|
172
295
|
subscribe: (listener) => this.requireRouter().subscribe(listener),
|
|
173
296
|
getSession: (id) => this.requireSessionStore().get(id),
|
|
174
297
|
createSession: (input) => {
|
|
175
|
-
const profile = this.pluginRegistry
|
|
176
|
-
|
|
298
|
+
const profile = resolvePiboProfileNameFromRegistryOrDefault(this.pluginRegistry, input.profile);
|
|
299
|
+
const profileContext = createPiboProfileFromRegistryOrDefault(this.pluginRegistry, profile);
|
|
300
|
+
const activeModel = input.activeModel ?? selectRequestedModelProfile(profileContext, loadPiboModelDefaults());
|
|
301
|
+
return this.requireSessionStore().create({ ...input, profile, activeModel });
|
|
177
302
|
},
|
|
178
303
|
updateSession: (id, input) => this.requireSessionStore().update(id, input),
|
|
304
|
+
setLiveSessionActiveModel: (id, model) => this.requireRouter().setLiveSessionActiveModel(id, model),
|
|
305
|
+
reportSessionError: (id, error, options) => this.requireRouter().reportSessionError(id, error, options),
|
|
179
306
|
deleteSession: (id) => this.requireSessionStore().delete?.(id) ?? false,
|
|
180
307
|
findSessions: (input) => this.requireSessionStore().find(input),
|
|
181
308
|
listSessions: () => this.requireSessionStore().list?.() ?? [],
|
|
309
|
+
getSessionRuntimeStatus: (piboSessionId) => this.requireRouter().getSessionRuntimeStatus(piboSessionId),
|
|
310
|
+
listSessionRuntimeStatuses: () => this.requireRouter().listSessionRuntimeStatuses(),
|
|
311
|
+
listRuns: (options) => this.requireRouter().listRuns(options),
|
|
312
|
+
snapshotSignalSession: (piboSessionId) => this.requireRouter().snapshotSignalSession(piboSessionId),
|
|
313
|
+
snapshotSignalTree: (rootPiboSessionId) => this.requireRouter().snapshotSignalTree(rootPiboSessionId),
|
|
314
|
+
subscribeSignalTree: (rootPiboSessionId, listener) => this.requireRouter().subscribeSignalTree(rootPiboSessionId, listener),
|
|
182
315
|
getGatewayActions: () => this.pluginRegistry.getGatewayActionInfos(),
|
|
183
316
|
getProfiles: () => this.pluginRegistry.getProfileInfos(),
|
|
317
|
+
createProfile: (name) => this.pluginRegistry.createProfile(name),
|
|
184
318
|
getCapabilityCatalog: () => this.pluginRegistry.getCapabilityCatalog(),
|
|
319
|
+
getRalphStopConditionDefinitions: () => this.pluginRegistry.getRalphStopConditionDefinitions(),
|
|
320
|
+
getRalphStopConditionInfos: () => this.pluginRegistry.getRalphStopConditionInfos(),
|
|
185
321
|
upsertProfile: (profile) => this.pluginRegistry.upsertProfile(profile),
|
|
186
322
|
removeProfile: (name) => this.pluginRegistry.removeProfile(name),
|
|
187
323
|
upsertContextFile: (contextFile) => this.pluginRegistry.upsertContextFile(contextFile),
|
|
@@ -208,11 +344,30 @@ export class PiboGatewayServer {
|
|
|
208
344
|
export async function runGatewayServer(options = {}) {
|
|
209
345
|
const server = new PiboGatewayServer(options);
|
|
210
346
|
await server.start();
|
|
347
|
+
try {
|
|
348
|
+
if (process.env.PIBO_FALLBACK_MODE === "1") {
|
|
349
|
+
writeFallbackGatewayPid();
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
writeGatewayPid();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
catch (err) {
|
|
356
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
357
|
+
await server.stop();
|
|
358
|
+
process.exit(1);
|
|
359
|
+
}
|
|
211
360
|
const host = options.host ?? DEFAULT_GATEWAY_HOST;
|
|
212
361
|
const port = options.port ?? DEFAULT_GATEWAY_PORT;
|
|
213
362
|
console.error(`pibo gateway listening on ${host}:${port}`);
|
|
214
363
|
const stop = async () => {
|
|
215
364
|
await server.stop();
|
|
365
|
+
if (process.env.PIBO_FALLBACK_MODE === "1") {
|
|
366
|
+
clearFallbackPidFile();
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
clearPidFile();
|
|
370
|
+
}
|
|
216
371
|
};
|
|
217
372
|
process.once("SIGINT", () => {
|
|
218
373
|
void stop().finally(() => process.exit(0));
|
package/dist/gateway/tool.js
CHANGED
|
@@ -1,62 +1,65 @@
|
|
|
1
1
|
import { Type } from "@mariozechner/pi-ai";
|
|
2
2
|
import { defineTool } from "@mariozechner/pi-coding-agent";
|
|
3
3
|
import { sendGatewayMessageAndWaitForReply } from "./request.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
export function createPiboGatewaySendTool(sendGatewayMessage = sendGatewayMessageAndWaitForReply) {
|
|
5
|
+
return defineTool({
|
|
6
|
+
name: "pibo_gateway_send",
|
|
7
|
+
label: "Pibo Gateway Send",
|
|
8
|
+
description: "Send a message through the local pibo gateway to a target session and return the target assistant reply.",
|
|
9
|
+
promptSnippet: "Send a message through the local pibo gateway to a target session and return the final assistant reply from that session.",
|
|
10
|
+
parameters: Type.Object({
|
|
11
|
+
piboSessionId: Type.String({ description: "Target Pibo gateway session id" }),
|
|
12
|
+
message: Type.String({ description: "Message to enqueue for the target session" }),
|
|
13
|
+
}),
|
|
14
|
+
async execute(_toolCallId, params) {
|
|
15
|
+
let result;
|
|
16
|
+
let response;
|
|
17
|
+
try {
|
|
18
|
+
result = await sendGatewayMessage({
|
|
19
|
+
type: "message",
|
|
20
|
+
piboSessionId: params.piboSessionId,
|
|
21
|
+
text: params.message,
|
|
22
|
+
source: "actor",
|
|
23
|
+
});
|
|
24
|
+
response = result.response;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
response = {
|
|
28
|
+
type: "res",
|
|
29
|
+
id: "",
|
|
30
|
+
ok: false,
|
|
31
|
+
error: { message: error instanceof Error ? error.message : String(error) },
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (!response.ok) {
|
|
35
|
+
const message = response.error?.message ?? "Gateway rejected the message";
|
|
36
|
+
const details = { ok: false, piboSessionId: params.piboSessionId, error: message };
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: "text", text: `Gateway error: ${message}` }],
|
|
39
|
+
details,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const details = {
|
|
43
|
+
ok: true,
|
|
19
44
|
piboSessionId: params.piboSessionId,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
response = result.response;
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
response = {
|
|
27
|
-
type: "res",
|
|
28
|
-
id: "",
|
|
29
|
-
ok: false,
|
|
30
|
-
error: { message: error instanceof Error ? error.message : String(error) },
|
|
45
|
+
gatewayPayload: response.payload,
|
|
46
|
+
reply: result?.reply?.text,
|
|
31
47
|
};
|
|
32
|
-
}
|
|
33
|
-
if (!response.ok) {
|
|
34
|
-
const message = response.error?.message ?? "Gateway rejected the message";
|
|
35
|
-
const details = { ok: false, piboSessionId: params.piboSessionId, error: message };
|
|
36
48
|
return {
|
|
37
|
-
content: [
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: "text",
|
|
52
|
+
text: result?.reply
|
|
53
|
+
? result.reply.text
|
|
54
|
+
: `Queued message for pibo gateway session "${params.piboSessionId}", but no assistant reply was returned.`,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
38
57
|
details,
|
|
39
58
|
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
gatewayPayload: response.payload,
|
|
45
|
-
reply: result?.reply.text,
|
|
46
|
-
};
|
|
47
|
-
return {
|
|
48
|
-
content: [
|
|
49
|
-
{
|
|
50
|
-
type: "text",
|
|
51
|
-
text: result?.reply
|
|
52
|
-
? result.reply.text
|
|
53
|
-
: `Queued message for pibo gateway session "${params.piboSessionId}", but no assistant reply was returned.`,
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
details,
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
});
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const piboGatewaySendTool = createPiboGatewaySendTool();
|
|
60
63
|
export function createPiboGatewayToolProfiles() {
|
|
61
64
|
return [createToolProfile(piboGatewaySendTool)];
|
|
62
65
|
}
|
package/dist/gateway/web.js
CHANGED
|
@@ -1,14 +1,43 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
1
2
|
import { createDefaultPiboPlugins } from "../plugins/builtin.js";
|
|
2
3
|
import { createPiboBetterAuthPlugin } from "../plugins/better-auth.js";
|
|
3
4
|
import { createPiboChatWebPlugin } from "../plugins/chat-web.js";
|
|
5
|
+
import { createPiboChatVscodeWebPlugin } from "../plugins/chat-vscode-web.js";
|
|
4
6
|
import { createPiboContextFilesPlugin } from "../plugins/context-files.js";
|
|
7
|
+
import { createPiboCronPlugin } from "../cron/plugin.js";
|
|
8
|
+
import { createPiboRalphPlugin } from "../ralph/plugin.js";
|
|
9
|
+
import { createPiboDevAuthPlugin } from "../plugins/dev-auth.js";
|
|
5
10
|
import { PiboPluginRegistry } from "../plugins/registry.js";
|
|
6
11
|
import { createPiboWebHostPlugin } from "../plugins/web.js";
|
|
7
12
|
import { DEFAULT_WEB_CHANNEL_HOST, DEFAULT_WEB_CHANNEL_PORT } from "../web/channel.js";
|
|
8
13
|
import { loadPiboConfig } from "../config/config.js";
|
|
9
14
|
import { PiboGatewayServer } from "./server.js";
|
|
15
|
+
import { clearFallbackPidFile, clearPidFile, writeFallbackGatewayPid, writeGatewayPid } from "./pidfile.js";
|
|
10
16
|
const PUBLIC_WEB_CHANNEL_HOST = "0.0.0.0";
|
|
11
17
|
const LOOPBACK_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
|
|
18
|
+
function isDockerRuntime() {
|
|
19
|
+
if (existsSync("/.dockerenv"))
|
|
20
|
+
return true;
|
|
21
|
+
try {
|
|
22
|
+
const cgroup = readFileSync("/proc/1/cgroup", "utf-8");
|
|
23
|
+
return /docker|kubepods|containerd/.test(cgroup);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function resolveWebGatewayAuthMode(options = {}) {
|
|
30
|
+
if (!options.devAuth) {
|
|
31
|
+
if (process.env.PIBO_DEV_AUTH === "1") {
|
|
32
|
+
throw new Error("PIBO_DEV_AUTH no longer activates dev auth for gateway:web; use the Docker worker entrypoint instead.");
|
|
33
|
+
}
|
|
34
|
+
return "better-auth";
|
|
35
|
+
}
|
|
36
|
+
if (!isDockerRuntime()) {
|
|
37
|
+
throw new Error("Pibo dev auth can only be enabled inside a Docker worker runtime.");
|
|
38
|
+
}
|
|
39
|
+
return "dev-auth";
|
|
40
|
+
}
|
|
12
41
|
function authBaseURL(options) {
|
|
13
42
|
return options.auth?.baseURL ?? loadPiboConfig().auth?.baseURL;
|
|
14
43
|
}
|
|
@@ -33,19 +62,43 @@ export function resolveWebGatewayServerOptions(options = {}) {
|
|
|
33
62
|
},
|
|
34
63
|
};
|
|
35
64
|
}
|
|
65
|
+
function webGatewayMode(options, useDevAuth) {
|
|
66
|
+
if (useDevAuth)
|
|
67
|
+
return "dev";
|
|
68
|
+
if (options.web?.port === 4808)
|
|
69
|
+
return "dev";
|
|
70
|
+
const baseURL = authBaseURL(options);
|
|
71
|
+
if (baseURL) {
|
|
72
|
+
try {
|
|
73
|
+
if (new URL(baseURL).hostname.startsWith("dev."))
|
|
74
|
+
return "dev";
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Fall through to production mode.
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return "prod";
|
|
81
|
+
}
|
|
36
82
|
export function createWebPiboPluginRegistry(options = {}) {
|
|
37
83
|
const resolvedOptions = resolveWebGatewayServerOptions(options);
|
|
84
|
+
const useDevAuth = resolveWebGatewayAuthMode(resolvedOptions) === "dev-auth";
|
|
38
85
|
return PiboPluginRegistry.create({
|
|
39
86
|
plugins: [
|
|
40
87
|
...createDefaultPiboPlugins(),
|
|
41
|
-
createPiboBetterAuthPlugin(resolvedOptions.auth),
|
|
42
|
-
createPiboWebHostPlugin({ announce: false, canonicalBaseURL: authBaseURL(resolvedOptions), ...resolvedOptions.web }),
|
|
88
|
+
useDevAuth ? createPiboDevAuthPlugin() : createPiboBetterAuthPlugin(resolvedOptions.auth),
|
|
89
|
+
createPiboWebHostPlugin({ announce: false, canonicalBaseURL: useDevAuth ? undefined : authBaseURL(resolvedOptions), gatewayMode: webGatewayMode(resolvedOptions, useDevAuth), ...resolvedOptions.web }),
|
|
90
|
+
createPiboCronPlugin({ cronStorePath: resolvedOptions.chat?.cronStorePath, dataStorePath: resolvedOptions.chat?.dataStorePath, dataPayloadRootDir: resolvedOptions.chat?.dataPayloadRootDir }),
|
|
91
|
+
createPiboRalphPlugin({ ralphStorePath: resolvedOptions.chat?.ralphStorePath, dataStorePath: resolvedOptions.chat?.dataStorePath, dataPayloadRootDir: resolvedOptions.chat?.dataPayloadRootDir }),
|
|
43
92
|
createPiboContextFilesPlugin(resolvedOptions.contextFiles),
|
|
44
93
|
createPiboChatWebPlugin(resolvedOptions.chat),
|
|
94
|
+
createPiboChatVscodeWebPlugin(),
|
|
45
95
|
],
|
|
46
96
|
});
|
|
47
97
|
}
|
|
48
98
|
function createChatAppURL(options, host, port) {
|
|
99
|
+
if (options.devAuth) {
|
|
100
|
+
return `http://${host}:${port}/apps/chat`;
|
|
101
|
+
}
|
|
49
102
|
const baseURL = options.auth?.baseURL ?? loadPiboConfig().auth?.baseURL;
|
|
50
103
|
if (baseURL) {
|
|
51
104
|
try {
|
|
@@ -65,11 +118,30 @@ export async function runWebGatewayServer(options = {}) {
|
|
|
65
118
|
pluginRegistry,
|
|
66
119
|
});
|
|
67
120
|
await server.start();
|
|
121
|
+
try {
|
|
122
|
+
if (process.env.PIBO_FALLBACK_MODE === "1") {
|
|
123
|
+
writeFallbackGatewayPid();
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
writeGatewayPid();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
131
|
+
await server.stop();
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
68
134
|
const host = resolvedOptions.web?.host ?? DEFAULT_WEB_CHANNEL_HOST;
|
|
69
135
|
const port = resolvedOptions.web?.port ?? DEFAULT_WEB_CHANNEL_PORT;
|
|
70
136
|
console.error(`pibo chat app available at ${createChatAppURL(resolvedOptions, host, port)}`);
|
|
71
137
|
const stop = async () => {
|
|
72
138
|
await server.stop();
|
|
139
|
+
if (process.env.PIBO_FALLBACK_MODE === "1") {
|
|
140
|
+
clearFallbackPidFile();
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
clearPidFile();
|
|
144
|
+
}
|
|
73
145
|
};
|
|
74
146
|
process.once("SIGINT", () => {
|
|
75
147
|
void stop().finally(() => process.exit(0));
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { createPiboGatewayToolProfiles } from "./gateway/tool.js";
|
|
|
11
11
|
export { createPiboRuntime, inspectPiboProfile, runPiboTui } from "./core/runtime.js";
|
|
12
12
|
export { PiboSessionRouter } from "./core/session-router.js";
|
|
13
13
|
export { PiboReliabilityStore, createDefaultPiboReliabilityStore } from "./reliability/store.js";
|
|
14
|
+
export { InMemoryPiboSignalRegistry, createPiboSignalRegistry } from "./signals/registry.js";
|
|
14
15
|
export { PiboGatewayServer, runGatewayServer } from "./gateway/server.js";
|
|
15
16
|
export { createWebPiboPluginRegistry, resolveWebGatewayServerOptions, runWebGatewayServer } from "./gateway/web.js";
|
|
16
17
|
export { runGatewayClient } from "./gateway/client.js";
|
|
@@ -20,4 +21,5 @@ export { sendGatewayEvent, sendGatewayMessageAndWaitForReply } from "./gateway/r
|
|
|
20
21
|
export { createSubagentToolDefinitions, createSubagentToolName, } from "./subagents/tool.js";
|
|
21
22
|
export { InMemoryPiboSessionStore, createPiSessionId, createPiboSessionId, createPiboSession, } from "./sessions/store.js";
|
|
22
23
|
export { runPiboCli } from "./cli.js";
|
|
23
|
-
export { DEFAULT_PIBO_CONFIG_PATH, PIBO_CONFIG_KEYS, deletePiboConfigValue, getDisplayPiboConfigValue, getPiboConfigValue, isPiboConfigKeySecret, loadPiboConfig, redactPiboConfig, savePiboConfig, setPiboConfigValue, } from "./config/config.js";
|
|
24
|
+
export { DEFAULT_PIBO_CONFIG_PATH, PIBO_CONFIG_KEYS, deletePiboConfigValue, getDefaultPiboConfigPath, getDisplayPiboConfigValue, getPiboConfigValue, isPiboConfigKeySecret, loadPiboConfig, redactPiboConfig, savePiboConfig, setPiboConfigValue, } from "./config/config.js";
|
|
25
|
+
export * from "./tools/runtime/index.js";
|
package/dist/local/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { PiboSessionRouter } from "../core/session-router.js";
|
|
3
|
-
import { createDefaultPiboPluginRegistry } from "../plugins/builtin.js";
|
|
3
|
+
import { createDefaultPiboPluginRegistry, createPiboProfileFromRegistryOrDefault, resolvePiboProfileNameFromRegistryOrDefault } from "../plugins/builtin.js";
|
|
4
4
|
import { getDefaultPiboWorkspace } from "../core/workspace.js";
|
|
5
5
|
import { InMemoryPiboSessionStore, } from "../sessions/store.js";
|
|
6
6
|
export const LOCAL_TUI_CHANNEL_NAME = "local-tui";
|
|
@@ -53,8 +53,8 @@ export class LocalRoutedTuiClient {
|
|
|
53
53
|
}
|
|
54
54
|
export function createLocalRoutedTuiClient(options = {}) {
|
|
55
55
|
const registry = options.pluginRegistry ?? createDefaultPiboPluginRegistry();
|
|
56
|
-
const profileName = registry
|
|
57
|
-
const profile = registry
|
|
56
|
+
const profileName = resolvePiboProfileNameFromRegistryOrDefault(registry, options.profile);
|
|
57
|
+
const profile = createPiboProfileFromRegistryOrDefault(registry, profileName);
|
|
58
58
|
const sessionName = options.sessionName ?? "default";
|
|
59
59
|
const workspace = options.cwd ?? getDefaultPiboWorkspace();
|
|
60
60
|
const sessionStore = new InMemoryPiboSessionStore();
|