@wrongstack/cli 0.310.0 → 0.313.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/dist/{acp-EA57GUFB.js → acp-LQMSMV32.js} +2 -2
- package/dist/chunk-4JRIWVJ4.js +13 -0
- package/dist/{chunk-63GFD62R.js → chunk-4S52MIIM.js} +2 -2
- package/dist/chunk-7CECQDNH.js +24 -0
- package/dist/chunk-AOAIPYFB.js +58 -0
- package/dist/{chunk-CHZZEEIP.js → chunk-CNQZ4HG4.js} +40 -9
- package/dist/{chunk-KQNYSZG2.js → chunk-E3X4KM7T.js} +6 -3
- package/dist/chunk-GWVLRUVH.js +120 -0
- package/dist/{cli-main-RFEZAJ4U.js → cli-main-BFUSCWXE.js} +228 -50
- package/dist/{diag-doctor-HJKFUY6B.js → diag-doctor-OPTB2NWY.js} +61 -3
- package/dist/{execution-WA2UCXNM.js → execution-TOBPK6MD.js} +109 -19
- package/dist/execution-chimera-cascade.d.ts +4 -1
- package/dist/execution-chimera-review.d.ts +4 -1
- package/dist/fleet/host-types.d.ts +9 -0
- package/dist/fleet/subagent-hook-runner.d.ts +22 -0
- package/dist/{hq-AG4VW4XO.js → hq-2XIXGAER.js} +2 -2
- package/dist/{hq-server-GZGM4BHA.js → hq-server-DBT3OOYD.js} +2 -2
- package/dist/index.js +16 -15
- package/dist/live-settings-input.d.ts +15 -1
- package/dist/proxy-wiring-G26YGP7S.js +15 -0
- package/dist/subcommands/contracts.d.ts +7 -0
- package/dist/subcommands/handlers/diag-doctor.d.ts +14 -0
- package/dist/{update-RATFF63M.js → update-ZXNC6I6G.js} +2 -2
- package/dist/webui-server/prefs-seeding.d.ts +4 -0
- package/dist/{webui-server-3DU6BVTB.js → webui-server-I53IYBW4.js} +8 -1
- package/dist/webui-server-options.d.ts +8 -0
- package/dist/wiring/provider-runtime.d.ts +25 -0
- package/dist/wiring/proxy-probe.d.ts +62 -0
- package/dist/wiring/proxy-wiring.d.ts +59 -0
- package/dist/wiring/wrongtrace-gate-counters.d.ts +18 -0
- package/dist/wiring/wrongtrace-gate.d.ts +13 -0
- package/dist/wiring/wrongtrace-hooks.d.ts +8 -0
- package/dist/wiring/wrongtrace-prompt-contributor.d.ts +23 -0
- package/dist/wiring/wrongtrace-telemetry.d.ts +53 -0
- package/dist/wrongtrace-gate-counters-P5BCBXQN.js +22 -0
- package/dist/wrongtrace-telemetry-6M2CCBX5.js +34 -0
- package/package.json +28 -27
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
loadCachedAcpRegistry,
|
|
4
4
|
refreshAcpRegistry,
|
|
5
5
|
setupProvider
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CNQZ4HG4.js";
|
|
7
7
|
import "./chunk-QYIIOMLE.js";
|
|
8
8
|
import "./chunk-BXFYBQKR.js";
|
|
9
9
|
import "./chunk-7OCVIDC7.js";
|
|
@@ -913,4 +913,4 @@ ${renderAcpBenchText(result)}
|
|
|
913
913
|
export {
|
|
914
914
|
acpCmd
|
|
915
915
|
};
|
|
916
|
-
//# sourceMappingURL=acp-
|
|
916
|
+
//# sourceMappingURL=acp-LQMSMV32.js.map
|
|
@@ -166,7 +166,7 @@ Update failed: ${msg}
|
|
|
166
166
|
var updateCmd = async (args, deps) => runUpdateCommand(args, deps);
|
|
167
167
|
function writeUpdateUsage(renderer) {
|
|
168
168
|
renderer.write(
|
|
169
|
-
"Usage:
|
|
169
|
+
"Usage: wstack update [--check-only] [--pm <manager>] [--allow-scripts (alias: --lifecycle-scripts)]\n"
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
function mergeUpdateArgs(args, flags) {
|
|
@@ -383,4 +383,4 @@ export {
|
|
|
383
383
|
detectUpdatePackageManager,
|
|
384
384
|
detectUpdatePackageName
|
|
385
385
|
};
|
|
386
|
-
//# sourceMappingURL=chunk-
|
|
386
|
+
//# sourceMappingURL=chunk-4S52MIIM.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
// src/wiring/wrongtrace-gate-counters.ts
|
|
3
|
+
import {
|
|
4
|
+
createWrongTraceGateCounter,
|
|
5
|
+
countersFilePath,
|
|
6
|
+
formatGateCounterReport,
|
|
7
|
+
loadWrongTraceGateCounters,
|
|
8
|
+
persistWrongTraceGateCounters,
|
|
9
|
+
recordGateDecision,
|
|
10
|
+
resetGateDecisions,
|
|
11
|
+
snapshotGateDecisions
|
|
12
|
+
} from "@wrongstack/wrongtrace";
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
createWrongTraceGateCounter,
|
|
16
|
+
countersFilePath,
|
|
17
|
+
formatGateCounterReport,
|
|
18
|
+
loadWrongTraceGateCounters,
|
|
19
|
+
persistWrongTraceGateCounters,
|
|
20
|
+
recordGateDecision,
|
|
21
|
+
resetGateDecisions,
|
|
22
|
+
snapshotGateDecisions
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-7CECQDNH.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
startProxyProbe
|
|
3
|
+
} from "./chunk-GWVLRUVH.js";
|
|
4
|
+
|
|
5
|
+
// src/wiring/proxy-wiring.ts
|
|
6
|
+
import {
|
|
7
|
+
applyProxyConfig
|
|
8
|
+
} from "@wrongstack/core/wiring/proxy-rewrite";
|
|
9
|
+
var probeRunner;
|
|
10
|
+
function applyWrongProxyPrefs(payload) {
|
|
11
|
+
const patch = {};
|
|
12
|
+
if (typeof payload["wrongProxyEnabled"] === "boolean") {
|
|
13
|
+
patch.enabled = payload["wrongProxyEnabled"];
|
|
14
|
+
}
|
|
15
|
+
if (typeof payload["wrongProxyUrl"] === "string") {
|
|
16
|
+
patch.url = payload["wrongProxyUrl"];
|
|
17
|
+
}
|
|
18
|
+
if (Object.keys(patch).length === 0) return;
|
|
19
|
+
applyProxyConfig(patch);
|
|
20
|
+
if (!probeRunner) {
|
|
21
|
+
probeRunner = startProxyProbe();
|
|
22
|
+
} else {
|
|
23
|
+
void probeRunner.poke();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function awaitFirstWrongProxyProbe() {
|
|
27
|
+
if (!probeRunner) return;
|
|
28
|
+
await probeRunner.poke();
|
|
29
|
+
}
|
|
30
|
+
function bootstrapWrongProxy(snapshot) {
|
|
31
|
+
if (!snapshot) {
|
|
32
|
+
applyWrongProxyPrefs({});
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const enabled = snapshot.enabled;
|
|
36
|
+
const url = snapshot.url;
|
|
37
|
+
if (typeof enabled === "boolean" || typeof url === "string") {
|
|
38
|
+
const payload = {};
|
|
39
|
+
if (typeof enabled === "boolean") payload["wrongProxyEnabled"] = enabled;
|
|
40
|
+
if (typeof url === "string") payload["wrongProxyUrl"] = url;
|
|
41
|
+
applyWrongProxyPrefs(payload);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
applyWrongProxyPrefs(snapshot);
|
|
45
|
+
}
|
|
46
|
+
function shutdownWrongProxy() {
|
|
47
|
+
if (probeRunner) probeRunner.stop();
|
|
48
|
+
probeRunner = void 0;
|
|
49
|
+
applyProxyConfig({ enabled: false, url: "", active: false });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
applyWrongProxyPrefs,
|
|
54
|
+
awaitFirstWrongProxyProbe,
|
|
55
|
+
bootstrapWrongProxy,
|
|
56
|
+
shutdownWrongProxy
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=chunk-AOAIPYFB.js.map
|
|
@@ -42,6 +42,37 @@ async function refreshAcpRegistry(paths, opts) {
|
|
|
42
42
|
return { count: result.agents.length, location, fetchedAt: result.fetchedAt };
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
// src/wiring/provider-runtime.ts
|
|
46
|
+
import { makeProviderFromConfig } from "@wrongstack/providers";
|
|
47
|
+
import { getProxyConfig, rewriteBaseUrl, shouldRewriteFor } from "@wrongstack/core/wiring/proxy-rewrite";
|
|
48
|
+
function resolveProviderCfg(config, providerId) {
|
|
49
|
+
const savedCfg = config.providers?.[providerId];
|
|
50
|
+
const rawBaseUrl = savedCfg?.baseUrl ?? config.baseUrl;
|
|
51
|
+
const baseUrl = rawBaseUrl && shouldRewriteFor(providerId) ? rewriteBaseUrl(rawBaseUrl, currentProxyBaseUrl()) : rawBaseUrl;
|
|
52
|
+
const cfg = {
|
|
53
|
+
...savedCfg,
|
|
54
|
+
apiKey: savedCfg?.apiKey ?? config.apiKey,
|
|
55
|
+
baseUrl,
|
|
56
|
+
type: providerId
|
|
57
|
+
};
|
|
58
|
+
const factoryType = savedCfg?.type ?? providerId;
|
|
59
|
+
return { cfg, factoryType };
|
|
60
|
+
}
|
|
61
|
+
function currentProxyBaseUrl() {
|
|
62
|
+
return getProxyConfig().url;
|
|
63
|
+
}
|
|
64
|
+
function resolveProviderCfgWithProxy(config, providerId) {
|
|
65
|
+
return resolveProviderCfg(config, providerId);
|
|
66
|
+
}
|
|
67
|
+
function buildProviderForId(args, providerId) {
|
|
68
|
+
const { cfg, factoryType } = resolveProviderCfg(args.config, providerId);
|
|
69
|
+
const useRegistry = !!args.config.features.modelsRegistry && args.providerRegistry.has(factoryType);
|
|
70
|
+
return useRegistry ? args.providerRegistry.create(cfg, factoryType) : makeProviderFromConfig(
|
|
71
|
+
providerId,
|
|
72
|
+
factoryType === "ai-gateway" ? { ...cfg, type: factoryType } : cfg
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
45
76
|
// src/shutdown-cleanup.ts
|
|
46
77
|
function createGracefulShutdown(cleanup) {
|
|
47
78
|
const exitCode = cleanup.exitCode ?? 0;
|
|
@@ -92,7 +123,7 @@ import {
|
|
|
92
123
|
buildProviderFactoriesFromRegistry,
|
|
93
124
|
createAiGatewayProviderFactory,
|
|
94
125
|
installCatalogModelOutputLimits,
|
|
95
|
-
makeProviderFromConfig,
|
|
126
|
+
makeProviderFromConfig as makeProviderFromConfig2,
|
|
96
127
|
withCatalogCapabilities
|
|
97
128
|
} from "@wrongstack/providers";
|
|
98
129
|
async function setupProvider(params) {
|
|
@@ -174,19 +205,17 @@ Try \`wstack models refresh\` once you have network access, or run with --no-fea
|
|
|
174
205
|
});
|
|
175
206
|
}
|
|
176
207
|
}
|
|
177
|
-
const providerConfig
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
};
|
|
208
|
+
const { cfg: providerConfig, factoryType } = resolveProviderCfgWithProxy(
|
|
209
|
+
config,
|
|
210
|
+
config.provider
|
|
211
|
+
);
|
|
182
212
|
let provider;
|
|
183
213
|
try {
|
|
184
|
-
const factoryType = providerConfig.type ?? config.provider;
|
|
185
214
|
const cfgWithType = { ...providerConfig, type: config.provider };
|
|
186
215
|
if (providerRegistry.has(factoryType)) {
|
|
187
216
|
provider = providerRegistry.create(cfgWithType, factoryType);
|
|
188
217
|
} else {
|
|
189
|
-
provider =
|
|
218
|
+
provider = makeProviderFromConfig2(config.provider, { ...cfgWithType, type: factoryType });
|
|
190
219
|
}
|
|
191
220
|
} catch (err) {
|
|
192
221
|
throw new ConfigError({
|
|
@@ -211,7 +240,9 @@ Try \`wstack models refresh\` once you have network access, or run with --no-fea
|
|
|
211
240
|
export {
|
|
212
241
|
loadCachedAcpRegistry,
|
|
213
242
|
refreshAcpRegistry,
|
|
243
|
+
resolveProviderCfg,
|
|
244
|
+
buildProviderForId,
|
|
214
245
|
setupProvider,
|
|
215
246
|
createGracefulShutdown
|
|
216
247
|
};
|
|
217
|
-
//# sourceMappingURL=chunk-
|
|
248
|
+
//# sourceMappingURL=chunk-CNQZ4HG4.js.map
|
|
@@ -959,7 +959,10 @@ function lanIPv4Addresses() {
|
|
|
959
959
|
function truncateHqSummary(value, maxLength) {
|
|
960
960
|
if (typeof value !== "string" || value.length === 0) return void 0;
|
|
961
961
|
if (value.length <= maxLength) return value;
|
|
962
|
-
|
|
962
|
+
const suffix = `\u2026[truncated:${value.length - maxLength}]`;
|
|
963
|
+
if (maxLength <= suffix.length) return "\u2026";
|
|
964
|
+
const prefixLen = maxLength - suffix.length;
|
|
965
|
+
return `${value.slice(0, prefixLen)}${suffix}`;
|
|
963
966
|
}
|
|
964
967
|
function hqMachineKey(hostname, machineId) {
|
|
965
968
|
const hn = hostname?.trim();
|
|
@@ -2841,7 +2844,7 @@ async function handleApiAgentMessages(req, res, match, agentMessages) {
|
|
|
2841
2844
|
async function handleApiSystemUpdate(res) {
|
|
2842
2845
|
const [{ checkForUpdate }, { detectUpdatePackageName }] = await Promise.all([
|
|
2843
2846
|
import("./update-check-WARHSVZA.js"),
|
|
2844
|
-
import("./update-
|
|
2847
|
+
import("./update-ZXNC6I6G.js")
|
|
2845
2848
|
]);
|
|
2846
2849
|
const packageName = detectUpdatePackageName();
|
|
2847
2850
|
const info = await checkForUpdate({ packageName });
|
|
@@ -4916,4 +4919,4 @@ export {
|
|
|
4916
4919
|
startHqServer,
|
|
4917
4920
|
HqInsecureExposureError2 as HqInsecureExposureError
|
|
4918
4921
|
};
|
|
4919
|
-
//# sourceMappingURL=chunk-
|
|
4922
|
+
//# sourceMappingURL=chunk-E3X4KM7T.js.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
|
|
2
|
+
// src/wiring/proxy-probe.ts
|
|
3
|
+
import { applyProxyConfig, getProxyConfig } from "@wrongstack/core/wiring/proxy-rewrite";
|
|
4
|
+
var DEFAULT_INTERVAL_MS = 3e4;
|
|
5
|
+
var DEFAULT_TIMEOUT_MS = 2e3;
|
|
6
|
+
var HEALTH_PATH = "/api/health";
|
|
7
|
+
var DEFAULT_DEACTIVATE_AFTER_FAILURES = 2;
|
|
8
|
+
var activeRunner;
|
|
9
|
+
function startProxyProbe(opts = {}) {
|
|
10
|
+
if (activeRunner) {
|
|
11
|
+
scheduleImmediateProbe(activeRunner);
|
|
12
|
+
return activeRunner;
|
|
13
|
+
}
|
|
14
|
+
const intervalMs = opts.intervalMs ?? DEFAULT_INTERVAL_MS;
|
|
15
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
16
|
+
const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
|
|
17
|
+
const setIntervalImpl = opts.setIntervalImpl ?? setInterval;
|
|
18
|
+
const clearIntervalImpl = opts.clearIntervalImpl ?? clearInterval;
|
|
19
|
+
const deactivateAfterFailures = typeof opts.deactivateAfterFailures === "number" && Number.isFinite(opts.deactivateAfterFailures) ? Math.max(1, Math.trunc(opts.deactivateAfterFailures)) : DEFAULT_DEACTIVATE_AFTER_FAILURES;
|
|
20
|
+
const state = {
|
|
21
|
+
currentAbort: void 0,
|
|
22
|
+
timer: void 0,
|
|
23
|
+
// Consecutive failed probes. Reset on every success; `active` flips to
|
|
24
|
+
// false only once this reaches `deactivateAfterFailures`. A single
|
|
25
|
+
// transient failure is a soft signal and must not disable rewrites.
|
|
26
|
+
consecutiveFailures: 0
|
|
27
|
+
};
|
|
28
|
+
const runOnce = async () => {
|
|
29
|
+
const cfg = getProxyConfig();
|
|
30
|
+
if (!cfg.enabled || !cfg.url) {
|
|
31
|
+
state.consecutiveFailures = 0;
|
|
32
|
+
if (state.currentAbort) state.currentAbort.abort();
|
|
33
|
+
state.currentAbort = void 0;
|
|
34
|
+
applyProxyConfig({ active: false });
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (state.currentAbort) state.currentAbort.abort();
|
|
38
|
+
const abort = new AbortController();
|
|
39
|
+
state.currentAbort = abort;
|
|
40
|
+
let timedOut = false;
|
|
41
|
+
const timeout = setTimeout(() => {
|
|
42
|
+
timedOut = true;
|
|
43
|
+
abort.abort();
|
|
44
|
+
}, timeoutMs);
|
|
45
|
+
if (typeof timeout.unref === "function") {
|
|
46
|
+
timeout.unref();
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const healthUrl = buildHealthUrl(cfg.url);
|
|
50
|
+
const res = await fetchImpl(healthUrl, {
|
|
51
|
+
method: "GET",
|
|
52
|
+
signal: abort.signal,
|
|
53
|
+
headers: { accept: "application/json" }
|
|
54
|
+
});
|
|
55
|
+
const ok = res.ok && res.status >= 200 && res.status < 300;
|
|
56
|
+
const live = getProxyConfig();
|
|
57
|
+
const stillRelevant = live.enabled && live.url === cfg.url;
|
|
58
|
+
if (stillRelevant) {
|
|
59
|
+
if (ok) {
|
|
60
|
+
state.consecutiveFailures = 0;
|
|
61
|
+
applyProxyConfig({ active: true });
|
|
62
|
+
} else {
|
|
63
|
+
state.consecutiveFailures += 1;
|
|
64
|
+
if (state.consecutiveFailures >= deactivateAfterFailures) {
|
|
65
|
+
applyProxyConfig({ active: false });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return ok;
|
|
70
|
+
} catch {
|
|
71
|
+
const live = getProxyConfig();
|
|
72
|
+
const stillRelevant = live.enabled && live.url === cfg.url;
|
|
73
|
+
if (stillRelevant && (timedOut || !abort.signal.aborted)) {
|
|
74
|
+
state.consecutiveFailures += 1;
|
|
75
|
+
if (state.consecutiveFailures >= deactivateAfterFailures) {
|
|
76
|
+
applyProxyConfig({ active: false });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
} finally {
|
|
81
|
+
clearTimeout(timeout);
|
|
82
|
+
if (state.currentAbort === abort) state.currentAbort = void 0;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const runner = {
|
|
86
|
+
stop() {
|
|
87
|
+
if (state.timer !== void 0) {
|
|
88
|
+
clearIntervalImpl(state.timer);
|
|
89
|
+
state.timer = void 0;
|
|
90
|
+
}
|
|
91
|
+
if (state.currentAbort) {
|
|
92
|
+
state.currentAbort.abort();
|
|
93
|
+
state.currentAbort = void 0;
|
|
94
|
+
}
|
|
95
|
+
activeRunner = void 0;
|
|
96
|
+
},
|
|
97
|
+
poke: runOnce
|
|
98
|
+
};
|
|
99
|
+
scheduleImmediateProbe(runner);
|
|
100
|
+
state.timer = setIntervalImpl(() => {
|
|
101
|
+
void runOnce();
|
|
102
|
+
}, intervalMs);
|
|
103
|
+
if (state.timer && typeof state.timer.unref === "function") {
|
|
104
|
+
state.timer.unref();
|
|
105
|
+
}
|
|
106
|
+
activeRunner = runner;
|
|
107
|
+
return runner;
|
|
108
|
+
}
|
|
109
|
+
function scheduleImmediateProbe(runner) {
|
|
110
|
+
void runner.poke();
|
|
111
|
+
}
|
|
112
|
+
function buildHealthUrl(rawBase) {
|
|
113
|
+
const trimmed = rawBase.trim().replace(/\/+$/, "");
|
|
114
|
+
return `${trimmed}${HEALTH_PATH}`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export {
|
|
118
|
+
startProxyProbe
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=chunk-GWVLRUVH.js.map
|