@pasko70/pibo 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -254
- package/context/codex-base-prompt.md +4 -0
- package/context/compute-worker.md +23 -0
- package/context/pibo-native-tooling.md +18 -0
- package/context/pibo-system-prompt.md +69 -8
- package/dist/api/simple-agent-api.js +136 -0
- package/dist/app-context.js +4 -0
- package/dist/apps/chat/agent-profiles.js +18 -3
- package/dist/apps/chat/agent-store.js +113 -16
- package/dist/apps/chat/chat-api-routes.js +311 -0
- package/dist/apps/chat/chat-capability-routes.js +90 -0
- package/dist/apps/chat/chat-files.js +178 -0
- package/dist/apps/chat/chat-request-normalizers.js +681 -0
- package/dist/apps/chat/chat-settings-routes.js +75 -0
- package/dist/apps/chat/chat-trace-helpers.js +94 -0
- package/dist/apps/chat/chat-user-skill-routes.js +149 -0
- package/dist/apps/chat/cron-api.js +213 -0
- package/dist/apps/chat/data/chat-data-mappers.js +74 -0
- package/dist/apps/chat/data/event-command-service.js +75 -0
- package/dist/apps/chat/data/navigation-query-service.js +11 -0
- package/dist/apps/chat/data/project-service.js +844 -0
- package/dist/apps/chat/data/read-state-service.js +42 -0
- package/dist/apps/chat/data/room-service.js +52 -0
- package/dist/apps/chat/data/session-query-service.js +63 -0
- package/dist/apps/chat/data/timeline-query-service.js +96 -0
- package/dist/apps/chat/event-log.js +1 -307
- package/dist/apps/chat/model-catalog.js +7 -2
- package/dist/apps/chat/output-compactor.js +126 -0
- package/dist/apps/chat/output-event-policy.js +17 -0
- package/dist/apps/chat/project-workflow-human-actions.js +347 -0
- package/dist/apps/chat/project-workflow-sessions.js +260 -0
- package/dist/apps/chat/provider-auth-actions.js +43 -0
- package/dist/apps/chat/ralph-api.js +156 -0
- package/dist/apps/chat/read-model.js +1 -218
- package/dist/apps/chat/rooms.js +1 -321
- package/dist/apps/chat/static-assets.js +996 -0
- package/dist/apps/chat/stream.js +29 -6
- package/dist/apps/chat/trace.js +179 -1003
- package/dist/apps/chat/types/event-store.js +1 -0
- package/dist/apps/chat/types/read-model.js +1 -0
- package/dist/apps/chat/types/rooms.js +36 -0
- package/dist/apps/chat/web-app.js +3131 -1959
- package/dist/apps/chat/workflow-catalog.js +572 -0
- package/dist/apps/chat/workflow-edge-compatibility.js +51 -0
- package/dist/apps/chat/workflow-json-schema-validation.js +335 -0
- package/dist/apps/chat/workflow-persistence-model.js +140 -0
- package/dist/apps/chat/workflow-persistence.js +633 -0
- package/dist/apps/chat/workflow-registered-ref-params.js +130 -0
- package/dist/apps/chat/workflow-registered-ref-pickers.js +179 -0
- package/dist/apps/chat/workflow-registered-ref-validation.js +210 -0
- package/dist/apps/chat/workflow-v2-security-validation.js +93 -0
- package/dist/apps/chat/workflow-validation-helpers.js +114 -0
- package/dist/apps/chat-ui/assets/{dist-CNLWH2qh.js → dist-B4lw9z4F.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-8e4L8ciw.js → dist-BbTaHWON.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CMZOa5ik.js → dist-BcT_c1EJ.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DNcnQRPF.js → dist-CGINd7XU.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CqqUC8Ce.js → dist-CrBzZkUp.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-D2N4-LIc.js → dist-CyyISotB.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CUqpST5w.js → dist-DFbnFNpX.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CspjOeBj.js → dist-DGLWQLX8.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-B7bbI3Qz.js → dist-DfcIkFSN.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-v4pjHlB7.js → dist-sKDHTwaT.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-D9L4MSRF.js → dist-y9D6la48.js} +1 -1
- package/dist/apps/chat-ui/assets/index-C25VYnyb.css +1 -0
- package/dist/apps/chat-ui/assets/index-CUkuvI3v.js +165 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-144x144.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-192x192.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-48x48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-512x512.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-72x72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-96x96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/1024.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/114.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/120.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/128.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/144.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/152.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/167.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/180.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/192.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/29.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/50.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/512.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/57.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/58.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/76.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/87.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/index.html +8 -3
- package/dist/apps/chat-ui/manifest.webmanifest +25 -0
- package/dist/apps/chat-ui/sw.js +41 -0
- package/dist/apps/chat-vscode-web/assets/index-B5QK07zO.css +2 -0
- package/dist/apps/chat-vscode-web/assets/index-C3GTPyDo.js +41 -0
- package/dist/apps/chat-vscode-web/index.html +14 -0
- package/dist/apps/cli-ui/InkSessionApp.js +1218 -0
- package/dist/apps/cli-ui/InkTerminalLine.js +53 -0
- package/dist/apps/cli-ui/InkTerminalRow.js +304 -0
- package/dist/apps/cli-ui/InkTerminalView.js +25 -0
- package/dist/apps/cli-ui/cliSessionsCommand.js +232 -0
- package/dist/apps/cli-ui/index.js +8 -0
- package/dist/apps/cli-ui/inkColors.js +67 -0
- package/dist/apps/cli-ui/inkJson.js +244 -0
- package/dist/apps/cli-ui/inkMarkdown.js +122 -0
- package/dist/apps/context-files-ui/assets/{dist-DFi2YGux.js → dist-BOiGdrG-.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-DyfSeBMu.js → dist-DK01b7x4.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-CwbH_3RN.js → dist-DPG9jOQ-.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-dTBsFYAl.js → dist-Dp5AH00p.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-CxRLRmMx.js → dist-DqYw0LH7.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-MyZgX9K2.js → dist-TF5iO5ML.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-DQXzt2Ng.js → dist-TbjAhles.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-YwR9dpb-.js → dist-ZsBbt0uY.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-CKQF1zEu.js → dist-kmsvtHkH.js} +1 -1
- package/dist/apps/context-files-ui/assets/{dist-BJW3917N.js → dist-vnd7PMu3.js} +1 -1
- package/dist/apps/context-files-ui/assets/{index-BwRDoHMC.css → index-B92tL3Pp.css} +1 -1
- package/dist/apps/context-files-ui/assets/{index-GwvjXytt.js → index-BhAWD3dv.js} +2 -2
- package/dist/apps/context-files-ui/index.html +2 -2
- package/dist/apps/vscode-artifacts/latest.vsix +0 -0
- package/dist/apps/vscode-artifacts/pibo-vscode-1.3.0.vsix +0 -0
- package/dist/auth/better-auth.js +2 -1
- package/dist/auth/login-actions.js +251 -0
- package/dist/auth/openai-codex-usage.js +147 -0
- package/dist/bin/pibo.js +0 -0
- package/dist/bin/rg.js +15 -0
- package/dist/cli-session/fakeSessionSource.js +804 -0
- package/dist/cli-session/index.js +3 -0
- package/dist/cli-session/localSessionSource.js +1144 -0
- package/dist/cli-session/sessionSource.js +13 -0
- package/dist/cli.js +159 -14
- package/dist/compute/cli.js +415 -0
- package/dist/compute/docker.js +827 -0
- package/dist/compute/resource-health.js +333 -0
- package/dist/compute/resource-policy.js +98 -0
- package/dist/config/config.js +9 -5
- package/dist/core/context-build.js +677 -0
- package/dist/core/model-defaults.js +51 -9
- package/dist/core/pibo-home.js +8 -0
- package/dist/core/profiles.js +48 -0
- package/dist/core/provider-telemetry.js +222 -0
- package/dist/core/routed-session.js +441 -47
- package/dist/core/runtime-telemetry.js +853 -0
- package/dist/core/runtime.js +103 -15
- package/dist/core/session-errors.js +47 -0
- package/dist/core/session-model.js +39 -0
- package/dist/core/session-router.js +292 -62
- package/dist/core/shared-app.js +17 -0
- package/dist/core/skill-expansion.js +43 -0
- package/dist/core/system-prompt-template.js +9 -9
- package/dist/core/telemetry-staleness.js +128 -0
- package/dist/core/test-output-compaction.js +145 -0
- package/dist/core/user-settings.js +73 -0
- package/dist/cron/channel.js +28 -0
- package/dist/cron/cli.js +230 -0
- package/dist/cron/plugin.js +11 -0
- package/dist/cron/schedule.js +214 -0
- package/dist/cron/service.js +177 -0
- package/dist/cron/store.js +349 -0
- package/dist/cron/types.js +1 -0
- package/dist/data/cli.js +184 -0
- package/dist/data/event-log.js +106 -0
- package/dist/data/final-app-space-cutover-migration.js +728 -0
- package/dist/data/ingest-service.js +389 -0
- package/dist/data/message-store.js +62 -0
- package/dist/data/navigation-store.js +75 -0
- package/dist/data/observation-store.js +46 -0
- package/dist/data/payload-store.js +144 -0
- package/dist/data/pibo-store.js +59 -0
- package/dist/data/schema.js +434 -0
- package/dist/data/session-store.js +63 -0
- package/dist/data/shared-app-migration.js +757 -0
- package/dist/data/sqlite-schema.js +12 -0
- package/dist/data/telemetry-preview.js +65 -0
- package/dist/data/telemetry-queries.js +212 -0
- package/dist/data/telemetry-retention.js +50 -0
- package/dist/data/telemetry-rows.js +158 -0
- package/dist/data/telemetry.js +357 -0
- package/dist/debug/delta-compaction.js +99 -0
- package/dist/debug/detail-format.js +86 -0
- package/dist/debug/events.js +149 -29
- package/dist/debug/failures.js +162 -0
- package/dist/debug/index.js +655 -30
- package/dist/debug/messages.js +185 -0
- package/dist/debug/next-commands.js +6 -0
- package/dist/debug/payloads.js +123 -0
- package/dist/debug/pty.js +924 -0
- package/dist/debug/session.js +45 -15
- package/dist/debug/sql.js +1 -1
- package/dist/debug/stores.js +18 -13
- package/dist/debug/summary.js +72 -0
- package/dist/debug/telemetry.js +649 -0
- package/dist/debug/tools.js +168 -0
- package/dist/debug/trace-render-check.js +151 -0
- package/dist/debug/trace.js +152 -27
- package/dist/debug/web-artifacts.js +63 -0
- package/dist/debug/web-options.js +313 -0
- package/dist/debug/web-render-analysis.js +310 -0
- package/dist/debug/web-snapshot-browser-scripts.js +303 -0
- package/dist/debug/web-streaming-benchmark-analysis.js +605 -0
- package/dist/debug/web-streaming-browser-library.js +928 -0
- package/dist/debug/web-streaming-browser-scripts.js +242 -0
- package/dist/debug/web-streaming-provider-telemetry.js +194 -0
- package/dist/debug/web-streaming-report.js +493 -0
- package/dist/debug/web-streaming-types.js +1 -0
- package/dist/debug/web.js +574 -0
- package/dist/gateway/backup.js +83 -0
- package/dist/gateway/cli.js +511 -0
- package/dist/gateway/fallback.js +155 -0
- package/dist/gateway/pidfile.js +84 -0
- package/dist/gateway/protocol.js +16 -0
- package/dist/gateway/server.js +172 -17
- package/dist/gateway/tool.js +54 -51
- package/dist/gateway/web.js +74 -2
- package/dist/index.js +3 -1
- package/dist/local/client.js +3 -3
- package/dist/local/extension.js +8 -5
- package/dist/plugins/builtin.js +251 -49
- package/dist/plugins/chat-vscode-web.js +28 -0
- package/dist/plugins/codex-compat.js +0 -41
- package/dist/plugins/context-files.js +98 -18
- package/dist/plugins/dev-auth.js +124 -0
- package/dist/plugins/native-tooling.js +15 -0
- package/dist/plugins/registry.js +49 -1
- package/dist/plugins/web-annotations.js +27 -0
- package/dist/providers/minimax.js +70 -0
- package/dist/providers/openai-compat.js +48 -0
- package/dist/ralph/channel.js +8 -0
- package/dist/ralph/cli.js +152 -0
- package/dist/ralph/plugin.js +14 -0
- package/dist/ralph/service.js +271 -0
- package/dist/ralph/stopping.js +151 -0
- package/dist/ralph/store.js +450 -0
- package/dist/ralph/templates.js +200 -0
- package/dist/ralph/types.js +1 -0
- package/dist/reliability/store.js +42 -26
- package/dist/runs/registry.js +72 -35
- package/dist/session-ui/commandCatalog.js +193 -0
- package/dist/session-ui/commandResults.js +95 -0
- package/dist/session-ui/index.js +7 -0
- package/dist/session-ui/ownerViewModel.js +27 -0
- package/dist/session-ui/roomSessionViewModel.js +69 -0
- package/dist/session-ui/statusViewModel.js +127 -0
- package/dist/session-ui/terminalCards.js +210 -0
- package/dist/session-ui/terminalRows.js +937 -0
- package/dist/session-ui/terminalValue.js +45 -0
- package/dist/sessions/pibo-data-store.js +178 -0
- package/dist/sessions/sqlite-store.js +78 -12
- package/dist/sessions/store.js +11 -4
- package/dist/sessions/workflow-session-kind.js +20 -0
- package/dist/setup/cli.js +567 -0
- package/dist/shared/trace-async-agent-runs.js +127 -0
- package/dist/shared/trace-engine.js +96 -0
- package/dist/shared/trace-event-projection.js +679 -0
- package/dist/shared/trace-live-reducer.js +191 -0
- package/dist/shared/trace-nodes.js +76 -0
- package/dist/shared/trace-order.js +11 -10
- package/dist/shared/trace-patch-nodes.js +83 -0
- package/dist/shared/trace-run-notifications.js +69 -0
- package/dist/shared/trace-subagent-links.js +46 -0
- package/dist/shared/trace-transcript.js +303 -0
- package/dist/shared/trace-types.js +1 -0
- package/dist/shared-app.js +4 -0
- package/dist/signals/aggregate.js +65 -0
- package/dist/signals/events.js +1 -0
- package/dist/signals/projector.js +158 -0
- package/dist/signals/registry.js +513 -0
- package/dist/signals/store.js +1 -0
- package/dist/signals/types.js +1 -0
- package/dist/skills/cli.js +117 -0
- package/dist/tools/agent-browser-leases.js +219 -0
- package/dist/tools/agent-browser-wrapper.js +99 -0
- package/dist/tools/browser-pool.js +623 -0
- package/dist/tools/browser-use-cdp.js +56 -4
- package/dist/tools/browser-use-leases.js +215 -37
- package/dist/tools/browser-use-wrapper.js +508 -65
- package/dist/tools/cdp-client.js +189 -0
- package/dist/tools/guides.js +203 -4
- package/dist/tools/index.js +666 -16
- package/dist/tools/npm-runtime.js +136 -0
- package/dist/tools/registry.js +107 -8
- package/dist/tools/runtime/index.js +3 -0
- package/dist/tools/runtime/node-backend.js +225 -0
- package/dist/tools/runtime/node-worker-source.js +206 -0
- package/dist/tools/runtime/python-backend.js +227 -0
- package/dist/tools/runtime/python-worker-source.js +178 -0
- package/dist/tools/runtime/registry.js +255 -0
- package/dist/tools/runtime/tool.js +168 -0
- package/dist/tools/runtime/types.js +1 -0
- package/dist/tools/web-search.js +2 -1
- package/dist/user-skills/installer.js +39 -36
- package/dist/user-skills/store.js +50 -11
- package/dist/vscode/cli.js +90 -0
- package/dist/vscode/code-cli.js +119 -0
- package/dist/vscode/install.js +177 -0
- package/dist/vscode/status.js +80 -0
- package/dist/vscode/types.js +14 -0
- package/dist/vscode/uninstall.js +49 -0
- package/dist/vscode/vsix-fetcher.js +131 -0
- package/dist/web/auth.js +5 -1
- package/dist/web/channel.js +86 -0
- package/dist/web/http.js +79 -14
- package/dist/web-annotations/api.js +348 -0
- package/dist/web-annotations/attachments.js +201 -0
- package/dist/web-annotations/cdp.js +1107 -0
- package/dist/web-annotations/index.js +7 -0
- package/dist/web-annotations/store.js +407 -0
- package/dist/web-annotations/tools.js +350 -0
- package/dist/web-annotations/types.js +34 -0
- package/dist/web-annotations/validation.js +288 -0
- package/docs/README.md +23 -0
- package/docs/ops/install-developer-host.md +112 -0
- package/docs/ops/install-user-host.md +76 -0
- package/docs/ops/upgrade-user-to-developer-host.md +69 -0
- package/docs/ops/vscode-extension-release.md +138 -0
- package/package.json +24 -9
- package/skills/builtin/pi-agent-harness/SKILL.md +24 -24
- package/skills/builtin/pibo-docker-system/SKILL.md +170 -0
- package/skills/builtin/pibo-spec-writing/SKILL.md +330 -0
- package/skills/builtin/prd/SKILL.md +143 -0
- package/skills/builtin/ralph-loop/SKILL.md +359 -0
- package/skills/builtin/ralph-prd-json/SKILL.md +123 -0
- package/skills/builtin/skill-creator/LICENSE.txt +202 -0
- package/skills/builtin/skill-creator/SKILL.md +513 -0
- package/skills/builtin/skill-creator/agents/analyzer.md +274 -0
- package/skills/builtin/skill-creator/agents/comparator.md +202 -0
- package/skills/builtin/skill-creator/agents/grader.md +223 -0
- package/skills/builtin/skill-creator/assets/eval_review.html +146 -0
- package/skills/builtin/skill-creator/eval-viewer/generate_review.py +471 -0
- package/skills/builtin/skill-creator/eval-viewer/viewer.html +1325 -0
- package/skills/builtin/skill-creator/references/schemas.md +430 -0
- package/skills/builtin/skill-creator/scripts/__init__.py +0 -0
- package/skills/builtin/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/skills/builtin/skill-creator/scripts/generate_report.py +326 -0
- package/skills/builtin/skill-creator/scripts/improve_description.py +247 -0
- package/skills/builtin/skill-creator/scripts/package_skill.py +136 -0
- package/skills/builtin/skill-creator/scripts/quick_validate.py +103 -0
- package/skills/builtin/skill-creator/scripts/run_eval.py +310 -0
- package/skills/builtin/skill-creator/scripts/run_loop.py +328 -0
- package/skills/builtin/skill-creator/scripts/utils.py +47 -0
- package/skills/builtin/web-annotations/SKILL.md +93 -0
- package/dist/apps/chat-ui/assets/index-D2Qxambd.js +0 -151
- package/dist/apps/chat-ui/assets/index-DXx368XK.css +0 -1
- package/dist/env.js +0 -32
- package/dist/plugins/core-tools.js +0 -94
- package/dist/plugins/example.js +0 -67
- package/dist/plugins/remote-agent.js +0 -9
- package/dist/remote/channel.js +0 -176
- package/dist/remote/client.js +0 -92
- package/dist/remote/examples/tui-controller.js +0 -263
- package/dist/remote/protocol.js +0 -55
- package/dist/remote/session-client.js +0 -189
- package/dist/sessions/bindings.js +0 -41
|
@@ -0,0 +1,937 @@
|
|
|
1
|
+
import { compareTraceNodes } from "../shared/trace-engine.js";
|
|
2
|
+
import { terminalTextValue } from "./terminalValue.js";
|
|
3
|
+
export const COMPACT_TERMINAL_OUTPUT_PREVIEW_LINES = 5;
|
|
4
|
+
export const COMPACT_TERMINAL_EXPLORING_PREVIEW_LINES = 6;
|
|
5
|
+
export function buildCompactTerminalRows(traceView, options) {
|
|
6
|
+
if (!traceView)
|
|
7
|
+
return [];
|
|
8
|
+
const flatNodes = flattenTraceNodes(traceView.nodes)
|
|
9
|
+
.sort((left, right) => compareTraceNodes(left.node, right.node))
|
|
10
|
+
.filter((item) => item.node.type !== "agent.turn" && (options.showThinking || item.node.type !== "model.reasoning"));
|
|
11
|
+
const candidates = flatNodes.map((item) => createRowCandidate(item.node, item.turnId));
|
|
12
|
+
return groupRelatedToolCandidates(candidates).map((candidate) => candidate.row);
|
|
13
|
+
}
|
|
14
|
+
function flattenTraceNodes(nodes, turnId) {
|
|
15
|
+
const result = [];
|
|
16
|
+
for (const node of nodes) {
|
|
17
|
+
if (node.type !== "agent.turn")
|
|
18
|
+
result.push({ node, turnId });
|
|
19
|
+
result.push(...flattenTraceNodes(node.children, node.type === "agent.turn" ? node.id : turnId));
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
function createRowCandidate(node, turnId) {
|
|
24
|
+
let candidate;
|
|
25
|
+
switch (node.type) {
|
|
26
|
+
case "user.message":
|
|
27
|
+
candidate = { row: createUserMessageRow(node), turnId };
|
|
28
|
+
break;
|
|
29
|
+
case "assistant.message":
|
|
30
|
+
candidate = { row: createAssistantMessageRow(node), turnId };
|
|
31
|
+
break;
|
|
32
|
+
case "model.reasoning":
|
|
33
|
+
candidate = { row: createReasoningRow(node), turnId };
|
|
34
|
+
break;
|
|
35
|
+
case "tool.call":
|
|
36
|
+
candidate = createToolRowCandidate(node, turnId);
|
|
37
|
+
break;
|
|
38
|
+
case "tool.result":
|
|
39
|
+
candidate = createToolResultRowCandidate(node, turnId);
|
|
40
|
+
break;
|
|
41
|
+
case "agent.delegation":
|
|
42
|
+
candidate = { row: createDelegationRow(node), turnId };
|
|
43
|
+
break;
|
|
44
|
+
case "agent.async":
|
|
45
|
+
candidate = { row: createAsyncAgentRow(node), turnId };
|
|
46
|
+
break;
|
|
47
|
+
case "yielded.run":
|
|
48
|
+
candidate = { row: createYieldedRunRow(node), turnId };
|
|
49
|
+
break;
|
|
50
|
+
case "execution.command":
|
|
51
|
+
candidate = { row: createExecutionCommandRow(node), turnId };
|
|
52
|
+
break;
|
|
53
|
+
case "execution.compaction":
|
|
54
|
+
candidate = { row: createCompactionRow(node), turnId };
|
|
55
|
+
break;
|
|
56
|
+
case "error":
|
|
57
|
+
candidate = { row: createErrorRow(node), turnId };
|
|
58
|
+
break;
|
|
59
|
+
case "agent.turn":
|
|
60
|
+
candidate = {
|
|
61
|
+
row: {
|
|
62
|
+
id: node.id,
|
|
63
|
+
kind: "error",
|
|
64
|
+
status: "neutral",
|
|
65
|
+
lines: [],
|
|
66
|
+
sourceNodeIds: [node.id],
|
|
67
|
+
},
|
|
68
|
+
turnId,
|
|
69
|
+
};
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
return { ...candidate, row: { ...candidate.row, ...debugFields(node) } };
|
|
73
|
+
}
|
|
74
|
+
function debugFields(node) {
|
|
75
|
+
return {
|
|
76
|
+
eventId: node.eventId,
|
|
77
|
+
runId: node.runId,
|
|
78
|
+
orderSource: node.source,
|
|
79
|
+
orderStreamId: node.orderKey?.streamId,
|
|
80
|
+
orderStreamFrameIndex: node.orderKey?.streamFrameIndex,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function createUserMessageRow(node) {
|
|
84
|
+
const text = stringValue(node.output) || stringValue(node.summary) || node.title;
|
|
85
|
+
return {
|
|
86
|
+
id: node.id,
|
|
87
|
+
kind: "message.user",
|
|
88
|
+
status: mapStatus(node.status),
|
|
89
|
+
lines: [{ prefix: "prompt", tokens: [token(text)] }],
|
|
90
|
+
sourceNodeIds: [node.id],
|
|
91
|
+
forkEntryId: node.entryId,
|
|
92
|
+
output: text,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function createAssistantMessageRow(node) {
|
|
96
|
+
return {
|
|
97
|
+
id: node.id,
|
|
98
|
+
kind: "message.assistant",
|
|
99
|
+
status: mapStatus(node.status),
|
|
100
|
+
lines: [],
|
|
101
|
+
sourceNodeIds: [node.id],
|
|
102
|
+
output: stringValue(node.output) || stringValue(node.summary) || "",
|
|
103
|
+
error: node.error,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function createReasoningRow(node) {
|
|
107
|
+
const text = previewText(node.output ?? node.summary);
|
|
108
|
+
return {
|
|
109
|
+
id: node.id,
|
|
110
|
+
kind: "reasoning",
|
|
111
|
+
status: mapStatus(node.status),
|
|
112
|
+
lines: [
|
|
113
|
+
{
|
|
114
|
+
prefix: "bullet",
|
|
115
|
+
tokens: [token(node.status === "running" ? "Thinking" : "Thought", "amber", "semibold")],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
sourceNodeIds: [node.id],
|
|
119
|
+
markdown: text,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function createToolRowCandidate(node, turnId) {
|
|
123
|
+
const command = shellCommandValue(node.input);
|
|
124
|
+
if (command && isShellToolName(node.title)) {
|
|
125
|
+
const row = createCommandToolRow(node, command);
|
|
126
|
+
return { row, turnId, exploring: undefined };
|
|
127
|
+
}
|
|
128
|
+
const image = classifyImageTool(node);
|
|
129
|
+
if (image) {
|
|
130
|
+
const row = createImageToolRow(node, image);
|
|
131
|
+
return { row, turnId, image: image.detail };
|
|
132
|
+
}
|
|
133
|
+
const preview = previewLines(node.error ?? node.output, COMPACT_TERMINAL_OUTPUT_PREVIEW_LINES, node.error ? "red" : "dim");
|
|
134
|
+
const row = {
|
|
135
|
+
id: node.id,
|
|
136
|
+
kind: "tool.call",
|
|
137
|
+
status: mapStatus(node.status),
|
|
138
|
+
errorKind: node.status === "error" ? "tool" : undefined,
|
|
139
|
+
lines: [
|
|
140
|
+
{
|
|
141
|
+
prefix: "bullet",
|
|
142
|
+
tokens: [
|
|
143
|
+
token(toolVerb(node.status), toneForStatus(node.status), "semibold"),
|
|
144
|
+
token(" "),
|
|
145
|
+
],
|
|
146
|
+
functionCall: { name: node.title, input: node.input },
|
|
147
|
+
},
|
|
148
|
+
...preview.lines,
|
|
149
|
+
],
|
|
150
|
+
sourceNodeIds: [node.id],
|
|
151
|
+
input: node.input,
|
|
152
|
+
output: node.output,
|
|
153
|
+
error: node.error,
|
|
154
|
+
expandable: node.input !== undefined || node.output !== undefined || Boolean(node.error),
|
|
155
|
+
previewOmission: previewOmission(preview, node.error ? "error" : "output"),
|
|
156
|
+
};
|
|
157
|
+
const exploring = classifyExploringTool(node);
|
|
158
|
+
return { row, turnId, exploring };
|
|
159
|
+
}
|
|
160
|
+
function createImageToolRow(node, image) {
|
|
161
|
+
const status = mapStatus(node.status);
|
|
162
|
+
const detailLabel = image.path ? `Path: ${image.path}` : image.query ? `Query: ${image.query}` : image.mimeType ? `Type: ${image.mimeType}` : "Image content returned";
|
|
163
|
+
return {
|
|
164
|
+
id: node.id,
|
|
165
|
+
kind: "tool.image",
|
|
166
|
+
status,
|
|
167
|
+
errorKind: node.status === "error" ? "tool" : undefined,
|
|
168
|
+
lines: [
|
|
169
|
+
{
|
|
170
|
+
prefix: "bullet",
|
|
171
|
+
tokens: [token(imageToolVerb(node.status, image.count), toneForStatus(node.status), "semibold")],
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
prefix: "detail",
|
|
175
|
+
tokens: [token(detailLabel, node.status === "error" ? "red" : "cyan")],
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
sourceNodeIds: [node.id],
|
|
179
|
+
input: sanitizeImagePayload(node.input),
|
|
180
|
+
output: image.summary,
|
|
181
|
+
error: node.error,
|
|
182
|
+
expandable: node.input !== undefined || image.summary !== undefined || Boolean(node.error),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function createToolResultRowCandidate(node, turnId) {
|
|
186
|
+
const image = classifyImageTool(node);
|
|
187
|
+
if (image) {
|
|
188
|
+
const row = createImageToolRow(node, image);
|
|
189
|
+
return { row, turnId, image: image.detail };
|
|
190
|
+
}
|
|
191
|
+
return { row: createToolResultRow(node), turnId };
|
|
192
|
+
}
|
|
193
|
+
function createToolResultRow(node) {
|
|
194
|
+
const preview = previewLines(node.error ?? node.output, COMPACT_TERMINAL_OUTPUT_PREVIEW_LINES, node.error ? "red" : "dim");
|
|
195
|
+
return {
|
|
196
|
+
id: node.id,
|
|
197
|
+
kind: "tool.call",
|
|
198
|
+
status: mapStatus(node.status),
|
|
199
|
+
errorKind: node.status === "error" ? "tool" : undefined,
|
|
200
|
+
lines: [
|
|
201
|
+
{
|
|
202
|
+
prefix: "bullet",
|
|
203
|
+
tokens: [token(node.status === "error" ? "Tool failed" : "Returned", toneForStatus(node.status), "semibold"), token(` ${node.title}`)],
|
|
204
|
+
},
|
|
205
|
+
...preview.lines,
|
|
206
|
+
],
|
|
207
|
+
sourceNodeIds: [node.id],
|
|
208
|
+
output: node.output,
|
|
209
|
+
error: node.error,
|
|
210
|
+
expandable: node.output !== undefined || Boolean(node.error),
|
|
211
|
+
previewOmission: previewOmission(preview, node.error ? "error" : "output"),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function createDelegationRow(node) {
|
|
215
|
+
const subagentName = stringValue(isRecord(node.input) ? node.input.subagentName : undefined) || node.summary || node.title;
|
|
216
|
+
const delegatedArguments = isRecord(node.input) ? node.input.arguments : undefined;
|
|
217
|
+
const previewText = compactInlinePreview(delegatedArguments ?? node.input);
|
|
218
|
+
const detailLines = previewText
|
|
219
|
+
? [{ prefix: "detail", tokens: [token(previewText, "dim")] }]
|
|
220
|
+
: [];
|
|
221
|
+
return {
|
|
222
|
+
id: node.id,
|
|
223
|
+
kind: "agent.delegation",
|
|
224
|
+
status: mapStatus(node.status),
|
|
225
|
+
lines: [
|
|
226
|
+
{
|
|
227
|
+
prefix: "bullet",
|
|
228
|
+
tokens: [token(delegationVerb(node.status), toneForStatus(node.status), "semibold"), token(` ${subagentName}`, "cyan")],
|
|
229
|
+
},
|
|
230
|
+
...detailLines,
|
|
231
|
+
],
|
|
232
|
+
sourceNodeIds: [node.id],
|
|
233
|
+
linkedPiboSessionId: node.linkedPiboSessionId,
|
|
234
|
+
input: node.input,
|
|
235
|
+
output: node.output,
|
|
236
|
+
error: node.error,
|
|
237
|
+
expandable: node.input !== undefined || node.output !== undefined || Boolean(node.error),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function createAsyncAgentRow(node) {
|
|
241
|
+
const preview = previewLines(node.error ?? node.output, COMPACT_TERMINAL_OUTPUT_PREVIEW_LINES, node.error ? "red" : "dim");
|
|
242
|
+
return {
|
|
243
|
+
id: node.id,
|
|
244
|
+
kind: "agent.async",
|
|
245
|
+
status: mapStatus(node.status),
|
|
246
|
+
lines: [
|
|
247
|
+
{
|
|
248
|
+
prefix: "bullet",
|
|
249
|
+
tokens: [token(asyncVerb(node.status), toneForStatus(node.status), "semibold"), token(` ${node.title}`, "cyan")],
|
|
250
|
+
},
|
|
251
|
+
...preview.lines,
|
|
252
|
+
],
|
|
253
|
+
sourceNodeIds: [node.id],
|
|
254
|
+
linkedPiboSessionId: node.linkedPiboSessionId,
|
|
255
|
+
input: node.input,
|
|
256
|
+
output: node.output,
|
|
257
|
+
error: node.error,
|
|
258
|
+
expandable: node.input !== undefined || node.output !== undefined || Boolean(node.error),
|
|
259
|
+
previewOmission: previewOmission(preview, node.error ? "error" : "output"),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function createYieldedRunRow(node) {
|
|
263
|
+
const preview = previewLines(node.output, COMPACT_TERMINAL_OUTPUT_PREVIEW_LINES);
|
|
264
|
+
return {
|
|
265
|
+
id: node.id,
|
|
266
|
+
kind: "yielded.run",
|
|
267
|
+
status: mapStatus(node.status),
|
|
268
|
+
errorKind: node.status === "error" ? "tool" : undefined,
|
|
269
|
+
lines: [
|
|
270
|
+
{
|
|
271
|
+
prefix: "bullet",
|
|
272
|
+
tokens: [
|
|
273
|
+
token(node.status === "running" ? "Waiting on runs" : "Run update", toneForStatus(node.status), "semibold"),
|
|
274
|
+
token(node.summary ? ` ${node.summary}` : ""),
|
|
275
|
+
],
|
|
276
|
+
},
|
|
277
|
+
...preview.lines,
|
|
278
|
+
],
|
|
279
|
+
sourceNodeIds: [node.id],
|
|
280
|
+
output: node.output,
|
|
281
|
+
error: node.error,
|
|
282
|
+
expandable: node.output !== undefined || Boolean(node.error),
|
|
283
|
+
previewOmission: previewOmission(preview, "output"),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function createCompactionRow(node) {
|
|
287
|
+
const label = node.status === "running"
|
|
288
|
+
? "Compacting"
|
|
289
|
+
: node.status === "error"
|
|
290
|
+
? "Compaction failed"
|
|
291
|
+
: stringValue(node.summary) || "Compacted";
|
|
292
|
+
return {
|
|
293
|
+
id: node.id,
|
|
294
|
+
kind: "execution.compaction",
|
|
295
|
+
status: mapStatus(node.status),
|
|
296
|
+
lines: [
|
|
297
|
+
{
|
|
298
|
+
prefix: "bullet",
|
|
299
|
+
tokens: [token(label, toneForStatus(node.status), node.status === "error" ? "bold" : "semibold")],
|
|
300
|
+
},
|
|
301
|
+
],
|
|
302
|
+
sourceNodeIds: [node.id],
|
|
303
|
+
input: node.input,
|
|
304
|
+
output: node.output,
|
|
305
|
+
error: node.error,
|
|
306
|
+
expandable: node.input !== undefined || node.output !== undefined || Boolean(node.error),
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function createExecutionCommandRow(node) {
|
|
310
|
+
if (node.title === "status") {
|
|
311
|
+
return createStatusToolRow(node);
|
|
312
|
+
}
|
|
313
|
+
if (node.title === "thinking") {
|
|
314
|
+
return createThinkingToolRow(node);
|
|
315
|
+
}
|
|
316
|
+
if (node.title === "fast_mode") {
|
|
317
|
+
return createFastModeToolRow(node);
|
|
318
|
+
}
|
|
319
|
+
if (node.title === "login" && isLoginMenuOutput(node.output)) {
|
|
320
|
+
return createLoginToolRow(node);
|
|
321
|
+
}
|
|
322
|
+
if (node.title === "model" && isModelMenuOutput(node.output)) {
|
|
323
|
+
return createModelToolRow(node);
|
|
324
|
+
}
|
|
325
|
+
const command = shellCommandValue(node.output) ?? shellCommandValue(node.input) ?? node.title;
|
|
326
|
+
const preview = previewLines(node.error ?? node.output, COMPACT_TERMINAL_OUTPUT_PREVIEW_LINES, node.error ? "red" : "dim", 180);
|
|
327
|
+
return {
|
|
328
|
+
id: node.id,
|
|
329
|
+
kind: "execution.command",
|
|
330
|
+
status: mapStatus(node.status),
|
|
331
|
+
lines: [
|
|
332
|
+
{
|
|
333
|
+
prefix: "bullet",
|
|
334
|
+
tokens: [token("Command", "yellow", "semibold"), token(` /${node.title}`, "yellow")],
|
|
335
|
+
},
|
|
336
|
+
...preview.lines,
|
|
337
|
+
],
|
|
338
|
+
sourceNodeIds: [node.id],
|
|
339
|
+
input: node.input,
|
|
340
|
+
output: node.output,
|
|
341
|
+
error: node.error,
|
|
342
|
+
expandable: node.input !== undefined || node.output !== undefined || Boolean(node.error),
|
|
343
|
+
previewOmission: previewOmission(preview, node.error ? "error" : "output"),
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function createStatusToolRow(node) {
|
|
347
|
+
return {
|
|
348
|
+
id: node.id,
|
|
349
|
+
kind: "tool.status",
|
|
350
|
+
status: mapStatus(node.status),
|
|
351
|
+
lines: [],
|
|
352
|
+
sourceNodeIds: [node.id],
|
|
353
|
+
input: node.input,
|
|
354
|
+
output: node.output,
|
|
355
|
+
error: node.error,
|
|
356
|
+
expandable: false,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function createThinkingToolRow(node) {
|
|
360
|
+
return {
|
|
361
|
+
id: node.id,
|
|
362
|
+
kind: "tool.thinking",
|
|
363
|
+
status: mapStatus(node.status),
|
|
364
|
+
lines: [],
|
|
365
|
+
sourceNodeIds: [node.id],
|
|
366
|
+
input: node.input,
|
|
367
|
+
output: node.output,
|
|
368
|
+
error: node.error,
|
|
369
|
+
expandable: false,
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
function createFastModeToolRow(node) {
|
|
373
|
+
const result = isRecord(node.output) ? node.output : undefined;
|
|
374
|
+
const mode = result?.mode === "fast" ? "fast" : result?.mode === "normal" ? "normal" : undefined;
|
|
375
|
+
const changed = result?.changed !== false;
|
|
376
|
+
const supported = result?.supported !== false;
|
|
377
|
+
const label = !supported
|
|
378
|
+
? "Fast mode is not supported by this model."
|
|
379
|
+
: mode === "fast"
|
|
380
|
+
? changed ? "Switched to Fast mode." : "Fast mode is already on."
|
|
381
|
+
: mode === "normal"
|
|
382
|
+
? changed ? "Switched to Normal mode." : "Normal mode is already on."
|
|
383
|
+
: "Fast mode updated.";
|
|
384
|
+
return {
|
|
385
|
+
id: node.id,
|
|
386
|
+
kind: "execution.command",
|
|
387
|
+
status: mapStatus(node.status),
|
|
388
|
+
lines: [
|
|
389
|
+
{
|
|
390
|
+
prefix: "bullet",
|
|
391
|
+
tokens: [token(label, supported ? "green" : "dim", "semibold")],
|
|
392
|
+
},
|
|
393
|
+
],
|
|
394
|
+
sourceNodeIds: [node.id],
|
|
395
|
+
input: node.input,
|
|
396
|
+
output: node.output,
|
|
397
|
+
error: node.error,
|
|
398
|
+
expandable: false,
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
function createLoginToolRow(node) {
|
|
402
|
+
return {
|
|
403
|
+
id: node.id,
|
|
404
|
+
kind: "tool.login",
|
|
405
|
+
status: mapStatus(node.status),
|
|
406
|
+
lines: [],
|
|
407
|
+
sourceNodeIds: [node.id],
|
|
408
|
+
input: node.input,
|
|
409
|
+
output: node.output,
|
|
410
|
+
error: node.error,
|
|
411
|
+
expandable: false,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function createModelToolRow(node) {
|
|
415
|
+
return {
|
|
416
|
+
id: node.id,
|
|
417
|
+
kind: "tool.model",
|
|
418
|
+
status: mapStatus(node.status),
|
|
419
|
+
lines: [],
|
|
420
|
+
sourceNodeIds: [node.id],
|
|
421
|
+
input: node.input,
|
|
422
|
+
output: node.output,
|
|
423
|
+
error: node.error,
|
|
424
|
+
expandable: false,
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
function isLoginMenuOutput(value) {
|
|
428
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
429
|
+
return false;
|
|
430
|
+
const record = value;
|
|
431
|
+
return record.action === "show_login_menu" && Array.isArray(record.providers);
|
|
432
|
+
}
|
|
433
|
+
function isModelMenuOutput(value) {
|
|
434
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
435
|
+
return false;
|
|
436
|
+
const record = value;
|
|
437
|
+
return record.action === "show_model_menu" && Array.isArray(record.providers);
|
|
438
|
+
}
|
|
439
|
+
function createCommandToolRow(node, command) {
|
|
440
|
+
const preview = previewLines(node.error ?? node.output, COMPACT_TERMINAL_OUTPUT_PREVIEW_LINES, node.error ? "red" : "dim", 180);
|
|
441
|
+
return {
|
|
442
|
+
id: node.id,
|
|
443
|
+
kind: "execution.command",
|
|
444
|
+
status: mapStatus(node.status),
|
|
445
|
+
errorKind: node.status === "error" ? "tool" : undefined,
|
|
446
|
+
lines: [
|
|
447
|
+
{
|
|
448
|
+
prefix: "bullet",
|
|
449
|
+
tokens: [token(node.status === "running" ? "Running" : "Ran", toneForStatus(node.status), "semibold"), token(" "), ...bashTokens(command)],
|
|
450
|
+
},
|
|
451
|
+
...preview.lines,
|
|
452
|
+
],
|
|
453
|
+
sourceNodeIds: [node.id],
|
|
454
|
+
input: node.input,
|
|
455
|
+
output: node.output,
|
|
456
|
+
error: node.error,
|
|
457
|
+
expandable: node.input !== undefined || node.output !== undefined || Boolean(node.error),
|
|
458
|
+
previewOmission: previewOmission(preview, node.error ? "error" : "output"),
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
function createErrorRow(node) {
|
|
462
|
+
return {
|
|
463
|
+
id: node.id,
|
|
464
|
+
kind: "error",
|
|
465
|
+
status: "error",
|
|
466
|
+
errorKind: "system",
|
|
467
|
+
lines: [
|
|
468
|
+
{
|
|
469
|
+
prefix: "bullet",
|
|
470
|
+
tokens: [token(node.title || "Error", "red", "bold"), token(node.error ? ` ${node.error}` : "", "red")],
|
|
471
|
+
},
|
|
472
|
+
...sessionErrorDetailLines(node.input),
|
|
473
|
+
],
|
|
474
|
+
sourceNodeIds: [node.id],
|
|
475
|
+
input: node.input,
|
|
476
|
+
error: node.error,
|
|
477
|
+
output: node.output,
|
|
478
|
+
expandable: node.input !== undefined || node.output !== undefined || Boolean(node.error),
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
function sessionErrorDetailLines(details) {
|
|
482
|
+
if (!isRecord(details))
|
|
483
|
+
return [];
|
|
484
|
+
const fields = [
|
|
485
|
+
["Class", stringValue(details.errorClass) ?? stringValue(details.category)],
|
|
486
|
+
["Code", stringValue(details.code) ?? stringValue(details.providerCode)],
|
|
487
|
+
["Origin", stringValue(details.origin)],
|
|
488
|
+
["Provider", [stringValue(details.api), stringValue(details.provider), stringValue(details.model)].filter(Boolean).join(" / ") || undefined],
|
|
489
|
+
["Retryable", typeof details.retryable === "boolean" ? (details.retryable ? "yes" : "no") : undefined],
|
|
490
|
+
];
|
|
491
|
+
return fields
|
|
492
|
+
.filter((entry) => typeof entry[1] === "string" && entry[1].length > 0)
|
|
493
|
+
.map(([label, value], index) => ({
|
|
494
|
+
prefix: index === 0 ? "detail" : "continuation",
|
|
495
|
+
tokens: [token(`${label}: `, "dim"), token(value, "red")],
|
|
496
|
+
}));
|
|
497
|
+
}
|
|
498
|
+
function groupRelatedToolCandidates(candidates) {
|
|
499
|
+
const grouped = [];
|
|
500
|
+
for (let index = 0; index < candidates.length; index += 1) {
|
|
501
|
+
const candidate = candidates[index];
|
|
502
|
+
const groupKind = candidateGroupKind(candidate);
|
|
503
|
+
if (!groupKind) {
|
|
504
|
+
grouped.push(candidate);
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
const run = [candidate];
|
|
508
|
+
let cursor = index + 1;
|
|
509
|
+
while (cursor < candidates.length && candidateGroupKind(candidates[cursor]) === groupKind && candidates[cursor].turnId === candidate.turnId) {
|
|
510
|
+
run.push(candidates[cursor]);
|
|
511
|
+
cursor += 1;
|
|
512
|
+
}
|
|
513
|
+
if (run.length === 1) {
|
|
514
|
+
grouped.push(candidate);
|
|
515
|
+
continue;
|
|
516
|
+
}
|
|
517
|
+
grouped.push({ row: groupKind === "images" ? createImageGroup(run) : createExploringGroup(run), turnId: candidate.turnId });
|
|
518
|
+
index = cursor - 1;
|
|
519
|
+
}
|
|
520
|
+
return grouped;
|
|
521
|
+
}
|
|
522
|
+
function candidateGroupKind(candidate) {
|
|
523
|
+
if (candidate.image)
|
|
524
|
+
return "images";
|
|
525
|
+
if (candidate.exploring)
|
|
526
|
+
return "exploring";
|
|
527
|
+
return undefined;
|
|
528
|
+
}
|
|
529
|
+
function createExploringGroup(candidates) {
|
|
530
|
+
const detailItems = detailItemsForGroup(candidates, "exploring");
|
|
531
|
+
const visibleDetailItems = detailItems.slice(0, COMPACT_TERMINAL_EXPLORING_PREVIEW_LINES);
|
|
532
|
+
const omittedDetailCount = Math.max(0, detailItems.length - visibleDetailItems.length);
|
|
533
|
+
const firstRow = candidates[0]?.row;
|
|
534
|
+
const firstId = firstRow?.id ?? "exploring";
|
|
535
|
+
const lastId = candidates[candidates.length - 1]?.row.id ?? firstId;
|
|
536
|
+
const status = candidates.some((candidate) => candidate.row.status === "running")
|
|
537
|
+
? "running"
|
|
538
|
+
: candidates.some((candidate) => candidate.row.status === "error")
|
|
539
|
+
? "error"
|
|
540
|
+
: "done";
|
|
541
|
+
return {
|
|
542
|
+
id: `group:exploring:${firstId}:${lastId}`,
|
|
543
|
+
kind: "tool.group.exploring",
|
|
544
|
+
status,
|
|
545
|
+
errorKind: status === "error" ? "tool" : undefined,
|
|
546
|
+
lines: [
|
|
547
|
+
{
|
|
548
|
+
prefix: "bullet",
|
|
549
|
+
tokens: [token(status === "running" ? "Exploring" : status === "error" ? "Exploring failed" : "Explored", toneForStatus(status), "semibold")],
|
|
550
|
+
},
|
|
551
|
+
...visibleDetailItems.map((item, index) => ({
|
|
552
|
+
prefix: index === 0 ? "detail" : "continuation",
|
|
553
|
+
tokens: [token(item.label, item.status === "error" ? "red" : "dim")],
|
|
554
|
+
})),
|
|
555
|
+
...(omittedDetailCount > 0 ? [{
|
|
556
|
+
prefix: "continuation",
|
|
557
|
+
tokens: [token(`+${omittedDetailCount} more explorations`, "dim", "normal", true)],
|
|
558
|
+
}] : []),
|
|
559
|
+
],
|
|
560
|
+
sourceNodeIds: candidates.flatMap((candidate) => candidate.row.sourceNodeIds),
|
|
561
|
+
eventId: firstRow?.eventId,
|
|
562
|
+
runId: firstRow?.runId,
|
|
563
|
+
orderSource: firstRow?.orderSource,
|
|
564
|
+
orderStreamId: firstRow?.orderStreamId,
|
|
565
|
+
orderStreamFrameIndex: firstRow?.orderStreamFrameIndex,
|
|
566
|
+
detailItems,
|
|
567
|
+
expandable: detailItems.some((item) => item.input !== undefined || item.output !== undefined || Boolean(item.error)),
|
|
568
|
+
previewOmission: omittedDetailCount > 0 ? {
|
|
569
|
+
source: "details",
|
|
570
|
+
visibleLineCount: visibleDetailItems.length,
|
|
571
|
+
omittedLineCount: omittedDetailCount,
|
|
572
|
+
totalLineCount: detailItems.length,
|
|
573
|
+
maxVisibleLineCount: COMPACT_TERMINAL_EXPLORING_PREVIEW_LINES,
|
|
574
|
+
} : undefined,
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function createImageGroup(candidates) {
|
|
578
|
+
const detailItems = detailItemsForGroup(candidates, "images");
|
|
579
|
+
const visibleDetailItems = detailItems.slice(0, COMPACT_TERMINAL_EXPLORING_PREVIEW_LINES);
|
|
580
|
+
const omittedDetailCount = Math.max(0, detailItems.length - visibleDetailItems.length);
|
|
581
|
+
const firstRow = candidates[0]?.row;
|
|
582
|
+
const firstId = firstRow?.id ?? "images";
|
|
583
|
+
const lastId = candidates[candidates.length - 1]?.row.id ?? firstId;
|
|
584
|
+
const status = candidates.some((candidate) => candidate.row.status === "running")
|
|
585
|
+
? "running"
|
|
586
|
+
: candidates.some((candidate) => candidate.row.status === "error")
|
|
587
|
+
? "error"
|
|
588
|
+
: "done";
|
|
589
|
+
return {
|
|
590
|
+
id: `group:images:${firstId}:${lastId}`,
|
|
591
|
+
kind: "tool.group.images",
|
|
592
|
+
status,
|
|
593
|
+
errorKind: status === "error" ? "tool" : undefined,
|
|
594
|
+
lines: [
|
|
595
|
+
{
|
|
596
|
+
prefix: "bullet",
|
|
597
|
+
tokens: [token(status === "running" ? "Viewing images" : status === "error" ? "Image reads failed" : "Viewed images", toneForStatus(status), "semibold")],
|
|
598
|
+
},
|
|
599
|
+
...visibleDetailItems.map((item, index) => ({
|
|
600
|
+
prefix: index === 0 ? "detail" : "continuation",
|
|
601
|
+
tokens: [token(item.label, item.status === "error" ? "red" : "cyan")],
|
|
602
|
+
})),
|
|
603
|
+
...(omittedDetailCount > 0 ? [{
|
|
604
|
+
prefix: "continuation",
|
|
605
|
+
tokens: [token(`+${omittedDetailCount} more image reads`, "dim", "normal", true)],
|
|
606
|
+
}] : []),
|
|
607
|
+
],
|
|
608
|
+
sourceNodeIds: candidates.flatMap((candidate) => candidate.row.sourceNodeIds),
|
|
609
|
+
eventId: firstRow?.eventId,
|
|
610
|
+
runId: firstRow?.runId,
|
|
611
|
+
orderSource: firstRow?.orderSource,
|
|
612
|
+
orderStreamId: firstRow?.orderStreamId,
|
|
613
|
+
orderStreamFrameIndex: firstRow?.orderStreamFrameIndex,
|
|
614
|
+
detailItems,
|
|
615
|
+
expandable: detailItems.some((item) => item.input !== undefined || item.output !== undefined || Boolean(item.error)),
|
|
616
|
+
previewOmission: omittedDetailCount > 0 ? {
|
|
617
|
+
source: "details",
|
|
618
|
+
visibleLineCount: visibleDetailItems.length,
|
|
619
|
+
omittedLineCount: omittedDetailCount,
|
|
620
|
+
totalLineCount: detailItems.length,
|
|
621
|
+
maxVisibleLineCount: COMPACT_TERMINAL_EXPLORING_PREVIEW_LINES,
|
|
622
|
+
} : undefined,
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
function detailItemsForGroup(candidates, kind) {
|
|
626
|
+
return candidates.map((candidate) => {
|
|
627
|
+
const detail = kind === "images" ? candidate.image : candidate.exploring;
|
|
628
|
+
return {
|
|
629
|
+
id: candidate.row.id,
|
|
630
|
+
label: detail?.label ?? candidate.row.lines[0]?.tokens.map((entry) => entry.text).join("") ?? candidate.row.id,
|
|
631
|
+
status: candidate.row.status,
|
|
632
|
+
input: candidate.row.input,
|
|
633
|
+
output: candidate.row.output,
|
|
634
|
+
error: candidate.row.error,
|
|
635
|
+
linkedPiboSessionId: candidate.row.linkedPiboSessionId,
|
|
636
|
+
previewOmission: candidate.row.previewOmission,
|
|
637
|
+
};
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
function classifyImageTool(node) {
|
|
641
|
+
const normalized = (node.title ?? "").trim().toLowerCase();
|
|
642
|
+
const args = isRecord(node.input) ? node.input : undefined;
|
|
643
|
+
const path = previewPath(args) ?? previewPath(isRecord(node.output) ? recordField(node.output, "details") : undefined) ?? previewPath(isRecord(node.output) ? node.output : undefined);
|
|
644
|
+
const query = previewQuery(args);
|
|
645
|
+
const images = collectImagePayloads(node.output);
|
|
646
|
+
const isImageTool = matchesTool(normalized, ["view_image", "image", "screenshot"]);
|
|
647
|
+
if (!images.length && !isImageTool)
|
|
648
|
+
return undefined;
|
|
649
|
+
const mimeType = images.map((image) => image.mimeType).find((value) => Boolean(value));
|
|
650
|
+
const count = Math.max(1, images.length);
|
|
651
|
+
const summary = {
|
|
652
|
+
type: images.length > 1 ? "images" : images.length === 1 ? "image" : "image_reference",
|
|
653
|
+
path,
|
|
654
|
+
query,
|
|
655
|
+
mimeType,
|
|
656
|
+
count: count > 1 ? count : undefined,
|
|
657
|
+
detail: images.length ? "Image data hidden in terminal view." : "Image path only; binary data is hidden in terminal view.",
|
|
658
|
+
};
|
|
659
|
+
const labelTarget = path ?? query ?? mimeType ?? "image";
|
|
660
|
+
return {
|
|
661
|
+
count,
|
|
662
|
+
path,
|
|
663
|
+
query,
|
|
664
|
+
mimeType,
|
|
665
|
+
summary,
|
|
666
|
+
detail: {
|
|
667
|
+
id: node.id,
|
|
668
|
+
label: `${node.status === "error" ? "Image failed" : "Viewed image"} ${labelTarget}`,
|
|
669
|
+
status: mapStatus(node.status),
|
|
670
|
+
input: sanitizeImagePayload(node.input),
|
|
671
|
+
output: summary,
|
|
672
|
+
error: node.error,
|
|
673
|
+
},
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
function collectImagePayloads(value, depth = 0, seen = new Set()) {
|
|
677
|
+
if (depth > 5 || value === undefined || value === null)
|
|
678
|
+
return [];
|
|
679
|
+
if (typeof value !== "object")
|
|
680
|
+
return [];
|
|
681
|
+
if (seen.has(value))
|
|
682
|
+
return [];
|
|
683
|
+
seen.add(value);
|
|
684
|
+
if (Array.isArray(value))
|
|
685
|
+
return value.flatMap((item) => collectImagePayloads(item, depth + 1, seen));
|
|
686
|
+
const record = value;
|
|
687
|
+
const type = typeof record.type === "string" ? record.type.toLowerCase() : undefined;
|
|
688
|
+
const mimeType = typeof record.mimeType === "string" ? record.mimeType : typeof record.mime_type === "string" ? record.mime_type : undefined;
|
|
689
|
+
const hasImageData = typeof record.data === "string" || typeof record.image_url === "string" || isRecord(record.image_url);
|
|
690
|
+
if ((type === "image" || type === "input_image" || type === "output_image" || type === "image_url") && (hasImageData || mimeType?.startsWith("image/"))) {
|
|
691
|
+
return [{ mimeType }];
|
|
692
|
+
}
|
|
693
|
+
if (mimeType?.startsWith("image/") && hasImageData)
|
|
694
|
+
return [{ mimeType }];
|
|
695
|
+
const nested = [];
|
|
696
|
+
if ("content" in record)
|
|
697
|
+
nested.push(record.content);
|
|
698
|
+
if ("message" in record)
|
|
699
|
+
nested.push(record.message);
|
|
700
|
+
if ("result" in record)
|
|
701
|
+
nested.push(record.result);
|
|
702
|
+
if ("output" in record)
|
|
703
|
+
nested.push(record.output);
|
|
704
|
+
return nested.flatMap((item) => collectImagePayloads(item, depth + 1, seen));
|
|
705
|
+
}
|
|
706
|
+
function sanitizeImagePayload(value) {
|
|
707
|
+
if (Array.isArray(value))
|
|
708
|
+
return value.map(sanitizeImagePayload);
|
|
709
|
+
if (!isRecord(value))
|
|
710
|
+
return value;
|
|
711
|
+
const result = {};
|
|
712
|
+
for (const [key, item] of Object.entries(value)) {
|
|
713
|
+
if ((key === "data" || key === "image_url") && typeof item === "string" && item.length > 120) {
|
|
714
|
+
result[key] = `[hidden ${key}]`;
|
|
715
|
+
continue;
|
|
716
|
+
}
|
|
717
|
+
result[key] = sanitizeImagePayload(item);
|
|
718
|
+
}
|
|
719
|
+
return result;
|
|
720
|
+
}
|
|
721
|
+
function imageToolVerb(status, count) {
|
|
722
|
+
if (status === "running")
|
|
723
|
+
return count > 1 ? "Viewing images" : "Viewing image";
|
|
724
|
+
if (status === "error")
|
|
725
|
+
return count > 1 ? "Image reads failed" : "Image read failed";
|
|
726
|
+
return count > 1 ? "Viewed images" : "Viewed image";
|
|
727
|
+
}
|
|
728
|
+
function recordField(record, key) {
|
|
729
|
+
const value = record?.[key];
|
|
730
|
+
return isRecord(value) ? value : undefined;
|
|
731
|
+
}
|
|
732
|
+
function classifyExploringTool(node) {
|
|
733
|
+
const normalized = (node.title ?? "").trim().toLowerCase();
|
|
734
|
+
const args = isRecord(node.input) ? node.input : undefined;
|
|
735
|
+
if (matchesTool(normalized, ["read", "open"])) {
|
|
736
|
+
return {
|
|
737
|
+
id: node.id,
|
|
738
|
+
label: `Read ${previewPath(args) ?? compactInlinePreview(node.input)}`,
|
|
739
|
+
status: mapStatus(node.status),
|
|
740
|
+
input: node.input,
|
|
741
|
+
output: node.output,
|
|
742
|
+
error: node.error,
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
if (matchesTool(normalized, ["list", "ls", "glob"])) {
|
|
746
|
+
return {
|
|
747
|
+
id: node.id,
|
|
748
|
+
label: `List ${previewPath(args) ?? compactInlinePreview(node.input)}`,
|
|
749
|
+
status: mapStatus(node.status),
|
|
750
|
+
input: node.input,
|
|
751
|
+
output: node.output,
|
|
752
|
+
error: node.error,
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
if (matchesTool(normalized, ["search", "find", "grep", "rg"])) {
|
|
756
|
+
const query = previewQuery(args);
|
|
757
|
+
const path = previewPath(args);
|
|
758
|
+
return {
|
|
759
|
+
id: node.id,
|
|
760
|
+
label: `Search ${query ?? compactInlinePreview(node.input)}${path ? ` in ${path}` : ""}`,
|
|
761
|
+
status: mapStatus(node.status),
|
|
762
|
+
input: node.input,
|
|
763
|
+
output: node.output,
|
|
764
|
+
error: node.error,
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
return undefined;
|
|
768
|
+
}
|
|
769
|
+
function matchesTool(name, terms) {
|
|
770
|
+
return terms.some((term) => name === term || name.startsWith(`${term}_`) || name.endsWith(`_${term}`) || name.includes(term));
|
|
771
|
+
}
|
|
772
|
+
function previewPath(value) {
|
|
773
|
+
if (!value)
|
|
774
|
+
return undefined;
|
|
775
|
+
for (const key of ["path", "file", "filePath", "filepath", "url", "uri", "cwd", "pattern", "glob"]) {
|
|
776
|
+
const candidate = stringValue(value[key]);
|
|
777
|
+
if (candidate)
|
|
778
|
+
return candidate;
|
|
779
|
+
}
|
|
780
|
+
return undefined;
|
|
781
|
+
}
|
|
782
|
+
function previewQuery(value) {
|
|
783
|
+
if (!value)
|
|
784
|
+
return undefined;
|
|
785
|
+
for (const key of ["query", "pattern", "text", "name", "q", "regex"]) {
|
|
786
|
+
const candidate = stringValue(value[key]);
|
|
787
|
+
if (candidate)
|
|
788
|
+
return candidate;
|
|
789
|
+
}
|
|
790
|
+
return undefined;
|
|
791
|
+
}
|
|
792
|
+
function previewLines(value, maxVisibleLines, tone = "dim", _maxLineLength = 160) {
|
|
793
|
+
const empty = { lines: [], visibleLineCount: 0, omittedLineCount: 0, totalLineCount: 0, maxVisibleLineCount: maxVisibleLines };
|
|
794
|
+
const text = previewText(value);
|
|
795
|
+
if (!text)
|
|
796
|
+
return empty;
|
|
797
|
+
const allLines = text
|
|
798
|
+
.split(/\r?\n/)
|
|
799
|
+
.map((line) => line.trimEnd())
|
|
800
|
+
.filter((line, index, lines) => line.length > 0 || lines.length === 1);
|
|
801
|
+
if (!allLines.length)
|
|
802
|
+
return empty;
|
|
803
|
+
const visible = allLines.slice(0, maxVisibleLines);
|
|
804
|
+
const omittedLineCount = Math.max(0, allLines.length - visible.length);
|
|
805
|
+
const lines = visible.map((line, index) => ({
|
|
806
|
+
prefix: index === 0 ? "detail" : "continuation",
|
|
807
|
+
tokens: [token(line, tone)],
|
|
808
|
+
}));
|
|
809
|
+
if (omittedLineCount > 0) {
|
|
810
|
+
lines.push({
|
|
811
|
+
prefix: "continuation",
|
|
812
|
+
tokens: [token(`+${omittedLineCount} more lines`, "dim", "normal", true)],
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
return {
|
|
816
|
+
lines,
|
|
817
|
+
visibleLineCount: visible.length,
|
|
818
|
+
omittedLineCount,
|
|
819
|
+
totalLineCount: allLines.length,
|
|
820
|
+
maxVisibleLineCount: maxVisibleLines,
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
function previewOmission(result, source) {
|
|
824
|
+
if (result.omittedLineCount <= 0)
|
|
825
|
+
return undefined;
|
|
826
|
+
return {
|
|
827
|
+
source,
|
|
828
|
+
visibleLineCount: result.visibleLineCount,
|
|
829
|
+
omittedLineCount: result.omittedLineCount,
|
|
830
|
+
totalLineCount: result.totalLineCount,
|
|
831
|
+
maxVisibleLineCount: result.maxVisibleLineCount,
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
function previewText(value) {
|
|
835
|
+
const text = terminalTextValue(value);
|
|
836
|
+
if (text !== undefined)
|
|
837
|
+
return text.trim();
|
|
838
|
+
if (typeof value === "string")
|
|
839
|
+
return value.trim();
|
|
840
|
+
if (value === undefined || value === null)
|
|
841
|
+
return "";
|
|
842
|
+
try {
|
|
843
|
+
return JSON.stringify(value, null, 2);
|
|
844
|
+
}
|
|
845
|
+
catch {
|
|
846
|
+
return String(value);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
function compactInlinePreview(value) {
|
|
850
|
+
const text = typeof value === "string" ? value : previewText(value);
|
|
851
|
+
return text.replace(/\s+/g, " ").trim();
|
|
852
|
+
}
|
|
853
|
+
function isShellToolName(name) {
|
|
854
|
+
const normalized = (name ?? "").trim().toLowerCase();
|
|
855
|
+
return (normalized === "shell" ||
|
|
856
|
+
normalized === "bash" ||
|
|
857
|
+
normalized === "terminal");
|
|
858
|
+
}
|
|
859
|
+
function shellCommandValue(value) {
|
|
860
|
+
if (!isRecord(value))
|
|
861
|
+
return undefined;
|
|
862
|
+
for (const key of ["cmd", "command", "script"]) {
|
|
863
|
+
const candidate = stringValue(value[key]);
|
|
864
|
+
if (candidate)
|
|
865
|
+
return candidate;
|
|
866
|
+
}
|
|
867
|
+
return undefined;
|
|
868
|
+
}
|
|
869
|
+
function bashTokens(command) {
|
|
870
|
+
const chunks = command.match(/\s+|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s]+/g) ?? [command];
|
|
871
|
+
let seenCommand = false;
|
|
872
|
+
return chunks.map((chunk) => {
|
|
873
|
+
if (/^\s+$/.test(chunk))
|
|
874
|
+
return token(chunk);
|
|
875
|
+
if (/^(?:&&|\|\||[|;<>]|2>&1)$/.test(chunk))
|
|
876
|
+
return token(chunk, "red", "semibold");
|
|
877
|
+
if (chunk.startsWith("-"))
|
|
878
|
+
return token(chunk, "magenta");
|
|
879
|
+
if (chunk.startsWith("$") || chunk.includes("="))
|
|
880
|
+
return token(chunk, "yellow");
|
|
881
|
+
if (/^['"]/.test(chunk))
|
|
882
|
+
return token(chunk, "green");
|
|
883
|
+
if (!seenCommand) {
|
|
884
|
+
seenCommand = true;
|
|
885
|
+
return token(chunk, "green", "semibold");
|
|
886
|
+
}
|
|
887
|
+
if (chunk.includes("/") || chunk.startsWith("."))
|
|
888
|
+
return token(chunk, "cyan");
|
|
889
|
+
return token(chunk, "default");
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
function toolVerb(status) {
|
|
893
|
+
if (status === "running")
|
|
894
|
+
return "Calling";
|
|
895
|
+
if (status === "error")
|
|
896
|
+
return "Call failed";
|
|
897
|
+
return "Called";
|
|
898
|
+
}
|
|
899
|
+
function delegationVerb(status) {
|
|
900
|
+
if (status === "running")
|
|
901
|
+
return "Spawning";
|
|
902
|
+
if (status === "error")
|
|
903
|
+
return "Spawn failed";
|
|
904
|
+
return "Spawned";
|
|
905
|
+
}
|
|
906
|
+
function asyncVerb(status) {
|
|
907
|
+
if (status === "running")
|
|
908
|
+
return "Waiting for";
|
|
909
|
+
if (status === "error")
|
|
910
|
+
return "Finished waiting for";
|
|
911
|
+
return "Finished waiting for";
|
|
912
|
+
}
|
|
913
|
+
function mapStatus(status) {
|
|
914
|
+
if (status === "running")
|
|
915
|
+
return "running";
|
|
916
|
+
if (status === "error")
|
|
917
|
+
return "error";
|
|
918
|
+
return "done";
|
|
919
|
+
}
|
|
920
|
+
function toneForStatus(status) {
|
|
921
|
+
if (status === "running")
|
|
922
|
+
return "cyan";
|
|
923
|
+
if (status === "error")
|
|
924
|
+
return "red";
|
|
925
|
+
if (status === "done")
|
|
926
|
+
return "green";
|
|
927
|
+
return "default";
|
|
928
|
+
}
|
|
929
|
+
function token(text, tone = "default", weight = "normal", italic = false) {
|
|
930
|
+
return { text, tone, weight, italic };
|
|
931
|
+
}
|
|
932
|
+
function stringValue(value) {
|
|
933
|
+
return typeof value === "string" && value.trim().length ? value : undefined;
|
|
934
|
+
}
|
|
935
|
+
function isRecord(value) {
|
|
936
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
937
|
+
}
|