@tangle-network/agent-provider-tangle 0.13.0 → 0.13.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,5 +1,5 @@
|
|
|
1
|
-
import type { AgentEnvironmentStatus, AgentSessionStatus, PlacementInfo } from "@tangle-network/agent-interface/environment-provider";
|
|
2
|
-
import type { SandboxInstanceLike } from "./tangle-types.js";
|
|
1
|
+
import type { AgentEnvironmentCreation, AgentEnvironmentStatus, AgentSessionStatus, PlacementInfo } from "@tangle-network/agent-interface/environment-provider";
|
|
2
|
+
import type { SandboxCreateReceiptLike, SandboxInstanceLike } from "./tangle-types.js";
|
|
3
3
|
export declare function nonEmptyString(value: unknown): string | undefined;
|
|
4
4
|
export declare function optionalNonEmptyString(value: unknown, label: string): string | undefined;
|
|
5
5
|
export declare function placementInfoFromLoopPlacement(placement: unknown, box: SandboxInstanceLike): PlacementInfo;
|
|
@@ -16,3 +16,9 @@ export declare function sessionStatusFromUnknown(status: unknown): AgentSessionS
|
|
|
16
16
|
* "unknown" instead of fabricating an execution-scoped answer.
|
|
17
17
|
*/
|
|
18
18
|
export declare function executionBoundSessionStatus(payload: unknown, executionId: string): AgentSessionStatus;
|
|
19
|
+
/**
|
|
20
|
+
* Map the platform create receipt to the environment creation verdict. An
|
|
21
|
+
* `unknown` outcome, a null receipt, and an SDK without receipts all leave the
|
|
22
|
+
* verdict absent, so a consumer cannot read them as proof of creation.
|
|
23
|
+
*/
|
|
24
|
+
export declare function creationFromSandboxCreateReceipt(receipt: SandboxCreateReceiptLike | null | undefined): AgentEnvironmentCreation | undefined;
|
|
@@ -117,3 +117,24 @@ export function executionBoundSessionStatus(payload, executionId) {
|
|
|
117
117
|
return sessionStatus;
|
|
118
118
|
return "unknown";
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Map the platform create receipt to the environment creation verdict. An
|
|
122
|
+
* `unknown` outcome, a null receipt, and an SDK without receipts all leave the
|
|
123
|
+
* verdict absent, so a consumer cannot read them as proof of creation.
|
|
124
|
+
*/
|
|
125
|
+
export function creationFromSandboxCreateReceipt(receipt) {
|
|
126
|
+
if (receipt === null || receipt === undefined)
|
|
127
|
+
return undefined;
|
|
128
|
+
switch (receipt.outcome) {
|
|
129
|
+
case "created":
|
|
130
|
+
return "created";
|
|
131
|
+
case "idempotent_replay":
|
|
132
|
+
return "replayed";
|
|
133
|
+
case "unknown":
|
|
134
|
+
return undefined;
|
|
135
|
+
default: {
|
|
136
|
+
const outcome = receipt.outcome;
|
|
137
|
+
throw new Error(`Tangle create receipt reported an unknown outcome: ${String(outcome)}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -3,7 +3,7 @@ import { AgentEnvironmentCapabilitiesSchema } from "@tangle-network/agent-interf
|
|
|
3
3
|
import { environmentEventFromSandboxEvent } from "./tangle-events.js";
|
|
4
4
|
import { executionIdFromTurnInput, promptFromTurnInput, promptOptionsFromTurnInput, } from "./tangle-prompt.js";
|
|
5
5
|
import { resolveRetainedSessionControlRef } from "./tangle-session-control.js";
|
|
6
|
-
import { placementInfoFromLoopPlacement, statusFromUnknown, } from "./tangle-environment-values.js";
|
|
6
|
+
import { creationFromSandboxCreateReceipt, placementInfoFromLoopPlacement, statusFromUnknown, } from "./tangle-environment-values.js";
|
|
7
7
|
import { execResultFromSandboxExecResult } from "./tangle-result-values.js";
|
|
8
8
|
import { capabilitiesForSandbox, frozenCapabilityDocument, sandboxCapabilitySupport, } from "./tangle-capabilities.js";
|
|
9
9
|
import { readDeploymentCapabilitySupport } from "./tangle-deployment-capabilities.js";
|
|
@@ -76,9 +76,11 @@ export async function sandboxInstanceAsEnvironment(box, providerName, client, de
|
|
|
76
76
|
...(options.signal ? { signal: options.signal } : {}),
|
|
77
77
|
...(options.controlRef ? { runControlRef: options.controlRef } : {}),
|
|
78
78
|
});
|
|
79
|
+
const creation = creationFromSandboxCreateReceipt(box.createReceipt?.());
|
|
79
80
|
return {
|
|
80
81
|
id: environmentId,
|
|
81
82
|
provider: providerName,
|
|
83
|
+
...(creation === undefined ? {} : { creation }),
|
|
82
84
|
...(box.name ? { name: boundedString(box.name, "Tangle environment name") } : {}),
|
|
83
85
|
...(box.metadata ? { metadata: snapshotMetadata(box.metadata) } : {}),
|
|
84
86
|
capabilities,
|
package/dist/tangle-types.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { BackendRegistryEntry, BackendRegistryResponse, BackendType, CreateSandboxOptions, ExecResult as SandboxExecResult, PromptOptions, PromptResult, SandboxEvent } from "@tangle-network/sandbox";
|
|
2
2
|
import type { AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, AgentExecutionPreparationReceipt, AgentInteractiveSessionControlClaim, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionControlClaimRequest, AgentInteractiveSessionPromptAcknowledgement, AgentInteractiveSessionPromptCommand, AgentInteractiveSessionStopAcknowledgement, AgentInteractiveSessionStopCommand, AgentProfile, InputPart, InteractionRequest, InteractionResponseCommand } from "@tangle-network/agent-interface";
|
|
3
3
|
import type { AgentEnvironmentCapabilities, AgentEnvironmentProvider, CreateAgentEnvironmentInput } from "@tangle-network/agent-interface/environment-provider";
|
|
4
|
+
/**
|
|
5
|
+
* The platform verdict for the create call that returned a sandbox.
|
|
6
|
+
* `created` means the call allocated the sandbox; `idempotent_replay` means an
|
|
7
|
+
* earlier call with the same idempotency key allocated it; `unknown` means the
|
|
8
|
+
* platform cannot prove either outcome.
|
|
9
|
+
*/
|
|
10
|
+
export interface SandboxCreateReceiptLike {
|
|
11
|
+
outcome: "created" | "idempotent_replay" | "unknown";
|
|
12
|
+
idempotencyKeyApplied: boolean;
|
|
13
|
+
}
|
|
4
14
|
export interface TangleExactProcessOptions {
|
|
5
15
|
teamId?: string;
|
|
6
16
|
}
|
|
@@ -367,6 +377,12 @@ export interface SandboxInstanceLike {
|
|
|
367
377
|
resourceUsage?(): Promise<SandboxResourceUsageLike | null>;
|
|
368
378
|
/** Interactive terminal transport. Absent on a client that cannot serve a PTY. */
|
|
369
379
|
terminals?: SandboxTerminalsLike;
|
|
380
|
+
/**
|
|
381
|
+
* The platform verdict for the create call that returned this instance.
|
|
382
|
+
* Absent on a Sandbox SDK older than 0.30.1; null for an instance resolved
|
|
383
|
+
* by id or when the platform reported no receipt.
|
|
384
|
+
*/
|
|
385
|
+
createReceipt?(): SandboxCreateReceiptLike | null;
|
|
370
386
|
refresh?(options?: {
|
|
371
387
|
signal?: AbortSignal;
|
|
372
388
|
}): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-provider-tangle",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"LICENSE"
|
|
86
86
|
],
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@tangle-network/agent-interface": "^1.0
|
|
88
|
+
"@tangle-network/agent-interface": "^1.4.0"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"@tangle-network/sandbox": ">=0.30.1 <1.0.0"
|
|
@@ -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.
|
|
105
|
+
"@tangle-network/agent-provider-testkit": "0.8.4"
|
|
106
106
|
},
|
|
107
107
|
"scripts": {
|
|
108
108
|
"build": "tsc -p tsconfig.json",
|