@capyclaw/offline-ddr0 1.9.0 → 1.9.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/lib/media.mjs +3 -3
- package/lib/sync.mjs +1 -1
- package/lib/workstore-repository.mjs +1 -1
- package/lib/workstore.mjs +17 -7
- package/node_modules/@capyclaw/asset-service/dsh-suite.json +1 -1
- package/node_modules/@capyclaw/asset-service/package.json +1 -1
- package/node_modules/@capyclaw/asset-service/src/index.mjs +96 -9
- package/node_modules/@capyclaw/foundation/abi/assets.mjs +26 -0
- package/node_modules/@capyclaw/foundation/abi/bridge.mjs +3 -1
- package/node_modules/@capyclaw/foundation/abi/index.mjs +15 -0
- package/node_modules/@capyclaw/foundation/abi/loader.mjs +8 -1
- package/node_modules/@capyclaw/foundation/abi/spec.mjs +5 -2
- package/node_modules/@capyclaw/foundation/abi/version.mjs +63 -5
- package/node_modules/@capyclaw/foundation/abi/visibility.mjs +90 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +21 -4
- package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +11 -10
- package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +8 -1
- package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +5 -1
- package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +5 -2
- package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +4 -0
- package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +29 -2
- package/node_modules/@capyclaw/foundation/lib/kernel.mjs +13 -3
- package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +31 -3
- package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +12 -2
- package/node_modules/@capyclaw/foundation/package.json +1 -1
- package/node_modules/@capyclaw/plugin-kit/package.json +3 -1
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +5 -2
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat.mjs +26 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +3 -82
- package/node_modules/@capyclaw/plugin-kit/src/service/static.mjs +79 -0
- package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +13 -5
- package/node_modules/@capyclaw/service-host/dsh-suite.json +1 -1
- package/node_modules/@capyclaw/service-host/package.json +1 -1
- package/node_modules/@capyclaw/service-host/src/index.mjs +18 -19
- package/node_modules/@capyclaw/suite-kit/README.md +52 -1
- package/node_modules/@capyclaw/suite-kit/package.json +6 -2
- package/node_modules/@capyclaw/suite-kit/src/host.mjs +230 -0
- package/node_modules/@capyclaw/suite-kit/src/index.mjs +14 -0
- package/node_modules/@capyclaw/suite-kit/suite.schema.json +16 -0
- package/node_modules/@capyclaw/work-store/STANDARD.md +9 -3
- package/node_modules/@capyclaw/work-store/dsh-suite.json +10 -3
- package/node_modules/@capyclaw/work-store/package.json +1 -1
- package/node_modules/@capyclaw/work-store/src/backend.mjs +3 -2
- package/node_modules/@capyclaw/work-store/src/index.mjs +16 -15
- package/package.json +1 -1
- package/plugin.mjs +13 -5
package/plugin.mjs
CHANGED
|
@@ -50,6 +50,11 @@ function resolveConfig(config = {}) {
|
|
|
50
50
|
// env DSH_OFFLINE_DDR0_STORAGE 可覆盖;非法值回落 workstore 并告警在装配处。
|
|
51
51
|
const raw = String(config.storage || process.env.DSH_OFFLINE_DDR0_STORAGE || 'workstore').toLowerCase()
|
|
52
52
|
const storage = raw === 'json' ? 'json' : 'workstore'
|
|
53
|
+
// standalone:显式声明离线单装(无宿主 workStore 服务)才允许画廊桥自开单实例(V2-1)。
|
|
54
|
+
// 缺省 false=宿主内,一律消费注入的共享服务;服务缺席时降级为空,不私开第二实例。
|
|
55
|
+
// env DSH_OFFLINE_DDR0_STANDALONE=1/true/yes 可覆盖。
|
|
56
|
+
const standalone = config.standalone === true
|
|
57
|
+
|| /^(1|true|yes)$/i.test(String(process.env.DSH_OFFLINE_DDR0_STANDALONE || ''))
|
|
53
58
|
// 主站同步(手动触发,离线优先):源站直连参数 + 可选会话令牌。
|
|
54
59
|
const syncCfg = (config && typeof config.sync === 'object' && config.sync) || {}
|
|
55
60
|
const sync = {
|
|
@@ -64,6 +69,7 @@ function resolveConfig(config = {}) {
|
|
|
64
69
|
).replace(/\/+$/, ''),
|
|
65
70
|
sitePath: String(config.sitePath || DEFAULT_SITE_PATH).replace(/\/+$/, ''),
|
|
66
71
|
storage,
|
|
72
|
+
standalone,
|
|
67
73
|
sync,
|
|
68
74
|
}
|
|
69
75
|
}
|
|
@@ -139,12 +145,12 @@ export const { name, inject, apply } = createPlugin({
|
|
|
139
145
|
const mirrorIndex = createMirrorIndex(mirrorDir, { log })
|
|
140
146
|
// 本地作品库(其它会话投递的内容)持久化在 profile plugin-data。
|
|
141
147
|
// 装配层只面向 LocalWorkRepository 契约(lib/repository.mjs),JSON↔work-store 切换零改路由。
|
|
142
|
-
const { storage } = resolveConfig(config)
|
|
148
|
+
const { storage, standalone } = resolveConfig(config)
|
|
143
149
|
const storeDir = resolveStoreDir()
|
|
144
|
-
// work-store 公共服务(
|
|
150
|
+
// work-store 公共服务(workStore):跨隔离安全探测;不在场给 null。
|
|
145
151
|
let workStoreService = null
|
|
146
152
|
try { workStoreService = (typeof service === 'function' && service('workStore')) || null } catch { /* 服务不在场 */ }
|
|
147
|
-
// asset-service 公共服务(
|
|
153
|
+
// asset-service 公共服务(assets):媒体仓优先接共享池/共享工厂;不在场给 null(私有仓兜底)。
|
|
148
154
|
let assetsService = null
|
|
149
155
|
try { assetsService = (typeof service === 'function' && service('assets')) || null } catch { /* 服务不在场 */ }
|
|
150
156
|
|
|
@@ -159,13 +165,15 @@ export const { name, inject, apply } = createPlugin({
|
|
|
159
165
|
// 装配决策(迁移/降级/回滚)在 lib/repository.mjs,可独立单测。
|
|
160
166
|
const { repo } = resolveLocalRepository({ storage, workStoreService, dir: storeDir, log })
|
|
161
167
|
// 本地 work-store(SQLite)作品源:只读、免登录,把 PPT 等本地生成物按 ddr0
|
|
162
|
-
//
|
|
168
|
+
// 作品契约并进画廊。宿主内注入共享服务(不自开句柄、不负责 close,V2-1);
|
|
169
|
+
// 服务缺席时降级为空,仅显式 standalone(离线单装)才自开只读单实例。
|
|
163
170
|
const wsSource = createWorkStoreSource({
|
|
164
171
|
dir: repo.dir,
|
|
165
172
|
mirrorDir,
|
|
166
173
|
log,
|
|
167
174
|
index: mirrorIndex,
|
|
168
175
|
store: workStoreService || undefined,
|
|
176
|
+
standalone,
|
|
169
177
|
})
|
|
170
178
|
const mirror = createMirror(mirrorDir, {
|
|
171
179
|
log,
|
|
@@ -179,7 +187,7 @@ export const { name, inject, apply } = createPlugin({
|
|
|
179
187
|
|
|
180
188
|
// 本地媒体资产仓(内容寻址,sha256 去重):同步时把外部/源站媒体物化进来,
|
|
181
189
|
// 本地直出路由先于 mirror——外部源失效不影响离线放映。两种存储模式都可用。
|
|
182
|
-
// 套件化复用公共基建:优先共享
|
|
190
|
+
// 套件化复用公共基建:优先共享 assets 服务(store/工厂),无服务时私有仓兜底(离线优先)。
|
|
183
191
|
const mediaStore = resolveMediaStore({ assets: assetsService, dir: path.join(storeDir, 'media-assets'), log })
|
|
184
192
|
const mediaHandler = createMediaHandler({ store: mediaStore, log })
|
|
185
193
|
|