@ai-setting/roy-agent-core 1.7.52 → 1.7.55
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/config/config-component.d.ts +346 -0
- package/dist/config/config-parser.d.ts +45 -0
- package/dist/config/env-key.d.ts +97 -0
- package/dist/config/env-source.d.ts +113 -0
- package/dist/config/file-source.d.ts +90 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/protocol-resolver.d.ts +94 -0
- package/dist/env/agent/agent-component.d.ts +646 -0
- package/dist/env/agent/agent-config-registration.d.ts +18 -0
- package/dist/env/agent/agent-registry.d.ts +500 -0
- package/dist/env/agent/index.d.ts +9 -0
- package/dist/env/agent/index.js +3 -3
- package/dist/env/agent/summary-agent.d.ts +44 -0
- package/dist/env/agent/types.d.ts +503 -0
- package/dist/env/commands/commands-component.d.ts +97 -0
- package/dist/env/commands/commands-config-registration.d.ts +19 -0
- package/dist/env/commands/index.d.ts +7 -0
- package/dist/env/commands/parser.d.ts +18 -0
- package/dist/env/commands/types.d.ts +133 -0
- package/dist/env/component.d.ts +186 -0
- package/dist/env/constants.d.ts +112 -0
- package/dist/env/context/env-context.d.ts +420 -0
- package/dist/env/context/env-event.d.ts +144 -0
- package/dist/env/context/index.d.ts +13 -0
- package/dist/env/debug/debug-component.d.ts +160 -0
- package/dist/env/debug/formatters/index.d.ts +8 -0
- package/dist/env/debug/formatters/repl-formatter.d.ts +80 -0
- package/dist/env/debug/formatters/trace-formatter.d.ts +43 -0
- package/dist/env/debug/formatters/tree-formatter.d.ts +72 -0
- package/dist/env/debug/index.d.ts +15 -0
- package/dist/env/debug/index.js +1 -1
- package/dist/env/debug/parser/regex-parser.d.ts +49 -0
- package/dist/env/debug/parser/span-builder.d.ts +79 -0
- package/dist/env/debug/reader/log-reader.d.ts +55 -0
- package/dist/env/debug/reader/span-db-reader.d.ts +70 -0
- package/dist/env/debug/types.d.ts +145 -0
- package/dist/env/environment.d.ts +185 -0
- package/dist/env/error-reply.d.ts +184 -0
- package/dist/env/errors.d.ts +120 -0
- package/dist/env/event-source/bounty-cli-handler.d.ts +42 -0
- package/dist/env/event-source/bounty-im-handler.d.ts +232 -0
- package/dist/env/event-source/event-source-component.d.ts +177 -0
- package/dist/env/event-source/event-source-config-registration.d.ts +18 -0
- package/dist/env/event-source/event-source-handlers.d.ts +472 -0
- package/dist/env/event-source/event-store.d.ts +110 -0
- package/dist/env/event-source/idempotency-key.d.ts +19 -0
- package/dist/env/event-source/index.d.ts +15 -0
- package/dist/env/event-source/index.js +6 -6
- package/dist/env/event-source/timer-handler.d.ts +74 -0
- package/dist/env/event-source/types.d.ts +803 -0
- package/dist/env/hook/global-hook-manager.d.ts +73 -0
- package/dist/env/hook/hook-manager.d.ts +139 -0
- package/dist/env/hook/index.d.ts +9 -0
- package/dist/env/hook/types.d.ts +107 -0
- package/dist/env/index.d.ts +24 -0
- package/dist/env/index.js +18 -18
- package/dist/env/interface.d.ts +156 -0
- package/dist/env/lark-mention-utils.d.ts +59 -0
- package/dist/env/llm/adapter-ai-sdk.d.ts +10 -0
- package/dist/env/llm/adapter-pi-ai.d.ts +184 -0
- package/dist/env/llm/adapter.d.ts +100 -0
- package/dist/env/llm/factory.d.ts +13 -0
- package/dist/env/llm/hooks.d.ts +150 -0
- package/dist/env/llm/index.d.ts +16 -0
- package/dist/env/llm/index.js +2 -2
- package/dist/env/llm/invoke.d.ts +304 -0
- package/dist/env/llm/llm-cache.d.ts +38 -0
- package/dist/env/llm/llm.d.ts +263 -0
- package/dist/env/llm/opencode-session.d.ts +79 -0
- package/dist/env/llm/provider.d.ts +40 -0
- package/dist/env/llm/reasoning-defense.d.ts +104 -0
- package/dist/env/llm/tool-args-parser.d.ts +77 -0
- package/dist/env/llm/tool-schema.d.ts +54 -0
- package/dist/env/llm/transform.d.ts +57 -0
- package/dist/env/llm/types.d.ts +844 -0
- package/dist/env/log-trace/decorator.d.ts +88 -0
- package/dist/env/log-trace/index.d.ts +14 -0
- package/dist/env/log-trace/log-trace-component.d.ts +268 -0
- package/dist/env/log-trace/log-trace-config-registration.d.ts +25 -0
- package/dist/env/log-trace/logger.d.ts +83 -0
- package/dist/env/log-trace/opentelemetry/cli-propagation.d.ts +105 -0
- package/dist/env/log-trace/opentelemetry/mod.d.ts +24 -0
- package/dist/env/log-trace/opentelemetry/propagation-env.d.ts +81 -0
- package/dist/env/log-trace/opentelemetry/propagation.d.ts +79 -0
- package/dist/env/log-trace/opentelemetry/tracer-provider.d.ts +157 -0
- package/dist/env/log-trace/span-storage.d.ts +37 -0
- package/dist/env/log-trace/trace-context.d.ts +28 -0
- package/dist/env/log-trace/types.d.ts +127 -0
- package/dist/env/mcp/command-resolver.d.ts +12 -0
- package/dist/env/mcp/config.d.ts +103 -0
- package/dist/env/mcp/index.d.ts +13 -0
- package/dist/env/mcp/loader.d.ts +78 -0
- package/dist/env/mcp/mcp-component.d.ts +54 -0
- package/dist/env/mcp/mcp-config-registration.d.ts +19 -0
- package/dist/env/mcp/npm-prefix/index.d.ts +17 -0
- package/dist/env/mcp/scanner.d.ts +38 -0
- package/dist/env/mcp/tool/adapter.d.ts +32 -0
- package/dist/env/mcp/tool/index.d.ts +4 -0
- package/dist/env/mcp/types.d.ts +131 -0
- package/dist/env/memory/built-in/index.d.ts +41 -0
- package/dist/env/memory/built-in/recall-memory.d.ts +29 -0
- package/dist/env/memory/built-in/record-memory.d.ts +44 -0
- package/dist/env/memory/index.d.ts +10 -0
- package/dist/env/memory/memory-component.d.ts +114 -0
- package/dist/env/memory/memory-config-registration.d.ts +18 -0
- package/dist/env/memory/memory-config.d.ts +18 -0
- package/dist/env/memory/plugin/index.d.ts +16 -0
- package/dist/env/memory/plugin/memory-agent.d.ts +126 -0
- package/dist/env/memory/plugin/memory-manager.d.ts +71 -0
- package/dist/env/memory/plugin/memory-plugin.d.ts +103 -0
- package/dist/env/memory/plugin/recall-memory.d.ts +16 -0
- package/dist/env/memory/plugin/types.d.ts +75 -0
- package/dist/env/memory/tools/memory-agent-tools.d.ts +109 -0
- package/dist/env/memory/types.d.ts +80 -0
- package/dist/env/paths.d.ts +46 -0
- package/dist/env/plugin/bounty-cli-notification-channel.d.ts +60 -0
- package/dist/env/plugin/event-bus-notification-channel.d.ts +50 -0
- package/dist/env/plugin/index.d.ts +13 -0
- package/dist/env/plugin/lark-cli-notification-channel.d.ts +61 -0
- package/dist/env/plugin/notification-channel.d.ts +143 -0
- package/dist/env/plugin/plugin-component.d.ts +232 -0
- package/dist/env/plugin/types.d.ts +146 -0
- package/dist/env/prompt/index.d.ts +7 -0
- package/dist/env/prompt/index.js +2 -2
- package/dist/env/prompt/prompt-component.d.ts +194 -0
- package/dist/env/prompt/prompt-config-registration.d.ts +18 -0
- package/dist/env/prompt/prompt-store.d.ts +26 -0
- package/dist/env/prompt/prompts-index.d.ts +146 -0
- package/dist/env/prompt/renderer.d.ts +21 -0
- package/dist/env/prompt/types.d.ts +176 -0
- package/dist/env/session/hooks.d.ts +14 -0
- package/dist/env/session/index.d.ts +19 -0
- package/dist/env/session/index.js +4 -4
- package/dist/env/session/search-query-parser.d.ts +41 -0
- package/dist/env/session/session-component.d.ts +464 -0
- package/dist/env/session/session-config-registration.d.ts +18 -0
- package/dist/env/session/session-id.d.ts +26 -0
- package/dist/env/session/session-message-converter.d.ts +142 -0
- package/dist/env/session/session-store.d.ts +188 -0
- package/dist/env/session/storage/index.d.ts +5 -0
- package/dist/env/session/storage/index.js +3 -3
- package/dist/env/session/storage/memory.d.ts +119 -0
- package/dist/env/session/storage/sqlite.d.ts +108 -0
- package/dist/env/session/types.d.ts +705 -0
- package/dist/env/session-tree-stopper.d.ts +79 -0
- package/dist/env/skill/config.d.ts +13 -0
- package/dist/env/skill/index.d.ts +6 -0
- package/dist/env/skill/parser.d.ts +9 -0
- package/dist/env/skill/scanner.d.ts +25 -0
- package/dist/env/skill/skill-component.d.ts +89 -0
- package/dist/env/skill/skill-config-registration.d.ts +18 -0
- package/dist/env/skill/tool/index.d.ts +1 -0
- package/dist/env/skill/tool/skill-tool.d.ts +15 -0
- package/dist/env/skill/types.d.ts +61 -0
- package/dist/env/task/backend/index.d.ts +24 -0
- package/dist/env/task/backend/index.js +702 -0
- package/dist/env/task/backend/roy-sidecar-task-port.d.ts +148 -0
- package/dist/env/task/backend/sqlite-task-port.d.ts +28 -0
- package/dist/env/task/backend/task-store-backend.d.ts +107 -0
- package/dist/env/task/backend/types.d.ts +282 -0
- package/dist/env/task/delegate/bg-task-id-storage.d.ts +9 -0
- package/dist/env/task/delegate/delegate-tool.d.ts +681 -0
- package/dist/env/task/delegate/index.d.ts +8 -0
- package/dist/env/task/delegate/index.js +2 -2
- package/dist/env/task/delegate/process-registry.d.ts +58 -0
- package/dist/env/task/delegate/stop-tool.d.ts +12 -0
- package/dist/env/task/delegate/subagent-resolver.d.ts +25 -0
- package/dist/env/task/events/index.d.ts +7 -0
- package/dist/env/task/events/task-event-payloads.d.ts +101 -0
- package/dist/env/task/events/task-event-types.d.ts +23 -0
- package/dist/env/task/hooks/contexts.d.ts +191 -0
- package/dist/env/task/hooks/index.d.ts +7 -0
- package/dist/env/task/hooks/task-hook-points.d.ts +42 -0
- package/dist/env/task/index.d.ts +7 -0
- package/dist/env/task/index.js +3 -3
- package/dist/env/task/plugins/auto-task-plugin.d.ts +38 -0
- package/dist/env/task/plugins/card-chat-routing.d.ts +88 -0
- package/dist/env/task/plugins/fake-user-message-helper.d.ts +90 -0
- package/dist/env/task/plugins/index.d.ts +8 -0
- package/dist/env/task/plugins/index.js +4 -4
- package/dist/env/task/plugins/lark-card-action-handler.d.ts +166 -0
- package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +600 -0
- package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +231 -0
- package/dist/env/task/plugins/max-iteration-reminder-plugin.d.ts +112 -0
- package/dist/env/task/plugins/per-task-group-chat-plugin.d.ts +561 -0
- package/dist/env/task/plugins/task-tag-plugin.d.ts +70 -0
- package/dist/env/task/plugins/workflow-extractor-agent.d.ts +43 -0
- package/dist/env/task/registry-hook-installer.d.ts +43 -0
- package/dist/env/task/storage/index.d.ts +5 -0
- package/dist/env/task/storage/migrations/001_add_project_path_context.d.ts +14 -0
- package/dist/env/task/storage/migrations/002_add_task_type.d.ts +14 -0
- package/dist/env/task/storage/migrations/003_add_process_description.d.ts +20 -0
- package/dist/env/task/storage/migrations/004_rename_action_to_milestone.d.ts +37 -0
- package/dist/env/task/storage/migrations/005_convert_blob_description_to_text.d.ts +51 -0
- package/dist/env/task/storage/sqlite-task-store.d.ts +241 -0
- package/dist/env/task/tag-service.d.ts +138 -0
- package/dist/env/task/task-child-context.d.ts +70 -0
- package/dist/env/task/task-component.d.ts +270 -0
- package/dist/env/task/task-config-registration.d.ts +19 -0
- package/dist/env/task/task-creation-registry.d.ts +181 -0
- package/dist/env/task/task-reuse-context.d.ts +52 -0
- package/dist/env/task/task-reuse-registry.d.ts +31 -0
- package/dist/env/task/tools/batch-archive-tool.d.ts +9 -0
- package/dist/env/task/tools/batch-delete-tool.d.ts +9 -0
- package/dist/env/task/tools/complete-tool.d.ts +12 -0
- package/dist/env/task/tools/create-tool.d.ts +6 -0
- package/dist/env/task/tools/delete-tool.d.ts +6 -0
- package/dist/env/task/tools/get-tool.d.ts +6 -0
- package/dist/env/task/tools/index.d.ts +13 -0
- package/dist/env/task/tools/list-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/create-tool.d.ts +12 -0
- package/dist/env/task/tools/operation/delete-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/get-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/index.d.ts +8 -0
- package/dist/env/task/tools/operation/list-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/operation-types.d.ts +225 -0
- package/dist/env/task/tools/operation/update-tool.d.ts +6 -0
- package/dist/env/task/tools/search-tool.d.ts +9 -0
- package/dist/env/task/tools/task-tree-tool.d.ts +65 -0
- package/dist/env/task/tools/task-types.d.ts +255 -0
- package/dist/env/task/tools/update-tool.d.ts +6 -0
- package/dist/env/task/types.d.ts +290 -0
- package/dist/env/tool/built-in/bash-effect.d.ts +36 -0
- package/dist/env/tool/built-in/bash.d.ts +16 -0
- package/dist/env/tool/built-in/echo.d.ts +7 -0
- package/dist/env/tool/built-in/edit-file.d.ts +6 -0
- package/dist/env/tool/built-in/glob.d.ts +6 -0
- package/dist/env/tool/built-in/grep.d.ts +6 -0
- package/dist/env/tool/built-in/index.d.ts +39 -0
- package/dist/env/tool/built-in/query-background-process-tool.d.ts +113 -0
- package/dist/env/tool/built-in/read-file.d.ts +5 -0
- package/dist/env/tool/built-in/understand-image.d.ts +59 -0
- package/dist/env/tool/built-in/write-file.d.ts +5 -0
- package/dist/env/tool/index.d.ts +16 -0
- package/dist/env/tool/registry.d.ts +61 -0
- package/dist/env/tool/tool-component.d.ts +242 -0
- package/dist/env/tool/tool-config-registration.d.ts +18 -0
- package/dist/env/tool/types.d.ts +274 -0
- package/dist/env/tool/validator.d.ts +14 -0
- package/dist/env/types.d.ts +184 -0
- package/dist/env/workflow/decorators/decorator-node.d.ts +76 -0
- package/dist/env/workflow/decorators/edge.d.ts +42 -0
- package/dist/env/workflow/decorators/index.d.ts +13 -0
- package/dist/env/workflow/decorators/node-as.d.ts +40 -0
- package/dist/env/workflow/decorators/workflow.d.ts +30 -0
- package/dist/env/workflow/engine/dag-manager.d.ts +176 -0
- package/dist/env/workflow/engine/engine.d.ts +440 -0
- package/dist/env/workflow/engine/event-bus.d.ts +54 -0
- package/dist/env/workflow/engine/executor.d.ts +122 -0
- package/dist/env/workflow/engine/index.d.ts +15 -0
- package/dist/env/workflow/engine/index.js +2 -2
- package/dist/env/workflow/engine/node-registry.d.ts +159 -0
- package/dist/env/workflow/engine/scheduler.d.ts +164 -0
- package/dist/env/workflow/extractor/workflow-converter.d.ts +55 -0
- package/dist/env/workflow/fixtures.d.ts +401 -0
- package/dist/env/workflow/hooks/index.d.ts +4 -0
- package/dist/env/workflow/hooks/workflow-hook-points.d.ts +161 -0
- package/dist/env/workflow/index.d.ts +30 -0
- package/dist/env/workflow/index.js +9 -9
- package/dist/env/workflow/metadata/keys.d.ts +6 -0
- package/dist/env/workflow/nodes/agent-component-adapter.d.ts +175 -0
- package/dist/env/workflow/nodes/agent-node.d.ts +206 -0
- package/dist/env/workflow/nodes/ask-user-node.d.ts +66 -0
- package/dist/env/workflow/nodes/condition-node.d.ts +39 -0
- package/dist/env/workflow/nodes/index.d.ts +8 -0
- package/dist/env/workflow/nodes/index.js +1 -1
- package/dist/env/workflow/nodes/merge-node.d.ts +40 -0
- package/dist/env/workflow/nodes/python-call-node.d.ts +95 -0
- package/dist/env/workflow/nodes/skill-node.d.ts +29 -0
- package/dist/env/workflow/nodes/tool-node.d.ts +64 -0
- package/dist/env/workflow/nodes/workflow-node.d.ts +118 -0
- package/dist/env/workflow/plugins/index.d.ts +6 -0
- package/dist/env/workflow/plugins/index.js +2 -2
- package/dist/env/workflow/plugins/lark-cli-workflow-notify-plugin.d.ts +107 -0
- package/dist/env/workflow/plugins/workflow-json-output-plugin.d.ts +166 -0
- package/dist/env/workflow/runtime/runtime-cancellation-scope.d.ts +121 -0
- package/dist/env/workflow/service/index.d.ts +9 -0
- package/dist/env/workflow/service/registry.d.ts +37 -0
- package/dist/env/workflow/service/workflow-service.d.ts +422 -0
- package/dist/env/workflow/storage/index.d.ts +11 -0
- package/dist/env/workflow/storage/mock-repositories.d.ts +106 -0
- package/dist/env/workflow/storage/safe-json.d.ts +62 -0
- package/dist/env/workflow/storage/sqlite.d.ts +57 -0
- package/dist/env/workflow/storage/tag-repo.d.ts +65 -0
- package/dist/env/workflow/storage/workflow-repo.d.ts +161 -0
- package/dist/env/workflow/tools/ask-user-tool.d.ts +35 -0
- package/dist/env/workflow/tools/index.d.ts +16 -0
- package/dist/env/workflow/tools/index.js +6 -6
- package/dist/env/workflow/tools/run-workflow.d.ts +130 -0
- package/dist/env/workflow/tools/submit-json-output-tool.d.ts +38 -0
- package/dist/env/workflow/tools/workflow-add-tool.d.ts +47 -0
- package/dist/env/workflow/tools/workflow-get-tool.d.ts +29 -0
- package/dist/env/workflow/tools/workflow-list-tool.d.ts +55 -0
- package/dist/env/workflow/tools/workflow-run-status-tool.d.ts +26 -0
- package/dist/env/workflow/tools/workflow-run-stop-tool.d.ts +29 -0
- package/dist/env/workflow/tools/workflow-search-tool.d.ts +33 -0
- package/dist/env/workflow/tools/workflow-tag-list-tool.d.ts +59 -0
- package/dist/env/workflow/tools/workflow-validate-tool.d.ts +69 -0
- package/dist/env/workflow/types/context.d.ts +17 -0
- package/dist/env/workflow/types/decorators-types.d.ts +182 -0
- package/dist/env/workflow/types/edge.d.ts +33 -0
- package/dist/env/workflow/types/event.d.ts +869 -0
- package/dist/env/workflow/types/index.d.ts +16 -0
- package/dist/env/workflow/types/run.d.ts +254 -0
- package/dist/env/workflow/types/workflow-error.d.ts +79 -0
- package/dist/env/workflow/types/workflow-hil.d.ts +57 -0
- package/dist/env/workflow/types/workflow-message.d.ts +193 -0
- package/dist/env/workflow/types/workflow-session.d.ts +17 -0
- package/dist/env/workflow/types/workflow.d.ts +654 -0
- package/dist/env/workflow/types_compat.d.ts +10 -0
- package/dist/env/workflow/utils/agent-session-metadata.d.ts +48 -0
- package/dist/env/workflow/utils/build-agent-node-output.d.ts +11 -0
- package/dist/env/workflow/utils/create-workflow.d.ts +35 -0
- package/dist/env/workflow/utils/dependency-prescan.d.ts +67 -0
- package/dist/env/workflow/utils/execution-state.d.ts +46 -0
- package/dist/env/workflow/utils/extract-agent-json-output.d.ts +6 -0
- package/dist/env/workflow/utils/index.d.ts +14 -0
- package/dist/env/workflow/utils/index.js +1 -1
- package/dist/env/workflow/utils/json-schema-to-zod.d.ts +23 -0
- package/dist/env/workflow/utils/node-id-utils.d.ts +20 -0
- package/dist/env/workflow/utils/node-output-contracts.d.ts +137 -0
- package/dist/env/workflow/utils/node-registry-helper.d.ts +36 -0
- package/dist/env/workflow/utils/output-schema-hint.d.ts +7 -0
- package/dist/env/workflow/utils/parse-agent-output-config.d.ts +9 -0
- package/dist/env/workflow/utils/recovery-validator.d.ts +30 -0
- package/dist/env/workflow/utils/redact-command-secrets.d.ts +70 -0
- package/dist/env/workflow/utils/sensitive-redact.d.ts +37 -0
- package/dist/env/workflow/utils/session-parser.d.ts +23 -0
- package/dist/env/workflow/utils/session-recovery.d.ts +122 -0
- package/dist/env/workflow/utils/shell-dialect-lint.d.ts +75 -0
- package/dist/env/workflow/utils/template-contract-validator.d.ts +87 -0
- package/dist/env/workflow/utils/template-resolver.d.ts +285 -0
- package/dist/env/workflow/utils/validate-workflow-definition.d.ts +79 -0
- package/dist/env/workflow/utils/validation-rules.d.ts +103 -0
- package/dist/env/workflow/utils/workflow-message-metadata.d.ts +20 -0
- package/dist/env/workflow/utils/workflow-sanitize.d.ts +51 -0
- package/dist/env/workflow/workflow-component.d.ts +138 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +21 -21
- package/dist/shared/@ai-setting/{roy-agent-core-stnddvx9.js → roy-agent-core-12d2xap8.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-pk1b3kvf.js → roy-agent-core-2b8jtv7m.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-x8n1r7h4.js → roy-agent-core-2bscfrr1.js} +188 -7
- package/dist/shared/@ai-setting/{roy-agent-core-gdsqp6j8.js → roy-agent-core-6masakz4.js} +45 -0
- package/dist/shared/@ai-setting/{roy-agent-core-vvxb9522.js → roy-agent-core-6qxh4xrm.js} +67 -6
- package/dist/shared/@ai-setting/{roy-agent-core-h93v6p6y.js → roy-agent-core-7qy3nffr.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-s214vmmd.js → roy-agent-core-8eqngasy.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-brwzs8wf.js → roy-agent-core-9h72sk1n.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-na73mym1.js → roy-agent-core-a4vzsn0g.js} +212 -1
- package/dist/shared/@ai-setting/{roy-agent-core-35s1w7tc.js → roy-agent-core-aer5kw1j.js} +142 -70
- package/dist/shared/@ai-setting/{roy-agent-core-j8e92gj8.js → roy-agent-core-b5ew8t0k.js} +0 -59
- package/dist/shared/@ai-setting/{roy-agent-core-rcfewbzr.js → roy-agent-core-cd62e9p1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-39xejr39.js → roy-agent-core-e2z1etk4.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-pkpkctvf.js → roy-agent-core-g36jevrk.js} +14 -183
- package/dist/shared/@ai-setting/{roy-agent-core-ezgsem94.js → roy-agent-core-j2nvedt6.js} +465 -128
- package/dist/shared/@ai-setting/{roy-agent-core-p2r27era.js → roy-agent-core-mxdc756a.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-p8ak03s0.js → roy-agent-core-w527pcpe.js} +293 -42
- package/dist/shared/@ai-setting/{roy-agent-core-3tv1q6f2.js → roy-agent-core-ytr2w0vb.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-yd21n6c7.js → roy-agent-core-zvemdfx5.js} +1 -1
- package/dist/test-utils/child-process-mock.d.ts +73 -0
- package/dist/util/process/process-tree-killer.d.ts +67 -0
- package/dist/utils/id.d.ts +11 -0
- package/dist/utils/loose-json.d.ts +30 -0
- package/dist/utils/media.d.ts +70 -0
- package/dist/utils/temp-file-manager/index.d.ts +99 -0
- package/package.json +5 -3
- /package/dist/shared/@ai-setting/{roy-agent-core-zy3hqfwg.js → roy-agent-core-0hq21px2.js} +0 -0
- /package/dist/shared/@ai-setting/{roy-agent-core-0cfaqnz9.js → roy-agent-core-k25gv86p.js} +0 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview PiAiAdapter — 包装 @earendil-works/pi-ai。
|
|
3
|
+
*
|
|
4
|
+
* 这是 roy-agent 默认的 LLM 适配层(ROY_LLM_PROVIDER=pi-ai 时启用)。
|
|
5
|
+
* 把 ChatRequest / ChatResponse / StreamHandle 翻译成 pi-ai 的
|
|
6
|
+
* complete() / stream() / getModel() 三件套。
|
|
7
|
+
*
|
|
8
|
+
* 关键映射:
|
|
9
|
+
* - provider/modelId → getModel(provider, modelId)
|
|
10
|
+
* - LLMMessage[] → pi-ai Context.messages
|
|
11
|
+
* - AssistantMessage.stopReason → ChatResponse.finishReason
|
|
12
|
+
* - usage {input, output, totalTokens} → UsageInfo
|
|
13
|
+
*/
|
|
14
|
+
import { type Model, type Context, type CacheRetention } from "@earendil-works/pi-ai";
|
|
15
|
+
import type { LLMAdapter, ChatRequest, ChatResponse, StreamHandle, ResolvedProvider, EmbedRequest, EmbedResponse } from "./adapter";
|
|
16
|
+
import type { LLMMessage, ToolInfo } from "./types";
|
|
17
|
+
/**
|
|
18
|
+
* Known provider list — 驱动 resolveProvider 的硬编码能力映射
|
|
19
|
+
*
|
|
20
|
+
* `apiProtocol`(Task #4383 P1)是**显式**协议声明,优先于任何 baseURL 猜测。
|
|
21
|
+
* 历史背景:`api` 字段曾被 `resolvePiModel()` 里的字面量特判
|
|
22
|
+
* (`baseURL?.includes("anthropic")`)绕过 —— minimax 因为真实 baseURL 恰好是
|
|
23
|
+
* `https://api.minimaxi.com/anthropic` 才「误打误撞」走对 anthropic-messages,
|
|
24
|
+
* 从而成为三家 provider 里唯一挂上显式 `cache_control` 的那个(#4381 实测 99.86%)。
|
|
25
|
+
* 现在把它变成声明式的,避免「换个 baseURL 就悄悄改了协议」。
|
|
26
|
+
*
|
|
27
|
+
* `api` 保留为**向后兼容**的遗留字段(只在既无 `apiProtocol` 也无 baseURL 线索时兜底)。
|
|
28
|
+
*/
|
|
29
|
+
export declare const KNOWN_PROVIDER_APIS: Record<string, {
|
|
30
|
+
api: string;
|
|
31
|
+
apiProtocol?: string;
|
|
32
|
+
contextLimit: number;
|
|
33
|
+
maxTokensLimit: number;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Resolve the pi-ai API protocol for a provider (Task #4383 P1).
|
|
37
|
+
*
|
|
38
|
+
* Resolution order (first match wins):
|
|
39
|
+
* 1. `explicitProtocol` — caller/config pins it, highest priority
|
|
40
|
+
* 2. `PROVIDER_API_OVERRIDES` — deliberate id-variant pins
|
|
41
|
+
* 3. `PROVIDER_ENDPOINT_APIS[provider]` — declared per-endpoint mapping
|
|
42
|
+
* (only for vendors that genuinely ship two protocols)
|
|
43
|
+
* 4. `KNOWN_PROVIDER_APIS[provider].apiProtocol` — declarative vendor default
|
|
44
|
+
* 5. generic `baseURL` heuristics — backward compat for user-defined proxies
|
|
45
|
+
* (`/responses` → openai-responses, `anthropic` → anthropic-messages).
|
|
46
|
+
* This path logs a warning so we notice configs that should be declared.
|
|
47
|
+
* 6. `KNOWN_PROVIDER_APIS[provider].api` — legacy field
|
|
48
|
+
* 7. `openai-completions` — final fallback
|
|
49
|
+
*
|
|
50
|
+
* @param provider roy-agent provider id from config (e.g. "minimax")
|
|
51
|
+
* @param baseURL resolved provider base URL (may be undefined)
|
|
52
|
+
* @param explicitProtocol optional explicit protocol from caller/config
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveApiProtocol(provider: string, baseURL?: string, explicitProtocol?: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* pi-ai `Model.compat` overrides that make `reasoning: true` a **byte-level
|
|
57
|
+
* no-op** for the openai-completions request body (Task #4403).
|
|
58
|
+
*
|
|
59
|
+
* Both entries are load-bearing and were derived empirically by capturing the
|
|
60
|
+
* real payload through pi-ai's public `onPayload` hook and diffing it against
|
|
61
|
+
* the `reasoning: false` baseline:
|
|
62
|
+
*
|
|
63
|
+
* - `supportsDeveloperRole: false` — without it, `openai-completions.js:591`
|
|
64
|
+
* computes `useDeveloperRole = model.reasoning && compat.supportsDeveloperRole`
|
|
65
|
+
* and rewrites the first message's role from `system` to `developer`.
|
|
66
|
+
* That difference lands at **JSON offset ~40** (the very start of the body),
|
|
67
|
+
* so prompt caching — which is a prefix match — would miss on every turn.
|
|
68
|
+
* - `thinkingFormat: "openai"` — without it, `openai-completions.js:433-475`
|
|
69
|
+
* picks the vendor's native thinking branch and, because roy-agent never
|
|
70
|
+
* passes `options.reasoningEffort`, emits an explicit
|
|
71
|
+
* `thinking: {type: "disabled"}` (deepseek) / `enable_thinking: false`
|
|
72
|
+
* (zai/qwen). That is a new top-level field the provider never saw before.
|
|
73
|
+
*
|
|
74
|
+
* With all three pins the payload is byte-identical to the `reasoning: false`
|
|
75
|
+
* baseline for every CUSTOM provider in the real config (verified for
|
|
76
|
+
* opencodego / glm / minimax / ali / volcengine / tong / opencode, plus
|
|
77
|
+
* deepseek once the Task #4398 `reasoning_content` hook is attached), so
|
|
78
|
+
* turning reasoning on can never regress the cache.
|
|
79
|
+
*
|
|
80
|
+
* Scope caveat: this guarantee covers the **fallback** (custom-provider)
|
|
81
|
+
* branch of `resolvePiModel()`. pi-ai built-ins keep their own hand-tuned
|
|
82
|
+
* `compat`/`reasoning` in the descriptor and are deliberately left alone.
|
|
83
|
+
*/
|
|
84
|
+
export declare const REASONING_COMPAT_PIN: {
|
|
85
|
+
readonly supportsDeveloperRole: false;
|
|
86
|
+
readonly thinkingFormat: "openai";
|
|
87
|
+
readonly supportsReasoningEffort: false;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Protocols where {@link REASONING_COMPAT_PIN} can actually hold the payload
|
|
91
|
+
* byte-stable.
|
|
92
|
+
*
|
|
93
|
+
* `openai-responses` is deliberately excluded: pi-ai flips the system prompt
|
|
94
|
+
* role there **unconditionally** —
|
|
95
|
+
* `openai-responses-shared.js:66: const role = model.reasoning ? "developer" : "system"`
|
|
96
|
+
* — with no `compat` escape hatch (its `getCompat()` only exposes
|
|
97
|
+
* `sendSessionIdHeader` / `supportsLongCacheRetention`). So on that path
|
|
98
|
+
* `reasoning: true` is a guaranteed prefix break, and we keep it off.
|
|
99
|
+
*/
|
|
100
|
+
export declare const REASONING_SAFE_PROTOCOLS: ReadonlySet<string>;
|
|
101
|
+
/**
|
|
102
|
+
* Decide the `reasoning` flag for a pi-ai model descriptor (Task #4403).
|
|
103
|
+
*
|
|
104
|
+
* This replaces the hardcoded `reasoning: false` that `resolvePiModel()` used
|
|
105
|
+
* to emit for every non-built-in (i.e. every custom) provider — the root
|
|
106
|
+
* problem flagged by Task #4398, because that literal silently disabled every
|
|
107
|
+
* `model.reasoning`-gated pi-ai capability.
|
|
108
|
+
*
|
|
109
|
+
* Resolution order:
|
|
110
|
+
* 1. protocol safety guard — see {@link REASONING_SAFE_PROTOCOLS}. Even an
|
|
111
|
+
* explicit `capabilities.reasoning: true` cannot win here, because on
|
|
112
|
+
* `openai-responses` the request prefix is guaranteed to change.
|
|
113
|
+
* 2. explicit config `capabilities.reasoning` (either `true` or `false`).
|
|
114
|
+
* 3. conservative default `false`.
|
|
115
|
+
*
|
|
116
|
+
* Deliberately NO model-name pattern matching. Guessing from names (e.g.
|
|
117
|
+
* "looks like a reasoner") risks emitting provider-specific thinking fields
|
|
118
|
+
* that the backend rejects (400), makes calls slower, and bills thinking
|
|
119
|
+
* tokens as output. Config is the only source of truth; absence means off.
|
|
120
|
+
*
|
|
121
|
+
* @param provider roy-agent provider id (may be a gateway)
|
|
122
|
+
* @param modelId model id requested from the provider
|
|
123
|
+
* @param capabilities `llm.providers.<id>.capabilities` from config
|
|
124
|
+
* @param apiProtocol resolved pi-ai API protocol for this target
|
|
125
|
+
*/
|
|
126
|
+
export declare function resolveModelReasoning(provider: string, modelId: string, capabilities?: {
|
|
127
|
+
reasoning?: boolean;
|
|
128
|
+
}, apiProtocol?: string): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Build the pi-ai cache-related request options (Task #4383 P0).
|
|
131
|
+
*
|
|
132
|
+
* Why this exists (#4381 root cause): pi-ai only emits an explicit cache
|
|
133
|
+
* marker when it is handed the right options. Two independent code paths:
|
|
134
|
+
*
|
|
135
|
+
* - **openai-completions** (`openai-completions.js:394-398`): `prompt_cache_key`
|
|
136
|
+
* is only set when `baseUrl` contains `api.openai.com` **or**
|
|
137
|
+
* `cacheRetention === "long" && compat.supportsLongCacheRetention`.
|
|
138
|
+
* deepseek / glm are neither `api.openai.com` nor passed any retention, so
|
|
139
|
+
* `prompt_cache_key` was permanently `undefined` → they fell back to implicit
|
|
140
|
+
* caching. Passing `cacheRetention: "long"` also sets
|
|
141
|
+
* `prompt_cache_retention: "24h"`.
|
|
142
|
+
* - **anthropic-messages** (`anthropic.js:25-36, 667-707`): `cache_control`
|
|
143
|
+
* markers are attached whenever `cacheRetention !== "none"`, and pi-ai
|
|
144
|
+
* already defaults to `"short"` (ephemeral, no ttl). That default is exactly
|
|
145
|
+
* what makes minimax hit 99.86%, so we must NOT override it — passing
|
|
146
|
+
* `"long"` would add `ttl: "1h"` and silently change current behaviour.
|
|
147
|
+
*
|
|
148
|
+
* Hence: openai-completions defaults to `"long"`, everything else keeps pi-ai's
|
|
149
|
+
* own default unless the caller explicitly asks for a retention.
|
|
150
|
+
*
|
|
151
|
+
* @returns options fragment to spread into `complete()` / `stream()` options.
|
|
152
|
+
* Only keys that should actually be sent are present (no `undefined`
|
|
153
|
+
* values), so `"sessionId" in opts` stays a meaningful assertion.
|
|
154
|
+
*/
|
|
155
|
+
export declare function buildPiCacheOptions(args: {
|
|
156
|
+
apiProtocol: string;
|
|
157
|
+
sessionId?: string;
|
|
158
|
+
cacheRetention?: CacheRetention;
|
|
159
|
+
}): Record<string, unknown>;
|
|
160
|
+
/**
|
|
161
|
+
* Resolve built-in models and models declared by roy-agent configuration.
|
|
162
|
+
* pi-ai's generated registry only contains its bundled provider/model pairs;
|
|
163
|
+
* custom provider ids (for example minimax-openai) need a complete Model
|
|
164
|
+
* descriptor before complete()/stream() can dispatch by API.
|
|
165
|
+
*/
|
|
166
|
+
export declare function resolvePiModel(provider: string, modelId: string, baseURL?: string, capabilities?: {
|
|
167
|
+
reasoning?: boolean;
|
|
168
|
+
}): Model<any>;
|
|
169
|
+
/**
|
|
170
|
+
* 将 LLMMessage 转换为 pi-ai 的消息结构
|
|
171
|
+
*/
|
|
172
|
+
export declare function toPiMessages(messages: LLMMessage[]): Context["messages"];
|
|
173
|
+
export declare function extractSystemPrompt(messages: LLMMessage[]): string | undefined;
|
|
174
|
+
export declare function toPiTools(tools: ToolInfo[] | undefined): Context["tools"];
|
|
175
|
+
export declare class EmbeddingNotSupportedError extends Error {
|
|
176
|
+
constructor(adapter: string);
|
|
177
|
+
}
|
|
178
|
+
export declare class PiAiAdapter implements LLMAdapter {
|
|
179
|
+
readonly name: "pi-ai";
|
|
180
|
+
chat(req: ChatRequest): Promise<ChatResponse>;
|
|
181
|
+
stream(req: ChatRequest): Promise<StreamHandle>;
|
|
182
|
+
embed(_req: EmbedRequest): Promise<EmbedResponse>;
|
|
183
|
+
resolveProvider(provider: string, modelId: string): Promise<ResolvedProvider>;
|
|
184
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview LLM Adapter 抽象接口。
|
|
3
|
+
*
|
|
4
|
+
* roy-agent 的 LLM 接入点统一通过 LLMAdapter;
|
|
5
|
+
* 当前实现:
|
|
6
|
+
* - PiAiAdapter — 包装 @earendil-works/pi-ai(默认路径)
|
|
7
|
+
* - AiSdkAdapter — 包装 Vercel AI SDK(fallback 路径)
|
|
8
|
+
*
|
|
9
|
+
* 通过 {@link createLLMAdapter} 选择,由环境变量 `ROY_LLM_PROVIDER` 控制。
|
|
10
|
+
*/
|
|
11
|
+
import type { LLMMessage, ToolInfo, UsageInfo, ProviderCapabilities } from "./types";
|
|
12
|
+
/** Adapter 名称(联合类型 + 运行时数组) */
|
|
13
|
+
export type AdapterName = "pi-ai" | "ai-sdk";
|
|
14
|
+
/** 运行时可用的 adapter 列表 */
|
|
15
|
+
export declare const ADAPTER_NAMES: readonly AdapterName[];
|
|
16
|
+
/** Provider 解析结果 */
|
|
17
|
+
export interface ResolvedProvider {
|
|
18
|
+
api: string;
|
|
19
|
+
provider: string;
|
|
20
|
+
modelId: string;
|
|
21
|
+
contextLimit: number;
|
|
22
|
+
maxTokensLimit: number;
|
|
23
|
+
}
|
|
24
|
+
/** Chat 请求 */
|
|
25
|
+
export interface ChatRequest {
|
|
26
|
+
provider: string;
|
|
27
|
+
modelId: string;
|
|
28
|
+
messages: LLMMessage[];
|
|
29
|
+
tools?: ToolInfo[];
|
|
30
|
+
systemPrompt?: string;
|
|
31
|
+
temperature?: number;
|
|
32
|
+
maxTokens?: number;
|
|
33
|
+
apiKey: string;
|
|
34
|
+
baseURL?: string;
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
/**
|
|
37
|
+
* Conversation / session id (e.g. roy-agent session id, or the Feishu
|
|
38
|
+
* chat-keyed session id `oc_...`). Used by providers that need a stable
|
|
39
|
+
* per-conversation identifier — notably OpenCode Go, which requires a stable
|
|
40
|
+
* `x-opencode-session` header (see opencode-session.ts).
|
|
41
|
+
*/
|
|
42
|
+
sessionId?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Prompt-cache retention preference (Task #4383 P0).
|
|
45
|
+
*
|
|
46
|
+
* Forwarded to pi-ai's `ProviderStreamOptions.cacheRetention`. When omitted,
|
|
47
|
+
* `buildPiCacheOptions()` applies a protocol-aware default:
|
|
48
|
+
* - `openai-completions` → `"long"` (needed for `prompt_cache_key`)
|
|
49
|
+
* - anything else → pi-ai's own default (`anthropic` uses `"short"` =
|
|
50
|
+
* ephemeral `cache_control`, which is the behaviour minimax already relies on)
|
|
51
|
+
*/
|
|
52
|
+
cacheRetention?: "none" | "short" | "long";
|
|
53
|
+
/**
|
|
54
|
+
* Provider capabilities from config (`llm.providers.<id>.capabilities`).
|
|
55
|
+
*
|
|
56
|
+
* Task #4403: this is the data path that was missing. `resolvePiModel()` used
|
|
57
|
+
* to hardcode `reasoning: false` for every custom provider, so
|
|
58
|
+
* `capabilities.reasoning` in config never influenced the pi-ai model
|
|
59
|
+
* descriptor at all. Threading it through here lets the descriptor reflect
|
|
60
|
+
* what the user actually configured.
|
|
61
|
+
*/
|
|
62
|
+
capabilities?: ProviderCapabilities;
|
|
63
|
+
}
|
|
64
|
+
/** Chat 响应(统一形状) */
|
|
65
|
+
export interface ChatResponse {
|
|
66
|
+
text: string;
|
|
67
|
+
finishReason: "stop" | "length" | "toolUse" | "error" | "aborted";
|
|
68
|
+
toolCalls?: Array<{
|
|
69
|
+
id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
arguments: string;
|
|
72
|
+
}>;
|
|
73
|
+
usage: UsageInfo;
|
|
74
|
+
raw?: unknown;
|
|
75
|
+
}
|
|
76
|
+
/** Stream handle:暴露异步事件流 + 最终结果 */
|
|
77
|
+
export interface StreamHandle {
|
|
78
|
+
events: AsyncIterable<unknown>;
|
|
79
|
+
result: () => Promise<ChatResponse>;
|
|
80
|
+
}
|
|
81
|
+
/** LLM Adapter 接口(3 个核心方法) */
|
|
82
|
+
export interface EmbedRequest {
|
|
83
|
+
provider: string;
|
|
84
|
+
modelId: string;
|
|
85
|
+
input: string | string[];
|
|
86
|
+
apiKey: string;
|
|
87
|
+
baseURL?: string;
|
|
88
|
+
signal?: AbortSignal;
|
|
89
|
+
}
|
|
90
|
+
export interface EmbedResponse {
|
|
91
|
+
embeddings: number[][];
|
|
92
|
+
usage: UsageInfo;
|
|
93
|
+
}
|
|
94
|
+
export interface LLMAdapter {
|
|
95
|
+
readonly name: AdapterName;
|
|
96
|
+
chat(req: ChatRequest): Promise<ChatResponse>;
|
|
97
|
+
stream(req: ChatRequest): Promise<StreamHandle>;
|
|
98
|
+
resolveProvider(provider: string, modelId: string): Promise<ResolvedProvider>;
|
|
99
|
+
embed(req: EmbedRequest): Promise<EmbedResponse>;
|
|
100
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview LLM Adapter 工厂
|
|
3
|
+
*
|
|
4
|
+
* 读取 ROY_LLM_PROVIDER 环境变量选择 adapter:
|
|
5
|
+
* - "pi-ai" → PiAiAdapter(默认)
|
|
6
|
+
* - "ai-sdk" → AiSdkAdapter(fallback)
|
|
7
|
+
*
|
|
8
|
+
* 通过 setLLMProvider() 可在运行时覆盖(用于测试)。
|
|
9
|
+
*/
|
|
10
|
+
import type { LLMAdapter, AdapterName } from "./adapter";
|
|
11
|
+
export declare function setLLMProvider(name: AdapterName | undefined): void;
|
|
12
|
+
export declare function getLLMProviderOverride(): AdapterName | undefined;
|
|
13
|
+
export declare const createLLMAdapter: () => LLMAdapter;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { LLMInvokeRequest, LLMInvokeResult, StreamEvent } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* LLM Hook 类型(兼容旧接口)
|
|
4
|
+
*/
|
|
5
|
+
export type LLMHookType = "before-invoke" | "after-invoke" | "stream";
|
|
6
|
+
/**
|
|
7
|
+
* LLM Hook 上下文
|
|
8
|
+
*/
|
|
9
|
+
export interface LLMHookContext {
|
|
10
|
+
/** 请求 */
|
|
11
|
+
request: LLMInvokeRequest;
|
|
12
|
+
/** Provider ID */
|
|
13
|
+
providerId: string;
|
|
14
|
+
/** 模型名称 */
|
|
15
|
+
model: string;
|
|
16
|
+
/** 元数据 */
|
|
17
|
+
metadata?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Before Invoke Hook
|
|
21
|
+
* 在 LLM 调用之前执行,可以修改请求
|
|
22
|
+
*/
|
|
23
|
+
export type LLMBeforeInvokeHook = (context: LLMHookContext) => Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* After Invoke Hook
|
|
26
|
+
* 在 LLM 调用之后执行,可以处理结果
|
|
27
|
+
*/
|
|
28
|
+
export type LLMAfterInvokeHook = (context: LLMHookContext, result: LLMInvokeResult) => Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Stream Hook
|
|
31
|
+
* 在流式调用时处理每个事件
|
|
32
|
+
*/
|
|
33
|
+
export type LLMStreamHook = (context: LLMHookContext, event: StreamEvent) => Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Hook 注册项
|
|
36
|
+
*/
|
|
37
|
+
export interface LLMHookRegistration {
|
|
38
|
+
/** Hook 类型 */
|
|
39
|
+
type: LLMHookType;
|
|
40
|
+
/** Hook 名称(可选,用于标识) */
|
|
41
|
+
name?: string;
|
|
42
|
+
/** Before Invoke Hook */
|
|
43
|
+
beforeInvoke?: LLMBeforeInvokeHook;
|
|
44
|
+
/** After Invoke Hook */
|
|
45
|
+
afterInvoke?: LLMAfterInvokeHook;
|
|
46
|
+
/** Stream Hook */
|
|
47
|
+
stream?: LLMStreamHook;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* LLMHookManager
|
|
51
|
+
*
|
|
52
|
+
* 代理到 globalHookManager 的 LLM Hook 管理器
|
|
53
|
+
*
|
|
54
|
+
* @deprecated 请直接使用 globalHookManager.register() 注册 hooks
|
|
55
|
+
*/
|
|
56
|
+
export declare class LLMHookManager {
|
|
57
|
+
private registrations;
|
|
58
|
+
/**
|
|
59
|
+
* 注册 Hook
|
|
60
|
+
*/
|
|
61
|
+
register(type: LLMHookType, handler: LLMBeforeInvokeHook | LLMAfterInvokeHook | LLMStreamHook, name?: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* 注册单个 registration 到 globalHookManager
|
|
64
|
+
*/
|
|
65
|
+
private registerToGlobal;
|
|
66
|
+
/**
|
|
67
|
+
* 取消注册 Hook
|
|
68
|
+
*/
|
|
69
|
+
unregister(hook: LLMBeforeInvokeHook | LLMAfterInvokeHook | LLMStreamHook): void;
|
|
70
|
+
/**
|
|
71
|
+
* 从 globalHookManager 取消注册
|
|
72
|
+
*/
|
|
73
|
+
private unregisterFromGlobal;
|
|
74
|
+
/**
|
|
75
|
+
* 按名称取消注册 Hook
|
|
76
|
+
*/
|
|
77
|
+
unregisterByName(name: string): void;
|
|
78
|
+
/**
|
|
79
|
+
* 按类型取消注册所有 Hook
|
|
80
|
+
*/
|
|
81
|
+
unregisterByType(type: LLMHookType): void;
|
|
82
|
+
/**
|
|
83
|
+
* 清空所有 Hook
|
|
84
|
+
*/
|
|
85
|
+
clear(): void;
|
|
86
|
+
/**
|
|
87
|
+
* 获取所有 Hook
|
|
88
|
+
*/
|
|
89
|
+
getHooks(): LLMHookRegistration[];
|
|
90
|
+
/**
|
|
91
|
+
* 按类型获取 Hook
|
|
92
|
+
*/
|
|
93
|
+
getHooksByType(type: LLMHookType): LLMHookRegistration[];
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* LLMHooks
|
|
97
|
+
*
|
|
98
|
+
* 兼容旧接口,内部委托给 globalHookManager
|
|
99
|
+
*
|
|
100
|
+
* @deprecated 请直接使用 globalHookManager
|
|
101
|
+
*/
|
|
102
|
+
export declare class LLMHooks {
|
|
103
|
+
private hookManager;
|
|
104
|
+
/**
|
|
105
|
+
* 注册 Hook
|
|
106
|
+
*/
|
|
107
|
+
register(type: LLMHookType, handler: LLMBeforeInvokeHook | LLMAfterInvokeHook | LLMStreamHook, name?: string): void;
|
|
108
|
+
/**
|
|
109
|
+
* 取消注册 Hook
|
|
110
|
+
*/
|
|
111
|
+
unregister(hook: LLMBeforeInvokeHook | LLMAfterInvokeHook | LLMStreamHook): void;
|
|
112
|
+
/**
|
|
113
|
+
* 按名称取消注册 Hook
|
|
114
|
+
*/
|
|
115
|
+
unregisterByName(name: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* 按类型取消注册所有 Hook
|
|
118
|
+
*/
|
|
119
|
+
unregisterByType(type: LLMHookType): void;
|
|
120
|
+
/**
|
|
121
|
+
* 清空所有 Hook
|
|
122
|
+
*/
|
|
123
|
+
clear(): void;
|
|
124
|
+
/**
|
|
125
|
+
* 获取所有 Hook
|
|
126
|
+
*/
|
|
127
|
+
getHooks(): LLMHookRegistration[];
|
|
128
|
+
/**
|
|
129
|
+
* 按类型获取 Hook
|
|
130
|
+
*/
|
|
131
|
+
getHooksByType(type: LLMHookType): LLMHookRegistration[];
|
|
132
|
+
/**
|
|
133
|
+
* 执行 Before Invoke Hooks
|
|
134
|
+
*
|
|
135
|
+
* @deprecated 请使用 globalHookManager.execute(LLMHookPoints.BEFORE_INVOKE, ...)
|
|
136
|
+
*/
|
|
137
|
+
executeBeforeInvoke(context: LLMHookContext): Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* 执行 After Invoke Hooks
|
|
140
|
+
*
|
|
141
|
+
* @deprecated 请使用 globalHookManager.execute(LLMHookPoints.AFTER_INVOKE, ...)
|
|
142
|
+
*/
|
|
143
|
+
executeAfterInvoke(context: LLMHookContext, result: LLMInvokeResult): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* 执行 Stream Hooks
|
|
146
|
+
*
|
|
147
|
+
* @deprecated 请使用 globalHookManager.execute(LLMHookPoints.ON_STREAM, ...)
|
|
148
|
+
*/
|
|
149
|
+
executeStream(context: LLMHookContext, event: StreamEvent): Promise<void>;
|
|
150
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Component
|
|
3
|
+
* 提供 LLM 调用能力
|
|
4
|
+
*/
|
|
5
|
+
export { type LLMAdapter, type AdapterName, type ChatRequest, type ChatResponse, type StreamHandle, type ResolvedProvider, ADAPTER_NAMES, } from "./adapter";
|
|
6
|
+
export { PiAiAdapter } from "./adapter-pi-ai";
|
|
7
|
+
export { AiSdkAdapter } from "./adapter-ai-sdk";
|
|
8
|
+
export { createLLMAdapter, setLLMProvider, getLLMProviderOverride } from "./factory";
|
|
9
|
+
export { type ContentPart, type LLMMessage, type LLMOutput, type UsageInfo, type ToolCall, type ToolResult, type ToolInfo, type LLMConfig, type LLMProvider, type ProviderConfig, type ProviderType, type LLMInvokeRequest, type LLMInvokeResult, type StreamEvent, } from "./types";
|
|
10
|
+
export { LLMConfigSchema, ProviderConfigSchema, ProviderCapabilitiesSchema, ModelLimitsSchema, LLMDefaultConfigSchema, } from "./types";
|
|
11
|
+
export { ProviderManager } from "./provider";
|
|
12
|
+
export { LLMTransform } from "./transform";
|
|
13
|
+
export { invoke, invokeNonStream, parseModelString, createInvokeConfig, convertToSDKMessages, type InvokeConfig, type InvokeOptions, type LLMToolContext, type ConvertedUsageInfo, } from "./invoke";
|
|
14
|
+
export { isOpencodeProvider, isOpencodeEndpoint, buildOpencodeHeaders, getOrCreateOpencodeSessionId, generateOpencodeSessionId, } from "./opencode-session";
|
|
15
|
+
export { type LLMHookType, type LLMHookContext, type LLMBeforeInvokeHook, type LLMAfterInvokeHook, type LLMStreamHook, type LLMHookRegistration, LLMHooks, } from "./hooks";
|
|
16
|
+
export { LLMComponent, type LLMComponentOptions } from "./llm";
|
package/dist/env/llm/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
createLLMAdapter,
|
|
15
15
|
getLLMProviderOverride,
|
|
16
16
|
setLLMProvider
|
|
17
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
17
|
+
} from "../../shared/@ai-setting/roy-agent-core-w527pcpe.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-adg9ghbt.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
|
20
20
|
import {
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
isOpencodeEndpoint,
|
|
29
29
|
isOpencodeProvider,
|
|
30
30
|
parseModelString
|
|
31
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
31
|
+
} from "../../shared/@ai-setting/roy-agent-core-0hq21px2.js";
|
|
32
32
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
33
33
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
34
34
|
import"../../shared/@ai-setting/roy-agent-core-tdbv7ff4.js";
|