@standardagents/builder 0.29.1 → 0.30.0
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 +192 -3
- package/dist/built-in-routes.js.map +1 -1
- package/dist/{index-BNLDsLsL.d.ts → index-CcnGEkPh.d.ts} +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +766 -21
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +1 -0
- package/dist/plugin.js +66 -5
- package/dist/plugin.js.map +1 -1
- package/dist/runtime.d.ts +60 -5
- package/dist/runtime.js +700 -16
- package/dist/runtime.js.map +1 -1
- package/dist/test.d.ts +1 -1
- package/package.json +5 -5
package/dist/runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { e as ThreadEnv, A as Agent, r as ThreadMetadata, t as ToolResult, M as Message, k as ClientToolRequest, l as ClientToolResponse, m as ClientStreamRequest, n as ClientStreamResponse, w as FileRecord, F as FlowState, y as FileStats, G as GrepResult, x as AttachmentRef, J as MessageContent, E as Env, q as ThreadInstance } from './index-
|
|
2
|
-
export { f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, B as Controller, a as ControllerContext, u as FlowResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, T as ToolCall, g as callClient, h as callClientStream, c as createThreadEndpointHandler, j as decodeStreamChunk, d as defineController, i as encodeStreamChunk, s as supportsClientForwarding } from './index-
|
|
3
|
-
import { CodeExecutionOptions, CodeExecutionResult, SubagentRegistryEntry, InjectMessageInput, QueueMessageInput, 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';
|
|
1
|
+
import { e as ThreadEnv, A as Agent, r as ThreadMetadata, t as ToolResult, M as Message, k as ClientToolRequest, l as ClientToolResponse, m as ClientStreamRequest, n as ClientStreamResponse, w as FileRecord, F as FlowState, y as FileStats, G as GrepResult, x as AttachmentRef, J as MessageContent, E as Env, q as ThreadInstance } from './index-CcnGEkPh.js';
|
|
2
|
+
export { f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, B as Controller, a as ControllerContext, u as FlowResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, T as ToolCall, g as callClient, h as callClientStream, c as createThreadEndpointHandler, j as decodeStreamChunk, d as defineController, i as encodeStreamChunk, s as supportsClientForwarding } from './index-CcnGEkPh.js';
|
|
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';
|
|
6
6
|
import { N as NamespacedRegistry } from './types-Bpe7IANZ.js';
|
|
@@ -1043,7 +1043,10 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1043
1043
|
* always produce a normal tool error (no client connected, timeout, or user
|
|
1044
1044
|
* denial) for the model to reason about.
|
|
1045
1045
|
*/
|
|
1046
|
-
callClientTool(request: ClientToolRequest
|
|
1046
|
+
callClientTool(request: ClientToolRequest, durability?: {
|
|
1047
|
+
toolCallId: string;
|
|
1048
|
+
side: "a" | "b";
|
|
1049
|
+
}): Promise<ClientToolResponse>;
|
|
1047
1050
|
/** Settle a pending forwarded call exactly once, clearing its timers. */
|
|
1048
1051
|
private settleClientCall;
|
|
1049
1052
|
/** Close and forget a bridge socket we've deemed dead, failing remaining calls. */
|
|
@@ -1682,14 +1685,66 @@ declare class DurableUserHub extends DurableObject<DurableUserHubEnv> {
|
|
|
1682
1685
|
private migrated;
|
|
1683
1686
|
constructor(ctx: DurableObjectState, env: DurableUserHubEnv);
|
|
1684
1687
|
private ensureMigrated;
|
|
1688
|
+
/**
|
|
1689
|
+
* Returns the user endpoints registry for lazy-loading `users/` files.
|
|
1690
|
+
* Keys are endpoint file paths relative to `users/` with the extension
|
|
1691
|
+
* stripped except the method suffix (e.g. `standardcode/lease_acquire.post`).
|
|
1692
|
+
* Implemented when DurableUserHub is imported from
|
|
1693
|
+
* 'virtual:@standardagents/builder'.
|
|
1694
|
+
*/
|
|
1695
|
+
userEndpoints(): Record<string, () => Promise<unknown>>;
|
|
1696
|
+
/**
|
|
1697
|
+
* Returns the hooks registry (same registry the thread runtime uses). The
|
|
1698
|
+
* hub filters it to user-scope hook types at dispatch time. Implemented
|
|
1699
|
+
* when DurableUserHub is imported from 'virtual:@standardagents/builder'.
|
|
1700
|
+
*/
|
|
1701
|
+
userHooks(): Record<string, () => Promise<unknown>>;
|
|
1685
1702
|
/**
|
|
1686
1703
|
* Accept the user's persistent client (daemon) WebSocket. The daemon holds
|
|
1687
1704
|
* this ONE socket for its whole lifetime; per-thread bridge sockets are
|
|
1688
1705
|
* opened separately and only while a thread is active.
|
|
1689
1706
|
*/
|
|
1690
1707
|
fetch(request: Request): Promise<Response>;
|
|
1691
|
-
|
|
1708
|
+
/** Idle sockets answer heartbeats at the edge without waking the object.
|
|
1709
|
+
* Registered at accept time rather than in the constructor so a hub that
|
|
1710
|
+
* never accepts a socket stays fully evictable (this also keeps
|
|
1711
|
+
* vitest-pool-workers' isolated storage able to pop the DO's frame). */
|
|
1712
|
+
private ensureHeartbeatAutoResponse;
|
|
1713
|
+
/** Sockets attached to the user event stream, restored after hibernation. */
|
|
1714
|
+
private streamSockets;
|
|
1715
|
+
private acceptUserStream;
|
|
1716
|
+
/**
|
|
1717
|
+
* Deliver an event frame to every socket attached to this user's stream.
|
|
1718
|
+
* At-most-once, live-only (spec: Users §4) — no history, no acks.
|
|
1719
|
+
*/
|
|
1720
|
+
broadcastUserEvent(userId: string, event: string, data?: unknown): void;
|
|
1721
|
+
/** Per-user execution chain (spec: Users §2.1) — see users/serialize.ts. */
|
|
1722
|
+
private executionChain;
|
|
1723
|
+
private scopeHost;
|
|
1724
|
+
private runUserEndpoint;
|
|
1725
|
+
/**
|
|
1726
|
+
* Fire every definition of a user hook type. Observational and best-effort:
|
|
1727
|
+
* failures are swallowed and dispatch never blocks the triggering
|
|
1728
|
+
* operation. Nested dispatch is suppressed so a `user_value_changed` hook
|
|
1729
|
+
* writing values cannot recurse.
|
|
1730
|
+
*/
|
|
1731
|
+
private inUserHookDispatch;
|
|
1732
|
+
private dispatchUserHooks;
|
|
1692
1733
|
webSocketClose(ws: WebSocket): Promise<void>;
|
|
1734
|
+
/**
|
|
1735
|
+
* Store or replace a grant. `secret` is write-only from this point on.
|
|
1736
|
+
* Policy (`CredentialGrant` minus the secret) is kept as JSON config.
|
|
1737
|
+
*/
|
|
1738
|
+
setGrant(userId: string, grant: CredentialGrant, secret: string): Promise<void>;
|
|
1739
|
+
deleteGrant(userId: string, name: string): Promise<void>;
|
|
1740
|
+
/** Metadata-only listing — never returns secret material. */
|
|
1741
|
+
listGrants(userId: string): Promise<Array<Omit<CredentialGrant, "name"> & {
|
|
1742
|
+
name: string;
|
|
1743
|
+
}>>;
|
|
1744
|
+
/** Perform a privileged fetch with the grant's credential injected. */
|
|
1745
|
+
private grantFetch;
|
|
1746
|
+
private handleGrantFetch;
|
|
1747
|
+
webSocketMessage(ws: WebSocket, _message: string | ArrayBuffer): Promise<void>;
|
|
1693
1748
|
webSocketError(ws: WebSocket): Promise<void>;
|
|
1694
1749
|
/** Whether a persistent client (daemon) is connected right now. */
|
|
1695
1750
|
hasClient(): Promise<boolean>;
|