@standardagents/builder 0.11.0-next.7005954 → 0.11.0-next.730b472
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/built-in-routes.js +6918 -22749
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/assets/img/meta.svg +19 -0
- package/dist/client/assets/img/moonshotai.svg +4 -0
- package/dist/client/assets/img/zai.svg +219 -0
- package/dist/client/assets/index.css +1 -1
- package/dist/client/index.js +23 -26
- package/dist/client/vendor.js +1 -1
- package/dist/client/vue.js +1 -1
- package/dist/index.d.ts +30 -250
- package/dist/index.js +1238 -3080
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +0 -6
- package/dist/plugin.js +56 -207
- package/dist/plugin.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { AgentPluginOptions, agentbuilder } from './plugin.js';
|
|
2
2
|
import { DurableObjectStorage } from '@cloudflare/workers-types';
|
|
3
3
|
import { ZodObject, ZodRawShape } from 'zod';
|
|
4
|
-
import { ToolResult as ToolResult$1, HookSignatures, AgentDefinition as AgentDefinition$1, ControllerContext, Controller, ModelDefinition as ModelDefinition$1, ToolArgs, PromptTextPart, SubpromptConfig as SubpromptConfig$2, ReasoningConfig, SideConfig as SideConfig$1
|
|
5
|
-
export { AgentType, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, PromptInput, PromptTextPart,
|
|
4
|
+
import { ToolResult as ToolResult$1, HookSignatures, AgentDefinition as AgentDefinition$1, ControllerContext, Controller, ModelDefinition as ModelDefinition$1, ToolArgs, PromptTextPart, SubpromptConfig as SubpromptConfig$2, ReasoningConfig, SideConfig as SideConfig$1 } from '@standardagents/spec';
|
|
5
|
+
export { AgentType, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, PromptInput, PromptTextPart, ReasoningConfig, StructuredPrompt, TextContent, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, defineAgent, defineHook, defineModel, definePrompt, defineThreadEndpoint, defineTool } from '@standardagents/spec';
|
|
6
6
|
import { DurableObject } from 'cloudflare:workers';
|
|
7
7
|
import 'vite';
|
|
8
8
|
|
|
@@ -13,71 +13,63 @@ import 'vite';
|
|
|
13
13
|
* Types are automatically populated when you run `pnpm dev` or `pnpm build`,
|
|
14
14
|
* which scans your `agentbuilder/` directories and generates types.
|
|
15
15
|
*
|
|
16
|
-
* The generated types are placed in `.
|
|
17
|
-
* StandardAgentSpec namespace from @standardagents/spec.
|
|
16
|
+
* The generated types are placed in `.agentbuilder/types.d.ts` and augment this namespace.
|
|
18
17
|
*
|
|
19
|
-
* Note:
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @deprecated Use StandardAgentSpec namespace from @standardagents/spec instead
|
|
18
|
+
* Note: We use interfaces as type registries because TypeScript allows interface
|
|
19
|
+
* declaration merging. The user's generated types will add properties to these
|
|
20
|
+
* interfaces, and we extract the union of all property keys.
|
|
23
21
|
*/
|
|
24
22
|
declare global {
|
|
25
23
|
namespace AgentBuilder {
|
|
26
24
|
/**
|
|
27
25
|
* Interface for model type registration.
|
|
28
|
-
*
|
|
26
|
+
* Generated types add properties: interface ModelRegistry { 'gpt-4o': true; 'claude-3': true; }
|
|
27
|
+
* This gives us: type Models = keyof ModelRegistry = 'gpt-4o' | 'claude-3'
|
|
29
28
|
*/
|
|
30
|
-
interface ModelRegistry
|
|
29
|
+
interface ModelRegistry {
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
32
|
* Interface for prompt type registration.
|
|
34
|
-
* @deprecated Use StandardAgentSpec.PromptRegistry instead
|
|
35
33
|
*/
|
|
36
|
-
interface PromptRegistry
|
|
34
|
+
interface PromptRegistry {
|
|
37
35
|
}
|
|
38
36
|
/**
|
|
39
37
|
* Interface for agent type registration.
|
|
40
|
-
* @deprecated Use StandardAgentSpec.AgentRegistry instead
|
|
41
38
|
*/
|
|
42
|
-
interface AgentRegistry
|
|
39
|
+
interface AgentRegistry {
|
|
43
40
|
}
|
|
44
41
|
/**
|
|
45
42
|
* Interface for tool type registration.
|
|
46
|
-
* @deprecated Use StandardAgentSpec.ToolRegistry instead
|
|
47
43
|
*/
|
|
48
|
-
interface ToolRegistry
|
|
44
|
+
interface ToolRegistry {
|
|
49
45
|
}
|
|
50
46
|
/**
|
|
51
47
|
* Interface for callable type registration (prompts, agents, tools).
|
|
52
|
-
* @deprecated Use StandardAgentSpec.CallableRegistry instead
|
|
53
48
|
*/
|
|
54
|
-
interface CallableRegistry
|
|
49
|
+
interface CallableRegistry {
|
|
55
50
|
}
|
|
56
51
|
/**
|
|
57
52
|
* Union type of all model names defined in agentbuilder/models/.
|
|
58
|
-
*
|
|
53
|
+
* When ModelRegistry is empty, this defaults to string for flexibility.
|
|
54
|
+
* When populated, it narrows to the specific model names.
|
|
59
55
|
*/
|
|
60
|
-
type Models =
|
|
56
|
+
type Models = keyof ModelRegistry extends never ? string : keyof ModelRegistry;
|
|
61
57
|
/**
|
|
62
58
|
* Union type of all prompt names defined in agentbuilder/prompts/.
|
|
63
|
-
* @deprecated Use StandardAgentSpec.Prompts instead
|
|
64
59
|
*/
|
|
65
|
-
type Prompts =
|
|
60
|
+
type Prompts = keyof PromptRegistry extends never ? string : keyof PromptRegistry;
|
|
66
61
|
/**
|
|
67
62
|
* Union type of all agent names defined in agentbuilder/agents/.
|
|
68
|
-
* @deprecated Use StandardAgentSpec.Agents instead
|
|
69
63
|
*/
|
|
70
|
-
type Agents =
|
|
64
|
+
type Agents = keyof AgentRegistry extends never ? string : keyof AgentRegistry;
|
|
71
65
|
/**
|
|
72
66
|
* Union type of all tool names defined in agentbuilder/tools/.
|
|
73
|
-
* @deprecated Use StandardAgentSpec.Tools instead
|
|
74
67
|
*/
|
|
75
|
-
type Tools =
|
|
68
|
+
type Tools = keyof ToolRegistry extends never ? string : keyof ToolRegistry;
|
|
76
69
|
/**
|
|
77
70
|
* Union type of all callable items (prompts, agents, tools) that can be used as tools.
|
|
78
|
-
* @deprecated Use StandardAgentSpec.Callables instead
|
|
79
71
|
*/
|
|
80
|
-
type Callables =
|
|
72
|
+
type Callables = keyof CallableRegistry extends never ? string : keyof CallableRegistry;
|
|
81
73
|
}
|
|
82
74
|
}
|
|
83
75
|
|
|
@@ -221,8 +213,6 @@ interface ThreadMetadata {
|
|
|
221
213
|
id: string;
|
|
222
214
|
agent_id: string;
|
|
223
215
|
user_id: string | null;
|
|
224
|
-
tenvs: Record<string, unknown> | null;
|
|
225
|
-
properties: Record<string, unknown> | null;
|
|
226
216
|
created_at: number;
|
|
227
217
|
}
|
|
228
218
|
/**
|
|
@@ -236,26 +226,7 @@ type HookRegistry = {
|
|
|
236
226
|
* Tools can have args (with validation schema) or no args.
|
|
237
227
|
* Uses local Zod types for compatibility with z.toJSONSchema().
|
|
238
228
|
*/
|
|
239
|
-
|
|
240
|
-
/** Description of what the tool does (shown to the LLM). */
|
|
241
|
-
description: string;
|
|
242
|
-
/** Zod schema for validating tool arguments, or null for no args. */
|
|
243
|
-
args: ZodObject<ZodRawShape> | null;
|
|
244
|
-
/** The tool implementation function. */
|
|
245
|
-
execute: ((state: any, args: Record<string, unknown>) => Promise<ToolResult$1>) | ((state: any) => Promise<ToolResult$1>);
|
|
246
|
-
/** Zod schema for thread environment variables, or null if none. */
|
|
247
|
-
tenvs?: ZodObject<ZodRawShape> | null;
|
|
248
|
-
/**
|
|
249
|
-
* Where this tool is executed:
|
|
250
|
-
* - 'local': Execute locally by the execution engine (default)
|
|
251
|
-
* - 'provider': Executed by the LLM provider, results come in response
|
|
252
|
-
*/
|
|
253
|
-
executionMode?: 'local' | 'provider';
|
|
254
|
-
/**
|
|
255
|
-
* Which provider executes this tool (when executionMode='provider').
|
|
256
|
-
*/
|
|
257
|
-
executionProvider?: string;
|
|
258
|
-
}
|
|
229
|
+
type NativeToolModule = [description: string, argsSchema: ZodObject<ZodRawShape>, toolFn: (state: any, args: Record<string, unknown>) => Promise<ToolResult$1>] | [description: string, argsSchema: null, toolFn: (state: any) => Promise<ToolResult$1>];
|
|
259
230
|
/**
|
|
260
231
|
* Thread instance (forward reference to avoid circular dependency)
|
|
261
232
|
*/
|
|
@@ -282,11 +253,7 @@ interface ThreadInstance {
|
|
|
282
253
|
getPromptNames(): string[];
|
|
283
254
|
getAgentNames(): string[];
|
|
284
255
|
writeFile(path: string, data: ArrayBuffer | string, mimeType: string, options?: Record<string, unknown>): Promise<any>;
|
|
285
|
-
readFile(path: string): Promise<
|
|
286
|
-
success: boolean;
|
|
287
|
-
data?: string;
|
|
288
|
-
error?: string;
|
|
289
|
-
}>;
|
|
256
|
+
readFile(path: string): Promise<ArrayBuffer | null>;
|
|
290
257
|
statFile(path: string): Promise<any>;
|
|
291
258
|
readdirFile(path: string): Promise<any[]>;
|
|
292
259
|
unlinkFile(path: string): Promise<void>;
|
|
@@ -349,7 +316,6 @@ type FlowCallWithRetries = FlowCall & {
|
|
|
349
316
|
interface SubpromptConfig$1 {
|
|
350
317
|
name: string;
|
|
351
318
|
initUserMessageProperty?: string;
|
|
352
|
-
initAttachmentsProperty?: string;
|
|
353
319
|
includeTextResponse?: boolean;
|
|
354
320
|
includeToolCalls?: boolean;
|
|
355
321
|
includeErrors?: boolean;
|
|
@@ -440,7 +406,6 @@ interface FlowState {
|
|
|
440
406
|
depth: number;
|
|
441
407
|
pendingMessageId?: string;
|
|
442
408
|
allowedTools?: ToolDefinition[];
|
|
443
|
-
pendingMetadataPromises?: Promise<void>[];
|
|
444
409
|
}
|
|
445
410
|
/**
|
|
446
411
|
* Text content part for multimodal messages
|
|
@@ -477,10 +442,6 @@ interface RequestContext {
|
|
|
477
442
|
tool_calls?: ToolCall[];
|
|
478
443
|
tool_call_id?: string;
|
|
479
444
|
name?: string;
|
|
480
|
-
reasoning_content?: string;
|
|
481
|
-
reasoning_details?: any[];
|
|
482
|
-
attachments?: any[];
|
|
483
|
-
toolName?: string;
|
|
484
445
|
}>;
|
|
485
446
|
model: string;
|
|
486
447
|
tools?: ToolDefinition[];
|
|
@@ -512,17 +473,6 @@ interface ToolDefinition {
|
|
|
512
473
|
description: string;
|
|
513
474
|
parameters?: Record<string, any>;
|
|
514
475
|
};
|
|
515
|
-
/**
|
|
516
|
-
* Where this tool is executed:
|
|
517
|
-
* - 'local': Execute locally by the execution engine (default)
|
|
518
|
-
* - 'provider': Executed by the LLM provider, results come in response
|
|
519
|
-
*/
|
|
520
|
-
executionMode?: 'local' | 'provider';
|
|
521
|
-
/**
|
|
522
|
-
* Which provider executes this tool (when executionMode='provider')
|
|
523
|
-
* e.g., 'openai', 'anthropic'
|
|
524
|
-
*/
|
|
525
|
-
executionProvider?: string;
|
|
526
476
|
}
|
|
527
477
|
/**
|
|
528
478
|
* Image returned by an LLM response (e.g., from image generation models)
|
|
@@ -530,12 +480,6 @@ interface ToolDefinition {
|
|
|
530
480
|
*/
|
|
531
481
|
interface LLMResponseImage {
|
|
532
482
|
type: "image_url";
|
|
533
|
-
/** Unique ID for this generated image (used to link to tool call) */
|
|
534
|
-
id?: string;
|
|
535
|
-
/** Name of the tool that generated this image (e.g., 'image_generation') */
|
|
536
|
-
toolName?: string;
|
|
537
|
-
/** The revised/actual prompt used to generate the image (from OpenAI's image_generation) */
|
|
538
|
-
revisedPrompt?: string;
|
|
539
483
|
image_url: {
|
|
540
484
|
url: string;
|
|
541
485
|
};
|
|
@@ -565,12 +509,6 @@ interface LLMResponse {
|
|
|
565
509
|
cost?: number;
|
|
566
510
|
provider?: string;
|
|
567
511
|
};
|
|
568
|
-
/** @internal Provider instance reference for async metadata fetching */
|
|
569
|
-
_provider?: unknown;
|
|
570
|
-
/** @internal Provider response ID for async metadata fetching */
|
|
571
|
-
_providerResponseId?: string;
|
|
572
|
-
/** @internal Aggregate response for logging */
|
|
573
|
-
_aggregate_response?: unknown;
|
|
574
512
|
}
|
|
575
513
|
/**
|
|
576
514
|
* Attachment returned by a tool (e.g., generated images)
|
|
@@ -703,7 +641,6 @@ interface LogData {
|
|
|
703
641
|
tools_available?: number;
|
|
704
642
|
prompt_name?: string;
|
|
705
643
|
tools_called?: string;
|
|
706
|
-
actual_provider?: string | null;
|
|
707
644
|
parent_log_id?: string | null;
|
|
708
645
|
tools_schema?: string | null;
|
|
709
646
|
message_history?: string | null;
|
|
@@ -860,50 +797,6 @@ interface ThreadMetaResponse {
|
|
|
860
797
|
lastActivity: number | null;
|
|
861
798
|
};
|
|
862
799
|
}
|
|
863
|
-
/**
|
|
864
|
-
* Log details returned by getLogDetails
|
|
865
|
-
*/
|
|
866
|
-
interface LogDetails {
|
|
867
|
-
id: string;
|
|
868
|
-
message_id: string;
|
|
869
|
-
provider: string;
|
|
870
|
-
actual_provider: string | null;
|
|
871
|
-
model: string;
|
|
872
|
-
model_name: string | null;
|
|
873
|
-
endpoint: string | null;
|
|
874
|
-
request_body: string | null;
|
|
875
|
-
request_headers: string | null;
|
|
876
|
-
response_body: string | null;
|
|
877
|
-
response_headers: string | null;
|
|
878
|
-
status_code: number | null;
|
|
879
|
-
reasoning_content: string | null;
|
|
880
|
-
input_tokens: number | null;
|
|
881
|
-
cached_tokens: number | null;
|
|
882
|
-
output_tokens: number | null;
|
|
883
|
-
reasoning_tokens: number | null;
|
|
884
|
-
total_tokens: number | null;
|
|
885
|
-
latency_ms: number | null;
|
|
886
|
-
time_to_first_token_ms: number | null;
|
|
887
|
-
finish_reason: string | null;
|
|
888
|
-
error: string | null;
|
|
889
|
-
error_type: string | null;
|
|
890
|
-
cost_input: number | null;
|
|
891
|
-
cost_output: number | null;
|
|
892
|
-
cost_total: number | null;
|
|
893
|
-
message_history_length: number | null;
|
|
894
|
-
tools_available: number | null;
|
|
895
|
-
prompt_name: string | null;
|
|
896
|
-
tools_called: string | null;
|
|
897
|
-
provider_tools: string | null;
|
|
898
|
-
parent_log_id: string | null;
|
|
899
|
-
tools_schema: string | null;
|
|
900
|
-
system_prompt: string | null;
|
|
901
|
-
errors: string | null;
|
|
902
|
-
retry_of_log_id: string | null;
|
|
903
|
-
tool_results: string | null;
|
|
904
|
-
is_complete: number;
|
|
905
|
-
created_at: number;
|
|
906
|
-
}
|
|
907
800
|
/**
|
|
908
801
|
* RPC methods exposed by DurableThread for external callers.
|
|
909
802
|
*/
|
|
@@ -927,14 +820,9 @@ interface DurableThreadRpc {
|
|
|
927
820
|
total: number;
|
|
928
821
|
hasMore: boolean;
|
|
929
822
|
}>;
|
|
930
|
-
getLogDetails(logId: string): Promise<
|
|
823
|
+
getLogDetails(logId: string): Promise<unknown>;
|
|
931
824
|
getThreadMeta(threadId: string): Promise<ThreadMetaResponse | null>;
|
|
932
825
|
deleteThread(): Promise<void>;
|
|
933
|
-
readFile(path: string): Promise<{
|
|
934
|
-
success: boolean;
|
|
935
|
-
data?: string;
|
|
936
|
-
error?: string;
|
|
937
|
-
}>;
|
|
938
826
|
}
|
|
939
827
|
/**
|
|
940
828
|
* Thread registry entry from DurableAgentBuilder.
|
|
@@ -954,16 +842,11 @@ interface DurableAgentBuilderRpc {
|
|
|
954
842
|
agent_name: string;
|
|
955
843
|
user_id?: string;
|
|
956
844
|
tags?: string[];
|
|
957
|
-
tenvs?: Record<string, unknown>;
|
|
958
|
-
properties?: Record<string, unknown>;
|
|
959
845
|
}): Promise<ThreadRegistryEntry$1>;
|
|
960
846
|
getThread(threadId: string): Promise<ThreadRegistryEntry$1 | null>;
|
|
961
847
|
listThreads(params?: {
|
|
962
848
|
agent_name?: string;
|
|
963
849
|
user_id?: string;
|
|
964
|
-
search?: string;
|
|
965
|
-
startDate?: number;
|
|
966
|
-
endDate?: number;
|
|
967
850
|
limit?: number;
|
|
968
851
|
offset?: number;
|
|
969
852
|
}): Promise<{
|
|
@@ -1013,49 +896,6 @@ interface ThreadEndpointContext {
|
|
|
1013
896
|
metadata: ThreadMetadata;
|
|
1014
897
|
};
|
|
1015
898
|
}
|
|
1016
|
-
/**
|
|
1017
|
-
* Handler function for builder thread endpoints.
|
|
1018
|
-
*
|
|
1019
|
-
* Unlike the spec's ThreadEndpointHandler which receives ThreadState,
|
|
1020
|
-
* the builder's handler receives direct access to the Durable Object
|
|
1021
|
-
* instance and thread metadata. This allows for lower-level operations
|
|
1022
|
-
* like calling RPC methods directly on the instance.
|
|
1023
|
-
*/
|
|
1024
|
-
type BuilderThreadEndpointHandler = (req: Request, context: {
|
|
1025
|
-
instance: ThreadInstance;
|
|
1026
|
-
metadata: ThreadMetadata;
|
|
1027
|
-
}) => Response | Promise<Response>;
|
|
1028
|
-
/**
|
|
1029
|
-
* Define a thread-specific endpoint with access to the Durable Object instance.
|
|
1030
|
-
*
|
|
1031
|
-
* This is the builder's version of defineThreadEndpoint. It provides direct
|
|
1032
|
-
* access to the thread's Durable Object instance and metadata, allowing
|
|
1033
|
-
* for lower-level operations like calling RPC methods directly.
|
|
1034
|
-
*
|
|
1035
|
-
* @param handler - Function that receives the request and thread context
|
|
1036
|
-
* @returns A Controller that can be used with the router
|
|
1037
|
-
*
|
|
1038
|
-
* @example
|
|
1039
|
-
* ```typescript
|
|
1040
|
-
* import { defineThreadEndpoint } from '@standardagents/builder';
|
|
1041
|
-
*
|
|
1042
|
-
* export default defineThreadEndpoint(async (req, { instance, metadata }) => {
|
|
1043
|
-
* // Access thread metadata
|
|
1044
|
-
* console.log('Thread ID:', metadata.id);
|
|
1045
|
-
* console.log('Agent ID:', metadata.agent_id);
|
|
1046
|
-
*
|
|
1047
|
-
* // Call RPC methods on the Durable Object instance
|
|
1048
|
-
* const messagesResult = await instance.getMessages();
|
|
1049
|
-
* const logs = await instance.getLogs();
|
|
1050
|
-
*
|
|
1051
|
-
* return Response.json({
|
|
1052
|
-
* messageCount: messagesResult.messages.length,
|
|
1053
|
-
* logCount: logs.length,
|
|
1054
|
-
* });
|
|
1055
|
-
* });
|
|
1056
|
-
* ```
|
|
1057
|
-
*/
|
|
1058
|
-
declare function defineThreadEndpoint(handler: BuilderThreadEndpointHandler): BuilderController;
|
|
1059
899
|
|
|
1060
900
|
/**
|
|
1061
901
|
* Define a controller with typed Cloudflare environment bindings.
|
|
@@ -1302,15 +1142,6 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1302
1142
|
* Simple "off" switch - stops turns, only cleared by user messages
|
|
1303
1143
|
*/
|
|
1304
1144
|
stop(): Promise<Response>;
|
|
1305
|
-
/**
|
|
1306
|
-
* Continue execution from where it stopped (RPC method)
|
|
1307
|
-
* Useful for debugging - continues the FlowEngine with additional steps
|
|
1308
|
-
* without adding a new message.
|
|
1309
|
-
*
|
|
1310
|
-
* @param threadId The thread ID
|
|
1311
|
-
* @param side Which side to start from ('a' or 'b'), defaults to 'a'
|
|
1312
|
-
*/
|
|
1313
|
-
continueExecution(threadId: string, side?: 'a' | 'b'): Promise<Response>;
|
|
1314
1145
|
/**
|
|
1315
1146
|
* Get message history (RPC method)
|
|
1316
1147
|
*
|
|
@@ -1423,12 +1254,10 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1423
1254
|
id: string;
|
|
1424
1255
|
message_id: string;
|
|
1425
1256
|
provider: string;
|
|
1426
|
-
actual_provider: string | null;
|
|
1427
1257
|
model: string;
|
|
1428
1258
|
model_name: string | null;
|
|
1429
1259
|
prompt_name: string | null;
|
|
1430
1260
|
tools_called: string | null;
|
|
1431
|
-
provider_tools: string | null;
|
|
1432
1261
|
parent_log_id: string | null;
|
|
1433
1262
|
retry_of_log_id: string | null;
|
|
1434
1263
|
error: string | null;
|
|
@@ -1448,7 +1277,6 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1448
1277
|
id: string;
|
|
1449
1278
|
message_id: string;
|
|
1450
1279
|
provider: string;
|
|
1451
|
-
actual_provider: string | null;
|
|
1452
1280
|
model: string;
|
|
1453
1281
|
model_name: string | null;
|
|
1454
1282
|
endpoint: string | null;
|
|
@@ -1475,7 +1303,6 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1475
1303
|
tools_available: number | null;
|
|
1476
1304
|
prompt_name: string | null;
|
|
1477
1305
|
tools_called: string | null;
|
|
1478
|
-
provider_tools: string | null;
|
|
1479
1306
|
parent_log_id: string | null;
|
|
1480
1307
|
tools_schema: string | null;
|
|
1481
1308
|
message_history: string | null;
|
|
@@ -1584,9 +1411,8 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1584
1411
|
/**
|
|
1585
1412
|
* WebSocket Hibernation API handler for connection close
|
|
1586
1413
|
* Called when a WebSocket connection is closed
|
|
1587
|
-
* Note: Do NOT call ws.close() here - the connection is already closed
|
|
1588
1414
|
*/
|
|
1589
|
-
webSocketClose(ws: WebSocket,
|
|
1415
|
+
webSocketClose(ws: WebSocket, code: number, reason: string, wasClean: boolean): Promise<void>;
|
|
1590
1416
|
/**
|
|
1591
1417
|
* WebSocket Hibernation API handler for errors
|
|
1592
1418
|
* Called when a WebSocket encounters an error
|
|
@@ -1615,11 +1441,6 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1615
1441
|
* This is the actual message processing logic, separate from the public sendMessage() RPC method
|
|
1616
1442
|
*/
|
|
1617
1443
|
private processMessage;
|
|
1618
|
-
/**
|
|
1619
|
-
* Internal method: Continue execution without adding a message (called by alarm queue)
|
|
1620
|
-
* This allows resuming FlowEngine execution from where it stopped.
|
|
1621
|
-
*/
|
|
1622
|
-
private doContinueExecution;
|
|
1623
1444
|
/**
|
|
1624
1445
|
* TEST METHOD: Queue a test operation
|
|
1625
1446
|
* Used for testing alarm queue ordering and timing
|
|
@@ -1931,7 +1752,6 @@ interface AgentBuilderEnv {
|
|
|
1931
1752
|
GITHUB_TOKEN?: string;
|
|
1932
1753
|
GITHUB_REPO?: string;
|
|
1933
1754
|
GITHUB_BRANCH?: string;
|
|
1934
|
-
ENCRYPTION_KEY?: string;
|
|
1935
1755
|
}
|
|
1936
1756
|
/**
|
|
1937
1757
|
* Thread metadata stored in the registry.
|
|
@@ -1941,8 +1761,6 @@ interface ThreadRegistryEntry {
|
|
|
1941
1761
|
agent_name: string;
|
|
1942
1762
|
user_id: string | null;
|
|
1943
1763
|
tags: string[] | null;
|
|
1944
|
-
tenvs: Record<string, unknown> | null;
|
|
1945
|
-
properties: Record<string, unknown> | null;
|
|
1946
1764
|
created_at: number;
|
|
1947
1765
|
}
|
|
1948
1766
|
/**
|
|
@@ -1967,7 +1785,7 @@ interface User {
|
|
|
1967
1785
|
/**
|
|
1968
1786
|
* Provider credentials.
|
|
1969
1787
|
*/
|
|
1970
|
-
interface Provider
|
|
1788
|
+
interface Provider {
|
|
1971
1789
|
name: string;
|
|
1972
1790
|
sdk: string;
|
|
1973
1791
|
api_key: string;
|
|
@@ -2011,8 +1829,6 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
|
|
|
2011
1829
|
agent_name: string;
|
|
2012
1830
|
user_id?: string;
|
|
2013
1831
|
tags?: string[];
|
|
2014
|
-
tenvs?: Record<string, unknown>;
|
|
2015
|
-
properties?: Record<string, unknown>;
|
|
2016
1832
|
}): Promise<ThreadRegistryEntry>;
|
|
2017
1833
|
/**
|
|
2018
1834
|
* Get a thread by ID.
|
|
@@ -2020,15 +1836,10 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
|
|
|
2020
1836
|
getThread(id: string): Promise<ThreadRegistryEntry | null>;
|
|
2021
1837
|
/**
|
|
2022
1838
|
* List threads with optional filtering.
|
|
2023
|
-
* Note: tenvs are not decrypted in list operations for performance.
|
|
2024
|
-
* Use getThread() to retrieve a thread with decrypted tenvs.
|
|
2025
1839
|
*/
|
|
2026
1840
|
listThreads(params?: {
|
|
2027
1841
|
agent_name?: string;
|
|
2028
1842
|
user_id?: string;
|
|
2029
|
-
search?: string;
|
|
2030
|
-
startDate?: number;
|
|
2031
|
-
endDate?: number;
|
|
2032
1843
|
limit?: number;
|
|
2033
1844
|
offset?: number;
|
|
2034
1845
|
}): Promise<{
|
|
@@ -2074,15 +1885,15 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
|
|
|
2074
1885
|
/**
|
|
2075
1886
|
* Get a provider's credentials.
|
|
2076
1887
|
*/
|
|
2077
|
-
getProvider(name: string): Promise<Provider
|
|
1888
|
+
getProvider(name: string): Promise<Provider | null>;
|
|
2078
1889
|
/**
|
|
2079
1890
|
* Set a provider's credentials.
|
|
2080
1891
|
*/
|
|
2081
|
-
setProvider(provider: Provider
|
|
1892
|
+
setProvider(provider: Provider): Promise<void>;
|
|
2082
1893
|
/**
|
|
2083
1894
|
* List all providers.
|
|
2084
1895
|
*/
|
|
2085
|
-
listProviders(): Promise<Provider
|
|
1896
|
+
listProviders(): Promise<Provider[]>;
|
|
2086
1897
|
/**
|
|
2087
1898
|
* Delete a provider.
|
|
2088
1899
|
*/
|
|
@@ -2456,34 +2267,16 @@ interface AgentDefinition<N extends string = string> {
|
|
|
2456
2267
|
exposeAsTool?: boolean;
|
|
2457
2268
|
/** Description shown when agent is used as a tool. */
|
|
2458
2269
|
toolDescription?: string;
|
|
2459
|
-
/**
|
|
2460
|
-
* Thread environment variables for this agent.
|
|
2461
|
-
* Merged into thread tenvs at creation time.
|
|
2462
|
-
* Later values (thread) override earlier ones (prompt -> agent).
|
|
2463
|
-
*/
|
|
2464
|
-
tenvs?: Record<string, unknown>;
|
|
2465
2270
|
/** Brief description of what this agent does. */
|
|
2466
2271
|
description?: string;
|
|
2467
2272
|
/** Icon URL or absolute path for the agent. */
|
|
2468
2273
|
icon?: string;
|
|
2469
2274
|
}
|
|
2470
2275
|
|
|
2471
|
-
/**
|
|
2472
|
-
* Options for generating a model file.
|
|
2473
|
-
*/
|
|
2474
|
-
interface GenerateModelFileOptions {
|
|
2475
|
-
/** The provider export name (e.g., 'openai', 'openrouter') */
|
|
2476
|
-
providerName: string;
|
|
2477
|
-
/** The provider package (e.g., '@standardagents/openai') */
|
|
2478
|
-
providerPackage: string;
|
|
2479
|
-
}
|
|
2480
2276
|
/**
|
|
2481
2277
|
* Generate a TypeScript file for a model definition.
|
|
2482
|
-
*
|
|
2483
|
-
* @param data - The model definition data
|
|
2484
|
-
* @param options - Provider import options (required since providers are functions)
|
|
2485
2278
|
*/
|
|
2486
|
-
declare function generateModelFile(data: ModelDefinition
|
|
2279
|
+
declare function generateModelFile(data: ModelDefinition): string;
|
|
2487
2280
|
|
|
2488
2281
|
/**
|
|
2489
2282
|
* Converts JSON Schema to Zod code string.
|
|
@@ -2522,8 +2315,6 @@ interface ToolConfigInput {
|
|
|
2522
2315
|
include_tool_calls?: boolean;
|
|
2523
2316
|
include_errors?: boolean;
|
|
2524
2317
|
init_user_message_property?: string | null;
|
|
2525
|
-
init_attachments_property?: string | null;
|
|
2526
|
-
tenvs?: Record<string, unknown>;
|
|
2527
2318
|
}
|
|
2528
2319
|
/**
|
|
2529
2320
|
* Prompt part as it comes from the UI/API.
|
|
@@ -3642,15 +3433,4 @@ declare class GitHubApiError extends Error {
|
|
|
3642
3433
|
constructor(message: string, status: number, details?: unknown);
|
|
3643
3434
|
}
|
|
3644
3435
|
|
|
3645
|
-
|
|
3646
|
-
type Provider = LLMProviderInterface;
|
|
3647
|
-
/** @public Alias for ContentPart */
|
|
3648
|
-
type ProviderContentPart = ContentPart;
|
|
3649
|
-
/** @public Alias for TextPart */
|
|
3650
|
-
type ProviderTextPart = TextPart;
|
|
3651
|
-
/** @public Alias for ImagePart */
|
|
3652
|
-
type ProviderImagePart = ImagePart;
|
|
3653
|
-
/** @public Alias for FilePart */
|
|
3654
|
-
type ProviderFilePart = FilePart;
|
|
3655
|
-
|
|
3656
|
-
export { type Agent, type AgentBuilderEnv, type AgentDefinition, type AttachmentRef, type AuthContext, type AuthUser, type BroadcastOptions, type BuilderThreadEndpointHandler, type BuilderController as Controller, type BuilderControllerContext as ControllerContext, DurableAgentBuilder, DurableThread, type Env, type FileRecord, type FileStats, type FlowResult, type FlowState, FlowStateSdk, type FlowStateWithSdk, GitHubApiError, GitHubClient, type GitHubCommitResult, type GitHubConfig, type GitHubFileChange, type GrepResult, type ImageContentPart, type ImageContextConfig, type ImageMetadata, type InjectMessageOptions$1 as InjectMessageOptions, type Provider as LLMProviderInterface, type LLMResponse, type Message, type MessageContent, type ModelDefinition, type MultimodalContent, type PromptContent, type PromptDefinition, type PromptIncludePart, type PromptPart, type Provider$1 as Provider, type ProviderContentPart, type ProviderFilePart, type ProviderImagePart, type ProviderTextPart, type RequestContext, type SideConfig, type StorageBackend, type SubpromptConfig, type TelemetryEvent, type TextContentPart, type ThreadEndpointContext, type ThreadEnv, type ThreadInstance, type ThreadMetadata, type ThreadRegistryEntry, type ToolCall, type ToolConfig, type ToolResult, type UpdateThreadParams, type User, authenticate, buildImageDescription, cat, defineController, defineThreadEndpoint, emitThreadEvent, enhanceFlowState, exists, find, forceTurn, generateAgentFile, generateImageDescription, generateModelFile, generatePromptFile, getFileStats, getMessages, getMessagesToSummarize, getThumbnail, getUnsummarizedImageAttachments, grep, hasImageAttachments, head, injectMessage, linkFile, mkdir, optimizeImageContext, queueTool, readFile, readdir, reloadHistory, replaceImagesWithDescriptions, requireAdmin, requireAuth, rmdir, stat, tail, unlink, updateThread, writeFile, writeImage };
|
|
3436
|
+
export { type Agent, type AgentBuilderEnv, type AgentDefinition, type AttachmentRef, type AuthContext, type AuthUser, type BroadcastOptions, type BuilderController as Controller, type BuilderControllerContext as ControllerContext, DurableAgentBuilder, DurableThread, type Env, type FileRecord, type FileStats, type FlowResult, type FlowState, FlowStateSdk, type FlowStateWithSdk, GitHubApiError, GitHubClient, type GitHubCommitResult, type GitHubConfig, type GitHubFileChange, type GrepResult, type ImageContentPart, type ImageContextConfig, type ImageMetadata, type InjectMessageOptions$1 as InjectMessageOptions, type LLMResponse, type Message, type MessageContent, type ModelDefinition, type MultimodalContent, type PromptContent, type PromptDefinition, type PromptIncludePart, type PromptPart, type Provider, type RequestContext, type SideConfig, type StorageBackend, type SubpromptConfig, type TelemetryEvent, type TextContentPart, type ThreadEndpointContext, type ThreadEnv, type ThreadInstance, type ThreadMetadata, type ThreadRegistryEntry, type ToolCall, type ToolConfig, type ToolResult, type UpdateThreadParams, type User, authenticate, buildImageDescription, cat, defineController, emitThreadEvent, enhanceFlowState, exists, find, forceTurn, generateAgentFile, generateImageDescription, generateModelFile, generatePromptFile, getFileStats, getMessages, getMessagesToSummarize, getThumbnail, getUnsummarizedImageAttachments, grep, hasImageAttachments, head, injectMessage, linkFile, mkdir, optimizeImageContext, queueTool, readFile, readdir, reloadHistory, replaceImagesWithDescriptions, requireAdmin, requireAuth, rmdir, stat, tail, unlink, updateThread, writeFile, writeImage };
|