@tangle-network/agent-provider-tangle 0.3.5 → 0.4.0
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/dist/exact-process.js +1 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +15 -4
- package/package.json +3 -3
package/dist/exact-process.js
CHANGED
|
@@ -92,10 +92,9 @@ function exactSandboxOptions(input, defaults) {
|
|
|
92
92
|
}
|
|
93
93
|
const resources = sandboxResourcesFromRequest(input.resources);
|
|
94
94
|
return {
|
|
95
|
-
|
|
95
|
+
environment: input.image,
|
|
96
96
|
agent: false,
|
|
97
97
|
driver: { type: "host-agent", runtimeBackend: "docker" },
|
|
98
|
-
publicEdge: false,
|
|
99
98
|
ephemeral: true,
|
|
100
99
|
sshEnabled: false,
|
|
101
100
|
webTerminalEnabled: false,
|
package/dist/index.d.ts
CHANGED
|
@@ -97,7 +97,9 @@ export interface SandboxSessionLike {
|
|
|
97
97
|
}): AsyncIterable<SandboxEvent>;
|
|
98
98
|
result(): Promise<PromptResult>;
|
|
99
99
|
prompt(message: string | InputPart[], options?: PromptOptions): Promise<PromptResult>;
|
|
100
|
-
|
|
100
|
+
interrupt(): Promise<{
|
|
101
|
+
cancelled: boolean;
|
|
102
|
+
}>;
|
|
101
103
|
}
|
|
102
104
|
export interface TangleProviderOptions {
|
|
103
105
|
client: SandboxClientLike;
|
package/dist/index.js
CHANGED
|
@@ -150,19 +150,24 @@ function sandboxSessionAsAgentSession(session) {
|
|
|
150
150
|
async prompt(input) {
|
|
151
151
|
return agentTurnResultFromPromptResult(await session.prompt(promptFromTurnInput(input), promptOptionsFromTurnInput(input)));
|
|
152
152
|
},
|
|
153
|
-
|
|
153
|
+
async cancel() {
|
|
154
|
+
await session.interrupt();
|
|
155
|
+
},
|
|
154
156
|
};
|
|
155
157
|
}
|
|
156
158
|
function sandboxOptionsFromCreateInput(input, defaultBackend) {
|
|
157
159
|
const workspace = input.workspace ?? {};
|
|
160
|
+
if (workspace.environment !== undefined && workspace.image !== undefined) {
|
|
161
|
+
throw new Error("Tangle workspace cannot specify both environment and image");
|
|
162
|
+
}
|
|
163
|
+
const environment = workspace.image ?? workspace.environment;
|
|
158
164
|
const providerOptions = input.providerOptions?.sandboxCreateOptions;
|
|
159
165
|
const base = providerOptions && typeof providerOptions === "object"
|
|
160
166
|
? { ...providerOptions }
|
|
161
167
|
: {};
|
|
162
168
|
return {
|
|
163
169
|
...base,
|
|
164
|
-
...(
|
|
165
|
-
...(workspace.image ? { image: workspace.image } : {}),
|
|
170
|
+
...(environment !== undefined ? { environment } : {}),
|
|
166
171
|
...(workspace.repoUrl ? { git: { url: workspace.repoUrl, ref: workspace.gitRef } } : {}),
|
|
167
172
|
...(input.resources ? { resources: input.resources } : {}),
|
|
168
173
|
...(input.env ? { env: input.env } : {}),
|
|
@@ -173,10 +178,16 @@ function sandboxOptionsFromCreateInput(input, defaultBackend) {
|
|
|
173
178
|
backend: {
|
|
174
179
|
...(base.backend ?? {}),
|
|
175
180
|
type: (input.backend ?? defaultBackend),
|
|
176
|
-
profile: input.profile,
|
|
181
|
+
profile: inlineAgentProfile(input.profile),
|
|
177
182
|
},
|
|
178
183
|
};
|
|
179
184
|
}
|
|
185
|
+
function inlineAgentProfile(profile) {
|
|
186
|
+
if (typeof profile === "string") {
|
|
187
|
+
throw new Error("Tangle provider requires an inline AgentProfile, not a profile reference");
|
|
188
|
+
}
|
|
189
|
+
return profile;
|
|
190
|
+
}
|
|
180
191
|
function environmentEventFromSandboxEvent(event) {
|
|
181
192
|
const data = event.data && typeof event.data === "object"
|
|
182
193
|
? event.data
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-provider-tangle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@tangle-network/agent-interface": "0.34.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@tangle-network/sandbox": ">=0.
|
|
37
|
+
"@tangle-network/sandbox": ">=0.13.0-develop.20260726215211.b0dddb3 <1.0.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"@tangle-network/sandbox": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@tangle-network/sandbox": "
|
|
45
|
+
"@tangle-network/sandbox": "0.13.0-develop.20260726215211.b0dddb3",
|
|
46
46
|
"@types/node": "25.6.0",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
48
|
"vitest": "^4.1.5",
|