@to11ai/sdk 0.5.0 → 0.7.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/client.d.ts +1 -1
- package/dist/gateway.cjs +110 -0
- package/dist/gateway.d.ts +104 -1
- package/dist/gateway.js +110 -0
- package/dist/generated/index.d.ts +1 -1
- package/dist/generated/types.gen.d.ts +88 -14
- package/dist/generated/zod.gen.d.ts +226 -27
- package/dist/prompts/cache.d.ts +1 -1
- package/dist/prompts/resource.cjs +10 -3
- package/dist/prompts/resource.d.ts +1 -1
- package/dist/prompts/resource.js +10 -3
- package/dist/prompts/types.d.ts +32 -2
- package/package.json +1 -1
- package/src/client.ts +1 -0
- package/src/gateway.ts +235 -0
- package/src/generated/index.ts +1 -1
- package/src/generated/types.gen.ts +94 -14
- package/src/generated/zod.gen.ts +110 -19
- package/src/prompts/cache.ts +4 -1
- package/src/prompts/resource.ts +12 -0
- package/src/prompts/types.ts +42 -1
|
@@ -245,18 +245,30 @@ export type PromptVersion = {
|
|
|
245
245
|
variablesSchema: unknown;
|
|
246
246
|
version: number;
|
|
247
247
|
};
|
|
248
|
+
export type RenderedAssistantMessage = {
|
|
249
|
+
content?: string | null;
|
|
250
|
+
role: 'assistant';
|
|
251
|
+
toolCalls?: Array<ResolvedToolCall> | null;
|
|
252
|
+
};
|
|
253
|
+
export type RenderedChatMessage = RenderedTextMessage | RenderedAssistantMessage | RenderedToolMessage;
|
|
248
254
|
export type RenderedChatPrompt = {
|
|
249
255
|
format: 'chat';
|
|
250
|
-
messages: Array<
|
|
251
|
-
content: string;
|
|
252
|
-
role: 'system' | 'user' | 'assistant' | 'developer' | 'tool';
|
|
253
|
-
}>;
|
|
256
|
+
messages: Array<RenderedChatMessage>;
|
|
254
257
|
};
|
|
255
258
|
export type RenderedPrompt = RenderedTextPrompt | RenderedChatPrompt;
|
|
259
|
+
export type RenderedTextMessage = {
|
|
260
|
+
content: string;
|
|
261
|
+
role: 'system' | 'user' | 'developer';
|
|
262
|
+
};
|
|
256
263
|
export type RenderedTextPrompt = {
|
|
257
264
|
format: 'text';
|
|
258
265
|
text: string;
|
|
259
266
|
};
|
|
267
|
+
export type RenderedToolMessage = {
|
|
268
|
+
content: string;
|
|
269
|
+
role: 'tool';
|
|
270
|
+
toolCallId: string;
|
|
271
|
+
};
|
|
260
272
|
export type ResolvedPrompt = {
|
|
261
273
|
blockRenderRecord?: {
|
|
262
274
|
[key: string]: 'rendered' | 'dimmed';
|
|
@@ -267,10 +279,25 @@ export type ResolvedPrompt = {
|
|
|
267
279
|
releaseId: string;
|
|
268
280
|
rendered: RenderedPrompt;
|
|
269
281
|
subjectHash?: string | null;
|
|
282
|
+
tools?: Array<ResolvedToolDefinition> | null;
|
|
270
283
|
variantName?: string | null;
|
|
271
284
|
version: number;
|
|
272
285
|
versionId: string;
|
|
273
286
|
};
|
|
287
|
+
export type ResolvedToolCall = {
|
|
288
|
+
arguments: {
|
|
289
|
+
[key: string]: unknown;
|
|
290
|
+
};
|
|
291
|
+
id: string;
|
|
292
|
+
name: string;
|
|
293
|
+
};
|
|
294
|
+
export type ResolvedToolDefinition = {
|
|
295
|
+
description?: string | null;
|
|
296
|
+
name: string;
|
|
297
|
+
parameters: {
|
|
298
|
+
[key: string]: unknown;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
274
301
|
export type RuleModelBinding = {
|
|
275
302
|
modelId: string;
|
|
276
303
|
provider: RuleProviderRef;
|
|
@@ -9343,7 +9370,7 @@ export type ProjectAuditListProjectAuditEventsResponses = {
|
|
|
9343
9370
|
providerSlug: string | null;
|
|
9344
9371
|
reason: string | null;
|
|
9345
9372
|
resourceId: string;
|
|
9346
|
-
resourceType: 'provider' | 'credential' | 'prompt' | 'rule' | 'env';
|
|
9373
|
+
resourceType: 'provider' | 'credential' | 'prompt' | 'rule' | 'env' | 'role' | 'api_key' | 'project' | 'organization' | 'organization_invitation' | 'workspace' | 'data_center' | 'cost_rate';
|
|
9347
9374
|
scheduledAt: string | null;
|
|
9348
9375
|
scheduledBy: string | null;
|
|
9349
9376
|
}>;
|
|
@@ -9388,7 +9415,7 @@ export type ProjectAuditExportExportProjectAuditEventsData = {
|
|
|
9388
9415
|
provider_id?: string | null;
|
|
9389
9416
|
credential_id?: string | null;
|
|
9390
9417
|
actor_id?: string | null;
|
|
9391
|
-
resource_type?: 'provider' | 'credential' | 'prompt' | 'rule' | 'env' | null;
|
|
9418
|
+
resource_type?: 'provider' | 'credential' | 'prompt' | 'rule' | 'env' | 'role' | 'api_key' | 'project' | 'organization' | 'organization_invitation' | 'workspace' | 'data_center' | 'cost_rate' | null;
|
|
9392
9419
|
event_type?: string | null;
|
|
9393
9420
|
since?: string | null;
|
|
9394
9421
|
until?: string | null;
|
|
@@ -14713,11 +14740,21 @@ export type PromptsGetPromptVersionDiffResponses = {
|
|
|
14713
14740
|
name: string;
|
|
14714
14741
|
op: 'add';
|
|
14715
14742
|
role: 'system' | 'user' | 'assistant' | 'developer' | 'tool';
|
|
14743
|
+
toolCalls?: Array<{
|
|
14744
|
+
arguments: {
|
|
14745
|
+
[key: string]: unknown;
|
|
14746
|
+
};
|
|
14747
|
+
id: string;
|
|
14748
|
+
name: string;
|
|
14749
|
+
}> | null;
|
|
14716
14750
|
toolSchema?: {
|
|
14751
|
+
content?: string | null;
|
|
14717
14752
|
description?: string | null;
|
|
14718
|
-
parameters
|
|
14753
|
+
parameters?: {
|
|
14719
14754
|
[key: string]: unknown;
|
|
14720
|
-
};
|
|
14755
|
+
} | null;
|
|
14756
|
+
toolCallId?: string | null;
|
|
14757
|
+
toolKind?: 'definition' | 'result' | null;
|
|
14721
14758
|
} | null;
|
|
14722
14759
|
} | {
|
|
14723
14760
|
condition: {
|
|
@@ -14727,11 +14764,21 @@ export type PromptsGetPromptVersionDiffResponses = {
|
|
|
14727
14764
|
name: string;
|
|
14728
14765
|
op: 'remove';
|
|
14729
14766
|
role: 'system' | 'user' | 'assistant' | 'developer' | 'tool';
|
|
14767
|
+
toolCalls?: Array<{
|
|
14768
|
+
arguments: {
|
|
14769
|
+
[key: string]: unknown;
|
|
14770
|
+
};
|
|
14771
|
+
id: string;
|
|
14772
|
+
name: string;
|
|
14773
|
+
}> | null;
|
|
14730
14774
|
toolSchema?: {
|
|
14775
|
+
content?: string | null;
|
|
14731
14776
|
description?: string | null;
|
|
14732
|
-
parameters
|
|
14777
|
+
parameters?: {
|
|
14733
14778
|
[key: string]: unknown;
|
|
14734
|
-
};
|
|
14779
|
+
} | null;
|
|
14780
|
+
toolCallId?: string | null;
|
|
14781
|
+
toolKind?: 'definition' | 'result' | null;
|
|
14735
14782
|
} | null;
|
|
14736
14783
|
} | {
|
|
14737
14784
|
after: string;
|
|
@@ -14759,19 +14806,42 @@ export type PromptsGetPromptVersionDiffResponses = {
|
|
|
14759
14806
|
op: 'edit_required';
|
|
14760
14807
|
} | {
|
|
14761
14808
|
after: {
|
|
14809
|
+
content?: string | null;
|
|
14762
14810
|
description?: string | null;
|
|
14763
|
-
parameters
|
|
14811
|
+
parameters?: {
|
|
14764
14812
|
[key: string]: unknown;
|
|
14765
|
-
};
|
|
14813
|
+
} | null;
|
|
14814
|
+
toolCallId?: string | null;
|
|
14815
|
+
toolKind?: 'definition' | 'result' | null;
|
|
14766
14816
|
};
|
|
14767
14817
|
before: {
|
|
14818
|
+
content?: string | null;
|
|
14768
14819
|
description?: string | null;
|
|
14769
|
-
parameters
|
|
14820
|
+
parameters?: {
|
|
14770
14821
|
[key: string]: unknown;
|
|
14771
|
-
};
|
|
14822
|
+
} | null;
|
|
14823
|
+
toolCallId?: string | null;
|
|
14824
|
+
toolKind?: 'definition' | 'result' | null;
|
|
14772
14825
|
};
|
|
14773
14826
|
name: string;
|
|
14774
14827
|
op: 'edit_tool_schema';
|
|
14828
|
+
} | {
|
|
14829
|
+
after: Array<{
|
|
14830
|
+
arguments: {
|
|
14831
|
+
[key: string]: unknown;
|
|
14832
|
+
};
|
|
14833
|
+
id: string;
|
|
14834
|
+
name: string;
|
|
14835
|
+
}>;
|
|
14836
|
+
before: Array<{
|
|
14837
|
+
arguments: {
|
|
14838
|
+
[key: string]: unknown;
|
|
14839
|
+
};
|
|
14840
|
+
id: string;
|
|
14841
|
+
name: string;
|
|
14842
|
+
}>;
|
|
14843
|
+
name: string;
|
|
14844
|
+
op: 'edit_tool_calls';
|
|
14775
14845
|
} | {
|
|
14776
14846
|
fromIndex: number;
|
|
14777
14847
|
name: string;
|
|
@@ -15218,6 +15288,7 @@ export type PromptsResolvePromptData = {
|
|
|
15218
15288
|
context?: {
|
|
15219
15289
|
[key: string]: string | number | boolean;
|
|
15220
15290
|
} | null;
|
|
15291
|
+
developerRole?: 'user' | 'developer' | 'system' | null;
|
|
15221
15292
|
labels: Array<string>;
|
|
15222
15293
|
slug: string;
|
|
15223
15294
|
subject?: string | null;
|
|
@@ -17614,10 +17685,13 @@ export type RoutingMetricsGetRoutingProviderMetricsResponses = {
|
|
|
17614
17685
|
data: Array<{
|
|
17615
17686
|
calls7dTotal: number;
|
|
17616
17687
|
daily: Array<number>;
|
|
17688
|
+
errorCount: number;
|
|
17689
|
+
errorRate: number;
|
|
17617
17690
|
latencyP50Ms: number | null;
|
|
17618
17691
|
latencyP95Ms: number | null;
|
|
17619
17692
|
providerId: string;
|
|
17620
17693
|
requests: number;
|
|
17694
|
+
spend7dUsd: number | null;
|
|
17621
17695
|
}> | null;
|
|
17622
17696
|
error: {
|
|
17623
17697
|
code: string;
|
|
@@ -316,26 +316,95 @@ export declare const zPromptVersion: z.ZodObject<{
|
|
|
316
316
|
variablesSchema: z.ZodUnknown;
|
|
317
317
|
version: z.ZodInt;
|
|
318
318
|
}, z.core.$strip>;
|
|
319
|
+
export declare const zRenderedTextMessage: z.ZodObject<{
|
|
320
|
+
content: z.ZodString;
|
|
321
|
+
role: z.ZodEnum<{
|
|
322
|
+
user: "user";
|
|
323
|
+
system: "system";
|
|
324
|
+
developer: "developer";
|
|
325
|
+
}>;
|
|
326
|
+
}, z.core.$strip>;
|
|
327
|
+
export declare const zRenderedTextPrompt: z.ZodObject<{
|
|
328
|
+
format: z.ZodEnum<{
|
|
329
|
+
text: "text";
|
|
330
|
+
}>;
|
|
331
|
+
text: z.ZodString;
|
|
332
|
+
}, z.core.$strip>;
|
|
333
|
+
export declare const zRenderedToolMessage: z.ZodObject<{
|
|
334
|
+
content: z.ZodString;
|
|
335
|
+
role: z.ZodEnum<{
|
|
336
|
+
tool: "tool";
|
|
337
|
+
}>;
|
|
338
|
+
toolCallId: z.ZodString;
|
|
339
|
+
}, z.core.$strip>;
|
|
340
|
+
export declare const zResolvedToolCall: z.ZodObject<{
|
|
341
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
342
|
+
id: z.ZodString;
|
|
343
|
+
name: z.ZodString;
|
|
344
|
+
}, z.core.$strip>;
|
|
345
|
+
export declare const zRenderedAssistantMessage: z.ZodObject<{
|
|
346
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
347
|
+
role: z.ZodEnum<{
|
|
348
|
+
assistant: "assistant";
|
|
349
|
+
}>;
|
|
350
|
+
toolCalls: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
351
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
352
|
+
id: z.ZodString;
|
|
353
|
+
name: z.ZodString;
|
|
354
|
+
}, z.core.$strip>>>>;
|
|
355
|
+
}, z.core.$strip>;
|
|
356
|
+
export declare const zRenderedChatMessage: z.ZodUnion<readonly [z.ZodObject<{
|
|
357
|
+
content: z.ZodString;
|
|
358
|
+
role: z.ZodEnum<{
|
|
359
|
+
user: "user";
|
|
360
|
+
system: "system";
|
|
361
|
+
developer: "developer";
|
|
362
|
+
}>;
|
|
363
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
364
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
365
|
+
role: z.ZodEnum<{
|
|
366
|
+
assistant: "assistant";
|
|
367
|
+
}>;
|
|
368
|
+
toolCalls: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
369
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
370
|
+
id: z.ZodString;
|
|
371
|
+
name: z.ZodString;
|
|
372
|
+
}, z.core.$strip>>>>;
|
|
373
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
374
|
+
content: z.ZodString;
|
|
375
|
+
role: z.ZodEnum<{
|
|
376
|
+
tool: "tool";
|
|
377
|
+
}>;
|
|
378
|
+
toolCallId: z.ZodString;
|
|
379
|
+
}, z.core.$strip>]>;
|
|
319
380
|
export declare const zRenderedChatPrompt: z.ZodObject<{
|
|
320
381
|
format: z.ZodEnum<{
|
|
321
382
|
chat: "chat";
|
|
322
383
|
}>;
|
|
323
|
-
messages: z.ZodArray<z.ZodObject<{
|
|
384
|
+
messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
324
385
|
content: z.ZodString;
|
|
325
386
|
role: z.ZodEnum<{
|
|
326
387
|
user: "user";
|
|
327
388
|
system: "system";
|
|
328
|
-
assistant: "assistant";
|
|
329
389
|
developer: "developer";
|
|
390
|
+
}>;
|
|
391
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
392
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
393
|
+
role: z.ZodEnum<{
|
|
394
|
+
assistant: "assistant";
|
|
395
|
+
}>;
|
|
396
|
+
toolCalls: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
397
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
398
|
+
id: z.ZodString;
|
|
399
|
+
name: z.ZodString;
|
|
400
|
+
}, z.core.$strip>>>>;
|
|
401
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
402
|
+
content: z.ZodString;
|
|
403
|
+
role: z.ZodEnum<{
|
|
330
404
|
tool: "tool";
|
|
331
405
|
}>;
|
|
332
|
-
|
|
333
|
-
}, z.core.$strip
|
|
334
|
-
export declare const zRenderedTextPrompt: z.ZodObject<{
|
|
335
|
-
format: z.ZodEnum<{
|
|
336
|
-
text: "text";
|
|
337
|
-
}>;
|
|
338
|
-
text: z.ZodString;
|
|
406
|
+
toolCallId: z.ZodString;
|
|
407
|
+
}, z.core.$strip>]>>;
|
|
339
408
|
}, z.core.$strip>;
|
|
340
409
|
export declare const zRenderedPrompt: z.ZodUnion<readonly [z.ZodObject<{
|
|
341
410
|
format: z.ZodEnum<{
|
|
@@ -346,17 +415,36 @@ export declare const zRenderedPrompt: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
346
415
|
format: z.ZodEnum<{
|
|
347
416
|
chat: "chat";
|
|
348
417
|
}>;
|
|
349
|
-
messages: z.ZodArray<z.ZodObject<{
|
|
418
|
+
messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
350
419
|
content: z.ZodString;
|
|
351
420
|
role: z.ZodEnum<{
|
|
352
421
|
user: "user";
|
|
353
422
|
system: "system";
|
|
354
|
-
assistant: "assistant";
|
|
355
423
|
developer: "developer";
|
|
424
|
+
}>;
|
|
425
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
426
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
427
|
+
role: z.ZodEnum<{
|
|
428
|
+
assistant: "assistant";
|
|
429
|
+
}>;
|
|
430
|
+
toolCalls: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
431
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
432
|
+
id: z.ZodString;
|
|
433
|
+
name: z.ZodString;
|
|
434
|
+
}, z.core.$strip>>>>;
|
|
435
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
436
|
+
content: z.ZodString;
|
|
437
|
+
role: z.ZodEnum<{
|
|
356
438
|
tool: "tool";
|
|
357
439
|
}>;
|
|
358
|
-
|
|
440
|
+
toolCallId: z.ZodString;
|
|
441
|
+
}, z.core.$strip>]>>;
|
|
359
442
|
}, z.core.$strip>]>;
|
|
443
|
+
export declare const zResolvedToolDefinition: z.ZodObject<{
|
|
444
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
445
|
+
name: z.ZodString;
|
|
446
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
447
|
+
}, z.core.$strip>;
|
|
360
448
|
export declare const zResolvedPrompt: z.ZodObject<{
|
|
361
449
|
blockRenderRecord: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
362
450
|
rendered: "rendered";
|
|
@@ -375,18 +463,37 @@ export declare const zResolvedPrompt: z.ZodObject<{
|
|
|
375
463
|
format: z.ZodEnum<{
|
|
376
464
|
chat: "chat";
|
|
377
465
|
}>;
|
|
378
|
-
messages: z.ZodArray<z.ZodObject<{
|
|
466
|
+
messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
379
467
|
content: z.ZodString;
|
|
380
468
|
role: z.ZodEnum<{
|
|
381
469
|
user: "user";
|
|
382
470
|
system: "system";
|
|
383
|
-
assistant: "assistant";
|
|
384
471
|
developer: "developer";
|
|
472
|
+
}>;
|
|
473
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
474
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
475
|
+
role: z.ZodEnum<{
|
|
476
|
+
assistant: "assistant";
|
|
477
|
+
}>;
|
|
478
|
+
toolCalls: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
479
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
480
|
+
id: z.ZodString;
|
|
481
|
+
name: z.ZodString;
|
|
482
|
+
}, z.core.$strip>>>>;
|
|
483
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
484
|
+
content: z.ZodString;
|
|
485
|
+
role: z.ZodEnum<{
|
|
385
486
|
tool: "tool";
|
|
386
487
|
}>;
|
|
387
|
-
|
|
488
|
+
toolCallId: z.ZodString;
|
|
489
|
+
}, z.core.$strip>]>>;
|
|
388
490
|
}, z.core.$strip>]>;
|
|
389
491
|
subjectHash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
492
|
+
tools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
493
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
494
|
+
name: z.ZodString;
|
|
495
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
496
|
+
}, z.core.$strip>>>>;
|
|
390
497
|
variantName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
391
498
|
version: z.ZodNumber;
|
|
392
499
|
versionId: z.ZodString;
|
|
@@ -5206,11 +5313,19 @@ export declare const zProjectAuditListProjectAuditEventsResponse: z.ZodObject<{
|
|
|
5206
5313
|
reason: z.ZodNullable<z.ZodString>;
|
|
5207
5314
|
resourceId: z.ZodString;
|
|
5208
5315
|
resourceType: z.ZodEnum<{
|
|
5316
|
+
api_key: "api_key";
|
|
5317
|
+
role: "role";
|
|
5209
5318
|
provider: "provider";
|
|
5319
|
+
workspace: "workspace";
|
|
5320
|
+
project: "project";
|
|
5210
5321
|
credential: "credential";
|
|
5322
|
+
organization: "organization";
|
|
5211
5323
|
prompt: "prompt";
|
|
5212
5324
|
rule: "rule";
|
|
5213
5325
|
env: "env";
|
|
5326
|
+
organization_invitation: "organization_invitation";
|
|
5327
|
+
data_center: "data_center";
|
|
5328
|
+
cost_rate: "cost_rate";
|
|
5214
5329
|
}>;
|
|
5215
5330
|
scheduledAt: z.ZodNullable<z.ZodString>;
|
|
5216
5331
|
scheduledBy: z.ZodNullable<z.ZodString>;
|
|
@@ -5254,11 +5369,19 @@ export declare const zProjectAuditExportExportProjectAuditEventsQuery: z.ZodObje
|
|
|
5254
5369
|
credential_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5255
5370
|
actor_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5256
5371
|
resource_type: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
5372
|
+
api_key: "api_key";
|
|
5373
|
+
role: "role";
|
|
5257
5374
|
provider: "provider";
|
|
5375
|
+
workspace: "workspace";
|
|
5376
|
+
project: "project";
|
|
5258
5377
|
credential: "credential";
|
|
5378
|
+
organization: "organization";
|
|
5259
5379
|
prompt: "prompt";
|
|
5260
5380
|
rule: "rule";
|
|
5261
5381
|
env: "env";
|
|
5382
|
+
organization_invitation: "organization_invitation";
|
|
5383
|
+
data_center: "data_center";
|
|
5384
|
+
cost_rate: "cost_rate";
|
|
5262
5385
|
}>>>;
|
|
5263
5386
|
event_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5264
5387
|
since: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -8378,13 +8501,24 @@ export declare const zPromptsGetPromptVersionDiffResponse: z.ZodObject<{
|
|
|
8378
8501
|
role: z.ZodEnum<{
|
|
8379
8502
|
user: "user";
|
|
8380
8503
|
system: "system";
|
|
8381
|
-
assistant: "assistant";
|
|
8382
8504
|
developer: "developer";
|
|
8383
8505
|
tool: "tool";
|
|
8506
|
+
assistant: "assistant";
|
|
8384
8507
|
}>;
|
|
8508
|
+
toolCalls: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
8509
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
8510
|
+
id: z.ZodString;
|
|
8511
|
+
name: z.ZodString;
|
|
8512
|
+
}, z.core.$strip>>>>;
|
|
8385
8513
|
toolSchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
8514
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8386
8515
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8387
|
-
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
8516
|
+
parameters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
8517
|
+
toolCallId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8518
|
+
toolKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
8519
|
+
definition: "definition";
|
|
8520
|
+
result: "result";
|
|
8521
|
+
}>>>;
|
|
8388
8522
|
}, z.core.$strip>>>;
|
|
8389
8523
|
}, z.core.$strip>, z.ZodObject<{
|
|
8390
8524
|
condition: z.ZodObject<{
|
|
@@ -8398,13 +8532,24 @@ export declare const zPromptsGetPromptVersionDiffResponse: z.ZodObject<{
|
|
|
8398
8532
|
role: z.ZodEnum<{
|
|
8399
8533
|
user: "user";
|
|
8400
8534
|
system: "system";
|
|
8401
|
-
assistant: "assistant";
|
|
8402
8535
|
developer: "developer";
|
|
8403
8536
|
tool: "tool";
|
|
8537
|
+
assistant: "assistant";
|
|
8404
8538
|
}>;
|
|
8539
|
+
toolCalls: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
8540
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
8541
|
+
id: z.ZodString;
|
|
8542
|
+
name: z.ZodString;
|
|
8543
|
+
}, z.core.$strip>>>>;
|
|
8405
8544
|
toolSchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
8545
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8406
8546
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8407
|
-
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
8547
|
+
parameters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
8548
|
+
toolCallId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8549
|
+
toolKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
8550
|
+
definition: "definition";
|
|
8551
|
+
result: "result";
|
|
8552
|
+
}>>>;
|
|
8408
8553
|
}, z.core.$strip>>>;
|
|
8409
8554
|
}, z.core.$strip>, z.ZodObject<{
|
|
8410
8555
|
after: z.ZodString;
|
|
@@ -8428,16 +8573,16 @@ export declare const zPromptsGetPromptVersionDiffResponse: z.ZodObject<{
|
|
|
8428
8573
|
after: z.ZodEnum<{
|
|
8429
8574
|
user: "user";
|
|
8430
8575
|
system: "system";
|
|
8431
|
-
assistant: "assistant";
|
|
8432
8576
|
developer: "developer";
|
|
8433
8577
|
tool: "tool";
|
|
8578
|
+
assistant: "assistant";
|
|
8434
8579
|
}>;
|
|
8435
8580
|
before: z.ZodEnum<{
|
|
8436
8581
|
user: "user";
|
|
8437
8582
|
system: "system";
|
|
8438
|
-
assistant: "assistant";
|
|
8439
8583
|
developer: "developer";
|
|
8440
8584
|
tool: "tool";
|
|
8585
|
+
assistant: "assistant";
|
|
8441
8586
|
}>;
|
|
8442
8587
|
name: z.ZodString;
|
|
8443
8588
|
op: z.ZodEnum<{
|
|
@@ -8452,17 +8597,44 @@ export declare const zPromptsGetPromptVersionDiffResponse: z.ZodObject<{
|
|
|
8452
8597
|
}>;
|
|
8453
8598
|
}, z.core.$strip>, z.ZodObject<{
|
|
8454
8599
|
after: z.ZodObject<{
|
|
8600
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8455
8601
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8456
|
-
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
8602
|
+
parameters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
8603
|
+
toolCallId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8604
|
+
toolKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
8605
|
+
definition: "definition";
|
|
8606
|
+
result: "result";
|
|
8607
|
+
}>>>;
|
|
8457
8608
|
}, z.core.$strip>;
|
|
8458
8609
|
before: z.ZodObject<{
|
|
8610
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8459
8611
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8460
|
-
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
8612
|
+
parameters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
8613
|
+
toolCallId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8614
|
+
toolKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
8615
|
+
definition: "definition";
|
|
8616
|
+
result: "result";
|
|
8617
|
+
}>>>;
|
|
8461
8618
|
}, z.core.$strip>;
|
|
8462
8619
|
name: z.ZodString;
|
|
8463
8620
|
op: z.ZodEnum<{
|
|
8464
8621
|
edit_tool_schema: "edit_tool_schema";
|
|
8465
8622
|
}>;
|
|
8623
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
8624
|
+
after: z.ZodArray<z.ZodObject<{
|
|
8625
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
8626
|
+
id: z.ZodString;
|
|
8627
|
+
name: z.ZodString;
|
|
8628
|
+
}, z.core.$strip>>;
|
|
8629
|
+
before: z.ZodArray<z.ZodObject<{
|
|
8630
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
8631
|
+
id: z.ZodString;
|
|
8632
|
+
name: z.ZodString;
|
|
8633
|
+
}, z.core.$strip>>;
|
|
8634
|
+
name: z.ZodString;
|
|
8635
|
+
op: z.ZodEnum<{
|
|
8636
|
+
edit_tool_calls: "edit_tool_calls";
|
|
8637
|
+
}>;
|
|
8466
8638
|
}, z.core.$strip>, z.ZodObject<{
|
|
8467
8639
|
fromIndex: z.ZodNumber;
|
|
8468
8640
|
name: z.ZodString;
|
|
@@ -8718,6 +8890,11 @@ export declare const zPromptsWithdrawPromptReviewResponse: z.ZodObject<{
|
|
|
8718
8890
|
}, z.core.$strip>;
|
|
8719
8891
|
export declare const zPromptsResolvePromptBody: z.ZodObject<{
|
|
8720
8892
|
context: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>;
|
|
8893
|
+
developerRole: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
8894
|
+
user: "user";
|
|
8895
|
+
system: "system";
|
|
8896
|
+
developer: "developer";
|
|
8897
|
+
}>>>;
|
|
8721
8898
|
labels: z.ZodArray<z.ZodString>;
|
|
8722
8899
|
slug: z.ZodString;
|
|
8723
8900
|
subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -8749,18 +8926,37 @@ export declare const zPromptsResolvePromptResponse: z.ZodObject<{
|
|
|
8749
8926
|
format: z.ZodEnum<{
|
|
8750
8927
|
chat: "chat";
|
|
8751
8928
|
}>;
|
|
8752
|
-
messages: z.ZodArray<z.ZodObject<{
|
|
8929
|
+
messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
8753
8930
|
content: z.ZodString;
|
|
8754
8931
|
role: z.ZodEnum<{
|
|
8755
8932
|
user: "user";
|
|
8756
8933
|
system: "system";
|
|
8757
|
-
assistant: "assistant";
|
|
8758
8934
|
developer: "developer";
|
|
8935
|
+
}>;
|
|
8936
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
8937
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8938
|
+
role: z.ZodEnum<{
|
|
8939
|
+
assistant: "assistant";
|
|
8940
|
+
}>;
|
|
8941
|
+
toolCalls: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
8942
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
8943
|
+
id: z.ZodString;
|
|
8944
|
+
name: z.ZodString;
|
|
8945
|
+
}, z.core.$strip>>>>;
|
|
8946
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
8947
|
+
content: z.ZodString;
|
|
8948
|
+
role: z.ZodEnum<{
|
|
8759
8949
|
tool: "tool";
|
|
8760
8950
|
}>;
|
|
8761
|
-
|
|
8951
|
+
toolCallId: z.ZodString;
|
|
8952
|
+
}, z.core.$strip>]>>;
|
|
8762
8953
|
}, z.core.$strip>]>;
|
|
8763
8954
|
subjectHash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8955
|
+
tools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
8956
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8957
|
+
name: z.ZodString;
|
|
8958
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
8959
|
+
}, z.core.$strip>>>>;
|
|
8764
8960
|
variantName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8765
8961
|
version: z.ZodNumber;
|
|
8766
8962
|
versionId: z.ZodString;
|
|
@@ -10197,10 +10393,13 @@ export declare const zRoutingMetricsGetRoutingProviderMetricsResponse: z.ZodObje
|
|
|
10197
10393
|
data: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
10198
10394
|
calls7dTotal: z.ZodNumber;
|
|
10199
10395
|
daily: z.ZodArray<z.ZodNumber>;
|
|
10396
|
+
errorCount: z.ZodNumber;
|
|
10397
|
+
errorRate: z.ZodNumber;
|
|
10200
10398
|
latencyP50Ms: z.ZodNullable<z.ZodNumber>;
|
|
10201
10399
|
latencyP95Ms: z.ZodNullable<z.ZodNumber>;
|
|
10202
10400
|
providerId: z.ZodString;
|
|
10203
10401
|
requests: z.ZodNumber;
|
|
10402
|
+
spend7dUsd: z.ZodNullable<z.ZodNumber>;
|
|
10204
10403
|
}, z.core.$strip>>>;
|
|
10205
10404
|
error: z.ZodNullable<z.ZodObject<{
|
|
10206
10405
|
code: z.ZodString;
|
|
@@ -13135,13 +13334,13 @@ export declare const zTracesListTracesQuery: z.ZodObject<{
|
|
|
13135
13334
|
page: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13136
13335
|
limit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13137
13336
|
sort: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
13337
|
+
toolCalls: "toolCalls";
|
|
13138
13338
|
provider: "provider";
|
|
13139
13339
|
model: "model";
|
|
13140
13340
|
durationMs: "durationMs";
|
|
13141
13341
|
startTime: "startTime";
|
|
13142
13342
|
inputTokens: "inputTokens";
|
|
13143
13343
|
outputTokens: "outputTokens";
|
|
13144
|
-
toolCalls: "toolCalls";
|
|
13145
13344
|
costUsd: "costUsd";
|
|
13146
13345
|
}>>>;
|
|
13147
13346
|
order: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
package/dist/prompts/cache.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare function buildCacheKey(projectId: string, slug: string, labels: s
|
|
|
38
38
|
* caches as the same deterministic variant on repeat (D8); the
|
|
39
39
|
* weighted-no-subject bypass is handled in the resource, not here.
|
|
40
40
|
*/
|
|
41
|
-
export declare function buildFetchCacheKey(projectId: string, slug: string, env: string, context?: PromptContext, subject?: string, variables?: Record<string, unknown
|
|
41
|
+
export declare function buildFetchCacheKey(projectId: string, slug: string, env: string, context?: PromptContext, subject?: string, variables?: Record<string, unknown>, developerRole?: string): string;
|
|
42
42
|
/**
|
|
43
43
|
* In-memory LRU cache for ResolvedPrompt objects.
|
|
44
44
|
*
|
|
@@ -53,7 +53,8 @@ var zResolvedPromptLegacy = import_zod2.zResolvedPrompt.pick({
|
|
|
53
53
|
version: true,
|
|
54
54
|
labels: true,
|
|
55
55
|
contentHash: true,
|
|
56
|
-
rendered: true
|
|
56
|
+
rendered: true,
|
|
57
|
+
tools: true
|
|
57
58
|
});
|
|
58
59
|
var zResolvedPromptEnvelope = import_zod2.zResolvedPrompt.partial({ releaseId: true }).extend({ strategy: import_zod.z.enum(["single", "weighted"]).optional() });
|
|
59
60
|
function unwrap(envelope) {
|
|
@@ -84,6 +85,9 @@ function normalizeResolvedEnvelope(raw) {
|
|
|
84
85
|
labels: raw.labels,
|
|
85
86
|
rendered: raw.rendered
|
|
86
87
|
};
|
|
88
|
+
if (raw.tools != null && raw.tools.length > 0) {
|
|
89
|
+
result.tools = raw.tools;
|
|
90
|
+
}
|
|
87
91
|
if (typeof provenance.variantName === "string" && provenance.variantName.length > 0) {
|
|
88
92
|
result.variantName = provenance.variantName;
|
|
89
93
|
}
|
|
@@ -215,9 +219,10 @@ class PromptResource {
|
|
|
215
219
|
subject,
|
|
216
220
|
variables,
|
|
217
221
|
cache: useCache = true,
|
|
218
|
-
fallback
|
|
222
|
+
fallback,
|
|
223
|
+
developerRole
|
|
219
224
|
} = options;
|
|
220
|
-
const cacheKey = import_cache.buildFetchCacheKey(this.projectId, slug, env, context, subject, variables);
|
|
225
|
+
const cacheKey = import_cache.buildFetchCacheKey(this.projectId, slug, env, context, subject, variables, developerRole);
|
|
221
226
|
if (useCache) {
|
|
222
227
|
const cached = this.cache.get(cacheKey);
|
|
223
228
|
if (cached && "messages" in cached)
|
|
@@ -230,6 +235,8 @@ class PromptResource {
|
|
|
230
235
|
body.subject = subject;
|
|
231
236
|
if (variables !== undefined)
|
|
232
237
|
body.variables = variables;
|
|
238
|
+
if (developerRole !== undefined)
|
|
239
|
+
body.developerRole = developerRole;
|
|
233
240
|
try {
|
|
234
241
|
const envelope = await this.transport.request("POST", `${getProjectPromptsPath(this.projectId)}:resolve`, {
|
|
235
242
|
body,
|