@tangle-network/agent-provider-tangle 5.0.2 → 5.0.3
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/tangle-create-options.js +1 -1
- package/dist/tangle-prompt.js +14 -10
- package/package.json +2 -2
|
@@ -199,7 +199,7 @@ export function sandboxOptionsFromCreateInput(input, defaultBackend, parsedWorks
|
|
|
199
199
|
...(input.idempotencyKey === undefined ? {} : { idempotencyKey: input.idempotencyKey }),
|
|
200
200
|
backend: {
|
|
201
201
|
type: backend,
|
|
202
|
-
profile,
|
|
202
|
+
profile: profile,
|
|
203
203
|
...(modelCredentials === undefined ? {} : {
|
|
204
204
|
model: "cliAuth" in modelCredentials
|
|
205
205
|
? { cliAuth: modelCredentials.cliAuth, authMode: "oauth" } : { apiKeyEnv: modelCredentials.apiKeyEnv, baseUrl: modelCredentials.baseUrl },
|
package/dist/tangle-prompt.js
CHANGED
|
@@ -89,6 +89,13 @@ function containsProxyReceipt(full, subset) {
|
|
|
89
89
|
return full.sandboxId === subset.sandboxId && full.generation === subset.generation &&
|
|
90
90
|
subset.bindings.every((binding) => full.bindings.some((member) => canonicalCandidateDigest(member) === canonicalCandidateDigest(binding)));
|
|
91
91
|
}
|
|
92
|
+
/** The sidecar's answer when it serves no public revision root: 409 with this exact text. Any other prepare failure stays an error. */
|
|
93
|
+
function publicPreparationRefusal(error) {
|
|
94
|
+
if (error instanceof Error && error.status === 409 &&
|
|
95
|
+
error.message.includes("Concurrent public profile materialization is disabled"))
|
|
96
|
+
return undefined;
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
92
99
|
/** Prepare one exact launch; legacy and cursor replay retain their existing path. */
|
|
93
100
|
export async function preparePromptOptions(box, options, provider, bindings) {
|
|
94
101
|
if (options.lastEventId !== undefined)
|
|
@@ -122,7 +129,10 @@ export async function preparePromptOptions(box, options, provider, bindings) {
|
|
|
122
129
|
validatePrepared(prepared.proxySecretReceipt);
|
|
123
130
|
}
|
|
124
131
|
else {
|
|
125
|
-
const prepared = await awaitWithSignal(box.preparePublicProfileRevision(args), options.signal);
|
|
132
|
+
const prepared = await awaitWithSignal(box.preparePublicProfileRevision(args), options.signal).catch(publicPreparationRefusal);
|
|
133
|
+
// A sidecar with no public revision root refuses every prepare, so its launch runs unprepared in the session just created.
|
|
134
|
+
if (prepared === undefined)
|
|
135
|
+
return { ...options, sessionId, backend };
|
|
126
136
|
options = { ...options, sessionId, backend, expectedPublicProfileRequestDigest: prepared.expectedPublicProfileRequestDigest, expectedPublicProfileRevision: prepared.expectedPublicProfileRevision };
|
|
127
137
|
validatePrepared(prepared.proxySecretReceipt);
|
|
128
138
|
}
|
|
@@ -255,10 +265,8 @@ function sandboxPromptBackendModel(value) {
|
|
|
255
265
|
model[field] = boundedString(present[field], `Tangle prompt backend model ${field}`);
|
|
256
266
|
}
|
|
257
267
|
if (present.maxThinkingTokens !== undefined) {
|
|
258
|
-
if (!Number.isSafeInteger(present.maxThinkingTokens) ||
|
|
259
|
-
present.maxThinkingTokens < 0) {
|
|
268
|
+
if (!Number.isSafeInteger(present.maxThinkingTokens) || present.maxThinkingTokens < 0)
|
|
260
269
|
throw new Error("Tangle prompt backend model maxThinkingTokens must be a non-negative integer");
|
|
261
|
-
}
|
|
262
270
|
model.maxThinkingTokens = present.maxThinkingTokens;
|
|
263
271
|
}
|
|
264
272
|
if (present.mode !== undefined) {
|
|
@@ -268,9 +276,8 @@ function sandboxPromptBackendModel(value) {
|
|
|
268
276
|
model.mode = present.mode;
|
|
269
277
|
}
|
|
270
278
|
if (present.authMode !== undefined) {
|
|
271
|
-
if (present.authMode !== "api-key" && present.authMode !== "oauth")
|
|
279
|
+
if (present.authMode !== "api-key" && present.authMode !== "oauth")
|
|
272
280
|
throw new Error('Tangle prompt backend model authMode must be "api-key" or "oauth"');
|
|
273
|
-
}
|
|
274
281
|
model.authMode = present.authMode;
|
|
275
282
|
}
|
|
276
283
|
if (present.authFiles !== undefined) {
|
|
@@ -289,11 +296,8 @@ function sandboxPromptBackendServer(value) {
|
|
|
289
296
|
assertDeclaredFields(present, new Set(["port", "hostname"]), "Tangle prompt backend server options");
|
|
290
297
|
const server = {};
|
|
291
298
|
if (present.port !== undefined) {
|
|
292
|
-
if (!Number.isSafeInteger(present.port) ||
|
|
293
|
-
present.port < 1 ||
|
|
294
|
-
present.port > 65_535) {
|
|
299
|
+
if (!Number.isSafeInteger(present.port) || present.port < 1 || present.port > 65_535)
|
|
295
300
|
throw new Error("Tangle prompt backend server port must be a TCP port number");
|
|
296
|
-
}
|
|
297
301
|
server.port = present.port;
|
|
298
302
|
}
|
|
299
303
|
if (present.hostname !== undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-provider-tangle",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@tangle-network/agent-provider-testkit": "0.12.
|
|
47
|
+
"@tangle-network/agent-provider-testkit": "0.12.2",
|
|
48
48
|
"@tangle-network/agent-runtime": "0.349.0",
|
|
49
49
|
"@tangle-network/sandbox": "1.0.141",
|
|
50
50
|
"@types/node": "26.6.5",
|