@to11ai/sdk 2.0.0-rc.5 → 2.0.0-rc.7
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/generated/index.d.ts +1 -1
- package/dist/generated/types.gen.d.ts +214 -0
- package/dist/generated/zod.gen.d.ts +183 -0
- package/dist/prompts/resource.cjs +3 -5
- package/dist/prompts/resource.d.ts +3 -3
- package/dist/prompts/resource.js +3 -5
- package/dist/prompts/types.d.ts +0 -2
- package/package.json +1 -1
- package/src/generated/index.ts +1 -1
- package/src/generated/types.gen.ts +224 -0
- package/src/generated/zod.gen.ts +147 -0
- package/src/prompts/resource.ts +9 -8
- package/src/prompts/types.ts +0 -2
package/src/generated/zod.gen.ts
CHANGED
|
@@ -7479,6 +7479,45 @@ export const zPromptsBulkPromptsResponse = z.object({
|
|
|
7479
7479
|
success: z.boolean()
|
|
7480
7480
|
});
|
|
7481
7481
|
|
|
7482
|
+
export const zPromptsRenderPromptBody = z.object({
|
|
7483
|
+
variables: z.record(z.string(), z.unknown()).nullish()
|
|
7484
|
+
});
|
|
7485
|
+
|
|
7486
|
+
export const zPromptsRenderPromptPath = z.object({
|
|
7487
|
+
projectId: z.string().min(1),
|
|
7488
|
+
slug: z.string().min(1),
|
|
7489
|
+
label: z.string().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/)
|
|
7490
|
+
});
|
|
7491
|
+
|
|
7492
|
+
/**
|
|
7493
|
+
* Success
|
|
7494
|
+
*/
|
|
7495
|
+
export const zPromptsRenderPromptResponse = z.object({
|
|
7496
|
+
code: z.number(),
|
|
7497
|
+
data: zResolvedPrompt.nullable(),
|
|
7498
|
+
error: z.object({
|
|
7499
|
+
code: z.string(),
|
|
7500
|
+
details: z.unknown().nullish(),
|
|
7501
|
+
message: z.string(),
|
|
7502
|
+
rowErrors: z.array(z.object({
|
|
7503
|
+
code: z.string(),
|
|
7504
|
+
message: z.string(),
|
|
7505
|
+
path: z.array(z.union([z.string(), z.number()]))
|
|
7506
|
+
})).nullish()
|
|
7507
|
+
}).nullable(),
|
|
7508
|
+
pagination: z.object({
|
|
7509
|
+
limit: z.int().gte(1).lte(100),
|
|
7510
|
+
page: z.int().gte(1),
|
|
7511
|
+
total: z.int().gte(0),
|
|
7512
|
+
totalPages: z.int().gte(0)
|
|
7513
|
+
}).nullable(),
|
|
7514
|
+
sdkBehavior: z.object({
|
|
7515
|
+
flags: z.record(z.string(), z.unknown()),
|
|
7516
|
+
v: z.int().gte(1)
|
|
7517
|
+
}).nullish(),
|
|
7518
|
+
success: z.boolean()
|
|
7519
|
+
});
|
|
7520
|
+
|
|
7482
7521
|
export const zPromptsGetPromptDirectorySummaryPath = z.object({
|
|
7483
7522
|
projectId: z.string().min(1)
|
|
7484
7523
|
});
|
|
@@ -12485,6 +12524,13 @@ export const zTracesListTracesQuery = z.object({
|
|
|
12485
12524
|
z.string()
|
|
12486
12525
|
])
|
|
12487
12526
|
]).nullish(),
|
|
12527
|
+
promptRef: z.union([
|
|
12528
|
+
z.string(),
|
|
12529
|
+
z.union([
|
|
12530
|
+
z.array(z.string()),
|
|
12531
|
+
z.string()
|
|
12532
|
+
])
|
|
12533
|
+
]).nullish(),
|
|
12488
12534
|
minTokens: z.string().nullish(),
|
|
12489
12535
|
maxTokens: z.string().nullish(),
|
|
12490
12536
|
minCost: z.string().nullish(),
|
|
@@ -12608,6 +12654,8 @@ export const zTracesListTracesResponse = z.object({
|
|
|
12608
12654
|
input_tokens: z.int(),
|
|
12609
12655
|
model: z.string(),
|
|
12610
12656
|
output_tokens: z.int(),
|
|
12657
|
+
prompt_id: z.string().nullable(),
|
|
12658
|
+
prompt_version: z.string().nullable(),
|
|
12611
12659
|
provider: z.string(),
|
|
12612
12660
|
session_id: z.string(),
|
|
12613
12661
|
span_count: z.int(),
|
|
@@ -12653,6 +12701,105 @@ export const zTracesListTracesResponse = z.object({
|
|
|
12653
12701
|
success: z.boolean()
|
|
12654
12702
|
});
|
|
12655
12703
|
|
|
12704
|
+
export const zTracesListTracePromptFacetsPath = z.object({
|
|
12705
|
+
projectId: z.string().min(1)
|
|
12706
|
+
});
|
|
12707
|
+
|
|
12708
|
+
export const zTracesListTracePromptFacetsQuery = z.object({
|
|
12709
|
+
page: z.string().nullish(),
|
|
12710
|
+
limit: z.string().nullish(),
|
|
12711
|
+
sort: z.enum([
|
|
12712
|
+
'startTime',
|
|
12713
|
+
'durationMs',
|
|
12714
|
+
'inputTokens',
|
|
12715
|
+
'outputTokens',
|
|
12716
|
+
'model',
|
|
12717
|
+
'provider',
|
|
12718
|
+
'toolCalls',
|
|
12719
|
+
'costUsd'
|
|
12720
|
+
]).nullish(),
|
|
12721
|
+
order: z.enum(['asc', 'desc']).nullish(),
|
|
12722
|
+
status: z.enum([
|
|
12723
|
+
'ok',
|
|
12724
|
+
'error',
|
|
12725
|
+
'timeout'
|
|
12726
|
+
]).nullish(),
|
|
12727
|
+
provider: z.union([
|
|
12728
|
+
z.string(),
|
|
12729
|
+
z.union([
|
|
12730
|
+
z.array(z.string()),
|
|
12731
|
+
z.string()
|
|
12732
|
+
])
|
|
12733
|
+
]).nullish(),
|
|
12734
|
+
model: z.union([
|
|
12735
|
+
z.string(),
|
|
12736
|
+
z.union([
|
|
12737
|
+
z.array(z.string()),
|
|
12738
|
+
z.string()
|
|
12739
|
+
])
|
|
12740
|
+
]).nullish(),
|
|
12741
|
+
promptRef: z.union([
|
|
12742
|
+
z.string(),
|
|
12743
|
+
z.union([
|
|
12744
|
+
z.array(z.string()),
|
|
12745
|
+
z.string()
|
|
12746
|
+
])
|
|
12747
|
+
]).nullish(),
|
|
12748
|
+
minTokens: z.string().nullish(),
|
|
12749
|
+
maxTokens: z.string().nullish(),
|
|
12750
|
+
minCost: z.string().nullish(),
|
|
12751
|
+
maxCost: z.string().nullish(),
|
|
12752
|
+
hasToolCalls: z.enum(['yes', 'no']).nullish(),
|
|
12753
|
+
timePreset: z.enum([
|
|
12754
|
+
'10m',
|
|
12755
|
+
'30m',
|
|
12756
|
+
'1h',
|
|
12757
|
+
'2h',
|
|
12758
|
+
'3h',
|
|
12759
|
+
'8h',
|
|
12760
|
+
'24h',
|
|
12761
|
+
'7d',
|
|
12762
|
+
'14d',
|
|
12763
|
+
'28d',
|
|
12764
|
+
'60d'
|
|
12765
|
+
]).nullish(),
|
|
12766
|
+
startTimeFrom: z.string().nullish(),
|
|
12767
|
+
startTimeTo: z.string().nullish()
|
|
12768
|
+
});
|
|
12769
|
+
|
|
12770
|
+
/**
|
|
12771
|
+
* Success
|
|
12772
|
+
*/
|
|
12773
|
+
export const zTracesListTracePromptFacetsResponse = z.object({
|
|
12774
|
+
code: z.number(),
|
|
12775
|
+
data: z.array(z.object({
|
|
12776
|
+
prompt_id: z.string(),
|
|
12777
|
+
prompt_version: z.string(),
|
|
12778
|
+
trace_count: z.int()
|
|
12779
|
+
})).nullable(),
|
|
12780
|
+
error: z.object({
|
|
12781
|
+
code: z.string(),
|
|
12782
|
+
details: z.unknown().nullish(),
|
|
12783
|
+
message: z.string(),
|
|
12784
|
+
rowErrors: z.array(z.object({
|
|
12785
|
+
code: z.string(),
|
|
12786
|
+
message: z.string(),
|
|
12787
|
+
path: z.array(z.union([z.string(), z.number()]))
|
|
12788
|
+
})).nullish()
|
|
12789
|
+
}).nullable(),
|
|
12790
|
+
pagination: z.object({
|
|
12791
|
+
limit: z.int().gte(1).lte(100),
|
|
12792
|
+
page: z.int().gte(1),
|
|
12793
|
+
total: z.int().gte(0),
|
|
12794
|
+
totalPages: z.int().gte(0)
|
|
12795
|
+
}).nullable(),
|
|
12796
|
+
sdkBehavior: z.object({
|
|
12797
|
+
flags: z.record(z.string(), z.unknown()),
|
|
12798
|
+
v: z.int().gte(1)
|
|
12799
|
+
}).nullish(),
|
|
12800
|
+
success: z.boolean()
|
|
12801
|
+
});
|
|
12802
|
+
|
|
12656
12803
|
export const zTracesGetTraceDetailPath = z.object({
|
|
12657
12804
|
projectId: z.string().min(1),
|
|
12658
12805
|
traceId: z.string().min(1)
|
package/src/prompts/resource.ts
CHANGED
|
@@ -522,9 +522,9 @@ export class PromptResource<F extends RenderFormat | undefined = undefined> {
|
|
|
522
522
|
* Env-aware resolution → neutral `RenderedPrompt`. Carries the resolve /
|
|
523
523
|
* offline-fallback logic; `render()` is the public shaping surface.
|
|
524
524
|
*
|
|
525
|
-
* - **
|
|
526
|
-
* (`/v1/projects/:projectId/prompts
|
|
527
|
-
* resolved label is
|
|
525
|
+
* - **wire mapping (TO11-2743):** posts to the path-addressed render route
|
|
526
|
+
* (`/v1/projects/:projectId/prompts/by-slug/:slug/labels/:label/render`),
|
|
527
|
+
* body `{ variables? }`. The resolved label is the single path label.
|
|
528
528
|
* - **No silent fallback (R4):** if no label is resolvable (none per call
|
|
529
529
|
* AND no client `env` fallback) this throws `MissingLabelError`
|
|
530
530
|
* CLIENT-side, eagerly, before any transport call.
|
|
@@ -557,17 +557,18 @@ export class PromptResource<F extends RenderFormat | undefined = undefined> {
|
|
|
557
557
|
);
|
|
558
558
|
}
|
|
559
559
|
|
|
560
|
-
const {
|
|
560
|
+
const { variables, fallback } = options;
|
|
561
561
|
|
|
562
|
-
//
|
|
563
|
-
|
|
564
|
-
|
|
562
|
+
// TO11-2743: slug + the single resolved label live in the PATH; the body
|
|
563
|
+
// carries only `variables`. Weighted-release bucketing (`subject`) is not
|
|
564
|
+
// supported by the render endpoint yet, so it's dropped from the surface.
|
|
565
|
+
const body: Record<string, unknown> = {};
|
|
565
566
|
if (variables !== undefined) body.variables = variables;
|
|
566
567
|
|
|
567
568
|
try {
|
|
568
569
|
const envelope = await this.transport.request<ResolvedPromptEnvelope>(
|
|
569
570
|
"POST",
|
|
570
|
-
`${getProjectPromptsPath(this.projectId)}
|
|
571
|
+
`${getProjectPromptsPath(this.projectId)}/by-slug/${encodeURIComponent(slug)}/labels/${encodeURIComponent(label)}/render`,
|
|
571
572
|
{
|
|
572
573
|
body,
|
|
573
574
|
decode: (data) =>
|
package/src/prompts/types.ts
CHANGED
|
@@ -236,8 +236,6 @@ export interface RenderOptions {
|
|
|
236
236
|
* When omitted, falls back to the client's `env` (env is a label value).
|
|
237
237
|
*/
|
|
238
238
|
label?: string;
|
|
239
|
-
/** Stable id so a weighted release sends the same caller to the same variant. */
|
|
240
|
-
subject?: string;
|
|
241
239
|
variables?: Record<string, unknown>;
|
|
242
240
|
/** Prompt served if the API is unreachable on a network error. */
|
|
243
241
|
fallback?: RenderedPrompt;
|