omnicell-router 0.7.0 → 0.8.2
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/backend/dist/cli/clients/activity.d.ts +35 -0
- package/backend/dist/cli/clients/activity.js +67 -0
- package/backend/dist/cli/clients/base.d.ts +13 -2
- package/backend/dist/cli/clients/claude.d.ts +2 -2
- package/backend/dist/cli/clients/codex.d.ts +2 -2
- package/backend/dist/cli/clients/core-adapters.d.ts +3 -4
- package/backend/dist/cli/clients/core-adapters.js +3 -4
- package/backend/dist/cli/clients/cursor-proxy.d.ts +88 -0
- package/backend/dist/cli/clients/cursor-proxy.js +421 -0
- package/backend/dist/cli/clients/dsh.d.ts +2 -2
- package/backend/dist/cli/clients/grok.d.ts +2 -2
- package/backend/dist/cli/clients/index.d.ts +8 -1
- package/backend/dist/cli/clients/index.js +55 -21
- package/backend/dist/cli/clients/kimi.d.ts +2 -2
- package/backend/dist/cli/clients/launcher.d.ts +8 -0
- package/backend/dist/cli/clients/model-meta.js +1 -1
- package/backend/dist/cli/clients/omp.d.ts +2 -2
- package/backend/dist/cli/clients/openclaw.d.ts +2 -2
- package/backend/dist/cli/clients/opencode-proxy.d.ts +11 -0
- package/backend/dist/cli/clients/opencode-proxy.js +351 -0
- package/backend/dist/cli/clients/opencode.d.ts +2 -2
- package/backend/dist/cli/clients/pi.d.ts +2 -2
- package/backend/dist/cli/clients/plugin-adapters.d.ts +3 -1
- package/backend/dist/cli/clients/plugin-adapters.js +6 -29
- package/backend/dist/cli/clients/qoder-proxy.d.ts +84 -0
- package/backend/dist/cli/clients/qoder-proxy.js +497 -0
- package/backend/dist/cli/clients/reserved.d.ts +2 -6
- package/backend/dist/cli/clients/reserved.js +2 -0
- package/backend/dist/cli/clients/workbuddy.d.ts +2 -2
- package/backend/dist/cli/index.js +60 -9
- package/backend/dist/cli/types.d.ts +29 -8
- package/backend/dist/compression/caveman-prompts.d.ts +1 -1
- package/backend/dist/config/comments-en.js +6 -12
- package/backend/dist/config/comments-zh.js +6 -12
- package/backend/dist/config/defaults.d.ts +56 -1
- package/backend/dist/config/defaults.js +68 -0
- package/backend/dist/config/index.d.ts +9 -2
- package/backend/dist/config/index.js +26 -3
- package/backend/dist/config/types.d.ts +55 -43
- package/backend/dist/forward-proxy/egress.d.ts +10 -2
- package/backend/dist/forward-proxy/egress.js +42 -4
- package/backend/dist/forward-proxy/ordered-relay.d.ts +29 -0
- package/backend/dist/forward-proxy/ordered-relay.js +46 -0
- package/backend/dist/forward-proxy/rules.d.ts +66 -19
- package/backend/dist/forward-proxy/rules.js +61 -14
- package/backend/dist/forward-proxy/server.js +226 -77
- package/backend/dist/forward-proxy/system-proxy.d.ts +42 -2
- package/backend/dist/forward-proxy/system-proxy.js +199 -22
- package/backend/dist/harness/common/market.d.ts +3 -3
- package/backend/dist/harness/host/adapters/amp.d.ts +1 -1
- package/backend/dist/harness/host/adapters/antigravity.d.ts +1 -1
- package/backend/dist/harness/host/adapters/claude.d.ts +1 -1
- package/backend/dist/harness/host/adapters/cline.d.ts +1 -1
- package/backend/dist/harness/host/adapters/codex.d.ts +1 -1
- package/backend/dist/harness/host/adapters/cursor.d.ts +1 -1
- package/backend/dist/harness/host/adapters/dsh.d.ts +2 -2
- package/backend/dist/harness/host/adapters/factory.d.ts +1 -1
- package/backend/dist/harness/host/adapters/gemini-cli.d.ts +1 -1
- package/backend/dist/harness/host/adapters/grok.d.ts +1 -1
- package/backend/dist/harness/host/adapters/kimi.d.ts +1 -1
- package/backend/dist/harness/host/adapters/omp.d.ts +1 -1
- package/backend/dist/harness/host/adapters/openclaw.d.ts +1 -1
- package/backend/dist/harness/host/adapters/opencode.d.ts +1 -1
- package/backend/dist/harness/host/adapters/pi.d.ts +1 -1
- package/backend/dist/harness/host/adapters/universal.d.ts +1 -1
- package/backend/dist/harness/host/adapters/windsurf.d.ts +1 -1
- package/backend/dist/harness/host/adapters/zed.d.ts +1 -1
- package/backend/dist/harness/skill/skills-sh.d.ts +1 -1
- package/backend/dist/harness/translation.js +64 -21
- package/backend/dist/harness/types.d.ts +1 -1
- package/backend/dist/harness/types.js +1 -1
- package/backend/dist/index.js +31 -18
- package/backend/dist/ir/adapters/anthropic-stream.d.ts +18 -0
- package/backend/dist/ir/adapters/anthropic-stream.js +247 -0
- package/backend/dist/ir/adapters/anthropic.d.ts +29 -0
- package/backend/dist/ir/adapters/anthropic.js +788 -0
- package/backend/dist/ir/adapters/chat.d.ts +15 -0
- package/backend/dist/ir/adapters/chat.js +602 -0
- package/backend/dist/ir/adapters/google-stream.d.ts +22 -0
- package/backend/dist/ir/adapters/google-stream.js +242 -0
- package/backend/dist/ir/adapters/google.d.ts +9 -0
- package/backend/dist/ir/adapters/google.js +317 -0
- package/backend/dist/ir/adapters/openai-responses-output.js +8 -5
- package/backend/dist/ir/adapters/openai-responses.d.ts +15 -0
- package/backend/dist/ir/adapters/openai-responses.js +26 -1
- package/backend/dist/ir/adapters/responses-output.d.ts +50 -0
- package/backend/dist/ir/adapters/responses-output.js +348 -0
- package/backend/dist/ir/adapters/responses-stream.d.ts +12 -0
- package/backend/dist/ir/adapters/responses-stream.js +178 -0
- package/backend/dist/ir/adapters/responses.d.ts +14 -0
- package/backend/dist/ir/adapters/responses.js +646 -0
- package/backend/dist/ir/errors.d.ts +2 -2
- package/backend/dist/ir/types.d.ts +2 -1
- package/backend/dist/metrics/request-cost.d.ts +11 -2
- package/backend/dist/metrics/request-cost.js +12 -3
- package/backend/dist/observability/request-identity.d.ts +1 -1
- package/backend/dist/observability/trace-id.d.ts +40 -0
- package/backend/dist/observability/trace-id.js +134 -0
- package/backend/dist/observability/upstream-events.d.ts +82 -60
- package/backend/dist/observability/upstream-events.js +142 -67
- package/backend/dist/opencode/catalog/types.d.ts +9 -0
- package/backend/dist/opencode/credentials/types.d.ts +2 -2
- package/backend/dist/opencode/probe.d.ts +24 -1
- package/backend/dist/opencode/probe.js +28 -4
- package/backend/dist/opencode/user-config.d.ts +5 -0
- package/backend/dist/pipeline/directives.d.ts +6 -2
- package/backend/dist/pipeline/directives.js +7 -3
- package/backend/dist/pipeline/orchestrator.d.ts +28 -27
- package/backend/dist/pipeline/orchestrator.js +220 -194
- package/backend/dist/pipeline/unresolved-model.d.ts +33 -0
- package/backend/dist/pipeline/unresolved-model.js +43 -0
- package/backend/dist/plugins/catalog-def.d.ts +143 -0
- package/backend/dist/plugins/catalog-def.js +177 -0
- package/backend/dist/plugins/gateways.d.ts +62 -3
- package/backend/dist/plugins/gateways.js +139 -2
- package/backend/dist/plugins/host.d.ts +42 -5
- package/backend/dist/plugins/host.js +454 -38
- package/backend/dist/plugins/manifest.d.ts +119 -10
- package/backend/dist/plugins/manifest.js +265 -14
- package/backend/dist/plugins/pack.js +26 -0
- package/backend/dist/plugins/types.d.ts +187 -21
- package/backend/dist/protocols/systemone/convert.d.ts +1 -0
- package/backend/dist/protocols/systemone/convert.js +6 -1
- package/backend/dist/protocols/systemone/decide.js +18 -8
- package/backend/dist/providers/anthropic-messages.d.ts +12 -0
- package/backend/dist/providers/anthropic-messages.js +53 -0
- package/backend/dist/providers/anthropic.d.ts +7 -8
- package/backend/dist/providers/anthropic.js +36 -324
- package/backend/dist/providers/base.d.ts +14 -2
- package/backend/dist/providers/boot-direct.js +68 -38
- package/backend/dist/providers/dispatch.d.ts +5 -19
- package/backend/dist/providers/dispatch.js +46 -58
- package/backend/dist/providers/executors/anthropic-messages.d.ts +1 -0
- package/backend/dist/providers/executors/anthropic-messages.js +3 -0
- package/backend/dist/providers/executors/dispatch.d.ts +16 -2
- package/backend/dist/providers/executors/dispatch.js +39 -9
- package/backend/dist/providers/executors/google-gemini.d.ts +1 -0
- package/backend/dist/providers/executors/google-gemini.js +3 -0
- package/backend/dist/providers/executors/http-stream.js +16 -3
- package/backend/dist/providers/executors/openai-chat.d.ts +1 -0
- package/backend/dist/providers/executors/openai-chat.js +3 -0
- package/backend/dist/providers/executors/openai-responses.d.ts +1 -0
- package/backend/dist/providers/executors/openai-responses.js +3 -0
- package/backend/dist/providers/executors/plugin-adapter.js +4 -4
- package/backend/dist/providers/google-gemini.d.ts +12 -0
- package/backend/dist/providers/google-gemini.js +50 -0
- package/backend/dist/providers/google.d.ts +7 -8
- package/backend/dist/providers/google.js +35 -308
- package/backend/dist/providers/http-json.d.ts +19 -0
- package/backend/dist/providers/http-json.js +104 -0
- package/backend/dist/providers/http-stream.d.ts +52 -0
- package/backend/dist/providers/http-stream.js +423 -0
- package/backend/dist/providers/member-match.d.ts +4 -5
- package/backend/dist/providers/member-match.js +4 -5
- package/backend/dist/providers/openai-chat.d.ts +13 -0
- package/backend/dist/providers/openai-chat.js +99 -0
- package/backend/dist/providers/openai-compatible.d.ts +7 -4
- package/backend/dist/providers/openai-compatible.js +71 -368
- package/backend/dist/providers/openai-responses.d.ts +12 -0
- package/backend/dist/providers/openai-responses.js +68 -0
- package/backend/dist/providers/opencode-proxy.d.ts +5 -5
- package/backend/dist/providers/opencode-proxy.js +49 -125
- package/backend/dist/providers/plugin-adapter.d.ts +9 -0
- package/backend/dist/providers/plugin-adapter.js +31 -0
- package/backend/dist/providers/registry.d.ts +49 -24
- package/backend/dist/providers/registry.js +97 -55
- package/backend/dist/providers/responses.d.ts +7 -28
- package/backend/dist/providers/responses.js +45 -253
- package/backend/dist/providers/tool-markup-leak.d.ts +41 -0
- package/backend/dist/providers/tool-markup-leak.js +57 -0
- package/backend/dist/providers/tool-markup-recovery.d.ts +27 -0
- package/backend/dist/providers/tool-markup-recovery.js +786 -0
- package/backend/dist/providers/virtual-meta.d.ts +21 -2
- package/backend/dist/providers/virtual-meta.js +49 -9
- package/backend/dist/proxy/asset-download.d.ts +54 -0
- package/backend/dist/proxy/asset-download.js +420 -0
- package/backend/dist/proxy/manual-node-spec.d.ts +16 -16
- package/backend/dist/proxy/mihomo-binary.d.ts +17 -2
- package/backend/dist/proxy/mihomo-binary.js +62 -51
- package/backend/dist/proxy/mihomo-client.js +15 -1
- package/backend/dist/proxy/mihomo-config.js +11 -2
- package/backend/dist/proxy/mihomo-geo.d.ts +87 -0
- package/backend/dist/proxy/mihomo-geo.js +213 -0
- package/backend/dist/proxy/mihomo-logs.d.ts +27 -0
- package/backend/dist/proxy/mihomo-logs.js +70 -0
- package/backend/dist/proxy/mihomo-pac.d.ts +11 -0
- package/backend/dist/proxy/mihomo-pac.js +15 -0
- package/backend/dist/proxy/mihomo-rules-import.d.ts +1 -1
- package/backend/dist/proxy/mihomo-rules-import.js +7 -7
- package/backend/dist/proxy/mihomo-sidecar.d.ts +17 -1
- package/backend/dist/proxy/mihomo-sidecar.js +148 -26
- package/backend/dist/quota/adapters/minimax.js +36 -13
- package/backend/dist/quota/cli-login.d.ts +8 -0
- package/backend/dist/quota/cli-login.js +18 -0
- package/backend/dist/quota/declarations.js +10 -0
- package/backend/dist/quota/dsl.js +18 -5
- package/backend/dist/quota/engine.d.ts +22 -1
- package/backend/dist/quota/engine.js +170 -29
- package/backend/dist/quota/prober.d.ts +5 -0
- package/backend/dist/quota/prober.js +11 -2
- package/backend/dist/quota/types.d.ts +87 -8
- package/backend/dist/quota/verdict.d.ts +35 -0
- package/backend/dist/quota/verdict.js +135 -0
- package/backend/dist/ratelimit/admission.d.ts +131 -0
- package/backend/dist/ratelimit/admission.js +233 -0
- package/backend/dist/ratelimit/rate-limiter.js +6 -0
- package/backend/dist/resilience/types.d.ts +2 -2
- package/backend/dist/router/layer2-decision.d.ts +1 -1
- package/backend/dist/router/layer2-decision.js +5 -8
- package/backend/dist/routes/console.js +248 -52
- package/backend/dist/routes/mihomo.d.ts +2 -0
- package/backend/dist/routes/mihomo.js +334 -29
- package/backend/dist/routes/responses.d.ts +87 -8
- package/backend/dist/routes/responses.js +314 -33
- package/backend/dist/server.js +34 -6
- package/backend/dist/session/session-manager.d.ts +6 -0
- package/backend/dist/session/session-manager.js +20 -9
- package/backend/dist/surfaces/chat-pipeline.d.ts +2 -2
- package/backend/dist/surfaces/chat-pipeline.js +17 -7
- package/backend/dist/surfaces/chat.js +15 -0
- package/backend/dist/surfaces/decision-pipeline.js +7 -10
- package/backend/dist/surfaces/direct-forward.d.ts +3 -0
- package/backend/dist/surfaces/direct-forward.js +206 -0
- package/backend/dist/surfaces/rate-limit-response.d.ts +17 -0
- package/backend/dist/surfaces/rate-limit-response.js +57 -0
- package/backend/dist/surfaces/types.d.ts +11 -0
- package/backend/dist/trace/tracker.d.ts +32 -1
- package/backend/dist/trace/tracker.js +29 -4
- package/backend/dist/types/router.d.ts +34 -12
- package/backend/dist/types/router.js +35 -6
- package/backend/dist/utils/chat-stream.d.ts +21 -8
- package/backend/dist/utils/chat-stream.js +46 -9
- package/backend/dist/utils/event-ring.d.ts +4 -0
- package/backend/dist/utils/event-ring.js +4 -0
- package/backend/dist/utils/popularity.js +29 -4
- package/backend/dist/utils/proxy.d.ts +7 -0
- package/backend/dist/utils/proxy.js +35 -10
- package/backend/dist/utils/retry-after.d.ts +21 -0
- package/backend/dist/utils/retry-after.js +36 -0
- package/bin/ocr.js +2 -2
- package/frontend/dist/assets/index-55VVwfFQ.js +1521 -0
- package/frontend/dist/assets/{index-CQSLGFTV.css → index-DxZ9MHKB.css} +1 -1
- package/frontend/dist/assets/workbuddy.color-DOMpQkxJ.svg +29 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-CLvxJjp_.js +0 -1476
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-client activity ledger — the console Clients page's dynamic sort key.
|
|
3
|
+
*
|
|
4
|
+
* A pure in-memory map, two timestamps per client ADAPTER name (the roster
|
|
5
|
+
* row key; there is no per-instance id — a family adapter is still one row):
|
|
6
|
+
*
|
|
7
|
+
* - `lastActiveAt` — stamped by the gateway's auth gate when an inference
|
|
8
|
+
* request arrives whose User-Agent fingerprints a known client CLI. The UA
|
|
9
|
+
* is forgeable and the fingerprint table is deliberately incomplete: this
|
|
10
|
+
* is DISPLAY-ONLY state (same doctrine as utils/harness-profiles.ts) — it
|
|
11
|
+
* never gates, rates or routes anything, so a spoofed or unknown UA costs
|
|
12
|
+
* at most a wrong card position.
|
|
13
|
+
* - `lastSetupAt` — stamped when `setupClient()` hooks a client successfully
|
|
14
|
+
* (the hooking moment — first takeover or a re-hook alike), so a freshly
|
|
15
|
+
* hooked client floats up even before it has sent any traffic.
|
|
16
|
+
*
|
|
17
|
+
* Memory-only by design: a gateway restart clears activity, and the roster
|
|
18
|
+
* falls back to `lastSetupAt` then the registry order. Nothing is persisted,
|
|
19
|
+
* nothing leaves the process.
|
|
20
|
+
*/
|
|
21
|
+
/** Record that `name` was hooked (setup succeeded) at `at`. */
|
|
22
|
+
export declare function noteClientSetup(name: string, at?: number): void;
|
|
23
|
+
/**
|
|
24
|
+
* Stamp activity for the client a request's User-Agent fingerprints, if any.
|
|
25
|
+
* Unknown / absent UAs are a no-op. Called per inference request — keep it
|
|
26
|
+
* allocation-free on the miss path.
|
|
27
|
+
*/
|
|
28
|
+
export declare function noteClientActivityFromUserAgent(ua: string | undefined, at?: number): void;
|
|
29
|
+
/** Activity timestamps for the clients the map knows about, keyed by adapter name. */
|
|
30
|
+
export declare function clientActivitySnapshot(): Record<string, {
|
|
31
|
+
lastActiveAt?: number;
|
|
32
|
+
lastSetupAt?: number;
|
|
33
|
+
}>;
|
|
34
|
+
/** Test reset — clears both maps (activity is process-local state). */
|
|
35
|
+
export declare function resetClientActivity(): void;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-client activity ledger — the console Clients page's dynamic sort key.
|
|
3
|
+
*
|
|
4
|
+
* A pure in-memory map, two timestamps per client ADAPTER name (the roster
|
|
5
|
+
* row key; there is no per-instance id — a family adapter is still one row):
|
|
6
|
+
*
|
|
7
|
+
* - `lastActiveAt` — stamped by the gateway's auth gate when an inference
|
|
8
|
+
* request arrives whose User-Agent fingerprints a known client CLI. The UA
|
|
9
|
+
* is forgeable and the fingerprint table is deliberately incomplete: this
|
|
10
|
+
* is DISPLAY-ONLY state (same doctrine as utils/harness-profiles.ts) — it
|
|
11
|
+
* never gates, rates or routes anything, so a spoofed or unknown UA costs
|
|
12
|
+
* at most a wrong card position.
|
|
13
|
+
* - `lastSetupAt` — stamped when `setupClient()` hooks a client successfully
|
|
14
|
+
* (the hooking moment — first takeover or a re-hook alike), so a freshly
|
|
15
|
+
* hooked client floats up even before it has sent any traffic.
|
|
16
|
+
*
|
|
17
|
+
* Memory-only by design: a gateway restart clears activity, and the roster
|
|
18
|
+
* falls back to `lastSetupAt` then the registry order. Nothing is persisted,
|
|
19
|
+
* nothing leaves the process.
|
|
20
|
+
*/
|
|
21
|
+
const lastActiveAt = new Map();
|
|
22
|
+
const lastSetupAt = new Map();
|
|
23
|
+
/**
|
|
24
|
+
* UA → client-adapter-name fingerprints — first match wins. Only confident,
|
|
25
|
+
* observed wire spellings belong here (measured on real traffic, like the
|
|
26
|
+
* harness-profiles evidence rule); a speculative entry mis-sorts a card.
|
|
27
|
+
* Known CLI User-Agents not listed (kimi, openclaw, dsh, …) simply never
|
|
28
|
+
* move in the sort — add each only once observed.
|
|
29
|
+
*/
|
|
30
|
+
const UA_MATCHERS = [
|
|
31
|
+
{ match: /claude-cli\//i, client: 'claude' },
|
|
32
|
+
{ match: /opencode\//i, client: 'opencode' },
|
|
33
|
+
{ match: /codex/i, client: 'codex' },
|
|
34
|
+
];
|
|
35
|
+
/** Record that `name` was hooked (setup succeeded) at `at`. */
|
|
36
|
+
export function noteClientSetup(name, at = Date.now()) {
|
|
37
|
+
lastSetupAt.set(name, at);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Stamp activity for the client a request's User-Agent fingerprints, if any.
|
|
41
|
+
* Unknown / absent UAs are a no-op. Called per inference request — keep it
|
|
42
|
+
* allocation-free on the miss path.
|
|
43
|
+
*/
|
|
44
|
+
export function noteClientActivityFromUserAgent(ua, at = Date.now()) {
|
|
45
|
+
if (!ua)
|
|
46
|
+
return;
|
|
47
|
+
for (const entry of UA_MATCHERS) {
|
|
48
|
+
if (entry.match.test(ua)) {
|
|
49
|
+
lastActiveAt.set(entry.client, at);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** Activity timestamps for the clients the map knows about, keyed by adapter name. */
|
|
55
|
+
export function clientActivitySnapshot() {
|
|
56
|
+
const out = {};
|
|
57
|
+
for (const [name, at] of lastSetupAt)
|
|
58
|
+
out[name] = { lastSetupAt: at };
|
|
59
|
+
for (const [name, at] of lastActiveAt)
|
|
60
|
+
out[name] = { ...out[name], lastActiveAt: at };
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
/** Test reset — clears both maps (activity is process-local state). */
|
|
64
|
+
export function resetClientActivity() {
|
|
65
|
+
lastActiveAt.clear();
|
|
66
|
+
lastSetupAt.clear();
|
|
67
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClientHookKind, ClientHookStatus
|
|
1
|
+
import { ClientHookKind, ClientHookStatus } from '../types.js';
|
|
2
2
|
import type { ClientLaunchVerb } from './launcher.js';
|
|
3
3
|
/** Last-resort fallback URL when config is unreadable; mirrors the config default. */
|
|
4
4
|
export declare const OCR_DEFAULT_PORT = 4000;
|
|
@@ -79,7 +79,10 @@ export interface ClientActionWarning {
|
|
|
79
79
|
* the caller must fall back. */
|
|
80
80
|
export declare function pluginWarningText(labels: Record<string, string | Record<string, string>> | undefined, code: string, params?: Record<string, string>): string | undefined;
|
|
81
81
|
export interface ClientAdapter {
|
|
82
|
-
|
|
82
|
+
/** Any string id the package declares (ADR-0027: dynamic registration —
|
|
83
|
+
* `plugin-adapters.ts` refuses only core and retired ids). Core hooks type
|
|
84
|
+
* their literals through `CORE_ADAPTERS`' `CoreClientId` keys. */
|
|
85
|
+
name: string;
|
|
83
86
|
displayName: string;
|
|
84
87
|
/** Where the hook lands; the registry stamps it into every status row. */
|
|
85
88
|
hookKind: ClientHookKind;
|
|
@@ -91,6 +94,14 @@ export interface ClientAdapter {
|
|
|
91
94
|
* drives. Declared here so the console never carries a client→logo table.
|
|
92
95
|
*/
|
|
93
96
|
icon?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Hook ids this hook MUTUALLY EXCLUDES: setting this hook up tears the
|
|
99
|
+
* sibling down first, and the registry tears this hook down when one of the
|
|
100
|
+
* listed ids is set up (both directions need only ONE side to declare).
|
|
101
|
+
* Only ids that can actually be installed are legal; the pairing is
|
|
102
|
+
* consulted by the generic `setupClient` logic — never hardcoded per id.
|
|
103
|
+
*/
|
|
104
|
+
exclusiveWith?: readonly string[];
|
|
94
105
|
/**
|
|
95
106
|
* Bare product name, for a surface whose context already implies the variant
|
|
96
107
|
* (the Clients tab header shows `OpenCode`, the flat overview list shows
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ClientAdapter } from './base.js';
|
|
2
2
|
import { ClientHookStatus } from '../types.js';
|
|
3
3
|
export declare class ClaudeClientAdapter implements ClientAdapter {
|
|
4
|
-
name:
|
|
5
|
-
hookKind:
|
|
4
|
+
name: "claude";
|
|
5
|
+
hookKind: "config";
|
|
6
6
|
displayName: string;
|
|
7
7
|
getConfigPath(): string;
|
|
8
8
|
getStatus(): Promise<Omit<ClientHookStatus, 'hookKind'>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ClientAdapter } from './base.js';
|
|
2
2
|
import { ClientHookStatus } from '../types.js';
|
|
3
3
|
export declare class CodexClientAdapter implements ClientAdapter {
|
|
4
|
-
name:
|
|
5
|
-
hookKind:
|
|
4
|
+
name: "codex";
|
|
5
|
+
hookKind: "config";
|
|
6
6
|
displayName: string;
|
|
7
7
|
getConfigPath(): string;
|
|
8
8
|
getStatus(): Promise<Omit<ClientHookStatus, 'hookKind'>>;
|
|
@@ -18,8 +18,7 @@ import type { CoreClientId } from './reserved.js';
|
|
|
18
18
|
*
|
|
19
19
|
* Typed `Record<CoreClientId, …>`, not `Record<string, …>`: the key list in
|
|
20
20
|
* `reserved.ts` is the single source, so a hook added or removed here without
|
|
21
|
-
* the id list (or the other way round) is a compile error.
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
21
|
+
* the id list (or the other way round) is a compile error. Package hooks are
|
|
22
|
+
* NOT typed here: they register any string id at runtime (ADR-0027), and core
|
|
23
|
+
* code must never string-reference one. */
|
|
25
24
|
export declare const CORE_ADAPTERS: Record<CoreClientId, ClientAdapter>;
|
|
@@ -26,10 +26,9 @@ import { WorkBuddyClientAdapter } from './workbuddy.js';
|
|
|
26
26
|
*
|
|
27
27
|
* Typed `Record<CoreClientId, …>`, not `Record<string, …>`: the key list in
|
|
28
28
|
* `reserved.ts` is the single source, so a hook added or removed here without
|
|
29
|
-
* the id list (or the other way round) is a compile error.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
29
|
+
* the id list (or the other way round) is a compile error. Package hooks are
|
|
30
|
+
* NOT typed here: they register any string id at runtime (ADR-0027), and core
|
|
31
|
+
* code must never string-reference one. */
|
|
33
32
|
export const CORE_ADAPTERS = {
|
|
34
33
|
opencode: new OpenCodeClientAdapter(),
|
|
35
34
|
claude: new ClaudeClientAdapter(),
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ClientAdapter, ClientActionResult } from './base.js';
|
|
2
|
+
import { ClientHookStatus } from '../types.js';
|
|
3
|
+
export declare function launcherPath(): string;
|
|
4
|
+
/** The CLI launcher — written only while `cursor-agent` is installed. */
|
|
5
|
+
export declare function agentLauncherPath(): string;
|
|
6
|
+
/**
|
|
7
|
+
* Loopback never enters the proxy hop. Cursor's Node legs inherit the proxy
|
|
8
|
+
* env vars set by the launcher, and proxying its own local services (language
|
|
9
|
+
* server, extension host, a project's dev server) would tie them to the
|
|
10
|
+
* gateway's lifetime. Both spellings are set on POSIX because libraries differ
|
|
11
|
+
* on which one they read; Windows env blocks are case-insensitive, so `set`
|
|
12
|
+
* emits ONE variable there.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CURSOR_NO_PROXY = "localhost,127.0.0.1,::1";
|
|
15
|
+
export interface CursorLauncherScripts {
|
|
16
|
+
main: string;
|
|
17
|
+
agent?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The launcher text for one platform. Pure so the env contract is testable
|
|
21
|
+
* without a real Cursor install:
|
|
22
|
+
* - `--proxy-server` covers Chromium legs;
|
|
23
|
+
* - lowercase `http(s)_proxy` covers Electron's Node/gRPC legs (they ignore
|
|
24
|
+
* the flag);
|
|
25
|
+
* - `NODE_EXTRA_CA_CERTS` covers Node's bundled Mozilla roots (the OS store
|
|
26
|
+
* is not consulted there);
|
|
27
|
+
* - `NO_PROXY`/`no_proxy` keeps loopback out of the proxy (one variable on
|
|
28
|
+
* Windows — the env block is case-insensitive there).
|
|
29
|
+
*
|
|
30
|
+
* Windows bodies open with `setlocal`: the `set` lines would otherwise rewrite
|
|
31
|
+
* the CALLING shell's proxy env for the rest of its life, and the agent body
|
|
32
|
+
* `call`s the target so an `exit` inside a `.cmd` shim cannot kill the caller.
|
|
33
|
+
*
|
|
34
|
+
* POSIX assignments quote the VALUE (`export K="v"`): a home directory with a
|
|
35
|
+
* space in it (routine on macOS) would otherwise truncate `NODE_EXTRA_CA_CERTS`
|
|
36
|
+
* at the first space. Both Windows bodies forward the caller's arguments with
|
|
37
|
+
* `%*` — `cmd.exe` re-expands them on `call`, which is the caller's business.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildCursorLaunchers(args: {
|
|
40
|
+
platform: NodeJS.Platform;
|
|
41
|
+
binary: string;
|
|
42
|
+
agentBinary?: string | null;
|
|
43
|
+
port: number;
|
|
44
|
+
caPath?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Strict mode (`forwardProxy.requireCredential`) needs the key IN the proxy
|
|
47
|
+
* URL: Chromium can prompt, but the Electron Node/gRPC legs cannot. Only the
|
|
48
|
+
* console setup passes it (the launcher file then holds the secret; written
|
|
49
|
+
* 0600/0700 instead of the default).
|
|
50
|
+
*/
|
|
51
|
+
proxyCredential?: string;
|
|
52
|
+
}): CursorLauncherScripts;
|
|
53
|
+
export declare class CursorProxyClientAdapter implements ClientAdapter {
|
|
54
|
+
name: "cursor-proxy";
|
|
55
|
+
hookKind: "launcher";
|
|
56
|
+
displayName: string;
|
|
57
|
+
versionCmd: string[];
|
|
58
|
+
getConfigPath(): string;
|
|
59
|
+
getStatus(): Promise<Omit<ClientHookStatus, 'hookKind'>>;
|
|
60
|
+
setup(options?: {
|
|
61
|
+
port?: number;
|
|
62
|
+
apiKey?: string;
|
|
63
|
+
}): Promise<ClientActionResult>;
|
|
64
|
+
teardown(): Promise<ClientActionResult>;
|
|
65
|
+
}
|
|
66
|
+
/** Outcome of a passthrough launcher run. */
|
|
67
|
+
export interface CursorLaunchResult {
|
|
68
|
+
ok: boolean;
|
|
69
|
+
code: number;
|
|
70
|
+
/** Launcher returns before the target exits (IDE launcher on win32/darwin). */
|
|
71
|
+
detached: boolean;
|
|
72
|
+
message?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Run one of the managed launchers, forwarding stdio and the launcher's exit code.
|
|
76
|
+
*
|
|
77
|
+
* `ocr cursor` / `ocr cursor-agent` go through the SCRIPT instead of re-deriving
|
|
78
|
+
* the proxy environment here: the launcher stays the single source of the env
|
|
79
|
+
* contract (flag for Chromium legs, lowercase http(s)_proxy + CA for Electron's
|
|
80
|
+
* Node legs), so a CLI launch and a double-click can never drift apart.
|
|
81
|
+
*
|
|
82
|
+
* `detached` flags the IDE launcher on win32/darwin, which returns as soon as
|
|
83
|
+
* the app is started (`start ""` / `nohup … &`): there the exit code is the
|
|
84
|
+
* LAUNCHER's, not the target's, and the target's own stdio never reaches us.
|
|
85
|
+
* The Linux `.sh` and the agent launchers stay attached, so their exit code is
|
|
86
|
+
* the real one.
|
|
87
|
+
*/
|
|
88
|
+
export declare function runCursorLauncher(kind: 'ide' | 'agent', argv: string[]): Promise<CursorLaunchResult>;
|