@tangle-network/agent-provider-tangle 0.12.0 → 0.12.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.
@@ -1,4 +1,4 @@
1
- import { AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionStopAcknowledgementMatchesCommand, exactAgentInteractiveSessionStart, } from "@tangle-network/agent-interface";
1
+ import { AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionStopAcknowledgementMatchesCommand, canonicalCandidateDigest, exactAgentInteractiveSessionStart, } from "@tangle-network/agent-interface";
2
2
  import { parseBackendType } from "@tangle-network/sandbox";
3
3
  import { assertOptionKeys } from "./tangle-environment-validation.js";
4
4
  import { transportFailureReason } from "./tangle-failure-reason.js";
@@ -46,10 +46,7 @@ export function createTangleInteractiveAgentRegistry(box, providerName, environm
46
46
  return ref;
47
47
  };
48
48
  const assertRef = (expected, candidate) => {
49
- if (expected.run.runId !== candidate.run.runId ||
50
- expected.run.requestDigest !== candidate.run.requestDigest ||
51
- expected.incarnationId !== candidate.incarnationId ||
52
- expected.preparationReceipt.digest !== candidate.preparationReceipt.digest) {
49
+ if (!sameExactSessionRef(expected, candidate)) {
53
50
  throw new Error("the Sandbox returned a different interactive session ref");
54
51
  }
55
52
  };
@@ -297,14 +294,13 @@ function statusFromSandbox(ref, observed) {
297
294
  });
298
295
  }
299
296
  const observedRef = AgentInteractiveSessionRefSchema.parse({
300
- run: ref.run,
297
+ run: { ...ref.run, sessionId: observed.sessionId },
301
298
  preparationReceipt: observed.preparationReceipt,
302
299
  incarnationId: observed.incarnationId,
303
300
  startedAt: observed.startedAt,
304
301
  });
305
- if (observed.sessionId !== ref.run.sessionId ||
306
- observed.harness !== ref.preparationReceipt.harness ||
307
- observedRef.preparationReceipt.digest !== ref.preparationReceipt.digest) {
302
+ if (observed.harness !== ref.preparationReceipt.harness ||
303
+ !sameExactSessionRef(ref, observedRef)) {
308
304
  throw new Error("the Sandbox reported a different interactive agent session identity");
309
305
  }
310
306
  if (observed.state === "running") {
@@ -326,3 +322,6 @@ function statusFromSandbox(ref, observed) {
326
322
  : {}),
327
323
  });
328
324
  }
325
+ function sameExactSessionRef(expected, candidate) {
326
+ return canonicalCandidateDigest(expected) === canonicalCandidateDigest(candidate);
327
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-provider-tangle",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -102,7 +102,7 @@
102
102
  "@types/node": "25.6.0",
103
103
  "typescript": "^6.0.3",
104
104
  "vitest": "^4.1.5",
105
- "@tangle-network/agent-provider-testkit": "0.8.0"
105
+ "@tangle-network/agent-provider-testkit": "0.8.1"
106
106
  },
107
107
  "scripts": {
108
108
  "build": "tsc -p tsconfig.json",