promptlayer 1.3.0 → 1.3.2
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/claude-agents.js +1 -1
- package/dist/claude-agents.js.map +1 -1
- package/dist/esm/{chunk-KDVM55TG.js → chunk-CRODAGHV.js} +2 -2
- package/dist/esm/chunk-CRODAGHV.js.map +1 -0
- package/dist/esm/claude-agents.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/openai-agents.js +1 -1
- package/dist/index.d.mts +66 -8
- package/dist/index.d.ts +66 -8
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/openai-agents.js +2 -2
- package/dist/openai-agents.js.map +1 -1
- package/package.json +3 -1
- package/dist/esm/chunk-KDVM55TG.js.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -41,7 +41,7 @@ interface SkillFileMove {
|
|
|
41
41
|
[k: string]: unknown;
|
|
42
42
|
}
|
|
43
43
|
type SkillCollectionProvider = "claude_code" | "openai" | "openclaw";
|
|
44
|
-
interface
|
|
44
|
+
interface PublishSkillCollectionFromFiles {
|
|
45
45
|
name: string;
|
|
46
46
|
folderId?: number;
|
|
47
47
|
provider: SkillCollectionProvider;
|
|
@@ -57,7 +57,7 @@ interface PublishSkillCollectionFromZip {
|
|
|
57
57
|
provider: SkillCollectionProvider;
|
|
58
58
|
commitMessage?: string;
|
|
59
59
|
}
|
|
60
|
-
type PublishSkillCollection =
|
|
60
|
+
type PublishSkillCollection = PublishSkillCollectionFromFiles | PublishSkillCollectionFromZip;
|
|
61
61
|
interface SaveSkillCollectionVersion {
|
|
62
62
|
fileUpdates?: SkillFileUpdate[];
|
|
63
63
|
moves?: SkillFileMove[];
|
|
@@ -87,13 +87,12 @@ interface SkillCollectionVersion {
|
|
|
87
87
|
created_at?: string;
|
|
88
88
|
[k: string]: unknown;
|
|
89
89
|
}
|
|
90
|
-
interface
|
|
90
|
+
interface PublishSkillCollectionResponse {
|
|
91
91
|
success: boolean;
|
|
92
92
|
skill_collection: SkillCollection;
|
|
93
93
|
version?: SkillCollectionVersion | null;
|
|
94
94
|
[k: string]: unknown;
|
|
95
95
|
}
|
|
96
|
-
type PublishSkillCollectionResponse = CreateSkillCollectionResponse;
|
|
97
96
|
interface PullSkillCollectionResponse {
|
|
98
97
|
success: boolean;
|
|
99
98
|
skill_collection: SkillCollection;
|
|
@@ -123,6 +122,7 @@ interface GetPromptTemplateParams {
|
|
|
123
122
|
metadata_filters?: Record<string, string>;
|
|
124
123
|
model?: string;
|
|
125
124
|
model_parameter_overrides?: Record<string, unknown>;
|
|
125
|
+
skip_input_variable_rendering?: boolean;
|
|
126
126
|
}
|
|
127
127
|
declare const templateFormat: readonly ["f-string", "jinja2"];
|
|
128
128
|
type TemplateFormat = (typeof templateFormat)[number];
|
|
@@ -391,7 +391,13 @@ type BuiltInTool = {
|
|
|
391
391
|
type: "web_search" | "file_search" | "code_interpreter" | "image_generation" | "google_maps" | "url_context" | "mcp" | "bash" | "shell" | "apply_patch" | "text_editor";
|
|
392
392
|
config: BuiltInToolConfig;
|
|
393
393
|
};
|
|
394
|
-
type
|
|
394
|
+
type RegistryTool = {
|
|
395
|
+
type: "registry";
|
|
396
|
+
tool_registry_id: number;
|
|
397
|
+
label?: string | null;
|
|
398
|
+
version_number?: number | null;
|
|
399
|
+
};
|
|
400
|
+
type Tool = FunctionTool | BuiltInTool | RegistryTool;
|
|
395
401
|
type SystemMessage = {
|
|
396
402
|
role: "system";
|
|
397
403
|
input_variables?: string[];
|
|
@@ -604,13 +610,58 @@ declare class SkillManager {
|
|
|
604
610
|
|
|
605
611
|
declare const wrapWithSpan: (functionName: string, func: Function, attributes?: Record<string, any>) => (...args: any[]) => any;
|
|
606
612
|
|
|
613
|
+
/**
|
|
614
|
+
* Tuple: [promptName, version, label, provider, model]
|
|
615
|
+
* Serialized to a JSON string for use as a Map key.
|
|
616
|
+
*/
|
|
617
|
+
type CacheKeyTuple = [
|
|
618
|
+
string,
|
|
619
|
+
number | null,
|
|
620
|
+
string | null,
|
|
621
|
+
string | null,
|
|
622
|
+
string | null
|
|
623
|
+
];
|
|
624
|
+
/**
|
|
625
|
+
* In-memory TTL cache for prompt templates.
|
|
626
|
+
*
|
|
627
|
+
* Stores unrendered API responses keyed by (promptName, version, label,
|
|
628
|
+
* provider, model). Supports stale-while-error: if the TTL has expired but
|
|
629
|
+
* the API is unreachable, the stale entry can be re-rendered as a fallback.
|
|
630
|
+
*/
|
|
631
|
+
declare class PromptTemplateCache {
|
|
632
|
+
private readonly ttlMs;
|
|
633
|
+
private readonly maxSize;
|
|
634
|
+
private readonly entries;
|
|
635
|
+
private readonly nonRenderable;
|
|
636
|
+
constructor(ttlSeconds: number, maxSize?: number);
|
|
637
|
+
static makeKey(promptName: string, params?: Record<string, unknown> | null): CacheKeyTuple;
|
|
638
|
+
private static serialize;
|
|
639
|
+
/**
|
|
640
|
+
* Returns `[deepClone | null, isFresh]`.
|
|
641
|
+
* The returned object is safe to mutate.
|
|
642
|
+
*/
|
|
643
|
+
get(key: CacheKeyTuple): [Record<string, unknown> | null, boolean];
|
|
644
|
+
put(key: CacheKeyTuple, response: Record<string, unknown>): void;
|
|
645
|
+
isNonRenderable(key: CacheKeyTuple): boolean;
|
|
646
|
+
markNonRenderable(key: CacheKeyTuple): void;
|
|
647
|
+
clear(): void;
|
|
648
|
+
/** Remove all entries whose cache key starts with `promptName`. */
|
|
649
|
+
invalidate(promptName: string): void;
|
|
650
|
+
private evictOldestEntry;
|
|
651
|
+
private evictOldestNonRenderable;
|
|
652
|
+
}
|
|
653
|
+
|
|
607
654
|
declare class TemplateManager {
|
|
608
655
|
apiKey: string;
|
|
609
656
|
baseURL: string;
|
|
610
657
|
throwOnError: boolean;
|
|
611
|
-
|
|
658
|
+
private _cache;
|
|
659
|
+
constructor(apiKey: string, baseURL: string, throwOnError?: boolean, cache?: PromptTemplateCache | null);
|
|
612
660
|
get: (promptName: string, params?: Partial<GetPromptTemplateParams>) => Promise<GetPromptTemplateResponse | null>;
|
|
661
|
+
private _fetchNormal;
|
|
662
|
+
private _getWithCache;
|
|
613
663
|
publish: (body: PublishPromptTemplate) => Promise<PublishPromptTemplateResponse>;
|
|
664
|
+
invalidate: (promptName?: string) => void;
|
|
614
665
|
all: (params?: Pagination) => Promise<ListPromptTemplatesResponse[]>;
|
|
615
666
|
}
|
|
616
667
|
|
|
@@ -631,6 +682,12 @@ interface ClientOptions {
|
|
|
631
682
|
workspaceId?: number;
|
|
632
683
|
throwOnError?: boolean;
|
|
633
684
|
baseURL?: string;
|
|
685
|
+
/**
|
|
686
|
+
* When > 0, enables in-memory TTL caching of prompt templates.
|
|
687
|
+
* Templates are fetched unrendered and substituted locally, reducing
|
|
688
|
+
* API calls. Default: 0 (disabled).
|
|
689
|
+
*/
|
|
690
|
+
cacheTtlSeconds?: number;
|
|
634
691
|
}
|
|
635
692
|
declare class PromptLayer {
|
|
636
693
|
apiKey: string;
|
|
@@ -642,7 +699,8 @@ declare class PromptLayer {
|
|
|
642
699
|
enableTracing: boolean;
|
|
643
700
|
throwOnError: boolean;
|
|
644
701
|
wrapWithSpan: typeof wrapWithSpan;
|
|
645
|
-
constructor({ apiKey, baseURL, enableTracing, throwOnError, }?: ClientOptions);
|
|
702
|
+
constructor({ apiKey, baseURL, enableTracing, throwOnError, cacheTtlSeconds, }?: ClientOptions);
|
|
703
|
+
invalidate(promptName?: string): void;
|
|
646
704
|
get Anthropic(): any;
|
|
647
705
|
get OpenAI(): any;
|
|
648
706
|
run({ promptName, promptVersion, promptReleaseLabel, inputVariables, tags, metadata, groupId, modelParameterOverrides, stream, provider, model, }: RunRequest): Promise<AsyncGenerator<{
|
|
@@ -659,4 +717,4 @@ declare class PromptLayer {
|
|
|
659
717
|
logRequest(body: LogRequest): Promise<RequestLog | null>;
|
|
660
718
|
}
|
|
661
719
|
|
|
662
|
-
export { type ClientOptions, type
|
|
720
|
+
export { type ClientOptions, type InitialSkillFileUpdate, PromptLayer, type PublishSkillCollection, type PublishSkillCollectionFromFiles, type PublishSkillCollectionFromZip, type PublishSkillCollectionResponse, type PullSkillCollectionParams, type PullSkillCollectionResponse, type SaveSkillCollectionVersion, type SkillCollection, type SkillCollectionVersion, type SkillFileMove, type SkillFileUpdate, type UpdateSkillCollection, type UpdateSkillCollectionResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ interface SkillFileMove {
|
|
|
41
41
|
[k: string]: unknown;
|
|
42
42
|
}
|
|
43
43
|
type SkillCollectionProvider = "claude_code" | "openai" | "openclaw";
|
|
44
|
-
interface
|
|
44
|
+
interface PublishSkillCollectionFromFiles {
|
|
45
45
|
name: string;
|
|
46
46
|
folderId?: number;
|
|
47
47
|
provider: SkillCollectionProvider;
|
|
@@ -57,7 +57,7 @@ interface PublishSkillCollectionFromZip {
|
|
|
57
57
|
provider: SkillCollectionProvider;
|
|
58
58
|
commitMessage?: string;
|
|
59
59
|
}
|
|
60
|
-
type PublishSkillCollection =
|
|
60
|
+
type PublishSkillCollection = PublishSkillCollectionFromFiles | PublishSkillCollectionFromZip;
|
|
61
61
|
interface SaveSkillCollectionVersion {
|
|
62
62
|
fileUpdates?: SkillFileUpdate[];
|
|
63
63
|
moves?: SkillFileMove[];
|
|
@@ -87,13 +87,12 @@ interface SkillCollectionVersion {
|
|
|
87
87
|
created_at?: string;
|
|
88
88
|
[k: string]: unknown;
|
|
89
89
|
}
|
|
90
|
-
interface
|
|
90
|
+
interface PublishSkillCollectionResponse {
|
|
91
91
|
success: boolean;
|
|
92
92
|
skill_collection: SkillCollection;
|
|
93
93
|
version?: SkillCollectionVersion | null;
|
|
94
94
|
[k: string]: unknown;
|
|
95
95
|
}
|
|
96
|
-
type PublishSkillCollectionResponse = CreateSkillCollectionResponse;
|
|
97
96
|
interface PullSkillCollectionResponse {
|
|
98
97
|
success: boolean;
|
|
99
98
|
skill_collection: SkillCollection;
|
|
@@ -123,6 +122,7 @@ interface GetPromptTemplateParams {
|
|
|
123
122
|
metadata_filters?: Record<string, string>;
|
|
124
123
|
model?: string;
|
|
125
124
|
model_parameter_overrides?: Record<string, unknown>;
|
|
125
|
+
skip_input_variable_rendering?: boolean;
|
|
126
126
|
}
|
|
127
127
|
declare const templateFormat: readonly ["f-string", "jinja2"];
|
|
128
128
|
type TemplateFormat = (typeof templateFormat)[number];
|
|
@@ -391,7 +391,13 @@ type BuiltInTool = {
|
|
|
391
391
|
type: "web_search" | "file_search" | "code_interpreter" | "image_generation" | "google_maps" | "url_context" | "mcp" | "bash" | "shell" | "apply_patch" | "text_editor";
|
|
392
392
|
config: BuiltInToolConfig;
|
|
393
393
|
};
|
|
394
|
-
type
|
|
394
|
+
type RegistryTool = {
|
|
395
|
+
type: "registry";
|
|
396
|
+
tool_registry_id: number;
|
|
397
|
+
label?: string | null;
|
|
398
|
+
version_number?: number | null;
|
|
399
|
+
};
|
|
400
|
+
type Tool = FunctionTool | BuiltInTool | RegistryTool;
|
|
395
401
|
type SystemMessage = {
|
|
396
402
|
role: "system";
|
|
397
403
|
input_variables?: string[];
|
|
@@ -604,13 +610,58 @@ declare class SkillManager {
|
|
|
604
610
|
|
|
605
611
|
declare const wrapWithSpan: (functionName: string, func: Function, attributes?: Record<string, any>) => (...args: any[]) => any;
|
|
606
612
|
|
|
613
|
+
/**
|
|
614
|
+
* Tuple: [promptName, version, label, provider, model]
|
|
615
|
+
* Serialized to a JSON string for use as a Map key.
|
|
616
|
+
*/
|
|
617
|
+
type CacheKeyTuple = [
|
|
618
|
+
string,
|
|
619
|
+
number | null,
|
|
620
|
+
string | null,
|
|
621
|
+
string | null,
|
|
622
|
+
string | null
|
|
623
|
+
];
|
|
624
|
+
/**
|
|
625
|
+
* In-memory TTL cache for prompt templates.
|
|
626
|
+
*
|
|
627
|
+
* Stores unrendered API responses keyed by (promptName, version, label,
|
|
628
|
+
* provider, model). Supports stale-while-error: if the TTL has expired but
|
|
629
|
+
* the API is unreachable, the stale entry can be re-rendered as a fallback.
|
|
630
|
+
*/
|
|
631
|
+
declare class PromptTemplateCache {
|
|
632
|
+
private readonly ttlMs;
|
|
633
|
+
private readonly maxSize;
|
|
634
|
+
private readonly entries;
|
|
635
|
+
private readonly nonRenderable;
|
|
636
|
+
constructor(ttlSeconds: number, maxSize?: number);
|
|
637
|
+
static makeKey(promptName: string, params?: Record<string, unknown> | null): CacheKeyTuple;
|
|
638
|
+
private static serialize;
|
|
639
|
+
/**
|
|
640
|
+
* Returns `[deepClone | null, isFresh]`.
|
|
641
|
+
* The returned object is safe to mutate.
|
|
642
|
+
*/
|
|
643
|
+
get(key: CacheKeyTuple): [Record<string, unknown> | null, boolean];
|
|
644
|
+
put(key: CacheKeyTuple, response: Record<string, unknown>): void;
|
|
645
|
+
isNonRenderable(key: CacheKeyTuple): boolean;
|
|
646
|
+
markNonRenderable(key: CacheKeyTuple): void;
|
|
647
|
+
clear(): void;
|
|
648
|
+
/** Remove all entries whose cache key starts with `promptName`. */
|
|
649
|
+
invalidate(promptName: string): void;
|
|
650
|
+
private evictOldestEntry;
|
|
651
|
+
private evictOldestNonRenderable;
|
|
652
|
+
}
|
|
653
|
+
|
|
607
654
|
declare class TemplateManager {
|
|
608
655
|
apiKey: string;
|
|
609
656
|
baseURL: string;
|
|
610
657
|
throwOnError: boolean;
|
|
611
|
-
|
|
658
|
+
private _cache;
|
|
659
|
+
constructor(apiKey: string, baseURL: string, throwOnError?: boolean, cache?: PromptTemplateCache | null);
|
|
612
660
|
get: (promptName: string, params?: Partial<GetPromptTemplateParams>) => Promise<GetPromptTemplateResponse | null>;
|
|
661
|
+
private _fetchNormal;
|
|
662
|
+
private _getWithCache;
|
|
613
663
|
publish: (body: PublishPromptTemplate) => Promise<PublishPromptTemplateResponse>;
|
|
664
|
+
invalidate: (promptName?: string) => void;
|
|
614
665
|
all: (params?: Pagination) => Promise<ListPromptTemplatesResponse[]>;
|
|
615
666
|
}
|
|
616
667
|
|
|
@@ -631,6 +682,12 @@ interface ClientOptions {
|
|
|
631
682
|
workspaceId?: number;
|
|
632
683
|
throwOnError?: boolean;
|
|
633
684
|
baseURL?: string;
|
|
685
|
+
/**
|
|
686
|
+
* When > 0, enables in-memory TTL caching of prompt templates.
|
|
687
|
+
* Templates are fetched unrendered and substituted locally, reducing
|
|
688
|
+
* API calls. Default: 0 (disabled).
|
|
689
|
+
*/
|
|
690
|
+
cacheTtlSeconds?: number;
|
|
634
691
|
}
|
|
635
692
|
declare class PromptLayer {
|
|
636
693
|
apiKey: string;
|
|
@@ -642,7 +699,8 @@ declare class PromptLayer {
|
|
|
642
699
|
enableTracing: boolean;
|
|
643
700
|
throwOnError: boolean;
|
|
644
701
|
wrapWithSpan: typeof wrapWithSpan;
|
|
645
|
-
constructor({ apiKey, baseURL, enableTracing, throwOnError, }?: ClientOptions);
|
|
702
|
+
constructor({ apiKey, baseURL, enableTracing, throwOnError, cacheTtlSeconds, }?: ClientOptions);
|
|
703
|
+
invalidate(promptName?: string): void;
|
|
646
704
|
get Anthropic(): any;
|
|
647
705
|
get OpenAI(): any;
|
|
648
706
|
run({ promptName, promptVersion, promptReleaseLabel, inputVariables, tags, metadata, groupId, modelParameterOverrides, stream, provider, model, }: RunRequest): Promise<AsyncGenerator<{
|
|
@@ -659,4 +717,4 @@ declare class PromptLayer {
|
|
|
659
717
|
logRequest(body: LogRequest): Promise<RequestLog | null>;
|
|
660
718
|
}
|
|
661
719
|
|
|
662
|
-
export { type ClientOptions, type
|
|
720
|
+
export { type ClientOptions, type InitialSkillFileUpdate, PromptLayer, type PublishSkillCollection, type PublishSkillCollectionFromFiles, type PublishSkillCollectionFromZip, type PublishSkillCollectionResponse, type PullSkillCollectionParams, type PullSkillCollectionResponse, type SaveSkillCollectionVersion, type SkillCollection, type SkillCollectionVersion, type SkillFileMove, type SkillFileUpdate, type UpdateSkillCollection, type UpdateSkillCollectionResponse };
|