@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
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { InitialSessionContext, } from "./profiles.js";
|
|
3
|
-
import { createDefaultPiboPluginRegistry } from "../plugins/builtin.js";
|
|
3
|
+
import { createDefaultPiboPluginRegistry, createPiboProfileFromRegistryOrDefault, resolvePiboProfileNameFromRegistryOrDefault, selectDefaultPiboProfileName } from "../plugins/builtin.js";
|
|
4
4
|
import { createPiboRuntime } from "./runtime.js";
|
|
5
5
|
import { RoutedSession } from "./routed-session.js";
|
|
6
|
+
import { runtimeSessionErrorDetails } from "./session-errors.js";
|
|
6
7
|
import { createSubagentToolName } from "../subagents/tool.js";
|
|
7
8
|
import { PiboRunRegistry } from "../runs/registry.js";
|
|
9
|
+
import { createPiboSignalRegistry } from "../signals/registry.js";
|
|
8
10
|
import { createDefaultPiboReliabilityStore } from "../reliability/store.js";
|
|
9
11
|
import { InMemoryPiboSessionStore, } from "../sessions/store.js";
|
|
10
12
|
import { getDefaultPiboWorkspace } from "./workspace.js";
|
|
13
|
+
import { loadPiboModelDefaults, selectRequestedFastMode } from "./model-defaults.js";
|
|
14
|
+
import { loadPiboUserSettings } from "./user-settings.js";
|
|
15
|
+
import { resolvePiboSessionActiveModel } from "./session-model.js";
|
|
16
|
+
import { isPiboThinkingLevel } from "./thinking.js";
|
|
17
|
+
import { RuntimeSessionRegistry } from "../tools/runtime/registry.js";
|
|
18
|
+
import { withWorkflowSessionKind } from "../sessions/workflow-session-kind.js";
|
|
19
|
+
import { PiboRuntimeTelemetryRecorder } from "./runtime-telemetry.js";
|
|
20
|
+
import { createPiboProviderTelemetryExtension } from "./provider-telemetry.js";
|
|
11
21
|
const DEFAULT_SUBAGENT_REPLY_TIMEOUT_MS = 10 * 60 * 1000;
|
|
22
|
+
export function resolvePiboSessionInitialThinkingLevel(session) {
|
|
23
|
+
const value = session.metadata?.initialThinkingLevel;
|
|
24
|
+
return typeof value === "string" && isPiboThinkingLevel(value) ? value : undefined;
|
|
25
|
+
}
|
|
26
|
+
export function resolvePiboSessionInitialFastMode(session) {
|
|
27
|
+
const value = session.metadata?.initialFastMode;
|
|
28
|
+
return typeof value === "boolean" ? value : undefined;
|
|
29
|
+
}
|
|
12
30
|
function profileForSession(baseProfile, piSessionId, parentPiSessionId) {
|
|
13
31
|
const options = {
|
|
14
32
|
profileName: baseProfile.profileName,
|
|
@@ -17,6 +35,12 @@ function profileForSession(baseProfile, piSessionId, parentPiSessionId) {
|
|
|
17
35
|
model: baseProfile.model,
|
|
18
36
|
mainModel: baseProfile.mainModel,
|
|
19
37
|
subagentModel: baseProfile.subagentModel,
|
|
38
|
+
thinkingLevel: baseProfile.thinkingLevel,
|
|
39
|
+
mainThinkingLevel: baseProfile.mainThinkingLevel,
|
|
40
|
+
subagentThinkingLevel: baseProfile.subagentThinkingLevel,
|
|
41
|
+
fast: baseProfile.fast,
|
|
42
|
+
mainFast: baseProfile.mainFast,
|
|
43
|
+
subagentFast: baseProfile.subagentFast,
|
|
20
44
|
skills: baseProfile.skills,
|
|
21
45
|
tools: baseProfile.tools,
|
|
22
46
|
subagents: baseProfile.subagents,
|
|
@@ -29,7 +53,7 @@ function profileForSession(baseProfile, piSessionId, parentPiSessionId) {
|
|
|
29
53
|
};
|
|
30
54
|
return new InitialSessionContext(options);
|
|
31
55
|
}
|
|
32
|
-
function
|
|
56
|
+
function formatRunReminderMessage(notification) {
|
|
33
57
|
return [
|
|
34
58
|
"<pibo_run_notification>",
|
|
35
59
|
JSON.stringify({
|
|
@@ -66,7 +90,7 @@ function formatRunNotification(notification) {
|
|
|
66
90
|
"</pibo_run_notification>",
|
|
67
91
|
].join("\n");
|
|
68
92
|
}
|
|
69
|
-
function
|
|
93
|
+
function isRunReminderServiceMessage(event) {
|
|
70
94
|
return event.source === "service" && event.text.startsWith("<pibo_run_notification>");
|
|
71
95
|
}
|
|
72
96
|
function isTerminalRunStatus(status) {
|
|
@@ -75,24 +99,47 @@ function isTerminalRunStatus(status) {
|
|
|
75
99
|
function asJsonObject(value) {
|
|
76
100
|
return value ?? {};
|
|
77
101
|
}
|
|
102
|
+
function shouldResetSessionAfterAction(action) {
|
|
103
|
+
return action === "login.complete" || action === "login.apikey" || action === "logout";
|
|
104
|
+
}
|
|
105
|
+
function piboRoomIdFromMetadata(metadata) {
|
|
106
|
+
const value = metadata?.chatRoomId;
|
|
107
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
108
|
+
}
|
|
109
|
+
function telemetryStoreFromSessionStore(store) {
|
|
110
|
+
return store.getTelemetryStore?.();
|
|
111
|
+
}
|
|
78
112
|
export class PiboSessionRouter {
|
|
79
113
|
options;
|
|
80
114
|
sessions = new Map();
|
|
81
115
|
pendingSessions = new Map();
|
|
82
116
|
listeners = new Set();
|
|
83
117
|
runRegistry;
|
|
84
|
-
|
|
118
|
+
signalRegistry;
|
|
119
|
+
runtimeRegistry;
|
|
120
|
+
scheduledRunReminders = new Map();
|
|
85
121
|
baseProfile;
|
|
86
122
|
pluginRegistry;
|
|
87
123
|
sessionStore;
|
|
88
124
|
reliabilityStore;
|
|
125
|
+
telemetryStore;
|
|
126
|
+
telemetryRecorder;
|
|
89
127
|
constructor(options = {}) {
|
|
90
128
|
this.options = options;
|
|
91
129
|
this.pluginRegistry = options.pluginRegistry ?? createDefaultPiboPluginRegistry();
|
|
92
130
|
this.sessionStore = options.sessionStore ?? new InMemoryPiboSessionStore();
|
|
93
|
-
this.
|
|
94
|
-
this.
|
|
131
|
+
this.telemetryStore = options.telemetryStore ?? telemetryStoreFromSessionStore(this.sessionStore);
|
|
132
|
+
this.telemetryRecorder = this.telemetryStore ? new PiboRuntimeTelemetryRecorder(this.telemetryStore) : undefined;
|
|
133
|
+
const defaultProfileName = selectDefaultPiboProfileName(this.pluginRegistry);
|
|
134
|
+
this.baseProfile = options.profile ?? createPiboProfileFromRegistryOrDefault(this.pluginRegistry, defaultProfileName);
|
|
135
|
+
this.reliabilityStore = options.reliabilityStore ?? (options.persistSession === false ? undefined : createDefaultPiboReliabilityStore());
|
|
136
|
+
this.signalRegistry = options.signalRegistry ?? createPiboSignalRegistry();
|
|
137
|
+
this.runtimeRegistry = new RuntimeSessionRegistry({ cwd: options.cwd ?? getDefaultPiboWorkspace() });
|
|
95
138
|
this.runRegistry = new PiboRunRegistry({ store: this.reliabilityStore });
|
|
139
|
+
this.runRegistry.subscribe((event) => this.projectRunRegistryEvent(event));
|
|
140
|
+
for (const run of this.runRegistry.listAll({ includeConsumed: true, includeDetached: true })) {
|
|
141
|
+
this.signalRegistry.project({ type: "run_changed", run, reason: "recovered" });
|
|
142
|
+
}
|
|
96
143
|
}
|
|
97
144
|
subscribe(listener) {
|
|
98
145
|
this.listeners.add(listener);
|
|
@@ -106,16 +153,125 @@ export class PiboSessionRouter {
|
|
|
106
153
|
return session.enqueueMessage(event);
|
|
107
154
|
}
|
|
108
155
|
const output = await session.executeAction(event);
|
|
156
|
+
if (event.action === "abort") {
|
|
157
|
+
this.signalRegistry.project({ type: "session_interrupted", piboSessionId: event.piboSessionId, reason: "abort action" });
|
|
158
|
+
}
|
|
109
159
|
if (event.action === "dispose") {
|
|
110
|
-
this.
|
|
111
|
-
|
|
112
|
-
|
|
160
|
+
this.disposeSignalSubtree(event.piboSessionId, "dispose action");
|
|
161
|
+
}
|
|
162
|
+
else if (shouldResetSessionAfterAction(event.action)) {
|
|
163
|
+
await this.resetCachedSession(event.piboSessionId, "provider auth changed");
|
|
164
|
+
}
|
|
165
|
+
return output;
|
|
166
|
+
}
|
|
167
|
+
async killSession(piboSessionId, options) {
|
|
168
|
+
const killed = [];
|
|
169
|
+
const cancelledRuns = [];
|
|
170
|
+
const session = this.sessions.get(piboSessionId);
|
|
171
|
+
if (session) {
|
|
172
|
+
killed.push(await session.kill());
|
|
173
|
+
if (options?.includeRuns) {
|
|
174
|
+
const runs = this.runRegistry.cancelControllerRuns(piboSessionId);
|
|
175
|
+
cancelledRuns.push(...runs.map((r) => r.runId));
|
|
176
|
+
}
|
|
177
|
+
await this.runtimeRegistry.closeControllerSessions(piboSessionId, { force: true });
|
|
178
|
+
this.signalRegistry.project({ type: "session_interrupted", piboSessionId, reason: "kill" });
|
|
179
|
+
const children = await this.killChildSessions(piboSessionId, options);
|
|
180
|
+
killed.push(...children.killed);
|
|
181
|
+
cancelledRuns.push(...children.cancelledRuns);
|
|
182
|
+
}
|
|
183
|
+
return { killed, cancelledRuns };
|
|
184
|
+
}
|
|
185
|
+
disposeSignalSubtree(piboSessionId, reason) {
|
|
186
|
+
const descendants = this.descendantSessionIds(piboSessionId);
|
|
187
|
+
for (const id of [piboSessionId, ...descendants]) {
|
|
188
|
+
this.runRegistry.cancelControllerRuns(id);
|
|
189
|
+
void this.runtimeRegistry.closeControllerSessions(id, { force: true });
|
|
190
|
+
this.signalRegistry.project({ type: "session_disposed", piboSessionId: id, reason });
|
|
191
|
+
this.scheduledRunReminders.delete(id);
|
|
192
|
+
this.sessions.delete(id);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
descendantSessionIds(parentId) {
|
|
196
|
+
const output = [];
|
|
197
|
+
for (const session of this.sessionStore.list?.() ?? []) {
|
|
198
|
+
if (session.parentId !== parentId)
|
|
199
|
+
continue;
|
|
200
|
+
output.push(session.id, ...this.descendantSessionIds(session.id));
|
|
113
201
|
}
|
|
114
202
|
return output;
|
|
115
203
|
}
|
|
204
|
+
async killChildSessions(parentId, options) {
|
|
205
|
+
const killed = [];
|
|
206
|
+
const cancelledRuns = [];
|
|
207
|
+
const allSessions = this.sessionStore.list?.() ?? [];
|
|
208
|
+
for (const session of allSessions) {
|
|
209
|
+
if (session.parentId === parentId) {
|
|
210
|
+
const childSession = this.sessions.get(session.id);
|
|
211
|
+
if (childSession) {
|
|
212
|
+
killed.push(await childSession.kill());
|
|
213
|
+
}
|
|
214
|
+
if (options?.includeRuns) {
|
|
215
|
+
const runs = this.runRegistry.cancelControllerRuns(session.id);
|
|
216
|
+
cancelledRuns.push(...runs.map((r) => r.runId));
|
|
217
|
+
}
|
|
218
|
+
const nested = await this.killChildSessions(session.id, options);
|
|
219
|
+
killed.push(...nested.killed);
|
|
220
|
+
cancelledRuns.push(...nested.cancelledRuns);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return { killed, cancelledRuns };
|
|
224
|
+
}
|
|
116
225
|
getPiboSessionIds() {
|
|
117
226
|
return [...this.sessions.keys()];
|
|
118
227
|
}
|
|
228
|
+
getSessionRuntimeStatus(piboSessionId) {
|
|
229
|
+
return this.sessions.get(piboSessionId)?.getStatus();
|
|
230
|
+
}
|
|
231
|
+
async setLiveSessionActiveModel(piboSessionId, model) {
|
|
232
|
+
const session = this.sessions.get(piboSessionId);
|
|
233
|
+
if (!session)
|
|
234
|
+
return model;
|
|
235
|
+
const status = session.getStatus();
|
|
236
|
+
if (status.processing || status.streaming || status.queuedMessages > 0) {
|
|
237
|
+
throw new Error("Session model can only be changed while the runtime is idle.");
|
|
238
|
+
}
|
|
239
|
+
if (!model) {
|
|
240
|
+
await this.resetCachedSession(piboSessionId);
|
|
241
|
+
return undefined;
|
|
242
|
+
}
|
|
243
|
+
return session.setModel(model);
|
|
244
|
+
}
|
|
245
|
+
reportSessionError(piboSessionId, error, options = {}) {
|
|
246
|
+
this.signalRegistry.project({ type: "session_created", session: this.resolvePiboSession(piboSessionId) });
|
|
247
|
+
this.emitOutput({
|
|
248
|
+
type: "session_error",
|
|
249
|
+
piboSessionId,
|
|
250
|
+
eventId: options.eventId,
|
|
251
|
+
error,
|
|
252
|
+
errorDetails: runtimeSessionErrorDetails(error),
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
listSessionRuntimeStatuses() {
|
|
256
|
+
return [...this.sessions.values()].map((session) => session.getStatus());
|
|
257
|
+
}
|
|
258
|
+
listRuns(options = {}) {
|
|
259
|
+
return this.runRegistry.listAll(options);
|
|
260
|
+
}
|
|
261
|
+
getSignalRegistry() {
|
|
262
|
+
return this.signalRegistry;
|
|
263
|
+
}
|
|
264
|
+
snapshotSignalSession(piboSessionId) {
|
|
265
|
+
this.projectKnownSessionSignals();
|
|
266
|
+
return this.signalRegistry.snapshotSession(piboSessionId);
|
|
267
|
+
}
|
|
268
|
+
snapshotSignalTree(rootPiboSessionId) {
|
|
269
|
+
this.projectKnownSessionSignals();
|
|
270
|
+
return this.signalRegistry.snapshotTree(rootPiboSessionId);
|
|
271
|
+
}
|
|
272
|
+
subscribeSignalTree(rootPiboSessionId, listener) {
|
|
273
|
+
return this.signalRegistry.subscribe(rootPiboSessionId, listener);
|
|
274
|
+
}
|
|
119
275
|
async emitMessageAndWaitForReply(event, timeoutMs = 120000) {
|
|
120
276
|
const eventWithId = { ...event, id: event.id ?? randomUUID() };
|
|
121
277
|
return await new Promise((resolve, reject) => {
|
|
@@ -156,7 +312,10 @@ export class PiboSessionRouter {
|
|
|
156
312
|
const sessions = [...this.sessions.values()];
|
|
157
313
|
this.sessions.clear();
|
|
158
314
|
this.runRegistry.cancelAll("Pibo session router was disposed.");
|
|
159
|
-
|
|
315
|
+
for (const session of sessions)
|
|
316
|
+
this.signalRegistry.project({ type: "session_disposed", piboSessionId: session.getStatus().piboSessionId, reason: "router disposed" });
|
|
317
|
+
this.scheduledRunReminders.clear();
|
|
318
|
+
await this.runtimeRegistry.closeAll({ force: true });
|
|
160
319
|
await Promise.all(sessions.map((session) => session.dispose()));
|
|
161
320
|
}
|
|
162
321
|
async getOrCreateSession(piboSessionId) {
|
|
@@ -177,22 +336,64 @@ export class PiboSessionRouter {
|
|
|
177
336
|
}
|
|
178
337
|
async createRoutedSession(piboSessionId) {
|
|
179
338
|
const piboSession = this.resolvePiboSession(piboSessionId);
|
|
180
|
-
|
|
339
|
+
this.signalRegistry.project({ type: "session_created", session: piboSession });
|
|
340
|
+
const profile = createPiboProfileFromRegistryOrDefault(this.pluginRegistry, piboSession.profile);
|
|
181
341
|
const parentPiSessionId = piboSession.parentId
|
|
182
342
|
? this.resolvePiboSession(piboSession.parentId).piSessionId
|
|
183
343
|
: undefined;
|
|
344
|
+
const modelDefaults = this.resolveModelDefaults();
|
|
345
|
+
const activeModel = this.ensureSessionActiveModel(piboSession, profile, parentPiSessionId, modelDefaults);
|
|
346
|
+
const initialThinkingLevel = resolvePiboSessionInitialThinkingLevel(piboSession);
|
|
347
|
+
const userSettings = loadPiboUserSettings();
|
|
348
|
+
const telemetryExtension = this.telemetryStore
|
|
349
|
+
? createPiboProviderTelemetryExtension({ store: this.telemetryStore, session: piboSession, model: activeModel })
|
|
350
|
+
: undefined;
|
|
184
351
|
const runtime = await createPiboRuntime({
|
|
185
352
|
cwd: piboSession.workspace ?? this.options.cwd,
|
|
186
353
|
persistSession: this.options.persistSession,
|
|
187
|
-
thinkingLevel: this.options.thinkingLevel,
|
|
354
|
+
thinkingLevel: initialThinkingLevel ?? this.options.thinkingLevel,
|
|
188
355
|
profile: profileForSession(profile, piboSession.piSessionId, parentPiSessionId),
|
|
356
|
+
extensionFactories: [
|
|
357
|
+
...(telemetryExtension ? [telemetryExtension] : []),
|
|
358
|
+
...(this.options.extensionFactories ?? []),
|
|
359
|
+
],
|
|
189
360
|
subagentRunner: this.createSubagentRunner(piboSession.id),
|
|
190
361
|
runToolController: this.createRunToolController(piboSession.id),
|
|
362
|
+
runtimeToolController: this.runtimeRegistry.createController(piboSession.id),
|
|
363
|
+
modelDefaults,
|
|
364
|
+
activeModel,
|
|
365
|
+
sessionContext: {
|
|
366
|
+
piboSessionId: piboSession.id,
|
|
367
|
+
piboRoomId: piboRoomIdFromMetadata(piboSession.metadata),
|
|
368
|
+
timezone: userSettings.timezone,
|
|
369
|
+
},
|
|
191
370
|
});
|
|
192
|
-
const
|
|
371
|
+
const initialFastMode = resolvePiboSessionInitialFastMode(piboSession) ?? selectRequestedFastMode(profileForSession(profile, piboSession.piSessionId, parentPiSessionId), modelDefaults) ?? false;
|
|
372
|
+
const session = new RoutedSession(piboSession.id, runtime, this.emitOutput, this.pluginRegistry, this.options.forwardPiEvents ?? false, this.telemetryRecorder
|
|
373
|
+
? (id, event, context) => this.telemetryRecorder?.recordPiEvent(id, event, { session: this.sessionStore.get(id), status: context.status, activeEventId: context.activeEventId })
|
|
374
|
+
: undefined, initialFastMode, (result, event) => this.handleSessionOperation(result, event), (id, opts) => this.killChildSessions(id, opts), (state) => this.signalRegistry.project({ type: "session_processing_changed", piboSessionId: piboSession.id, processing: state.processing, queuedMessages: state.queuedMessages }));
|
|
193
375
|
this.sessions.set(piboSession.id, session);
|
|
194
376
|
return session;
|
|
195
377
|
}
|
|
378
|
+
ensureSessionActiveModel(piboSession, profile, parentPiSessionId, modelDefaults) {
|
|
379
|
+
const activeModel = resolvePiboSessionActiveModel({
|
|
380
|
+
profile,
|
|
381
|
+
piboSession,
|
|
382
|
+
parentPiSessionId,
|
|
383
|
+
modelDefaults,
|
|
384
|
+
});
|
|
385
|
+
if (!piboSession.activeModel && activeModel) {
|
|
386
|
+
this.sessionStore.update(piboSession.id, { activeModel });
|
|
387
|
+
}
|
|
388
|
+
return activeModel;
|
|
389
|
+
}
|
|
390
|
+
resolveModelDefaults() {
|
|
391
|
+
if (typeof this.options.modelDefaults === "function")
|
|
392
|
+
return this.options.modelDefaults();
|
|
393
|
+
if (this.options.modelDefaults)
|
|
394
|
+
return this.options.modelDefaults;
|
|
395
|
+
return loadPiboModelDefaults(this.options.cwd ?? process.cwd());
|
|
396
|
+
}
|
|
196
397
|
async handleSessionOperation(result, event) {
|
|
197
398
|
if (result.cancelled)
|
|
198
399
|
return;
|
|
@@ -214,12 +415,12 @@ export class PiboSessionRouter {
|
|
|
214
415
|
channel: source.channel,
|
|
215
416
|
kind: "branch",
|
|
216
417
|
profile: source.profile,
|
|
217
|
-
ownerScope: source.ownerScope,
|
|
218
418
|
parentId: source.kind === "subagent" ? source.parentId : undefined,
|
|
219
419
|
originId: source.id,
|
|
220
420
|
piSessionId: result.current.piSessionId,
|
|
221
421
|
workspace: result.current.cwd,
|
|
222
422
|
title: source.title,
|
|
423
|
+
activeModel: source.activeModel,
|
|
223
424
|
metadata: {
|
|
224
425
|
...asJsonObject(source.metadata),
|
|
225
426
|
originAction: action,
|
|
@@ -227,22 +428,27 @@ export class PiboSessionRouter {
|
|
|
227
428
|
},
|
|
228
429
|
});
|
|
229
430
|
}
|
|
230
|
-
async resetCachedSession(piboSessionId) {
|
|
431
|
+
async resetCachedSession(piboSessionId, reason) {
|
|
231
432
|
const cached = this.sessions.get(piboSessionId);
|
|
232
433
|
this.sessions.delete(piboSessionId);
|
|
434
|
+
await this.runtimeRegistry.closeControllerSessions(piboSessionId, { force: true });
|
|
233
435
|
await cached?.dispose();
|
|
436
|
+
if (reason)
|
|
437
|
+
this.signalRegistry.project({ type: "session_disposed", piboSessionId, reason });
|
|
234
438
|
}
|
|
235
439
|
resolvePiboSession(piboSessionId) {
|
|
236
440
|
const existing = this.sessionStore.get(piboSessionId);
|
|
237
441
|
if (existing)
|
|
238
442
|
return existing;
|
|
239
|
-
|
|
443
|
+
const created = this.sessionStore.create({
|
|
240
444
|
id: piboSessionId,
|
|
241
445
|
channel: "pibo.runtime",
|
|
242
446
|
kind: "runtime",
|
|
243
447
|
profile: this.baseProfile.profileName,
|
|
244
448
|
workspace: this.options.cwd ?? getDefaultPiboWorkspace(),
|
|
245
449
|
});
|
|
450
|
+
this.signalRegistry.project({ type: "session_created", session: created });
|
|
451
|
+
return created;
|
|
246
452
|
}
|
|
247
453
|
createSubagentRunner(parentPiboSessionId) {
|
|
248
454
|
return {
|
|
@@ -275,7 +481,7 @@ export class PiboSessionRouter {
|
|
|
275
481
|
return {
|
|
276
482
|
startToolRun: ({ toolName, params, completionPolicy, retryable, maxAttempts, execute }) => {
|
|
277
483
|
const run = this.runRegistry.startToolRun({
|
|
278
|
-
|
|
484
|
+
controllerPiboSessionId: parentPiboSessionId,
|
|
279
485
|
toolName,
|
|
280
486
|
params,
|
|
281
487
|
completionPolicy,
|
|
@@ -287,12 +493,12 @@ export class PiboSessionRouter {
|
|
|
287
493
|
const result = await execute();
|
|
288
494
|
const completed = this.runRegistry.complete(run.runId, result);
|
|
289
495
|
if (completed)
|
|
290
|
-
this.
|
|
496
|
+
this.scheduleRunReminder(parentPiboSessionId, false);
|
|
291
497
|
}
|
|
292
498
|
catch (error) {
|
|
293
499
|
const failed = this.runRegistry.fail(run.runId, error instanceof Error ? error.message : String(error));
|
|
294
500
|
if (failed)
|
|
295
|
-
this.
|
|
501
|
+
this.scheduleRunReminder(parentPiboSessionId, false);
|
|
296
502
|
}
|
|
297
503
|
})();
|
|
298
504
|
return run;
|
|
@@ -303,18 +509,18 @@ export class PiboSessionRouter {
|
|
|
303
509
|
readRun: (runId) => {
|
|
304
510
|
const run = this.runRegistry.read(parentPiboSessionId, runId);
|
|
305
511
|
if (run.consumed && isTerminalRunStatus(run.status)) {
|
|
306
|
-
this.
|
|
512
|
+
this.refreshQueuedRunReminders(parentPiboSessionId);
|
|
307
513
|
}
|
|
308
514
|
return run;
|
|
309
515
|
},
|
|
310
516
|
cancelRun: async (runId) => {
|
|
311
517
|
const cancelled = this.runRegistry.cancel(parentPiboSessionId, runId);
|
|
312
|
-
this.
|
|
518
|
+
this.refreshQueuedRunReminders(parentPiboSessionId);
|
|
313
519
|
return cancelled;
|
|
314
520
|
},
|
|
315
521
|
ackRun: (runId) => {
|
|
316
522
|
const run = this.runRegistry.ack(parentPiboSessionId, runId);
|
|
317
|
-
this.
|
|
523
|
+
this.refreshQueuedRunReminders(parentPiboSessionId);
|
|
318
524
|
return run;
|
|
319
525
|
},
|
|
320
526
|
};
|
|
@@ -339,83 +545,105 @@ export class PiboSessionRouter {
|
|
|
339
545
|
return depth;
|
|
340
546
|
}
|
|
341
547
|
resolveSubagentSession(parentPiboSessionId, subagent, threadKey) {
|
|
342
|
-
const targetProfile = this.pluginRegistry
|
|
548
|
+
const targetProfile = resolvePiboProfileNameFromRegistryOrDefault(this.pluginRegistry, subagent.targetProfile);
|
|
343
549
|
const parent = this.resolvePiboSession(parentPiboSessionId);
|
|
344
550
|
const resolvedThreadKey = threadKey?.trim() ? threadKey.trim() : randomUUID();
|
|
345
|
-
const
|
|
551
|
+
const baseMetadata = {
|
|
346
552
|
subagentName: subagent.name,
|
|
347
553
|
subagentToolName: createSubagentToolName(subagent.name),
|
|
348
554
|
threadKey: resolvedThreadKey,
|
|
349
555
|
};
|
|
556
|
+
const metadata = withWorkflowSessionKind(baseMetadata, "subagent");
|
|
350
557
|
const parentChatRoomId = typeof parent.metadata?.chatRoomId === "string" ? parent.metadata.chatRoomId : undefined;
|
|
351
558
|
if (parentChatRoomId)
|
|
352
559
|
metadata.chatRoomId = parentChatRoomId;
|
|
353
|
-
const legacyMetadata =
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
channel: "pibo.subagents",
|
|
368
|
-
kind: "subagent",
|
|
369
|
-
parentId: parent.id,
|
|
370
|
-
profile: targetProfile,
|
|
371
|
-
metadata: legacyMetadata,
|
|
372
|
-
})[0];
|
|
560
|
+
const legacyMetadata = { ...baseMetadata };
|
|
561
|
+
const legacyMetadataWithChatRoom = parentChatRoomId
|
|
562
|
+
? { ...baseMetadata, chatRoomId: parentChatRoomId }
|
|
563
|
+
: undefined;
|
|
564
|
+
const findExisting = (candidate) => candidate
|
|
565
|
+
? this.sessionStore.find({
|
|
566
|
+
channel: "pibo.subagents",
|
|
567
|
+
kind: "subagent",
|
|
568
|
+
parentId: parent.id,
|
|
569
|
+
profile: targetProfile,
|
|
570
|
+
metadata: candidate,
|
|
571
|
+
})[0]
|
|
572
|
+
: undefined;
|
|
573
|
+
const existing = findExisting(metadata) ?? findExisting(legacyMetadataWithChatRoom) ?? findExisting(legacyMetadata);
|
|
373
574
|
if (existing) {
|
|
374
|
-
|
|
375
|
-
|
|
575
|
+
const updatedMetadata = withWorkflowSessionKind({
|
|
576
|
+
...(existing.metadata ?? {}),
|
|
577
|
+
...(parentChatRoomId ? { chatRoomId: parentChatRoomId } : {}),
|
|
578
|
+
}, "subagent");
|
|
579
|
+
if (JSON.stringify(updatedMetadata) !== JSON.stringify(existing.metadata ?? {})) {
|
|
580
|
+
return this.sessionStore.update(existing.id, { metadata: updatedMetadata }) ?? existing;
|
|
376
581
|
}
|
|
377
582
|
return existing;
|
|
378
583
|
}
|
|
379
|
-
|
|
584
|
+
const childProfile = createPiboProfileFromRegistryOrDefault(this.pluginRegistry, targetProfile);
|
|
585
|
+
const childSession = this.sessionStore.create({
|
|
380
586
|
channel: "pibo.subagents",
|
|
381
587
|
kind: "subagent",
|
|
382
588
|
profile: targetProfile,
|
|
383
|
-
ownerScope: parent.ownerScope,
|
|
384
589
|
parentId: parent.id,
|
|
385
590
|
workspace: parent.workspace,
|
|
386
591
|
metadata,
|
|
387
592
|
});
|
|
593
|
+
this.signalRegistry.project({ type: "session_created", session: childSession });
|
|
594
|
+
const activeModel = resolvePiboSessionActiveModel({
|
|
595
|
+
profile: childProfile,
|
|
596
|
+
piboSession: childSession,
|
|
597
|
+
parentPiSessionId: parent.piSessionId,
|
|
598
|
+
modelDefaults: this.resolveModelDefaults(),
|
|
599
|
+
});
|
|
600
|
+
return activeModel ? this.sessionStore.update(childSession.id, { activeModel }) ?? childSession : childSession;
|
|
388
601
|
}
|
|
389
602
|
emitOutput = (event) => {
|
|
603
|
+
const session = this.sessionStore.get(event.piboSessionId);
|
|
604
|
+
this.telemetryRecorder?.recordOutput(event, { session, status: this.sessions.get(event.piboSessionId)?.getStatus() });
|
|
605
|
+
this.signalRegistry.project({ type: "pibo_output", event, session });
|
|
390
606
|
this.pluginRegistry.notifyEvent(event);
|
|
391
607
|
for (const listener of this.listeners) {
|
|
392
608
|
listener(event);
|
|
393
609
|
}
|
|
394
610
|
if (event.type === "message_finished" && event.source !== "service") {
|
|
395
|
-
this.
|
|
611
|
+
this.scheduleRunReminder(event.piboSessionId, true);
|
|
396
612
|
}
|
|
397
613
|
};
|
|
398
|
-
|
|
614
|
+
projectKnownSessionSignals() {
|
|
615
|
+
for (const session of this.sessionStore.list?.() ?? []) {
|
|
616
|
+
this.signalRegistry.project({ type: "session_created", session });
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
projectRunRegistryEvent(event) {
|
|
620
|
+
if (event.type === "run_removed") {
|
|
621
|
+
this.signalRegistry.project({ type: "run_removed", runId: event.runId, controllerPiboSessionId: event.controllerPiboSessionId });
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
this.signalRegistry.project({ type: "run_changed", run: event.run, previousStatus: "previousStatus" in event ? event.previousStatus : undefined, reason: "reason" in event ? event.reason : event.type });
|
|
625
|
+
}
|
|
626
|
+
scheduleRunReminder(piboSessionId, includeAlreadyNotified) {
|
|
399
627
|
if (!this.runRegistry.hasPendingNotification(piboSessionId, { includeAlreadyNotified }))
|
|
400
628
|
return;
|
|
401
|
-
const previous = this.
|
|
629
|
+
const previous = this.scheduledRunReminders.get(piboSessionId);
|
|
402
630
|
if (previous !== undefined) {
|
|
403
|
-
this.
|
|
631
|
+
this.scheduledRunReminders.set(piboSessionId, previous || includeAlreadyNotified);
|
|
404
632
|
return;
|
|
405
633
|
}
|
|
406
|
-
this.
|
|
634
|
+
this.scheduledRunReminders.set(piboSessionId, includeAlreadyNotified);
|
|
407
635
|
queueMicrotask(() => {
|
|
408
|
-
void this.
|
|
636
|
+
void this.deliverRunReminder(piboSessionId);
|
|
409
637
|
});
|
|
410
638
|
}
|
|
411
|
-
|
|
412
|
-
const removed = this.sessions.get(piboSessionId)?.removeQueuedMessages(
|
|
639
|
+
refreshQueuedRunReminders(piboSessionId) {
|
|
640
|
+
const removed = this.sessions.get(piboSessionId)?.removeQueuedMessages(isRunReminderServiceMessage) ?? 0;
|
|
413
641
|
if (removed > 0)
|
|
414
|
-
this.
|
|
642
|
+
this.scheduleRunReminder(piboSessionId, true);
|
|
415
643
|
}
|
|
416
|
-
async
|
|
417
|
-
const includeAlreadyNotified = this.
|
|
418
|
-
this.
|
|
644
|
+
async deliverRunReminder(piboSessionId) {
|
|
645
|
+
const includeAlreadyNotified = this.scheduledRunReminders.get(piboSessionId) ?? false;
|
|
646
|
+
this.scheduledRunReminders.delete(piboSessionId);
|
|
419
647
|
const notification = this.runRegistry.createNotification(piboSessionId, { includeAlreadyNotified });
|
|
420
648
|
if (!notification)
|
|
421
649
|
return;
|
|
@@ -424,16 +652,18 @@ export class PiboSessionRouter {
|
|
|
424
652
|
session.enqueueMessage({
|
|
425
653
|
type: "message",
|
|
426
654
|
piboSessionId,
|
|
427
|
-
text:
|
|
655
|
+
text: formatRunReminderMessage(notification),
|
|
428
656
|
source: "service",
|
|
429
657
|
id: randomUUID(),
|
|
430
658
|
});
|
|
431
659
|
}
|
|
432
660
|
catch (error) {
|
|
661
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
433
662
|
this.emitOutput({
|
|
434
663
|
type: "session_error",
|
|
435
664
|
piboSessionId,
|
|
436
|
-
error:
|
|
665
|
+
error: message,
|
|
666
|
+
errorDetails: runtimeSessionErrorDetails(message),
|
|
437
667
|
});
|
|
438
668
|
}
|
|
439
669
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const SHARED_APP_SCOPE = "shared:app";
|
|
2
|
+
export const SHARED_PRINCIPAL_ID = "shared:app";
|
|
3
|
+
export function compatibleOwnerScopes(ownerScope) {
|
|
4
|
+
if (!ownerScope || ownerScope === SHARED_APP_SCOPE)
|
|
5
|
+
return [SHARED_APP_SCOPE];
|
|
6
|
+
return [ownerScope, SHARED_APP_SCOPE];
|
|
7
|
+
}
|
|
8
|
+
export function compatiblePrincipalIds(principalId) {
|
|
9
|
+
if (!principalId || principalId === SHARED_PRINCIPAL_ID)
|
|
10
|
+
return [SHARED_PRINCIPAL_ID];
|
|
11
|
+
return [principalId, SHARED_PRINCIPAL_ID];
|
|
12
|
+
}
|
|
13
|
+
export function isCompatibleOwnerScope(actual, expected) {
|
|
14
|
+
if (!expected)
|
|
15
|
+
return true;
|
|
16
|
+
return compatibleOwnerScopes(expected).includes(actual ?? SHARED_APP_SCOPE);
|
|
17
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
export function expandInlineSkills(text, skills) {
|
|
3
|
+
try {
|
|
4
|
+
const pattern = /(?<!\\)\$([a-z0-9-]+)/g;
|
|
5
|
+
const matches = [...text.matchAll(pattern)];
|
|
6
|
+
const seen = new Set();
|
|
7
|
+
const toExpand = [];
|
|
8
|
+
for (const match of matches) {
|
|
9
|
+
const name = match[1];
|
|
10
|
+
if (seen.has(name))
|
|
11
|
+
continue;
|
|
12
|
+
const skill = skills.find((s) => s.name === name);
|
|
13
|
+
if (!skill)
|
|
14
|
+
continue;
|
|
15
|
+
seen.add(name);
|
|
16
|
+
toExpand.push(skill);
|
|
17
|
+
}
|
|
18
|
+
if (toExpand.length === 0)
|
|
19
|
+
return text;
|
|
20
|
+
const appendices = toExpand.map((skill) => {
|
|
21
|
+
try {
|
|
22
|
+
const content = readFileSync(skill.filePath, "utf-8");
|
|
23
|
+
const body = stripFrontmatter(content).trim();
|
|
24
|
+
return `---\n\n$${skill.name}\n${body}`;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return `---\n\n$${skill.name}\n[Error: could not load skill content]`;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return `${text}\n\n${appendices.join("\n\n")}`;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return text;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function stripFrontmatter(content) {
|
|
37
|
+
if (!content.startsWith("---"))
|
|
38
|
+
return content;
|
|
39
|
+
const endIndex = content.indexOf("---", 3);
|
|
40
|
+
if (endIndex === -1)
|
|
41
|
+
return content;
|
|
42
|
+
return content.slice(endIndex + 3).trimStart();
|
|
43
|
+
}
|