@tangle-network/agent-provider-cli-bridge 1.1.1 → 1.1.3
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/dist/retained-execution.js +7 -3
- package/dist/retained-run-state.js +1 -1
- package/dist/wire.d.ts +0 -1
- package/dist/wire.js +0 -7
- package/package.json +2 -2
|
@@ -33,6 +33,7 @@ export async function* streamTrackedCliBridgeTurn(options, environmentInput, pro
|
|
|
33
33
|
let admitted = false;
|
|
34
34
|
let admissionValidated = false;
|
|
35
35
|
try {
|
|
36
|
+
await confirmCliBridgeContextTransfer(options, originalTurn, run, signal);
|
|
36
37
|
if (useNativeInteractions) {
|
|
37
38
|
await beginCliBridgeNativeTurn(options, providerName, environmentInput, turn, run, transport, nativeSessions, signal, () => {
|
|
38
39
|
admitted = true;
|
|
@@ -51,7 +52,6 @@ export async function* streamTrackedCliBridgeTurn(options, environmentInput, pro
|
|
|
51
52
|
yield event;
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
await confirmCliBridgeContextTransfer(options, originalTurn, run, signal);
|
|
55
55
|
drained = true;
|
|
56
56
|
if (runs.get(run.id) === run)
|
|
57
57
|
runs.delete(run.id);
|
|
@@ -112,6 +112,7 @@ export async function dispatchCliBridgeTurn(options, environmentInput, prepared,
|
|
|
112
112
|
let accepted = false;
|
|
113
113
|
let responseBody;
|
|
114
114
|
try {
|
|
115
|
+
await confirmCliBridgeContextTransfer(options, prepared.turn, run, signal);
|
|
115
116
|
if (useNativeInteractions) {
|
|
116
117
|
await beginCliBridgeNativeTurn(options, providerName, environmentInput, prepared.turn, run, transport, nativeSessions, signal, () => {
|
|
117
118
|
accepted = true;
|
|
@@ -146,7 +147,6 @@ export async function dispatchCliBridgeTurn(options, environmentInput, prepared,
|
|
|
146
147
|
}
|
|
147
148
|
const controlRef = exactControlRefForRun(run, providerName);
|
|
148
149
|
run.controlRef = controlRef;
|
|
149
|
-
await confirmCliBridgeContextTransfer(options, prepared.turn, run, signal);
|
|
150
150
|
if (responseBody) {
|
|
151
151
|
await detachCliBridgeReader(responseBody);
|
|
152
152
|
responseBody = undefined;
|
|
@@ -202,7 +202,11 @@ async function confirmCliBridgeContextTransfer(options, turn, run, signal) {
|
|
|
202
202
|
const transfer = await lookupCliBridgeContext(options, turn.contextTransfer, signal);
|
|
203
203
|
if (transfer === undefined ||
|
|
204
204
|
(transfer.status !== "accepted" && transfer.status !== "replayed")) {
|
|
205
|
-
throw new
|
|
205
|
+
throw new CliBridgeRequestRejectedError(409, "cli-bridge did not confirm admitted portable context");
|
|
206
|
+
}
|
|
207
|
+
if (transfer.environmentId !== run.environmentId || transfer.sessionId !== run.sessionId ||
|
|
208
|
+
transfer.runId !== run.id || transfer.executionId !== run.executionId) {
|
|
209
|
+
throw new CliBridgeRequestRejectedError(409, "cli-bridge portable context belongs to another environment or run");
|
|
206
210
|
}
|
|
207
211
|
run.contextTransferReceipt = transfer;
|
|
208
212
|
}
|
|
@@ -83,7 +83,7 @@ export function prepareCliBridgeRun(options, environmentInput, originalTurn, pro
|
|
|
83
83
|
const executionId = validatedTurn.executionId ?? destination?.executionId ?? runId;
|
|
84
84
|
if (destination !== undefined &&
|
|
85
85
|
(destination.provider !== providerName ||
|
|
86
|
-
destination.environmentId !== environmentId ||
|
|
86
|
+
(destination.environmentId !== undefined && destination.environmentId !== environmentId) ||
|
|
87
87
|
destination.sessionId !== sessionId ||
|
|
88
88
|
destination.executionId !== executionId)) {
|
|
89
89
|
throw new Error("cli-bridge context transfer targets another destination");
|
package/dist/wire.d.ts
CHANGED
|
@@ -37,4 +37,3 @@ export declare function modelRequestCount(value: unknown): number | undefined;
|
|
|
37
37
|
export declare function cliBridgeRunId(environmentId: string, turn: AgentTurnInput, turnId: string): string;
|
|
38
38
|
export declare function assertCliBridgeRunId(value: string): string;
|
|
39
39
|
export declare function runSnapshot(value: string): CliBridgeRunSnapshot;
|
|
40
|
-
export declare function cancelSnapshot(value: string): CliBridgeRunSnapshot;
|
package/dist/wire.js
CHANGED
|
@@ -378,10 +378,3 @@ export function runSnapshot(value) {
|
|
|
378
378
|
terminal,
|
|
379
379
|
};
|
|
380
380
|
}
|
|
381
|
-
export function cancelSnapshot(value) {
|
|
382
|
-
const parsed = safeJson(value);
|
|
383
|
-
if (!parsed || !parsed.run || typeof parsed.run !== "object") {
|
|
384
|
-
throw new Error("cli-bridge cancel returned an invalid snapshot");
|
|
385
|
-
}
|
|
386
|
-
return runSnapshot(JSON.stringify(parsed.run));
|
|
387
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-provider-cli-bridge",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "AgentEnvironmentProvider adapter for cli-bridge retained sessions and one-shot turns",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"LICENSE"
|
|
65
65
|
],
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@tangle-network/agent-interface": "^
|
|
67
|
+
"@tangle-network/agent-interface": "^4.0.0",
|
|
68
68
|
"undici": "8.11.2"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|