@tangle-network/agent-provider-tangle 1.9.0 → 1.9.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.
@@ -6,9 +6,8 @@ export declare function isSandboxConnectionMarker(event: SandboxEvent): boolean;
6
6
  * The session ids a Sandbox event carries, kept separate by field position.
7
7
  *
8
8
  * `runFrameSessionId` is `data.sessionId`/`data.sessionID`. The run/stream lane
9
- * copies that value straight from the backend adapter, so on `session.updated`
10
- * it is the harness-native session id (Claude, Codex, OpenCode) rather than the
11
- * runtime session id.
9
+ * copies the public resume key from the adapter on `session.updated`.
10
+ * That key can differ from the Runtime session and is not native identity evidence.
12
11
  *
13
12
  * `envelopeSessionId` is the `properties` and `properties.info` position of an
14
13
  * /agents/events frame, plus `properties.part` on a frame type that publishes a
@@ -138,17 +138,15 @@ export function environmentEventFromSandboxEvent(event, expected = {}) {
138
138
  if (Object.prototype.hasOwnProperty.call(data, "contextTransferReceipt")) {
139
139
  throw new Error("Tangle Sandbox emitted an unsolicited context transfer receipt");
140
140
  }
141
- // A stream-bound iterator is the response body of the run this call started
142
- // or the replay of one named execution, so the transport itself excludes
143
- // another session's frames. On such a stream the run-frame position of
144
- // `session.updated` carries the harness-native session id (for example an
145
- // OpenCode session) rather than the runtime session id, so that one position
146
- // on that one frame type is content. Every other position of that frame, and
147
- // every position of every other frame type, names the runtime session and is
148
- // compared to the expected id.
141
+ // A bound public stream can carry the adapter's resume key in session.updated.
142
+ // It is content, not evidence of provider-native identity or Runtime ownership.
143
+ // Envelope identities still bind the frame to the expected Runtime session.
144
+ if (record.type === "native.session.observed") {
145
+ throw new Error("Tangle public stream exposed a private native identity event");
146
+ }
149
147
  const identity = sandboxEventIdentity(event);
150
- const runFrameCarriesNativeSessionId = expected.streamBound === true && record.type === "session.updated";
151
- const identityBearingSessionIds = carriedSessionIds(runFrameCarriesNativeSessionId
148
+ const runFrameCarriesPublicResumeKey = expected.streamBound === true && record.type === "session.updated";
149
+ const identityBearingSessionIds = carriedSessionIds(runFrameCarriesPublicResumeKey
152
150
  ? { envelopeSessionId: identity.envelopeSessionId }
153
151
  : identity);
154
152
  if (expected.executionId !== undefined) {
@@ -180,8 +178,7 @@ export function environmentEventFromSandboxEvent(event, expected = {}) {
180
178
  // Other event names do not prove whether their usage is incremental.
181
179
  const usageMode = declaredModes[0] ??
182
180
  (record.type === "result" || record.type === "done" ? "cumulative" : undefined);
183
- // The session id reaches the normalized event whichever position carried it,
184
- // including the native id an execution-bound stream just accepted as content.
181
+ // Preserve the public resume key without promoting it to native attribution.
185
182
  const normalized = normalizeSandboxEvent(record.type, data, identity);
186
183
  return {
187
184
  type: record.type,
@@ -210,8 +207,8 @@ function normalizeSandboxEvent(type, data, identity) {
210
207
  // of the frame's own positions carries and introduces none of its own. Each
211
208
  // position it can repeat is already bound: the check above compared every
212
209
  // position that names the runtime session, and the run-frame position of a
213
- // stream-bound `session.updated` holds the native id the computed block
214
- // carries too. A frame that carries no session id can supply none either.
210
+ // stream-bound `session.updated` holds the public resume key the computed
211
+ // block carries too. A frame that carries no session id can supply none either.
215
212
  if (parsed.data.type === "session.updated") {
216
213
  if (!carriedSessionIds(identity).includes(parsed.data.sessionId)) {
217
214
  throw new Error("Tangle Sandbox normalized event named a session the frame does not carry");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-provider-tangle",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -103,7 +103,7 @@
103
103
  "LICENSE"
104
104
  ],
105
105
  "dependencies": {
106
- "@tangle-network/agent-interface": "^2.14.0"
106
+ "@tangle-network/agent-interface": "^2.15.0"
107
107
  },
108
108
  "peerDependencies": {
109
109
  "@tangle-network/sandbox": ">=0.58.0 <1.0.0"