@kodax-ai/kodax 0.7.72 → 0.7.73
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 +92 -0
- package/README.md +48 -14
- package/README_CN.md +33 -10
- package/dist/chunks/{agent-YKGU4USA.js → agent-T6PGT6AU.js} +1 -1
- package/dist/chunks/argument-completer-QGMWA2C3.js +2 -0
- package/dist/chunks/{chunk-SQODXBLX.js → chunk-64M5HOCA.js} +1 -1
- package/dist/chunks/{chunk-PKQOEDHJ.js → chunk-6JTWXGVU.js} +217 -223
- package/dist/chunks/{chunk-IR5KIK7E.js → chunk-6RI2RBTF.js} +1 -1
- package/dist/chunks/chunk-AGDDM5AW.js +329 -0
- package/dist/chunks/chunk-BUPJGG3C.js +5 -0
- package/dist/chunks/chunk-EAD4SF3Z.js +413 -0
- package/dist/chunks/chunk-F7AIEHSS.js +46 -0
- package/dist/chunks/{chunk-E27LHEIP.js → chunk-GAFFYJU3.js} +1 -1
- package/dist/chunks/chunk-HVCNAZ52.js +365 -0
- package/dist/chunks/{chunk-MVARIMQV.js → chunk-M7FXNPWV.js} +2 -2
- package/dist/chunks/{chunk-44QXPEEE.js → chunk-MBAPT2R5.js} +1 -1
- package/dist/chunks/{chunk-WIBLZK4G.js → chunk-MLEAQTCD.js} +2 -2
- package/dist/chunks/{chunk-JSDLBXME.js → chunk-OG6DRNKV.js} +63 -63
- package/dist/chunks/{chunk-2RI252RN.js → chunk-PFH53O4M.js} +1 -1
- package/dist/chunks/chunk-V4F6IYNK.js +73 -0
- package/dist/chunks/chunk-WQ6PWGK5.js +320 -0
- package/dist/chunks/chunk-XXQLPTAN.js +78 -0
- package/dist/chunks/compaction-config-IHJBP4GO.js +2 -0
- package/dist/chunks/{construction-bootstrap-ZJPXUPXQ.js → construction-bootstrap-EGRUHKLP.js} +1 -1
- package/dist/chunks/dist-5N3I2RTW.js +2 -0
- package/dist/chunks/{dist-GOUP4YVE.js → dist-EVEJAII2.js} +1 -1
- package/dist/chunks/host-MECITNE3.js +2 -0
- package/dist/chunks/run-manager-AY7RQOWM.js +2 -0
- package/dist/chunks/{utils-OTT5CG5J.js → utils-2GAE4XIM.js} +1 -1
- package/dist/index.d.ts +16 -16
- package/dist/index.js +5 -5
- package/dist/kodax_cli.js +1341 -1320
- package/dist/provider-capabilities.json +184 -5
- package/dist/runtime-worker.js +1227 -1216
- package/dist/sdk-a2a.d.ts +10 -10
- package/dist/sdk-a2a.js +1 -1
- package/dist/sdk-agent.d.ts +13 -13
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +96 -30
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.d.ts +1 -1
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.d.ts +8 -49
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +138 -16
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +99 -17
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-session.d.ts +6 -6
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +10 -10
- package/dist/types-chunks/{base.d-Cz_rwpOi.d.ts → base.d-ChvpaKjZ.d.ts} +1 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-CHJO5y94.d.ts → bash-prefix-extractor.d-bApf5nGw.d.ts} +3 -3
- package/dist/types-chunks/{capability-learning.d-_lR0J4iR.d.ts → capability-learning.d-DPrYxRjF.d.ts} +1 -1
- package/dist/types-chunks/{capsule.d-DxtdE-GD.d.ts → capsule.d-CGWltwno.d.ts} +2 -2
- package/dist/types-chunks/{commands.d-DZxHzH5-.d.ts → commands.d-CEHGwRok.d.ts} +62 -6
- package/dist/types-chunks/{guardrail.d-DlpMnd-Y.d.ts → guardrail.d-CC4vAQl7.d.ts} +2 -1
- package/dist/types-chunks/{guardrail.d-auV61_h5.d.ts → guardrail.d-CXIPlWP3.d.ts} +10 -10
- package/dist/types-chunks/{public-api.d--IDNJsu1.d.ts → public-api.d-FBmX0kxo.d.ts} +4 -3
- package/dist/types-chunks/{run-manager.d-Bh50OdVl.d.ts → run-manager.d-DUNnJcpE.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-Cfw6NFu-.d.ts → sdk-session-XqacVOs8.d.ts} +3 -3
- package/dist/types-chunks/{resolver.d-ssgNSlrh.d.ts → side-query.d-DWTMsndP.d.ts} +68 -5
- package/dist/types-chunks/{types.d-DH1mvdcl.d.ts → types.d-BnPhGmar.d.ts} +3 -1
- package/dist/types-chunks/{types.d-Cqaw71Ax.d.ts → types.d-CSmF0t0n.d.ts} +6 -5
- package/dist/types-chunks/{types.d-EqQmHztg.d.ts → types.d-DKr6TCXL.d.ts} +16 -9
- package/dist/types-chunks/{types.d-CNZgY52F.d.ts → types.d-DgciGHoG.d.ts} +2 -2
- package/dist/types-chunks/{utils.d-gmn3c5U4.d.ts → utils.d-BPYX7-KN.d.ts} +94 -10
- package/docs/SDK_EMBEDDER_GUIDE.md +128 -21
- package/package.json +2 -2
- package/dist/chunks/argument-completer-QZETLNAB.js +0 -2
- package/dist/chunks/chunk-23X6REO4.js +0 -46
- package/dist/chunks/chunk-CLFP6UGU.js +0 -71
- package/dist/chunks/chunk-EDZ5KJFT.js +0 -5
- package/dist/chunks/chunk-GIK4SGAT.js +0 -364
- package/dist/chunks/chunk-GVWPHE23.js +0 -310
- package/dist/chunks/chunk-VDGCGOQH.js +0 -328
- package/dist/chunks/chunk-VVE3UM4F.js +0 -410
- package/dist/chunks/chunk-ZJIMT5I3.js +0 -78
- package/dist/chunks/compaction-config-TWCDFLX6.js +0 -2
- package/dist/chunks/dist-JT4ATXVM.js +0 -2
- package/dist/chunks/host-SVEDZUC5.js +0 -2
- package/dist/chunks/run-manager-RX42UNEM.js +0 -2
|
@@ -1905,12 +1905,12 @@ Each provider has one `verifyStrategy` value baked into `provider-capabilities.j
|
|
|
1905
1905
|
|
|
1906
1906
|
| Strategy | What runs | Cost | Used by built-ins |
|
|
1907
1907
|
|---|---|---|---|
|
|
1908
|
-
| `count-tokens` | `client.messages.countTokens({ messages: [{role:'user',content:'hi'}] })` | 0 token | `anthropic`, `zhipu-coding`, `
|
|
1908
|
+
| `count-tokens` | `client.messages.countTokens({ messages: [{role:'user',content:'hi'}] })` | 0 token | `anthropic`, `kimi-code`, `qwen-token-plan`, `zhipu-coding`, `zai-coding`, `minimax-coding`, `ark-coding` |
|
|
1909
1909
|
| `models-list` | `client.models.list()` | 0 token | `openai`, `deepseek`, `kimi`, `qwen` |
|
|
1910
1910
|
| `minimal-message` | `chat.completions.create({max_tokens:1, content:'hi'})` (or Anthropic equivalent) | ~6–7 token | `zhipu`, `mimo`, `mimo-coding` |
|
|
1911
1911
|
| `unsupported` | nothing — short-circuits | — | `gemini-cli`, `codex-cli` (cli-bridge: credentials live in CLI binary) |
|
|
1912
1912
|
|
|
1913
|
-
`models-list` is NOT used as a universal default because (a) some providers' `/v1/models` is publicly accessible (so a bad key returns 200 — false positive), and (b) some compat layers don't implement it (404) or 401 even for valid keys (false negative). The 2026-05-28 provider probe matrix captured
|
|
1913
|
+
`models-list` is NOT used as a universal default because (a) some providers' `/v1/models` is publicly accessible (so a bad key returns 200 — false positive), and (b) some compat layers don't implement it (404) or 401 even for valid keys (false negative). The 2026-05-28 provider probe matrix captured the original per-provider evidence (12 providers at the time; 15 built-in aliases as of 2026-06-28). The current capability catalog has 16 aliases, including `qwen-token-plan` with `count-tokens`; opencode's `setup-recording-env.ts` makes the same per-provider decision across its 20+ providers.
|
|
1914
1914
|
|
|
1915
1915
|
### Custom providers
|
|
1916
1916
|
|
|
@@ -2656,8 +2656,14 @@ sub.close();
|
|
|
2656
2656
|
|
|
2657
2657
|
`runs.start({ options })` is a DTO boundary in Worker and daemon forms. Do not
|
|
2658
2658
|
pass process-local objects such as `extensionRuntime`, callbacks, `AbortSignal`,
|
|
2659
|
-
LSP services, class instances, or cyclic structures. KodaX rejects them before
|
|
2660
|
-
transport instead of silently dropping fields.
|
|
2659
|
+
LSP services, class instances, or cyclic structures. KodaX rejects them before
|
|
2660
|
+
transport instead of silently dropping fields.
|
|
2661
|
+
|
|
2662
|
+
`events.beforeToolExecute` is an executable policy hook, not an observation
|
|
2663
|
+
callback. It is preserved in embedded mode and rejected in daemon mode; install
|
|
2664
|
+
the equivalent policy in the daemon owner instead. The KodaX REPL explicitly
|
|
2665
|
+
marks and removes only its own legacy approval hook because Runtime-owned
|
|
2666
|
+
permission brokering replaces that hook.
|
|
2661
2667
|
|
|
2662
2668
|
Use the runtime APIs for cross-boundary behavior:
|
|
2663
2669
|
|
|
@@ -2703,8 +2709,27 @@ await sub.ready;
|
|
|
2703
2709
|
Await `ready` before another client starts work that may request permission;
|
|
2704
2710
|
this creates an explicit cross-connection ordering boundary. Only the first
|
|
2705
2711
|
valid response wins. Wrong-run or stale responses are rejected.
|
|
2706
|
-
Abort, runtime close, daemon stop, and timeout reject unresolved permission
|
|
2707
|
-
requests so tool approval promises do not hang forever.
|
|
2712
|
+
Abort, runtime close, daemon stop, and timeout reject unresolved permission
|
|
2713
|
+
requests so tool approval promises do not hang forever.
|
|
2714
|
+
|
|
2715
|
+
SDK clients that create a concrete request may pass `toolInput` and
|
|
2716
|
+
`executionCwd` to `runtime.permissions.request(...)` in both embedded and
|
|
2717
|
+
daemon mode. The Runtime removes raw `toolInput` before publishing the pending
|
|
2718
|
+
request, derives the bounded/redacted preview from that concrete input,
|
|
2719
|
+
canonicalizes it into a matcher, and returns only opaque `grantSuggestions`.
|
|
2720
|
+
A caller-supplied `inputPreview` cannot override this trusted summary.
|
|
2721
|
+
`projectRoot`, classifier signals, and other owner-only safety context are
|
|
2722
|
+
deliberately not client request fields.
|
|
2723
|
+
|
|
2724
|
+
Grant administration is typed through `RuntimePermissionScope` and the
|
|
2725
|
+
exported `RuntimePermissionMatcher` union (`exact-command`, `exact-path`, and
|
|
2726
|
+
`exact-call`). These types are available from both the package root and
|
|
2727
|
+
`@kodax-ai/kodax/runtime`; matcher construction remains Runtime-owned.
|
|
2728
|
+
Legacy `allow_always.scope` responses remain accepted for 0.7.x clients, but
|
|
2729
|
+
the Runtime narrows them to its concrete candidate and never persists the
|
|
2730
|
+
client-provided coarse scope. Legacy persisted grants that lack a Runtime
|
|
2731
|
+
matcher remain inspectable and revocable, but never authorize a concrete tool
|
|
2732
|
+
call; the user must approve a fresh Runtime-issued exact suggestion.
|
|
2708
2733
|
|
|
2709
2734
|
### Config, catalogs, MCP, and Space-style admin APIs
|
|
2710
2735
|
|
|
@@ -3721,7 +3746,7 @@ const runtime = await connectKodaXRuntime({
|
|
|
3721
3746
|
sharedSessionSettings: 1,
|
|
3722
3747
|
durableRecoveryQueries: 1,
|
|
3723
3748
|
daemonManagement: 1,
|
|
3724
|
-
runtimeAutoModeGuardrail:
|
|
3749
|
+
runtimeAutoModeGuardrail: 3,
|
|
3725
3750
|
},
|
|
3726
3751
|
});
|
|
3727
3752
|
```
|
|
@@ -3733,17 +3758,21 @@ Coder. FEATURE_269 does not advertise `interruptInput`, so an interrupt-only
|
|
|
3733
3758
|
product must require `{ interruptInput: 1 }` and fail connection. The supported
|
|
3734
3759
|
fallback is `delivery: 'after_turn'` only when that is the user's intent.
|
|
3735
3760
|
|
|
3736
|
-
The
|
|
3761
|
+
The v0.7.73 SDK requires `runtimeAutoModeGuardrail:3` automatically for
|
|
3737
3762
|
`autoStart: true`, even when the caller omits it from `requirements`. If the healthy
|
|
3738
|
-
profile daemon
|
|
3739
|
-
revision/owner-policy fenced preflight, and replaces it only when no
|
|
3740
|
-
queued run, Workflow, Agent turn, pending permission/user input, or
|
|
3741
|
-
logical client exists. A busy or still-older daemon is never stopped: the
|
|
3763
|
+
profile daemon advertises v1 or v2, the SDK first requires `daemonManagement:1`,
|
|
3764
|
+
takes a revision/owner-policy fenced preflight, and replaces it only when no
|
|
3765
|
+
active or queued run, Workflow, Agent turn, pending permission/user input, or
|
|
3766
|
+
other logical client exists. A busy or still-older daemon is never stopped: the
|
|
3742
3767
|
connection rejects with `RuntimeDaemonCapabilityUpgradeError`, whose
|
|
3743
3768
|
`recoverable` and `restartRequired` fields are `true` and whose optional
|
|
3744
3769
|
`preflight` explains the blockers. Attach-only connections never mutate daemon
|
|
3745
3770
|
ownership and must request `runtimeAutoModeGuardrail:1` explicitly when they
|
|
3746
|
-
depend on
|
|
3771
|
+
depend only on the v1 owner contract, v2 for bounded input, effective-default
|
|
3772
|
+
metadata, structured diagnostics, and speculative-window parity, or v3 for
|
|
3773
|
+
opaque exact grant suggestions and concrete permission matchers. Capability
|
|
3774
|
+
requirements are minimum versions: v3 satisfies v1/v2, v2 satisfies v1, and an
|
|
3775
|
+
older daemon never satisfies a newer requirement.
|
|
3747
3776
|
|
|
3748
3777
|
The `coderFeatureMatrix` capability reports daemon availability for managed
|
|
3749
3778
|
runs, transcript/session operations, Todo projection, managed tasks, Workflow,
|
|
@@ -3866,7 +3895,8 @@ create another run. Settings use compare-and-swap; a stale revision returns a
|
|
|
3866
3895
|
structured conflict and must be reloaded, never silently overwritten. The
|
|
3867
3896
|
shared settings keys are `provider`, `model`, `effort`, `thinking`,
|
|
3868
3897
|
`reasoningMode`, `permissionMode`, `executionCwd`, `agentMode`, and
|
|
3869
|
-
`autoModeEngine
|
|
3898
|
+
`autoModeEngine`, `autoModeClassifierModel`, `autoModeTimeoutMs`, and
|
|
3899
|
+
`autoModeSpeculativeWindowMs`.
|
|
3870
3900
|
|
|
3871
3901
|
```ts
|
|
3872
3902
|
const queued = await runtime.runs.submitInput({
|
|
@@ -3909,9 +3939,13 @@ for (const request of await runtime.userInputs.listPending({ sessionId })) {
|
|
|
3909
3939
|
}
|
|
3910
3940
|
|
|
3911
3941
|
for (const request of await runtime.permissions.listPending({ sessionId })) {
|
|
3942
|
+
const sessionScope = request.grantSuggestions
|
|
3943
|
+
?.find((candidate) => candidate.kind === 'session');
|
|
3912
3944
|
const accepted = await runtime.permissions.respond(
|
|
3913
3945
|
request.id,
|
|
3914
|
-
|
|
3946
|
+
sessionScope
|
|
3947
|
+
? { type: 'allow_session', suggestionId: sessionScope.id }
|
|
3948
|
+
: { type: 'allow_once' },
|
|
3915
3949
|
{ runId: request.runId },
|
|
3916
3950
|
);
|
|
3917
3951
|
if (!accepted) refreshPendingInteractions();
|
|
@@ -3921,7 +3955,19 @@ for (const request of await runtime.permissions.listPending({ sessionId })) {
|
|
|
3921
3955
|
Persistent `allow_always` grants are owned by the daemon and require
|
|
3922
3956
|
`permission:grant-admin`. Use `permissions.listGrants()` and
|
|
3923
3957
|
`revokeGrant(grantId, expectedRevision)` for revision-safe administration.
|
|
3924
|
-
Clients must
|
|
3958
|
+
Clients must return one opaque `grantSuggestions[].id` from the pending request;
|
|
3959
|
+
they must not infer, construct, or widen a scope from the display label or input
|
|
3960
|
+
preview. A safe request can offer `allow_session` and `allow_always`; a risky or
|
|
3961
|
+
dynamic shell request deliberately omits the persistent candidate. Command
|
|
3962
|
+
grants match one exact normalized command/cwd/shell/background combination,
|
|
3963
|
+
while path grants match one tool and normalized absolute path (the future
|
|
3964
|
+
Write/Edit content may differ). Generic extension calls can receive only an
|
|
3965
|
+
exact in-memory Session grant. Raw command/argv data is not stored in the
|
|
3966
|
+
matcher; grants and audit contain only its fingerprint plus a bounded,
|
|
3967
|
+
secret-redacted operator label. Clients must not keep separate persistent
|
|
3968
|
+
permission rule stores. Runtime capability `runtimeAutoModeGuardrail` v3 advertises this
|
|
3969
|
+
opaque concrete-grant contract; restart or upgrade an older daemon instead of
|
|
3970
|
+
falling back to a client-side alias.
|
|
3925
3971
|
|
|
3926
3972
|
### Broker a Space keychain credential
|
|
3927
3973
|
|
|
@@ -4132,7 +4178,7 @@ tool arguments.
|
|
|
4132
4178
|
|
|
4133
4179
|
---
|
|
4134
4180
|
|
|
4135
|
-
## 24. Runtime-owned Auto Mode and plan-approval bridges (v0.7.72)
|
|
4181
|
+
## 24. Runtime-owned Auto Mode and plan-approval bridges (v0.7.72–v0.7.73)
|
|
4136
4182
|
|
|
4137
4183
|
Auto Mode is a Runtime session contract, including in shared-daemon mode. Do
|
|
4138
4184
|
not implement a second classifier or decide permissions from a client-side
|
|
@@ -4146,14 +4192,54 @@ await runtime.sessions.updateSettings(session.id, {
|
|
|
4146
4192
|
autoModeEngine: 'llm',
|
|
4147
4193
|
autoModeClassifierModel: 'zhipu:glm-5.2', // optional; otherwise follow the run model
|
|
4148
4194
|
autoModeTimeoutMs: 20_000, // positive safe integer, optional
|
|
4195
|
+
autoModeSpeculativeWindowMs: 0, // non-negative safe integer, optional
|
|
4149
4196
|
executionCwd: projectDirectory,
|
|
4150
4197
|
});
|
|
4151
4198
|
```
|
|
4152
4199
|
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4200
|
+
All three Auto fields are durable session settings in inline, Worker, and
|
|
4201
|
+
daemon forms. A `null` patch removes an optional override. Timeout must be a
|
|
4202
|
+
positive safe integer; speculative window must be non-negative, so `0` is a
|
|
4203
|
+
valid request to wait for the actual verdict. Daemon capability discovery
|
|
4204
|
+
advertises all fields in `sharedSessionSettings.keys`.
|
|
4205
|
+
|
|
4206
|
+
SDK hosts that need config precedence without creating a REPL can reuse the
|
|
4207
|
+
same typed resolver as KodaX:
|
|
4208
|
+
|
|
4209
|
+
```ts
|
|
4210
|
+
import {
|
|
4211
|
+
loadAutoModeSettings,
|
|
4212
|
+
resolveAutoModeSettings,
|
|
4213
|
+
type ResolveAutoModeSettingsInput,
|
|
4214
|
+
} from '@kodax-ai/kodax/repl';
|
|
4215
|
+
|
|
4216
|
+
const persisted = loadAutoModeSettings(process.env);
|
|
4217
|
+
const preview = resolveAutoModeSettings({
|
|
4218
|
+
settings: { engine: 'llm', speculativeWindowMs: 0 },
|
|
4219
|
+
env: process.env,
|
|
4220
|
+
});
|
|
4221
|
+
```
|
|
4222
|
+
|
|
4223
|
+
`resolveAutoModeSettings()` is pure. `loadAutoModeSettings()` reads the KodaX
|
|
4224
|
+
config once and delegates to that resolver; `loadConfig()` declares and
|
|
4225
|
+
returns the same optional `autoMode` object.
|
|
4226
|
+
|
|
4227
|
+
Starting with the v0.7.73 patch, `permissionMode: 'auto'` with an omitted
|
|
4228
|
+
`autoModeEngine` still means the documented `llm` default and is still owned by
|
|
4229
|
+
Runtime. If neither `autoModeClassifierModel` nor the effective run/session/
|
|
4230
|
+
Runtime model exists, `runs.start()` rejects with
|
|
4231
|
+
`RuntimeAutoModeConfigurationError` (`code:
|
|
4232
|
+
'auto_mode_classifier_model_required'`, `recoverable: true`) before provider
|
|
4233
|
+
construction, a classifier call, or a pending permission. Blank and malformed
|
|
4234
|
+
classifier model specs are rejected by the same typed configuration boundary;
|
|
4235
|
+
a live rules-to-LLM switch is blocked rather than converted into approval work.
|
|
4236
|
+
|
|
4237
|
+
Direct consumers of `createAutoModeToolGuardrail()` receive the same terminal
|
|
4238
|
+
model boundary. After resolving CLI/env/session/settings/live-default
|
|
4239
|
+
precedence, an empty effective model returns a local configuration `block`
|
|
4240
|
+
before provider lookup. It does not call `askUser`, mutate the denial or
|
|
4241
|
+
circuit-breaker trackers, or change the engine to rules. An explicit non-empty
|
|
4242
|
+
classifier override remains valid even when the main-session model is empty.
|
|
4157
4243
|
|
|
4158
4244
|
The Runtime owns one serialized permission-settings stream and one shared
|
|
4159
4245
|
engine/denial/breaker state per Session. It reuses bounded context-specific
|
|
@@ -4179,6 +4265,27 @@ spurious approval prompt. A real `escalate` uses the existing shared
|
|
|
4179
4265
|
it. Hosts should subscribe to permission events to display such a request, but
|
|
4180
4266
|
must not treat a missing request as an error for a safe tool call.
|
|
4181
4267
|
|
|
4268
|
+
The classifier deadline remains 20 seconds by default and includes connection
|
|
4269
|
+
setup, provider Retry-After/backoff, inference, and stream completion. KodaX
|
|
4270
|
+
does not solve timeouts by extending that deadline indefinitely. Before the
|
|
4271
|
+
provider call it removes assistant prose/thinking and image paths, limits each
|
|
4272
|
+
tool result to 2 KiB and the serialized permission-relevant transcript to
|
|
4273
|
+
8 KiB, then enforces 16 KiB action and 32 KiB total-prompt ceilings plus a
|
|
4274
|
+
256-token output cap. An oversized action or prompt escalates without a
|
|
4275
|
+
provider call; it is never truncated into an automatic allow. These limits are
|
|
4276
|
+
owned by `classify()` itself, so custom callers cannot accidentally bypass the
|
|
4277
|
+
session-history boundary.
|
|
4278
|
+
|
|
4279
|
+
`ClassifyDecision.diagnostics` and the lower-level
|
|
4280
|
+
`SideQueryResult.diagnostics` expose provider, model, effective timeout,
|
|
4281
|
+
elapsed time, retry count/wait, and a coarse terminal phase without including
|
|
4282
|
+
the prompt, action, messages, or response text. `pre_output` means no non-empty
|
|
4283
|
+
text delta was observed; `streaming` means output began before termination.
|
|
4284
|
+
`firstOutputMs` and `streamMs` are present only when the provider adapter emits
|
|
4285
|
+
a text delta. The current provider API cannot honestly separate DNS/connect,
|
|
4286
|
+
TLS, provider queueing, and inference, so embedders must not infer those stages
|
|
4287
|
+
from `pre_output`.
|
|
4288
|
+
|
|
4182
4289
|
The permission event's `inputPreview` is a display-safe diagnostic projection:
|
|
4183
4290
|
it is bounded, credential-redacted, valid JSON, and includes the effective
|
|
4184
4291
|
execution directory. Use the Runtime owner’s typed tool input for execution;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kodax-ai/kodax",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "KodaX lightweight coding agent - TypeScript implementation with
|
|
3
|
+
"version": "0.7.73",
|
|
4
|
+
"description": "KodaX lightweight coding agent - TypeScript implementation with 16 built-in LLM provider aliases, published as a Node-free single-file CLI and SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"publishConfig": {
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{Da as a,Ea as b}from"./chunk-PKQOEDHJ.js";import"./chunk-WIBLZK4G.js";import"./chunk-2RI252RN.js";import"./chunk-VVE3UM4F.js";import"./chunk-IR5KIK7E.js";import"./chunk-MVARIMQV.js";import"./chunk-VDGCGOQH.js";import"./chunk-SQODXBLX.js";import"./chunk-44QXPEEE.js";import"./chunk-GIK4SGAT.js";import"./chunk-ZJIMT5I3.js";import"./chunk-JSDLBXME.js";import"./chunk-E27LHEIP.js";import"./chunk-EDZ5KJFT.js";import"./chunk-23X6REO4.js";import"./chunk-ONUPGMER.js";export{a as ArgumentCompleter,b as createArgumentCompleter};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{a as o}from"./chunk-ONUPGMER.js";import{AsyncLocalStorage as Be}from"node:async_hooks";var Ne=new Be;function Le(e){let t=Ne.getStore()?.credential;return t?M(e,t,new WeakMap):e}o(Le,"redactScopedProviderCredential");function M(e,t,n){if(typeof e=="string")return e.split(t).join("[REDACTED_CREDENTIAL]");if(e===null||typeof e!="object")return e;let r=n.get(e);if(r!==void 0)return r;if(e instanceof Error){let s=new Error(M(e.message,t,n));return n.set(e,s),s.name=e.name,e.stack!==void 0&&(s.stack=M(e.stack,t,n)),s}if(Array.isArray(e)){let s=[];n.set(e,s);for(let l of e)s.push(M(l,t,n));return s}let i={};n.set(e,i);for(let[s,l]of Object.entries(Object.getOwnPropertyDescriptors(e))){if(!l.enumerable||!("value"in l))continue;let u=s.split(t).join("[REDACTED_CREDENTIAL]");i[u]=M(l.value,t,n)}return i}o(M,"redactCredentialValue");function A(e,t){return`${e}/${t??""}`}o(A,"capabilityCacheKey");function je(e,t,n){return e[A(t,n)]?.rejected??[]}o(je,"getRejectedEfforts");function $e(e,t,n,r,i,s){let l=A(t,n),u=e[l],g=u?.rejected.includes(r)?u.rejected:[...u?.rejected??[],r];return{...e,[l]:{rejected:g,source:i,updatedAt:s}}}o($e,"addRejectedEffort");function Fe(e,t,n){if(!t)return{};let r={...e};return delete r[A(t,n)],r}o(Fe,"removeCacheEntry");function Ue(e){if(!e||typeof e!="object")return{};let t={};for(let[n,r]of Object.entries(e)){if(!r||typeof r!="object")continue;let i=r,s=Array.isArray(i.rejected)?i.rejected.filter(g=>typeof g=="string"):[],l=i.source==="probed"?"probed":"observed",u=typeof i.updatedAt=="string"?i.updatedAt:"";t[n]={rejected:s,source:l,updatedAt:u}}return t}o(Ue,"sanitizeCapabilityCache");import{AsyncLocalStorage as We}from"node:async_hooks";var Ve=new We,J=8,Y=32;function ze(e){if(e===void 0)return;let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:void 0}o(ze,"parsePositiveInt");function qe(){let e=I()?.workflow?.maxConcurrency,t=typeof e=="number"&&Number.isInteger(e)&&e>0?e:ze(process.env.KODAX_WORKFLOW_MAX_CONCURRENCY)??J;return Math.max(1,Math.min(Y,t))}o(qe,"resolveWorkflowMaxConcurrency");function I(){return Ve.getStore()}o(I,"getRunScopedConfig");var K={transport:"native-api",conversationSemantics:"full-history",mcpSupport:"none",contextFidelity:"full",toolCallingFidelity:"full",sessionSupport:"full",longRunningSupport:"full",multimodalSupport:"none",evidenceSupport:"full"},Q={...K,multimodalSupport:"image-input"},O={transport:"cli-bridge",conversationSemantics:"last-user-message",mcpSupport:"none",contextFidelity:"lossy",toolCallingFidelity:"limited",sessionSupport:"stateless",longRunningSupport:"limited",multimodalSupport:"none",evidenceSupport:"limited"},Z={...O,multimodalSupport:"image-input"};function j(e){return{transport:e.transport,conversationSemantics:e.conversationSemantics,mcpSupport:e.mcpSupport,contextFidelity:e.contextFidelity??"full",toolCallingFidelity:e.toolCallingFidelity??"full",sessionSupport:e.sessionSupport??"full",longRunningSupport:e.longRunningSupport??"full",multimodalSupport:e.multimodalSupport??"none",evidenceSupport:e.evidenceSupport??"full"}}o(j,"normalizeCapabilityProfile");import tn from"@anthropic-ai/sdk";import{parse as $o}from"partial-json";import hn from"openai";import{ClientSideConnection as _n,PROTOCOL_VERSION as Xn,ndJsonStream as An}from"@agentclientprotocol/sdk";var Sn=String.raw`
|
|
3
|
-
using System;
|
|
4
|
-
using System.Runtime.InteropServices;
|
|
5
|
-
using System.Text;
|
|
6
|
-
public static class KodaXNativeProcessSnapshot {
|
|
7
|
-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
|
8
|
-
private struct ProcessEntry32 {
|
|
9
|
-
public uint dwSize;
|
|
10
|
-
public uint cntUsage;
|
|
11
|
-
public uint th32ProcessID;
|
|
12
|
-
public IntPtr th32DefaultHeapID;
|
|
13
|
-
public uint th32ModuleID;
|
|
14
|
-
public uint cntThreads;
|
|
15
|
-
public uint th32ParentProcessID;
|
|
16
|
-
public int pcPriClassBase;
|
|
17
|
-
public uint dwFlags;
|
|
18
|
-
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
|
|
19
|
-
public string szExeFile;
|
|
20
|
-
}
|
|
21
|
-
[DllImport("kernel32.dll", SetLastError = true)]
|
|
22
|
-
private static extern IntPtr CreateToolhelp32Snapshot(uint flags, uint processId);
|
|
23
|
-
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
|
24
|
-
private static extern bool Process32First(IntPtr snapshot, ref ProcessEntry32 entry);
|
|
25
|
-
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
|
26
|
-
private static extern bool Process32Next(IntPtr snapshot, ref ProcessEntry32 entry);
|
|
27
|
-
[DllImport("kernel32.dll")]
|
|
28
|
-
private static extern bool CloseHandle(IntPtr handle);
|
|
29
|
-
public static string ReadRows() {
|
|
30
|
-
var snapshot = CreateToolhelp32Snapshot(2, 0);
|
|
31
|
-
if (snapshot == new IntPtr(-1)) return string.Empty;
|
|
32
|
-
var rows = new StringBuilder();
|
|
33
|
-
var entry = new ProcessEntry32();
|
|
34
|
-
entry.dwSize = (uint)Marshal.SizeOf(entry);
|
|
35
|
-
try {
|
|
36
|
-
if (!Process32First(snapshot, ref entry)) return string.Empty;
|
|
37
|
-
do {
|
|
38
|
-
rows.Append(entry.th32ProcessID).Append(',').Append(entry.th32ParentProcessID).Append('\n');
|
|
39
|
-
entry.dwSize = (uint)Marshal.SizeOf(entry);
|
|
40
|
-
} while (Process32Next(snapshot, ref entry));
|
|
41
|
-
return rows.ToString();
|
|
42
|
-
} finally {
|
|
43
|
-
CloseHandle(snapshot);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}`;import ie from"node:fs";import se from"node:os";import ae from"node:path";var pt="gpt-5.4",gt="auto-gemini-3",mt=["gpt-5.4","gpt-5.3-codex","gpt-5.3-codex-spark"],ht=["auto-gemini-3","gemini-3.1-pro-preview","gemini-3-flash-preview","gemini-2.5-pro","gemini-2.5-flash"];function de(e){let t=new Set,n=[];for(let r of e){let i=r.trim();if(!i)continue;let s=i.toLowerCase();t.has(s)||(t.add(s),n.push(i))}return n}o(de,"dedupePreserveOrder");function yt(){let e=ae.join(se.homedir(),".codex","config.toml");try{return ie.readFileSync(e,"utf8").match(/^\s*model\s*=\s*"([^"]+)"/m)?.[1]?.trim()||null}catch{return null}}o(yt,"readCodexConfiguredModel");function bt(){let e=ae.join(se.homedir(),".gemini","settings.json");try{let t=JSON.parse(ie.readFileSync(e,"utf8")),n=typeof t.model=="string"?t.model.trim():"";return n||(typeof t.general?.model=="string"?t.general.model.trim():"")||null}catch{return null}}o(bt,"readGeminiConfiguredModel");function E(){return yt()||pt}o(E,"getCodexCliDefaultModel");function T(){return bt()||gt}o(T,"getGeminiCliDefaultModel");function w(){return de([E(),...mt])}o(w,"getCodexCliKnownModels");function _(){return de([T(),...ht])}o(_,"getGeminiCliKnownModels");var pr=T(),gr=_();var xr=E(),Sr=w();import{existsSync as wt,readFileSync as _t}from"node:fs";import S from"node:path";import{fileURLToPath as Xt}from"node:url";var le=["none","prompt-only","native-effort","native-budget","native-toggle","native-adaptive","unknown"],ue=["openai-responses-effort","openai-chat-effort","codex-cli-config","anthropic-output-effort","provider-budget","provider-toggle","prompt-only","none"],ce=["anthropic-adaptive","anthropic-budget","provider-budget","provider-toggle","none"],fe=["zai-glm-5.2","zai-glm-toggle","deepseek-v4-openai","deepseek-v4-anthropic","deepseek-toggle","kimi-k3","kimi-k2.7-code","kimi-hybrid-toggle","minimax-m3","minimax-m2-always","mimo-v2.5-toggle","qwen-hybrid-thinking","openai-chat-reasoning","openai-responses-reasoning","codex-cli-effort","claude-adaptive-xhigh","claude-adaptive-max","anthropic-budget","generic-thinking-toggle","none"],pe=["native","image-input-native","cli-bridge","image-input-cli-bridge"],ge=["count-tokens","models-list","minimal-message","unsupported"];function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(h,"isPlainObject");function R(e,t){if(typeof e!="string"||e.length===0)throw new Error(`provider-capabilities.json: ${t} must be a non-empty string`);return e}o(R,"requireString");function x(e,t){if(e!==void 0)return R(e,t)}o(x,"optionalString");function P(e,t){if(e!==void 0){if(typeof e!="number"||!Number.isFinite(e)||e<0)throw new Error(`provider-capabilities.json: ${t} must be a non-negative finite number`);return e}}o(P,"optionalNumber");function f(e,t){if(e!==void 0){if(typeof e!="boolean")throw new Error(`provider-capabilities.json: ${t} must be a boolean`);return e}}o(f,"optionalBoolean");function me(e,t){if(e!==void 0){if(!Array.isArray(e))throw new Error(`provider-capabilities.json: ${t} must be an array`);return e.map((n,r)=>R(n,`${t}[${r}]`))}}o(me,"optionalStringArray");function Ct(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let n={};for(let[r,i]of Object.entries(e))n[r]=R(i,`${t}.${r}`);return n}o(Ct,"optionalStringMap");function Pt(e,t){if(e!==void 0){if(typeof e!="string"||!fe.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${fe.join(", ")}, got ${JSON.stringify(e)}`);return e}}o(Pt,"optionalReasoningPreset");function F(e,t){if(typeof e!="string"||!le.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${le.join(", ")}, got ${JSON.stringify(e)}`);return e}o(F,"requireReasoningCapability");function Rt(e,t){if(typeof e!="string"||!ue.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ue.join(", ")}, got ${JSON.stringify(e)}`);return e}o(Rt,"requireEffortStrategy");function Et(e,t){if(e!==void 0){if(typeof e!="string"||!ce.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ce.join(", ")}, got ${JSON.stringify(e)}`);return e}}o(Et,"optionalThinkingStrategy");function he(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let n=Rt(e.effortStrategy,`${t}.effortStrategy`),r=Pt(e.reasoningPreset,`${t}.reasoningPreset`),i=Et(e.thinkingStrategy,`${t}.thinkingStrategy`),s=x(e.defaultEffort,`${t}.defaultEffort`),l=Ct(e.effortAliases,`${t}.effortAliases`),u=me(e.disabledEfforts,`${t}.disabledEfforts`),g=me(e.localRejectEfforts,`${t}.localRejectEfforts`),y=f(e.allowCustomEffort,`${t}.allowCustomEffort`),b=f(e.supportsReasoningEffort,`${t}.supportsReasoningEffort`),v=f(e.supportsReasoningSummary,`${t}.supportsReasoningSummary`),k=f(e.supportsEncryptedReasoningReplay,`${t}.supportsEncryptedReasoningReplay`),d=f(e.supportsAdaptiveThinking,`${t}.supportsAdaptiveThinking`),C=f(e.supportsManualThinkingBudget,`${t}.supportsManualThinkingBudget`),p=f(e.supportsDisabledThinking,`${t}.supportsDisabledThinking`),X=f(e.requiresEffortBetaHeader,`${t}.requiresEffortBetaHeader`),a={effortStrategy:n};if(r!==void 0&&(a.reasoningPreset=r),i!==void 0&&(a.thinkingStrategy=i),s!==void 0&&(a.defaultEffort=s),l!==void 0&&(a.effortAliases=l),u!==void 0&&(a.disabledEfforts=u),g!==void 0&&(a.localRejectEfforts=g),e.supportedEfforts!==void 0){if(!Array.isArray(e.supportedEfforts))throw new Error(`provider-capabilities.json: ${t}.supportedEfforts must be an array`);a.supportedEfforts=e.supportedEfforts.map((c,m)=>{if(!h(c))throw new Error(`provider-capabilities.json: ${t}.supportedEfforts[${m}] must be an object`);return{value:R(c.value,`${t}.supportedEfforts[${m}].value`),...x(c.description,`${t}.supportedEfforts[${m}].description`)!==void 0?{description:x(c.description,`${t}.supportedEfforts[${m}].description`)}:{},...f(c.isDefault,`${t}.supportedEfforts[${m}].isDefault`)!==void 0?{isDefault:f(c.isDefault,`${t}.supportedEfforts[${m}].isDefault`)}:{},...f(c.isUserVisible,`${t}.supportedEfforts[${m}].isUserVisible`)!==void 0?{isUserVisible:f(c.isUserVisible,`${t}.supportedEfforts[${m}].isUserVisible`)}:{}}})}if(e.budgetByEffort!==void 0){if(!h(e.budgetByEffort))throw new Error(`provider-capabilities.json: ${t}.budgetByEffort must be an object`);let c={};for(let[m,G]of Object.entries(e.budgetByEffort))c[m]=P(G,`${t}.budgetByEffort.${m}`)??0;a.budgetByEffort=c}return y!==void 0&&(a.allowCustomEffort=y),b!==void 0&&(a.supportsReasoningEffort=b),v!==void 0&&(a.supportsReasoningSummary=v),k!==void 0&&(a.supportsEncryptedReasoningReplay=k),d!==void 0&&(a.supportsAdaptiveThinking=d),C!==void 0&&(a.supportsManualThinkingBudget=C),p!==void 0&&(a.supportsDisabledThinking=p),X!==void 0&&(a.requiresEffortBetaHeader=X),a}o(he,"validateReasoningProfile");function ye(e,t){let n=e.reasoningProfile,r=e.reasoningCapabilityV2;if(n!==void 0&&r!==void 0)throw new Error(`provider-capabilities.json: ${t} must not define both reasoningProfile and deprecated reasoningCapabilityV2`);return n!==void 0?he(n,`${t}.reasoningProfile`):he(r,`${t}.reasoningCapabilityV2`)}o(ye,"validateReasoningProfileField");function Tt(e,t){if(typeof e!="string"||!pe.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${pe.join(", ")}, got ${JSON.stringify(e)}`);return e}o(Tt,"requireProfileName");function xt(e,t){if(typeof e!="string"||!ge.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ge.join(", ")}, got ${JSON.stringify(e)}`);return e}o(xt,"requireVerifyStrategy");function St(e,t){if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let n=R(e.id,`${t}.id`),r=x(e.wireModel,`${t}.wireModel`),i=x(e.displayName,`${t}.displayName`),s=P(e.contextWindow,`${t}.contextWindow`),l=P(e.maxOutputTokens,`${t}.maxOutputTokens`),u=P(e.thinkingBudgetCap,`${t}.thinkingBudgetCap`),g=f(e.replayReasoningContent,`${t}.replayReasoningContent`),y=f(e.strictThinkingSignature,`${t}.strictThinkingSignature`),b=P(e.streamMaxDurationMs,`${t}.streamMaxDurationMs`),v=e.reasoningCapability===void 0?void 0:F(e.reasoningCapability,`${t}.reasoningCapability`),k=ye(e,t),d={id:n};return r!==void 0&&(d.wireModel=r),i!==void 0&&(d.displayName=i),s!==void 0&&(d.contextWindow=s),l!==void 0&&(d.maxOutputTokens=l),u!==void 0&&(d.thinkingBudgetCap=u),v!==void 0&&(d.reasoningCapability=v),k!==void 0&&(d.reasoningProfile=k),g!==void 0&&(d.replayReasoningContent=g),y!==void 0&&(d.strictThinkingSignature=y),b!==void 0&&(d.streamMaxDurationMs=b),d}o(St,"validateModelDescriptor");function Mt(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let n={};for(let[r,i]of Object.entries(e))n[r]=F(i,`${t}.${r}`);return n}o(Mt,"validateModelReasoningCapabilities");function Kt(e,t){if(!h(e))throw new Error(`provider-capabilities.json: providers.${t} must be an object`);let n=f(e.cliBridge,`providers.${t}.cliBridge`),r=R(e.apiKeyEnv,`providers.${t}.apiKeyEnv`),i=F(e.reasoningCapability,`providers.${t}.reasoningCapability`),s=ye(e,`providers.${t}`),l=Tt(e.capabilityProfile,`providers.${t}.capabilityProfile`),u=xt(e.verifyStrategy,`providers.${t}.verifyStrategy`);if(n&&u!=="unsupported")throw new Error(`provider-capabilities.json: providers.${t} is a cliBridge entry but verifyStrategy="${u}" \u2014 must be "unsupported" (CLI binary owns credentials)`);let g=P(e.contextWindow,`providers.${t}.contextWindow`),y=P(e.maxOutputTokens,`providers.${t}.maxOutputTokens`),b=P(e.thinkingBudgetCap,`providers.${t}.thinkingBudgetCap`),v=f(e.supportsThinking,`providers.${t}.supportsThinking`),k=Mt(e.modelReasoningCapabilities,`providers.${t}.modelReasoningCapabilities`),d=x(e.model,`providers.${t}.model`);if(n&&(d!==void 0||e.models!==void 0))throw new Error(`provider-capabilities.json: providers.${t} is a cliBridge entry but defines model/models \u2014 must be omitted (filled at load time)`);if(!n&&d===void 0)throw new Error(`provider-capabilities.json: providers.${t}.model is required (only cliBridge entries may omit)`);let C;if(e.models!==void 0){if(!Array.isArray(e.models))throw new Error(`provider-capabilities.json: providers.${t}.models must be an array`);C=e.models.map((a,c)=>St(a,`providers.${t}.models[${c}]`));let X=new Set([...d===void 0?[]:[d],...C.map(a=>a.id)]);for(let[a,c]of C.entries())if(c.wireModel!==void 0&&!X.has(c.wireModel))throw new Error(`provider-capabilities.json: providers.${t}.models[${a}].wireModel must reference a declared model, got ${JSON.stringify(c.wireModel)}`)}let p={apiKeyEnv:r,reasoningCapability:i,capabilityProfile:l,verifyStrategy:u};return s!==void 0&&(p.reasoningProfile=s),d!==void 0&&(p.model=d),C!==void 0&&(p.models=C),g!==void 0&&(p.contextWindow=g),y!==void 0&&(p.maxOutputTokens=y),b!==void 0&&(p.thinkingBudgetCap=b),v!==void 0&&(p.supportsThinking=v),k!==void 0&&(p.modelReasoningCapabilities=k),n&&(p.cliBridge=!0),p}o(Kt,"validateProviderEntry");function be(e){if(!h(e))throw new Error("provider-capabilities.json: root must be an object");if(e.version!==1)throw new Error(`provider-capabilities.json: version must be 1, got ${JSON.stringify(e.version)}`);let t=R(e.updatedAt,"updatedAt");if(!h(e.providers))throw new Error("provider-capabilities.json: providers must be an object");let n={};for(let[r,i]of Object.entries(e.providers))n[r]=Kt(i,r);return{version:1,updatedAt:t,providers:n}}o(be,"validateProviderCapabilitiesJson");var At=Object.freeze({native:K,"image-input-native":Q,"cli-bridge":O,"image-input-cli-bridge":Z}),L=null;function It(){if(process.env.KODAX_BUNDLED==="true")return S.join(S.dirname(process.execPath),"provider-capabilities.json");let e=S.dirname(Xt(import.meta.url)),t=[S.join(e,"provider-capabilities.json"),S.join(S.dirname(e),"provider-capabilities.json")];for(let n of t)if(wt(n))return n;return t[0]}o(It,"resolveJsonPath");function Ot(e){if(e.models){for(let t of e.models)t.reasoningProfile&&ve(t.reasoningProfile);for(let t of e.models)Object.freeze(t);Object.freeze(e.models)}return e.reasoningProfile&&ve(e.reasoningProfile),e.modelReasoningCapabilities&&Object.freeze(e.modelReasoningCapabilities),Object.freeze(e)}o(Ot,"deepFreezeSnapshot");function ve(e){if(e.supportedEfforts){for(let t of e.supportedEfforts)Object.freeze(t);Object.freeze(e.supportedEfforts)}e.budgetByEffort&&Object.freeze(e.budgetByEffort),e.effortAliases&&Object.freeze(e.effortAliases),e.disabledEfforts&&Object.freeze(e.disabledEfforts),e.localRejectEfforts&&Object.freeze(e.localRejectEfforts),Object.freeze(e)}o(ve,"freezeReasoningProfile");function Dt(e){if(e==="gemini-cli"){let t=T();return{model:t,models:_().filter(n=>n!==t).map(n=>({id:n}))}}if(e==="codex-cli"){let t=E();return{model:t,models:w().filter(n=>n!==t).map(n=>({id:n}))}}throw new Error(`provider-capabilities loader: unknown cliBridge provider '${e}'`)}o(Dt,"resolveCliBridgeModels");function Bt(e,t){let n=At[t.capabilityProfile];if(!n)throw new Error(`provider-capabilities loader: unknown capabilityProfile '${t.capabilityProfile}' for provider '${e}'`);if(t.cliBridge){let i=Dt(e),s={model:i.model,models:i.models,apiKeyEnv:t.apiKeyEnv,reasoningCapability:t.reasoningCapability,capabilityProfile:n,verifyStrategy:t.verifyStrategy};return t.reasoningProfile!==void 0&&(s.reasoningProfile=t.reasoningProfile),t.supportsThinking!==void 0&&(s.supportsThinking=t.supportsThinking),s}let r={model:t.model,apiKeyEnv:t.apiKeyEnv,reasoningCapability:t.reasoningCapability,capabilityProfile:n,verifyStrategy:t.verifyStrategy};return t.reasoningProfile!==void 0&&(r.reasoningProfile=t.reasoningProfile),t.models!==void 0&&(r.models=t.models),t.modelReasoningCapabilities!==void 0&&(r.modelReasoningCapabilities=t.modelReasoningCapabilities),t.contextWindow!==void 0&&(r.contextWindow=t.contextWindow),t.maxOutputTokens!==void 0&&(r.maxOutputTokens=t.maxOutputTokens),t.thinkingBudgetCap!==void 0&&(r.thinkingBudgetCap=t.thinkingBudgetCap),t.supportsThinking!==void 0&&(r.supportsThinking=t.supportsThinking),r}o(Bt,"buildSnapshot");function ke(){if(L)return L;let e=It(),t;try{let i=_t(e,"utf8");t=JSON.parse(i)}catch(i){let s=i instanceof Error?i.message:String(i);throw new Error(`provider-capabilities loader: failed to read ${e}: ${s}`)}let n=be(t),r={};for(let[i,s]of Object.entries(n.providers))r[i]=Ot(Bt(i,s));return L=Object.freeze(r),L}o(ke,"getProviderSnapshots");import Yr from"@anthropic-ai/sdk";var V=ke();var Ce=process.env.KODAX_PROVIDER??"zhipu-coding";export{Le as a,je as b,$e as c,Fe as d,Ue as e,qe as f,j as g,V as h};
|