omnicell-router 0.1.0 → 0.2.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/RELEASING.md +238 -238
- package/RELEASING.zh-CN.md +230 -230
- package/backend/dist/capture/recorder.js +2 -1
- package/backend/dist/cli/clients/base.js +8 -16
- package/backend/dist/cli/clients/dsh.js +8 -16
- package/backend/dist/cli/clients/pi.js +16 -9
- package/backend/dist/cli/types.d.ts +5 -0
- package/backend/dist/config/env.js +2 -1
- package/backend/dist/config/index.js +2 -0
- package/backend/dist/config/types.d.ts +23 -0
- package/backend/dist/harness/adapters/amp.d.ts +2 -0
- package/backend/dist/harness/adapters/amp.js +7 -0
- package/backend/dist/harness/adapters/claude.d.ts +2 -0
- package/backend/dist/harness/adapters/claude.js +7 -0
- package/backend/dist/harness/adapters/cline.d.ts +2 -0
- package/backend/dist/harness/adapters/cline.js +6 -0
- package/backend/dist/harness/adapters/codex.d.ts +2 -0
- package/backend/dist/harness/adapters/codex.js +6 -0
- package/backend/dist/harness/adapters/cursor.d.ts +5 -0
- package/backend/dist/harness/adapters/cursor.js +10 -0
- package/backend/dist/harness/adapters/declarative.d.ts +62 -0
- package/backend/dist/harness/adapters/declarative.js +202 -0
- package/backend/dist/harness/adapters/dsh.d.ts +5 -0
- package/backend/dist/harness/adapters/dsh.js +6 -0
- package/backend/dist/harness/adapters/gemini-cli.d.ts +2 -0
- package/backend/dist/harness/adapters/gemini-cli.js +7 -0
- package/backend/dist/harness/adapters/github-copilot.d.ts +5 -0
- package/backend/dist/harness/adapters/github-copilot.js +10 -0
- package/backend/dist/harness/adapters/index.d.ts +44 -0
- package/backend/dist/harness/adapters/index.js +99 -0
- package/backend/dist/harness/adapters/opencode.d.ts +2 -0
- package/backend/dist/harness/adapters/opencode.js +55 -0
- package/backend/dist/harness/adapters/pi.d.ts +1 -0
- package/backend/dist/harness/adapters/pi.js +22 -0
- package/backend/dist/harness/adapters/skills-paths.d.ts +15 -0
- package/backend/dist/harness/adapters/skills-paths.js +17 -0
- package/backend/dist/harness/adapters/types.d.ts +174 -0
- package/backend/dist/harness/adapters/types.js +12 -0
- package/backend/dist/harness/adapters/universal.d.ts +6 -0
- package/backend/dist/harness/adapters/universal.js +10 -0
- package/backend/dist/harness/adapters/windsurf.d.ts +2 -0
- package/backend/dist/harness/adapters/windsurf.js +10 -0
- package/backend/dist/harness/adapters/zed.d.ts +2 -0
- package/backend/dist/harness/adapters/zed.js +6 -0
- package/backend/dist/harness/awesome-opencode.d.ts +40 -0
- package/backend/dist/harness/awesome-opencode.js +75 -0
- package/backend/dist/harness/browse.d.ts +202 -0
- package/backend/dist/harness/browse.js +1214 -0
- package/backend/dist/harness/catalog-npm.d.ts +59 -0
- package/backend/dist/harness/catalog-npm.js +145 -0
- package/backend/dist/harness/clawhub.d.ts +212 -0
- package/backend/dist/harness/clawhub.js +426 -0
- package/backend/dist/harness/config-file.d.ts +29 -0
- package/backend/dist/harness/config-file.js +35 -0
- package/backend/dist/harness/detail.d.ts +74 -0
- package/backend/dist/harness/detail.js +330 -0
- package/backend/dist/harness/discover.d.ts +118 -0
- package/backend/dist/harness/discover.js +507 -0
- package/backend/dist/harness/drift.d.ts +21 -0
- package/backend/dist/harness/drift.js +25 -0
- package/backend/dist/harness/hash.d.ts +10 -0
- package/backend/dist/harness/hash.js +63 -0
- package/backend/dist/harness/hosts.d.ts +18 -0
- package/backend/dist/harness/hosts.js +15 -0
- package/backend/dist/harness/install.d.ts +88 -0
- package/backend/dist/harness/install.js +301 -0
- package/backend/dist/harness/inventory.d.ts +10 -0
- package/backend/dist/harness/inventory.js +198 -0
- package/backend/dist/harness/ledger.d.ts +39 -0
- package/backend/dist/harness/ledger.js +83 -0
- package/backend/dist/harness/maintenance.d.ts +115 -0
- package/backend/dist/harness/maintenance.js +603 -0
- package/backend/dist/harness/manifest.d.ts +31 -0
- package/backend/dist/harness/manifest.js +234 -0
- package/backend/dist/harness/net.d.ts +86 -0
- package/backend/dist/harness/net.js +113 -0
- package/backend/dist/harness/opencode-cafe.d.ts +40 -0
- package/backend/dist/harness/opencode-cafe.js +85 -0
- package/backend/dist/harness/opencode-ecosystem.d.ts +34 -0
- package/backend/dist/harness/opencode-ecosystem.js +246 -0
- package/backend/dist/harness/pi-dev.d.ts +81 -0
- package/backend/dist/harness/pi-dev.js +187 -0
- package/backend/dist/harness/probe.d.ts +33 -0
- package/backend/dist/harness/probe.js +85 -0
- package/backend/dist/harness/registry.d.ts +2 -0
- package/backend/dist/harness/registry.js +26 -0
- package/backend/dist/harness/scopes.d.ts +21 -0
- package/backend/dist/harness/scopes.js +22 -0
- package/backend/dist/harness/skill-md.d.ts +18 -0
- package/backend/dist/harness/skill-md.js +71 -0
- package/backend/dist/harness/skills-sh.d.ts +109 -0
- package/backend/dist/harness/skills-sh.js +178 -0
- package/backend/dist/harness/smithery.d.ts +64 -0
- package/backend/dist/harness/smithery.js +146 -0
- package/backend/dist/harness/sources/awesome-opencode.d.ts +11 -0
- package/backend/dist/harness/sources/awesome-opencode.js +39 -0
- package/backend/dist/harness/sources/clawhub.d.ts +2 -0
- package/backend/dist/harness/sources/clawhub.js +83 -0
- package/backend/dist/harness/sources/github.d.ts +9 -0
- package/backend/dist/harness/sources/github.js +202 -0
- package/backend/dist/harness/sources/mcp-official.d.ts +2 -0
- package/backend/dist/harness/sources/mcp-official.js +110 -0
- package/backend/dist/harness/sources/npm.d.ts +2 -0
- package/backend/dist/harness/sources/npm.js +152 -0
- package/backend/dist/harness/sources/opencode-cafe.d.ts +11 -0
- package/backend/dist/harness/sources/opencode-cafe.js +41 -0
- package/backend/dist/harness/sources/smithery.d.ts +2 -0
- package/backend/dist/harness/sources/smithery.js +81 -0
- package/backend/dist/harness/spi.d.ts +98 -0
- package/backend/dist/harness/spi.js +8 -0
- package/backend/dist/harness/stars.d.ts +70 -0
- package/backend/dist/harness/stars.js +202 -0
- package/backend/dist/harness/translation.d.ts +142 -0
- package/backend/dist/harness/translation.js +567 -0
- package/backend/dist/harness/tree.d.ts +13 -0
- package/backend/dist/harness/tree.js +19 -0
- package/backend/dist/harness/types.d.ts +286 -0
- package/backend/dist/harness/types.js +8 -0
- package/backend/dist/harness/writers/extension.d.ts +116 -0
- package/backend/dist/harness/writers/extension.js +219 -0
- package/backend/dist/harness/writers/mcp.d.ts +72 -0
- package/backend/dist/harness/writers/mcp.js +195 -0
- package/backend/dist/harness/writers/skill.d.ts +60 -0
- package/backend/dist/harness/writers/skill.js +146 -0
- package/backend/dist/opencode/agents.d.ts +5 -0
- package/backend/dist/opencode/agents.js +10 -1
- package/backend/dist/opencode/catalog/cache.js +2 -1
- package/backend/dist/opencode/catalog/logos.js +2 -1
- package/backend/dist/opencode/catalog/ocr-store.js +2 -1
- package/backend/dist/opencode/catalog/overrides-store.js +2 -1
- package/backend/dist/opencode/credentials/factory.js +10 -27
- package/backend/dist/opencode/credentials/ocr-store.js +2 -1
- package/backend/dist/opencode/provider-defs.js +2 -1
- package/backend/dist/opencode/user-config.js +8 -16
- package/backend/dist/providers/registry.d.ts +15 -4
- package/backend/dist/providers/registry.js +29 -5
- package/backend/dist/providers/virtual-meta.d.ts +13 -0
- package/backend/dist/providers/virtual-meta.js +18 -0
- package/backend/dist/quota/store.js +2 -1
- package/backend/dist/resilience/breaker-state.js +2 -1
- package/backend/dist/resilience/credential-state.js +2 -1
- package/backend/dist/routes/console.js +137 -15
- package/backend/dist/routes/harness.d.ts +2 -0
- package/backend/dist/routes/harness.js +622 -0
- package/backend/dist/server.js +4 -0
- package/backend/dist/session/session-manager.js +2 -1
- package/backend/dist/surfaces/systemone-probe.d.ts +25 -0
- package/backend/dist/surfaces/systemone-probe.js +74 -0
- package/backend/dist/utils/atomic-write.d.ts +12 -0
- package/backend/dist/utils/atomic-write.js +29 -0
- package/bin/ocr.js +2 -2
- package/frontend/dist/assets/{index-DEo2iAT7.css → index-1o7qI-KJ.css} +1 -1
- package/frontend/dist/assets/index-DvXKvNxl.js +962 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +87 -87
- package/backend/dist/budget/budget-manager.d.ts +0 -25
- package/backend/dist/budget/budget-manager.js +0 -54
- package/backend/dist/config/governance-limits.d.ts +0 -68
- package/backend/dist/config/governance-limits.js +0 -261
- package/backend/dist/flywheel/collector.d.ts +0 -74
- package/backend/dist/flywheel/collector.js +0 -235
- package/backend/dist/flywheel/dataset.d.ts +0 -130
- package/backend/dist/flywheel/dataset.js +0 -638
- package/backend/dist/flywheel/decision-capture.d.ts +0 -68
- package/backend/dist/flywheel/decision-capture.js +0 -85
- package/backend/dist/flywheel/prune.d.ts +0 -133
- package/backend/dist/flywheel/prune.js +0 -495
- package/backend/dist/flywheel/schema.d.ts +0 -108
- package/backend/dist/flywheel/schema.js +0 -117
- package/backend/dist/flywheel/trainer.d.ts +0 -84
- package/backend/dist/flywheel/trainer.js +0 -198
- package/backend/dist/opencode/catalog/custom-store.d.ts +0 -50
- package/backend/dist/opencode/catalog/custom-store.js +0 -144
- package/backend/dist/opencode/credentials/push.d.ts +0 -38
- package/backend/dist/opencode/credentials/push.js +0 -116
- package/backend/dist/opencode/credentials/reconcile.d.ts +0 -49
- package/backend/dist/opencode/credentials/reconcile.js +0 -216
- package/backend/dist/opencode/sync.d.ts +0 -29
- package/backend/dist/opencode/sync.js +0 -186
- package/backend/dist/pipeline/account-selection.d.ts +0 -101
- package/backend/dist/pipeline/account-selection.js +0 -112
- package/backend/dist/providers/systemone.d.ts +0 -29
- package/backend/dist/providers/systemone.js +0 -170
- package/backend/dist/ratelimit/duration.d.ts +0 -24
- package/backend/dist/ratelimit/duration.js +0 -43
- package/backend/dist/ratelimit/governance-runtime.d.ts +0 -121
- package/backend/dist/ratelimit/governance-runtime.js +0 -183
- package/backend/dist/ratelimit/index.d.ts +0 -4
- package/backend/dist/ratelimit/index.js +0 -4
- package/backend/dist/ratelimit/limiter.d.ts +0 -157
- package/backend/dist/ratelimit/limiter.js +0 -244
- package/backend/dist/ratelimit/sliding-window-counter.d.ts +0 -63
- package/backend/dist/ratelimit/sliding-window-counter.js +0 -103
- package/backend/dist/ratelimit/subject.d.ts +0 -26
- package/backend/dist/ratelimit/subject.js +0 -28
- package/backend/dist/resilience/account-state.d.ts +0 -84
- package/backend/dist/resilience/account-state.js +0 -228
- package/backend/dist/router/layer1-classifier.d.ts +0 -111
- package/backend/dist/router/layer1-classifier.js +0 -467
- package/backend/dist/router/layer2-judge.d.ts +0 -111
- package/backend/dist/router/layer2-judge.js +0 -373
- package/backend/dist/router/retry-escalation.d.ts +0 -89
- package/backend/dist/router/retry-escalation.js +0 -99
- package/backend/dist/routes/flywheel.d.ts +0 -3
- package/backend/dist/routes/flywheel.js +0 -268
- package/backend/dist/routes/systemone.d.ts +0 -3
- package/backend/dist/routes/systemone.js +0 -90
- package/backend/dist/surfaces/governance-envelope.d.ts +0 -34
- package/backend/dist/surfaces/governance-envelope.js +0 -47
- package/backend/dist/utils/token-estimator.d.ts +0 -7
- package/backend/dist/utils/token-estimator.js +0 -20
- package/frontend/dist/assets/index-nwgWkmU1.js +0 -840
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System One default-model probe — the power behind the console's System One "test" button.
|
|
3
|
+
*
|
|
4
|
+
* The probe fires the REAL `/v1/systemone` fallback path over a one-question `noul` payload. The
|
|
5
|
+
* surface's own admission gates deliver the verdicts verbatim (unset config → 400 model_required,
|
|
6
|
+
* unknown id → 404 model_not_found). A probe is a REAL surface request — the capture ledger
|
|
7
|
+
* records it like any client request when requestCapture is on, and it spends one upstream call.
|
|
8
|
+
* An explicit click is the explicit consent to both.
|
|
9
|
+
*
|
|
10
|
+
* `overrideModel` carries the PICKER'S PENDING value so the operator tests BEFORE saving: given →
|
|
11
|
+
* the request rides `model: <pending>` (the same gate chain the fallback would meet after a save;
|
|
12
|
+
* only the trivial config-read differs), and an empty string = "as if unset" → `not_configured`
|
|
13
|
+
* without a call; omitted → the saved `systemone.defaultModel` via the omitted-model path.
|
|
14
|
+
*/
|
|
15
|
+
export interface SystemoneProbe {
|
|
16
|
+
ok: boolean;
|
|
17
|
+
/** The configured `systemone.defaultModel` — what an omitted model resolves to. */
|
|
18
|
+
configured: string;
|
|
19
|
+
/** The registered model id the surface echoed back, when ok. */
|
|
20
|
+
model?: string;
|
|
21
|
+
latencyMs: number;
|
|
22
|
+
code?: 'not_configured' | 'no_api_key' | 'upstream';
|
|
23
|
+
error?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function probeSystemoneDefault(overrideModel?: string): Promise<SystemoneProbe>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defaultGatewayPort } from '../cli/clients/base.js';
|
|
2
|
+
import { loadConfig } from '../config/index.js';
|
|
3
|
+
import { firstEnabledKey } from '../harness/translation.js';
|
|
4
|
+
/** One-question `noul` payload: the smallest legal decision request (answers are values, no prose). */
|
|
5
|
+
const PROBE_BODY = { state: 'probe', questions: { probe: { type: 'noul' } } };
|
|
6
|
+
export async function probeSystemoneDefault(overrideModel) {
|
|
7
|
+
const configured = overrideModel !== undefined
|
|
8
|
+
? overrideModel.trim()
|
|
9
|
+
: (loadConfig().systemone?.defaultModel || '').trim();
|
|
10
|
+
const started = Date.now();
|
|
11
|
+
if (!configured) {
|
|
12
|
+
// Deterministic surface behavior (decision-pipeline rejects an omitted model with 400
|
|
13
|
+
// model_required) — reporting it without a call is honest AND free.
|
|
14
|
+
return {
|
|
15
|
+
ok: false,
|
|
16
|
+
configured: '',
|
|
17
|
+
latencyMs: 0,
|
|
18
|
+
code: 'not_configured',
|
|
19
|
+
error: 'systemone.defaultModel is not configured — /v1/systemone requests without a model are rejected (400 model_required)',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const key = firstEnabledKey();
|
|
23
|
+
if (!key) {
|
|
24
|
+
return { ok: false, configured, latencyMs: 0, code: 'no_api_key', error: 'no enabled gateway API key' };
|
|
25
|
+
}
|
|
26
|
+
// A pending selection rides as an explicit `model` — the surface resolves it through the same
|
|
27
|
+
// gates the saved fallback would after a save. Only the no-override probe omits `model`.
|
|
28
|
+
const body = overrideModel !== undefined ? { ...PROBE_BODY, model: configured } : PROBE_BODY;
|
|
29
|
+
let response;
|
|
30
|
+
try {
|
|
31
|
+
response = await fetch(`http://127.0.0.1:${defaultGatewayPort()}/v1/systemone`, {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}` },
|
|
34
|
+
body: JSON.stringify(body),
|
|
35
|
+
signal: AbortSignal.timeout(30_000),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
return {
|
|
40
|
+
ok: false,
|
|
41
|
+
configured,
|
|
42
|
+
latencyMs: Date.now() - started,
|
|
43
|
+
code: 'upstream',
|
|
44
|
+
error: e instanceof Error ? e.message : String(e),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
// The surface's error body names the real cause (model_required / model_not_found /
|
|
49
|
+
// no_healthy_model) — carry a short snippet instead of a bare status code.
|
|
50
|
+
let detail = '';
|
|
51
|
+
try {
|
|
52
|
+
detail = (await response.text()).replace(/\s+/g, ' ').trim().slice(0, 200);
|
|
53
|
+
}
|
|
54
|
+
catch { /* body unreadable — the status code is the whole message */ }
|
|
55
|
+
return {
|
|
56
|
+
ok: false,
|
|
57
|
+
configured,
|
|
58
|
+
latencyMs: Date.now() - started,
|
|
59
|
+
code: 'upstream',
|
|
60
|
+
error: `gateway returned HTTP ${response.status}${detail ? ` — ${detail}` : ''}`,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const payload = (await response.json().catch(() => null));
|
|
64
|
+
if (!payload || !payload.answers || typeof payload.model !== 'string') {
|
|
65
|
+
return {
|
|
66
|
+
ok: false,
|
|
67
|
+
configured,
|
|
68
|
+
latencyMs: Date.now() - started,
|
|
69
|
+
code: 'upstream',
|
|
70
|
+
error: 'malformed decision response from gateway',
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return { ok: true, configured, model: payload.model, latencyMs: Date.now() - started };
|
|
74
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `renameSync` with the house retry policy — the ONLY way a tmp→final atomic persist lands.
|
|
3
|
+
*
|
|
4
|
+
* Why a retry exists at all: on Windows, an antivirus or the search indexer briefly holds a handle
|
|
5
|
+
* on a just-written file, so the rename of a fresh tmp file intermittently fails with EPERM. The
|
|
6
|
+
* window is tens of milliseconds; five attempts with a 10/20/30/40 ms backoff ride through it.
|
|
7
|
+
*
|
|
8
|
+
* Apply this to every persist whose failure surfaces as a user-visible error (config writes, state
|
|
9
|
+
* journals, manifests). Best-effort renames stay bare: a `.corrupt.<ts>` quarantine or a daemon log
|
|
10
|
+
* rotation losing one rename is not a data-loss event.
|
|
11
|
+
*/
|
|
12
|
+
export declare function renameWithRetry(src: string, dest: string): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
/**
|
|
3
|
+
* `renameSync` with the house retry policy — the ONLY way a tmp→final atomic persist lands.
|
|
4
|
+
*
|
|
5
|
+
* Why a retry exists at all: on Windows, an antivirus or the search indexer briefly holds a handle
|
|
6
|
+
* on a just-written file, so the rename of a fresh tmp file intermittently fails with EPERM. The
|
|
7
|
+
* window is tens of milliseconds; five attempts with a 10/20/30/40 ms backoff ride through it.
|
|
8
|
+
*
|
|
9
|
+
* Apply this to every persist whose failure surfaces as a user-visible error (config writes, state
|
|
10
|
+
* journals, manifests). Best-effort renames stay bare: a `.corrupt.<ts>` quarantine or a daemon log
|
|
11
|
+
* rotation losing one rename is not a data-loss event.
|
|
12
|
+
*/
|
|
13
|
+
export function renameWithRetry(src, dest) {
|
|
14
|
+
let lastError;
|
|
15
|
+
for (let attempt = 0; attempt < 5; attempt++) {
|
|
16
|
+
try {
|
|
17
|
+
fs.renameSync(src, dest);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
lastError = e;
|
|
22
|
+
if (attempt < 4) {
|
|
23
|
+
const until = Date.now() + (attempt + 1) * 10;
|
|
24
|
+
while (Date.now() < until) { }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
throw lastError;
|
|
29
|
+
}
|
package/bin/ocr.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import '../backend/dist/cli/index.js';
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import '../backend/dist/cli/index.js';
|