@standardagents/builder 0.11.0-next.22e39d0 → 0.11.0-next.24f9ff1
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 +22754 -6950
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/assets/index.css +1 -1
- package/dist/client/index.js +26 -23
- package/dist/client/vendor.js +1 -1
- package/dist/client/vue.js +1 -1
- package/dist/index.d.ts +224 -26
- package/dist/index.js +3119 -1240
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +6 -0
- package/dist/plugin.js +238 -56
- package/dist/plugin.js.map +1 -1
- package/package.json +4 -4
- package/dist/client/assets/img/meta.svg +0 -19
- package/dist/client/assets/img/moonshotai.svg +0 -4
- package/dist/client/assets/img/zai.svg +0 -219
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, 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,
|
|
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, LLMProviderInterface, ContentPart, TextPart, ImagePart, FilePart } from '@standardagents/spec';
|
|
5
|
+
export { AgentType, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, PromptInput, PromptTextPart, ProviderAssistantMessage, ProviderError, ProviderErrorCode, ProviderFactory, ProviderFactoryConfig, ProviderFinishReason, ProviderGeneratedImage, ProviderMessage, ProviderMessageContent, ModelCapabilities as ProviderModelCapabilities, ProviderReasoningDetail, ProviderRequest, ProviderResponse, ProviderStreamChunk, ProviderSystemMessage, ProviderTool, ProviderToolCallPart, ProviderToolMessage, ProviderToolResultContent, ProviderUsage, ProviderUserMessage, ReasoningConfig, StructuredPrompt, TextContent, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, defineAgent, defineHook, defineModel, definePrompt, defineTool, mapReasoningLevel } from '@standardagents/spec';
|
|
6
6
|
import { DurableObject } from 'cloudflare:workers';
|
|
7
7
|
import 'vite';
|
|
8
8
|
|
|
@@ -213,6 +213,8 @@ interface ThreadMetadata {
|
|
|
213
213
|
id: string;
|
|
214
214
|
agent_id: string;
|
|
215
215
|
user_id: string | null;
|
|
216
|
+
tenvs: Record<string, unknown> | null;
|
|
217
|
+
properties: Record<string, unknown> | null;
|
|
216
218
|
created_at: number;
|
|
217
219
|
}
|
|
218
220
|
/**
|
|
@@ -226,7 +228,26 @@ type HookRegistry = {
|
|
|
226
228
|
* Tools can have args (with validation schema) or no args.
|
|
227
229
|
* Uses local Zod types for compatibility with z.toJSONSchema().
|
|
228
230
|
*/
|
|
229
|
-
|
|
231
|
+
interface NativeToolModule {
|
|
232
|
+
/** Description of what the tool does (shown to the LLM). */
|
|
233
|
+
description: string;
|
|
234
|
+
/** Zod schema for validating tool arguments, or null for no args. */
|
|
235
|
+
args: ZodObject<ZodRawShape> | null;
|
|
236
|
+
/** The tool implementation function. */
|
|
237
|
+
execute: ((state: any, args: Record<string, unknown>) => Promise<ToolResult$1>) | ((state: any) => Promise<ToolResult$1>);
|
|
238
|
+
/** Zod schema for thread environment variables, or null if none. */
|
|
239
|
+
tenvs?: ZodObject<ZodRawShape> | null;
|
|
240
|
+
/**
|
|
241
|
+
* Where this tool is executed:
|
|
242
|
+
* - 'local': Execute locally by the execution engine (default)
|
|
243
|
+
* - 'provider': Executed by the LLM provider, results come in response
|
|
244
|
+
*/
|
|
245
|
+
executionMode?: 'local' | 'provider';
|
|
246
|
+
/**
|
|
247
|
+
* Which provider executes this tool (when executionMode='provider').
|
|
248
|
+
*/
|
|
249
|
+
executionProvider?: string;
|
|
250
|
+
}
|
|
230
251
|
/**
|
|
231
252
|
* Thread instance (forward reference to avoid circular dependency)
|
|
232
253
|
*/
|
|
@@ -253,7 +274,11 @@ interface ThreadInstance {
|
|
|
253
274
|
getPromptNames(): string[];
|
|
254
275
|
getAgentNames(): string[];
|
|
255
276
|
writeFile(path: string, data: ArrayBuffer | string, mimeType: string, options?: Record<string, unknown>): Promise<any>;
|
|
256
|
-
readFile(path: string): Promise<
|
|
277
|
+
readFile(path: string): Promise<{
|
|
278
|
+
success: boolean;
|
|
279
|
+
data?: string;
|
|
280
|
+
error?: string;
|
|
281
|
+
}>;
|
|
257
282
|
statFile(path: string): Promise<any>;
|
|
258
283
|
readdirFile(path: string): Promise<any[]>;
|
|
259
284
|
unlinkFile(path: string): Promise<void>;
|
|
@@ -316,6 +341,7 @@ type FlowCallWithRetries = FlowCall & {
|
|
|
316
341
|
interface SubpromptConfig$1 {
|
|
317
342
|
name: string;
|
|
318
343
|
initUserMessageProperty?: string;
|
|
344
|
+
initAttachmentsProperty?: string;
|
|
319
345
|
includeTextResponse?: boolean;
|
|
320
346
|
includeToolCalls?: boolean;
|
|
321
347
|
includeErrors?: boolean;
|
|
@@ -406,6 +432,7 @@ interface FlowState {
|
|
|
406
432
|
depth: number;
|
|
407
433
|
pendingMessageId?: string;
|
|
408
434
|
allowedTools?: ToolDefinition[];
|
|
435
|
+
pendingMetadataPromises?: Promise<void>[];
|
|
409
436
|
}
|
|
410
437
|
/**
|
|
411
438
|
* Text content part for multimodal messages
|
|
@@ -442,6 +469,10 @@ interface RequestContext {
|
|
|
442
469
|
tool_calls?: ToolCall[];
|
|
443
470
|
tool_call_id?: string;
|
|
444
471
|
name?: string;
|
|
472
|
+
reasoning_content?: string;
|
|
473
|
+
reasoning_details?: any[];
|
|
474
|
+
attachments?: any[];
|
|
475
|
+
toolName?: string;
|
|
445
476
|
}>;
|
|
446
477
|
model: string;
|
|
447
478
|
tools?: ToolDefinition[];
|
|
@@ -473,6 +504,17 @@ interface ToolDefinition {
|
|
|
473
504
|
description: string;
|
|
474
505
|
parameters?: Record<string, any>;
|
|
475
506
|
};
|
|
507
|
+
/**
|
|
508
|
+
* Where this tool is executed:
|
|
509
|
+
* - 'local': Execute locally by the execution engine (default)
|
|
510
|
+
* - 'provider': Executed by the LLM provider, results come in response
|
|
511
|
+
*/
|
|
512
|
+
executionMode?: 'local' | 'provider';
|
|
513
|
+
/**
|
|
514
|
+
* Which provider executes this tool (when executionMode='provider')
|
|
515
|
+
* e.g., 'openai', 'anthropic'
|
|
516
|
+
*/
|
|
517
|
+
executionProvider?: string;
|
|
476
518
|
}
|
|
477
519
|
/**
|
|
478
520
|
* Image returned by an LLM response (e.g., from image generation models)
|
|
@@ -480,6 +522,12 @@ interface ToolDefinition {
|
|
|
480
522
|
*/
|
|
481
523
|
interface LLMResponseImage {
|
|
482
524
|
type: "image_url";
|
|
525
|
+
/** Unique ID for this generated image (used to link to tool call) */
|
|
526
|
+
id?: string;
|
|
527
|
+
/** Name of the tool that generated this image (e.g., 'image_generation') */
|
|
528
|
+
toolName?: string;
|
|
529
|
+
/** The revised/actual prompt used to generate the image (from OpenAI's image_generation) */
|
|
530
|
+
revisedPrompt?: string;
|
|
483
531
|
image_url: {
|
|
484
532
|
url: string;
|
|
485
533
|
};
|
|
@@ -509,6 +557,12 @@ interface LLMResponse {
|
|
|
509
557
|
cost?: number;
|
|
510
558
|
provider?: string;
|
|
511
559
|
};
|
|
560
|
+
/** @internal Provider instance reference for async metadata fetching */
|
|
561
|
+
_provider?: unknown;
|
|
562
|
+
/** @internal Provider response ID for async metadata fetching */
|
|
563
|
+
_providerResponseId?: string;
|
|
564
|
+
/** @internal Aggregate response for logging */
|
|
565
|
+
_aggregate_response?: unknown;
|
|
512
566
|
}
|
|
513
567
|
/**
|
|
514
568
|
* Attachment returned by a tool (e.g., generated images)
|
|
@@ -641,6 +695,7 @@ interface LogData {
|
|
|
641
695
|
tools_available?: number;
|
|
642
696
|
prompt_name?: string;
|
|
643
697
|
tools_called?: string;
|
|
698
|
+
actual_provider?: string | null;
|
|
644
699
|
parent_log_id?: string | null;
|
|
645
700
|
tools_schema?: string | null;
|
|
646
701
|
message_history?: string | null;
|
|
@@ -785,20 +840,6 @@ interface LogEntry {
|
|
|
785
840
|
created_at: number;
|
|
786
841
|
request_body: string | null;
|
|
787
842
|
}
|
|
788
|
-
/**
|
|
789
|
-
* Agent definition returned from loadAgent()
|
|
790
|
-
*/
|
|
791
|
-
interface AgentDefinition$1 {
|
|
792
|
-
name: string;
|
|
793
|
-
title?: string;
|
|
794
|
-
type?: string;
|
|
795
|
-
description?: string;
|
|
796
|
-
icon?: string;
|
|
797
|
-
defaultPrompt?: string;
|
|
798
|
-
defaultModel?: string;
|
|
799
|
-
tools?: string[];
|
|
800
|
-
[key: string]: unknown;
|
|
801
|
-
}
|
|
802
843
|
/**
|
|
803
844
|
* Response from getThreadMeta()
|
|
804
845
|
*/
|
|
@@ -811,6 +852,50 @@ interface ThreadMetaResponse {
|
|
|
811
852
|
lastActivity: number | null;
|
|
812
853
|
};
|
|
813
854
|
}
|
|
855
|
+
/**
|
|
856
|
+
* Log details returned by getLogDetails
|
|
857
|
+
*/
|
|
858
|
+
interface LogDetails {
|
|
859
|
+
id: string;
|
|
860
|
+
message_id: string;
|
|
861
|
+
provider: string;
|
|
862
|
+
actual_provider: string | null;
|
|
863
|
+
model: string;
|
|
864
|
+
model_name: string | null;
|
|
865
|
+
endpoint: string | null;
|
|
866
|
+
request_body: string | null;
|
|
867
|
+
request_headers: string | null;
|
|
868
|
+
response_body: string | null;
|
|
869
|
+
response_headers: string | null;
|
|
870
|
+
status_code: number | null;
|
|
871
|
+
reasoning_content: string | null;
|
|
872
|
+
input_tokens: number | null;
|
|
873
|
+
cached_tokens: number | null;
|
|
874
|
+
output_tokens: number | null;
|
|
875
|
+
reasoning_tokens: number | null;
|
|
876
|
+
total_tokens: number | null;
|
|
877
|
+
latency_ms: number | null;
|
|
878
|
+
time_to_first_token_ms: number | null;
|
|
879
|
+
finish_reason: string | null;
|
|
880
|
+
error: string | null;
|
|
881
|
+
error_type: string | null;
|
|
882
|
+
cost_input: number | null;
|
|
883
|
+
cost_output: number | null;
|
|
884
|
+
cost_total: number | null;
|
|
885
|
+
message_history_length: number | null;
|
|
886
|
+
tools_available: number | null;
|
|
887
|
+
prompt_name: string | null;
|
|
888
|
+
tools_called: string | null;
|
|
889
|
+
provider_tools: string | null;
|
|
890
|
+
parent_log_id: string | null;
|
|
891
|
+
tools_schema: string | null;
|
|
892
|
+
system_prompt: string | null;
|
|
893
|
+
errors: string | null;
|
|
894
|
+
retry_of_log_id: string | null;
|
|
895
|
+
tool_results: string | null;
|
|
896
|
+
is_complete: number;
|
|
897
|
+
created_at: number;
|
|
898
|
+
}
|
|
814
899
|
/**
|
|
815
900
|
* RPC methods exposed by DurableThread for external callers.
|
|
816
901
|
*/
|
|
@@ -834,9 +919,14 @@ interface DurableThreadRpc {
|
|
|
834
919
|
total: number;
|
|
835
920
|
hasMore: boolean;
|
|
836
921
|
}>;
|
|
837
|
-
getLogDetails(logId: string): Promise<
|
|
922
|
+
getLogDetails(logId: string): Promise<LogDetails | null>;
|
|
838
923
|
getThreadMeta(threadId: string): Promise<ThreadMetaResponse | null>;
|
|
839
924
|
deleteThread(): Promise<void>;
|
|
925
|
+
readFile(path: string): Promise<{
|
|
926
|
+
success: boolean;
|
|
927
|
+
data?: string;
|
|
928
|
+
error?: string;
|
|
929
|
+
}>;
|
|
840
930
|
}
|
|
841
931
|
/**
|
|
842
932
|
* Thread registry entry from DurableAgentBuilder.
|
|
@@ -856,11 +946,16 @@ interface DurableAgentBuilderRpc {
|
|
|
856
946
|
agent_name: string;
|
|
857
947
|
user_id?: string;
|
|
858
948
|
tags?: string[];
|
|
949
|
+
tenvs?: Record<string, unknown>;
|
|
950
|
+
properties?: Record<string, unknown>;
|
|
859
951
|
}): Promise<ThreadRegistryEntry$1>;
|
|
860
952
|
getThread(threadId: string): Promise<ThreadRegistryEntry$1 | null>;
|
|
861
953
|
listThreads(params?: {
|
|
862
954
|
agent_name?: string;
|
|
863
955
|
user_id?: string;
|
|
956
|
+
search?: string;
|
|
957
|
+
startDate?: number;
|
|
958
|
+
endDate?: number;
|
|
864
959
|
limit?: number;
|
|
865
960
|
offset?: number;
|
|
866
961
|
}): Promise<{
|
|
@@ -910,6 +1005,49 @@ interface ThreadEndpointContext {
|
|
|
910
1005
|
metadata: ThreadMetadata;
|
|
911
1006
|
};
|
|
912
1007
|
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Handler function for builder thread endpoints.
|
|
1010
|
+
*
|
|
1011
|
+
* Unlike the spec's ThreadEndpointHandler which receives ThreadState,
|
|
1012
|
+
* the builder's handler receives direct access to the Durable Object
|
|
1013
|
+
* instance and thread metadata. This allows for lower-level operations
|
|
1014
|
+
* like calling RPC methods directly on the instance.
|
|
1015
|
+
*/
|
|
1016
|
+
type BuilderThreadEndpointHandler = (req: Request, context: {
|
|
1017
|
+
instance: ThreadInstance;
|
|
1018
|
+
metadata: ThreadMetadata;
|
|
1019
|
+
}) => Response | Promise<Response>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Define a thread-specific endpoint with access to the Durable Object instance.
|
|
1022
|
+
*
|
|
1023
|
+
* This is the builder's version of defineThreadEndpoint. It provides direct
|
|
1024
|
+
* access to the thread's Durable Object instance and metadata, allowing
|
|
1025
|
+
* for lower-level operations like calling RPC methods directly.
|
|
1026
|
+
*
|
|
1027
|
+
* @param handler - Function that receives the request and thread context
|
|
1028
|
+
* @returns A Controller that can be used with the router
|
|
1029
|
+
*
|
|
1030
|
+
* @example
|
|
1031
|
+
* ```typescript
|
|
1032
|
+
* import { defineThreadEndpoint } from '@standardagents/builder';
|
|
1033
|
+
*
|
|
1034
|
+
* export default defineThreadEndpoint(async (req, { instance, metadata }) => {
|
|
1035
|
+
* // Access thread metadata
|
|
1036
|
+
* console.log('Thread ID:', metadata.id);
|
|
1037
|
+
* console.log('Agent ID:', metadata.agent_id);
|
|
1038
|
+
*
|
|
1039
|
+
* // Call RPC methods on the Durable Object instance
|
|
1040
|
+
* const messagesResult = await instance.getMessages();
|
|
1041
|
+
* const logs = await instance.getLogs();
|
|
1042
|
+
*
|
|
1043
|
+
* return Response.json({
|
|
1044
|
+
* messageCount: messagesResult.messages.length,
|
|
1045
|
+
* logCount: logs.length,
|
|
1046
|
+
* });
|
|
1047
|
+
* });
|
|
1048
|
+
* ```
|
|
1049
|
+
*/
|
|
1050
|
+
declare function defineThreadEndpoint(handler: BuilderThreadEndpointHandler): BuilderController;
|
|
913
1051
|
|
|
914
1052
|
/**
|
|
915
1053
|
* Define a controller with typed Cloudflare environment bindings.
|
|
@@ -1156,6 +1294,15 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1156
1294
|
* Simple "off" switch - stops turns, only cleared by user messages
|
|
1157
1295
|
*/
|
|
1158
1296
|
stop(): Promise<Response>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Continue execution from where it stopped (RPC method)
|
|
1299
|
+
* Useful for debugging - continues the FlowEngine with additional steps
|
|
1300
|
+
* without adding a new message.
|
|
1301
|
+
*
|
|
1302
|
+
* @param threadId The thread ID
|
|
1303
|
+
* @param side Which side to start from ('a' or 'b'), defaults to 'a'
|
|
1304
|
+
*/
|
|
1305
|
+
continueExecution(threadId: string, side?: 'a' | 'b'): Promise<Response>;
|
|
1159
1306
|
/**
|
|
1160
1307
|
* Get message history (RPC method)
|
|
1161
1308
|
*
|
|
@@ -1268,10 +1415,12 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1268
1415
|
id: string;
|
|
1269
1416
|
message_id: string;
|
|
1270
1417
|
provider: string;
|
|
1418
|
+
actual_provider: string | null;
|
|
1271
1419
|
model: string;
|
|
1272
1420
|
model_name: string | null;
|
|
1273
1421
|
prompt_name: string | null;
|
|
1274
1422
|
tools_called: string | null;
|
|
1423
|
+
provider_tools: string | null;
|
|
1275
1424
|
parent_log_id: string | null;
|
|
1276
1425
|
retry_of_log_id: string | null;
|
|
1277
1426
|
error: string | null;
|
|
@@ -1291,6 +1440,7 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1291
1440
|
id: string;
|
|
1292
1441
|
message_id: string;
|
|
1293
1442
|
provider: string;
|
|
1443
|
+
actual_provider: string | null;
|
|
1294
1444
|
model: string;
|
|
1295
1445
|
model_name: string | null;
|
|
1296
1446
|
endpoint: string | null;
|
|
@@ -1317,6 +1467,7 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1317
1467
|
tools_available: number | null;
|
|
1318
1468
|
prompt_name: string | null;
|
|
1319
1469
|
tools_called: string | null;
|
|
1470
|
+
provider_tools: string | null;
|
|
1320
1471
|
parent_log_id: string | null;
|
|
1321
1472
|
tools_schema: string | null;
|
|
1322
1473
|
message_history: string | null;
|
|
@@ -1425,8 +1576,9 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1425
1576
|
/**
|
|
1426
1577
|
* WebSocket Hibernation API handler for connection close
|
|
1427
1578
|
* Called when a WebSocket connection is closed
|
|
1579
|
+
* Note: Do NOT call ws.close() here - the connection is already closed
|
|
1428
1580
|
*/
|
|
1429
|
-
webSocketClose(ws: WebSocket,
|
|
1581
|
+
webSocketClose(ws: WebSocket, _code: number, _reason: string, _wasClean: boolean): Promise<void>;
|
|
1430
1582
|
/**
|
|
1431
1583
|
* WebSocket Hibernation API handler for errors
|
|
1432
1584
|
* Called when a WebSocket encounters an error
|
|
@@ -1455,6 +1607,11 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1455
1607
|
* This is the actual message processing logic, separate from the public sendMessage() RPC method
|
|
1456
1608
|
*/
|
|
1457
1609
|
private processMessage;
|
|
1610
|
+
/**
|
|
1611
|
+
* Internal method: Continue execution without adding a message (called by alarm queue)
|
|
1612
|
+
* This allows resuming FlowEngine execution from where it stopped.
|
|
1613
|
+
*/
|
|
1614
|
+
private doContinueExecution;
|
|
1458
1615
|
/**
|
|
1459
1616
|
* TEST METHOD: Queue a test operation
|
|
1460
1617
|
* Used for testing alarm queue ordering and timing
|
|
@@ -1766,6 +1923,7 @@ interface AgentBuilderEnv {
|
|
|
1766
1923
|
GITHUB_TOKEN?: string;
|
|
1767
1924
|
GITHUB_REPO?: string;
|
|
1768
1925
|
GITHUB_BRANCH?: string;
|
|
1926
|
+
ENCRYPTION_KEY?: string;
|
|
1769
1927
|
}
|
|
1770
1928
|
/**
|
|
1771
1929
|
* Thread metadata stored in the registry.
|
|
@@ -1775,6 +1933,8 @@ interface ThreadRegistryEntry {
|
|
|
1775
1933
|
agent_name: string;
|
|
1776
1934
|
user_id: string | null;
|
|
1777
1935
|
tags: string[] | null;
|
|
1936
|
+
tenvs: Record<string, unknown> | null;
|
|
1937
|
+
properties: Record<string, unknown> | null;
|
|
1778
1938
|
created_at: number;
|
|
1779
1939
|
}
|
|
1780
1940
|
/**
|
|
@@ -1799,7 +1959,7 @@ interface User {
|
|
|
1799
1959
|
/**
|
|
1800
1960
|
* Provider credentials.
|
|
1801
1961
|
*/
|
|
1802
|
-
interface Provider {
|
|
1962
|
+
interface Provider$1 {
|
|
1803
1963
|
name: string;
|
|
1804
1964
|
sdk: string;
|
|
1805
1965
|
api_key: string;
|
|
@@ -1843,6 +2003,8 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
|
|
|
1843
2003
|
agent_name: string;
|
|
1844
2004
|
user_id?: string;
|
|
1845
2005
|
tags?: string[];
|
|
2006
|
+
tenvs?: Record<string, unknown>;
|
|
2007
|
+
properties?: Record<string, unknown>;
|
|
1846
2008
|
}): Promise<ThreadRegistryEntry>;
|
|
1847
2009
|
/**
|
|
1848
2010
|
* Get a thread by ID.
|
|
@@ -1850,10 +2012,15 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
|
|
|
1850
2012
|
getThread(id: string): Promise<ThreadRegistryEntry | null>;
|
|
1851
2013
|
/**
|
|
1852
2014
|
* List threads with optional filtering.
|
|
2015
|
+
* Note: tenvs are not decrypted in list operations for performance.
|
|
2016
|
+
* Use getThread() to retrieve a thread with decrypted tenvs.
|
|
1853
2017
|
*/
|
|
1854
2018
|
listThreads(params?: {
|
|
1855
2019
|
agent_name?: string;
|
|
1856
2020
|
user_id?: string;
|
|
2021
|
+
search?: string;
|
|
2022
|
+
startDate?: number;
|
|
2023
|
+
endDate?: number;
|
|
1857
2024
|
limit?: number;
|
|
1858
2025
|
offset?: number;
|
|
1859
2026
|
}): Promise<{
|
|
@@ -1899,15 +2066,15 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
|
|
|
1899
2066
|
/**
|
|
1900
2067
|
* Get a provider's credentials.
|
|
1901
2068
|
*/
|
|
1902
|
-
getProvider(name: string): Promise<Provider | null>;
|
|
2069
|
+
getProvider(name: string): Promise<Provider$1 | null>;
|
|
1903
2070
|
/**
|
|
1904
2071
|
* Set a provider's credentials.
|
|
1905
2072
|
*/
|
|
1906
|
-
setProvider(provider: Provider): Promise<void>;
|
|
2073
|
+
setProvider(provider: Provider$1): Promise<void>;
|
|
1907
2074
|
/**
|
|
1908
2075
|
* List all providers.
|
|
1909
2076
|
*/
|
|
1910
|
-
listProviders(): Promise<Provider[]>;
|
|
2077
|
+
listProviders(): Promise<Provider$1[]>;
|
|
1911
2078
|
/**
|
|
1912
2079
|
* Delete a provider.
|
|
1913
2080
|
*/
|
|
@@ -2281,16 +2448,34 @@ interface AgentDefinition<N extends string = string> {
|
|
|
2281
2448
|
exposeAsTool?: boolean;
|
|
2282
2449
|
/** Description shown when agent is used as a tool. */
|
|
2283
2450
|
toolDescription?: string;
|
|
2451
|
+
/**
|
|
2452
|
+
* Thread environment variables for this agent.
|
|
2453
|
+
* Merged into thread tenvs at creation time.
|
|
2454
|
+
* Later values (thread) override earlier ones (prompt -> agent).
|
|
2455
|
+
*/
|
|
2456
|
+
tenvs?: Record<string, unknown>;
|
|
2284
2457
|
/** Brief description of what this agent does. */
|
|
2285
2458
|
description?: string;
|
|
2286
2459
|
/** Icon URL or absolute path for the agent. */
|
|
2287
2460
|
icon?: string;
|
|
2288
2461
|
}
|
|
2289
2462
|
|
|
2463
|
+
/**
|
|
2464
|
+
* Options for generating a model file.
|
|
2465
|
+
*/
|
|
2466
|
+
interface GenerateModelFileOptions {
|
|
2467
|
+
/** The provider export name (e.g., 'openai', 'openrouter') */
|
|
2468
|
+
providerName: string;
|
|
2469
|
+
/** The provider package (e.g., '@standardagents/openai') */
|
|
2470
|
+
providerPackage: string;
|
|
2471
|
+
}
|
|
2290
2472
|
/**
|
|
2291
2473
|
* Generate a TypeScript file for a model definition.
|
|
2474
|
+
*
|
|
2475
|
+
* @param data - The model definition data
|
|
2476
|
+
* @param options - Provider import options (required since providers are functions)
|
|
2292
2477
|
*/
|
|
2293
|
-
declare function generateModelFile(data: ModelDefinition): string;
|
|
2478
|
+
declare function generateModelFile(data: ModelDefinition, options: GenerateModelFileOptions): string;
|
|
2294
2479
|
|
|
2295
2480
|
/**
|
|
2296
2481
|
* Converts JSON Schema to Zod code string.
|
|
@@ -2329,6 +2514,8 @@ interface ToolConfigInput {
|
|
|
2329
2514
|
include_tool_calls?: boolean;
|
|
2330
2515
|
include_errors?: boolean;
|
|
2331
2516
|
init_user_message_property?: string | null;
|
|
2517
|
+
init_attachments_property?: string | null;
|
|
2518
|
+
tenvs?: Record<string, unknown>;
|
|
2332
2519
|
}
|
|
2333
2520
|
/**
|
|
2334
2521
|
* Prompt part as it comes from the UI/API.
|
|
@@ -3447,4 +3634,15 @@ declare class GitHubApiError extends Error {
|
|
|
3447
3634
|
constructor(message: string, status: number, details?: unknown);
|
|
3448
3635
|
}
|
|
3449
3636
|
|
|
3450
|
-
|
|
3637
|
+
/** @public Alias for LLMProviderInterface */
|
|
3638
|
+
type Provider = LLMProviderInterface;
|
|
3639
|
+
/** @public Alias for ContentPart */
|
|
3640
|
+
type ProviderContentPart = ContentPart;
|
|
3641
|
+
/** @public Alias for TextPart */
|
|
3642
|
+
type ProviderTextPart = TextPart;
|
|
3643
|
+
/** @public Alias for ImagePart */
|
|
3644
|
+
type ProviderImagePart = ImagePart;
|
|
3645
|
+
/** @public Alias for FilePart */
|
|
3646
|
+
type ProviderFilePart = FilePart;
|
|
3647
|
+
|
|
3648
|
+
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 };
|