docks-kit 0.22.28 → 0.24.0

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.
Files changed (93) hide show
  1. package/AGENTS.md +42 -89
  2. package/README.md +35 -72
  3. package/cli/docs/command-guards.md +233 -197
  4. package/cli/docs/flags.md +17 -65
  5. package/cli/docs/install.md +2 -3
  6. package/cli/docs/omp-context.md +79 -7
  7. package/cli/docs/omp-models.md +27 -12
  8. package/cli/docs/overview.md +7 -18
  9. package/cli/docs/platforms.md +2 -2
  10. package/cli/docs/sync-layers.md +14 -60
  11. package/cli/docs/toolchain.md +12 -81
  12. package/cli/src/argv.ts +0 -12
  13. package/cli/src/argvValidate.ts +3 -54
  14. package/cli/src/commands/docs.ts +3 -15
  15. package/cli/src/commands/omp.ts +1 -1
  16. package/cli/src/commands/scratch.ts +1 -1
  17. package/cli/src/commands/sync.ts +5 -120
  18. package/cli/src/commands/tidy.ts +1 -1
  19. package/cli/src/commands/toolchain.ts +4 -12
  20. package/cli/src/engine-native/DESIGN.md +69 -100
  21. package/cli/src/engine-native/deps.ts +7 -92
  22. package/cli/src/engine-native/engineCtx.ts +9 -103
  23. package/cli/src/engine-native/exec.ts +1 -18
  24. package/cli/src/engine-native/index.ts +6 -8
  25. package/cli/src/engine-native/jq.ts +4 -37
  26. package/cli/src/engine-native/kitDb.ts +21 -37
  27. package/cli/src/engine-native/modes.ts +3 -132
  28. package/cli/src/engine-native/ompFastMode.ts +1 -1
  29. package/cli/src/engine-native/ompOverlay.ts +1 -1
  30. package/cli/src/engine-native/ompRemovals.ts +24 -3
  31. package/cli/src/engine-native/ompSession.ts +67 -0
  32. package/cli/src/engine-native/ompSync.ts +1 -1
  33. package/cli/src/engine-native/os/darwin.ts +0 -4
  34. package/cli/src/engine-native/os/index.ts +1 -2
  35. package/cli/src/engine-native/os/linux.ts +0 -3
  36. package/cli/src/engine-native/os/posix.ts +2 -47
  37. package/cli/src/engine-native/os/types.ts +1 -36
  38. package/cli/src/engine-native/os/windows.ts +0 -50
  39. package/cli/src/engine-native/parseArgs.ts +7 -180
  40. package/cli/src/engine-native/parseHelp.ts +4 -44
  41. package/cli/src/engine-native/scratch.ts +1 -1
  42. package/cli/src/engine-native/services.ts +1 -2
  43. package/cli/src/engine-native/sharedTypes.d.ts +1 -41
  44. package/cli/src/engine-native/syncConcurrency.ts +3 -15
  45. package/cli/src/engine-native/syncDispatch.ts +30 -143
  46. package/cli/src/engine-native/toolchain.ts +6 -45
  47. package/cli/src/engine.ts +0 -75
  48. package/cli/src/generated/sotPayload.ts +14 -43
  49. package/cli/src/main.ts +8 -24
  50. package/cli/src/payload.ts +2 -8
  51. package/cli/tsconfig.json +1 -3
  52. package/package.json +3 -5
  53. package/cli/docs/models.md +0 -58
  54. package/cli/docs/modifiers.md +0 -52
  55. package/cli/docs/plugins.md +0 -70
  56. package/cli/src/checklistPrompt.ts +0 -464
  57. package/cli/src/commands/harnesses.ts +0 -80
  58. package/cli/src/commands/model.ts +0 -68
  59. package/cli/src/commands/models.ts +0 -75
  60. package/cli/src/commands/plugins.ts +0 -35
  61. package/cli/src/commands/skills.ts +0 -40
  62. package/cli/src/commands/status.ts +0 -206
  63. package/cli/src/efforts.ts +0 -89
  64. package/cli/src/engine-native/claudeLsp.ts +0 -301
  65. package/cli/src/engine-native/claudeOptionalPlugins.ts +0 -126
  66. package/cli/src/engine-native/claudePluginPasses.ts +0 -426
  67. package/cli/src/engine-native/claudeRemovals.ts +0 -383
  68. package/cli/src/engine-native/claudeRetired.ts +0 -165
  69. package/cli/src/engine-native/claudeRuntime.ts +0 -157
  70. package/cli/src/engine-native/claudeSettings.ts +0 -201
  71. package/cli/src/engine-native/claudeSettingsModifiers.ts +0 -115
  72. package/cli/src/engine-native/claudeSync.ts +0 -312
  73. package/cli/src/engine-native/codexConfig.ts +0 -214
  74. package/cli/src/engine-native/codexHooks.ts +0 -91
  75. package/cli/src/engine-native/codexPaths.ts +0 -14
  76. package/cli/src/engine-native/codexPlugins.ts +0 -315
  77. package/cli/src/engine-native/codexStatus.ts +0 -25
  78. package/cli/src/engine-native/codexSync.ts +0 -314
  79. package/cli/src/engine-native/codexToml.ts +0 -303
  80. package/cli/src/engine-native/harnesses.ts +0 -138
  81. package/cli/src/engine-native/liveModels.ts +0 -264
  82. package/cli/src/engine-native/models.ts +0 -101
  83. package/cli/src/engine-native/parseModifiers.ts +0 -225
  84. package/cli/src/engine-native/settings.ts +0 -42
  85. package/cli/src/engine-native/skillsInstall.ts +0 -135
  86. package/cli/src/engine-native/skillsLinks.ts +0 -216
  87. package/cli/src/engine-native/skillsManifest.ts +0 -36
  88. package/cli/src/engine-native/skillsPrune.ts +0 -117
  89. package/cli/src/engine-native/skillsRecords.ts +0 -138
  90. package/cli/src/engine-native/skillsSync.ts +0 -57
  91. package/cli/src/engine-native/tomlLines.ts +0 -92
  92. package/cli/src/manifests.ts +0 -145
  93. package/cli/src/terminalCells.ts +0 -191
