@tangle-network/agent-provider-tangle 0.3.4 → 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 +4 -2
- package/dist/index.js +22 -5
- 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
|
@@ -54,7 +54,7 @@ export interface SandboxInstanceLike {
|
|
|
54
54
|
}): Promise<string>;
|
|
55
55
|
write?(path: string, content: string, options?: {
|
|
56
56
|
sessionId?: string;
|
|
57
|
-
}): Promise<
|
|
57
|
+
}): Promise<unknown>;
|
|
58
58
|
exec?(command: string, options?: unknown): Promise<SandboxExecResult>;
|
|
59
59
|
fs?: {
|
|
60
60
|
supportsWriteMode?: true;
|
|
@@ -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
|
@@ -88,7 +88,13 @@ function sandboxInstanceAsEnvironment(box, providerName, client) {
|
|
|
88
88
|
}
|
|
89
89
|
: {}),
|
|
90
90
|
...(box.read ? { read: box.read.bind(box) } : {}),
|
|
91
|
-
...(box.write
|
|
91
|
+
...(box.write
|
|
92
|
+
? {
|
|
93
|
+
async write(path, content) {
|
|
94
|
+
await box.write?.(path, content);
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
: {}),
|
|
92
98
|
...(box.exec
|
|
93
99
|
? {
|
|
94
100
|
async exec(command, options) {
|
|
@@ -144,19 +150,24 @@ function sandboxSessionAsAgentSession(session) {
|
|
|
144
150
|
async prompt(input) {
|
|
145
151
|
return agentTurnResultFromPromptResult(await session.prompt(promptFromTurnInput(input), promptOptionsFromTurnInput(input)));
|
|
146
152
|
},
|
|
147
|
-
|
|
153
|
+
async cancel() {
|
|
154
|
+
await session.interrupt();
|
|
155
|
+
},
|
|
148
156
|
};
|
|
149
157
|
}
|
|
150
158
|
function sandboxOptionsFromCreateInput(input, defaultBackend) {
|
|
151
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;
|
|
152
164
|
const providerOptions = input.providerOptions?.sandboxCreateOptions;
|
|
153
165
|
const base = providerOptions && typeof providerOptions === "object"
|
|
154
166
|
? { ...providerOptions }
|
|
155
167
|
: {};
|
|
156
168
|
return {
|
|
157
169
|
...base,
|
|
158
|
-
...(
|
|
159
|
-
...(workspace.image ? { image: workspace.image } : {}),
|
|
170
|
+
...(environment !== undefined ? { environment } : {}),
|
|
160
171
|
...(workspace.repoUrl ? { git: { url: workspace.repoUrl, ref: workspace.gitRef } } : {}),
|
|
161
172
|
...(input.resources ? { resources: input.resources } : {}),
|
|
162
173
|
...(input.env ? { env: input.env } : {}),
|
|
@@ -167,10 +178,16 @@ function sandboxOptionsFromCreateInput(input, defaultBackend) {
|
|
|
167
178
|
backend: {
|
|
168
179
|
...(base.backend ?? {}),
|
|
169
180
|
type: (input.backend ?? defaultBackend),
|
|
170
|
-
profile: input.profile,
|
|
181
|
+
profile: inlineAgentProfile(input.profile),
|
|
171
182
|
},
|
|
172
183
|
};
|
|
173
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
|
+
}
|
|
174
191
|
function environmentEventFromSandboxEvent(event) {
|
|
175
192
|
const data = event.data && typeof event.data === "object"
|
|
176
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",
|