@standardagents/builder 0.38.2 → 0.39.1

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/runtime.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { j as AuthContext, e as ThreadEnv, w as Agent, y as ThreadMetadata, z as ToolResult, M as Message, o as ClientToolRequest, p as ClientToolResponse, q as ClientStreamRequest, t as ClientStreamResponse, H as FileRecord, V as SkillStorageScope, F as FlowState, N as FileStats, K as GrepResult, J as AttachmentRef, U as MessageContent, G as Env, x as ThreadInstance } from './index-CF-lgN47.js';
2
- export { A as AuthUser, f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, u as ClientDuplex, v as ClientForwarding, B as Controller, a as ControllerContext, D as FlowResult, P as ImageContentPart, I as ImageMetadata, L as LLMResponse, Q as MultimodalContent, R as RequestContext, S as StorageBackend, E as TelemetryEvent, O as TextContentPart, b as ThreadEndpointContext, T as ToolCall, g as authenticate, k as callClient, l as callClientStream, c as createThreadEndpointHandler, n as decodeStreamChunk, d as defineController, m as encodeStreamChunk, i as endpointCallerFromAuth, h as requireAdmin, r as requireAuth, s as supportsClientForwarding } from './index-CF-lgN47.js';
1
+ import { j as AuthContext, e as ThreadEnv, w as Agent, y as ThreadMetadata, z as ToolResult, M as Message, o as ClientToolRequest, p as ClientToolResponse, q as ClientStreamRequest, t as ClientStreamResponse, H as FileRecord, V as SkillStorageScope, F as FlowState, N as FileStats, K as GrepResult, J as AttachmentRef, U as MessageContent, G as Env, x as ThreadInstance } from './index-yIcqf7DC.js';
2
+ export { A as AuthUser, f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, u as ClientDuplex, v as ClientForwarding, B as Controller, a as ControllerContext, D as FlowResult, P as ImageContentPart, I as ImageMetadata, L as LLMResponse, Q as MultimodalContent, R as RequestContext, S as StorageBackend, E as TelemetryEvent, O as TextContentPart, b as ThreadEndpointContext, T as ToolCall, g as authenticate, k as callClient, l as callClientStream, c as createThreadEndpointHandler, n as decodeStreamChunk, d as defineController, m as encodeStreamChunk, i as endpointCallerFromAuth, h as requireAdmin, r as requireAuth, s as supportsClientForwarding } from './index-yIcqf7DC.js';
3
3
  import { CodeExecutionOptions, CodeExecutionResult, SubagentRegistryEntry, InjectMessageInput, QueueMessageInput, CredentialGrant, SkillMetadata, SkillFileInput, ModelDefinition as ModelDefinition$1, ToolArgs, PromptTextPart, PromptEnvPart, VariableDefinition, SubpromptConfig as SubpromptConfig$1, PromptToolConfig as PromptToolConfig$1, SubagentToolConfig as SubagentToolConfig$1, ReasoningConfig, SideConfig as SideConfig$1, LLMProviderInterface, ContentPart, TextPart, ImagePart, FilePart, ThreadState, NamespaceContext, DefinitionLoader } from '@standardagents/spec';
4
4
  export { AgentType, DefinitionLoader, GlobalNamespaceContext, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, NamespaceContext, PackageSignature, PackedExports, PackedMeta, PackedMetadata, PackedNamespaceContext, 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, belongsToPackage, defineAgent, defineHook, defineModel, definePrompt, defineTool, isPacked, isVisibleInNamespace, mapReasoningLevel } from '@standardagents/spec';
5
5
  import { DurableObject, WorkerEntrypoint } from 'cloudflare:workers';
@@ -512,6 +512,11 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
512
512
  private getThreadNameFromTags;
513
513
  private toSubagentProjection;
514
514
  private resolveSubagentMessageProjections;
515
+ /**
516
+ * Build hook resolution context and a genuine at-rest ThreadState.
517
+ * Resolution failures abort insertion so lifecycle hooks cannot be bypassed.
518
+ */
519
+ private buildAtRestHookState;
515
520
  /**
516
521
  * Inject a top-level message without starting a new execution.
517
522
  *
@@ -3187,7 +3192,7 @@ interface AgentDefinition<N extends string = string> {
3187
3192
  /**
3188
3193
  * Options for injecting a message
3189
3194
  */
