@songtonyli/dsh-cli 0.1.90 → 0.1.92
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 +1 -1
- package/bin/dsh.mjs +1 -1
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +26 -13
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +6 -3
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +51 -1
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +2 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-host-header/hostHeaderMiddleware.js +4 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/util-endpoints/lib/aws/parseArn.js +4 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-browser/defaultUserAgent.js +18 -9
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.js +6 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +1 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsSmithyRpcV2JsonProtocol.js +51 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/util/util-arn-parser/arn.js +2 -1
- package/node_modules/@aws-sdk/core/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-eventstream/dist-cjs/index.js +4 -2
- package/node_modules/@aws-sdk/middleware-eventstream/dist-es/eventStreamHandlingMiddleware.js +2 -1
- package/node_modules/@aws-sdk/middleware-eventstream/dist-es/eventStreamHeaderMiddleware.js +2 -1
- package/node_modules/@aws-sdk/middleware-eventstream/package.json +1 -1
- package/node_modules/@aws-sdk/middleware-websocket/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +3 -3
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +1 -1
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/xml-builder/package.json +1 -1
- package/node_modules/@deepseek-ai/cordis/README.md +6 -2
- package/node_modules/@deepseek-ai/cordis/lib/index.js +955 -909
- package/node_modules/@deepseek-ai/cordis/src/context.ts +1 -1
- package/node_modules/@deepseek-ai/cordis/src/events.ts +81 -62
- package/node_modules/@deepseek-ai/cordis/src/fiber.ts +95 -58
- package/node_modules/@deepseek-ai/cordis/src/logger.ts +10 -5
- package/node_modules/@deepseek-ai/cordis/src/reflect.ts +37 -19
- package/node_modules/@deepseek-ai/cordis/src/utils.ts +28 -21
- package/node_modules/@deepseek-ai/cordis-plugin-include/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/cordis-plugin-include/src/index.ts +2 -6
- package/node_modules/@deepseek-ai/cordis-plugin-loader/README.md +4 -0
- package/node_modules/@deepseek-ai/cordis-plugin-loader/lib/index.js +40 -39
- package/node_modules/@deepseek-ai/cordis-plugin-loader/src/config/entry.ts +13 -13
- package/node_modules/@deepseek-ai/cordis-plugin-loader/src/config/group.ts +1 -3
- package/node_modules/@deepseek-ai/cordis-plugin-loader/src/config/isolate.ts +10 -7
- package/node_modules/@deepseek-ai/cordis-plugin-loader/src/index.ts +17 -20
- package/node_modules/@deepseek-ai/dsh/package.json +0 -1
- package/node_modules/@deepseek-ai/dsh-action-cards/lib/typert.host.js +1 -1
- package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-composition-reference/references/packages.md +5 -3
- package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/references/host-plugin.md +13 -0
- package/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/typert.host.js +1 -1
- package/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/types/mount.js +2 -2
- package/node_modules/@deepseek-ai/dsh-api-gateway/lib/client.browser.js +1 -1
- package/node_modules/@deepseek-ai/dsh-api-gateway/lib/client.node.js +1 -1
- package/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/client/remote-events.js +1 -1
- package/node_modules/@deepseek-ai/dsh-api-remotes/lib/client.js +7464 -2004
- package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/client.js +77 -92
- package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.host.js +47 -3
- package/node_modules/@deepseek-ai/dsh-api-terminal-controller/lib/typert.host.js +1 -1
- package/node_modules/@deepseek-ai/dsh-app-boot/lib/index.js +8 -19
- package/node_modules/@deepseek-ai/dsh-base/cordis.patch.yml +3 -0
- package/node_modules/@deepseek-ai/dsh-client-file-upload/lib/typert.host.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-modules/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-client-modules/README.md +3 -1
- package/node_modules/@deepseek-ai/dsh-client-modules/README.zh.md +3 -1
- package/node_modules/@deepseek-ai/dsh-client-modules/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-modules/lib/index.js +37 -15
- package/node_modules/@deepseek-ai/dsh-client-ui-attachment/README.i18n.yaml +4 -4
- package/node_modules/@deepseek-ai/dsh-client-ui-attachment/README.md +3 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-attachment/README.zh.md +3 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-attachment/lib/client.js +19 -6
- package/node_modules/@deepseek-ai/dsh-client-ui-attachment/package.json +4 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-chat/README.i18n.yaml +10 -10
- package/node_modules/@deepseek-ai/dsh-client-ui-chat/README.md +8 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-chat/README.zh.md +8 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/client.js +146 -30
- package/node_modules/@deepseek-ai/dsh-client-ui-chat/package.json +4 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-commands/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-commands/README.md +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-commands/README.zh.md +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-commands/lib/client.js +295 -274
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/README.i18n.yaml +40 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/README.md +100 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/README.zh.md +100 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/lib/client.js +1445 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/lib/index.js +6 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/locale/de.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/locale/en.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/locale/es.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/locale/fr.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/locale/ja.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/locale/pt.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/locale/ru.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/locale/zh.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-context-menu/package.json +61 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-conversation/README.i18n.yaml +4 -4
- package/node_modules/@deepseek-ai/dsh-client-ui-conversation/README.md +4 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-conversation/README.zh.md +4 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +119 -55
- package/node_modules/@deepseek-ai/dsh-client-ui-conversation/package.json +4 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/README.md +2 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/README.zh.md +2 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/client.js +19 -7
- package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/package.json +4 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/README.i18n.yaml +40 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/README.md +92 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/README.zh.md +92 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/lib/client.js +1875 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/lib/index.js +6 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/locale/de.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/locale/en.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/locale/es.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/locale/fr.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/locale/ja.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/locale/pt.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/locale/ru.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/locale/zh.json +5 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-file-actions/package.json +65 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-layout/README.i18n.yaml +6 -6
- package/node_modules/@deepseek-ai/dsh-client-ui-layout/README.md +9 -3
- package/node_modules/@deepseek-ai/dsh-client-ui-layout/README.zh.md +9 -3
- package/node_modules/@deepseek-ai/dsh-client-ui-layout/lib/client.js +91 -26
- package/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/README.md +8 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/README.zh.md +8 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/lib/client.js +431 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/package.json +13 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/README.i18n.yaml +8 -8
- package/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/README.md +6 -3
- package/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/README.zh.md +6 -3
- package/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/lib/client.js +111 -48
- package/node_modules/@deepseek-ai/dsh-client-ui-plugin-market/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-plugin-market/README.md +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-plugin-market/README.zh.md +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-plugin-market/lib/client.js +2 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-reference/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-reference/README.md +2 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-reference/README.zh.md +2 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-reference/lib/client.js +28 -5
- package/node_modules/@deepseek-ai/dsh-client-ui-reference/package.json +4 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-schedule/README.i18n.yaml +19 -19
- package/node_modules/@deepseek-ai/dsh-client-ui-schedule/README.md +25 -39
- package/node_modules/@deepseek-ai/dsh-client-ui-schedule/README.zh.md +23 -37
- package/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/client.js +10359 -3743
- package/node_modules/@deepseek-ai/dsh-client-ui-schedule/package.json +1 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/README.md +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/README.zh.md +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +76 -58
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/README.i18n.yaml +6 -6
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/README.md +5 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/README.zh.md +5 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +46 -18
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/README.i18n.yaml +8 -8
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/README.md +7 -5
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/README.zh.md +7 -5
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/client.js +349 -251
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/package.json +5 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/README.i18n.yaml +20 -14
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/README.md +44 -11
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/README.zh.md +44 -11
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/lib/client.js +1571 -472
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/package.json +5 -3
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/README.i18n.yaml +12 -12
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/README.md +15 -7
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/README.zh.md +15 -7
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/lib/client.js +435 -52
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/package.json +4 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-subagent/lib/client.js +8 -0
- package/node_modules/@deepseek-ai/dsh-client-ui-theme/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-theme/README.md +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-theme/README.zh.md +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-tool/README.i18n.yaml +4 -4
- package/node_modules/@deepseek-ai/dsh-client-ui-tool/README.md +5 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-tool/README.zh.md +5 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/client.js +195 -59
- package/node_modules/@deepseek-ai/dsh-client-ui-tool/package.json +5 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/README.i18n.yaml +4 -4
- package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/README.md +6 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/README.zh.md +6 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/lib/client.js +127 -27
- package/node_modules/@deepseek-ai/dsh-client-ui-workspace/README.i18n.yaml +15 -15
- package/node_modules/@deepseek-ai/dsh-client-ui-workspace/README.md +16 -8
- package/node_modules/@deepseek-ai/dsh-client-ui-workspace/README.zh.md +17 -8
- package/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +523 -480
- package/node_modules/@deepseek-ai/dsh-client-ui-workspace/package.json +4 -2
- package/node_modules/@deepseek-ai/dsh-commands/README.i18n.yaml +4 -4
- package/node_modules/@deepseek-ai/dsh-commands/README.md +3 -0
- package/node_modules/@deepseek-ai/dsh-commands/README.zh.md +3 -0
- package/node_modules/@deepseek-ai/dsh-commands/lib/typert.host.js +1 -1
- package/node_modules/@deepseek-ai/dsh-commands/lib/types/builtin.js +39 -0
- package/node_modules/@deepseek-ai/dsh-commands/package.json +5 -1
- package/node_modules/@deepseek-ai/dsh-compaction-basic/README.i18n.yaml +4 -10
- package/node_modules/@deepseek-ai/dsh-compaction-basic/README.md +2 -0
- package/node_modules/@deepseek-ai/dsh-compaction-basic/README.zh.md +2 -0
- package/node_modules/@deepseek-ai/dsh-cordis-client-runner/lib/client.js +233 -56
- package/node_modules/@deepseek-ai/dsh-cordis-host-runner/lib/typert.host.js +2 -2
- package/node_modules/@deepseek-ai/dsh-deepseek-llm-api-extensions/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-deepseek-llm-api-extensions/README.md +2 -0
- package/node_modules/@deepseek-ai/dsh-deepseek-llm-api-extensions/README.zh.md +2 -0
- package/node_modules/@deepseek-ai/dsh-experimental-auto-review/README.i18n.yaml +16 -19
- package/node_modules/@deepseek-ai/dsh-experimental-auto-review/README.md +11 -22
- package/node_modules/@deepseek-ai/dsh-experimental-auto-review/README.zh.md +11 -22
- package/node_modules/@deepseek-ai/dsh-experimental-auto-review/lib/index.js +2 -0
- package/node_modules/@deepseek-ai/dsh-experimental-client-ui-cot-translation/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-experimental-client-ui-forge/README.i18n.yaml +12 -12
- package/node_modules/@deepseek-ai/dsh-experimental-client-ui-forge/README.md +18 -10
- package/node_modules/@deepseek-ai/dsh-experimental-client-ui-forge/README.zh.md +20 -12
- package/node_modules/@deepseek-ai/dsh-experimental-client-ui-forge/lib/client.js +3338 -297
- package/node_modules/@deepseek-ai/dsh-experimental-client-ui-forge/lib/index.js +159 -52
- package/node_modules/@deepseek-ai/dsh-experimental-client-ui-forge/lib/typert.host.js +298 -18
- package/node_modules/@deepseek-ai/dsh-experimental-client-ui-forge/lib/typert.remote-client.js +267 -13
- package/node_modules/@deepseek-ai/dsh-experimental-forge/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-experimental-forge/README.md +5 -1
- package/node_modules/@deepseek-ai/dsh-experimental-forge/README.zh.md +5 -1
- package/node_modules/@deepseek-ai/dsh-experimental-forge/lib/index.js +48 -6
- package/node_modules/@deepseek-ai/dsh-experimental-forge-github/README.i18n.yaml +8 -8
- package/node_modules/@deepseek-ai/dsh-experimental-forge-github/README.md +9 -5
- package/node_modules/@deepseek-ai/dsh-experimental-forge-github/README.zh.md +9 -5
- package/node_modules/@deepseek-ai/dsh-experimental-forge-github/lib/index.js +301 -31
- package/node_modules/@deepseek-ai/dsh-experimental-forge-github/package.json +1 -0
- package/node_modules/@deepseek-ai/dsh-experimental-liveshare/lib/client.js +5 -58
- package/node_modules/@deepseek-ai/dsh-experimental-liveshare/lib/index.js +5 -2
- package/node_modules/@deepseek-ai/dsh-experimental-liveshare/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-experimental-session-inspector/lib/client.js +77 -92
- package/node_modules/@deepseek-ai/dsh-experimental-translator/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-experimental-translator/lib/types/deepseek.js +2 -2
- package/node_modules/@deepseek-ai/dsh-fs/README.i18n.yaml +12 -12
- package/node_modules/@deepseek-ai/dsh-fs/README.md +15 -7
- package/node_modules/@deepseek-ai/dsh-fs/README.zh.md +15 -7
- package/node_modules/@deepseek-ai/dsh-fs/lib/index.js +21 -2
- package/node_modules/@deepseek-ai/dsh-fs/package.json +3 -0
- package/node_modules/@deepseek-ai/dsh-fs-local/README.i18n.yaml +4 -4
- package/node_modules/@deepseek-ai/dsh-fs-local/README.md +4 -2
- package/node_modules/@deepseek-ai/dsh-fs-local/README.zh.md +4 -2
- package/node_modules/@deepseek-ai/dsh-fs-local/lib/index.js +156 -30
- package/node_modules/@deepseek-ai/dsh-fs-local/package.json +2 -1
- package/node_modules/@deepseek-ai/dsh-fs-observation-policy/README.i18n.yaml +6 -6
- package/node_modules/@deepseek-ai/dsh-fs-observation-policy/README.md +4 -2
- package/node_modules/@deepseek-ai/dsh-fs-observation-policy/README.zh.md +4 -2
- package/node_modules/@deepseek-ai/dsh-fs-observation-policy/lib/index.js +12 -4
- package/node_modules/@deepseek-ai/dsh-fs-patch/LICENSE +235 -0
- package/node_modules/@deepseek-ai/dsh-fs-patch/README.i18n.yaml +40 -0
- package/node_modules/@deepseek-ai/dsh-fs-patch/README.md +112 -0
- package/node_modules/@deepseek-ai/dsh-fs-patch/README.zh.md +112 -0
- package/node_modules/@deepseek-ai/dsh-fs-patch/lib/index.js +275 -0
- package/node_modules/@deepseek-ai/dsh-fs-patch/package.json +35 -0
- package/node_modules/@deepseek-ai/dsh-fs-sandbox/README.i18n.yaml +6 -6
- package/node_modules/@deepseek-ai/dsh-fs-sandbox/README.md +4 -2
- package/node_modules/@deepseek-ai/dsh-fs-sandbox/README.zh.md +4 -2
- package/node_modules/@deepseek-ai/dsh-fs-sandbox/lib/index.js +24 -1
- package/node_modules/@deepseek-ai/dsh-goal/lib/typert.host.js +1 -1
- package/node_modules/@deepseek-ai/dsh-hmr/lib/index.js +4 -3
- package/node_modules/@deepseek-ai/dsh-llm/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-llm/README.md +2 -0
- package/node_modules/@deepseek-ai/dsh-llm/README.zh.md +2 -0
- package/node_modules/@deepseek-ai/dsh-llm/lib/typert.host.js +9 -1
- package/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/index.js +4 -3
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.i18n.yaml +5 -2
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.md +7 -0
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.zh.md +7 -0
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +27 -11
- package/node_modules/@deepseek-ai/dsh-official-bundles/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-official-bundles/README.md +1 -1
- package/node_modules/@deepseek-ai/dsh-official-bundles/README.zh.md +1 -1
- package/node_modules/@deepseek-ai/dsh-official-bundles/lib/index.js +86 -52
- package/node_modules/@deepseek-ai/dsh-permission-presets/lib/typert.host.js +1 -1
- package/node_modules/@deepseek-ai/dsh-plugin-manager/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-plugin-manager/README.md +4 -4
- package/node_modules/@deepseek-ai/dsh-plugin-manager/README.zh.md +4 -4
- package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/index.js +32 -12
- package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/typert.host.js +31 -31
- package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/typert.remote-client.js +27 -27
- package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/github-connection.js +13 -3
- package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/index.js +14 -2
- package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/install-spec.js +1 -1
- package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/operations.js +2 -0
- package/node_modules/@deepseek-ai/dsh-plugin-recommendations/lib/typert.host.js +1 -1
- package/node_modules/@deepseek-ai/dsh-schedule/README.i18n.yaml +72 -39
- package/node_modules/@deepseek-ai/dsh-schedule/README.md +180 -56
- package/node_modules/@deepseek-ai/dsh-schedule/README.zh.md +185 -61
- package/node_modules/@deepseek-ai/dsh-schedule/lib/index.js +1270 -992
- package/node_modules/@deepseek-ai/dsh-schedule/lib/typert.host.js +1842 -274
- package/node_modules/@deepseek-ai/dsh-schedule/lib/typert.remote-client.js +1712 -194
- package/node_modules/@deepseek-ai/dsh-schedule/lib/types/delivery-history.js +7 -20
- package/node_modules/@deepseek-ai/dsh-schedule/lib/types/domain.js +199 -655
- package/node_modules/@deepseek-ai/dsh-schedule/lib/types/index.js +452 -204
- package/node_modules/@deepseek-ai/dsh-schedule/lib/types/runtime.js +389 -70
- package/node_modules/@deepseek-ai/dsh-schedule/lib/types/storage.js +85 -16
- package/node_modules/@deepseek-ai/dsh-schedule/lib/types/types.js +1 -1
- package/node_modules/@deepseek-ai/dsh-schedule/lib/types/update.js +72 -144
- package/node_modules/@deepseek-ai/dsh-schedule/package.json +5 -2
- package/node_modules/@deepseek-ai/dsh-sdk-app/README.i18n.yaml +12 -12
- package/node_modules/@deepseek-ai/dsh-sdk-app/README.md +7 -4
- package/node_modules/@deepseek-ai/dsh-sdk-app/README.zh.md +7 -4
- package/node_modules/@deepseek-ai/dsh-sdk-app/cordis.patch.yml +3 -0
- package/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-server/README.i18n.yaml +52 -4
- package/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-server/README.md +77 -1
- package/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-server/README.zh.md +77 -1
- package/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-server/lib/index.js +306 -2
- package/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-server/package.json +15 -0
- package/node_modules/@deepseek-ai/dsh-sdk-protocol/README.i18n.yaml +4 -4
- package/node_modules/@deepseek-ai/dsh-sdk-protocol/README.md +10 -2
- package/node_modules/@deepseek-ai/dsh-sdk-protocol/README.zh.md +10 -2
- package/node_modules/@deepseek-ai/dsh-sdk-protocol/package.json +2 -0
- package/node_modules/@deepseek-ai/dsh-session-log-deepseek/README.i18n.yaml +9 -6
- package/node_modules/@deepseek-ai/dsh-session-log-deepseek/README.md +20 -1
- package/node_modules/@deepseek-ai/dsh-session-log-deepseek/README.zh.md +20 -1
- package/node_modules/@deepseek-ai/dsh-session-log-deepseek/lib/index.js +91 -57
- package/node_modules/@deepseek-ai/dsh-session-log-deepseek/lib/types/index.js +100 -66
- package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/lib/worker.cjs +947 -917
- package/node_modules/@deepseek-ai/dsh-session-reference/lib/typert.host.js +1 -1
- package/node_modules/@deepseek-ai/dsh-session-title-llm/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-session-title-llm/README.md +1 -1
- package/node_modules/@deepseek-ai/dsh-session-title-llm/README.zh.md +1 -1
- package/node_modules/@deepseek-ai/dsh-settings/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-settings/lib/types/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-subagent/lib/typert.host.js +1 -1
- package/node_modules/@deepseek-ai/dsh-system-prompt/lib/index.js +2 -0
- package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/api-catalog.js +260 -92
- package/node_modules/@deepseek-ai/dsh-tool-fs/README.i18n.yaml +38 -20
- package/node_modules/@deepseek-ai/dsh-tool-fs/README.md +63 -5
- package/node_modules/@deepseek-ai/dsh-tool-fs/README.zh.md +63 -5
- package/node_modules/@deepseek-ai/dsh-tool-fs/lib/index.js +784 -27
- package/node_modules/@deepseek-ai/dsh-tool-fs/package.json +4 -1
- package/node_modules/@deepseek-ai/dsh-tool-schedule/README.i18n.yaml +50 -32
- package/node_modules/@deepseek-ai/dsh-tool-schedule/README.md +47 -20
- package/node_modules/@deepseek-ai/dsh-tool-schedule/README.zh.md +47 -20
- package/node_modules/@deepseek-ai/dsh-tool-schedule/lib/index.js +477 -445
- package/node_modules/@deepseek-ai/dsh-tool-schedule/package.json +7 -2
- package/node_modules/@deepseek-ai/dsh-user-questions/lib/typert.host.js +1 -1
- package/node_modules/@deepseek-ai/dsh-util-time/README.i18n.yaml +10 -10
- package/node_modules/@deepseek-ai/dsh-util-time/README.md +11 -7
- package/node_modules/@deepseek-ai/dsh-util-time/README.zh.md +11 -7
- package/node_modules/@deepseek-ai/dsh-util-time/lib/index.js +1020 -3
- package/node_modules/@deepseek-ai/dsh-util-time/package.json +4 -2
- package/node_modules/@deepseek-ai/dsh-util-values/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-util-values/README.md +1 -1
- package/node_modules/@deepseek-ai/dsh-util-values/README.zh.md +1 -1
- package/node_modules/@deepseek-ai/dsh-util-values/lib/index.js +77 -92
- package/node_modules/@deepseek-ai/dsh-web-app/cordis.patch.yml +5 -1
- package/node_modules/@deepseek-ai/dsh-web-app/package.json +3 -1
- package/node_modules/@deepseek-ai/dsh-web-app/presets/cordis.patch.yml +3 -0
- package/node_modules/@deepseek-ai/dsh-web-app/presets/ptc.patch.yml +3 -0
- package/node_modules/@deepseek-ai/dsh-web-app/presets/standard.patch.yml +3 -0
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-BCbHmUSs.js +197 -0
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-BUDGJY4R.css +1 -0
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/index.html +2 -2
- package/node_modules/@deepseek-ai/dsh-workflow-ptc/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-workspace-changes/README.i18n.yaml +4 -4
- package/node_modules/@deepseek-ai/dsh-workspace-changes/README.md +3 -1
- package/node_modules/@deepseek-ai/dsh-workspace-changes/README.zh.md +4 -2
- package/node_modules/@deepseek-ai/dsh-workspace-changes/lib/index.js +5 -0
- package/node_modules/@deepseek-ai/dsh-workspace-changes/lib/types/index.js +5 -0
- package/node_modules/@deepseek-ai/dsh-workspace-changes/package.json +4 -1
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.cjs +16917 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.mjs +15193 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.cjs +325 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.mjs +295 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.cjs +4642 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.mjs +4155 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.cjs +2495 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.mjs +7 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.cjs +662 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.mjs +6 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/internal/utils.cjs +20 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/internal/utils.mjs +20 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/resource/SemanticResourceAttributes.cjs +1326 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/resource/SemanticResourceAttributes.mjs +1188 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.cjs +1947 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.mjs +1756 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.cjs +9 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.mjs +9 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.cjs +362 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.mjs +312 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/trace/SemanticAttributes.cjs +2508 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/trace/SemanticAttributes.mjs +2236 -0
- package/node_modules/@opentelemetry/semantic-conventions/package.json +22 -35
- package/node_modules/@smithy/core/dist-cjs/index.js +4 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +32 -16
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +26 -13
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +8 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +16 -8
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +8 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +2 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +10 -5
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +18 -9
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +18 -9
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +42 -24
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +20 -10
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +24 -12
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +13 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +7 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +13 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +6 -3
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/util-identity-and-auth/DefaultIdentityProviderConfig.js +2 -1
- package/node_modules/@smithy/core/dist-es/normalizeProvider.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeDeserializer.js +8 -4
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeSerializer.js +6 -3
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeDeserializer2.js +12 -6
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeSerializer2.js +4 -2
- package/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/client/middleware-stack/MiddlewareStack.js +10 -5
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/create-aggregated-client.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/exceptions.js +4 -2
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/extensions/checksum.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/get-value-from-text-node.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/object-mapping.js +4 -2
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/serde-json.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js +8 -4
- package/node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/booleanSelector.js +6 -3
- package/node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/numberSelector.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointUrlConfig.js +8 -4
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/resolveEndpoint.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +6 -3
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/Int64.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/SmithyMessageDecoderStream.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde/utils.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde-universal/getUnmarshalledStream.js +4 -2
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +8 -4
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +4 -2
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +7 -5
- package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +7 -5
- package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +7 -5
- package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +6 -3
- package/node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/configurations.js +4 -2
- package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/parseRetryAfterHeader.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retry-pre-sra-deprecated/StandardRetryStrategy.js +6 -3
- package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retryMiddleware.js +6 -3
- package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/util.js +6 -3
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.browser.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.native.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/serde/util-body-length/calculateBodyLength.browser.js +6 -3
- package/node_modules/@smithy/core/dist-es/submodules/transport/httpResponse.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/transport/normalizeProvider.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/transport/toEndpointV1.js +2 -1
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +19 -7
- package/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +2 -1
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +11 -6
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +6 -0
- package/node_modules/@smithy/node-http-handler/package.json +2 -2
- package/node_modules/@smithy/signature-v4/dist-cjs/index.js +23 -11
- package/node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js +4 -2
- package/node_modules/@smithy/signature-v4/dist-es/SignatureV4Base.js +4 -2
- package/node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js +5 -1
- package/node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js +2 -1
- package/node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js +2 -1
- package/node_modules/@smithy/signature-v4/dist-es/headerUtil.js +6 -3
- package/node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js +2 -1
- package/node_modules/@smithy/signature-v4/dist-es/prepareRequest.js +2 -1
- package/node_modules/@smithy/signature-v4/package.json +2 -2
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/encodeurl/README.md +14 -0
- package/node_modules/encodeurl/index.js +5 -10
- package/node_modules/encodeurl/package.json +7 -3
- package/node_modules/hast-util-to-html/lib/handle/comment.js +6 -1
- package/node_modules/hast-util-to-html/lib/handle/doctype.js +1 -1
- package/node_modules/hast-util-to-html/lib/handle/element.js +33 -9
- package/node_modules/hast-util-to-html/lib/handle/index.js +1 -1
- package/node_modules/hast-util-to-html/lib/handle/raw.js +1 -1
- package/node_modules/hast-util-to-html/lib/handle/root.js +1 -1
- package/node_modules/hast-util-to-html/lib/handle/text.js +1 -1
- package/node_modules/hast-util-to-html/lib/index.js +9 -4
- package/node_modules/hast-util-to-html/lib/omission/closing.js +7 -5
- package/node_modules/hast-util-to-html/lib/omission/omission.js +0 -1
- package/node_modules/hast-util-to-html/lib/omission/opening.js +4 -2
- package/node_modules/hast-util-to-html/lib/omission/util/siblings.js +3 -0
- package/node_modules/hast-util-to-html/package.json +5 -23
- package/node_modules/hast-util-to-html/readme.md +3 -2
- package/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
- package/node_modules/jose/package.json +1 -1
- package/node_modules/rrule/LICENCE +65 -0
- package/node_modules/rrule/README.md +837 -0
- package/node_modules/rrule/dist/es5/rrule.js +3803 -0
- package/node_modules/rrule/dist/es5/rrule.min.js +2 -0
- package/node_modules/rrule/dist/esm/cache.js +95 -0
- package/node_modules/rrule/dist/esm/callbackiterresult.js +24 -0
- package/node_modules/rrule/dist/esm/datetime.js +186 -0
- package/node_modules/rrule/dist/esm/dateutil.js +161 -0
- package/node_modules/rrule/dist/esm/datewithzone.js +36 -0
- package/node_modules/rrule/dist/esm/helpers.js +118 -0
- package/node_modules/rrule/dist/esm/index.js +22 -0
- package/node_modules/rrule/dist/esm/iter/index.js +138 -0
- package/node_modules/rrule/dist/esm/iter/poslist.js +42 -0
- package/node_modules/rrule/dist/esm/iterinfo/easter.js +21 -0
- package/node_modules/rrule/dist/esm/iterinfo/index.js +188 -0
- package/node_modules/rrule/dist/esm/iterinfo/monthinfo.js +51 -0
- package/node_modules/rrule/dist/esm/iterinfo/yearinfo.js +128 -0
- package/node_modules/rrule/dist/esm/iterresult.js +88 -0
- package/node_modules/rrule/dist/esm/iterset.js +63 -0
- package/node_modules/rrule/dist/esm/masks.js +30 -0
- package/node_modules/rrule/dist/esm/nlp/i18n.js +74 -0
- package/node_modules/rrule/dist/esm/nlp/index.js +122 -0
- package/node_modules/rrule/dist/esm/nlp/parsetext.js +391 -0
- package/node_modules/rrule/dist/esm/nlp/totext.js +395 -0
- package/node_modules/rrule/dist/esm/optionstostring.js +98 -0
- package/node_modules/rrule/dist/esm/parseoptions.js +201 -0
- package/node_modules/rrule/dist/esm/parsestring.js +128 -0
- package/node_modules/rrule/dist/esm/rrule.js +232 -0
- package/node_modules/rrule/dist/esm/rruleset.js +182 -0
- package/node_modules/rrule/dist/esm/rrulestr.js +188 -0
- package/node_modules/rrule/dist/esm/types.js +14 -0
- package/node_modules/rrule/dist/esm/weekday.js +45 -0
- package/node_modules/rrule/package.json +79 -0
- package/package.json +32 -31
- package/node_modules/@deepseek-ai/dsh-computer-use/README.i18n.yaml +0 -37
- package/node_modules/@deepseek-ai/dsh-computer-use/README.md +0 -90
- package/node_modules/@deepseek-ai/dsh-computer-use/README.zh.md +0 -90
- package/node_modules/@deepseek-ai/dsh-computer-use/lib/index.js +0 -35
- package/node_modules/@deepseek-ai/dsh-computer-use/lib/types/brand.js +0 -10
- package/node_modules/@deepseek-ai/dsh-computer-use/lib/types/index.js +0 -36
- package/node_modules/@deepseek-ai/dsh-computer-use/locale/de.json +0 -6
- package/node_modules/@deepseek-ai/dsh-computer-use/locale/en.json +0 -6
- package/node_modules/@deepseek-ai/dsh-computer-use/locale/es.json +0 -6
- package/node_modules/@deepseek-ai/dsh-computer-use/locale/fr.json +0 -6
- package/node_modules/@deepseek-ai/dsh-computer-use/locale/ja.json +0 -6
- package/node_modules/@deepseek-ai/dsh-computer-use/locale/pt.json +0 -6
- package/node_modules/@deepseek-ai/dsh-computer-use/locale/ru.json +0 -6
- package/node_modules/@deepseek-ai/dsh-computer-use/locale/zh.json +0 -6
- package/node_modules/@deepseek-ai/dsh-computer-use/package.json +0 -44
- package/node_modules/@deepseek-ai/dsh-cua/README.i18n.yaml +0 -49
- package/node_modules/@deepseek-ai/dsh-cua/README.md +0 -130
- package/node_modules/@deepseek-ai/dsh-cua/README.zh.md +0 -130
- package/node_modules/@deepseek-ai/dsh-cua/lib/api.js +0 -597
- package/node_modules/@deepseek-ai/dsh-cua/lib/bridge.js +0 -611
- package/node_modules/@deepseek-ai/dsh-cua/lib/client.js +0 -1758
- package/node_modules/@deepseek-ai/dsh-cua/lib/index.js +0 -1916
- package/node_modules/@deepseek-ai/dsh-cua/lib/native-client.js +0 -285
- package/node_modules/@deepseek-ai/dsh-cua/lib/protocol.js +0 -305
- package/node_modules/@deepseek-ai/dsh-cua/lib/remote-types.js +0 -1
- package/node_modules/@deepseek-ai/dsh-cua/lib/typert.host.js +0 -416
- package/node_modules/@deepseek-ai/dsh-cua/lib/typert.remote-client.js +0 -301
- package/node_modules/@deepseek-ai/dsh-cua/locale/de.json +0 -6
- package/node_modules/@deepseek-ai/dsh-cua/locale/en.json +0 -6
- package/node_modules/@deepseek-ai/dsh-cua/locale/es.json +0 -6
- package/node_modules/@deepseek-ai/dsh-cua/locale/fr.json +0 -6
- package/node_modules/@deepseek-ai/dsh-cua/locale/ja.json +0 -6
- package/node_modules/@deepseek-ai/dsh-cua/locale/pt.json +0 -6
- package/node_modules/@deepseek-ai/dsh-cua/locale/ru.json +0 -6
- package/node_modules/@deepseek-ai/dsh-cua/locale/zh.json +0 -6
- package/node_modules/@deepseek-ai/dsh-cua/package.json +0 -151
- package/node_modules/@deepseek-ai/dsh-cua-bundle/README.i18n.yaml +0 -46
- package/node_modules/@deepseek-ai/dsh-cua-bundle/README.md +0 -94
- package/node_modules/@deepseek-ai/dsh-cua-bundle/README.zh.md +0 -94
- package/node_modules/@deepseek-ai/dsh-cua-bundle/cordis.patch.yml +0 -10
- package/node_modules/@deepseek-ai/dsh-cua-bundle/docs/DETAIL.md +0 -1
- package/node_modules/@deepseek-ai/dsh-cua-bundle/docs/DETAIL.zh.md +0 -1
- package/node_modules/@deepseek-ai/dsh-cua-bundle/docs/preview.svg +0 -33
- package/node_modules/@deepseek-ai/dsh-cua-bundle/docs/preview.zh.svg +0 -33
- package/node_modules/@deepseek-ai/dsh-cua-bundle/icon.svg +0 -35
- package/node_modules/@deepseek-ai/dsh-cua-bundle/lib/index.js +0 -1
- package/node_modules/@deepseek-ai/dsh-cua-bundle/locale/de.json +0 -7
- package/node_modules/@deepseek-ai/dsh-cua-bundle/locale/en.json +0 -7
- package/node_modules/@deepseek-ai/dsh-cua-bundle/locale/es.json +0 -7
- package/node_modules/@deepseek-ai/dsh-cua-bundle/locale/fr.json +0 -7
- package/node_modules/@deepseek-ai/dsh-cua-bundle/locale/ja.json +0 -7
- package/node_modules/@deepseek-ai/dsh-cua-bundle/locale/pt.json +0 -7
- package/node_modules/@deepseek-ai/dsh-cua-bundle/locale/ru.json +0 -7
- package/node_modules/@deepseek-ai/dsh-cua-bundle/locale/zh.json +0 -7
- package/node_modules/@deepseek-ai/dsh-cua-bundle/package.json +0 -58
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index--TtJvO-i.js +0 -197
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Jtzf36XE.css +0 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js +0 -14991
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.js +0 -298
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js +0 -4060
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js +0 -13
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js +0 -16
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.js +0 -23
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js +0 -1250
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js +0 -1733
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js +0 -12
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js +0 -315
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js +0 -2360
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js +0 -14991
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.js +0 -298
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js +0 -4060
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js +0 -13
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js +0 -16
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/internal/utils.js +0 -23
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/resource/SemanticResourceAttributes.js +0 -1250
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/resource/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js +0 -1733
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js +0 -12
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_metrics.js +0 -315
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/trace/SemanticAttributes.js +0 -2360
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/trace/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js +0 -15049
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js +0 -301
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js +0 -4072
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js +0 -29
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js +0 -32
- package/node_modules/@opentelemetry/semantic-conventions/build/src/internal/utils.js +0 -27
- package/node_modules/@opentelemetry/semantic-conventions/build/src/resource/SemanticResourceAttributes.js +0 -1255
- package/node_modules/@opentelemetry/semantic-conventions/build/src/resource/index.js +0 -26
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js +0 -1759
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js +0 -15
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_metrics.js +0 -319
- package/node_modules/@opentelemetry/semantic-conventions/build/src/trace/SemanticAttributes.js +0 -2368
- package/node_modules/@opentelemetry/semantic-conventions/build/src/trace/index.js +0 -26
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js +0 -10
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols → serde}/writeKey.js +0 -0
|
@@ -680,110 +680,95 @@ function enumerableStringKeys(value) {
|
|
|
680
680
|
function walkJsonValue(value, detach) {
|
|
681
681
|
const ancestors = /* @__PURE__ */ new Set();
|
|
682
682
|
let root;
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
if (
|
|
686
|
-
|
|
687
|
-
else
|
|
683
|
+
let parent;
|
|
684
|
+
const assign = (item) => {
|
|
685
|
+
if (parent === void 0) {
|
|
686
|
+
if (detach) root = item;
|
|
687
|
+
} else if (parent.kind === "array") {
|
|
688
|
+
if (parent.target !== void 0) parent.target[parent.key] = item;
|
|
689
|
+
} else if (parent.target !== void 0) Object.defineProperty(parent.target, parent.key, {
|
|
688
690
|
value: item,
|
|
689
691
|
enumerable: true,
|
|
690
692
|
configurable: true,
|
|
691
693
|
writable: true
|
|
692
694
|
});
|
|
693
695
|
};
|
|
694
|
-
const
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
if (
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
696
|
+
const frames = [];
|
|
697
|
+
let current = value;
|
|
698
|
+
for (;;) {
|
|
699
|
+
if (current === null) assign(null);
|
|
700
|
+
else if (typeof current === "boolean" || typeof current === "string") assign(current);
|
|
701
|
+
else if (typeof current === "number") {
|
|
702
|
+
if (!Number.isFinite(current) || Object.is(current, -0)) return void 0;
|
|
703
|
+
assign(current);
|
|
704
|
+
} else {
|
|
705
|
+
if (typeof current !== "object") return void 0;
|
|
706
|
+
if (ancestors.has(current)) return void 0;
|
|
707
|
+
if (Array.isArray(current)) {
|
|
708
|
+
if (!hasPlainArrayPrototype(current)) return void 0;
|
|
709
|
+
const length = current.length;
|
|
710
|
+
if (Reflect.ownKeys(current).length !== length + 1) return void 0;
|
|
711
|
+
const target = detach ? [] : void 0;
|
|
712
|
+
if (target !== void 0) assign(target);
|
|
713
|
+
let indices;
|
|
714
|
+
if (!Number.isInteger(length)) {
|
|
715
|
+
indices = [];
|
|
716
|
+
for (let index = length - 1; index >= 0; index--) indices.push(index);
|
|
717
|
+
}
|
|
718
|
+
frames.push({
|
|
710
719
|
kind: "array",
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
720
|
+
source: current,
|
|
721
|
+
length: indices?.length ?? length,
|
|
722
|
+
index: 0,
|
|
723
|
+
key: 0,
|
|
724
|
+
indices,
|
|
725
|
+
target
|
|
726
|
+
});
|
|
727
|
+
} else {
|
|
728
|
+
if (!hasPlainObjectPrototype(current)) return void 0;
|
|
729
|
+
const keys = enumerableStringKeys(current);
|
|
730
|
+
if (keys === void 0) return void 0;
|
|
731
|
+
const target = detach ? {} : void 0;
|
|
732
|
+
if (target !== void 0) assign(target);
|
|
733
|
+
frames.push({
|
|
722
734
|
kind: "object",
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
if (current === null) {
|
|
731
|
-
assign(task.destination, null);
|
|
732
|
-
continue;
|
|
733
|
-
}
|
|
734
|
-
if (typeof current === "boolean" || typeof current === "string") {
|
|
735
|
-
assign(task.destination, current);
|
|
736
|
-
continue;
|
|
737
|
-
}
|
|
738
|
-
if (typeof current === "number") {
|
|
739
|
-
if (!Number.isFinite(current) || Object.is(current, -0)) return void 0;
|
|
740
|
-
assign(task.destination, current);
|
|
741
|
-
continue;
|
|
742
|
-
}
|
|
743
|
-
if (typeof current !== "object") return void 0;
|
|
744
|
-
if (ancestors.has(current)) return void 0;
|
|
745
|
-
if (Array.isArray(current)) {
|
|
746
|
-
if (!hasPlainArrayPrototype(current)) return void 0;
|
|
747
|
-
const length = current.length;
|
|
748
|
-
if (Reflect.ownKeys(current).length !== length + 1) return void 0;
|
|
749
|
-
const target = detach ? [] : void 0;
|
|
750
|
-
if (target !== void 0) assign(task.destination, target);
|
|
735
|
+
source: current,
|
|
736
|
+
keys,
|
|
737
|
+
index: 0,
|
|
738
|
+
key: "",
|
|
739
|
+
target
|
|
740
|
+
});
|
|
741
|
+
}
|
|
751
742
|
ancestors.add(current);
|
|
752
|
-
tasks.push({
|
|
753
|
-
kind: "leave",
|
|
754
|
-
source: current
|
|
755
|
-
});
|
|
756
|
-
for (let index = length - 1; index >= 0; index--) tasks.push({
|
|
757
|
-
kind: "array-item",
|
|
758
|
-
source: current,
|
|
759
|
-
index,
|
|
760
|
-
...target === void 0 ? {} : { target }
|
|
761
|
-
});
|
|
762
|
-
continue;
|
|
763
743
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
key
|
|
782
|
-
|
|
783
|
-
|
|
744
|
+
for (;;) {
|
|
745
|
+
const frame = frames.at(-1);
|
|
746
|
+
if (frame === void 0) return detach ? root : true;
|
|
747
|
+
const length = frame.kind === "array" ? frame.length : frame.keys.length;
|
|
748
|
+
if (frame.index >= length) {
|
|
749
|
+
ancestors.delete(frame.source);
|
|
750
|
+
frames.pop();
|
|
751
|
+
continue;
|
|
752
|
+
}
|
|
753
|
+
const index = frame.index++;
|
|
754
|
+
parent = frame;
|
|
755
|
+
if (frame.kind === "array") {
|
|
756
|
+
const key = frame.indices === void 0 ? index : frame.indices[frame.indices.length - index - 1];
|
|
757
|
+
/* v8 ignore next -- the loop is bounded by the captured index count. */
|
|
758
|
+
if (key === void 0) return void 0;
|
|
759
|
+
if (!Object.prototype.hasOwnProperty.call(frame.source, key)) return void 0;
|
|
760
|
+
frame.key = key;
|
|
761
|
+
current = frame.source[key];
|
|
762
|
+
} else {
|
|
763
|
+
const key = frame.keys[index];
|
|
764
|
+
/* v8 ignore next -- the loop is bounded by the captured key count. */
|
|
765
|
+
if (key === void 0) return void 0;
|
|
766
|
+
frame.key = key;
|
|
767
|
+
current = frame.source[key];
|
|
768
|
+
}
|
|
769
|
+
break;
|
|
784
770
|
}
|
|
785
771
|
}
|
|
786
|
-
return detach ? root : true;
|
|
787
772
|
}
|
|
788
773
|
/**
|
|
789
774
|
* Validate and detach lossless JSON in one read per property.
|
|
@@ -1275,6 +1260,7 @@ var DisposableList = class {
|
|
|
1275
1260
|
/** Shared symbols used to avoid public property-name collisions. */
|
|
1276
1261
|
const symbols = {
|
|
1277
1262
|
shadow: Symbol.for("cordis.shadow"),
|
|
1263
|
+
caller: Symbol.for("cordis.caller"),
|
|
1278
1264
|
receiver: Symbol.for("cordis.receiver"),
|
|
1279
1265
|
original: Symbol.for("cordis.original"),
|
|
1280
1266
|
metadata: Symbol.for("cordis.metadata"),
|
|
@@ -1349,11 +1335,12 @@ function withProp(target, prop, value) {
|
|
|
1349
1335
|
writable: false
|
|
1350
1336
|
}));
|
|
1351
1337
|
}
|
|
1352
|
-
function createShadow(
|
|
1338
|
+
function createShadow(useSite, target, property, receiver) {
|
|
1353
1339
|
if (!property) return receiver;
|
|
1354
|
-
const
|
|
1355
|
-
if (!
|
|
1356
|
-
|
|
1340
|
+
const value = getPropertyDescriptor(target, property)?.value;
|
|
1341
|
+
if (!value) return receiver;
|
|
1342
|
+
const defSite = value[symbols.shadow] ?? value;
|
|
1343
|
+
return withProp(receiver, property, useSite.extend({ [symbols.shadow]: defSite }));
|
|
1357
1344
|
}
|
|
1358
1345
|
function createShadowMethod(ctx, value, outer, shadow) {
|
|
1359
1346
|
return new Proxy(value, { apply: (target, thisArg, args) => {
|
|
@@ -1362,37 +1349,40 @@ function createShadowMethod(ctx, value, outer, shadow) {
|
|
|
1362
1349
|
} });
|
|
1363
1350
|
}
|
|
1364
1351
|
function createTraceable(ctx, value, tracker) {
|
|
1365
|
-
|
|
1352
|
+
const defSite = ctx[symbols.shadow] ?? ctx;
|
|
1353
|
+
const useSite = ctx[symbols.shadow] ? Object.getPrototypeOf(ctx) : ctx;
|
|
1366
1354
|
const proxy = new Proxy(value, {
|
|
1367
1355
|
get: (target, prop, receiver) => {
|
|
1368
1356
|
if (prop === symbols.original) return target;
|
|
1369
|
-
if (prop ===
|
|
1357
|
+
if (prop === symbols.caller) return defSite;
|
|
1358
|
+
if (prop === tracker.property) return useSite;
|
|
1370
1359
|
if (typeof prop === "symbol") return Reflect.get(target, prop, receiver);
|
|
1371
|
-
if (tracker.associate &&
|
|
1360
|
+
if (tracker.associate && useSite.reflect.props[`${tracker.associate}.${prop}`]) return Reflect.get(ctx, `${tracker.associate}.${prop}`, withProp(ctx, symbols.receiver, receiver));
|
|
1372
1361
|
let shadow, innerValue;
|
|
1373
1362
|
const desc = getPropertyDescriptor(target, prop);
|
|
1374
1363
|
if (desc && "value" in desc) innerValue = desc.value;
|
|
1375
1364
|
else {
|
|
1376
|
-
shadow = createShadow(
|
|
1365
|
+
shadow = createShadow(useSite, target, tracker.property, receiver);
|
|
1377
1366
|
innerValue = Reflect.get(target, prop, shadow);
|
|
1378
1367
|
}
|
|
1379
1368
|
const innerTracker = innerValue?.[symbols.tracker];
|
|
1380
|
-
if (innerTracker) return createTraceable(
|
|
1369
|
+
if (innerTracker) return createTraceable(useSite, innerValue, innerTracker);
|
|
1381
1370
|
else if (!tracker.noShadow && typeof innerValue === "function") {
|
|
1382
|
-
shadow ??= createShadow(
|
|
1383
|
-
return createShadowMethod(
|
|
1371
|
+
shadow ??= createShadow(useSite, target, tracker.property, receiver);
|
|
1372
|
+
return createShadowMethod(useSite, innerValue, receiver, shadow);
|
|
1384
1373
|
} else return innerValue;
|
|
1385
1374
|
},
|
|
1386
1375
|
set: (target, prop, value, receiver) => {
|
|
1387
1376
|
if (prop === symbols.original) return false;
|
|
1377
|
+
if (prop === symbols.caller) return false;
|
|
1388
1378
|
if (prop === tracker.property) return false;
|
|
1389
1379
|
if (typeof prop === "symbol") return Reflect.set(target, prop, value, receiver);
|
|
1390
|
-
if (tracker.associate &&
|
|
1391
|
-
const shadow = createShadow(
|
|
1380
|
+
if (tracker.associate && useSite.reflect.props[`${tracker.associate}.${prop}`]) return Reflect.set(ctx, `${tracker.associate}.${prop}`, value, withProp(ctx, symbols.receiver, receiver));
|
|
1381
|
+
const shadow = createShadow(useSite, target, tracker.property, receiver);
|
|
1392
1382
|
return Reflect.set(target, prop, value, shadow);
|
|
1393
1383
|
},
|
|
1394
1384
|
apply: (target, thisArg, args) => {
|
|
1395
|
-
return applyTraceable(proxy, target, thisArg, args);
|
|
1385
|
+
return applyTraceable(tracker.noShadow ? proxy : createShadow(useSite, target, tracker.property, proxy), target, thisArg, args);
|
|
1396
1386
|
}
|
|
1397
1387
|
});
|
|
1398
1388
|
return proxy;
|
|
@@ -1404,7 +1394,8 @@ function applyTraceable(proxy, value, thisArg, args) {
|
|
|
1404
1394
|
/** Create a callable service object that dispatches through `symbols.invoke`. */
|
|
1405
1395
|
function createCallable(name, proto, tracker) {
|
|
1406
1396
|
const self = function(...args) {
|
|
1407
|
-
|
|
1397
|
+
const proxy = createTraceable(self["ctx"], self, tracker);
|
|
1398
|
+
return Reflect.apply(proxy, this, args);
|
|
1408
1399
|
};
|
|
1409
1400
|
defineProperty(self, "name", name);
|
|
1410
1401
|
return Object.setPrototypeOf(self, proto);
|
|
@@ -1450,649 +1441,215 @@ function buildOuterStack(offset = 0) {
|
|
|
1450
1441
|
return () => outerError.stack.split("\n").slice(3 + offset);
|
|
1451
1442
|
}
|
|
1452
1443
|
//#endregion
|
|
1453
|
-
//#region ../../../vendor/cordis/src/
|
|
1444
|
+
//#region ../../../vendor/cordis/src/fiber.ts
|
|
1445
|
+
const kValidationError$1 = Symbol.for("ValidationError");
|
|
1446
|
+
/** Error raised when plugin configuration fails standard-schema validation. */
|
|
1447
|
+
var ValidationError$1 = class extends TypeError {
|
|
1448
|
+
name = "ValidationError";
|
|
1449
|
+
/**
|
|
1450
|
+
* Build the aggregated message from schema issues.
|
|
1451
|
+
*
|
|
1452
|
+
* @param issues — the standard-schema issues, one message line each.
|
|
1453
|
+
*/
|
|
1454
|
+
constructor(issues) {
|
|
1455
|
+
super(`invalid config:\n` + issues.map((issue) => {
|
|
1456
|
+
if (issue.path) return ` - ${issue.message} (at ${issue.path.join(".")})`;
|
|
1457
|
+
else return ` - ${issue.message}`;
|
|
1458
|
+
}).join("\n"));
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
Object.defineProperty(ValidationError$1.prototype, kValidationError$1, { value: true });
|
|
1454
1462
|
/**
|
|
1455
|
-
*
|
|
1463
|
+
* Validate and normalize config for a plugin runtime before it starts.
|
|
1456
1464
|
*
|
|
1457
|
-
* @param
|
|
1458
|
-
* @
|
|
1465
|
+
* @param runtime — the plugin runtime whose `Config` schema to apply.
|
|
1466
|
+
* @param config — the raw user config.
|
|
1467
|
+
* @returns the validated config, or `config` unchanged if the runtime has no schema.
|
|
1468
|
+
* @throws {ValidationError} when validation reports issues.
|
|
1459
1469
|
*/
|
|
1460
|
-
function
|
|
1461
|
-
|
|
1470
|
+
function resolveConfig(runtime, config) {
|
|
1471
|
+
if (!runtime.Config) return config;
|
|
1472
|
+
const result = runtime.Config["~standard"].validate(config);
|
|
1473
|
+
if ("then" in result) throw new TypeError("Async config validation is not supported");
|
|
1474
|
+
if (result.issues) throw new ValidationError$1(result.issues);
|
|
1475
|
+
else return result.value;
|
|
1476
|
+
}
|
|
1477
|
+
const effectInertia = /* @__PURE__ */ new WeakMap();
|
|
1478
|
+
function runDisposable(dispose) {
|
|
1479
|
+
const result = dispose();
|
|
1480
|
+
return effectInertia.get(dispose)?.() ?? result;
|
|
1481
|
+
}
|
|
1482
|
+
/** Notify plugin teardown without allowing one observer to break ownership cleanup. */
|
|
1483
|
+
function emitPluginDisposed(context, fiber) {
|
|
1484
|
+
const args = ["internal/plugin", fiber];
|
|
1485
|
+
let callbacks;
|
|
1486
|
+
try {
|
|
1487
|
+
callbacks = context.events.dispatch("emit", args);
|
|
1488
|
+
} catch (error) {
|
|
1489
|
+
context.logger.error(error);
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1492
|
+
for (const callback of callbacks) try {
|
|
1493
|
+
const returned = callback(...args);
|
|
1494
|
+
Promise.resolve(returned).catch((error) => context.logger.error(error));
|
|
1495
|
+
} catch (error) {
|
|
1496
|
+
context.logger.error(error);
|
|
1497
|
+
}
|
|
1462
1498
|
}
|
|
1499
|
+
/** Framework error with a stable machine-readable code. */
|
|
1500
|
+
var CordisError = class CordisError extends Error {
|
|
1501
|
+
code;
|
|
1502
|
+
/**
|
|
1503
|
+
* @param code — the stable error code; also the default message.
|
|
1504
|
+
* @param message — optional human-readable override.
|
|
1505
|
+
*/
|
|
1506
|
+
constructor(code, message) {
|
|
1507
|
+
super(message ?? CordisError.Code[code]);
|
|
1508
|
+
this.code = code;
|
|
1509
|
+
}
|
|
1510
|
+
};
|
|
1511
|
+
(function(_CordisError) {
|
|
1512
|
+
_CordisError.Code = { INACTIVE_EFFECT: "cannot create effect on inactive context" };
|
|
1513
|
+
})(CordisError || (CordisError = {}));
|
|
1514
|
+
const INACTIVE = "__INACTIVE__";
|
|
1463
1515
|
/**
|
|
1464
|
-
*
|
|
1516
|
+
* Runtime instance of one plugin application.
|
|
1465
1517
|
*
|
|
1466
|
-
*
|
|
1467
|
-
*
|
|
1518
|
+
* A fiber tracks dependency state, raw and effective config, lifecycle effects, and
|
|
1519
|
+
* cleanup for the plugin context returned by `ctx.plugin()`.
|
|
1468
1520
|
*/
|
|
1469
|
-
var
|
|
1521
|
+
var Fiber = class {
|
|
1522
|
+
parent;
|
|
1523
|
+
inject;
|
|
1524
|
+
runtime;
|
|
1525
|
+
/** Unique id within the registry; 0 for the root fiber, `null` once disposed. */
|
|
1526
|
+
uid;
|
|
1527
|
+
/** The context this fiber's plugin runs in (extends the parent context). */
|
|
1470
1528
|
ctx;
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1529
|
+
/** Raw plugin input retained for the next activation. */
|
|
1530
|
+
config;
|
|
1531
|
+
/** Current lifecycle state; transitions emit `internal/status`. */
|
|
1532
|
+
state = 0;
|
|
1533
|
+
/** Dispose this fiber: unload the plugin, then settle once cleanup finished. */
|
|
1534
|
+
dispose;
|
|
1535
|
+
/** Required implementations retained through dependent teardown. */
|
|
1536
|
+
committed;
|
|
1537
|
+
/** Service implementations owned by this fiber, including isolated provisions. */
|
|
1538
|
+
provisions = /* @__PURE__ */ new Set();
|
|
1539
|
+
/** The in-flight load/unload transition, if one is currently running. */
|
|
1540
|
+
inertia;
|
|
1541
|
+
_hooks = Object.create(null);
|
|
1542
|
+
_disposables = new DisposableList();
|
|
1543
|
+
context;
|
|
1544
|
+
_error;
|
|
1545
|
+
_revision = 0;
|
|
1546
|
+
_configRevision = 0;
|
|
1547
|
+
_effectiveConfig;
|
|
1548
|
+
_runner;
|
|
1549
|
+
_store = Object.create(null);
|
|
1550
|
+
_release;
|
|
1492
1551
|
/**
|
|
1493
|
-
*
|
|
1552
|
+
* Create a fiber. Plugin authors normally obtain fibers from `ctx.plugin()`
|
|
1553
|
+
* rather than constructing them directly.
|
|
1494
1554
|
*
|
|
1495
|
-
* @param
|
|
1496
|
-
* @param
|
|
1497
|
-
* @
|
|
1555
|
+
* @param parent — the context the plugin was loaded from.
|
|
1556
|
+
* @param config — raw config, validated against the runtime's schema.
|
|
1557
|
+
* @param inject — resolved dependency map (service name → intercept config).
|
|
1558
|
+
* @param runtime — the shared plugin runtime, or `null` for the root fiber.
|
|
1559
|
+
* @param getOuterStack — captures the caller stack for effect diagnostics.
|
|
1498
1560
|
*/
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1561
|
+
constructor(parent, config, inject, runtime, getOuterStack) {
|
|
1562
|
+
this.parent = parent;
|
|
1563
|
+
this.inject = inject;
|
|
1564
|
+
this.runtime = runtime;
|
|
1565
|
+
this.config = config;
|
|
1566
|
+
const collect = (dispose) => {
|
|
1567
|
+
this._disposables.push(dispose);
|
|
1568
|
+
};
|
|
1569
|
+
if (runtime) {
|
|
1570
|
+
this.uid = parent.registry.counter;
|
|
1571
|
+
this.ctx = this.context = parent.extend({ fiber: this });
|
|
1572
|
+
const injectEntries = Object.entries(this.inject);
|
|
1573
|
+
if (injectEntries.length) {
|
|
1574
|
+
this.ctx[Context.intercept] = Object.create(parent[Context.intercept]);
|
|
1575
|
+
for (const [name, config] of injectEntries) {
|
|
1576
|
+
if (isNullable(config)) continue;
|
|
1577
|
+
this.ctx[Context.intercept][name] = config;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
this._runner = {
|
|
1581
|
+
epoch: INACTIVE,
|
|
1582
|
+
getOuterStack,
|
|
1583
|
+
execute: function() {
|
|
1584
|
+
const config = this.resolveConfig(this.config);
|
|
1585
|
+
this._effectiveConfig = config;
|
|
1586
|
+
if (isConstructor(runtime.callback)) {
|
|
1587
|
+
const instance = new runtime.callback(this.ctx, config);
|
|
1588
|
+
for (const hook of instance?.[symbols.initHooks] ?? []) hook();
|
|
1589
|
+
return instance?.[symbols.init]?.();
|
|
1590
|
+
} else return runtime.callback(this.ctx, config);
|
|
1591
|
+
},
|
|
1592
|
+
collect
|
|
1593
|
+
};
|
|
1594
|
+
this.dispose = parent.fiber.effect(() => {
|
|
1595
|
+
const remove = runtime.fibers.push(this);
|
|
1596
|
+
return async () => {
|
|
1597
|
+
this.uid = null;
|
|
1598
|
+
emitPluginDisposed(this.context, this);
|
|
1599
|
+
if (this.ctx.registry.has(runtime.callback)) {
|
|
1600
|
+
remove();
|
|
1601
|
+
if (!runtime.fibers.length) this.ctx.registry.delete(runtime.callback);
|
|
1602
|
+
}
|
|
1603
|
+
this._setEpoch(INACTIVE);
|
|
1604
|
+
if (!this.inertia) this._updateState(() => {
|
|
1605
|
+
this.inertia = this._unload();
|
|
1606
|
+
return 5;
|
|
1607
|
+
});
|
|
1608
|
+
while (this.inertia) await this.inertia;
|
|
1609
|
+
};
|
|
1610
|
+
}, "ctx.plugin()");
|
|
1611
|
+
try {
|
|
1612
|
+
this.context.emit("internal/plugin", this);
|
|
1613
|
+
} catch (error) {
|
|
1614
|
+
Promise.resolve(this.dispose()).catch((reason) => this.ctx.logger.error(reason));
|
|
1615
|
+
throw error;
|
|
1616
|
+
}
|
|
1617
|
+
if (this.uid !== null && parent.fiber.state !== 5) {
|
|
1618
|
+
for (const name of Object.keys(this.inject)) this._checkImpl(name);
|
|
1619
|
+
this._refresh();
|
|
1620
|
+
}
|
|
1621
|
+
} else {
|
|
1622
|
+
this.uid = 0;
|
|
1623
|
+
this.ctx = this.context = parent;
|
|
1624
|
+
this.state = 2;
|
|
1625
|
+
this.committed = Object.create(null);
|
|
1626
|
+
this._runner = {
|
|
1627
|
+
epoch: "0",
|
|
1628
|
+
getOuterStack,
|
|
1629
|
+
execute: () => {},
|
|
1630
|
+
collect
|
|
1631
|
+
};
|
|
1632
|
+
this.dispose = () => this.restart();
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
/** The plugin's display name, inherited from the nearest named ancestor, else `'root'`. */
|
|
1636
|
+
get name() {
|
|
1637
|
+
let fiber = this;
|
|
1638
|
+
do {
|
|
1639
|
+
if (fiber.runtime?.name) return fiber.runtime.name;
|
|
1640
|
+
fiber = fiber.parent.fiber;
|
|
1641
|
+
} while (fiber !== fiber.parent.fiber);
|
|
1642
|
+
return "root";
|
|
1505
1643
|
}
|
|
1506
1644
|
/**
|
|
1507
|
-
*
|
|
1645
|
+
* Throw if the fiber has already been disposed.
|
|
1508
1646
|
*
|
|
1509
|
-
* @
|
|
1510
|
-
* @
|
|
1647
|
+
* @returns nothing when the fiber is still active.
|
|
1648
|
+
* @throws {CordisError} `INACTIVE_EFFECT` when the fiber's uid has been cleared.
|
|
1511
1649
|
*/
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
}
|
|
1516
|
-
/**
|
|
1517
|
-
* Run listeners synchronously without waiting for returned promises.
|
|
1518
|
-
*
|
|
1519
|
-
* @param args — optional `this`, the event name, then listener arguments.
|
|
1520
|
-
*/
|
|
1521
|
-
emit(...args) {
|
|
1522
|
-
this.dispatch("emit", args).map((cb) => cb(...args));
|
|
1523
|
-
}
|
|
1524
|
-
/**
|
|
1525
|
-
* Run listeners in order, awaiting each, until one returns a bail value.
|
|
1526
|
-
*
|
|
1527
|
-
* @param args — optional `this`, the event name, then listener arguments.
|
|
1528
|
-
* @returns the first bail value (see {@link isBailed}), if any.
|
|
1529
|
-
*/
|
|
1530
|
-
async serial(...args) {
|
|
1531
|
-
for (const cb of this.dispatch("serial", args)) {
|
|
1532
|
-
const result = await cb(...args);
|
|
1533
|
-
if (isBailed(result)) return result;
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
/**
|
|
1537
|
-
* Run listeners synchronously until one returns a bail value.
|
|
1538
|
-
*
|
|
1539
|
-
* @param args — optional `this`, the event name, then listener arguments.
|
|
1540
|
-
* @returns the first bail value (see {@link isBailed}), if any.
|
|
1541
|
-
*/
|
|
1542
|
-
bail(...args) {
|
|
1543
|
-
for (const cb of this.dispatch("bail", args)) {
|
|
1544
|
-
const result = cb(...args);
|
|
1545
|
-
if (isBailed(result)) return result;
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
/**
|
|
1549
|
-
* Compose listeners around the final `next` callback.
|
|
1550
|
-
*
|
|
1551
|
-
* The last dispatch argument is treated as the innermost `next`. Listeners
|
|
1552
|
-
* run outermost-first; a listener that does not call `next()` vetoes the
|
|
1553
|
-
* rest of the chain, including the built-in behavior.
|
|
1554
|
-
*
|
|
1555
|
-
* @param args — optional `this`, the event name, listener arguments, then `next`.
|
|
1556
|
-
* @returns the outermost listener's return value.
|
|
1557
|
-
*/
|
|
1558
|
-
waterfall(...args) {
|
|
1559
|
-
const cbs = this.dispatch("waterfall", args);
|
|
1560
|
-
const inner = args.pop();
|
|
1561
|
-
const next = () => {
|
|
1562
|
-
return (cbs.shift() ?? inner)(...args);
|
|
1563
|
-
};
|
|
1564
|
-
args.push(next);
|
|
1565
|
-
return next();
|
|
1566
|
-
}
|
|
1567
|
-
/**
|
|
1568
|
-
* Store a listener record as an effect on the current fiber.
|
|
1569
|
-
*
|
|
1570
|
-
* @param label — effect label shown in fiber diagnostics.
|
|
1571
|
-
* @param hooks — the listener list for one event.
|
|
1572
|
-
* @param callback — the listener to store.
|
|
1573
|
-
* @param options — placement and filtering options.
|
|
1574
|
-
* @returns a disposer that unregisters the listener.
|
|
1575
|
-
*/
|
|
1576
|
-
register(label, hooks, callback, options) {
|
|
1577
|
-
const method = options.prepend ? "unshift" : "push";
|
|
1578
|
-
return this.ctx.fiber.effect(() => {
|
|
1579
|
-
hooks[method]({
|
|
1580
|
-
ctx: this.ctx,
|
|
1581
|
-
callback,
|
|
1582
|
-
...options
|
|
1583
|
-
});
|
|
1584
|
-
return () => this.unregister(hooks, callback);
|
|
1585
|
-
}, label);
|
|
1586
|
-
}
|
|
1587
|
-
/**
|
|
1588
|
-
* Remove a stored listener record.
|
|
1589
|
-
*
|
|
1590
|
-
* @param hooks — the listener list for one event.
|
|
1591
|
-
* @param callback — the listener to remove.
|
|
1592
|
-
* @returns `true` if the listener was found and removed.
|
|
1593
|
-
*/
|
|
1594
|
-
unregister(hooks, callback) {
|
|
1595
|
-
const index = hooks.findIndex((hook) => hook.callback === callback);
|
|
1596
|
-
if (index >= 0) {
|
|
1597
|
-
hooks.splice(index, 1);
|
|
1598
|
-
return true;
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
/**
|
|
1602
|
-
* Register an event listener owned by the current fiber.
|
|
1603
|
-
*
|
|
1604
|
-
* The listener is removed automatically when the fiber unloads. Throws
|
|
1605
|
-
* `CordisError('INACTIVE_EFFECT')` if the fiber is already disposed.
|
|
1606
|
-
*
|
|
1607
|
-
* @param name — the event name to listen for.
|
|
1608
|
-
* @param listener — called with the dispatch arguments.
|
|
1609
|
-
* @param options — listener options; a boolean is shorthand for `prepend`.
|
|
1610
|
-
* @returns a disposer removing the listener; `true` if it was still registered.
|
|
1611
|
-
*/
|
|
1612
|
-
on(name, listener, options) {
|
|
1613
|
-
if (typeof options !== "object") options = { prepend: options };
|
|
1614
|
-
this.ctx.fiber.assertActive();
|
|
1615
|
-
listener = this.ctx.reflect.bind(listener);
|
|
1616
|
-
const result = this.bail(this.ctx, "internal/listener", name, listener, options);
|
|
1617
|
-
if (result) return result;
|
|
1618
|
-
const hooks = this._hooks[name] ||= [];
|
|
1619
|
-
const label = `ctx.on(${typeof name === "string" ? JSON.stringify(name) : name.toString()})`;
|
|
1620
|
-
return this.register(label, hooks, listener, options);
|
|
1621
|
-
}
|
|
1622
|
-
/**
|
|
1623
|
-
* Register an event listener that disposes itself after the first call.
|
|
1624
|
-
*
|
|
1625
|
-
* @param name — the event name to listen for.
|
|
1626
|
-
* @param listener — called at most once with the dispatch arguments.
|
|
1627
|
-
* @param options — listener options; a boolean is shorthand for `prepend`.
|
|
1628
|
-
* @returns a disposer removing the listener; `true` if it was still registered.
|
|
1629
|
-
*/
|
|
1630
|
-
once(name, listener, options) {
|
|
1631
|
-
const dispose = this.on(name, function(...args) {
|
|
1632
|
-
dispose();
|
|
1633
|
-
return listener.apply(this, args);
|
|
1634
|
-
}, options);
|
|
1635
|
-
return dispose;
|
|
1636
|
-
}
|
|
1637
|
-
};
|
|
1638
|
-
//#endregion
|
|
1639
|
-
//#region ../../../vendor/cordis/src/logger.ts
|
|
1640
|
-
/** Built-in placeholder formatters used by `Logger.format()`. */
|
|
1641
|
-
const defaultFormatters = {
|
|
1642
|
-
s: (value) => String(value),
|
|
1643
|
-
d: (value) => Math.trunc(Number(value)),
|
|
1644
|
-
i: (value) => Math.trunc(Number(value)),
|
|
1645
|
-
f: (value) => Number(value),
|
|
1646
|
-
o: (value) => JSON.stringify(value),
|
|
1647
|
-
O: (value) => JSON.stringify(value),
|
|
1648
|
-
c: () => "",
|
|
1649
|
-
C: (value, exporter, message) => {
|
|
1650
|
-
return Logger.color(exporter, Logger.code(message.name, exporter.colors), value);
|
|
1651
|
-
}
|
|
1652
|
-
};
|
|
1653
|
-
function isAggregateError(error) {
|
|
1654
|
-
return error instanceof Error && Array.isArray(error["errors"]);
|
|
1655
|
-
}
|
|
1656
|
-
/** Logger facade for one named subsystem. */
|
|
1657
|
-
var Logger = class {
|
|
1658
|
-
service;
|
|
1659
|
-
static color(exporter, code, value, decoration = "") {
|
|
1660
|
-
if (!exporter.colors) return "" + value;
|
|
1661
|
-
return `\u001b[3${code < 8 ? code : "8;5;" + code}${exporter.colors >= 2 ? decoration : ""}m${value}\u001b[0m`;
|
|
1662
|
-
}
|
|
1663
|
-
static code(name, level) {
|
|
1664
|
-
let hash = 0;
|
|
1665
|
-
for (let i = 0; i < name.length; i++) {
|
|
1666
|
-
hash = (hash << 3) - hash + name.charCodeAt(i) + 13;
|
|
1667
|
-
hash |= 0;
|
|
1668
|
-
}
|
|
1669
|
-
const colors = !level ? [] : level >= 2 ? c256 : c16;
|
|
1670
|
-
return colors[Math.abs(hash) % colors.length];
|
|
1671
|
-
}
|
|
1672
|
-
static format(exporter, message) {
|
|
1673
|
-
const args = message.args.slice();
|
|
1674
|
-
if (args[0] instanceof Error) {
|
|
1675
|
-
args[0] = args[0].stack || args[0].message;
|
|
1676
|
-
args.unshift("%s");
|
|
1677
|
-
} else if (typeof args[0] !== "string") args.unshift("%o");
|
|
1678
|
-
let format = args.shift();
|
|
1679
|
-
format = format.replace(/%([a-zA-Z%])/g, (match, char) => {
|
|
1680
|
-
if (match === "%%") return "%";
|
|
1681
|
-
const formatter = exporter.formatters?.[char] ?? defaultFormatters[char];
|
|
1682
|
-
if (typeof formatter === "function") return formatter(args.shift(), exporter, message);
|
|
1683
|
-
return match;
|
|
1684
|
-
});
|
|
1685
|
-
const oFormatter = exporter.formatters?.o ?? defaultFormatters.o;
|
|
1686
|
-
for (let arg of args) {
|
|
1687
|
-
if (typeof arg === "object" && arg) arg = oFormatter(arg, exporter, message);
|
|
1688
|
-
format += " " + arg;
|
|
1689
|
-
}
|
|
1690
|
-
const { maxLength = 10240 } = exporter;
|
|
1691
|
-
return format.split(/\r?\n/g).map((line) => {
|
|
1692
|
-
return line.slice(0, maxLength) + (line.length > maxLength ? "..." : "");
|
|
1693
|
-
}).join("\n");
|
|
1694
|
-
}
|
|
1695
|
-
constructor(options, service) {
|
|
1696
|
-
this.service = service;
|
|
1697
|
-
Object.assign(this, options);
|
|
1698
|
-
this.error = this._method("error", 0);
|
|
1699
|
-
this.info = this._method("info", 1);
|
|
1700
|
-
this.warn = this._method("warn", 2);
|
|
1701
|
-
this.debug = this._method("debug", 3);
|
|
1702
|
-
}
|
|
1703
|
-
_method(type, level) {
|
|
1704
|
-
return (...args) => {
|
|
1705
|
-
if (args.length === 1 && args[0] instanceof Error) {
|
|
1706
|
-
if (args[0].cause) this[type](args[0].cause);
|
|
1707
|
-
else if (isAggregateError(args[0])) {
|
|
1708
|
-
args[0].errors.forEach((error) => this[type](error));
|
|
1709
|
-
return;
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
const sn = ++this.service._snMessage;
|
|
1713
|
-
const ts = Date.now();
|
|
1714
|
-
for (const exporter of this.service.exporters.values()) {
|
|
1715
|
-
if ((exporter.levels?.[this.name] ?? exporter.levels?.default ?? this.level ?? 1) < level) continue;
|
|
1716
|
-
const message = {
|
|
1717
|
-
sn,
|
|
1718
|
-
ts,
|
|
1719
|
-
type,
|
|
1720
|
-
level,
|
|
1721
|
-
name: this.name,
|
|
1722
|
-
...this.meta,
|
|
1723
|
-
args
|
|
1724
|
-
};
|
|
1725
|
-
exporter.export(message);
|
|
1726
|
-
}
|
|
1727
|
-
};
|
|
1728
|
-
}
|
|
1729
|
-
};
|
|
1730
|
-
/** ANSI 16-color palette indexes used for logger name coloring. */
|
|
1731
|
-
const c16 = [
|
|
1732
|
-
6,
|
|
1733
|
-
2,
|
|
1734
|
-
3,
|
|
1735
|
-
4,
|
|
1736
|
-
5,
|
|
1737
|
-
1
|
|
1738
|
-
];
|
|
1739
|
-
/** ANSI 256-color palette indexes used for logger name coloring. */
|
|
1740
|
-
const c256 = [
|
|
1741
|
-
20,
|
|
1742
|
-
21,
|
|
1743
|
-
26,
|
|
1744
|
-
27,
|
|
1745
|
-
32,
|
|
1746
|
-
33,
|
|
1747
|
-
38,
|
|
1748
|
-
39,
|
|
1749
|
-
40,
|
|
1750
|
-
41,
|
|
1751
|
-
42,
|
|
1752
|
-
43,
|
|
1753
|
-
44,
|
|
1754
|
-
45,
|
|
1755
|
-
56,
|
|
1756
|
-
57,
|
|
1757
|
-
62,
|
|
1758
|
-
63,
|
|
1759
|
-
68,
|
|
1760
|
-
69,
|
|
1761
|
-
74,
|
|
1762
|
-
75,
|
|
1763
|
-
76,
|
|
1764
|
-
77,
|
|
1765
|
-
78,
|
|
1766
|
-
79,
|
|
1767
|
-
80,
|
|
1768
|
-
81,
|
|
1769
|
-
92,
|
|
1770
|
-
93,
|
|
1771
|
-
98,
|
|
1772
|
-
99,
|
|
1773
|
-
112,
|
|
1774
|
-
113,
|
|
1775
|
-
129,
|
|
1776
|
-
134,
|
|
1777
|
-
135,
|
|
1778
|
-
148,
|
|
1779
|
-
149,
|
|
1780
|
-
160,
|
|
1781
|
-
161,
|
|
1782
|
-
162,
|
|
1783
|
-
163,
|
|
1784
|
-
164,
|
|
1785
|
-
165,
|
|
1786
|
-
166,
|
|
1787
|
-
167,
|
|
1788
|
-
168,
|
|
1789
|
-
169,
|
|
1790
|
-
170,
|
|
1791
|
-
171,
|
|
1792
|
-
172,
|
|
1793
|
-
173,
|
|
1794
|
-
178,
|
|
1795
|
-
179,
|
|
1796
|
-
184,
|
|
1797
|
-
185,
|
|
1798
|
-
196,
|
|
1799
|
-
197,
|
|
1800
|
-
198,
|
|
1801
|
-
199,
|
|
1802
|
-
200,
|
|
1803
|
-
201,
|
|
1804
|
-
202,
|
|
1805
|
-
203,
|
|
1806
|
-
204,
|
|
1807
|
-
205,
|
|
1808
|
-
206,
|
|
1809
|
-
207,
|
|
1810
|
-
208,
|
|
1811
|
-
209,
|
|
1812
|
-
214,
|
|
1813
|
-
215,
|
|
1814
|
-
220,
|
|
1815
|
-
221
|
|
1816
|
-
];
|
|
1817
|
-
/**
|
|
1818
|
-
* Built-in logging service.
|
|
1819
|
-
*
|
|
1820
|
-
* Call `ctx.logger()` to create a named logger, or call `ctx.logger.info()`
|
|
1821
|
-
* directly to log with the current fiber-derived name.
|
|
1822
|
-
*/
|
|
1823
|
-
var LoggerService = class LoggerService {
|
|
1824
|
-
bufferSize = 1e3;
|
|
1825
|
-
buffer = [];
|
|
1826
|
-
ctx;
|
|
1827
|
-
_snMessage = 0;
|
|
1828
|
-
_snExporter = 0;
|
|
1829
|
-
exporters = /* @__PURE__ */ new Map();
|
|
1830
|
-
constructor(ctx) {
|
|
1831
|
-
const tracker = {
|
|
1832
|
-
property: "ctx",
|
|
1833
|
-
noShadow: true
|
|
1834
|
-
};
|
|
1835
|
-
const self = createCallable("logger", joinPrototype(Object.getPrototypeOf(this), Function.prototype), tracker);
|
|
1836
|
-
Object.assign(self, this);
|
|
1837
|
-
self.ctx = ctx;
|
|
1838
|
-
defineProperty(self, symbols.tracker, tracker);
|
|
1839
|
-
self.exporter({
|
|
1840
|
-
colors: 3,
|
|
1841
|
-
export: (message) => {
|
|
1842
|
-
self.buffer.push(message);
|
|
1843
|
-
if (self.buffer.length > self.bufferSize) self.buffer = self.buffer.slice(-self.bufferSize);
|
|
1844
|
-
}
|
|
1845
|
-
});
|
|
1846
|
-
return self;
|
|
1847
|
-
}
|
|
1848
|
-
/**
|
|
1849
|
-
* Register an exporter and dispose it with the current fiber.
|
|
1850
|
-
*
|
|
1851
|
-
* @param exporter — the sink that receives structured log messages.
|
|
1852
|
-
* @returns a disposer that removes the exporter.
|
|
1853
|
-
*/
|
|
1854
|
-
exporter(exporter) {
|
|
1855
|
-
return this.ctx.effect(() => {
|
|
1856
|
-
const id = ++this._snExporter;
|
|
1857
|
-
this.exporters.set(id, exporter);
|
|
1858
|
-
return () => this.exporters.delete(id);
|
|
1859
|
-
}, "ctx.logger.exporter()");
|
|
1860
|
-
}
|
|
1861
|
-
_resolveConfig() {
|
|
1862
|
-
let intercept = this.ctx[symbols.intercept];
|
|
1863
|
-
const configs = [];
|
|
1864
|
-
while ("logger" in intercept) {
|
|
1865
|
-
if (Object.hasOwn(intercept, "logger")) configs.unshift(intercept["logger"]);
|
|
1866
|
-
intercept = Object.getPrototypeOf(intercept);
|
|
1867
|
-
}
|
|
1868
|
-
return Object.assign({}, ...configs);
|
|
1869
|
-
}
|
|
1870
|
-
[symbols.invoke](name) {
|
|
1871
|
-
const config = this._resolveConfig();
|
|
1872
|
-
const fiber = (this.ctx[symbols.shadow] ?? this.ctx).fiber;
|
|
1873
|
-
name ??= config.name;
|
|
1874
|
-
name ??= hyphenate(fiber.name);
|
|
1875
|
-
return new Logger({
|
|
1876
|
-
name,
|
|
1877
|
-
level: config.level,
|
|
1878
|
-
meta: { fiber: new WeakRef(fiber) }
|
|
1879
|
-
}, this);
|
|
1880
|
-
}
|
|
1881
|
-
static {
|
|
1882
|
-
for (const type of [
|
|
1883
|
-
"error",
|
|
1884
|
-
"info",
|
|
1885
|
-
"warn",
|
|
1886
|
-
"debug"
|
|
1887
|
-
]) LoggerService.prototype[type] = function(...args) {
|
|
1888
|
-
return this()[type](...args);
|
|
1889
|
-
};
|
|
1890
|
-
}
|
|
1891
|
-
};
|
|
1892
|
-
//#endregion
|
|
1893
|
-
//#region ../../../vendor/cordis/src/fiber.ts
|
|
1894
|
-
const kValidationError$1 = Symbol.for("ValidationError");
|
|
1895
|
-
/** Error raised when plugin configuration fails standard-schema validation. */
|
|
1896
|
-
var ValidationError$1 = class extends TypeError {
|
|
1897
|
-
name = "ValidationError";
|
|
1898
|
-
/**
|
|
1899
|
-
* Build the aggregated message from schema issues.
|
|
1900
|
-
*
|
|
1901
|
-
* @param issues — the standard-schema issues, one message line each.
|
|
1902
|
-
*/
|
|
1903
|
-
constructor(issues) {
|
|
1904
|
-
super(`invalid config:\n` + issues.map((issue) => {
|
|
1905
|
-
if (issue.path) return ` - ${issue.message} (at ${issue.path.join(".")})`;
|
|
1906
|
-
else return ` - ${issue.message}`;
|
|
1907
|
-
}).join("\n"));
|
|
1908
|
-
}
|
|
1909
|
-
};
|
|
1910
|
-
Object.defineProperty(ValidationError$1.prototype, kValidationError$1, { value: true });
|
|
1911
|
-
/**
|
|
1912
|
-
* Validate and normalize config for a plugin runtime before it starts.
|
|
1913
|
-
*
|
|
1914
|
-
* @param runtime — the plugin runtime whose `Config` schema to apply.
|
|
1915
|
-
* @param config — the raw user config.
|
|
1916
|
-
* @returns the validated config, or `config` unchanged if the runtime has no schema.
|
|
1917
|
-
* @throws {ValidationError} when validation reports issues.
|
|
1918
|
-
*/
|
|
1919
|
-
function resolveConfig(runtime, config) {
|
|
1920
|
-
if (!runtime.Config) return config;
|
|
1921
|
-
const result = runtime.Config["~standard"].validate(config);
|
|
1922
|
-
if ("then" in result) throw new TypeError("Async config validation is not supported");
|
|
1923
|
-
if (result.issues) throw new ValidationError$1(result.issues);
|
|
1924
|
-
else return result.value;
|
|
1925
|
-
}
|
|
1926
|
-
const effectInertia = /* @__PURE__ */ new WeakMap();
|
|
1927
|
-
function runDisposable(dispose) {
|
|
1928
|
-
const result = dispose();
|
|
1929
|
-
return effectInertia.get(dispose)?.() ?? result;
|
|
1930
|
-
}
|
|
1931
|
-
/** Notify plugin teardown without allowing one observer to break ownership cleanup. */
|
|
1932
|
-
function emitPluginDisposed(context, fiber) {
|
|
1933
|
-
const args = ["internal/plugin", fiber];
|
|
1934
|
-
let callbacks;
|
|
1935
|
-
try {
|
|
1936
|
-
callbacks = context.events.dispatch("emit", args);
|
|
1937
|
-
} catch (error) {
|
|
1938
|
-
context.logger.error(error);
|
|
1939
|
-
return;
|
|
1940
|
-
}
|
|
1941
|
-
for (const callback of callbacks) try {
|
|
1942
|
-
const returned = callback(...args);
|
|
1943
|
-
Promise.resolve(returned).catch((error) => context.logger.error(error));
|
|
1944
|
-
} catch (error) {
|
|
1945
|
-
context.logger.error(error);
|
|
1946
|
-
}
|
|
1947
|
-
}
|
|
1948
|
-
/** Framework error with a stable machine-readable code. */
|
|
1949
|
-
var CordisError = class CordisError extends Error {
|
|
1950
|
-
code;
|
|
1951
|
-
/**
|
|
1952
|
-
* @param code — the stable error code; also the default message.
|
|
1953
|
-
* @param message — optional human-readable override.
|
|
1954
|
-
*/
|
|
1955
|
-
constructor(code, message) {
|
|
1956
|
-
super(message ?? CordisError.Code[code]);
|
|
1957
|
-
this.code = code;
|
|
1958
|
-
}
|
|
1959
|
-
};
|
|
1960
|
-
(function(_CordisError) {
|
|
1961
|
-
_CordisError.Code = { INACTIVE_EFFECT: "cannot create effect on inactive context" };
|
|
1962
|
-
})(CordisError || (CordisError = {}));
|
|
1963
|
-
const INACTIVE = "__INACTIVE__";
|
|
1964
|
-
/**
|
|
1965
|
-
* Runtime instance of one plugin application.
|
|
1966
|
-
*
|
|
1967
|
-
* A fiber tracks dependency state, validated config, lifecycle effects, and
|
|
1968
|
-
* cleanup for the plugin context returned by `ctx.plugin()`.
|
|
1969
|
-
*/
|
|
1970
|
-
var Fiber = class {
|
|
1971
|
-
parent;
|
|
1972
|
-
inject;
|
|
1973
|
-
runtime;
|
|
1974
|
-
/** Unique id within the registry; 0 for the root fiber, `null` once disposed. */
|
|
1975
|
-
uid;
|
|
1976
|
-
/** The context this fiber's plugin runs in (extends the parent context). */
|
|
1977
|
-
ctx;
|
|
1978
|
-
/** The validated plugin config (updated by `update()`); read through {@link effectiveConfig}. */
|
|
1979
|
-
config;
|
|
1980
|
-
/** The raw plugin config, re-resolved before activation; use {@link rawConfig} to read or retain it. */
|
|
1981
|
-
_config;
|
|
1982
|
-
/** Current lifecycle state; transitions emit `internal/status`. */
|
|
1983
|
-
state = 0;
|
|
1984
|
-
/** Dispose this fiber: unload the plugin, then settle once cleanup finished. */
|
|
1985
|
-
dispose;
|
|
1986
|
-
/** Snapshot of required service implementations while loaded; `undefined` otherwise. */
|
|
1987
|
-
store;
|
|
1988
|
-
/** The in-flight load/unload transition, if one is currently running. */
|
|
1989
|
-
inertia;
|
|
1990
|
-
_hooks = Object.create(null);
|
|
1991
|
-
_disposables = new DisposableList();
|
|
1992
|
-
context;
|
|
1993
|
-
_error;
|
|
1994
|
-
_runner;
|
|
1995
|
-
_store = Object.create(null);
|
|
1996
|
-
/**
|
|
1997
|
-
* Create a fiber. Plugin authors normally obtain fibers from `ctx.plugin()`
|
|
1998
|
-
* rather than constructing them directly.
|
|
1999
|
-
*
|
|
2000
|
-
* @param parent — the context the plugin was loaded from.
|
|
2001
|
-
* @param config — raw config, validated against the runtime's schema.
|
|
2002
|
-
* @param inject — resolved dependency map (service name → intercept config).
|
|
2003
|
-
* @param runtime — the shared plugin runtime, or `null` for the root fiber.
|
|
2004
|
-
* @param getOuterStack — captures the caller stack for effect diagnostics.
|
|
2005
|
-
*/
|
|
2006
|
-
constructor(parent, config, inject, runtime, getOuterStack) {
|
|
2007
|
-
this.parent = parent;
|
|
2008
|
-
this.inject = inject;
|
|
2009
|
-
this.runtime = runtime;
|
|
2010
|
-
this._config = config;
|
|
2011
|
-
const collect = (dispose) => {
|
|
2012
|
-
this._disposables.push(dispose);
|
|
2013
|
-
};
|
|
2014
|
-
if (runtime) {
|
|
2015
|
-
this.uid = parent.registry.counter;
|
|
2016
|
-
this.ctx = this.context = parent.extend({ fiber: this });
|
|
2017
|
-
const injectEntries = Object.entries(this.inject);
|
|
2018
|
-
if (injectEntries.length) {
|
|
2019
|
-
this.ctx[Context.intercept] = Object.create(parent[Context.intercept]);
|
|
2020
|
-
for (const [name, config] of injectEntries) {
|
|
2021
|
-
if (isNullable(config)) continue;
|
|
2022
|
-
this.ctx[Context.intercept][name] = config;
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
this._runner = {
|
|
2026
|
-
epoch: INACTIVE,
|
|
2027
|
-
getOuterStack,
|
|
2028
|
-
execute: function() {
|
|
2029
|
-
if (isConstructor(runtime.callback)) {
|
|
2030
|
-
const instance = new runtime.callback(this.ctx, this.config);
|
|
2031
|
-
for (const hook of instance?.[symbols.initHooks] ?? []) hook();
|
|
2032
|
-
return instance?.[symbols.init]?.();
|
|
2033
|
-
} else return runtime.callback(this.ctx, this.config);
|
|
2034
|
-
},
|
|
2035
|
-
collect
|
|
2036
|
-
};
|
|
2037
|
-
this.dispose = parent.fiber.effect(() => {
|
|
2038
|
-
const remove = runtime.fibers.push(this);
|
|
2039
|
-
return async () => {
|
|
2040
|
-
this.uid = null;
|
|
2041
|
-
emitPluginDisposed(this.context, this);
|
|
2042
|
-
if (this.ctx.registry.has(runtime.callback)) {
|
|
2043
|
-
remove();
|
|
2044
|
-
if (!runtime.fibers.length) this.ctx.registry.delete(runtime.callback);
|
|
2045
|
-
}
|
|
2046
|
-
this._setEpoch(INACTIVE);
|
|
2047
|
-
if (!this.inertia) this._updateState(() => {
|
|
2048
|
-
this.inertia = this._unload();
|
|
2049
|
-
return 5;
|
|
2050
|
-
});
|
|
2051
|
-
while (this.inertia) await this.inertia;
|
|
2052
|
-
};
|
|
2053
|
-
}, "ctx.plugin()");
|
|
2054
|
-
try {
|
|
2055
|
-
this.context.emit("internal/plugin", this);
|
|
2056
|
-
} catch (error) {
|
|
2057
|
-
Promise.resolve(this.dispose()).catch((reason) => this.ctx.logger.error(reason));
|
|
2058
|
-
throw error;
|
|
2059
|
-
}
|
|
2060
|
-
if (this.uid !== null && parent.fiber.state !== 5) {
|
|
2061
|
-
for (const name of Object.keys(this.inject)) this._checkImpl(name);
|
|
2062
|
-
this._refresh();
|
|
2063
|
-
}
|
|
2064
|
-
} else {
|
|
2065
|
-
this.uid = 0;
|
|
2066
|
-
this.ctx = this.context = parent;
|
|
2067
|
-
this.state = 2;
|
|
2068
|
-
this.store = Object.create(null);
|
|
2069
|
-
this._runner = {
|
|
2070
|
-
epoch: "",
|
|
2071
|
-
getOuterStack,
|
|
2072
|
-
execute: () => {},
|
|
2073
|
-
collect
|
|
2074
|
-
};
|
|
2075
|
-
this.dispose = () => this.restart();
|
|
2076
|
-
}
|
|
2077
|
-
}
|
|
2078
|
-
/** The plugin's display name, inherited from the nearest named ancestor, else `'root'`. */
|
|
2079
|
-
get name() {
|
|
2080
|
-
let fiber = this;
|
|
2081
|
-
do {
|
|
2082
|
-
if (fiber.runtime?.name) return fiber.runtime.name;
|
|
2083
|
-
fiber = fiber.parent.fiber;
|
|
2084
|
-
} while (fiber !== fiber.parent.fiber);
|
|
2085
|
-
return "root";
|
|
2086
|
-
}
|
|
2087
|
-
/**
|
|
2088
|
-
* Throw if the fiber has already been disposed.
|
|
2089
|
-
*
|
|
2090
|
-
* @returns nothing when the fiber is still active.
|
|
2091
|
-
* @throws {CordisError} `INACTIVE_EFFECT` when the fiber's uid has been cleared.
|
|
2092
|
-
*/
|
|
2093
|
-
assertActive() {
|
|
2094
|
-
if (this.uid !== null) return;
|
|
2095
|
-
throw new CordisError("INACTIVE_EFFECT");
|
|
1650
|
+
assertActive() {
|
|
1651
|
+
if (this.uid !== null) return;
|
|
1652
|
+
throw new CordisError("INACTIVE_EFFECT");
|
|
2096
1653
|
}
|
|
2097
1654
|
_execute(runner) {
|
|
2098
1655
|
const oldEpoch = runner.epoch;
|
|
@@ -2234,199 +1791,667 @@ var Fiber = class {
|
|
|
2234
1791
|
runner.epoch = false;
|
|
2235
1792
|
return finalizeDisposal(dispose);
|
|
2236
1793
|
};
|
|
2237
|
-
wrapper.then = async (onFulfilled, onRejected) => {
|
|
2238
|
-
return Promise.resolve(task).then(() => disposeAsync).then(onFulfilled, onRejected);
|
|
1794
|
+
wrapper.then = async (onFulfilled, onRejected) => {
|
|
1795
|
+
return Promise.resolve(task).then(() => disposeAsync).then(onFulfilled, onRejected);
|
|
1796
|
+
};
|
|
1797
|
+
return wrapper;
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Return metadata for currently registered effects.
|
|
1801
|
+
*
|
|
1802
|
+
* @returns one {@link EffectMeta} tree per labeled live effect.
|
|
1803
|
+
*/
|
|
1804
|
+
getEffects() {
|
|
1805
|
+
return [...this._disposables].map((dispose) => dispose[symbols.effect]).filter(Boolean);
|
|
1806
|
+
}
|
|
1807
|
+
_getState() {
|
|
1808
|
+
if (this.uid === null) return 4;
|
|
1809
|
+
if (this._error) return 3;
|
|
1810
|
+
if (this._runner.epoch !== INACTIVE) return 2;
|
|
1811
|
+
return 0;
|
|
1812
|
+
}
|
|
1813
|
+
_updateState(callback) {
|
|
1814
|
+
const oldState = this.state;
|
|
1815
|
+
this.state = callback() ?? this._getState();
|
|
1816
|
+
if (oldState === this.state) return;
|
|
1817
|
+
this.context.emit("internal/status", this, oldState);
|
|
1818
|
+
if (oldState !== 2 && this.state !== 2) return;
|
|
1819
|
+
for (const key of Reflect.ownKeys(this.ctx.reflect.store)) {
|
|
1820
|
+
const impl = this.ctx.reflect.store[key];
|
|
1821
|
+
if (impl.ctx.fiber !== this) continue;
|
|
1822
|
+
this.ctx.isolate(impl.name, impl.isolate).reflect.notify([impl.name]);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
_checkImpl(name) {
|
|
1826
|
+
const impl = this.ctx.reflect._getImpl(name, true);
|
|
1827
|
+
if (!impl) return delete this._store[name];
|
|
1828
|
+
try {
|
|
1829
|
+
if (impl.check && !impl.check.call(getTraceable(this.ctx, impl.value))) return delete this._store[name];
|
|
1830
|
+
} catch (error) {
|
|
1831
|
+
impl.ctx.logger.error(error);
|
|
1832
|
+
return delete this._store[name];
|
|
1833
|
+
}
|
|
1834
|
+
this._store[name] = impl;
|
|
1835
|
+
}
|
|
1836
|
+
_refresh() {
|
|
1837
|
+
let epoch = `${this._revision}`;
|
|
1838
|
+
for (const name of Object.keys(this.inject)) {
|
|
1839
|
+
const impl = this._store[name];
|
|
1840
|
+
if (!impl) {
|
|
1841
|
+
epoch = INACTIVE;
|
|
1842
|
+
break;
|
|
1843
|
+
}
|
|
1844
|
+
epoch += ":" + impl.uid;
|
|
1845
|
+
}
|
|
1846
|
+
this._setEpoch(epoch);
|
|
1847
|
+
}
|
|
1848
|
+
_setEpoch(epoch) {
|
|
1849
|
+
const oldEpoch = this._runner.epoch;
|
|
1850
|
+
if (epoch === oldEpoch) return;
|
|
1851
|
+
if (this._error) return;
|
|
1852
|
+
this._runner.epoch = epoch;
|
|
1853
|
+
if (this.inertia) return;
|
|
1854
|
+
this._updateState(() => {
|
|
1855
|
+
if (epoch !== INACTIVE && oldEpoch === INACTIVE) {
|
|
1856
|
+
this.inertia = this._reload();
|
|
1857
|
+
return 1;
|
|
1858
|
+
} else {
|
|
1859
|
+
this.inertia = this._unload();
|
|
1860
|
+
return 5;
|
|
1861
|
+
}
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
/** Raw input retained for the next activation, without evaluating expressions or validating it. */
|
|
1865
|
+
get rawConfig() {
|
|
1866
|
+
return this.ctx.fiber.config;
|
|
1867
|
+
}
|
|
1868
|
+
/** Retain raw input without changing the running config or triggering an update. */
|
|
1869
|
+
set rawConfig(config) {
|
|
1870
|
+
this.ctx.fiber.config = config;
|
|
1871
|
+
this.ctx.fiber._configRevision++;
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* The object passed to plugin activation or the latest successful update that retained the instance.
|
|
1875
|
+
* Candidate resolution does not publish it; volatile updates retain its references.
|
|
1876
|
+
* Undefined before activation and readable after unload; callers requiring a live instance check `state`.
|
|
1877
|
+
*/
|
|
1878
|
+
get effectiveConfig() {
|
|
1879
|
+
return this.ctx.fiber._effectiveConfig;
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Evaluate and validate a candidate using this fiber's `internal/config` hooks and runtime schema.
|
|
1883
|
+
* Does not publish the result, replace raw input, or commit running volatile references.
|
|
1884
|
+
* Required injections must be available when a hook uses them.
|
|
1885
|
+
* @param config Raw candidate input.
|
|
1886
|
+
* @returns The candidate's resolved config, retaining the schema's result identity.
|
|
1887
|
+
* @throws {ValidationError} when the runtime schema rejects the candidate; hook errors propagate.
|
|
1888
|
+
*/
|
|
1889
|
+
resolveConfig(config) {
|
|
1890
|
+
const fiber = this.ctx.fiber;
|
|
1891
|
+
return fiber.context.waterfall("internal/config", fiber, () => config);
|
|
1892
|
+
}
|
|
1893
|
+
async _reload() {
|
|
1894
|
+
this.committed = { ...this._store };
|
|
1895
|
+
for (const impl of Object.values(this.committed)) {
|
|
1896
|
+
if (impl.ctx.fiber === this) continue;
|
|
1897
|
+
impl.dependents.add(this);
|
|
1898
|
+
}
|
|
1899
|
+
const oldEpoch = this._runner.epoch;
|
|
1900
|
+
try {
|
|
1901
|
+
await Promise.resolve();
|
|
1902
|
+
if (this._runner.epoch === oldEpoch) await this._execute(this._runner);
|
|
1903
|
+
} catch (reason) {
|
|
1904
|
+
this.ctx.logger.error(reason);
|
|
1905
|
+
if (this._runner.epoch === oldEpoch) {
|
|
1906
|
+
this._error = reason;
|
|
1907
|
+
this._runner.epoch = INACTIVE;
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
this._updateState(() => {
|
|
1911
|
+
if (this._runner.epoch === oldEpoch) this.inertia = void 0;
|
|
1912
|
+
else {
|
|
1913
|
+
this.inertia = this._unload();
|
|
1914
|
+
return 5;
|
|
1915
|
+
}
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
async _unload() {
|
|
1919
|
+
while ([...this.provisions].some((impl) => impl.dependents.size)) await new Promise((resolve) => this._release = resolve);
|
|
1920
|
+
this._release = void 0;
|
|
1921
|
+
await Promise.all(this._disposables.clear().map(async (dispose) => {
|
|
1922
|
+
try {
|
|
1923
|
+
await composeError(async (info) => {
|
|
1924
|
+
await Promise.resolve();
|
|
1925
|
+
info.error = /* @__PURE__ */ new Error();
|
|
1926
|
+
await runDisposable(dispose);
|
|
1927
|
+
}, this._runner.getOuterStack);
|
|
1928
|
+
} catch (reason) {
|
|
1929
|
+
this.ctx.logger.error(reason);
|
|
1930
|
+
}
|
|
1931
|
+
}));
|
|
1932
|
+
for (const impl of Object.values(this.committed ?? {})) {
|
|
1933
|
+
if (!impl.dependents.delete(this) || impl.dependents.size) continue;
|
|
1934
|
+
impl.release?.();
|
|
1935
|
+
impl.ctx.fiber._release?.();
|
|
1936
|
+
}
|
|
1937
|
+
this.committed = void 0;
|
|
1938
|
+
this._updateState(() => {
|
|
1939
|
+
if (this._runner.epoch === INACTIVE) this.inertia = void 0;
|
|
1940
|
+
else {
|
|
1941
|
+
this.inertia = this._reload();
|
|
1942
|
+
return 1;
|
|
1943
|
+
}
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
/**
|
|
1947
|
+
* Wait for current lifecycle work and rethrow startup errors.
|
|
1948
|
+
*
|
|
1949
|
+
* @returns this fiber, once it has settled into a stable state.
|
|
1950
|
+
* @throws the config-validation or plugin-startup error, if any.
|
|
1951
|
+
*/
|
|
1952
|
+
async await() {
|
|
1953
|
+
while (this.inertia) await this.inertia;
|
|
1954
|
+
if (this._error) throw this._error;
|
|
1955
|
+
return this;
|
|
1956
|
+
}
|
|
1957
|
+
/**
|
|
1958
|
+
* Dispose and immediately reload this plugin with its current config.
|
|
1959
|
+
*
|
|
1960
|
+
* @returns a promise resolving once the reload settled.
|
|
1961
|
+
* @throws {CordisError} `INACTIVE_EFFECT` when the fiber is already disposed.
|
|
1962
|
+
*/
|
|
1963
|
+
async restart() {
|
|
1964
|
+
const fiber = this.ctx.fiber;
|
|
1965
|
+
fiber.assertActive();
|
|
1966
|
+
fiber._revision++;
|
|
1967
|
+
fiber._refresh();
|
|
1968
|
+
await fiber.await();
|
|
1969
|
+
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Resolve a candidate, retain its raw config and apply it through the update waterfall.
|
|
1972
|
+
* @param config Raw config; pending fibers defer resolution until activation.
|
|
1973
|
+
* @param noSave Suppress the persistence notification when true.
|
|
1974
|
+
* @returns The awaited update/restart result, or undefined when a synchronous listener handles it.
|
|
1975
|
+
* @throws {ValidationError} when an active fiber's candidate is invalid.
|
|
1976
|
+
*/
|
|
1977
|
+
update(config, noSave = false) {
|
|
1978
|
+
const fiber = this.ctx.fiber;
|
|
1979
|
+
fiber.assertActive();
|
|
1980
|
+
const loaded = fiber._runner.epoch !== INACTIVE;
|
|
1981
|
+
const resolved = loaded ? fiber.resolveConfig(config) : void 0;
|
|
1982
|
+
if (!noSave) fiber.context.emit("internal/commit", fiber, config);
|
|
1983
|
+
fiber.config = config;
|
|
1984
|
+
fiber._error = void 0;
|
|
1985
|
+
const configRevision = ++fiber._configRevision;
|
|
1986
|
+
const epoch = fiber._runner.epoch;
|
|
1987
|
+
const committed = fiber.committed;
|
|
1988
|
+
let restarted = false;
|
|
1989
|
+
const restart = () => {
|
|
1990
|
+
restarted = true;
|
|
1991
|
+
return fiber.restart();
|
|
1992
|
+
};
|
|
1993
|
+
const publish = () => {
|
|
1994
|
+
if (!restarted && fiber.uid !== null && fiber._configRevision === configRevision && fiber._runner.epoch === epoch && fiber.committed === committed) fiber._effectiveConfig = resolved;
|
|
2239
1995
|
};
|
|
2240
|
-
|
|
1996
|
+
const result = loaded ? fiber.context.waterfall(fiber, "internal/update", resolved, restart) : restart();
|
|
1997
|
+
if (result === void 0) {
|
|
1998
|
+
publish();
|
|
1999
|
+
return;
|
|
2000
|
+
}
|
|
2001
|
+
const task = Promise.resolve(result).then(publish);
|
|
2002
|
+
task.catch(() => {});
|
|
2003
|
+
return task;
|
|
2004
|
+
}
|
|
2005
|
+
};
|
|
2006
|
+
//#endregion
|
|
2007
|
+
//#region ../../../vendor/cordis/src/events.ts
|
|
2008
|
+
/**
|
|
2009
|
+
* Return whether an event result should stop a bail-style dispatch.
|
|
2010
|
+
*
|
|
2011
|
+
* @param value — a listener's return value.
|
|
2012
|
+
* @returns `true` unless `value` is `null`, `false`, or `undefined`.
|
|
2013
|
+
*/
|
|
2014
|
+
function isBailed(value) {
|
|
2015
|
+
return value !== null && value !== false && value !== void 0;
|
|
2016
|
+
}
|
|
2017
|
+
/**
|
|
2018
|
+
* Event bus installed as `ctx.events` and mixed into every context.
|
|
2019
|
+
*
|
|
2020
|
+
* The service supports concurrent, synchronous, serial, bail, and waterfall
|
|
2021
|
+
* dispatch and automatically disposes listeners with their owning fiber.
|
|
2022
|
+
*/
|
|
2023
|
+
var EventsService = class {
|
|
2024
|
+
ctx;
|
|
2025
|
+
_hooks = Object.create(null);
|
|
2026
|
+
constructor(ctx) {
|
|
2027
|
+
this.ctx = ctx;
|
|
2028
|
+
defineProperty(this, symbols.tracker, {
|
|
2029
|
+
property: "ctx",
|
|
2030
|
+
noShadow: true
|
|
2031
|
+
});
|
|
2032
|
+
this.on("internal/listener", function(name, listener, options) {
|
|
2033
|
+
if (name === "internal/update" && !options.global) {
|
|
2034
|
+
const hooks = this.fiber._hooks["internal/update"] ??= new DisposableList();
|
|
2035
|
+
const method = options.prepend ? "unshift" : "push";
|
|
2036
|
+
return this.fiber.effect(() => hooks[method](listener), "ctx.on(\"internal/update\")");
|
|
2037
|
+
}
|
|
2038
|
+
});
|
|
2039
|
+
this.on("internal/update", function(config, next) {
|
|
2040
|
+
const cbs = [...this._hooks["internal/update"] || []];
|
|
2041
|
+
const _next = () => {
|
|
2042
|
+
return (cbs.shift() ?? next).call(this, config, _next);
|
|
2043
|
+
};
|
|
2044
|
+
return _next();
|
|
2045
|
+
}, {
|
|
2046
|
+
global: true,
|
|
2047
|
+
prepend: true
|
|
2048
|
+
});
|
|
2049
|
+
this.on("internal/config", (fiber, next) => {
|
|
2050
|
+
const config = next();
|
|
2051
|
+
return fiber.runtime ? resolveConfig(fiber.runtime, config) : config;
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
_resolve(type, args) {
|
|
2055
|
+
const thisArg = typeof args[0] === "object" || typeof args[0] === "function" ? args.shift() : null;
|
|
2056
|
+
const name = args.shift();
|
|
2057
|
+
if ((typeof name !== "string" || !name.startsWith("internal/")) && this._hooks["internal/dispatch"]?.length) this.emit("internal/dispatch", type, name, args, thisArg);
|
|
2058
|
+
const filter = thisArg?.[Context.filter];
|
|
2059
|
+
return [thisArg, (this._hooks[name] || []).filter((hook) => hook.global || !filter || filter.call(thisArg, hook.ctx)).map((hook) => hook.callback)];
|
|
2241
2060
|
}
|
|
2242
2061
|
/**
|
|
2243
|
-
*
|
|
2062
|
+
* Resolve bound callbacks using the event's context filter.
|
|
2063
|
+
* @param type Dispatch mode reported to observers.
|
|
2064
|
+
* @param args Dispatch arguments, consumed through the event name.
|
|
2065
|
+
* @returns Matching callbacks bound to the dispatch receiver.
|
|
2066
|
+
* DSH retains callback enumeration for per-listener error containment.
|
|
2067
|
+
*/
|
|
2068
|
+
dispatch(type, args) {
|
|
2069
|
+
const [thisArg, callbacks] = this._resolve(type, args);
|
|
2070
|
+
return callbacks.map((callback) => callback.bind(thisArg));
|
|
2071
|
+
}
|
|
2072
|
+
/**
|
|
2073
|
+
* Run listeners concurrently and wait for all of them.
|
|
2244
2074
|
*
|
|
2245
|
-
* @
|
|
2075
|
+
* @param args — optional `this`, the event name, then listener arguments.
|
|
2076
|
+
* @returns a promise resolving once every listener has settled.
|
|
2246
2077
|
*/
|
|
2247
|
-
|
|
2248
|
-
|
|
2078
|
+
async parallel(...args) {
|
|
2079
|
+
const [thisArg, callbacks] = this._resolve("parallel", args);
|
|
2080
|
+
const errors = (await Promise.allSettled(callbacks.map(async (callback) => Reflect.apply(callback, thisArg, args)))).filter((result) => result.status === "rejected");
|
|
2081
|
+
if (errors.length) throw new AggregateError(errors.map((error) => error.reason));
|
|
2249
2082
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2083
|
+
/**
|
|
2084
|
+
* Run listeners synchronously without waiting for returned promises.
|
|
2085
|
+
*
|
|
2086
|
+
* @param args — optional `this`, the event name, then listener arguments.
|
|
2087
|
+
*/
|
|
2088
|
+
emit(...args) {
|
|
2089
|
+
const [thisArg, callbacks] = this._resolve("emit", args);
|
|
2090
|
+
for (const callback of callbacks) Reflect.apply(callback, thisArg, args);
|
|
2255
2091
|
}
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2092
|
+
/**
|
|
2093
|
+
* Run listeners in order, awaiting each, until one returns a bail value.
|
|
2094
|
+
*
|
|
2095
|
+
* @param args — optional `this`, the event name, then listener arguments.
|
|
2096
|
+
* @returns the first bail value (see {@link isBailed}), if any.
|
|
2097
|
+
*/
|
|
2098
|
+
async serial(...args) {
|
|
2099
|
+
const [thisArg, callbacks] = this._resolve("serial", args);
|
|
2100
|
+
for (const callback of callbacks) {
|
|
2101
|
+
const result = await Reflect.apply(callback, thisArg, args);
|
|
2102
|
+
if (isBailed(result)) return result;
|
|
2266
2103
|
}
|
|
2267
2104
|
}
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2105
|
+
/**
|
|
2106
|
+
* Run listeners synchronously until one returns a bail value.
|
|
2107
|
+
*
|
|
2108
|
+
* @param args — optional `this`, the event name, then listener arguments.
|
|
2109
|
+
* @returns the first bail value (see {@link isBailed}), if any.
|
|
2110
|
+
*/
|
|
2111
|
+
bail(...args) {
|
|
2112
|
+
const [thisArg, callbacks] = this._resolve("bail", args);
|
|
2113
|
+
for (const callback of callbacks) {
|
|
2114
|
+
const result = Reflect.apply(callback, thisArg, args);
|
|
2115
|
+
if (isBailed(result)) return result;
|
|
2276
2116
|
}
|
|
2277
|
-
this._store[name] = impl;
|
|
2278
2117
|
}
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
this.
|
|
2118
|
+
/**
|
|
2119
|
+
* Compose listeners around the final `next` callback.
|
|
2120
|
+
*
|
|
2121
|
+
* The last dispatch argument is treated as the innermost `next`. Listeners
|
|
2122
|
+
* run outermost-first; a listener that does not call `next()` vetoes the
|
|
2123
|
+
* rest of the chain, including the built-in behavior.
|
|
2124
|
+
*
|
|
2125
|
+
* @param args — optional `this`, the event name, listener arguments, then `next`.
|
|
2126
|
+
* @returns the outermost listener's return value.
|
|
2127
|
+
*/
|
|
2128
|
+
waterfall(...args) {
|
|
2129
|
+
const [thisArg, callbacks] = this._resolve("waterfall", args);
|
|
2130
|
+
const inner = args.pop();
|
|
2131
|
+
const dispatch = () => {
|
|
2132
|
+
const callback = callbacks.shift();
|
|
2133
|
+
if (!callback) return inner();
|
|
2134
|
+
let called = false;
|
|
2135
|
+
const next = () => {
|
|
2136
|
+
if (called) throw new Error("next() called multiple times");
|
|
2137
|
+
called = true;
|
|
2138
|
+
return dispatch();
|
|
2139
|
+
};
|
|
2140
|
+
return Reflect.apply(callback, thisArg, [...args, next]);
|
|
2141
|
+
};
|
|
2142
|
+
return dispatch();
|
|
2291
2143
|
}
|
|
2292
|
-
|
|
2293
|
-
const
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
this.inertia = this._unload();
|
|
2303
|
-
return 5;
|
|
2304
|
-
}
|
|
2305
|
-
});
|
|
2144
|
+
register(label, name, callback, options) {
|
|
2145
|
+
const method = options.prepend ? "unshift" : "push";
|
|
2146
|
+
return this.ctx.fiber.effect(() => {
|
|
2147
|
+
(this._hooks[name] ??= [])[method]({
|
|
2148
|
+
ctx: this.ctx,
|
|
2149
|
+
callback,
|
|
2150
|
+
...options
|
|
2151
|
+
});
|
|
2152
|
+
return () => this.unregister(name, callback);
|
|
2153
|
+
}, label);
|
|
2306
2154
|
}
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
return
|
|
2155
|
+
unregister(name, callback) {
|
|
2156
|
+
const hooks = this._hooks[name];
|
|
2157
|
+
if (!hooks) return;
|
|
2158
|
+
const index = hooks.findIndex((hook) => hook.callback === callback);
|
|
2159
|
+
if (index >= 0) {
|
|
2160
|
+
hooks.splice(index, 1);
|
|
2161
|
+
if (!hooks.length) delete this._hooks[name];
|
|
2162
|
+
return true;
|
|
2163
|
+
}
|
|
2310
2164
|
}
|
|
2311
|
-
/**
|
|
2312
|
-
|
|
2313
|
-
|
|
2165
|
+
/**
|
|
2166
|
+
* Register an event listener owned by the current fiber.
|
|
2167
|
+
*
|
|
2168
|
+
* The listener is removed automatically when the fiber unloads. Throws
|
|
2169
|
+
* `CordisError('INACTIVE_EFFECT')` if the fiber is already disposed.
|
|
2170
|
+
*
|
|
2171
|
+
* @param name — the event name to listen for.
|
|
2172
|
+
* @param listener — called with the dispatch arguments.
|
|
2173
|
+
* @param options — listener options; a boolean is shorthand for `prepend`.
|
|
2174
|
+
* @returns a disposer removing the listener; `true` if it was still registered.
|
|
2175
|
+
*/
|
|
2176
|
+
on(name, listener, options) {
|
|
2177
|
+
if (typeof options !== "object") options = { prepend: options };
|
|
2178
|
+
this.ctx.fiber.assertActive();
|
|
2179
|
+
listener = this.ctx.reflect.bind(listener);
|
|
2180
|
+
const result = this.bail(this.ctx, "internal/listener", name, listener, options);
|
|
2181
|
+
if (result) return result;
|
|
2182
|
+
const label = `ctx.on(${typeof name === "string" ? JSON.stringify(name) : name.toString()})`;
|
|
2183
|
+
return this.register(label, name, listener, options);
|
|
2314
2184
|
}
|
|
2315
2185
|
/**
|
|
2316
|
-
*
|
|
2317
|
-
*
|
|
2186
|
+
* Register an event listener that disposes itself after the first call.
|
|
2187
|
+
*
|
|
2188
|
+
* @param name — the event name to listen for.
|
|
2189
|
+
* @param listener — called at most once with the dispatch arguments.
|
|
2190
|
+
* @param options — listener options; a boolean is shorthand for `prepend`.
|
|
2191
|
+
* @returns a disposer removing the listener; `true` if it was still registered.
|
|
2318
2192
|
*/
|
|
2319
|
-
|
|
2320
|
-
|
|
2193
|
+
once(name, listener, options) {
|
|
2194
|
+
const dispose = this.on(name, function(...args) {
|
|
2195
|
+
dispose();
|
|
2196
|
+
return listener.apply(this, args);
|
|
2197
|
+
}, options);
|
|
2198
|
+
return dispose;
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2201
|
+
//#endregion
|
|
2202
|
+
//#region ../../../vendor/cordis/src/logger.ts
|
|
2203
|
+
/** Built-in placeholder formatters used by `Logger.format()`. */
|
|
2204
|
+
const defaultFormatters = {
|
|
2205
|
+
s: (value) => String(value),
|
|
2206
|
+
d: (value) => Math.trunc(Number(value)),
|
|
2207
|
+
i: (value) => Math.trunc(Number(value)),
|
|
2208
|
+
f: (value) => Number(value),
|
|
2209
|
+
o: (value) => JSON.stringify(value),
|
|
2210
|
+
O: (value) => JSON.stringify(value),
|
|
2211
|
+
c: () => "",
|
|
2212
|
+
C: (value, exporter, message) => {
|
|
2213
|
+
return Logger.color(exporter, Logger.code(message.name, exporter.colors), value);
|
|
2214
|
+
}
|
|
2215
|
+
};
|
|
2216
|
+
function isAggregateError(error) {
|
|
2217
|
+
return error instanceof Error && Array.isArray(error["errors"]);
|
|
2218
|
+
}
|
|
2219
|
+
/** Logger facade for one named subsystem. */
|
|
2220
|
+
var Logger = class {
|
|
2221
|
+
service;
|
|
2222
|
+
static color(exporter, code, value, decoration = "") {
|
|
2223
|
+
if (!exporter.colors) return "" + value;
|
|
2224
|
+
return `\u001b[3${code < 8 ? code : "8;5;" + code}${exporter.colors >= 2 ? decoration : ""}m${value}\u001b[0m`;
|
|
2225
|
+
}
|
|
2226
|
+
static code(name, level) {
|
|
2227
|
+
let hash = 0;
|
|
2228
|
+
for (let i = 0; i < name.length; i++) {
|
|
2229
|
+
hash = (hash << 3) - hash + name.charCodeAt(i) + 13;
|
|
2230
|
+
hash |= 0;
|
|
2231
|
+
}
|
|
2232
|
+
const colors = !level ? [] : level >= 2 ? c256 : c16;
|
|
2233
|
+
return colors[Math.abs(hash) % colors.length];
|
|
2234
|
+
}
|
|
2235
|
+
static format(exporter, message) {
|
|
2236
|
+
const args = message.args.slice();
|
|
2237
|
+
if (args[0] instanceof Error) {
|
|
2238
|
+
args[0] = args[0].stack || args[0].message;
|
|
2239
|
+
args.unshift("%s");
|
|
2240
|
+
} else if (typeof args[0] !== "string") args.unshift("%o");
|
|
2241
|
+
let format = args.shift();
|
|
2242
|
+
format = format.replace(/%([a-zA-Z%])/g, (match, char) => {
|
|
2243
|
+
if (match === "%%") return "%";
|
|
2244
|
+
const formatter = exporter.formatters?.[char] ?? defaultFormatters[char];
|
|
2245
|
+
if (typeof formatter === "function") return formatter(args.shift(), exporter, message);
|
|
2246
|
+
return match;
|
|
2247
|
+
});
|
|
2248
|
+
const oFormatter = exporter.formatters?.o ?? defaultFormatters.o;
|
|
2249
|
+
for (let arg of args) {
|
|
2250
|
+
if (typeof arg === "object" && arg) arg = oFormatter(arg, exporter, message);
|
|
2251
|
+
format += " " + arg;
|
|
2252
|
+
}
|
|
2253
|
+
const { maxLength = 10240 } = exporter;
|
|
2254
|
+
return format.split(/\r?\n/g).map((line) => {
|
|
2255
|
+
return line.slice(0, maxLength) + (line.length > maxLength ? "..." : "");
|
|
2256
|
+
}).join("\n");
|
|
2321
2257
|
}
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
*/
|
|
2330
|
-
resolveConfig(config) {
|
|
2331
|
-
const fiber = this.ctx.fiber;
|
|
2332
|
-
config = fiber.context.waterfall(fiber, "internal/config", config, () => config);
|
|
2333
|
-
return fiber.runtime ? resolveConfig(fiber.runtime, config) : config;
|
|
2258
|
+
constructor(options, service) {
|
|
2259
|
+
this.service = service;
|
|
2260
|
+
Object.assign(this, options);
|
|
2261
|
+
this.error = this._method("error", 0);
|
|
2262
|
+
this.info = this._method("info", 2);
|
|
2263
|
+
this.warn = this._method("warn", 1);
|
|
2264
|
+
this.debug = this._method("debug", 3);
|
|
2334
2265
|
}
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
this._error = void 0;
|
|
2266
|
+
_method(type, level) {
|
|
2267
|
+
return (...args) => {
|
|
2268
|
+
if (args.length === 1 && args[0] instanceof Error) {
|
|
2269
|
+
if (args[0].cause) this[type](args[0].cause);
|
|
2270
|
+
else if (isAggregateError(args[0])) {
|
|
2271
|
+
args[0].errors.forEach((error) => this[type](error));
|
|
2272
|
+
return;
|
|
2273
|
+
}
|
|
2344
2274
|
}
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
this.
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2275
|
+
const sn = ++this.service._snMessage;
|
|
2276
|
+
const ts = Date.now();
|
|
2277
|
+
for (const exporter of this.service.exporters.values()) {
|
|
2278
|
+
if ((exporter.levels?.[this.name] ?? exporter.levels?.default ?? this.level ?? 2) < level) continue;
|
|
2279
|
+
const message = {
|
|
2280
|
+
sn,
|
|
2281
|
+
ts,
|
|
2282
|
+
type,
|
|
2283
|
+
level,
|
|
2284
|
+
name: this.name,
|
|
2285
|
+
...this.meta,
|
|
2286
|
+
args
|
|
2287
|
+
};
|
|
2288
|
+
exporter.export(message);
|
|
2355
2289
|
}
|
|
2356
|
-
}
|
|
2290
|
+
};
|
|
2357
2291
|
}
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2292
|
+
};
|
|
2293
|
+
/** ANSI 16-color palette indexes used for logger name coloring. */
|
|
2294
|
+
const c16 = [
|
|
2295
|
+
6,
|
|
2296
|
+
2,
|
|
2297
|
+
3,
|
|
2298
|
+
4,
|
|
2299
|
+
5,
|
|
2300
|
+
1
|
|
2301
|
+
];
|
|
2302
|
+
/** ANSI 256-color palette indexes used for logger name coloring. */
|
|
2303
|
+
const c256 = [
|
|
2304
|
+
20,
|
|
2305
|
+
21,
|
|
2306
|
+
26,
|
|
2307
|
+
27,
|
|
2308
|
+
32,
|
|
2309
|
+
33,
|
|
2310
|
+
38,
|
|
2311
|
+
39,
|
|
2312
|
+
40,
|
|
2313
|
+
41,
|
|
2314
|
+
42,
|
|
2315
|
+
43,
|
|
2316
|
+
44,
|
|
2317
|
+
45,
|
|
2318
|
+
56,
|
|
2319
|
+
57,
|
|
2320
|
+
62,
|
|
2321
|
+
63,
|
|
2322
|
+
68,
|
|
2323
|
+
69,
|
|
2324
|
+
74,
|
|
2325
|
+
75,
|
|
2326
|
+
76,
|
|
2327
|
+
77,
|
|
2328
|
+
78,
|
|
2329
|
+
79,
|
|
2330
|
+
80,
|
|
2331
|
+
81,
|
|
2332
|
+
92,
|
|
2333
|
+
93,
|
|
2334
|
+
98,
|
|
2335
|
+
99,
|
|
2336
|
+
112,
|
|
2337
|
+
113,
|
|
2338
|
+
129,
|
|
2339
|
+
134,
|
|
2340
|
+
135,
|
|
2341
|
+
148,
|
|
2342
|
+
149,
|
|
2343
|
+
160,
|
|
2344
|
+
161,
|
|
2345
|
+
162,
|
|
2346
|
+
163,
|
|
2347
|
+
164,
|
|
2348
|
+
165,
|
|
2349
|
+
166,
|
|
2350
|
+
167,
|
|
2351
|
+
168,
|
|
2352
|
+
169,
|
|
2353
|
+
170,
|
|
2354
|
+
171,
|
|
2355
|
+
172,
|
|
2356
|
+
173,
|
|
2357
|
+
178,
|
|
2358
|
+
179,
|
|
2359
|
+
184,
|
|
2360
|
+
185,
|
|
2361
|
+
196,
|
|
2362
|
+
197,
|
|
2363
|
+
198,
|
|
2364
|
+
199,
|
|
2365
|
+
200,
|
|
2366
|
+
201,
|
|
2367
|
+
202,
|
|
2368
|
+
203,
|
|
2369
|
+
204,
|
|
2370
|
+
205,
|
|
2371
|
+
206,
|
|
2372
|
+
207,
|
|
2373
|
+
208,
|
|
2374
|
+
209,
|
|
2375
|
+
214,
|
|
2376
|
+
215,
|
|
2377
|
+
220,
|
|
2378
|
+
221
|
|
2379
|
+
];
|
|
2380
|
+
/**
|
|
2381
|
+
* Built-in logging service.
|
|
2382
|
+
*
|
|
2383
|
+
* Call `ctx.logger()` to create a named logger, or call `ctx.logger.info()`
|
|
2384
|
+
* directly to log with the current fiber-derived name.
|
|
2385
|
+
*/
|
|
2386
|
+
var LoggerService = class LoggerService {
|
|
2387
|
+
bufferSize = 1e3;
|
|
2388
|
+
buffer = [];
|
|
2389
|
+
ctx;
|
|
2390
|
+
_snMessage = 0;
|
|
2391
|
+
_snExporter = 0;
|
|
2392
|
+
exporters = /* @__PURE__ */ new Map();
|
|
2393
|
+
constructor(ctx) {
|
|
2394
|
+
const tracker = {
|
|
2395
|
+
property: "ctx",
|
|
2396
|
+
noShadow: true
|
|
2397
|
+
};
|
|
2398
|
+
const self = createCallable("logger", joinPrototype(Object.getPrototypeOf(this), Function.prototype), tracker);
|
|
2399
|
+
Object.assign(self, this);
|
|
2400
|
+
self.ctx = ctx;
|
|
2401
|
+
defineProperty(self, symbols.tracker, tracker);
|
|
2402
|
+
self.exporter({
|
|
2403
|
+
colors: 3,
|
|
2404
|
+
export: (message) => {
|
|
2405
|
+
self.buffer.push(message);
|
|
2406
|
+
const overflow = self.buffer.length - self.bufferSize;
|
|
2407
|
+
if (overflow === 1) self.buffer.shift();
|
|
2408
|
+
else if (overflow > 1) self.buffer.splice(0, overflow);
|
|
2376
2409
|
}
|
|
2377
2410
|
});
|
|
2411
|
+
return self;
|
|
2378
2412
|
}
|
|
2379
2413
|
/**
|
|
2380
|
-
*
|
|
2381
|
-
*
|
|
2382
|
-
* @returns this fiber, once it has settled into a stable state.
|
|
2383
|
-
* @throws the config-validation or plugin-startup error, if any.
|
|
2384
|
-
*/
|
|
2385
|
-
async await() {
|
|
2386
|
-
while (this.inertia) await this.inertia;
|
|
2387
|
-
if (this._error) throw this._error;
|
|
2388
|
-
return this;
|
|
2389
|
-
}
|
|
2390
|
-
/**
|
|
2391
|
-
* Dispose and immediately reload this plugin with its current config.
|
|
2414
|
+
* Register an exporter and dispose it with the current fiber.
|
|
2392
2415
|
*
|
|
2393
|
-
* @
|
|
2394
|
-
* @
|
|
2416
|
+
* @param exporter — the sink that receives structured log messages.
|
|
2417
|
+
* @returns a disposer that removes the exporter.
|
|
2395
2418
|
*/
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2419
|
+
exporter(exporter) {
|
|
2420
|
+
return this.ctx.effect(() => {
|
|
2421
|
+
const id = ++this._snExporter;
|
|
2422
|
+
this.exporters.set(id, exporter);
|
|
2423
|
+
return () => this.exporters.delete(id);
|
|
2424
|
+
}, "ctx.logger.exporter()");
|
|
2402
2425
|
}
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
* @param config — the new raw config; validated before anything restarts.
|
|
2410
|
-
* @param noSave — hint for persistence hooks not to write the change back.
|
|
2411
|
-
* @returns nothing; the restart runs behind the `internal/update` waterfall.
|
|
2412
|
-
* @throws {ValidationError} when the new config fails validation.
|
|
2413
|
-
*/
|
|
2414
|
-
update(config, noSave = false) {
|
|
2415
|
-
const fiber = this.ctx.fiber;
|
|
2416
|
-
fiber.assertActive();
|
|
2417
|
-
fiber._config = config;
|
|
2418
|
-
if (fiber.state !== 2) {
|
|
2419
|
-
fiber._error = void 0;
|
|
2420
|
-
fiber._setEpoch(INACTIVE);
|
|
2421
|
-
fiber._refresh();
|
|
2422
|
-
return;
|
|
2426
|
+
_resolveConfig() {
|
|
2427
|
+
let intercept = this.ctx[symbols.intercept];
|
|
2428
|
+
const configs = [];
|
|
2429
|
+
while ("logger" in intercept) {
|
|
2430
|
+
if (Object.hasOwn(intercept, "logger")) configs.unshift(intercept["logger"]);
|
|
2431
|
+
intercept = Object.getPrototypeOf(intercept);
|
|
2423
2432
|
}
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2433
|
+
return Object.assign({}, ...configs);
|
|
2434
|
+
}
|
|
2435
|
+
[symbols.invoke](name) {
|
|
2436
|
+
const config = this._resolveConfig();
|
|
2437
|
+
const fiber = (this[symbols.caller] ?? this.ctx).fiber;
|
|
2438
|
+
name ??= config.name;
|
|
2439
|
+
name ??= hyphenate(fiber.name);
|
|
2440
|
+
return new Logger({
|
|
2441
|
+
name,
|
|
2442
|
+
level: config.level,
|
|
2443
|
+
meta: { fiber: new WeakRef(fiber) }
|
|
2444
|
+
}, this);
|
|
2445
|
+
}
|
|
2446
|
+
static {
|
|
2447
|
+
for (const type of [
|
|
2448
|
+
"error",
|
|
2449
|
+
"info",
|
|
2450
|
+
"warn",
|
|
2451
|
+
"debug"
|
|
2452
|
+
]) LoggerService.prototype[type] = function(...args) {
|
|
2453
|
+
return this()[type](...args);
|
|
2454
|
+
};
|
|
2430
2455
|
}
|
|
2431
2456
|
};
|
|
2432
2457
|
//#endregion
|
|
@@ -2458,12 +2483,14 @@ var ReflectService = class {
|
|
|
2458
2483
|
try {
|
|
2459
2484
|
const def = target.reflect.props[prop];
|
|
2460
2485
|
if (def?.type === "accessor") return def.get.call(ctx, ctx[symbols.receiver], error);
|
|
2461
|
-
|
|
2486
|
+
const defSite = ctx[symbols.shadow] ?? ctx;
|
|
2487
|
+
if (!defSite.fiber.runtime) return ctx.reflect.get(prop, false);
|
|
2462
2488
|
return ctx.events.waterfall("internal/get", ctx, prop, error, () => {
|
|
2463
|
-
const key =
|
|
2464
|
-
let fiber =
|
|
2489
|
+
const key = defSite[symbols.isolate][prop];
|
|
2490
|
+
let fiber = defSite.fiber;
|
|
2465
2491
|
while (true) {
|
|
2466
|
-
|
|
2492
|
+
let impl = fiber.committed?.[prop];
|
|
2493
|
+
for (const provision of fiber.provisions) if (provision.name === prop && provision.ctx[symbols.isolate][prop] === key) impl = provision;
|
|
2467
2494
|
if (impl) return getTraceable(ctx, impl.value);
|
|
2468
2495
|
if (prop in fiber.inject) {
|
|
2469
2496
|
error.message = `cannot get required service "${prop}" in inactive context`;
|
|
@@ -2508,6 +2535,7 @@ var ReflectService = class {
|
|
|
2508
2535
|
store = Object.create(null);
|
|
2509
2536
|
/** Declared context properties (services and accessors), by name. */
|
|
2510
2537
|
props = Object.create(null);
|
|
2538
|
+
_implCounter = 0;
|
|
2511
2539
|
constructor(ctx) {
|
|
2512
2540
|
this.ctx = ctx;
|
|
2513
2541
|
defineProperty(this, symbols.tracker, {
|
|
@@ -2548,7 +2576,7 @@ var ReflectService = class {
|
|
|
2548
2576
|
const key = this.ctx[symbols.isolate][name];
|
|
2549
2577
|
const impl = key && this.store[key];
|
|
2550
2578
|
if (!impl) return;
|
|
2551
|
-
if (strict && impl.fiber.state !== 2) return;
|
|
2579
|
+
if (strict && impl.ctx.fiber.state !== 2) return;
|
|
2552
2580
|
return impl;
|
|
2553
2581
|
}
|
|
2554
2582
|
/**
|
|
@@ -2564,7 +2592,7 @@ var ReflectService = class {
|
|
|
2564
2592
|
const key = this.ctx[symbols.isolate][name];
|
|
2565
2593
|
const impl = this.store[key];
|
|
2566
2594
|
if (!impl) throw new Error(`cannot set property "${name}" without provide`);
|
|
2567
|
-
if (impl.fiber !== this.ctx.fiber) throw new Error(`cannot set property "${name}" in multiple fibers`);
|
|
2595
|
+
if (impl.ctx.fiber !== this.ctx.fiber) throw new Error(`cannot set property "${name}" in multiple fibers`);
|
|
2568
2596
|
impl.value = value;
|
|
2569
2597
|
return true;
|
|
2570
2598
|
}
|
|
@@ -2586,20 +2614,27 @@ var ReflectService = class {
|
|
|
2586
2614
|
this.ctx.root[symbols.isolate][name] ??= Symbol(name);
|
|
2587
2615
|
const key = this.ctx[symbols.isolate][name];
|
|
2588
2616
|
const impl = {
|
|
2617
|
+
uid: ++this._implCounter,
|
|
2589
2618
|
name,
|
|
2590
2619
|
value,
|
|
2591
|
-
|
|
2592
|
-
check
|
|
2620
|
+
ctx: this.ctx,
|
|
2621
|
+
check,
|
|
2622
|
+
isolate: key,
|
|
2623
|
+
dependents: /* @__PURE__ */ new Set()
|
|
2593
2624
|
};
|
|
2594
|
-
if (this.store[key]) throw new Error(`service "${name}" has been registered at <${this.store[key].fiber.name}>`);
|
|
2625
|
+
if (this.store[key]) throw new Error(`service "${name}" has been registered at <${this.store[key].ctx.fiber.name}>`);
|
|
2595
2626
|
this.store[key] = impl;
|
|
2596
|
-
this.ctx.fiber.
|
|
2627
|
+
this.ctx.fiber.provisions.add(impl);
|
|
2597
2628
|
if (this.ctx.fiber.state === 2) this.notify([name]);
|
|
2598
2629
|
return async () => {
|
|
2599
|
-
delete this.store[
|
|
2600
|
-
|
|
2601
|
-
await Promise
|
|
2602
|
-
|
|
2630
|
+
if (this.store[impl.isolate] === impl) delete this.store[impl.isolate];
|
|
2631
|
+
this.ctx.isolate(name, impl.isolate).reflect.notify([name]);
|
|
2632
|
+
await new Promise((resolve) => {
|
|
2633
|
+
impl.release = resolve;
|
|
2634
|
+
if (!impl.dependents.size) resolve();
|
|
2635
|
+
});
|
|
2636
|
+
impl.release = void 0;
|
|
2637
|
+
this.ctx.fiber.provisions.delete(impl);
|
|
2603
2638
|
};
|
|
2604
2639
|
}, `ctx.provide(${JSON.stringify(name)})`);
|
|
2605
2640
|
}
|
|
@@ -2608,10 +2643,8 @@ var ReflectService = class {
|
|
|
2608
2643
|
*
|
|
2609
2644
|
* @param names — the service names that changed.
|
|
2610
2645
|
* @param filter — restricts notification to matching isolation scopes.
|
|
2611
|
-
* @returns the fibers whose dependency state was refreshed.
|
|
2612
2646
|
*/
|
|
2613
2647
|
notify(names, filter = (ctx, name) => ctx[symbols.isolate][name] === this.ctx[symbols.isolate][name]) {
|
|
2614
|
-
const fibers = [];
|
|
2615
2648
|
for (const runtime of this.ctx.registry.values()) for (const fiber of runtime.fibers) {
|
|
2616
2649
|
let hasUpdate = false;
|
|
2617
2650
|
for (const name of names) {
|
|
@@ -2622,14 +2655,12 @@ var ReflectService = class {
|
|
|
2622
2655
|
}
|
|
2623
2656
|
if (!hasUpdate) continue;
|
|
2624
2657
|
fiber._refresh();
|
|
2625
|
-
fibers.push(fiber);
|
|
2626
2658
|
}
|
|
2627
2659
|
for (const name of names) {
|
|
2628
2660
|
const self = Object.create(this.ctx);
|
|
2629
2661
|
self[symbols.filter] = (target) => filter(target, name);
|
|
2630
2662
|
this.ctx.events.emit(self, "internal/service", name, this._getImpl(name, false)?.value);
|
|
2631
2663
|
}
|
|
2632
|
-
return fibers;
|
|
2633
2664
|
}
|
|
2634
2665
|
/**
|
|
2635
2666
|
* Define a computed context property backed by get/set hooks.
|
|
@@ -7681,7 +7712,6 @@ function fourDigitYearEpoch(value) {
|
|
|
7681
7712
|
epoch
|
|
7682
7713
|
});
|
|
7683
7714
|
}
|
|
7684
|
-
Number.MAX_SAFE_INTEGER;
|
|
7685
7715
|
//#endregion
|
|
7686
7716
|
//#region ../session-format-v0-to-v1/src/validation-helpers.ts
|
|
7687
7717
|
/**
|