docks-kit 0.23.0 → 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.
- package/AGENTS.md +19 -20
- package/README.md +12 -22
- package/cli/docs/command-guards.md +5 -3
- package/cli/docs/flags.md +11 -29
- package/cli/docs/install.md +1 -1
- package/cli/docs/omp-context.md +79 -7
- package/cli/docs/omp-models.md +18 -12
- package/cli/docs/overview.md +5 -8
- package/cli/docs/sync-layers.md +12 -11
- package/cli/docs/toolchain.md +4 -4
- package/cli/src/argv.ts +0 -4
- package/cli/src/argvValidate.ts +2 -9
- package/cli/src/commands/docs.ts +2 -2
- package/cli/src/commands/omp.ts +1 -1
- package/cli/src/commands/scratch.ts +1 -1
- package/cli/src/commands/sync.ts +3 -24
- package/cli/src/commands/tidy.ts +1 -1
- package/cli/src/engine-native/DESIGN.md +21 -31
- package/cli/src/engine-native/deps.ts +2 -7
- package/cli/src/engine-native/engineCtx.ts +3 -28
- package/cli/src/engine-native/index.ts +2 -2
- package/cli/src/engine-native/kitDb.ts +21 -37
- package/cli/src/engine-native/ompFastMode.ts +1 -1
- package/cli/src/engine-native/ompOverlay.ts +1 -1
- package/cli/src/engine-native/ompRemovals.ts +24 -3
- package/cli/src/engine-native/ompSession.ts +67 -0
- package/cli/src/engine-native/ompSync.ts +1 -1
- package/cli/src/engine-native/os/posix.ts +0 -1
- package/cli/src/engine-native/os/types.ts +0 -4
- package/cli/src/engine-native/os/windows.ts +0 -1
- package/cli/src/engine-native/parseArgs.ts +1 -61
- package/cli/src/engine-native/parseHelp.ts +1 -6
- package/cli/src/engine-native/scratch.ts +1 -1
- package/cli/src/engine-native/sharedTypes.d.ts +1 -1
- package/cli/src/engine-native/syncConcurrency.ts +3 -3
- package/cli/src/engine-native/syncDispatch.ts +26 -92
- package/cli/src/engine-native/toolchain.ts +1 -5
- package/cli/src/generated/sotPayload.ts +6 -8
- package/cli/src/main.ts +3 -7
- package/package.json +2 -2
- package/cli/src/checklistPrompt.ts +0 -464
- package/cli/src/commands/harnesses.ts +0 -77
- package/cli/src/commands/skills.ts +0 -40
- package/cli/src/engine-native/harnesses.ts +0 -138
- package/cli/src/engine-native/skillsInstall.ts +0 -135
- package/cli/src/engine-native/skillsLinks.ts +0 -216
- package/cli/src/engine-native/skillsManifest.ts +0 -36
- package/cli/src/engine-native/skillsPrune.ts +0 -117
- package/cli/src/engine-native/skillsRecords.ts +0 -138
- package/cli/src/engine-native/skillsSync.ts +0 -57
- package/cli/src/manifests.ts +0 -53
- package/cli/src/terminalCells.ts +0 -191
package/cli/src/argv.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { GlobalFlag } from "effect/cli";
|
|
2
2
|
import { docsCommand } from "./commands/docs";
|
|
3
|
-
import { harnessesCommand } from "./commands/harnesses";
|
|
4
|
-
import { skillsCommand } from "./commands/skills";
|
|
5
3
|
import { syncCommand } from "./commands/sync";
|
|
6
4
|
import { toolchainCommand } from "./commands/toolchain";
|
|
7
5
|
import { updateCommand } from "./commands/update";
|
|
@@ -28,10 +26,8 @@ export type ArgvOutcome =
|
|
|
28
26
|
*/
|
|
29
27
|
export const COMMANDS = [
|
|
30
28
|
syncCommand,
|
|
31
|
-
harnessesCommand,
|
|
32
29
|
updateCommand,
|
|
33
30
|
toolchainCommand,
|
|
34
|
-
skillsCommand,
|
|
35
31
|
docsCommand,
|
|
36
32
|
ompCommand,
|
|
37
33
|
scratchCommand,
|
package/cli/src/argvValidate.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Per-command validation for the Effect CLI layer:
|
|
3
|
-
*
|
|
2
|
+
* Per-command validation for the Effect CLI layer: unknown-command/flag
|
|
3
|
+
* detection, and boolean-value and duplicate rejection.
|
|
4
4
|
* Operates on scanned flags so the grammar machinery stays in argvSurface.ts.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { isLegacyFlag, LEGACY_FLAG_HINTS } from "./engine-native/parseArgs";
|
|
8
7
|
import type { ArgvSurfaces, FlagSurface, ScannedFlag } from "./argvSurface";
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -25,12 +24,6 @@ export const validateScannedArgv = (
|
|
|
25
24
|
return `unknown command '${subcommand}'`;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
if (subcommand === "sync") {
|
|
29
|
-
for (const flag of flags) {
|
|
30
|
-
if (isLegacyFlag(flag.name)) return LEGACY_FLAG_HINTS[flag.name];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
27
|
// Effect 4 expands clustered shorts, but the kit declares no clusterable alias
|
|
35
28
|
// pair, so refusing a cluster as one unknown flag is the conservative direction.
|
|
36
29
|
for (const flag of flags) {
|
package/cli/src/commands/docs.ts
CHANGED
|
@@ -14,10 +14,10 @@ import commandGuards from "../../docs/command-guards.md" with { type: "text" };
|
|
|
14
14
|
const TOPICS: Record<string, { summary: string; body: string }> = {
|
|
15
15
|
overview: { summary: "What docks-kit is and how the pieces fit", body: overview },
|
|
16
16
|
"sync-layers": {
|
|
17
|
-
summary: "
|
|
17
|
+
summary: "How sync deploys the omp SoT, and its additive-by-default semantics",
|
|
18
18
|
body: syncLayers,
|
|
19
19
|
},
|
|
20
|
-
flags: { summary: "Full flag reference
|
|
20
|
+
flags: { summary: "Full flag reference", body: flags },
|
|
21
21
|
toolchain: {
|
|
22
22
|
summary: "Verified-version floors, the doctor table, and the upstream outdated report",
|
|
23
23
|
body: toolchain,
|
package/cli/src/commands/omp.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Argument, Command } from "effect/cli";
|
|
|
4
4
|
import { Console, Effect } from "effect";
|
|
5
5
|
|
|
6
6
|
import { bail } from "../engine";
|
|
7
|
-
import { engineHome } from "../engine-native/
|
|
7
|
+
import { engineHome } from "../engine-native/ompSession";
|
|
8
8
|
import {
|
|
9
9
|
allowedRemovalRoots,
|
|
10
10
|
createScratchDir,
|
package/cli/src/commands/sync.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command, Flag } from "effect/cli";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
-
import {
|
|
5
|
+
import { engine } from "../engine";
|
|
6
6
|
import { spawnHost } from "../engine-native/exec";
|
|
7
7
|
import type { Logger } from "../engine-native/logger";
|
|
8
8
|
import { kitHome } from "../kitHome";
|
|
@@ -35,21 +35,10 @@ export const updateNudge = (logger: Logger): void => {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
const VALID_TARGETS = ["agents", "omp"];
|
|
39
|
-
|
|
40
|
-
const targets: Argument.Argument<ReadonlyArray<string>> = Argument.String("target").pipe(
|
|
41
|
-
Argument.withDescription("Sync targets: agents, omp (default: selected harnesses)"),
|
|
42
|
-
Argument.variadic(),
|
|
43
|
-
);
|
|
44
|
-
|
|
45
38
|
const dryRun = Flag.Boolean("dry-run").pipe(
|
|
46
39
|
Flag.withDescription("Preview without applying"),
|
|
47
40
|
Flag.withDefault(false),
|
|
48
41
|
);
|
|
49
|
-
const prune = Flag.Boolean("prune").pipe(
|
|
50
|
-
Flag.withDescription("Remove kit-managed universal skills not in SoT/.agents/skills.txt"),
|
|
51
|
-
Flag.withDefault(false),
|
|
52
|
-
);
|
|
53
42
|
const skipPluginRefresh = Flag.Boolean("skip-plugin-refresh").pipe(
|
|
54
43
|
Flag.withDescription(
|
|
55
44
|
"Install missing plugins but skip refresh-only updates for existing plugins",
|
|
@@ -65,24 +54,14 @@ const verbose = Flag.Boolean("verbose").pipe(
|
|
|
65
54
|
export const syncCommand = Command.make(
|
|
66
55
|
"sync",
|
|
67
56
|
{
|
|
68
|
-
targets,
|
|
69
57
|
dryRun,
|
|
70
|
-
prune,
|
|
71
58
|
skipPluginRefresh,
|
|
72
59
|
verbose,
|
|
73
60
|
},
|
|
74
61
|
(config) =>
|
|
75
62
|
Effect.gen(function* () {
|
|
76
|
-
const
|
|
77
|
-
if (bad.length > 0) {
|
|
78
|
-
return yield* bail(
|
|
79
|
-
`Unknown sync target(s): ${bad.join(", ")} (valid: ${VALID_TARGETS.join(", ")})`,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const args: Array<string> = ["sync", ...config.targets];
|
|
63
|
+
const args: Array<string> = ["sync"];
|
|
84
64
|
if (config.dryRun) args.push("--dry-run");
|
|
85
|
-
if (config.prune) args.push("--prune");
|
|
86
65
|
if (config.skipPluginRefresh) args.push("--skip-plugin-refresh");
|
|
87
66
|
if (config.verbose) args.push("--verbose");
|
|
88
67
|
|
package/cli/src/commands/tidy.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Command, Flag } from "effect/cli";
|
|
|
4
4
|
import { Console, Effect, Option } from "effect";
|
|
5
5
|
|
|
6
6
|
import { bail } from "../engine";
|
|
7
|
-
import { engineHome } from "../engine-native/
|
|
7
|
+
import { engineHome } from "../engine-native/ompSession";
|
|
8
8
|
import { acquireKitLock, releaseKitLock } from "../engine-native/kitLock";
|
|
9
9
|
import { scratchRoot, tidyApplyLockPath } from "../engine-native/scratch";
|
|
10
10
|
import {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
EngineNative is the only supported sync engine. It lives in
|
|
4
4
|
`cli/src/engine-native/`. The `sync` and `toolchain` commands invoke it
|
|
5
5
|
through `cli/src/engine.ts` and pass normalized argv to that seam. Other
|
|
6
|
-
commands, such as `omp`, `
|
|
6
|
+
commands, such as `omp`, `update`, `scratch`, and
|
|
7
7
|
`tidy`, import engine-native modules directly. The former
|
|
8
8
|
shell engine was removed after the `bash-engine-final` tag.
|
|
9
9
|
`DOCKS_KIT_ENGINE=bash` is now an explicit removed-engine diagnostic and exits
|
|
@@ -12,11 +12,12 @@ shell engine was removed after the `bash-engine-final` tag.
|
|
|
12
12
|
## Selection Contract
|
|
13
13
|
|
|
14
14
|
- The public `sync` and `toolchain` commands route through `engine(args)`
|
|
15
|
-
after `effect/cli` (the CLI module inside `effect` 4) parses pickers
|
|
16
|
-
|
|
15
|
+
after `effect/cli` (the CLI module inside `effect` 4) parses pickers and flag
|
|
16
|
+
spellings. `sync` takes no positional argument, so `effect/cli` refuses a
|
|
17
|
+
word such as `omp` with `Unexpected positional argument` and exit 1.
|
|
17
18
|
- Other public commands call engine-native modules directly, for example
|
|
18
19
|
`tidy.ts` `planTidy` and `applyTidy`, `scratch.ts` `createScratchDir`, and
|
|
19
|
-
`
|
|
20
|
+
`ompSession.ts` `readOmpSessionModel`.
|
|
20
21
|
- `DOCKS_KIT_ENGINE=native-raw` is harness-private: it bypasses `effect/cli`
|
|
21
22
|
and hands argv directly to EngineNative so tests can exercise the internal
|
|
22
23
|
engine vocabulary.
|
|
@@ -40,14 +41,10 @@ shell engine was removed after the `bash-engine-final` tag.
|
|
|
40
41
|
intercom configuration, materializes the kit plugin, and only then runs the
|
|
41
42
|
marketplace and plugin passes, because the plugin pass links the kit plugin
|
|
42
43
|
directory.
|
|
43
|
-
- **
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
`DOCKS_KIT_SYNC_CONCURRENCY=1` restores serial execution for golden tests
|
|
48
|
-
and debugging. Each individual pipeline remains serial, and summaries keep
|
|
49
|
-
the skills, omp order.
|
|
50
|
-
- **External CLIs stay external.** `omp`, `npx`, `npm`, `bun`, and `curl` are
|
|
44
|
+
- **One pipeline.** Sync runs only the omp pipeline, which is serial.
|
|
45
|
+
`syncConcurrency.ts` `runBounded` stays for the parallel probes of `tidy`
|
|
46
|
+
and the tidy report.
|
|
47
|
+
- **External CLIs stay external.** `omp`, `npm`, `bun`, and `curl` are
|
|
51
48
|
spawned with argv arrays, not shell command strings except where an external
|
|
52
49
|
installer contract requires a script interpreter.
|
|
53
50
|
- **Backups precede mutation.** Deployed settings/config files write `.bak`
|
|
@@ -117,14 +114,13 @@ bootstrap needs an installer download.
|
|
|
117
114
|
the deliverable (the report table for `toolchain check`), so nothing prints
|
|
118
115
|
after it. The schema below applies to `sync` only.
|
|
119
116
|
|
|
120
|
-
The `--- Sync complete ---` block (stdout, `echo`) prints after the
|
|
121
|
-
|
|
117
|
+
The `--- Sync complete ---` block (stdout, `echo`) prints after the omp
|
|
118
|
+
pipeline settles, also on dry-run. When the pipeline rejects, `syncDispatch.ts`
|
|
122
119
|
`engineSync` skips the block and prints only the `--- Failures ---` ledger.
|
|
123
|
-
The block starts with a `Repo:` line and adds the
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
changed → restart line; skills changed → discovery line) or under
|
|
120
|
+
The block starts with a `Repo:` line and adds the `omp:` and `omp plugins:`
|
|
121
|
+
inventory lines. Dry-run leaves out the `omp plugins:` line. Next-step advice
|
|
122
|
+
lines print only when their trigger changed this run (an omp plugin upgraded
|
|
123
|
+
→ `/reload-plugins` line; omp files changed → restart line) or under
|
|
128
124
|
`--verbose`.
|
|
129
125
|
|
|
130
126
|
### Platform seam
|
|
@@ -134,7 +130,7 @@ holds the engine's host-detection `process.platform` read and keeps platform
|
|
|
134
130
|
normalization injectable for tests. These direct reads remain:
|
|
135
131
|
|
|
136
132
|
- the POSIX-only `chmod` guard in `kitDb.ts`;
|
|
137
|
-
- the default `platform` argument of `
|
|
133
|
+
- the default `platform` argument of `ompSession.ts` `engineHome`;
|
|
138
134
|
- `exec.ts` `WINDOWS_PROCESS`;
|
|
139
135
|
- `tidy.ts` `listProcesses`;
|
|
140
136
|
- `tidyReport.ts` `memorySection`, `processSection`, `trashSection`,
|
|
@@ -161,8 +157,8 @@ on the host directly.
|
|
|
161
157
|
`--verbose` / `-v` on the public `sync` and `toolchain` commands selects
|
|
162
158
|
verbose output. On the harness-private raw channel,
|
|
163
159
|
`DOCKS_KIT_VERBOSE=1` also selects it. Only the raw channel honors the
|
|
164
|
-
unprefixed `Ctx` env globals (`engineCtx.ts makeCtx` reads `DRY_RUN
|
|
165
|
-
`DOCKS_KIT_VERBOSE
|
|
160
|
+
unprefixed `Ctx` env globals (`engineCtx.ts makeCtx` reads `DRY_RUN` and
|
|
161
|
+
`DOCKS_KIT_VERBOSE`). `main.ts` passes `{ envGlobals: true }` to
|
|
166
162
|
`runEngineNative` only on that channel. The public `engine()` seam ignores
|
|
167
163
|
these variables.
|
|
168
164
|
The default service factory returns a raw Logger. `runEngineNative` wraps the
|
|
@@ -175,14 +171,13 @@ active logger binding.
|
|
|
175
171
|
|
|
176
172
|
| Module | Owns |
|
|
177
173
|
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
178
|
-
| `parseArgs.ts` | engine usage
|
|
174
|
+
| `parseArgs.ts` | engine usage and the argv dispatch loop; re-exports the `parseHelp.ts` help text and early-exit error |
|
|
179
175
|
| `index.ts` | entry routing (`toolchain`/`sync`) and the run-scoped verbosity gate |
|
|
180
176
|
| `engineCtx.ts` | `Ctx` shape and `makeCtx`; the unprefixed env globals apply only on the native-raw channel |
|
|
181
|
-
| `syncDispatch.ts` |
|
|
182
|
-
| `syncConcurrency.ts` | input-ordered bounded pool (`runBounded`)
|
|
177
|
+
| `syncDispatch.ts` | sync and folder locks, the omp pipeline call, run summary, next-step blocks, and the `--- Failures ---` ledger |
|
|
178
|
+
| `syncConcurrency.ts` | input-ordered bounded pool (`runBounded`) for the tidy probes |
|
|
183
179
|
| `../payload.ts` | generated text payload reads and presentation-only source labels |
|
|
184
180
|
| `bun.ts` | per-run memoized Bun resolution/bootstrap shared by the omp pipeline and direct toolchain ensure |
|
|
185
|
-
| `skillsSync.ts` | universal-skill pipeline orchestration; `skillsManifest.ts` parses the manifest, `skillsInstall.ts` owns the install pass, `skillsLinks.ts` the ordered symlink/junction/copy fallback and `~/.claude/skills` entry healing, and `skillsPrune.ts` the prune and managed-skill snapshot |
|
|
186
181
|
| `ompSync.ts` | omp pipeline orchestration and summary; `ompFileDeploy.ts`, `ompMarketplace.ts`, `ompPlugins.ts`, and `ompRemovals.ts` own the file, marketplace, plugin, and retired-key passes; `ompPaths.ts` resolves roots; `ompYaml.ts` merges YAML |
|
|
187
182
|
| `toolchain.ts` | tool presence/version probes, verified-version floor reporting, report table |
|
|
188
183
|
| `modes.ts` | direct `toolchain` mode |
|
|
@@ -199,11 +194,6 @@ active logger binding.
|
|
|
199
194
|
x64.
|
|
200
195
|
- Unsupported hosts fail before launcher fallback, dependency probes, downloads,
|
|
201
196
|
settings writes, or sync work.
|
|
202
|
-
- Directory linking is capability-driven. The host module supplies only the
|
|
203
|
-
order while the runtime decides the outcome: symlink, then a Windows junction
|
|
204
|
-
with an absolute target, then a recursive copy. Copies carry a kit marker so
|
|
205
|
-
later sync can heal them back to a real link and prune can reclaim them
|
|
206
|
-
without touching user-owned directories.
|
|
207
197
|
|
|
208
198
|
## Tests
|
|
209
199
|
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
import { isAbsolute } from "node:path";
|
|
11
11
|
|
|
12
12
|
import { capture, captureWithin, commandExists, p, which, type CaptureOutcome } from "./exec";
|
|
13
|
-
import { engineHome } from "./
|
|
13
|
+
import { engineHome } from "./ompSession";
|
|
14
14
|
import { hostOs, platformName, rawPlatform } from "./os";
|
|
15
15
|
import type { Invocation } from "./os/types";
|
|
16
16
|
import { field } from "./toolchain";
|
|
17
17
|
|
|
18
|
-
export type ToolId = "git" | "jq" | "curl" | "
|
|
18
|
+
export type ToolId = "git" | "jq" | "curl" | "npm" | "omp" | "bun";
|
|
19
19
|
|
|
20
20
|
export type ProbeResult =
|
|
21
21
|
| { readonly state: "present"; readonly path?: string }
|
|
@@ -144,15 +144,10 @@ export const DEPENDENCIES: Record<ToolId, DependencySpec> = {
|
|
|
144
144
|
git: spec("git", (pf = rawPlatform()) => hostOs(platformName(pf)).installHint("git")),
|
|
145
145
|
jq: spec("jq", (pf = rawPlatform()) => hostOs(platformName(pf)).installHint("jq")),
|
|
146
146
|
curl: spec("curl", (pf = rawPlatform()) => hostOs(platformName(pf)).installHint("curl")),
|
|
147
|
-
node: spec("node", () => "install Node.js via https://nodejs.org (or your package manager)"),
|
|
148
147
|
npm: spec(
|
|
149
148
|
"npm",
|
|
150
149
|
() => "ships with Node.js — install via https://nodejs.org (or your package manager)",
|
|
151
150
|
),
|
|
152
|
-
npx: spec(
|
|
153
|
-
"npx",
|
|
154
|
-
() => "ships with Node.js — install via https://nodejs.org (or your package manager)",
|
|
155
|
-
),
|
|
156
151
|
omp: spec(
|
|
157
152
|
"omp",
|
|
158
153
|
() =>
|
|
@@ -3,34 +3,24 @@
|
|
|
3
3
|
* the environment. Split from index.ts, which re-exports the public surface
|
|
4
4
|
* so existing import paths keep working.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { engineHome } from "./harnesses";
|
|
6
|
+
import { engineHome } from "./ompSession";
|
|
8
7
|
import type { TerminalLease } from "./logger";
|
|
9
8
|
import type { BunRuntimeState } from "./bun";
|
|
10
9
|
import { kitHome } from "../kitHome";
|
|
11
10
|
import type { EngineServices } from "./services";
|
|
12
|
-
import type { SyncConcurrency } from "./syncConcurrency";
|
|
13
11
|
|
|
14
12
|
export interface Ctx {
|
|
15
13
|
readonly repoDir: string;
|
|
16
14
|
readonly home: string;
|
|
17
|
-
readonly agentsDir: string;
|
|
18
|
-
readonly interactive: boolean;
|
|
19
15
|
dryRun: boolean;
|
|
20
16
|
verbose: boolean;
|
|
21
17
|
skipPluginRefresh?: boolean;
|
|
22
|
-
prune: boolean;
|
|
23
18
|
/** Injected capability seam (logger/deps/platform) — see services.ts. */
|
|
24
19
|
readonly services: EngineServices;
|
|
25
|
-
syncConcurrency: SyncConcurrency;
|
|
26
20
|
terminalLease?: TerminalLease;
|
|
27
21
|
bunRuntime?: Promise<BunRuntimeState>;
|
|
28
|
-
targetFilterSet: boolean;
|
|
29
|
-
syncAgents: boolean;
|
|
30
|
-
syncOmp: boolean;
|
|
31
22
|
/** Per-run next-step triggers (Output Policy): advice prints only when its trigger changed or --verbose. */
|
|
32
23
|
readonly nextStepTriggers: {
|
|
33
|
-
skillsRestart: boolean;
|
|
34
24
|
ompRestart: boolean;
|
|
35
25
|
/** A marketplace plugin upgrade changed a version, so running omp sessions lost its folder. */
|
|
36
26
|
ompPluginUpgraded: boolean;
|
|
@@ -42,7 +32,7 @@ export interface Ctx {
|
|
|
42
32
|
export interface CtxOptions {
|
|
43
33
|
/**
|
|
44
34
|
* True only on the harness-private native-raw channel: seed `Ctx` from the
|
|
45
|
-
* unprefixed env globals DRY_RUN
|
|
35
|
+
* unprefixed env globals DRY_RUN and DOCKS_KIT_VERBOSE
|
|
46
36
|
* (the historical ${VAR:-default} contract). The public CLI takes the same
|
|
47
37
|
* behavior from flags.
|
|
48
38
|
*/
|
|
@@ -50,7 +40,7 @@ export interface CtxOptions {
|
|
|
50
40
|
}
|
|
51
41
|
|
|
52
42
|
/**
|
|
53
|
-
* Build the run context. HOME
|
|
43
|
+
* Build the run context. HOME applies on every path;
|
|
54
44
|
* the env globals apply only when `options.envGlobals` is true.
|
|
55
45
|
*/
|
|
56
46
|
export function makeCtx(services: EngineServices, options: CtxOptions): Ctx {
|
|
@@ -60,26 +50,11 @@ export function makeCtx(services: EngineServices, options: CtxOptions): Ctx {
|
|
|
60
50
|
return {
|
|
61
51
|
repoDir: kitHome(),
|
|
62
52
|
home,
|
|
63
|
-
agentsDir:
|
|
64
|
-
globals["AGENTS_DIR"] !== undefined && globals["AGENTS_DIR"] !== ""
|
|
65
|
-
? globals["AGENTS_DIR"]
|
|
66
|
-
: p(home, ".agents"),
|
|
67
|
-
interactive:
|
|
68
|
-
env["DOCKS_KIT_INTERACTIVE"] === "1" ||
|
|
69
|
-
(env["DOCKS_KIT_INTERACTIVE"] !== "0" &&
|
|
70
|
-
process.stdout.isTTY === true &&
|
|
71
|
-
process.stdin.isTTY === true),
|
|
72
53
|
dryRun: globals["DRY_RUN"] === "1",
|
|
73
54
|
verbose: globals["DOCKS_KIT_VERBOSE"] === "1",
|
|
74
55
|
skipPluginRefresh: false,
|
|
75
|
-
prune: globals["PRUNE"] === "1",
|
|
76
|
-
syncConcurrency: 3,
|
|
77
56
|
services,
|
|
78
|
-
targetFilterSet: false,
|
|
79
|
-
syncAgents: false,
|
|
80
|
-
syncOmp: false,
|
|
81
57
|
nextStepTriggers: {
|
|
82
|
-
skillsRestart: false,
|
|
83
58
|
ompRestart: false,
|
|
84
59
|
ompPluginUpgraded: false,
|
|
85
60
|
},
|
|
@@ -5,8 +5,8 @@
|
|
|
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`,
|
|
9
|
-
* `syncConcurrency.ts`, and
|
|
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
|
*/
|
|
@@ -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.
|
|
15
|
-
*
|
|
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
|
|
20
|
-
//
|
|
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
|
|
92
|
-
readonly
|
|
93
|
-
readonly
|
|
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.
|
|
107
|
-
//
|
|
108
|
-
function
|
|
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
|
|
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
|
|
122
|
+
if (selector === null) return undefined;
|
|
126
123
|
return {
|
|
127
|
-
|
|
128
|
-
|
|
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
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
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 {
|
|
@@ -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
|
|
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 "./
|
|
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
|
|
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 `
|
|
264
|
-
*
|
|
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
|
|
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
|
|
@@ -16,7 +16,6 @@ export function posixHost(inputs: PosixHostInputs): HostOs {
|
|
|
16
16
|
return {
|
|
17
17
|
id: inputs.id,
|
|
18
18
|
toolchainOs: inputs.toolchainOs,
|
|
19
|
-
directoryLinkKinds: ["symlink"],
|
|
20
19
|
executableSuffixes: [""],
|
|
21
20
|
invoke: (executablePath, args) => ({ command: executablePath, args }),
|
|
22
21
|
bunExecutableName: "bun",
|