@chatcode/chatcode-cli 3.0.2 → 3.0.4-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +10 -10
- package/README.md +26 -1
- package/README.zh.md +26 -1
- package/lib/bin.js +70 -75
- package/lib/{command-errors-CIYn1nnW.js → command-errors-BkCHTQHj.js} +12 -12
- package/lib/{command-trees-8o99Bws7.js → command-trees-5HFyC5sI.js} +2 -2
- package/lib/{component-identity-CnmIKHEF.js → component-identity-De91VHwW.js} +3 -3
- package/lib/{dist-DxjlHHph.js → dist-CsDWUvQ4.js} +238 -232
- package/lib/dsh-ecosystem-spec/protocols/profile-definitions.d.ts +13 -0
- package/lib/dsh-ecosystem-spec/protocols/profile-definitions.js +59 -0
- package/lib/dsh-ecosystem-spec/protocols/tui-channel-http.d.ts +15 -0
- package/lib/dsh-ecosystem-spec/protocols/tui-channel-http.js +32 -0
- package/lib/dsh-ecosystem-spec/protocols/tui-channel.d.ts +59 -0
- package/lib/dsh-ecosystem-spec/protocols/tui-channel.js +166 -0
- package/lib/dsh-ecosystem-spec/protocols/tui-contributions.d.ts +42 -0
- package/lib/dsh-ecosystem-spec/protocols/tui-contributions.js +143 -0
- package/lib/dsh-ecosystem-spec/registry/README.md +14 -0
- package/lib/dsh-ecosystem-spec/registry/contracts/decision-events-v1alpha1.json +13 -0
- package/lib/dsh-ecosystem-spec/registry/contracts/scene-v1alpha1.json +13 -0
- package/lib/dsh-ecosystem-spec/registry/contracts/settings-section-v1alpha1.json +13 -0
- package/lib/dsh-ecosystem-spec/registry/contracts/tui-channel-v1alpha1.json +30 -0
- package/lib/dsh-ecosystem-spec/registry/contracts/workspace-provider-v1alpha1.json +6 -0
- package/lib/dsh-ecosystem-spec/registry/host-descriptor.tui.example.json +56 -0
- package/lib/dsh-ecosystem-spec/registry/permissions-0.1.json +13 -0
- package/lib/dsh-ecosystem-spec/registry/registry-0.15.json +149 -0
- package/lib/dsh-ecosystem-spec/schemas/conformance-claim.schema.json +15 -0
- package/lib/dsh-ecosystem-spec/schemas/effect-ledger-record.schema.json +16 -0
- package/lib/dsh-ecosystem-spec/schemas/host-descriptor.schema.json +26 -0
- package/lib/{dump-config-BSTrhTT_.js → dump-config-BcH-VYuv.js} +5 -5
- package/lib/dump-config-CyopmD85.js +2 -0
- package/lib/{dump-config-schema-Cz4A13GB.js → dump-config-schema-DM0fb6Ns.js} +2 -2
- package/lib/{extension-events-DciGPKJa.js → extension-events-CdYCRP0o.js} +26 -26
- package/lib/{frames-7PAg0Q9b.js → frames-DOX-Jgk8.js} +4 -4
- package/lib/headless-compat.js +2 -2
- package/lib/{home-migration-DLaSvmfn.js → home-migration-BjDmRwBB.js} +23 -4
- package/lib/{host-access-CmD27uhQ.js → host-access-Bk4xps5E.js} +1 -1
- package/lib/{keymap-CFChEJ2W.js → keymap-CJ1kvLR2.js} +17 -16
- package/lib/{plugin-jvd9PCVt.js → plugin-XR7ncbnW.js} +3767 -2331
- package/lib/{plugin-DYHtreEd.js → plugin-eJjD6r12.js} +1 -1
- package/lib/{profile-boot-Blq7uqhx.js → profile-boot-BNQry1NM.js} +109 -14
- package/lib/profile-boot.js +2 -2
- package/lib/{scenes-ai_8sHDs.js → scenes-CAmWncZD.js} +3 -3
- package/lib/{settings-sections-QQ1-2lhL.js → settings-sections-CakcvBv9.js} +7 -3
- package/lib/startup-diagnostics-C_hRCp-q.js +91 -0
- package/lib/statusBarSettings-BPPS_Usm.js +382 -0
- package/lib/{supports-color-CcW-FGjr.js → supports-color-DyChQwlI.js} +2 -2
- package/lib/{themes-DTzG_9I_.js → themes-OjcUpZzw.js} +13 -13
- package/lib/tui-compat-command-trees.js +1 -1
- package/lib/tui-compat-extensions.js +4 -4
- package/lib/tui-compat-plugin-host.js +5 -5
- package/lib/tui-compat-scenes.js +1 -1
- package/lib/tui-compat-settings-sections.js +1 -1
- package/lib/tui-compat-working-activity.js +4 -4
- package/lib/tui-compat-workspaces.js +1 -1
- package/lib/tui-compat.js +44 -29
- package/lib/types/args.d.ts +2 -0
- package/lib/types/home-migration.d.ts +8 -0
- package/lib/types/permission-bypass.d.ts +16 -0
- package/lib/types/profile-boot.d.ts +12 -0
- package/lib/types/startup-diagnostics.d.ts +13 -0
- package/lib/types/tui-compat.d.ts +6 -0
- package/lib/types/web-browser.d.ts +6 -0
- package/lib/types/web-instance.d.ts +42 -0
- package/lib/web-browser-Vcgfdsv_.js +46 -0
- package/lib/web-instance-B0jec7cq.js +2 -0
- package/lib/web-instance-DbP7IHPv.js +280 -0
- package/lib/{workspaces-CznCgVHv.js → workspaces-XY7UdfXp.js} +2 -2
- package/package.json +40 -32
- package/runtime/manifest.json +4 -6
- package/runtime/node_modules/@deepseek-ai/dsh-agent-default-model/lib/index.js +34 -4
- package/runtime/node_modules/@deepseek-ai/dsh-agent-default-model/lib/types/index.d.ts +9 -0
- package/runtime/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-composition-reference/references/packages.md +2 -1
- package/runtime/node_modules/@deepseek-ai/dsh-api-gateway/lib/client.js +2 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/client/remote-stream.js +4 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-remotes/lib/client.js +39 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/index.js +6 -1
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.host.js +10 -3
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.remote-client.js +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/catalog.js +8 -1
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/types.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/index.js +28 -1
- package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/typert.host.js +39 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/typert.remote-client.d.ts +2 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/typert.remote-client.js +32 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/types/index.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/types/index.js +19 -1
- package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/index.js +28 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/feed.js +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/index.js +67 -19
- package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/types/index.d.ts +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/types/profile-context.d.ts +11 -1
- package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/worker/profile-resolution-bootstrap.js +22 -3
- package/runtime/node_modules/@deepseek-ai/dsh-base/cordis.patch.yml +9 -3
- package/runtime/node_modules/@deepseek-ai/dsh-base/package.json +2 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/client.js +3 -2
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/index.d.ts +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/client.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +60 -12
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/types/client/directory.d.ts +3 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/types/client/locales.d.ts +6 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/markdown/CodeBlock.module.css +3 -5
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/markdown/MarkdownText.module.css +23 -27
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings/lib/types/client/contract/slots.d.ts +3 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/client.js +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/types/index.d.ts +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +8 -7
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/types/client/SettingsDocumentAction.d.ts +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/types/client/settings-document-store.d.ts +2 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +33 -12
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/types/client/locales.d.ts +2 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/lib/client.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +8 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/locales.d.ts +2 -0
- package/runtime/node_modules/@deepseek-ai/dsh-compaction-basic/lib/index.js +84 -8
- package/runtime/node_modules/@deepseek-ai/dsh-compaction-basic/lib/types/region.d.ts +9 -0
- package/runtime/node_modules/@deepseek-ai/dsh-compaction-basic/lib/types/summarizer.d.ts +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/index.js +35 -0
- package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/brand.d.ts +11 -0
- package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/brand.js +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/index.d.ts +28 -0
- package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/index.js +36 -0
- package/runtime/node_modules/@deepseek-ai/dsh-computer-use/package.json +42 -0
- package/runtime/node_modules/@deepseek-ai/dsh-config-editor/lib/index.js +102 -14
- package/runtime/node_modules/@deepseek-ai/dsh-config-editor/lib/types/index.d.ts +34 -4
- package/runtime/node_modules/@deepseek-ai/dsh-config-editor/package.json +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-host-webserver/lib/index.js +2 -1
- package/runtime/node_modules/@deepseek-ai/dsh-native-command/lib/index.js +21 -8
- package/runtime/node_modules/@deepseek-ai/dsh-native-command/lib/types/path-opener.d.ts +4 -6
- package/runtime/node_modules/@deepseek-ai/dsh-native-command/lib/types/path-opener.js +18 -7
- package/runtime/node_modules/@deepseek-ai/dsh-session-log-export/lib/client.js +3 -8
- package/runtime/node_modules/@deepseek-ai/dsh-session-log-export/lib/types/client/HeaderAction.d.ts +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-settings/lib/index.js +5 -4
- package/runtime/node_modules/@deepseek-ai/dsh-settings/lib/types/index.d.ts +4 -3
- package/runtime/node_modules/@deepseek-ai/dsh-settings/lib/types/index.js +4 -3
- package/runtime/node_modules/@deepseek-ai/dsh-skill/lib/types/index.d.ts +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-skill-filesystem/lib/index.js +7 -1
- package/runtime/node_modules/@deepseek-ai/dsh-storage/lib/types/backend.d.ts +4 -0
- package/runtime/node_modules/@deepseek-ai/dsh-storage-domain/lib/index.js +60 -0
- package/runtime/node_modules/@deepseek-ai/dsh-storage-domain/lib/types/domain.d.ts +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-storage-json/lib/index.js +25 -0
- package/runtime/node_modules/@deepseek-ai/dsh-storage-json/package.json +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/index.js +5472 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/command-args.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/commands/tianti/cicd.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/commands/tianti/tianti.d.ts +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/commands/tianti-deliver/tianti-deliver.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/config.d.ts +27 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/index.d.ts +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/memory-config.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/runtime.d.ts +105 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/aliases.d.ts +11 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/auth.d.ts +20 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/client.d.ts +206 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/config.d.ts +20 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/index.d.ts +6 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/log.d.ts +16 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/types.d.ts +136 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/codebase.d.ts +19 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/dynamicWorkflow.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/engine.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/executor.d.ts +11 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/executors.d.ts +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/index.d.ts +23 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/memorySuggestions.d.ts +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/openspec.d.ts +31 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/recommend.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/render.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/requirementContext.d.ts +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/scenarioUpgrade.d.ts +24 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/state.d.ts +16 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/store.d.ts +33 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/templates.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/types.d.ts +385 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/writeReviewSync.d.ts +6 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/writeReview/index.d.ts +29 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/writeReview/store.d.ts +20 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/writeReview/types.d.ts +49 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/tools.d.ts +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tianti/package.json +55 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/api-catalog.js +57 -13
- package/runtime/node_modules/@deepseek-ai/dsh-web-app/presets/cordis.patch.yml +2 -1
- package/runtime/node_modules/@deepseek-ai/dsh-web-app/presets/ptc.patch.yml +2 -1
- package/runtime/node_modules/@deepseek-ai/dsh-web-app/presets/standard.patch.yml +2 -1
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-D5kpKf--.css +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Dz_cDcce.js +133 -0
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Dz_cDcce.js.map +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/chatcode-apple-touch-icon.png +0 -0
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/chatcode-icon-32.png +0 -0
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/chatcode-mask-icon.svg +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/favicon-dark.svg +1 -3
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/favicon.ico +0 -0
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/favicon.svg +1 -3
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/index.html +8 -4
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/preview.html +8 -4
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/package.json +2 -1
- package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/index.js +110 -33
- package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/entity.d.ts +6 -0
- package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/entity.js +23 -17
- package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/index.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/index.js +95 -21
- package/lib/dump-config-DBW7YLx-.js +0 -2
- package/lib/tuiDisplayPrefs-BCHRRcfe.js +0 -162
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-DUvMhLle.css +0 -1
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Q6zc2uHV.js +0 -127
- package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Q6zc2uHV.js.map +0 -1
- package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/README.md +0 -9
- package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/bin/system.node +0 -0
- package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/package.json +0 -31
- package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/prebuilds.json +0 -6
- package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-x64/README.md +0 -9
- package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-x64/package.json +0 -31
- package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-x64/prebuilds.json +0 -6
- package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-arm64/README.md +0 -11
- package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-arm64/package.json +0 -31
- package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-arm64/prebuilds.json +0 -24
- package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-x64/README.md +0 -11
- package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-x64/package.json +0 -31
- package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-x64/prebuilds.json +0 -24
|
@@ -86,6 +86,10 @@ export interface KvUnit {
|
|
|
86
86
|
tables: Record<string, Record<string, unknown>>;
|
|
87
87
|
global: unknown;
|
|
88
88
|
}>;
|
|
89
|
+
/** Reload committed medium state before a domain refresh. Unsupported backends retain their snapshot. */
|
|
90
|
+
refresh?(): Promise<void>;
|
|
91
|
+
/** Hold a cross-process writer lock across a complete logical operation, including all its writes. */
|
|
92
|
+
exclusive?<T>(operation: () => Promise<T>): Promise<T>;
|
|
89
93
|
/**
|
|
90
94
|
* Read one record without loading other records. Backends without keyed
|
|
91
95
|
* reads omit this member; on-demand domains require it.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
2
|
import { UNIT_NAME_RE, storageBackendServiceKey } from "@deepseek-ai/dsh-storage";
|
|
3
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
+
import { isDeepStrictEqual } from "node:util";
|
|
3
5
|
//#region lib/types/error.js
|
|
4
6
|
/**
|
|
5
7
|
* Error vocabulary of the domain data form.
|
|
@@ -109,6 +111,7 @@ const noop = () => {};
|
|
|
109
111
|
*/
|
|
110
112
|
var DomainImpl = class {
|
|
111
113
|
ctx;
|
|
114
|
+
spec;
|
|
112
115
|
unit;
|
|
113
116
|
onClosed;
|
|
114
117
|
/** Domain name from the spec. */
|
|
@@ -123,6 +126,7 @@ var DomainImpl = class {
|
|
|
123
126
|
/** Set when close finishes (chain drained, unit closed): reads reject from here on. */
|
|
124
127
|
closed = false;
|
|
125
128
|
disposal;
|
|
129
|
+
operationScope = new AsyncLocalStorage();
|
|
126
130
|
/**
|
|
127
131
|
* @param ctx - Context that carries `domain/changed` emissions.
|
|
128
132
|
* @param spec - The domain declaration.
|
|
@@ -138,6 +142,7 @@ var DomainImpl = class {
|
|
|
138
142
|
*/
|
|
139
143
|
constructor(ctx, spec, unit, records, globalValue, onClosed, readStored) {
|
|
140
144
|
this.ctx = ctx;
|
|
145
|
+
this.spec = spec;
|
|
141
146
|
this.unit = unit;
|
|
142
147
|
this.onClosed = onClosed;
|
|
143
148
|
this.name = spec.name;
|
|
@@ -191,6 +196,53 @@ var DomainImpl = class {
|
|
|
191
196
|
if (table === void 0) throw new Error(`domain '${this.name}' declares no table '${name}'`);
|
|
192
197
|
return table;
|
|
193
198
|
}
|
|
199
|
+
/** Reload eager records atomically in memory; a malformed record leaves the previous projection untouched.
|
|
200
|
+
* @returns Whether persisted records or global values changed the in-memory projection.
|
|
201
|
+
*/
|
|
202
|
+
refresh() {
|
|
203
|
+
return this.enqueue(async () => {
|
|
204
|
+
await this.unit.refresh?.();
|
|
205
|
+
const snapshot = await this.unit.loadAll();
|
|
206
|
+
const records = /* @__PURE__ */ new Map();
|
|
207
|
+
let global;
|
|
208
|
+
try {
|
|
209
|
+
for (const [name, tableSpec] of Object.entries(this.spec.tables)) {
|
|
210
|
+
const parsed = /* @__PURE__ */ new Map();
|
|
211
|
+
for (const [key, raw] of Object.entries(snapshot.tables[name] ?? {})) parsed.set(key, tableSpec.valueSchema.parse(raw));
|
|
212
|
+
records.set(name, parsed);
|
|
213
|
+
}
|
|
214
|
+
global = this.spec.global === void 0 ? void 0 : snapshot.global === null ? this.spec.global.initial : this.spec.global.schema.parse(snapshot.global);
|
|
215
|
+
} catch (error) {
|
|
216
|
+
throw new DomainError("invalid-record", `domain '${this.name}': refreshed snapshot failed validation`, { cause: error });
|
|
217
|
+
}
|
|
218
|
+
let changed = !isDeepStrictEqual(this.globalValue, global);
|
|
219
|
+
for (const [name, next] of records) {
|
|
220
|
+
const table = this.tables.get(name);
|
|
221
|
+
if (table === void 0) throw new Error(`domain '${this.name}' declares no table '${name}'`);
|
|
222
|
+
changed = table.replace(next) || changed;
|
|
223
|
+
}
|
|
224
|
+
this.globalValue = global;
|
|
225
|
+
return changed;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/** Nested table/global operations run on this queue slot, not behind their own awaiting parent.
|
|
229
|
+
* @param operation Work executed under the domain queue and backend writer lock.
|
|
230
|
+
* @returns The operation result after the locked work settles.
|
|
231
|
+
*/
|
|
232
|
+
exclusive(operation) {
|
|
233
|
+
if (this.operationScope.getStore()?.active) return operation();
|
|
234
|
+
return this.enqueue(async () => {
|
|
235
|
+
const run = async () => {
|
|
236
|
+
const scope = { active: true };
|
|
237
|
+
try {
|
|
238
|
+
return await this.operationScope.run(scope, operation);
|
|
239
|
+
} finally {
|
|
240
|
+
scope.active = false;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
return await (this.unit.exclusive === void 0 ? run() : this.unit.exclusive(run));
|
|
244
|
+
});
|
|
245
|
+
}
|
|
194
246
|
/**
|
|
195
247
|
* Close this domain: reject new writes immediately, drain already-queued
|
|
196
248
|
* writes (their events still emit), close the unit, then free the name via
|
|
@@ -221,6 +273,7 @@ var DomainImpl = class {
|
|
|
221
273
|
}
|
|
222
274
|
}
|
|
223
275
|
enqueue(job) {
|
|
276
|
+
if (this.operationScope.getStore()?.active) return job();
|
|
224
277
|
if (this.disposing) return Promise.reject(new DomainError("closed", `domain '${this.name}' is closed`));
|
|
225
278
|
const result = this.chain.then(job);
|
|
226
279
|
this.chain = result.then(noop, noop);
|
|
@@ -241,6 +294,13 @@ var KvTableImpl = class {
|
|
|
241
294
|
this.tableName = tableName;
|
|
242
295
|
this.records = records;
|
|
243
296
|
}
|
|
297
|
+
replace(next) {
|
|
298
|
+
if (isDeepStrictEqual(this.records, next)) return false;
|
|
299
|
+
this.records.clear();
|
|
300
|
+
for (const [key, value] of next) this.records.set(key, value);
|
|
301
|
+
this.loaded.clear();
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
244
304
|
read(key) {
|
|
245
305
|
return this.host.enqueue(async () => {
|
|
246
306
|
if (this.host.readStored !== void 0 && !this.loaded.has(key)) {
|
|
@@ -94,6 +94,10 @@ export interface Domain<S extends DomainSpec> {
|
|
|
94
94
|
readonly name: string;
|
|
95
95
|
/** Global singleton handle; a spec without `global` has no usable handle (`never`). */
|
|
96
96
|
readonly global: DomainGlobalHandleOf<S>;
|
|
97
|
+
/** Reload and validate the complete medium snapshot. No events emit; the owner publishes its refreshed projection. */
|
|
98
|
+
refresh(): Promise<boolean>;
|
|
99
|
+
/** Serialize a logical operation locally and, where supported, across processes. Refresh inside the operation before writing. */
|
|
100
|
+
exclusive<T>(operation: () => Promise<T>): Promise<T>;
|
|
97
101
|
/**
|
|
98
102
|
* Resolve one declared table handle. Handles are stable — repeated calls
|
|
99
103
|
* return the same instance.
|
|
@@ -135,6 +139,7 @@ export interface RecordDomain<S extends DomainSpec> {
|
|
|
135
139
|
*/
|
|
136
140
|
export declare class DomainImpl {
|
|
137
141
|
private readonly ctx;
|
|
142
|
+
private readonly spec;
|
|
138
143
|
private readonly unit;
|
|
139
144
|
private readonly onClosed;
|
|
140
145
|
/** Domain name from the spec. */
|
|
@@ -149,6 +154,7 @@ export declare class DomainImpl {
|
|
|
149
154
|
/** Set when close finishes (chain drained, unit closed): reads reject from here on. */
|
|
150
155
|
private closed;
|
|
151
156
|
private disposal?;
|
|
157
|
+
private readonly operationScope;
|
|
152
158
|
/**
|
|
153
159
|
* @param ctx - Context that carries `domain/changed` emissions.
|
|
154
160
|
* @param spec - The domain declaration.
|
|
@@ -172,6 +178,15 @@ export declare class DomainImpl {
|
|
|
172
178
|
* @returns the stable table handle.
|
|
173
179
|
*/
|
|
174
180
|
table(name: string): KvTable<string, unknown>;
|
|
181
|
+
/** Reload eager records atomically in memory; a malformed record leaves the previous projection untouched.
|
|
182
|
+
* @returns Whether persisted records or global values changed the in-memory projection.
|
|
183
|
+
*/
|
|
184
|
+
refresh(): Promise<boolean>;
|
|
185
|
+
/** Nested table/global operations run on this queue slot, not behind their own awaiting parent.
|
|
186
|
+
* @param operation Work executed under the domain queue and backend writer lock.
|
|
187
|
+
* @returns The operation result after the locked work settles.
|
|
188
|
+
*/
|
|
189
|
+
exclusive<T>(operation: () => Promise<T>): Promise<T>;
|
|
175
190
|
/**
|
|
176
191
|
* Close this domain: reject new writes immediately, drain already-queued
|
|
177
192
|
* writes (their events still emit), close the unit, then free the name via
|
|
@@ -3,6 +3,7 @@ import z from "@deepseek-ai/schemastery";
|
|
|
3
3
|
import { StorageError, UNIT_NAME_RE, storageBackendServiceKey } from "@deepseek-ai/dsh-storage";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
|
+
import { withFileLock } from "@deepseek-ai/dsh-atomic-write";
|
|
6
7
|
//#region lib/types/atomic.js
|
|
7
8
|
/**
|
|
8
9
|
* Atomic whole-file replacement for the JSON backend.
|
|
@@ -203,6 +204,30 @@ var SingleJsonUnit = class {
|
|
|
203
204
|
this.state = state;
|
|
204
205
|
this.onClose = onClose;
|
|
205
206
|
}
|
|
207
|
+
async refresh() {
|
|
208
|
+
this.assertOpen();
|
|
209
|
+
let text;
|
|
210
|
+
try {
|
|
211
|
+
text = await readFile(this.path, "utf8");
|
|
212
|
+
} catch (error) {
|
|
213
|
+
if (error.code !== "ENOENT") throw error;
|
|
214
|
+
}
|
|
215
|
+
this.state = text === void 0 ? {
|
|
216
|
+
version: this.descriptor.version,
|
|
217
|
+
global: null,
|
|
218
|
+
tables: new Map(this.descriptor.tables.map((table) => [table, /* @__PURE__ */ new Map()]))
|
|
219
|
+
} : parse(text, this.descriptor);
|
|
220
|
+
}
|
|
221
|
+
async exclusive(operation) {
|
|
222
|
+
this.assertOpen();
|
|
223
|
+
const pending = withFileLock(this.path, operation, { waitMs: 1e4 });
|
|
224
|
+
this.inFlight.add(pending);
|
|
225
|
+
try {
|
|
226
|
+
return await pending;
|
|
227
|
+
} finally {
|
|
228
|
+
this.inFlight.delete(pending);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
206
231
|
async loadAll() {
|
|
207
232
|
this.assertOpen();
|
|
208
233
|
const tables = {};
|