@jini-ai/agent-runtime 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +103 -0
- package/README.md +34 -17
- package/dist/acp-model-probe.d.ts +6 -4
- package/dist/acp-model-probe.js +3 -3
- package/dist/agent-protocol/acp/account-failure.d.ts +4 -2
- package/dist/agent-protocol/acp/account-failure.js +1 -1
- package/dist/agent-protocol/acp/json.d.ts +6 -6
- package/dist/agent-protocol/acp/json.js +3 -3
- package/dist/agent-protocol/acp/models.d.ts +10 -5
- package/dist/agent-protocol/acp/models.js +32 -31
- package/dist/agent-protocol/acp/session-params.d.ts +3 -1
- package/dist/agent-protocol/acp/session-params.js +2 -1
- package/dist/agent-protocol/acp/session.d.ts +28 -22
- package/dist/agent-protocol/acp/session.js +181 -147
- package/dist/agent-protocol/acp/text-suppression.d.ts +1 -1
- package/dist/agent-protocol/acp/text-suppression.js +1 -1
- package/dist/agent-protocol/acp/types.d.ts +3 -2
- package/dist/agent-protocol/acp/updates.d.ts +11 -11
- package/dist/agent-protocol/acp/updates.js +2 -2
- package/dist/agent-protocol/core/json-line-stream.d.ts +24 -8
- package/dist/agent-protocol/core/json-line-stream.js +8 -8
- package/dist/agent-protocol/pi-rpc/events.d.ts +5 -1
- package/dist/agent-protocol/pi-rpc/events.js +36 -36
- package/dist/agent-protocol/pi-rpc/internal.d.ts +4 -1
- package/dist/agent-protocol/pi-rpc/models.d.ts +3 -1
- package/dist/agent-protocol/pi-rpc/models.js +1 -1
- package/dist/agent-protocol/pi-rpc/session.d.ts +1 -1
- package/dist/agent-protocol/pi-rpc/session.js +33 -32
- package/dist/amr-model-cache.d.ts +12 -4
- package/dist/amr-model-cache.js +17 -21
- package/dist/amr-profile-resolver.d.ts +3 -1
- package/dist/anthropic-live-models.js +0 -0
- package/dist/artifact-taxonomy.d.ts +6 -2
- package/dist/auth.d.ts +52 -15
- package/dist/auth.js +36 -36
- package/dist/claude-code-models.js +2 -2
- package/dist/claude-stream.d.ts +22 -3
- package/dist/claude-stream.js +24 -8
- package/dist/copilot-stream.d.ts +7 -3
- package/dist/copilot-stream.js +3 -3
- package/dist/defs/aider.d.ts +8 -1
- package/dist/defs/aider.js +2 -2
- package/dist/defs/amp.d.ts +8 -1
- package/dist/defs/amp.js +2 -2
- package/dist/defs/amr.d.ts +22 -6
- package/dist/defs/amr.js +23 -23
- package/dist/defs/antigravity.d.ts +15 -4
- package/dist/defs/antigravity.js +9 -8
- package/dist/defs/auggie.d.ts +4 -1
- package/dist/defs/auggie.js +1 -1
- package/dist/defs/claude.d.ts +16 -2
- package/dist/defs/claude.js +22 -4
- package/dist/defs/cline.d.ts +4 -1
- package/dist/defs/cline.js +1 -1
- package/dist/defs/codebuddy.d.ts +8 -1
- package/dist/defs/codebuddy.js +2 -2
- package/dist/defs/codex.d.ts +18 -4
- package/dist/defs/codex.js +7 -7
- package/dist/defs/copilot.d.ts +8 -1
- package/dist/defs/copilot.js +2 -2
- package/dist/defs/crush.d.ts +8 -1
- package/dist/defs/crush.js +1 -1
- package/dist/defs/cursor-agent.d.ts +14 -3
- package/dist/defs/cursor-agent.js +5 -5
- package/dist/defs/deepseek.d.ts +8 -1
- package/dist/defs/deepseek.js +2 -2
- package/dist/defs/devin.d.ts +12 -2
- package/dist/defs/devin.js +3 -3
- package/dist/defs/droid.d.ts +8 -1
- package/dist/defs/droid.js +1 -1
- package/dist/defs/gemini.d.ts +8 -1
- package/dist/defs/gemini.js +1 -1
- package/dist/defs/goose.d.ts +4 -1
- package/dist/defs/goose.js +1 -1
- package/dist/defs/grok-build.d.ts +11 -2
- package/dist/defs/grok-build.js +3 -3
- package/dist/defs/hermes.d.ts +4 -1
- package/dist/defs/hermes.js +2 -2
- package/dist/defs/kilo.d.ts +4 -1
- package/dist/defs/kilo.js +2 -2
- package/dist/defs/kimi.d.ts +4 -1
- package/dist/defs/kimi.js +2 -2
- package/dist/defs/kiro.d.ts +4 -1
- package/dist/defs/kiro.js +2 -2
- package/dist/defs/mimo.d.ts +8 -1
- package/dist/defs/mimo.js +2 -2
- package/dist/defs/opencode.d.ts +9 -2
- package/dist/defs/opencode.js +2 -2
- package/dist/defs/pi.d.ts +12 -2
- package/dist/defs/pi.js +9 -9
- package/dist/defs/qoder.d.ts +8 -1
- package/dist/defs/qoder.js +2 -2
- package/dist/defs/qwen.d.ts +8 -1
- package/dist/defs/qwen.js +2 -2
- package/dist/defs/reasonix.d.ts +4 -1
- package/dist/defs/reasonix.js +3 -3
- package/dist/defs/shared.d.ts +4 -2
- package/dist/defs/shared.js +2 -2
- package/dist/defs/trae-cli.d.ts +12 -2
- package/dist/defs/trae-cli.js +3 -3
- package/dist/defs/vibe.d.ts +4 -1
- package/dist/defs/vibe.js +2 -2
- package/dist/detection.d.ts +38 -3
- package/dist/detection.js +77 -37
- package/dist/diagnostics.d.ts +14 -3
- package/dist/diagnostics.js +5 -5
- package/dist/env.d.ts +16 -4
- package/dist/env.js +7 -7
- package/dist/executables.d.ts +24 -8
- package/dist/executables.js +13 -13
- package/dist/index.d.ts +228 -4
- package/dist/index.js +230 -6
- package/dist/invocation.d.ts +6 -1
- package/dist/invocation.js +2 -2
- package/dist/json-event-stream.d.ts +7 -2
- package/dist/json-event-stream.js +3 -3
- package/dist/launch.d.ts +12 -2
- package/dist/launch.js +3 -3
- package/dist/log-file.d.ts +4 -1
- package/dist/log-file.js +2 -2
- package/dist/mcp.d.ts +6 -3
- package/dist/mcp.js +1 -1
- package/dist/metadata.d.ts +7 -3
- package/dist/metadata.js +1 -1
- package/dist/mmd-routes.d.ts +22 -6
- package/dist/mmd-routes.js +14 -14
- package/dist/model-catalog-cache.d.ts +50 -0
- package/dist/model-catalog-cache.js +61 -0
- package/dist/model-loading-state.d.ts +10 -0
- package/dist/model-loading-state.js +23 -0
- package/dist/model-registry.d.ts +28 -7
- package/dist/model-registry.js +11 -8
- package/dist/models.d.ts +31 -6
- package/dist/models.js +6 -6
- package/dist/opencode-log.d.ts +12 -4
- package/dist/opencode-log.js +8 -8
- package/dist/paths.d.ts +6 -2
- package/dist/paths.js +3 -3
- package/dist/pi-models.d.ts +3 -1
- package/dist/pi-models.js +2 -2
- package/dist/prompt-budget.d.ts +17 -4
- package/dist/prompt-budget.js +3 -3
- package/dist/prompt-file.d.ts +5 -1
- package/dist/prompt-file.js +1 -1
- package/dist/providers/aihubmix.d.ts +34 -9
- package/dist/providers/aihubmix.js +26 -26
- package/dist/providers/anthropic-messages.d.ts +77 -20
- package/dist/providers/anthropic-messages.js +53 -50
- package/dist/providers/azure-chat.d.ts +21 -7
- package/dist/providers/azure-chat.js +18 -16
- package/dist/providers/connection-guard.d.ts +45 -31
- package/dist/providers/connection-guard.js +40 -143
- package/dist/providers/connection-test.d.ts +1 -1
- package/dist/providers/connection-test.js +13 -30
- package/dist/providers/elevenlabs.d.ts +7 -2
- package/dist/providers/elevenlabs.js +4 -4
- package/dist/providers/google-messages.d.ts +44 -10
- package/dist/providers/google-messages.js +36 -34
- package/dist/providers/google-schema.d.ts +26 -0
- package/dist/providers/google-schema.js +253 -0
- package/dist/providers/google.d.ts +21 -6
- package/dist/providers/google.js +10 -10
- package/dist/providers/index.d.ts +3 -2
- package/dist/providers/index.js +3 -2
- package/dist/providers/model-catalog.d.ts +1 -1
- package/dist/providers/model-catalog.js +14 -27
- package/dist/providers/oauth-callback-server.d.ts +1 -1
- package/dist/providers/oauth-callback-server.js +3 -2
- package/dist/providers/oauth-credentials.d.ts +7 -1
- package/dist/providers/oauth-credentials.js +5 -5
- package/dist/providers/oauth-provider.d.ts +2 -2
- package/dist/providers/oauth-provider.js +20 -25
- package/dist/providers/oauth-tokens.d.ts +26 -6
- package/dist/providers/oauth-tokens.js +9 -9
- package/dist/providers/ollama-chat.d.ts +66 -31
- package/dist/providers/ollama-chat.js +64 -61
- package/dist/providers/openai-chat.d.ts +77 -22
- package/dist/providers/openai-chat.js +71 -67
- package/dist/providers/pkce.d.ts +33 -20
- package/dist/providers/pkce.js +75 -146
- package/dist/providers/sse-decode.d.ts +3 -1
- package/dist/providers/sse-decode.js +1 -1
- package/dist/providers/token-params.d.ts +16 -5
- package/dist/providers/token-params.js +6 -6
- package/dist/providers/tool-turn-types.d.ts +89 -0
- package/dist/providers/tool-turn-types.js +2 -0
- package/dist/providers/tool-turn.d.ts +10 -0
- package/dist/providers/tool-turn.js +252 -0
- package/dist/qoder-stream.d.ts +7 -3
- package/dist/qoder-stream.js +3 -3
- package/dist/registry.d.ts +6 -2
- package/dist/registry.js +4 -4
- package/dist/resolution.d.ts +5 -1
- package/dist/resolution.js +3 -3
- package/dist/role-marker-guard.d.ts +9 -5
- package/dist/role-marker-guard.js +5 -5
- package/dist/terminal-launch.d.ts +6 -1
- package/dist/terminal-launch.js +2 -2
- package/dist/types.d.ts +37 -6
- package/package.json +43 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# @jini-ai/agent-runtime
|
|
2
|
+
|
|
3
|
+
## 0.4.0 — 2026-10-02
|
|
4
|
+
|
|
5
|
+
### BREAKING
|
|
6
|
+
|
|
7
|
+
- Use isolated provider and cache subpaths, including ./providers/sse-decode for browsers; core clock/redaction and canonical platform address classifiers replace local contracts. Unloaded bundled skill/craft documents are archived outside the package.
|
|
8
|
+
- Distribution includes runtime output, release documentation and required assets only. Process records and per-job neutrality checks are no longer part of the package surface.
|
|
9
|
+
|
|
10
|
+
## Unreleased
|
|
11
|
+
|
|
12
|
+
### Fixes
|
|
13
|
+
|
|
14
|
+
- Align parser parity and default-option fixtures with current argument objects and exact optional-property contracts. Preserve manifest fixture tuples and type Google continuation mocks with checked request bodies for strict indexed access.
|
|
15
|
+
- Omit the probe environment's absent proxy override so the existing system-proxy default remains active.
|
|
16
|
+
|
|
17
|
+
### BREAKING — canonical OAuth, redaction and network primitives
|
|
18
|
+
|
|
19
|
+
- Provider PKCE uses the main OAuth API, explicitly retaining 64-byte verifier entropy; normalized tokens are adapted to the existing persisted provider wire DTO. Main OAuth now guards/bounds fixed-issuer HTTP and returns typed errors; deriveCodeChallenge validates RFC verifiers.
|
|
20
|
+
- Remove runtime classifier/redactor exports and local implementations. Import hostname policies from `@jini-ai/platform/net` and `redactSecrets({ input }, { exactSecrets })` from core. Conservative masking keeps model/request identifiers and uses categorized markers; diagnostics never opt into opaque-run masking.
|
|
21
|
+
- Model catalog clocks use core `Clock.nowMs()`; ACP unknown-value records are named `UnknownRecord`, not JSON objects.
|
|
22
|
+
- Callback payload caches use the main bounded store while retaining exclusive TTL and unref timer behavior. Neutralize host-settings wording and host identity comments. Drop the conversion report from published files; the document remains for later relocation.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
- Preserve host environment customization after CLI housekeeping; correct the hook documentation.
|
|
26
|
+
- Keep DNS resolver injection required and reject lookup failures or empty answers instead of allowing unpinned fallback.
|
|
27
|
+
- Validate model catalogue variants with an explicit `TypeError` before trimming.
|
|
28
|
+
- Tag ACP failures before resume acknowledgement with `error.details.kind: 'resume_failed'`, preserving original codes and nesting original details under `cause`.
|
|
29
|
+
|
|
30
|
+
- Add `./providers/tool-turn` with injected provider adapters, normalized tool results and termination reasons, and Gemini schema adaptation. Existing provider loops and exports are preserved.
|
|
31
|
+
- Add `./model-catalog/cache` for instance-owned live discovery, TTL success/failure caching, tenant-safe key tuples, and injected clock/merge ports. Share the single-flight loader with the existing AMR cache.
|
|
32
|
+
- Complete the runtime subpaths (`./providers/tool-turn`, `./model-catalog/cache`, and `./providers/sse-decode`) with runtime metadata, declaration mappings, root barrel exports for turns/cache, and API documentation. The cache and SSE decoder can be imported independently in universal runtimes; the provider adapters and root require Node.
|
|
33
|
+
- Delegate provider PKCE and pending authorization primitives to `@jini-ai/oauth`, retaining provider contracts and wire formats.
|
|
34
|
+
- **BREAKING:** Convert existing public runtime/provider helpers, session factories, cache constructors and methods, runtime-definition callbacks, custom DNS/HTTP/event ports, and stream-feed methods to `(requiredArgs, optionalArgs)` objects. Required inputs are in the first object; optional controls are in the second. Update hosts and port implementations together using `API-CONVERSION-w7.md`. Existing export names and package version are retained; no positional compatibility adapters are provided. React props and upstream standard-library callable contracts are unchanged.
|
|
35
|
+
- **BREAKING:** `AcpModelProbe.detectModels` now separates required `{ bin, args }` from optional probe controls, matching `detectAcpModels` and its `probeAcpModels` alias. Custom probes must read environment, timeout, client identity and default model from the second object.
|
|
36
|
+
|
|
37
|
+
## 0.2.1
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Add top-level `main`/`types` fields alongside the existing `exports` map. A consumer on
|
|
42
|
+
TypeScript's classic `moduleResolution: "node"` (node10) — which ignores `package.json#exports`
|
|
43
|
+
entirely — could not resolve this package's types at all (`TS2307: Cannot find module`) even
|
|
44
|
+
after the previous exports-map fix restored `require()` at runtime; type resolution and runtime
|
|
45
|
+
resolution are separate algorithms. Verified against a real external consumer (whose
|
|
46
|
+
tsconfig uses this legacy resolution mode): adding these two fields, with its tsconfig completely
|
|
47
|
+
unchanged, made the error disappear. Also fixes absolute-path `require()` (distinct from a bare
|
|
48
|
+
specifier, which already worked) for the same reason — `main` was previously absent.
|
|
49
|
+
|
|
50
|
+
Purely additive: every modern resolver (Node's own runtime `exports` resolution, TypeScript's
|
|
51
|
+
`bundler`/`node16`/`nodenext`) prefers `exports` over `main`/`types` when both are present, so
|
|
52
|
+
this changes nothing for a consumer already on a modern resolver.
|
|
53
|
+
|
|
54
|
+
- Updated dependencies
|
|
55
|
+
- @jini-ai/platform@0.1.2
|
|
56
|
+
|
|
57
|
+
## 0.2.0
|
|
58
|
+
|
|
59
|
+
### Minor Changes
|
|
60
|
+
|
|
61
|
+
- Add a `"default"` export condition to every published package's `exports` map — every one of
|
|
62
|
+
them lacked it, which meant `require()` failed with `ERR_PACKAGE_PATH_NOT_EXPORTED` for any
|
|
63
|
+
CommonJS consumer (found via a real external integration attempt; Node needs `require(esm)`
|
|
64
|
+
support, i.e. Node >=22.12, for this to resolve).
|
|
65
|
+
|
|
66
|
+
`@jini-ai/agent-runtime`:
|
|
67
|
+
|
|
68
|
+
- **New**: `RuntimeBuildOptions.permissionMode` (`'bypass' | 'restricted'`) lets a caller opt a
|
|
69
|
+
run OUT of the auto-approve-every-permission-prompt flag every def with one
|
|
70
|
+
(`bypassPermissions` / `--yolo` / `--dangerously-skip-permissions`) previously pushed
|
|
71
|
+
unconditionally, with no way to turn it off. Omitting it keeps today's default (bypass)
|
|
72
|
+
behavior unchanged.
|
|
73
|
+
- **New**: `ClaudeStreamEvent`, `CopilotStreamEvent`, and `QoderEvent` are now real exported
|
|
74
|
+
discriminated unions instead of `Record<string, unknown>` — a real external consumer guessed a
|
|
75
|
+
nonexistent field name (`event.text` instead of the actual `event.delta`) against the old
|
|
76
|
+
untyped sink and silently lost every streamed token with no compile or runtime error.
|
|
77
|
+
- Fixed a doc/implementation mismatch in `claude-stream.ts`: the module doc claimed `tool_result`
|
|
78
|
+
events carry `{ tool_use_id, content, is_error }`; the actual emitted shape is
|
|
79
|
+
`{ toolUseId, content, isError }`.
|
|
80
|
+
|
|
81
|
+
`@jini-ai/daemon`: `AgentExecutorRunInput.permissionMode` forwards the new
|
|
82
|
+
`RuntimeBuildOptions.permissionMode` through to `buildArgs`, so a host can actually reach the new
|
|
83
|
+
opt-out from the daemon's real run-input surface, not just from `@jini-ai/agent-runtime` in
|
|
84
|
+
isolation.
|
|
85
|
+
|
|
86
|
+
`@jini-ai/agentic`: `setAtPointer` no longer throws on a malformed (e.g. missing leading `/`)
|
|
87
|
+
`updateDataModel` path — degrades to a no-op like its sibling `getAtPointer`, matching this
|
|
88
|
+
package's own "a bad binding must not crash the renderer" contract. That path is agent-authored
|
|
89
|
+
wire data with no error boundary above it in any host, so the uncaught throw could unmount an
|
|
90
|
+
entire chat UI from ~40 bytes of malformed input.
|
|
91
|
+
|
|
92
|
+
`@jini-ai/chat-react`: a local (client-resolved) A2UI button action is no longer a silent no-op —
|
|
93
|
+
`A2uiSurfaceCard` now surfaces the resolved value. New `ExtEventErrorBoundary` confines a
|
|
94
|
+
`kind: 'ext'` event group's renderer to its own card instead of letting a render/effect-phase
|
|
95
|
+
throw from agent-controlled content unmount the whole chat root (there was no error boundary
|
|
96
|
+
anywhere in this package or its hosts before this).
|
|
97
|
+
|
|
98
|
+
- 0d15314: Add a neutral Composer footer slot for host-owned controls, forward an optional host-selected model through every AgentExecutor runtime transport, expose daemon-owned live agent/model discovery with an explicit rescan route, and recognize Claude Code's partial-stream `message_delta` turn boundary so successful stream-json runs close cleanly.
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- Updated dependencies
|
|
103
|
+
- @jini-ai/platform@0.1.1
|
package/README.md
CHANGED
|
@@ -5,10 +5,10 @@ generation: brand-agnostic craft knowledge and portable skill packages
|
|
|
5
5
|
(both product-neutral per root `AGENTS.md`) plus a real TypeScript runtime
|
|
6
6
|
surface — the `runtimes/` -> agent-runtime adapter registry/detection/
|
|
7
7
|
launch/stream-parser port and the `agent-protocol/` ACP + pi-rpc subprocess
|
|
8
|
-
transport (see `src/index.ts`'s own header comment and
|
|
8
|
+
transport (see `src/index.ts`'s own header comment and the archived provenance ledger's
|
|
9
9
|
"Barrel merge" section for the full inventory), plus `src/model-registry.ts`
|
|
10
10
|
below. This top-level blurb has historically lagged that TS surface's
|
|
11
|
-
growth — treat `src/index.ts` and
|
|
11
|
+
growth — treat `src/index.ts` and the archived provenance ledger as the source of truth
|
|
12
12
|
for what's actually implemented.
|
|
13
13
|
|
|
14
14
|
## `src/model-registry.ts`
|
|
@@ -22,22 +22,39 @@ model-catalogue cache key, model-choice normalization against a live
|
|
|
22
22
|
catalogue) for any consumer building a "pick a model/agent" UI — e.g.
|
|
23
23
|
`@jini-ai/chat-react`'s `features/model-picker/` slice. Distinct from
|
|
24
24
|
`src/registry.ts` (the static `BASE_AGENT_DEFS` CLI-adapter catalog). See
|
|
25
|
-
|
|
25
|
+
the archived provenance ledger for full provenance.
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Archived craft and skill content
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
forms, RTL, anti-AI-slop, …) that a skill can opt into via a
|
|
31
|
-
`craft.requires` front-matter array. See `src/craft/README.md` for the
|
|
32
|
-
full mechanism and `source-map.md` for provenance.
|
|
29
|
+
The former craft rulebooks and portable skill documents are archived with the extraction records. No runtime loader or build asset-copy step reads them, so they are outside this package's distributable surface. Source execution code and provider/cache APIs remain described below.
|
|
33
30
|
|
|
34
|
-
##
|
|
31
|
+
## Runtime APIs and subpaths
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
Public functions, constructors, stream methods and custom ports use at most two
|
|
34
|
+
argument objects: required inputs first, optional controls second. Existing
|
|
35
|
+
names are retained, but positional callers must migrate together with their
|
|
36
|
+
port implementations. See [API.md](https://github.com/AINSEP/Jini/blob/main/packages/agent-runtime/API.md) for current examples and
|
|
37
|
+
[API.md](https://github.com/AINSEP/Jini/blob/main/packages/agent-runtime/API.md) for the current public contracts.
|
|
38
|
+
|
|
39
|
+
Omit optional properties to use their defaults; exact optional-property types
|
|
40
|
+
exclude explicitly assigned `undefined`. Model parsers accept `{ stdout }`.
|
|
41
|
+
|
|
42
|
+
| Import | Runtime | Surface |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| `@jini-ai/agent-runtime` | Node | CLI registry, launch/detection, protocols, providers, tool turns and caches |
|
|
45
|
+
| `@jini-ai/agent-runtime/providers/tool-turn` | Node | Provider-neutral tool turns, replaceable adapters, Gemini schema helpers |
|
|
46
|
+
| `@jini-ai/agent-runtime/model-catalog/cache` | Universal | Instance-owned discovery cache and model union |
|
|
47
|
+
| `@jini-ai/agent-runtime/providers/sse-decode` | Universal | Inbound SSE frame decoder over an async iterable |
|
|
48
|
+
|
|
49
|
+
Browser consumers import the universal subpaths directly. The package root and
|
|
50
|
+
provider adapters load Node modules. Provider PKCE adapters delegate protocol
|
|
51
|
+
operations to `@jini-ai/oauth`; the host still owns endpoint policy, credentials,
|
|
52
|
+
callback handling and persistence. None of these entries selects a site layout.
|
|
53
|
+
|
|
54
|
+
## Design decisions
|
|
55
|
+
|
|
56
|
+
- [Provider adapters preserve native continuation and tool events](docs/decisions/DR-001-provider-native-tool-lifecycle.md).
|
|
57
|
+
|
|
58
|
+
Provider network predicates now live in `@jini-ai/platform/net`; secret redaction lives in `@jini-ai/core` and takes `{ input }` with `{ exactSecrets }`. Runtime no longer re-exports those utilities. Core's conservative policy retains model/request identifiers and returns categorized redaction markers. Model catalog hosts pass core `Clock` (`nowMs()`); ACP transport values use `UnknownRecord` to avoid claiming validated JSON.
|
|
59
|
+
|
|
60
|
+
PKCE providers pass `{ verifierBytes: 64 }` to the main OAuth API. Fixed-issuer token operations use its URL guard, bounded parser, timeout, redirect refusal and typed errors; the runtime maps normalized tokens into its existing persisted provider DTO. Pending callbacks use the main storage factory with an explicit exclusive expiry option and an unref scheduler. The cache is bounded to the main 256-entry default. The conversion report remains in the repository for relocation and is excluded from package files.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* separate subsystem.
|
|
16
16
|
*
|
|
17
17
|
* So `detectAcpModels` becomes an injectable port: an `AcpModelProbe` with
|
|
18
|
-
* a single `detectModels(
|
|
18
|
+
* a single `detectModels(requiredArgs, optionalArgs)` method, matching the real call shape
|
|
19
19
|
* every ACP-based def literal already uses. The default implementation is
|
|
20
20
|
* a no-op that resolves to `[]`, which makes `detection.ts`'s `fetchModels`
|
|
21
21
|
* step treat the live-fetch as "returned nothing" and fall back to the
|
|
@@ -38,11 +38,13 @@ export interface AcpModelProbeRequest {
|
|
|
38
38
|
defaultModelOption?: RuntimeModelOption;
|
|
39
39
|
}
|
|
40
40
|
export interface AcpModelProbe {
|
|
41
|
-
detectModels(
|
|
41
|
+
detectModels(requiredArgs: Pick<AcpModelProbeRequest, 'bin' | 'args'>, optionalArgs?: Omit<AcpModelProbeRequest, 'bin' | 'args'>): Promise<RuntimeModelOption[]>;
|
|
42
42
|
}
|
|
43
43
|
export declare const noopAcpModelProbe: AcpModelProbe;
|
|
44
44
|
/** Install the real ACP transport (or a test double). Pass `null` to restore the no-op default. */
|
|
45
|
-
export declare function setAcpModelProbe(probe
|
|
45
|
+
export declare function setAcpModelProbe({ probe }: {
|
|
46
|
+
probe: AcpModelProbe | null;
|
|
47
|
+
}): void;
|
|
46
48
|
/** Drop-in replacement for OD's `detectAcpModels` — delegates to whatever probe is currently installed. */
|
|
47
|
-
export declare function detectAcpModels(
|
|
49
|
+
export declare function detectAcpModels(requiredArgs: Pick<AcpModelProbeRequest, "bin" | "args">, optionalArgs?: Omit<AcpModelProbeRequest, "bin" | "args">): Promise<RuntimeModelOption[]>;
|
|
48
50
|
//# sourceMappingURL=acp-model-probe.d.ts.map
|
package/dist/acp-model-probe.js
CHANGED
|
@@ -5,11 +5,11 @@ export const noopAcpModelProbe = {
|
|
|
5
5
|
};
|
|
6
6
|
let activeAcpModelProbe = noopAcpModelProbe;
|
|
7
7
|
/** Install the real ACP transport (or a test double). Pass `null` to restore the no-op default. */
|
|
8
|
-
export function setAcpModelProbe(probe) {
|
|
8
|
+
export function setAcpModelProbe({ probe }) {
|
|
9
9
|
activeAcpModelProbe = probe ?? noopAcpModelProbe;
|
|
10
10
|
}
|
|
11
11
|
/** Drop-in replacement for OD's `detectAcpModels` — delegates to whatever probe is currently installed. */
|
|
12
|
-
export async function detectAcpModels(
|
|
13
|
-
return activeAcpModelProbe.detectModels(
|
|
12
|
+
export async function detectAcpModels(requiredArgs, optionalArgs = {}) {
|
|
13
|
+
return activeAcpModelProbe.detectModels(requiredArgs, optionalArgs);
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=acp-model-probe.js.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* actionable error. OD's real implementation classifies vela/AMR-branded
|
|
5
5
|
* failure text against a hardcoded, product-branded recharge URL — that
|
|
6
6
|
* adapter is product-specific and must not live in this package (see
|
|
7
|
-
*
|
|
7
|
+
* archived provenance ledger for the full account of what was left behind and why).
|
|
8
8
|
* Callers inject their own `AccountFailureClassifier` through
|
|
9
9
|
* `AttachAcpSessionOptions.accountFailureClassifier`; the default
|
|
10
10
|
* `noopAccountFailureClassifier` always returns `null`, which reproduces the
|
|
@@ -32,7 +32,9 @@ export interface AccountFailure {
|
|
|
32
32
|
* `null` when the text does not match a known account-failure pattern.
|
|
33
33
|
*/
|
|
34
34
|
export interface AccountFailureClassifier {
|
|
35
|
-
classify(
|
|
35
|
+
classify(requiredArgs: {
|
|
36
|
+
text: string;
|
|
37
|
+
}): AccountFailure | null;
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
38
40
|
* Default no-op classifier used when a caller does not inject a real one.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* actionable error. OD's real implementation classifies vela/AMR-branded
|
|
5
5
|
* failure text against a hardcoded, product-branded recharge URL — that
|
|
6
6
|
* adapter is product-specific and must not live in this package (see
|
|
7
|
-
*
|
|
7
|
+
* archived provenance ledger for the full account of what was left behind and why).
|
|
8
8
|
* Callers inject their own `AccountFailureClassifier` through
|
|
9
9
|
* `AttachAcpSessionOptions.accountFailureClassifier`; the default
|
|
10
10
|
* `noopAccountFailureClassifier` always returns `null`, which reproduces the
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* performs no I/O; depends only on acp/types and acp/constants.
|
|
5
5
|
* Consumed by acp/rpc.ts, acp/session.ts, acp/models.ts, and acp/updates.ts.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { UnknownRecord } from './types.js';
|
|
8
8
|
/** Default environment variable name `resolveAcpTimeoutMs` reads when the
|
|
9
9
|
* caller does not supply its own. A host application with its own branded
|
|
10
10
|
* env var naming convention should pass its own name explicitly rather than
|
|
@@ -32,14 +32,14 @@ export declare function errorMessage(err: unknown): string;
|
|
|
32
32
|
*/
|
|
33
33
|
export declare function resolveAcpTimeoutMs(env: NodeJS.ProcessEnv, fallbackMs: number, envVarName?: string): number;
|
|
34
34
|
/**
|
|
35
|
-
* Coerces an unknown value to a `
|
|
35
|
+
* Coerces an unknown value to a `UnknownRecord` if it is a non-null, non-array
|
|
36
36
|
* plain object, or returns `null` otherwise. The primary guard used throughout
|
|
37
37
|
* the ACP layer before accessing named properties on parsed JSON frames.
|
|
38
38
|
*
|
|
39
39
|
* @param value - Any value from a JSON parse result.
|
|
40
|
-
* @returns The value cast as `
|
|
40
|
+
* @returns The value cast as `UnknownRecord`, or `null` when the cast is unsafe.
|
|
41
41
|
*/
|
|
42
|
-
export declare function asObject(value: unknown):
|
|
42
|
+
export declare function asObject(value: unknown): UnknownRecord | null;
|
|
43
43
|
/**
|
|
44
44
|
* Returns a short diagnostic string describing the JSON kind of `value`:
|
|
45
45
|
* `'array'`, `'null'`, or the result of `typeof`. Used to build
|
|
@@ -50,7 +50,7 @@ export declare function asObject(value: unknown): JsonObject | null;
|
|
|
50
50
|
export declare function acpValueKind(value: unknown): string;
|
|
51
51
|
/**
|
|
52
52
|
* Returns a sorted array of own string keys from `value` if it is a
|
|
53
|
-
* `
|
|
53
|
+
* `UnknownRecord`, or an empty array otherwise. Used to snapshot object
|
|
54
54
|
* structure for diagnostic payloads without risking a throw.
|
|
55
55
|
*
|
|
56
56
|
* @param value - Any value from a parsed ACP update object.
|
|
@@ -78,5 +78,5 @@ export declare function extractAcpTextValue(value: unknown, depth?: number): str
|
|
|
78
78
|
* @param update - A parsed ACP `session/update` params object.
|
|
79
79
|
* @returns The first non-empty text string, or `null` when none is present.
|
|
80
80
|
*/
|
|
81
|
-
export declare function extractAcpUpdateText(update:
|
|
81
|
+
export declare function extractAcpUpdateText(update: UnknownRecord): string | null;
|
|
82
82
|
//# sourceMappingURL=json.d.ts.map
|
|
@@ -33,12 +33,12 @@ export function resolveAcpTimeoutMs(env, fallbackMs, envVarName = DEFAULT_ACP_TI
|
|
|
33
33
|
return Math.min(MAX_TIMEOUT_MS, Math.max(0, Math.floor(raw)));
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* Coerces an unknown value to a `
|
|
36
|
+
* Coerces an unknown value to a `UnknownRecord` if it is a non-null, non-array
|
|
37
37
|
* plain object, or returns `null` otherwise. The primary guard used throughout
|
|
38
38
|
* the ACP layer before accessing named properties on parsed JSON frames.
|
|
39
39
|
*
|
|
40
40
|
* @param value - Any value from a JSON parse result.
|
|
41
|
-
* @returns The value cast as `
|
|
41
|
+
* @returns The value cast as `UnknownRecord`, or `null` when the cast is unsafe.
|
|
42
42
|
*/
|
|
43
43
|
export function asObject(value) {
|
|
44
44
|
return value && typeof value === 'object' ? value : null;
|
|
@@ -59,7 +59,7 @@ export function acpValueKind(value) {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Returns a sorted array of own string keys from `value` if it is a
|
|
62
|
-
* `
|
|
62
|
+
* `UnknownRecord`, or an empty array otherwise. Used to snapshot object
|
|
63
63
|
* structure for diagnostic payloads without risking a throw.
|
|
64
64
|
*
|
|
65
65
|
* @param value - Any value from a parsed ACP update object.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UnknownRecord } from './types.js';
|
|
2
2
|
/** A single model entry exposed to the daemon's model-selection UI and to `session/set_model` calls. */
|
|
3
3
|
export interface ModelOption {
|
|
4
4
|
id: string;
|
|
@@ -37,7 +37,7 @@ export declare function normalizeConfigOptionToken(value: unknown): string;
|
|
|
37
37
|
* @param option - A single item from the `configOptions` array.
|
|
38
38
|
* @param configId - The trimmed `id` field of that item.
|
|
39
39
|
*/
|
|
40
|
-
export declare function isModelConfigOption(option:
|
|
40
|
+
export declare function isModelConfigOption(option: UnknownRecord, configId: string): boolean;
|
|
41
41
|
/**
|
|
42
42
|
* Scans the `configOptions` array from an ACP `session/new` result and returns
|
|
43
43
|
* the first entry that passes `isModelConfigOption`. Returns `null` when no
|
|
@@ -72,7 +72,12 @@ export declare function normalizeModelConfigOptions(configOptions: unknown, defa
|
|
|
72
72
|
* @param configOptions - Optional `result.configOptions` for the config-option path.
|
|
73
73
|
* @returns A deduplicated array of `ModelOption` items.
|
|
74
74
|
*/
|
|
75
|
-
export declare function normalizeModels(models
|
|
75
|
+
export declare function normalizeModels({ models, defaultModelOption }: {
|
|
76
|
+
models: unknown;
|
|
77
|
+
defaultModelOption: ModelOption;
|
|
78
|
+
}, { configOptions }?: {
|
|
79
|
+
configOptions?: unknown;
|
|
80
|
+
}): ModelOption[];
|
|
76
81
|
/**
|
|
77
82
|
* Returns `true` for JSON-RPC error codes that indicate a model-selection
|
|
78
83
|
* failure from which the session can recover by falling back to the default
|
|
@@ -88,7 +93,7 @@ export declare function modelSelectionErrorIsRecoverable(code: unknown): boolean
|
|
|
88
93
|
*
|
|
89
94
|
* @param result - The parsed `result` object from a session handshake response.
|
|
90
95
|
*/
|
|
91
|
-
export declare function currentModelFromSessionResult(result:
|
|
96
|
+
export declare function currentModelFromSessionResult(result: UnknownRecord): string | null;
|
|
92
97
|
/**
|
|
93
98
|
* Probes a running ACP binary by spawning it, performing the
|
|
94
99
|
* `initialize` → `session/new` handshake, and reading the model list from the
|
|
@@ -108,5 +113,5 @@ export declare function currentModelFromSessionResult(result: JsonObject): strin
|
|
|
108
113
|
* @param options.defaultModelOption - Fallback option prepended to the result list.
|
|
109
114
|
* @returns A promise resolving to the available `ModelOption[]`.
|
|
110
115
|
*/
|
|
111
|
-
export declare function detectAcpModels(
|
|
116
|
+
export declare function detectAcpModels(requiredArgs: Pick<DetectAcpModelsOptions, "bin" | "args">, optionalArgs?: Omit<DetectAcpModelsOptions, "bin" | "args">): Promise<ModelOption[]>;
|
|
112
117
|
//# sourceMappingURL=models.d.ts.map
|
|
@@ -123,7 +123,7 @@ export function normalizeModelConfigOptions(configOptions, defaultModelOption) {
|
|
|
123
123
|
* @param configOptions - Optional `result.configOptions` for the config-option path.
|
|
124
124
|
* @returns A deduplicated array of `ModelOption` items.
|
|
125
125
|
*/
|
|
126
|
-
export function normalizeModels(models, defaultModelOption, configOptions) {
|
|
126
|
+
export function normalizeModels({ models, defaultModelOption }, { configOptions } = {}) {
|
|
127
127
|
const configModels = normalizeModelConfigOptions(configOptions, defaultModelOption);
|
|
128
128
|
if (configModels && configModels.models.length > 1) {
|
|
129
129
|
return configModels.models;
|
|
@@ -190,7 +190,8 @@ export function currentModelFromSessionResult(result) {
|
|
|
190
190
|
* @param options.defaultModelOption - Fallback option prepended to the result list.
|
|
191
191
|
* @returns A promise resolving to the available `ModelOption[]`.
|
|
192
192
|
*/
|
|
193
|
-
export async function detectAcpModels(
|
|
193
|
+
export async function detectAcpModels(requiredArgs, optionalArgs = {}) {
|
|
194
|
+
const { bin, args, cwd = process.cwd(), env = process.env, timeoutMs = DEFAULT_TIMEOUT_MS, clientName = 'agent-runtime-detect', clientVersion = 'runtime-adapter', defaultModelOption = { id: 'default', label: 'Default (CLI config)' }, } = { ...optionalArgs, ...requiredArgs };
|
|
194
195
|
const effectiveTimeoutMs = resolveAcpTimeoutMs(env, timeoutMs);
|
|
195
196
|
return await new Promise((resolve, reject) => {
|
|
196
197
|
const child = spawn(bin, args, {
|
|
@@ -232,38 +233,38 @@ export async function detectAcpModels({ bin, args, cwd = process.cwd(), env = pr
|
|
|
232
233
|
};
|
|
233
234
|
const sendSessionNew = () => {
|
|
234
235
|
expectedId = nextId;
|
|
235
|
-
writeRpc(nextId, 'session/new', buildAcpSessionNewParams(cwd));
|
|
236
|
+
writeRpc(nextId, 'session/new', buildAcpSessionNewParams({ cwd: cwd }));
|
|
236
237
|
nextId += 1;
|
|
237
238
|
};
|
|
238
|
-
const parser = createJsonLineStream((raw) => {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
239
|
+
const parser = createJsonLineStream({ onMessage: ({ message: raw }) => {
|
|
240
|
+
const obj = asObject(raw);
|
|
241
|
+
const error = asObject(obj?.error);
|
|
242
|
+
const result = asObject(obj?.result);
|
|
243
|
+
const rpcErr = rpcErrorMessage(raw);
|
|
244
|
+
if (rpcErr) {
|
|
245
|
+
// JSON-RPC -32603 "Internal error" during model detection:
|
|
246
|
+
// If this is for the current expected-id (initialize/session/new),
|
|
247
|
+
// it's a real probe failure — reject immediately.
|
|
248
|
+
// Otherwise it's cleanup noise — suppress it.
|
|
249
|
+
if (error?.code === -32603 && obj?.id !== expectedId)
|
|
250
|
+
return;
|
|
251
|
+
fail(rpcErr);
|
|
249
252
|
return;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
});
|
|
266
|
-
child.stdout.on('data', (chunk) => parser.feed(chunk));
|
|
253
|
+
}
|
|
254
|
+
if (obj?.id !== expectedId || !result)
|
|
255
|
+
return;
|
|
256
|
+
if (expectedId === 1) {
|
|
257
|
+
sendSessionNew();
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (expectedId === 2) {
|
|
261
|
+
const models = normalizeModels({ models: result.models, defaultModelOption: defaultModelOption }, { configOptions: result.configOptions });
|
|
262
|
+
finish(resolve, models);
|
|
263
|
+
if (!child.killed)
|
|
264
|
+
child.kill('SIGTERM');
|
|
265
|
+
}
|
|
266
|
+
} });
|
|
267
|
+
child.stdout.on('data', (chunk) => parser.feed({ chunk: chunk }));
|
|
267
268
|
child.stdout.on('close', () => parser.flush());
|
|
268
269
|
child.stdin.on('error', (err) => fail(`stdin error: ${err.message}`));
|
|
269
270
|
child.stderr.on('data', (chunk) => {
|
|
@@ -31,7 +31,9 @@ export interface AcpSessionOptions {
|
|
|
31
31
|
* @param options - Optional MCP server list and env-format selector.
|
|
32
32
|
* @returns The `session/new` params object ready for JSON-RPC serialisation.
|
|
33
33
|
*/
|
|
34
|
-
export declare function buildAcpSessionNewParams(
|
|
34
|
+
export declare function buildAcpSessionNewParams({ cwd }: {
|
|
35
|
+
cwd: string;
|
|
36
|
+
}, options?: AcpSessionOptions): {
|
|
35
37
|
cwd: string;
|
|
36
38
|
mcpServers: {
|
|
37
39
|
type: string;
|
|
@@ -18,7 +18,8 @@ import path from 'node:path';
|
|
|
18
18
|
* @param options - Optional MCP server list and env-format selector.
|
|
19
19
|
* @returns The `session/new` params object ready for JSON-RPC serialisation.
|
|
20
20
|
*/
|
|
21
|
-
export function buildAcpSessionNewParams(cwd
|
|
21
|
+
export function buildAcpSessionNewParams({ cwd }, options = {}) {
|
|
22
|
+
const { mcpServers, envFormat = 'array' } = options;
|
|
22
23
|
const servers = Array.isArray(mcpServers) ? mcpServers : [];
|
|
23
24
|
const wantsMap = envFormat === 'map';
|
|
24
25
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExecutionProfile } from './types.js';
|
|
2
2
|
import { type ArtifactTextSuppressor } from './text-suppression.js';
|
|
3
|
-
import type { JsonRpcId,
|
|
3
|
+
import type { JsonRpcId, UnknownRecord, AcpChildProcess } from './types.js';
|
|
4
4
|
import { type AcpMcpServerInput } from './session-params.js';
|
|
5
5
|
import { type AccountFailureClassifier } from './account-failure.js';
|
|
6
6
|
/** One option offered by an ACP agent for a pending tool permission request. */
|
|
@@ -19,10 +19,10 @@ export interface AcpPermissionOption {
|
|
|
19
19
|
export interface AcpPermissionRequest {
|
|
20
20
|
readonly requestId: JsonRpcId;
|
|
21
21
|
readonly sessionId: string | null;
|
|
22
|
-
readonly toolCall:
|
|
22
|
+
readonly toolCall: UnknownRecord | null;
|
|
23
23
|
readonly options: readonly AcpPermissionOption[];
|
|
24
24
|
/** Original ACP request parameters for forward-compatible audit storage. */
|
|
25
|
-
readonly rawParams:
|
|
25
|
+
readonly rawParams: UnknownRecord;
|
|
26
26
|
}
|
|
27
27
|
/** A host's response to an {@link AcpPermissionRequest}. */
|
|
28
28
|
export type AcpPermissionDecision = {
|
|
@@ -55,7 +55,10 @@ export interface AttachAcpSessionOptions {
|
|
|
55
55
|
imagePaths?: string[];
|
|
56
56
|
mcpServers?: AcpMcpServerInput[];
|
|
57
57
|
envFormat?: 'array' | 'map';
|
|
58
|
-
send: (
|
|
58
|
+
send: (requiredArgs: {
|
|
59
|
+
event: string;
|
|
60
|
+
payload: unknown;
|
|
61
|
+
}) => void;
|
|
59
62
|
/**
|
|
60
63
|
* Receives every native ACP tool-permission request before the agent can
|
|
61
64
|
* execute it. Omit it only when the host intends the session to fail closed
|
|
@@ -113,7 +116,10 @@ export declare function createAcpSessionState(): AcpSessionState;
|
|
|
113
116
|
* construct a fake one with `vi.fn()` stubs for the callbacks.
|
|
114
117
|
*/
|
|
115
118
|
export interface AcpSessionEffects {
|
|
116
|
-
send: (
|
|
119
|
+
send: (requiredArgs: {
|
|
120
|
+
event: string;
|
|
121
|
+
payload: unknown;
|
|
122
|
+
}) => void;
|
|
117
123
|
fail: (message: string, options?: {
|
|
118
124
|
forceModelUnavailable?: boolean;
|
|
119
125
|
details?: unknown;
|
|
@@ -127,7 +133,7 @@ export interface AcpSessionEffects {
|
|
|
127
133
|
emitVisibleTextDelta: (delta: string) => void;
|
|
128
134
|
noteArtifactTextSuppression: (reason: string) => void;
|
|
129
135
|
noteToolCallTextSuppression: (reason: string) => void;
|
|
130
|
-
emitAcpRawShapeDiagnostic: (update:
|
|
136
|
+
emitAcpRawShapeDiagnostic: (update: UnknownRecord) => void;
|
|
131
137
|
toolCallTextSuppressor: ArtifactTextSuppressor;
|
|
132
138
|
runStartedAt: number;
|
|
133
139
|
modelUnavailableErrorCode?: 'AMR_MODEL_UNAVAILABLE' | undefined;
|
|
@@ -149,20 +155,20 @@ export interface AcpSessionEffects {
|
|
|
149
155
|
export declare function handleRpcError({ state, effects, obj, error, rpcErr, }: {
|
|
150
156
|
state: AcpSessionState;
|
|
151
157
|
effects: AcpSessionEffects;
|
|
152
|
-
obj:
|
|
153
|
-
error:
|
|
158
|
+
obj: UnknownRecord;
|
|
159
|
+
error: UnknownRecord | null;
|
|
154
160
|
rpcErr: string;
|
|
155
161
|
}): void;
|
|
156
162
|
/** Promotes an AMR retry-status `session/update` into a structured account-failure error, if the classifier matches. Returns `true` when it did (and thus failed the session). */
|
|
157
163
|
export declare function tryPromoteAmrRetryStatus({ effects, update, }: {
|
|
158
164
|
effects: AcpSessionEffects;
|
|
159
|
-
update:
|
|
165
|
+
update: UnknownRecord;
|
|
160
166
|
}): boolean;
|
|
161
167
|
/** Translates an `agent_thought_chunk` update into `thinking_start` (once) / `thinking_delta` events. */
|
|
162
168
|
export declare function handleThoughtChunkUpdate({ state, effects, update, }: {
|
|
163
169
|
state: AcpSessionState;
|
|
164
170
|
effects: AcpSessionEffects;
|
|
165
|
-
update:
|
|
171
|
+
update: UnknownRecord;
|
|
166
172
|
}): void;
|
|
167
173
|
/** Strips tool-call XML from a raw message delta via the session's tool-call text suppressor, noting the suppression reason. */
|
|
168
174
|
export declare function stripToolCallText({ effects, delta }: {
|
|
@@ -208,31 +214,31 @@ export declare function applyDsmlArtifactSuppression({ state, effects, suppresso
|
|
|
208
214
|
export declare function handleMessageChunkUpdate({ state, effects, update, }: {
|
|
209
215
|
state: AcpSessionState;
|
|
210
216
|
effects: AcpSessionEffects;
|
|
211
|
-
update:
|
|
217
|
+
update: UnknownRecord;
|
|
212
218
|
}): void;
|
|
213
219
|
export declare function mirrorArtifactWriteToolEvent({ state, effects, update, toolCallId, }: {
|
|
214
220
|
state: AcpSessionState;
|
|
215
221
|
effects: AcpSessionEffects;
|
|
216
|
-
update:
|
|
222
|
+
update: UnknownRecord;
|
|
217
223
|
toolCallId: string | null;
|
|
218
224
|
}): void;
|
|
219
225
|
/** Arms the DSML artifact suppressor when a tool_call/tool_call_update completes an artifact write, or disarms it once its owning write call terminally fails. */
|
|
220
226
|
export declare function updateDsmlSuppressorForToolCall({ state, update, toolCallId, }: {
|
|
221
227
|
state: AcpSessionState;
|
|
222
|
-
update:
|
|
228
|
+
update: UnknownRecord;
|
|
223
229
|
toolCallId: string | null;
|
|
224
230
|
}): void;
|
|
225
231
|
/** Translates a `tool_call` / `tool_call_update` update: tracks it as real turn output, mirrors artifact writes, and manages DSML suppressor arming. */
|
|
226
232
|
export declare function handleToolCallUpdate({ state, effects, update, }: {
|
|
227
233
|
state: AcpSessionState;
|
|
228
234
|
effects: AcpSessionEffects;
|
|
229
|
-
update:
|
|
235
|
+
update: UnknownRecord;
|
|
230
236
|
}): void;
|
|
231
237
|
/** Top-level `session/update` dispatcher: emits a generic status for non-streaming update kinds, then routes to the matching per-kind handler. */
|
|
232
238
|
export declare function handleSessionUpdate({ state, effects, update, }: {
|
|
233
239
|
state: AcpSessionState;
|
|
234
240
|
effects: AcpSessionEffects;
|
|
235
|
-
update:
|
|
241
|
+
update: UnknownRecord;
|
|
236
242
|
}): void;
|
|
237
243
|
/** Handles the `initialize` ack: sends `session/load` (resume) or `session/new` (fresh). */
|
|
238
244
|
export declare function handleInitializeAck({ state, effects }: {
|
|
@@ -248,33 +254,33 @@ export declare function triggerSetModelIfNeeded({ state, effects, }: {
|
|
|
248
254
|
export declare function handleSessionNewAck({ state, effects, result, rawLine, }: {
|
|
249
255
|
state: AcpSessionState;
|
|
250
256
|
effects: AcpSessionEffects;
|
|
251
|
-
result:
|
|
257
|
+
result: UnknownRecord;
|
|
252
258
|
rawLine: string;
|
|
253
259
|
}): void;
|
|
254
260
|
/** Handles the `session/prompt` ack: fails a turn that reported model activity but produced no visible output, otherwise flushes and finishes cleanly. */
|
|
255
261
|
export declare function handlePromptResult({ state, effects, result, }: {
|
|
256
262
|
state: AcpSessionState;
|
|
257
263
|
effects: AcpSessionEffects;
|
|
258
|
-
result:
|
|
264
|
+
result: UnknownRecord;
|
|
259
265
|
}): void;
|
|
260
266
|
/** Whether an incoming result frame is the ack for an in-flight `session/set_model` (or `set_config_option`) request. */
|
|
261
267
|
export declare function isModelSetAckExpected({ state, effects, obj, }: {
|
|
262
268
|
state: AcpSessionState;
|
|
263
269
|
effects: AcpSessionEffects;
|
|
264
|
-
obj:
|
|
270
|
+
obj: UnknownRecord;
|
|
265
271
|
}): boolean;
|
|
266
272
|
/** Handles the `session/set_model` (or `set_config_option`) ack: records the confirmed model and sends the prompt. */
|
|
267
273
|
export declare function handleModelSetAck({ state, effects, result, }: {
|
|
268
274
|
state: AcpSessionState;
|
|
269
275
|
effects: AcpSessionEffects;
|
|
270
|
-
result:
|
|
276
|
+
result: UnknownRecord;
|
|
271
277
|
}): void;
|
|
272
278
|
/** Top-level JSON-RPC result dispatcher, keyed by which request `expectedId`/`promptRequestId` is currently outstanding. */
|
|
273
279
|
export declare function routeResultById({ state, effects, obj, result, rawLine, }: {
|
|
274
280
|
state: AcpSessionState;
|
|
275
281
|
effects: AcpSessionEffects;
|
|
276
|
-
obj:
|
|
277
|
-
result:
|
|
282
|
+
obj: UnknownRecord;
|
|
283
|
+
result: UnknownRecord | null;
|
|
278
284
|
rawLine: string;
|
|
279
285
|
}): void;
|
|
280
286
|
/**
|
|
@@ -302,5 +308,5 @@ export declare function routeResultById({ state, effects, obj, result, rawLine,
|
|
|
302
308
|
* @returns A controller with `hasFatalError`, `getDurableSessionId`,
|
|
303
309
|
* `completedSuccessfully`, and `abort` methods.
|
|
304
310
|
*/
|
|
305
|
-
export declare function attachAcpSession(
|
|
311
|
+
export declare function attachAcpSession(requiredArgs: Pick<AttachAcpSessionOptions, "child" | "prompt" | "send">, optionalArgs?: Omit<AttachAcpSessionOptions, "child" | "prompt" | "send">): AcpSessionController;
|
|
306
312
|
//# sourceMappingURL=session.d.ts.map
|