@standardagents/spec 0.41.17 → 0.41.18

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
@@ -1465,6 +1465,72 @@ interface ThreadReasoningChunkEvent {
1465
1465
  * server never emits reasoning to that socket.
1466
1466
  */
1467
1467
  declare const THREAD_STREAM_REASONING_PARAM = "reasoning";
1468
+ /**
1469
+ * Coarse execution state of a thread.
1470
+ *
1471
+ * - `idle` — no execution is running and the last run did not fail: it ended
1472
+ * normally (a reply, a stop tool, a stop-on-response, a park for a
1473
+ * human-backed side, a user abort, a hook block, a step/turn cap) or the
1474
+ * thread has never run.
1475
+ * - `running` — an execution is in flight.
1476
+ * - `failed` — the last run ended in an error (a step error, a fatal
1477
+ * execution error, a repeated tool error, a session failure, or an
1478
+ * execution the runtime lost and could not recover).
1479
+ *
1480
+ * The run state describes execution only, not conversational turn
1481
+ * ownership: a run that ended by handing the turn to a human side is `idle`
1482
+ * with `reason` `awaiting_human` (or the stop code that ended the turn).
1483
+ */
1484
+ type ThreadRunState = 'idle' | 'running' | 'failed';
1485
+ /**
1486
+ * Authoritative run status of a thread.
1487
+ *
1488
+ * Runtimes persist the status with the thread so it survives restarts, and
1489
+ * MUST NOT leave a thread `running` once its executor is gone: a lost
1490
+ * execution resolves to `failed` (reason `execution_lost`).
1491
+ *
1492
+ * Read it with {@link ThreadState.status}, from `GET /api/threads/:id`
1493
+ * (`status` field), or live from the thread message stream
1494
+ * ({@link ThreadStatusEvent}).
1495
+ */
1496
+ interface ThreadStatus {
1497
+ /** Current run state. */
1498
+ state: ThreadRunState;
1499
+ /** When the thread entered this state (microseconds since epoch, like `created_at`). */
1500
+ since: number;
1501
+ /**
1502
+ * The raw stop reason code of the last transition out of `running` — for
1503
+ * example `stop_on_response`, `stop_tool`, `awaiting_human`,
1504
+ * `hook_blocked`, `max_total_steps`, `aborted_by_user`, `step_error`,
1505
+ * `fatal_error`, `execution_lost`. Null while `running` and for a thread
1506
+ * that has never run. Runtimes MAY report codes beyond this list; clients
1507
+ * MUST treat unknown codes as opaque.
1508
+ */
1509
+ reason?: string | null;
1510
+ }
1511
+ interface ThreadStatusEvent {
1512
+ type: 'thread_status';
1513
+ status: ThreadStatus;
1514
+ }
1515
+ /** Severity of an application log entry. */
1516
+ type ThreadLogLevel = 'debug' | 'info' | 'warn' | 'error';
1517
+ /**
1518
+ * An application log entry recorded with {@link ThreadState.log}.
1519
+ *
1520
+ * Runtimes bound entry sizes and truncate oversized fields with a marker
1521
+ * instead of rejecting the entry: `name` to 120 characters, `message` to
1522
+ * 4 KiB, and the JSON encoding of `data` to 16 KiB.
1523
+ */
1524
+ interface ThreadLogEntry {
1525
+ /** Short event name, e.g. `cache.miss` or `sync.completed`. */
1526
+ name: string;
1527
+ /** Human-readable detail. */
1528
+ message?: string;
1529
+ /** Severity. Defaults to `info`. */
1530
+ level?: ThreadLogLevel;
1531
+ /** Structured, JSON-serializable detail. */
1532
+ data?: Record<string, unknown>;
1533
+ }
1468
1534
  /**
1469
1535
  * Storage location identifier.
1470
1536
  *
@@ -2591,6 +2657,33 @@ interface ThreadState {
2591
2657
  * @returns Thumbnail data as ArrayBuffer, or null if not available
2592
2658
  */
2593
2659
  getFileThumbnail(path: string): Promise<ArrayBuffer | null>;
2660
+ /**
2661
+ * Read the thread's authoritative run status.
2662
+ *
2663
+ * A method rather than a property: the status changes while the caller
2664
+ * holds the state (a tool runs inside a `running` thread; an endpoint
2665
+ * observes it later), so every call reads the current persisted value.
2666
+ *
2667
+ * Not to be confused with {@link ThreadState.setStatus}, which writes a
2668
+ * free-form label into this thread's entry in its PARENT's subagent
2669
+ * registry and does not affect the run status.
2670
+ */
2671
+ status(): Promise<ThreadStatus>;
2672
+ /**
2673
+ * Record an application log entry on the thread.
2674
+ *
2675
+ * The entry appears alongside the runtime's own execution logs (LLM
2676
+ * requests, tool and handler executions) and is delivered to live log
2677
+ * subscribers. Logging never creates a message, never starts or wakes an
2678
+ * execution, and never throws because an entry is too large (see
2679
+ * {@link ThreadLogEntry} for the size bounds).
2680
+ *
2681
+ * @example
2682
+ * ```typescript
2683
+ * await state.log({ name: 'cache.miss', level: 'debug', data: { key } });
2684
+ * ```
2685
+ */
2686
+ log(entry: ThreadLogEntry): Promise<void>;
2594
2687
  /**
2595
2688
  * Execution-specific state.
2596
2689
  *
@@ -6257,4 +6350,4 @@ declare function validateAgentDefinition(def: unknown): DefinitionIssue[];
6257
6350
  */
6258
6351
  declare const SPEC_VERSION = "0.2.0";
6259
6352
 
6260
- export { type AgentDefinition, type AgentType, type AttachmentRef, type CodeExecution, type CodeExecutionError, type CodeExecutionLog, type CodeExecutionOptions, type CodeExecutionResult, type CodeExecutionStatus, type ContentPart, type Controller, type ControllerContext, type ControllerReturn, type CreateFetch, type CredentialGrant, DEFINITION_ISSUE_CODES, type DefineHandlerOptions, type DefineToolOptions, type DefinitionIssue, type DefinitionIssueCode, type DefinitionLoader, ENDPOINT_ACCESS_SYMBOL, type Effect, type EffectDefinition, type EmptyUsesState, type EndpointAccess, type EndpointOptions, type EnvValueType, type ErrorOrigin, type ExecutionState, type FetchLike, type FileChunk, type FilePart, type FileRecord, type FileStats, type FileStorage, type FindResult, type GetMessagesOptions, type GlobalNamespaceContext, type GrepResult, HANDLER_SYMBOL, type HandlerDefinition, type HandlerSide, type HookContext, type HookDefinition, type HookDefinitionOptions, type HookDefinitionResult, type HookExecutionContext, type HookExecutionSource, type HookMessage, type HookName, type HookSignatures, type HookToolCall, type HookToolResult, type HumanSide, type ImageContent, type ImagePart, type ImageUrlPart, type InferProviderOptions, type InjectMessageInput, type InspectedRequest, type LLMMessage, type LLMProviderInterface, type ListUserThreadsOptions, type ListUserValuesOptions, type MarkedThreadEndpoint, type MarkedUserEndpoint, type MarkedUserRoom, type Message, type MessageUpdates, type MessagesResult, type ModelCapabilities, type ModelDefinition, type ModelProvider, type NamespaceContext, type PackageSignature, type PackedExports, type PackedMeta, type PackedMetadata, type PackedNamespaceContext, type ParentHookRequirement, type ParentHookStage, type PromptContent, type PromptDefinition, type PromptEnvPart, type PromptIncludePart, type PromptInput, type PromptPart, type PromptSide, type PromptTextPart, type PromptToolConfig, type ProviderAssistantMessage, type ProviderAttachment, type ProviderConfigSlot, type ProviderConfigSlots, type ProviderConfigValueSource, type ProviderDefinition, ProviderError, type ProviderErrorCode, type ProviderErrorOptions, type ProviderExecutedToolResult, type ProviderFactory, type ProviderFactoryConfig, type ProviderFactoryWithOptions, type ProviderFinishReason, type ProviderGeneratedImage, type ProviderInstance, type ProviderMessage, type ProviderMessageContent, type ProviderMethodOverrides, type ProviderModelInfo, type ProviderModelsPage, type ProviderModelsQuery, type ProviderOverride, type ProviderOverrideContext, type ProviderReasoningDetail, type ProviderRequest, type ProviderResponse, type ProviderStreamChunk, type ProviderSyncOverride, type ProviderSystemMessage, type ProviderTool, type ProviderToolCallPart, type ProviderToolMessage, type ProviderToolResultContent, type ProviderUsage, type ProviderUsagePricing, type ProviderUserMessage, type ProviderWebSearchResult, type QueueMessageInput, RESERVED_RELATIONSHIP_NAMES, type ReadFileStreamOptions, type ReaddirResult, type ReasoningConfig, type ResolveUsesState, type ResponseSummary, type RuntimeByteStream, type RuntimeStreamErrorCode, type RuntimeStreamRequest, type RuntimeStreamResult, type RuntimeStreams, SPEC_VERSION, type ScheduledEffect, type SessionToolBinding, type SessionToolConfig, type SetEnvOptions, type SideConfig, type SkillFileInput, type SkillMetadata, type SkillsNamespace, type StopSessionOptions, type StructuredPrompt, type SubagentRegistryEntry, type SubagentRelationship, type SubagentToolConfig, type SubpromptConfig, THREAD_ENDPOINT_SYMBOL, THREAD_STREAM_REASONING_PARAM, type TenvRawShape, type TextContent, type TextPart, type ThreadEndpointAuth, type ThreadEndpointHandler, type ThreadEndpointRouteParams, type ThreadHookName, type ThreadMessageChunkEvent, type ThreadMetadata, type ThreadReasoningChunkEvent, type ThreadState, type ThreadUser, type Tool, type ToolArgs, type ToolArgsNode, type ToolArgsRawShape, type ToolAttachment, type ToolConfig, type ToolContent, type ToolDefinition, type ToolResult, type ToolTenvs, type ToolVariables, USER_ENDPOINT_SYMBOL, USER_ROOM_SYMBOL, type UserClientInfo, type UserEndpointHandler, type UserEndpointRouteParams, type UserHandle, type UserIdentity, type UserRoomConnection, type UserRoomDefinition, type UserRoomFrame, type UserRoomPresenceEvent, type UserState, type UserThreadSummary, type UserValueEntry, type UsesAwareExecute, type UsesConstrainedState, type VariableDefinition, type VariableType, type VirtualModuleLoader, type VirtualModuleRegistry, type WriteFileOptions, belongsToPackage, defineAgent, defineController, defineEffect, defineHandler, defineHook, defineModel, definePrompt, defineProvider, defineThreadEndpoint, defineTool, defineUserEndpoint, defineUserRoom, getEndpointAccess, isHandler, isPacked, isThreadEndpoint, isUserEndpoint, isUserRoom, isVisibleInNamespace, mapReasoningLevel, providerConst, providerEnv, providerValue, validateAgentDefinition, validateToolName };
6353
+ export { type AgentDefinition, type AgentType, type AttachmentRef, type CodeExecution, type CodeExecutionError, type CodeExecutionLog, type CodeExecutionOptions, type CodeExecutionResult, type CodeExecutionStatus, type ContentPart, type Controller, type ControllerContext, type ControllerReturn, type CreateFetch, type CredentialGrant, DEFINITION_ISSUE_CODES, type DefineHandlerOptions, type DefineToolOptions, type DefinitionIssue, type DefinitionIssueCode, type DefinitionLoader, ENDPOINT_ACCESS_SYMBOL, type Effect, type EffectDefinition, type EmptyUsesState, type EndpointAccess, type EndpointOptions, type EnvValueType, type ErrorOrigin, type ExecutionState, type FetchLike, type FileChunk, type FilePart, type FileRecord, type FileStats, type FileStorage, type FindResult, type GetMessagesOptions, type GlobalNamespaceContext, type GrepResult, HANDLER_SYMBOL, type HandlerDefinition, type HandlerSide, type HookContext, type HookDefinition, type HookDefinitionOptions, type HookDefinitionResult, type HookExecutionContext, type HookExecutionSource, type HookMessage, type HookName, type HookSignatures, type HookToolCall, type HookToolResult, type HumanSide, type ImageContent, type ImagePart, type ImageUrlPart, type InferProviderOptions, type InjectMessageInput, type InspectedRequest, type LLMMessage, type LLMProviderInterface, type ListUserThreadsOptions, type ListUserValuesOptions, type MarkedThreadEndpoint, type MarkedUserEndpoint, type MarkedUserRoom, type Message, type MessageUpdates, type MessagesResult, type ModelCapabilities, type ModelDefinition, type ModelProvider, type NamespaceContext, type PackageSignature, type PackedExports, type PackedMeta, type PackedMetadata, type PackedNamespaceContext, type ParentHookRequirement, type ParentHookStage, type PromptContent, type PromptDefinition, type PromptEnvPart, type PromptIncludePart, type PromptInput, type PromptPart, type PromptSide, type PromptTextPart, type PromptToolConfig, type ProviderAssistantMessage, type ProviderAttachment, type ProviderConfigSlot, type ProviderConfigSlots, type ProviderConfigValueSource, type ProviderDefinition, ProviderError, type ProviderErrorCode, type ProviderErrorOptions, type ProviderExecutedToolResult, type ProviderFactory, type ProviderFactoryConfig, type ProviderFactoryWithOptions, type ProviderFinishReason, type ProviderGeneratedImage, type ProviderInstance, type ProviderMessage, type ProviderMessageContent, type ProviderMethodOverrides, type ProviderModelInfo, type ProviderModelsPage, type ProviderModelsQuery, type ProviderOverride, type ProviderOverrideContext, type ProviderReasoningDetail, type ProviderRequest, type ProviderResponse, type ProviderStreamChunk, type ProviderSyncOverride, type ProviderSystemMessage, type ProviderTool, type ProviderToolCallPart, type ProviderToolMessage, type ProviderToolResultContent, type ProviderUsage, type ProviderUsagePricing, type ProviderUserMessage, type ProviderWebSearchResult, type QueueMessageInput, RESERVED_RELATIONSHIP_NAMES, type ReadFileStreamOptions, type ReaddirResult, type ReasoningConfig, type ResolveUsesState, type ResponseSummary, type RuntimeByteStream, type RuntimeStreamErrorCode, type RuntimeStreamRequest, type RuntimeStreamResult, type RuntimeStreams, SPEC_VERSION, type ScheduledEffect, type SessionToolBinding, type SessionToolConfig, type SetEnvOptions, type SideConfig, type SkillFileInput, type SkillMetadata, type SkillsNamespace, type StopSessionOptions, type StructuredPrompt, type SubagentRegistryEntry, type SubagentRelationship, type SubagentToolConfig, type SubpromptConfig, THREAD_ENDPOINT_SYMBOL, THREAD_STREAM_REASONING_PARAM, type TenvRawShape, type TextContent, type TextPart, type ThreadEndpointAuth, type ThreadEndpointHandler, type ThreadEndpointRouteParams, type ThreadHookName, type ThreadLogEntry, type ThreadLogLevel, type ThreadMessageChunkEvent, type ThreadMetadata, type ThreadReasoningChunkEvent, type ThreadRunState, type ThreadState, type ThreadStatus, type ThreadStatusEvent, type ThreadUser, type Tool, type ToolArgs, type ToolArgsNode, type ToolArgsRawShape, type ToolAttachment, type ToolConfig, type ToolContent, type ToolDefinition, type ToolResult, type ToolTenvs, type ToolVariables, USER_ENDPOINT_SYMBOL, USER_ROOM_SYMBOL, type UserClientInfo, type UserEndpointHandler, type UserEndpointRouteParams, type UserHandle, type UserIdentity, type UserRoomConnection, type UserRoomDefinition, type UserRoomFrame, type UserRoomPresenceEvent, type UserState, type UserThreadSummary, type UserValueEntry, type UsesAwareExecute, type UsesConstrainedState, type VariableDefinition, type VariableType, type VirtualModuleLoader, type VirtualModuleRegistry, type WriteFileOptions, belongsToPackage, defineAgent, defineController, defineEffect, defineHandler, defineHook, defineModel, definePrompt, defineProvider, defineThreadEndpoint, defineTool, defineUserEndpoint, defineUserRoom, getEndpointAccess, isHandler, isPacked, isThreadEndpoint, isUserEndpoint, isUserRoom, isVisibleInNamespace, mapReasoningLevel, providerConst, providerEnv, providerValue, validateAgentDefinition, validateToolName };