@@ -1,23 +1,23 @@
1
1
  /**
2
- * EngineNative — the supported sync/model/toolchain engine.
2
+ * EngineNative — the supported sync/toolchain engine.
3
3
  *
4
4
  * Golden suites drive it through main.ts's harness-private `native-raw`
5
5
  * channel, which bypasses effect/cli so tests see the internal argv
6
6
  * vocabulary directly.
7
7
  *
8
- * Split: run context lives in `engineCtx.ts`, scheduling in
9
- * `syncConcurrency.ts`, and pipeline dispatch in `syncDispatch.ts`. This
8
+ * Split: run context lives in `engineCtx.ts`, the bounded runner in
9
+ * `syncConcurrency.ts`, and sync dispatch in `syncDispatch.ts`. This
10
10
  * module keeps the entry routing and re-exports the public surface so
11
11
  * existing import paths keep working.
12
12
  */
13
13
  import { makeCtx, type Ctx } from "./engineCtx";
14
- import { modeModel, modeToolchain } from "./modes";
14
+ import { modeToolchain } from "./modes";
15
15
  import { ExitError } from "./parseArgs";
16
16
  import { makeEngineServices, type EngineServices, type Logger } from "./services";
17
17
  import { engineSync } from "./syncDispatch";
18
18
 
19
- export type { Ctx, ModifierFlag } from "./engineCtx";
20
- export { runBounded, syncConcurrencyForManifest } from "./syncConcurrency";
19
+ export type { Ctx } from "./engineCtx";
20
+ export { runBounded } from "./syncConcurrency";
21
21
  export type { SyncConcurrency, SyncTask } from "./syncConcurrency";
22
22
 
23
23
  /**
@@ -52,8 +52,6 @@ export async function runEngineNative(
52
52
  try {
53
53
  ctx = makeCtx(runServices, { envGlobals: options.envGlobals === true });
54
54
  switch (argv[0]) {
55
- case "model":
56
- return await modeModel(ctx, argv.slice(1));
57
55
  case "toolchain":
58
56
  return await modeToolchain(ctx, argv.slice(1));
59
57
  case "sync":
@@ -1,17 +1,9 @@
1
1
  /**
2
- * jq-semantics primitives for EngineNative.
3
- *
4
- * Some deployed JSON contracts were defined by jq behavior, so EngineNative
5
- * reproduces three jq behaviors exactly:
6
- * - `*` (recursive object merge): right side wins; objects merge
7
- * recursively; arrays and scalars are REPLACED, never concatenated;
8
- * merged key order = left object's order, then right-only keys appended.
9
- * - `unique`: sorts (jq's total order — for our string arrays, Unicode
10
- * codepoint order) and deduplicates.
11
- * - output formatting: 2-space indent, UTF-8 raw, trailing newline.
2
+ * JSON primitives for EngineNative: the `Json` value type, object narrowing,
3
+ * jq-compatible codepoint ordering, and a parse that yields `undefined`
4
+ * instead of throwing.
12
5
  */
13
6
 
14
- import { existsSync, readFileSync } from "node:fs";
15
7
  import type { JsonObject } from "./sharedTypes";
16
8
 