3190
- interface InjectMessageOptions$1 {
3195
+ interface InjectMessageOptions {
3191
3196
  /** The message content */
3192
3197
  content: string;
3193
3198
  /** The message role */
@@ -3200,7 +3205,7 @@ interface InjectMessageOptions$1 {
3200
3205
  toolCallId?: string;
3201
3206
  /** Optional name field */
3202
3207
  name?: string;
3203
- /** Whether this message is silent (hidden from LLM, visible in UI only). Default: false */
3208
+ /** Whether this message is silent (not shown in UI). Default: false */
3204
3209
  silent?: boolean;
3205
3210
  /** Optional structured metadata */
3206
3211
  metadata?: Record<string, unknown>;
@@ -3268,7 +3273,7 @@ declare function queueTool(flow: FlowState, toolName: string, args?: Record<stri
3268
3273
  * });
3269
3274
  * ```
3270
3275
  */
3271
- declare function injectMessage(flow: FlowState, options: InjectMessageOptions$1): Promise<Message>;
3276
+ declare function injectMessage(flow: FlowState, options: InjectMessageOptions): Promise<Message>;
3272
3277
  /**
3273
3278
  * Get messages from the thread history
3274
3279
  *
@@ -3299,9 +3304,9 @@ declare function getMessages(flow: FlowState, limit?: number, offset?: number, o
3299
3304
  /**
3300
3305
  * Reload message history from storage
3301
3306
  *
3302
- * Re-loads the complete message history from the thread's SQLite storage,
3303
- * applying any filter_messages hooks. This is useful when you need to refresh
3304
- * the message history after making changes (e.g., injecting silent messages).
3307
+ * Re-loads the complete message history from the thread's SQLite storage.
3308
+ * This is useful when you need to refresh the message history after making
3309
+ * changes (e.g., injecting messages).
3305
3310
  *
3306
3311
  * @param flow - The current FlowState
3307
3312
  * @returns Array of messages (reloaded from storage)
@@ -3811,29 +3816,6 @@ declare function find(flow: FlowState, pattern: string, options?: {
3811
3816
  limit?: number;
3812
3817
  }): Promise<FileRecord[]>;
3813
3818
 
3814
- /**
3815
- * Options for injecting a message
3816
- */
3817
- interface InjectMessageOptions {
3818
- /** The message content */
3819
- content: string;
3820
- /** The message role */
3821
- role: "system" | "user" | "assistant" | "tool";
3822
- /** Optional message ID. If not provided, a UUID will be generated */
3823
- id?: string;
3824
- /** Optional message to insert before. If not provided, message is appended to the end */
3825
- beforeMessageId?: string;
3826
- /** Optional tool call ID (for role="tool" only) */
3827
- toolCallId?: string;
3828
- /** Optional name field */
3829
- name?: string;
3830
- /** Whether this message is silent (hidden from LLM, visible in UI only). Default: false */
3831
- silent?: boolean;
3832
- /** Force message to be top-level (depth 0) even when called from sub-prompts. Default: false */
3833
- forceTopLevel?: boolean;
3834
- /** Force a specific side to play the next turn after injecting the message */
3835
- forceTurn?: "side_a" | "side_b";
3836
- }
3837
3819
  /**
3838
3820
  * Options for broadcasting custom data
3839
3821
  */
@@ -3933,9 +3915,9 @@ declare class FlowStateSdk {
3933
3915
  /**
3934
3916
  * Reload message history from storage
3935
3917
  *
3936
- * Re-loads the complete message history from the thread's SQLite storage,
3937
- * applying any filter_messages hooks. This is useful when you need to refresh
3938
- * the message history after making changes (e.g., injecting silent messages).
3918
+ * Re-loads the complete message history from the thread's SQLite storage.
3919
+ * This is useful when you need to refresh the message history after making
3920
+ * changes (e.g., injecting messages).
3939
3921
  *
3940
3922
  * @param flow - The current FlowState
3941
3923
  * @returns Array of messages (reloaded from storage)
@@ -4360,4 +4342,4 @@ declare function createNamespaceContext(agentDef: {
4360
4342
  */
4361
4343
  declare function isQualifiedName(name: string): boolean;
4362
4344
 
4363
- export { Agent, type AgentBuilderEnv, type AgentBuilderEvent, type AgentDefinition, AttachmentRef, AuthContext, type BroadcastOptions, ClientStreamRequest, ClientStreamResponse, ClientToolRequest, ClientToolResponse, CodeExecutionBridge, DurableAgentBuilder, DurableThread, DurableUserHub, Env, FileRecord, FileStats, FlowState, FlowStateSdk, type FlowStateWithSdk, GrepResult, type HubClientInfo, type ImageContextConfig, type InjectMessageOptions$1 as InjectMessageOptions, type Provider as LLMProviderInterface, Message, MessageContent, type ModelDefinition, NamespaceResolutionError, NamespacedRegistry, type PromptContent, type PromptDefinition, type PromptIncludePart, type PromptPart, type PromptToolConfig, type Provider$1 as Provider, type ProviderContentPart, type ProviderFilePart, type ProviderImagePart, ProviderRegistry, type ProviderTextPart, type SessionToolBinding, type SessionToolConfig, type SideConfig, type SubagentToolConfig, type SubpromptConfig, ThreadEnv, type ThreadEventPayload, ThreadInstance, ThreadMetadata, type ThreadRegistryEntry, ThreadWatchdog, type ThreadWatchdogState, type ToolConfig, ToolResult, type UpdateThreadParams, type User, type WatchdogCheckin, type WatchdogProbeResult, applyRuntimeCors, buildImageDescription, canAccessThread, cat, createNamespaceContext, emitThreadEvent, enhanceFlowState, exists, find, forceTurn, generateImageDescription, getFileStats, getMessages, getMessagesToSummarize, getShortName, getThumbnail, getUnsummarizedImageAttachments, getVisibleAgentNames, getVisibleModelNames, getVisiblePromptNames, getVisibleToolNames, grep, hasImageAttachments, head, injectMessage, isAdminOnlyApiRoute, isHostedInstance, isPublicApiRoute, isQualifiedName, isSameOriginBrowserRequest, isTrustedLocalDevelopmentRequest, linkFile, mkdir, move, optimizeImageContext, parseQualifiedName, qualifyName, queueTool, readFile, readdir, reloadHistory, rename, replaceImagesWithDescriptions, resolveAgent, resolveHook, resolveModel, resolvePrompt, resolveTool, rmdir, runtimeCorsHeaders, runtimePreflightResponse, stat, tail, unlink, updateThread, writeFile, writeImage };
4345
+ export { Agent, type AgentBuilderEnv, type AgentBuilderEvent, type AgentDefinition, AttachmentRef, AuthContext, type BroadcastOptions, ClientStreamRequest, ClientStreamResponse, ClientToolRequest, ClientToolResponse, CodeExecutionBridge, DurableAgentBuilder, DurableThread, DurableUserHub, Env, FileRecord, FileStats, FlowState, FlowStateSdk, type FlowStateWithSdk, GrepResult, type HubClientInfo, type ImageContextConfig, type InjectMessageOptions, type Provider as LLMProviderInterface, Message, MessageContent, type ModelDefinition, NamespaceResolutionError, NamespacedRegistry, type PromptContent, type PromptDefinition, type PromptIncludePart, type PromptPart, type PromptToolConfig, type Provider$1 as Provider, type ProviderContentPart, type ProviderFilePart, type ProviderImagePart, ProviderRegistry, type ProviderTextPart, type SessionToolBinding, type SessionToolConfig, type SideConfig, type SubagentToolConfig, type SubpromptConfig, ThreadEnv, type ThreadEventPayload, ThreadInstance, ThreadMetadata, type ThreadRegistryEntry, ThreadWatchdog, type ThreadWatchdogState, type ToolConfig, ToolResult, type UpdateThreadParams, type User, type WatchdogCheckin, type WatchdogProbeResult, applyRuntimeCors, buildImageDescription, canAccessThread, cat, createNamespaceContext, emitThreadEvent, enhanceFlowState, exists, find, forceTurn, generateImageDescription, getFileStats, getMessages, getMessagesToSummarize, getShortName, getThumbnail, getUnsummarizedImageAttachments, getVisibleAgentNames, getVisibleModelNames, getVisiblePromptNames, getVisibleToolNames, grep, hasImageAttachments, head, injectMessage, isAdminOnlyApiRoute, isHostedInstance, isPublicApiRoute, isQualifiedName, isSameOriginBrowserRequest, isTrustedLocalDevelopmentRequest, linkFile, mkdir, move, optimizeImageContext, parseQualifiedName, qualifyName, queueTool, readFile, readdir, reloadHistory, rename, replaceImagesWithDescriptions, resolveAgent, resolveHook, resolveModel, resolvePrompt, resolveTool, rmdir, runtimeCorsHeaders, runtimePreflightResponse, stat, tail, unlink, updateThread, writeFile, writeImage };