@dipoleml/dcode-cli 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/THIRD-PARTY-NOTICES.md +1081 -12
- package/dist/dcode.cjs +59368 -45608
- package/dist/packages/browser-use-plugin/README.md +12 -12
- package/dist/packages/browser-use-plugin/docs/api.json +1 -1
- package/dist/packages/browser-use-plugin/docs/overview.md +5 -4
- package/dist/packages/browser-use-plugin/docs/workflow.md +1 -1
- package/dist/packages/browser-use-plugin/scripts/build.mjs +1 -0
- package/dist/packages/browser-use-plugin/skills/control-browser/SKILL.md +10 -7
- package/dist/packages/bundled-skills/skills/dynamic-workflows/SKILL.md +760 -687
- package/dist/packages/bundled-skills/skills/dynamic-workflows/examples.md +310 -1
- package/dist/packages/bundled-skills/skills/dynamic-workflows/patterns.md +336 -4
- package/dist/packages/node-repl-host/.dcode-plugin/plugin.json +1 -1
- package/dist/packages/node-repl-host/dist/mcp/server.js +9 -14
- package/dist/packages/node-repl-host/scripts/build.mjs +1 -0
- package/dist/provider/dcode-builtin.json +6612 -202
- package/node_modules/@dcode/contracts/dist/compact/index.d.ts +7 -7
- package/node_modules/@dcode/contracts/dist/config/index.d.ts +1 -1
- package/node_modules/@dcode/contracts/dist/events/event-reducer.js +1 -0
- package/node_modules/@dcode/contracts/dist/events/in-memory-session-event-store.js +3 -2
- package/node_modules/@dcode/contracts/dist/events/session-event-retention.d.ts +8 -0
- package/node_modules/@dcode/contracts/dist/events/session-event-retention.js +18 -0
- package/node_modules/@dcode/contracts/dist/events/session.events.d.ts +94 -16
- package/node_modules/@dcode/contracts/dist/events/session.events.js +10 -0
- package/node_modules/@dcode/contracts/dist/hooks/index.d.ts +134 -134
- package/node_modules/@dcode/contracts/dist/hooks/workspace-hook-trust.d.ts +14 -14
- package/node_modules/@dcode/contracts/dist/index.d.ts +2 -0
- package/node_modules/@dcode/contracts/dist/index.js +2 -0
- package/node_modules/@dcode/contracts/dist/interfaces/browser-control.port.d.ts +22 -0
- package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run-hole.port.d.ts +92 -0
- package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run-hole.port.js +9 -0
- package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run-retune.port.d.ts +4 -4
- package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run-retune.port.js +7 -3
- package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run-workspace.port.js +8 -3
- package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run.port.d.ts +119 -18
- package/node_modules/@dcode/contracts/dist/interfaces/dynamic-workflow-run.port.js +13 -0
- package/node_modules/@dcode/contracts/dist/interfaces/index.d.ts +1 -0
- package/node_modules/@dcode/contracts/dist/interfaces/index.js +1 -0
- package/node_modules/@dcode/contracts/dist/interfaces/mcp.port.d.ts +161 -1
- package/node_modules/@dcode/contracts/dist/interfaces/mcp.port.js +17 -0
- package/node_modules/@dcode/contracts/dist/interfaces/permission-full-access.d.ts +15 -15
- package/node_modules/@dcode/contracts/dist/interfaces/permission-full-access.js +1 -1
- package/node_modules/@dcode/contracts/dist/interfaces/permission.port.d.ts +15 -1
- package/node_modules/@dcode/contracts/dist/interfaces/provider-endpoint-routing.port.d.ts +19 -0
- package/node_modules/@dcode/contracts/dist/interfaces/provider-endpoint-routing.port.js +1 -0
- package/node_modules/@dcode/contracts/dist/interfaces/session-store.port.d.ts +4 -2
- package/node_modules/@dcode/contracts/dist/interfaces/session-store.port.js +5 -0
- package/node_modules/@dcode/contracts/dist/interfaces/session.port.d.ts +92 -3
- package/node_modules/@dcode/contracts/dist/interfaces/session.port.js +4 -1
- package/node_modules/@dcode/contracts/dist/interfaces/topic-resource.port.d.ts +25 -0
- package/node_modules/@dcode/contracts/dist/interfaces/topic-resource.port.js +1 -0
- package/node_modules/@dcode/contracts/dist/model/index.d.ts +15 -1
- package/node_modules/@dcode/contracts/dist/model/index.js +5 -0
- package/node_modules/@dcode/contracts/dist/model/invocation-context.d.ts +6 -1
- package/node_modules/@dcode/contracts/dist/plugins/index.d.ts +23 -0
- package/node_modules/@dcode/contracts/dist/plugins/index.js +2 -1
- package/node_modules/@dcode/contracts/dist/telemetry/agent-execution.d.ts +2 -0
- package/node_modules/@dcode/contracts/dist/telemetry/agent-execution.js +2 -0
- package/node_modules/@dcode/contracts/dist/telemetry/index.d.ts +5 -1
- package/node_modules/@dcode/contracts/dist/telemetry/index.js +12 -0
- package/node_modules/@dcode/contracts/dist/tools/agent.d.ts +12 -12
- package/node_modules/@dcode/contracts/dist/tools/amend-workflow.d.ts +39 -15
- package/node_modules/@dcode/contracts/dist/tools/amend-workflow.js +12 -6
- package/node_modules/@dcode/contracts/dist/tools/automation.d.ts +32 -32
- package/node_modules/@dcode/contracts/dist/tools/automation.js +1 -1
- package/node_modules/@dcode/contracts/dist/tools/bash.d.ts +16 -16
- package/node_modules/@dcode/contracts/dist/tools/bash.js +1 -1
- package/node_modules/@dcode/contracts/dist/tools/create-workflow.d.ts +365 -66
- package/node_modules/@dcode/contracts/dist/tools/create-workflow.js +92 -11
- package/node_modules/@dcode/contracts/dist/tools/edit.d.ts +16 -16
- package/node_modules/@dcode/contracts/dist/tools/eval-workflow-snippet.d.ts +6 -6
- package/node_modules/@dcode/contracts/dist/tools/eval-workflow-snippet.js +5 -1
- package/node_modules/@dcode/contracts/dist/tools/fill-workflow-hole.d.ts +729 -0
- package/node_modules/@dcode/contracts/dist/tools/fill-workflow-hole.js +102 -0
- package/node_modules/@dcode/contracts/dist/tools/get-workflow-run.d.ts +136 -28
- package/node_modules/@dcode/contracts/dist/tools/get-workflow-run.js +36 -0
- package/node_modules/@dcode/contracts/dist/tools/grep.d.ts +4 -4
- package/node_modules/@dcode/contracts/dist/tools/grep.js +4 -0
- package/node_modules/@dcode/contracts/dist/tools/index.d.ts +2 -0
- package/node_modules/@dcode/contracts/dist/tools/index.js +4 -0
- package/node_modules/@dcode/contracts/dist/tools/list-saved-workflows.d.ts +8 -8
- package/node_modules/@dcode/contracts/dist/tools/list-workflow-runs.d.ts +8 -8
- package/node_modules/@dcode/contracts/dist/tools/node-repl.d.ts +2 -2
- package/node_modules/@dcode/contracts/dist/tools/off-peak.d.ts +3 -3
- package/node_modules/@dcode/contracts/dist/tools/off-peak.js +2 -2
- package/node_modules/@dcode/contracts/dist/tools/performance.d.ts +22 -22
- package/node_modules/@dcode/contracts/dist/tools/plan-mode.d.ts +12 -12
- package/node_modules/@dcode/contracts/dist/tools/plan-mode.js +6 -4
- package/node_modules/@dcode/contracts/dist/tools/read-session-context.d.ts +86 -13
- package/node_modules/@dcode/contracts/dist/tools/read-session-context.js +37 -6
- package/node_modules/@dcode/contracts/dist/tools/read.d.ts +38 -38
- package/node_modules/@dcode/contracts/dist/tools/save-workflow.d.ts +21 -10
- package/node_modules/@dcode/contracts/dist/tools/save-workflow.js +22 -2
- package/node_modules/@dcode/contracts/dist/tools/saved-workflow.d.ts +4 -4
- package/node_modules/@dcode/contracts/dist/tools/send-message.d.ts +2 -2
- package/node_modules/@dcode/contracts/dist/tools/skill.js +1 -0
- package/node_modules/@dcode/contracts/dist/tools/task-output.d.ts +6 -6
- package/node_modules/@dcode/contracts/dist/tools/tool-result-metadata.d.ts +1228 -259
- package/node_modules/@dcode/contracts/dist/tools/tool-result-metadata.js +41 -0
- package/node_modules/@dcode/contracts/dist/tools/webfetch.d.ts +2 -2
- package/node_modules/@dcode/contracts/dist/tools/workflow-observation-display.d.ts +20 -20
- package/node_modules/@dcode/contracts/dist/tools/workflow-settings.d.ts +55 -0
- package/node_modules/@dcode/contracts/dist/tools/workflow-settings.js +86 -0
- package/node_modules/@dcode/contracts/dist/tools/workflow.d.ts +8 -8
- package/node_modules/@dcode/contracts/dist/tools/write.d.ts +18 -18
- package/node_modules/@dcode/contracts/dist/workflow/index.d.ts +98 -98
- package/node_modules/@dcode/contracts/dist/workflow/script.d.ts +12 -12
- package/node_modules/@dcode/i18n/dist/index.js +2 -2
- package/node_modules/@dcode/i18n/dist/locale.d.ts +1 -1
- package/node_modules/@dcode/i18n/dist/locale.js +4 -4
- package/node_modules/@dcode/i18n/dist/locales/en-US.js +5 -5
- package/node_modules/@dcode/i18n/dist/locales/fr-CA.d.ts +3 -0
- package/node_modules/@dcode/i18n/dist/locales/fr-CA.js +354 -0
- package/node_modules/@dcode/model-option-map/package.json +1 -1
- package/node_modules/@dcode/shared/dist/api-key-usage-scene.d.ts +7 -0
- package/node_modules/@dcode/shared/dist/api-key-usage-scene.js +6 -0
- package/node_modules/@dcode/shared/dist/attachment-source.d.ts +8 -0
- package/node_modules/@dcode/shared/dist/attachment-source.js +4 -0
- package/node_modules/@dcode/shared/dist/background-bash-output.d.ts +4 -4
- package/node_modules/@dcode/shared/dist/bots.d.ts +763 -15
- package/node_modules/@dcode/shared/dist/bots.js +236 -2
- package/node_modules/@dcode/shared/dist/browser-use/command-metadata.d.ts +2 -2
- package/node_modules/@dcode/shared/dist/browser-use/commands.d.ts +4 -3
- package/node_modules/@dcode/shared/dist/browser-use/commands.js +3 -1
- package/node_modules/@dcode/shared/dist/browser-use/nodeReplBroker.d.ts +5 -4
- package/node_modules/@dcode/shared/dist/browser-use/result.d.ts +6 -6
- package/node_modules/@dcode/shared/dist/channel-mention.d.ts +173 -0
- package/node_modules/@dcode/shared/dist/channel-mention.js +120 -0
- package/node_modules/@dcode/shared/dist/channels.d.ts +128 -1
- package/node_modules/@dcode/shared/dist/channels.js +66 -0
- package/node_modules/@dcode/shared/dist/clientConfig.d.ts +1 -0
- package/node_modules/@dcode/shared/dist/clientConfig.js +18 -2
- package/node_modules/@dcode/shared/dist/cloudContent.d.ts +160 -0
- package/node_modules/@dcode/shared/dist/cloudContent.js +116 -0
- package/node_modules/@dcode/shared/dist/coding-plan-subscription.d.ts +59 -0
- package/node_modules/@dcode/shared/dist/conversation-message-projection-policy.js +2 -0
- package/node_modules/@dcode/shared/dist/conversation-share.d.ts +351 -47
- package/node_modules/@dcode/shared/dist/conversation-share.js +8 -6
- package/node_modules/@dcode/shared/dist/conversationSelection.d.ts +23 -0
- package/node_modules/@dcode/shared/dist/conversationSelection.js +30 -0
- package/node_modules/@dcode/shared/dist/database-startup.d.ts +5 -5
- package/node_modules/@dcode/shared/dist/dcode-agent-model-state.js +14 -6
- package/node_modules/@dcode/shared/dist/dcode-agent-policy.d.ts +16 -1
- package/node_modules/@dcode/shared/dist/dcode-agent-policy.js +17 -1
- package/node_modules/@dcode/shared/dist/dcode-agent-runtime.js +1 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol/index.d.ts +1733 -318
- package/node_modules/@dcode/shared/dist/dcode-protocol/index.js +555 -24
- package/node_modules/@dcode/shared/dist/dcode-protocol/trace.d.ts +9 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol/trace.js +10 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-legacy-types.d.ts +30 -20
- package/node_modules/@dcode/shared/dist/dcode-protocol-legacy-types.js +3 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/apply.js +12 -3
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/attachment-ref.d.ts +5 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/attachment-ref.js +3 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/coalesce.d.ts +3 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/coalesce.js +3 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/command.d.ts +359 -28
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/command.js +67 -45
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/controller.d.ts +170 -65
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/create-session-config.d.ts +20 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/create-session-config.js +15 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/create-workflow-display.d.ts +34 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/create-workflow-display.js +45 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/delta.d.ts +1453 -278
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/delta.js +45 -2
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/index.d.ts +1 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/index.js +1 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/input-intent.d.ts +173 -6
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/input-intent.js +29 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/rows.d.ts +731 -125
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/rows.js +23 -11
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/sessions-index-workflow-activity.d.ts +30 -11
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/sessions-index-workflow-activity.js +35 -3
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/sessions-index.d.ts +40 -25
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/snapshot.d.ts +1444 -216
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/snapshot.js +3 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/submission.d.ts +1 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/submission.js +1 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/telemetry.d.ts +62 -58
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/toolDisplay.d.ts +185 -50
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/toolDisplay.js +31 -3
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/transport.d.ts +7145 -1002
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/transport.js +18 -5
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/wire-assembler.js +2 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/wire-fault.js +4 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/wire-reassembly.js +5 -3
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-artifacts.d.ts +29 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-artifacts.js +64 -4
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-command-rejections.d.ts +13 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-command-rejections.js +23 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-observation-display.d.ts +14 -14
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-row-meta.d.ts +52 -8
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-row-meta.js +22 -3
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-run-settings-command.d.ts +4 -4
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-run-settings-command.js +2 -2
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-actor-session.d.ts +21 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-actor-session.js +44 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-actor-status.d.ts +1 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-actor-status.js +3 -2
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-caps.js +5 -4
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-concurrency.d.ts +26 -19
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-concurrency.js +40 -32
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-delta.d.ts +4 -3
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-delta.js +4 -3
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-entries.d.ts +12 -2
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-entries.js +44 -6
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-eviction.d.ts +2 -2
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-eviction.js +17 -10
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-holes.d.ts +33 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-holes.js +202 -0
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-legacy.d.ts +1 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-legacy.js +1 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-phases.js +10 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-reducer.d.ts +1 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-reducer.js +29 -22
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-started.js +5 -2
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-tables.js +2 -1
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs-unlisted.js +6 -3
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs.d.ts +125 -40
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-runs.js +101 -26
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workflow-workspace.d.ts +4 -4
- package/node_modules/@dcode/shared/dist/dcode-protocol-v4/workspace-hook-review.d.ts +1 -1
- package/node_modules/@dcode/shared/dist/dcode-session-content-profile.d.ts +5 -0
- package/node_modules/@dcode/shared/dist/dcode-session-content-profile.js +49 -0
- package/node_modules/@dcode/shared/dist/dcode-slash-command-help.js +4 -4
- package/node_modules/@dcode/shared/dist/dcode-task-mode-schema.d.ts +6 -1
- package/node_modules/@dcode/shared/dist/dcode-task-mode-schema.js +13 -1
- package/node_modules/@dcode/shared/dist/dcode-task-types-core.d.ts +12 -2
- package/node_modules/@dcode/shared/dist/dcode-task-types.d.ts +23 -0
- package/node_modules/@dcode/shared/dist/dcodeEndpoint.d.ts +20 -1
- package/node_modules/@dcode/shared/dist/dcodeEndpoint.js +98 -17
- package/node_modules/@dcode/shared/dist/desktopMenu.js +48 -48
- package/node_modules/@dcode/shared/dist/dynamic-workflow-feature.d.ts +35 -6
- package/node_modules/@dcode/shared/dist/dynamic-workflow-feature.js +45 -6
- package/node_modules/@dcode/shared/dist/env.d.ts +5 -4
- package/node_modules/@dcode/shared/dist/env.js +9 -9
- package/node_modules/@dcode/shared/dist/errors.d.ts +24 -0
- package/node_modules/@dcode/shared/dist/errors.js +54 -0
- package/node_modules/@dcode/shared/dist/execution-state.d.ts +4 -2
- package/node_modules/@dcode/shared/dist/execution-state.js +1 -1
- package/node_modules/@dcode/shared/dist/feedback.d.ts +1 -1
- package/node_modules/@dcode/shared/dist/gen-ui/contract.d.ts +140 -0
- package/node_modules/@dcode/shared/dist/gen-ui/contract.example.d.ts +5 -0
- package/node_modules/@dcode/shared/dist/gen-ui/contract.example.js +36 -0
- package/node_modules/@dcode/shared/dist/gen-ui/contract.js +196 -0
- package/node_modules/@dcode/shared/dist/gen-ui/contract.test.d.ts +2 -0
- package/node_modules/@dcode/shared/dist/gen-ui/contract.test.js +75 -0
- package/node_modules/@dcode/shared/dist/gen-ui/index.d.ts +2 -0
- package/node_modules/@dcode/shared/dist/gen-ui/index.js +2 -0
- package/node_modules/@dcode/shared/dist/gen-ui/module.d.ts +7 -0
- package/node_modules/@dcode/shared/dist/gen-ui/module.js +7 -0
- package/node_modules/@dcode/shared/dist/gen-ui/tweakProtocol.d.ts +202 -0
- package/node_modules/@dcode/shared/dist/gen-ui/tweakProtocol.js +126 -0
- package/node_modules/@dcode/shared/dist/helpAppConfig.d.ts +1 -1
- package/node_modules/@dcode/shared/dist/helpAppConfig.js +2 -2
- package/node_modules/@dcode/shared/dist/highspeed.d.ts +181 -0
- package/node_modules/@dcode/shared/dist/highspeed.js +112 -0
- package/node_modules/@dcode/shared/dist/index.d.ts +27 -5
- package/node_modules/@dcode/shared/dist/index.js +24 -2
- package/node_modules/@dcode/shared/dist/localTtft.d.ts +27 -27
- package/node_modules/@dcode/shared/dist/marketingTouch.d.ts +930 -0
- package/node_modules/@dcode/shared/dist/marketingTouch.js +170 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/appTools.d.ts +83 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/appTools.js +124 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/content.d.ts +4 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/content.js +8 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/contract.d.ts +241 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/contract.example.d.ts +31 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/contract.example.js +42 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/contract.js +101 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/contract.test.d.ts +2 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/contract.test.js +64 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/hostContract.d.ts +47 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/hostContract.js +8 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/index.d.ts +9 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/index.js +9 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/instance.d.ts +10 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/instance.js +11 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/module.d.ts +12 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/module.js +12 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/resourceMime.d.ts +8 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/resourceMime.js +73 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/sampling.d.ts +101 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/sampling.js +107 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/sampling.test.d.ts +2 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/sampling.test.js +55 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/schemas.d.ts +78 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/schemas.js +65 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/toolMeta.d.ts +39 -0
- package/node_modules/@dcode/shared/dist/mcp-apps/toolMeta.js +199 -0
- package/node_modules/@dcode/shared/dist/mcp.d.ts +6 -2
- package/node_modules/@dcode/shared/dist/memory.d.ts +9 -0
- package/node_modules/@dcode/shared/dist/memory.js +2 -0
- package/node_modules/@dcode/shared/dist/model-execution.d.ts +31 -0
- package/node_modules/@dcode/shared/dist/model-execution.js +38 -0
- package/node_modules/@dcode/shared/dist/networkCapture.d.ts +49 -0
- package/node_modules/@dcode/shared/dist/networkCapture.js +41 -0
- package/node_modules/@dcode/shared/dist/node/genUiPaths.d.ts +6 -0
- package/node_modules/@dcode/shared/dist/node/genUiPaths.js +16 -0
- package/node_modules/@dcode/shared/dist/node/genUiPaths.test.d.ts +2 -0
- package/node_modules/@dcode/shared/dist/node/genUiPaths.test.js +30 -0
- package/node_modules/@dcode/shared/dist/node/networkCapture.d.ts +8 -0
- package/node_modules/@dcode/shared/dist/node/networkCapture.js +96 -0
- package/node_modules/@dcode/shared/dist/node/officialPluginCache.d.ts +1 -2
- package/node_modules/@dcode/shared/dist/node/subagentMarkdownMigration.d.ts +1 -2
- package/node_modules/@dcode/shared/dist/node.d.ts +2 -0
- package/node_modules/@dcode/shared/dist/node.js +2 -0
- package/node_modules/@dcode/shared/dist/output-style.d.ts +17 -0
- package/node_modules/@dcode/shared/dist/output-style.js +2 -0
- package/node_modules/@dcode/shared/dist/platform.d.ts +149 -1
- package/node_modules/@dcode/shared/dist/platform.js +2 -0
- package/node_modules/@dcode/shared/dist/platformUpdate.d.ts +61 -0
- package/node_modules/@dcode/shared/dist/platformUpdate.js +2 -0
- package/node_modules/@dcode/shared/dist/plugin-marketplaces.d.ts +5 -0
- package/node_modules/@dcode/shared/dist/plugin-marketplaces.js +20 -14
- package/node_modules/@dcode/shared/dist/project-access-token-client.d.ts +42 -0
- package/node_modules/@dcode/shared/dist/project-access-token-client.js +260 -0
- package/node_modules/@dcode/shared/dist/project-access-token-response.d.ts +4 -0
- package/node_modules/@dcode/shared/dist/project-access-token-response.js +9 -0
- package/node_modules/@dcode/shared/dist/project-access-token.d.ts +45 -0
- package/node_modules/@dcode/shared/dist/project-access-token.js +164 -0
- package/node_modules/@dcode/shared/dist/protocol.d.ts +41 -4
- package/node_modules/@dcode/shared/dist/protocol.js +1 -1
- package/node_modules/@dcode/shared/dist/provider-provisioning.d.ts +26 -2
- package/node_modules/@dcode/shared/dist/provider-provisioning.js +19 -3
- package/node_modules/@dcode/shared/dist/providers.d.ts +1 -2
- package/node_modules/@dcode/shared/dist/providers.js +1 -1
- package/node_modules/@dcode/shared/dist/remote-workspace-identity.d.ts +6 -1
- package/node_modules/@dcode/shared/dist/remote-workspace-identity.js +35 -1
- package/node_modules/@dcode/shared/dist/remoteAppConfig.js +1 -1
- package/node_modules/@dcode/shared/dist/remoteEnvironmentKey.js +19 -0
- package/node_modules/@dcode/shared/dist/remoteTarget.d.ts +14 -1
- package/node_modules/@dcode/shared/dist/remoteTarget.js +4 -0
- package/node_modules/@dcode/shared/dist/remoteUsageTelemetry.d.ts +27 -0
- package/node_modules/@dcode/shared/dist/remoteUsageTelemetry.js +43 -0
- package/node_modules/@dcode/shared/dist/rendererActionTrace.d.ts +35 -35
- package/node_modules/@dcode/shared/dist/request-security-edition/index.d.ts +3 -0
- package/node_modules/@dcode/shared/dist/request-security-edition/index.js +3 -0
- package/node_modules/@dcode/shared/dist/request-security-edition/policy.d.ts +3 -0
- package/node_modules/@dcode/shared/dist/request-security-edition/policy.js +5 -0
- package/node_modules/@dcode/shared/dist/request-security-edition/verification-policy.d.ts +19 -0
- package/node_modules/@dcode/shared/dist/request-security-edition/verification-policy.js +29 -0
- package/node_modules/@dcode/shared/dist/rewardsBridge.d.ts +8 -0
- package/node_modules/@dcode/shared/dist/rewardsBridge.js +80 -0
- package/node_modules/@dcode/shared/dist/rewardsEmbedded.d.ts +37 -0
- package/node_modules/@dcode/shared/dist/rewardsEmbedded.js +50 -0
- package/node_modules/@dcode/shared/dist/sessionCreateTelemetry.d.ts +3 -3
- package/node_modules/@dcode/shared/dist/subagent-profile-frontmatter.d.ts +10 -0
- package/node_modules/@dcode/shared/dist/subagent-profile-frontmatter.js +212 -0
- package/node_modules/@dcode/shared/dist/subagent-profile-parser.d.ts +10 -0
- package/node_modules/@dcode/shared/dist/subagent-profile-parser.js +200 -0
- package/node_modules/@dcode/shared/dist/subagent-profile.d.ts +82 -0
- package/node_modules/@dcode/shared/dist/subagent-profile.js +28 -0
- package/node_modules/@dcode/shared/dist/subagent-runtime-config.d.ts +135 -0
- package/node_modules/@dcode/shared/dist/subagent-runtime-config.js +39 -0
- package/node_modules/@dcode/shared/dist/subagents-types.d.ts +1 -1
- package/node_modules/@dcode/shared/dist/task-realtime-core.d.ts +57 -24
- package/node_modules/@dcode/shared/dist/task-realtime-core.js +8 -2
- package/node_modules/@dcode/shared/dist/test-ids-workflow.d.ts +4 -0
- package/node_modules/@dcode/shared/dist/test-ids-workflow.js +5 -0
- package/node_modules/@dcode/shared/dist/test-ids.d.ts +25 -0
- package/node_modules/@dcode/shared/dist/test-ids.js +25 -0
- package/node_modules/@dcode/shared/dist/tool-identity.d.ts +1 -1
- package/node_modules/@dcode/shared/dist/tool-identity.js +4 -0
- package/node_modules/@dcode/shared/dist/tool-plan-adapter.js +14 -1
- package/node_modules/@dcode/shared/dist/usage-stats.d.ts +13 -0
- package/node_modules/@dcode/shared/dist/validation.d.ts +1461 -85
- package/node_modules/@dcode/shared/dist/validation.js +423 -14
- package/node_modules/@dcode/shared/dist/validationAppSettings.d.ts +71 -15
- package/node_modules/@dcode/shared/dist/validationAppSettings.js +74 -12
- package/node_modules/@dcode/shared/dist/web-remote-control-heartbeat.d.ts +8 -0
- package/node_modules/@dcode/shared/dist/web-remote-control-heartbeat.js +40 -0
- package/node_modules/@dcode/shared/dist/web-remote-control-rpc-transport.d.ts +183 -0
- package/node_modules/@dcode/shared/dist/web-remote-control-rpc-transport.js +562 -0
- package/node_modules/@dcode/shared/dist/web-remote-control.d.ts +645 -0
- package/node_modules/@dcode/shared/dist/web-remote-control.js +174 -0
- package/node_modules/@dcode/shared/package.json +5 -2
- package/node_modules/@dcode/tui/dist/app-approval-panel.js +3 -2
- package/node_modules/@dcode/tui/dist/app-approval.d.ts +3 -1
- package/node_modules/@dcode/tui/dist/app-approval.js +9 -5
- package/node_modules/@dcode/tui/dist/app-compact-timeline.d.ts +3 -0
- package/node_modules/@dcode/tui/dist/app-compact-timeline.js +5 -2
- package/node_modules/@dcode/tui/dist/app-empty-transcript.d.ts +1 -0
- package/node_modules/@dcode/tui/dist/app-empty-transcript.js +1 -1
- package/node_modules/@dcode/tui/dist/app-file-mentions.d.ts +2 -0
- package/node_modules/@dcode/tui/dist/app-file-mentions.js +2 -2
- package/node_modules/@dcode/tui/dist/app-input-pane.d.ts +38 -0
- package/node_modules/@dcode/tui/dist/app-input-pane.js +19 -19
- package/node_modules/@dcode/tui/dist/app-input-status.d.ts +17 -0
- package/node_modules/@dcode/tui/dist/app-input-status.js +4 -4
- package/node_modules/@dcode/tui/dist/app-input.d.ts +1 -0
- package/node_modules/@dcode/tui/dist/app-input.js +1 -1
- package/node_modules/@dcode/tui/dist/app-markdown-theme.d.ts +2 -1
- package/node_modules/@dcode/tui/dist/app-markdown-theme.js +1 -1
- package/node_modules/@dcode/tui/dist/app-markdown.d.ts +1 -0
- package/node_modules/@dcode/tui/dist/app-markdown.js +1 -1
- package/node_modules/@dcode/tui/dist/app-mode-command.d.ts +3 -0
- package/node_modules/@dcode/tui/dist/app-mode-command.js +4 -4
- package/node_modules/@dcode/tui/dist/app-mode-suggestion-panel.d.ts +5 -0
- package/node_modules/@dcode/tui/dist/app-mode-suggestion-panel.js +1 -1
- package/node_modules/@dcode/tui/dist/app-mode.d.ts +1 -1
- package/node_modules/@dcode/tui/dist/app-mode.js +1 -1
- package/node_modules/@dcode/tui/dist/app-model-ref.d.ts +1 -0
- package/node_modules/@dcode/tui/dist/app-model-ref.js +1 -1
- package/node_modules/@dcode/tui/dist/app-motion.d.ts +13 -0
- package/node_modules/@dcode/tui/dist/app-motion.js +17 -7
- package/node_modules/@dcode/tui/dist/app-session-event-handler.d.ts +33 -0
- package/node_modules/@dcode/tui/dist/app-session-event-handler.js +4 -4
- package/node_modules/@dcode/tui/dist/app-shiki-diff-view.d.ts +18 -1
- package/node_modules/@dcode/tui/dist/app-shiki-diff-view.js +3 -3
- package/node_modules/@dcode/tui/dist/app-shiki-highlighter.d.ts +3 -0
- package/node_modules/@dcode/tui/dist/app-shiki-highlighter.js +7 -2
- package/node_modules/@dcode/tui/dist/app-sidebar-layout.d.ts +10 -0
- package/node_modules/@dcode/tui/dist/app-sidebar-layout.js +4 -4
- package/node_modules/@dcode/tui/dist/app-submit.d.ts +1 -0
- package/node_modules/@dcode/tui/dist/app-submit.js +1 -1
- package/node_modules/@dcode/tui/dist/app-thought-components.d.ts +7 -0
- package/node_modules/@dcode/tui/dist/app-thought-components.js +2 -2
- package/node_modules/@dcode/tui/dist/app-tool-transcript.d.ts +1 -0
- package/node_modules/@dcode/tui/dist/app-tool-transcript.js +3 -0
- package/node_modules/@dcode/tui/dist/app-view.d.ts +27 -0
- package/node_modules/@dcode/tui/dist/app-view.js +1 -1
- package/node_modules/@dcode/tui/dist/app-workflow-card.js +1 -1
- package/node_modules/@dcode/tui/dist/app-workflow-seed.d.ts +18 -1
- package/node_modules/@dcode/tui/dist/app-workflow-seed.js +4 -4
- package/node_modules/@dcode/tui/dist/index.js +5118 -2579
- package/node_modules/@dcode/tui/dist/tui.d.ts +3 -0
- package/node_modules/@dcode/tui/dist/tui.js +1 -1
- package/node_modules/@dcode/tui/dist/types.d.ts +1 -1
- package/node_modules/oniguruma-parser/LICENSE +1 -1
- package/node_modules/oniguruma-parser/README.md +15 -61
- package/node_modules/oniguruma-parser/dist/oniguruma-parser.min.js +4 -4
- package/node_modules/oniguruma-parser/dist/parser/parse.js +1 -1
- package/node_modules/oniguruma-parser/dist/traverser/traverse.js +1 -1
- package/node_modules/oniguruma-parser/package.json +5 -5
- package/node_modules/oniguruma-to-es/dist/cjs/generate.d.ts +1 -1
- package/node_modules/oniguruma-to-es/dist/cjs/index.js +121 -120
- package/node_modules/oniguruma-to-es/dist/cjs/subclass.d.ts +2 -2
- package/node_modules/oniguruma-to-es/dist/cjs/transform.d.ts +3 -5
- package/node_modules/oniguruma-to-es/dist/cjs/unicode.d.ts +1 -1
- package/node_modules/oniguruma-to-es/dist/esm/generate.d.ts +1 -1
- package/node_modules/oniguruma-to-es/dist/esm/index.js +1 -3
- package/node_modules/oniguruma-to-es/dist/esm/subclass.d.ts +2 -2
- package/node_modules/oniguruma-to-es/dist/esm/transform.d.ts +3 -5
- package/node_modules/oniguruma-to-es/dist/esm/unicode.d.ts +1 -1
- package/node_modules/oniguruma-to-es/dist/index.min.js +6 -6
- package/node_modules/oniguruma-to-es/package.json +5 -5
- package/package.json +5 -5
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const requestVerificationReasons = ["model-request"];
|
|
2
|
+
export const requestVerificationTimeoutMessage = "Provider runtime headers request timed out. Please send your message again.";
|
|
3
|
+
export const REQUEST_VERIFICATION_REQUIRED = "request_verification_unavailable";
|
|
4
|
+
export function readRequestVerificationConfig(_configs) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
export function requestVerificationClaimHeaders(_proof) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
export function withoutRequestVerificationHeaders(headers) {
|
|
11
|
+
return { ...headers };
|
|
12
|
+
}
|
|
13
|
+
export function allowRequestVerificationHeaders(_headers) {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
export function requiresRequestVerification(_access) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
export function isRequestVerificationMessage(_message) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
export function summarizeRequestVerificationHeaders(_headers) {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
export function requestVerificationDiagnostics(_input) {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
export const requestVerificationInteractionAvailable = false;
|
|
29
|
+
//# sourceMappingURL=verification-policy.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type RewardsContext } from "./rewardsEmbedded.js";
|
|
2
|
+
/** 此函数经 preload 序列化到网页主世界,不能引用模块外的运行时变量。 */
|
|
3
|
+
export declare function installRewardsPageBridge(): void;
|
|
4
|
+
export declare function createRewardsInjectionScript(context: RewardsContext, credentials: {
|
|
5
|
+
oauth?: string | null;
|
|
6
|
+
jwt?: string | null;
|
|
7
|
+
}, expectedUrl?: string): string;
|
|
8
|
+
//# sourceMappingURL=rewardsBridge.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { rewardsContextSchema } from "./rewardsEmbedded.js";
|
|
2
|
+
/** 此函数经 preload 序列化到网页主世界,不能引用模块外的运行时变量。 */
|
|
3
|
+
export function installRewardsPageBridge() {
|
|
4
|
+
// 持久分区可能遗留上次账号;在业务脚本运行前清除,等待本次 App 注入完成。
|
|
5
|
+
const storage = globalThis
|
|
6
|
+
.localStorage;
|
|
7
|
+
for (const key of ["oauth:dcode:access_token", "oauth:bigmodel:access_token", "dcodejwttoken"])
|
|
8
|
+
storage.removeItem(key);
|
|
9
|
+
const window = globalThis.window;
|
|
10
|
+
let current = null;
|
|
11
|
+
const listeners = {
|
|
12
|
+
theme: new Set(),
|
|
13
|
+
locale: new Set(),
|
|
14
|
+
auth: new Set(),
|
|
15
|
+
};
|
|
16
|
+
window.addEventListener("dcode-rewards-context", (event) => {
|
|
17
|
+
const next = event.detail;
|
|
18
|
+
if (!next ||
|
|
19
|
+
!["dcode-light", "dcode-dark"].includes(next.theme) ||
|
|
20
|
+
!["zh-CN", "en-US"].includes(next.locale) ||
|
|
21
|
+
!next.auth ||
|
|
22
|
+
!["ready", "anonymous"].includes(next.auth.status) ||
|
|
23
|
+
![null, "dcode", "bigmodel"].includes(next.auth.provider) ||
|
|
24
|
+
!Number.isSafeInteger(next.auth.revision) ||
|
|
25
|
+
next.auth.revision < 0)
|
|
26
|
+
return;
|
|
27
|
+
const previous = current;
|
|
28
|
+
current = next;
|
|
29
|
+
for (const key of ["theme", "locale", "auth"]) {
|
|
30
|
+
if (JSON.stringify(previous?.[key]) !== JSON.stringify(next[key])) {
|
|
31
|
+
for (const callback of listeners[key])
|
|
32
|
+
callback(next[key]);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(window, "dcodeBridge", {
|
|
37
|
+
configurable: false,
|
|
38
|
+
writable: false,
|
|
39
|
+
value: {
|
|
40
|
+
// 对象方法不引入 esbuild keepNames 辅助闭包;序列化到主世界后可独立执行。
|
|
41
|
+
getTheme() {
|
|
42
|
+
return current?.theme ?? null;
|
|
43
|
+
},
|
|
44
|
+
getLang() {
|
|
45
|
+
return current?.locale ?? null;
|
|
46
|
+
},
|
|
47
|
+
getAuthState() {
|
|
48
|
+
return current?.auth ?? null;
|
|
49
|
+
},
|
|
50
|
+
onThemeChange(callback) {
|
|
51
|
+
listeners.theme.add(callback);
|
|
52
|
+
return () => listeners.theme.delete(callback);
|
|
53
|
+
},
|
|
54
|
+
onLangChange(callback) {
|
|
55
|
+
listeners.locale.add(callback);
|
|
56
|
+
return () => listeners.locale.delete(callback);
|
|
57
|
+
},
|
|
58
|
+
onAuthChange(callback) {
|
|
59
|
+
listeners.auth.add(callback);
|
|
60
|
+
return () => listeners.auth.delete(callback);
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export function createRewardsInjectionScript(context, credentials, expectedUrl) {
|
|
66
|
+
const snapshot = rewardsContextSchema.parse(context);
|
|
67
|
+
const values = snapshot.auth.status === "ready"
|
|
68
|
+
? {
|
|
69
|
+
[`oauth:${snapshot.auth.provider}:access_token`]: credentials.oauth?.trim() || null,
|
|
70
|
+
dcodejwttoken: credentials.jwt?.trim() || null,
|
|
71
|
+
}
|
|
72
|
+
: {};
|
|
73
|
+
return `(() => {
|
|
74
|
+
${expectedUrl ? `if (window.location.href !== ${JSON.stringify(expectedUrl)}) return;` : ""}
|
|
75
|
+
for (const key of ["oauth:dcode:access_token", "oauth:bigmodel:access_token", "dcodejwttoken"]) localStorage.removeItem(key);
|
|
76
|
+
for (const [key, value] of Object.entries(${JSON.stringify(values)})) if (value) localStorage.setItem(key, value);
|
|
77
|
+
window.dispatchEvent(new CustomEvent("dcode-rewards-context", { detail: ${JSON.stringify(snapshot)} }));
|
|
78
|
+
})()`;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=rewardsBridge.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const REWARDS_PARTITION = "persist:dcode-rewards";
|
|
3
|
+
export declare const REWARDS_CONTEXT_EVENT = "dcode-rewards-context";
|
|
4
|
+
export declare const rewardsContextSchema: z.ZodObject<{
|
|
5
|
+
theme: z.ZodEnum<{
|
|
6
|
+
"dcode-light": "dcode-light";
|
|
7
|
+
"dcode-dark": "dcode-dark";
|
|
8
|
+
}>;
|
|
9
|
+
locale: z.ZodEnum<{
|
|
10
|
+
"fr-CA": "fr-CA";
|
|
11
|
+
"en-US": "en-US";
|
|
12
|
+
}>;
|
|
13
|
+
auth: z.ZodObject<{
|
|
14
|
+
status: z.ZodEnum<{
|
|
15
|
+
ready: "ready";
|
|
16
|
+
anonymous: "anonymous";
|
|
17
|
+
}>;
|
|
18
|
+
provider: z.ZodNullable<z.ZodEnum<{
|
|
19
|
+
dcode: "dcode";
|
|
20
|
+
bigmodel: "bigmodel";
|
|
21
|
+
}>>;
|
|
22
|
+
revision: z.ZodNumber;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type RewardsContext = z.infer<typeof rewardsContextSchema>;
|
|
26
|
+
export declare function isTrustedRewardsUrl(value: string, options?: {
|
|
27
|
+
dev?: boolean;
|
|
28
|
+
e2e?: boolean;
|
|
29
|
+
}): boolean;
|
|
30
|
+
export declare function resolveRewardsOrigin(options: {
|
|
31
|
+
env: "test" | "production";
|
|
32
|
+
dev?: boolean;
|
|
33
|
+
override?: string;
|
|
34
|
+
e2e?: boolean;
|
|
35
|
+
}): string;
|
|
36
|
+
export declare function buildRewardsUrl(origin: string, locale: string, theme: RewardsContext["theme"]): string;
|
|
37
|
+
//# sourceMappingURL=rewardsEmbedded.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const REWARDS_PARTITION = "persist:dcode-rewards";
|
|
3
|
+
export const REWARDS_CONTEXT_EVENT = "dcode-rewards-context";
|
|
4
|
+
// 上游奖励页只有 cn/en 两种语言;DCode 的 fr-CA 界面映射到 en 页面(与 coding-plan webview 同策略)。
|
|
5
|
+
export const rewardsContextSchema = z.object({
|
|
6
|
+
theme: z.enum(["dcode-light", "dcode-dark"]),
|
|
7
|
+
locale: z.enum(["fr-CA", "en-US"]),
|
|
8
|
+
auth: z.object({
|
|
9
|
+
status: z.enum(["ready", "anonymous"]),
|
|
10
|
+
provider: z.enum(["dcode", "bigmodel"]).nullable(),
|
|
11
|
+
revision: z.number().int().nonnegative(),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
export function isTrustedRewardsUrl(value, options = {}) {
|
|
15
|
+
try {
|
|
16
|
+
const url = new URL(value);
|
|
17
|
+
if (url.username || url.password)
|
|
18
|
+
return false;
|
|
19
|
+
const trusted = ["https://dcode.dipoleml.com"].includes(url.origin) ||
|
|
20
|
+
(options.dev === true && url.origin === "http://localhost:3000") ||
|
|
21
|
+
(options.e2e === true &&
|
|
22
|
+
url.protocol === "http:" &&
|
|
23
|
+
["127.0.0.1", "localhost"].includes(url.hostname));
|
|
24
|
+
return (trusted &&
|
|
25
|
+
/^\/en\/rewards\/?$/.test(url.pathname) &&
|
|
26
|
+
url.searchParams.get("embedded") === "app");
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function resolveRewardsOrigin(options) {
|
|
33
|
+
try {
|
|
34
|
+
if (options.override &&
|
|
35
|
+
isTrustedRewardsUrl(buildRewardsUrl(options.override, "en-US", "dcode-dark"), options))
|
|
36
|
+
return new URL(options.override).origin;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// 配置值非法时回到受信任的环境地址,不让菜单点击直接抛异常。
|
|
40
|
+
}
|
|
41
|
+
return "https://dcode.dipoleml.com";
|
|
42
|
+
}
|
|
43
|
+
export function buildRewardsUrl(origin, locale, theme) {
|
|
44
|
+
// 奖励页当前仅提供英语;法语界面也落到 en 页面,等官网提供法语版后再接入。
|
|
45
|
+
const url = new URL("/en/rewards", origin);
|
|
46
|
+
url.searchParams.set("embedded", "app");
|
|
47
|
+
url.searchParams.set("theme", theme);
|
|
48
|
+
return url.toString();
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=rewardsEmbedded.js.map
|
|
@@ -16,13 +16,13 @@ export declare const sessionCreateTelemetrySchema: z.ZodObject<{
|
|
|
16
16
|
eventExtraDetail: z.ZodObject<{
|
|
17
17
|
create_source: z.ZodEnum<{
|
|
18
18
|
project: "project";
|
|
19
|
-
session: "session";
|
|
20
19
|
group: "group";
|
|
20
|
+
session: "session";
|
|
21
21
|
}>;
|
|
22
22
|
client_kind: z.ZodLiteral<"mobile">;
|
|
23
23
|
workspace_kind: z.ZodEnum<{
|
|
24
|
-
remote: "remote";
|
|
25
24
|
local: "local";
|
|
25
|
+
remote: "remote";
|
|
26
26
|
}>;
|
|
27
27
|
remote_kind: z.ZodEnum<{
|
|
28
28
|
"": "";
|
|
@@ -48,8 +48,8 @@ export declare const automationSessionCreateTelemetrySchema: z.ZodObject<{
|
|
|
48
48
|
}, z.core.$strict>;
|
|
49
49
|
eventExtraDetail: z.ZodObject<{
|
|
50
50
|
workspace_kind: z.ZodEnum<{
|
|
51
|
-
remote: "remote";
|
|
52
51
|
local: "local";
|
|
52
|
+
remote: "remote";
|
|
53
53
|
}>;
|
|
54
54
|
remote_kind: z.ZodEnum<{
|
|
55
55
|
"": "";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function splitMarkdownFrontmatter(content: string): {
|
|
2
|
+
body: string;
|
|
3
|
+
frontmatter?: string;
|
|
4
|
+
};
|
|
5
|
+
export interface ParsedAgentFrontmatter {
|
|
6
|
+
mcpServers: string[] | null | undefined;
|
|
7
|
+
values: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseAgentFrontmatter(frontmatter: string): ParsedAgentFrontmatter;
|
|
10
|
+
//# sourceMappingURL=subagent-profile-frontmatter.d.ts.map
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
export function splitMarkdownFrontmatter(content) {
|
|
2
|
+
const normalized = content.replace(/^\uFEFF/u, "");
|
|
3
|
+
if (!normalized.startsWith("---")) {
|
|
4
|
+
return { body: normalized };
|
|
5
|
+
}
|
|
6
|
+
const lines = normalized.split(/\r?\n/u);
|
|
7
|
+
if (lines[0]?.trim() !== "---")
|
|
8
|
+
return { body: normalized };
|
|
9
|
+
const endIndex = lines.findIndex((line, index) => index > 0 && line.trim() === "---");
|
|
10
|
+
if (endIndex < 0)
|
|
11
|
+
return { body: normalized };
|
|
12
|
+
return {
|
|
13
|
+
frontmatter: lines.slice(1, endIndex).join("\n"),
|
|
14
|
+
body: lines.slice(endIndex + 1).join("\n"),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function parseAgentFrontmatter(frontmatter) {
|
|
18
|
+
const { bareValueKeys, invalidNestedListKeys, values } = parseLooseFrontmatter(frontmatter);
|
|
19
|
+
if (bareValueKeys.has("tools")) {
|
|
20
|
+
delete values.tools;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
mcpServers: parseMcpServerNames(values.mcpServers, Object.prototype.hasOwnProperty.call(values, "mcpServers"), bareValueKeys.has("mcpServers"), invalidNestedListKeys.has("mcpServers")),
|
|
24
|
+
values,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function parseLooseFrontmatter(frontmatter) {
|
|
28
|
+
const bareValueKeys = new Set();
|
|
29
|
+
const invalidNestedListKeys = new Set();
|
|
30
|
+
const values = {};
|
|
31
|
+
const lines = frontmatter.split(/\r?\n/u);
|
|
32
|
+
let pendingListKey;
|
|
33
|
+
for (const rawLine of lines) {
|
|
34
|
+
const line = rawLine.trimEnd();
|
|
35
|
+
if (!line.trim() || line.trimStart().startsWith("#"))
|
|
36
|
+
continue;
|
|
37
|
+
const listMatch = line.match(/^\s*-\s+(.*)$/u);
|
|
38
|
+
if (listMatch && pendingListKey) {
|
|
39
|
+
bareValueKeys.delete(pendingListKey);
|
|
40
|
+
const rawListItem = listMatch[1] ?? "";
|
|
41
|
+
if (pendingListKey === "mcpServers" && isUnquotedMappingValue(rawListItem)) {
|
|
42
|
+
invalidNestedListKeys.add(pendingListKey);
|
|
43
|
+
}
|
|
44
|
+
const existing = Array.isArray(values[pendingListKey])
|
|
45
|
+
? values[pendingListKey]
|
|
46
|
+
: [];
|
|
47
|
+
values[pendingListKey] = [
|
|
48
|
+
...existing,
|
|
49
|
+
pendingListKey === "mcpServers"
|
|
50
|
+
? parseMcpServerListItem(rawListItem)
|
|
51
|
+
: parseScalarValue(rawListItem),
|
|
52
|
+
];
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (pendingListKey && /^\s+/u.test(rawLine)) {
|
|
56
|
+
// 块状 mapping 不是 server-name 列表,不能被空数组吞掉后扩大 child MCP scope。
|
|
57
|
+
invalidNestedListKeys.add(pendingListKey);
|
|
58
|
+
pendingListKey = undefined;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
pendingListKey = undefined;
|
|
62
|
+
const keyValue = line.match(/^([A-Za-z][A-Za-z0-9_-]*)\s*:\s*(.*)$/u);
|
|
63
|
+
if (!keyValue)
|
|
64
|
+
continue;
|
|
65
|
+
const key = keyValue[1];
|
|
66
|
+
const rawValue = keyValue[2] ?? "";
|
|
67
|
+
if (rawValue.trim() === "") {
|
|
68
|
+
values[key] = [];
|
|
69
|
+
bareValueKeys.add(key);
|
|
70
|
+
pendingListKey = key;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (key === "mcpServers" && hasUnquotedInlineMappingItem(rawValue)) {
|
|
74
|
+
invalidNestedListKeys.add(key);
|
|
75
|
+
}
|
|
76
|
+
values[key] = parseScalarValue(rawValue, key === "mcpServers");
|
|
77
|
+
}
|
|
78
|
+
return { bareValueKeys, invalidNestedListKeys, values };
|
|
79
|
+
}
|
|
80
|
+
function parseMcpServerNames(value, isConfigured, hasBareValue, hasInvalidNestedValue) {
|
|
81
|
+
if (!isConfigured)
|
|
82
|
+
return undefined;
|
|
83
|
+
if (!Array.isArray(value) || hasBareValue || hasInvalidNestedValue)
|
|
84
|
+
return null;
|
|
85
|
+
const names = [];
|
|
86
|
+
for (const item of value) {
|
|
87
|
+
if (typeof item !== "string")
|
|
88
|
+
return null;
|
|
89
|
+
const name = item.trim();
|
|
90
|
+
if (name.length === 0)
|
|
91
|
+
return null;
|
|
92
|
+
names.push(name);
|
|
93
|
+
}
|
|
94
|
+
return names;
|
|
95
|
+
}
|
|
96
|
+
function hasUnquotedInlineMappingItem(rawValue) {
|
|
97
|
+
const value = stripInlineComment(rawValue.trim());
|
|
98
|
+
if (!value.startsWith("[") || !value.endsWith("]"))
|
|
99
|
+
return false;
|
|
100
|
+
return splitTopLevelList(value.slice(1, -1), true).some(isUnquotedMappingValue);
|
|
101
|
+
}
|
|
102
|
+
function isUnquotedMappingValue(rawValue) {
|
|
103
|
+
const value = stripInlineComment(rawValue.trim());
|
|
104
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
105
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
return (value.startsWith("{") && value.endsWith("}")) || /^[^:]+:(?:\s|$)/u.test(value);
|
|
109
|
+
}
|
|
110
|
+
function parseMcpServerListItem(rawValue) {
|
|
111
|
+
const value = stripInlineComment(rawValue.trim());
|
|
112
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
113
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
114
|
+
return unquoteScalar(value);
|
|
115
|
+
}
|
|
116
|
+
if (value.startsWith("[") && value.endsWith("]"))
|
|
117
|
+
return null;
|
|
118
|
+
if (/^(?:null|~)$/iu.test(value))
|
|
119
|
+
return null;
|
|
120
|
+
if (/^(?:true|false)$/iu.test(value))
|
|
121
|
+
return value.toLowerCase() === "true";
|
|
122
|
+
if (/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/iu.test(value)) {
|
|
123
|
+
return Number(value);
|
|
124
|
+
}
|
|
125
|
+
return value;
|
|
126
|
+
}
|
|
127
|
+
function parseScalarValue(rawValue, parseInlineItemScalars = false) {
|
|
128
|
+
const value = stripInlineComment(rawValue.trim());
|
|
129
|
+
if (value === "true")
|
|
130
|
+
return true;
|
|
131
|
+
if (value === "false")
|
|
132
|
+
return false;
|
|
133
|
+
if (/^\d+$/u.test(value))
|
|
134
|
+
return Number(value);
|
|
135
|
+
if (value.startsWith("[") && value.endsWith("]")) {
|
|
136
|
+
return splitTopLevelList(value.slice(1, -1), parseInlineItemScalars, parseInlineItemScalars).map((item) => parseInlineItemScalars
|
|
137
|
+
? parseMcpServerListItem(item)
|
|
138
|
+
: unquoteScalar(stripInlineComment(item.trim())));
|
|
139
|
+
}
|
|
140
|
+
if (value.startsWith("{") && value.endsWith("}")) {
|
|
141
|
+
try {
|
|
142
|
+
return JSON.parse(value);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return value;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return unquoteScalar(value);
|
|
149
|
+
}
|
|
150
|
+
function stripInlineComment(value) {
|
|
151
|
+
let quote;
|
|
152
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
153
|
+
const char = value[index];
|
|
154
|
+
if ((char === '"' || char === "'") && value[index - 1] !== "\\") {
|
|
155
|
+
quote = quote === char ? undefined : (quote ?? char);
|
|
156
|
+
}
|
|
157
|
+
if (!quote && char === "#" && /\s/u.test(value[index - 1] ?? "")) {
|
|
158
|
+
return value.slice(0, index).trimEnd();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return value;
|
|
162
|
+
}
|
|
163
|
+
function unquoteScalar(value) {
|
|
164
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
165
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
166
|
+
return value.slice(1, -1);
|
|
167
|
+
}
|
|
168
|
+
return value;
|
|
169
|
+
}
|
|
170
|
+
function splitTopLevelList(value, trackContainerDepth = false, preserveEmptyItems = false) {
|
|
171
|
+
const items = [];
|
|
172
|
+
let current = "";
|
|
173
|
+
let quote;
|
|
174
|
+
let braceDepth = 0;
|
|
175
|
+
let bracketDepth = 0;
|
|
176
|
+
let parenDepth = 0;
|
|
177
|
+
for (const char of value) {
|
|
178
|
+
if ((char === '"' || char === "'") && !quote) {
|
|
179
|
+
quote = char;
|
|
180
|
+
current += char;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (quote === char) {
|
|
184
|
+
quote = undefined;
|
|
185
|
+
current += char;
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
if (!quote && char === "(")
|
|
189
|
+
parenDepth += 1;
|
|
190
|
+
if (!quote && char === ")")
|
|
191
|
+
parenDepth = Math.max(0, parenDepth - 1);
|
|
192
|
+
if (!quote && trackContainerDepth && char === "{")
|
|
193
|
+
braceDepth += 1;
|
|
194
|
+
if (!quote && trackContainerDepth && char === "}")
|
|
195
|
+
braceDepth = Math.max(0, braceDepth - 1);
|
|
196
|
+
if (!quote && trackContainerDepth && char === "[")
|
|
197
|
+
bracketDepth += 1;
|
|
198
|
+
if (!quote && trackContainerDepth && char === "]")
|
|
199
|
+
bracketDepth = Math.max(0, bracketDepth - 1);
|
|
200
|
+
if (!quote && parenDepth === 0 && braceDepth === 0 && bracketDepth === 0 && char === ",") {
|
|
201
|
+
if (current.trim() || preserveEmptyItems)
|
|
202
|
+
items.push(current.trim());
|
|
203
|
+
current = "";
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
current += char;
|
|
207
|
+
}
|
|
208
|
+
if (current.trim())
|
|
209
|
+
items.push(current.trim());
|
|
210
|
+
return items;
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=subagent-profile-frontmatter.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AgentProfile, AgentProfileSource, AgentProfileParseDiagnostic } from "./subagent-profile.js";
|
|
2
|
+
export declare function parseAgentProfileFromMarkdown(input: {
|
|
3
|
+
content: string;
|
|
4
|
+
path?: string;
|
|
5
|
+
source: AgentProfileSource;
|
|
6
|
+
}): {
|
|
7
|
+
diagnostic?: AgentProfileParseDiagnostic;
|
|
8
|
+
profile?: AgentProfile;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=subagent-profile-parser.d.ts.map
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { parseAgentFrontmatter, splitMarkdownFrontmatter } from "./subagent-profile-frontmatter.js";
|
|
2
|
+
import { parseSubagentMarkdownSelection } from "./subagent-markdown-selection.js";
|
|
3
|
+
const VALID_COLORS = new Set([
|
|
4
|
+
"red",
|
|
5
|
+
"blue",
|
|
6
|
+
"green",
|
|
7
|
+
"yellow",
|
|
8
|
+
"purple",
|
|
9
|
+
"orange",
|
|
10
|
+
"pink",
|
|
11
|
+
"cyan",
|
|
12
|
+
]);
|
|
13
|
+
const VALID_PERMISSION_MODES = new Set([
|
|
14
|
+
"acceptEdits",
|
|
15
|
+
"auto",
|
|
16
|
+
"bypassPermissions",
|
|
17
|
+
"default",
|
|
18
|
+
"dontAsk",
|
|
19
|
+
"plan",
|
|
20
|
+
]);
|
|
21
|
+
const VALID_MEMORY_SCOPES = new Set(["user", "project", "local"]);
|
|
22
|
+
export function parseAgentProfileFromMarkdown(input) {
|
|
23
|
+
const parsed = splitMarkdownFrontmatter(input.content);
|
|
24
|
+
if (!parsed.frontmatter) {
|
|
25
|
+
return {
|
|
26
|
+
diagnostic: {
|
|
27
|
+
code: "agent_missing_frontmatter",
|
|
28
|
+
message: `Agent Markdown must include frontmatter: ${input.path ?? "<inline>"}`,
|
|
29
|
+
path: input.path,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const { mcpServers, values: frontmatter } = parseAgentFrontmatter(parsed.frontmatter);
|
|
34
|
+
const name = scalarString(frontmatter.name);
|
|
35
|
+
const description = scalarString(frontmatter.description)?.replace(/\\n/gu, "\n");
|
|
36
|
+
if (!name) {
|
|
37
|
+
return missingRequiredDiagnostic("name", input.path);
|
|
38
|
+
}
|
|
39
|
+
if (!description) {
|
|
40
|
+
return missingRequiredDiagnostic("description", input.path);
|
|
41
|
+
}
|
|
42
|
+
const modelSelection = parseSubagentMarkdownSelection(frontmatter);
|
|
43
|
+
const color = normalizeColor(scalarString(frontmatter.color));
|
|
44
|
+
const parsedPermissionMode = normalizePermissionMode(scalarString(frontmatter.permissionMode));
|
|
45
|
+
// 修复原因:项目级 subagent markdown 属于仓库输入,不能通过 frontmatter 把
|
|
46
|
+
// child runtime 提升到 bypass/yolo;权限模式只接受用户级或受信插件配置。
|
|
47
|
+
const permissionMode = input.source === "project" ? undefined : parsedPermissionMode;
|
|
48
|
+
const maxTurns = normalizePositiveInteger(frontmatter.maxTurns);
|
|
49
|
+
const memory = parseAgentMemoryScope(frontmatter.memory);
|
|
50
|
+
const memoryDiagnostic = frontmatter.memory !== undefined && memory === undefined
|
|
51
|
+
? {
|
|
52
|
+
code: "agent_invalid_memory_scope",
|
|
53
|
+
message: `Agent frontmatter memory must be user, project, or local: ${input.path ?? "<inline>"}`,
|
|
54
|
+
path: input.path,
|
|
55
|
+
}
|
|
56
|
+
: undefined;
|
|
57
|
+
if (mcpServers === null) {
|
|
58
|
+
return {
|
|
59
|
+
diagnostic: {
|
|
60
|
+
code: "agent_invalid_mcp_servers",
|
|
61
|
+
message: `Agent frontmatter mcpServers must be a list of parent server names: ${input.path ?? "<inline>"}`,
|
|
62
|
+
path: input.path,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
...(memoryDiagnostic ? { diagnostic: memoryDiagnostic } : {}),
|
|
68
|
+
profile: {
|
|
69
|
+
name,
|
|
70
|
+
description,
|
|
71
|
+
source: input.source,
|
|
72
|
+
systemPrompt: parsed.body.trim(),
|
|
73
|
+
...(input.path ? { path: input.path } : {}),
|
|
74
|
+
...(modelSelection ? { modelSelection } : {}),
|
|
75
|
+
...(color ? { color } : {}),
|
|
76
|
+
...(permissionMode ? { permissionMode } : {}),
|
|
77
|
+
...(maxTurns ? { maxTurns } : {}),
|
|
78
|
+
...(memory ? { memory } : {}),
|
|
79
|
+
...optionalList("tools", frontmatter.tools),
|
|
80
|
+
...optionalList("disallowedTools", frontmatter.disallowedTools),
|
|
81
|
+
...optionalList("skills", frontmatter.skills),
|
|
82
|
+
...optionalBoolean("background", frontmatter.background),
|
|
83
|
+
...optionalBoolean("injectAgentsMd", frontmatter.injectAgentsMd),
|
|
84
|
+
...(mcpServers === undefined ? {} : { mcpServers }),
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function parseAgentMemoryScope(value) {
|
|
89
|
+
return typeof value === "string" && VALID_MEMORY_SCOPES.has(value)
|
|
90
|
+
? value
|
|
91
|
+
: undefined;
|
|
92
|
+
}
|
|
93
|
+
function missingRequiredDiagnostic(field, path) {
|
|
94
|
+
return {
|
|
95
|
+
diagnostic: {
|
|
96
|
+
code: "agent_missing_required_frontmatter",
|
|
97
|
+
message: `Agent frontmatter must include ${field}: ${path ?? "<inline>"}`,
|
|
98
|
+
path,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function parseToolList(value) {
|
|
103
|
+
if (Array.isArray(value)) {
|
|
104
|
+
return normalizeToolNames(normalizeStringList(value));
|
|
105
|
+
}
|
|
106
|
+
if (typeof value !== "string")
|
|
107
|
+
return undefined;
|
|
108
|
+
const result = [];
|
|
109
|
+
let current = "";
|
|
110
|
+
let parenDepth = 0;
|
|
111
|
+
for (const char of value) {
|
|
112
|
+
if (char === "(")
|
|
113
|
+
parenDepth += 1;
|
|
114
|
+
if (char === ")")
|
|
115
|
+
parenDepth = Math.max(0, parenDepth - 1);
|
|
116
|
+
if (parenDepth === 0 && (char === "," || /\s/u.test(char))) {
|
|
117
|
+
if (current.trim())
|
|
118
|
+
result.push(current.trim());
|
|
119
|
+
current = "";
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
current += char;
|
|
123
|
+
}
|
|
124
|
+
if (current.trim())
|
|
125
|
+
result.push(current.trim());
|
|
126
|
+
return normalizeToolNames(result);
|
|
127
|
+
}
|
|
128
|
+
function optionalList(key, value) {
|
|
129
|
+
const list = key === "skills" ? normalizeStringList(value) : parseToolList(value);
|
|
130
|
+
if (list && list.length > 0)
|
|
131
|
+
return { [key]: list };
|
|
132
|
+
if (key === "tools" && Array.isArray(value)) {
|
|
133
|
+
return { tools: [] };
|
|
134
|
+
}
|
|
135
|
+
return {};
|
|
136
|
+
}
|
|
137
|
+
function optionalBoolean(key, value) {
|
|
138
|
+
if (typeof value === "boolean")
|
|
139
|
+
return { [key]: value };
|
|
140
|
+
if (typeof value === "string") {
|
|
141
|
+
if (value.toLowerCase() === "true")
|
|
142
|
+
return { [key]: true };
|
|
143
|
+
if (value.toLowerCase() === "false")
|
|
144
|
+
return { [key]: false };
|
|
145
|
+
}
|
|
146
|
+
return {};
|
|
147
|
+
}
|
|
148
|
+
function normalizeStringList(value) {
|
|
149
|
+
if (Array.isArray(value)) {
|
|
150
|
+
const list = value.filter((item) => typeof item === "string" && item.length > 0);
|
|
151
|
+
return list.length > 0 ? list : undefined;
|
|
152
|
+
}
|
|
153
|
+
if (typeof value !== "string")
|
|
154
|
+
return undefined;
|
|
155
|
+
const list = value
|
|
156
|
+
.split(/[,\s]+/u)
|
|
157
|
+
.map((item) => item.trim())
|
|
158
|
+
.filter(Boolean);
|
|
159
|
+
return list.length > 0 ? list : undefined;
|
|
160
|
+
}
|
|
161
|
+
function scalarString(value) {
|
|
162
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
|
|
163
|
+
}
|
|
164
|
+
function normalizeColor(value) {
|
|
165
|
+
if (!value)
|
|
166
|
+
return undefined;
|
|
167
|
+
return VALID_COLORS.has(value)
|
|
168
|
+
? value
|
|
169
|
+
: undefined;
|
|
170
|
+
}
|
|
171
|
+
function normalizePermissionMode(value) {
|
|
172
|
+
if (!value)
|
|
173
|
+
return undefined;
|
|
174
|
+
return VALID_PERMISSION_MODES.has(value)
|
|
175
|
+
? value
|
|
176
|
+
: undefined;
|
|
177
|
+
}
|
|
178
|
+
function normalizePositiveInteger(value) {
|
|
179
|
+
if (typeof value === "number" && Number.isInteger(value) && value > 0)
|
|
180
|
+
return value;
|
|
181
|
+
if (typeof value === "string" && /^\d+$/u.test(value)) {
|
|
182
|
+
const parsed = Number(value);
|
|
183
|
+
return parsed > 0 ? parsed : undefined;
|
|
184
|
+
}
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
function normalizeToolNames(values) {
|
|
188
|
+
if (!values)
|
|
189
|
+
return undefined;
|
|
190
|
+
const names = values.map(toolNameFromSpec).filter((item) => item.length > 0);
|
|
191
|
+
return names.length > 0 ? names : undefined;
|
|
192
|
+
}
|
|
193
|
+
function toolNameFromSpec(value) {
|
|
194
|
+
const trimmed = value.trim();
|
|
195
|
+
const parenIndex = trimmed.indexOf("(");
|
|
196
|
+
if (parenIndex < 0)
|
|
197
|
+
return trimmed;
|
|
198
|
+
return trimmed.slice(0, parenIndex).trim();
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=subagent-profile-parser.js.map
|