@xopcai/xopc 0.0.115 → 0.0.117
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 +26 -10
- package/README.zh-CN.md +26 -10
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/demo-memory/src/index.d.ts +6 -0
- package/dist/extensions/demo-memory/src/index.js +132 -0
- package/dist/extensions/demo-memory/src/index.js.map +1 -0
- package/dist/extensions/demo-memory/xopc.extension.json +15 -0
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +3 -3
- package/dist/extensions/telegram/src/command-handler.js +1 -2
- package/dist/extensions/telegram/src/command-handler.js.map +1 -1
- package/dist/extensions/telegram/src/config-schema.d.ts +8 -8
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DVnBfANm.js → agent-avatar-dicebear-BBLhJ2C6.js} +1 -1
- package/dist/gateway/static/root/assets/agents-C6xgagZd.js +71 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-CBpLONvG.js +1 -0
- package/dist/gateway/static/root/assets/{appearance-settings-BQpPSTHD.js → appearance-settings-CGcc54yj.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DdDx0V4z.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CXu-Csep.js → archive-plugin-DZsVqMhU.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BAjgOoGY.js → attachment-load-CIol6JWX.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-BSBgB2hO.js → binary-plugins-B3UauMfp.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BpXw9TTR.js → block-editor-2HJoFchH.js} +3 -3
- package/dist/gateway/static/root/assets/browser-settings-page-CUOO-PQk.js +8 -0
- package/dist/gateway/static/root/assets/capability-presets-api-XQoMTI0A.js +1 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CfqF-kGr.js +1 -0
- package/dist/gateway/static/root/assets/{channels-settings-BbPUpzWB.js → channels-settings-BYyRzsex.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DIvEz4NX.js +2 -0
- package/dist/gateway/static/root/assets/cron-api-R41aQCX9.js +1 -0
- package/dist/gateway/static/root/assets/cron-page-D97nFqQD.js +3 -0
- package/dist/gateway/static/root/assets/dreaming-settings-Bceaw1PG.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-D9kgUHCc.js → extension-debug-page-DX5WRE_t.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CGyhXqzR.js → extension-page-Buah7Bw-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DL8Xquqd.js → extension-settings-page-DuroLVnf.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-D0VXA932.js → fetch-B5zdl27C.js} +1 -1
- package/dist/gateway/static/root/assets/{format-interval-label-Be8SmgUw.js → format-interval-label-Dn_QKIqb.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-config-api-gT4ZhE7h.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-iISWAZRm.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DERUH61L.js → gateway-startup-retry-B3kL8KGY.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DCUROLMQ.js +1 -0
- package/dist/gateway/static/root/assets/{goals-config-api-BPmqWk90.js → goals-config-api-AR-fVh0P.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-Cpb21ezg.js +2 -0
- package/dist/gateway/static/root/assets/goals-settings-CPAuFwoD.js +1 -0
- package/dist/gateway/static/root/assets/{heartbeat-config-api-Bfdzr8oV.js → heartbeat-config-api-D7bKFEeO.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CC69vNx0.js +1 -0
- package/dist/gateway/static/root/assets/index-CwhK8qCh.js +122 -0
- package/dist/gateway/static/root/assets/index-CyfhARL-.css +1 -0
- package/dist/gateway/static/root/assets/{interval-presets-utKbuCRY.js → interval-presets-0DtsnxE0.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CjqS6c6V.js → keyboard-shortcuts-settings-BPREtN8B.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DefCgF4o.js +2 -0
- package/dist/gateway/static/root/assets/{markdown-split-DW8C47iB.js → markdown-split-ChbR9LGO.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D6HwDhDT.js → media-plugins-B82oP80n.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Cf1O9JB0.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-DmKiIihT.js +2 -0
- package/dist/gateway/static/root/assets/note-detail-page-CxxfLRJZ.js +2 -0
- package/dist/gateway/static/root/assets/{note-image-lightbox-pJM35Pz5.js → note-image-lightbox-CDknITM3.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-X2slSx7V.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CVwHuyN6.js → preview-open-alternatives-DV3xQsWB.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BvmUWqgu.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-Ba-UEk7x.js → save-bar-controls-BODCXnvY.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-CNN9595U.js → schedule-field-CgJSCD3B.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DnNMmtD5.js → schema-form-qtfEI6QM.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-B0yESuuL.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-q2M8RKOo.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-CmOz80i5.js → settings-collapsible-section-BHZKjVcS.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-BmK7JJOV.js → settings-form-section-5i35D-J1.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-CGozabLD.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-FoOSe6nU.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-Dp2qGrHC.js → share-preview-page-B0H63tDv.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Cy5zWyYQ.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DaZNFro9.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CnwtUzvw.js +2 -0
- package/dist/gateway/static/root/assets/system-settings-panel-DXs2VmBt.js +1 -0
- package/dist/gateway/static/root/assets/typed-models-lib-4gPuydz_.js +1 -0
- package/dist/gateway/static/root/assets/{use-channel-catalog-CHlO8J9G.js → use-channel-catalog-BCjP_VHb.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DvKiOglO.js +1 -0
- package/dist/gateway/static/root/assets/{voice-player-store-DDDWYHvg.js → voice-player-store-BlF9V05n.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-CAVZcONQ.js +18 -0
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/agent-manager.js +7 -8
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/agent-scope.js +6 -8
- package/dist/src/agent/agent-scope.js.map +1 -1
- package/dist/src/agent/background-review/coordinator.js +0 -1
- package/dist/src/agent/background-review/coordinator.js.map +1 -1
- package/dist/src/agent/background-review/run-background-review.d.ts +0 -2
- package/dist/src/agent/background-review/run-background-review.js +2 -4
- package/dist/src/agent/background-review/run-background-review.js.map +1 -1
- package/dist/src/agent/background-review/settings.js +8 -7
- package/dist/src/agent/background-review/settings.js.map +1 -1
- package/dist/src/agent/bootstrap/bootstrap-context.d.ts +2 -2
- package/dist/src/agent/bootstrap/bootstrap-context.js +4 -4
- package/dist/src/agent/bootstrap/bootstrap-context.js.map +1 -1
- package/dist/src/agent/context/workspace-seed.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js.map +1 -1
- package/dist/src/agent/fallback/candidates.js +6 -3
- package/dist/src/agent/fallback/candidates.js.map +1 -1
- package/dist/src/agent/goals/checklist-judge.d.ts +1 -0
- package/dist/src/agent/goals/checklist-judge.js +1 -1
- package/dist/src/agent/goals/checklist-judge.js.map +1 -1
- package/dist/src/agent/goals/evaluate-turn.d.ts +1 -0
- package/dist/src/agent/goals/evaluate-turn.js +1 -0
- package/dist/src/agent/goals/evaluate-turn.js.map +1 -1
- package/dist/src/agent/goals/post-turn.js +8 -1
- package/dist/src/agent/goals/post-turn.js.map +1 -1
- package/dist/src/agent/image/generation/runtime-types.d.ts +2 -0
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/generation/runtime.js.map +1 -1
- package/dist/src/agent/image/image-helpers.d.ts +1 -1
- package/dist/src/agent/image/image-helpers.js +4 -17
- package/dist/src/agent/image/image-helpers.js.map +1 -1
- package/dist/src/agent/image/image-model-fallback.js +1 -1
- package/dist/src/agent/image/image-model-fallback.js.map +1 -1
- package/dist/src/agent/image/inbound-image-handling.js +1 -1
- package/dist/src/agent/image/inbound-image-handling.js.map +1 -1
- package/dist/src/agent/image/tool-model-config.d.ts +1 -1
- package/dist/src/agent/image/tool-model-config.js +2 -2
- package/dist/src/agent/image/tool-model-config.js.map +1 -1
- package/dist/src/agent/image/understanding/pi-ai-provider.js +5 -2
- package/dist/src/agent/image/understanding/pi-ai-provider.js.map +1 -1
- package/dist/src/agent/image/understanding/provider-registry.d.ts +1 -0
- package/dist/src/agent/image/understanding/provider-registry.js +16 -2
- package/dist/src/agent/image/understanding/provider-registry.js.map +1 -1
- package/dist/src/agent/mcp/resolve-embedded-mcp-tools.js +1 -1
- package/dist/src/agent/mcp/resolve-embedded-mcp-tools.js.map +1 -1
- package/dist/src/agent/media-generation/runtime-shared.d.ts +5 -2
- package/dist/src/agent/media-generation/runtime-shared.js +1 -1
- package/dist/src/agent/media-generation/runtime-shared.js.map +1 -1
- package/dist/src/agent/memory/builtin-memory-store.d.ts +2 -0
- package/dist/src/agent/memory/builtin-memory-store.js +4 -0
- package/dist/src/agent/memory/builtin-memory-store.js.map +1 -1
- package/dist/src/agent/memory/builtin-provider.d.ts +31 -9
- package/dist/src/agent/memory/builtin-provider.js +261 -11
- package/dist/src/agent/memory/builtin-provider.js.map +1 -1
- package/dist/src/agent/memory/context-assembler.d.ts +10 -0
- package/dist/src/agent/memory/context-assembler.js +26 -0
- package/dist/src/agent/memory/context-assembler.js.map +1 -0
- package/dist/src/agent/memory/create-memory-manager.js +25 -7
- package/dist/src/agent/memory/create-memory-manager.js.map +1 -1
- package/dist/src/agent/memory/dreaming/config.d.ts +1 -6
- package/dist/src/agent/memory/dreaming/config.js +8 -8
- package/dist/src/agent/memory/dreaming/config.js.map +1 -1
- package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +2 -0
- package/dist/src/agent/memory/dreaming/deep-promotion.js +24 -0
- package/dist/src/agent/memory/dreaming/deep-promotion.js.map +1 -1
- package/dist/src/agent/memory/index.d.ts +1 -0
- package/dist/src/agent/memory/index.js +4 -3
- package/dist/src/agent/memory/inject-prefetch.js +6 -2
- package/dist/src/agent/memory/inject-prefetch.js.map +1 -1
- package/dist/src/agent/memory/manager.d.ts +37 -1
- package/dist/src/agent/memory/manager.js +332 -40
- package/dist/src/agent/memory/manager.js.map +1 -1
- package/dist/src/agent/memory/memory-config.js +12 -15
- package/dist/src/agent/memory/memory-config.js.map +1 -1
- package/dist/src/agent/memory/plugin-discovery.d.ts +19 -5
- package/dist/src/agent/memory/plugin-discovery.js +97 -31
- package/dist/src/agent/memory/plugin-discovery.js.map +1 -1
- package/dist/src/agent/memory/provider.d.ts +20 -15
- package/dist/src/agent/memory/stub-memory-provider.d.ts +17 -2
- package/dist/src/agent/memory/stub-memory-provider.js +20 -3
- package/dist/src/agent/memory/stub-memory-provider.js.map +1 -1
- package/dist/src/agent/memory/types.d.ts +136 -0
- package/dist/src/agent/models/manager.d.ts +1 -1
- package/dist/src/agent/models/manager.js +1 -1
- package/dist/src/agent/models/manager.js.map +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +2 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.d.ts +2 -2
- package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.js +1 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.js.map +1 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +2 -6
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -8
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js.map +1 -1
- package/dist/src/agent/reply/post-compaction-context.js +11 -6
- package/dist/src/agent/reply/post-compaction-context.js.map +1 -1
- package/dist/src/agent/reply/startup-context.js +8 -9
- package/dist/src/agent/reply/startup-context.js.map +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +1 -4
- package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
- package/dist/src/agent/service/session-context-report.js +1 -1
- package/dist/src/agent/service/session-context-report.js.map +1 -1
- package/dist/src/agent/service.js +21 -25
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/service.types.d.ts +1 -2
- package/dist/src/agent/session/session-hydrator.js +1 -2
- package/dist/src/agent/session/session-hydrator.js.map +1 -1
- package/dist/src/agent/session/session-inspector.d.ts +1 -1
- package/dist/src/agent/session/session-inspector.js +9 -14
- package/dist/src/agent/session/session-inspector.js.map +1 -1
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/starter-agents.d.ts +1 -3
- package/dist/src/agent/starter-agents.js +13 -21
- package/dist/src/agent/starter-agents.js.map +1 -1
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +1 -2
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js.map +1 -1
- package/dist/src/agent/tools/composio-tool.d.ts +8 -0
- package/dist/src/agent/tools/composio-tool.js +46 -0
- package/dist/src/agent/tools/composio-tool.js.map +1 -0
- package/dist/src/agent/tools/curated-memory-tool.d.ts +2 -5
- package/dist/src/agent/tools/curated-memory-tool.js +20 -16
- package/dist/src/agent/tools/curated-memory-tool.js.map +1 -1
- package/dist/src/agent/tools/factory.d.ts +0 -4
- package/dist/src/agent/tools/factory.js +32 -66
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/image-generate-tool.d.ts +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +19 -14
- package/dist/src/agent/tools/image-generate-tool.js.map +1 -1
- package/dist/src/agent/tools/image-tool.js +1 -3
- package/dist/src/agent/tools/image-tool.js.map +1 -1
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/memory-tool.d.ts +2 -2
- package/dist/src/agent/tools/memory-tool.js +39 -14
- package/dist/src/agent/tools/memory-tool.js.map +1 -1
- package/dist/src/agent/tools/session-search-tool.js +1 -3
- package/dist/src/agent/tools/session-search-tool.js.map +1 -1
- package/dist/src/agent/tools/web-extract.js +6 -5
- package/dist/src/agent/tools/web-extract.js.map +1 -1
- package/dist/src/agent/workflow/builtins/audit-repo.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/audit-repo.js +15 -2
- package/dist/src/agent/workflow/builtins/audit-repo.js.map +1 -1
- package/dist/src/agent/workflow/builtins/client-proposal.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/client-proposal.js +10 -1
- package/dist/src/agent/workflow/builtins/client-proposal.js.map +1 -1
- package/dist/src/agent/workflow/builtins/competitor-scan.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/competitor-scan.js +16 -2
- package/dist/src/agent/workflow/builtins/competitor-scan.js.map +1 -1
- package/dist/src/agent/workflow/builtins/content-draft.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/content-draft.js +15 -2
- package/dist/src/agent/workflow/builtins/content-draft.js.map +1 -1
- package/dist/src/agent/workflow/builtins/content-repurpose.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/content-repurpose.js +10 -1
- package/dist/src/agent/workflow/builtins/content-repurpose.js.map +1 -1
- package/dist/src/agent/workflow/builtins/debug-incident.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/debug-incident.js +9 -1
- package/dist/src/agent/workflow/builtins/debug-incident.js.map +1 -1
- package/dist/src/agent/workflow/builtins/decision-compare.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/decision-compare.js +16 -2
- package/dist/src/agent/workflow/builtins/decision-compare.js.map +1 -1
- package/dist/src/agent/workflow/builtins/implementation-plan.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/implementation-plan.js +11 -1
- package/dist/src/agent/workflow/builtins/implementation-plan.js.map +1 -1
- package/dist/src/agent/workflow/builtins/inbox-triage.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/inbox-triage.js +11 -1
- package/dist/src/agent/workflow/builtins/inbox-triage.js.map +1 -1
- package/dist/src/agent/workflow/builtins/meeting-prep.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/meeting-prep.js +9 -1
- package/dist/src/agent/workflow/builtins/meeting-prep.js.map +1 -1
- package/dist/src/agent/workflow/builtins/multi-perspective-review.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/multi-perspective-review.js +9 -1
- package/dist/src/agent/workflow/builtins/multi-perspective-review.js.map +1 -1
- package/dist/src/agent/workflow/builtins/offer-design.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/offer-design.js +10 -1
- package/dist/src/agent/workflow/builtins/offer-design.js.map +1 -1
- package/dist/src/agent/workflow/builtins/pr-review.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/pr-review.js +9 -1
- package/dist/src/agent/workflow/builtins/pr-review.js.map +1 -1
- package/dist/src/agent/workflow/builtins/release-check.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/release-check.js +10 -1
- package/dist/src/agent/workflow/builtins/release-check.js.map +1 -1
- package/dist/src/agent/workflow/builtins/research.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/research.js +16 -2
- package/dist/src/agent/workflow/builtins/research.js.map +1 -1
- package/dist/src/agent/workflow/builtins/weekly-review.d.ts +1 -1
- package/dist/src/agent/workflow/builtins/weekly-review.js +9 -1
- package/dist/src/agent/workflow/builtins/weekly-review.js.map +1 -1
- package/dist/src/agent/workflow/subagent-runner.js +1 -3
- package/dist/src/agent/workflow/subagent-runner.js.map +1 -1
- package/dist/src/agent-manifest/index.d.ts +4 -0
- package/dist/src/agent-manifest/index.js +10 -0
- package/dist/src/agent-manifest/index.js.map +1 -0
- package/dist/src/agent-manifest/prompt.d.ts +2 -0
- package/dist/src/agent-manifest/prompt.js +57 -0
- package/dist/src/agent-manifest/prompt.js.map +1 -0
- package/dist/src/agent-manifest/resolver.d.ts +11 -0
- package/dist/src/agent-manifest/resolver.js +93 -0
- package/dist/src/agent-manifest/resolver.js.map +1 -0
- package/dist/src/agent-manifest/schema.d.ts +778 -0
- package/dist/src/agent-manifest/schema.js +267 -0
- package/dist/src/agent-manifest/schema.js.map +1 -0
- package/dist/src/agent-manifest/validator.d.ts +24 -0
- package/dist/src/agent-manifest/validator.js +87 -0
- package/dist/src/agent-manifest/validator.js.map +1 -0
- package/dist/src/agent-runtime/boundary-guard.d.ts +12 -0
- package/dist/src/agent-runtime/boundary-guard.js +23 -0
- package/dist/src/agent-runtime/boundary-guard.js.map +1 -0
- package/dist/src/agent-runtime/index.d.ts +7 -0
- package/dist/src/agent-runtime/index.js +8 -0
- package/dist/src/agent-runtime/memory-runtime.d.ts +21 -0
- package/dist/src/agent-runtime/memory-runtime.js +50 -0
- package/dist/src/agent-runtime/memory-runtime.js.map +1 -0
- package/dist/src/agent-runtime/model-router.d.ts +11 -0
- package/dist/src/agent-runtime/model-router.js +16 -0
- package/dist/src/agent-runtime/model-router.js.map +1 -0
- package/dist/src/agent-runtime/run-trace.d.ts +27 -0
- package/dist/src/agent-runtime/run-trace.js +53 -0
- package/dist/src/agent-runtime/run-trace.js.map +1 -0
- package/dist/src/agent-runtime/runtime-profile.d.ts +24 -0
- package/dist/src/agent-runtime/runtime-profile.js +44 -0
- package/dist/src/agent-runtime/runtime-profile.js.map +1 -0
- package/dist/src/agent-runtime/tool-registry.d.ts +28 -0
- package/dist/src/agent-runtime/tool-registry.js +52 -0
- package/dist/src/agent-runtime/tool-registry.js.map +1 -0
- package/dist/src/agent-runtime/workflow-runtime.d.ts +31 -0
- package/dist/src/agent-runtime/workflow-runtime.js +34 -0
- package/dist/src/agent-runtime/workflow-runtime.js.map +1 -0
- package/dist/src/browser/actions/extension-registry-bridge.js +1 -1
- package/dist/src/browser/actions/extension-registry-bridge.js.map +1 -1
- package/dist/src/browser/actions/registry.js +5 -8
- package/dist/src/browser/actions/registry.js.map +1 -1
- package/dist/src/browser/backend-from-config.d.ts +1 -1
- package/dist/src/browser/backend-from-config.js +50 -71
- package/dist/src/browser/backend-from-config.js.map +1 -1
- package/dist/src/browser/browser-command-timeout.d.ts +0 -1
- package/dist/src/browser/browser-command-timeout.js +3 -7
- package/dist/src/browser/browser-command-timeout.js.map +1 -1
- package/dist/src/browser/providers/browser-ext-install.d.ts +2 -12
- package/dist/src/browser/providers/browser-ext-install.js +3 -8
- package/dist/src/browser/providers/browser-ext-install.js.map +1 -1
- package/dist/src/browser/readiness.js +16 -16
- package/dist/src/browser/readiness.js.map +1 -1
- package/dist/src/browser/schemas.js +1 -1
- package/dist/src/browser/schemas.js.map +1 -1
- package/dist/src/chat-commands/builtins/config.js +4 -4
- package/dist/src/chat-commands/builtins/config.js.map +1 -1
- package/dist/src/chat-commands/builtins/thinking.js +16 -42
- package/dist/src/chat-commands/builtins/thinking.js.map +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/chat-commands/config-paths.js.map +1 -1
- package/dist/src/chat-commands/context.js +3 -4
- package/dist/src/chat-commands/context.js.map +1 -1
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/command-manifest.js.map +1 -1
- package/dist/src/cli/commands/agent.js +3 -1
- package/dist/src/cli/commands/agent.js.map +1 -1
- package/dist/src/cli/commands/agents.js +3 -6
- package/dist/src/cli/commands/agents.js.map +1 -1
- package/dist/src/cli/commands/browser-cli-helpers.js +9 -11
- package/dist/src/cli/commands/browser-cli-helpers.js.map +1 -1
- package/dist/src/cli/commands/config.js +5 -5
- package/dist/src/cli/commands/config.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -17
- package/dist/src/cli/commands/doctor/checks/provider-auth.js.map +1 -1
- package/dist/src/cli/commands/goal.js +1 -1
- package/dist/src/cli/commands/image.js +13 -372
- package/dist/src/cli/commands/image.js.map +1 -1
- package/dist/src/cli/commands/models.js +26 -10
- package/dist/src/cli/commands/models.js.map +1 -1
- package/dist/src/cli/commands/onboard/channels/registry.js.map +1 -1
- package/dist/src/cli/commands/onboard/model.js +20 -22
- package/dist/src/cli/commands/onboard/model.js.map +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/onboard.js.map +1 -1
- package/dist/src/cli/utils/init-workspace-core.d.ts +1 -4
- package/dist/src/cli/utils/init-workspace-core.js +7 -6
- package/dist/src/cli/utils/init-workspace-core.js.map +1 -1
- package/dist/src/commands/agents.config.d.ts +0 -1
- package/dist/src/commands/agents.config.js +66 -12
- package/dist/src/commands/agents.config.js.map +1 -1
- package/dist/src/config/agent-profile.d.ts +5 -17
- package/dist/src/config/agent-profile.js +31 -64
- package/dist/src/config/agent-profile.js.map +1 -1
- package/dist/src/config/agent-typed-models.d.ts +1 -1
- package/dist/src/config/agent-typed-models.js +0 -1
- package/dist/src/config/agent-typed-models.js.map +1 -1
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/integration.d.ts +1 -1
- package/dist/src/config/reload.js +1 -1
- package/dist/src/config/reload.js.map +1 -1
- package/dist/src/config/rules.js +6 -56
- package/dist/src/config/rules.js.map +1 -1
- package/dist/src/config/schema.d.ts +925 -781
- package/dist/src/config/schema.js +157 -424
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/connectors/composio-triggers.d.ts +10 -0
- package/dist/src/connectors/composio-triggers.js +32 -0
- package/dist/src/connectors/composio-triggers.js.map +1 -0
- package/dist/src/connectors/composio.d.ts +54 -0
- package/dist/src/connectors/composio.js +334 -0
- package/dist/src/connectors/composio.js.map +1 -0
- package/dist/src/connectors/health.js +16 -1
- package/dist/src/connectors/health.js.map +1 -1
- package/dist/src/connectors/install.d.ts +2 -1
- package/dist/src/connectors/install.js +50 -13
- package/dist/src/connectors/install.js.map +1 -1
- package/dist/src/connectors/instances.js +57 -6
- package/dist/src/connectors/instances.js.map +1 -1
- package/dist/src/connectors/lifecycle.d.ts +3 -0
- package/dist/src/connectors/lifecycle.js +23 -0
- package/dist/src/connectors/lifecycle.js.map +1 -0
- package/dist/src/connectors/materialize.js +2 -1
- package/dist/src/connectors/materialize.js.map +1 -1
- package/dist/src/connectors/providers.d.ts +1 -0
- package/dist/src/connectors/providers.js +10 -2
- package/dist/src/connectors/providers.js.map +1 -1
- package/dist/src/connectors/registries/modelscope.d.ts +2 -0
- package/dist/src/connectors/registries/modelscope.js +205 -0
- package/dist/src/connectors/registries/modelscope.js.map +1 -0
- package/dist/src/connectors/registries/official-mcp.d.ts +2 -0
- package/dist/src/connectors/registries/official-mcp.js +142 -0
- package/dist/src/connectors/registries/official-mcp.js.map +1 -0
- package/dist/src/connectors/registries/search.d.ts +12 -0
- package/dist/src/connectors/registries/search.js +89 -0
- package/dist/src/connectors/registries/search.js.map +1 -0
- package/dist/src/connectors/registries/smithery.d.ts +2 -0
- package/dist/src/connectors/registries/smithery.js +98 -0
- package/dist/src/connectors/registries/smithery.js.map +1 -0
- package/dist/src/connectors/registries/types.d.ts +20 -0
- package/dist/src/connectors/registries/types.js +1 -0
- package/dist/src/connectors/secret-store.js +4 -2
- package/dist/src/connectors/secret-store.js.map +1 -1
- package/dist/src/connectors/setup-secrets.d.ts +15 -0
- package/dist/src/connectors/setup-secrets.js +64 -0
- package/dist/src/connectors/setup-secrets.js.map +1 -0
- package/dist/src/connectors/supervisor.d.ts +15 -0
- package/dist/src/connectors/supervisor.js +73 -0
- package/dist/src/connectors/supervisor.js.map +1 -0
- package/dist/src/connectors/types.d.ts +27 -3
- package/dist/src/connectors/usage.js +6 -1
- package/dist/src/connectors/usage.js.map +1 -1
- package/dist/src/cron/index.js +1 -1
- package/dist/src/cron/service.js +1 -1
- package/dist/src/cron/validation.d.ts +3 -3
- package/dist/src/extensions/activation-context.js +13 -7
- package/dist/src/extensions/activation-context.js.map +1 -1
- package/dist/src/gateway/agents-admin.d.ts +17 -18
- package/dist/src/gateway/agents-admin.js +123 -88
- package/dist/src/gateway/agents-admin.js.map +1 -1
- package/dist/src/gateway/capability-presets-admin.d.ts +56 -0
- package/dist/src/gateway/capability-presets-admin.js +214 -0
- package/dist/src/gateway/capability-presets-admin.js.map +1 -0
- package/dist/src/gateway/hono/lib/agent-model.d.ts +1 -1
- package/dist/src/gateway/hono/lib/agent-model.js +1 -1
- package/dist/src/gateway/hono/lib/agent-model.js.map +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +234 -127
- package/dist/src/gateway/hono/lib/config-payload.js +13 -37
- package/dist/src/gateway/hono/lib/config-payload.js.map +1 -1
- package/dist/src/gateway/hono/routes/agents.js +56 -33
- package/dist/src/gateway/hono/routes/agents.js.map +1 -1
- package/dist/src/gateway/hono/routes/browser.js +8 -15
- package/dist/src/gateway/hono/routes/browser.js.map +1 -1
- package/dist/src/gateway/hono/routes/capability-presets.d.ts +3 -0
- package/dist/src/gateway/hono/routes/capability-presets.js +145 -0
- package/dist/src/gateway/hono/routes/capability-presets.js.map +1 -0
- package/dist/src/gateway/hono/routes/config-patch/agents.d.ts +1 -17
- package/dist/src/gateway/hono/routes/config-patch/agents.js +2 -443
- package/dist/src/gateway/hono/routes/config-patch/agents.js.map +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +7 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js.map +1 -1
- package/dist/src/gateway/hono/routes/config.js +1 -1
- package/dist/src/gateway/hono/routes/config.js.map +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +230 -3
- package/dist/src/gateway/hono/routes/connectors.js.map +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +7 -0
- package/dist/src/gateway/hono/routes/dreaming.js.map +1 -1
- package/dist/src/gateway/hono/routes/goals.js +52 -5
- package/dist/src/gateway/hono/routes/goals.js.map +1 -1
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/index.js.map +1 -1
- 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/memory.d.ts +3 -0
- package/dist/src/gateway/hono/routes/memory.js +290 -0
- package/dist/src/gateway/hono/routes/memory.js.map +1 -0
- package/dist/src/gateway/hono/routes/voice.js +14 -1
- package/dist/src/gateway/hono/routes/voice.js.map +1 -1
- package/dist/src/gateway/hono/sse.js.map +1 -1
- package/dist/src/gateway/service/agent-runner.d.ts +5 -12
- package/dist/src/gateway/service/agent-runner.js +8 -8
- package/dist/src/gateway/service/agent-runner.js.map +1 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -10
- package/dist/src/gateway/service/run-gateway-agent.js.map +1 -1
- package/dist/src/gateway/service.d.ts +2 -2
- package/dist/src/gateway/service.js +20 -16
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/gateway/user-turn-input.d.ts +18 -0
- package/dist/src/gateway/user-turn-input.js +16 -0
- package/dist/src/gateway/user-turn-input.js.map +1 -0
- package/dist/src/goals/goal-queue-store.d.ts +2 -1
- package/dist/src/goals/goal-queue-store.js +2 -2
- package/dist/src/goals/goal-queue-store.js.map +1 -1
- package/dist/src/goals/goal-queue-types.d.ts +4 -3
- package/dist/src/goals/goal-runner.js +25 -3
- package/dist/src/goals/goal-runner.js.map +1 -1
- package/dist/src/goals/goal-service.d.ts +6 -1
- package/dist/src/goals/goal-service.js +9 -2
- package/dist/src/goals/goal-service.js.map +1 -1
- package/dist/src/goals/goal-store.d.ts +7 -1
- package/dist/src/goals/goal-store.js +42 -0
- package/dist/src/goals/goal-store.js.map +1 -1
- package/dist/src/goals/types.d.ts +10 -0
- package/dist/src/notes/agent-context.js +2 -2
- package/dist/src/providers/index.d.ts +2 -2
- package/dist/src/providers/index.js +10 -14
- package/dist/src/providers/index.js.map +1 -1
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/session-workspace.js +7 -2
- package/dist/src/session/session-workspace.js.map +1 -1
- package/dist/src/session/store.js +5 -0
- package/dist/src/session/store.js.map +1 -1
- package/dist/src/session/thinking-resolve.d.ts +1 -1
- package/dist/src/session/thinking-resolve.js +1 -1
- package/dist/src/session/thinking-resolve.js.map +1 -1
- package/dist/src/storage/sqlite/connection.js +1 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -0
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +101 -0
- package/dist/src/storage/sqlite/memory-records-repository.js +309 -0
- package/dist/src/storage/sqlite/memory-records-repository.js.map +1 -0
- package/dist/src/storage/sqlite/migrations/011_goal_context_messages.sql +8 -0
- package/dist/src/storage/sqlite/migrations/012_memory_records.sql +63 -0
- package/dist/src/storage/sqlite/migrations/013_memory_trace_events.sql +21 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +2 -2
- package/dist/src/storage/sqlite/migrations/runner.js +4 -4
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +3 -3
- package/dist/src/storage/sqlite/schema.sql +95 -0
- package/dist/src/tui/backends/embedded-backend.js +6 -4
- package/dist/src/tui/backends/embedded-backend.js.map +1 -1
- package/dist/src/tui/extension-host/load-extensions.js.map +1 -1
- package/dist/src/voice/tts/openai-compatible-speech.d.ts +1 -1
- package/dist/src/voice/tts/openai-compatible-speech.js.map +1 -1
- package/dist/src/voice/tts/providers/edge-speech.js +14 -2
- package/dist/src/voice/tts/providers/edge-speech.js.map +1 -1
- package/dist/src/voice/tts/speak-core.js +3 -3
- package/dist/src/voice/tts/speak-core.js.map +1 -1
- package/dist/src/voice/tts/speech-provider-types.d.ts +2 -2
- package/dist/src/voice/tts/types.js +1 -1
- package/dist/src/voice/tts/types.js.map +1 -1
- package/dist/src/workflows/domain/result.d.ts +0 -1
- package/dist/src/workflows/engine/workflow-engine.js +7 -23
- package/dist/src/workflows/engine/workflow-engine.js.map +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +3 -4
- package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
- package/package.json +4 -3
- package/dist/gateway/static/root/assets/agent-browser-settings-page-DPXc4hz8.js +0 -6
- package/dist/gateway/static/root/assets/agent-defaults-tabbed-page-CTJ0YnRQ.js +0 -1
- package/dist/gateway/static/root/assets/agents-zJXQfJ_W.js +0 -71
- package/dist/gateway/static/root/assets/app-management-settings-panel-DzGbdr04.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-CPjfyzSD.js +0 -1
- package/dist/gateway/static/root/assets/config-api-NOoPiIYz.js +0 -3
- package/dist/gateway/static/root/assets/connectors-settings-CAXYMOdp.js +0 -2
- package/dist/gateway/static/root/assets/cron-api-C9BOqAXd.js +0 -1
- package/dist/gateway/static/root/assets/cron-page-DuUbBeKI.js +0 -3
- package/dist/gateway/static/root/assets/dreaming-settings-DQ4DtiK1.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-C-xjn__h.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BMPwIjKI.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-BJsyjJnF.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-BerDgIhw.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-ByTjeAto.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-TbHgcjTn.js +0 -1
- package/dist/gateway/static/root/assets/index-AkTrf6Pb.js +0 -122
- package/dist/gateway/static/root/assets/index-fh5sXTj9.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-DGXuPf5B.js +0 -2
- package/dist/gateway/static/root/assets/messages-upgxw6Ub.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-Bot16nn7.js +0 -2
- package/dist/gateway/static/root/assets/note-detail-page-Brlyou8M.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-DvZ4pwc-.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BZEDmxbZ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DdGGlsfn.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DlkEkPf9.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-DFPTrsPF.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CYCCfgh4.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bff1pGd0.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CJGKpBur.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-C6ocduTD.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-5jrIEr5b.js +0 -1
- package/dist/gateway/static/root/assets/use-agent-defaults-form-BuiXLIs5.js +0 -1
- package/dist/gateway/static/root/assets/use-settings-tab-guard-CW5JORnl.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DDoQyghO.js +0 -1
- package/dist/gateway/static/root/assets/workflow-page.utils-CKjeEGqx.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-B604ehHG.js +0 -18
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* - competitors: competitor names (optional)
|
|
10
10
|
* - focus: what you care most about (optional)
|
|
11
11
|
*/
|
|
12
|
-
export declare const COMPETITOR_SCAN_SCRIPT = "export const meta = {\n name: 'competitor_scan',\n description: 'Scan competitors in parallel and synthesize positioning, pricing, and differentiation opportunities.',\n whenToUse: 'Solo founder comparing alternatives before pricing, positioning, or go-to-market decisions.',\n examplePrompts: [\n { field: 'market', text: 'AI writing assistant for solo creators' },\n { field: 'competitors', text: 'Notion AI, Jasper, Cursor' },\n ],\n i18n: {\n zh: {\n description: '\u5E76\u884C\u626B\u63CF\u7ADE\u54C1\uFF0C\u7EFC\u5408\u5B9A\u4F4D\u3001\u5B9A\u4EF7\u4E0E\u5DEE\u5F02\u5316\u673A\u4F1A\u3002',\n whenToUse: '\u4E00\u4EBA\u516C\u53F8\u5728\u5B9A\u4EF7\u3001\u5B9A\u4F4D\u6216\u8FDB\u5165\u5E02\u573A\u524D\u9700\u8981\u7ADE\u54C1\u5BF9\u6BD4\u65F6\u3002',\n examplePrompts: [\n { field: 'market', text: '\u9762\u5411\u72EC\u7ACB\u521B\u4F5C\u8005\u7684 AI \u5199\u4F5C\u52A9\u624B' },\n { field: 'competitors', text: 'Notion AI\u3001Jasper\u3001Cursor' },\n ],\n },\n },\n tags: ['research', 'investigation'],\n estimatedAgents: { min: 4, max: 7 },\n phases: [\n { title: 'Frame' },\n { title: 'Scan' },\n { title: 'Synthesize' },\n ],\n}\n\nconst RESEARCH_TOOLS = ['web_search', 'web_fetch']\n\nconst market = args && typeof args === 'object' && args.market\n ? String(args.market)\n : 'Infer the market from the most recent user turn.'\n\nconst competitorsRaw = args && typeof args === 'object' && args.competitors\n ? String(args.competitors)\n : ''\n\nconst focus = args && typeof args === 'object' && args.focus\n ? String(args.focus)\n : 'positioning and pricing'\n\nphase('Frame')\nconst frame = await agent(\n 'Frame this competitor scan. If competitors are not listed, propose 3\u20134 realistic competitors. Return scan criteria and your assumed buyer persona.\\n\\n' +\n 'MARKET:\\n' + market + '\\n' +\n (competitorsRaw ? 'COMPETITORS:\\n' + competitorsRaw + '\\n' : '') +\n 'FOCUS:\\n' + focus,\n {\n label: 'frame',\n toolset: RESEARCH_TOOLS,\n schema: {\n type: 'object',\n properties: {\n competitors: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n oneLiner: { type: 'string' },\n },\n required: ['name'],\n },\n },\n criteria: { type: 'array', items: { type: 'string' } },\n buyerPersona: { type: 'string' },\n },\n required: ['competitors', 'criteria'],\n },\n },\n)\n\nif (!frame || !frame.competitors?.length) {\n
|
|
12
|
+
export declare const COMPETITOR_SCAN_SCRIPT = "export const meta = {\n name: 'competitor_scan',\n description: 'Scan competitors in parallel and synthesize positioning, pricing, and differentiation opportunities.',\n whenToUse: 'Solo founder comparing alternatives before pricing, positioning, or go-to-market decisions.',\n examplePrompts: [\n { field: 'market', text: 'AI writing assistant for solo creators' },\n { field: 'competitors', text: 'Notion AI, Jasper, Cursor' },\n ],\n i18n: {\n zh: {\n description: '\u5E76\u884C\u626B\u63CF\u7ADE\u54C1\uFF0C\u7EFC\u5408\u5B9A\u4F4D\u3001\u5B9A\u4EF7\u4E0E\u5DEE\u5F02\u5316\u673A\u4F1A\u3002',\n whenToUse: '\u4E00\u4EBA\u516C\u53F8\u5728\u5B9A\u4EF7\u3001\u5B9A\u4F4D\u6216\u8FDB\u5165\u5E02\u573A\u524D\u9700\u8981\u7ADE\u54C1\u5BF9\u6BD4\u65F6\u3002',\n examplePrompts: [\n { field: 'market', text: '\u9762\u5411\u72EC\u7ACB\u521B\u4F5C\u8005\u7684 AI \u5199\u4F5C\u52A9\u624B' },\n { field: 'competitors', text: 'Notion AI\u3001Jasper\u3001Cursor' },\n ],\n },\n },\n tags: ['research', 'investigation'],\n estimatedAgents: { min: 4, max: 7 },\n phases: [\n { title: 'Frame' },\n { title: 'Scan' },\n { title: 'Synthesize' },\n ],\n}\n\nconst RESEARCH_TOOLS = ['web_search', 'web_fetch']\n\nconst market = args && typeof args === 'object' && args.market\n ? String(args.market)\n : 'Infer the market from the most recent user turn.'\n\nconst competitorsRaw = args && typeof args === 'object' && args.competitors\n ? String(args.competitors)\n : ''\n\nconst focus = args && typeof args === 'object' && args.focus\n ? String(args.focus)\n : 'positioning and pricing'\n\nphase('Frame')\nconst frame = await agent(\n 'Frame this competitor scan. If competitors are not listed, propose 3\u20134 realistic competitors. Return scan criteria and your assumed buyer persona.\\n\\n' +\n 'MARKET:\\n' + market + '\\n' +\n (competitorsRaw ? 'COMPETITORS:\\n' + competitorsRaw + '\\n' : '') +\n 'FOCUS:\\n' + focus,\n {\n label: 'frame',\n toolset: RESEARCH_TOOLS,\n schema: {\n type: 'object',\n properties: {\n competitors: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n oneLiner: { type: 'string' },\n },\n required: ['name'],\n },\n },\n criteria: { type: 'array', items: { type: 'string' } },\n buyerPersona: { type: 'string' },\n },\n required: ['competitors', 'criteria'],\n },\n },\n)\n\nif (!frame || !frame.competitors?.length) {\n const output = { ok: false, reason: 'framing failed', market }\n return {\n summary: output.reason,\n sections: [{ kind: 'json', title: 'Scan framing', value: output }],\n structuredOutput: output,\n }\n}\n\nconst competitors = frame.competitors.slice(0, 4)\n\nphase('Scan')\nconst scans = await parallel(\n competitors.map((c) => () =>\n agent(\n 'Research this competitor for a solo founder. Use web search. Return positioning, pricing model, strengths, weaknesses, and target customer \u2014 cite sources where possible.\\n\\n' +\n 'COMPETITOR: ' + c.name + '\\nMARKET: ' + market + '\\nFOCUS: ' + focus,\n {\n label: c.name,\n toolset: RESEARCH_TOOLS,\n maxIterations: 25,\n schema: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n positioning: { type: 'string' },\n pricing: { type: 'string' },\n strengths: { type: 'array', items: { type: 'string' } },\n weaknesses: { type: 'array', items: { type: 'string' } },\n targetCustomer: { type: 'string' },\n sources: { type: 'array', items: { type: 'string' } },\n },\n required: ['name', 'positioning', 'strengths', 'weaknesses'],\n },\n },\n ),\n ),\n)\n\nphase('Synthesize')\nconst synthesis = await agent(\n 'Synthesize a competitor matrix and differentiation playbook for a one-person company. Include whitespace opportunities, pricing band recommendation, and 3 positioning angles to test.\\n\\n' +\n JSON.stringify({ market, focus, frame, scans: scans.filter(Boolean) }, null, 2),\n {\n label: 'synthesis',\n schema: {\n type: 'object',\n properties: {\n matrixSummary: { type: 'string' },\n whitespace: { type: 'array', items: { type: 'string' } },\n pricingBand: { type: 'string' },\n positioningAngles: { type: 'array', items: { type: 'string' } },\n avoidCompetingOn: { type: 'array', items: { type: 'string' } },\n },\n required: ['matrixSummary', 'whitespace', 'positioningAngles'],\n },\n },\n)\n\nconst output = {\n ok: true,\n market,\n competitorCount: competitors.length,\n scans: scans.filter(Boolean),\n ...(synthesis ?? { matrixSummary: 'synthesis failed', whitespace: [], positioningAngles: [] }),\n}\nreturn {\n summary: output.matrixSummary,\n sections: [\n { kind: 'questions', title: 'Whitespace opportunities', items: output.whitespace },\n { kind: 'questions', title: 'Positioning angles', items: output.positioningAngles },\n { kind: 'json', title: 'Competitor scans', value: output.scans },\n ],\n structuredOutput: output,\n}\n";
|
|
@@ -83,7 +83,12 @@ const frame = await agent(
|
|
|
83
83
|
)
|
|
84
84
|
|
|
85
85
|
if (!frame || !frame.competitors?.length) {
|
|
86
|
-
|
|
86
|
+
const output = { ok: false, reason: 'framing failed', market }
|
|
87
|
+
return {
|
|
88
|
+
summary: output.reason,
|
|
89
|
+
sections: [{ kind: 'json', title: 'Scan framing', value: output }],
|
|
90
|
+
structuredOutput: output,
|
|
91
|
+
}
|
|
87
92
|
}
|
|
88
93
|
|
|
89
94
|
const competitors = frame.competitors.slice(0, 4)
|
|
@@ -136,13 +141,22 @@ const synthesis = await agent(
|
|
|
136
141
|
},
|
|
137
142
|
)
|
|
138
143
|
|
|
139
|
-
|
|
144
|
+
const output = {
|
|
140
145
|
ok: true,
|
|
141
146
|
market,
|
|
142
147
|
competitorCount: competitors.length,
|
|
143
148
|
scans: scans.filter(Boolean),
|
|
144
149
|
...(synthesis ?? { matrixSummary: 'synthesis failed', whitespace: [], positioningAngles: [] }),
|
|
145
150
|
}
|
|
151
|
+
return {
|
|
152
|
+
summary: output.matrixSummary,
|
|
153
|
+
sections: [
|
|
154
|
+
{ kind: 'questions', title: 'Whitespace opportunities', items: output.whitespace },
|
|
155
|
+
{ kind: 'questions', title: 'Positioning angles', items: output.positioningAngles },
|
|
156
|
+
{ kind: 'json', title: 'Competitor scans', value: output.scans },
|
|
157
|
+
],
|
|
158
|
+
structuredOutput: output,
|
|
159
|
+
}
|
|
146
160
|
`;
|
|
147
161
|
//#endregion
|
|
148
162
|
export { COMPETITOR_SCAN_SCRIPT };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"competitor-scan.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/competitor-scan.ts"],"sourcesContent":["/**\n * Built-in workflow: `competitor_scan`\n *\n * Parallel competitor scan for solopreneurs — positioning, pricing, strengths,\n * weaknesses, and differentiation opportunities.\n *\n * Args:\n * - market: what you are building or selling\n * - competitors: competitor names (optional)\n * - focus: what you care most about (optional)\n */\n\nexport const COMPETITOR_SCAN_SCRIPT = `export const meta = {\n name: 'competitor_scan',\n description: 'Scan competitors in parallel and synthesize positioning, pricing, and differentiation opportunities.',\n whenToUse: 'Solo founder comparing alternatives before pricing, positioning, or go-to-market decisions.',\n examplePrompts: [\n { field: 'market', text: 'AI writing assistant for solo creators' },\n { field: 'competitors', text: 'Notion AI, Jasper, Cursor' },\n ],\n i18n: {\n zh: {\n description: '并行扫描竞品,综合定位、定价与差异化机会。',\n whenToUse: '一人公司在定价、定位或进入市场前需要竞品对比时。',\n examplePrompts: [\n { field: 'market', text: '面向独立创作者的 AI 写作助手' },\n { field: 'competitors', text: 'Notion AI、Jasper、Cursor' },\n ],\n },\n },\n tags: ['research', 'investigation'],\n estimatedAgents: { min: 4, max: 7 },\n phases: [\n { title: 'Frame' },\n { title: 'Scan' },\n { title: 'Synthesize' },\n ],\n}\n\nconst RESEARCH_TOOLS = ['web_search', 'web_fetch']\n\nconst market = args && typeof args === 'object' && args.market\n ? String(args.market)\n : 'Infer the market from the most recent user turn.'\n\nconst competitorsRaw = args && typeof args === 'object' && args.competitors\n ? String(args.competitors)\n : ''\n\nconst focus = args && typeof args === 'object' && args.focus\n ? String(args.focus)\n : 'positioning and pricing'\n\nphase('Frame')\nconst frame = await agent(\n 'Frame this competitor scan. If competitors are not listed, propose 3–4 realistic competitors. Return scan criteria and your assumed buyer persona.\\\\n\\\\n' +\n 'MARKET:\\\\n' + market + '\\\\n' +\n (competitorsRaw ? 'COMPETITORS:\\\\n' + competitorsRaw + '\\\\n' : '') +\n 'FOCUS:\\\\n' + focus,\n {\n label: 'frame',\n toolset: RESEARCH_TOOLS,\n schema: {\n type: 'object',\n properties: {\n competitors: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n oneLiner: { type: 'string' },\n },\n required: ['name'],\n },\n },\n criteria: { type: 'array', items: { type: 'string' } },\n buyerPersona: { type: 'string' },\n },\n required: ['competitors', 'criteria'],\n },\n },\n)\n\nif (!frame || !frame.competitors?.length) {\n
|
|
1
|
+
{"version":3,"file":"competitor-scan.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/competitor-scan.ts"],"sourcesContent":["/**\n * Built-in workflow: `competitor_scan`\n *\n * Parallel competitor scan for solopreneurs — positioning, pricing, strengths,\n * weaknesses, and differentiation opportunities.\n *\n * Args:\n * - market: what you are building or selling\n * - competitors: competitor names (optional)\n * - focus: what you care most about (optional)\n */\n\nexport const COMPETITOR_SCAN_SCRIPT = `export const meta = {\n name: 'competitor_scan',\n description: 'Scan competitors in parallel and synthesize positioning, pricing, and differentiation opportunities.',\n whenToUse: 'Solo founder comparing alternatives before pricing, positioning, or go-to-market decisions.',\n examplePrompts: [\n { field: 'market', text: 'AI writing assistant for solo creators' },\n { field: 'competitors', text: 'Notion AI, Jasper, Cursor' },\n ],\n i18n: {\n zh: {\n description: '并行扫描竞品,综合定位、定价与差异化机会。',\n whenToUse: '一人公司在定价、定位或进入市场前需要竞品对比时。',\n examplePrompts: [\n { field: 'market', text: '面向独立创作者的 AI 写作助手' },\n { field: 'competitors', text: 'Notion AI、Jasper、Cursor' },\n ],\n },\n },\n tags: ['research', 'investigation'],\n estimatedAgents: { min: 4, max: 7 },\n phases: [\n { title: 'Frame' },\n { title: 'Scan' },\n { title: 'Synthesize' },\n ],\n}\n\nconst RESEARCH_TOOLS = ['web_search', 'web_fetch']\n\nconst market = args && typeof args === 'object' && args.market\n ? String(args.market)\n : 'Infer the market from the most recent user turn.'\n\nconst competitorsRaw = args && typeof args === 'object' && args.competitors\n ? String(args.competitors)\n : ''\n\nconst focus = args && typeof args === 'object' && args.focus\n ? String(args.focus)\n : 'positioning and pricing'\n\nphase('Frame')\nconst frame = await agent(\n 'Frame this competitor scan. If competitors are not listed, propose 3–4 realistic competitors. Return scan criteria and your assumed buyer persona.\\\\n\\\\n' +\n 'MARKET:\\\\n' + market + '\\\\n' +\n (competitorsRaw ? 'COMPETITORS:\\\\n' + competitorsRaw + '\\\\n' : '') +\n 'FOCUS:\\\\n' + focus,\n {\n label: 'frame',\n toolset: RESEARCH_TOOLS,\n schema: {\n type: 'object',\n properties: {\n competitors: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n oneLiner: { type: 'string' },\n },\n required: ['name'],\n },\n },\n criteria: { type: 'array', items: { type: 'string' } },\n buyerPersona: { type: 'string' },\n },\n required: ['competitors', 'criteria'],\n },\n },\n)\n\nif (!frame || !frame.competitors?.length) {\n const output = { ok: false, reason: 'framing failed', market }\n return {\n summary: output.reason,\n sections: [{ kind: 'json', title: 'Scan framing', value: output }],\n structuredOutput: output,\n }\n}\n\nconst competitors = frame.competitors.slice(0, 4)\n\nphase('Scan')\nconst scans = await parallel(\n competitors.map((c) => () =>\n agent(\n 'Research this competitor for a solo founder. Use web search. Return positioning, pricing model, strengths, weaknesses, and target customer — cite sources where possible.\\\\n\\\\n' +\n 'COMPETITOR: ' + c.name + '\\\\nMARKET: ' + market + '\\\\nFOCUS: ' + focus,\n {\n label: c.name,\n toolset: RESEARCH_TOOLS,\n maxIterations: 25,\n schema: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n positioning: { type: 'string' },\n pricing: { type: 'string' },\n strengths: { type: 'array', items: { type: 'string' } },\n weaknesses: { type: 'array', items: { type: 'string' } },\n targetCustomer: { type: 'string' },\n sources: { type: 'array', items: { type: 'string' } },\n },\n required: ['name', 'positioning', 'strengths', 'weaknesses'],\n },\n },\n ),\n ),\n)\n\nphase('Synthesize')\nconst synthesis = await agent(\n 'Synthesize a competitor matrix and differentiation playbook for a one-person company. Include whitespace opportunities, pricing band recommendation, and 3 positioning angles to test.\\\\n\\\\n' +\n JSON.stringify({ market, focus, frame, scans: scans.filter(Boolean) }, null, 2),\n {\n label: 'synthesis',\n schema: {\n type: 'object',\n properties: {\n matrixSummary: { type: 'string' },\n whitespace: { type: 'array', items: { type: 'string' } },\n pricingBand: { type: 'string' },\n positioningAngles: { type: 'array', items: { type: 'string' } },\n avoidCompetingOn: { type: 'array', items: { type: 'string' } },\n },\n required: ['matrixSummary', 'whitespace', 'positioningAngles'],\n },\n },\n)\n\nconst output = {\n ok: true,\n market,\n competitorCount: competitors.length,\n scans: scans.filter(Boolean),\n ...(synthesis ?? { matrixSummary: 'synthesis failed', whitespace: [], positioningAngles: [] }),\n}\nreturn {\n summary: output.matrixSummary,\n sections: [\n { kind: 'questions', title: 'Whitespace opportunities', items: output.whitespace },\n { kind: 'questions', title: 'Positioning angles', items: output.positioningAngles },\n { kind: 'json', title: 'Competitor scans', value: output.scans },\n ],\n structuredOutput: output,\n}\n`\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,yBAAyB"}
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
* - audience: who will read it (optional)
|
|
11
11
|
* - format: email | post | announcement | document | message (optional)
|
|
12
12
|
*/
|
|
13
|
-
export declare const CONTENT_DRAFT_SCRIPT = "export const meta = {\n name: 'content_draft',\n description: 'Draft polished content from multiple tone and audience angles, then synthesize the best version.',\n whenToUse: 'User needs help writing an email, post, announcement, doc section, or message \u2014 not code.',\n examplePrompts: [\n { field: 'topic', text: 'Write a product launch announcement for our mobile app update' },\n { field: 'topic', text: 'Draft a polite follow-up email after a missed meeting' },\n ],\n i18n: {\n zh: {\n description: '\u4ECE\u591A\u4E2A\u8BED\u6C14\u4E0E\u53D7\u4F17\u89D2\u5EA6\u8D77\u8349\u5185\u5BB9\uFF0C\u5E76\u7EFC\u5408\u4EA7\u51FA\u6700\u4F73\u7248\u672C\u3002',\n whenToUse: '\u7528\u6237\u9700\u8981\u5199\u90AE\u4EF6\u3001\u5E16\u5B50\u3001\u516C\u544A\u3001\u6587\u6863\u6BB5\u843D\u6216\u6D88\u606F\u7B49\u975E\u4EE3\u7801\u5185\u5BB9\u65F6\u3002',\n examplePrompts: [\n { field: 'topic', text: '\u5199\u4E00\u4EFD\u79FB\u52A8\u7AEF\u5E94\u7528\u66F4\u65B0\u7684\u4EA7\u54C1\u53D1\u5E03\u516C\u544A' },\n { field: 'topic', text: '\u8D77\u8349\u4E00\u5C01\u9519\u8FC7\u4F1A\u8BAE\u540E\u7684\u793C\u8C8C\u8DDF\u8FDB\u90AE\u4EF6' },\n ],\n },\n },\n tags: ['writing', 'content', 'communication'],\n estimatedAgents: { min: 4, max: 6 },\n phases: [\n { title: 'Brief' },\n { title: 'Angles' },\n { title: 'Draft' },\n ],\n}\n\nconst topic = args && typeof args === 'object' && args.topic\n ? String(args.topic)\n : 'Infer the writing topic from the most recent user turn.'\n\nconst audience = args && typeof args === 'object' && args.audience\n ? String(args.audience)\n : 'general professional audience'\n\nconst format = args && typeof args === 'object' && args.format\n ? String(args.format)\n : 'document'\n\nphase('Brief')\nconst brief = await agent(\n 'Clarify this writing brief. Return the core message, constraints, tone guidance, and 3 distinct angles worth exploring (each with a hook and key point).\\n\\n' +\n 'TOPIC:\\n' + topic + '\\nAUDIENCE:\\n' + audience + '\\nFORMAT:\\n' + format,\n {\n label: 'brief',\n schema: {\n type: 'object',\n properties: {\n coreMessage: { type: 'string' },\n tone: { type: 'string' },\n constraints: { type: 'array', items: { type: 'string' } },\n angles: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n hook: { type: 'string' },\n keyPoint: { type: 'string' },\n },\n required: ['title', 'hook', 'keyPoint'],\n },\n },\n },\n required: ['coreMessage', 'angles'],\n },\n },\n)\n\nif (!brief || !brief.angles?.length) {\n
|
|
13
|
+
export declare const CONTENT_DRAFT_SCRIPT = "export const meta = {\n name: 'content_draft',\n description: 'Draft polished content from multiple tone and audience angles, then synthesize the best version.',\n whenToUse: 'User needs help writing an email, post, announcement, doc section, or message \u2014 not code.',\n examplePrompts: [\n { field: 'topic', text: 'Write a product launch announcement for our mobile app update' },\n { field: 'topic', text: 'Draft a polite follow-up email after a missed meeting' },\n ],\n i18n: {\n zh: {\n description: '\u4ECE\u591A\u4E2A\u8BED\u6C14\u4E0E\u53D7\u4F17\u89D2\u5EA6\u8D77\u8349\u5185\u5BB9\uFF0C\u5E76\u7EFC\u5408\u4EA7\u51FA\u6700\u4F73\u7248\u672C\u3002',\n whenToUse: '\u7528\u6237\u9700\u8981\u5199\u90AE\u4EF6\u3001\u5E16\u5B50\u3001\u516C\u544A\u3001\u6587\u6863\u6BB5\u843D\u6216\u6D88\u606F\u7B49\u975E\u4EE3\u7801\u5185\u5BB9\u65F6\u3002',\n examplePrompts: [\n { field: 'topic', text: '\u5199\u4E00\u4EFD\u79FB\u52A8\u7AEF\u5E94\u7528\u66F4\u65B0\u7684\u4EA7\u54C1\u53D1\u5E03\u516C\u544A' },\n { field: 'topic', text: '\u8D77\u8349\u4E00\u5C01\u9519\u8FC7\u4F1A\u8BAE\u540E\u7684\u793C\u8C8C\u8DDF\u8FDB\u90AE\u4EF6' },\n ],\n },\n },\n tags: ['writing', 'content', 'communication'],\n estimatedAgents: { min: 4, max: 6 },\n phases: [\n { title: 'Brief' },\n { title: 'Angles' },\n { title: 'Draft' },\n ],\n}\n\nconst topic = args && typeof args === 'object' && args.topic\n ? String(args.topic)\n : 'Infer the writing topic from the most recent user turn.'\n\nconst audience = args && typeof args === 'object' && args.audience\n ? String(args.audience)\n : 'general professional audience'\n\nconst format = args && typeof args === 'object' && args.format\n ? String(args.format)\n : 'document'\n\nphase('Brief')\nconst brief = await agent(\n 'Clarify this writing brief. Return the core message, constraints, tone guidance, and 3 distinct angles worth exploring (each with a hook and key point).\\n\\n' +\n 'TOPIC:\\n' + topic + '\\nAUDIENCE:\\n' + audience + '\\nFORMAT:\\n' + format,\n {\n label: 'brief',\n schema: {\n type: 'object',\n properties: {\n coreMessage: { type: 'string' },\n tone: { type: 'string' },\n constraints: { type: 'array', items: { type: 'string' } },\n angles: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n hook: { type: 'string' },\n keyPoint: { type: 'string' },\n },\n required: ['title', 'hook', 'keyPoint'],\n },\n },\n },\n required: ['coreMessage', 'angles'],\n },\n },\n)\n\nif (!brief || !brief.angles?.length) {\n const output = { ok: false, reason: 'briefing failed', topic, audience, format }\n return {\n summary: output.reason,\n sections: [{ kind: 'json', title: 'Draft briefing', value: output }],\n structuredOutput: output,\n }\n}\n\nconst angles = brief.angles.slice(0, 3)\n\nphase('Angles')\nconst angleDrafts = await parallel(\n angles.map((a) => () =>\n agent(\n 'Write a complete draft for this angle. Match the requested format and audience. Keep it ready to send or publish with minimal edits.\\n\\n' +\n 'FORMAT: ' + format + '\\nAUDIENCE: ' + audience + '\\nCORE MESSAGE: ' + brief.coreMessage + '\\n' +\n 'ANGLE: ' + a.title + '\\nHOOK: ' + a.hook + '\\nKEY POINT: ' + a.keyPoint,\n {\n label: a.title,\n schema: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n body: { type: 'string' },\n subject: { type: 'string' },\n },\n required: ['title', 'body'],\n },\n },\n ),\n ),\n)\n\nphase('Draft')\nconst live = angleDrafts.filter(Boolean)\nconst finalDraft = await agent(\n 'Synthesize the best final draft from these angle-level versions. Pick the strongest hook and structure, merge the best lines, and remove redundancy. ' +\n 'Return the polished draft plus a one-line rationale and two optional shorter variants (e.g. social / SMS length).\\n\\n' +\n JSON.stringify({ brief, drafts: live }, null, 2),\n {\n label: 'final draft',\n schema: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n subject: { type: 'string' },\n body: { type: 'string' },\n rationale: { type: 'string' },\n shortVariants: { type: 'array', items: { type: 'string' } },\n },\n required: ['body', 'rationale'],\n },\n },\n)\n\nconst output = {\n ok: true,\n topic,\n audience,\n format,\n angleCount: angles.length,\n ...(finalDraft ?? { body: 'draft synthesis failed', rationale: '' }),\n}\nreturn {\n summary: output.rationale || output.title || 'Draft complete.',\n sections: [\n { kind: 'text', title: output.title ?? 'Draft', content: output.body },\n { kind: 'questions', title: 'Short variants', items: output.shortVariants ?? [] },\n ],\n structuredOutput: output,\n}\n";
|
|
@@ -81,7 +81,12 @@ const brief = await agent(
|
|
|
81
81
|
)
|
|
82
82
|
|
|
83
83
|
if (!brief || !brief.angles?.length) {
|
|
84
|
-
|
|
84
|
+
const output = { ok: false, reason: 'briefing failed', topic, audience, format }
|
|
85
|
+
return {
|
|
86
|
+
summary: output.reason,
|
|
87
|
+
sections: [{ kind: 'json', title: 'Draft briefing', value: output }],
|
|
88
|
+
structuredOutput: output,
|
|
89
|
+
}
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
const angles = brief.angles.slice(0, 3)
|
|
@@ -131,7 +136,7 @@ const finalDraft = await agent(
|
|
|
131
136
|
},
|
|
132
137
|
)
|
|
133
138
|
|
|
134
|
-
|
|
139
|
+
const output = {
|
|
135
140
|
ok: true,
|
|
136
141
|
topic,
|
|
137
142
|
audience,
|
|
@@ -139,6 +144,14 @@ return {
|
|
|
139
144
|
angleCount: angles.length,
|
|
140
145
|
...(finalDraft ?? { body: 'draft synthesis failed', rationale: '' }),
|
|
141
146
|
}
|
|
147
|
+
return {
|
|
148
|
+
summary: output.rationale || output.title || 'Draft complete.',
|
|
149
|
+
sections: [
|
|
150
|
+
{ kind: 'text', title: output.title ?? 'Draft', content: output.body },
|
|
151
|
+
{ kind: 'questions', title: 'Short variants', items: output.shortVariants ?? [] },
|
|
152
|
+
],
|
|
153
|
+
structuredOutput: output,
|
|
154
|
+
}
|
|
142
155
|
`;
|
|
143
156
|
//#endregion
|
|
144
157
|
export { CONTENT_DRAFT_SCRIPT };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-draft.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/content-draft.ts"],"sourcesContent":["/**\n * Built-in workflow: `content_draft`\n *\n * Multi-angle content drafting for non-code writing tasks — emails, posts,\n * announcements, docs, or messages. Fans out tone/audience angles in parallel,\n * then synthesizes a polished draft with variants.\n *\n * Args:\n * - topic: what to write about\n * - audience: who will read it (optional)\n * - format: email | post | announcement | document | message (optional)\n */\n\nexport const CONTENT_DRAFT_SCRIPT = `export const meta = {\n name: 'content_draft',\n description: 'Draft polished content from multiple tone and audience angles, then synthesize the best version.',\n whenToUse: 'User needs help writing an email, post, announcement, doc section, or message — not code.',\n examplePrompts: [\n { field: 'topic', text: 'Write a product launch announcement for our mobile app update' },\n { field: 'topic', text: 'Draft a polite follow-up email after a missed meeting' },\n ],\n i18n: {\n zh: {\n description: '从多个语气与受众角度起草内容,并综合产出最佳版本。',\n whenToUse: '用户需要写邮件、帖子、公告、文档段落或消息等非代码内容时。',\n examplePrompts: [\n { field: 'topic', text: '写一份移动端应用更新的产品发布公告' },\n { field: 'topic', text: '起草一封错过会议后的礼貌跟进邮件' },\n ],\n },\n },\n tags: ['writing', 'content', 'communication'],\n estimatedAgents: { min: 4, max: 6 },\n phases: [\n { title: 'Brief' },\n { title: 'Angles' },\n { title: 'Draft' },\n ],\n}\n\nconst topic = args && typeof args === 'object' && args.topic\n ? String(args.topic)\n : 'Infer the writing topic from the most recent user turn.'\n\nconst audience = args && typeof args === 'object' && args.audience\n ? String(args.audience)\n : 'general professional audience'\n\nconst format = args && typeof args === 'object' && args.format\n ? String(args.format)\n : 'document'\n\nphase('Brief')\nconst brief = await agent(\n 'Clarify this writing brief. Return the core message, constraints, tone guidance, and 3 distinct angles worth exploring (each with a hook and key point).\\\\n\\\\n' +\n 'TOPIC:\\\\n' + topic + '\\\\nAUDIENCE:\\\\n' + audience + '\\\\nFORMAT:\\\\n' + format,\n {\n label: 'brief',\n schema: {\n type: 'object',\n properties: {\n coreMessage: { type: 'string' },\n tone: { type: 'string' },\n constraints: { type: 'array', items: { type: 'string' } },\n angles: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n hook: { type: 'string' },\n keyPoint: { type: 'string' },\n },\n required: ['title', 'hook', 'keyPoint'],\n },\n },\n },\n required: ['coreMessage', 'angles'],\n },\n },\n)\n\nif (!brief || !brief.angles?.length) {\n
|
|
1
|
+
{"version":3,"file":"content-draft.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/content-draft.ts"],"sourcesContent":["/**\n * Built-in workflow: `content_draft`\n *\n * Multi-angle content drafting for non-code writing tasks — emails, posts,\n * announcements, docs, or messages. Fans out tone/audience angles in parallel,\n * then synthesizes a polished draft with variants.\n *\n * Args:\n * - topic: what to write about\n * - audience: who will read it (optional)\n * - format: email | post | announcement | document | message (optional)\n */\n\nexport const CONTENT_DRAFT_SCRIPT = `export const meta = {\n name: 'content_draft',\n description: 'Draft polished content from multiple tone and audience angles, then synthesize the best version.',\n whenToUse: 'User needs help writing an email, post, announcement, doc section, or message — not code.',\n examplePrompts: [\n { field: 'topic', text: 'Write a product launch announcement for our mobile app update' },\n { field: 'topic', text: 'Draft a polite follow-up email after a missed meeting' },\n ],\n i18n: {\n zh: {\n description: '从多个语气与受众角度起草内容,并综合产出最佳版本。',\n whenToUse: '用户需要写邮件、帖子、公告、文档段落或消息等非代码内容时。',\n examplePrompts: [\n { field: 'topic', text: '写一份移动端应用更新的产品发布公告' },\n { field: 'topic', text: '起草一封错过会议后的礼貌跟进邮件' },\n ],\n },\n },\n tags: ['writing', 'content', 'communication'],\n estimatedAgents: { min: 4, max: 6 },\n phases: [\n { title: 'Brief' },\n { title: 'Angles' },\n { title: 'Draft' },\n ],\n}\n\nconst topic = args && typeof args === 'object' && args.topic\n ? String(args.topic)\n : 'Infer the writing topic from the most recent user turn.'\n\nconst audience = args && typeof args === 'object' && args.audience\n ? String(args.audience)\n : 'general professional audience'\n\nconst format = args && typeof args === 'object' && args.format\n ? String(args.format)\n : 'document'\n\nphase('Brief')\nconst brief = await agent(\n 'Clarify this writing brief. Return the core message, constraints, tone guidance, and 3 distinct angles worth exploring (each with a hook and key point).\\\\n\\\\n' +\n 'TOPIC:\\\\n' + topic + '\\\\nAUDIENCE:\\\\n' + audience + '\\\\nFORMAT:\\\\n' + format,\n {\n label: 'brief',\n schema: {\n type: 'object',\n properties: {\n coreMessage: { type: 'string' },\n tone: { type: 'string' },\n constraints: { type: 'array', items: { type: 'string' } },\n angles: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n hook: { type: 'string' },\n keyPoint: { type: 'string' },\n },\n required: ['title', 'hook', 'keyPoint'],\n },\n },\n },\n required: ['coreMessage', 'angles'],\n },\n },\n)\n\nif (!brief || !brief.angles?.length) {\n const output = { ok: false, reason: 'briefing failed', topic, audience, format }\n return {\n summary: output.reason,\n sections: [{ kind: 'json', title: 'Draft briefing', value: output }],\n structuredOutput: output,\n }\n}\n\nconst angles = brief.angles.slice(0, 3)\n\nphase('Angles')\nconst angleDrafts = await parallel(\n angles.map((a) => () =>\n agent(\n 'Write a complete draft for this angle. Match the requested format and audience. Keep it ready to send or publish with minimal edits.\\\\n\\\\n' +\n 'FORMAT: ' + format + '\\\\nAUDIENCE: ' + audience + '\\\\nCORE MESSAGE: ' + brief.coreMessage + '\\\\n' +\n 'ANGLE: ' + a.title + '\\\\nHOOK: ' + a.hook + '\\\\nKEY POINT: ' + a.keyPoint,\n {\n label: a.title,\n schema: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n body: { type: 'string' },\n subject: { type: 'string' },\n },\n required: ['title', 'body'],\n },\n },\n ),\n ),\n)\n\nphase('Draft')\nconst live = angleDrafts.filter(Boolean)\nconst finalDraft = await agent(\n 'Synthesize the best final draft from these angle-level versions. Pick the strongest hook and structure, merge the best lines, and remove redundancy. ' +\n 'Return the polished draft plus a one-line rationale and two optional shorter variants (e.g. social / SMS length).\\\\n\\\\n' +\n JSON.stringify({ brief, drafts: live }, null, 2),\n {\n label: 'final draft',\n schema: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n subject: { type: 'string' },\n body: { type: 'string' },\n rationale: { type: 'string' },\n shortVariants: { type: 'array', items: { type: 'string' } },\n },\n required: ['body', 'rationale'],\n },\n },\n)\n\nconst output = {\n ok: true,\n topic,\n audience,\n format,\n angleCount: angles.length,\n ...(finalDraft ?? { body: 'draft synthesis failed', rationale: '' }),\n}\nreturn {\n summary: output.rationale || output.title || 'Draft complete.',\n sections: [\n { kind: 'text', title: output.title ?? 'Draft', content: output.body },\n { kind: 'questions', title: 'Short variants', items: output.shortVariants ?? [] },\n ],\n structuredOutput: output,\n}\n`\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,uBAAuB"}
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* - source: original article, notes, or talking points
|
|
9
9
|
* - platforms: target platforms (optional)
|
|
10
10
|
*/
|
|
11
|
-
export declare const CONTENT_REPURPOSE_SCRIPT = "export const meta = {\n name: 'content_repurpose',\n description: 'Repurpose one source into platform-specific content (threads, posts, scripts, newsletter).',\n whenToUse: 'User has existing content and wants multi-platform distribution without rewriting from scratch.',\n examplePrompts: [\n { field: 'source', text: '2000-word blog post on building a one-person AI business' },\n { field: 'platforms', text: 'X thread, LinkedIn, 60s video script, newsletter teaser' },\n ],\n i18n: {\n zh: {\n description: '\u5C06\u4E00\u4EFD\u6838\u5FC3\u5185\u5BB9\u6539\u7F16\u4E3A\u591A\u5E73\u53F0\u683C\u5F0F\uFF08\u63A8\u6587\u4E32\u3001\u9886\u82F1\u5E16\u3001\u77ED\u89C6\u9891\u811A\u672C\u3001Newsletter \u6458\u8981\uFF09\u3002',\n whenToUse: '\u7528\u6237\u5DF2\u6709\u5185\u5BB9\u7D20\u6750\uFF0C\u9700\u8981\u4E00\u6E90\u591A\u7528\u3001\u591A\u5E73\u53F0\u5206\u53D1\u65F6\u3002',\n examplePrompts: [\n { field: 'source', text: '\u4E00\u7BC7 2000 \u5B57\u5173\u4E8E\u4E00\u4EBA AI \u516C\u53F8\u7684\u535A\u5BA2' },\n { field: 'platforms', text: 'X \u63A8\u6587\u4E32\u3001LinkedIn\u300160 \u79D2\u53E3\u64AD\u7A3F\u3001Newsletter \u5BFC\u8BED' },\n ],\n },\n },\n tags: ['writing', 'content'],\n estimatedAgents: { min: 4, max: 6 },\n phases: [\n { title: 'Extract' },\n { title: 'Adapt' },\n { title: 'Package' },\n ],\n}\n\nconst source = args && typeof args === 'object' && args.source\n ? String(args.source)\n : 'Infer the source content from the most recent user turn.'\n\nconst platformsRaw = args && typeof args === 'object' && args.platforms\n ? String(args.platforms)\n : ''\n\nconst DEFAULT_PLATFORMS = [\n { id: 'x_thread', label: 'X / Twitter thread', format: '5\u20138 tweets, hook-first, one idea per tweet' },\n { id: 'linkedin', label: 'LinkedIn post', format: 'Professional post, 150\u2013250 words, clear CTA' },\n { id: 'short_video', label: 'Short video script', format: '60-second spoken script with hook and CTA' },\n { id: 'newsletter', label: 'Newsletter teaser', format: 'Subject line + 2\u20133 sentence teaser + bullet highlights' },\n]\n\nphase('Extract')\nconst extracted = await agent(\n 'Extract reusable content atoms from this source: core thesis, 3\u20135 key points, best quotes/stats, audience hook, and CTA.\\n\\nSOURCE:\\n' + source,\n {\n label: 'extract',\n schema: {\n type: 'object',\n properties: {\n thesis: { type: 'string' },\n keyPoints: { type: 'array', items: { type: 'string' } },\n hooks: { type: 'array', items: { type: 'string' } },\n quotesOrStats: { type: 'array', items: { type: 'string' } },\n cta: { type: 'string' },\n },\n required: ['thesis', 'keyPoints', 'cta'],\n },\n },\n)\n\nconst targets = platformsRaw\n ? platformsRaw\n .split(/[,\uFF0C\\n]/)\n .map((s) => s.trim())\n .filter(Boolean)\n .map((label, index) => ({\n id: 'custom_' + index,\n label,\n format: 'Native format and length for ' + label,\n }))\n : DEFAULT_PLATFORMS\n\nphase('Adapt')\nconst adaptations = await parallel(\n targets.map((p) => () =>\n agent(\n 'Adapt the extracted content for this platform. Match native tone and length. Return ready-to-publish copy.\\n\\n' +\n 'PLATFORM: ' + p.label + '\\nFORMAT: ' + p.format + '\\n\\n' +\n JSON.stringify(extracted, null, 2),\n {\n label: p.label,\n schema: {\n type: 'object',\n properties: {\n platform: { type: 'string' },\n copy: { type: 'string' },\n notes: { type: 'string' },\n },\n required: ['platform', 'copy'],\n },\n },\n ),\n ),\n)\n\nphase('Package')\nconst packaged = await agent(\n 'Package all platform adaptations with a publishing checklist: suggested order, cross-links between posts, and one optional bonus format (e.g. carousel outline).\\n\\n' +\n JSON.stringify({ extracted, adaptations: adaptations.filter(Boolean) }, null, 2),\n {\n label: 'package',\n schema: {\n type: 'object',\n properties: {\n publishingOrder: { type: 'array', items: { type: 'string' } },\n crossLinks: { type: 'array', items: { type: 'string' } },\n bonusFormat: { type: 'string' },\n summary: { type: 'string' },\n },\n required: ['publishingOrder', 'summary'],\n },\n },\n)\n\
|
|
11
|
+
export declare const CONTENT_REPURPOSE_SCRIPT = "export const meta = {\n name: 'content_repurpose',\n description: 'Repurpose one source into platform-specific content (threads, posts, scripts, newsletter).',\n whenToUse: 'User has existing content and wants multi-platform distribution without rewriting from scratch.',\n examplePrompts: [\n { field: 'source', text: '2000-word blog post on building a one-person AI business' },\n { field: 'platforms', text: 'X thread, LinkedIn, 60s video script, newsletter teaser' },\n ],\n i18n: {\n zh: {\n description: '\u5C06\u4E00\u4EFD\u6838\u5FC3\u5185\u5BB9\u6539\u7F16\u4E3A\u591A\u5E73\u53F0\u683C\u5F0F\uFF08\u63A8\u6587\u4E32\u3001\u9886\u82F1\u5E16\u3001\u77ED\u89C6\u9891\u811A\u672C\u3001Newsletter \u6458\u8981\uFF09\u3002',\n whenToUse: '\u7528\u6237\u5DF2\u6709\u5185\u5BB9\u7D20\u6750\uFF0C\u9700\u8981\u4E00\u6E90\u591A\u7528\u3001\u591A\u5E73\u53F0\u5206\u53D1\u65F6\u3002',\n examplePrompts: [\n { field: 'source', text: '\u4E00\u7BC7 2000 \u5B57\u5173\u4E8E\u4E00\u4EBA AI \u516C\u53F8\u7684\u535A\u5BA2' },\n { field: 'platforms', text: 'X \u63A8\u6587\u4E32\u3001LinkedIn\u300160 \u79D2\u53E3\u64AD\u7A3F\u3001Newsletter \u5BFC\u8BED' },\n ],\n },\n },\n tags: ['writing', 'content'],\n estimatedAgents: { min: 4, max: 6 },\n phases: [\n { title: 'Extract' },\n { title: 'Adapt' },\n { title: 'Package' },\n ],\n}\n\nconst source = args && typeof args === 'object' && args.source\n ? String(args.source)\n : 'Infer the source content from the most recent user turn.'\n\nconst platformsRaw = args && typeof args === 'object' && args.platforms\n ? String(args.platforms)\n : ''\n\nconst DEFAULT_PLATFORMS = [\n { id: 'x_thread', label: 'X / Twitter thread', format: '5\u20138 tweets, hook-first, one idea per tweet' },\n { id: 'linkedin', label: 'LinkedIn post', format: 'Professional post, 150\u2013250 words, clear CTA' },\n { id: 'short_video', label: 'Short video script', format: '60-second spoken script with hook and CTA' },\n { id: 'newsletter', label: 'Newsletter teaser', format: 'Subject line + 2\u20133 sentence teaser + bullet highlights' },\n]\n\nphase('Extract')\nconst extracted = await agent(\n 'Extract reusable content atoms from this source: core thesis, 3\u20135 key points, best quotes/stats, audience hook, and CTA.\\n\\nSOURCE:\\n' + source,\n {\n label: 'extract',\n schema: {\n type: 'object',\n properties: {\n thesis: { type: 'string' },\n keyPoints: { type: 'array', items: { type: 'string' } },\n hooks: { type: 'array', items: { type: 'string' } },\n quotesOrStats: { type: 'array', items: { type: 'string' } },\n cta: { type: 'string' },\n },\n required: ['thesis', 'keyPoints', 'cta'],\n },\n },\n)\n\nconst targets = platformsRaw\n ? platformsRaw\n .split(/[,\uFF0C\\n]/)\n .map((s) => s.trim())\n .filter(Boolean)\n .map((label, index) => ({\n id: 'custom_' + index,\n label,\n format: 'Native format and length for ' + label,\n }))\n : DEFAULT_PLATFORMS\n\nphase('Adapt')\nconst adaptations = await parallel(\n targets.map((p) => () =>\n agent(\n 'Adapt the extracted content for this platform. Match native tone and length. Return ready-to-publish copy.\\n\\n' +\n 'PLATFORM: ' + p.label + '\\nFORMAT: ' + p.format + '\\n\\n' +\n JSON.stringify(extracted, null, 2),\n {\n label: p.label,\n schema: {\n type: 'object',\n properties: {\n platform: { type: 'string' },\n copy: { type: 'string' },\n notes: { type: 'string' },\n },\n required: ['platform', 'copy'],\n },\n },\n ),\n ),\n)\n\nphase('Package')\nconst packaged = await agent(\n 'Package all platform adaptations with a publishing checklist: suggested order, cross-links between posts, and one optional bonus format (e.g. carousel outline).\\n\\n' +\n JSON.stringify({ extracted, adaptations: adaptations.filter(Boolean) }, null, 2),\n {\n label: 'package',\n schema: {\n type: 'object',\n properties: {\n publishingOrder: { type: 'array', items: { type: 'string' } },\n crossLinks: { type: 'array', items: { type: 'string' } },\n bonusFormat: { type: 'string' },\n summary: { type: 'string' },\n },\n required: ['publishingOrder', 'summary'],\n },\n },\n)\n\nconst output = {\n ok: true,\n extracted,\n adaptations: adaptations.filter(Boolean),\n ...(packaged ?? { publishingOrder: [], summary: 'packaging failed' }),\n}\nreturn {\n summary: output.summary,\n sections: [\n { kind: 'questions', title: 'Publishing order', items: output.publishingOrder },\n { kind: 'questions', title: 'Cross-links', items: output.crossLinks ?? [] },\n { kind: 'json', title: 'Adaptations', value: output.adaptations },\n ],\n structuredOutput: output,\n}\n";
|
|
@@ -124,12 +124,21 @@ const packaged = await agent(
|
|
|
124
124
|
},
|
|
125
125
|
)
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
const output = {
|
|
128
128
|
ok: true,
|
|
129
129
|
extracted,
|
|
130
130
|
adaptations: adaptations.filter(Boolean),
|
|
131
131
|
...(packaged ?? { publishingOrder: [], summary: 'packaging failed' }),
|
|
132
132
|
}
|
|
133
|
+
return {
|
|
134
|
+
summary: output.summary,
|
|
135
|
+
sections: [
|
|
136
|
+
{ kind: 'questions', title: 'Publishing order', items: output.publishingOrder },
|
|
137
|
+
{ kind: 'questions', title: 'Cross-links', items: output.crossLinks ?? [] },
|
|
138
|
+
{ kind: 'json', title: 'Adaptations', value: output.adaptations },
|
|
139
|
+
],
|
|
140
|
+
structuredOutput: output,
|
|
141
|
+
}
|
|
133
142
|
`;
|
|
134
143
|
//#endregion
|
|
135
144
|
export { CONTENT_REPURPOSE_SCRIPT };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-repurpose.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/content-repurpose.ts"],"sourcesContent":["/**\n * Built-in workflow: `content_repurpose`\n *\n * Repurpose one source piece into multi-platform formats — threads, LinkedIn,\n * short video script, newsletter blurb. For personal-brand solopreneurs.\n *\n * Args:\n * - source: original article, notes, or talking points\n * - platforms: target platforms (optional)\n */\n\nexport const CONTENT_REPURPOSE_SCRIPT = `export const meta = {\n name: 'content_repurpose',\n description: 'Repurpose one source into platform-specific content (threads, posts, scripts, newsletter).',\n whenToUse: 'User has existing content and wants multi-platform distribution without rewriting from scratch.',\n examplePrompts: [\n { field: 'source', text: '2000-word blog post on building a one-person AI business' },\n { field: 'platforms', text: 'X thread, LinkedIn, 60s video script, newsletter teaser' },\n ],\n i18n: {\n zh: {\n description: '将一份核心内容改编为多平台格式(推文串、领英帖、短视频脚本、Newsletter 摘要)。',\n whenToUse: '用户已有内容素材,需要一源多用、多平台分发时。',\n examplePrompts: [\n { field: 'source', text: '一篇 2000 字关于一人 AI 公司的博客' },\n { field: 'platforms', text: 'X 推文串、LinkedIn、60 秒口播稿、Newsletter 导语' },\n ],\n },\n },\n tags: ['writing', 'content'],\n estimatedAgents: { min: 4, max: 6 },\n phases: [\n { title: 'Extract' },\n { title: 'Adapt' },\n { title: 'Package' },\n ],\n}\n\nconst source = args && typeof args === 'object' && args.source\n ? String(args.source)\n : 'Infer the source content from the most recent user turn.'\n\nconst platformsRaw = args && typeof args === 'object' && args.platforms\n ? String(args.platforms)\n : ''\n\nconst DEFAULT_PLATFORMS = [\n { id: 'x_thread', label: 'X / Twitter thread', format: '5–8 tweets, hook-first, one idea per tweet' },\n { id: 'linkedin', label: 'LinkedIn post', format: 'Professional post, 150–250 words, clear CTA' },\n { id: 'short_video', label: 'Short video script', format: '60-second spoken script with hook and CTA' },\n { id: 'newsletter', label: 'Newsletter teaser', format: 'Subject line + 2–3 sentence teaser + bullet highlights' },\n]\n\nphase('Extract')\nconst extracted = await agent(\n 'Extract reusable content atoms from this source: core thesis, 3–5 key points, best quotes/stats, audience hook, and CTA.\\\\n\\\\nSOURCE:\\\\n' + source,\n {\n label: 'extract',\n schema: {\n type: 'object',\n properties: {\n thesis: { type: 'string' },\n keyPoints: { type: 'array', items: { type: 'string' } },\n hooks: { type: 'array', items: { type: 'string' } },\n quotesOrStats: { type: 'array', items: { type: 'string' } },\n cta: { type: 'string' },\n },\n required: ['thesis', 'keyPoints', 'cta'],\n },\n },\n)\n\nconst targets = platformsRaw\n ? platformsRaw\n .split(/[,,\\\\n]/)\n .map((s) => s.trim())\n .filter(Boolean)\n .map((label, index) => ({\n id: 'custom_' + index,\n label,\n format: 'Native format and length for ' + label,\n }))\n : DEFAULT_PLATFORMS\n\nphase('Adapt')\nconst adaptations = await parallel(\n targets.map((p) => () =>\n agent(\n 'Adapt the extracted content for this platform. Match native tone and length. Return ready-to-publish copy.\\\\n\\\\n' +\n 'PLATFORM: ' + p.label + '\\\\nFORMAT: ' + p.format + '\\\\n\\\\n' +\n JSON.stringify(extracted, null, 2),\n {\n label: p.label,\n schema: {\n type: 'object',\n properties: {\n platform: { type: 'string' },\n copy: { type: 'string' },\n notes: { type: 'string' },\n },\n required: ['platform', 'copy'],\n },\n },\n ),\n ),\n)\n\nphase('Package')\nconst packaged = await agent(\n 'Package all platform adaptations with a publishing checklist: suggested order, cross-links between posts, and one optional bonus format (e.g. carousel outline).\\\\n\\\\n' +\n JSON.stringify({ extracted, adaptations: adaptations.filter(Boolean) }, null, 2),\n {\n label: 'package',\n schema: {\n type: 'object',\n properties: {\n publishingOrder: { type: 'array', items: { type: 'string' } },\n crossLinks: { type: 'array', items: { type: 'string' } },\n bonusFormat: { type: 'string' },\n summary: { type: 'string' },\n },\n required: ['publishingOrder', 'summary'],\n },\n },\n)\n\
|
|
1
|
+
{"version":3,"file":"content-repurpose.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/content-repurpose.ts"],"sourcesContent":["/**\n * Built-in workflow: `content_repurpose`\n *\n * Repurpose one source piece into multi-platform formats — threads, LinkedIn,\n * short video script, newsletter blurb. For personal-brand solopreneurs.\n *\n * Args:\n * - source: original article, notes, or talking points\n * - platforms: target platforms (optional)\n */\n\nexport const CONTENT_REPURPOSE_SCRIPT = `export const meta = {\n name: 'content_repurpose',\n description: 'Repurpose one source into platform-specific content (threads, posts, scripts, newsletter).',\n whenToUse: 'User has existing content and wants multi-platform distribution without rewriting from scratch.',\n examplePrompts: [\n { field: 'source', text: '2000-word blog post on building a one-person AI business' },\n { field: 'platforms', text: 'X thread, LinkedIn, 60s video script, newsletter teaser' },\n ],\n i18n: {\n zh: {\n description: '将一份核心内容改编为多平台格式(推文串、领英帖、短视频脚本、Newsletter 摘要)。',\n whenToUse: '用户已有内容素材,需要一源多用、多平台分发时。',\n examplePrompts: [\n { field: 'source', text: '一篇 2000 字关于一人 AI 公司的博客' },\n { field: 'platforms', text: 'X 推文串、LinkedIn、60 秒口播稿、Newsletter 导语' },\n ],\n },\n },\n tags: ['writing', 'content'],\n estimatedAgents: { min: 4, max: 6 },\n phases: [\n { title: 'Extract' },\n { title: 'Adapt' },\n { title: 'Package' },\n ],\n}\n\nconst source = args && typeof args === 'object' && args.source\n ? String(args.source)\n : 'Infer the source content from the most recent user turn.'\n\nconst platformsRaw = args && typeof args === 'object' && args.platforms\n ? String(args.platforms)\n : ''\n\nconst DEFAULT_PLATFORMS = [\n { id: 'x_thread', label: 'X / Twitter thread', format: '5–8 tweets, hook-first, one idea per tweet' },\n { id: 'linkedin', label: 'LinkedIn post', format: 'Professional post, 150–250 words, clear CTA' },\n { id: 'short_video', label: 'Short video script', format: '60-second spoken script with hook and CTA' },\n { id: 'newsletter', label: 'Newsletter teaser', format: 'Subject line + 2–3 sentence teaser + bullet highlights' },\n]\n\nphase('Extract')\nconst extracted = await agent(\n 'Extract reusable content atoms from this source: core thesis, 3–5 key points, best quotes/stats, audience hook, and CTA.\\\\n\\\\nSOURCE:\\\\n' + source,\n {\n label: 'extract',\n schema: {\n type: 'object',\n properties: {\n thesis: { type: 'string' },\n keyPoints: { type: 'array', items: { type: 'string' } },\n hooks: { type: 'array', items: { type: 'string' } },\n quotesOrStats: { type: 'array', items: { type: 'string' } },\n cta: { type: 'string' },\n },\n required: ['thesis', 'keyPoints', 'cta'],\n },\n },\n)\n\nconst targets = platformsRaw\n ? platformsRaw\n .split(/[,,\\\\n]/)\n .map((s) => s.trim())\n .filter(Boolean)\n .map((label, index) => ({\n id: 'custom_' + index,\n label,\n format: 'Native format and length for ' + label,\n }))\n : DEFAULT_PLATFORMS\n\nphase('Adapt')\nconst adaptations = await parallel(\n targets.map((p) => () =>\n agent(\n 'Adapt the extracted content for this platform. Match native tone and length. Return ready-to-publish copy.\\\\n\\\\n' +\n 'PLATFORM: ' + p.label + '\\\\nFORMAT: ' + p.format + '\\\\n\\\\n' +\n JSON.stringify(extracted, null, 2),\n {\n label: p.label,\n schema: {\n type: 'object',\n properties: {\n platform: { type: 'string' },\n copy: { type: 'string' },\n notes: { type: 'string' },\n },\n required: ['platform', 'copy'],\n },\n },\n ),\n ),\n)\n\nphase('Package')\nconst packaged = await agent(\n 'Package all platform adaptations with a publishing checklist: suggested order, cross-links between posts, and one optional bonus format (e.g. carousel outline).\\\\n\\\\n' +\n JSON.stringify({ extracted, adaptations: adaptations.filter(Boolean) }, null, 2),\n {\n label: 'package',\n schema: {\n type: 'object',\n properties: {\n publishingOrder: { type: 'array', items: { type: 'string' } },\n crossLinks: { type: 'array', items: { type: 'string' } },\n bonusFormat: { type: 'string' },\n summary: { type: 'string' },\n },\n required: ['publishingOrder', 'summary'],\n },\n },\n)\n\nconst output = {\n ok: true,\n extracted,\n adaptations: adaptations.filter(Boolean),\n ...(packaged ?? { publishingOrder: [], summary: 'packaging failed' }),\n}\nreturn {\n summary: output.summary,\n sections: [\n { kind: 'questions', title: 'Publishing order', items: output.publishingOrder },\n { kind: 'questions', title: 'Cross-links', items: output.crossLinks ?? [] },\n { kind: 'json', title: 'Adaptations', value: output.adaptations },\n ],\n structuredOutput: output,\n}\n`\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,2BAA2B"}
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
* - logs: optional log excerpt
|
|
11
11
|
* - context: optional extra context (what changed, when it started)
|
|
12
12
|
*/
|
|
13
|
-
export declare 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 examplePrompts: [\n { field: 'error', text: 'Triage this stack trace from production' },\n { field: 'error', text: 'Why does the gateway return 502 after deploy?' },\n ],\n i18n: {\n zh: {\n description: '\u5BF9\u9519\u8BEF\u6216\u65E5\u5FD7\u7247\u6BB5\u505A\u5E76\u884C\u5047\u8BBE\u63A8\u6F14\uFF0C\u5E76\u6392\u5E8F\u6839\u56E0\u4E0E\u9A8C\u8BC1\u6B65\u9AA4\u3002',\n whenToUse: '\u7528\u6237\u62A5\u544A bug\u3001\u5D29\u6E83\u3001\u62A5\u9519\u6216\u5F02\u5E38\u884C\u4E3A\uFF0C\u9700\u8981\u7CFB\u7EDF\u5316\u6392\u67E5\u65F6\u3002',\n examplePrompts: [\n { field: 'error', text: '\u6392\u67E5\u751F\u4EA7\u73AF\u5883\u8FD9\u6761\u5806\u6808' },\n { field: 'error', text: '\u90E8\u7F72\u540E\u7F51\u5173\u8FD4\u56DE 502\uFF0C\u53EF\u80FD\u662F\u4EC0\u4E48\u539F\u56E0\uFF1F' },\n ],\n },\n },\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\u20133 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 + ' \u2014 ' + 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\
|
|
13
|
+
export declare 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 examplePrompts: [\n { field: 'error', text: 'Triage this stack trace from production' },\n { field: 'error', text: 'Why does the gateway return 502 after deploy?' },\n ],\n i18n: {\n zh: {\n description: '\u5BF9\u9519\u8BEF\u6216\u65E5\u5FD7\u7247\u6BB5\u505A\u5E76\u884C\u5047\u8BBE\u63A8\u6F14\uFF0C\u5E76\u6392\u5E8F\u6839\u56E0\u4E0E\u9A8C\u8BC1\u6B65\u9AA4\u3002',\n whenToUse: '\u7528\u6237\u62A5\u544A bug\u3001\u5D29\u6E83\u3001\u62A5\u9519\u6216\u5F02\u5E38\u884C\u4E3A\uFF0C\u9700\u8981\u7CFB\u7EDF\u5316\u6392\u67E5\u65F6\u3002',\n examplePrompts: [\n { field: 'error', text: '\u6392\u67E5\u751F\u4EA7\u73AF\u5883\u8FD9\u6761\u5806\u6808' },\n { field: 'error', text: '\u90E8\u7F72\u540E\u7F51\u5173\u8FD4\u56DE 502\uFF0C\u53EF\u80FD\u662F\u4EC0\u4E48\u539F\u56E0\uFF1F' },\n ],\n },\n },\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\u20133 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 + ' \u2014 ' + 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\nconst output = {\n ok: true,\n triage,\n ...(ranking ?? { topCauses: [], summary: 'ranking failed', immediateActions: [] }),\n byHypothesis,\n}\nreturn {\n summary: output.summary,\n sections: [\n { kind: 'risks', title: 'Top causes', items: output.topCauses.map((item) => ({ title: item.hypothesis, severity: item.likelihood, detail: item.summary, mitigation: item.nextStep })) },\n { kind: 'questions', title: 'Immediate actions', items: output.immediateActions ?? [] },\n ],\n structuredOutput: output,\n}\n";
|
|
@@ -156,12 +156,20 @@ const ranking = await agent(
|
|
|
156
156
|
},
|
|
157
157
|
)
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
const output = {
|
|
160
160
|
ok: true,
|
|
161
161
|
triage,
|
|
162
162
|
...(ranking ?? { topCauses: [], summary: 'ranking failed', immediateActions: [] }),
|
|
163
163
|
byHypothesis,
|
|
164
164
|
}
|
|
165
|
+
return {
|
|
166
|
+
summary: output.summary,
|
|
167
|
+
sections: [
|
|
168
|
+
{ kind: 'risks', title: 'Top causes', items: output.topCauses.map((item) => ({ title: item.hypothesis, severity: item.likelihood, detail: item.summary, mitigation: item.nextStep })) },
|
|
169
|
+
{ kind: 'questions', title: 'Immediate actions', items: output.immediateActions ?? [] },
|
|
170
|
+
],
|
|
171
|
+
structuredOutput: output,
|
|
172
|
+
}
|
|
165
173
|
`;
|
|
166
174
|
//#endregion
|
|
167
175
|
export { DEBUG_INCIDENT_SCRIPT };
|
|
@@ -1 +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 examplePrompts: [\n { field: 'error', text: 'Triage this stack trace from production' },\n { field: 'error', text: 'Why does the gateway return 502 after deploy?' },\n ],\n i18n: {\n zh: {\n description: '对错误或日志片段做并行假设推演,并排序根因与验证步骤。',\n whenToUse: '用户报告 bug、崩溃、报错或异常行为,需要系统化排查时。',\n examplePrompts: [\n { field: 'error', text: '排查生产环境这条堆栈' },\n { field: 'error', text: '部署后网关返回 502,可能是什么原因?' },\n ],\n },\n },\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\
|
|
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 examplePrompts: [\n { field: 'error', text: 'Triage this stack trace from production' },\n { field: 'error', text: 'Why does the gateway return 502 after deploy?' },\n ],\n i18n: {\n zh: {\n description: '对错误或日志片段做并行假设推演,并排序根因与验证步骤。',\n whenToUse: '用户报告 bug、崩溃、报错或异常行为,需要系统化排查时。',\n examplePrompts: [\n { field: 'error', text: '排查生产环境这条堆栈' },\n { field: 'error', text: '部署后网关返回 502,可能是什么原因?' },\n ],\n },\n },\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\nconst output = {\n ok: true,\n triage,\n ...(ranking ?? { topCauses: [], summary: 'ranking failed', immediateActions: [] }),\n byHypothesis,\n}\nreturn {\n summary: output.summary,\n sections: [\n { kind: 'risks', title: 'Top causes', items: output.topCauses.map((item) => ({ title: item.hypothesis, severity: item.likelihood, detail: item.summary, mitigation: item.nextStep })) },\n { kind: 'questions', title: 'Immediate actions', items: output.immediateActions ?? [] },\n ],\n structuredOutput: output,\n}\n`\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,wBAAwB"}
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
* - options: optional comma-separated or newline-separated option list
|
|
11
11
|
* - criteria: optional evaluation criteria hint
|
|
12
12
|
*/
|
|
13
|
-
export declare const DECISION_COMPARE_SCRIPT = "export const meta = {\n name: 'decision_compare',\n description: 'Compare options across independent evaluators, then recommend with explicit trade-offs.',\n whenToUse: 'User faces a non-code decision with multiple viable options and wants a structured comparison.',\n examplePrompts: [\n { field: 'question', text: 'Which project management tool fits a 5-person remote team?' },\n { field: 'question', text: 'Should we host the event in-person, hybrid, or fully virtual?' },\n ],\n i18n: {\n zh: {\n description: '\u7531\u591A\u4E2A\u72EC\u7ACB\u8BC4\u5BA1\u7EF4\u5EA6\u5BF9\u6BD4\u9009\u9879\uFF0C\u5E76\u7ED9\u51FA\u542B\u6743\u8861\u7684\u63A8\u8350\u7ED3\u8BBA\u3002',\n whenToUse: '\u7528\u6237\u9762\u4E34\u591A\u4E2A\u53EF\u884C\u65B9\u6848\u7684\u975E\u4EE3\u7801\u51B3\u7B56\uFF0C\u9700\u8981\u7ED3\u6784\u5316\u5BF9\u6BD4\u65F6\u3002',\n examplePrompts: [\n { field: 'question', text: '5 \u4EBA\u8FDC\u7A0B\u56E2\u961F\u9002\u5408\u7528\u54EA\u6B3E\u9879\u76EE\u7BA1\u7406\u5DE5\u5177\uFF1F' },\n { field: 'question', text: '\u6D3B\u52A8\u5E94\u8BE5\u7EBF\u4E0B\u3001\u6DF7\u5408\u8FD8\u662F\u7EAF\u7EBF\u4E0A\u4E3E\u529E\uFF1F' },\n ],\n },\n },\n tags: ['decision-making', 'comparison', 'productivity'],\n estimatedAgents: { min: 4, max: 7 },\n phases: [\n { title: 'Frame' },\n { title: 'Evaluate' },\n { title: 'Recommend' },\n ],\n}\n\nconst question = args && typeof args === 'object' && args.question\n ? String(args.question)\n : 'Infer the decision question from the most recent user turn.'\n\nconst optionsRaw = args && typeof args === 'object' && args.options\n ? String(args.options)\n : ''\n\nconst criteriaHint = args && typeof args === 'object' && args.criteria\n ? String(args.criteria)\n : ''\n\nphase('Frame')\nconst frame = await agent(\n 'Frame this decision. If options are not provided, propose 3\u20134 realistic options. Return evaluation criteria (weighted if helpful), assumptions, and non-goals.\\n\\n' +\n 'QUESTION:\\n' + question + '\\n' +\n (optionsRaw ? 'OPTIONS:\\n' + optionsRaw + '\\n' : '') +\n (criteriaHint ? 'CRITERIA HINT:\\n' + criteriaHint + '\\n' : ''),\n {\n label: 'framing',\n schema: {\n type: 'object',\n properties: {\n options: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n summary: { type: 'string' },\n },\n required: ['name', 'summary'],\n },\n },\n criteria: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n weight: { type: 'string', enum: ['low', 'med', 'high'] },\n },\n required: ['name'],\n },\n },\n assumptions: { type: 'array', items: { type: 'string' } },\n },\n required: ['options', 'criteria'],\n },\n },\n)\n\nif (!frame || !frame.options?.length) {\n
|
|
13
|
+
export declare const DECISION_COMPARE_SCRIPT = "export const meta = {\n name: 'decision_compare',\n description: 'Compare options across independent evaluators, then recommend with explicit trade-offs.',\n whenToUse: 'User faces a non-code decision with multiple viable options and wants a structured comparison.',\n examplePrompts: [\n { field: 'question', text: 'Which project management tool fits a 5-person remote team?' },\n { field: 'question', text: 'Should we host the event in-person, hybrid, or fully virtual?' },\n ],\n i18n: {\n zh: {\n description: '\u7531\u591A\u4E2A\u72EC\u7ACB\u8BC4\u5BA1\u7EF4\u5EA6\u5BF9\u6BD4\u9009\u9879\uFF0C\u5E76\u7ED9\u51FA\u542B\u6743\u8861\u7684\u63A8\u8350\u7ED3\u8BBA\u3002',\n whenToUse: '\u7528\u6237\u9762\u4E34\u591A\u4E2A\u53EF\u884C\u65B9\u6848\u7684\u975E\u4EE3\u7801\u51B3\u7B56\uFF0C\u9700\u8981\u7ED3\u6784\u5316\u5BF9\u6BD4\u65F6\u3002',\n examplePrompts: [\n { field: 'question', text: '5 \u4EBA\u8FDC\u7A0B\u56E2\u961F\u9002\u5408\u7528\u54EA\u6B3E\u9879\u76EE\u7BA1\u7406\u5DE5\u5177\uFF1F' },\n { field: 'question', text: '\u6D3B\u52A8\u5E94\u8BE5\u7EBF\u4E0B\u3001\u6DF7\u5408\u8FD8\u662F\u7EAF\u7EBF\u4E0A\u4E3E\u529E\uFF1F' },\n ],\n },\n },\n tags: ['decision-making', 'comparison', 'productivity'],\n estimatedAgents: { min: 4, max: 7 },\n phases: [\n { title: 'Frame' },\n { title: 'Evaluate' },\n { title: 'Recommend' },\n ],\n}\n\nconst question = args && typeof args === 'object' && args.question\n ? String(args.question)\n : 'Infer the decision question from the most recent user turn.'\n\nconst optionsRaw = args && typeof args === 'object' && args.options\n ? String(args.options)\n : ''\n\nconst criteriaHint = args && typeof args === 'object' && args.criteria\n ? String(args.criteria)\n : ''\n\nphase('Frame')\nconst frame = await agent(\n 'Frame this decision. If options are not provided, propose 3\u20134 realistic options. Return evaluation criteria (weighted if helpful), assumptions, and non-goals.\\n\\n' +\n 'QUESTION:\\n' + question + '\\n' +\n (optionsRaw ? 'OPTIONS:\\n' + optionsRaw + '\\n' : '') +\n (criteriaHint ? 'CRITERIA HINT:\\n' + criteriaHint + '\\n' : ''),\n {\n label: 'framing',\n schema: {\n type: 'object',\n properties: {\n options: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n summary: { type: 'string' },\n },\n required: ['name', 'summary'],\n },\n },\n criteria: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n weight: { type: 'string', enum: ['low', 'med', 'high'] },\n },\n required: ['name'],\n },\n },\n assumptions: { type: 'array', items: { type: 'string' } },\n },\n required: ['options', 'criteria'],\n },\n },\n)\n\nif (!frame || !frame.options?.length) {\n const output = { ok: false, reason: 'framing failed', question }\n return {\n summary: output.reason,\n sections: [{ kind: 'json', title: 'Decision framing', value: output }],\n structuredOutput: output,\n }\n}\n\nconst options = frame.options.slice(0, 4)\nconst criteria = frame.criteria ?? []\n\nconst LENSES = [\n { name: 'Benefits', focus: 'Upside, value delivered, and who wins.' },\n { name: 'Risks', focus: 'Downside, failure modes, hidden costs, and regrets.' },\n { name: 'Fit', focus: 'Fit for stated constraints, audience, timeline, and resources.' },\n]\n\nphase('Evaluate')\nconst evaluations = await parallel(\n LENSES.map((lens) => () =>\n agent(\n 'Evaluate every option through this lens. Be specific \u2014 avoid generic pros/cons. Score each option low/med/high for this lens with a one-line rationale.\\n\\n' +\n 'LENS: ' + lens.name + ' \u2014 ' + lens.focus + '\\n' +\n 'QUESTION: ' + question + '\\n' +\n 'OPTIONS:\\n' + JSON.stringify(options, null, 2) + '\\n' +\n 'CRITERIA:\\n' + JSON.stringify(criteria, null, 2),\n {\n label: lens.name,\n schema: {\n type: 'object',\n properties: {\n lens: { type: 'string' },\n scores: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n option: { type: 'string' },\n score: { type: 'string', enum: ['low', 'med', 'high'] },\n rationale: { type: 'string' },\n },\n required: ['option', 'score', 'rationale'],\n },\n },\n },\n required: ['lens', 'scores'],\n },\n },\n ),\n ),\n)\n\nphase('Recommend')\nconst live = evaluations.filter(Boolean)\nconst recommendation = await agent(\n 'Recommend the best option (or a hybrid) from these lens-level evaluations. State trade-offs explicitly, note what would change the recommendation, and give a runner-up.\\n\\n' +\n 'QUESTION:\\n' + question + '\\n\\n' +\n JSON.stringify({ frame, evaluations: live }, null, 2),\n {\n label: 'recommendation',\n schema: {\n type: 'object',\n properties: {\n recommendation: { type: 'string' },\n rationale: { type: 'string' },\n tradeoffs: { type: 'array', items: { type: 'string' } },\n runnerUp: { type: 'string' },\n whatWouldChange: { type: 'array', items: { type: 'string' } },\n },\n required: ['recommendation', 'rationale', 'tradeoffs'],\n },\n },\n)\n\nconst output = {\n ok: true,\n question,\n optionCount: options.length,\n ...(recommendation ?? { recommendation: 'recommendation failed', rationale: '', tradeoffs: [] }),\n}\nreturn {\n summary: output.recommendation,\n sections: [\n { kind: 'text', title: 'Rationale', content: output.rationale },\n { kind: 'questions', title: 'Trade-offs', items: output.tradeoffs },\n { kind: 'questions', title: 'What would change the recommendation', items: output.whatWouldChange ?? [] },\n ],\n structuredOutput: output,\n}\n";
|
|
@@ -91,7 +91,12 @@ const frame = await agent(
|
|
|
91
91
|
)
|
|
92
92
|
|
|
93
93
|
if (!frame || !frame.options?.length) {
|
|
94
|
-
|
|
94
|
+
const output = { ok: false, reason: 'framing failed', question }
|
|
95
|
+
return {
|
|
96
|
+
summary: output.reason,
|
|
97
|
+
sections: [{ kind: 'json', title: 'Decision framing', value: output }],
|
|
98
|
+
structuredOutput: output,
|
|
99
|
+
}
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
const options = frame.options.slice(0, 4)
|
|
@@ -160,12 +165,21 @@ const recommendation = await agent(
|
|
|
160
165
|
},
|
|
161
166
|
)
|
|
162
167
|
|
|
163
|
-
|
|
168
|
+
const output = {
|
|
164
169
|
ok: true,
|
|
165
170
|
question,
|
|
166
171
|
optionCount: options.length,
|
|
167
172
|
...(recommendation ?? { recommendation: 'recommendation failed', rationale: '', tradeoffs: [] }),
|
|
168
173
|
}
|
|
174
|
+
return {
|
|
175
|
+
summary: output.recommendation,
|
|
176
|
+
sections: [
|
|
177
|
+
{ kind: 'text', title: 'Rationale', content: output.rationale },
|
|
178
|
+
{ kind: 'questions', title: 'Trade-offs', items: output.tradeoffs },
|
|
179
|
+
{ kind: 'questions', title: 'What would change the recommendation', items: output.whatWouldChange ?? [] },
|
|
180
|
+
],
|
|
181
|
+
structuredOutput: output,
|
|
182
|
+
}
|
|
169
183
|
`;
|
|
170
184
|
//#endregion
|
|
171
185
|
export { DECISION_COMPARE_SCRIPT };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-compare.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/decision-compare.ts"],"sourcesContent":["/**\n * Built-in workflow: `decision_compare`\n *\n * Structured comparison of options for everyday decisions — vendors, approaches,\n * purchases, policies, or life choices. Independent evaluators score each option,\n * then a synthesizer recommends with trade-offs spelled out.\n *\n * Args:\n * - question: the decision to make\n * - options: optional comma-separated or newline-separated option list\n * - criteria: optional evaluation criteria hint\n */\n\nexport const DECISION_COMPARE_SCRIPT = `export const meta = {\n name: 'decision_compare',\n description: 'Compare options across independent evaluators, then recommend with explicit trade-offs.',\n whenToUse: 'User faces a non-code decision with multiple viable options and wants a structured comparison.',\n examplePrompts: [\n { field: 'question', text: 'Which project management tool fits a 5-person remote team?' },\n { field: 'question', text: 'Should we host the event in-person, hybrid, or fully virtual?' },\n ],\n i18n: {\n zh: {\n description: '由多个独立评审维度对比选项,并给出含权衡的推荐结论。',\n whenToUse: '用户面临多个可行方案的非代码决策,需要结构化对比时。',\n examplePrompts: [\n { field: 'question', text: '5 人远程团队适合用哪款项目管理工具?' },\n { field: 'question', text: '活动应该线下、混合还是纯线上举办?' },\n ],\n },\n },\n tags: ['decision-making', 'comparison', 'productivity'],\n estimatedAgents: { min: 4, max: 7 },\n phases: [\n { title: 'Frame' },\n { title: 'Evaluate' },\n { title: 'Recommend' },\n ],\n}\n\nconst question = args && typeof args === 'object' && args.question\n ? String(args.question)\n : 'Infer the decision question from the most recent user turn.'\n\nconst optionsRaw = args && typeof args === 'object' && args.options\n ? String(args.options)\n : ''\n\nconst criteriaHint = args && typeof args === 'object' && args.criteria\n ? String(args.criteria)\n : ''\n\nphase('Frame')\nconst frame = await agent(\n 'Frame this decision. If options are not provided, propose 3–4 realistic options. Return evaluation criteria (weighted if helpful), assumptions, and non-goals.\\\\n\\\\n' +\n 'QUESTION:\\\\n' + question + '\\\\n' +\n (optionsRaw ? 'OPTIONS:\\\\n' + optionsRaw + '\\\\n' : '') +\n (criteriaHint ? 'CRITERIA HINT:\\\\n' + criteriaHint + '\\\\n' : ''),\n {\n label: 'framing',\n schema: {\n type: 'object',\n properties: {\n options: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n summary: { type: 'string' },\n },\n required: ['name', 'summary'],\n },\n },\n criteria: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n weight: { type: 'string', enum: ['low', 'med', 'high'] },\n },\n required: ['name'],\n },\n },\n assumptions: { type: 'array', items: { type: 'string' } },\n },\n required: ['options', 'criteria'],\n },\n },\n)\n\nif (!frame || !frame.options?.length) {\n
|
|
1
|
+
{"version":3,"file":"decision-compare.js","names":[],"sources":["../../../../../src/agent/workflow/builtins/decision-compare.ts"],"sourcesContent":["/**\n * Built-in workflow: `decision_compare`\n *\n * Structured comparison of options for everyday decisions — vendors, approaches,\n * purchases, policies, or life choices. Independent evaluators score each option,\n * then a synthesizer recommends with trade-offs spelled out.\n *\n * Args:\n * - question: the decision to make\n * - options: optional comma-separated or newline-separated option list\n * - criteria: optional evaluation criteria hint\n */\n\nexport const DECISION_COMPARE_SCRIPT = `export const meta = {\n name: 'decision_compare',\n description: 'Compare options across independent evaluators, then recommend with explicit trade-offs.',\n whenToUse: 'User faces a non-code decision with multiple viable options and wants a structured comparison.',\n examplePrompts: [\n { field: 'question', text: 'Which project management tool fits a 5-person remote team?' },\n { field: 'question', text: 'Should we host the event in-person, hybrid, or fully virtual?' },\n ],\n i18n: {\n zh: {\n description: '由多个独立评审维度对比选项,并给出含权衡的推荐结论。',\n whenToUse: '用户面临多个可行方案的非代码决策,需要结构化对比时。',\n examplePrompts: [\n { field: 'question', text: '5 人远程团队适合用哪款项目管理工具?' },\n { field: 'question', text: '活动应该线下、混合还是纯线上举办?' },\n ],\n },\n },\n tags: ['decision-making', 'comparison', 'productivity'],\n estimatedAgents: { min: 4, max: 7 },\n phases: [\n { title: 'Frame' },\n { title: 'Evaluate' },\n { title: 'Recommend' },\n ],\n}\n\nconst question = args && typeof args === 'object' && args.question\n ? String(args.question)\n : 'Infer the decision question from the most recent user turn.'\n\nconst optionsRaw = args && typeof args === 'object' && args.options\n ? String(args.options)\n : ''\n\nconst criteriaHint = args && typeof args === 'object' && args.criteria\n ? String(args.criteria)\n : ''\n\nphase('Frame')\nconst frame = await agent(\n 'Frame this decision. If options are not provided, propose 3–4 realistic options. Return evaluation criteria (weighted if helpful), assumptions, and non-goals.\\\\n\\\\n' +\n 'QUESTION:\\\\n' + question + '\\\\n' +\n (optionsRaw ? 'OPTIONS:\\\\n' + optionsRaw + '\\\\n' : '') +\n (criteriaHint ? 'CRITERIA HINT:\\\\n' + criteriaHint + '\\\\n' : ''),\n {\n label: 'framing',\n schema: {\n type: 'object',\n properties: {\n options: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n summary: { type: 'string' },\n },\n required: ['name', 'summary'],\n },\n },\n criteria: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n weight: { type: 'string', enum: ['low', 'med', 'high'] },\n },\n required: ['name'],\n },\n },\n assumptions: { type: 'array', items: { type: 'string' } },\n },\n required: ['options', 'criteria'],\n },\n },\n)\n\nif (!frame || !frame.options?.length) {\n const output = { ok: false, reason: 'framing failed', question }\n return {\n summary: output.reason,\n sections: [{ kind: 'json', title: 'Decision framing', value: output }],\n structuredOutput: output,\n }\n}\n\nconst options = frame.options.slice(0, 4)\nconst criteria = frame.criteria ?? []\n\nconst LENSES = [\n { name: 'Benefits', focus: 'Upside, value delivered, and who wins.' },\n { name: 'Risks', focus: 'Downside, failure modes, hidden costs, and regrets.' },\n { name: 'Fit', focus: 'Fit for stated constraints, audience, timeline, and resources.' },\n]\n\nphase('Evaluate')\nconst evaluations = await parallel(\n LENSES.map((lens) => () =>\n agent(\n 'Evaluate every option through this lens. Be specific — avoid generic pros/cons. Score each option low/med/high for this lens with a one-line rationale.\\\\n\\\\n' +\n 'LENS: ' + lens.name + ' — ' + lens.focus + '\\\\n' +\n 'QUESTION: ' + question + '\\\\n' +\n 'OPTIONS:\\\\n' + JSON.stringify(options, null, 2) + '\\\\n' +\n 'CRITERIA:\\\\n' + JSON.stringify(criteria, null, 2),\n {\n label: lens.name,\n schema: {\n type: 'object',\n properties: {\n lens: { type: 'string' },\n scores: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n option: { type: 'string' },\n score: { type: 'string', enum: ['low', 'med', 'high'] },\n rationale: { type: 'string' },\n },\n required: ['option', 'score', 'rationale'],\n },\n },\n },\n required: ['lens', 'scores'],\n },\n },\n ),\n ),\n)\n\nphase('Recommend')\nconst live = evaluations.filter(Boolean)\nconst recommendation = await agent(\n 'Recommend the best option (or a hybrid) from these lens-level evaluations. State trade-offs explicitly, note what would change the recommendation, and give a runner-up.\\\\n\\\\n' +\n 'QUESTION:\\\\n' + question + '\\\\n\\\\n' +\n JSON.stringify({ frame, evaluations: live }, null, 2),\n {\n label: 'recommendation',\n schema: {\n type: 'object',\n properties: {\n recommendation: { type: 'string' },\n rationale: { type: 'string' },\n tradeoffs: { type: 'array', items: { type: 'string' } },\n runnerUp: { type: 'string' },\n whatWouldChange: { type: 'array', items: { type: 'string' } },\n },\n required: ['recommendation', 'rationale', 'tradeoffs'],\n },\n },\n)\n\nconst output = {\n ok: true,\n question,\n optionCount: options.length,\n ...(recommendation ?? { recommendation: 'recommendation failed', rationale: '', tradeoffs: [] }),\n}\nreturn {\n summary: output.recommendation,\n sections: [\n { kind: 'text', title: 'Rationale', content: output.rationale },\n { kind: 'questions', title: 'Trade-offs', items: output.tradeoffs },\n { kind: 'questions', title: 'What would change the recommendation', items: output.whatWouldChange ?? [] },\n ],\n structuredOutput: output,\n}\n`\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,0BAA0B"}
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* - request: feature, bugfix, or refactor request
|
|
10
10
|
* - scope: optional repo path or subsystem hint
|
|
11
11
|
*/
|
|
12
|
-
export declare const IMPLEMENTATION_PLAN_SCRIPT = "export const meta = {\n name: 'implementation_plan',\n description: 'Create an actionable implementation plan from a feature, refactor, or bugfix request.',\n whenToUse: 'User wants a technical plan before coding, especially for multi-file or unfamiliar code changes.',\n examplePrompts: [\n { field: 'request', text: 'Plan a refactor of the session store' },\n { field: 'request', text: 'Design implementation steps for OAuth login' },\n ],\n i18n: {\n zh: {\n description: '\u5C06\u529F\u80FD\u3001\u91CD\u6784\u6216\u4FEE\u590D\u9700\u6C42\u8F6C\u5316\u4E3A\u53EF\u6267\u884C\u7684\u5B9E\u73B0\u8BA1\u5212\u3002',\n whenToUse: '\u7528\u6237\u60F3\u5728\u52A8\u624B\u5199\u4EE3\u7801\u524D\u62FF\u5230\u6280\u672F\u65B9\u6848\uFF0C\u5C24\u5176\u662F\u591A\u6587\u4EF6\u6216\u4E0D\u719F\u6089\u4EE3\u7801\u7684\u6539\u52A8\u3002',\n examplePrompts: [\n { field: 'request', text: '\u89C4\u5212 session store \u7684\u91CD\u6784\u6B65\u9AA4' },\n { field: 'request', text: '\u8BBE\u8BA1 OAuth \u767B\u5F55\u7684\u5B9E\u73B0\u6B65\u9AA4' },\n ],\n },\n },\n tags: ['planning', 'implementation', 'architecture'],\n estimatedAgents: { min: 5, max: 6 },\n phases: [\n { title: 'Frame' },\n { title: 'Explore' },\n { title: 'Plan' },\n { title: 'Validate' },\n ],\n}\n\nconst READ_ONLY_TOOLS = ['read_file', 'grep', 'find', 'list_dir']\n\nconst request = args && typeof args === 'object' && args.request\n ? String(args.request)\n : 'Infer the implementation request from the current conversation context.'\n\nconst scope = args && typeof args === 'object' && args.scope\n ? String(args.scope)\n : '.'\n\nphase('Frame')\nconst frame = await agent(\n 'Frame this implementation request. Identify the desired outcome, non-goals, likely affected domains, and open questions. Be concrete and avoid generic advice.\\n\\n' +\n 'REQUEST:\\n' + request + '\\n\\nSCOPE HINT:\\n' + scope,\n {\n label: 'request framing',\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n outcome: { type: 'string' },\n nonGoals: { type: 'array', items: { type: 'string' } },\n affectedDomains: { type: 'array', items: { type: 'string' } },\n openQuestions: { type: 'array', items: { type: 'string' } },\n },\n required: ['outcome', 'affectedDomains'],\n },\n },\n)\n\nconst AREAS = [\n { key: 'entrypoints', focus: 'Routes, commands, UI pages, public APIs, and user-facing surfaces that must change.' },\n { key: 'domain', focus: 'Core domain model, state transitions, stores, services, and invariants.' },\n { key: 'integration', focus: 'Cross-module dependencies, config, events, async jobs, persistence, and external APIs.' },\n { key: 'validation', focus: 'Existing tests, missing regression tests, build/type/lint commands, and release validation.' },\n]\n\nphase('Explore')\nconst explorations = await parallel(\n AREAS.map((area) => () =>\n agent(\n 'Explore the repository for this implementation plan through the ' + area.key + ' lens.\\n' +\n 'Focus: ' + area.focus + '\\n\\n' +\n 'REQUEST:\\n' + request + '\\n\\n' +\n 'FRAME:\\n' + JSON.stringify(frame, null, 2) + '\\n\\n' +\n 'Return concrete files/functions/modules to inspect or modify, existing patterns to follow, and constraints that affect the plan.',\n {\n label: area.key + ' exploration',\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n targets: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n path: { type: 'string' },\n reason: { type: 'string' },\n },\n required: ['path', 'reason'],\n },\n },\n patterns: { type: 'array', items: { type: 'string' } },\n constraints: { type: 'array', items: { type: 'string' } },\n },\n required: ['targets', 'constraints'],\n },\n },\n ),\n ),\n)\n\nphase('Plan')\nconst plan = await agent(\n 'Synthesize an implementation plan from the framing and explorations. Make it executable by an engineer or coding agent. ' +\n 'Use phased tasks, name the concrete files/modules, include sequencing/dependencies, and call out decisions that need user confirmation.\\n\\n' +\n JSON.stringify({ request, scope, frame, explorations }, null, 2),\n {\n label: 'plan synthesis',\n schema: {\n type: 'object',\n properties: {\n summary: { type: 'string' },\n phases: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n tasks: { type: 'array', items: { type: 'string' } },\n files: { type: 'array', items: { type: 'string' } },\n },\n required: ['title', 'tasks'],\n },\n },\n decisions: { type: 'array', items: { type: 'string' } },\n risks: { type: 'array', items: { type: 'string' } },\n },\n required: ['summary', 'phases', 'risks'],\n },\n },\n)\n\nphase('Validate')\nconst validation = await agent(\n 'Create a validation checklist for this implementation plan. Include targeted tests, full commands, manual UI/API checks if relevant, and rollback/recovery notes.\\n\\n' +\n JSON.stringify({ request, plan }, null, 2),\n {\n label: 'validation checklist',\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n testCommands: { type: 'array', items: { type: 'string' } },\n manualChecks: { type: 'array', items: { type: 'string' } },\n rollbackNotes: { type: 'array', items: { type: 'string' } },\n },\n required: ['testCommands', 'manualChecks'],\n },\n },\n)\n\
|
|
12
|
+
export declare const IMPLEMENTATION_PLAN_SCRIPT = "export const meta = {\n name: 'implementation_plan',\n description: 'Create an actionable implementation plan from a feature, refactor, or bugfix request.',\n whenToUse: 'User wants a technical plan before coding, especially for multi-file or unfamiliar code changes.',\n examplePrompts: [\n { field: 'request', text: 'Plan a refactor of the session store' },\n { field: 'request', text: 'Design implementation steps for OAuth login' },\n ],\n i18n: {\n zh: {\n description: '\u5C06\u529F\u80FD\u3001\u91CD\u6784\u6216\u4FEE\u590D\u9700\u6C42\u8F6C\u5316\u4E3A\u53EF\u6267\u884C\u7684\u5B9E\u73B0\u8BA1\u5212\u3002',\n whenToUse: '\u7528\u6237\u60F3\u5728\u52A8\u624B\u5199\u4EE3\u7801\u524D\u62FF\u5230\u6280\u672F\u65B9\u6848\uFF0C\u5C24\u5176\u662F\u591A\u6587\u4EF6\u6216\u4E0D\u719F\u6089\u4EE3\u7801\u7684\u6539\u52A8\u3002',\n examplePrompts: [\n { field: 'request', text: '\u89C4\u5212 session store \u7684\u91CD\u6784\u6B65\u9AA4' },\n { field: 'request', text: '\u8BBE\u8BA1 OAuth \u767B\u5F55\u7684\u5B9E\u73B0\u6B65\u9AA4' },\n ],\n },\n },\n tags: ['planning', 'implementation', 'architecture'],\n estimatedAgents: { min: 5, max: 6 },\n phases: [\n { title: 'Frame' },\n { title: 'Explore' },\n { title: 'Plan' },\n { title: 'Validate' },\n ],\n}\n\nconst READ_ONLY_TOOLS = ['read_file', 'grep', 'find', 'list_dir']\n\nconst request = args && typeof args === 'object' && args.request\n ? String(args.request)\n : 'Infer the implementation request from the current conversation context.'\n\nconst scope = args && typeof args === 'object' && args.scope\n ? String(args.scope)\n : '.'\n\nphase('Frame')\nconst frame = await agent(\n 'Frame this implementation request. Identify the desired outcome, non-goals, likely affected domains, and open questions. Be concrete and avoid generic advice.\\n\\n' +\n 'REQUEST:\\n' + request + '\\n\\nSCOPE HINT:\\n' + scope,\n {\n label: 'request framing',\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n outcome: { type: 'string' },\n nonGoals: { type: 'array', items: { type: 'string' } },\n affectedDomains: { type: 'array', items: { type: 'string' } },\n openQuestions: { type: 'array', items: { type: 'string' } },\n },\n required: ['outcome', 'affectedDomains'],\n },\n },\n)\n\nconst AREAS = [\n { key: 'entrypoints', focus: 'Routes, commands, UI pages, public APIs, and user-facing surfaces that must change.' },\n { key: 'domain', focus: 'Core domain model, state transitions, stores, services, and invariants.' },\n { key: 'integration', focus: 'Cross-module dependencies, config, events, async jobs, persistence, and external APIs.' },\n { key: 'validation', focus: 'Existing tests, missing regression tests, build/type/lint commands, and release validation.' },\n]\n\nphase('Explore')\nconst explorations = await parallel(\n AREAS.map((area) => () =>\n agent(\n 'Explore the repository for this implementation plan through the ' + area.key + ' lens.\\n' +\n 'Focus: ' + area.focus + '\\n\\n' +\n 'REQUEST:\\n' + request + '\\n\\n' +\n 'FRAME:\\n' + JSON.stringify(frame, null, 2) + '\\n\\n' +\n 'Return concrete files/functions/modules to inspect or modify, existing patterns to follow, and constraints that affect the plan.',\n {\n label: area.key + ' exploration',\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n targets: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n path: { type: 'string' },\n reason: { type: 'string' },\n },\n required: ['path', 'reason'],\n },\n },\n patterns: { type: 'array', items: { type: 'string' } },\n constraints: { type: 'array', items: { type: 'string' } },\n },\n required: ['targets', 'constraints'],\n },\n },\n ),\n ),\n)\n\nphase('Plan')\nconst plan = await agent(\n 'Synthesize an implementation plan from the framing and explorations. Make it executable by an engineer or coding agent. ' +\n 'Use phased tasks, name the concrete files/modules, include sequencing/dependencies, and call out decisions that need user confirmation.\\n\\n' +\n JSON.stringify({ request, scope, frame, explorations }, null, 2),\n {\n label: 'plan synthesis',\n schema: {\n type: 'object',\n properties: {\n summary: { type: 'string' },\n phases: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n title: { type: 'string' },\n tasks: { type: 'array', items: { type: 'string' } },\n files: { type: 'array', items: { type: 'string' } },\n },\n required: ['title', 'tasks'],\n },\n },\n decisions: { type: 'array', items: { type: 'string' } },\n risks: { type: 'array', items: { type: 'string' } },\n },\n required: ['summary', 'phases', 'risks'],\n },\n },\n)\n\nphase('Validate')\nconst validation = await agent(\n 'Create a validation checklist for this implementation plan. Include targeted tests, full commands, manual UI/API checks if relevant, and rollback/recovery notes.\\n\\n' +\n JSON.stringify({ request, plan }, null, 2),\n {\n label: 'validation checklist',\n toolset: READ_ONLY_TOOLS,\n schema: {\n type: 'object',\n properties: {\n testCommands: { type: 'array', items: { type: 'string' } },\n manualChecks: { type: 'array', items: { type: 'string' } },\n rollbackNotes: { type: 'array', items: { type: 'string' } },\n },\n required: ['testCommands', 'manualChecks'],\n },\n },\n)\n\nconst output = {\n ok: true,\n request,\n scope,\n ...(plan ?? { summary: 'plan synthesis failed', phases: [], decisions: [], risks: [] }),\n validation: validation ?? { testCommands: [], manualChecks: [], rollbackNotes: [] },\n}\nreturn {\n summary: output.summary,\n sections: [\n { kind: 'json', title: 'Plan phases', value: output.phases },\n { kind: 'questions', title: 'Decisions', items: output.decisions ?? [] },\n { kind: 'risks', title: 'Risks', items: output.risks.map((title) => ({ title })) },\n { kind: 'json', title: 'Validation', value: output.validation },\n ],\n structuredOutput: output,\n}\n";
|
|
@@ -161,13 +161,23 @@ const validation = await agent(
|
|
|
161
161
|
},
|
|
162
162
|
)
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
const output = {
|
|
165
165
|
ok: true,
|
|
166
166
|
request,
|
|
167
167
|
scope,
|
|
168
168
|
...(plan ?? { summary: 'plan synthesis failed', phases: [], decisions: [], risks: [] }),
|
|
169
169
|
validation: validation ?? { testCommands: [], manualChecks: [], rollbackNotes: [] },
|
|
170
170
|
}
|
|
171
|
+
return {
|
|
172
|
+
summary: output.summary,
|
|
173
|
+
sections: [
|
|
174
|
+
{ kind: 'json', title: 'Plan phases', value: output.phases },
|
|
175
|
+
{ kind: 'questions', title: 'Decisions', items: output.decisions ?? [] },
|
|
176
|
+
{ kind: 'risks', title: 'Risks', items: output.risks.map((title) => ({ title })) },
|
|
177
|
+
{ kind: 'json', title: 'Validation', value: output.validation },
|
|
178
|
+
],
|
|
179
|
+
structuredOutput: output,
|
|
180
|
+
}
|
|
171
181
|
`;
|
|
172
182
|
//#endregion
|
|
173
183
|
export { IMPLEMENTATION_PLAN_SCRIPT };
|