@tangle-network/agent-provider-tangle 3.6.1 → 3.6.2
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
CHANGED
|
@@ -447,8 +447,12 @@ metadata so a fresh process can recover the exact interface digest.
|
|
|
447
447
|
Snapshot-created children are validated through the marker and complete
|
|
448
448
|
account inventory, while legacy fork markers also require the Sandbox fork
|
|
449
449
|
ledger to report a settled success.
|
|
450
|
-
Checkpoint deletion
|
|
451
|
-
|
|
450
|
+
Checkpoint deletion reads only the source's own snapshots. A child created
|
|
451
|
+
from a checkpoint holds a full restore of it in its own volume, so deleting the
|
|
452
|
+
checkpoint neither waits for nor changes its children. One Sandbox path still
|
|
453
|
+
names the checkpoint after create: last-resort sidecar recreation replays the
|
|
454
|
+
child's original create request, and once the checkpoint is deleted that replay
|
|
455
|
+
fails with `SNAPSHOT_NOT_FOUND` (agent-dev-container#9388).
|
|
452
456
|
The adapter never treats an SDK response without an explicit idempotency or
|
|
453
457
|
deletion outcome as success.
|
|
454
458
|
|
|
@@ -3,7 +3,7 @@ import { ConfidentialAttestationSchema, ConfidentialExecutionRequestSchema, Fork
|
|
|
3
3
|
import { awaitWithSignal, boundedIdentifier, boundedString, MAX_STRING_LENGTH, cloneJson, safeIdentifier, safeString, } from "./tangle-contract-safety.js";
|
|
4
4
|
import { encodeTangleConfidentialAttestationQuote } from "./tangle-confidential-attestation.js";
|
|
5
5
|
import { checkpointMarkerTags, forkMarkerMetadata, markerBelongsToSource, checkpointMarkerBelongsToSource, checkpointMarkerFromTags, forkMarkerFromMetadata, } from "./tangle-workspace-markers.js";
|
|
6
|
-
import { checkpointRecordFromSnapshot, validSnapshotResult, reconcileCheckpoint, findManagedCheckpoint, findForkByKey, findForkChildById, completeForkChild,
|
|
6
|
+
import { checkpointRecordFromSnapshot, validSnapshotResult, reconcileCheckpoint, findManagedCheckpoint, findForkByKey, findForkChildById, completeForkChild, lookupOutcomeFromSandbox, isoDate, } from "./tangle-workspace-recovery.js";
|
|
7
7
|
const TANGLE_ATTESTATION_NONCE_PATTERN = /^(?:0x)?[0-9a-fA-F]{64}(?:[0-9a-fA-F]{64})?$/;
|
|
8
8
|
function confidentialForkRefusal(request) {
|
|
9
9
|
const confidential = request.confidential;
|
|
@@ -220,30 +220,20 @@ export function createTangleWorkspaceBranching(options) {
|
|
|
220
220
|
if (previous.requestDigest !== request.requestDigest) {
|
|
221
221
|
return cleanupConflict(request, previous.requestDigest);
|
|
222
222
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
return cleanupUnknown(request, "Sandbox child inventory is unavailable; deletion was not attempted", true);
|
|
238
|
-
}
|
|
239
|
-
if (blocking.length > 0) {
|
|
240
|
-
const acknowledgement = cleanupInUse(request, blocking);
|
|
241
|
-
cleanup.set(request.operationId, {
|
|
242
|
-
requestDigest: request.requestDigest,
|
|
243
|
-
acknowledgement,
|
|
244
|
-
});
|
|
245
|
-
return acknowledgement;
|
|
246
|
-
}
|
|
223
|
+
return previous.acknowledgement.status === "deleted"
|
|
224
|
+
? cleanupAlreadyAbsent(request)
|
|
225
|
+
: previous.acknowledgement;
|
|
226
|
+
}
|
|
227
|
+
// A child created from a checkpoint holds a full restore of it in its own
|
|
228
|
+
// volume, and Sandbox deletes a snapshot without regard to children, so
|
|
229
|
+
// deletion reads only this source's snapshots. One Sandbox path still names
|
|
230
|
+
// the checkpoint after create: last-resort sidecar recreation replays the
|
|
231
|
+
// child's original create request, and after deletion that replay fails
|
|
232
|
+
// with SNAPSHOT_NOT_FOUND instead of restoring the checkpoint
|
|
233
|
+
// (agent-dev-container#9388). The
|
|
234
|
+
// account-wide child scan this replaces paged a listing that Sandbox
|
|
235
|
+
// rebuilds and re-sorts on every page; on a busy account a page failed or
|
|
236
|
+
// repeated, deletion was never attempted, and the source was kept running.
|
|
247
237
|
const known = await findManagedCheckpoint(box, provider, request.targetId, undefined, operation?.signal);
|
|
248
238
|
if (known === "unknown") {
|
|
249
239
|
return cleanupUnknown(request, "Sandbox checkpoint inventory is unavailable; deletion was not attempted", true);
|
|
@@ -870,14 +860,6 @@ function cleanupConflict(request, existingRequestDigest) {
|
|
|
870
860
|
message: "Cleanup operation id is bound to another target",
|
|
871
861
|
});
|
|
872
862
|
}
|
|
873
|
-
function cleanupInUse(request, blockingTargetIds) {
|
|
874
|
-
return WorkspaceCleanupAcknowledgementSchema.parse({
|
|
875
|
-
...request,
|
|
876
|
-
status: "in_use",
|
|
877
|
-
blockingTargetIds,
|
|
878
|
-
message: "Checkpoint is still referenced by forked environments",
|
|
879
|
-
});
|
|
880
|
-
}
|
|
881
863
|
function cleanupUnknown(request, message, retryable) {
|
|
882
864
|
return WorkspaceCleanupAcknowledgementSchema.parse({
|
|
883
865
|
...request,
|
|
@@ -49,7 +49,6 @@ export declare function findForkChildById(client: SandboxClientLike, box: Sandbo
|
|
|
49
49
|
* marker is absent. Never invent either field from the request.
|
|
50
50
|
*/
|
|
51
51
|
export declare function completeForkChild(client: SandboxClientLike, child: SandboxInstanceLike, signal?: AbortSignal): Promise<SandboxInstanceLike | undefined>;
|
|
52
|
-
export declare function findBlockingForks(box: SandboxInstanceLike, client: SandboxClientLike, provider: string, checkpointId: string, signal?: AbortSignal): Promise<string[] | undefined>;
|
|
53
52
|
/**
|
|
54
53
|
* Read a fork ledger answer for a key that left no marked resource behind.
|
|
55
54
|
*
|
|
@@ -383,28 +383,6 @@ export async function completeForkChild(client, child, signal) {
|
|
|
383
383
|
return undefined;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
export async function findBlockingForks(box, client, provider, checkpointId, signal) {
|
|
387
|
-
const candidates = await listMarkedForkChildren(client, box, provider, undefined, signal);
|
|
388
|
-
if (candidates === undefined)
|
|
389
|
-
return undefined;
|
|
390
|
-
const blocking = new Set();
|
|
391
|
-
for (const { child, marker } of candidates) {
|
|
392
|
-
if (marker.request.checkpoint.checkpointId !== checkpointId)
|
|
393
|
-
continue;
|
|
394
|
-
try {
|
|
395
|
-
// A candidate that cannot be confirmed leaves the dependency set
|
|
396
|
-
// unknown, so cleanup must not proceed on a partial answer.
|
|
397
|
-
if (!(await forkOperationSucceeded(box, marker, signal)))
|
|
398
|
-
return undefined;
|
|
399
|
-
blocking.add(child.id);
|
|
400
|
-
}
|
|
401
|
-
catch {
|
|
402
|
-
signal?.throwIfAborted();
|
|
403
|
-
return undefined;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
return [...blocking].sort();
|
|
407
|
-
}
|
|
408
386
|
/**
|
|
409
387
|
* Read the complete account inventory through Sandbox offset pages.
|
|
410
388
|
*
|
|
@@ -460,9 +438,8 @@ async function listAllSandboxChildren(client, signal) {
|
|
|
460
438
|
/**
|
|
461
439
|
* Read every account child that carries a fork marker this source produced.
|
|
462
440
|
*
|
|
463
|
-
* The scan is the
|
|
464
|
-
*
|
|
465
|
-
* closed on the same condition.
|
|
441
|
+
* The scan is the front half of fork recovery. It returns undefined when the
|
|
442
|
+
* inventory itself cannot be trusted, so recovery fails closed.
|
|
466
443
|
*/
|
|
467
444
|
async function listMarkedForkChildren(client, box, provider, key, signal) {
|
|
468
445
|
const children = await listAllSandboxChildren(client, signal);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-provider-tangle",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.2",
|
|
4
4
|
"description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
}
|
|
140
140
|
},
|
|
141
141
|
"devDependencies": {
|
|
142
|
-
"@tangle-network/agent-provider-testkit": "0.10.
|
|
142
|
+
"@tangle-network/agent-provider-testkit": "0.10.1",
|
|
143
143
|
"@tangle-network/agent-runtime": "0.292.3",
|
|
144
144
|
"@tangle-network/sandbox": "0.58.7",
|
|
145
145
|
"@types/node": "26.6.3",
|