@tangle-network/agent-provider-cli-bridge 0.5.0 → 0.6.1
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/README.md +8 -0
- package/dist/index.d.ts +5 -27
- package/dist/index.js +38 -998
- package/dist/provider-options.d.ts +26 -0
- package/dist/provider-options.js +10 -0
- package/dist/retained-control.d.ts +11 -0
- package/dist/retained-control.js +170 -0
- package/dist/retained-environment.d.ts +11 -0
- package/dist/retained-environment.js +189 -0
- package/dist/retained-event-cursor.d.ts +18 -0
- package/dist/retained-event-cursor.js +68 -0
- package/dist/retained-execution.d.ts +12 -0
- package/dist/retained-execution.js +304 -0
- package/dist/retained-run-state.d.ts +38 -0
- package/dist/retained-run-state.js +97 -0
- package/dist/retained-stream.d.ts +8 -0
- package/dist/retained-stream.js +276 -0
- package/dist/transport.d.ts +23 -0
- package/dist/transport.js +32 -0
- package/dist/wire.d.ts +27 -0
- package/dist/wire.js +243 -0
- package/package.json +21 -3
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ const reference = await environment.dispatch({
|
|
|
23
23
|
sessionId: 'research-session',
|
|
24
24
|
executionId: 'research-turn-1',
|
|
25
25
|
})
|
|
26
|
+
await saveControlRef(reference.controlRef)
|
|
26
27
|
const session = environment.session(reference.id)
|
|
27
28
|
|
|
28
29
|
for await (const event of session.events({ since: '0' })) {
|
|
@@ -35,6 +36,11 @@ await session.prompt({
|
|
|
35
36
|
})
|
|
36
37
|
```
|
|
37
38
|
|
|
39
|
+
Persist the returned `controlRef` before treating dispatch as accepted.
|
|
40
|
+
It contains the exact provider, environment, session, execution, run, and request digest needed after a process restart.
|
|
41
|
+
Reconstruct the environment with `provider.get(controlRef.environmentId)`, then call `environment.session(controlRef.sessionId, { controlRef })`.
|
|
42
|
+
The provider rejects any coordinate or digest mismatch instead of attaching to a different run.
|
|
43
|
+
|
|
38
44
|
The bridge model is selected from run data in this order: the turn, the provider default, or the profile's `harness` plus `model.default`.
|
|
39
45
|
Execution fails before network use when none is present.
|
|
40
46
|
|
|
@@ -43,6 +49,8 @@ Passing the same `sessionId` on later turns continues the same CLI conversation.
|
|
|
43
49
|
`dispatch()` starts a bridge-owned durable run and returns after detaching its HTTP reader.
|
|
44
50
|
The returned `AgentSession` exposes status, cursor-based event replay, the terminal result, continuation, and cancellation.
|
|
45
51
|
Cancellation returns only after cli-bridge confirms the run is terminal.
|
|
52
|
+
Usage events and terminal result metadata include `modelRequests` only when the bridge measured an exact non-negative integer count.
|
|
53
|
+
Missing, malformed, partial, or estimated request counts remain unknown.
|
|
46
54
|
When `dispatch()` receives no `sessionId`, it creates one from that turn's stable run id and returns it.
|
|
47
55
|
Replay and result reads fail loudly after cli-bridge's configured replay retention expires.
|
|
48
56
|
Stopping a `session.events()` reader detaches only that replay observer.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
import type { AgentEnvironmentCapabilities, AgentEnvironmentProvider } from "@tangle-network/agent-interface/environment-provider";
|
|
2
2
|
import { type HarnessType } from "@tangle-network/agent-interface";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
bearerToken?: string;
|
|
6
|
-
defaultModel?: string;
|
|
7
|
-
defaultMode?: "byob" | "hosted-safe" | "hosted-sandboxed";
|
|
8
|
-
defaultExecution?: {
|
|
9
|
-
kind: "host";
|
|
10
|
-
} | {
|
|
11
|
-
kind: "sandbox";
|
|
12
|
-
repoUrl?: string;
|
|
13
|
-
gitRef?: string;
|
|
14
|
-
capability?: string;
|
|
15
|
-
ttlSeconds?: number;
|
|
16
|
-
};
|
|
17
|
-
/** Maximum wait for response headers. Defaults to no timeout. */
|
|
18
|
-
headersTimeoutMs?: number;
|
|
19
|
-
/** Maximum idle time between response body chunks. Defaults to no timeout. */
|
|
20
|
-
bodyTimeoutMs?: number;
|
|
21
|
-
/** Maximum wait for cli-bridge to confirm cancellation. Defaults to 30 seconds. */
|
|
22
|
-
cancelWaitMs?: number;
|
|
23
|
-
fetch?: typeof fetch;
|
|
24
|
-
name?: string;
|
|
25
|
-
capabilities?: AgentEnvironmentCapabilities;
|
|
26
|
-
}
|
|
3
|
+
import { type CliBridgeProviderOptions } from "./provider-options.js";
|
|
4
|
+
export type { CliBridgeProviderOptions } from "./provider-options.js";
|
|
27
5
|
export declare function createCliBridgeProvider(options: CliBridgeProviderOptions): AgentEnvironmentProvider;
|
|
28
6
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
7
|
+
* Describe the bridge backend, not this adapter.
|
|
8
|
+
*
|
|
9
|
+
* The adapter forwards an AgentProfile but does not own harness prompt controls.
|
|
32
10
|
*/
|
|
33
11
|
export declare function defaultCliBridgeCapabilities(harness?: HarnessType): AgentEnvironmentCapabilities;
|