harness-dispatch 0.4.0 → 0.6.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/CHANGELOG.md +152 -0
- package/README.md +232 -87
- package/config.default.yaml +416 -397
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +2 -2
- package/dist/auth.js.map +1 -1
- package/dist/billing.d.ts +35 -4
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +48 -17
- package/dist/billing.js.map +1 -1
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +147 -91
- package/dist/bin.js.map +1 -1
- package/dist/breaker-store.d.ts +60 -9
- package/dist/breaker-store.d.ts.map +1 -1
- package/dist/breaker-store.js +246 -50
- package/dist/breaker-store.js.map +1 -1
- package/dist/circuit-breaker.d.ts +35 -0
- package/dist/circuit-breaker.d.ts.map +1 -1
- package/dist/circuit-breaker.js +68 -11
- package/dist/circuit-breaker.js.map +1 -1
- package/dist/config/coercions.d.ts +31 -0
- package/dist/config/coercions.d.ts.map +1 -0
- package/dist/config/coercions.js +169 -0
- package/dist/config/coercions.js.map +1 -0
- package/dist/config/env-interpolation.d.ts +36 -0
- package/dist/config/env-interpolation.d.ts.map +1 -0
- package/dist/config/env-interpolation.js +73 -0
- package/dist/config/env-interpolation.js.map +1 -0
- package/dist/config/protocol.d.ts +51 -0
- package/dist/config/protocol.d.ts.map +1 -0
- package/dist/config/protocol.js +300 -0
- package/dist/config/protocol.js.map +1 -0
- package/dist/config/route-fields.d.ts +72 -0
- package/dist/config/route-fields.d.ts.map +1 -0
- package/dist/config/route-fields.js +128 -0
- package/dist/config/route-fields.js.map +1 -0
- package/dist/config/validation.d.ts +72 -0
- package/dist/config/validation.d.ts.map +1 -0
- package/dist/config/validation.js +189 -0
- package/dist/config/validation.js.map +1 -0
- package/dist/config.d.ts +19 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +214 -635
- package/dist/config.js.map +1 -1
- package/dist/configure-yaml.d.ts +23 -0
- package/dist/configure-yaml.d.ts.map +1 -0
- package/dist/configure-yaml.js +193 -0
- package/dist/configure-yaml.js.map +1 -0
- package/dist/dispatch-log.d.ts.map +1 -1
- package/dist/dispatch-log.js +2 -3
- package/dist/dispatch-log.js.map +1 -1
- package/dist/dispatchers/base.d.ts +3 -0
- package/dist/dispatchers/base.d.ts.map +1 -1
- package/dist/dispatchers/base.js.map +1 -1
- package/dist/dispatchers/generic-cli.d.ts +15 -1
- package/dist/dispatchers/generic-cli.d.ts.map +1 -1
- package/dist/dispatchers/generic-cli.js +69 -5
- package/dist/dispatchers/generic-cli.js.map +1 -1
- package/dist/dispatchers/openai-compatible.d.ts.map +1 -1
- package/dist/dispatchers/openai-compatible.js +70 -2
- package/dist/dispatchers/openai-compatible.js.map +1 -1
- package/dist/dispatchers/shared/kill-tree.d.ts +17 -4
- package/dist/dispatchers/shared/kill-tree.d.ts.map +1 -1
- package/dist/dispatchers/shared/kill-tree.js +28 -4
- package/dist/dispatchers/shared/kill-tree.js.map +1 -1
- package/dist/dispatchers/shared/rate-limit-headers.d.ts +17 -0
- package/dist/dispatchers/shared/rate-limit-headers.d.ts.map +1 -1
- package/dist/dispatchers/shared/rate-limit-headers.js +27 -0
- package/dist/dispatchers/shared/rate-limit-headers.js.map +1 -1
- package/dist/dispatchers/shared/stream-subprocess.d.ts +11 -0
- package/dist/dispatchers/shared/stream-subprocess.d.ts.map +1 -1
- package/dist/dispatchers/shared/stream-subprocess.js +62 -35
- package/dist/dispatchers/shared/stream-subprocess.js.map +1 -1
- package/dist/dispatchers/shared/subprocess.d.ts.map +1 -1
- package/dist/dispatchers/shared/subprocess.js +3 -0
- package/dist/dispatchers/shared/subprocess.js.map +1 -1
- package/dist/dispatchers/shared/which-available.d.ts.map +1 -1
- package/dist/dispatchers/shared/which-available.js +16 -2
- package/dist/dispatchers/shared/which-available.js.map +1 -1
- package/dist/file-lock.d.ts +17 -0
- package/dist/file-lock.d.ts.map +1 -0
- package/dist/file-lock.js +143 -0
- package/dist/file-lock.js.map +1 -0
- package/dist/http/parse.d.ts +64 -0
- package/dist/http/parse.d.ts.map +1 -0
- package/dist/http/parse.js +230 -0
- package/dist/http/parse.js.map +1 -0
- package/dist/http/server.d.ts +2 -0
- package/dist/http/server.d.ts.map +1 -1
- package/dist/http/server.js +249 -286
- package/dist/http/server.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/job-runner.js +23 -5
- package/dist/job-runner.js.map +1 -1
- package/dist/jobs/context.d.ts +17 -0
- package/dist/jobs/context.d.ts.map +1 -0
- package/dist/jobs/context.js +84 -0
- package/dist/jobs/context.js.map +1 -0
- package/dist/jobs/store.d.ts +80 -0
- package/dist/jobs/store.d.ts.map +1 -0
- package/dist/jobs/store.js +279 -0
- package/dist/jobs/store.js.map +1 -0
- package/dist/jobs/types.d.ts +135 -0
- package/dist/jobs/types.d.ts.map +1 -0
- package/dist/jobs/types.js +11 -0
- package/dist/jobs/types.js.map +1 -0
- package/dist/jobs.d.ts +165 -85
- package/dist/jobs.d.ts.map +1 -1
- package/dist/jobs.js +824 -208
- package/dist/jobs.js.map +1 -1
- package/dist/leaderboard.d.ts +24 -1
- package/dist/leaderboard.d.ts.map +1 -1
- package/dist/leaderboard.js +94 -2
- package/dist/leaderboard.js.map +1 -1
- package/dist/mcp/config-hot-reload.d.ts.map +1 -1
- package/dist/mcp/config-hot-reload.js +1 -1
- package/dist/mcp/config-hot-reload.js.map +1 -1
- package/dist/mcp/dispatcher-factory.d.ts +16 -1
- package/dist/mcp/dispatcher-factory.d.ts.map +1 -1
- package/dist/mcp/dispatcher-factory.js +41 -3
- package/dist/mcp/dispatcher-factory.js.map +1 -1
- package/dist/mcp/tool-schemas.d.ts +194 -0
- package/dist/mcp/tool-schemas.d.ts.map +1 -0
- package/dist/mcp/tool-schemas.js +311 -0
- package/dist/mcp/tool-schemas.js.map +1 -0
- package/dist/mcp/tools.d.ts +26 -51
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +122 -151
- package/dist/mcp/tools.js.map +1 -1
- package/dist/observability/index.d.ts +16 -3
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +23 -7
- package/dist/observability/index.js.map +1 -1
- package/dist/observability/spans.d.ts.map +1 -1
- package/dist/observability/spans.js +4 -1
- package/dist/observability/spans.js.map +1 -1
- package/dist/quota.d.ts +106 -22
- package/dist/quota.d.ts.map +1 -1
- package/dist/quota.js +198 -58
- package/dist/quota.js.map +1 -1
- package/dist/route-policy.d.ts.map +1 -1
- package/dist/route-policy.js +13 -3
- package/dist/route-policy.js.map +1 -1
- package/dist/router.d.ts +29 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +102 -40
- package/dist/router.js.map +1 -1
- package/dist/safety.d.ts.map +1 -1
- package/dist/safety.js +11 -2
- package/dist/safety.js.map +1 -1
- package/dist/state-dir.d.ts +17 -0
- package/dist/state-dir.d.ts.map +1 -0
- package/dist/state-dir.js +21 -0
- package/dist/state-dir.js.map +1 -0
- package/dist/status.d.ts +49 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +67 -4
- package/dist/status.js.map +1 -1
- package/dist/types.d.ts +74 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/working-dir.d.ts +13 -0
- package/dist/working-dir.d.ts.map +1 -1
- package/dist/working-dir.js +27 -0
- package/dist/working-dir.js.map +1 -1
- package/dist/workspace-lock.d.ts +40 -0
- package/dist/workspace-lock.d.ts.map +1 -0
- package/dist/workspace-lock.js +258 -0
- package/dist/workspace-lock.js.map +1 -0
- package/dist/workspace-resolve.d.ts +98 -0
- package/dist/workspace-resolve.d.ts.map +1 -0
- package/dist/workspace-resolve.js +382 -0
- package/dist/workspace-resolve.js.map +1 -0
- package/dist/workspaces.d.ts +16 -0
- package/dist/workspaces.d.ts.map +1 -1
- package/dist/workspaces.js +166 -22
- package/dist/workspaces.js.map +1 -1
- package/package.json +99 -96
- package/dist/dashboard/live.d.ts +0 -49
- package/dist/dashboard/live.d.ts.map +0 -1
- package/dist/dashboard/live.js +0 -149
- package/dist/dashboard/live.js.map +0 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a config file is ALLOWED to say, and what to warn about when it says
|
|
3
|
+
* something else.
|
|
4
|
+
*
|
|
5
|
+
* Split out of config.ts. This module exists because of a specific, repeated
|
|
6
|
+
* failure: the parser reads what it recognises and cannot distinguish a key it
|
|
7
|
+
* does not know from a key that is absent. Four silent-drop defects came from
|
|
8
|
+
* that — a misspelled `workspace_policy` or `safety_profile` left the route
|
|
9
|
+
* running under the LESS restrictive default, silently.
|
|
10
|
+
*
|
|
11
|
+
* So the legal surface is enumerated here rather than implied by whatever the
|
|
12
|
+
* builders happen to read. Keeping it in one file is the point: a per-shape
|
|
13
|
+
* copy is what drifted last time.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Warn on any unrecognised value for an enum that FAILS OPEN.
|
|
17
|
+
*
|
|
18
|
+
* Every *From() validator returns undefined on a mismatch and the caller
|
|
19
|
+
* falls back to a default — silently. For most fields that is merely
|
|
20
|
+
* annoying, but for these three the default is LESS restrictive than what the
|
|
21
|
+
* operator asked for:
|
|
22
|
+
*
|
|
23
|
+
* safety_profile: read_onlyy -> undefined -> DEFAULT_SAFETY_PROFILE
|
|
24
|
+
* -> workspace_edit (write access)
|
|
25
|
+
* workspace_policy: coppy -> undefined -> shared_locked
|
|
26
|
+
* -> a SHARED workspace, not an
|
|
27
|
+
* isolated copy
|
|
28
|
+
*
|
|
29
|
+
* A typo therefore quietly grants more than intended, which is the wrong
|
|
30
|
+
* direction for a safety control. The same parser already warns loudly for a
|
|
31
|
+
* malformed `protocol` block, so this is consistency as much as safety.
|
|
32
|
+
*
|
|
33
|
+
* Walks the raw tree rather than hooking each builder: the same keys appear
|
|
34
|
+
* under services:, clis:, endpoints: and overrides:, and a single walk cannot
|
|
35
|
+
* miss a format the way four separate call sites can.
|
|
36
|
+
*/
|
|
37
|
+
export const FAIL_OPEN_ENUMS = {
|
|
38
|
+
// Billing enums, added after a review found `billing_kind: metered-api`
|
|
39
|
+
// (hyphen, not underscore) silently resolving to the harness default of
|
|
40
|
+
// `included_plan_then_flexible_credits` with paidUsagePossible false and no
|
|
41
|
+
// warning. This block existed precisely for enums whose fallback is LESS
|
|
42
|
+
// restrictive than the value attempted, and billing is the other hard
|
|
43
|
+
// constraint the product states — a typo here silently marks a metered route
|
|
44
|
+
// as free.
|
|
45
|
+
billing_kind: [
|
|
46
|
+
"local_compute",
|
|
47
|
+
"included_plan_usage",
|
|
48
|
+
"included_plan_then_flexible_credits",
|
|
49
|
+
"included_credit_then_optional_overage",
|
|
50
|
+
"included_usage_then_on_demand",
|
|
51
|
+
"metered_api",
|
|
52
|
+
"free_quota",
|
|
53
|
+
"unknown",
|
|
54
|
+
],
|
|
55
|
+
billing_confidence: ["documented", "inferred", "unknown", "unsupported"],
|
|
56
|
+
safety_profile: ["read_only", "workspace_edit", "full_auto"],
|
|
57
|
+
effective_safety: ["read_only", "workspace_edit", "full_auto"],
|
|
58
|
+
workspace_policy: ["shared", "shared_locked", "git_worktree", "copy"],
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Every key this parser understands at the top level of config.yaml.
|
|
62
|
+
*
|
|
63
|
+
* `doctor` reported "no unrecognized config entries" while a typo'd or
|
|
64
|
+
* invented top-level key produced no warning at all — the check's own name
|
|
65
|
+
* promised something it never did. A misspelled `max_concurrent_runs` is
|
|
66
|
+
* indistinguishable from not setting it, which is exactly the silent-default
|
|
67
|
+
* class that has bitten this file twice already.
|
|
68
|
+
*/
|
|
69
|
+
export const KNOWN_TOP_LEVEL_KEYS = new Set([
|
|
70
|
+
"version",
|
|
71
|
+
"clis",
|
|
72
|
+
"endpoints",
|
|
73
|
+
"services",
|
|
74
|
+
"disabled",
|
|
75
|
+
"overrides",
|
|
76
|
+
"api_keys",
|
|
77
|
+
"protocols",
|
|
78
|
+
"policy",
|
|
79
|
+
"telemetry",
|
|
80
|
+
"retention",
|
|
81
|
+
"leaderboard",
|
|
82
|
+
"max_concurrent_runs",
|
|
83
|
+
"default_safety_profile",
|
|
84
|
+
"workspace_policy",
|
|
85
|
+
"protocol",
|
|
86
|
+
]);
|
|
87
|
+
/**
|
|
88
|
+
* Every key a `clis:` or `endpoints:` entry may carry.
|
|
89
|
+
*
|
|
90
|
+
* ROOT-CAUSE FIX, not a fourth instance. Three separate silent-drop defects
|
|
91
|
+
* were found in this file in one day — workspace_policy ignored for `clis:`,
|
|
92
|
+
* api_keys ignored for `endpoints:`, unknown top-level keys unwarned — and
|
|
93
|
+
* each was patched individually. Measured afterwards: a route carrying
|
|
94
|
+
* `workspace_polcy`, `safety_profil` and `tierr` still produced ZERO warnings
|
|
95
|
+
* and silently got none of the three.
|
|
96
|
+
*
|
|
97
|
+
* The mechanism is that this parser reads what it recognises and cannot
|
|
98
|
+
* distinguish a key it does not know from a key that is absent. Nothing
|
|
99
|
+
* enumerated the legal surface, so every future misspelling was guaranteed to
|
|
100
|
+
* fail the same silent way — and these are safety and isolation controls, so
|
|
101
|
+
* "silently absent" means "silently less restrictive".
|
|
102
|
+
*
|
|
103
|
+
* Kept as one list for both entry shapes on purpose. Splitting it per shape
|
|
104
|
+
* would recreate the original defect, where two parallel field lists drifted
|
|
105
|
+
* and each was missing something the other had.
|
|
106
|
+
*/
|
|
107
|
+
export const KNOWN_ROUTE_KEYS = new Set([
|
|
108
|
+
"name", "harness", "type", "command", "enabled", "model", "models", "model_hint",
|
|
109
|
+
"tier", "weight", "cli_capability", "capabilities", "timeout_ms",
|
|
110
|
+
"max_input_tokens", "max_output_tokens", "thinking_level",
|
|
111
|
+
"leaderboard_model", "escalate_model", "escalate_on", "resource_weight",
|
|
112
|
+
"api_key", "base_url", "protocol", "filter",
|
|
113
|
+
"provider", "surface", "auth_source", "billing_kind", "billing_confidence",
|
|
114
|
+
"billing_notes", "paid_usage_possible", "allow_paid_usage",
|
|
115
|
+
"safety_profile", "effective_safety", "workspace_policy",
|
|
116
|
+
"endpoint_mode", "endpoint_provider", "wire_protocol",
|
|
117
|
+
]);
|
|
118
|
+
export function warnUnknownRouteKeys(entry, label, warnings) {
|
|
119
|
+
for (const key of Object.keys(entry)) {
|
|
120
|
+
if (KNOWN_ROUTE_KEYS.has(key))
|
|
121
|
+
continue;
|
|
122
|
+
warnings.push(`${label}: unknown key "${key}" — IGNORED. If this was meant to be a ` +
|
|
123
|
+
`safety or workspace setting, it is NOT in effect; check the spelling.`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Keys the parser ACCEPTS and nothing reads.
|
|
128
|
+
*
|
|
129
|
+
* Silently allowing them is worse than rejecting them: `default_safety_profile`
|
|
130
|
+
* is a safety-control name that does nothing at all, which is the exact
|
|
131
|
+
* failure this module exists to prevent. They stay allow-listed (so they are
|
|
132
|
+
* not reported as typos) but say plainly that setting them has no effect.
|
|
133
|
+
*
|
|
134
|
+
* Verified read-nowhere in src/ at the time of writing; if one is implemented
|
|
135
|
+
* later, delete it from here and the warning goes away.
|
|
136
|
+
*/
|
|
137
|
+
const ACCEPTED_BUT_UNIMPLEMENTED = new Set(["protocols", "default_safety_profile"]);
|
|
138
|
+
export function warnUnknownTopLevelKeys(raw, warnings) {
|
|
139
|
+
for (const key of Object.keys(raw)) {
|
|
140
|
+
if (ACCEPTED_BUT_UNIMPLEMENTED.has(key)) {
|
|
141
|
+
warnings.push(`${key}: recognised but NOT IMPLEMENTED — setting it has no effect. ` +
|
|
142
|
+
`Remove it, or track the gap; it is not a typo.`);
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (KNOWN_TOP_LEVEL_KEYS.has(key))
|
|
146
|
+
continue;
|
|
147
|
+
if (key.endsWith("_api_key"))
|
|
148
|
+
continue; // documented per-route shorthand
|
|
149
|
+
warnings.push(`unknown top-level config key: ${key} — IGNORED. Check the spelling against ` +
|
|
150
|
+
`the documented keys (${[...KNOWN_TOP_LEVEL_KEYS].slice(0, 6).join(", ")}, ...).`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export function warnUnknownSafetyEnums(node, warnings, where = "") {
|
|
154
|
+
if (Array.isArray(node)) {
|
|
155
|
+
for (const [i, v] of node.entries())
|
|
156
|
+
warnUnknownSafetyEnums(v, warnings, `${where}[${i}]`);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (node === null || typeof node !== "object")
|
|
160
|
+
return;
|
|
161
|
+
const obj = node;
|
|
162
|
+
const label = typeof obj.name === "string" && obj.name !== "" ? String(obj.name) : where || "config";
|
|
163
|
+
for (const [key, allowed] of Object.entries(FAIL_OPEN_ENUMS)) {
|
|
164
|
+
const value = obj[key];
|
|
165
|
+
if (value === undefined)
|
|
166
|
+
continue;
|
|
167
|
+
if (typeof value === "string" && allowed.includes(value))
|
|
168
|
+
continue;
|
|
169
|
+
// effective_safety may also be a per-request map; validate it entry by
|
|
170
|
+
// entry so a typo in one key still warns without condemning the whole
|
|
171
|
+
// block. See effectiveSafetyFrom().
|
|
172
|
+
if (key === "effective_safety" && value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
173
|
+
const entries = Object.entries(value);
|
|
174
|
+
const bad = entries.filter(([k, v]) => !allowed.includes(k) || typeof v !== "string" || !allowed.includes(v));
|
|
175
|
+
if (bad.length === 0)
|
|
176
|
+
continue;
|
|
177
|
+
warnings.push(`${label}: effective_safety: ${bad.map(([k, v]) => `${k}: ${JSON.stringify(v)}`).join(", ")} ` +
|
|
178
|
+
`is not a ${allowed.join("/")} pair — IGNORED for those requests.`);
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
warnings.push(`${label}: ${key}: ${JSON.stringify(value)} is not one of ${allowed.join(", ")} — ` +
|
|
182
|
+
`IGNORED, and the default applies instead, which is less restrictive than what ` +
|
|
183
|
+
`this looks like it was meant to set. Fix the value.`);
|
|
184
|
+
}
|
|
185
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
186
|
+
warnUnknownSafetyEnums(v, warnings, where ? `${where}.${k}` : k);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/config/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAsC;IAChE,wEAAwE;IACxE,wEAAwE;IACxE,4EAA4E;IAC5E,yEAAyE;IACzE,sEAAsE;IACtE,6EAA6E;IAC7E,WAAW;IACX,YAAY,EAAE;QACZ,eAAe;QACf,qBAAqB;QACrB,qCAAqC;QACrC,uCAAuC;QACvC,+BAA+B;QAC/B,aAAa;QACb,YAAY;QACZ,SAAS;KACV;IACD,kBAAkB,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,CAAC;IACxE,cAAc,EAAE,CAAC,WAAW,EAAE,gBAAgB,EAAE,WAAW,CAAC;IAC5D,gBAAgB,EAAE,CAAC,WAAW,EAAE,gBAAgB,EAAE,WAAW,CAAC;IAC9D,gBAAgB,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,CAAC;CACtE,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IAC1C,SAAS;IACT,MAAM;IACN,WAAW;IACX,UAAU;IACV,UAAU;IACV,WAAW;IACX,UAAU;IACV,WAAW;IACX,QAAQ;IACR,WAAW;IACX,WAAW;IACX,aAAa;IACb,qBAAqB;IACrB,wBAAwB;IACxB,kBAAkB;IAClB,UAAU;CACX,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,gB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,CAAC,EAAE,CAAC;QACzC,sBAAsB,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -12,14 +12,31 @@
|
|
|
12
12
|
* All string values are scanned for ${ENV_VAR} references and replaced with
|
|
13
13
|
* the corresponding environment variable.
|
|
14
14
|
*/
|
|
15
|
+
/** Injection seam for tests. Set via loadConfig({ whichFn }) if needed. */
|
|
16
|
+
export type WhichFn = (cmd: string) => Promise<string | null>;
|
|
15
17
|
import type { CliProtocolConfig, RouterConfig } from "./types.js";
|
|
16
18
|
/** Named, selectable protocols — every harness in CLI_DEFAULTS that defines one, keyed by its harness name (see protocolFrom()'s string/`extends:` handling). */
|
|
17
19
|
export declare const PROTOCOL_PRESETS: Record<string, CliProtocolConfig>;
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Commands auto-detect probes on PATH, exported so `doctor` can name them.
|
|
22
|
+
*
|
|
23
|
+
* A zero-route install used to report "0 ready route(s)" and stop, which tells
|
|
24
|
+
* a new user nothing about what was looked for or what to install. Keyed the
|
|
25
|
+
* same way as AUTO_DETECT_NAME so the two cannot drift.
|
|
26
|
+
*/
|
|
27
|
+
export declare const AUTO_DETECT_COMMANDS: Record<string, string>;
|
|
20
28
|
export interface LoadConfigOptions {
|
|
21
29
|
/** Override `which` for tests — return null when a CLI is "not found". */
|
|
22
30
|
whichFn?: WhichFn;
|
|
31
|
+
/**
|
|
32
|
+
* Treat a missing explicit path as auto-detect rather than an error.
|
|
33
|
+
*
|
|
34
|
+
* Only `configure` sets this: the path it is given is its OUTPUT, which
|
|
35
|
+
* legitimately does not exist yet. For every other command an explicit
|
|
36
|
+
* --config that is not there is a typo, and silently auto-detecting printed
|
|
37
|
+
* a confident route table for a config that was never loaded.
|
|
38
|
+
*/
|
|
39
|
+
allowMissing?: boolean;
|
|
23
40
|
}
|
|
24
41
|
/**
|
|
25
42
|
* Load a RouterConfig.
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA6BH,2EAA2E;AAC3E,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AA+B9D,OAAO,KAAK,EAOV,iBAAiB,EAGjB,YAAY,EAOb,MAAM,YAAY,CAAC;AAsEpB,iKAAiK;AACjK,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAI9D,CAAC;AAQF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKvD,CAAC;AA6iBF,MAAM,WAAW,iBAAiB;IAChC,0EAA0E;IAC1E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC9B,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,GAAE,iBAAsB,GAC3B,OAAO,CAAC,YAAY,CAAC,CAwGvB;AAMD,MAAM,WAAW,aAAa;IAC5B,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,EACnC,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GACpD,aAAa,CAkCf"}
|