17
9
  export type Json = null | boolean | number | string | Array<Json> | { [key: string]: Json };
@@ -20,22 +12,7 @@ export function isObject(v: Json): v is JsonObject {
20
12
  return typeof v === "object" && v !== null && !Array.isArray(v);
21
13
  }
22
14
 
23
- /** jq `$left * $right`. */
24
- export function deepMerge(left: Json, right: Json): Json {
25
- if (!isObject(left) || !isObject(right)) return right;
26
- const out: JsonObject = { ...left };
27
- for (const [k, v] of Object.entries(right)) {
28
- const lv = out[k];
29
- out[k] = lv !== undefined && isObject(lv) && isObject(v) ? deepMerge(lv, v) : v;
30
- }
31
- return out;
32
- }
33
-
34
- /** jq `unique` over an array of strings: codepoint sort + dedup. */
35
- export function uniqueStrings(arr: Array<string>): Array<string> {
36
- return [...new Set(arr)].sort(compareCodepoints);
37
- }
38
-
15
+ /** jq's string order: compare by Unicode codepoint, not UTF-16 code unit. */
39
16
  export function compareCodepoints(a: string, b: string): number {
40
17
  const ia = a[Symbol.iterator]();
41
18
  const ib = b[Symbol.iterator]();
@@ -51,11 +28,6 @@ export function compareCodepoints(a: string, b: string): number {
51
28
  }
52
29
  }
53
30
 
54
- /** jq's default pretty-printer for the documents this kit writes. */
55
- export function jqStringify(v: Json): string {
56
- return `${JSON.stringify(v, null, 2)}\n`;
57
- }
58
-
59
31
  /** jq `empty` validation: parse or null. */
