@tangle-network/agent-provider-tangle 4.5.2 → 4.5.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/README.md +4 -0
- package/dist/tangle-environment-dispatch.js +16 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -41,6 +41,10 @@ Use the typed field for large profiles; generic provider metadata keeps its exis
|
|
|
41
41
|
|
|
42
42
|
Exact execution replay preserves the admitted request and its digest.
|
|
43
43
|
An explicit replay override cannot replace the selected account, credential channel, or harness.
|
|
44
|
+
Before dispatch admission, replay the original `create` and turn with their original idempotency keys.
|
|
45
|
+
Native-capture `get()` requires an already selected backend; it is not the entrypoint for an intent whose first dispatch was refused.
|
|
46
|
+
A backend 404 alone does not prove that a prior execution ran nothing or authorize replacing it under new keys.
|
|
47
|
+
When an older SDK's reuse receipt omits the exact control reference, the adapter reads the session's authoritative status and validates its echoed reference against the original session, execution, environment and request digest. Missing or conflicting authority still refuses recovery.
|
|
44
48
|
|
|
45
49
|
## Workspace file reads
|
|
46
50
|
|
|
@@ -15,13 +15,10 @@ export function dispatchEnvironmentRun(box, provider, environmentId) {
|
|
|
15
15
|
callerControlRef.environmentId !== environmentId) {
|
|
16
16
|
throw new Error("Tangle control reference does not match this environment");
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
input
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (input.executionId !== undefined &&
|
|
23
|
-
input.executionId !== callerControlRef.executionId) {
|
|
24
|
-
throw new Error("Tangle executionId conflicts with the control reference");
|
|
18
|
+
for (const field of ["sessionId", "executionId"]) {
|
|
19
|
+
if (input[field] !== undefined && input[field] !== callerControlRef[field]) {
|
|
20
|
+
throw new Error(`Tangle ${field} conflicts with the control reference`);
|
|
21
|
+
}
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
24
|
const expectedSessionId = input.sessionId ??
|
|
@@ -62,6 +59,16 @@ export function dispatchEnvironmentRun(box, provider, environmentId) {
|
|
|
62
59
|
}
|
|
63
60
|
throw error;
|
|
64
61
|
}
|
|
62
|
+
const receipt = dispatched;
|
|
63
|
+
if (receipt?.dispatched === false && receipt.alreadyExisted === true &&
|
|
64
|
+
receipt.sessionId === expectedSessionId && receipt.executionId === expectedExecutionId &&
|
|
65
|
+
receipt.runControlRef === undefined && callerControlRef === undefined && box.session) {
|
|
66
|
+
// Recover an older SDK's omitted reuse reference from server status; validate every binding below.
|
|
67
|
+
const status = await awaitWithSignal(box.session(expectedSessionId).status({ signal: input.signal }), input.signal);
|
|
68
|
+
const echoedRef = status && typeof status === "object" && !Array.isArray(status) && "runControlRef" in status ? status.runControlRef : undefined;
|
|
69
|
+
if (echoedRef !== undefined)
|
|
70
|
+
dispatched = { ...receipt, runControlRef: echoedRef };
|
|
71
|
+
}
|
|
65
72
|
let reference;
|
|
66
73
|
try {
|
|
67
74
|
reference = sessionRefFromSandboxDispatch(dispatched, provider, environmentId, expectedExecutionId, requestDigest, expectedSessionId, callerControlRef);
|
|
@@ -79,12 +86,10 @@ export function dispatchEnvironmentRun(box, provider, environmentId) {
|
|
|
79
86
|
}
|
|
80
87
|
throw error;
|
|
81
88
|
}
|
|
82
|
-
const boundReference = reference;
|
|
83
89
|
if (input.signal?.aborted && input.detach !== true) {
|
|
84
|
-
await interruptAfterAbort(box,
|
|
85
|
-
input.signal.throwIfAborted();
|
|
90
|
+
await interruptAfterAbort(box, reference);
|
|
86
91
|
}
|
|
87
92
|
input.signal?.throwIfAborted();
|
|
88
|
-
return
|
|
93
|
+
return reference;
|
|
89
94
|
};
|
|
90
95
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-provider-tangle",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.3",
|
|
4
4
|
"description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"LICENSE"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tangle-network/agent-interface": "^5.10.
|
|
36
|
+
"@tangle-network/agent-interface": "^5.10.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@tangle-network/sandbox": ">=0.60.88 <2.0.0"
|