@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,335 @@
|
|
|
1
|
+
function isJsonValue(value) {
|
|
2
|
+
if (value === null
|
|
3
|
+
|| typeof value === "string"
|
|
4
|
+
|| typeof value === "boolean"
|
|
5
|
+
|| (typeof value === "number" && Number.isFinite(value))) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
if (Array.isArray(value))
|
|
9
|
+
return value.every(isJsonValue);
|
|
10
|
+
if (value && typeof value === "object")
|
|
11
|
+
return Object.values(value).every(isJsonValue);
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
function isJsonObject(value) {
|
|
15
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value) && isJsonValue(value);
|
|
16
|
+
}
|
|
17
|
+
const WORKFLOW_JSON_SCHEMA_SUPPORTED_TYPES = new Set(["string", "number", "integer", "boolean", "object", "array", "null"]);
|
|
18
|
+
const WORKFLOW_JSON_SCHEMA_SUPPORTED_KEYS = new Set([
|
|
19
|
+
"type",
|
|
20
|
+
"title",
|
|
21
|
+
"description",
|
|
22
|
+
"enum",
|
|
23
|
+
"const",
|
|
24
|
+
"default",
|
|
25
|
+
"properties",
|
|
26
|
+
"required",
|
|
27
|
+
"additionalProperties",
|
|
28
|
+
"items",
|
|
29
|
+
"anyOf",
|
|
30
|
+
"oneOf",
|
|
31
|
+
"allOf",
|
|
32
|
+
"$defs",
|
|
33
|
+
"$ref",
|
|
34
|
+
]);
|
|
35
|
+
export function validateJsonSchemaObjectLike(value, path, diagnostics, options) {
|
|
36
|
+
const { requireObjectRoot, ...target } = options;
|
|
37
|
+
if (!isJsonObject(value)) {
|
|
38
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
39
|
+
code: "WorkflowSchemaError.invalidJsonSchema",
|
|
40
|
+
message: `JSON schema at '${path}' must be an object.`,
|
|
41
|
+
path,
|
|
42
|
+
hint: "Use the existing JSON Schema subset object; Zod schemas are not part of V2 authoring.",
|
|
43
|
+
});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
validateWorkflowJsonSchemaSubsetLike(value, path, diagnostics, target, {
|
|
47
|
+
context: { rootSchema: value, seenRefs: new Set() },
|
|
48
|
+
root: true,
|
|
49
|
+
requireObjectRoot,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function validateWorkflowJsonSchemaSubsetLike(value, path, diagnostics, target, options) {
|
|
53
|
+
if (!isJsonObject(value)) {
|
|
54
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
55
|
+
code: "WorkflowInterfaceError.schemaNotObject",
|
|
56
|
+
message: "JSON schema must be an object in the V1 Structured Outputs subset.",
|
|
57
|
+
path,
|
|
58
|
+
hint: "Use an object JSON Schema with a supported type, properties, and required fields.",
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
for (const key of Object.keys(value)) {
|
|
63
|
+
if (!WORKFLOW_JSON_SCHEMA_SUPPORTED_KEYS.has(key)) {
|
|
64
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
65
|
+
code: "WorkflowInterfaceError.unsupportedSchemaKeyword",
|
|
66
|
+
message: `JSON Schema keyword '${key}' is not supported by the V1 Structured Outputs subset.`,
|
|
67
|
+
path: `${path}.${key}`,
|
|
68
|
+
hint: "Remove the keyword or model the contract with type, properties, items, enum, const, anyOf, $defs, or $ref.",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (value.oneOf !== undefined) {
|
|
73
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
74
|
+
code: "WorkflowInterfaceError.unsupportedOneOf",
|
|
75
|
+
message: "oneOf is not supported by the V1 Structured Outputs subset.",
|
|
76
|
+
path: `${path}.oneOf`,
|
|
77
|
+
hint: "Use anyOf for supported alternatives, or split the contract into explicit adapter/workflow steps.",
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (value.allOf !== undefined) {
|
|
81
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
82
|
+
code: "WorkflowInterfaceError.unsupportedAllOf",
|
|
83
|
+
message: "allOf is not supported by the V1 Structured Outputs subset.",
|
|
84
|
+
path: `${path}.allOf`,
|
|
85
|
+
hint: "Flatten the schema into one object with explicit properties and required fields.",
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
validateWorkflowJsonSchemaDefsLike(value, path, diagnostics, target, options.context);
|
|
89
|
+
validateWorkflowJsonSchemaRefLike(value, path, diagnostics, target, options);
|
|
90
|
+
if (value.type === undefined && value.$ref === undefined && value.anyOf === undefined) {
|
|
91
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
92
|
+
code: "WorkflowInterfaceError.schemaTypeMissing",
|
|
93
|
+
message: "JSON schemas must declare a supported type unless they are local $ref or anyOf wrappers.",
|
|
94
|
+
path: `${path}.type`,
|
|
95
|
+
hint: "Add type: 'object', 'array', 'string', 'number', 'integer', 'boolean', or 'null'.",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
const schemaTypes = validateWorkflowJsonSchemaTypeLike(value.type, path, diagnostics, target);
|
|
99
|
+
if (options.root && value.anyOf !== undefined) {
|
|
100
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
101
|
+
code: "WorkflowInterfaceError.rootAnyOf",
|
|
102
|
+
message: "Root anyOf is not supported for workflow structured output schemas.",
|
|
103
|
+
path: `${path}.anyOf`,
|
|
104
|
+
hint: "Use a root object and place anyOf inside a property or $defs entry.",
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
validateWorkflowJsonSchemaAnyOfLike(value, path, diagnostics, target, options.context);
|
|
108
|
+
if (options.root && options.requireObjectRoot && value.$ref === undefined && !schemaTypes.includes("object")) {
|
|
109
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
110
|
+
code: "WorkflowInterfaceError.rootMustBeObject",
|
|
111
|
+
message: "Structured workflow JSON schemas must have an object root in V1.",
|
|
112
|
+
path: `${path}.type`,
|
|
113
|
+
hint: "Wrap scalar or array values in an object property, e.g. { type: 'object', properties: { value: ... }, required: ['value'], additionalProperties: false }.",
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (schemaTypes.includes("object") || value.properties !== undefined || value.required !== undefined || value.additionalProperties !== undefined) {
|
|
117
|
+
validateWorkflowJsonObjectSchemaLike(value, path, diagnostics, target, options.context);
|
|
118
|
+
}
|
|
119
|
+
if (schemaTypes.includes("array")) {
|
|
120
|
+
if (value.items === undefined) {
|
|
121
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
122
|
+
code: "WorkflowInterfaceError.arrayMissingItems",
|
|
123
|
+
message: "Array schemas must declare an items schema.",
|
|
124
|
+
path: `${path}.items`,
|
|
125
|
+
hint: "Add items with another supported V1 schema.",
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
validateWorkflowJsonSchemaSubsetLike(value.items, `${path}.items`, diagnostics, target, {
|
|
130
|
+
context: options.context,
|
|
131
|
+
root: false,
|
|
132
|
+
requireObjectRoot: false,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (value.enum !== undefined && !Array.isArray(value.enum)) {
|
|
137
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
138
|
+
code: "WorkflowInterfaceError.invalidEnum",
|
|
139
|
+
message: "enum must be an array of JSON values.",
|
|
140
|
+
path: `${path}.enum`,
|
|
141
|
+
hint: "Use enum: ['one', 'two'] or remove the enum constraint.",
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function validateWorkflowJsonSchemaDefsLike(schema, path, diagnostics, target, context) {
|
|
146
|
+
if (schema.$defs === undefined)
|
|
147
|
+
return;
|
|
148
|
+
if (!isJsonObject(schema.$defs)) {
|
|
149
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
150
|
+
code: "WorkflowInterfaceError.invalidDefs",
|
|
151
|
+
message: "$defs must be an object keyed by local definition name.",
|
|
152
|
+
path: `${path}.$defs`,
|
|
153
|
+
hint: "Use $defs: { Name: { type: 'object', ... } } for reusable schemas.",
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
for (const [defName, defSchema] of Object.entries(schema.$defs)) {
|
|
158
|
+
validateWorkflowJsonSchemaSubsetLike(defSchema, `${path}.$defs.${defName}`, diagnostics, target, {
|
|
159
|
+
context,
|
|
160
|
+
root: false,
|
|
161
|
+
requireObjectRoot: false,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function validateWorkflowJsonSchemaRefLike(schema, path, diagnostics, target, options) {
|
|
166
|
+
if (schema.$ref === undefined)
|
|
167
|
+
return;
|
|
168
|
+
if (typeof schema.$ref !== "string") {
|
|
169
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
170
|
+
code: "WorkflowInterfaceError.invalidRef",
|
|
171
|
+
message: "$ref must be a string local reference.",
|
|
172
|
+
path: `${path}.$ref`,
|
|
173
|
+
hint: "Use local references such as '#/$defs/MyObject'.",
|
|
174
|
+
});
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const refTarget = resolveWorkflowJsonSchemaLocalRef(options.context.rootSchema, schema.$ref);
|
|
178
|
+
if (!refTarget) {
|
|
179
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
180
|
+
code: "WorkflowInterfaceError.unresolvedRef",
|
|
181
|
+
message: `JSON Schema reference '${schema.$ref}' could not be resolved.`,
|
|
182
|
+
path: `${path}.$ref`,
|
|
183
|
+
hint: "Only local $defs references are supported in V1, for example '#/$defs/MyObject'.",
|
|
184
|
+
});
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (options.context.seenRefs.has(schema.$ref))
|
|
188
|
+
return;
|
|
189
|
+
options.context.seenRefs.add(schema.$ref);
|
|
190
|
+
validateWorkflowJsonSchemaSubsetLike(refTarget, `${path}.$ref(${schema.$ref})`, diagnostics, target, options);
|
|
191
|
+
options.context.seenRefs.delete(schema.$ref);
|
|
192
|
+
}
|
|
193
|
+
function validateWorkflowJsonSchemaAnyOfLike(schema, path, diagnostics, target, context) {
|
|
194
|
+
if (schema.anyOf === undefined)
|
|
195
|
+
return;
|
|
196
|
+
if (!Array.isArray(schema.anyOf) || schema.anyOf.length === 0) {
|
|
197
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
198
|
+
code: "WorkflowInterfaceError.invalidAnyOf",
|
|
199
|
+
message: "anyOf must be a non-empty array of schema objects.",
|
|
200
|
+
path: `${path}.anyOf`,
|
|
201
|
+
hint: "Provide one or more supported schema alternatives.",
|
|
202
|
+
});
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
schema.anyOf.forEach((item, index) => validateWorkflowJsonSchemaSubsetLike(item, `${path}.anyOf.${index}`, diagnostics, target, {
|
|
206
|
+
context,
|
|
207
|
+
root: false,
|
|
208
|
+
requireObjectRoot: false,
|
|
209
|
+
}));
|
|
210
|
+
}
|
|
211
|
+
function validateWorkflowJsonSchemaTypeLike(value, path, diagnostics, target) {
|
|
212
|
+
if (value === undefined)
|
|
213
|
+
return [];
|
|
214
|
+
const values = Array.isArray(value) ? value : [value];
|
|
215
|
+
if (values.length === 0) {
|
|
216
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
217
|
+
code: "WorkflowInterfaceError.emptyType",
|
|
218
|
+
message: "Schema type arrays must include at least one supported type.",
|
|
219
|
+
path: `${path}.type`,
|
|
220
|
+
hint: "Use a supported type such as 'object', or a nullable pair such as ['string', 'null'].",
|
|
221
|
+
});
|
|
222
|
+
return [];
|
|
223
|
+
}
|
|
224
|
+
const seen = new Set();
|
|
225
|
+
const validTypes = [];
|
|
226
|
+
values.forEach((typeName, index) => {
|
|
227
|
+
if (typeof typeName !== "string" || !WORKFLOW_JSON_SCHEMA_SUPPORTED_TYPES.has(typeName)) {
|
|
228
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
229
|
+
code: "WorkflowInterfaceError.unsupportedSchemaType",
|
|
230
|
+
message: `Schema type '${String(typeName)}' is not supported by the V1 Structured Outputs subset.`,
|
|
231
|
+
path: Array.isArray(value) ? `${path}.type.${index}` : `${path}.type`,
|
|
232
|
+
hint: "Use one of string, number, integer, boolean, object, array, or null.",
|
|
233
|
+
});
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (seen.has(typeName)) {
|
|
237
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
238
|
+
code: "WorkflowInterfaceError.duplicateSchemaType",
|
|
239
|
+
message: `Schema type '${typeName}' is duplicated.`,
|
|
240
|
+
path: Array.isArray(value) ? `${path}.type.${index}` : `${path}.type`,
|
|
241
|
+
hint: "List each schema type only once.",
|
|
242
|
+
});
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
seen.add(typeName);
|
|
246
|
+
validTypes.push(typeName);
|
|
247
|
+
});
|
|
248
|
+
return validTypes;
|
|
249
|
+
}
|
|
250
|
+
function validateWorkflowJsonObjectSchemaLike(schema, path, diagnostics, target, context) {
|
|
251
|
+
if (schema.additionalProperties !== false) {
|
|
252
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
253
|
+
code: "WorkflowInterfaceError.objectAdditionalProperties",
|
|
254
|
+
message: "Object schemas must set additionalProperties: false in the V1 Structured Outputs subset.",
|
|
255
|
+
path: `${path}.additionalProperties`,
|
|
256
|
+
hint: "Add additionalProperties: false to every object schema.",
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
if (schema.properties !== undefined && !isJsonObject(schema.properties)) {
|
|
260
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
261
|
+
code: "WorkflowInterfaceError.invalidProperties",
|
|
262
|
+
message: "Object schema properties must be an object.",
|
|
263
|
+
path: `${path}.properties`,
|
|
264
|
+
hint: "Use properties: { fieldName: { type: 'string' } }.",
|
|
265
|
+
});
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const propertyEntries = Object.entries(isJsonObject(schema.properties) ? schema.properties : {});
|
|
269
|
+
if (propertyEntries.length > 0 && !Array.isArray(schema.required)) {
|
|
270
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
271
|
+
code: "WorkflowInterfaceError.objectRequiredMissing",
|
|
272
|
+
message: "Object schemas must list every property in required.",
|
|
273
|
+
path: `${path}.required`,
|
|
274
|
+
hint: "Set required to exactly the object property names; use nullable types for optional semantics.",
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
const required = Array.isArray(schema.required) ? schema.required : [];
|
|
278
|
+
const requiredSet = new Set(required.filter((entry) => typeof entry === "string"));
|
|
279
|
+
for (const [propertyName, propertySchema] of propertyEntries) {
|
|
280
|
+
if (!requiredSet.has(propertyName)) {
|
|
281
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
282
|
+
code: "WorkflowInterfaceError.objectPropertyNotRequired",
|
|
283
|
+
message: `Object property '${propertyName}' must be listed in required.`,
|
|
284
|
+
path: `${path}.required`,
|
|
285
|
+
hint: "Structured Outputs requires every object field to be required; use a union with null for nullable fields.",
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
validateWorkflowJsonSchemaSubsetLike(propertySchema, `${path}.properties.${propertyName}`, diagnostics, target, {
|
|
289
|
+
context,
|
|
290
|
+
root: false,
|
|
291
|
+
requireObjectRoot: false,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
for (const requiredName of required) {
|
|
295
|
+
if (typeof requiredName !== "string") {
|
|
296
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
297
|
+
code: "WorkflowInterfaceError.invalidRequiredEntry",
|
|
298
|
+
message: "required entries must be strings.",
|
|
299
|
+
path: `${path}.required`,
|
|
300
|
+
hint: "List required property names as strings.",
|
|
301
|
+
});
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
if (isJsonObject(schema.properties) && !Object.hasOwn(schema.properties, requiredName)) {
|
|
305
|
+
addWorkflowJsonSchemaDiagnostic(diagnostics, target, {
|
|
306
|
+
code: "WorkflowInterfaceError.requiredUnknownProperty",
|
|
307
|
+
message: `Required property '${requiredName}' is not declared in properties.`,
|
|
308
|
+
path: `${path}.required`,
|
|
309
|
+
hint: "Remove the unknown required name or add a matching property schema.",
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function resolveWorkflowJsonSchemaLocalRef(rootSchema, ref) {
|
|
315
|
+
if (!ref.startsWith("#/$defs/"))
|
|
316
|
+
return undefined;
|
|
317
|
+
const defs = isJsonObject(rootSchema.$defs) ? rootSchema.$defs : undefined;
|
|
318
|
+
if (!defs)
|
|
319
|
+
return undefined;
|
|
320
|
+
const pointer = ref.slice("#/$defs/".length).split("/").map((segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
321
|
+
let current = defs;
|
|
322
|
+
for (const segment of pointer) {
|
|
323
|
+
if (!isJsonObject(current) || !Object.hasOwn(current, segment))
|
|
324
|
+
return undefined;
|
|
325
|
+
current = current[segment];
|
|
326
|
+
}
|
|
327
|
+
return current;
|
|
328
|
+
}
|
|
329
|
+
function addWorkflowJsonSchemaDiagnostic(diagnostics, target, input) {
|
|
330
|
+
diagnostics.push({
|
|
331
|
+
...input,
|
|
332
|
+
severity: "error",
|
|
333
|
+
...target,
|
|
334
|
+
});
|
|
335
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
const WORKFLOW_DIAGNOSTIC_TEXT_MAX_LENGTH = 600;
|
|
3
|
+
const WORKFLOW_DIAGNOSTIC_REF_MAX_LENGTH = 240;
|
|
4
|
+
const WORKFLOW_DIAGNOSTIC_SENSITIVE_VALUE_PATTERN = /(["']?)(promptTemplate|promptOverrides|inputValues|input|output|state|payload|edgePayload|humanActionPayload|edge payload|human action payload)\1\s*[:=]\s*("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`|\{[^{}]{0,500}\}|\[[^[\]]{0,500}\]|[^\s,;]{1,500})/gi;
|
|
5
|
+
export function sanitizeWorkflowDiagnostics(value) {
|
|
6
|
+
if (!Array.isArray(value))
|
|
7
|
+
return [];
|
|
8
|
+
return value.map(sanitizeWorkflowDiagnostic);
|
|
9
|
+
}
|
|
10
|
+
function sanitizeWorkflowDiagnostic(value) {
|
|
11
|
+
const record = isWorkflowDiagnosticRecord(value) ? value : {};
|
|
12
|
+
const diagnostic = {
|
|
13
|
+
code: normalizeWorkflowDiagnosticString(record.code, WORKFLOW_DIAGNOSTIC_REF_MAX_LENGTH) ?? "WorkflowDiagnostic.redacted",
|
|
14
|
+
message: normalizeWorkflowDiagnosticText(record.message) ?? "Workflow diagnostic details were redacted.",
|
|
15
|
+
severity: normalizeWorkflowDiagnosticSeverity(record.severity),
|
|
16
|
+
};
|
|
17
|
+
const path = normalizeWorkflowDiagnosticString(record.path, WORKFLOW_DIAGNOSTIC_REF_MAX_LENGTH);
|
|
18
|
+
if (path)
|
|
19
|
+
diagnostic.path = path;
|
|
20
|
+
const nodeId = normalizeWorkflowDiagnosticString(record.nodeId, WORKFLOW_DIAGNOSTIC_REF_MAX_LENGTH);
|
|
21
|
+
if (nodeId)
|
|
22
|
+
diagnostic.nodeId = nodeId;
|
|
23
|
+
const edgeId = normalizeWorkflowDiagnosticString(record.edgeId, WORKFLOW_DIAGNOSTIC_REF_MAX_LENGTH);
|
|
24
|
+
if (edgeId)
|
|
25
|
+
diagnostic.edgeId = edgeId;
|
|
26
|
+
const registryRef = normalizeWorkflowDiagnosticString(record.registryRef, WORKFLOW_DIAGNOSTIC_REF_MAX_LENGTH);
|
|
27
|
+
if (registryRef)
|
|
28
|
+
diagnostic.registryRef = registryRef;
|
|
29
|
+
const hint = normalizeWorkflowDiagnosticText(record.hint);
|
|
30
|
+
if (hint)
|
|
31
|
+
diagnostic.hint = hint;
|
|
32
|
+
return diagnostic;
|
|
33
|
+
}
|
|
34
|
+
function isWorkflowDiagnosticRecord(value) {
|
|
35
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
36
|
+
}
|
|
37
|
+
function normalizeWorkflowDiagnosticSeverity(value) {
|
|
38
|
+
return value === "info" || value === "warning" || value === "error" ? value : "error";
|
|
39
|
+
}
|
|
40
|
+
function normalizeWorkflowDiagnosticText(value) {
|
|
41
|
+
const text = normalizeWorkflowDiagnosticString(value, WORKFLOW_DIAGNOSTIC_TEXT_MAX_LENGTH);
|
|
42
|
+
if (!text)
|
|
43
|
+
return undefined;
|
|
44
|
+
return truncateWorkflowDiagnosticText(redactWorkflowDiagnosticText(text));
|
|
45
|
+
}
|
|
46
|
+
function normalizeWorkflowDiagnosticString(value, maxLength) {
|
|
47
|
+
if (typeof value !== "string")
|
|
48
|
+
return undefined;
|
|
49
|
+
const trimmed = value.trim();
|
|
50
|
+
if (!trimmed)
|
|
51
|
+
return undefined;
|
|
52
|
+
return trimmed.length > maxLength ? `${trimmed.slice(0, maxLength)}…` : trimmed;
|
|
53
|
+
}
|
|
54
|
+
function redactWorkflowDiagnosticText(text) {
|
|
55
|
+
return text.replace(WORKFLOW_DIAGNOSTIC_SENSITIVE_VALUE_PATTERN, (_match, quote, label) => `${quote}${label}${quote}: [redacted]`);
|
|
56
|
+
}
|
|
57
|
+
function truncateWorkflowDiagnosticText(text) {
|
|
58
|
+
return text.length > WORKFLOW_DIAGNOSTIC_TEXT_MAX_LENGTH ? `${text.slice(0, WORKFLOW_DIAGNOSTIC_TEXT_MAX_LENGTH)}…` : text;
|
|
59
|
+
}
|
|
60
|
+
export function hashPromptAssetMarkdown(markdown) {
|
|
61
|
+
return `sha256:${createHash("sha256").update(markdown, "utf8").digest("hex")}`;
|
|
62
|
+
}
|
|
63
|
+
export function normalizeWorkflowPromptAssetLabel(value) {
|
|
64
|
+
if (typeof value !== "string")
|
|
65
|
+
return "Workflow prompt asset";
|
|
66
|
+
const trimmed = value.trim();
|
|
67
|
+
return trimmed ? trimmed.slice(0, 120) : "Workflow prompt asset";
|
|
68
|
+
}
|
|
69
|
+
export function allocateWorkflowPublishedVersion(input) {
|
|
70
|
+
const existing = new Set(input.existingVersions);
|
|
71
|
+
let base = maxWorkflowSemver([
|
|
72
|
+
...input.existingVersions,
|
|
73
|
+
input.draft.baseWorkflowVersion ?? (typeof input.draft.definition.version === "string" ? input.draft.definition.version : undefined),
|
|
74
|
+
]);
|
|
75
|
+
base ??= { major: 0, minor: 0, patch: 0 };
|
|
76
|
+
let candidate = bumpWorkflowSemver(base, input.versionIntent);
|
|
77
|
+
while (existing.has(formatWorkflowSemver(candidate))) {
|
|
78
|
+
candidate = bumpWorkflowSemver(candidate, input.versionIntent);
|
|
79
|
+
}
|
|
80
|
+
return formatWorkflowSemver(candidate);
|
|
81
|
+
}
|
|
82
|
+
function maxWorkflowSemver(versions) {
|
|
83
|
+
let max;
|
|
84
|
+
for (const version of versions) {
|
|
85
|
+
const parsed = version ? parseWorkflowSemver(version) : undefined;
|
|
86
|
+
if (parsed && (!max || compareWorkflowSemver(parsed, max) > 0))
|
|
87
|
+
max = parsed;
|
|
88
|
+
}
|
|
89
|
+
return max;
|
|
90
|
+
}
|
|
91
|
+
export function parseWorkflowSemver(version) {
|
|
92
|
+
const match = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(version.trim());
|
|
93
|
+
if (!match)
|
|
94
|
+
return undefined;
|
|
95
|
+
return { major: Number(match[1]), minor: Number(match[2]), patch: Number(match[3]) };
|
|
96
|
+
}
|
|
97
|
+
export function compareWorkflowSemver(left, right) {
|
|
98
|
+
return left.major - right.major || left.minor - right.minor || left.patch - right.patch;
|
|
99
|
+
}
|
|
100
|
+
function bumpWorkflowSemver(version, intent) {
|
|
101
|
+
if (intent === "major")
|
|
102
|
+
return { major: version.major + 1, minor: 0, patch: 0 };
|
|
103
|
+
if (intent === "minor")
|
|
104
|
+
return { major: version.major, minor: version.minor + 1, patch: 0 };
|
|
105
|
+
return { major: version.major, minor: version.minor, patch: version.patch + 1 };
|
|
106
|
+
}
|
|
107
|
+
function formatWorkflowSemver(version) {
|
|
108
|
+
return `${version.major}.${version.minor}.${version.patch}`;
|
|
109
|
+
}
|
|
110
|
+
export function workflowDraftDefinitionForPublishedVersion(definition, workflowId, version) {
|
|
111
|
+
return {
|
|
112
|
+
...cloneJsonObject(definition),
|
|
113
|
+
id: workflowId,
|
|
114
|
+
version,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export function hashWorkflowDefinitionJson(definition) {
|
|
118
|
+
return `sha256:${createHash("sha256").update(canonicalWorkflowDefinitionJson(definition)).digest("hex")}`;
|
|
119
|
+
}
|
|
120
|
+
export function canonicalWorkflowDefinitionJson(definition) {
|
|
121
|
+
return JSON.stringify(normalizeForCanonicalJson(definition));
|
|
122
|
+
}
|
|
123
|
+
export function normalizeForCanonicalJson(value) {
|
|
124
|
+
if (Array.isArray(value)) {
|
|
125
|
+
return value.map((item) => normalizeForCanonicalJson(item) ?? null);
|
|
126
|
+
}
|
|
127
|
+
if (value && typeof value === "object") {
|
|
128
|
+
const output = {};
|
|
129
|
+
for (const key of Object.keys(value).sort()) {
|
|
130
|
+
const normalized = normalizeForCanonicalJson(value[key]);
|
|
131
|
+
if (normalized !== undefined)
|
|
132
|
+
output[key] = normalized;
|
|
133
|
+
}
|
|
134
|
+
return output;
|
|
135
|
+
}
|
|
136
|
+
return value;
|
|
137
|
+
}
|
|
138
|
+
function cloneJsonObject(value) {
|
|
139
|
+
return JSON.parse(JSON.stringify(value));
|
|
140
|
+
}
|