@nomix-ai/nomix-harness 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -9
- package/dist/assets/web/assets/index-BnapMmQ_.css +1 -0
- package/dist/assets/web/assets/index-Dx7Ws_OC.js +96 -0
- package/dist/assets/web/assets/langs/{php-D-uCvoST.js → php-DDkx9sim.js} +2 -2
- package/dist/{kernel/web-frontend/dist/assets/langs/ruby-DEItuUFs.js → assets/web/assets/langs/ruby-DCxyoPen.js} +2 -2
- package/dist/assets/web/assets/{vendor-Cjbwl5VI.js → vendor-D22_Mp1f.js} +2 -2
- package/dist/assets/web/favicon.svg +8 -0
- package/dist/assets/web/index.html +5 -5
- package/dist/bundles/base/cordis.patch.yml +31 -6
- package/dist/bundles/web-app/cordis.patch.yml +27 -6
- package/dist/cli/bin.js +4 -5
- package/dist/cli/builtin-registry.js +34 -4
- package/dist/cli/{dump-config-d3ECray2.js → dump-config-BEj2GlJo.js} +1 -1
- package/dist/cli/{plugin-Bw9wgrmj.js → plugin-D_gLgCYL.js} +1 -1
- package/dist/cli/profile-boot-BSrYtiQI.js +2 -0
- package/dist/cli/{profile-boot-DFHdh9Xq.js → profile-boot-CByqUxLM.js} +0 -2
- package/dist/cli/runtime.js +0 -2
- package/dist/config/agent-presets/code/agent.cordis.yml +4 -3
- package/dist/config/agent-presets/cordis/agent.cordis.yml +4 -3
- package/dist/config/agent-presets/cordis/skills/editing-cordis-compositions/SKILL.md +13 -2
- package/dist/config/agent-presets/minimal/agent.cordis.yml +27 -1
- package/dist/config/agent-presets/standard/agent.cordis.yml +4 -3
- package/dist/kernel/acp/package.json +1 -1
- package/dist/kernel/agent/package.json +1 -1
- package/dist/kernel/agent-default-model/package.json +1 -1
- package/dist/kernel/agent-instructions/package.json +1 -1
- package/dist/kernel/agent-loop/lib/index.js +33 -10
- package/dist/kernel/agent-loop/lib/types/agent.js +26 -6
- package/dist/kernel/agent-loop/package.json +1 -1
- package/dist/kernel/agent-presets/package.json +1 -1
- package/dist/kernel/agent-tool-presentation/package.json +1 -1
- package/dist/kernel/anonymous-user-id/package.json +1 -1
- package/dist/kernel/api-gateway/lib/client.js +84 -55
- package/dist/kernel/api-gateway/lib/types/client/index.js +93 -61
- package/dist/kernel/api-gateway/package.json +1 -1
- package/dist/kernel/api-remotes/lib/client.js +166 -27
- package/dist/kernel/api-remotes/lib/index.js +1 -1
- package/dist/kernel/api-remotes/lib/types/client/index.d.ts +4 -0
- package/dist/kernel/api-remotes/lib/types/client/index.js +4 -1
- package/dist/kernel/api-remotes/lib/types/remote-events.d.ts +1 -1
- package/dist/kernel/api-remotes/lib/types/remote-events.js +1 -1
- package/dist/kernel/api-remotes/package.json +11 -7
- package/dist/kernel/app-boot/lib/index.js +19 -41
- package/dist/kernel/app-boot/lib/types/index.d.ts +0 -1
- package/dist/kernel/app-boot/lib/types/index.js +2 -3
- package/dist/kernel/app-boot/lib/types/profile.d.ts +15 -12
- package/dist/kernel/app-boot/lib/types/profile.js +15 -25
- package/dist/kernel/app-boot/package.json +1 -1
- package/dist/kernel/atomic-write/lib/index.js +36 -16
- package/dist/kernel/atomic-write/lib/types/index.d.ts +21 -5
- package/dist/kernel/atomic-write/lib/types/index.js +40 -16
- package/dist/kernel/atomic-write/package.json +1 -1
- package/dist/kernel/attachment/lib/index.js +62 -3
- package/dist/kernel/attachment/lib/types/admission.d.ts +15 -0
- package/dist/kernel/attachment/lib/types/admission.js +33 -0
- package/dist/kernel/attachment/lib/types/brand.d.ts +8 -0
- package/dist/kernel/attachment/lib/types/brand.js +8 -0
- package/dist/kernel/attachment/lib/types/error.d.ts +2 -2
- package/dist/kernel/attachment/lib/types/error.js +1 -0
- package/dist/kernel/attachment/lib/types/index.d.ts +23 -5
- package/dist/kernel/attachment/lib/types/index.js +24 -2
- package/dist/kernel/attachment/lib/types/types.d.ts +47 -2
- package/dist/kernel/attachment/package.json +3 -2
- package/dist/kernel/attachment-local/lib/index.js +640 -48
- package/dist/kernel/attachment-local/lib/types/compression-limiter.d.ts +18 -0
- package/dist/kernel/attachment-local/lib/types/compression-limiter.js +43 -0
- package/dist/kernel/attachment-local/lib/types/encoding.d.ts +23 -0
- package/dist/kernel/attachment-local/lib/types/encoding.js +33 -0
- package/dist/kernel/attachment-local/lib/types/image.d.ts +31 -2
- package/dist/kernel/attachment-local/lib/types/image.js +43 -4
- package/dist/kernel/attachment-local/lib/types/index.d.ts +45 -10
- package/dist/kernel/attachment-local/lib/types/index.js +140 -10
- package/dist/kernel/attachment-local/lib/types/normalization.d.ts +44 -0
- package/dist/kernel/attachment-local/lib/types/normalization.js +148 -0
- package/dist/kernel/attachment-local/lib/types/request-image.d.ts +35 -0
- package/dist/kernel/attachment-local/lib/types/request-image.js +208 -0
- package/dist/kernel/attachment-local/lib/types/store.d.ts +36 -9
- package/dist/kernel/attachment-local/lib/types/store.js +60 -24
- package/dist/kernel/attachment-local/package.json +1 -1
- package/dist/kernel/authorization/lib/index.js +248 -0
- package/dist/kernel/authorization/lib/invariant.js +36 -0
- package/dist/kernel/authorization/lib/types/index.d.ts +223 -0
- package/dist/kernel/authorization/lib/types/index.js +299 -0
- package/dist/kernel/authorization/lib/types/invariant.d.ts +16 -0
- package/dist/kernel/authorization/lib/types/invariant.js +38 -0
- package/dist/kernel/authorization/lib/types/types.d.ts +83 -0
- package/dist/kernel/authorization/lib/types/types.js +8 -0
- package/dist/kernel/{client-web-react → authorization}/package.json +19 -16
- package/dist/kernel/base/cordis.patch.yml +31 -6
- package/dist/kernel/base/package.json +3 -1
- package/dist/kernel/bash-local/package.json +1 -1
- package/dist/kernel/bash-sandbox/package.json +1 -1
- package/dist/kernel/brand/package.json +1 -1
- package/dist/kernel/client-connection/lib/client.js +148 -28
- package/dist/kernel/client-connection/lib/index.js +4 -4
- package/dist/kernel/client-connection/lib/types/client/fixture.js +112 -20
- package/dist/kernel/client-connection/lib/types/client/index.d.ts +21 -1
- package/dist/kernel/client-connection/lib/types/client/index.js +3 -2
- package/dist/kernel/client-connection/lib/types/client/rpc.d.ts +4 -1
- package/dist/kernel/client-connection/lib/types/client/rpc.js +4 -2
- package/dist/kernel/client-connection/lib/types/http-bridge.d.ts +2 -2
- package/dist/kernel/client-connection/lib/types/http-bridge.js +3 -3
- package/dist/kernel/client-connection/lib/types/index.d.ts +1 -1
- package/dist/kernel/client-connection/package.json +15 -9
- package/dist/kernel/client-hmr/package.json +1 -1
- package/dist/kernel/client-locale/lib/client.js +48 -9
- package/dist/kernel/client-locale/lib/types/client/index.d.ts +19 -3
- package/dist/kernel/client-locale/lib/types/client/index.js +48 -7
- package/dist/kernel/client-locale/package.json +6 -6
- package/dist/kernel/client-modules/lib/client.js +188 -123
- package/dist/kernel/client-modules/lib/index.js +177 -31
- package/dist/kernel/client-modules/lib/types/client/index.d.ts +19 -8
- package/dist/kernel/client-modules/lib/types/client/index.js +25 -8
- package/dist/kernel/client-modules/lib/types/client/manifest.d.ts +90 -41
- package/dist/kernel/client-modules/lib/types/client/manifest.js +45 -12
- package/dist/kernel/client-modules/lib/types/client/system.d.ts +15 -17
- package/dist/kernel/client-modules/lib/types/client/system.js +85 -56
- package/dist/kernel/client-modules/lib/types/index.d.ts +28 -12
- package/dist/kernel/client-modules/lib/types/index.js +128 -34
- package/dist/kernel/client-modules/package.json +4 -2
- package/dist/kernel/client-runtime/lib/client.js +43 -8
- package/dist/kernel/client-runtime/lib/types/client/contract/session.d.ts +1 -1
- package/dist/kernel/client-runtime/lib/types/client/contract/store.d.ts +1 -1
- package/dist/kernel/client-runtime/lib/types/client/contract/store.js +2 -2
- package/dist/kernel/client-runtime/lib/types/client/index.d.ts +2 -2
- package/dist/kernel/client-runtime/lib/types/client/index.js +3 -3
- package/dist/kernel/client-runtime/lib/types/client/sessions/context-provenance.d.ts +8 -0
- package/dist/kernel/client-runtime/lib/types/client/sessions/context-provenance.js +13 -0
- package/dist/kernel/client-runtime/lib/types/client/sessions/conversation.d.ts +11 -7
- package/dist/kernel/client-runtime/lib/types/client/sessions/projection-store.d.ts +1 -1
- package/dist/kernel/client-runtime/lib/types/client/sessions/session.d.ts +1 -1
- package/dist/kernel/client-runtime/lib/types/client/sessions/session.js +4 -4
- package/dist/kernel/client-runtime/lib/types/client/slots.d.ts +1 -1
- package/dist/kernel/client-runtime/lib/types/client/slots.js +1 -1
- package/dist/kernel/client-runtime/lib/types/client/workspaces/path.d.ts +9 -0
- package/dist/kernel/client-runtime/lib/types/client/workspaces/path.js +27 -1
- package/dist/kernel/client-runtime/package.json +25 -14
- package/dist/kernel/client-ui-agent-preset/lib/client.js +55 -55
- package/dist/kernel/client-ui-agent-preset/lib/types/client/index.js +2 -2
- package/dist/kernel/client-ui-agent-preset/lib/types/client/settings-store.d.ts +7 -1
- package/dist/kernel/client-ui-agent-preset/lib/types/client/settings-store.js +21 -20
- package/dist/kernel/client-ui-agent-preset/package.json +2 -7
- package/dist/kernel/client-ui-attachment/lib/client.js +782 -0
- package/dist/kernel/client-ui-attachment/lib/index.js +5 -505
- package/dist/kernel/client-ui-attachment/lib/invariant.js +2 -3
- package/dist/kernel/client-ui-attachment/lib/types/client/ComposerAttachments.d.ts +4 -0
- package/dist/kernel/client-ui-attachment/lib/types/client/ComposerAttachments.js +85 -0
- package/dist/kernel/client-ui-attachment/lib/types/client/MessageImages.d.ts +4 -0
- package/dist/kernel/client-ui-attachment/lib/types/client/MessageImages.js +8 -0
- package/dist/kernel/client-ui-attachment/lib/types/client/index.d.ts +7 -0
- package/dist/kernel/client-ui-attachment/lib/types/client/index.js +16 -0
- package/dist/kernel/client-ui-attachment/lib/types/client/labels.d.ts +35 -0
- package/dist/kernel/client-ui-attachment/lib/types/client/labels.js +52 -0
- package/dist/kernel/client-ui-attachment/lib/types/index.d.ts +3 -15
- package/dist/kernel/client-ui-attachment/lib/types/index.js +3 -11
- package/dist/kernel/client-ui-attachment/lib/types/invariant.js +2 -3
- package/dist/kernel/client-ui-attachment/package.json +32 -9
- package/dist/kernel/client-ui-brand-official/lib/client.js +50 -0
- package/dist/kernel/client-ui-brand-official/lib/index.js +9 -0
- package/dist/kernel/{client-web-react → client-ui-brand-official}/lib/invariant.js +6 -8
- package/dist/kernel/client-ui-brand-official/lib/types/client/Brand.d.ts +16 -0
- package/dist/kernel/client-ui-brand-official/lib/types/client/Brand.js +18 -0
- package/dist/kernel/client-ui-brand-official/lib/types/client/index.d.ts +10 -0
- package/dist/kernel/client-ui-brand-official/lib/types/client/index.js +17 -0
- package/dist/kernel/client-ui-brand-official/lib/types/index.d.ts +7 -0
- package/dist/kernel/client-ui-brand-official/lib/types/index.js +7 -0
- package/dist/kernel/client-ui-brand-official/lib/types/invariant.d.ts +16 -0
- package/dist/kernel/{client-web-react → client-ui-brand-official}/lib/types/invariant.js +6 -8
- package/dist/kernel/client-ui-brand-official/package.json +72 -0
- package/dist/kernel/client-ui-commands/lib/client.js +44 -15
- package/dist/kernel/client-ui-commands/lib/types/client/locales.d.ts +2 -0
- package/dist/kernel/client-ui-commands/lib/types/client/locales.js +2 -0
- package/dist/kernel/client-ui-commands/lib/types/client/service.d.ts +11 -1
- package/dist/kernel/client-ui-commands/lib/types/client/service.js +39 -7
- package/dist/kernel/client-ui-commands/package.json +2 -5
- package/dist/kernel/client-ui-conversation/lib/client.js +949 -531
- package/dist/kernel/client-ui-conversation/lib/types/client/apply.js +6 -4
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/AssistantMarkdown.d.ts +4 -5
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/AssistantMarkdown.js +6 -6
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/AssistantNodeView.d.ts +1 -1
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/AssistantNodeView.js +2 -2
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/ChatNodeSeat.d.ts +1 -1
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/ChatNodeSeat.js +5 -3
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/ChatView.js +53 -10
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/ContextInjectionRow.js +4 -1
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/MessageItem.d.ts +4 -5
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/MessageItem.js +46 -16
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/StatsLine.d.ts +5 -3
- package/dist/kernel/client-ui-conversation/lib/types/client/chat/StatsLine.js +54 -5
- package/dist/kernel/client-ui-conversation/lib/types/client/contract/slots.d.ts +90 -8
- package/dist/kernel/client-ui-conversation/lib/types/client/conversation-nodes/assistant.js +1 -0
- package/dist/kernel/client-ui-conversation/lib/types/client/conversation-nodes/chat-snapshot-builder.d.ts +1 -0
- package/dist/kernel/client-ui-conversation/lib/types/client/conversation-nodes/chat-snapshot-builder.js +95 -6
- package/dist/kernel/client-ui-conversation/lib/types/client/conversation-nodes/message.d.ts +11 -3
- package/dist/kernel/client-ui-conversation/lib/types/client/conversation-nodes/turn-error.d.ts +6 -3
- package/dist/kernel/client-ui-conversation/lib/types/client/conversation-nodes/turn-error.js +10 -26
- package/dist/kernel/client-ui-conversation/lib/types/client/image-labels.d.ts +1 -33
- package/dist/kernel/client-ui-conversation/lib/types/client/image-labels.js +5 -54
- package/dist/kernel/client-ui-conversation/lib/types/client/index.d.ts +1 -1
- package/dist/kernel/client-ui-conversation/lib/types/client/input/contract.d.ts +17 -14
- package/dist/kernel/client-ui-conversation/lib/types/client/input/decorations.d.ts +13 -5
- package/dist/kernel/client-ui-conversation/lib/types/client/input/decorations.js +26 -10
- package/dist/kernel/client-ui-conversation/lib/types/client/input/facade.d.ts +34 -14
- package/dist/kernel/client-ui-conversation/lib/types/client/input/facade.js +116 -34
- package/dist/kernel/client-ui-conversation/lib/types/client/input/hub.d.ts +1 -1
- package/dist/kernel/client-ui-conversation/lib/types/client/input/hub.js +21 -19
- package/dist/kernel/client-ui-conversation/lib/types/client/input/machine.d.ts +35 -14
- package/dist/kernel/client-ui-conversation/lib/types/client/input/machine.js +71 -34
- package/dist/kernel/client-ui-conversation/lib/types/client/locales.d.ts +16 -0
- package/dist/kernel/client-ui-conversation/lib/types/client/locales.js +16 -0
- package/dist/kernel/client-ui-conversation/lib/types/client/reference/ReferenceIcon.d.ts +16 -0
- package/dist/kernel/client-ui-conversation/lib/types/client/reference/ReferenceIcon.js +16 -0
- package/dist/kernel/client-ui-conversation/lib/types/client/service.d.ts +14 -1
- package/dist/kernel/client-ui-conversation/lib/types/client/service.js +26 -6
- package/dist/kernel/client-ui-conversation/lib/types/client/skeleton/ConversationRoot.js +1 -1
- package/dist/kernel/client-ui-conversation/lib/types/client/skeleton/ConversationSession.js +18 -3
- package/dist/kernel/client-ui-conversation/lib/types/client/skeleton/EmptyHero.d.ts +3 -1
- package/dist/kernel/client-ui-conversation/lib/types/client/skeleton/EmptyHero.js +4 -2
- package/dist/kernel/client-ui-conversation/lib/types/client/skeleton/InputBar.js +141 -126
- package/dist/kernel/client-ui-conversation/package.json +9 -8
- package/dist/kernel/client-ui-cordis/lib/client.js +48 -48
- package/dist/kernel/client-ui-cordis/package.json +2 -5
- package/dist/kernel/client-ui-deliverables/lib/client.js +5 -5
- package/dist/kernel/client-ui-deliverables/package.json +4 -6
- package/dist/kernel/client-ui-directory-picker-browse/lib/client.js +26 -26
- package/dist/kernel/client-ui-directory-picker-browse/package.json +2 -5
- package/dist/kernel/client-ui-directory-picker-native/package.json +2 -5
- package/dist/kernel/client-ui-goal/lib/client.js +8 -8
- package/dist/kernel/client-ui-goal/package.json +6 -5
- package/dist/kernel/client-ui-input-trigger/lib/client.js +82 -26
- package/dist/kernel/client-ui-input-trigger/lib/types/client/MenuView.js +13 -9
- package/dist/kernel/client-ui-input-trigger/lib/types/client/controller.d.ts +5 -3
- package/dist/kernel/client-ui-input-trigger/lib/types/client/controller.js +19 -7
- package/dist/kernel/client-ui-input-trigger/lib/types/client/index.d.ts +1 -1
- package/dist/kernel/client-ui-input-trigger/lib/types/core/contract.d.ts +7 -2
- package/dist/kernel/client-ui-input-trigger/lib/types/core/detect.d.ts +4 -4
- package/dist/kernel/client-ui-input-trigger/lib/types/core/detect.js +24 -6
- package/dist/kernel/client-ui-input-trigger/lib/types/core/menu.d.ts +15 -2
- package/dist/kernel/client-ui-input-trigger/lib/types/core/menu.js +13 -4
- package/dist/kernel/client-ui-input-trigger/lib/types/types.d.ts +52 -8
- package/dist/kernel/client-ui-input-trigger/package.json +4 -5
- package/dist/kernel/client-ui-jobs/lib/client.js +10 -10
- package/dist/kernel/client-ui-jobs/package.json +3 -7
- package/dist/kernel/client-ui-layout/lib/client.js +3 -3
- package/dist/kernel/client-ui-layout/package.json +2 -4
- package/dist/kernel/client-ui-message-feedback/lib/client.js +174 -58
- package/dist/kernel/client-ui-message-feedback/lib/types/client/MessageFeedbackActions.d.ts +9 -3
- package/dist/kernel/client-ui-message-feedback/lib/types/client/MessageFeedbackActions.js +164 -25
- package/dist/kernel/client-ui-message-feedback/lib/types/client/locales.d.ts +2 -0
- package/dist/kernel/client-ui-message-feedback/lib/types/client/locales.js +2 -0
- package/dist/kernel/client-ui-message-feedback/package.json +3 -5
- package/dist/kernel/client-ui-model-selection/lib/client.js +18 -18
- package/dist/kernel/client-ui-model-selection/package.json +7 -9
- package/dist/kernel/client-ui-permission-presets/lib/client.js +97 -83
- package/dist/kernel/client-ui-permission-presets/lib/types/client/index.js +6 -19
- package/dist/kernel/client-ui-permission-presets/lib/types/client/settings-store.d.ts +27 -18
- package/dist/kernel/client-ui-permission-presets/lib/types/client/settings-store.js +95 -68
- package/dist/kernel/client-ui-permission-presets/package.json +2 -8
- package/dist/kernel/client-ui-plan/lib/client.js +1 -1
- package/dist/kernel/client-ui-plan/lib/types/client/index.js +1 -1
- package/dist/kernel/client-ui-plan/package.json +2 -6
- package/dist/kernel/client-ui-primitives/lib/Button.module.css +79 -0
- package/dist/kernel/client-ui-primitives/lib/ConnectionBanner.module.css +13 -0
- package/dist/kernel/client-ui-primitives/lib/DiffBlock.module.css +107 -0
- package/dist/kernel/client-ui-primitives/lib/DisclosureRow.module.css +69 -0
- package/dist/kernel/client-ui-primitives/lib/HoverCard.module.css +54 -0
- package/dist/kernel/client-ui-primitives/lib/Input.module.css +38 -0
- package/dist/kernel/client-ui-primitives/lib/JsonTree.module.css +222 -0
- package/dist/kernel/client-ui-primitives/lib/Menu.module.css +242 -0
- package/dist/kernel/client-ui-primitives/lib/Modal.module.css +103 -0
- package/dist/kernel/client-ui-primitives/lib/OnboardingSurface.module.css +29 -0
- package/dist/kernel/client-ui-primitives/lib/Pill.module.css +27 -0
- package/dist/kernel/client-ui-primitives/lib/ReadBlock.module.css +117 -0
- package/dist/kernel/client-ui-primitives/lib/RiskConfirmation.module.css +73 -0
- package/dist/kernel/client-ui-primitives/lib/SearchBlock.module.css +120 -0
- package/dist/kernel/client-ui-primitives/lib/StateDot.module.css +65 -0
- package/dist/kernel/client-ui-primitives/lib/TerminalBlock.module.css +211 -0
- package/dist/kernel/client-ui-primitives/lib/Toast.module.css +70 -0
- package/dist/kernel/client-ui-primitives/lib/Tooltip.module.css +49 -0
- package/dist/kernel/client-ui-primitives/lib/WebBlock.module.css +130 -0
- package/dist/kernel/client-ui-primitives/lib/index.js +291 -261
- package/dist/kernel/client-ui-primitives/lib/invariant.js +2 -0
- package/dist/kernel/client-ui-primitives/lib/markdown/CodeBlock.module.css +96 -0
- package/dist/kernel/client-ui-primitives/lib/markdown/JsonBlock.module.css +32 -0
- package/dist/kernel/client-ui-primitives/lib/markdown/MarkdownText.module.css +304 -0
- package/dist/kernel/client-ui-primitives/lib/markdown/MessageText.module.css +9 -0
- package/dist/kernel/client-ui-primitives/lib/types/BrandWordmark.d.ts +7 -1
- package/dist/kernel/client-ui-primitives/lib/types/BrandWordmark.js +4 -2
- package/dist/kernel/client-ui-primitives/lib/types/index.d.ts +4 -1
- package/dist/kernel/client-ui-primitives/lib/types/index.js +2 -1
- package/dist/kernel/client-ui-primitives/lib/types/markdown/render.d.ts +2 -0
- package/dist/kernel/client-ui-primitives/lib/types/markdown/render.js +10 -2
- package/dist/kernel/client-ui-primitives/lib/types/useAnchoredPosition.d.ts +32 -0
- package/dist/kernel/client-ui-primitives/lib/types/useAnchoredPosition.js +69 -0
- package/dist/kernel/client-ui-primitives/package.json +2 -1
- package/dist/kernel/client-ui-reference/lib/client.js +149 -0
- package/dist/kernel/client-ui-reference/lib/index.js +11 -0
- package/dist/kernel/{client-schema-form → client-ui-reference}/lib/invariant.js +7 -8
- package/dist/kernel/client-ui-reference/lib/types/client/index.d.ts +9 -0
- package/dist/kernel/client-ui-reference/lib/types/client/index.js +106 -0
- package/dist/kernel/client-ui-reference/lib/types/client/locales.d.ts +30 -0
- package/dist/kernel/client-ui-reference/lib/types/client/locales.js +22 -0
- package/dist/kernel/client-ui-reference/lib/types/index.d.ts +9 -0
- package/dist/kernel/client-ui-reference/lib/types/index.js +9 -0
- package/dist/kernel/{client-schema-form → client-ui-reference}/lib/types/invariant.d.ts +3 -3
- package/dist/kernel/{client-schema-form → client-ui-reference}/lib/types/invariant.js +7 -8
- package/dist/kernel/client-ui-reference/package.json +77 -0
- package/dist/kernel/client-ui-renderer/lib/client.js +989 -0
- package/dist/kernel/client-ui-renderer/lib/index.js +6 -0
- package/dist/kernel/client-ui-renderer/lib/invariant.js +23 -0
- package/dist/kernel/{client-web/lib/types → client-ui-renderer/lib/types/client}/DocumentTitle.d.ts +4 -4
- package/dist/kernel/client-ui-renderer/lib/types/client/DocumentTitle.js +17 -0
- package/dist/kernel/client-ui-renderer/lib/types/client/app.d.ts +18 -0
- package/dist/kernel/{client-web/lib/types → client-ui-renderer/lib/types/client}/app.js +5 -5
- package/dist/kernel/{client-web-react/lib/types → client-ui-renderer/lib/types/client}/bind.d.ts +1 -1
- package/dist/kernel/client-ui-renderer/lib/types/client/index.d.ts +29 -0
- package/dist/kernel/client-ui-renderer/lib/types/client/index.js +51 -0
- package/dist/kernel/{client-web-react/lib/types → client-ui-renderer/lib/types/client}/scoped-slots.d.ts +1 -1
- package/dist/kernel/{client-web-react/lib/types → client-ui-renderer/lib/types/client}/scoped-slots.js +1 -1
- package/dist/kernel/{client-web-react/lib/types → client-ui-renderer/lib/types/client}/session-provider.d.ts +1 -1
- package/dist/kernel/client-ui-renderer/lib/types/index.d.ts +4 -0
- package/dist/kernel/client-ui-renderer/lib/types/index.js +4 -0
- package/dist/kernel/{client-web-react → client-ui-renderer}/lib/types/invariant.d.ts +3 -3
- package/dist/kernel/client-ui-renderer/lib/types/invariant.js +22 -0
- package/dist/kernel/client-ui-renderer/package.json +71 -0
- package/dist/kernel/client-ui-settings/lib/client.js +1177 -67
- package/dist/kernel/client-ui-settings/lib/types/client/index.d.ts +20 -12
- package/dist/kernel/client-ui-settings/lib/types/client/index.js +25 -6
- package/dist/kernel/client-ui-settings/lib/types/client/schema.d.ts +72 -0
- package/dist/kernel/client-ui-settings/lib/types/client/schema.js +152 -0
- package/dist/kernel/client-ui-settings/lib/types/client/settings-mirror.d.ts +118 -0
- package/dist/kernel/client-ui-settings/lib/types/client/settings-mirror.js +160 -0
- package/dist/kernel/client-ui-settings/lib/types/client/settings-scope.d.ts +51 -24
- package/dist/kernel/client-ui-settings/lib/types/client/settings-scope.js +88 -71
- package/dist/kernel/client-ui-settings/package.json +7 -7
- package/dist/kernel/client-ui-settings-general/lib/client.js +60 -64
- package/dist/kernel/client-ui-settings-general/lib/types/client/SettingsDocumentAction.d.ts +7 -6
- package/dist/kernel/client-ui-settings-general/lib/types/client/index.js +10 -11
- package/dist/kernel/client-ui-settings-general/lib/types/client/settings-document-store.d.ts +13 -11
- package/dist/kernel/client-ui-settings-general/lib/types/client/settings-document-store.js +37 -40
- package/dist/kernel/client-ui-settings-general/package.json +4 -8
- package/dist/kernel/client-ui-settings-models/lib/client.js +280 -210
- package/dist/kernel/client-ui-settings-models/lib/types/client/DeepSeekOnboardingDialog.d.ts +3 -0
- package/dist/kernel/client-ui-settings-models/lib/types/client/DeepSeekOnboardingDialog.js +2 -2
- package/dist/kernel/client-ui-settings-models/lib/types/client/ModelListEditor.js +11 -1
- package/dist/kernel/client-ui-settings-models/lib/types/client/ModelsSection.d.ts +10 -5
- package/dist/kernel/client-ui-settings-models/lib/types/client/ModelsSection.js +9 -6
- package/dist/kernel/client-ui-settings-models/lib/types/client/ProviderEditor.d.ts +3 -0
- package/dist/kernel/client-ui-settings-models/lib/types/client/ProviderEditor.js +30 -29
- package/dist/kernel/client-ui-settings-models/lib/types/client/index.js +27 -22
- package/dist/kernel/client-ui-settings-models/lib/types/client/locales.d.ts +2 -0
- package/dist/kernel/client-ui-settings-models/lib/types/client/locales.js +4 -0
- package/dist/kernel/client-ui-settings-models/lib/types/client/schema-operations.d.ts +10 -0
- package/dist/kernel/client-ui-settings-models/lib/types/client/schema-operations.js +17 -0
- package/dist/kernel/client-ui-settings-models/lib/types/client/store.d.ts +15 -7
- package/dist/kernel/client-ui-settings-models/lib/types/client/store.js +30 -21
- package/dist/kernel/client-ui-settings-models/lib/types/client/welcome-store.d.ts +35 -18
- package/dist/kernel/client-ui-settings-models/lib/types/client/welcome-store.js +89 -82
- package/dist/kernel/client-ui-settings-models/package.json +3 -8
- package/dist/kernel/client-ui-settings-plugin-inventory/lib/client.js +11 -11
- package/dist/kernel/client-ui-settings-plugin-inventory/package.json +2 -5
- package/dist/kernel/client-ui-settings-plugins/lib/client.js +42 -65
- package/dist/kernel/client-ui-settings-plugins/lib/types/client/index.js +5 -8
- package/dist/kernel/client-ui-settings-plugins/lib/types/client/tab-store.d.ts +8 -17
- package/dist/kernel/client-ui-settings-plugins/lib/types/client/tab-store.js +22 -44
- package/dist/kernel/client-ui-settings-plugins/package.json +2 -7
- package/dist/kernel/client-ui-sidebar/lib/client.js +50 -20
- package/dist/kernel/client-ui-sidebar/lib/types/client/SidebarRoot.js +7 -3
- package/dist/kernel/client-ui-sidebar/lib/types/client/contract/slots.d.ts +30 -1
- package/dist/kernel/client-ui-sidebar/lib/types/client/index.d.ts +1 -1
- package/dist/kernel/client-ui-sidebar/lib/types/client/index.js +2 -0
- package/dist/kernel/client-ui-sidebar/package.json +2 -4
- package/dist/kernel/client-ui-skill/lib/client.js +12 -12
- package/dist/kernel/client-ui-skill/package.json +2 -5
- package/dist/kernel/client-ui-slots/lib/index.js +2 -0
- package/dist/kernel/client-ui-slots/lib/invariant.js +2 -0
- package/dist/kernel/client-ui-slots/lib/types/renderer.d.ts +1 -1
- package/dist/kernel/client-ui-slots/lib/types/store.d.ts +1 -1
- package/dist/kernel/client-ui-slots/package.json +1 -1
- package/dist/kernel/client-ui-subagent/lib/client.js +289 -157
- package/dist/kernel/client-ui-subagent/lib/types/client/SubagentHeaderLineage.d.ts +18 -0
- package/dist/kernel/client-ui-subagent/lib/types/client/{SubagentCatalogAction.js → SubagentHeaderLineage.js} +153 -25
- package/dist/kernel/client-ui-subagent/lib/types/client/index.d.ts +4 -16
- package/dist/kernel/client-ui-subagent/lib/types/client/index.js +7 -45
- package/dist/kernel/client-ui-subagent/lib/types/client/locales.d.ts +1 -0
- package/dist/kernel/client-ui-subagent/lib/types/client/locales.js +2 -0
- package/dist/kernel/client-ui-subagent/package.json +6 -8
- package/dist/kernel/client-ui-theme/lib/client.js +46 -3
- package/dist/kernel/client-ui-theme/lib/index.js +22 -23
- package/dist/kernel/client-ui-theme/lib/types/boot-theme.d.ts +9 -10
- package/dist/kernel/client-ui-theme/lib/types/boot-theme.js +12 -19
- package/dist/kernel/client-ui-theme/lib/types/client/index.d.ts +1 -1
- package/dist/kernel/client-ui-theme/lib/types/client/index.js +3 -1
- package/dist/kernel/client-ui-theme/lib/types/client/styles.d.ts +7 -0
- package/dist/kernel/client-ui-theme/lib/types/client/styles.js +32 -0
- package/dist/kernel/client-ui-theme/lib/types/index.d.ts +4 -3
- package/dist/kernel/client-ui-theme/lib/types/index.js +7 -6
- package/dist/kernel/client-ui-theme/package.json +4 -6
- package/dist/kernel/client-ui-tool/lib/client.js +105 -65
- package/dist/kernel/client-ui-tool/lib/types/client/apply.d.ts +1 -2
- package/dist/kernel/client-ui-tool/lib/types/client/apply.js +6 -2
- package/dist/kernel/client-ui-tool/lib/types/client/contract/slots.d.ts +13 -3
- package/dist/kernel/client-ui-tool/lib/types/client/index.d.ts +1 -1
- package/dist/kernel/client-ui-tool/lib/types/client/tool/ToolCallTree.d.ts +1 -1
- package/dist/kernel/client-ui-tool/lib/types/client/tool/ToolCallTree.js +8 -6
- package/dist/kernel/client-ui-tool/lib/types/client/tool/ToolDetails.d.ts +2 -9
- package/dist/kernel/client-ui-tool/lib/types/client/tool/ToolDetails.js +4 -3
- package/dist/kernel/client-ui-tool/lib/types/client/tool/models/read-card-model.d.ts +4 -18
- package/dist/kernel/client-ui-tool/lib/types/client/tool/models/read-card-model.js +21 -4
- package/dist/kernel/client-ui-tool/lib/types/client/tool/models/tool-call-model.d.ts +2 -9
- package/dist/kernel/client-ui-tool/lib/types/client/tool/models/tool-call-model.js +22 -2
- package/dist/kernel/client-ui-tool/lib/types/client/tool/toolviews/GenericToolCard.d.ts +1 -1
- package/dist/kernel/client-ui-tool/lib/types/client/tool/toolviews/GenericToolCard.js +3 -3
- package/dist/kernel/client-ui-tool/lib/types/client/tool/toolviews/file-mutation-row.d.ts +1 -1
- package/dist/kernel/client-ui-tool/lib/types/client/tool/toolviews/file-mutation-row.js +2 -2
- package/dist/kernel/client-ui-tool/lib/types/client/tool/toolviews/read-row.d.ts +1 -1
- package/dist/kernel/client-ui-tool/lib/types/client/tool/toolviews/read-row.js +3 -3
- package/dist/kernel/client-ui-tool/package.json +4 -6
- package/dist/kernel/client-ui-trajectory/lib/client.js +144 -143
- package/dist/kernel/client-ui-trajectory/lib/types/client/trajectory-assistant-definition.js +2 -1
- package/dist/kernel/client-ui-trajectory/package.json +2 -4
- package/dist/kernel/client-ui-user-questions/lib/client.js +73 -36
- package/dist/kernel/client-ui-user-questions/lib/types/client/QuestionComposer.js +24 -6
- package/dist/kernel/client-ui-user-questions/package.json +12 -10
- package/dist/kernel/client-ui-workflow-run/lib/client.js +262 -87
- package/dist/kernel/client-ui-workflow-run/lib/types/client/WorkflowRunPanel.js +162 -23
- package/dist/kernel/client-ui-workflow-run/package.json +3 -7
- package/dist/kernel/client-ui-workspace/lib/client.js +96 -60
- package/dist/kernel/client-ui-workspace/lib/types/client/WorkspaceBrowser.d.ts +1 -1
- package/dist/kernel/client-ui-workspace/lib/types/client/WorkspaceBrowser.js +38 -6
- package/dist/kernel/client-ui-workspace/lib/types/client/contract/slots.d.ts +9 -7
- package/dist/kernel/client-ui-workspace/lib/types/client/index.js +4 -2
- package/dist/kernel/client-ui-workspace/lib/types/client/rows/Rows.d.ts +4 -1
- package/dist/kernel/client-ui-workspace/lib/types/client/rows/Rows.js +5 -3
- package/dist/kernel/client-ui-workspace/package.json +6 -4
- package/dist/kernel/client-web/lib/base.css +41 -0
- package/dist/kernel/client-web/lib/boot-page.module.css +104 -0
- package/dist/kernel/client-web/lib/index.js +154 -308
- package/dist/kernel/client-web/lib/invariant.js +2 -0
- package/dist/kernel/client-web/lib/types/boot-page.d.ts +46 -0
- package/dist/kernel/client-web/lib/types/boot-page.js +93 -0
- package/dist/kernel/client-web/lib/types/boot.d.ts +20 -33
- package/dist/kernel/client-web/lib/types/boot.js +76 -149
- package/dist/kernel/client-web/lib/types/index.d.ts +5 -11
- package/dist/kernel/client-web/lib/types/index.js +4 -10
- package/dist/kernel/client-web/lib/types/loader-status.d.ts +3 -51
- package/dist/kernel/client-web/lib/types/loader-status.js +0 -35
- package/dist/kernel/client-web/lib/types/platform.d.ts +3 -1
- package/dist/kernel/client-web/lib/types/platform.js +4 -3
- package/dist/kernel/client-web/lib/types/seed.js +0 -6
- package/dist/kernel/client-web/package.json +8 -15
- package/dist/kernel/cmdline/package.json +1 -1
- package/dist/kernel/code-runtime/package.json +1 -1
- package/dist/kernel/code-runtime-python/lib/index.js +413 -0
- package/dist/kernel/code-runtime-python/lib/invariant.js +24 -0
- package/dist/kernel/code-runtime-python/lib/types/index.d.ts +12 -0
- package/dist/kernel/code-runtime-python/lib/types/index.js +11 -0
- package/dist/kernel/code-runtime-python/lib/types/invariant.d.ts +16 -0
- package/dist/kernel/code-runtime-python/lib/types/invariant.js +23 -0
- package/dist/kernel/code-runtime-python/lib/types/protocol.d.ts +329 -0
- package/dist/kernel/code-runtime-python/lib/types/protocol.js +496 -0
- package/dist/kernel/{client-schema-form → code-runtime-python}/package.json +11 -14
- package/dist/kernel/code-runtime-python/py/protocol.py +138 -0
- package/dist/kernel/code-runtime-worker-thread/package.json +1 -1
- package/dist/kernel/command-compact/package.json +1 -1
- package/dist/kernel/command-feedback/package.json +1 -1
- package/dist/kernel/command-goal/lib/index.js +40 -6
- package/dist/kernel/command-goal/lib/types/index.js +35 -6
- package/dist/kernel/command-goal/package.json +2 -1
- package/dist/kernel/commands/lib/index.js +78 -21
- package/dist/kernel/commands/lib/typert.host.js +53 -9
- package/dist/kernel/commands/lib/typert.remote-client.d.ts +4 -3
- package/dist/kernel/commands/lib/typert.remote-client.js +18 -2
- package/dist/kernel/commands/lib/types/index.d.ts +20 -1
- package/dist/kernel/commands/lib/types/index.js +77 -20
- package/dist/kernel/commands/lib/types/types.d.ts +8 -0
- package/dist/kernel/commands/package.json +5 -1
- package/dist/kernel/compaction/package.json +1 -1
- package/dist/kernel/compaction-basic/package.json +1 -1
- package/dist/kernel/compaction-tool-result-pruner/package.json +1 -1
- package/dist/kernel/cordis/package.json +3 -1
- package/dist/kernel/cordis-client-runner/lib/client.js +171 -37
- package/dist/kernel/cordis-client-runner/lib/types/client/api-catalog.js +3 -3
- package/dist/kernel/cordis-client-runner/lib/types/client/slot-catalog.js +208 -30
- package/dist/kernel/cordis-client-runner/package.json +2 -5
- package/dist/kernel/cordis-host-runner/lib/index.js +28 -5
- package/dist/kernel/cordis-host-runner/lib/typert.host.js +54 -6
- package/dist/kernel/cordis-host-runner/lib/types/sandbox.d.ts +9 -3
- package/dist/kernel/cordis-host-runner/lib/types/sandbox.js +34 -6
- package/dist/kernel/cordis-host-runner/package.json +1 -1
- package/dist/kernel/cordis-plugin-group/package.json +3 -1
- package/dist/kernel/cordis-plugin-hmr/lib/types/index.js +1 -1
- package/dist/kernel/cordis-plugin-hmr/package.json +3 -1
- package/dist/kernel/cordis-plugin-include/lib/index.js +2 -2
- package/dist/kernel/cordis-plugin-include/lib/types/index.d.ts +2 -2
- package/dist/kernel/cordis-plugin-include/lib/types/index.js +2 -2
- package/dist/kernel/cordis-plugin-include/package.json +3 -1
- package/dist/kernel/cordis-plugin-loader/package.json +3 -1
- package/dist/kernel/cordis-plugin-logger-console/package.json +3 -1
- package/dist/kernel/cordis-plugin-timer/package.json +3 -1
- package/dist/kernel/cosmokit/package.json +3 -1
- package/dist/kernel/credentials/lib/index.js +104 -13
- package/dist/kernel/credentials/lib/invariant.js +3 -3
- package/dist/kernel/credentials/lib/types/index.d.ts +136 -7
- package/dist/kernel/credentials/lib/types/index.js +114 -15
- package/dist/kernel/credentials/lib/types/invariant.js +3 -3
- package/dist/kernel/credentials/lib/types/types.d.ts +58 -5
- package/dist/kernel/credentials/lib/types/types.js +4 -4
- package/dist/kernel/credentials/package.json +1 -1
- package/dist/kernel/credentials-local/lib/index.js +387 -29
- package/dist/kernel/credentials-local/lib/invariant.js +1 -1
- package/dist/kernel/credentials-local/lib/types/index.d.ts +57 -12
- package/dist/kernel/credentials-local/lib/types/index.js +445 -30
- package/dist/kernel/credentials-local/lib/types/invariant.js +1 -1
- package/dist/kernel/credentials-local/package.json +1 -1
- package/dist/kernel/e2b/package.json +1 -1
- package/dist/kernel/experimental-agent-team/lib/index.js +1728 -0
- package/dist/kernel/experimental-agent-team/lib/invariant.js +354 -0
- package/dist/kernel/experimental-agent-team/lib/types/activity.d.ts +23 -0
- package/dist/kernel/experimental-agent-team/lib/types/activity.js +85 -0
- package/dist/kernel/experimental-agent-team/lib/types/error.d.ts +13 -0
- package/dist/kernel/experimental-agent-team/lib/types/error.js +23 -0
- package/dist/kernel/experimental-agent-team/lib/types/fold.d.ts +44 -0
- package/dist/kernel/experimental-agent-team/lib/types/fold.js +243 -0
- package/dist/kernel/experimental-agent-team/lib/types/index.d.ts +115 -0
- package/dist/kernel/experimental-agent-team/lib/types/index.js +205 -0
- package/dist/kernel/experimental-agent-team/lib/types/invariant.d.ts +9 -0
- package/dist/kernel/experimental-agent-team/lib/types/invariant.js +29 -0
- package/dist/kernel/experimental-agent-team/lib/types/journal.d.ts +39 -0
- package/dist/kernel/experimental-agent-team/lib/types/journal.js +59 -0
- package/dist/kernel/experimental-agent-team/lib/types/lifecycle.d.ts +33 -0
- package/dist/kernel/experimental-agent-team/lib/types/lifecycle.js +85 -0
- package/dist/kernel/experimental-agent-team/lib/types/mailbox.d.ts +79 -0
- package/dist/kernel/experimental-agent-team/lib/types/mailbox.js +303 -0
- package/dist/kernel/experimental-agent-team/lib/types/roster.d.ts +113 -0
- package/dist/kernel/experimental-agent-team/lib/types/roster.js +445 -0
- package/dist/kernel/experimental-agent-team/lib/types/session-message.d.ts +11 -0
- package/dist/kernel/experimental-agent-team/lib/types/session-message.js +23 -0
- package/dist/kernel/experimental-agent-team/lib/types/task-board.d.ts +62 -0
- package/dist/kernel/experimental-agent-team/lib/types/task-board.js +275 -0
- package/dist/kernel/experimental-agent-team/lib/types/task-graph.d.ts +21 -0
- package/dist/kernel/experimental-agent-team/lib/types/task-graph.js +62 -0
- package/dist/kernel/experimental-agent-team/lib/types/types.d.ts +192 -0
- package/dist/kernel/experimental-agent-team/lib/types/types.js +26 -0
- package/dist/kernel/experimental-agent-team/lib/types/validation.d.ts +16 -0
- package/dist/kernel/experimental-agent-team/lib/types/validation.js +33 -0
- package/dist/kernel/experimental-agent-team/package.json +62 -0
- package/dist/kernel/experimental-tool-agent-team/lib/index.js +555 -0
- package/dist/kernel/experimental-tool-agent-team/lib/invariant.js +13 -0
- package/dist/kernel/experimental-tool-agent-team/lib/types/index.d.ts +19 -0
- package/dist/kernel/experimental-tool-agent-team/lib/types/index.js +379 -0
- package/dist/kernel/experimental-tool-agent-team/lib/types/invariant.d.ts +9 -0
- package/dist/kernel/experimental-tool-agent-team/lib/types/invariant.js +11 -0
- package/dist/kernel/experimental-tool-agent-team/package.json +61 -0
- package/dist/kernel/file-reference/lib/index.js +138 -0
- package/dist/kernel/file-reference/lib/invariant.js +23 -0
- package/dist/kernel/file-reference/lib/typert.host.d.ts +3 -0
- package/dist/kernel/file-reference/lib/typert.host.js +436 -0
- package/dist/kernel/file-reference/lib/typert.remote-client.d.ts +26 -0
- package/dist/kernel/file-reference/lib/typert.remote-client.js +59 -0
- package/dist/kernel/file-reference/lib/types/grammar.d.ts +33 -0
- package/dist/kernel/file-reference/lib/types/grammar.js +43 -0
- package/dist/kernel/file-reference/lib/types/index.d.ts +42 -0
- package/dist/kernel/file-reference/lib/types/index.js +75 -0
- package/dist/kernel/file-reference/lib/types/invariant.d.ts +16 -0
- package/dist/kernel/file-reference/lib/types/invariant.js +22 -0
- package/dist/kernel/file-reference/lib/types/types.d.ts +13 -0
- package/dist/kernel/file-reference/lib/types/types.js +7 -0
- package/dist/kernel/file-reference/package.json +70 -0
- package/dist/kernel/file-reference-local/lib/index.js +327 -0
- package/dist/kernel/file-reference-local/lib/invariant.js +23 -0
- package/dist/kernel/file-reference-local/lib/types/index.d.ts +35 -0
- package/dist/kernel/file-reference-local/lib/types/index.js +105 -0
- package/dist/kernel/file-reference-local/lib/types/invariant.d.ts +16 -0
- package/dist/kernel/file-reference-local/lib/types/invariant.js +22 -0
- package/dist/kernel/file-reference-local/lib/types/search.d.ts +52 -0
- package/dist/kernel/file-reference-local/lib/types/search.js +258 -0
- package/dist/kernel/file-reference-local/package.json +58 -0
- package/dist/kernel/fs/package.json +1 -1
- package/dist/kernel/fs-e2b/package.json +1 -1
- package/dist/kernel/fs-local/package.json +1 -1
- package/dist/kernel/fs-observation-policy/package.json +1 -1
- package/dist/kernel/fs-sandbox/package.json +1 -1
- package/dist/kernel/goal/lib/index.js +5 -2
- package/dist/kernel/goal/lib/typert.host.js +27 -3
- package/dist/kernel/goal/lib/types/index.js +2 -2
- package/dist/kernel/goal/lib/types/types.d.ts +3 -0
- package/dist/kernel/goal/package.json +1 -1
- package/dist/kernel/goal-round-driver/package.json +1 -1
- package/dist/kernel/headless/package.json +1 -1
- package/dist/kernel/home-paths/package.json +1 -1
- package/dist/kernel/hook-protocol/package.json +1 -1
- package/dist/kernel/hooks-claude-code/package.json +1 -1
- package/dist/kernel/hooks-codex/package.json +1 -1
- package/dist/kernel/host-apiproxy/lib/index.js +25 -57
- package/dist/kernel/host-apiproxy/lib/types/api/host.d.ts +2 -0
- package/dist/kernel/host-apiproxy/lib/types/api/host.schema.d.ts +1 -0
- package/dist/kernel/host-apiproxy/lib/types/api/host.schema.js +1 -0
- package/dist/kernel/host-apiproxy/lib/types/api/sessions.d.ts +4 -0
- package/dist/kernel/host-apiproxy/lib/types/api/sessions.schema.js +1 -0
- package/dist/kernel/host-apiproxy/lib/types/api-proxy.js +15 -53
- package/dist/kernel/host-apiproxy/package.json +1 -1
- package/dist/kernel/host-directory-picker/package.json +1 -1
- package/dist/kernel/host-directory-picker-auto/package.json +1 -1
- package/dist/kernel/host-directory-picker-browse/package.json +1 -1
- package/dist/kernel/host-directory-picker-native/package.json +1 -1
- package/dist/kernel/host-frontend-static/lib/index.js +34 -26
- package/dist/kernel/host-frontend-static/lib/types/index.d.ts +10 -10
- package/dist/kernel/host-frontend-static/lib/types/index.js +38 -27
- package/dist/kernel/host-frontend-static/package.json +2 -2
- package/dist/kernel/host-plugin-inventory/package.json +1 -1
- package/dist/kernel/host-webserver/lib/index.js +102 -6
- package/dist/kernel/host-webserver/lib/types/index.d.ts +33 -5
- package/dist/kernel/host-webserver/lib/types/index.js +28 -5
- package/dist/kernel/host-webserver/lib/types/injections.d.ts +56 -0
- package/dist/kernel/host-webserver/lib/types/injections.js +82 -0
- package/dist/kernel/host-webserver/package.json +1 -1
- package/dist/kernel/invariants/package.json +1 -1
- package/dist/kernel/jobs/package.json +1 -1
- package/dist/kernel/jobs-local/package.json +1 -1
- package/dist/kernel/launch-environment/package.json +1 -1
- package/dist/kernel/llm/lib/index.js +247 -25
- package/dist/kernel/llm/lib/types/assembler.d.ts +10 -1
- package/dist/kernel/llm/lib/types/assembler.js +20 -1
- package/dist/kernel/llm/lib/types/content.d.ts +59 -0
- package/dist/kernel/llm/lib/types/content.js +149 -0
- package/dist/kernel/llm/lib/types/index.d.ts +24 -1
- package/dist/kernel/llm/lib/types/index.js +61 -8
- package/dist/kernel/llm/lib/types/retry-policy.d.ts +1 -1
- package/dist/kernel/llm/lib/types/retry-policy.js +6 -2
- package/dist/kernel/llm/package.json +1 -1
- package/dist/kernel/llm-deepseek/lib/index.js +1100 -70
- package/dist/kernel/llm-deepseek/lib/types/adapter.d.ts +69 -1
- package/dist/kernel/llm-deepseek/lib/types/adapter.js +296 -60
- package/dist/kernel/llm-deepseek/lib/types/file-id.d.ts +19 -0
- package/dist/kernel/llm-deepseek/lib/types/file-id.js +18 -0
- package/dist/kernel/llm-deepseek/lib/types/file-store.d.ts +83 -0
- package/dist/kernel/llm-deepseek/lib/types/file-store.js +261 -0
- package/dist/kernel/llm-deepseek/lib/types/files-api.d.ts +103 -0
- package/dist/kernel/llm-deepseek/lib/types/files-api.js +206 -0
- package/dist/kernel/llm-deepseek/lib/types/index.d.ts +31 -3
- package/dist/kernel/llm-deepseek/lib/types/index.js +139 -3
- package/dist/kernel/llm-deepseek/lib/types/serialize.d.ts +55 -6
- package/dist/kernel/llm-deepseek/lib/types/serialize.js +179 -23
- package/dist/kernel/llm-deepseek/lib/types/types.d.ts +28 -5
- package/dist/kernel/llm-deepseek/lib/types/upload-index.d.ts +68 -0
- package/dist/kernel/llm-deepseek/lib/types/upload-index.js +171 -0
- package/dist/kernel/llm-deepseek/package.json +9 -1
- package/dist/kernel/llm-pi-ai/lib/index.js +1758 -1171
- package/dist/kernel/llm-pi-ai/lib/types/adapter.d.ts +30 -5
- package/dist/kernel/llm-pi-ai/lib/types/adapter.js +43 -23
- package/dist/kernel/llm-pi-ai/lib/types/auth.d.ts +60 -0
- package/dist/kernel/llm-pi-ai/lib/types/auth.js +196 -0
- package/dist/kernel/llm-pi-ai/lib/types/catalog.d.ts +176 -38
- package/dist/kernel/llm-pi-ai/lib/types/catalog.js +245 -50
- package/dist/kernel/llm-pi-ai/lib/types/config.d.ts +37 -5
- package/dist/kernel/llm-pi-ai/lib/types/config.js +67 -2
- package/dist/kernel/llm-pi-ai/lib/types/context.d.ts +8 -3
- package/dist/kernel/llm-pi-ai/lib/types/context.js +60 -16
- package/dist/kernel/llm-pi-ai/lib/types/index.d.ts +1 -0
- package/dist/kernel/llm-pi-ai/lib/types/index.js +21 -19
- package/dist/kernel/llm-pi-ai/lib/types/login.d.ts +21 -0
- package/dist/kernel/llm-pi-ai/lib/types/login.js +154 -0
- package/dist/kernel/llm-pi-ai/lib/types/stream.js +4 -0
- package/dist/kernel/llm-pi-ai/package.json +3 -1
- package/dist/kernel/llm-retry/package.json +1 -1
- package/dist/kernel/lsp/package.json +1 -1
- package/dist/kernel/lsp-stdio/package.json +1 -1
- package/dist/kernel/manifest.json +10 -2
- package/dist/kernel/mcp-client/package.json +1 -1
- package/dist/kernel/message-feedback/package.json +1 -1
- package/dist/kernel/native-command/package.json +1 -1
- package/dist/kernel/node-addon-landlock-run/lib/index.js +1 -1
- package/dist/kernel/node-addon-landlock-run/package.json +4 -2
- package/dist/kernel/output-retention/package.json +1 -1
- package/dist/kernel/permission-presets/lib/index.js +14 -2
- package/dist/kernel/permission-presets/lib/types/index.d.ts +5 -0
- package/dist/kernel/permission-presets/lib/types/index.js +11 -2
- package/dist/kernel/permission-presets/package.json +1 -1
- package/dist/kernel/persona/package.json +1 -1
- package/dist/kernel/plan-mode/lib/index.js +49 -15
- package/dist/kernel/plan-mode/lib/types/index.d.ts +22 -0
- package/dist/kernel/plan-mode/lib/types/index.js +45 -19
- package/dist/kernel/plan-mode/lib/types/types.d.ts +5 -4
- package/dist/kernel/plan-mode/package.json +1 -1
- package/dist/kernel/pwsh-local/package.json +1 -1
- package/dist/kernel/pwsh-sandbox/package.json +1 -1
- package/dist/kernel/repeat-tool-reminder/lib/index.js +1 -1
- package/dist/kernel/repeat-tool-reminder/package.json +1 -1
- package/dist/kernel/sandbox/package.json +1 -1
- package/dist/kernel/sandbox-local/lib/index.js +8 -13
- package/dist/kernel/sandbox-local/lib/types/index.d.ts +1 -3
- package/dist/kernel/sandbox-local/lib/types/index.js +4 -7
- package/dist/kernel/sandbox-local/lib/types/profiles.js +1 -1
- package/dist/kernel/sandbox-local/package.json +1 -1
- package/dist/kernel/sandbox-policy/package.json +1 -1
- package/dist/kernel/sandbox-windows-acl/package.json +1 -1
- package/dist/kernel/schedule/package.json +1 -1
- package/dist/kernel/schemastery/package.json +3 -1
- package/dist/kernel/scope/package.json +1 -1
- package/dist/kernel/sdk-client/lib/index.js +2 -2
- package/dist/kernel/sdk-client/lib/types/api.js +2 -2
- package/dist/kernel/sdk-client/lib/types/types.d.ts +4 -4
- package/dist/kernel/sdk-client/package.json +1 -1
- package/dist/kernel/sdk-jsonrpc-server/lib/index.js +12 -5
- package/dist/kernel/sdk-jsonrpc-server/lib/types/index.js +7 -0
- package/dist/kernel/sdk-jsonrpc-server/lib/types/server.d.ts +2 -1
- package/dist/kernel/sdk-jsonrpc-server/lib/types/server.js +15 -6
- package/dist/kernel/sdk-jsonrpc-server/package.json +2 -1
- package/dist/kernel/sdk-protocol/package.json +1 -1
- package/dist/kernel/session/lib/index.js +4 -0
- package/dist/kernel/session/lib/types/known-event-types.js +4 -0
- package/dist/kernel/session/lib/types/types.d.ts +6 -1
- package/dist/kernel/session/package.json +1 -1
- package/dist/kernel/session-checkpoint-policy/package.json +1 -1
- package/dist/kernel/session-log-export/package.json +2 -5
- package/dist/kernel/session-persistence/lib/index.js +1 -1
- package/dist/kernel/session-persistence/lib/types/coordinator.js +2 -1
- package/dist/kernel/session-persistence/package.json +1 -1
- package/dist/kernel/session-persistence-jsonl/package.json +1 -1
- package/dist/kernel/session-persistence-sqlite/lib/index.js +1105 -375
- package/dist/kernel/session-persistence-sqlite/lib/invariant.js +2 -2
- package/dist/kernel/session-persistence-sqlite/lib/types/codec.d.ts +72 -0
- package/dist/kernel/session-persistence-sqlite/lib/types/codec.js +304 -0
- package/dist/kernel/session-persistence-sqlite/lib/types/compression.d.ts +46 -0
- package/dist/kernel/session-persistence-sqlite/lib/types/compression.js +234 -0
- package/dist/kernel/session-persistence-sqlite/lib/types/index.d.ts +22 -80
- package/dist/kernel/session-persistence-sqlite/lib/types/index.js +27 -278
- package/dist/kernel/session-persistence-sqlite/lib/types/invariant.js +2 -2
- package/dist/kernel/session-persistence-sqlite/lib/types/schema.d.ts +63 -85
- package/dist/kernel/session-persistence-sqlite/lib/types/schema.js +293 -159
- package/dist/kernel/session-persistence-sqlite/lib/types/sql.d.ts +15 -0
- package/dist/kernel/session-persistence-sqlite/lib/types/sql.js +57 -0
- package/dist/kernel/session-persistence-sqlite/lib/types/store.d.ts +66 -0
- package/dist/kernel/session-persistence-sqlite/lib/types/store.js +394 -0
- package/dist/kernel/session-persistence-sqlite/package.json +9 -3
- package/dist/kernel/session-persistence-sqlite/resources/sql/begin-immediate.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/begin.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/commit.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/delete-events-from.sql +2 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/foreign-keys-on.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/insert-event.sql +3 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/insert-persistence-state.sql +2 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/journal-mode-delete.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/journal-mode-persist.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/journal-mode-truncate.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/journal-mode-wal.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/mmap-off.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/rollback.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/schema.sql +30 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-application-id.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-events-from.sql +4 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-events.sql +4 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-mmap-size.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-packed-predecessors.sql +6 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-schema-objects.sql +4 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-session.sql +4 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-sessions.sql +3 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-store-id.sql +3 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-synchronous.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-tail-events.sql +5 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-trusted-schema.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-user-object-count.sql +3 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/select-user-version.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/set-application-id.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/set-user-version-17.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/synchronous-full.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/trusted-schema-off.sql +1 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/update-session-revision.sql +3 -0
- package/dist/kernel/session-persistence-sqlite/resources/sql/upsert-session.sql +13 -0
- package/dist/kernel/session-projection/lib/index.js +55 -30
- package/dist/kernel/session-projection/lib/types/index.d.ts +57 -34
- package/dist/kernel/session-projection/lib/types/index.js +61 -36
- package/dist/kernel/session-projection/lib/types/types.d.ts +11 -4
- package/dist/kernel/session-projection/package.json +1 -1
- package/dist/kernel/session-projection-cache/lib/index.js +1 -1
- package/dist/kernel/session-projection-cache/lib/types/index.d.ts +1 -1
- package/dist/kernel/session-projection-cache/lib/types/index.js +4 -5
- package/dist/kernel/session-projection-cache/package.json +1 -1
- package/dist/kernel/session-query/package.json +1 -1
- package/dist/kernel/session-query-sqlite/package.json +1 -1
- package/dist/kernel/session-reference/lib/index.js +232 -110
- package/dist/kernel/session-reference/lib/typert.host.d.ts +3 -0
- package/dist/kernel/session-reference/lib/typert.host.js +458 -0
- package/dist/kernel/session-reference/lib/typert.remote-client.d.ts +26 -0
- package/dist/kernel/session-reference/lib/typert.remote-client.js +62 -0
- package/dist/kernel/session-reference/lib/types/index.d.ts +25 -5
- package/dist/kernel/session-reference/lib/types/index.js +230 -126
- package/dist/kernel/session-reference/lib/types/types.d.ts +14 -3
- package/dist/kernel/session-reference/lib/types/types.js +6 -1
- package/dist/kernel/session-reference/package.json +23 -3
- package/dist/kernel/session-stats/lib/index.js +31 -12
- package/dist/kernel/session-stats/lib/types/projection.d.ts +64 -2
- package/dist/kernel/session-stats/lib/types/projection.js +31 -12
- package/dist/kernel/session-stats/package.json +1 -1
- package/dist/kernel/session-telemetry/package.json +1 -1
- package/dist/kernel/session-telemetry-otel/package.json +1 -1
- package/dist/kernel/session-title/lib/index.js +6 -2
- package/dist/kernel/session-title/lib/types/index.js +3 -2
- package/dist/kernel/session-title/lib/types/types.d.ts +3 -0
- package/dist/kernel/session-title/package.json +1 -1
- package/dist/kernel/session-title-all-prompts-llm/package.json +1 -1
- package/dist/kernel/session-title-first-prompt-llm/package.json +1 -1
- package/dist/kernel/session-title-llm/package.json +1 -1
- package/dist/kernel/settings/package.json +1 -1
- package/dist/kernel/settings-file/package.json +1 -1
- package/dist/kernel/shell/package.json +1 -1
- package/dist/kernel/shell-env/package.json +1 -1
- package/dist/kernel/skill/package.json +1 -1
- package/dist/kernel/skill-badge/assets/nomix-badge.md +6 -6
- package/dist/kernel/skill-badge/assets/nomix-badge.png +0 -0
- package/dist/kernel/skill-badge/lib/index.js +1 -1
- package/dist/kernel/skill-badge/lib/types/index.js +1 -1
- package/dist/kernel/skill-badge/package.json +1 -1
- package/dist/kernel/skill-filesystem/package.json +1 -1
- package/dist/kernel/spill/package.json +1 -1
- package/dist/kernel/spill-local/package.json +1 -1
- package/dist/kernel/spill-policy/package.json +1 -1
- package/dist/kernel/storage/package.json +1 -1
- package/dist/kernel/storage-domain/package.json +1 -1
- package/dist/kernel/storage-json/package.json +1 -1
- package/dist/kernel/storage-sqlite/package.json +1 -1
- package/dist/kernel/subagent/lib/index.js +123 -20
- package/dist/kernel/subagent/lib/types/continuation.d.ts +21 -2
- package/dist/kernel/subagent/lib/types/continuation.js +58 -7
- package/dist/kernel/subagent/lib/types/index.d.ts +11 -0
- package/dist/kernel/subagent/lib/types/index.js +16 -0
- package/dist/kernel/subagent/lib/types/out-of-process.d.ts +2 -0
- package/dist/kernel/subagent/lib/types/out-of-process.js +31 -1
- package/dist/kernel/subagent/lib/types/projection.d.ts +55 -8
- package/dist/kernel/subagent/lib/types/projection.js +30 -15
- package/dist/kernel/subagent/lib/types/run-settlement.js +10 -3
- package/dist/kernel/subagent/lib/types/types.d.ts +7 -0
- package/dist/kernel/subagent/package.json +1 -1
- package/dist/kernel/subagent-acp/package.json +1 -1
- package/dist/kernel/subagent-claude-code/cordis.patch.yml +6 -0
- package/dist/kernel/subagent-claude-code/lib/index.js +267 -73
- package/dist/kernel/subagent-claude-code/lib/types/index.d.ts +16 -6
- package/dist/kernel/subagent-claude-code/lib/types/index.js +35 -14
- package/dist/kernel/subagent-claude-code/lib/types/process.d.ts +5 -7
- package/dist/kernel/subagent-claude-code/lib/types/process.js +12 -24
- package/dist/kernel/subagent-claude-code/lib/types/run.d.ts +24 -7
- package/dist/kernel/subagent-claude-code/lib/types/run.js +266 -40
- package/dist/kernel/subagent-claude-code/package.json +10 -2
- package/dist/kernel/subagent-codex/cordis.patch.yml +5 -0
- package/dist/kernel/subagent-codex/lib/index.js +482 -91
- package/dist/kernel/subagent-codex/lib/types/index.d.ts +11 -6
- package/dist/kernel/subagent-codex/lib/types/index.js +33 -12
- package/dist/kernel/subagent-codex/lib/types/run.d.ts +17 -8
- package/dist/kernel/subagent-codex/lib/types/run.js +235 -42
- package/dist/kernel/subagent-codex/lib/types/wire.d.ts +49 -1
- package/dist/kernel/subagent-codex/lib/types/wire.js +280 -33
- package/dist/kernel/subagent-codex/package.json +10 -5
- package/dist/kernel/subagent-fork-in-process/package.json +1 -1
- package/dist/kernel/subagent-in-process-driver/package.json +1 -1
- package/dist/kernel/subagent-nomix-sdk/package.json +1 -1
- package/dist/kernel/subagent-spawn-in-process/package.json +1 -1
- package/dist/kernel/subprocess/package.json +1 -1
- package/dist/kernel/subprocess-e2b/package.json +1 -1
- package/dist/kernel/subprocess-local/lib/index.js +303 -1
- package/dist/kernel/subprocess-local/lib/types/process-inspector.js +3 -0
- package/dist/kernel/subprocess-local/lib/types/terminal.d.ts +6 -1
- package/dist/kernel/subprocess-local/lib/types/terminal.js +78 -1
- package/dist/kernel/subprocess-local/lib/types/windows-inspector.d.ts +80 -0
- package/dist/kernel/subprocess-local/lib/types/windows-inspector.js +259 -0
- package/dist/kernel/subprocess-local/package.json +2 -1
- package/dist/kernel/system-prompt/package.json +1 -1
- package/dist/kernel/terminal/package.json +1 -1
- package/dist/kernel/terminal-bash/lib/index.js +85 -20
- package/dist/kernel/terminal-bash/lib/types/config.d.ts +29 -5
- package/dist/kernel/terminal-bash/lib/types/config.js +33 -3
- package/dist/kernel/terminal-bash/lib/types/index.d.ts +7 -0
- package/dist/kernel/terminal-bash/lib/types/index.js +65 -13
- package/dist/kernel/terminal-bash/package.json +2 -1
- package/dist/kernel/time-context/lib/index.js +1 -1
- package/dist/kernel/time-context/lib/invariant.js +1 -1
- package/dist/kernel/time-context/package.json +1 -1
- package/dist/kernel/timeout/package.json +1 -1
- package/dist/kernel/tmux-context/lib/index.js +1 -1
- package/dist/kernel/tmux-context/package.json +1 -1
- package/dist/kernel/token-meter/lib/index.js +77 -21
- package/dist/kernel/token-meter/lib/types/breakdown-projection.d.ts +76 -9
- package/dist/kernel/token-meter/lib/types/breakdown-projection.js +22 -6
- package/dist/kernel/token-meter/lib/types/usage-projection.d.ts +186 -25
- package/dist/kernel/token-meter/lib/types/usage-projection.js +44 -15
- package/dist/kernel/token-meter/package.json +1 -1
- package/dist/kernel/tool-ask-user/package.json +1 -1
- package/dist/kernel/tool-bash/package.json +1 -1
- package/dist/kernel/tool-bash-persistent/lib/index.js +15 -5
- package/dist/kernel/tool-bash-persistent/lib/types/index.js +23 -6
- package/dist/kernel/tool-bash-persistent/package.json +1 -1
- package/dist/kernel/tool-call-timeout-policy/package.json +1 -1
- package/dist/kernel/tool-cordis/lib/index.js +655 -83
- package/dist/kernel/tool-cordis/lib/types/api-catalog.js +439 -41
- package/dist/kernel/tool-cordis/package.json +1 -1
- package/dist/kernel/tool-fs/lib/index.js +80 -52
- package/dist/kernel/tool-fs/lib/types/read-image.d.ts +16 -12
- package/dist/kernel/tool-fs/lib/types/read-image.js +73 -29
- package/dist/kernel/tool-fs/package.json +1 -1
- package/dist/kernel/tool-fs-search/lib/index.js +11 -7
- package/dist/kernel/tool-fs-search/lib/types/search-core.d.ts +5 -6
- package/dist/kernel/tool-fs-search/lib/types/search-core.js +12 -7
- package/dist/kernel/tool-fs-search/package.json +1 -1
- package/dist/kernel/tool-goal/package.json +1 -1
- package/dist/kernel/tool-jobs/package.json +1 -1
- package/dist/kernel/tool-lsp/package.json +1 -1
- package/dist/kernel/tool-pwsh/package.json +1 -1
- package/dist/kernel/tool-pwsh-persistent/lib/index.js +407 -0
- package/dist/kernel/tool-pwsh-persistent/lib/invariant.js +24 -0
- package/dist/kernel/tool-pwsh-persistent/lib/types/index.d.ts +24 -0
- package/dist/kernel/tool-pwsh-persistent/lib/types/index.js +465 -0
- package/dist/kernel/tool-pwsh-persistent/lib/types/invariant.d.ts +16 -0
- package/dist/kernel/tool-pwsh-persistent/lib/types/invariant.js +23 -0
- package/dist/kernel/tool-pwsh-persistent/package.json +62 -0
- package/dist/kernel/tool-ralph/package.json +1 -1
- package/dist/kernel/tool-session-query/package.json +1 -1
- package/dist/kernel/tool-skill/package.json +1 -1
- package/dist/kernel/tool-str-replace-editor/package.json +1 -1
- package/dist/kernel/tool-subagent/lib/index.js +10 -8
- package/dist/kernel/tool-subagent/lib/types/index.js +15 -8
- package/dist/kernel/tool-subagent/package.json +1 -1
- package/dist/kernel/tool-subagent-control/package.json +1 -1
- package/dist/kernel/tool-subagent-report/lib/index.js +1 -1
- package/dist/kernel/tool-subagent-report/lib/types/index.d.ts +3 -3
- package/dist/kernel/tool-subagent-report/lib/types/index.js +1 -1
- package/dist/kernel/tool-subagent-report/package.json +1 -1
- package/dist/kernel/tool-terminal/package.json +1 -1
- package/dist/kernel/tool-todo/lib/index.js +5 -2
- package/dist/kernel/tool-todo/lib/types/index.js +2 -2
- package/dist/kernel/tool-todo/lib/types/types.d.ts +3 -0
- package/dist/kernel/tool-todo/package.json +1 -1
- package/dist/kernel/tool-web/lib/index.js +101 -26
- package/dist/kernel/tool-web/lib/types/index.d.ts +4 -2
- package/dist/kernel/tool-web/lib/types/index.js +5 -3
- package/dist/kernel/tool-web/lib/types/search.d.ts +23 -20
- package/dist/kernel/tool-web/lib/types/search.js +109 -20
- package/dist/kernel/tool-web/package.json +1 -1
- package/dist/kernel/tool-workflow/package.json +1 -1
- package/dist/kernel/tools/package.json +1 -1
- package/dist/kernel/typert-generator/lib/index.js +8 -3
- package/dist/kernel/typert-generator/lib/types/cordis-catalog.js +8 -3
- package/dist/kernel/typert-generator/package.json +1 -1
- package/dist/kernel/typert-loader/package.json +1 -1
- package/dist/kernel/typert-protocol/package.json +1 -1
- package/dist/kernel/typert-registry/package.json +1 -1
- package/dist/kernel/user-approval/package.json +1 -1
- package/dist/kernel/user-questions/package.json +1 -1
- package/dist/kernel/web/lib/types/types.d.ts +4 -3
- package/dist/kernel/web/package.json +1 -1
- package/dist/kernel/web-app/cordis.patch.yml +27 -6
- package/dist/kernel/web-app/lib/index.js +111 -15
- package/dist/kernel/web-app/lib/startup.js +4 -2
- package/dist/kernel/web-app/lib/types/index.d.ts +8 -4
- package/dist/kernel/web-app/lib/types/index.js +116 -23
- package/dist/kernel/web-app/lib/types/startup.d.ts +3 -1
- package/dist/kernel/web-app/lib/types/startup.js +4 -1
- package/dist/kernel/web-app/package.json +12 -2
- package/dist/kernel/web-fetch-http/lib/index.js +1 -1
- package/dist/kernel/web-fetch-http/lib/types/index.d.ts +1 -1
- package/dist/kernel/web-fetch-http/lib/types/index.js +1 -1
- package/dist/kernel/web-fetch-http/package.json +1 -1
- package/dist/kernel/web-frontend/dist/assets/index-BnapMmQ_.css +1 -0
- package/dist/kernel/web-frontend/dist/assets/index-Dx7Ws_OC.js +96 -0
- package/dist/kernel/web-frontend/dist/assets/langs/{php-D-uCvoST.js → php-DDkx9sim.js} +2 -2
- package/dist/{assets/web/assets/langs/ruby-DEItuUFs.js → kernel/web-frontend/dist/assets/langs/ruby-DCxyoPen.js} +2 -2
- package/dist/kernel/web-frontend/dist/assets/{vendor-Cjbwl5VI.js → vendor-D22_Mp1f.js} +2 -2
- package/dist/kernel/web-frontend/dist/favicon.svg +8 -0
- package/dist/kernel/web-frontend/dist/index.html +5 -5
- package/dist/kernel/web-frontend/package.json +5 -8
- package/dist/kernel/web-search-deepseek/lib/index.js +1 -1
- package/dist/kernel/web-search-deepseek/lib/types/provider.js +1 -1
- package/dist/kernel/web-search-deepseek/package.json +1 -1
- package/dist/kernel/web-search-exa/lib/index.js +1 -1
- package/dist/kernel/web-search-exa/lib/types/provider.js +1 -1
- package/dist/kernel/web-search-exa/package.json +1 -1
- package/dist/kernel/web-search-perplexity/lib/index.js +1 -1
- package/dist/kernel/web-search-perplexity/lib/types/provider.js +1 -1
- package/dist/kernel/web-search-perplexity/package.json +1 -1
- package/dist/kernel/workflow/package.json +1 -1
- package/dist/kernel/workflow-worker-thread/package.json +1 -1
- package/dist/kernel/workspace/package.json +1 -1
- package/dist/plugins/manifest.json +50 -10
- package/dist/runtime/index.js +0 -2
- package/package.json +8 -6
- package/dist/assets/web/assets/index-B_fSXASy.css +0 -1
- package/dist/assets/web/assets/index-B_sZ-Gsu.js +0 -112
- package/dist/cli/builtin-registry.d.ts +0 -5
- package/dist/cli/profile-boot-CeU09iFc.js +0 -2
- package/dist/kernel/app-boot/lib/types/legacy-branding.d.ts +0 -6
- package/dist/kernel/app-boot/lib/types/legacy-branding.js +0 -18
- package/dist/kernel/client-schema-form/lib/index.js +0 -137
- package/dist/kernel/client-schema-form/lib/types/index.d.ts +0 -10
- package/dist/kernel/client-schema-form/lib/types/index.js +0 -9
- package/dist/kernel/client-schema-form/lib/types/model.d.ts +0 -66
- package/dist/kernel/client-schema-form/lib/types/model.js +0 -153
- package/dist/kernel/client-ui-subagent/lib/types/client/SubagentCatalogAction.d.ts +0 -18
- package/dist/kernel/client-ui-theme/lib/styles/base.css +0 -15
- package/dist/kernel/client-ui-theme/lib/styles/design-platform.css +0 -338
- package/dist/kernel/client-ui-theme/lib/styles/gradient-shadow-text.css +0 -232
- package/dist/kernel/client-ui-theme/lib/styles/scrollbar.css +0 -90
- package/dist/kernel/client-ui-theme/lib/styles/shiki.css +0 -31
- package/dist/kernel/client-web/lib/types/AppRoot.d.ts +0 -16
- package/dist/kernel/client-web/lib/types/AppRoot.js +0 -27
- package/dist/kernel/client-web/lib/types/DocumentTitle.js +0 -16
- package/dist/kernel/client-web/lib/types/app-shell.d.ts +0 -28
- package/dist/kernel/client-web/lib/types/app-shell.js +0 -27
- package/dist/kernel/client-web/lib/types/app.d.ts +0 -21
- package/dist/kernel/client-web-react/lib/index.js +0 -810
- package/dist/kernel/client-web-react/lib/types/index.d.ts +0 -16
- package/dist/kernel/client-web-react/lib/types/index.js +0 -6
- package/dist/kernel/client-web-react/lib/types/use-invoke.d.ts +0 -9
- package/dist/kernel/client-web-react/lib/types/use-invoke.js +0 -52
- package/dist/kernel/skill-badge/assets/nomix-badge.svg +0 -8
- package/dist/kernel/web-frontend/dist/assets/index-B_fSXASy.css +0 -1
- package/dist/kernel/web-frontend/dist/assets/index-B_sZ-Gsu.js +0 -112
- /package/dist/kernel/{client-web-react/lib/types → client-ui-renderer/lib/types/client}/bind.js +0 -0
- /package/dist/kernel/{client-web-react/lib/types → client-ui-renderer/lib/types/client}/session-provider.js +0 -0
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import z from "../../schemastery/lib/index.mjs";
|
|
2
|
-
import { CONTEXT_WINDOW_EXCEEDED_CODE, CallId, EMPTY_RESPONSE_CODE, LlmAdapter, LlmError, ProviderRequestId, QUOTA_EXCEEDED_CODE, ReasoningEffortId, RetryPolicySchema, assertUsableApiKey, attributionHeaders, contentHasImage, isContextWindowExceededError, isQuotaExceededError, resolveRetryPolicy } from "../../llm/lib/index.js";
|
|
2
|
+
import { CONTEXT_WINDOW_EXCEEDED_CODE, CallId, EMPTY_RESPONSE_CODE, LlmAdapter, LlmError, ProviderRequestId, QUOTA_EXCEEDED_CODE, ReasoningEffortId, RetryPolicySchema, assertUsableApiKey, attributionHeaders, contentHasImage, isContextWindowExceededError, isQuotaExceededError, offloadRequestImagesWithPolicy, requestImageHandleText, resolveRetryPolicy } from "../../llm/lib/index.js";
|
|
3
3
|
import { credentialRef } from "../../credentials/lib/index.js";
|
|
4
4
|
import { launchEnvironmentOf } from "../../launch-environment/lib/index.js";
|
|
5
5
|
import { deepEqualJson, installSettingsSection, settingsNamespace } from "../../settings/lib/index.js";
|
|
6
|
-
import { MAX_TIMER_DELAY_MS, idleWatchdog, timeoutOf } from "../../timeout/lib/index.js";
|
|
6
|
+
import { MAX_TIMER_DELAY_MS, deadline, idleWatchdog, timeoutOf } from "../../timeout/lib/index.js";
|
|
7
7
|
import { getOrCreateAnonymousUserId } from "../../anonymous-user-id/lib/index.js";
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
import { mkdir, readFile } from "node:fs/promises";
|
|
10
|
+
import { dirname, join } from "node:path";
|
|
11
|
+
import { withFileLock, writeFileAtomic } from "../../atomic-write/lib/index.js";
|
|
12
|
+
import { resolveNomixHome } from "../../home-paths/lib/index.js";
|
|
13
|
+
import { ImageVariantId } from "../../attachment/lib/index.js";
|
|
8
14
|
import { EventSourceParserStream } from "eventsource-parser/stream";
|
|
9
15
|
//#region lib/types/serialize.js
|
|
10
16
|
/**
|
|
11
|
-
* Serialize harness messages into DeepSeek chat completions.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* unknown declaration-merged block types retain the adapter's documented extension fallback.
|
|
17
|
+
* Serialize harness messages into DeepSeek chat completions. Text-only
|
|
18
|
+
* requests retain string user content; the image path resolves durable
|
|
19
|
+
* attachments into ordered file-id or inline parts. Tool-result images follow their
|
|
20
|
+
* string-only tool messages in a separate user message.
|
|
16
21
|
* @module nomix-llm-deepseek/serialize
|
|
17
22
|
*/
|
|
23
|
+
const TOOL_RESULT_IMAGE_TEXT = "Attached image(s) from tool result:";
|
|
18
24
|
/** Validate the adapter-owned effort before resolving its DeepSeek wire fields. */
|
|
19
25
|
function reasoningEffort(effort) {
|
|
20
26
|
if (effort === "off" || effort === "low" || effort === "high" || effort === "max") return effort;
|
|
@@ -40,6 +46,63 @@ function flattenText(blocks) {
|
|
|
40
46
|
function assertTextOnly(blocks) {
|
|
41
47
|
if (contentHasImage(blocks)) throw new LlmError("The DeepSeek chat-completions adapter does not support image content.", "UNSUPPORTED_CONTENT");
|
|
42
48
|
}
|
|
49
|
+
/** Reject roles whose DeepSeek history format cannot carry image input. */
|
|
50
|
+
function assertSupportedImageRoles(messages) {
|
|
51
|
+
for (const message of messages) if (message.role !== "user" && contentHasImage(message.content)) throw new LlmError(`The DeepSeek chat-completions adapter cannot represent image content in a ${message.role} message.`, "UNSUPPORTED_CONTENT");
|
|
52
|
+
}
|
|
53
|
+
/** Describe the exact request preview and its model-callable coordinate system. */
|
|
54
|
+
function imageHandle(version, precededByContent) {
|
|
55
|
+
return {
|
|
56
|
+
type: "text",
|
|
57
|
+
text: `${precededByContent ? "\n" : ""}${requestImageHandleText(version)}`
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** Resolve one durable image into its descriptor and transient DeepSeek image part. */
|
|
61
|
+
async function imageParts(block, images, location, precededByContent) {
|
|
62
|
+
const version = images.requestImages.get(block.attachment.attachmentId);
|
|
63
|
+
if (version === void 0) throw new LlmError(`DeepSeek request image ${block.attachment.attachmentId} was not prepared.`, "INVALID_REQUEST");
|
|
64
|
+
const image = images.representation.kind === "file" ? {
|
|
65
|
+
type: "file",
|
|
66
|
+
file_id: await images.representation.resolveFileId(version, block, location)
|
|
67
|
+
} : {
|
|
68
|
+
type: "image_url",
|
|
69
|
+
image_url: { url: `data:${version.mediaType};base64,${Buffer.from(version.data).toString("base64")}` }
|
|
70
|
+
};
|
|
71
|
+
return [imageHandle(version, precededByContent), image];
|
|
72
|
+
}
|
|
73
|
+
/** Convert user or nested tool-result blocks into ordered wire parts. */
|
|
74
|
+
async function contentParts(blocks, images, message, nextImage) {
|
|
75
|
+
const parts = [];
|
|
76
|
+
for (const block of blocks) switch (block.type) {
|
|
77
|
+
case "text":
|
|
78
|
+
if (block.text.length > 0) parts.push({
|
|
79
|
+
type: "text",
|
|
80
|
+
text: block.text
|
|
81
|
+
});
|
|
82
|
+
break;
|
|
83
|
+
case "image":
|
|
84
|
+
nextImage.value += 1;
|
|
85
|
+
parts.push(...await imageParts(block, images, {
|
|
86
|
+
message,
|
|
87
|
+
image: nextImage.value
|
|
88
|
+
}, parts.length > 0));
|
|
89
|
+
break;
|
|
90
|
+
case "tool-result":
|
|
91
|
+
parts.push(...await contentParts(block.content, images, message, nextImage));
|
|
92
|
+
break;
|
|
93
|
+
default: break;
|
|
94
|
+
}
|
|
95
|
+
return parts;
|
|
96
|
+
}
|
|
97
|
+
/** Keep text-only user messages on the compact string wire form. */
|
|
98
|
+
function userContent(parts) {
|
|
99
|
+
const text = [];
|
|
100
|
+
for (const part of parts) {
|
|
101
|
+
if (part.type !== "text") return [...parts];
|
|
102
|
+
text.push(part.text);
|
|
103
|
+
}
|
|
104
|
+
return text.join("");
|
|
105
|
+
}
|
|
43
106
|
/** Serialize one assistant message (text + reasoning + tool calls). */
|
|
44
107
|
function serializeAssistant(message) {
|
|
45
108
|
const text = flattenText(message.content);
|
|
@@ -55,7 +118,7 @@ function serializeAssistant(message) {
|
|
|
55
118
|
return {
|
|
56
119
|
role: "assistant",
|
|
57
120
|
content: text,
|
|
58
|
-
...
|
|
121
|
+
...reasoning.length > 0 ? { reasoning_content: reasoning } : {},
|
|
59
122
|
...toolCalls.length > 0 ? { tool_calls: toolCalls } : {}
|
|
60
123
|
};
|
|
61
124
|
}
|
|
@@ -97,20 +160,70 @@ function serializeMessages(messages) {
|
|
|
97
160
|
return wire;
|
|
98
161
|
}
|
|
99
162
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* @param
|
|
104
|
-
* @param
|
|
105
|
-
* @returns
|
|
163
|
+
* Serialize image-capable history after resolving durable attachments.
|
|
164
|
+
* Consecutive tool results keep string `tool` messages and share one following
|
|
165
|
+
* user message containing their images.
|
|
166
|
+
* @param messages - transient request history after request-size offloading.
|
|
167
|
+
* @param images - prepared request versions, one provider representation, and its budget.
|
|
168
|
+
* @returns ordered DeepSeek wire messages.
|
|
106
169
|
*/
|
|
107
|
-
function
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
170
|
+
async function serializeMessagesWithImages(messages, images) {
|
|
171
|
+
assertSupportedImageRoles(messages);
|
|
172
|
+
const wire = [];
|
|
173
|
+
let pendingToolImages = [];
|
|
174
|
+
const flushToolImages = () => {
|
|
175
|
+
if (pendingToolImages.length === 0) return;
|
|
176
|
+
wire.push({
|
|
177
|
+
role: "user",
|
|
178
|
+
content: [{
|
|
179
|
+
type: "text",
|
|
180
|
+
text: TOOL_RESULT_IMAGE_TEXT
|
|
181
|
+
}, ...pendingToolImages]
|
|
182
|
+
});
|
|
183
|
+
pendingToolImages = [];
|
|
184
|
+
};
|
|
185
|
+
for (const [messageIndex, message] of messages.entries()) {
|
|
186
|
+
const nextImage = { value: 0 };
|
|
187
|
+
if (message.role === "system") {
|
|
188
|
+
flushToolImages();
|
|
189
|
+
wire.push({
|
|
190
|
+
role: "system",
|
|
191
|
+
content: flattenText(message.content)
|
|
192
|
+
});
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (message.role === "assistant") {
|
|
196
|
+
flushToolImages();
|
|
197
|
+
wire.push(serializeAssistant(message));
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const regular = message.content.filter((block) => block.type !== "tool-result");
|
|
201
|
+
const toolResults = message.content.filter((block) => block.type === "tool-result");
|
|
202
|
+
const content = userContent(await contentParts(regular, images, messageIndex + 1, nextImage));
|
|
203
|
+
if (content.length > 0 || toolResults.length === 0) {
|
|
204
|
+
flushToolImages();
|
|
205
|
+
wire.push({
|
|
206
|
+
role: "user",
|
|
207
|
+
content
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
for (const result of toolResults) {
|
|
211
|
+
const parts = await contentParts(result.content, images, messageIndex + 1, nextImage);
|
|
212
|
+
const imageParts = parts.filter((part) => part.type !== "text");
|
|
213
|
+
const text = parts.filter((part) => part.type === "text").map((part) => part.text).join("");
|
|
214
|
+
wire.push({
|
|
215
|
+
role: "tool",
|
|
216
|
+
tool_call_id: result.toolCallId,
|
|
217
|
+
content: text || "(no output)"
|
|
218
|
+
});
|
|
219
|
+
pendingToolImages.push(...imageParts);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
flushToolImages();
|
|
223
|
+
return wire;
|
|
224
|
+
}
|
|
225
|
+
/** Assemble request fields shared by text-only and image-capable conversion. */
|
|
226
|
+
function requestWithMessages(options, messages, defaults) {
|
|
114
227
|
const tools = options.tools?.map((tool) => ({
|
|
115
228
|
type: "function",
|
|
116
229
|
function: {
|
|
@@ -134,6 +247,635 @@ function serializeRequest(options, defaults = {}) {
|
|
|
134
247
|
};
|
|
135
248
|
}
|
|
136
249
|
/**
|
|
250
|
+
* Build the full wire request. Always streaming (`stream: true`, usage
|
|
251
|
+
* reporting on); optional fields are omitted rather than sent as null, so
|
|
252
|
+
* provider defaults apply.
|
|
253
|
+
* @param options - the harness request (model, history, system, tools, sampling).
|
|
254
|
+
* @param defaults - adapter-level thinking defaults; undefined fields put nothing on the wire.
|
|
255
|
+
* @returns the chat-completions request body.
|
|
256
|
+
*/
|
|
257
|
+
function serializeRequest(options, defaults = {}) {
|
|
258
|
+
const messages = [];
|
|
259
|
+
if (options.system !== void 0) messages.push({
|
|
260
|
+
role: "system",
|
|
261
|
+
content: options.system
|
|
262
|
+
});
|
|
263
|
+
messages.push(...serializeMessages(options.messages));
|
|
264
|
+
return requestWithMessages(options, messages, defaults);
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Build one image-capable request while keeping durable bytes out of session
|
|
268
|
+
* messages. Oversized oldest images become deterministic text after their
|
|
269
|
+
* exact request-version byte lengths are known and before provider serialization.
|
|
270
|
+
* @param options - harness request containing image-capable user content.
|
|
271
|
+
* @param images - attachment resolver, request bound, and cancellation.
|
|
272
|
+
* @param defaults - adapter-level thinking defaults.
|
|
273
|
+
* @returns the fully materialized DeepSeek request body.
|
|
274
|
+
*/
|
|
275
|
+
async function serializeRequestWithImages(options, images, defaults = {}) {
|
|
276
|
+
assertSupportedImageRoles(options.messages);
|
|
277
|
+
const requestMessages = offloadRequestImagesWithPolicy(options.messages, {
|
|
278
|
+
representation: images.representation.kind === "file" ? "raw" : "base64",
|
|
279
|
+
byteLength: (ref) => {
|
|
280
|
+
const version = images.requestImages.get(ref.attachmentId);
|
|
281
|
+
if (version === void 0) throw new LlmError(`DeepSeek request image ${ref.attachmentId} was not prepared.`, "INVALID_REQUEST");
|
|
282
|
+
return version.bytes;
|
|
283
|
+
},
|
|
284
|
+
maxBytes: images.maxRequestImageBytes,
|
|
285
|
+
...images.maxImagesPerRequest === void 0 ? {} : { maxImages: images.maxImagesPerRequest },
|
|
286
|
+
...images.byteQuantum === void 0 ? {} : { byteQuantum: images.byteQuantum },
|
|
287
|
+
...images.countQuantum === void 0 ? {} : { countQuantum: images.countQuantum }
|
|
288
|
+
});
|
|
289
|
+
const messages = [];
|
|
290
|
+
if (options.system !== void 0) messages.push({
|
|
291
|
+
role: "system",
|
|
292
|
+
content: options.system
|
|
293
|
+
});
|
|
294
|
+
messages.push(...await serializeMessagesWithImages(requestMessages, images));
|
|
295
|
+
return requestWithMessages(options, messages, defaults);
|
|
296
|
+
}
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region lib/types/file-id.js
|
|
299
|
+
/** DeepSeek Files API identifiers. @module nomix-llm-deepseek/file-id */
|
|
300
|
+
/**
|
|
301
|
+
* Brand a provider-returned file identifier after wire validation.
|
|
302
|
+
* @param id - non-empty Files API identifier.
|
|
303
|
+
* @returns the same string with its provider identity attached at type level.
|
|
304
|
+
*/
|
|
305
|
+
function DeepSeekFileId(id) {
|
|
306
|
+
return id;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Brand a locally derived namespace digest.
|
|
310
|
+
* @param scope - SHA-256 digest of endpoint and API key.
|
|
311
|
+
* @returns the same string with namespace identity attached at type level.
|
|
312
|
+
*/
|
|
313
|
+
function DeepSeekFileScope(scope) {
|
|
314
|
+
return scope;
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region lib/types/files-api.js
|
|
318
|
+
/** OpenAI-compatible DeepSeek Files API transport. @module nomix-llm-deepseek/files-api */
|
|
319
|
+
/** Minimum provider-supported file lifetime. */
|
|
320
|
+
const MIN_FILE_EXPIRY_SECONDS = 3600;
|
|
321
|
+
/** Maximum provider-supported file lifetime. */
|
|
322
|
+
const MAX_FILE_EXPIRY_SECONDS = 2592e3;
|
|
323
|
+
/** Maximum Files API upload size. */
|
|
324
|
+
const MAX_FILE_UPLOAD_BYTES = 128 * 1024 * 1024;
|
|
325
|
+
/** Current per-key file-count quota. */
|
|
326
|
+
const MAX_STORED_FILE_COUNT = 1e4;
|
|
327
|
+
/** Current per-key storage quota. */
|
|
328
|
+
const MAX_STORED_FILE_BYTES = 25 * 1024 * 1024 * 1024;
|
|
329
|
+
/** Files API operation failure with its HTTP status retained for recovery policy. */
|
|
330
|
+
var DeepSeekFilesError = class extends LlmError {
|
|
331
|
+
/** Parsed provider detail used only for error classification. */
|
|
332
|
+
detail;
|
|
333
|
+
/**
|
|
334
|
+
* @param message - user-readable provider failure.
|
|
335
|
+
* @param status - HTTP status returned by the Files API.
|
|
336
|
+
* @param detail - provider error fields joined for classification.
|
|
337
|
+
*/
|
|
338
|
+
constructor(message, status, detail) {
|
|
339
|
+
super(message, status === 401 || status === 403 ? "AUTH" : status === 429 ? "RATE_LIMIT" : status >= 500 ? "SERVER" : "FILES_API", { status });
|
|
340
|
+
this.name = "DeepSeekFilesError";
|
|
341
|
+
this.detail = detail;
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* Whether an upload failure reports a provider storage or file-count quota.
|
|
346
|
+
* @param error - Files API operation failure.
|
|
347
|
+
* @returns whether one bounded remote cleanup and upload retry may recover.
|
|
348
|
+
*/
|
|
349
|
+
function isFilesQuotaError(error) {
|
|
350
|
+
return error instanceof DeepSeekFilesError && /(?:quota|storage|stored files|file count|too many files)/iu.test(error.detail);
|
|
351
|
+
}
|
|
352
|
+
function invalidResponse(operation) {
|
|
353
|
+
return new LlmError(`DeepSeek Files API returned an invalid ${operation} response.`, "INVALID_RESPONSE");
|
|
354
|
+
}
|
|
355
|
+
function parseFileObject(value, operation) {
|
|
356
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw invalidResponse(operation);
|
|
357
|
+
const wire = value;
|
|
358
|
+
if (typeof wire.id !== "string" || wire.id.length === 0 || wire.object !== "file" || !Number.isSafeInteger(wire.bytes) || wire.bytes < 0 || !Number.isSafeInteger(wire.created_at) || wire.created_at < 0 || typeof wire.filename !== "string" || wire.filename.length === 0 || wire.purpose !== "user_data" || wire.expires_at !== void 0 && (!Number.isSafeInteger(wire.expires_at) || wire.expires_at < 0)) throw invalidResponse(operation);
|
|
359
|
+
return {
|
|
360
|
+
id: DeepSeekFileId(wire.id),
|
|
361
|
+
bytes: wire.bytes,
|
|
362
|
+
createdAt: wire.created_at,
|
|
363
|
+
filename: wire.filename,
|
|
364
|
+
purpose: "user_data",
|
|
365
|
+
...wire.expires_at === void 0 ? {} : { expiresAt: wire.expires_at }
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function providerErrorDetail(value) {
|
|
369
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return { detail: "" };
|
|
370
|
+
const error = value.error;
|
|
371
|
+
if (error === null || typeof error !== "object" || Array.isArray(error)) return { detail: "" };
|
|
372
|
+
const fields = error;
|
|
373
|
+
const message = typeof fields.message === "string" ? fields.message : void 0;
|
|
374
|
+
return {
|
|
375
|
+
...message === void 0 ? {} : { message },
|
|
376
|
+
detail: [
|
|
377
|
+
fields.code,
|
|
378
|
+
fields.type,
|
|
379
|
+
fields.message
|
|
380
|
+
].filter((field) => typeof field === "string").join(" ")
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
/** Direct client for the OpenAI-compatible `/files` endpoints. */
|
|
384
|
+
var DeepSeekFilesClient = class {
|
|
385
|
+
baseURL;
|
|
386
|
+
apiKey;
|
|
387
|
+
fetchImpl;
|
|
388
|
+
/**
|
|
389
|
+
* @param options - endpoint, API-key snapshot, and optional test transport.
|
|
390
|
+
*/
|
|
391
|
+
constructor(options) {
|
|
392
|
+
this.baseURL = options.baseURL.replace(/\/+$/u, "");
|
|
393
|
+
this.apiKey = options.apiKey;
|
|
394
|
+
this.fetchImpl = options.fetch ?? globalThis.fetch;
|
|
395
|
+
}
|
|
396
|
+
async request(path, init, signal) {
|
|
397
|
+
let response;
|
|
398
|
+
try {
|
|
399
|
+
const headers = new Headers(attributionHeaders());
|
|
400
|
+
headers.set("authorization", `Bearer ${this.apiKey}`);
|
|
401
|
+
response = await this.fetchImpl(`${this.baseURL}${path}`, {
|
|
402
|
+
...init,
|
|
403
|
+
headers,
|
|
404
|
+
...signal === void 0 ? {} : { signal }
|
|
405
|
+
});
|
|
406
|
+
} catch (error) {
|
|
407
|
+
if (signal?.aborted) throw error;
|
|
408
|
+
throw new LlmError(`DeepSeek Files API request to ${this.baseURL} failed`, "TRANSPORT", { cause: error });
|
|
409
|
+
}
|
|
410
|
+
if (response.ok) return response;
|
|
411
|
+
let parsed;
|
|
412
|
+
try {
|
|
413
|
+
parsed = await response.json();
|
|
414
|
+
} catch {}
|
|
415
|
+
const { message, detail } = providerErrorDetail(parsed);
|
|
416
|
+
throw new DeepSeekFilesError(message ?? `DeepSeek Files API error (HTTP ${response.status})`, response.status, detail);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Upload one image with an explicit expiry.
|
|
420
|
+
* @param input - deterministic request-version bytes, media type, filename, lifetime, and cancellation.
|
|
421
|
+
* @returns the validated provider file object, including `expires_at`.
|
|
422
|
+
*/
|
|
423
|
+
async upload(input) {
|
|
424
|
+
if (input.data.byteLength > 134217728) throw new LlmError("DeepSeek Files API upload exceeds 128 MiB.", "INVALID_REQUEST");
|
|
425
|
+
if (!Number.isSafeInteger(input.expiresAfterSeconds) || input.expiresAfterSeconds < 3600 || input.expiresAfterSeconds > 2592e3) throw new LlmError("DeepSeek file expiry must be between 3600 and 2592000 seconds.", "INVALID_REQUEST");
|
|
426
|
+
const form = new FormData();
|
|
427
|
+
form.set("purpose", "user_data");
|
|
428
|
+
form.set("expires_after[anchor]", "created_at");
|
|
429
|
+
form.set("expires_after[seconds]", String(input.expiresAfterSeconds));
|
|
430
|
+
form.set("file", new Blob([Uint8Array.from(input.data).buffer], { type: input.mediaType }), input.filename);
|
|
431
|
+
const file = parseFileObject(await (await this.request("/files", {
|
|
432
|
+
method: "POST",
|
|
433
|
+
body: form
|
|
434
|
+
}, input.signal)).json(), "upload");
|
|
435
|
+
if (file.expiresAt === void 0) throw invalidResponse("upload");
|
|
436
|
+
return {
|
|
437
|
+
...file,
|
|
438
|
+
expiresAt: file.expiresAt
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* List one ascending or descending page of user-data files.
|
|
443
|
+
* @param options - pagination, ordering, and cancellation.
|
|
444
|
+
* @returns the validated page.
|
|
445
|
+
*/
|
|
446
|
+
async list(options = {}) {
|
|
447
|
+
const query = new URLSearchParams({ purpose: "user_data" });
|
|
448
|
+
if (options.after !== void 0) query.set("after", options.after);
|
|
449
|
+
if (options.limit !== void 0) query.set("limit", String(options.limit));
|
|
450
|
+
if (options.order !== void 0) query.set("order", options.order);
|
|
451
|
+
const value = await (await this.request(`/files?${query.toString()}`, { method: "GET" }, options.signal)).json();
|
|
452
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw invalidResponse("list");
|
|
453
|
+
const wire = value;
|
|
454
|
+
if (wire.object !== "list" || !Array.isArray(wire.data) || typeof wire.has_more !== "boolean" || wire.first_id !== void 0 && typeof wire.first_id !== "string" || wire.last_id !== void 0 && typeof wire.last_id !== "string") throw invalidResponse("list");
|
|
455
|
+
return {
|
|
456
|
+
data: wire.data.map((item) => parseFileObject(item, "list")),
|
|
457
|
+
...typeof wire.first_id === "string" ? { firstId: DeepSeekFileId(wire.first_id) } : {},
|
|
458
|
+
...typeof wire.last_id === "string" ? { lastId: DeepSeekFileId(wire.last_id) } : {},
|
|
459
|
+
hasMore: wire.has_more
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Retrieve one file object.
|
|
464
|
+
* @param fileId - provider file identifier.
|
|
465
|
+
* @param signal - request cancellation.
|
|
466
|
+
* @returns the validated file object.
|
|
467
|
+
*/
|
|
468
|
+
async retrieve(fileId, signal) {
|
|
469
|
+
return parseFileObject(await (await this.request(`/files/${encodeURIComponent(fileId)}`, { method: "GET" }, signal)).json(), "retrieve");
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Delete one provider file.
|
|
473
|
+
* @param fileId - provider file identifier.
|
|
474
|
+
* @param signal - request cancellation.
|
|
475
|
+
*/
|
|
476
|
+
async delete(fileId, signal) {
|
|
477
|
+
const value = await (await this.request(`/files/${encodeURIComponent(fileId)}`, { method: "DELETE" }, signal)).json();
|
|
478
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw invalidResponse("delete");
|
|
479
|
+
const wire = value;
|
|
480
|
+
if (wire.id !== fileId || wire.object !== "file" || wire.deleted !== true) throw invalidResponse("delete");
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region lib/types/upload-index.js
|
|
485
|
+
/** Durable DeepSeek attachment-to-file-id index. @module nomix-llm-deepseek/upload-index */
|
|
486
|
+
var InvalidUploadIndexError = class extends Error {};
|
|
487
|
+
/**
|
|
488
|
+
* Derive a non-secret stable index namespace without persisting or logging the API key.
|
|
489
|
+
* @param baseURL - normalized provider endpoint namespace.
|
|
490
|
+
* @param apiKey - resolved credential used only as hash input.
|
|
491
|
+
* @returns branded SHA-256 namespace digest.
|
|
492
|
+
*/
|
|
493
|
+
function deepSeekFileScope(baseURL, apiKey) {
|
|
494
|
+
return DeepSeekFileScope(createHash("sha256").update(baseURL.replace(/\/+$/u, "")).update("\0").update(apiKey).digest("hex"));
|
|
495
|
+
}
|
|
496
|
+
function absent(error) {
|
|
497
|
+
return error?.code === "ENOENT";
|
|
498
|
+
}
|
|
499
|
+
function parseRecord(value) {
|
|
500
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new InvalidUploadIndexError("llm-deepseek: upload index contains a non-object record");
|
|
501
|
+
const record = value;
|
|
502
|
+
if (typeof record.scope !== "string" || !/^[0-9a-f]{64}$/u.test(record.scope) || typeof record.attachmentId !== "string" || !/^sha256:[0-9a-f]{64}$/u.test(record.attachmentId) || typeof record.variantId !== "string" || !/^sha256:[0-9a-f]{64}$/u.test(record.variantId) || typeof record.fileId !== "string" || record.fileId.length === 0 || !Number.isSafeInteger(record.bytes) || record.bytes < 0 || !Number.isSafeInteger(record.createdAt) || record.createdAt < 0 || !Number.isSafeInteger(record.expiresAt) || record.expiresAt < 0) throw new InvalidUploadIndexError("llm-deepseek: upload index contains an invalid record");
|
|
503
|
+
return {
|
|
504
|
+
scope: DeepSeekFileScope(record.scope),
|
|
505
|
+
attachmentId: record.attachmentId,
|
|
506
|
+
variantId: ImageVariantId(record.variantId),
|
|
507
|
+
fileId: DeepSeekFileId(record.fileId),
|
|
508
|
+
bytes: record.bytes,
|
|
509
|
+
createdAt: record.createdAt,
|
|
510
|
+
expiresAt: record.expiresAt
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
function parseIndex(text) {
|
|
514
|
+
let value;
|
|
515
|
+
try {
|
|
516
|
+
value = JSON.parse(text);
|
|
517
|
+
} catch (error) {
|
|
518
|
+
throw new InvalidUploadIndexError("llm-deepseek: upload index is not valid JSON", { cause: error });
|
|
519
|
+
}
|
|
520
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new InvalidUploadIndexError("llm-deepseek: upload index is not an object");
|
|
521
|
+
const index = value;
|
|
522
|
+
if (index.formatVersion !== 3 || !Array.isArray(index.records)) throw new InvalidUploadIndexError("llm-deepseek: unsupported upload index format");
|
|
523
|
+
const records = index.records.map(parseRecord);
|
|
524
|
+
const keys = /* @__PURE__ */ new Set();
|
|
525
|
+
for (const record of records) {
|
|
526
|
+
const key = `${record.scope}\0${record.variantId}`;
|
|
527
|
+
if (keys.has(key)) throw new InvalidUploadIndexError("llm-deepseek: upload index contains duplicate mappings");
|
|
528
|
+
keys.add(key);
|
|
529
|
+
}
|
|
530
|
+
return {
|
|
531
|
+
formatVersion: 3,
|
|
532
|
+
records
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
function reusable(record, now, refreshMarginMs) {
|
|
536
|
+
return record.expiresAt - now > refreshMarginMs;
|
|
537
|
+
}
|
|
538
|
+
/** Atomic local index shared by every DeepSeek session in this NOMIX home. */
|
|
539
|
+
var DeepSeekUploadIndex = class {
|
|
540
|
+
/** Absolute owner-private JSON index path. */
|
|
541
|
+
path;
|
|
542
|
+
/**
|
|
543
|
+
* @param path - explicit test path; omission uses `NOMIX_HOME/llm-deepseek/files-v3.json`.
|
|
544
|
+
*/
|
|
545
|
+
constructor(path = join(resolveNomixHome(), "llm-deepseek", "files-v3.json")) {
|
|
546
|
+
this.path = path;
|
|
547
|
+
}
|
|
548
|
+
async load() {
|
|
549
|
+
try {
|
|
550
|
+
return parseIndex(await readFile(this.path, "utf8"));
|
|
551
|
+
} catch (error) {
|
|
552
|
+
if (absent(error) || error instanceof InvalidUploadIndexError) return {
|
|
553
|
+
formatVersion: 3,
|
|
554
|
+
records: []
|
|
555
|
+
};
|
|
556
|
+
throw error;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
async save(index) {
|
|
560
|
+
await writeFileAtomic(this.path, `${JSON.stringify(index, void 0, 2)}\n`, {
|
|
561
|
+
mode: 384,
|
|
562
|
+
dirMode: 448
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Read one reusable mapping.
|
|
567
|
+
* @param scope - endpoint/API-key namespace.
|
|
568
|
+
* @param variantId - complete request-image transformation identity.
|
|
569
|
+
* @param now - current Unix time in milliseconds.
|
|
570
|
+
* @param refreshMarginMs - remaining lifetime below which a mapping is not reused.
|
|
571
|
+
* @returns the mapping when it has enough lifetime remaining.
|
|
572
|
+
*/
|
|
573
|
+
async get(scope, variantId, now, refreshMarginMs) {
|
|
574
|
+
const record = (await this.load()).records.find((candidate) => candidate.scope === scope && candidate.variantId === variantId);
|
|
575
|
+
return record !== void 0 && reusable(record, now, refreshMarginMs) ? record : void 0;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Publish a completed upload unless another process already published a reusable mapping.
|
|
579
|
+
* @param candidate - completed remote upload.
|
|
580
|
+
* @param now - current Unix time in milliseconds.
|
|
581
|
+
* @param refreshMarginMs - minimum reusable remaining lifetime.
|
|
582
|
+
* @returns the winning record and whether the candidate entered the index.
|
|
583
|
+
*/
|
|
584
|
+
async commit(candidate, now, refreshMarginMs) {
|
|
585
|
+
await mkdir(dirname(this.path), {
|
|
586
|
+
recursive: true,
|
|
587
|
+
mode: 448
|
|
588
|
+
});
|
|
589
|
+
return withFileLock(this.path, async () => {
|
|
590
|
+
const index = await this.load();
|
|
591
|
+
const existing = index.records.find((record) => record.scope === candidate.scope && record.variantId === candidate.variantId && reusable(record, now, refreshMarginMs));
|
|
592
|
+
if (existing !== void 0) return {
|
|
593
|
+
record: existing,
|
|
594
|
+
accepted: false
|
|
595
|
+
};
|
|
596
|
+
const records = index.records.filter((record) => reusable(record, now, refreshMarginMs) && !(record.scope === candidate.scope && record.variantId === candidate.variantId));
|
|
597
|
+
records.push(candidate);
|
|
598
|
+
await this.save({
|
|
599
|
+
formatVersion: 3,
|
|
600
|
+
records
|
|
601
|
+
});
|
|
602
|
+
return {
|
|
603
|
+
record: candidate,
|
|
604
|
+
accepted: true
|
|
605
|
+
};
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Remove one exact mapping without deleting a concurrently installed successor.
|
|
610
|
+
* @param scope - endpoint/API-key namespace.
|
|
611
|
+
* @param variantId - complete request-image transformation identity.
|
|
612
|
+
* @param fileId - exact remote generation being invalidated.
|
|
613
|
+
*/
|
|
614
|
+
async remove(scope, variantId, fileId) {
|
|
615
|
+
await mkdir(dirname(this.path), {
|
|
616
|
+
recursive: true,
|
|
617
|
+
mode: 448
|
|
618
|
+
});
|
|
619
|
+
await withFileLock(this.path, async () => {
|
|
620
|
+
const index = await this.load();
|
|
621
|
+
const records = index.records.filter((record) => !(record.scope === scope && record.variantId === variantId && record.fileId === fileId));
|
|
622
|
+
if (records.length !== index.records.length) await this.save({
|
|
623
|
+
formatVersion: 3,
|
|
624
|
+
records
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Remove every local mapping for one remote namespace.
|
|
630
|
+
* @param scope - endpoint/API-key namespace.
|
|
631
|
+
*/
|
|
632
|
+
async clear(scope) {
|
|
633
|
+
await mkdir(dirname(this.path), {
|
|
634
|
+
recursive: true,
|
|
635
|
+
mode: 448
|
|
636
|
+
});
|
|
637
|
+
await withFileLock(this.path, async () => {
|
|
638
|
+
const index = await this.load();
|
|
639
|
+
const records = index.records.filter((record) => record.scope !== scope);
|
|
640
|
+
if (records.length !== index.records.length) await this.save({
|
|
641
|
+
formatVersion: 3,
|
|
642
|
+
records
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
//#endregion
|
|
648
|
+
//#region lib/types/file-store.js
|
|
649
|
+
/** DeepSeek Files API upload reuse, invalidation, and quota recovery. @module nomix-llm-deepseek/file-store */
|
|
650
|
+
/** DeepSeek chat accepts at most 32 MiB per image even when it is referenced by file id. */
|
|
651
|
+
const MAX_CHAT_IMAGE_BYTES = 32 * 1024 * 1024;
|
|
652
|
+
const OWNED_FILE_PREFIX = "nomix-";
|
|
653
|
+
function abortReason(signal) {
|
|
654
|
+
const reason = signal.reason;
|
|
655
|
+
return reason instanceof Error ? reason : new Error("DeepSeek file upload cancelled with a non-Error reason.", { cause: reason });
|
|
656
|
+
}
|
|
657
|
+
function uploadFailure(error) {
|
|
658
|
+
return error instanceof Error ? error : new Error("DeepSeek file upload failed with a non-Error reason.", { cause: error });
|
|
659
|
+
}
|
|
660
|
+
function waitForUpload(operation, signal) {
|
|
661
|
+
signal?.throwIfAborted();
|
|
662
|
+
operation.waiters += 1;
|
|
663
|
+
let released = false;
|
|
664
|
+
const release = (cancelledReason) => {
|
|
665
|
+
if (released) return;
|
|
666
|
+
released = true;
|
|
667
|
+
operation.waiters -= 1;
|
|
668
|
+
if (cancelledReason !== void 0 && operation.waiters === 0 && !operation.settled) operation.controller.abort(cancelledReason);
|
|
669
|
+
};
|
|
670
|
+
if (signal === void 0) return operation.promise.finally(() => {
|
|
671
|
+
release();
|
|
672
|
+
});
|
|
673
|
+
return new Promise((resolve, reject) => {
|
|
674
|
+
const abort = () => {
|
|
675
|
+
const reason = abortReason(signal);
|
|
676
|
+
release(reason);
|
|
677
|
+
reject(reason);
|
|
678
|
+
};
|
|
679
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
680
|
+
operation.promise.then((value) => {
|
|
681
|
+
signal.removeEventListener("abort", abort);
|
|
682
|
+
release();
|
|
683
|
+
resolve(value);
|
|
684
|
+
}, (error) => {
|
|
685
|
+
signal.removeEventListener("abort", abort);
|
|
686
|
+
release();
|
|
687
|
+
reject(uploadFailure(error));
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
function extension(mediaType) {
|
|
692
|
+
switch (mediaType) {
|
|
693
|
+
case "image/png": return "png";
|
|
694
|
+
case "image/jpeg": return "jpeg";
|
|
695
|
+
case "image/webp": return "webp";
|
|
696
|
+
case "image/gif": return "gif";
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
function filename(version) {
|
|
700
|
+
return `${OWNED_FILE_PREFIX}${String(version.attachment.attachmentId).slice(7, 23)}-${String(version.variantId).slice(7, 15)}.${extension(version.mediaType)}`;
|
|
701
|
+
}
|
|
702
|
+
/** User-scoped durable file-id reuse for the DeepSeek route. */
|
|
703
|
+
var DeepSeekFileStore = class {
|
|
704
|
+
index;
|
|
705
|
+
now;
|
|
706
|
+
fetchImpl;
|
|
707
|
+
inflight = /* @__PURE__ */ new Map();
|
|
708
|
+
/**
|
|
709
|
+
* @param options - testable index, clock, and transport boundaries.
|
|
710
|
+
*/
|
|
711
|
+
constructor(options = {}) {
|
|
712
|
+
this.index = options.index ?? new DeepSeekUploadIndex();
|
|
713
|
+
this.now = options.now ?? Date.now;
|
|
714
|
+
this.fetchImpl = options.fetch;
|
|
715
|
+
}
|
|
716
|
+
client(connection) {
|
|
717
|
+
return new DeepSeekFilesClient({
|
|
718
|
+
baseURL: connection.baseURL,
|
|
719
|
+
apiKey: connection.apiKey,
|
|
720
|
+
...this.fetchImpl === void 0 ? {} : { fetch: this.fetchImpl }
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Resolve or upload one deterministic request image. Concurrent calls share one upload while retaining independent waits.
|
|
725
|
+
* @param version - deterministic model-request bytes and complete transformation identity.
|
|
726
|
+
* @param connection - endpoint and API-key snapshot.
|
|
727
|
+
* @param policy - expiry and quota-recovery policy.
|
|
728
|
+
* @param signal - cancellation of this wait; shared transport stops when no waiter remains.
|
|
729
|
+
* @returns a reusable file id and whether this call published a new upload.
|
|
730
|
+
*/
|
|
731
|
+
ensureUploaded(version, connection, policy, signal) {
|
|
732
|
+
signal?.throwIfAborted();
|
|
733
|
+
const key = `${deepSeekFileScope(connection.baseURL, connection.apiKey)}\0${version.variantId}`;
|
|
734
|
+
let active = this.inflight.get(key);
|
|
735
|
+
if (active?.controller.signal.aborted) {
|
|
736
|
+
this.inflight.delete(key);
|
|
737
|
+
active = void 0;
|
|
738
|
+
}
|
|
739
|
+
if (active !== void 0) return waitForUpload(active, signal);
|
|
740
|
+
const controller = new AbortController();
|
|
741
|
+
const shared = {
|
|
742
|
+
controller,
|
|
743
|
+
settled: false,
|
|
744
|
+
waiters: 0,
|
|
745
|
+
promise: void 0
|
|
746
|
+
};
|
|
747
|
+
shared.promise = this.ensureUploadedOnce(version, connection, policy, controller.signal).then((value) => {
|
|
748
|
+
shared.settled = true;
|
|
749
|
+
return value;
|
|
750
|
+
}, (error) => {
|
|
751
|
+
shared.settled = true;
|
|
752
|
+
throw uploadFailure(error);
|
|
753
|
+
});
|
|
754
|
+
this.inflight.set(key, shared);
|
|
755
|
+
shared.promise.finally(() => {
|
|
756
|
+
if (this.inflight.get(key) === shared) this.inflight.delete(key);
|
|
757
|
+
}).catch(() => {});
|
|
758
|
+
return waitForUpload(shared, signal);
|
|
759
|
+
}
|
|
760
|
+
async ensureUploadedOnce(version, connection, policy, signal) {
|
|
761
|
+
if (version.bytes > 33554432) throw new LlmError("DeepSeek chat image exceeds the 32 MiB per-image limit.", "INVALID_REQUEST");
|
|
762
|
+
const scope = deepSeekFileScope(connection.baseURL, connection.apiKey);
|
|
763
|
+
const now = this.now();
|
|
764
|
+
const marginMs = policy.refreshMarginSeconds * 1e3;
|
|
765
|
+
const cached = await this.index.get(scope, version.variantId, now, marginMs);
|
|
766
|
+
if (cached !== void 0) return {
|
|
767
|
+
record: cached,
|
|
768
|
+
uploaded: false
|
|
769
|
+
};
|
|
770
|
+
const client = this.client(connection);
|
|
771
|
+
const upload = async () => {
|
|
772
|
+
const remote = await client.upload({
|
|
773
|
+
data: version.data,
|
|
774
|
+
mediaType: version.mediaType,
|
|
775
|
+
filename: filename(version),
|
|
776
|
+
expiresAfterSeconds: policy.expiresAfterSeconds,
|
|
777
|
+
signal
|
|
778
|
+
});
|
|
779
|
+
if (remote.bytes !== version.data.byteLength) throw new LlmError("DeepSeek Files API upload response does not match the submitted image.", "INVALID_RESPONSE");
|
|
780
|
+
return {
|
|
781
|
+
scope,
|
|
782
|
+
attachmentId: version.attachment.attachmentId,
|
|
783
|
+
variantId: version.variantId,
|
|
784
|
+
fileId: remote.id,
|
|
785
|
+
bytes: remote.bytes,
|
|
786
|
+
createdAt: remote.createdAt * 1e3,
|
|
787
|
+
expiresAt: remote.expiresAt * 1e3
|
|
788
|
+
};
|
|
789
|
+
};
|
|
790
|
+
let candidate;
|
|
791
|
+
try {
|
|
792
|
+
candidate = await upload();
|
|
793
|
+
} catch (error) {
|
|
794
|
+
if (!isFilesQuotaError(error)) throw error;
|
|
795
|
+
if (await this.reclaimOldestOwned(connection, policy.quotaCleanupBatch, signal) === 0) throw error;
|
|
796
|
+
candidate = await upload();
|
|
797
|
+
}
|
|
798
|
+
const committed = await this.index.commit(candidate, this.now(), marginMs);
|
|
799
|
+
if (!committed.accepted) try {
|
|
800
|
+
await client.delete(candidate.fileId, signal);
|
|
801
|
+
} catch {}
|
|
802
|
+
return {
|
|
803
|
+
record: committed.record,
|
|
804
|
+
uploaded: committed.accepted
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Invalidate one exact local mapping after the chat endpoint rejects its remote id.
|
|
809
|
+
* @param version - request-image version whose remote generation failed.
|
|
810
|
+
* @param fileId - exact rejected file id.
|
|
811
|
+
* @param connection - endpoint and API-key snapshot.
|
|
812
|
+
*/
|
|
813
|
+
async invalidate(version, fileId, connection) {
|
|
814
|
+
await this.index.remove(deepSeekFileScope(connection.baseURL, connection.apiKey), version.variantId, fileId);
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Delete the indexed remote file for one attachment and remove its local mapping.
|
|
818
|
+
* @param version - exact request-image version to release.
|
|
819
|
+
* @param connection - endpoint and API-key snapshot.
|
|
820
|
+
* @param policy - expiry policy used to locate a reusable mapping.
|
|
821
|
+
* @param signal - request cancellation.
|
|
822
|
+
* @returns whether an indexed file existed and was deleted.
|
|
823
|
+
*/
|
|
824
|
+
async release(version, connection, policy, signal) {
|
|
825
|
+
const scope = deepSeekFileScope(connection.baseURL, connection.apiKey);
|
|
826
|
+
const record = await this.index.get(scope, version.variantId, this.now(), policy.refreshMarginSeconds * 1e3);
|
|
827
|
+
if (record === void 0) return false;
|
|
828
|
+
await this.client(connection).delete(record.fileId, signal);
|
|
829
|
+
await this.index.remove(scope, version.variantId, record.fileId);
|
|
830
|
+
return true;
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Delete the oldest provider files whose names identify harness ownership.
|
|
834
|
+
* @param connection - endpoint and API-key snapshot.
|
|
835
|
+
* @param count - positive maximum number of files to delete.
|
|
836
|
+
* @param signal - request cancellation.
|
|
837
|
+
* @returns number of successfully deleted files.
|
|
838
|
+
*/
|
|
839
|
+
async reclaimOldestOwned(connection, count, signal) {
|
|
840
|
+
const client = this.client(connection);
|
|
841
|
+
let after;
|
|
842
|
+
const owned = [];
|
|
843
|
+
while (owned.length < count) {
|
|
844
|
+
const page = await client.list({
|
|
845
|
+
...after === void 0 ? {} : { after },
|
|
846
|
+
limit: 1e3,
|
|
847
|
+
order: "asc",
|
|
848
|
+
...signal === void 0 ? {} : { signal }
|
|
849
|
+
});
|
|
850
|
+
for (const file of page.data) {
|
|
851
|
+
if (!file.filename.startsWith(OWNED_FILE_PREFIX)) continue;
|
|
852
|
+
owned.push(file.id);
|
|
853
|
+
if (owned.length === count) break;
|
|
854
|
+
}
|
|
855
|
+
if (!page.hasMore || page.lastId === void 0 || page.lastId === after) break;
|
|
856
|
+
after = page.lastId;
|
|
857
|
+
}
|
|
858
|
+
for (const fileId of owned) await client.delete(fileId, signal);
|
|
859
|
+
return owned.length;
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Delete every remote harness-owned file in the active API-key namespace and clear its index.
|
|
863
|
+
* @param connection - endpoint and API-key snapshot.
|
|
864
|
+
* @param signal - request cancellation.
|
|
865
|
+
* @returns number of deleted files.
|
|
866
|
+
*/
|
|
867
|
+
async releaseAll(connection, signal) {
|
|
868
|
+
let total = 0;
|
|
869
|
+
for (;;) {
|
|
870
|
+
const deleted = await this.reclaimOldestOwned(connection, 1e3, signal);
|
|
871
|
+
total += deleted;
|
|
872
|
+
if (deleted < 1e3) break;
|
|
873
|
+
}
|
|
874
|
+
await this.index.clear(deepSeekFileScope(connection.baseURL, connection.apiKey));
|
|
875
|
+
return total;
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
/**
|
|
137
879
|
* Parse an SSE byte stream into data payloads. Yields `[DONE]` as the final
|
|
138
880
|
* value and returns; throws `LlmError('STREAM_CLOSED')` when the stream ends
|
|
139
881
|
* without it (truncated response — the model call cannot be trusted).
|
|
@@ -411,7 +1153,34 @@ const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 3e5;
|
|
|
411
1153
|
const DEFAULT_CONTEXT_WINDOW = 1e6;
|
|
412
1154
|
/** Default per-request output-token cap. */
|
|
413
1155
|
const DEFAULT_MAX_TOKENS = 256e3;
|
|
1156
|
+
/** Default bound on accumulated file-referenced image bytes per request. */
|
|
1157
|
+
const DEFAULT_MAX_REQUEST_FILES_BYTES = 128 * 1024 * 1024;
|
|
1158
|
+
/** Default bound on accumulated base64 image payload after Files API fallback. */
|
|
1159
|
+
const DEFAULT_MAX_INLINE_REQUEST_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
1160
|
+
/** Provider request image-count limit. */
|
|
1161
|
+
const DEFAULT_MAX_IMAGES_PER_REQUEST = 600;
|
|
1162
|
+
/** Total-pixel budget matching DeepSeek's normal vision projection. */
|
|
1163
|
+
const DEFAULT_REQUEST_IMAGE_PIXEL_BUDGET = 64e4;
|
|
1164
|
+
/** Total-pixel budget matching provider low-detail image input. */
|
|
1165
|
+
const DEFAULT_LOW_DETAIL_IMAGE_PIXEL_BUDGET = 512 * 512;
|
|
1166
|
+
/** Encoded-byte cap for one deterministic model-request image. */
|
|
1167
|
+
const DEFAULT_REQUEST_IMAGE_MAX_BYTES = 1024 * 1024;
|
|
1168
|
+
/** Deterministic raw-byte removal step. */
|
|
1169
|
+
const DEFAULT_IMAGE_OFFLOAD_BYTE_QUANTUM = 64 * 1024 * 1024;
|
|
1170
|
+
/** Deterministic base64-byte removal step after Files API fallback. */
|
|
1171
|
+
const DEFAULT_INLINE_IMAGE_OFFLOAD_BYTE_QUANTUM = 10 * 1024 * 1024;
|
|
1172
|
+
/** Deterministic image-count removal step. */
|
|
1173
|
+
const DEFAULT_IMAGE_OFFLOAD_COUNT_QUANTUM = 20;
|
|
1174
|
+
/** Default explicit lifetime for uploaded images. */
|
|
1175
|
+
const DEFAULT_FILE_EXPIRY_SECONDS = 10080 * 60;
|
|
1176
|
+
/** Default proactive refresh window for indexed file ids. */
|
|
1177
|
+
const DEFAULT_FILE_REFRESH_MARGIN_SECONDS = 3600;
|
|
1178
|
+
/** Default number of oldest harness-owned files removed on quota recovery. */
|
|
1179
|
+
const DEFAULT_FILE_QUOTA_CLEANUP_BATCH = 100;
|
|
1180
|
+
/** Default deadline for resolving one request image through the Files API. */
|
|
1181
|
+
const DEFAULT_FILES_API_TIMEOUT_MS = 6e4;
|
|
414
1182
|
const STREAM_IDLE_TIMEOUT_CODE = "LLM_STREAM_IDLE_TIMEOUT";
|
|
1183
|
+
const FILES_API_TIMEOUT_CODE = "DEEPSEEK_FILES_API_TIMEOUT";
|
|
415
1184
|
const OFF_REASONING_EFFORT = ReasoningEffortId("off");
|
|
416
1185
|
const LOW_REASONING_EFFORT = ReasoningEffortId("low");
|
|
417
1186
|
const HIGH_REASONING_EFFORT = ReasoningEffortId("high");
|
|
@@ -438,13 +1207,83 @@ const OFF_ONLY_REASONING_EFFORTS = [{
|
|
|
438
1207
|
id: OFF_REASONING_EFFORT,
|
|
439
1208
|
name: "Off"
|
|
440
1209
|
}];
|
|
1210
|
+
/** Marks a failed file-id resolution that may be retried as an inline request. */
|
|
1211
|
+
var FileResolutionFailure = class extends Error {
|
|
1212
|
+
constructor(cause) {
|
|
1213
|
+
super("DeepSeek Files API could not resolve a request image.", { cause });
|
|
1214
|
+
this.name = "FileResolutionFailure";
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
function collectImageRefs(content, refs) {
|
|
1218
|
+
for (const block of content) if (block.type === "image") refs.set(block.attachment.attachmentId, block.attachment);
|
|
1219
|
+
else if (block.type === "tool-result") collectImageRefs(block.content, refs);
|
|
1220
|
+
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Resolve the request-image budgets owned by one DeepSeek model route.
|
|
1223
|
+
* @param model - Advertised model route and its optional image overrides.
|
|
1224
|
+
* @returns Complete pixel and encoded-byte budgets.
|
|
1225
|
+
* @internal
|
|
1226
|
+
*/
|
|
1227
|
+
function resolveRequestImagePolicy(model) {
|
|
1228
|
+
let maxPixels;
|
|
1229
|
+
if (model.imagePixelBudget !== void 0) maxPixels = model.imagePixelBudget;
|
|
1230
|
+
else if (model.imageDetail === "low") maxPixels = DEFAULT_LOW_DETAIL_IMAGE_PIXEL_BUDGET;
|
|
1231
|
+
else maxPixels = DEFAULT_REQUEST_IMAGE_PIXEL_BUDGET;
|
|
1232
|
+
return {
|
|
1233
|
+
maxPixels,
|
|
1234
|
+
maxBytes: model.imageMaxBytes === void 0 ? DEFAULT_REQUEST_IMAGE_MAX_BYTES : model.imageMaxBytes
|
|
1235
|
+
};
|
|
1236
|
+
}
|
|
1237
|
+
async function prepareRequestImages(options, attachments, model, signal) {
|
|
1238
|
+
const refs = /* @__PURE__ */ new Map();
|
|
1239
|
+
for (const message of options.messages) collectImageRefs(message.content, refs);
|
|
1240
|
+
const policy = resolveRequestImagePolicy(model);
|
|
1241
|
+
const orderedRefs = [...refs.values()];
|
|
1242
|
+
const projected = await Promise.all(orderedRefs.map((ref) => attachments.readImageRequest(ref, policy, signal)));
|
|
1243
|
+
return new Map(orderedRefs.map((ref, index) => [ref.attachmentId, projected[index]]));
|
|
1244
|
+
}
|
|
1245
|
+
function providerRejectedNormalizedImage(detail) {
|
|
1246
|
+
return /(?:unsupported|invalid|cannot read|failed to (?:decode|process)).{0,40}image/iu.test(detail) || /image.{0,40}(?:unsupported|invalid|cannot be decoded)/iu.test(detail);
|
|
1247
|
+
}
|
|
1248
|
+
function providerRejectedFileId(detail) {
|
|
1249
|
+
const file = /\bfile(?:[_ -]?(?:id|api|not[_ -]?found|deleted|expired))?/iu.test(detail);
|
|
1250
|
+
const missing = /(?:expired|not[_ -]?found|deleted|do(?:es)? not exist|not created under (?:this|your) account)/iu.test(detail);
|
|
1251
|
+
const invalidId = /(?:invalid.{0,20}file[_ -]?(?:id|api)|file[_ -]?(?:id|api).{0,20}invalid)/iu.test(detail);
|
|
1252
|
+
return file && (missing || invalidId);
|
|
1253
|
+
}
|
|
1254
|
+
function detailNamesFileId(detail, fileId) {
|
|
1255
|
+
let index = detail.indexOf(fileId);
|
|
1256
|
+
while (index >= 0) {
|
|
1257
|
+
const before = detail[index - 1];
|
|
1258
|
+
const after = detail[index + fileId.length];
|
|
1259
|
+
if ((before === void 0 || !/[\p{L}\p{N}_-]/u.test(before)) && (after === void 0 || !/[\p{L}\p{N}_-]/u.test(after))) return true;
|
|
1260
|
+
index = detail.indexOf(fileId, index + 1);
|
|
1261
|
+
}
|
|
1262
|
+
return false;
|
|
1263
|
+
}
|
|
1264
|
+
function staleMappings(files, detail) {
|
|
1265
|
+
const unique = [...new Map(files.map((file) => [`${file.version.variantId}\0${file.fileId}`, file])).values()];
|
|
1266
|
+
const exact = unique.filter((file) => detailNamesFileId(detail, file.fileId));
|
|
1267
|
+
return exact.length > 0 ? exact : unique;
|
|
1268
|
+
}
|
|
1269
|
+
function normalizedImageFacts(file) {
|
|
1270
|
+
const version = file.version;
|
|
1271
|
+
const name = version.attachment.name ?? version.attachment.attachmentId;
|
|
1272
|
+
const colour = version.hasAlpha ? "sRGBA" : "sRGB";
|
|
1273
|
+
return `"${name}" at message ${file.location.message}, image ${file.location.image} (${version.mediaType}, 8-bit ${colour}, ${version.width}x${version.height})`;
|
|
1274
|
+
}
|
|
1275
|
+
function normalizedImageDiagnostic(files, providerMessage, providerDetail) {
|
|
1276
|
+
const target = files.find((file) => detailNamesFileId(providerDetail, file.fileId)) ?? (files.length === 1 ? files[0] : void 0);
|
|
1277
|
+
if (target !== void 0) return `DeepSeek rejected normalized image ${normalizedImageFacts(target)}: ${providerMessage}. The provider rejected bytes already normalized by the harness; PNG, JPEG, WebP, and GIF remain supported input formats.`;
|
|
1278
|
+
return `DeepSeek rejected a normalized request image: ${providerMessage}. Candidate images: ${[...new Map(files.map((file) => [`${file.version.variantId}\0${file.location.message}\0${file.location.image}`, file])).values()].map(normalizedImageFacts).join("; ")}. The provider rejected bytes already normalized by the harness; PNG, JPEG, WebP, and GIF remain supported input formats.`;
|
|
1279
|
+
}
|
|
441
1280
|
function modelInfo(provider, model) {
|
|
442
1281
|
return {
|
|
443
1282
|
provider,
|
|
444
1283
|
id: model.id,
|
|
445
1284
|
name: model.name ?? model.id,
|
|
446
1285
|
...model.description === void 0 ? {} : { description: model.description },
|
|
447
|
-
inputModalities: ["text"]
|
|
1286
|
+
inputModalities: model.inputModalities ?? ["text"]
|
|
448
1287
|
};
|
|
449
1288
|
}
|
|
450
1289
|
function providerRetryAfterMs(value) {
|
|
@@ -468,6 +1307,7 @@ function requestId(headers) {
|
|
|
468
1307
|
*/
|
|
469
1308
|
function httpErrorCode(status, error) {
|
|
470
1309
|
if (status === 401 || status === 403) return "AUTH";
|
|
1310
|
+
if (status === 413) return "INVALID_REQUEST";
|
|
471
1311
|
const detail = [
|
|
472
1312
|
error?.code,
|
|
473
1313
|
error?.type,
|
|
@@ -491,9 +1331,11 @@ function httpErrorCode(status, error) {
|
|
|
491
1331
|
*/
|
|
492
1332
|
var DeepSeekAdapter = class extends LlmAdapter {
|
|
493
1333
|
config;
|
|
1334
|
+
files;
|
|
494
1335
|
constructor(config) {
|
|
495
1336
|
super();
|
|
496
1337
|
this.config = config;
|
|
1338
|
+
this.files = config.resolveFiles?.() ?? new DeepSeekFileStore();
|
|
497
1339
|
}
|
|
498
1340
|
providerInfo(provider) {
|
|
499
1341
|
return {
|
|
@@ -508,10 +1350,12 @@ var DeepSeekAdapter = class extends LlmAdapter {
|
|
|
508
1350
|
return Promise.resolve(this.config.options().models.map((model) => modelInfo(provider, model)));
|
|
509
1351
|
}
|
|
510
1352
|
resolveModel(provider, model, _signal) {
|
|
511
|
-
|
|
1353
|
+
return Promise.resolve(this.modelInfoFor(this.config.options(), provider, model));
|
|
1354
|
+
}
|
|
1355
|
+
modelInfoFor(connection, provider, model) {
|
|
512
1356
|
const configured = connection.models.find((entry) => entry.id === model);
|
|
513
1357
|
const contextWindow = configured?.contextWindow ?? connection.defaultContextWindow;
|
|
514
|
-
return
|
|
1358
|
+
return {
|
|
515
1359
|
...configured === void 0 ? {
|
|
516
1360
|
provider,
|
|
517
1361
|
id: model,
|
|
@@ -527,21 +1371,37 @@ var DeepSeekAdapter = class extends LlmAdapter {
|
|
|
527
1371
|
efforts: REASONING_EFFORTS,
|
|
528
1372
|
defaultEffort: connection.defaults.reasoningEffort === "off" ? OFF_REASONING_EFFORT : connection.defaults.reasoningEffort === "low" ? LOW_REASONING_EFFORT : connection.defaults.reasoningEffort === "max" ? MAX_REASONING_EFFORT : HIGH_REASONING_EFFORT
|
|
529
1373
|
} }
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
prepareCall(provider, model, _signal) {
|
|
1377
|
+
const connection = this.config.options();
|
|
1378
|
+
return Promise.resolve({
|
|
1379
|
+
model: this.modelInfoFor(connection, provider, model),
|
|
1380
|
+
stream: (options) => this.streamWithConnection(options, connection)
|
|
530
1381
|
});
|
|
531
1382
|
}
|
|
532
|
-
|
|
1383
|
+
stream(options) {
|
|
1384
|
+
return this.streamWithConnection(options, this.config.options());
|
|
1385
|
+
}
|
|
1386
|
+
async *streamWithConnection(options, connection) {
|
|
533
1387
|
const env_1 = {
|
|
534
1388
|
stack: [],
|
|
535
1389
|
error: void 0,
|
|
536
1390
|
hasError: false
|
|
537
1391
|
};
|
|
538
1392
|
try {
|
|
539
|
-
const
|
|
1393
|
+
const hasImages = options.messages.some((message) => contentHasImage(message.content));
|
|
1394
|
+
let attachments;
|
|
1395
|
+
if (hasImages) {
|
|
1396
|
+
if (connection.models.find((entry) => entry.id === options.model)?.inputModalities?.includes("image") !== true) throw new LlmError(`DeepSeek model "${options.model}" does not accept image input.`, "UNSUPPORTED_CONTENT");
|
|
1397
|
+
attachments = this.config.resolveAttachments?.();
|
|
1398
|
+
if (attachments === void 0) throw new LlmError("DeepSeek image conversion requires the durable attachment service.", "UNSUPPORTED_CONTENT");
|
|
1399
|
+
}
|
|
540
1400
|
const apiKey = await this.config.resolveApiKey(connection);
|
|
541
1401
|
const userId = this.config.resolveUserId();
|
|
542
1402
|
const consumer = new AbortController();
|
|
543
1403
|
const watchdog = __addDisposableResource(env_1, idleWatchdog(options.signal === void 0 ? consumer.signal : AbortSignal.any([options.signal, consumer.signal]), connection.streamIdleTimeoutMs, STREAM_IDLE_TIMEOUT_CODE), false);
|
|
544
|
-
const iterator = this.request(options, watchdog.signal, connection, apiKey, userId, () => {
|
|
1404
|
+
const iterator = this.request(options, watchdog.signal, connection, apiKey, userId, attachments, () => {
|
|
545
1405
|
watchdog.pulse();
|
|
546
1406
|
})[Symbol.asyncIterator]();
|
|
547
1407
|
let exhausted = false;
|
|
@@ -572,9 +1432,7 @@ var DeepSeekAdapter = class extends LlmAdapter {
|
|
|
572
1432
|
__disposeResources(env_1);
|
|
573
1433
|
}
|
|
574
1434
|
}
|
|
575
|
-
async *request(options, signal, connection, apiKey, userId,
|
|
576
|
-
const body = serializeRequest(options, connection.defaults);
|
|
577
|
-
const payload = JSON.stringify(body);
|
|
1435
|
+
async *request(options, signal, connection, apiKey, userId, attachments, onActivity) {
|
|
578
1436
|
const headers = {
|
|
579
1437
|
"authorization": `Bearer ${apiKey}`,
|
|
580
1438
|
"content-type": "application/json",
|
|
@@ -584,35 +1442,131 @@ var DeepSeekAdapter = class extends LlmAdapter {
|
|
|
584
1442
|
...options.sessionId !== void 0 ? { "x-nomix-harness-session-id": String(options.sessionId) } : {},
|
|
585
1443
|
...options.purpose === "compaction" ? { "x-nomix-harness-compact": "1" } : {}
|
|
586
1444
|
};
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
1445
|
+
const fileConnection = {
|
|
1446
|
+
baseURL: connection.baseURL,
|
|
1447
|
+
apiKey
|
|
1448
|
+
};
|
|
1449
|
+
const model = connection.models.find((entry) => entry.id === options.model);
|
|
1450
|
+
const policy = model === void 0 ? void 0 : resolveRequestImagePolicy(model);
|
|
1451
|
+
const requestMessages = policy === void 0 ? options.messages : offloadRequestImagesWithPolicy(options.messages, {
|
|
1452
|
+
representation: "raw",
|
|
1453
|
+
maxBytes: connection.maxRequestFilesBytes,
|
|
1454
|
+
maxImages: connection.maxImagesPerRequest,
|
|
1455
|
+
byteQuantum: connection.imageOffloadByteQuantum,
|
|
1456
|
+
countQuantum: connection.imageOffloadCountQuantum,
|
|
1457
|
+
byteLength: (ref) => Math.min(ref.bytes, policy.maxBytes)
|
|
1458
|
+
});
|
|
1459
|
+
const requestOptions = requestMessages === options.messages ? options : {
|
|
1460
|
+
...options,
|
|
1461
|
+
messages: [...requestMessages]
|
|
1462
|
+
};
|
|
1463
|
+
const requestImages = attachments === void 0 || model === void 0 ? /* @__PURE__ */ new Map() : await prepareRequestImages(requestOptions, attachments, model, signal);
|
|
1464
|
+
let representation = "file";
|
|
1465
|
+
let fileAttempt = 0;
|
|
1466
|
+
while (true) {
|
|
1467
|
+
const usedFiles = [];
|
|
1468
|
+
let body;
|
|
1469
|
+
if (attachments === void 0) body = serializeRequest(requestOptions, connection.defaults);
|
|
1470
|
+
else if (representation === "base64") body = await serializeRequestWithImages(requestOptions, {
|
|
1471
|
+
representation: { kind: "base64" },
|
|
1472
|
+
requestImages,
|
|
1473
|
+
maxRequestImageBytes: connection.maxInlineRequestImageBytes,
|
|
1474
|
+
maxImagesPerRequest: connection.maxImagesPerRequest,
|
|
1475
|
+
byteQuantum: connection.inlineImageOffloadByteQuantum,
|
|
1476
|
+
countQuantum: connection.imageOffloadCountQuantum
|
|
1477
|
+
}, connection.defaults);
|
|
1478
|
+
else try {
|
|
1479
|
+
body = await serializeRequestWithImages(requestOptions, {
|
|
1480
|
+
representation: {
|
|
1481
|
+
kind: "file",
|
|
1482
|
+
resolveFileId: async (version, _block, location) => {
|
|
1483
|
+
const env_2 = {
|
|
1484
|
+
stack: [],
|
|
1485
|
+
error: void 0,
|
|
1486
|
+
hasError: false
|
|
1487
|
+
};
|
|
1488
|
+
try {
|
|
1489
|
+
const filesDeadline = __addDisposableResource(env_2, deadline(signal, connection.filesApiTimeoutMs, FILES_API_TIMEOUT_CODE), false);
|
|
1490
|
+
let resolved;
|
|
1491
|
+
try {
|
|
1492
|
+
resolved = await this.files.ensureUploaded(version, fileConnection, connection.filePolicy, filesDeadline.signal);
|
|
1493
|
+
} catch (error) {
|
|
1494
|
+
if (signal.aborted) throw error;
|
|
1495
|
+
throw new FileResolutionFailure(error);
|
|
1496
|
+
}
|
|
1497
|
+
onActivity();
|
|
1498
|
+
usedFiles.push({
|
|
1499
|
+
version,
|
|
1500
|
+
fileId: resolved.record.fileId,
|
|
1501
|
+
location
|
|
1502
|
+
});
|
|
1503
|
+
return resolved.record.fileId;
|
|
1504
|
+
} catch (e_2) {
|
|
1505
|
+
env_2.error = e_2;
|
|
1506
|
+
env_2.hasError = true;
|
|
1507
|
+
} finally {
|
|
1508
|
+
__disposeResources(env_2);
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
},
|
|
1512
|
+
requestImages,
|
|
1513
|
+
maxRequestImageBytes: connection.maxRequestFilesBytes,
|
|
1514
|
+
maxImagesPerRequest: connection.maxImagesPerRequest,
|
|
1515
|
+
byteQuantum: connection.imageOffloadByteQuantum,
|
|
1516
|
+
countQuantum: connection.imageOffloadCountQuantum
|
|
1517
|
+
}, connection.defaults);
|
|
1518
|
+
} catch (error) {
|
|
1519
|
+
if (!(error instanceof FileResolutionFailure)) throw error;
|
|
1520
|
+
representation = "base64";
|
|
1521
|
+
continue;
|
|
1522
|
+
}
|
|
1523
|
+
const payload = JSON.stringify(body);
|
|
1524
|
+
let response;
|
|
602
1525
|
try {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
}
|
|
1526
|
+
response = await fetch(`${connection.baseURL}/chat/completions`, {
|
|
1527
|
+
method: "POST",
|
|
1528
|
+
headers,
|
|
1529
|
+
body: payload,
|
|
1530
|
+
signal
|
|
1531
|
+
});
|
|
1532
|
+
} catch (error) {
|
|
1533
|
+
if (signal.aborted) throw error;
|
|
1534
|
+
throw new LlmError(`DeepSeek API request to ${connection.baseURL} failed`, "TRANSPORT", { cause: error });
|
|
1535
|
+
}
|
|
1536
|
+
if (!response.ok) {
|
|
1537
|
+
let message = `DeepSeek API error (HTTP ${response.status})`;
|
|
1538
|
+
let providerError;
|
|
1539
|
+
const rawResponse = await response.text();
|
|
1540
|
+
try {
|
|
1541
|
+
providerError = JSON.parse(rawResponse).error;
|
|
1542
|
+
if (providerError?.message) message = providerError.message;
|
|
1543
|
+
} catch {}
|
|
1544
|
+
const detail = [
|
|
1545
|
+
providerError?.code,
|
|
1546
|
+
providerError?.type,
|
|
1547
|
+
providerError?.message
|
|
1548
|
+
].filter((field) => typeof field === "string").join(" ");
|
|
1549
|
+
if (usedFiles.length > 0 && providerRejectedFileId(detail)) {
|
|
1550
|
+
await Promise.all(staleMappings(usedFiles, detail).map((file) => this.files.invalidate(file.version, file.fileId, fileConnection)));
|
|
1551
|
+
if (fileAttempt === 0) {
|
|
1552
|
+
fileAttempt += 1;
|
|
1553
|
+
continue;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
if (response.status === 400 && usedFiles.length > 0 && providerRejectedNormalizedImage(detail)) message = normalizedImageDiagnostic(usedFiles, message, detail);
|
|
1557
|
+
const delay = providerRetryAfterMs(response.headers.get("retry-after"));
|
|
1558
|
+
const id = requestId(response.headers);
|
|
1559
|
+
throw new LlmError(message, httpErrorCode(response.status, providerError), {
|
|
1560
|
+
cause: new Error(rawResponse.length > 0 ? rawResponse : `DeepSeek HTTP ${response.status}`),
|
|
1561
|
+
status: response.status,
|
|
1562
|
+
...delay === void 0 ? {} : { providerRetryAfterMs: delay },
|
|
1563
|
+
...id === void 0 ? {} : { requestId: id }
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
if (!response.body) throw new LlmError("DeepSeek API returned no response body", "EMPTY_RESPONSE");
|
|
1567
|
+
yield* translate(parseSse(response.body, onActivity));
|
|
1568
|
+
return;
|
|
613
1569
|
}
|
|
614
|
-
if (!response.body) throw new LlmError("DeepSeek API returned no response body", "EMPTY_RESPONSE");
|
|
615
|
-
yield* translate(parseSse(response.body, onComment));
|
|
616
1570
|
}
|
|
617
1571
|
};
|
|
618
1572
|
//#endregion
|
|
@@ -635,21 +1589,37 @@ const NS = settingsNamespace("llm-deepseek");
|
|
|
635
1589
|
const DEFAULT_API_KEY_ENV = "DEEPSEEK_API_KEY";
|
|
636
1590
|
/** The single provider route this plugin owns. */
|
|
637
1591
|
const PROVIDER = "deepseek-official";
|
|
638
|
-
const DEFAULT_MODELS = [
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
1592
|
+
const DEFAULT_MODELS = [
|
|
1593
|
+
{
|
|
1594
|
+
id: "deepseek-v4-flash",
|
|
1595
|
+
name: "DeepSeek-V4-Flash",
|
|
1596
|
+
contextWindow: DEFAULT_CONTEXT_WINDOW
|
|
1597
|
+
},
|
|
1598
|
+
{
|
|
1599
|
+
id: "deepseek-v4-pro",
|
|
1600
|
+
name: "DeepSeek-V4-Pro",
|
|
1601
|
+
contextWindow: DEFAULT_CONTEXT_WINDOW
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
id: "deepseek-v4-flash-vision-exp",
|
|
1605
|
+
name: "DeepSeek-V4-Flash-Vision-Exp",
|
|
1606
|
+
contextWindow: DEFAULT_CONTEXT_WINDOW,
|
|
1607
|
+
inputModalities: ["text", "image"],
|
|
1608
|
+
imagePixelBudget: DEFAULT_REQUEST_IMAGE_PIXEL_BUDGET,
|
|
1609
|
+
imageMaxBytes: DEFAULT_REQUEST_IMAGE_MAX_BYTES
|
|
1610
|
+
}
|
|
1611
|
+
];
|
|
1612
|
+
const MODEL_MODALITIES = ["text", "image"];
|
|
647
1613
|
const catalogModel = z.object({
|
|
648
1614
|
id: z.string().required(),
|
|
649
1615
|
name: z.string(),
|
|
650
1616
|
description: z.string(),
|
|
651
1617
|
contextWindow: z.number().step(1).min(1),
|
|
652
|
-
maxTokens: z.number().step(1).min(1)
|
|
1618
|
+
maxTokens: z.number().step(1).min(1),
|
|
1619
|
+
inputModalities: z.array(z.union(MODEL_MODALITIES)).min(1).default(["text"]),
|
|
1620
|
+
imagePixelBudget: z.number().step(1).min(1),
|
|
1621
|
+
imageMaxBytes: z.number().step(1).min(1),
|
|
1622
|
+
imageDetail: z.union(["auto", "low"])
|
|
653
1623
|
});
|
|
654
1624
|
const Config = z.object({
|
|
655
1625
|
apiKeyEnv: z.string().role("credential-ref").default(DEFAULT_API_KEY_ENV),
|
|
@@ -665,6 +1635,16 @@ const Config = z.object({
|
|
|
665
1635
|
defaultContextWindow: z.number().step(1).min(1).default(DEFAULT_CONTEXT_WINDOW),
|
|
666
1636
|
models: z.array(catalogModel).default(DEFAULT_MODELS),
|
|
667
1637
|
streamIdleTimeoutMs: z.number().min(Number.MIN_VALUE).max(MAX_TIMER_DELAY_MS).default(DEFAULT_STREAM_IDLE_TIMEOUT_MS),
|
|
1638
|
+
maxRequestFilesBytes: z.number().step(1).min(1).default(DEFAULT_MAX_REQUEST_FILES_BYTES),
|
|
1639
|
+
maxInlineRequestImageBytes: z.number().step(1).min(1).default(DEFAULT_MAX_INLINE_REQUEST_IMAGE_BYTES),
|
|
1640
|
+
maxImagesPerRequest: z.number().step(1).min(1).default(600),
|
|
1641
|
+
imageOffloadByteQuantum: z.number().step(1).min(1).default(DEFAULT_IMAGE_OFFLOAD_BYTE_QUANTUM),
|
|
1642
|
+
inlineImageOffloadByteQuantum: z.number().step(1).min(1).default(DEFAULT_INLINE_IMAGE_OFFLOAD_BYTE_QUANTUM),
|
|
1643
|
+
imageOffloadCountQuantum: z.number().step(1).min(1).default(20),
|
|
1644
|
+
filesApiTimeoutMs: z.number().min(Number.MIN_VALUE).max(MAX_TIMER_DELAY_MS).default(DEFAULT_FILES_API_TIMEOUT_MS),
|
|
1645
|
+
fileExpiresAfterSeconds: z.number().step(1).min(3600).max(2592e3).default(DEFAULT_FILE_EXPIRY_SECONDS),
|
|
1646
|
+
fileRefreshMarginSeconds: z.number().step(1).min(0).default(DEFAULT_FILE_REFRESH_MARGIN_SECONDS),
|
|
1647
|
+
fileQuotaCleanupBatch: z.number().step(1).min(1).max(1e3).default(100),
|
|
668
1648
|
retryPolicy: RetryPolicySchema
|
|
669
1649
|
});
|
|
670
1650
|
/** Public API default; the internal endpoint comes from $DEEPSEEK_BASE_URL. */
|
|
@@ -679,6 +1659,14 @@ function resolveModels(models) {
|
|
|
679
1659
|
if (model.name !== void 0 && model.name.length === 0) throw new Error(`llm-deepseek: catalog model "${model.id}" has an empty name`);
|
|
680
1660
|
if (model.contextWindow !== void 0 && (!Number.isInteger(model.contextWindow) || model.contextWindow <= 0)) throw new Error(`llm-deepseek: catalog model "${model.id}" contextWindow must be a positive integer`);
|
|
681
1661
|
if (model.maxTokens !== void 0 && (!Number.isInteger(model.maxTokens) || model.maxTokens <= 0)) throw new Error(`llm-deepseek: catalog model "${model.id}" maxTokens must be a positive integer`);
|
|
1662
|
+
const inputModalities = model.inputModalities ?? ["text"];
|
|
1663
|
+
if (inputModalities.length === 0) throw new Error(`llm-deepseek: catalog model "${model.id}" inputModalities must not be empty`);
|
|
1664
|
+
if (inputModalities.some((modality) => !MODEL_MODALITIES.includes(modality))) throw new Error(`llm-deepseek: catalog model "${model.id}" inputModalities must contain only "text" and "image"`);
|
|
1665
|
+
if (new Set(inputModalities).size !== inputModalities.length) throw new Error(`llm-deepseek: catalog model "${model.id}" inputModalities must not contain duplicates`);
|
|
1666
|
+
const hasImage = inputModalities.includes("image");
|
|
1667
|
+
if (!hasImage && (model.imagePixelBudget !== void 0 || model.imageMaxBytes !== void 0 || model.imageDetail !== void 0)) throw new Error(`llm-deepseek: text-only catalog model "${model.id}" cannot declare image request limits`);
|
|
1668
|
+
if (model.imagePixelBudget !== void 0 && (!Number.isSafeInteger(model.imagePixelBudget) || model.imagePixelBudget <= 0)) throw new Error(`llm-deepseek: catalog model "${model.id}" imagePixelBudget must be a positive safe integer`);
|
|
1669
|
+
if (model.imageMaxBytes !== void 0 && (!Number.isSafeInteger(model.imageMaxBytes) || model.imageMaxBytes <= 0)) throw new Error(`llm-deepseek: catalog model "${model.id}" imageMaxBytes must be a positive safe integer`);
|
|
682
1670
|
if (seen.has(model.id)) throw new Error(`llm-deepseek: duplicate catalog model "${model.id}"`);
|
|
683
1671
|
seen.add(model.id);
|
|
684
1672
|
return {
|
|
@@ -686,7 +1674,13 @@ function resolveModels(models) {
|
|
|
686
1674
|
...model.name === void 0 ? {} : { name: model.name },
|
|
687
1675
|
...model.description === void 0 ? {} : { description: model.description },
|
|
688
1676
|
...model.contextWindow === void 0 ? {} : { contextWindow: model.contextWindow },
|
|
689
|
-
...model.maxTokens === void 0 ? {} : { maxTokens: model.maxTokens }
|
|
1677
|
+
...model.maxTokens === void 0 ? {} : { maxTokens: model.maxTokens },
|
|
1678
|
+
inputModalities: [...inputModalities],
|
|
1679
|
+
...hasImage ? {
|
|
1680
|
+
imagePixelBudget: model.imagePixelBudget ?? (model.imageDetail === "low" ? 262144 : 64e4),
|
|
1681
|
+
imageMaxBytes: model.imageMaxBytes ?? 1048576,
|
|
1682
|
+
...model.imageDetail === void 0 ? {} : { imageDetail: model.imageDetail }
|
|
1683
|
+
} : {}
|
|
690
1684
|
};
|
|
691
1685
|
});
|
|
692
1686
|
}
|
|
@@ -708,6 +1702,29 @@ function resolveAdapterOptions(config, environment) {
|
|
|
708
1702
|
if (config.maxTokens !== void 0 && (!Number.isSafeInteger(config.maxTokens) || config.maxTokens <= 0)) throw new Error("llm-deepseek: maxTokens must be a positive safe integer");
|
|
709
1703
|
const streamIdleTimeoutMs = config.streamIdleTimeoutMs ?? 3e5;
|
|
710
1704
|
if (!Number.isFinite(streamIdleTimeoutMs) || streamIdleTimeoutMs <= 0 || streamIdleTimeoutMs > MAX_TIMER_DELAY_MS) throw new Error(`llm-deepseek: streamIdleTimeoutMs must be a positive finite number no greater than ${MAX_TIMER_DELAY_MS}`);
|
|
1705
|
+
const maxRequestFilesBytes = config.maxRequestFilesBytes ?? 134217728;
|
|
1706
|
+
if (!Number.isSafeInteger(maxRequestFilesBytes) || maxRequestFilesBytes <= 0) throw new Error("llm-deepseek: maxRequestFilesBytes must be a positive safe integer");
|
|
1707
|
+
const maxInlineRequestImageBytes = config.maxInlineRequestImageBytes ?? 20971520;
|
|
1708
|
+
if (!Number.isSafeInteger(maxInlineRequestImageBytes) || maxInlineRequestImageBytes <= 0) throw new Error("llm-deepseek: maxInlineRequestImageBytes must be a positive safe integer");
|
|
1709
|
+
const maxImagesPerRequest = config.maxImagesPerRequest ?? 600;
|
|
1710
|
+
if (!Number.isSafeInteger(maxImagesPerRequest) || maxImagesPerRequest <= 0) throw new Error("llm-deepseek: maxImagesPerRequest must be a positive safe integer");
|
|
1711
|
+
const imageOffloadByteQuantum = config.imageOffloadByteQuantum ?? 67108864;
|
|
1712
|
+
if (!Number.isSafeInteger(imageOffloadByteQuantum) || imageOffloadByteQuantum <= 0) throw new Error("llm-deepseek: imageOffloadByteQuantum must be a positive safe integer");
|
|
1713
|
+
if (imageOffloadByteQuantum > maxRequestFilesBytes) throw new Error("llm-deepseek: imageOffloadByteQuantum must not exceed maxRequestFilesBytes");
|
|
1714
|
+
const inlineImageOffloadByteQuantum = config.inlineImageOffloadByteQuantum ?? 10485760;
|
|
1715
|
+
if (!Number.isSafeInteger(inlineImageOffloadByteQuantum) || inlineImageOffloadByteQuantum <= 0) throw new Error("llm-deepseek: inlineImageOffloadByteQuantum must be a positive safe integer");
|
|
1716
|
+
if (inlineImageOffloadByteQuantum > maxInlineRequestImageBytes) throw new Error("llm-deepseek: inlineImageOffloadByteQuantum must not exceed maxInlineRequestImageBytes");
|
|
1717
|
+
const imageOffloadCountQuantum = config.imageOffloadCountQuantum ?? 20;
|
|
1718
|
+
if (!Number.isSafeInteger(imageOffloadCountQuantum) || imageOffloadCountQuantum <= 0) throw new Error("llm-deepseek: imageOffloadCountQuantum must be a positive safe integer");
|
|
1719
|
+
if (imageOffloadCountQuantum > maxImagesPerRequest) throw new Error("llm-deepseek: imageOffloadCountQuantum must not exceed maxImagesPerRequest");
|
|
1720
|
+
const filesApiTimeoutMs = config.filesApiTimeoutMs ?? 6e4;
|
|
1721
|
+
if (!Number.isFinite(filesApiTimeoutMs) || filesApiTimeoutMs <= 0 || filesApiTimeoutMs > MAX_TIMER_DELAY_MS) throw new Error(`llm-deepseek: filesApiTimeoutMs must be a positive finite number no greater than ${MAX_TIMER_DELAY_MS}`);
|
|
1722
|
+
const fileExpiresAfterSeconds = config.fileExpiresAfterSeconds ?? 604800;
|
|
1723
|
+
if (!Number.isSafeInteger(fileExpiresAfterSeconds) || fileExpiresAfterSeconds < 3600 || fileExpiresAfterSeconds > 2592e3) throw new Error("llm-deepseek: fileExpiresAfterSeconds must be an integer from 3600 through 2592000");
|
|
1724
|
+
const fileRefreshMarginSeconds = config.fileRefreshMarginSeconds ?? 3600;
|
|
1725
|
+
if (!Number.isSafeInteger(fileRefreshMarginSeconds) || fileRefreshMarginSeconds < 0 || fileRefreshMarginSeconds >= fileExpiresAfterSeconds) throw new Error("llm-deepseek: fileRefreshMarginSeconds must be a non-negative integer below fileExpiresAfterSeconds");
|
|
1726
|
+
const fileQuotaCleanupBatch = config.fileQuotaCleanupBatch ?? 100;
|
|
1727
|
+
if (!Number.isSafeInteger(fileQuotaCleanupBatch) || fileQuotaCleanupBatch < 1 || fileQuotaCleanupBatch > 1e3) throw new Error("llm-deepseek: fileQuotaCleanupBatch must be an integer from 1 through 1000");
|
|
711
1728
|
return {
|
|
712
1729
|
apiKeyEnv: credentialRef(config.apiKeyEnv ?? DEFAULT_API_KEY_ENV),
|
|
713
1730
|
baseURL: config.baseURL ?? environment?.get(BASE_URL_ENV)?.value ?? "https://api.deepseek.com",
|
|
@@ -719,6 +1736,18 @@ function resolveAdapterOptions(config, environment) {
|
|
|
719
1736
|
defaultContextWindow: config.defaultContextWindow ?? 1e6,
|
|
720
1737
|
models: resolveModels(config.models),
|
|
721
1738
|
streamIdleTimeoutMs,
|
|
1739
|
+
maxRequestFilesBytes,
|
|
1740
|
+
maxInlineRequestImageBytes,
|
|
1741
|
+
maxImagesPerRequest,
|
|
1742
|
+
imageOffloadByteQuantum,
|
|
1743
|
+
inlineImageOffloadByteQuantum,
|
|
1744
|
+
imageOffloadCountQuantum,
|
|
1745
|
+
filesApiTimeoutMs,
|
|
1746
|
+
filePolicy: {
|
|
1747
|
+
expiresAfterSeconds: fileExpiresAfterSeconds,
|
|
1748
|
+
refreshMarginSeconds: fileRefreshMarginSeconds,
|
|
1749
|
+
quotaCleanupBatch: fileQuotaCleanupBatch
|
|
1750
|
+
},
|
|
722
1751
|
retryPolicy: resolveRetryPolicy(config.retryPolicy, "llm-deepseek: retryPolicy")
|
|
723
1752
|
};
|
|
724
1753
|
}
|
|
@@ -760,7 +1789,8 @@ function apply(ctx, config) {
|
|
|
760
1789
|
const adapter = new DeepSeekAdapter({
|
|
761
1790
|
options,
|
|
762
1791
|
resolveApiKey,
|
|
763
|
-
resolveUserId
|
|
1792
|
+
resolveUserId,
|
|
1793
|
+
resolveAttachments: () => ctx.get("attachments")
|
|
764
1794
|
});
|
|
765
1795
|
ctx.llm.registerConfigurableProviders([{
|
|
766
1796
|
provider: PROVIDER,
|
|
@@ -784,4 +1814,4 @@ function apply(ctx, config) {
|
|
|
784
1814
|
});
|
|
785
1815
|
}
|
|
786
1816
|
//#endregion
|
|
787
|
-
export { Config, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_TOKENS, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DeepSeekAdapter, PUBLIC_BASE_URL, apply, inject, name, resolveAdapterOptions };
|
|
1817
|
+
export { Config, DEFAULT_CONTEXT_WINDOW, DEFAULT_FILES_API_TIMEOUT_MS, DEFAULT_FILE_EXPIRY_SECONDS, DEFAULT_FILE_QUOTA_CLEANUP_BATCH, DEFAULT_FILE_REFRESH_MARGIN_SECONDS, DEFAULT_IMAGE_OFFLOAD_BYTE_QUANTUM, DEFAULT_IMAGE_OFFLOAD_COUNT_QUANTUM, DEFAULT_INLINE_IMAGE_OFFLOAD_BYTE_QUANTUM, DEFAULT_LOW_DETAIL_IMAGE_PIXEL_BUDGET, DEFAULT_MAX_IMAGES_PER_REQUEST, DEFAULT_MAX_INLINE_REQUEST_IMAGE_BYTES, DEFAULT_MAX_REQUEST_FILES_BYTES, DEFAULT_MAX_TOKENS, DEFAULT_REQUEST_IMAGE_MAX_BYTES, DEFAULT_REQUEST_IMAGE_PIXEL_BUDGET, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DeepSeekAdapter, DeepSeekFileId, DeepSeekFileStore, DeepSeekFilesClient, DeepSeekUploadIndex, MAX_CHAT_IMAGE_BYTES, MAX_FILE_EXPIRY_SECONDS, MAX_FILE_UPLOAD_BYTES, MAX_STORED_FILE_BYTES, MAX_STORED_FILE_COUNT, MIN_FILE_EXPIRY_SECONDS, PUBLIC_BASE_URL, apply, deepSeekFileScope, inject, name, resolveAdapterOptions };
|