@standardagents/builder 0.11.2 → 0.11.3

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
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, LLMProviderInterface, ContentPart, TextPart, ImagePart, FilePart } from '@standardagents/spec';
4
+ import { ToolResult as ToolResult$1, HookSignatures, AgentDefinition as AgentDefinition$1, ControllerContext, Controller, ThreadEndpointHandler, ModelDefinition as ModelDefinition$1, ToolArgs, PromptTextPart, SubpromptConfig as SubpromptConfig$2, ReasoningConfig, SideConfig as SideConfig$1, LLMProviderInterface, ContentPart, TextPart, ImagePart, FilePart } from '@standardagents/spec';
5
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';
@@ -1006,6 +1006,7 @@ interface BuilderControllerContext<Env extends ThreadEnv = ThreadEnv> extends Om
1006
1006
  type BuilderController<Env extends ThreadEnv = ThreadEnv> = (context: BuilderControllerContext<Env>) => ReturnType<Controller>;
1007
1007
  /**
1008
1008
  * Thread endpoint context with access to thread instance and metadata.
1009
+ * @deprecated Use ThreadState instead
1009
1010
  */
1010
1011
  interface ThreadEndpointContext {
1011
1012
  req: Request;
@@ -1017,46 +1018,14 @@ interface ThreadEndpointContext {
1017
1018
  /**
1018
1019
  * Handler function for builder thread endpoints.
1019
1020
  *
1020
- * Unlike the spec's ThreadEndpointHandler which receives ThreadState,
1021
- * the builder's handler receives direct access to the Durable Object
1022
- * instance and thread metadata. This allows for lower-level operations
1023
- * like calling RPC methods directly on the instance.
1024
- */
1025
- type BuilderThreadEndpointHandler = (req: Request, context: {
1026
- instance: ThreadInstance;
1027
- metadata: ThreadMetadata;
1028
- }) => Response | Promise<Response>;
1029
- /**
1030
- * Define a thread-specific endpoint with access to the Durable Object instance.
1031
- *
1032
- * This is the builder's version of defineThreadEndpoint. It provides direct
1033
- * access to the thread's Durable Object instance and metadata, allowing
1034
- * for lower-level operations like calling RPC methods directly.
1035
- *
1036
- * @param handler - Function that receives the request and thread context
1037
- * @returns A Controller that can be used with the router
1038
- *
1039
- * @example
1040
- * ```typescript
1041
- * import { defineThreadEndpoint } from '@standardagents/builder';
1042
- *
1043
- * export default defineThreadEndpoint(async (req, { instance, metadata }) => {
1044
- * // Access thread metadata
1045
- * console.log('Thread ID:', metadata.id);
1046
- * console.log('Agent ID:', metadata.agent_id);
1047
- *
1048
- * // Call RPC methods on the Durable Object instance
1049
- * const messagesResult = await instance.getMessages();
1050
- * const logs = await instance.getLogs();
1021
+ * Receives the request and a ThreadState object per the Standard Agents spec.
1022
+ * The ThreadState provides access to thread identity, messages, logs,
1023
+ * resource loading, tool invocation, and more.
1051
1024
  *
1052
- * return Response.json({
1053
- * messageCount: messagesResult.messages.length,
1054
- * logCount: logs.length,
1055
- * });
1056
- * });
1057
- * ```
1025
+ * Note: `state.execution` is always null in endpoints since the thread
1026
+ * is not actively executing.
1058
1027
  */
1059
- declare function defineThreadEndpoint(handler: BuilderThreadEndpointHandler): BuilderController;
1028
+ type BuilderThreadEndpointHandler = ThreadEndpointHandler;
1060
1029
 
1061
1030
  /**
1062
1031
  * Define a controller with typed Cloudflare environment bindings.
@@ -3654,4 +3623,4 @@ type ProviderImagePart = ImagePart;
3654
3623
  /** @public Alias for FilePart */
3655
3624
  type ProviderFilePart = FilePart;
3656
3625
 
3657
- 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 };
3626
+ 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, 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 };