60
32
  export function parseJson(text: string): Json | undefined {
61
33
  try {
@@ -64,8 +36,3 @@ export function parseJson(text: string): Json | undefined {
64
36
  return undefined;
65
37
  }
66
38
  }
67
-
68
- /** Parse a JSON file with `parseJson` semantics; a missing file is `undefined`. */
69
- export function readJsonFile(file: string): Json | undefined {
70
- return existsSync(file) ? parseJson(readFileSync(file, "utf8")) : undefined;
71
- }
@@ -11,13 +11,14 @@ import { p } from "./exec";
11
11
 
12
12
  /**
13
13
  * Append-only. Never edit or reorder a shipped entry. A release that changes the
14
- * schema appends one SQL string. State tables (harness_selection, omp_session)
15
- * get data-preserving migrations; cache_entry may be dropped and recreated
14
+ * schema appends one SQL string. The state table omp_session gets
15
+ * data-preserving migrations; cache_entry may be dropped and recreated
16
16
  * because every row can be refetched.
17
17
  */
18
18
  const MIGRATIONS: ReadonlyArray<string> = [
19
- // omp_session.advisor_thinking has had no use since 0.22.22. It stays only
20
- // to keep schema 1, which older kits still open; nothing reads or writes it.
19
+ // omp_session.advisor_thinking has had no use since 0.22.22, and
20
+ // harness_selection has had no use since 0.24.0. They stay only to keep
21
+ // schema 1, which older kits still open; nothing reads or writes them.
21
22
  `CREATE TABLE harness_selection (
22
23
  harness TEXT PRIMARY KEY CHECK (harness IN ('claude','codex','agents','omp'))
23
24
  ) STRICT, WITHOUT ROWID;
@@ -88,9 +89,9 @@ function migrate(db: DatabaseSync): boolean {
88
89
  });
89
90
  }
90
91
 
91
- interface LegacyState {
92
- readonly harnesses: ReadonlyArray<string>;
93
- readonly session?: { selector: string; thinking: string | null };
92
+ interface LegacySession {
93
+ readonly selector: string;
94
+ readonly thinking: string | null;
94
95
  }
95
96
 
96
97
  export function isNonBlankString(value: unknown): value is string {
@@ -103,9 +104,9 @@ export function nonBlankOrNull(value: unknown): string | null {
103
104
  }
104
105
 
105
106
  // Same validation the JSON store applied: root object, version 1, non-blank
106
- // selector and levels. Unknown or duplicate harness names are dropped by the
107
- // table's CHECK and PRIMARY KEY through INSERT OR IGNORE.
108
- function parseLegacyState(file: string): LegacyState | undefined {
107
+ // selector and levels. The legacy harness selection is not imported: sync
108
+ // has one harness and reads no selection.
109
+ function parseLegacySession(file: string): LegacySession | undefined {
109
110
  let parsed: unknown;
110
111
  try {
111
112
  parsed = JSON.parse(readFileSync(file, "utf8")) as unknown;
@@ -115,43 +116,26 @@ function parseLegacyState(file: string): LegacyState | undefined {
115
116
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return undefined;
116
117
  if (!("version" in parsed) || parsed.version !== 1) return undefined;
117
118
 
118
- const rawHarnesses = "harnesses" in parsed ? parsed.harnesses : undefined;
119
- const harnesses = Array.isArray(rawHarnesses)
120
- ? rawHarnesses.filter((value): value is string => typeof value === "string")
121
- : [];
122
119
  const entry = "ompSession" in parsed ? parsed.ompSession : undefined;
123
- if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return { harnesses };
120
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return undefined;
124
121
  const selector = nonBlankOrNull("selector" in entry ? entry.selector : undefined);
125
- if (selector === null) return { harnesses };
122
+ if (selector === null) return undefined;
126
123
  return {
127
- harnesses,
128
- session: {
129
- selector,
130
- thinking: nonBlankOrNull("thinking" in entry ? entry.thinking : undefined),
131
- },
124
+ selector,
125
+ thinking: nonBlankOrNull("thinking" in entry ? entry.thinking : undefined),
132
126
  };
133
127
  }
134
128
 
135
129
  function importLegacyState(db: DatabaseSync, legacy: string): void {
136
130
  inTransaction(db, () => {
137
- const rows = db
138
- .prepare(
139
- "SELECT (SELECT count(*) FROM harness_selection) + (SELECT count(*) FROM omp_session) AS n",
140
- )
141
- .get()?.["n"];
131
+ const rows = db.prepare("SELECT count(*) AS n FROM omp_session").get()?.["n"];
142
132
  if (rows !== 0) return;
143
- const state = parseLegacyState(legacy);
144
- if (state === undefined) return;
145
- const insertHarness = db.prepare(
146
- "INSERT OR IGNORE INTO harness_selection (harness) VALUES (?)",
133
+ const session = parseLegacySession(legacy);
134
+ if (session === undefined) return;
135
+ db.prepare("INSERT INTO omp_session (id, selector, thinking) VALUES (1, ?, ?)").run(
136
+ session.selector,
137
+ session.thinking,
147
138
  );
148
- for (const harness of state.harnesses) insertHarness.run(harness);
149
- if (state.session !== undefined) {
150
- db.prepare("INSERT INTO omp_session (id, selector, thinking) VALUES (1, ?, ?)").run(
151
- state.session.selector,
152
- state.session.thinking,
153
- );
154
- }
155
139
  });
156
140
  // An invalid file is renamed too, so no later run parses it again.
157
141
  try {
@@ -1,140 +1,12 @@
1
1
  /**
2
- * Direct modes for `model` and `toolchain`. Same public argv vocabulary,
3
- * golden-tested messages, same exit codes.
2
+ * Direct mode for `toolchain`. Same public argv vocabulary, golden-tested
3
+ * messages, same exit codes.
4
4
  */
5
- import { p } from "./exec";
6
- import { existsSync, readFileSync } from "node:fs";
7
- import { payloadText } from "../payload";
8
-
9
- import { codexHome } from "./codexPaths";
10
- import { syncClaudeModel } from "./claudeSettingsModifiers";
11
- import { syncCodexModel } from "./codexToml";
12
5
  import type { Ctx } from "./index";
13
- import { isObject, parseJson, type Json } from "./jq";
14
- import { printModels, validateClaudeModel, validateCodexModel } from "./models";
15
- import { defaultLiveInputs, resolveCatalog } from "./liveModels";
16
6
  import { bunBootstrap } from "./bun";
17
- import { withFolderLocks, withSyncLock } from "./syncDispatch";
18
- import { upgradeLspServers } from "./claudeLsp";
19
7
  import { belowFloor, field, installedVersion, outdatedReport, present, report } from "./toolchain";
20
- import { topLevelTomlString } from "../manifests";
21
-
22
- export async function modeModel(ctx: Ctx, args: ReadonlyArray<string>): Promise<number> {
23
- const { err } = ctx.services.logger;
24
- let tool: "claude" | "codex" | "" = "";
25
- let value = "";
26
- for (const arg of args) {
27
- if (arg === "--dry-run") ctx.dryRun = true;
28
- else if (arg === "--verbose") {
29
- ctx.verbose = true;
30
- } else if (arg === "claude" || arg === "codex") tool = arg;
31
- else if (arg.startsWith("-")) {
32
- err(`Unknown flag for model: ${arg}`);
33
- return 2;
34
- } else value = arg;
35
- }
36
- if (tool === "") {
37
- err("Usage: model <claude|codex> [value] [--dry-run]");
38
- return 2;
39
- }
40
- if (value === "") return await showModel(ctx, tool);
41
- // A write does the same read-modify-write of settings.json and config.toml as a sync.
42
- return await withSyncLock(ctx, args, async () => {
43
- // `model codex` writes config.toml in the Codex folder, which syncs of
44
- // other homes can share. It creates no folder, so a missing one needs no lock.
45
- const codexDir = codexHome(ctx.home);
46
- const folders = tool === "codex" && existsSync(codexDir) ? [codexDir] : [];
47
- return await withFolderLocks(ctx, folders, () => writeModel(ctx, tool, value));
48
- });
49
- }
50
-
51
- /** Print the deployed model, the SoT model, and the model catalog of `tool`. */
52
- async function showModel(ctx: Ctx, tool: "claude" | "codex"): Promise<number> {
53
- const { echo, err, warn } = ctx.services.logger;
54
- const catalog = await resolveCatalog(tool, defaultLiveInputs(ctx.home));
55
- if (tool === "claude") {
56
- const deployed = p(ctx.home, ".claude", "settings.json");
57
- const result = readConfig(deployed);
58
- if (result.kind === "missing") {
59
- warn("~/.claude/settings.json missing");
60
- return 0;
61
- }
62
- if (result.kind === "read-error") {
63
- err(`Failed to read ~/.claude/settings.json: ${String(result.error)}`);
64
- return 1;
65
- }
66
- echo(`deployed: ${jsonModelText(result.data)}`);
67
- echo(`SoT: ${jsonModelText(payloadText("SoT/.claude/settings.json"))}`);
68
- } else {
69
- const deployed = p(codexHome(ctx.home), "config.toml");
70
- const result = readConfig(deployed);
71
- if (result.kind === "missing") {
72
- warn(`${deployed} missing`);
73
- return 0;
74
- }
75
- if (result.kind === "read-error") {
76
- err(`Failed to read ${deployed}: ${String(result.error)}`);
77
- return 1;
78
- }
79
- echo(`deployed: ${topLevelTomlString(result.data, "model") ?? ""}`);
80
- echo(`SoT: ${topLevelTomlString(payloadText("SoT/.codex/config.toml"), "model") ?? ""}`);
81
- }
82
- printModels(ctx, catalog);
83
- return 0;
84
- }
85
-
86
- /** Validate `value` against the model catalog of `tool`, then write it. */
87
- async function writeModel(ctx: Ctx, tool: "claude" | "codex", value: string): Promise<number> {
88
- const { err } = ctx.services.logger;
89
- const catalog = await resolveCatalog(tool, defaultLiveInputs(ctx.home));
90
- if (tool === "claude") {
91
- if (!validateClaudeModel(ctx, value, catalog)) {
92
- printModels(ctx, catalog);
93
- err(`Invalid Claude model '${value}'`);
94
- return 2;
95
- }
96
- syncClaudeModel(ctx, value);
97
- } else {
98
- if (!validateCodexModel(ctx, value, catalog)) {
99
- printModels(ctx, catalog);
100
- err(`Invalid Codex model '${value}'`);
101
- return 2;
102
- }
103
- syncCodexModel(ctx, value);
104
- }
105
- return 0;
106
- }
107
-
108
- type ConfigReadResult =
109
- | { readonly kind: "missing" }
110
- | { readonly kind: "read-error"; readonly error: unknown }
111
- | { readonly kind: "data"; readonly data: string };
112
-
113
- function readConfig(file: string): ConfigReadResult {
114
- try {
115
- return { kind: "data", data: readFileSync(file, "utf8") };
116
- } catch (error) {
117
- const code =
118
- typeof error === "object" &&
119
- error !== null &&
120
- "code" in error &&
121
- typeof error.code === "string"
122
- ? error.code
123
- : undefined;
124
- return code === "ENOENT" ? { kind: "missing" } : { kind: "read-error", error };
125
- }
126
- }
127
-
128
- function jsonModelText(text: string): string {
129
- const doc = parseJson(text);
130
- if (doc === undefined) return "";
131
- const v: Json | undefined = isObject(doc) ? doc["model"] : undefined;
132
- if (v === undefined || v === null || v === false) return "default (unset)";
133
- return typeof v === "string" ? v : JSON.stringify(v);
134
- }
135
8
 
136
- const TOOLCHAIN_USAGE =
137
- "Usage: toolchain [check|ensure <tool> [--dry-run]|outdated [--refresh]|upgrade [--dry-run]]";
9
+ const TOOLCHAIN_USAGE = "Usage: toolchain [check|ensure <tool> [--dry-run]|outdated [--refresh]]";
138
10
 
139
11
  export async function modeToolchain(ctx: Ctx, args: ReadonlyArray<string>): Promise<number> {
140
12
  const { echo, err, verbose, warn } = ctx.services.logger;
@@ -158,7 +30,6 @@ export async function modeToolchain(ctx: Ctx, args: ReadonlyArray<string>): Prom
158
30
  await outdatedReport(ctx, { refresh: args.includes("--refresh") });
159
31
  return 0;
160
32
  }
161
- if (op === "upgrade") return await upgradeLspServers(ctx);
162
33
  if (op !== "ensure") {
163
34
  err(TOOLCHAIN_USAGE);
164
35
  return 2;
@@ -47,7 +47,7 @@ export function toggleOpenAiFast(configText: string): FastToggle {
47
47
  /** Throw the error of the toggle when the deployed config.yml is missing. */
48
48
  export function requireDeployedConfig(configPath: string): void {
49
49
  if (!existsSync(configPath)) {
50
- throw new Error(`${configPath} does not exist; run 'docks-kit sync omp' first`);
50
+ throw new Error(`${configPath} does not exist; run 'docks-kit sync' first`);
51
51
  }
52
52
  }
53
53
 
@@ -12,7 +12,7 @@
12
12
  */
13
13
  import { createHash } from "node:crypto";
14
14
  import { delimiter } from "node:path";
15
- import type { OmpSessionModel } from "./harnesses";
15
+ import type { OmpSessionModel } from "./ompSession";
16
16
 
17
17
  export interface CatalogModel {
18
18
  readonly selector: string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * EngineNative `sync omp` retired-entry pruning. `ompYaml.ts mergeOmpConfig` and
2
+ * EngineNative sync retired-entry pruning. `ompYaml.ts mergeOmpConfig` and
3
3
  * `mergeOmpModels` are additive: their `mergeMappings, deployed-key retention
4
4
  * loop` returns every deployed key absent from the SoT to the merged result,
5
5
  * and `mergeBashPatterns` keeps a deployed rule the SoT stops shipping as a user
@@ -40,6 +40,9 @@ type RetiredValue = string | number | boolean | ReadonlyArray<string>;
40
40
  * same value.
41
41
  * - `compaction.thresholdTokens: 231200`: an old fixed compaction trigger.
42
42
  * Pruning it restores omp's reserve-based default `-1`.
43
+ * - The 18 entries from `task.maxConcurrency` to `github.enabled`: overrides
44
+ * that the owner returned to the omp 19.0.0 defaults. Pruning one restores
45
+ * the omp default, for example `task.maxEffort` `max` instead of `xhigh`.
43
46
  */
44
47
  export const OMP_RETIRED_VALUES: ReadonlyArray<readonly [string, RetiredValue]> = [
45
48
  ["symbolPreset", "unicode"],
@@ -85,6 +88,24 @@ export const OMP_RETIRED_VALUES: ReadonlyArray<readonly [string, RetiredValue]>
85
88
  ["textVerbosity", "low"],
86
89
  ["codexResets.autoRedeem", "no"],
87
90
  ["tools.approvalMode", "yolo"],
91
+ ["task.maxConcurrency", 16],
92
+ ["task.maxEffort", "xhigh"],
93
+ ["task.maxRuntimeMs", 3600000],
94
+ ["task.agentIdleTtlMs", 120000],
95
+ ["task.enableLsp", true],
96
+ ["task.eager", "always"],
97
+ ["task.showResolvedModelBadge", true],
98
+ ["find.enabled", true],
99
+ ["providers.webSearchTimeoutSeconds", 30],
100
+ ["browser.idleCloseSec", 600],
101
+ ["steeringMode", "all"],
102
+ ["doubleEscapeAction", "tree"],
103
+ ["features.unexpectedStopDetection", "smart"],
104
+ ["compaction.idleEnabled", true],
105
+ ["compaction.handoffSaveToDisk", true],
106
+ ["commands.enableOpencodeProject", false],
107
+ ["statusLine.compactThinkingLevel", false],
108
+ ["github.enabled", true],
88
109
  ];
89
110
 
90
111
  /**
@@ -260,8 +281,8 @@ function indexOfKey(mapping: YAMLMap, key: string): number {
260
281
  /**
261
282
  * Deletes `segments` when `matches` accepts the leaf value, then removes every
262
283
  * ancestor mapping the deletion left empty. An ancestor holding another key
263
- * survives, so `statusLine` keeps `compactThinkingLevel` while `tui` disappears
264
- * once both of its keys are gone.
284
+ * survives, so `task` keeps its reviewer overrides while `tui` disappears once
285
+ * both of its keys are gone.
265
286
  */
266
287
  function deletePath(
267
288
  root: YAMLMap,
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The omp session model that `docks-kit omp` stores in ~/.docks-kit/kit.db
3
+ * (kitDb.ts), and the engine home root that locates the kit store.
4
+ */
5
+ import { homedir } from "node:os";
6
+
7
+ import { isNonBlankString, nonBlankOrNull, withKitDb } from "./kitDb";
8
+ import type { OmpSessionModel } from "./sharedTypes";
9
+
10
+ export type { OmpSessionModel };
11
+
12
+ export const DEFAULT_OMP_SESSION_MODEL: OmpSessionModel = {
13
+ selector: "opencode-zen/muse-spark-1.3-contributor-free",
14
+ thinking: "xhigh",
15
+ };
16
+
17
+ /**
18
+ * Resolve the engine home root the way the harness resolves `~`. On Windows,
19
+ * USERPROFILE applies and HOME is ignored. Elsewhere, HOME applies. The
20
+ * platform home is the fallback.
21
+ */
22
+ export function engineHome(
23
+ env: NodeJS.ProcessEnv = process.env,
24
+ platform: NodeJS.Platform = process.platform,
25
+ ): string {
26
+ const home = platform === "win32" ? env["USERPROFILE"] : env["HOME"];
27
+ return home !== undefined && home !== "" ? home : homedir();
28
+ }
29
+
30
+ // Read the stored session model without throwing so a corrupt store falls
31
+ // back to the default instead of breaking sync.
32
+ export function readOmpSessionModel(home: string): OmpSessionModel | undefined {
33
+ try {
34
+ return withKitDb(home, "read", (db) => {
35
+ const row = db.prepare("SELECT selector, thinking FROM omp_session WHERE id = 1").get();
36
+ const selector = row?.["selector"];
37
+ if (!isNonBlankString(selector)) return undefined;
38
+ const thinking = row?.["thinking"];
39
+ const model: OmpSessionModel = {
40
+ selector,
41
+ ...(isNonBlankString(thinking) ? { thinking } : {}),
42
+ };
43
+ return model;
44
+ });
45
+ } catch {
46
+ return undefined;
47
+ }
48
+ }
49
+
50
+ export function writeOmpSessionModel(home: string, model: OmpSessionModel): void {
51
+ // A blank selector would make omp resolve an arbitrary model, so reject it
52
+ // before anything reaches disk.
53
+ if (!isNonBlankString(model.selector)) {
54
+ throw new Error("Omp session model selector must be a non-empty string");
55
+ }
56
+ // Store a blank or absent level as NULL so a switch to a level-free model
57
+ // leaves no stale level behind.
58
+ const thinking = nonBlankOrNull(model.thinking);
59
+ withKitDb(home, "write", (db) =>
60
+ db
61
+ .prepare(
62
+ `INSERT INTO omp_session (id, selector, thinking) VALUES (1, ?, ?)
63
+ ON CONFLICT(id) DO UPDATE SET selector = excluded.selector, thinking = excluded.thinking`,
64
+ )
65
+ .run(model.selector, thinking),
66
+ );
67
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * EngineNative `sync omp` pipeline. config.yml merges through mergeOmpConfig
2
+ * EngineNative sync pipeline. config.yml merges through mergeOmpConfig
3
3
  * and models.yml through mergeOmpModels. Both preserve user-only keys.
4
4
  * Paths come from ompPaths because profiles, PI_CONFIG_DIR,
5
5
  * PI_CODING_AGENT_DIR, and XDG roots each move them. `runSync` resolves them
@@ -4,13 +4,9 @@ import type { HostOs } from "./types";
4
4
  export const darwin: HostOs = posixHost({
5
5
  id: "darwin",
6
6
  toolchainOs: "darwin",
7
- supportsBubblewrap: false,
8
- // macOS terminals start bash as a login shell. It reads the first existing file of these and never reads .bashrc.
9
- bashTargets: [".bash_profile", ".bash_login", ".profile"],
10
7
  packageManagerHints: {
11
8
  git: "brew install git",
12
9
  jq: "brew install jq",
13
10
  curl: "brew install curl",
14
- ffplay: "brew install ffmpeg",
15
11
  },
16
12
  });
@@ -22,12 +22,11 @@ export function platformName(pf: NodeJS.Platform = rawPlatform()): PlatformName
22
22
  }
23
23
  }
24
24
 
25
- // An unrecognized host keeps Linux hint text, filters no toolchain row, and never claims bubblewrap — exactly today's behavior.
25
+ // An unrecognized host keeps Linux hint text and filters no toolchain row — exactly today's behavior.
26
26
  const unknown: HostOs = {
27
27
  ...linux,
28
28
  id: "unknown",
29
29
  toolchainOs: "",
30
- supportsBubblewrap: false,
31
30
  };
32
31
 
33
32
  const HOSTS: Readonly<Record<PlatformName, HostOs>> = {
@@ -4,12 +4,9 @@ import type { HostOs } from "./types";
4
4
  export const linux: HostOs = posixHost({
5
5
  id: "linux",
6
6
  toolchainOs: "linux",
7
- supportsBubblewrap: true,
8
- bashTargets: [".bashrc"],
9
7
  packageManagerHints: {
10
8
  git: "sudo apt install -y git (or your distro's package manager)",
11
9
  jq: "sudo apt install -y jq",
12
10
  curl: "sudo apt install -y curl",
13
- ffplay: "sudo apt install -y ffmpeg",
14
11
  },
15
12
  });
@@ -2,26 +2,13 @@
2
2
  // through this module. A slash join keeps the same host-stable path p() would produce.
3
3
  import type { HintedTool, HostOs } from "./types";
4
4
 
5
- function posixLiteral(value: string): string {
6
- return `'${value.replaceAll("'", `'"'"'`)}'`;
7
- }
8
-
9
5
  /** Package-manager hints for the tools a POSIX host installs through its own package manager. */
10
- export type PackageManagerHints = Readonly<Record<Exclude<HintedTool, "claude" | "codex">, string>>;
11
-
12
- const UPSTREAM_INSTALLER_HINTS: Readonly<Record<"claude" | "codex", string>> = {
13
- claude: 'tmp=$(mktemp) && curl -fsSL https://claude.ai/install.sh -o "$tmp" && bash "$tmp"',
14
- codex:
15
- 'tmp=$(mktemp) && curl -fsSL https://chatgpt.com/codex/install.sh -o "$tmp" && CODEX_NON_INTERACTIVE=1 sh "$tmp"',
16
- };
6
+ export type PackageManagerHints = Readonly<Record<HintedTool, string>>;
17
7
 
18
8
  interface PosixHostInputs {
19
9
  readonly id: HostOs["id"];
20
10
  readonly toolchainOs: HostOs["toolchainOs"];
21
- readonly supportsBubblewrap: boolean;
22
11
  readonly packageManagerHints: PackageManagerHints;
23
- /** Home-relative bash startup files in read order; the first existing one gets the write, else the first entry. */
24
- readonly bashTargets: readonly [string, ...string[]];
25
12
  }
26
13
 
27
14
  /** Members shared by every POSIX host; linux and darwin differ only in the inputs. */
@@ -29,8 +16,6 @@ export function posixHost(inputs: PosixHostInputs): HostOs {
29
16
  return {
30
17
  id: inputs.id,
31
18
  toolchainOs: inputs.toolchainOs,
32
- supportsBubblewrap: inputs.supportsBubblewrap,
33
- directoryLinkKinds: ["symlink"],
34
19
  executableSuffixes: [""],
35
20
  invoke: (executablePath, args) => ({ command: executablePath, args }),
36
21
  bunExecutableName: "bun",
@@ -48,36 +33,6 @@ export function posixHost(inputs: PosixHostInputs): HostOs {
48
33
  },
49
34
  };
50
35
  },
51
- environmentSetting: (name, value) => ({
52
- kind: "profile",
53
- // Bash reads .bash_login only as a login file. Only a host that writes to it
54
- // scans it, so a dormant copy cannot block the write to the loaded file.
55
- candidates: [
56
- ".zshrc",
57
- ".bashrc",
58
- ".bash_profile",
59
- ...(inputs.bashTargets.includes(".bash_login") ? [".bash_login"] : []),
60
- ".profile",
61
- ".zshenv",
62
- ],
63
- target: (shell, exists) => {
64
- const shellPath = shell ?? "bash";
65
- const shellName = shellPath.slice(shellPath.lastIndexOf("/") + 1);
66
- if (shellName === "zsh") return ".zshrc";
67
- if (shellName !== "bash") return ".profile";
68
- return inputs.bashTargets.find(exists) ?? inputs.bashTargets[0];
69
- },
70
- line: `export ${name}=${value}`,
71
- }),
72
- statusLineCommand: (bun, script) => {
73
- const bunLiteral = posixLiteral(bun);
74
- const scriptLiteral = posixLiteral(script);
75
- return `test -x ${bunLiteral} && test -f ${scriptLiteral} && exec ${bunLiteral} ${scriptLiteral} || true`;
76
- },
77
- failureHookCommand: (command) => command,
78
- installHint: (tool) =>
79
- tool === "claude" || tool === "codex"
80
- ? UPSTREAM_INSTALLER_HINTS[tool]
81
- : inputs.packageManagerHints[tool],
36
+ installHint: (tool) => inputs.packageManagerHints[tool],
82
37
  };
83
38
  }