@carljia/omd-dsh 0.1.5 → 0.1.7

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 CHANGED
@@ -1,6 +1,10 @@
1
1
  # @carljia/omd-dsh
2
2
 
3
- OMD 理念的 DSH 插件:两个 cordis 行 + 7 个模式 preset + 同步 CLI。总览、模式矩阵与安装见仓库根 [README.md](../../README.md)。
3
+ OMD 理念的 DSH 插件:两个 cordis 行 + 7 个模式 preset + 同步 CLI。以 `dsh.bundle` 形式分发——`dsh plugin add @carljia/omd-dsh` 安装后重启即自动同步预设;也可全局安装后用 `omd-dsh sync`。总览、模式矩阵与安装见仓库根 [README.md](../../README.md)。
4
+
5
+ ## 分发:bundle + boot 行
6
+
7
+ 包声明 `dsh.bundle.patch` → `cordis.patch.yml`,后者注入宿主行 `@carljia/omd-dsh/boot`。该行在 profile 启动时执行与 `omd-dsh sync` 相同的内核(`lib/sync.js`):定位 harness、渲染并复制 7 个 preset 与 `.omd-vendor/` 行模块、把行模块的 `@deepseek-ai/*` 导入改写为 harness 树的 `file://` URL、首次生成 `omd-matrix.json`。全程幂等、hash 保护、不覆盖本地修改。
4
8
 
5
9
  ## 行:omd-mode
6
10
 
@@ -0,0 +1,10 @@
1
+ # omd-dsh bundle patch: inject the boot row that, on startup, materializes
2
+ # the 7 OMD agent presets into the user preset root (<DSH_HOME>/.agent-presets).
3
+ #
4
+ # The boot row (lib/boot.js) resolves the harness tree, copies the presets and
5
+ # the vendored row modules, rewrites their @deepseek-ai/* imports to the harness,
6
+ # and generates the model matrix on first run — idempotently. Install with:
7
+ # dsh plugin --profile web add @carljia/omd-dsh # then restart dsh.
8
+ - insert:
9
+ - id: omd-dsh
10
+ name: '@carljia/omd-dsh/boot'
package/lib/boot.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @module @carljia/omd-dsh/boot
3
+ *
4
+ * omd-dsh bundle boot row: materialize the 7 OMD agent presets into the user
5
+ * preset root (<DSH_HOME>/.agent-presets) when the profile boots, so
6
+ * "dsh plugin add @carljia/omd-dsh" + a restart is the whole install — no
7
+ * manual "omd-dsh sync" needed.
8
+ *
9
+ * The sync is idempotent (hash-aware, conflict-protected) and reuses the same
10
+ * core as the "omd-dsh sync" CLI. The harness node_modules is located from
11
+ * this module's own resolution path first (the profile exposes the harness
12
+ * tree via its flat module fallback), then through the CLI's detection chain.
13
+ *
14
+ * A sync failure is logged, not thrown: a broken omd-dsh should never brick
15
+ * the host's boot.
16
+ */
17
+ /** Cordis plugin name used by loader diagnostics. */
18
+ export declare const name = "omd-dsh";
19
+ /** No service injection: this row only runs its idempotent install at mount. */
20
+ export declare const inject: string[];
21
+ export declare function apply(ctx: any): Promise<void>;
package/lib/boot.js ADDED
@@ -0,0 +1,45 @@
1
+ import { runSync, resolveHarnessFromSelf, resolveHarness } from "./sync.js";
2
+ /**
3
+ * @module @carljia/omd-dsh/boot
4
+ *
5
+ * omd-dsh bundle boot row: materialize the 7 OMD agent presets into the user
6
+ * preset root (<DSH_HOME>/.agent-presets) when the profile boots, so
7
+ * "dsh plugin add @carljia/omd-dsh" + a restart is the whole install — no
8
+ * manual "omd-dsh sync" needed.
9
+ *
10
+ * The sync is idempotent (hash-aware, conflict-protected) and reuses the same
11
+ * core as the "omd-dsh sync" CLI. The harness node_modules is located from
12
+ * this module's own resolution path first (the profile exposes the harness
13
+ * tree via its flat module fallback), then through the CLI's detection chain.
14
+ *
15
+ * A sync failure is logged, not thrown: a broken omd-dsh should never brick
16
+ * the host's boot.
17
+ */
18
+ /** Cordis plugin name used by loader diagnostics. */
19
+ export const name = "omd-dsh";
20
+ /** No service injection: this row only runs its idempotent install at mount. */
21
+ export const inject = [];
22
+ function log(ctx, level, message) {
23
+ try {
24
+ const logger = ctx?.logger;
25
+ if (logger !== undefined && logger !== null) {
26
+ logger[level](message);
27
+ return;
28
+ }
29
+ }
30
+ catch { /* fall through to console */ }
31
+ (level === "error" ? console.error : console.log)(message);
32
+ }
33
+ export async function apply(ctx) {
34
+ try {
35
+ const harness = resolveHarnessFromSelf() ?? resolveHarness({ harness: undefined, dryRun: false, verbose: false });
36
+ if (harness === undefined) {
37
+ log(ctx, "error", "omd-dsh: cannot locate the DSH harness node_modules — presets were not synced. Run `omd-dsh sync --harness <path>` once to point it at the harness, then restart.");
38
+ return;
39
+ }
40
+ await runSync({ harness: undefined, dryRun: false, verbose: false }, harness, (message) => log(ctx, "info", message));
41
+ }
42
+ catch (error) {
43
+ log(ctx, "error", "omd-dsh: preset sync failed: " + (error instanceof Error ? error.message : String(error)));
44
+ }
45
+ }