docks-kit 0.23.0 → 0.25.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 +22 -138
- package/README.md +38 -23
- package/cli/docs/command-guards.md +5 -3
- package/cli/docs/flags.md +11 -29
- package/cli/docs/install.md +5 -4
- package/cli/docs/omp-context.md +79 -7
- package/cli/docs/omp-models.md +22 -15
- package/cli/docs/overview.md +5 -8
- package/cli/docs/sync-layers.md +55 -83
- package/cli/docs/toolchain.md +7 -8
- 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/commands/update.ts +3 -3
- package/cli/src/engine-native/DESIGN.md +24 -35
- package/cli/src/engine-native/deps.ts +2 -7
- package/cli/src/engine-native/engineCtx.ts +3 -31
- package/cli/src/engine-native/failures.ts +2 -2
- package/cli/src/engine-native/index.ts +2 -2
- package/cli/src/engine-native/kitDb.ts +21 -37
- package/cli/src/engine-native/ompChild.ts +1 -1
- package/cli/src/engine-native/ompFastMode.ts +1 -1
- package/cli/src/engine-native/ompKitPlugin.ts +7 -16
- package/cli/src/engine-native/ompOverlay.ts +1 -1
- package/cli/src/engine-native/ompPlugins.ts +205 -221
- 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 +6 -15
- 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 +339 -17
- package/cli/src/main.ts +3 -7
- package/cli/tsconfig.json +1 -0
- 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/ompMarketplace.ts +0 -140
- 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
|
@@ -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.
|
|
@@ -38,16 +39,11 @@ shell engine was removed after the `bash-engine-final` tag.
|
|
|
38
39
|
the whole files, merges `config.yml` and runs the retired-key removals on
|
|
39
40
|
the merged result, merges `models.yml` and runs its removals, writes the
|
|
40
41
|
intercom configuration, materializes the kit plugin, and only then runs the
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
rejection, started pipelines drain and queued pipelines never start.
|
|
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
|
|
42
|
+
plugin pass, because the plugin pass links the kit plugin directory.
|
|
43
|
+
- **One pipeline.** Sync runs only the omp pipeline, which is serial.
|
|
44
|
+
`syncConcurrency.ts` `runBounded` stays for the parallel probes of `tidy`
|
|
45
|
+
and the tidy report.
|
|
46
|
+
- **External CLIs stay external.** `omp`, `npm`, `bun`, and `curl` are
|
|
51
47
|
spawned with argv arrays, not shell command strings except where an external
|
|
52
48
|
installer contract requires a script interpreter.
|
|
53
49
|
- **Backups precede mutation.** Deployed settings/config files write `.bak`
|
|
@@ -117,15 +113,14 @@ bootstrap needs an installer download.
|
|
|
117
113
|
the deliverable (the report table for `toolchain check`), so nothing prints
|
|
118
114
|
after it. The schema below applies to `sync` only.
|
|
119
115
|
|
|
120
|
-
The `--- Sync complete ---` block (stdout, `echo`) prints after the
|
|
121
|
-
|
|
116
|
+
The `--- Sync complete ---` block (stdout, `echo`) prints after the omp
|
|
117
|
+
pipeline settles, also on dry-run. When the pipeline rejects, `syncDispatch.ts`
|
|
122
118
|
`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
|
-
|
|
128
|
-
`--verbose`.
|
|
119
|
+
The block starts with a `Repo:` line and adds the `omp:` and `omp plugins:`
|
|
120
|
+
inventory lines. Dry-run leaves out the `omp plugins:` line. Next-step advice
|
|
121
|
+
lines print only when their trigger changed this run (an omp plugin operation,
|
|
122
|
+
such as the uninstall of a retired marketplace plugin, or a changed omp file →
|
|
123
|
+
restart line) or under `--verbose`.
|
|
129
124
|
|
|
130
125
|
### Platform seam
|
|
131
126
|
|
|
@@ -134,7 +129,7 @@ holds the engine's host-detection `process.platform` read and keeps platform
|
|
|
134
129
|
normalization injectable for tests. These direct reads remain:
|
|
135
130
|
|
|
136
131
|
- the POSIX-only `chmod` guard in `kitDb.ts`;
|
|
137
|
-
- the default `platform` argument of `
|
|
132
|
+
- the default `platform` argument of `ompSession.ts` `engineHome`;
|
|
138
133
|
- `exec.ts` `WINDOWS_PROCESS`;
|
|
139
134
|
- `tidy.ts` `listProcesses`;
|
|
140
135
|
- `tidyReport.ts` `memorySection`, `processSection`, `trashSection`,
|
|
@@ -161,8 +156,8 @@ on the host directly.
|
|
|
161
156
|
`--verbose` / `-v` on the public `sync` and `toolchain` commands selects
|
|
162
157
|
verbose output. On the harness-private raw channel,
|
|
163
158
|
`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
|
|
159
|
+
unprefixed `Ctx` env globals (`engineCtx.ts makeCtx` reads `DRY_RUN` and
|
|
160
|
+
`DOCKS_KIT_VERBOSE`). `main.ts` passes `{ envGlobals: true }` to
|
|
166
161
|
`runEngineNative` only on that channel. The public `engine()` seam ignores
|
|
167
162
|
these variables.
|
|
168
163
|
The default service factory returns a raw Logger. `runEngineNative` wraps the
|
|
@@ -175,15 +170,14 @@ active logger binding.
|
|
|
175
170
|
|
|
176
171
|
| Module | Owns |
|
|
177
172
|
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
178
|
-
| `parseArgs.ts` | engine usage
|
|
173
|
+
| `parseArgs.ts` | engine usage and the argv dispatch loop; re-exports the `parseHelp.ts` help text and early-exit error |
|
|
179
174
|
| `index.ts` | entry routing (`toolchain`/`sync`) and the run-scoped verbosity gate |
|
|
180
175
|
| `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`)
|
|
176
|
+
| `syncDispatch.ts` | sync and folder locks, the omp pipeline call, run summary, next-step blocks, and the `--- Failures ---` ledger |
|
|
177
|
+
| `syncConcurrency.ts` | input-ordered bounded pool (`runBounded`) for the tidy probes |
|
|
183
178
|
| `../payload.ts` | generated text payload reads and presentation-only source labels |
|
|
184
179
|
| `bun.ts` | per-run memoized Bun resolution/bootstrap shared by the omp pipeline and direct toolchain ensure |
|
|
185
|
-
| `
|
|
186
|
-
| `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 |
|
|
180
|
+
| `ompSync.ts` | omp pipeline orchestration and summary; `ompFileDeploy.ts`, `ompPlugins.ts`, and `ompRemovals.ts` own the file, plugin (with the marketplace-plugin retirement), and retired-key passes; `ompPaths.ts` resolves roots; `ompYaml.ts` merges YAML |
|
|
187
181
|
| `toolchain.ts` | tool presence/version probes, verified-version floor reporting, report table |
|
|
188
182
|
| `modes.ts` | direct `toolchain` mode |
|
|
189
183
|
| `jq.ts` | the `Json` value type, object narrowing, jq-compatible codepoint ordering, and a parse that yields `undefined` instead of throwing |
|
|
@@ -199,11 +193,6 @@ active logger binding.
|
|
|
199
193
|
x64.
|
|
200
194
|
- Unsupported hosts fail before launcher fallback, dependency probes, downloads,
|
|
201
195
|
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
196
|
|
|
208
197
|
## Tests
|
|
209
198
|
|
|
@@ -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,37 +3,25 @@
|
|
|
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
|
-
/** A marketplace plugin upgrade changed a version, so running omp sessions lost its folder. */
|
|
36
|
-
ompPluginUpgraded: boolean;
|
|
37
25
|
};
|
|
38
26
|
/** Harness-CLI operations that failed this run; a non-empty list fails the sync. */
|
|
39
27
|
readonly failures: Array<string>;
|
|
@@ -42,7 +30,7 @@ export interface Ctx {
|
|
|
42
30
|
export interface CtxOptions {
|
|
43
31
|
/**
|
|
44
32
|
* True only on the harness-private native-raw channel: seed `Ctx` from the
|
|
45
|
-
* unprefixed env globals DRY_RUN
|
|
33
|
+
* unprefixed env globals DRY_RUN and DOCKS_KIT_VERBOSE
|
|
46
34
|
* (the historical ${VAR:-default} contract). The public CLI takes the same
|
|
47
35
|
* behavior from flags.
|
|
48
36
|
*/
|
|
@@ -50,7 +38,7 @@ export interface CtxOptions {
|
|
|
50
38
|
}
|
|
51
39
|
|
|
52
40
|
/**
|
|
53
|
-
* Build the run context. HOME
|
|
41
|
+
* Build the run context. HOME applies on every path;
|
|
54
42
|
* the env globals apply only when `options.envGlobals` is true.
|
|
55
43
|
*/
|
|
56
44
|
export function makeCtx(services: EngineServices, options: CtxOptions): Ctx {
|
|
@@ -60,28 +48,12 @@ export function makeCtx(services: EngineServices, options: CtxOptions): Ctx {
|
|
|
60
48
|
return {
|
|
61
49
|
repoDir: kitHome(),
|
|
62
50
|
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
51
|
dryRun: globals["DRY_RUN"] === "1",
|
|
73
52
|
verbose: globals["DOCKS_KIT_VERBOSE"] === "1",
|
|
74
53
|
skipPluginRefresh: false,
|
|
75
|
-
prune: globals["PRUNE"] === "1",
|
|
76
|
-
syncConcurrency: 3,
|
|
77
54
|
services,
|
|
78
|
-
targetFilterSet: false,
|
|
79
|
-
syncAgents: false,
|
|
80
|
-
syncOmp: false,
|
|
81
55
|
nextStepTriggers: {
|
|
82
|
-
skillsRestart: false,
|
|
83
56
|
ompRestart: false,
|
|
84
|
-
ompPluginUpgraded: false,
|
|
85
57
|
},
|
|
86
58
|
failures: [],
|
|
87
59
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Failure ledger for harness-CLI operations. A kit-managed
|
|
3
|
-
*
|
|
2
|
+
* Failure ledger for harness-CLI operations. A kit-managed plugin or
|
|
3
|
+
* marketplace command that exits non-zero is recorded here so engineSync can list
|
|
4
4
|
* it and exit non-zero instead of reporting a clean sync.
|
|
5
5
|
*/
|
|
6
6
|
import type { Ctx } from "./index";
|
|
@@ -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 {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `omp` child processes of a sync. Every `omp` command that the
|
|
3
|
-
*
|
|
3
|
+
* plugin pass runs starts through `spawnOmp`, so each child
|
|
4
4
|
* writes into the data root that the sync locked.
|
|
5
5
|
*/
|
|
6
6
|
import { spawnProcess, type AsyncProcessOptions, type AsyncProcessResult } from "./exec";
|
|
@@ -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
|
|
|
@@ -6,19 +6,11 @@
|
|
|
6
6
|
* the payload no longer lists. Split from ompSync.ts; the orchestration still
|
|
7
7
|
* lives there.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
chmodSync,
|
|
11
|
-
existsSync,
|
|
12
|
-
lstatSync,
|
|
13
|
-
readFileSync,
|
|
14
|
-
readdirSync,
|
|
15
|
-
rmdirSync,
|
|
16
|
-
unlinkSync,
|
|
17
|
-
writeFileSync,
|
|
18
|
-
} from "node:fs";
|
|
9
|
+
import { existsSync, lstatSync, readFileSync, readdirSync, rmdirSync, unlinkSync } from "node:fs";
|
|
19
10
|
|
|
20
11
|
import { GENERATED_PACKAGE_VERSION } from "../generated/sotPayload";
|
|
21
|
-
import { payloadBytes,
|
|
12
|
+
import { payloadBytes, payloadPaths } from "../payload";
|
|
13
|
+
import { replaceFile } from "./atomicWrite";
|
|
22
14
|
import { p } from "./exec";
|
|
23
15
|
import type { Ctx } from "./index";
|
|
24
16
|
import { isObject, parseJson } from "./jq";
|
|
@@ -69,9 +61,8 @@ export function syncKitPlugin(ctx: Ctx): void {
|
|
|
69
61
|
}));
|
|
70
62
|
|
|
71
63
|
if (ctx.dryRun) {
|
|
72
|
-
for
|
|
73
|
-
|
|
74
|
-
}
|
|
64
|
+
// One line for the folder: a line per file would grow with each plugin file.
|
|
65
|
+
echo(`[dry-run] sync embedded:${SOURCE_PREFIX} -> ${pluginDir}`);
|
|
75
66
|
return;
|
|
76
67
|
}
|
|
77
68
|
|
|
@@ -87,8 +78,8 @@ export function syncKitPlugin(ctx: Ctx): void {
|
|
|
87
78
|
}
|
|
88
79
|
ensureDirectory(target.slice(0, target.lastIndexOf("/")));
|
|
89
80
|
if (existsSync(target) && readFileSync(target).equals(content)) continue;
|
|
90
|
-
|
|
91
|
-
|
|
81
|
+
// A rename, so a session that reads the file during a sync sees the old or the new file.
|
|
82
|
+
replaceFile(target, content, { mode: 0o600 });
|
|
92
83
|
changed = true;
|
|
93
84
|
}
|
|
94
85
|
if (existsSync(pluginDir)) {
|
|
@@ -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;
|