@xopcai/xopc 0.0.84 → 0.0.86
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/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/feishu/src/plugin.d.ts +2 -0
- package/dist/extensions/feishu/src/plugin.js +10 -0
- package/dist/extensions/feishu/src/plugin.js.map +1 -1
- package/dist/extensions/feishu/src/workflow-progress.d.ts +27 -0
- package/dist/extensions/feishu/src/workflow-progress.js +99 -0
- package/dist/extensions/feishu/src/workflow-progress.js.map +1 -0
- package/dist/extensions/telegram/src/plugin.d.ts +2 -0
- package/dist/extensions/telegram/src/plugin.js +11 -1
- package/dist/extensions/telegram/src/plugin.js.map +1 -1
- package/dist/extensions/telegram/src/routing-integration.js +2 -2
- package/dist/extensions/telegram/src/workflow-progress.d.ts +24 -0
- package/dist/extensions/telegram/src/workflow-progress.js +73 -0
- package/dist/extensions/telegram/src/workflow-progress.js.map +1 -0
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/__tests__/workflow-progress.test.js +158 -0
- package/dist/extensions/weixin/src/__tests__/workflow-progress.test.js.map +1 -0
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +1 -1
- package/dist/extensions/weixin/src/cdn/upload.js +1 -1
- package/dist/extensions/weixin/src/media/data-url.js +1 -1
- package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
- package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
- package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
- package/dist/extensions/weixin/src/plugin.d.ts +2 -0
- package/dist/extensions/weixin/src/plugin.js +11 -1
- package/dist/extensions/weixin/src/plugin.js.map +1 -1
- package/dist/extensions/weixin/src/storage/sync-buf.js +1 -1
- package/dist/extensions/weixin/src/workflow-progress.d.ts +26 -0
- package/dist/extensions/weixin/src/workflow-progress.js +99 -0
- package/dist/extensions/weixin/src/workflow-progress.js.map +1 -0
- package/dist/gateway/static/root/assets/agents-mS3_HpRI.js +222 -0
- package/dist/gateway/static/root/assets/apps-page-DrfytjOb.js +1 -0
- package/dist/gateway/static/root/assets/channels-settings-BG6b9KrW.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Bs5kMCMI.js +8 -0
- package/dist/gateway/static/root/assets/createLucideIcon-DPHK1VkS.js +1 -0
- package/dist/gateway/static/root/assets/cron-api-BuVcZ5zR.js +1 -0
- package/dist/gateway/static/root/assets/cron-page-BMrloeFH.js +1 -0
- package/dist/gateway/static/root/assets/dist-BTWC-BTN.js +45 -0
- package/dist/gateway/static/root/assets/{dist-CqNMNhJM.js → dist-CKU1OOTf.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-gf2L0kY_.js → extension-debug-page-BdW_46sN.js} +1 -1
- package/dist/gateway/static/root/assets/extension-page-DW47KI82.js +1 -0
- package/dist/gateway/static/root/assets/extension-settings-page-B-W4x2xP.js +1 -0
- package/dist/gateway/static/root/assets/fetch-B2MYHbWg.js +1 -0
- package/dist/gateway/static/root/assets/{field-primitives-DTtlp-l8.js → field-primitives-DPG-oJmx.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-config-api-C8dNts9i.js +1 -0
- package/dist/gateway/static/root/assets/index-BmVYculr.js +4700 -0
- package/dist/gateway/static/root/assets/index-ew_2L2We.css +1 -0
- package/dist/gateway/static/root/assets/logs-page-sTsVWz0X.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-FaG_Vlkb.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-DuvRQW--.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-Bet1OerL.js +3 -0
- package/dist/gateway/static/root/assets/share-preview-page-BtG2kLDh.js +2 -0
- package/dist/gateway/static/root/assets/skills-page-DhUO235y.js +2 -0
- package/dist/gateway/static/root/assets/theme-store-DryYl3qD.js +1 -0
- package/dist/gateway/static/root/assets/url-BwNL6Rgk.js +3 -0
- package/dist/gateway/static/root/assets/utils-BY7bU1DT.js +1 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-CGEydndO.js +1 -0
- package/dist/gateway/static/root/index.html +7 -6
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +7 -7
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -1
- package/dist/src/agent/context/workspace-seed.js +3 -3
- package/dist/src/agent/embedded/map-stream-events.js +6 -0
- package/dist/src/agent/embedded/map-stream-events.js.map +1 -1
- package/dist/src/agent/embedded/subscribe-session.js +24 -0
- package/dist/src/agent/embedded/subscribe-session.js.map +1 -1
- package/dist/src/agent/embedded/types.d.ts +19 -0
- package/dist/src/agent/goals/goal-locale.js +2 -2
- package/dist/src/agent/goals/goal-run-store.js +4 -4
- package/dist/src/agent/goals/persistent-goal-service.js +1 -1
- package/dist/src/agent/goals/post-turn.js +2 -2
- package/dist/src/agent/image/load-image-media.js +2 -2
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/ipc/inbox.js +2 -2
- package/dist/src/agent/ipc/socket.js +1 -1
- package/dist/src/agent/memory/builtin-memory-store.js +1 -1
- package/dist/src/agent/memory/dreaming/deep-promotion.js +1 -1
- package/dist/src/agent/memory/dreaming/events.js +1 -1
- package/dist/src/agent/memory/dreaming/last-run.js +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.js +1 -1
- package/dist/src/agent/memory/dreaming/preview.js +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
- package/dist/src/agent/memory/dreaming/short-term-store.js +1 -1
- package/dist/src/agent/memory/dreaming/utils.js +1 -1
- package/dist/src/agent/memory/plugin-discovery.js +1 -1
- package/dist/src/agent/models/manager.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
- package/dist/src/agent/reply/post-compaction-context.js +1 -1
- package/dist/src/agent/reply/startup-context.d.ts +3 -0
- package/dist/src/agent/reply/startup-context.js +25 -2
- package/dist/src/agent/reply/startup-context.js.map +1 -1
- package/dist/src/agent/reply/workspace-boundary-read.js +1 -1
- package/dist/src/agent/sandbox/path-policy.js +2 -2
- package/dist/src/agent/service/build-direct-message-content.js +1 -1
- package/dist/src/agent/service.d.ts +1 -0
- package/dist/src/agent/service.js +10 -4
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/config.js +1 -1
- package/dist/src/agent/skills/hub-hash.js +2 -2
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +3 -3
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/scanner.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/tools/create-share-tool.d.ts +27 -0
- package/dist/src/agent/tools/create-share-tool.js +237 -0
- package/dist/src/agent/tools/create-share-tool.js.map +1 -0
- package/dist/src/agent/tools/dreaming-tool.js +1 -1
- package/dist/src/agent/tools/factory.js +35 -1
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +1 -1
- package/dist/src/agent/tools/index.d.ts +2 -0
- package/dist/src/agent/tools/index.js +3 -1
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/skill-manage-tool.js +1 -1
- package/dist/src/agent/tools/workflow-tool.d.ts +41 -0
- package/dist/src/agent/tools/workflow-tool.js +271 -0
- package/dist/src/agent/tools/workflow-tool.js.map +1 -0
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/workflow/builtins/audit-repo.d.ts +13 -0
- package/dist/src/agent/workflow/builtins/audit-repo.js +156 -0
- package/dist/src/agent/workflow/builtins/audit-repo.js.map +1 -0
- package/dist/src/agent/workflow/builtins/debug-incident.d.ts +13 -0
- package/dist/src/agent/workflow/builtins/debug-incident.js +155 -0
- package/dist/src/agent/workflow/builtins/debug-incident.js.map +1 -0
- package/dist/src/agent/workflow/builtins/index.d.ts +17 -0
- package/dist/src/agent/workflow/builtins/index.js +38 -0
- package/dist/src/agent/workflow/builtins/index.js.map +1 -0
- package/dist/src/agent/workflow/builtins/multi-perspective-review.d.ts +14 -0
- package/dist/src/agent/workflow/builtins/multi-perspective-review.js +149 -0
- package/dist/src/agent/workflow/builtins/multi-perspective-review.js.map +1 -0
- package/dist/src/agent/workflow/builtins/pr-review.d.ts +12 -0
- package/dist/src/agent/workflow/builtins/pr-review.js +156 -0
- package/dist/src/agent/workflow/builtins/pr-review.js.map +1 -0
- package/dist/src/agent/workflow/builtins/research.d.ts +13 -0
- package/dist/src/agent/workflow/builtins/research.js +160 -0
- package/dist/src/agent/workflow/builtins/research.js.map +1 -0
- package/dist/src/agent/workflow/catalog.d.ts +56 -0
- package/dist/src/agent/workflow/catalog.js +159 -0
- package/dist/src/agent/workflow/catalog.js.map +1 -0
- package/dist/src/agent/workflow/channel-capability.d.ts +76 -0
- package/dist/src/agent/workflow/channel-capability.js +1 -0
- package/dist/src/agent/workflow/index.d.ts +11 -0
- package/dist/src/agent/workflow/index.js +10 -0
- package/dist/src/agent/workflow/last-run-memory.d.ts +42 -0
- package/dist/src/agent/workflow/last-run-memory.js +60 -0
- package/dist/src/agent/workflow/last-run-memory.js.map +1 -0
- package/dist/src/agent/workflow/parser.d.ts +20 -0
- package/dist/src/agent/workflow/parser.js +146 -0
- package/dist/src/agent/workflow/parser.js.map +1 -0
- package/dist/src/agent/workflow/progress-broker.d.ts +80 -0
- package/dist/src/agent/workflow/progress-broker.js +263 -0
- package/dist/src/agent/workflow/progress-broker.js.map +1 -0
- package/dist/src/agent/workflow/runtime.d.ts +31 -0
- package/dist/src/agent/workflow/runtime.js +301 -0
- package/dist/src/agent/workflow/runtime.js.map +1 -0
- package/dist/src/agent/workflow/snapshot.d.ts +18 -0
- package/dist/src/agent/workflow/snapshot.js +144 -0
- package/dist/src/agent/workflow/snapshot.js.map +1 -0
- package/dist/src/agent/workflow/structured-output-tool.d.ts +33 -0
- package/dist/src/agent/workflow/structured-output-tool.js +58 -0
- package/dist/src/agent/workflow/structured-output-tool.js.map +1 -0
- package/dist/src/agent/workflow/subagent-runner.d.ts +42 -0
- package/dist/src/agent/workflow/subagent-runner.js +104 -0
- package/dist/src/agent/workflow/subagent-runner.js.map +1 -0
- package/dist/src/agent/workflow/types.d.ts +145 -0
- package/dist/src/agent/workflow/types.js +1 -0
- package/dist/src/auth/credentials.js +3 -3
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/browser/cache-dir-policy.js +1 -1
- package/dist/src/browser/cdp-local-launcher.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +4 -4
- package/dist/src/browser/providers/cloakbrowser.js +4 -4
- package/dist/src/browser/providers/playwright-doctor.js +1 -1
- package/dist/src/browser/stealth.js +1 -1
- package/dist/src/channels/attachments/inbound-persist.js +1 -1
- package/dist/src/channels/attachments/outbound-tts-persist.js +1 -1
- package/dist/src/channels/outbound/persist-store.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +1 -1
- package/dist/src/channels/pairing/pairing-store.js +2 -2
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/model.js +40 -23
- package/dist/src/chat-commands/builtins/model.js.map +1 -1
- package/dist/src/chat-commands/builtins/system.js +30 -15
- package/dist/src/chat-commands/builtins/system.js.map +1 -1
- package/dist/src/chat-commands/builtins/workflow.d.ts +18 -0
- package/dist/src/chat-commands/builtins/workflow.js +172 -0
- package/dist/src/chat-commands/builtins/workflow.js.map +1 -0
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/chat-commands/format-output.d.ts +28 -0
- package/dist/src/chat-commands/format-output.js +45 -0
- package/dist/src/chat-commands/format-output.js.map +1 -0
- package/dist/src/chat-commands/index.d.ts +1 -0
- package/dist/src/chat-commands/index.js +3 -1
- package/dist/src/chat-commands/index.js.map +1 -1
- package/dist/src/cli/commands/config.js +2 -2
- package/dist/src/cli/commands/doctor/checks/config-health.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/state-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +10 -4
- package/dist/src/cli/commands/gateway/lifecycle.js.map +1 -1
- package/dist/src/cli/commands/gateway/shared.js +1 -1
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +4 -4
- package/dist/src/cli/commands/onboard.js +2 -2
- package/dist/src/cli/commands/tunnel.js +2 -2
- package/dist/src/cli/utils/gateway-client.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +2 -2
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/gateway-bind.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/config/paths-state.js +1 -1
- package/dist/src/config/profile.js +2 -2
- package/dist/src/config/public-url.d.ts +28 -0
- package/dist/src/config/public-url.js +103 -0
- package/dist/src/config/public-url.js.map +1 -0
- package/dist/src/config/schema.d.ts +82 -0
- package/dist/src/config/schema.js +130 -1
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/config/workspace-path.js +1 -1
- package/dist/src/cron/executor.js +2 -2
- package/dist/src/cron/persistence.js +1 -1
- package/dist/src/cron/run-log-store.js +1 -1
- package/dist/src/daemon/constants.js +1 -1
- package/dist/src/daemon/install-plan.js +3 -3
- package/dist/src/daemon/install-plan.js.map +1 -1
- package/dist/src/daemon/launchd.js +2 -2
- package/dist/src/daemon/schtasks.js +38 -1
- package/dist/src/daemon/schtasks.js.map +1 -1
- package/dist/src/daemon/systemd.js +2 -2
- package/dist/src/extensions/bundle-mcp.js +1 -1
- package/dist/src/extensions/discover-extensions.js +1 -1
- package/dist/src/extensions/health.js +1 -1
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/lockfile.js +2 -2
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +2 -2
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +33 -2
- package/dist/src/gateway/hono/app.js.map +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/lib/extension-store.js +2 -2
- package/dist/src/gateway/hono/lib/static-ui.js +2 -2
- package/dist/src/gateway/hono/oauth.js +1 -1
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +1 -1
- package/dist/src/gateway/hono/routes/host-fs.js +2 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js.map +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/shares.js +631 -34
- package/dist/src/gateway/hono/routes/shares.js.map +1 -1
- package/dist/src/gateway/hono/routes/site-shares.d.ts +3 -0
- package/dist/src/gateway/hono/routes/site-shares.js +228 -0
- package/dist/src/gateway/hono/routes/site-shares.js.map +1 -0
- package/dist/src/gateway/hono/routes/tunnel.js +97 -8
- package/dist/src/gateway/hono/routes/tunnel.js.map +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +5 -5
- package/dist/src/gateway/hono/sse.js +2 -2
- package/dist/src/gateway/host.d.ts +3 -1
- package/dist/src/gateway/host.js +3 -1
- package/dist/src/gateway/host.js.map +1 -1
- package/dist/src/gateway/lock.js +3 -3
- package/dist/src/gateway/ports.d.ts +6 -0
- package/dist/src/gateway/ports.js +38 -2
- package/dist/src/gateway/ports.js.map +1 -1
- package/dist/src/gateway/public-url.d.ts +8 -0
- package/dist/src/gateway/public-url.js +10 -0
- package/dist/src/gateway/public-url.js.map +1 -0
- package/dist/src/gateway/security/origin-check.d.ts +9 -1
- package/dist/src/gateway/security/origin-check.js +4 -0
- package/dist/src/gateway/security/origin-check.js.map +1 -1
- package/dist/src/gateway/server.js +15 -0
- package/dist/src/gateway/server.js.map +1 -1
- package/dist/src/gateway/service/agent-runner.js +2 -2
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +2 -2
- package/dist/src/gateway/service.js +3 -2
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/gateway/workspace-fs-file-list.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/i18n/goals-bundle.js +1 -1
- package/dist/src/i18n/index.d.ts +1 -0
- package/dist/src/i18n/index.js +2 -1
- package/dist/src/i18n/locales/share-tool.en.js +15 -0
- package/dist/src/i18n/locales/share-tool.en.js.map +1 -0
- package/dist/src/i18n/locales/share-tool.zh.js +15 -0
- package/dist/src/i18n/locales/share-tool.zh.js.map +1 -0
- package/dist/src/i18n/share-tool-bundle.d.ts +20 -0
- package/dist/src/i18n/share-tool-bundle.js +56 -0
- package/dist/src/i18n/share-tool-bundle.js.map +1 -0
- package/dist/src/infra/gateway-processes.js +1 -0
- package/dist/src/infra/gateway-processes.js.map +1 -1
- package/dist/src/infra/restart.js +2 -2
- package/dist/src/infra/update-check.js +1 -1
- package/dist/src/infra/update-lock.js +3 -3
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/infra/update-startup.js +2 -2
- package/dist/src/infra/write-file-atomic.js +2 -2
- package/dist/src/providers/auth-runtime/auth-profile-store.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/session/config-store.js +2 -2
- package/dist/src/session/parity/jsonl-transcript-io.js +2 -2
- package/dist/src/session/parity/sessions-json-file.js +1 -1
- package/dist/src/session/parity/transcript-file-lock.js +2 -2
- package/dist/src/session/parity/transcript-paths.js +1 -1
- package/dist/src/session/search-index-cache.js +1 -1
- package/dist/src/session/search-index.js +1 -1
- package/dist/src/session/session-title.js +3 -2
- package/dist/src/session/session-title.js.map +1 -1
- package/dist/src/session/store.js +5 -5
- package/dist/src/share/share-auto.d.ts +74 -0
- package/dist/src/share/share-auto.js +247 -0
- package/dist/src/share/share-auto.js.map +1 -0
- package/dist/src/share/share-config.js +63 -4
- package/dist/src/share/share-config.js.map +1 -1
- package/dist/src/share/share-landing.d.ts +28 -2
- package/dist/src/share/share-landing.js +155 -34
- package/dist/src/share/share-landing.js.map +1 -1
- package/dist/src/share/share-store.d.ts +48 -4
- package/dist/src/share/share-store.js +322 -51
- package/dist/src/share/share-store.js.map +1 -1
- package/dist/src/share/share-thumbnail.d.ts +35 -0
- package/dist/src/share/share-thumbnail.js +277 -0
- package/dist/src/share/share-thumbnail.js.map +1 -0
- package/dist/src/share/share-types.d.ts +68 -10
- package/dist/src/share/share-types.js +18 -1
- package/dist/src/share/share-types.js.map +1 -1
- package/dist/src/share/share-url.js +1 -1
- package/dist/src/share/share-zip.d.ts +35 -0
- package/dist/src/share/share-zip.js +303 -0
- package/dist/src/share/share-zip.js.map +1 -0
- package/dist/src/share/site-proxy.d.ts +35 -0
- package/dist/src/share/site-proxy.js +234 -0
- package/dist/src/share/site-proxy.js.map +1 -0
- package/dist/src/share/site-share-config.d.ts +11 -0
- package/dist/src/share/site-share-config.js +103 -0
- package/dist/src/share/site-share-config.js.map +1 -0
- package/dist/src/share/site-share-router.d.ts +23 -0
- package/dist/src/share/site-share-router.js +147 -0
- package/dist/src/share/site-share-router.js.map +1 -0
- package/dist/src/share/site-share-store.d.ts +53 -0
- package/dist/src/share/site-share-store.js +400 -0
- package/dist/src/share/site-share-store.js.map +1 -0
- package/dist/src/share/site-share-types.d.ts +103 -0
- package/dist/src/share/site-share-types.js +41 -0
- package/dist/src/share/site-share-types.js.map +1 -0
- package/dist/src/share/site-static-serve.d.ts +10 -0
- package/dist/src/share/site-static-serve.js +145 -0
- package/dist/src/share/site-static-serve.js.map +1 -0
- package/dist/src/tui/clipboard-image.js +3 -3
- package/dist/src/tui/theme-manager.js +1 -1
- package/dist/src/tui/tui-commands.js +18 -0
- package/dist/src/tui/tui-commands.js.map +1 -1
- package/dist/src/tui/tui-keybindings-file.js +1 -1
- package/dist/src/tui/tui-scoped-models.js +2 -2
- package/dist/src/tui/tui-settings.js +1 -1
- package/dist/src/tui/tui-workflow-slash.d.ts +32 -0
- package/dist/src/tui/tui-workflow-slash.js +63 -0
- package/dist/src/tui/tui-workflow-slash.js.map +1 -0
- package/dist/src/tui/tui.js +2 -2
- package/dist/src/tunnel/enable-lan-pairing.js +1 -1
- package/dist/src/tunnel/frpc-binary.js +3 -3
- package/dist/src/tunnel/frpc-config.js +1 -1
- package/dist/src/tunnel/frpc-extract.js +1 -1
- package/dist/src/tunnel/index.js +2 -2
- package/dist/src/tunnel/pair-context.d.ts +7 -1
- package/dist/src/tunnel/pair-context.js +25 -9
- package/dist/src/tunnel/pair-context.js.map +1 -1
- package/dist/src/tunnel/pair-url.d.ts +14 -1
- package/dist/src/tunnel/pair-url.js +14 -1
- package/dist/src/tunnel/pair-url.js.map +1 -1
- package/dist/src/tunnel/tunnel-service.js +2 -2
- package/dist/src/tunnel/tunnel-state.js +1 -1
- package/dist/src/utils/logger/audit.js +1 -1
- package/dist/src/utils/logger/log-store.js +1 -1
- package/dist/src/utils/logger/rotation.js +1 -1
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/voice/tts/providers/edge-speech.js +2 -2
- package/package.json +3 -2
- package/dist/gateway/static/root/assets/agents-tR-nNP04.js +0 -222
- package/dist/gateway/static/root/assets/apps-page-BDw6SP-d.js +0 -1
- package/dist/gateway/static/root/assets/button-KafIU8dx.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-DEFd-jj1.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DI5FHdGe.js +0 -8
- package/dist/gateway/static/root/assets/cron-api-BSqY8LwW.js +0 -1
- package/dist/gateway/static/root/assets/cron-page-D7lVDjcR.js +0 -1
- package/dist/gateway/static/root/assets/dist-C57OMHW8.js +0 -48
- package/dist/gateway/static/root/assets/extension-page-CQo2Xsmg.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-CZf0WoZg.js +0 -1
- package/dist/gateway/static/root/assets/fetch-2iRFmd3n.js +0 -3
- package/dist/gateway/static/root/assets/heartbeat-config-api-B0drdQEJ.js +0 -1
- package/dist/gateway/static/root/assets/index-0Gt3TG4j.js +0 -4693
- package/dist/gateway/static/root/assets/index-BuFldCsB.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-DMuORLfC.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-_UO8g6NN.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-DkmHkknc.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-Cz8FoW_A.js +0 -3
- package/dist/gateway/static/root/assets/skills-page-HrUOxF7H.js +0 -2
- package/dist/gateway/static/root/assets/theme-store-D01dJt95.js +0 -1
- package/dist/gateway/static/root/assets/utils-BFwcR6pL.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-JF8-aqc5.js +0 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
//#region src/agent/workflow/builtins/debug-incident.ts
|
|
2
|
+
/**
|
|
3
|
+
* Built-in workflow: `debug_incident`
|
|
4
|
+
*
|
|
5
|
+
* Triage an error, stack trace, or log snippet. Parses the signal, fans out
|
|
6
|
+
* parallel hypotheses (config, race, dependency, data, environment), then
|
|
7
|
+
* ranks likely root causes with verification steps.
|
|
8
|
+
*
|
|
9
|
+
* Args:
|
|
10
|
+
* - error: error message or stack trace
|
|
11
|
+
* - logs: optional log excerpt
|
|
12
|
+
* - context: optional extra context (what changed, when it started)
|
|
13
|
+
*/
|
|
14
|
+
const DEBUG_INCIDENT_SCRIPT = `export const meta = {
|
|
15
|
+
name: 'debug_incident',
|
|
16
|
+
description: 'Triage an error or log snippet with parallel hypotheses and ranked root-cause analysis.',
|
|
17
|
+
whenToUse: 'User reports a bug, crash, error message, or unexpected behavior and wants systematic triage.',
|
|
18
|
+
tags: ['debug', 'incident', 'troubleshooting'],
|
|
19
|
+
estimatedAgents: { min: 7, max: 7 },
|
|
20
|
+
phases: [
|
|
21
|
+
{ title: 'Triage' },
|
|
22
|
+
{ title: 'Hypotheses' },
|
|
23
|
+
{ title: 'Rank' },
|
|
24
|
+
],
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const READ_TOOLS = ['read_file', 'grep', 'find', 'list_dir', 'shell']
|
|
28
|
+
|
|
29
|
+
const error = args && typeof args === 'object' && args.error
|
|
30
|
+
? String(args.error)
|
|
31
|
+
: 'Infer the primary error from the most recent user message or conversation context.'
|
|
32
|
+
|
|
33
|
+
const logs = args && typeof args === 'object' && args.logs
|
|
34
|
+
? String(args.logs)
|
|
35
|
+
: ''
|
|
36
|
+
|
|
37
|
+
const context = args && typeof args === 'object' && args.context
|
|
38
|
+
? String(args.context)
|
|
39
|
+
: ''
|
|
40
|
+
|
|
41
|
+
phase('Triage')
|
|
42
|
+
const triage = await agent(
|
|
43
|
+
'Parse this incident signal. Extract: error type, likely subsystem, affected files/modules if identifiable, and 2–3 key facts from logs.\\n\\n' +
|
|
44
|
+
'ERROR:\\n' + error + '\\n\\n' +
|
|
45
|
+
(logs ? 'LOGS:\\n' + logs + '\\n\\n' : '') +
|
|
46
|
+
(context ? 'CONTEXT:\\n' + context + '\\n\\n' : '') +
|
|
47
|
+
'Use read/grep tools to locate relevant code if the workspace may contain the failing path.',
|
|
48
|
+
{
|
|
49
|
+
label: 'incident triage',
|
|
50
|
+
toolset: READ_TOOLS,
|
|
51
|
+
schema: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
errorType: { type: 'string' },
|
|
55
|
+
subsystem: { type: 'string' },
|
|
56
|
+
affectedPaths: { type: 'array', items: { type: 'string' } },
|
|
57
|
+
keyFacts: { type: 'array', items: { type: 'string' } },
|
|
58
|
+
},
|
|
59
|
+
required: ['errorType', 'keyFacts'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
const HYPOTHESES = [
|
|
65
|
+
{ key: 'config', angle: 'Misconfiguration, missing env vars, wrong defaults, feature flags, stale config cache.' },
|
|
66
|
+
{ key: 'race', angle: 'Concurrency, timing, ordering, partial failure under load, missing locks or awaits.' },
|
|
67
|
+
{ key: 'dependency', angle: 'Version mismatch, breaking upstream change, network/API failure, timeout, auth expiry.' },
|
|
68
|
+
{ key: 'data', angle: 'Bad input, schema drift, null/empty edge case, corrupt state, migration gap.' },
|
|
69
|
+
{ key: 'environment', angle: 'OS, permissions, disk, memory, container/network isolation, platform-specific behavior.' },
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
phase('Hypotheses')
|
|
73
|
+
const hypothesisReports = await parallel(
|
|
74
|
+
HYPOTHESES.map((h) => () =>
|
|
75
|
+
agent(
|
|
76
|
+
'Evaluate whether this hypothesis explains the incident. Search the codebase for supporting or refuting evidence.\\n\\n' +
|
|
77
|
+
'HYPOTHESIS: ' + h.key + ' — ' + h.angle + '\\n\\n' +
|
|
78
|
+
'TRIAGE:\\n' + JSON.stringify(triage, null, 2) + '\\n\\n' +
|
|
79
|
+
'ERROR:\\n' + error + '\\n\\n' +
|
|
80
|
+
(logs ? 'LOGS:\\n' + logs + '\\n\\n' : '') +
|
|
81
|
+
'Return: likelihood (low/med/high), evidence (file paths + brief notes), and one verification step.',
|
|
82
|
+
{
|
|
83
|
+
label: h.key + ' hypothesis',
|
|
84
|
+
toolset: READ_TOOLS,
|
|
85
|
+
schema: {
|
|
86
|
+
type: 'object',
|
|
87
|
+
properties: {
|
|
88
|
+
likelihood: { type: 'string', enum: ['low', 'med', 'high'] },
|
|
89
|
+
evidence: {
|
|
90
|
+
type: 'array',
|
|
91
|
+
items: {
|
|
92
|
+
type: 'object',
|
|
93
|
+
properties: {
|
|
94
|
+
path: { type: 'string' },
|
|
95
|
+
note: { type: 'string' },
|
|
96
|
+
},
|
|
97
|
+
required: ['path', 'note'],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
verificationStep: { type: 'string' },
|
|
101
|
+
},
|
|
102
|
+
required: ['likelihood', 'evidence', 'verificationStep'],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
),
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
phase('Rank')
|
|
110
|
+
const live = hypothesisReports.filter(Boolean)
|
|
111
|
+
const byHypothesis = {}
|
|
112
|
+
for (let i = 0; i < HYPOTHESES.length; i++) {
|
|
113
|
+
byHypothesis[HYPOTHESES[i].key] = live[i] ?? null
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const ranking = await agent(
|
|
117
|
+
'Rank root causes by likelihood. Pick the top 3 with confidence and concrete next steps to confirm or fix.\\n\\n' +
|
|
118
|
+
JSON.stringify({ triage, byHypothesis }, null, 2),
|
|
119
|
+
{
|
|
120
|
+
label: 'root cause ranking',
|
|
121
|
+
schema: {
|
|
122
|
+
type: 'object',
|
|
123
|
+
properties: {
|
|
124
|
+
topCauses: {
|
|
125
|
+
type: 'array',
|
|
126
|
+
items: {
|
|
127
|
+
type: 'object',
|
|
128
|
+
properties: {
|
|
129
|
+
hypothesis: { type: 'string' },
|
|
130
|
+
likelihood: { type: 'string', enum: ['low', 'med', 'high'] },
|
|
131
|
+
summary: { type: 'string' },
|
|
132
|
+
nextStep: { type: 'string' },
|
|
133
|
+
},
|
|
134
|
+
required: ['hypothesis', 'likelihood', 'summary', 'nextStep'],
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
immediateActions: { type: 'array', items: { type: 'string' } },
|
|
138
|
+
summary: { type: 'string' },
|
|
139
|
+
},
|
|
140
|
+
required: ['topCauses', 'summary'],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
ok: true,
|
|
147
|
+
triage,
|
|
148
|
+
...(ranking ?? { topCauses: [], summary: 'ranking failed', immediateActions: [] }),
|
|
149
|
+
byHypothesis,
|
|
150
|
+
}
|
|
151
|
+
`;
|
|
152
|
+
//#endregion
|
|
153
|
+
export { DEBUG_INCIDENT_SCRIPT };
|
|
154
|
+
|
|
155
|
+
//# sourceMappingURL=debug-incident.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-incident.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/debug-incident.ts"],"sourcesContent":["/**\n * Built-in workflow: `debug_incident`\n *\n * Triage an error, stack trace, or log snippet. Parses the signal, fans out\n * parallel hypotheses (config, race, dependency, data, environment), then\n * ranks likely root causes with verification steps.\n *\n * Args:\n * - error: error message or stack trace\n * - logs: optional log excerpt\n * - context: optional extra context (what changed, when it started)\n */\n\nexport const DEBUG_INCIDENT_SCRIPT = `export const meta = {\n name: 'debug_incident',\n description: 'Triage an error or log snippet with parallel hypotheses and ranked root-cause analysis.',\n whenToUse: 'User reports a bug, crash, error message, or unexpected behavior and wants systematic triage.',\n tags: ['debug', 'incident', 'troubleshooting'],\n estimatedAgents: { min: 7, max: 7 },\n phases: [\n { title: 'Triage' },\n { title: 'Hypotheses' },\n { title: 'Rank' },\n ],\n}\n\nconst READ_TOOLS = ['read_file', 'grep', 'find', 'list_dir', 'shell']\n\nconst error = args && typeof args === 'object' && args.error\n ? String(args.error)\n : 'Infer the primary error from the most recent user message or conversation context.'\n\nconst logs = args && typeof args === 'object' && args.logs\n ? String(args.logs)\n : ''\n\nconst context = args && typeof args === 'object' && args.context\n ? String(args.context)\n : ''\n\nphase('Triage')\nconst triage = await agent(\n 'Parse this incident signal. Extract: error type, likely subsystem, affected files/modules if identifiable, and 2–3 key facts from logs.\\\\n\\\\n' +\n 'ERROR:\\\\n' + error + '\\\\n\\\\n' +\n (logs ? 'LOGS:\\\\n' + logs + '\\\\n\\\\n' : '') +\n (context ? 'CONTEXT:\\\\n' + context + '\\\\n\\\\n' : '') +\n 'Use read/grep tools to locate relevant code if the workspace may contain the failing path.',\n {\n label: 'incident triage',\n toolset: READ_TOOLS,\n schema: {\n type: 'object',\n properties: {\n errorType: { type: 'string' },\n subsystem: { type: 'string' },\n affectedPaths: { type: 'array', items: { type: 'string' } },\n keyFacts: { type: 'array', items: { type: 'string' } },\n },\n required: ['errorType', 'keyFacts'],\n },\n },\n)\n\nconst HYPOTHESES = [\n { key: 'config', angle: 'Misconfiguration, missing env vars, wrong defaults, feature flags, stale config cache.' },\n { key: 'race', angle: 'Concurrency, timing, ordering, partial failure under load, missing locks or awaits.' },\n { key: 'dependency', angle: 'Version mismatch, breaking upstream change, network/API failure, timeout, auth expiry.' },\n { key: 'data', angle: 'Bad input, schema drift, null/empty edge case, corrupt state, migration gap.' },\n { key: 'environment', angle: 'OS, permissions, disk, memory, container/network isolation, platform-specific behavior.' },\n]\n\nphase('Hypotheses')\nconst hypothesisReports = await parallel(\n HYPOTHESES.map((h) => () =>\n agent(\n 'Evaluate whether this hypothesis explains the incident. Search the codebase for supporting or refuting evidence.\\\\n\\\\n' +\n 'HYPOTHESIS: ' + h.key + ' — ' + h.angle + '\\\\n\\\\n' +\n 'TRIAGE:\\\\n' + JSON.stringify(triage, null, 2) + '\\\\n\\\\n' +\n 'ERROR:\\\\n' + error + '\\\\n\\\\n' +\n (logs ? 'LOGS:\\\\n' + logs + '\\\\n\\\\n' : '') +\n 'Return: likelihood (low/med/high), evidence (file paths + brief notes), and one verification step.',\n {\n label: h.key + ' hypothesis',\n toolset: READ_TOOLS,\n schema: {\n type: 'object',\n properties: {\n likelihood: { type: 'string', enum: ['low', 'med', 'high'] },\n evidence: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n path: { type: 'string' },\n note: { type: 'string' },\n },\n required: ['path', 'note'],\n },\n },\n verificationStep: { type: 'string' },\n },\n required: ['likelihood', 'evidence', 'verificationStep'],\n },\n },\n ),\n ),\n)\n\nphase('Rank')\nconst live = hypothesisReports.filter(Boolean)\nconst byHypothesis = {}\nfor (let i = 0; i < HYPOTHESES.length; i++) {\n byHypothesis[HYPOTHESES[i].key] = live[i] ?? null\n}\n\nconst ranking = await agent(\n 'Rank root causes by likelihood. Pick the top 3 with confidence and concrete next steps to confirm or fix.\\\\n\\\\n' +\n JSON.stringify({ triage, byHypothesis }, null, 2),\n {\n label: 'root cause ranking',\n schema: {\n type: 'object',\n properties: {\n topCauses: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n hypothesis: { type: 'string' },\n likelihood: { type: 'string', enum: ['low', 'med', 'high'] },\n summary: { type: 'string' },\n nextStep: { type: 'string' },\n },\n required: ['hypothesis', 'likelihood', 'summary', 'nextStep'],\n },\n },\n immediateActions: { type: 'array', items: { type: 'string' } },\n summary: { type: 'string' },\n },\n required: ['topCauses', 'summary'],\n },\n },\n)\n\nreturn {\n ok: true,\n triage,\n ...(ranking ?? { topCauses: [], summary: 'ranking failed', immediateActions: [] }),\n byHypothesis,\n}\n`\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,wBAAwB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundled workflow templates. These are shipped with xopc and discoverable
|
|
3
|
+
* via the catalog alongside user workflows in `~/.xopc/workflows/`. A user
|
|
4
|
+
* workflow with the same `name` always wins — built-ins are starting points,
|
|
5
|
+
* not authority.
|
|
6
|
+
*/
|
|
7
|
+
import { AUDIT_REPO_SCRIPT } from './audit-repo.js';
|
|
8
|
+
import { DEBUG_INCIDENT_SCRIPT } from './debug-incident.js';
|
|
9
|
+
import { MULTI_PERSPECTIVE_REVIEW_SCRIPT } from './multi-perspective-review.js';
|
|
10
|
+
import { PR_REVIEW_SCRIPT } from './pr-review.js';
|
|
11
|
+
import { RESEARCH_SCRIPT } from './research.js';
|
|
12
|
+
export interface BuiltinWorkflow {
|
|
13
|
+
name: string;
|
|
14
|
+
script: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const BUILTIN_WORKFLOWS: readonly BuiltinWorkflow[];
|
|
17
|
+
export { AUDIT_REPO_SCRIPT, DEBUG_INCIDENT_SCRIPT, MULTI_PERSPECTIVE_REVIEW_SCRIPT, PR_REVIEW_SCRIPT, RESEARCH_SCRIPT, };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AUDIT_REPO_SCRIPT } from "./audit-repo.js";
|
|
2
|
+
import { DEBUG_INCIDENT_SCRIPT } from "./debug-incident.js";
|
|
3
|
+
import { MULTI_PERSPECTIVE_REVIEW_SCRIPT } from "./multi-perspective-review.js";
|
|
4
|
+
import { PR_REVIEW_SCRIPT } from "./pr-review.js";
|
|
5
|
+
import { RESEARCH_SCRIPT } from "./research.js";
|
|
6
|
+
//#region src/agent/workflow/builtins/index.ts
|
|
7
|
+
/**
|
|
8
|
+
* Bundled workflow templates. These are shipped with xopc and discoverable
|
|
9
|
+
* via the catalog alongside user workflows in `~/.xopc/workflows/`. A user
|
|
10
|
+
* workflow with the same `name` always wins — built-ins are starting points,
|
|
11
|
+
* not authority.
|
|
12
|
+
*/
|
|
13
|
+
const BUILTIN_WORKFLOWS = Object.freeze([
|
|
14
|
+
{
|
|
15
|
+
name: "audit_repo",
|
|
16
|
+
script: AUDIT_REPO_SCRIPT
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "debug_incident",
|
|
20
|
+
script: DEBUG_INCIDENT_SCRIPT
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "multi_perspective_review",
|
|
24
|
+
script: MULTI_PERSPECTIVE_REVIEW_SCRIPT
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "pr_review",
|
|
28
|
+
script: PR_REVIEW_SCRIPT
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "research",
|
|
32
|
+
script: RESEARCH_SCRIPT
|
|
33
|
+
}
|
|
34
|
+
]);
|
|
35
|
+
//#endregion
|
|
36
|
+
export { AUDIT_REPO_SCRIPT, BUILTIN_WORKFLOWS, DEBUG_INCIDENT_SCRIPT, MULTI_PERSPECTIVE_REVIEW_SCRIPT, PR_REVIEW_SCRIPT, RESEARCH_SCRIPT };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/index.ts"],"sourcesContent":["/**\n * Bundled workflow templates. These are shipped with xopc and discoverable\n * via the catalog alongside user workflows in `~/.xopc/workflows/`. A user\n * workflow with the same `name` always wins — built-ins are starting points,\n * not authority.\n */\n\nimport { AUDIT_REPO_SCRIPT } from './audit-repo.js';\nimport { DEBUG_INCIDENT_SCRIPT } from './debug-incident.js';\nimport { MULTI_PERSPECTIVE_REVIEW_SCRIPT } from './multi-perspective-review.js';\nimport { PR_REVIEW_SCRIPT } from './pr-review.js';\nimport { RESEARCH_SCRIPT } from './research.js';\n\nexport interface BuiltinWorkflow {\n name: string;\n script: string;\n}\n\nexport const BUILTIN_WORKFLOWS: readonly BuiltinWorkflow[] = Object.freeze([\n { name: 'audit_repo', script: AUDIT_REPO_SCRIPT },\n { name: 'debug_incident', script: DEBUG_INCIDENT_SCRIPT },\n { name: 'multi_perspective_review', script: MULTI_PERSPECTIVE_REVIEW_SCRIPT },\n { name: 'pr_review', script: PR_REVIEW_SCRIPT },\n { name: 'research', script: RESEARCH_SCRIPT },\n]);\n\nexport {\n AUDIT_REPO_SCRIPT,\n DEBUG_INCIDENT_SCRIPT,\n MULTI_PERSPECTIVE_REVIEW_SCRIPT,\n PR_REVIEW_SCRIPT,\n RESEARCH_SCRIPT,\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,oBAAgD,OAAO,OAAO;CACzE;EAAE,MAAM;EAAc,QAAQ;EAAmB;CACjD;EAAE,MAAM;EAAkB,QAAQ;EAAuB;CACzD;EAAE,MAAM;EAA4B,QAAQ;EAAiC;CAC7E;EAAE,MAAM;EAAa,QAAQ;EAAkB;CAC/C;EAAE,MAAM;EAAY,QAAQ;EAAiB;CAC9C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in workflow: `multi_perspective_review`
|
|
3
|
+
*
|
|
4
|
+
* Reviews a target (file, PR, design doc, plan — passed via args.target) from
|
|
5
|
+
* several independent perspectives, then asks an adversarial judge to decide
|
|
6
|
+
* what would actually break in practice. Useful for sanity-checking decisions
|
|
7
|
+
* before they ship.
|
|
8
|
+
*
|
|
9
|
+
* Args:
|
|
10
|
+
* - target: what to review
|
|
11
|
+
* - lenses: optional array of { name, angle } to override default lenses
|
|
12
|
+
* - skipAdversarial: when true, skip the adversarial judge phase
|
|
13
|
+
*/
|
|
14
|
+
export declare const MULTI_PERSPECTIVE_REVIEW_SCRIPT = "export const meta = {\n name: 'multi_perspective_review',\n description: 'Review a target from N independent perspectives, then adversarially judge what would actually break.',\n whenToUse: 'User wants a stress-test of a design, plan, PR, or proposal before committing to it.',\n tags: ['review', 'planning', 'decision'],\n estimatedAgents: { min: 5, max: 6 },\n phases: [\n { title: 'Lenses' },\n { title: 'Adversarial' },\n { title: 'Synthesize' },\n ],\n}\n\nconst READ_ONLY_TOOLS = ['read_file', 'grep', 'find', 'list_dir']\n\nconst target = args && typeof args === 'object' && args.target\n ? String(args.target)\n : 'No explicit target was provided. Treat the currently focused file or recent context as the target.'\n\nconst skipAdversarial = Boolean(args && typeof args === 'object' && args.skipAdversarial)\n\nconst DEFAULT_LENSES = [\n { name: 'User', angle: 'How a real user experiences this. Friction, confusion, surprise paths, accessibility.' },\n { name: 'Operator', angle: 'How an on-call engineer experiences this in production. Failure modes, observability, rollback.' },\n { name: 'Skeptic', angle: 'Hidden assumptions. What is being implied but not stated. What would break under load or weird input.' },\n { name: 'Maintainer', angle: 'Six-month-later view. Clarity, naming, layering, ease of changing nearby code.' },\n]\n\nlet lenses = DEFAULT_LENSES\nif (args && typeof args === 'object' && Array.isArray(args.lenses) && args.lenses.length) {\n lenses = args.lenses\n .filter((l) => l && typeof l === 'object' && l.name && l.angle)\n .map((l) => ({ name: String(l.name), angle: String(l.angle) }))\n if (!lenses.length) lenses = DEFAULT_LENSES\n}\n\nphase('Lenses')\nconst lensViews = await parallel(\n lenses.map((l) => () =>\n agent(\n 'Review the following target through the ' + l.name + ' lens.\\n' +\n 'Lens focus: ' + l.angle + '\\n\\n' +\n 'TARGET:\\n' + target + '\\n\\n' +\n 'Return 3\u20137 concrete observations. Each entry: title (5\u201310 words), why-it-matters (1 sentence), risk (low/med/high).',\n {\n label: l.name + ' lens',\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n observations: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n why: { type: 'string' },\n risk: { type: 'string', enum: ['low', 'med', 'high'] },\n },\n required: ['title', 'why', 'risk'],\n },\n },\n },\n required: ['observations'],\n },\n },\n ),\n ),\n)\n\nconst valid = lensViews.filter(Boolean)\nconst allObs = valid.flatMap((v, i) =>\n (v?.observations ?? []).map((o) => ({ lens: lenses[i].name, ...o })),\n)\n\nlet verdict = null\nif (!skipAdversarial) {\n phase('Adversarial')\n verdict = await agent(\n 'You are an adversarial judge. Given these multi-lens observations of a target, decide which would actually cause real harm if shipped as-is. ' +\n 'Default to realRisk=false unless an observation has clear, mechanism-level evidence. ' +\n 'Rate evidenceStrength as weak | moderate | strong.\\n\\n' +\n JSON.stringify(allObs, null, 2),\n {\n label: 'adversarial verdict',\n schema: {\n type: 'object',\n properties: {\n verdicts: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n lens: { type: 'string' },\n realRisk: { type: 'boolean' },\n evidenceStrength: { type: 'string', enum: ['weak', 'moderate', 'strong'] },\n reason: { type: 'string' },\n },\n required: ['title', 'lens', 'realRisk', 'evidenceStrength', 'reason'],\n },\n },\n },\n required: ['verdicts'],\n },\n },\n )\n}\n\nphase('Synthesize')\nconst confirmed = (verdict?.verdicts ?? []).filter((v) => v.realRisk)\nconst goNoGo = skipAdversarial\n ? (allObs.some((o) => o.risk === 'high') ? 'fix_first' : 'ship')\n : confirmed.some((v) => v.evidenceStrength === 'strong')\n ? 'fix_first'\n : confirmed.length\n ? 'fix_first'\n : 'ship'\n\nreturn {\n ok: true,\n target,\n lenses: lenses.map((l) => l.name),\n skipAdversarial,\n observationCount: allObs.length,\n confirmedRiskCount: confirmed.length,\n goNoGo,\n topRisks: confirmed.slice(0, 10),\n allVerdicts: verdict?.verdicts ?? [],\n}\n";
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
//#region src/agent/workflow/builtins/multi-perspective-review.ts
|
|
2
|
+
/**
|
|
3
|
+
* Built-in workflow: `multi_perspective_review`
|
|
4
|
+
*
|
|
5
|
+
* Reviews a target (file, PR, design doc, plan — passed via args.target) from
|
|
6
|
+
* several independent perspectives, then asks an adversarial judge to decide
|
|
7
|
+
* what would actually break in practice. Useful for sanity-checking decisions
|
|
8
|
+
* before they ship.
|
|
9
|
+
*
|
|
10
|
+
* Args:
|
|
11
|
+
* - target: what to review
|
|
12
|
+
* - lenses: optional array of { name, angle } to override default lenses
|
|
13
|
+
* - skipAdversarial: when true, skip the adversarial judge phase
|
|
14
|
+
*/
|
|
15
|
+
const MULTI_PERSPECTIVE_REVIEW_SCRIPT = `export const meta = {
|
|
16
|
+
name: 'multi_perspective_review',
|
|
17
|
+
description: 'Review a target from N independent perspectives, then adversarially judge what would actually break.',
|
|
18
|
+
whenToUse: 'User wants a stress-test of a design, plan, PR, or proposal before committing to it.',
|
|
19
|
+
tags: ['review', 'planning', 'decision'],
|
|
20
|
+
estimatedAgents: { min: 5, max: 6 },
|
|
21
|
+
phases: [
|
|
22
|
+
{ title: 'Lenses' },
|
|
23
|
+
{ title: 'Adversarial' },
|
|
24
|
+
{ title: 'Synthesize' },
|
|
25
|
+
],
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const READ_ONLY_TOOLS = ['read_file', 'grep', 'find', 'list_dir']
|
|
29
|
+
|
|
30
|
+
const target = args && typeof args === 'object' && args.target
|
|
31
|
+
? String(args.target)
|
|
32
|
+
: 'No explicit target was provided. Treat the currently focused file or recent context as the target.'
|
|
33
|
+
|
|
34
|
+
const skipAdversarial = Boolean(args && typeof args === 'object' && args.skipAdversarial)
|
|
35
|
+
|
|
36
|
+
const DEFAULT_LENSES = [
|
|
37
|
+
{ name: 'User', angle: 'How a real user experiences this. Friction, confusion, surprise paths, accessibility.' },
|
|
38
|
+
{ name: 'Operator', angle: 'How an on-call engineer experiences this in production. Failure modes, observability, rollback.' },
|
|
39
|
+
{ name: 'Skeptic', angle: 'Hidden assumptions. What is being implied but not stated. What would break under load or weird input.' },
|
|
40
|
+
{ name: 'Maintainer', angle: 'Six-month-later view. Clarity, naming, layering, ease of changing nearby code.' },
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
let lenses = DEFAULT_LENSES
|
|
44
|
+
if (args && typeof args === 'object' && Array.isArray(args.lenses) && args.lenses.length) {
|
|
45
|
+
lenses = args.lenses
|
|
46
|
+
.filter((l) => l && typeof l === 'object' && l.name && l.angle)
|
|
47
|
+
.map((l) => ({ name: String(l.name), angle: String(l.angle) }))
|
|
48
|
+
if (!lenses.length) lenses = DEFAULT_LENSES
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
phase('Lenses')
|
|
52
|
+
const lensViews = await parallel(
|
|
53
|
+
lenses.map((l) => () =>
|
|
54
|
+
agent(
|
|
55
|
+
'Review the following target through the ' + l.name + ' lens.\\n' +
|
|
56
|
+
'Lens focus: ' + l.angle + '\\n\\n' +
|
|
57
|
+
'TARGET:\\n' + target + '\\n\\n' +
|
|
58
|
+
'Return 3–7 concrete observations. Each entry: title (5–10 words), why-it-matters (1 sentence), risk (low/med/high).',
|
|
59
|
+
{
|
|
60
|
+
label: l.name + ' lens',
|
|
61
|
+
toolset: READ_ONLY_TOOLS,
|
|
62
|
+
schema: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
properties: {
|
|
65
|
+
observations: {
|
|
66
|
+
type: 'array',
|
|
67
|
+
items: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
properties: {
|
|
70
|
+
title: { type: 'string' },
|
|
71
|
+
why: { type: 'string' },
|
|
72
|
+
risk: { type: 'string', enum: ['low', 'med', 'high'] },
|
|
73
|
+
},
|
|
74
|
+
required: ['title', 'why', 'risk'],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
required: ['observations'],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
),
|
|
82
|
+
),
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
const valid = lensViews.filter(Boolean)
|
|
86
|
+
const allObs = valid.flatMap((v, i) =>
|
|
87
|
+
(v?.observations ?? []).map((o) => ({ lens: lenses[i].name, ...o })),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
let verdict = null
|
|
91
|
+
if (!skipAdversarial) {
|
|
92
|
+
phase('Adversarial')
|
|
93
|
+
verdict = await agent(
|
|
94
|
+
'You are an adversarial judge. Given these multi-lens observations of a target, decide which would actually cause real harm if shipped as-is. ' +
|
|
95
|
+
'Default to realRisk=false unless an observation has clear, mechanism-level evidence. ' +
|
|
96
|
+
'Rate evidenceStrength as weak | moderate | strong.\\n\\n' +
|
|
97
|
+
JSON.stringify(allObs, null, 2),
|
|
98
|
+
{
|
|
99
|
+
label: 'adversarial verdict',
|
|
100
|
+
schema: {
|
|
101
|
+
type: 'object',
|
|
102
|
+
properties: {
|
|
103
|
+
verdicts: {
|
|
104
|
+
type: 'array',
|
|
105
|
+
items: {
|
|
106
|
+
type: 'object',
|
|
107
|
+
properties: {
|
|
108
|
+
title: { type: 'string' },
|
|
109
|
+
lens: { type: 'string' },
|
|
110
|
+
realRisk: { type: 'boolean' },
|
|
111
|
+
evidenceStrength: { type: 'string', enum: ['weak', 'moderate', 'strong'] },
|
|
112
|
+
reason: { type: 'string' },
|
|
113
|
+
},
|
|
114
|
+
required: ['title', 'lens', 'realRisk', 'evidenceStrength', 'reason'],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
required: ['verdicts'],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
phase('Synthesize')
|
|
125
|
+
const confirmed = (verdict?.verdicts ?? []).filter((v) => v.realRisk)
|
|
126
|
+
const goNoGo = skipAdversarial
|
|
127
|
+
? (allObs.some((o) => o.risk === 'high') ? 'fix_first' : 'ship')
|
|
128
|
+
: confirmed.some((v) => v.evidenceStrength === 'strong')
|
|
129
|
+
? 'fix_first'
|
|
130
|
+
: confirmed.length
|
|
131
|
+
? 'fix_first'
|
|
132
|
+
: 'ship'
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
ok: true,
|
|
136
|
+
target,
|
|
137
|
+
lenses: lenses.map((l) => l.name),
|
|
138
|
+
skipAdversarial,
|
|
139
|
+
observationCount: allObs.length,
|
|
140
|
+
confirmedRiskCount: confirmed.length,
|
|
141
|
+
goNoGo,
|
|
142
|
+
topRisks: confirmed.slice(0, 10),
|
|
143
|
+
allVerdicts: verdict?.verdicts ?? [],
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
//#endregion
|
|
147
|
+
export { MULTI_PERSPECTIVE_REVIEW_SCRIPT };
|
|
148
|
+
|
|
149
|
+
//# sourceMappingURL=multi-perspective-review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-perspective-review.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/multi-perspective-review.ts"],"sourcesContent":["/**\n * Built-in workflow: `multi_perspective_review`\n *\n * Reviews a target (file, PR, design doc, plan — passed via args.target) from\n * several independent perspectives, then asks an adversarial judge to decide\n * what would actually break in practice. Useful for sanity-checking decisions\n * before they ship.\n *\n * Args:\n * - target: what to review\n * - lenses: optional array of { name, angle } to override default lenses\n * - skipAdversarial: when true, skip the adversarial judge phase\n */\n\nexport const MULTI_PERSPECTIVE_REVIEW_SCRIPT = `export const meta = {\n name: 'multi_perspective_review',\n description: 'Review a target from N independent perspectives, then adversarially judge what would actually break.',\n whenToUse: 'User wants a stress-test of a design, plan, PR, or proposal before committing to it.',\n tags: ['review', 'planning', 'decision'],\n estimatedAgents: { min: 5, max: 6 },\n phases: [\n { title: 'Lenses' },\n { title: 'Adversarial' },\n { title: 'Synthesize' },\n ],\n}\n\nconst READ_ONLY_TOOLS = ['read_file', 'grep', 'find', 'list_dir']\n\nconst target = args && typeof args === 'object' && args.target\n ? String(args.target)\n : 'No explicit target was provided. Treat the currently focused file or recent context as the target.'\n\nconst skipAdversarial = Boolean(args && typeof args === 'object' && args.skipAdversarial)\n\nconst DEFAULT_LENSES = [\n { name: 'User', angle: 'How a real user experiences this. Friction, confusion, surprise paths, accessibility.' },\n { name: 'Operator', angle: 'How an on-call engineer experiences this in production. Failure modes, observability, rollback.' },\n { name: 'Skeptic', angle: 'Hidden assumptions. What is being implied but not stated. What would break under load or weird input.' },\n { name: 'Maintainer', angle: 'Six-month-later view. Clarity, naming, layering, ease of changing nearby code.' },\n]\n\nlet lenses = DEFAULT_LENSES\nif (args && typeof args === 'object' && Array.isArray(args.lenses) && args.lenses.length) {\n lenses = args.lenses\n .filter((l) => l && typeof l === 'object' && l.name && l.angle)\n .map((l) => ({ name: String(l.name), angle: String(l.angle) }))\n if (!lenses.length) lenses = DEFAULT_LENSES\n}\n\nphase('Lenses')\nconst lensViews = await parallel(\n lenses.map((l) => () =>\n agent(\n 'Review the following target through the ' + l.name + ' lens.\\\\n' +\n 'Lens focus: ' + l.angle + '\\\\n\\\\n' +\n 'TARGET:\\\\n' + target + '\\\\n\\\\n' +\n 'Return 3–7 concrete observations. Each entry: title (5–10 words), why-it-matters (1 sentence), risk (low/med/high).',\n {\n label: l.name + ' lens',\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n observations: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n why: { type: 'string' },\n risk: { type: 'string', enum: ['low', 'med', 'high'] },\n },\n required: ['title', 'why', 'risk'],\n },\n },\n },\n required: ['observations'],\n },\n },\n ),\n ),\n)\n\nconst valid = lensViews.filter(Boolean)\nconst allObs = valid.flatMap((v, i) =>\n (v?.observations ?? []).map((o) => ({ lens: lenses[i].name, ...o })),\n)\n\nlet verdict = null\nif (!skipAdversarial) {\n phase('Adversarial')\n verdict = await agent(\n 'You are an adversarial judge. Given these multi-lens observations of a target, decide which would actually cause real harm if shipped as-is. ' +\n 'Default to realRisk=false unless an observation has clear, mechanism-level evidence. ' +\n 'Rate evidenceStrength as weak | moderate | strong.\\\\n\\\\n' +\n JSON.stringify(allObs, null, 2),\n {\n label: 'adversarial verdict',\n schema: {\n type: 'object',\n properties: {\n verdicts: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n lens: { type: 'string' },\n realRisk: { type: 'boolean' },\n evidenceStrength: { type: 'string', enum: ['weak', 'moderate', 'strong'] },\n reason: { type: 'string' },\n },\n required: ['title', 'lens', 'realRisk', 'evidenceStrength', 'reason'],\n },\n },\n },\n required: ['verdicts'],\n },\n },\n )\n}\n\nphase('Synthesize')\nconst confirmed = (verdict?.verdicts ?? []).filter((v) => v.realRisk)\nconst goNoGo = skipAdversarial\n ? (allObs.some((o) => o.risk === 'high') ? 'fix_first' : 'ship')\n : confirmed.some((v) => v.evidenceStrength === 'strong')\n ? 'fix_first'\n : confirmed.length\n ? 'fix_first'\n : 'ship'\n\nreturn {\n ok: true,\n target,\n lenses: lenses.map((l) => l.name),\n skipAdversarial,\n observationCount: allObs.length,\n confirmedRiskCount: confirmed.length,\n goNoGo,\n topRisks: confirmed.slice(0, 10),\n allVerdicts: verdict?.verdicts ?? [],\n}\n`\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,kCAAkC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in workflow: `pr_review`
|
|
3
|
+
*
|
|
4
|
+
* Focused review of a PR, diff, or commit range — lighter than full repo audit.
|
|
5
|
+
* Parallel reviewers cover correctness, security, tests, API compat, and perf;
|
|
6
|
+
* final phase produces a ship/block verdict with blockers vs suggestions.
|
|
7
|
+
*
|
|
8
|
+
* Args:
|
|
9
|
+
* - target: PR description, diff, commit range, or file list
|
|
10
|
+
* - diff: alias for target
|
|
11
|
+
*/
|
|
12
|
+
export declare const PR_REVIEW_SCRIPT = "export const meta = {\n name: 'pr_review',\n description: 'Review a PR/diff/commit range with parallel focused reviewers and a ship/block verdict.',\n whenToUse: 'User asks to review a PR, diff, specific changes, or commit range (not the whole repo).',\n tags: ['code-review', 'pr'],\n estimatedAgents: { min: 7, max: 7 },\n phases: [\n { title: 'Scope' },\n { title: 'Review' },\n { title: 'Verdict' },\n ],\n}\n\nconst READ_ONLY_TOOLS = ['read_file', 'grep', 'find', 'list_dir', 'shell']\n\nconst target = args && typeof args === 'object'\n ? String(args.target ?? args.diff ?? '')\n : ''\nconst reviewTarget = target.trim()\n ? target\n : 'Recent changes in the working tree or the diff/context from the current conversation.'\n\nconst REVIEWERS = [\n { key: 'correctness', focus: 'Logic bugs, edge cases, error handling, null safety, race conditions in changed code.' },\n { key: 'security', focus: 'Auth/authz regressions, input validation, secret exposure, injection, unsafe deserialization in the diff.' },\n { key: 'tests', focus: 'Missing tests for changed behavior, brittle assertions, untested edge cases introduced by this change.' },\n { key: 'api_compat', focus: 'Breaking public API changes, schema migrations, backward compatibility, deprecation handling.' },\n { key: 'perf', focus: 'Regressions in hot paths, accidental N+1, sync I/O, unbounded loops or allocations in changed code.' },\n]\n\nphase('Scope')\nconst scope = await agent(\n 'Identify what changed for this review target. List changed files, blast radius (what depends on them), and the apparent intent of the change. Be concise.\\n\\nTARGET:\\n' +\n reviewTarget,\n {\n label: 'change scope',\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n changedFiles: { type: 'array', items: { type: 'string' } },\n intent: { type: 'string' },\n blastRadius: { type: 'string' },\n },\n required: ['changedFiles', 'intent'],\n },\n },\n)\n\nphase('Review')\nconst reviews = await parallel(\n REVIEWERS.map((r) => () =>\n agent(\n 'Review these changes through the ' + r.key + ' lens.\\n' +\n 'Focus: ' + r.focus + '\\n\\n' +\n 'TARGET:\\n' + reviewTarget + '\\n\\n' +\n 'SCOPE:\\n' + JSON.stringify(scope, null, 2) + '\\n\\n' +\n 'Return findings: file, severity (low/med/high/blocker), title, fix suggestion. Blocker = must fix before merge.',\n {\n label: r.key,\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n findings: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n file: { type: 'string' },\n severity: { type: 'string', enum: ['low', 'med', 'high', 'blocker'] },\n title: { type: 'string' },\n fix: { type: 'string' },\n },\n required: ['file', 'severity', 'title', 'fix'],\n },\n },\n },\n required: ['findings'],\n },\n },\n ),\n ),\n)\n\nphase('Verdict')\nconst live = reviews.filter(Boolean)\nconst byReviewer = {}\nfor (let i = 0; i < REVIEWERS.length; i++) {\n byReviewer[REVIEWERS[i].key] = live[i]?.findings ?? []\n}\n\nconst verdict = await agent(\n 'Synthesize a PR review verdict. Separate blockers from suggestions. Deduplicate. Recommend ship | fix_first | block.\\n\\n' +\n JSON.stringify(byReviewer, null, 2),\n {\n label: 'verdict',\n schema: {\n type: 'object',\n properties: {\n recommendation: { type: 'string', enum: ['ship', 'fix_first', 'block'] },\n summary: { type: 'string' },\n blockers: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n file: { type: 'string' },\n title: { type: 'string' },\n fix: { type: 'string' },\n },\n required: ['file', 'title'],\n },\n },\n suggestions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n file: { type: 'string' },\n severity: { type: 'string' },\n title: { type: 'string' },\n },\n required: ['file', 'title'],\n },\n },\n },\n required: ['recommendation', 'summary', 'blockers'],\n },\n },\n)\n\nreturn {\n ok: true,\n target: reviewTarget,\n scope,\n ...(verdict ?? { recommendation: 'fix_first', summary: 'verdict failed', blockers: [], suggestions: [] }),\n byReviewer,\n}\n";
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
//#region src/agent/workflow/builtins/pr-review.ts
|
|
2
|
+
/**
|
|
3
|
+
* Built-in workflow: `pr_review`
|
|
4
|
+
*
|
|
5
|
+
* Focused review of a PR, diff, or commit range — lighter than full repo audit.
|
|
6
|
+
* Parallel reviewers cover correctness, security, tests, API compat, and perf;
|
|
7
|
+
* final phase produces a ship/block verdict with blockers vs suggestions.
|
|
8
|
+
*
|
|
9
|
+
* Args:
|
|
10
|
+
* - target: PR description, diff, commit range, or file list
|
|
11
|
+
* - diff: alias for target
|
|
12
|
+
*/
|
|
13
|
+
const PR_REVIEW_SCRIPT = `export const meta = {
|
|
14
|
+
name: 'pr_review',
|
|
15
|
+
description: 'Review a PR/diff/commit range with parallel focused reviewers and a ship/block verdict.',
|
|
16
|
+
whenToUse: 'User asks to review a PR, diff, specific changes, or commit range (not the whole repo).',
|
|
17
|
+
tags: ['code-review', 'pr'],
|
|
18
|
+
estimatedAgents: { min: 7, max: 7 },
|
|
19
|
+
phases: [
|
|
20
|
+
{ title: 'Scope' },
|
|
21
|
+
{ title: 'Review' },
|
|
22
|
+
{ title: 'Verdict' },
|
|
23
|
+
],
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const READ_ONLY_TOOLS = ['read_file', 'grep', 'find', 'list_dir', 'shell']
|
|
27
|
+
|
|
28
|
+
const target = args && typeof args === 'object'
|
|
29
|
+
? String(args.target ?? args.diff ?? '')
|
|
30
|
+
: ''
|
|
31
|
+
const reviewTarget = target.trim()
|
|
32
|
+
? target
|
|
33
|
+
: 'Recent changes in the working tree or the diff/context from the current conversation.'
|
|
34
|
+
|
|
35
|
+
const REVIEWERS = [
|
|
36
|
+
{ key: 'correctness', focus: 'Logic bugs, edge cases, error handling, null safety, race conditions in changed code.' },
|
|
37
|
+
{ key: 'security', focus: 'Auth/authz regressions, input validation, secret exposure, injection, unsafe deserialization in the diff.' },
|
|
38
|
+
{ key: 'tests', focus: 'Missing tests for changed behavior, brittle assertions, untested edge cases introduced by this change.' },
|
|
39
|
+
{ key: 'api_compat', focus: 'Breaking public API changes, schema migrations, backward compatibility, deprecation handling.' },
|
|
40
|
+
{ key: 'perf', focus: 'Regressions in hot paths, accidental N+1, sync I/O, unbounded loops or allocations in changed code.' },
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
phase('Scope')
|
|
44
|
+
const scope = await agent(
|
|
45
|
+
'Identify what changed for this review target. List changed files, blast radius (what depends on them), and the apparent intent of the change. Be concise.\\n\\nTARGET:\\n' +
|
|
46
|
+
reviewTarget,
|
|
47
|
+
{
|
|
48
|
+
label: 'change scope',
|
|
49
|
+
toolset: READ_ONLY_TOOLS,
|
|
50
|
+
schema: {
|
|
51
|
+
type: 'object',
|
|
52
|
+
properties: {
|
|
53
|
+
changedFiles: { type: 'array', items: { type: 'string' } },
|
|
54
|
+
intent: { type: 'string' },
|
|
55
|
+
blastRadius: { type: 'string' },
|
|
56
|
+
},
|
|
57
|
+
required: ['changedFiles', 'intent'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
phase('Review')
|
|
63
|
+
const reviews = await parallel(
|
|
64
|
+
REVIEWERS.map((r) => () =>
|
|
65
|
+
agent(
|
|
66
|
+
'Review these changes through the ' + r.key + ' lens.\\n' +
|
|
67
|
+
'Focus: ' + r.focus + '\\n\\n' +
|
|
68
|
+
'TARGET:\\n' + reviewTarget + '\\n\\n' +
|
|
69
|
+
'SCOPE:\\n' + JSON.stringify(scope, null, 2) + '\\n\\n' +
|
|
70
|
+
'Return findings: file, severity (low/med/high/blocker), title, fix suggestion. Blocker = must fix before merge.',
|
|
71
|
+
{
|
|
72
|
+
label: r.key,
|
|
73
|
+
toolset: READ_ONLY_TOOLS,
|
|
74
|
+
schema: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
findings: {
|
|
78
|
+
type: 'array',
|
|
79
|
+
items: {
|
|
80
|
+
type: 'object',
|
|
81
|
+
properties: {
|
|
82
|
+
file: { type: 'string' },
|
|
83
|
+
severity: { type: 'string', enum: ['low', 'med', 'high', 'blocker'] },
|
|
84
|
+
title: { type: 'string' },
|
|
85
|
+
fix: { type: 'string' },
|
|
86
|
+
},
|
|
87
|
+
required: ['file', 'severity', 'title', 'fix'],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
required: ['findings'],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
),
|
|
95
|
+
),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
phase('Verdict')
|
|
99
|
+
const live = reviews.filter(Boolean)
|
|
100
|
+
const byReviewer = {}
|
|
101
|
+
for (let i = 0; i < REVIEWERS.length; i++) {
|
|
102
|
+
byReviewer[REVIEWERS[i].key] = live[i]?.findings ?? []
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const verdict = await agent(
|
|
106
|
+
'Synthesize a PR review verdict. Separate blockers from suggestions. Deduplicate. Recommend ship | fix_first | block.\\n\\n' +
|
|
107
|
+
JSON.stringify(byReviewer, null, 2),
|
|
108
|
+
{
|
|
109
|
+
label: 'verdict',
|
|
110
|
+
schema: {
|
|
111
|
+
type: 'object',
|
|
112
|
+
properties: {
|
|
113
|
+
recommendation: { type: 'string', enum: ['ship', 'fix_first', 'block'] },
|
|
114
|
+
summary: { type: 'string' },
|
|
115
|
+
blockers: {
|
|
116
|
+
type: 'array',
|
|
117
|
+
items: {
|
|
118
|
+
type: 'object',
|
|
119
|
+
properties: {
|
|
120
|
+
file: { type: 'string' },
|
|
121
|
+
title: { type: 'string' },
|
|
122
|
+
fix: { type: 'string' },
|
|
123
|
+
},
|
|
124
|
+
required: ['file', 'title'],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
suggestions: {
|
|
128
|
+
type: 'array',
|
|
129
|
+
items: {
|
|
130
|
+
type: 'object',
|
|
131
|
+
properties: {
|
|
132
|
+
file: { type: 'string' },
|
|
133
|
+
severity: { type: 'string' },
|
|
134
|
+
title: { type: 'string' },
|
|
135
|
+
},
|
|
136
|
+
required: ['file', 'title'],
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
required: ['recommendation', 'summary', 'blockers'],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
ok: true,
|
|
147
|
+
target: reviewTarget,
|
|
148
|
+
scope,
|
|
149
|
+
...(verdict ?? { recommendation: 'fix_first', summary: 'verdict failed', blockers: [], suggestions: [] }),
|
|
150
|
+
byReviewer,
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
153
|
+
//#endregion
|
|
154
|
+
export { PR_REVIEW_SCRIPT };
|
|
155
|
+
|
|
156
|
+
//# sourceMappingURL=pr-review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-review.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/pr-review.ts"],"sourcesContent":["/**\n * Built-in workflow: `pr_review`\n *\n * Focused review of a PR, diff, or commit range — lighter than full repo audit.\n * Parallel reviewers cover correctness, security, tests, API compat, and perf;\n * final phase produces a ship/block verdict with blockers vs suggestions.\n *\n * Args:\n * - target: PR description, diff, commit range, or file list\n * - diff: alias for target\n */\n\nexport const PR_REVIEW_SCRIPT = `export const meta = {\n name: 'pr_review',\n description: 'Review a PR/diff/commit range with parallel focused reviewers and a ship/block verdict.',\n whenToUse: 'User asks to review a PR, diff, specific changes, or commit range (not the whole repo).',\n tags: ['code-review', 'pr'],\n estimatedAgents: { min: 7, max: 7 },\n phases: [\n { title: 'Scope' },\n { title: 'Review' },\n { title: 'Verdict' },\n ],\n}\n\nconst READ_ONLY_TOOLS = ['read_file', 'grep', 'find', 'list_dir', 'shell']\n\nconst target = args && typeof args === 'object'\n ? String(args.target ?? args.diff ?? '')\n : ''\nconst reviewTarget = target.trim()\n ? target\n : 'Recent changes in the working tree or the diff/context from the current conversation.'\n\nconst REVIEWERS = [\n { key: 'correctness', focus: 'Logic bugs, edge cases, error handling, null safety, race conditions in changed code.' },\n { key: 'security', focus: 'Auth/authz regressions, input validation, secret exposure, injection, unsafe deserialization in the diff.' },\n { key: 'tests', focus: 'Missing tests for changed behavior, brittle assertions, untested edge cases introduced by this change.' },\n { key: 'api_compat', focus: 'Breaking public API changes, schema migrations, backward compatibility, deprecation handling.' },\n { key: 'perf', focus: 'Regressions in hot paths, accidental N+1, sync I/O, unbounded loops or allocations in changed code.' },\n]\n\nphase('Scope')\nconst scope = await agent(\n 'Identify what changed for this review target. List changed files, blast radius (what depends on them), and the apparent intent of the change. Be concise.\\\\n\\\\nTARGET:\\\\n' +\n reviewTarget,\n {\n label: 'change scope',\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n changedFiles: { type: 'array', items: { type: 'string' } },\n intent: { type: 'string' },\n blastRadius: { type: 'string' },\n },\n required: ['changedFiles', 'intent'],\n },\n },\n)\n\nphase('Review')\nconst reviews = await parallel(\n REVIEWERS.map((r) => () =>\n agent(\n 'Review these changes through the ' + r.key + ' lens.\\\\n' +\n 'Focus: ' + r.focus + '\\\\n\\\\n' +\n 'TARGET:\\\\n' + reviewTarget + '\\\\n\\\\n' +\n 'SCOPE:\\\\n' + JSON.stringify(scope, null, 2) + '\\\\n\\\\n' +\n 'Return findings: file, severity (low/med/high/blocker), title, fix suggestion. Blocker = must fix before merge.',\n {\n label: r.key,\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n findings: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n file: { type: 'string' },\n severity: { type: 'string', enum: ['low', 'med', 'high', 'blocker'] },\n title: { type: 'string' },\n fix: { type: 'string' },\n },\n required: ['file', 'severity', 'title', 'fix'],\n },\n },\n },\n required: ['findings'],\n },\n },\n ),\n ),\n)\n\nphase('Verdict')\nconst live = reviews.filter(Boolean)\nconst byReviewer = {}\nfor (let i = 0; i < REVIEWERS.length; i++) {\n byReviewer[REVIEWERS[i].key] = live[i]?.findings ?? []\n}\n\nconst verdict = await agent(\n 'Synthesize a PR review verdict. Separate blockers from suggestions. Deduplicate. Recommend ship | fix_first | block.\\\\n\\\\n' +\n JSON.stringify(byReviewer, null, 2),\n {\n label: 'verdict',\n schema: {\n type: 'object',\n properties: {\n recommendation: { type: 'string', enum: ['ship', 'fix_first', 'block'] },\n summary: { type: 'string' },\n blockers: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n file: { type: 'string' },\n title: { type: 'string' },\n fix: { type: 'string' },\n },\n required: ['file', 'title'],\n },\n },\n suggestions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n file: { type: 'string' },\n severity: { type: 'string' },\n title: { type: 'string' },\n },\n required: ['file', 'title'],\n },\n },\n },\n required: ['recommendation', 'summary', 'blockers'],\n },\n },\n)\n\nreturn {\n ok: true,\n target: reviewTarget,\n scope,\n ...(verdict ?? { recommendation: 'fix_first', summary: 'verdict failed', blockers: [], suggestions: [] }),\n byReviewer,\n}\n`\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,mBAAmB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in workflow: `research`
|
|
3
|
+
*
|
|
4
|
+
* Multi-modal research sweep on a question (args.question). Fans out search /
|
|
5
|
+
* exploration / source-reading angles in parallel, then synthesises a cited
|
|
6
|
+
* report. Each angle is its own subagent so source reading does not pollute the
|
|
7
|
+
* parent context.
|
|
8
|
+
*
|
|
9
|
+
* Args:
|
|
10
|
+
* - question: research question
|
|
11
|
+
* - depth: 'quick' (2 angles) | 'standard' (4) | 'deep' (6)
|
|
12
|
+
*/
|
|
13
|
+
export declare const RESEARCH_SCRIPT = "export const meta = {\n name: 'research',\n description: 'Multi-angle research on a question with parallel exploration and a cited synthesis.',\n whenToUse: 'User asks a non-trivial research question that benefits from multiple search angles or source reads.',\n tags: ['research', 'investigation'],\n estimatedAgents: { min: 4, max: 8 },\n phases: [\n { title: 'Frame' },\n { title: 'Sweep' },\n { title: 'Synthesize' },\n ],\n}\n\nconst RESEARCH_TOOLS = ['web_search', 'web_fetch', 'read_file', 'grep', 'find', 'list_dir']\n\nconst question = args && typeof args === 'object' && args.question\n ? String(args.question)\n : 'No explicit question supplied; infer from the most recent user turn.'\n\nconst depth = args && typeof args === 'object' && args.depth\n ? String(args.depth)\n : 'standard'\nconst maxAngles = depth === 'quick' ? 2 : depth === 'deep' ? 6 : 4\n\nphase('Frame')\nconst frame = await agent(\n 'Frame this research question. Return exactly ' + maxAngles + ' distinct angles worth investigating, ' +\n 'each with the single most decisive sub-question. Be concrete.\\n\\nQUESTION:\\n' +\n question,\n {\n label: 'framing',\n schema: {\n type: 'object',\n properties: {\n angles: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n key_question: { type: 'string' },\n },\n required: ['title', 'key_question'],\n },\n },\n },\n required: ['angles'],\n },\n },\n)\n\nif (!frame || !frame.angles?.length) {\n return { ok: false, reason: 'framing failed', question, depth }\n}\n\nconst angles = frame.angles.slice(0, maxAngles)\n\nphase('Sweep')\nconst angleReports = await parallel(\n angles.map((a) => () =>\n agent(\n 'Investigate this angle. Use search and source-read tools liberally. Distinguish what you can confirm from what is conjecture.\\n\\n' +\n 'ANGLE: ' + a.title + '\\n' +\n 'KEY QUESTION: ' + a.key_question + '\\n\\n' +\n 'Return: 3\u20136 grounded findings (each with a 1-line claim and a source URL or file path), plus the strongest counter-evidence.',\n {\n label: a.title,\n toolset: RESEARCH_TOOLS,\n maxIterations: depth === 'deep' ? 40 : 30,\n schema: {\n type: 'object',\n properties: {\n findings: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n claim: { type: 'string' },\n source: { type: 'string' },\n confidence: { type: 'string', enum: ['low', 'med', 'high'] },\n },\n required: ['claim', 'source', 'confidence'],\n },\n },\n counterEvidence: { type: 'string' },\n },\n required: ['findings'],\n },\n },\n ),\n ),\n)\n\nphase('Synthesize')\nconst live = angleReports.filter(Boolean)\nconst synthesis = await agent(\n 'Synthesize a cited research report from these angle-level findings. Drop unsupported or duplicate claims. Use the highest-confidence source per claim. ' +\n 'Explicitly list contradictions where angles disagree. Return: an executive summary (max 5 sentences), top findings with inline source URLs, open questions, and contradictions.\\n\\n' +\n 'QUESTION:\\n' + question + '\\n\\n' +\n JSON.stringify({ angles, reports: live }, null, 2),\n {\n label: 'synthesis',\n schema: {\n type: 'object',\n properties: {\n executiveSummary: { type: 'string' },\n topFindings: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n claim: { type: 'string' },\n source: { type: 'string' },\n },\n required: ['claim', 'source'],\n },\n },\n openQuestions: { type: 'array', items: { type: 'string' } },\n contradictions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n topic: { type: 'string' },\n sides: { type: 'array', items: { type: 'string' } },\n },\n required: ['topic', 'sides'],\n },\n },\n },\n required: ['executiveSummary', 'topFindings'],\n },\n },\n)\n\nreturn {\n ok: true,\n question,\n depth,\n angleCount: angles.length,\n ...(synthesis ?? { executiveSummary: 'synthesis failed', topFindings: [], contradictions: [] }),\n}\n";
|