docks-kit 0.22.20 → 0.22.23
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 +5 -5
- package/cli/docs/command-guards.md +5 -4
- package/cli/docs/omp-context.md +13 -9
- package/cli/docs/omp-models.md +90 -69
- package/cli/src/commands/omp.ts +25 -73
- package/cli/src/engine-native/harnesses.ts +5 -11
- package/cli/src/engine-native/kitDb.ts +7 -7
- package/cli/src/engine-native/ompOverlay.ts +23 -69
- package/cli/src/engine-native/ompRemovals.ts +47 -8
- package/cli/src/engine-native/sharedTypes.d.ts +0 -2
- package/cli/src/generated/sotPayload.ts +5 -5
- package/package.json +1 -1
|
@@ -16,6 +16,8 @@ import { p } from "./exec";
|
|
|
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
21
|
`CREATE TABLE harness_selection (
|
|
20
22
|
harness TEXT PRIMARY KEY CHECK (harness IN ('claude','codex','agents','omp'))
|
|
21
23
|
) STRICT, WITHOUT ROWID;
|
|
@@ -88,7 +90,7 @@ function migrate(db: DatabaseSync): boolean {
|
|
|
88
90
|
|
|
89
91
|
interface LegacyState {
|
|
90
92
|
readonly harnesses: ReadonlyArray<string>;
|
|
91
|
-
readonly session?: { selector: string; thinking: string | null
|
|
93
|
+
readonly session?: { selector: string; thinking: string | null };
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
export function isNonBlankString(value: unknown): value is string {
|
|
@@ -126,9 +128,6 @@ function parseLegacyState(file: string): LegacyState | undefined {
|
|
|
126
128
|
session: {
|
|
127
129
|
selector,
|
|
128
130
|
thinking: nonBlankOrNull("thinking" in entry ? entry.thinking : undefined),
|
|
129
|
-
advisorThinking: nonBlankOrNull(
|
|
130
|
-
"advisorThinking" in entry ? entry.advisorThinking : undefined,
|
|
131
|
-
),
|
|
132
131
|
},
|
|
133
132
|
};
|
|
134
133
|
}
|
|
@@ -148,9 +147,10 @@ function importLegacyState(db: DatabaseSync, legacy: string): void {
|
|
|
148
147
|
);
|
|
149
148
|
for (const harness of state.harnesses) insertHarness.run(harness);
|
|
150
149
|
if (state.session !== undefined) {
|
|
151
|
-
db.prepare(
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
db.prepare("INSERT INTO omp_session (id, selector, thinking) VALUES (1, ?, ?)").run(
|
|
151
|
+
state.session.selector,
|
|
152
|
+
state.session.thinking,
|
|
153
|
+
);
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
// An invalid file is renamed too, so no later run parses it again.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Run overlay for `docks-kit omp`. The overlay merges over the deployed omp
|
|
3
3
|
* config for one run only. It sets the 16 roles in ROLE_ORDER to the free
|
|
4
|
-
* model and empties the
|
|
4
|
+
* model and empties the 12 retry chains in FALLBACK_ORDER and the chains keyed
|
|
5
5
|
* by the free model. omp merges the overlay key by key, so each deployed retry
|
|
6
6
|
* chain that is not in FALLBACK_ORDER stays as deployed. The `web` role and
|
|
7
7
|
* its retry chain are not in the overlay, so the deployed web-search provider
|
|
8
8
|
* order applies, and that order can include a paid chat model. A deployed
|
|
9
|
-
* `plan`, `slow`, or `designer` chain also stays, but a retry of
|
|
10
|
-
* model uses the empty chain keyed by that model first. Every other
|
|
11
|
-
* through to the deployed config.
|
|
9
|
+
* `advisor`, `plan`, `slow`, or `designer` chain also stays, but a retry of
|
|
10
|
+
* the free model uses the empty chain keyed by that model first. Every other
|
|
11
|
+
* key falls through to the deployed config.
|
|
12
12
|
*/
|
|
13
13
|
import { createHash } from "node:crypto";
|
|
14
14
|
import { delimiter } from "node:path";
|
|
@@ -35,7 +35,7 @@ export const THINKING_LADDER: ReadonlyArray<string> = [
|
|
|
35
35
|
* One overlay file per distinct model and level combination, so a second
|
|
36
36
|
* launcher cannot rewrite the file a running session still reads. omp
|
|
37
37
|
* reloads a changed overlay mid-session, so the digest covers the exact
|
|
38
|
-
* rendered overlay: the selector,
|
|
38
|
+
* rendered overlay: the selector, the level, and every rendered key. A
|
|
39
39
|
* selector carries a slash and may carry other characters a host rejects in
|
|
40
40
|
* a file name, so unsafe characters in the readable prefix become hyphens.
|
|
41
41
|
*/
|
|
@@ -47,14 +47,16 @@ export function overlayFileName(model: OmpSessionModel): string {
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Role keys in the order used by SoT/.omp/config.yml for readable diffs. The
|
|
50
|
-
* SoT does not set `memory
|
|
51
|
-
* falls back to the omp built-in priority chain, which can name a
|
|
52
|
-
*
|
|
53
|
-
*
|
|
50
|
+
* SoT does not set `advisor`, `memory`, and `judge`, so they come last. An
|
|
51
|
+
* unset role falls back to the omp built-in priority chain, which can name a
|
|
52
|
+
* paid model. omp takes the `/advisor on` model from the `advisor` role and
|
|
53
|
+
* uses `slow` only when that role is unset, so the overlay pins `advisor`
|
|
54
|
+
* too: a deployed or project advisor role would otherwise send the advisor
|
|
55
|
+
* to a paid model. The `web` role is left out on purpose, so the
|
|
56
|
+
* deployed web-search provider order applies.
|
|
54
57
|
*/
|
|
55
58
|
const ROLE_ORDER: ReadonlyArray<string> = [
|
|
56
59
|
"smol",
|
|
57
|
-
"advisor",
|
|
58
60
|
"designer",
|
|
59
61
|
"plan",
|
|
60
62
|
"commit",
|
|
@@ -67,6 +69,7 @@ const ROLE_ORDER: ReadonlyArray<string> = [
|
|
|
67
69
|
"switch_fable",
|
|
68
70
|
"astra",
|
|
69
71
|
"reviewer",
|
|
72
|
+
"advisor",
|
|
70
73
|
"memory",
|
|
71
74
|
"judge",
|
|
72
75
|
];
|
|
@@ -78,7 +81,6 @@ const ROLE_ORDER: ReadonlyArray<string> = [
|
|
|
78
81
|
*/
|
|
79
82
|
const FALLBACK_ORDER: ReadonlyArray<string> = [
|
|
80
83
|
"default",
|
|
81
|
-
"advisor",
|
|
82
84
|
"task",
|
|
83
85
|
"vision",
|
|
84
86
|
"smol",
|
|
@@ -147,29 +149,12 @@ export function ladderCeiling(levels: ReadonlyArray<string>): string | undefined
|
|
|
147
149
|
return undefined;
|
|
148
150
|
}
|
|
149
151
|
|
|
150
|
-
/**
|
|
151
|
-
* Resolve the advisor level from the model own ladder. The advisor runs
|
|
152
|
-
* quick review passes, so it takes the highest level at or below medium,
|
|
153
|
-
* and the lowest level when the ladder starts above medium. The result
|
|
154
|
-
* never exceeds the ladder ceiling by construction.
|
|
155
|
-
*/
|
|
156
|
-
export function advisorLevelFor(levels: ReadonlyArray<string>): string | undefined {
|
|
157
|
-
const known = THINKING_LADDER.filter((level) => levels.includes(level));
|
|
158
|
-
if (known.length === 0) return undefined;
|
|
159
|
-
const mediumIndex = THINKING_LADDER.indexOf("medium");
|
|
160
|
-
let advisor: string | undefined;
|
|
161
|
-
for (const level of known) {
|
|
162
|
-
if ((THINKING_LADDER.indexOf(level) as number) <= (mediumIndex as number)) advisor = level;
|
|
163
|
-
}
|
|
164
|
-
return advisor ?? (known[0] as string);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
152
|
/**
|
|
168
153
|
* What the picker may ask about thinking levels for one model. omp accepts a
|
|
169
154
|
* `:level` suffix on a role only for a level the model publishes, so the
|
|
170
155
|
* question set comes from the model own ladder: no ladder means no question,
|
|
171
|
-
* a single level means no choice to make, and two or more levels mean
|
|
172
|
-
*
|
|
156
|
+
* a single level means no choice to make, and two or more levels mean one
|
|
157
|
+
* level choice for every role.
|
|
173
158
|
*/
|
|
174
159
|
export type EffortPlan =
|
|
175
160
|
| { readonly kind: "none" }
|
|
@@ -184,39 +169,19 @@ export function planEffortChoice(levels: ReadonlyArray<string>): EffortPlan {
|
|
|
184
169
|
return { kind: "choose", levels: known, highest: known[known.length - 1] as string };
|
|
185
170
|
}
|
|
186
171
|
|
|
187
|
-
/**
|
|
188
|
-
* Recommend an advisor level for a chosen main level. The advisor runs quick
|
|
189
|
-
* review passes, so it sits two steps down the model own ladder, and it
|
|
190
|
-
* clamps to the lowest level the model publishes. Steps count positions in
|
|
191
|
-
* that model ladder, not the global ladder, so a sparse ladder such as
|
|
192
|
-
* `high, max` still recommends a real level.
|
|
193
|
-
*/
|
|
194
|
-
export function advisorRecommendation(
|
|
195
|
-
levels: ReadonlyArray<string>,
|
|
196
|
-
main: string,
|
|
197
|
-
): string | undefined {
|
|
198
|
-
const known = THINKING_LADDER.filter((level) => levels.includes(level));
|
|
199
|
-
const index = known.indexOf(main);
|
|
200
|
-
if (index < 0) return known[0];
|
|
201
|
-
return known[Math.max(0, index - 2)];
|
|
202
|
-
}
|
|
203
|
-
|
|
204
172
|
/** A thinking level the overlay can render, or undefined for a blank one. */
|
|
205
173
|
function renderableLevel(level: string | undefined): string | undefined {
|
|
206
174
|
return typeof level === "string" && level.trim() !== "" ? level : undefined;
|
|
207
175
|
}
|
|
208
176
|
|
|
209
177
|
/**
|
|
210
|
-
* The value the overlay gives
|
|
178
|
+
* The value the overlay gives every role. The overlay, the session `--model`,
|
|
211
179
|
* and the child environment all use it, so the three cannot drift apart. A
|
|
212
180
|
* model without a level gets the bare selector so the deployed level applies.
|
|
213
181
|
*/
|
|
214
|
-
function roleValue(model: OmpSessionModel
|
|
182
|
+
function roleValue(model: OmpSessionModel): string {
|
|
215
183
|
const thinking = renderableLevel(model.thinking);
|
|
216
|
-
|
|
217
|
-
const level =
|
|
218
|
-
role === "advisor" ? (renderableLevel(model.advisorThinking) ?? thinking) : thinking;
|
|
219
|
-
return `${model.selector}:${level}`;
|
|
184
|
+
return thinking === undefined ? model.selector : `${model.selector}:${thinking}`;
|
|
220
185
|
}
|
|
221
186
|
|
|
222
187
|
/**
|
|
@@ -230,7 +195,7 @@ export function renderFreeOverlay(model: OmpSessionModel): string {
|
|
|
230
195
|
if (thinking !== undefined) lines.push(`defaultThinkingLevel: ${thinking}`);
|
|
231
196
|
lines.push("modelRoles:");
|
|
232
197
|
for (const role of ROLE_ORDER) {
|
|
233
|
-
lines.push(` ${role}: ${roleValue(model
|
|
198
|
+
lines.push(` ${role}: ${roleValue(model)}`);
|
|
234
199
|
}
|
|
235
200
|
if (thinking !== undefined) lines.push("task:", ` maxEffort: ${thinking}`);
|
|
236
201
|
lines.push("retry:", " fallbackChains:");
|
|
@@ -258,22 +223,11 @@ export function buildOmpArgs(
|
|
|
258
223
|
session: OmpSessionModel,
|
|
259
224
|
passthrough: ReadonlyArray<string>,
|
|
260
225
|
): ReadonlyArray<string> {
|
|
261
|
-
return [
|
|
262
|
-
"launch",
|
|
263
|
-
"--config",
|
|
264
|
-
overlayPath,
|
|
265
|
-
"--model",
|
|
266
|
-
roleValue(session, "default"),
|
|
267
|
-
...passthrough,
|
|
268
|
-
];
|
|
226
|
+
return ["launch", "--config", overlayPath, "--model", roleValue(session), ...passthrough];
|
|
269
227
|
}
|
|
270
228
|
|
|
271
229
|
// Variables that omp reads at launch to set a role above every config layer.
|
|
272
|
-
const
|
|
273
|
-
["PI_SMOL_MODEL", "smol"],
|
|
274
|
-
["PI_SLOW_MODEL", "slow"],
|
|
275
|
-
["PI_PLAN_MODEL", "plan"],
|
|
276
|
-
];
|
|
230
|
+
const MODEL_ENV_NAMES: ReadonlyArray<string> = ["PI_SMOL_MODEL", "PI_SLOW_MODEL", "PI_PLAN_MODEL"];
|
|
277
231
|
|
|
278
232
|
export interface OmpChildEnvironment {
|
|
279
233
|
readonly env: Record<string, string | undefined>;
|
|
@@ -300,8 +254,8 @@ export function ompChildEnvironment(
|
|
|
300
254
|
PI_CONFIG_FILES: [...inherited, overlayPath].join(delimiter),
|
|
301
255
|
};
|
|
302
256
|
const replaced: Array<string> = [];
|
|
303
|
-
|
|
304
|
-
|
|
257
|
+
const value = roleValue(session);
|
|
258
|
+
for (const name of MODEL_ENV_NAMES) {
|
|
305
259
|
const previous = parent[name];
|
|
306
260
|
if (previous !== undefined && previous !== "" && previous !== value) replaced.push(name);
|
|
307
261
|
env[name] = value;
|
|
@@ -17,18 +17,31 @@ import type { Ctx } from "./index";
|
|
|
17
17
|
import { backupPrivateFile } from "./ompFileDeploy";
|
|
18
18
|
import { bashPatternKey, bashRuleKey } from "./ompYaml";
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
/** A retired leaf value: a scalar, or a sequence the kit shipped as one value. */
|
|
21
|
+
type RetiredValue = string | number | boolean | ReadonlyArray<string>;
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Keys the kit used to deploy, each paired with the exact value it deployed. A
|
|
24
25
|
* key is pruned only while the deployed value still equals that value, so a
|
|
25
|
-
* user who changed the setting keeps it.
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* user who changed the setting keeps it. A key listed twice shipped both
|
|
27
|
+
* values at different times.
|
|
28
|
+
*
|
|
29
|
+
* Most recorded values equal omp's current default, so pruning them changes no
|
|
30
|
+
* behavior today and lets a later upstream default change take effect. These
|
|
31
|
+
* entries differ from the default, and pruning them is intended:
|
|
32
|
+
* - `retry.usageAwareFallback: true` restores omp's default `false`, which
|
|
33
|
+
* removes the coding-plan reserve prompt.
|
|
34
|
+
* - `advisor.enabled: true` and `advisor.syncBacklog: "1"` (defaults `false`
|
|
35
|
+
* and `"off"`), `modelRoles.advisor`, and the empty
|
|
36
|
+
* `retry.fallbackChains.advisor` chain: the owner removed the advisor. omp
|
|
37
|
+
* keeps it off, and an `/advisor on` session runs on the `slow` role.
|
|
38
|
+
* - `codexResets.autoRedeem: "no"`: omp migrates this legacy key in memory to
|
|
39
|
+
* `autoRedeem5h` and `autoRedeemWeekly`, which the SoT now declares with the
|
|
40
|
+
* same value.
|
|
41
|
+
* - `compaction.thresholdTokens: 231200`: an old fixed compaction trigger.
|
|
42
|
+
* Pruning it restores omp's reserve-based default `-1`.
|
|
30
43
|
*/
|
|
31
|
-
const OMP_RETIRED_VALUES: ReadonlyArray<readonly [string,
|
|
44
|
+
export const OMP_RETIRED_VALUES: ReadonlyArray<readonly [string, RetiredValue]> = [
|
|
32
45
|
["symbolPreset", "unicode"],
|
|
33
46
|
["theme.dark", "titanium"],
|
|
34
47
|
["statusLine.preset", "default"],
|
|
@@ -48,6 +61,30 @@ const OMP_RETIRED_VALUES: ReadonlyArray<readonly [string, RetiredScalar]> = [
|
|
|
48
61
|
["autoResume", false],
|
|
49
62
|
["startup.changelogMode", "summary"],
|
|
50
63
|
["retry.usageAwareFallback", true],
|
|
64
|
+
["defaultThinkingLevel", "high"],
|
|
65
|
+
["tier.anthropic", "none"],
|
|
66
|
+
["advisor.enabled", true],
|
|
67
|
+
["advisor.enabled", false],
|
|
68
|
+
["advisor.syncBacklog", "1"],
|
|
69
|
+
["task.softRequestBudget", 200],
|
|
70
|
+
["task.softRequestBudgetNotice", true],
|
|
71
|
+
["task.batch", true],
|
|
72
|
+
["task.enableEffort", false],
|
|
73
|
+
["task.maxRecursionDepth", 2],
|
|
74
|
+
["modelRoles.advisor", "anthropic/claude-opus-5-5:medium"],
|
|
75
|
+
["providers.anthropic.serverSideFallback", false],
|
|
76
|
+
["providers.fetch", "auto"],
|
|
77
|
+
["retry.fallbackChains.advisor", []],
|
|
78
|
+
["includeWorkspaceTree", false],
|
|
79
|
+
["commands.enableOpencodeUser", false],
|
|
80
|
+
["skills.enableClaudeUser", false],
|
|
81
|
+
["skills.enableCodexUser", false],
|
|
82
|
+
["skills.enableAgentsUser", true],
|
|
83
|
+
["compaction.thresholdTokens", -1],
|
|
84
|
+
["compaction.thresholdTokens", 231200],
|
|
85
|
+
["textVerbosity", "low"],
|
|
86
|
+
["codexResets.autoRedeem", "no"],
|
|
87
|
+
["tools.approvalMode", "yolo"],
|
|
51
88
|
];
|
|
52
89
|
|
|
53
90
|
/**
|
|
@@ -352,7 +389,9 @@ export function syncOmpRemovals(ctx: Ctx, configFile: string, alreadyBackedUp: b
|
|
|
352
389
|
retiredKeys([
|
|
353
390
|
...OMP_RETIRED_VALUES.map(([path, value]): RetiredEntry => [
|
|
354
391
|
path,
|
|
355
|
-
(
|
|
392
|
+
Array.isArray(value)
|
|
393
|
+
? (node) => isSeq(node) && isDeepStrictEqual(node.toJSON(), value)
|
|
394
|
+
: (node) => isScalar(node) && node.value === value,
|
|
356
395
|
]),
|
|
357
396
|
...OMP_RETIRED_KEYS.map((path): RetiredEntry => [path, () => true]),
|
|
358
397
|
]),
|
|
@@ -47,8 +47,6 @@ export interface OmpSessionModel {
|
|
|
47
47
|
// Session ceiling; absent when the model publishes no ladder, so no
|
|
48
48
|
// invented level ever reaches a selector that omp must resolve.
|
|
49
49
|
readonly thinking?: string;
|
|
50
|
-
// Advisor level; absent when the model publishes no ladder.
|
|
51
|
-
readonly advisorThinking?: string;
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
/**
|