@pasko70/pibo 1.0.5 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -250
- package/context/codex-base-prompt.md +4 -0
- package/context/compute-worker.md +23 -0
- package/context/pibo-native-tooling.md +18 -0
- package/context/pibo-system-prompt.md +69 -8
- package/dist/api/simple-agent-api.js +136 -0
- package/dist/app-context.js +4 -0
- package/dist/apps/chat/agent-profiles.js +42 -5
- package/dist/apps/chat/agent-store.js +113 -16
- package/dist/apps/chat/chat-api-routes.js +311 -0
- package/dist/apps/chat/chat-capability-routes.js +90 -0
- package/dist/apps/chat/chat-files.js +178 -0
- package/dist/apps/chat/chat-request-normalizers.js +681 -0
- package/dist/apps/chat/chat-settings-routes.js +75 -0
- package/dist/apps/chat/chat-trace-helpers.js +94 -0
- package/dist/apps/chat/chat-user-skill-routes.js +149 -0
- package/dist/apps/chat/cron-api.js +213 -0
- package/dist/apps/chat/data/chat-data-mappers.js +74 -0
- package/dist/apps/chat/data/event-command-service.js +75 -0
- package/dist/apps/chat/data/navigation-query-service.js +11 -0
- package/dist/apps/chat/data/project-service.js +844 -0
- package/dist/apps/chat/data/read-state-service.js +42 -0
- package/dist/apps/chat/data/room-service.js +52 -0
- package/dist/apps/chat/data/session-query-service.js +63 -0
- package/dist/apps/chat/data/timeline-query-service.js +96 -0
- package/dist/apps/chat/event-log.js +1 -307
- package/dist/apps/chat/model-catalog.js +47 -0
- package/dist/apps/chat/output-compactor.js +126 -0
- package/dist/apps/chat/output-event-policy.js +17 -0
- package/dist/apps/chat/project-workflow-human-actions.js +347 -0
- package/dist/apps/chat/project-workflow-sessions.js +260 -0
- package/dist/apps/chat/provider-auth-actions.js +43 -0
- package/dist/apps/chat/ralph-api.js +156 -0
- package/dist/apps/chat/read-model.js +1 -218
- package/dist/apps/chat/rooms.js +1 -321
- package/dist/apps/chat/static-assets.js +996 -0
- package/dist/apps/chat/stream.js +29 -6
- package/dist/apps/chat/trace.js +179 -1003
- package/dist/apps/chat/types/event-store.js +1 -0
- package/dist/apps/chat/types/read-model.js +1 -0
- package/dist/apps/chat/types/rooms.js +36 -0
- package/dist/apps/chat/web-app.js +3168 -1811
- package/dist/apps/chat/workflow-catalog.js +572 -0
- package/dist/apps/chat/workflow-edge-compatibility.js +51 -0
- package/dist/apps/chat/workflow-json-schema-validation.js +335 -0
- package/dist/apps/chat/workflow-persistence-model.js +140 -0
- package/dist/apps/chat/workflow-persistence.js +633 -0
- package/dist/apps/chat/workflow-registered-ref-params.js +130 -0
- package/dist/apps/chat/workflow-registered-ref-pickers.js +179 -0
- package/dist/apps/chat/workflow-registered-ref-validation.js +210 -0
- package/dist/apps/chat/workflow-v2-security-validation.js +93 -0
- package/dist/apps/chat/workflow-validation-helpers.js +114 -0
- package/dist/apps/chat-ui/assets/{dist-CI0Xj2Cp.js → dist-B4lw9z4F.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-aMr2VYOu.js → dist-BbTaHWON.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-u2OzzOTm.js → dist-BcT_c1EJ.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-Di1ScJ22.js → dist-CGINd7XU.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-wiRpAHIv.js → dist-CrBzZkUp.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CaNOvqMY.js → dist-CyyISotB.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-zgYUl2B-.js → dist-DFbnFNpX.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CNlhGq5i.js → dist-DGLWQLX8.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-BGxHKHPX.js → dist-DfcIkFSN.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DrM-H3e1.js → dist-sKDHTwaT.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DpmEro5R.js → dist-y9D6la48.js} +1 -1
- package/dist/apps/chat-ui/assets/index-C25VYnyb.css +1 -0
- package/dist/apps/chat-ui/assets/index-CUkuvI3v.js +165 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-144x144.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-192x192.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-48x48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-512x512.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-72x72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-96x96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/1024.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/114.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/120.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/128.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/144.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/152.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/167.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/180.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/192.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/29.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/50.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/512.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/57.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/58.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/76.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/87.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/index.html +8 -3
- package/dist/apps/chat-ui/manifest.webmanifest +25 -0
- package/dist/apps/chat-ui/sw.js +41 -0
- package/dist/apps/cli-ui/InkSessionApp.js +1218 -0
- package/dist/apps/cli-ui/InkTerminalLine.js +53 -0
- package/dist/apps/cli-ui/InkTerminalRow.js +304 -0
- package/dist/apps/cli-ui/InkTerminalView.js +25 -0
- package/dist/apps/cli-ui/cliSessionsCommand.js +232 -0
- package/dist/apps/cli-ui/index.js +8 -0
- package/dist/apps/cli-ui/inkColors.js +67 -0
- package/dist/apps/cli-ui/inkJson.js +244 -0
- package/dist/apps/cli-ui/inkMarkdown.js +122 -0
- package/dist/apps/context-files-ui/assets/{dist-DFi2YGux.js → dist-BOiGdrG-.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-DyfSeBMu.js → dist-DK01b7x4.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-CwbH_3RN.js → dist-DPG9jOQ-.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-dTBsFYAl.js → dist-Dp5AH00p.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-CxRLRmMx.js → dist-DqYw0LH7.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-MyZgX9K2.js → dist-TF5iO5ML.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-DQXzt2Ng.js → dist-TbjAhles.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-YwR9dpb-.js → dist-ZsBbt0uY.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-CKQF1zEu.js → dist-kmsvtHkH.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-BJW3917N.js → dist-vnd7PMu3.js} +1 -1
- package/dist/apps/context-files-ui/assets/{index-BwRDoHMC.css → index-B92tL3Pp.css} +1 -1
- package/dist/apps/context-files-ui/assets/{index-GwvjXytt.js → index-BhAWD3dv.js} +2 -2
- package/dist/apps/context-files-ui/index.html +2 -2
- package/dist/auth/better-auth.js +2 -1
- package/dist/auth/login-actions.js +251 -0
- package/dist/auth/openai-codex-usage.js +147 -0
- package/dist/bin/pibo.js +0 -0
- package/dist/bin/rg.js +15 -0
- package/dist/cli-session/fakeSessionSource.js +804 -0
- package/dist/cli-session/index.js +3 -0
- package/dist/cli-session/localSessionSource.js +1144 -0
- package/dist/cli-session/sessionSource.js +13 -0
- package/dist/cli.js +142 -14
- package/dist/compute/cli.js +415 -0
- package/dist/compute/docker.js +827 -0
- package/dist/compute/resource-health.js +333 -0
- package/dist/compute/resource-policy.js +98 -0
- package/dist/config/config.js +9 -5
- package/dist/core/context-build.js +677 -0
- package/dist/core/model-defaults.js +51 -9
- package/dist/core/pibo-home.js +8 -0
- package/dist/core/profiles.js +48 -0
- package/dist/core/provider-telemetry.js +222 -0
- package/dist/core/routed-session.js +441 -47
- package/dist/core/runtime-telemetry.js +853 -0
- package/dist/core/runtime.js +103 -15
- package/dist/core/session-errors.js +47 -0
- package/dist/core/session-model.js +39 -0
- package/dist/core/session-router.js +292 -62
- package/dist/core/shared-app.js +17 -0
- package/dist/core/skill-expansion.js +43 -0
- package/dist/core/system-prompt-template.js +9 -9
- package/dist/core/telemetry-staleness.js +128 -0
- package/dist/core/test-output-compaction.js +145 -0
- package/dist/core/user-settings.js +73 -0
- package/dist/cron/channel.js +28 -0
- package/dist/cron/cli.js +230 -0
- package/dist/cron/plugin.js +11 -0
- package/dist/cron/schedule.js +214 -0
- package/dist/cron/service.js +177 -0
- package/dist/cron/store.js +349 -0
- package/dist/cron/types.js +1 -0
- package/dist/data/cli.js +184 -0
- package/dist/data/event-log.js +106 -0
- package/dist/data/final-app-space-cutover-migration.js +728 -0
- package/dist/data/ingest-service.js +389 -0
- package/dist/data/message-store.js +62 -0
- package/dist/data/navigation-store.js +75 -0
- package/dist/data/observation-store.js +46 -0
- package/dist/data/payload-store.js +144 -0
- package/dist/data/pibo-store.js +59 -0
- package/dist/data/schema.js +434 -0
- package/dist/data/session-store.js +63 -0
- package/dist/data/shared-app-migration.js +757 -0
- package/dist/data/sqlite-schema.js +12 -0
- package/dist/data/telemetry-preview.js +65 -0
- package/dist/data/telemetry-queries.js +212 -0
- package/dist/data/telemetry-retention.js +50 -0
- package/dist/data/telemetry-rows.js +158 -0
- package/dist/data/telemetry.js +357 -0
- package/dist/debug/delta-compaction.js +99 -0
- package/dist/debug/detail-format.js +86 -0
- package/dist/debug/events.js +149 -29
- package/dist/debug/failures.js +162 -0
- package/dist/debug/index.js +655 -30
- package/dist/debug/messages.js +185 -0
- package/dist/debug/next-commands.js +6 -0
- package/dist/debug/payloads.js +123 -0
- package/dist/debug/pty.js +924 -0
- package/dist/debug/session.js +45 -15
- package/dist/debug/sql.js +1 -1
- package/dist/debug/stores.js +18 -13
- package/dist/debug/summary.js +72 -0
- package/dist/debug/telemetry.js +649 -0
- package/dist/debug/tools.js +168 -0
- package/dist/debug/trace-render-check.js +151 -0
- package/dist/debug/trace.js +152 -27
- package/dist/debug/web-artifacts.js +63 -0
- package/dist/debug/web-options.js +313 -0
- package/dist/debug/web-render-analysis.js +310 -0
- package/dist/debug/web-snapshot-browser-scripts.js +303 -0
- package/dist/debug/web-streaming-benchmark-analysis.js +605 -0
- package/dist/debug/web-streaming-browser-library.js +928 -0
- package/dist/debug/web-streaming-browser-scripts.js +242 -0
- package/dist/debug/web-streaming-provider-telemetry.js +194 -0
- package/dist/debug/web-streaming-report.js +493 -0
- package/dist/debug/web-streaming-types.js +1 -0
- package/dist/debug/web.js +574 -0
- package/dist/gateway/backup.js +83 -0
- package/dist/gateway/cli.js +511 -0
- package/dist/gateway/fallback.js +155 -0
- package/dist/gateway/pidfile.js +84 -0
- package/dist/gateway/protocol.js +16 -0
- package/dist/gateway/server.js +174 -17
- package/dist/gateway/tool.js +54 -51
- package/dist/gateway/web.js +74 -2
- package/dist/index.js +3 -1
- package/dist/local/client.js +3 -3
- package/dist/local/extension.js +8 -5
- package/dist/plugins/builtin.js +252 -49
- package/dist/plugins/chat-vscode-web.js +28 -0
- package/dist/plugins/codex-compat.js +0 -41
- package/dist/plugins/context-files.js +98 -18
- package/dist/plugins/dev-auth.js +124 -0
- package/dist/plugins/native-tooling.js +15 -0
- package/dist/plugins/registry.js +66 -2
- package/dist/plugins/web-annotations.js +27 -0
- package/dist/providers/minimax.js +70 -0
- package/dist/providers/openai-compat.js +48 -0
- package/dist/ralph/channel.js +8 -0
- package/dist/ralph/cli.js +152 -0
- package/dist/ralph/plugin.js +14 -0
- package/dist/ralph/service.js +271 -0
- package/dist/ralph/stopping.js +151 -0
- package/dist/ralph/store.js +450 -0
- package/dist/ralph/templates.js +200 -0
- package/dist/ralph/types.js +1 -0
- package/dist/reliability/store.js +42 -26
- package/dist/runs/registry.js +72 -35
- package/dist/session-ui/commandCatalog.js +193 -0
- package/dist/session-ui/commandResults.js +95 -0
- package/dist/session-ui/index.js +7 -0
- package/dist/session-ui/ownerViewModel.js +27 -0
- package/dist/session-ui/roomSessionViewModel.js +69 -0
- package/dist/session-ui/statusViewModel.js +127 -0
- package/dist/session-ui/terminalCards.js +210 -0
- package/dist/session-ui/terminalRows.js +937 -0
- package/dist/session-ui/terminalValue.js +45 -0
- package/dist/sessions/pibo-data-store.js +178 -0
- package/dist/sessions/sqlite-store.js +78 -12
- package/dist/sessions/store.js +11 -4
- package/dist/sessions/workflow-session-kind.js +20 -0
- package/dist/setup/cli.js +567 -0
- package/dist/shared/trace-async-agent-runs.js +127 -0
- package/dist/shared/trace-engine.js +96 -0
- package/dist/shared/trace-event-projection.js +679 -0
- package/dist/shared/trace-live-reducer.js +191 -0
- package/dist/shared/trace-nodes.js +76 -0
- package/dist/shared/trace-order.js +11 -10
- package/dist/shared/trace-patch-nodes.js +83 -0
- package/dist/shared/trace-run-notifications.js +69 -0
- package/dist/shared/trace-subagent-links.js +46 -0
- package/dist/shared/trace-transcript.js +303 -0
- package/dist/shared/trace-types.js +1 -0
- package/dist/shared-app.js +4 -0
- package/dist/signals/aggregate.js +65 -0
- package/dist/signals/events.js +1 -0
- package/dist/signals/projector.js +158 -0
- package/dist/signals/registry.js +513 -0
- package/dist/signals/store.js +1 -0
- package/dist/signals/types.js +1 -0
- package/dist/skills/cli.js +117 -0
- package/dist/tools/agent-browser-leases.js +219 -0
- package/dist/tools/agent-browser-wrapper.js +99 -0
- package/dist/tools/browser-pool.js +623 -0
- package/dist/tools/browser-use-cdp.js +56 -4
- package/dist/tools/browser-use-leases.js +215 -37
- package/dist/tools/browser-use-wrapper.js +508 -65
- package/dist/tools/cdp-client.js +189 -0
- package/dist/tools/guides.js +203 -4
- package/dist/tools/index.js +666 -16
- package/dist/tools/npm-runtime.js +136 -0
- package/dist/tools/registry.js +107 -8
- package/dist/tools/runtime/index.js +3 -0
- package/dist/tools/runtime/node-backend.js +225 -0
- package/dist/tools/runtime/node-worker-source.js +206 -0
- package/dist/tools/runtime/python-backend.js +227 -0
- package/dist/tools/runtime/python-worker-source.js +178 -0
- package/dist/tools/runtime/registry.js +255 -0
- package/dist/tools/runtime/tool.js +168 -0
- package/dist/tools/runtime/types.js +1 -0
- package/dist/tools/web-search.js +2 -1
- package/dist/user-skills/installer.js +214 -0
- package/dist/user-skills/manager.js +35 -0
- package/dist/user-skills/store.js +267 -0
- package/dist/user-skills/types.js +1 -0
- package/dist/web/auth.js +5 -1
- package/dist/web/channel.js +86 -0
- package/dist/web/http.js +79 -14
- package/dist/web-annotations/api.js +348 -0
- package/dist/web-annotations/attachments.js +201 -0
- package/dist/web-annotations/cdp.js +1107 -0
- package/dist/web-annotations/index.js +7 -0
- package/dist/web-annotations/store.js +407 -0
- package/dist/web-annotations/tools.js +350 -0
- package/dist/web-annotations/types.js +34 -0
- package/dist/web-annotations/validation.js +288 -0
- package/docs/README.md +23 -0
- package/docs/ops/install-developer-host.md +112 -0
- package/docs/ops/install-user-host.md +76 -0
- package/docs/ops/upgrade-user-to-developer-host.md +69 -0
- package/package.json +24 -10
- package/{.codex/skills → skills/builtin}/pi-agent-harness/SKILL.md +24 -24
- package/skills/builtin/pibo-docker-system/SKILL.md +170 -0
- package/skills/builtin/pibo-spec-writing/SKILL.md +330 -0
- package/skills/builtin/prd/SKILL.md +143 -0
- package/skills/builtin/ralph-loop/SKILL.md +359 -0
- package/skills/builtin/ralph-prd-json/SKILL.md +123 -0
- package/skills/builtin/skill-creator/LICENSE.txt +202 -0
- package/skills/builtin/skill-creator/SKILL.md +513 -0
- package/skills/builtin/skill-creator/agents/analyzer.md +274 -0
- package/skills/builtin/skill-creator/agents/comparator.md +202 -0
- package/skills/builtin/skill-creator/agents/grader.md +223 -0
- package/skills/builtin/skill-creator/assets/eval_review.html +146 -0
- package/skills/builtin/skill-creator/eval-viewer/generate_review.py +471 -0
- package/skills/builtin/skill-creator/eval-viewer/viewer.html +1325 -0
- package/skills/builtin/skill-creator/references/schemas.md +430 -0
- package/skills/builtin/skill-creator/scripts/__init__.py +0 -0
- package/skills/builtin/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/skills/builtin/skill-creator/scripts/generate_report.py +326 -0
- package/skills/builtin/skill-creator/scripts/improve_description.py +247 -0
- package/skills/builtin/skill-creator/scripts/package_skill.py +136 -0
- package/skills/builtin/skill-creator/scripts/quick_validate.py +103 -0
- package/skills/builtin/skill-creator/scripts/run_eval.py +310 -0
- package/skills/builtin/skill-creator/scripts/run_loop.py +328 -0
- package/skills/builtin/skill-creator/scripts/utils.py +47 -0
- package/skills/builtin/web-annotations/SKILL.md +93 -0
- package/dist/apps/chat-ui/assets/index-B_E935fP.js +0 -151
- package/dist/apps/chat-ui/assets/index-Dk-opWl3.css +0 -1
- package/dist/env.js +0 -32
- package/dist/plugins/core-tools.js +0 -94
- package/dist/plugins/example.js +0 -67
- package/dist/plugins/remote-agent.js +0 -9
- package/dist/remote/channel.js +0 -176
- package/dist/remote/client.js +0 -92
- package/dist/remote/examples/tui-controller.js +0 -263
- package/dist/remote/protocol.js +0 -55
- package/dist/remote/session-client.js +0 -189
- package/dist/sessions/bindings.js +0 -41
- /package/{.codex/skills → skills/builtin}/pi-agent-harness/agents/openai.yaml +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function renderableTerminalValue(value) {
|
|
2
|
+
if (value === undefined || value === null)
|
|
3
|
+
return { kind: "empty" };
|
|
4
|
+
const text = terminalTextValue(value);
|
|
5
|
+
if (text !== undefined)
|
|
6
|
+
return { kind: "text", text };
|
|
7
|
+
return { kind: "json", value };
|
|
8
|
+
}
|
|
9
|
+
export function terminalTextValue(value) {
|
|
10
|
+
if (typeof value === "string")
|
|
11
|
+
return value;
|
|
12
|
+
if (Array.isArray(value)) {
|
|
13
|
+
const parts = value.map(terminalTextValue).filter((part) => part !== undefined);
|
|
14
|
+
return parts.length === value.length && parts.length > 0 ? parts.join("") : undefined;
|
|
15
|
+
}
|
|
16
|
+
if (!isRecord(value))
|
|
17
|
+
return undefined;
|
|
18
|
+
const type = typeof value.type === "string" ? value.type : undefined;
|
|
19
|
+
if (type === "text" && typeof value.text === "string")
|
|
20
|
+
return value.text;
|
|
21
|
+
if (type === "text" && typeof value.content === "string")
|
|
22
|
+
return value.content;
|
|
23
|
+
if (type === "output_text" && typeof value.text === "string")
|
|
24
|
+
return value.text;
|
|
25
|
+
const content = terminalTextValue(value.content);
|
|
26
|
+
if (content !== undefined && isTextContentWrapper(value))
|
|
27
|
+
return content;
|
|
28
|
+
const messageContent = isRecord(value.message) ? terminalTextValue(value.message.content) : undefined;
|
|
29
|
+
if (messageContent !== undefined)
|
|
30
|
+
return messageContent;
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
function isTextContentWrapper(value) {
|
|
34
|
+
const keys = Object.keys(value).filter((key) => value[key] !== undefined);
|
|
35
|
+
if (keys.length === 1 && keys[0] === "content")
|
|
36
|
+
return true;
|
|
37
|
+
if (keys.every((key) => key === "content" || key === "type"))
|
|
38
|
+
return true;
|
|
39
|
+
if (keys.every((key) => key === "content" || key === "details" || key === "type"))
|
|
40
|
+
return true;
|
|
41
|
+
return typeof value.type === "string" && value.type.includes("text");
|
|
42
|
+
}
|
|
43
|
+
function isRecord(value) {
|
|
44
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
45
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { PiboDataStore } from "../data/pibo-store.js";
|
|
2
|
+
import { createPiboSession, matchesFindInput, } from "./store.js";
|
|
3
|
+
export class PiboDataSessionStore {
|
|
4
|
+
dataStore;
|
|
5
|
+
db;
|
|
6
|
+
ownsDataStore;
|
|
7
|
+
constructor(dataStore = new PiboDataStore()) {
|
|
8
|
+
if (typeof dataStore === "string") {
|
|
9
|
+
this.dataStore = new PiboDataStore(dataStore);
|
|
10
|
+
this.ownsDataStore = true;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
this.dataStore = dataStore;
|
|
14
|
+
this.ownsDataStore = false;
|
|
15
|
+
}
|
|
16
|
+
this.db = this.dataStore.db;
|
|
17
|
+
}
|
|
18
|
+
get(id) {
|
|
19
|
+
const row = this.db.prepare("SELECT * FROM sessions WHERE id = ? AND deleted_at IS NULL").get(id);
|
|
20
|
+
return row ? sessionFromRow(row) : undefined;
|
|
21
|
+
}
|
|
22
|
+
list() {
|
|
23
|
+
return this.db.prepare("SELECT * FROM sessions WHERE deleted_at IS NULL ORDER BY updated_at DESC").all().map(sessionFromRow);
|
|
24
|
+
}
|
|
25
|
+
create(input) {
|
|
26
|
+
const session = createPiboSession(input);
|
|
27
|
+
this.insertSession(session);
|
|
28
|
+
const created = this.get(session.id);
|
|
29
|
+
if (!created)
|
|
30
|
+
throw new Error(`Failed to create Pibo session "${session.id}"`);
|
|
31
|
+
return created;
|
|
32
|
+
}
|
|
33
|
+
update(id, input) {
|
|
34
|
+
const existing = this.get(id);
|
|
35
|
+
if (!existing)
|
|
36
|
+
return undefined;
|
|
37
|
+
if (input.piSessionId && input.piSessionId !== existing.piSessionId) {
|
|
38
|
+
const attached = this.db
|
|
39
|
+
.prepare("SELECT id FROM sessions WHERE pi_session_id = ? AND id <> ? AND deleted_at IS NULL")
|
|
40
|
+
.get(input.piSessionId, id);
|
|
41
|
+
if (attached)
|
|
42
|
+
throw new Error(`Pi session "${input.piSessionId}" is already attached to Pibo session "${attached.id}"`);
|
|
43
|
+
}
|
|
44
|
+
const updated = {
|
|
45
|
+
...existing,
|
|
46
|
+
piSessionId: input.piSessionId ?? existing.piSessionId,
|
|
47
|
+
profile: input.profile ?? existing.profile,
|
|
48
|
+
parentId: input.parentId === null ? undefined : input.parentId ?? existing.parentId,
|
|
49
|
+
originId: input.originId === null ? undefined : input.originId ?? existing.originId,
|
|
50
|
+
workspace: input.workspace === null ? undefined : input.workspace ?? existing.workspace,
|
|
51
|
+
title: input.title === null ? undefined : input.title ?? existing.title,
|
|
52
|
+
metadata: input.metadata ?? existing.metadata,
|
|
53
|
+
activeModel: input.activeModel === null ? undefined : input.activeModel ? { ...input.activeModel } : existing.activeModel,
|
|
54
|
+
updatedAt: new Date().toISOString(),
|
|
55
|
+
};
|
|
56
|
+
this.db.prepare(`
|
|
57
|
+
UPDATE sessions SET
|
|
58
|
+
pi_session_id = ?,
|
|
59
|
+
root_session_id = ?,
|
|
60
|
+
parent_id = ?,
|
|
61
|
+
origin_id = ?,
|
|
62
|
+
profile = ?,
|
|
63
|
+
active_model_json = ?,
|
|
64
|
+
workspace = ?,
|
|
65
|
+
title = ?,
|
|
66
|
+
metadata_json = ?,
|
|
67
|
+
updated_at = ?,
|
|
68
|
+
last_activity_at = MAX(last_activity_at, ?)
|
|
69
|
+
WHERE id = ? AND deleted_at IS NULL
|
|
70
|
+
`).run(updated.piSessionId, rootSessionId(updated), updated.parentId ?? null, updated.originId ?? null, updated.profile, updated.activeModel ? JSON.stringify(updated.activeModel) : null, updated.workspace ?? null, updated.title ?? "Untitled Session", JSON.stringify(updated.metadata ?? {}), updated.updatedAt, updated.updatedAt, id);
|
|
71
|
+
return this.get(id);
|
|
72
|
+
}
|
|
73
|
+
delete(id) {
|
|
74
|
+
const result = this.db.prepare("DELETE FROM sessions WHERE id = ?").run(id);
|
|
75
|
+
return Number(result.changes ?? 0) > 0;
|
|
76
|
+
}
|
|
77
|
+
find(input) {
|
|
78
|
+
const clauses = ["deleted_at IS NULL"];
|
|
79
|
+
const values = [];
|
|
80
|
+
if (input.ids !== undefined) {
|
|
81
|
+
if (input.ids.length === 0)
|
|
82
|
+
return [];
|
|
83
|
+
clauses.push(`id IN (${input.ids.map(() => "?").join(", ")})`);
|
|
84
|
+
values.push(...input.ids);
|
|
85
|
+
}
|
|
86
|
+
if (input.channel !== undefined) {
|
|
87
|
+
clauses.push("channel = ?");
|
|
88
|
+
values.push(input.channel);
|
|
89
|
+
}
|
|
90
|
+
if (input.kind !== undefined) {
|
|
91
|
+
clauses.push("kind = ?");
|
|
92
|
+
values.push(input.kind);
|
|
93
|
+
}
|
|
94
|
+
if (input.parentId !== undefined) {
|
|
95
|
+
if (input.parentId === null)
|
|
96
|
+
clauses.push("parent_id IS NULL");
|
|
97
|
+
else {
|
|
98
|
+
clauses.push("parent_id = ?");
|
|
99
|
+
values.push(input.parentId);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (input.originId !== undefined) {
|
|
103
|
+
clauses.push("origin_id = ?");
|
|
104
|
+
values.push(input.originId);
|
|
105
|
+
}
|
|
106
|
+
if (input.profile !== undefined) {
|
|
107
|
+
clauses.push("profile = ?");
|
|
108
|
+
values.push(input.profile);
|
|
109
|
+
}
|
|
110
|
+
if (input.activeModel !== undefined) {
|
|
111
|
+
if (input.activeModel === null)
|
|
112
|
+
clauses.push("active_model_json IS NULL");
|
|
113
|
+
else
|
|
114
|
+
clauses.push("active_model_json IS NOT NULL");
|
|
115
|
+
}
|
|
116
|
+
const rows = this.db.prepare(`SELECT * FROM sessions WHERE ${clauses.join(" AND ")} ORDER BY updated_at DESC`).all(...values);
|
|
117
|
+
return rows.map(sessionFromRow).filter((session) => matchesFindInput(session, input));
|
|
118
|
+
}
|
|
119
|
+
getTelemetryStore() {
|
|
120
|
+
return this.dataStore.telemetry;
|
|
121
|
+
}
|
|
122
|
+
close() {
|
|
123
|
+
if (this.ownsDataStore)
|
|
124
|
+
this.dataStore.close();
|
|
125
|
+
}
|
|
126
|
+
insertSession(session) {
|
|
127
|
+
const columns = [
|
|
128
|
+
"id", "pi_session_id", "room_id", "root_session_id", "parent_id", "origin_id",
|
|
129
|
+
"channel", "kind", "profile", "active_model_json", "workspace", "title", "first_message_preview",
|
|
130
|
+
"status", "metadata_json", "created_at", "updated_at", "last_activity_at",
|
|
131
|
+
];
|
|
132
|
+
this.db.prepare(`
|
|
133
|
+
INSERT INTO sessions (${columns.join(", ")}) VALUES (${columns.map(() => "?").join(", ")})
|
|
134
|
+
`).run(session.id, session.piSessionId, roomIdFromMetadata(session.metadata), rootSessionId(session), session.parentId ?? null, session.originId ?? null, session.channel, session.kind, session.profile, session.activeModel ? JSON.stringify(session.activeModel) : null, session.workspace ?? null, session.title ?? "Untitled Session", previewText(session.title ?? "") ?? null, "idle", JSON.stringify(session.metadata ?? {}), session.createdAt, session.updatedAt, session.updatedAt);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export function createDefaultPiboDataSessionStore() {
|
|
138
|
+
return new PiboDataSessionStore(new PiboDataStore());
|
|
139
|
+
}
|
|
140
|
+
function sessionFromRow(row) {
|
|
141
|
+
return {
|
|
142
|
+
id: row.id,
|
|
143
|
+
piSessionId: row.pi_session_id ?? "",
|
|
144
|
+
channel: row.channel,
|
|
145
|
+
kind: row.kind,
|
|
146
|
+
profile: row.profile,
|
|
147
|
+
parentId: row.parent_id ?? undefined,
|
|
148
|
+
originId: row.origin_id ?? undefined,
|
|
149
|
+
workspace: row.workspace ?? undefined,
|
|
150
|
+
title: row.title ?? undefined,
|
|
151
|
+
metadata: parseJsonObject(row.metadata_json),
|
|
152
|
+
activeModel: row.active_model_json ? JSON.parse(row.active_model_json) : undefined,
|
|
153
|
+
createdAt: row.created_at,
|
|
154
|
+
updatedAt: row.updated_at,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function parseJsonObject(json) {
|
|
158
|
+
if (!json)
|
|
159
|
+
return {};
|
|
160
|
+
try {
|
|
161
|
+
const value = JSON.parse(json);
|
|
162
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return {};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function rootSessionId(session) {
|
|
169
|
+
return session.parentId ? (typeof session.metadata?.rootSessionId === "string" ? session.metadata.rootSessionId : session.parentId) : session.id;
|
|
170
|
+
}
|
|
171
|
+
function roomIdFromMetadata(metadata) {
|
|
172
|
+
const value = metadata?.chatRoomId;
|
|
173
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
174
|
+
}
|
|
175
|
+
function previewText(text) {
|
|
176
|
+
const normalized = text.replace(/\s+/g, " ").trim();
|
|
177
|
+
return normalized ? normalized.slice(0, 512) : undefined;
|
|
178
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mkdirSync } from "node:fs";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { piboHomePath } from "../core/pibo-home.js";
|
|
3
4
|
import { DatabaseSync } from "node:sqlite";
|
|
4
5
|
import { createPiboSession, matchesFindInput, } from "./store.js";
|
|
5
6
|
export class SqlitePiboSessionStore {
|
|
@@ -13,6 +14,10 @@ export class SqlitePiboSessionStore {
|
|
|
13
14
|
this.db.exec("PRAGMA busy_timeout = 5000");
|
|
14
15
|
if (resolvedPath !== ":memory:")
|
|
15
16
|
this.db.exec("PRAGMA journal_mode = WAL");
|
|
17
|
+
this.applySchema();
|
|
18
|
+
this.ensureActiveModelColumn();
|
|
19
|
+
}
|
|
20
|
+
applySchema() {
|
|
16
21
|
this.db.exec(`
|
|
17
22
|
CREATE TABLE IF NOT EXISTS pibo_sessions (
|
|
18
23
|
id TEXT PRIMARY KEY,
|
|
@@ -20,20 +25,18 @@ export class SqlitePiboSessionStore {
|
|
|
20
25
|
channel TEXT NOT NULL,
|
|
21
26
|
kind TEXT NOT NULL,
|
|
22
27
|
profile TEXT NOT NULL,
|
|
23
|
-
owner_scope TEXT,
|
|
24
28
|
parent_id TEXT,
|
|
25
29
|
origin_id TEXT,
|
|
26
30
|
workspace TEXT,
|
|
27
31
|
title TEXT,
|
|
28
32
|
metadata_json TEXT,
|
|
33
|
+
active_model_json TEXT,
|
|
29
34
|
created_at TEXT NOT NULL,
|
|
30
35
|
updated_at TEXT NOT NULL,
|
|
31
36
|
FOREIGN KEY(parent_id) REFERENCES pibo_sessions(id),
|
|
32
37
|
FOREIGN KEY(origin_id) REFERENCES pibo_sessions(id)
|
|
33
38
|
);
|
|
34
39
|
|
|
35
|
-
CREATE INDEX IF NOT EXISTS idx_pibo_sessions_owner
|
|
36
|
-
ON pibo_sessions(owner_scope, updated_at);
|
|
37
40
|
CREATE INDEX IF NOT EXISTS idx_pibo_sessions_parent
|
|
38
41
|
ON pibo_sessions(parent_id, updated_at);
|
|
39
42
|
CREATE INDEX IF NOT EXISTS idx_pibo_sessions_origin
|
|
@@ -42,6 +45,11 @@ export class SqlitePiboSessionStore {
|
|
|
42
45
|
ON pibo_sessions(channel, kind, updated_at);
|
|
43
46
|
`);
|
|
44
47
|
}
|
|
48
|
+
ensureActiveModelColumn() {
|
|
49
|
+
const columns = new Set(this.db.prepare("PRAGMA table_info(pibo_sessions)").all().map((column) => column.name));
|
|
50
|
+
if (!columns.has("active_model_json"))
|
|
51
|
+
this.db.exec("ALTER TABLE pibo_sessions ADD COLUMN active_model_json TEXT");
|
|
52
|
+
}
|
|
45
53
|
get(id) {
|
|
46
54
|
const row = this.db.prepare("SELECT * FROM pibo_sessions WHERE id = ?").get(id);
|
|
47
55
|
return row ? sessionFromRow(row) : undefined;
|
|
@@ -59,17 +67,17 @@ export class SqlitePiboSessionStore {
|
|
|
59
67
|
channel,
|
|
60
68
|
kind,
|
|
61
69
|
profile,
|
|
62
|
-
owner_scope,
|
|
63
70
|
parent_id,
|
|
64
71
|
origin_id,
|
|
65
72
|
workspace,
|
|
66
73
|
title,
|
|
67
74
|
metadata_json,
|
|
75
|
+
active_model_json,
|
|
68
76
|
created_at,
|
|
69
77
|
updated_at
|
|
70
78
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
71
79
|
`)
|
|
72
|
-
.run(session.id, session.piSessionId, session.channel, session.kind, session.profile, session.
|
|
80
|
+
.run(session.id, session.piSessionId, session.channel, session.kind, session.profile, session.parentId ?? null, session.originId ?? null, session.workspace ?? null, session.title ?? null, JSON.stringify(session.metadata ?? {}), session.activeModel ? JSON.stringify(session.activeModel) : null, session.createdAt, session.updatedAt);
|
|
73
81
|
const created = this.get(session.id);
|
|
74
82
|
if (!created)
|
|
75
83
|
throw new Error(`Failed to create Pibo session "${session.id}"`);
|
|
@@ -83,12 +91,12 @@ export class SqlitePiboSessionStore {
|
|
|
83
91
|
...existing,
|
|
84
92
|
piSessionId: input.piSessionId ?? existing.piSessionId,
|
|
85
93
|
profile: input.profile ?? existing.profile,
|
|
86
|
-
ownerScope: input.ownerScope ?? existing.ownerScope,
|
|
87
94
|
parentId: input.parentId === null ? undefined : input.parentId ?? existing.parentId,
|
|
88
95
|
originId: input.originId === null ? undefined : input.originId ?? existing.originId,
|
|
89
96
|
workspace: input.workspace === null ? undefined : input.workspace ?? existing.workspace,
|
|
90
97
|
title: input.title === null ? undefined : input.title ?? existing.title,
|
|
91
98
|
metadata: input.metadata ?? existing.metadata,
|
|
99
|
+
activeModel: input.activeModel === null ? undefined : input.activeModel ? { ...input.activeModel } : existing.activeModel,
|
|
92
100
|
updatedAt: new Date().toISOString(),
|
|
93
101
|
};
|
|
94
102
|
this.db
|
|
@@ -96,16 +104,16 @@ export class SqlitePiboSessionStore {
|
|
|
96
104
|
UPDATE pibo_sessions SET
|
|
97
105
|
pi_session_id = ?,
|
|
98
106
|
profile = ?,
|
|
99
|
-
owner_scope = ?,
|
|
100
107
|
parent_id = ?,
|
|
101
108
|
origin_id = ?,
|
|
102
109
|
workspace = ?,
|
|
103
110
|
title = ?,
|
|
104
111
|
metadata_json = ?,
|
|
112
|
+
active_model_json = ?,
|
|
105
113
|
updated_at = ?
|
|
106
114
|
WHERE id = ?
|
|
107
115
|
`)
|
|
108
|
-
.run(updated.piSessionId, updated.profile, updated.
|
|
116
|
+
.run(updated.piSessionId, updated.profile, updated.parentId ?? null, updated.originId ?? null, updated.workspace ?? null, updated.title ?? null, JSON.stringify(updated.metadata ?? {}), updated.activeModel ? JSON.stringify(updated.activeModel) : null, updated.updatedAt, id);
|
|
109
117
|
return this.get(id);
|
|
110
118
|
}
|
|
111
119
|
delete(id) {
|
|
@@ -113,14 +121,56 @@ export class SqlitePiboSessionStore {
|
|
|
113
121
|
return Number(result.changes ?? 0) > 0;
|
|
114
122
|
}
|
|
115
123
|
find(input) {
|
|
116
|
-
|
|
124
|
+
const clauses = [];
|
|
125
|
+
const values = [];
|
|
126
|
+
if (input.ids !== undefined) {
|
|
127
|
+
if (input.ids.length === 0)
|
|
128
|
+
return [];
|
|
129
|
+
clauses.push(`id IN (${input.ids.map(() => "?").join(", ")})`);
|
|
130
|
+
values.push(...input.ids);
|
|
131
|
+
}
|
|
132
|
+
if (input.channel !== undefined) {
|
|
133
|
+
clauses.push("channel = ?");
|
|
134
|
+
values.push(input.channel);
|
|
135
|
+
}
|
|
136
|
+
if (input.kind !== undefined) {
|
|
137
|
+
clauses.push("kind = ?");
|
|
138
|
+
values.push(input.kind);
|
|
139
|
+
}
|
|
140
|
+
if (input.parentId !== undefined) {
|
|
141
|
+
if (input.parentId === null)
|
|
142
|
+
clauses.push("parent_id IS NULL");
|
|
143
|
+
else {
|
|
144
|
+
clauses.push("parent_id = ?");
|
|
145
|
+
values.push(input.parentId);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (input.originId !== undefined) {
|
|
149
|
+
clauses.push("origin_id = ?");
|
|
150
|
+
values.push(input.originId);
|
|
151
|
+
}
|
|
152
|
+
if (input.profile !== undefined) {
|
|
153
|
+
clauses.push("profile = ?");
|
|
154
|
+
values.push(input.profile);
|
|
155
|
+
}
|
|
156
|
+
if (input.activeModel !== undefined) {
|
|
157
|
+
if (input.activeModel === null)
|
|
158
|
+
clauses.push("active_model_json IS NULL");
|
|
159
|
+
else
|
|
160
|
+
clauses.push("active_model_json IS NOT NULL");
|
|
161
|
+
}
|
|
162
|
+
const where = clauses.length ? `WHERE ${clauses.join(" AND ")}` : "";
|
|
163
|
+
const rows = this.db
|
|
164
|
+
.prepare(`SELECT * FROM pibo_sessions ${where} ORDER BY updated_at DESC`)
|
|
165
|
+
.all(...values);
|
|
166
|
+
return rows.map(sessionFromRow).filter((session) => matchesFindInput(session, input));
|
|
117
167
|
}
|
|
118
168
|
close() {
|
|
119
169
|
this.db.close();
|
|
120
170
|
}
|
|
121
171
|
}
|
|
122
|
-
export function createDefaultPiboSessionStore(
|
|
123
|
-
return new SqlitePiboSessionStore(
|
|
172
|
+
export function createDefaultPiboSessionStore(_cwd) {
|
|
173
|
+
return new SqlitePiboSessionStore(piboHomePath("pibo-sessions.sqlite"));
|
|
124
174
|
}
|
|
125
175
|
function sessionFromRow(row) {
|
|
126
176
|
return {
|
|
@@ -129,12 +179,12 @@ function sessionFromRow(row) {
|
|
|
129
179
|
channel: row.channel,
|
|
130
180
|
kind: row.kind,
|
|
131
181
|
profile: row.profile,
|
|
132
|
-
ownerScope: row.owner_scope ?? undefined,
|
|
133
182
|
parentId: row.parent_id ?? undefined,
|
|
134
183
|
originId: row.origin_id ?? undefined,
|
|
135
184
|
workspace: row.workspace ?? undefined,
|
|
136
185
|
title: row.title ?? undefined,
|
|
137
186
|
metadata: parseMetadata(row.metadata_json),
|
|
187
|
+
activeModel: parseModelProfile(row.active_model_json),
|
|
138
188
|
createdAt: row.created_at,
|
|
139
189
|
updatedAt: row.updated_at,
|
|
140
190
|
};
|
|
@@ -152,3 +202,19 @@ function parseMetadata(value) {
|
|
|
152
202
|
return {};
|
|
153
203
|
}
|
|
154
204
|
}
|
|
205
|
+
function parseModelProfile(value) {
|
|
206
|
+
if (!value)
|
|
207
|
+
return undefined;
|
|
208
|
+
try {
|
|
209
|
+
const parsed = JSON.parse(value);
|
|
210
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
211
|
+
return undefined;
|
|
212
|
+
const raw = parsed;
|
|
213
|
+
if (typeof raw.provider !== "string" || typeof raw.id !== "string")
|
|
214
|
+
return undefined;
|
|
215
|
+
return { provider: raw.provider, id: raw.id };
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
}
|
package/dist/sessions/store.js
CHANGED
|
@@ -12,12 +12,12 @@ export function createPiboSession(input, now = new Date().toISOString()) {
|
|
|
12
12
|
channel: input.channel,
|
|
13
13
|
kind: input.kind,
|
|
14
14
|
profile: input.profile,
|
|
15
|
-
ownerScope: input.ownerScope,
|
|
16
15
|
parentId: input.parentId,
|
|
17
16
|
originId: input.originId,
|
|
18
17
|
workspace: input.workspace,
|
|
19
18
|
title: input.title,
|
|
20
19
|
metadata: input.metadata ?? {},
|
|
20
|
+
activeModel: input.activeModel ? { ...input.activeModel } : undefined,
|
|
21
21
|
createdAt: now,
|
|
22
22
|
updatedAt: now,
|
|
23
23
|
};
|
|
@@ -56,12 +56,12 @@ export class InMemoryPiboSessionStore {
|
|
|
56
56
|
...existing,
|
|
57
57
|
piSessionId: input.piSessionId ?? existing.piSessionId,
|
|
58
58
|
profile: input.profile ?? existing.profile,
|
|
59
|
-
ownerScope: input.ownerScope ?? existing.ownerScope,
|
|
60
59
|
parentId: input.parentId === null ? undefined : input.parentId ?? existing.parentId,
|
|
61
60
|
originId: input.originId === null ? undefined : input.originId ?? existing.originId,
|
|
62
61
|
workspace: input.workspace === null ? undefined : input.workspace ?? existing.workspace,
|
|
63
62
|
title: input.title === null ? undefined : input.title ?? existing.title,
|
|
64
63
|
metadata: input.metadata ?? existing.metadata,
|
|
64
|
+
activeModel: input.activeModel === null ? undefined : input.activeModel ? { ...input.activeModel } : existing.activeModel,
|
|
65
65
|
updatedAt: new Date().toISOString(),
|
|
66
66
|
};
|
|
67
67
|
this.set(updated, existing.piSessionId);
|
|
@@ -96,8 +96,6 @@ export function matchesFindInput(session, input) {
|
|
|
96
96
|
return false;
|
|
97
97
|
if (input.kind !== undefined && session.kind !== input.kind)
|
|
98
98
|
return false;
|
|
99
|
-
if (input.ownerScope !== undefined && session.ownerScope !== input.ownerScope)
|
|
100
|
-
return false;
|
|
101
99
|
if (input.parentId !== undefined) {
|
|
102
100
|
if (input.parentId === null) {
|
|
103
101
|
if (session.parentId !== undefined)
|
|
@@ -111,6 +109,15 @@ export function matchesFindInput(session, input) {
|
|
|
111
109
|
return false;
|
|
112
110
|
if (input.profile !== undefined && session.profile !== input.profile)
|
|
113
111
|
return false;
|
|
112
|
+
if (input.activeModel !== undefined) {
|
|
113
|
+
if (input.activeModel === null) {
|
|
114
|
+
if (session.activeModel !== undefined)
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
else if (session.activeModel?.provider !== input.activeModel.provider || session.activeModel?.id !== input.activeModel.id) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
114
121
|
if (input.metadata && !metadataMatches(session.metadata, input.metadata))
|
|
115
122
|
return false;
|
|
116
123
|
return true;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const PIBO_WORKFLOW_SESSION_KIND_METADATA_KEY = "workflowSessionKind";
|
|
2
|
+
export const PIBO_WORKFLOW_SESSION_KINDS = ["main_workflow", "nested_workflow", "agent_node", "subagent"];
|
|
3
|
+
export function isPiboWorkflowSessionKind(value) {
|
|
4
|
+
return typeof value === "string" && PIBO_WORKFLOW_SESSION_KINDS.includes(value);
|
|
5
|
+
}
|
|
6
|
+
export function workflowSessionKindFromMetadata(metadata) {
|
|
7
|
+
const value = metadata?.[PIBO_WORKFLOW_SESSION_KIND_METADATA_KEY];
|
|
8
|
+
if (isPiboWorkflowSessionKind(value))
|
|
9
|
+
return value;
|
|
10
|
+
// Backfill the initial Project workflow metadata shape used before the stable enum.
|
|
11
|
+
if (metadata?.projectSessionKind === "main")
|
|
12
|
+
return "main_workflow";
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
export function withWorkflowSessionKind(metadata, workflowSessionKind) {
|
|
16
|
+
return {
|
|
17
|
+
...(metadata ?? {}),
|
|
18
|
+
[PIBO_WORKFLOW_SESSION_KIND_METADATA_KEY]: workflowSessionKind,
|
|
19
|
+
};
|
|
20
|
+
}
|