langsmith 0.6.1 → 0.6.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/client.cjs +16 -1
- package/dist/client.d.ts +10 -0
- package/dist/client.js +16 -1
- package/dist/experimental/otel/translator.cjs +15 -1
- package/dist/experimental/otel/translator.js +15 -1
- package/dist/experimental/sandbox/client.cjs +12 -12
- package/dist/experimental/sandbox/client.d.ts +3 -2
- package/dist/experimental/sandbox/client.js +12 -12
- package/dist/experimental/sandbox/sandbox.cjs +18 -10
- package/dist/experimental/sandbox/sandbox.d.ts +13 -5
- package/dist/experimental/sandbox/sandbox.js +18 -10
- package/dist/experimental/sandbox/types.d.ts +37 -19
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -4668,6 +4668,11 @@ class Client {
|
|
|
4668
4668
|
* the prompt contents, not merely the publishing account. Prompts from your
|
|
4669
4669
|
* own or your organization's account can still be unsafe if that account or
|
|
4670
4670
|
* prompt was compromised.
|
|
4671
|
+
*
|
|
4672
|
+
* When pulling a trusted external prompt, prefer pinning to a specific commit
|
|
4673
|
+
* rather than following a mutable latest version. Using `includeModel: true`
|
|
4674
|
+
* increases risk and should be avoided for public prompts or prompts outside
|
|
4675
|
+
* your own organization.
|
|
4671
4676
|
*/
|
|
4672
4677
|
async pullPromptCommit(promptIdentifier, options) {
|
|
4673
4678
|
assertPullPublicPromptAllowed(promptIdentifier, options?.dangerouslyPullPublicPrompt);
|
|
@@ -4703,6 +4708,11 @@ class Client {
|
|
|
4703
4708
|
* the prompt contents, not merely the publishing account. Prompts from your
|
|
4704
4709
|
* own or your organization's account can still be unsafe if that account or
|
|
4705
4710
|
* prompt was compromised.
|
|
4711
|
+
*
|
|
4712
|
+
* When pulling a trusted external prompt, prefer pinning to a specific commit
|
|
4713
|
+
* rather than following a mutable latest version. Using `includeModel: true`
|
|
4714
|
+
* increases risk and should be avoided for public prompts or prompts outside
|
|
4715
|
+
* your own organization.
|
|
4706
4716
|
* @private
|
|
4707
4717
|
*/
|
|
4708
4718
|
async _pullPrompt(promptIdentifier, options) {
|
|
@@ -4888,7 +4898,12 @@ class Client {
|
|
|
4888
4898
|
});
|
|
4889
4899
|
const data = (await response.json());
|
|
4890
4900
|
const commitHash = data.commit.commit_hash;
|
|
4891
|
-
|
|
4901
|
+
let ownerForUrl = owner;
|
|
4902
|
+
if (owner === "-") {
|
|
4903
|
+
const settings = await this._getSettings();
|
|
4904
|
+
ownerForUrl = settings.tenant_handle || owner;
|
|
4905
|
+
}
|
|
4906
|
+
return `${this.getHostUrl()}/hub/${ownerForUrl}/${name}:${commitHash.slice(0, 8)}`;
|
|
4892
4907
|
}
|
|
4893
4908
|
async _deleteDirectory(identifier) {
|
|
4894
4909
|
const [owner, name] = (0, prompts_js_1.parseHubIdentifier)(identifier);
|
package/dist/client.d.ts
CHANGED
|
@@ -1346,6 +1346,11 @@ export declare class Client implements LangSmithTracingClientInterface {
|
|
|
1346
1346
|
* the prompt contents, not merely the publishing account. Prompts from your
|
|
1347
1347
|
* own or your organization's account can still be unsafe if that account or
|
|
1348
1348
|
* prompt was compromised.
|
|
1349
|
+
*
|
|
1350
|
+
* When pulling a trusted external prompt, prefer pinning to a specific commit
|
|
1351
|
+
* rather than following a mutable latest version. Using `includeModel: true`
|
|
1352
|
+
* increases risk and should be avoided for public prompts or prompts outside
|
|
1353
|
+
* your own organization.
|
|
1349
1354
|
*/
|
|
1350
1355
|
pullPromptCommit(promptIdentifier: string, options?: {
|
|
1351
1356
|
includeModel?: boolean;
|
|
@@ -1372,6 +1377,11 @@ export declare class Client implements LangSmithTracingClientInterface {
|
|
|
1372
1377
|
* the prompt contents, not merely the publishing account. Prompts from your
|
|
1373
1378
|
* own or your organization's account can still be unsafe if that account or
|
|
1374
1379
|
* prompt was compromised.
|
|
1380
|
+
*
|
|
1381
|
+
* When pulling a trusted external prompt, prefer pinning to a specific commit
|
|
1382
|
+
* rather than following a mutable latest version. Using `includeModel: true`
|
|
1383
|
+
* increases risk and should be avoided for public prompts or prompts outside
|
|
1384
|
+
* your own organization.
|
|
1375
1385
|
* @private
|
|
1376
1386
|
*/
|
|
1377
1387
|
_pullPrompt(promptIdentifier: string, options?: {
|
package/dist/client.js
CHANGED
|
@@ -4630,6 +4630,11 @@ export class Client {
|
|
|
4630
4630
|
* the prompt contents, not merely the publishing account. Prompts from your
|
|
4631
4631
|
* own or your organization's account can still be unsafe if that account or
|
|
4632
4632
|
* prompt was compromised.
|
|
4633
|
+
*
|
|
4634
|
+
* When pulling a trusted external prompt, prefer pinning to a specific commit
|
|
4635
|
+
* rather than following a mutable latest version. Using `includeModel: true`
|
|
4636
|
+
* increases risk and should be avoided for public prompts or prompts outside
|
|
4637
|
+
* your own organization.
|
|
4633
4638
|
*/
|
|
4634
4639
|
async pullPromptCommit(promptIdentifier, options) {
|
|
4635
4640
|
assertPullPublicPromptAllowed(promptIdentifier, options?.dangerouslyPullPublicPrompt);
|
|
@@ -4665,6 +4670,11 @@ export class Client {
|
|
|
4665
4670
|
* the prompt contents, not merely the publishing account. Prompts from your
|
|
4666
4671
|
* own or your organization's account can still be unsafe if that account or
|
|
4667
4672
|
* prompt was compromised.
|
|
4673
|
+
*
|
|
4674
|
+
* When pulling a trusted external prompt, prefer pinning to a specific commit
|
|
4675
|
+
* rather than following a mutable latest version. Using `includeModel: true`
|
|
4676
|
+
* increases risk and should be avoided for public prompts or prompts outside
|
|
4677
|
+
* your own organization.
|
|
4668
4678
|
* @private
|
|
4669
4679
|
*/
|
|
4670
4680
|
async _pullPrompt(promptIdentifier, options) {
|
|
@@ -4850,7 +4860,12 @@ export class Client {
|
|
|
4850
4860
|
});
|
|
4851
4861
|
const data = (await response.json());
|
|
4852
4862
|
const commitHash = data.commit.commit_hash;
|
|
4853
|
-
|
|
4863
|
+
let ownerForUrl = owner;
|
|
4864
|
+
if (owner === "-") {
|
|
4865
|
+
const settings = await this._getSettings();
|
|
4866
|
+
ownerForUrl = settings.tenant_handle || owner;
|
|
4867
|
+
}
|
|
4868
|
+
return `${this.getHostUrl()}/hub/${ownerForUrl}/${name}:${commitHash.slice(0, 8)}`;
|
|
4854
4869
|
}
|
|
4855
4870
|
async _deleteDirectory(identifier) {
|
|
4856
4871
|
const [owner, name] = parseHubIdentifier(identifier);
|
|
@@ -46,6 +46,11 @@ const WELL_KNOWN_OPERATION_NAMES = {
|
|
|
46
46
|
function getOperationName(runType) {
|
|
47
47
|
return WELL_KNOWN_OPERATION_NAMES[runType] || runType;
|
|
48
48
|
}
|
|
49
|
+
function isPrimitive(value) {
|
|
50
|
+
return (typeof value === "string" ||
|
|
51
|
+
typeof value === "number" ||
|
|
52
|
+
typeof value === "boolean");
|
|
53
|
+
}
|
|
49
54
|
class LangSmithToOTELTranslator {
|
|
50
55
|
constructor() {
|
|
51
56
|
Object.defineProperty(this, "spans", {
|
|
@@ -178,6 +183,12 @@ class LangSmithToOTELTranslator {
|
|
|
178
183
|
if (modelName) {
|
|
179
184
|
span.setAttribute(constants.GEN_AI_REQUEST_MODEL, modelName);
|
|
180
185
|
}
|
|
186
|
+
// Set usage from metadata if available
|
|
187
|
+
// This can be overriden by `run.outputs.usage_metadata` later if present.
|
|
188
|
+
if (runInfo.extra?.metadata?.usage_metadata &&
|
|
189
|
+
typeof runInfo.extra.metadata.usage_metadata === "object") {
|
|
190
|
+
span.setAttribute(constants.LANGSMITH_USAGE_METADATA, JSON.stringify(runInfo.extra.metadata.usage_metadata));
|
|
191
|
+
}
|
|
181
192
|
// Set token usage information
|
|
182
193
|
if ("prompt_tokens" in runInfo &&
|
|
183
194
|
typeof runInfo.prompt_tokens === "number") {
|
|
@@ -196,7 +207,7 @@ class LangSmithToOTELTranslator {
|
|
|
196
207
|
const metadata = runInfo.extra?.metadata || {};
|
|
197
208
|
for (const [key, value] of Object.entries(metadata)) {
|
|
198
209
|
if (value !== null && value !== undefined) {
|
|
199
|
-
span.setAttribute(`${constants.LANGSMITH_METADATA}.${key}`, String(value));
|
|
210
|
+
span.setAttribute(`${constants.LANGSMITH_METADATA}.${key}`, isPrimitive(value) ? String(value) : JSON.stringify(value));
|
|
200
211
|
}
|
|
201
212
|
}
|
|
202
213
|
const tags = runInfo.tags;
|
|
@@ -365,6 +376,9 @@ class LangSmithToOTELTranslator {
|
|
|
365
376
|
if (outputs.usage_metadata &&
|
|
366
377
|
typeof outputs.usage_metadata === "object") {
|
|
367
378
|
const usageMetadata = outputs.usage_metadata;
|
|
379
|
+
// Set usage from outputs if available
|
|
380
|
+
// This overrides the usage from metadata if present.
|
|
381
|
+
span.setAttribute(constants.LANGSMITH_USAGE_METADATA, JSON.stringify(usageMetadata));
|
|
368
382
|
if (usageMetadata.input_token_details) {
|
|
369
383
|
span.setAttribute(constants.GEN_AI_USAGE_INPUT_TOKEN_DETAILS, JSON.stringify(usageMetadata.input_token_details));
|
|
370
384
|
}
|
|
@@ -10,6 +10,11 @@ const WELL_KNOWN_OPERATION_NAMES = {
|
|
|
10
10
|
function getOperationName(runType) {
|
|
11
11
|
return WELL_KNOWN_OPERATION_NAMES[runType] || runType;
|
|
12
12
|
}
|
|
13
|
+
function isPrimitive(value) {
|
|
14
|
+
return (typeof value === "string" ||
|
|
15
|
+
typeof value === "number" ||
|
|
16
|
+
typeof value === "boolean");
|
|
17
|
+
}
|
|
13
18
|
export class LangSmithToOTELTranslator {
|
|
14
19
|
constructor() {
|
|
15
20
|
Object.defineProperty(this, "spans", {
|
|
@@ -142,6 +147,12 @@ export class LangSmithToOTELTranslator {
|
|
|
142
147
|
if (modelName) {
|
|
143
148
|
span.setAttribute(constants.GEN_AI_REQUEST_MODEL, modelName);
|
|
144
149
|
}
|
|
150
|
+
// Set usage from metadata if available
|
|
151
|
+
// This can be overriden by `run.outputs.usage_metadata` later if present.
|
|
152
|
+
if (runInfo.extra?.metadata?.usage_metadata &&
|
|
153
|
+
typeof runInfo.extra.metadata.usage_metadata === "object") {
|
|
154
|
+
span.setAttribute(constants.LANGSMITH_USAGE_METADATA, JSON.stringify(runInfo.extra.metadata.usage_metadata));
|
|
155
|
+
}
|
|
145
156
|
// Set token usage information
|
|
146
157
|
if ("prompt_tokens" in runInfo &&
|
|
147
158
|
typeof runInfo.prompt_tokens === "number") {
|
|
@@ -160,7 +171,7 @@ export class LangSmithToOTELTranslator {
|
|
|
160
171
|
const metadata = runInfo.extra?.metadata || {};
|
|
161
172
|
for (const [key, value] of Object.entries(metadata)) {
|
|
162
173
|
if (value !== null && value !== undefined) {
|
|
163
|
-
span.setAttribute(`${constants.LANGSMITH_METADATA}.${key}`, String(value));
|
|
174
|
+
span.setAttribute(`${constants.LANGSMITH_METADATA}.${key}`, isPrimitive(value) ? String(value) : JSON.stringify(value));
|
|
164
175
|
}
|
|
165
176
|
}
|
|
166
177
|
const tags = runInfo.tags;
|
|
@@ -329,6 +340,9 @@ export class LangSmithToOTELTranslator {
|
|
|
329
340
|
if (outputs.usage_metadata &&
|
|
330
341
|
typeof outputs.usage_metadata === "object") {
|
|
331
342
|
const usageMetadata = outputs.usage_metadata;
|
|
343
|
+
// Set usage from outputs if available
|
|
344
|
+
// This overrides the usage from metadata if present.
|
|
345
|
+
span.setAttribute(constants.LANGSMITH_USAGE_METADATA, JSON.stringify(usageMetadata));
|
|
332
346
|
if (usageMetadata.input_token_details) {
|
|
333
347
|
span.setAttribute(constants.GEN_AI_USAGE_INPUT_TOKEN_DETAILS, JSON.stringify(usageMetadata.input_token_details));
|
|
334
348
|
}
|
|
@@ -204,12 +204,12 @@ class SandboxClient {
|
|
|
204
204
|
* ```
|
|
205
205
|
*/
|
|
206
206
|
async createSandbox(snapshotId, options = {}) {
|
|
207
|
-
const { snapshotName, name, timeout = 30, waitForReady = true,
|
|
207
|
+
const { snapshotName, name, timeout = 30, waitForReady = true, idleTtlSeconds, deleteAfterStopSeconds, vCpus, memBytes, fsCapacityBytes, proxyConfig, } = options;
|
|
208
208
|
if (!!snapshotId === !!snapshotName) {
|
|
209
209
|
throw new errors_js_1.LangSmithValidationError("Exactly one of snapshotId or options.snapshotName must be set", "snapshotId");
|
|
210
210
|
}
|
|
211
|
-
(0, helpers_js_1.validateTtl)(ttlSeconds, "ttlSeconds");
|
|
212
211
|
(0, helpers_js_1.validateTtl)(idleTtlSeconds, "idleTtlSeconds");
|
|
212
|
+
(0, helpers_js_1.validateTtl)(deleteAfterStopSeconds, "deleteAfterStopSeconds");
|
|
213
213
|
const url = `${this._baseUrl}/boxes`;
|
|
214
214
|
const payload = {
|
|
215
215
|
wait_for_ready: waitForReady,
|
|
@@ -226,12 +226,12 @@ class SandboxClient {
|
|
|
226
226
|
if (name) {
|
|
227
227
|
payload.name = name;
|
|
228
228
|
}
|
|
229
|
-
if (ttlSeconds !== undefined) {
|
|
230
|
-
payload.ttl_seconds = ttlSeconds;
|
|
231
|
-
}
|
|
232
229
|
if (idleTtlSeconds !== undefined) {
|
|
233
230
|
payload.idle_ttl_seconds = idleTtlSeconds;
|
|
234
231
|
}
|
|
232
|
+
if (deleteAfterStopSeconds !== undefined) {
|
|
233
|
+
payload.delete_after_stop_seconds = deleteAfterStopSeconds;
|
|
234
|
+
}
|
|
235
235
|
if (vCpus !== undefined) {
|
|
236
236
|
payload.vcpus = vCpus;
|
|
237
237
|
}
|
|
@@ -299,12 +299,12 @@ class SandboxClient {
|
|
|
299
299
|
const options = typeof newNameOrOptions === "string"
|
|
300
300
|
? { newName: newNameOrOptions }
|
|
301
301
|
: newNameOrOptions;
|
|
302
|
-
const { newName,
|
|
303
|
-
(0, helpers_js_1.validateTtl)(ttlSeconds, "ttlSeconds");
|
|
302
|
+
const { newName, idleTtlSeconds, deleteAfterStopSeconds } = options;
|
|
304
303
|
(0, helpers_js_1.validateTtl)(idleTtlSeconds, "idleTtlSeconds");
|
|
304
|
+
(0, helpers_js_1.validateTtl)(deleteAfterStopSeconds, "deleteAfterStopSeconds");
|
|
305
305
|
if (newName === undefined &&
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
idleTtlSeconds === undefined &&
|
|
307
|
+
deleteAfterStopSeconds === undefined) {
|
|
308
308
|
return this.getSandbox(name);
|
|
309
309
|
}
|
|
310
310
|
const url = `${this._baseUrl}/boxes/${encodeURIComponent(name)}`;
|
|
@@ -312,12 +312,12 @@ class SandboxClient {
|
|
|
312
312
|
if (newName !== undefined) {
|
|
313
313
|
payload.name = newName;
|
|
314
314
|
}
|
|
315
|
-
if (ttlSeconds !== undefined) {
|
|
316
|
-
payload.ttl_seconds = ttlSeconds;
|
|
317
|
-
}
|
|
318
315
|
if (idleTtlSeconds !== undefined) {
|
|
319
316
|
payload.idle_ttl_seconds = idleTtlSeconds;
|
|
320
317
|
}
|
|
318
|
+
if (deleteAfterStopSeconds !== undefined) {
|
|
319
|
+
payload.delete_after_stop_seconds = deleteAfterStopSeconds;
|
|
320
|
+
}
|
|
321
321
|
const response = await this._fetch(url, {
|
|
322
322
|
method: "PATCH",
|
|
323
323
|
headers: { "Content-Type": "application/json" },
|
|
@@ -111,14 +111,15 @@ export declare class SandboxClient {
|
|
|
111
111
|
*/
|
|
112
112
|
updateSandbox(name: string, newName: string): Promise<Sandbox>;
|
|
113
113
|
/**
|
|
114
|
-
* Update a sandbox's name and/or
|
|
114
|
+
* Update a sandbox's name and/or retention settings (idle stop and
|
|
115
|
+
* delete-after-stop).
|
|
115
116
|
*
|
|
116
117
|
* @param name - Current sandbox name.
|
|
117
118
|
* @param options - Fields to update. Omit a field to leave it unchanged.
|
|
118
119
|
* @returns Updated Sandbox. If no fields are provided, returns the current sandbox.
|
|
119
120
|
* @throws LangSmithResourceNotFoundError if sandbox not found.
|
|
120
121
|
* @throws LangSmithResourceNameConflictError if newName is already in use.
|
|
121
|
-
* @throws LangSmithValidationError if
|
|
122
|
+
* @throws LangSmithValidationError if retention values are invalid.
|
|
122
123
|
*/
|
|
123
124
|
updateSandbox(name: string, options: UpdateSandboxOptions): Promise<Sandbox>;
|
|
124
125
|
/**
|
|
@@ -201,12 +201,12 @@ export class SandboxClient {
|
|
|
201
201
|
* ```
|
|
202
202
|
*/
|
|
203
203
|
async createSandbox(snapshotId, options = {}) {
|
|
204
|
-
const { snapshotName, name, timeout = 30, waitForReady = true,
|
|
204
|
+
const { snapshotName, name, timeout = 30, waitForReady = true, idleTtlSeconds, deleteAfterStopSeconds, vCpus, memBytes, fsCapacityBytes, proxyConfig, } = options;
|
|
205
205
|
if (!!snapshotId === !!snapshotName) {
|
|
206
206
|
throw new LangSmithValidationError("Exactly one of snapshotId or options.snapshotName must be set", "snapshotId");
|
|
207
207
|
}
|
|
208
|
-
validateTtl(ttlSeconds, "ttlSeconds");
|
|
209
208
|
validateTtl(idleTtlSeconds, "idleTtlSeconds");
|
|
209
|
+
validateTtl(deleteAfterStopSeconds, "deleteAfterStopSeconds");
|
|
210
210
|
const url = `${this._baseUrl}/boxes`;
|
|
211
211
|
const payload = {
|
|
212
212
|
wait_for_ready: waitForReady,
|
|
@@ -223,12 +223,12 @@ export class SandboxClient {
|
|
|
223
223
|
if (name) {
|
|
224
224
|
payload.name = name;
|
|
225
225
|
}
|
|
226
|
-
if (ttlSeconds !== undefined) {
|
|
227
|
-
payload.ttl_seconds = ttlSeconds;
|
|
228
|
-
}
|
|
229
226
|
if (idleTtlSeconds !== undefined) {
|
|
230
227
|
payload.idle_ttl_seconds = idleTtlSeconds;
|
|
231
228
|
}
|
|
229
|
+
if (deleteAfterStopSeconds !== undefined) {
|
|
230
|
+
payload.delete_after_stop_seconds = deleteAfterStopSeconds;
|
|
231
|
+
}
|
|
232
232
|
if (vCpus !== undefined) {
|
|
233
233
|
payload.vcpus = vCpus;
|
|
234
234
|
}
|
|
@@ -296,12 +296,12 @@ export class SandboxClient {
|
|
|
296
296
|
const options = typeof newNameOrOptions === "string"
|
|
297
297
|
? { newName: newNameOrOptions }
|
|
298
298
|
: newNameOrOptions;
|
|
299
|
-
const { newName,
|
|
300
|
-
validateTtl(ttlSeconds, "ttlSeconds");
|
|
299
|
+
const { newName, idleTtlSeconds, deleteAfterStopSeconds } = options;
|
|
301
300
|
validateTtl(idleTtlSeconds, "idleTtlSeconds");
|
|
301
|
+
validateTtl(deleteAfterStopSeconds, "deleteAfterStopSeconds");
|
|
302
302
|
if (newName === undefined &&
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
idleTtlSeconds === undefined &&
|
|
304
|
+
deleteAfterStopSeconds === undefined) {
|
|
305
305
|
return this.getSandbox(name);
|
|
306
306
|
}
|
|
307
307
|
const url = `${this._baseUrl}/boxes/${encodeURIComponent(name)}`;
|
|
@@ -309,12 +309,12 @@ export class SandboxClient {
|
|
|
309
309
|
if (newName !== undefined) {
|
|
310
310
|
payload.name = newName;
|
|
311
311
|
}
|
|
312
|
-
if (ttlSeconds !== undefined) {
|
|
313
|
-
payload.ttl_seconds = ttlSeconds;
|
|
314
|
-
}
|
|
315
312
|
if (idleTtlSeconds !== undefined) {
|
|
316
313
|
payload.idle_ttl_seconds = idleTtlSeconds;
|
|
317
314
|
}
|
|
315
|
+
if (deleteAfterStopSeconds !== undefined) {
|
|
316
|
+
payload.delete_after_stop_seconds = deleteAfterStopSeconds;
|
|
317
|
+
}
|
|
318
318
|
const response = await this._fetch(url, {
|
|
319
319
|
method: "PATCH",
|
|
320
320
|
headers: { "Content-Type": "application/json" },
|
|
@@ -80,26 +80,34 @@ class Sandbox {
|
|
|
80
80
|
writable: true,
|
|
81
81
|
value: void 0
|
|
82
82
|
});
|
|
83
|
-
/**
|
|
84
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Idle timeout TTL in seconds (`0` means disabled).
|
|
85
|
+
* New sandboxes receive a server-side default of `600` seconds (10 minutes)
|
|
86
|
+
* when the caller did not set `idleTtlSeconds` explicitly. The launcher
|
|
87
|
+
* stops the sandbox after this many idle seconds.
|
|
88
|
+
*/
|
|
89
|
+
Object.defineProperty(this, "idle_ttl_seconds", {
|
|
85
90
|
enumerable: true,
|
|
86
91
|
configurable: true,
|
|
87
92
|
writable: true,
|
|
88
93
|
value: void 0
|
|
89
94
|
});
|
|
90
95
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* when the caller did not set `idleTtlSeconds` explicitly.
|
|
96
|
+
* Seconds after the sandbox enters the `stopped` state before it (and
|
|
97
|
+
* its filesystem clone) are permanently deleted (`0` means disabled).
|
|
94
98
|
*/
|
|
95
|
-
Object.defineProperty(this, "
|
|
99
|
+
Object.defineProperty(this, "delete_after_stop_seconds", {
|
|
96
100
|
enumerable: true,
|
|
97
101
|
configurable: true,
|
|
98
102
|
writable: true,
|
|
99
103
|
value: void 0
|
|
100
104
|
});
|
|
101
|
-
/**
|
|
102
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Timestamp when the sandbox transitioned to `stopped`, or `undefined`
|
|
107
|
+
* while running. The deletion deadline is
|
|
108
|
+
* `stopped_at + delete_after_stop_seconds`.
|
|
109
|
+
*/
|
|
110
|
+
Object.defineProperty(this, "stopped_at", {
|
|
103
111
|
enumerable: true,
|
|
104
112
|
configurable: true,
|
|
105
113
|
writable: true,
|
|
@@ -146,9 +154,9 @@ class Sandbox {
|
|
|
146
154
|
this.id = data.id;
|
|
147
155
|
this.created_at = data.created_at;
|
|
148
156
|
this.updated_at = data.updated_at;
|
|
149
|
-
this.ttl_seconds = data.ttl_seconds;
|
|
150
157
|
this.idle_ttl_seconds = data.idle_ttl_seconds;
|
|
151
|
-
this.
|
|
158
|
+
this.delete_after_stop_seconds = data.delete_after_stop_seconds;
|
|
159
|
+
this.stopped_at = data.stopped_at ?? undefined;
|
|
152
160
|
this.snapshot_id = data.snapshot_id;
|
|
153
161
|
this.vCpus = data.vcpus;
|
|
154
162
|
this.mem_bytes = data.mem_bytes;
|
|
@@ -38,16 +38,24 @@ export declare class Sandbox {
|
|
|
38
38
|
readonly created_at?: string;
|
|
39
39
|
/** Timestamp when the sandbox was last updated. */
|
|
40
40
|
readonly updated_at?: string;
|
|
41
|
-
/** Maximum lifetime TTL in seconds (`0` means disabled). */
|
|
42
|
-
readonly ttl_seconds?: number;
|
|
43
41
|
/**
|
|
44
42
|
* Idle timeout TTL in seconds (`0` means disabled).
|
|
45
43
|
* New sandboxes receive a server-side default of `600` seconds (10 minutes)
|
|
46
|
-
* when the caller did not set `idleTtlSeconds` explicitly.
|
|
44
|
+
* when the caller did not set `idleTtlSeconds` explicitly. The launcher
|
|
45
|
+
* stops the sandbox after this many idle seconds.
|
|
47
46
|
*/
|
|
48
47
|
readonly idle_ttl_seconds?: number;
|
|
49
|
-
/**
|
|
50
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Seconds after the sandbox enters the `stopped` state before it (and
|
|
50
|
+
* its filesystem clone) are permanently deleted (`0` means disabled).
|
|
51
|
+
*/
|
|
52
|
+
readonly delete_after_stop_seconds?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Timestamp when the sandbox transitioned to `stopped`, or `undefined`
|
|
55
|
+
* while running. The deletion deadline is
|
|
56
|
+
* `stopped_at + delete_after_stop_seconds`.
|
|
57
|
+
*/
|
|
58
|
+
readonly stopped_at?: string;
|
|
51
59
|
/** Snapshot ID used to create this sandbox. */
|
|
52
60
|
readonly snapshot_id?: string;
|
|
53
61
|
/** Number of vCPUs allocated. */
|
|
@@ -77,26 +77,34 @@ export class Sandbox {
|
|
|
77
77
|
writable: true,
|
|
78
78
|
value: void 0
|
|
79
79
|
});
|
|
80
|
-
/**
|
|
81
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Idle timeout TTL in seconds (`0` means disabled).
|
|
82
|
+
* New sandboxes receive a server-side default of `600` seconds (10 minutes)
|
|
83
|
+
* when the caller did not set `idleTtlSeconds` explicitly. The launcher
|
|
84
|
+
* stops the sandbox after this many idle seconds.
|
|
85
|
+
*/
|
|
86
|
+
Object.defineProperty(this, "idle_ttl_seconds", {
|
|
82
87
|
enumerable: true,
|
|
83
88
|
configurable: true,
|
|
84
89
|
writable: true,
|
|
85
90
|
value: void 0
|
|
86
91
|
});
|
|
87
92
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* when the caller did not set `idleTtlSeconds` explicitly.
|
|
93
|
+
* Seconds after the sandbox enters the `stopped` state before it (and
|
|
94
|
+
* its filesystem clone) are permanently deleted (`0` means disabled).
|
|
91
95
|
*/
|
|
92
|
-
Object.defineProperty(this, "
|
|
96
|
+
Object.defineProperty(this, "delete_after_stop_seconds", {
|
|
93
97
|
enumerable: true,
|
|
94
98
|
configurable: true,
|
|
95
99
|
writable: true,
|
|
96
100
|
value: void 0
|
|
97
101
|
});
|
|
98
|
-
/**
|
|
99
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Timestamp when the sandbox transitioned to `stopped`, or `undefined`
|
|
104
|
+
* while running. The deletion deadline is
|
|
105
|
+
* `stopped_at + delete_after_stop_seconds`.
|
|
106
|
+
*/
|
|
107
|
+
Object.defineProperty(this, "stopped_at", {
|
|
100
108
|
enumerable: true,
|
|
101
109
|
configurable: true,
|
|
102
110
|
writable: true,
|
|
@@ -143,9 +151,9 @@ export class Sandbox {
|
|
|
143
151
|
this.id = data.id;
|
|
144
152
|
this.created_at = data.created_at;
|
|
145
153
|
this.updated_at = data.updated_at;
|
|
146
|
-
this.ttl_seconds = data.ttl_seconds;
|
|
147
154
|
this.idle_ttl_seconds = data.idle_ttl_seconds;
|
|
148
|
-
this.
|
|
155
|
+
this.delete_after_stop_seconds = data.delete_after_stop_seconds;
|
|
156
|
+
this.stopped_at = data.stopped_at ?? undefined;
|
|
149
157
|
this.snapshot_id = data.snapshot_id;
|
|
150
158
|
this.vCpus = data.vcpus;
|
|
151
159
|
this.mem_bytes = data.mem_bytes;
|
|
@@ -53,12 +53,24 @@ export interface SandboxData {
|
|
|
53
53
|
status_message?: string;
|
|
54
54
|
created_at?: string;
|
|
55
55
|
updated_at?: string;
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Idle timeout in seconds. The launcher stops the sandbox after this
|
|
58
|
+
* many seconds of inactivity. `0` disables the idle stop;
|
|
59
|
+
* omitted/`undefined` means not set (the server applies a default).
|
|
60
|
+
*/
|
|
59
61
|
idle_ttl_seconds?: number;
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Seconds after a sandbox enters the `stopped` state before it (and its
|
|
64
|
+
* filesystem clone) are permanently deleted. `0` disables stop-anchored
|
|
65
|
+
* deletion; omitted/`undefined` falls back to the server default.
|
|
66
|
+
*/
|
|
67
|
+
delete_after_stop_seconds?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Timestamp when the sandbox transitioned to the `stopped` state, or
|
|
70
|
+
* `undefined` while running. The deletion deadline is
|
|
71
|
+
* `stopped_at + delete_after_stop_seconds`.
|
|
72
|
+
*/
|
|
73
|
+
stopped_at?: string;
|
|
62
74
|
/** Snapshot ID used to create this sandbox. */
|
|
63
75
|
snapshot_id?: string;
|
|
64
76
|
/** Number of vCPUs allocated. */
|
|
@@ -264,16 +276,20 @@ export interface CreateSandboxOptions {
|
|
|
264
276
|
*/
|
|
265
277
|
waitForReady?: boolean;
|
|
266
278
|
/**
|
|
267
|
-
*
|
|
268
|
-
*
|
|
279
|
+
* Idle timeout in seconds. The launcher stops the sandbox after this many
|
|
280
|
+
* seconds of inactivity. Must be a multiple of 60. Pass `0` to disable
|
|
281
|
+
* the idle stop. When omitted, the server applies a default of `600`
|
|
282
|
+
* seconds (10 minutes).
|
|
269
283
|
*/
|
|
270
|
-
|
|
284
|
+
idleTtlSeconds?: number;
|
|
271
285
|
/**
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
286
|
+
* Seconds after the sandbox enters the `stopped` state before it (and
|
|
287
|
+
* its filesystem clone) are permanently deleted. Must be a multiple of
|
|
288
|
+
* 60. Pass `0` to disable stop-anchored deletion (manual cleanup
|
|
289
|
+
* required). When omitted, the server applies its configured default
|
|
290
|
+
* (typically 14 days).
|
|
275
291
|
*/
|
|
276
|
-
|
|
292
|
+
deleteAfterStopSeconds?: number;
|
|
277
293
|
/** Number of vCPUs. */
|
|
278
294
|
vCpus?: number;
|
|
279
295
|
/** Memory in bytes. */
|
|
@@ -363,21 +379,23 @@ export interface StartSandboxOptions {
|
|
|
363
379
|
signal?: AbortSignal;
|
|
364
380
|
}
|
|
365
381
|
/**
|
|
366
|
-
* Options for updating a sandbox (name and/or
|
|
382
|
+
* Options for updating a sandbox (name and/or retention settings).
|
|
367
383
|
*/
|
|
368
384
|
export interface UpdateSandboxOptions {
|
|
369
385
|
/** New display name. */
|
|
370
386
|
newName?: string;
|
|
371
387
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
388
|
+
* Idle timeout in seconds. Must be a multiple of 60. Pass `0` to disable
|
|
389
|
+
* the idle stop. Omit (or pass `undefined`) to leave the existing value
|
|
390
|
+
* unchanged.
|
|
374
391
|
*/
|
|
375
|
-
|
|
392
|
+
idleTtlSeconds?: number;
|
|
376
393
|
/**
|
|
377
|
-
*
|
|
378
|
-
*
|
|
394
|
+
* Seconds after entering `stopped` before deletion. Must be a multiple
|
|
395
|
+
* of 60. Pass `0` to disable stop-anchored deletion. Omit (or pass
|
|
396
|
+
* `undefined`) to leave the existing value unchanged.
|
|
379
397
|
*/
|
|
380
|
-
|
|
398
|
+
deleteAfterStopSeconds?: number;
|
|
381
399
|
}
|
|
382
400
|
/**
|
|
383
401
|
* Options for waiting for a sandbox to become ready.
|
package/dist/index.cjs
CHANGED
|
@@ -18,4 +18,4 @@ Object.defineProperty(exports, "PromptCache", { enumerable: true, get: function
|
|
|
18
18
|
Object.defineProperty(exports, "configureGlobalPromptCache", { enumerable: true, get: function () { return index_js_1.configureGlobalPromptCache; } });
|
|
19
19
|
Object.defineProperty(exports, "promptCacheSingleton", { enumerable: true, get: function () { return index_js_1.promptCacheSingleton; } });
|
|
20
20
|
// Update using pnpm bump-version
|
|
21
|
-
exports.__version__ = "0.6.
|
|
21
|
+
exports.__version__ = "0.6.3";
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export { overrideFetchImplementation } from "./singletons/fetch.js";
|
|
|
5
5
|
export { getDefaultProjectName } from "./utils/project.js";
|
|
6
6
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
7
7
|
export { Cache, PromptCache, type CacheConfig, type CacheMetrics, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
8
|
-
export declare const __version__ = "0.6.
|
|
8
|
+
export declare const __version__ = "0.6.3";
|
package/dist/index.js
CHANGED
|
@@ -5,4 +5,4 @@ export { getDefaultProjectName } from "./utils/project.js";
|
|
|
5
5
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
6
6
|
export { Cache, PromptCache, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
7
7
|
// Update using pnpm bump-version
|
|
8
|
-
export const __version__ = "0.6.
|
|
8
|
+
export const __version__ = "0.6.3";
|