@standardagents/builder 0.41.10 → 0.41.12

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,5 +1,5 @@
1
- import { M as ModelDefinition, A as AgentDefinition } from './resolver-kvVdxct2.js';
2
- export { m as AgentBuilderEnv, n as AgentBuilderEvent, ah as BroadcastOptions, C as CodeExecutionBridge, h as DurableAgentBuilder, D as DurableThread, l as DurableUserHub, af as FlowStateSdk, ai as FlowStateWithSdk, G as HandlerSide, H as HubClientInfo, E as HumanSide, aq as ImageContextConfig, ae as InjectMessageOptions, as as LLMProviderInterface, aL as NamespaceResolutionError, w as PromptContent, s as PromptDefinition, y as PromptIncludePart, x as PromptPart, F as PromptSide, t as PromptToolConfig, P as Provider, at as ProviderContentPart, aw as ProviderFilePart, av as ProviderImagePart, ar as ProviderRegistry, au as ProviderTextPart, B as SessionToolBinding, z as SessionToolConfig, I as SideConfig, J as SubagentRelationship, u as SubagentToolConfig, S as SubpromptConfig, o as ThreadEventPayload, p as ThreadRegistryEntry, T as ThreadWatchdog, j as ThreadWatchdogState, v as ToolConfig, U as UpdateThreadParams, q as User, k as WatchdogCheckin, W as WatchdogProbeResult, f as applyRuntimeCors, am as buildImageDescription, c as canAccessThread, a9 as cat, aJ as createNamespaceContext, Q as emitThreadEvent, ag as enhanceFlowState, a0 as exists, ad as find, R as forceTurn, ap as generateImageDescription, a7 as getFileStats, N as getMessages, al as getMessagesToSummarize, az as getShortName, a8 as getThumbnail, ak as getUnsummarizedImageAttachments, aG as getVisibleAgentNames, aI as getVisibleModelNames, aH as getVisiblePromptNames, aF as getVisibleToolNames, ac as grep, aj as hasImageAttachments, aa as head, L as injectMessage, d as isAdminOnlyApiRoute, i as isHostedInstance, b as isPublicApiRoute, aK as isQualifiedName, e as isSameOriginBrowserRequest, a as isTrustedLocalDevelopmentRequest, Z as linkFile, a2 as mkdir, a5 as move, ao as optimizeImageContext, ax as parseQualifiedName, ay as qualifyName, K as queueTool, _ as readFile, a3 as readdir, O as reloadHistory, a6 as rename, an as replaceImagesWithDescriptions, aD as resolveAgent, aE as resolveHook, aC as resolveModel, aB as resolvePrompt, aA as resolveTool, a4 as rmdir, r as runtimeCorsHeaders, g as runtimePreflightResponse, $ as stat, ab as tail, a1 as unlink, V as updateThread, X as writeFile, Y as writeImage } from './resolver-kvVdxct2.js';
1
+ import { M as ModelDefinition, A as AgentDefinition } from './resolver-DE5HFRlb.js';
2
+ export { m as AgentBuilderEnv, n as AgentBuilderEvent, ah as BroadcastOptions, C as CodeExecutionBridge, h as DurableAgentBuilder, D as DurableThread, l as DurableUserHub, af as FlowStateSdk, ai as FlowStateWithSdk, G as HandlerSide, H as HubClientInfo, E as HumanSide, aq as ImageContextConfig, ae as InjectMessageOptions, as as LLMProviderInterface, aL as NamespaceResolutionError, w as PromptContent, s as PromptDefinition, y as PromptIncludePart, x as PromptPart, F as PromptSide, t as PromptToolConfig, P as Provider, at as ProviderContentPart, aw as ProviderFilePart, av as ProviderImagePart, ar as ProviderRegistry, au as ProviderTextPart, B as SessionToolBinding, z as SessionToolConfig, I as SideConfig, J as SubagentRelationship, u as SubagentToolConfig, S as SubpromptConfig, o as ThreadEventPayload, p as ThreadRegistryEntry, T as ThreadWatchdog, j as ThreadWatchdogState, v as ToolConfig, U as UpdateThreadParams, q as User, k as WatchdogCheckin, W as WatchdogProbeResult, f as applyRuntimeCors, am as buildImageDescription, c as canAccessThread, a9 as cat, aJ as createNamespaceContext, Q as emitThreadEvent, ag as enhanceFlowState, a0 as exists, ad as find, R as forceTurn, ap as generateImageDescription, a7 as getFileStats, N as getMessages, al as getMessagesToSummarize, az as getShortName, a8 as getThumbnail, ak as getUnsummarizedImageAttachments, aG as getVisibleAgentNames, aI as getVisibleModelNames, aH as getVisiblePromptNames, aF as getVisibleToolNames, ac as grep, aj as hasImageAttachments, aa as head, L as injectMessage, d as isAdminOnlyApiRoute, i as isHostedInstance, b as isPublicApiRoute, aK as isQualifiedName, e as isSameOriginBrowserRequest, a as isTrustedLocalDevelopmentRequest, Z as linkFile, a2 as mkdir, a5 as move, ao as optimizeImageContext, ax as parseQualifiedName, ay as qualifyName, K as queueTool, _ as readFile, a3 as readdir, O as reloadHistory, a6 as rename, an as replaceImagesWithDescriptions, aD as resolveAgent, aE as resolveHook, aC as resolveModel, aB as resolvePrompt, aA as resolveTool, a4 as rmdir, r as runtimeCorsHeaders, g as runtimePreflightResponse, $ as stat, ab as tail, a1 as unlink, V as updateThread, X as writeFile, Y as writeImage } from './resolver-DE5HFRlb.js';
3
3
  export { AgentPluginOptions, agentbuilder, builder } from './plugin.js';
4
4
  export { v as Agent, J as AttachmentRef, i as AuthContext, A as AuthUser, e as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, t as ClientDuplex, u as ClientForwarding, p as ClientStreamRequest, q as ClientStreamResponse, n as ClientToolRequest, o as ClientToolResponse, B as Controller, a as ControllerContext, G as Env, H as FileRecord, N as FileStats, D as FlowResult, F as FlowState, K as GrepResult, P as ImageContentPart, I as ImageMetadata, L as LLMResponse, M as Message, U as MessageContent, Q as MultimodalContent, R as RequestContext, S as StorageBackend, E as TelemetryEvent, O as TextContentPart, T as ThreadEndpointContext, b as ThreadEnv, w as ThreadInstance, x as ThreadMetadata, y as ToolCall, z as ToolResult, f as authenticate, j as callClient, k as callClientStream, c as createThreadEndpointHandler, m as decodeStreamChunk, d as defineController, l as encodeStreamChunk, h as endpointCallerFromAuth, g as requireAdmin, r as requireAuth, s as supportsClientForwarding } from './index-ChHAVogf.js';
5
5
  export { AgentType, DefineHandlerOptions, DefinitionLoader, GlobalNamespaceContext, HANDLER_SYMBOL, HandlerDefinition, HookExecutionContext, HookExecutionSource, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, NamespaceContext, PackageSignature, PackedExports, PackedMeta, PackedMetadata, PackedNamespaceContext, ParentHookRequirement, ParentHookStage, PromptInput, PromptTextPart, ProviderAssistantMessage, ProviderConfigSlot, ProviderConfigSlots, ProviderConfigValueSource, ProviderDefinition, ProviderError, ProviderErrorCode, ProviderFactory, ProviderFactoryConfig, ProviderFinishReason, ProviderGeneratedImage, ProviderMessage, ProviderMessageContent, ProviderMethodOverrides, ModelCapabilities as ProviderModelCapabilities, ProviderOverride, ProviderOverrideContext, ProviderReasoningDetail, ProviderRequest, ProviderResponse, ProviderStreamChunk, ProviderSyncOverride, ProviderSystemMessage, ProviderTool, ProviderToolCallPart, ProviderToolMessage, ProviderToolResultContent, ProviderUsage, ProviderUserMessage, ReasoningConfig, StructuredPrompt, TextContent, ThreadHookName, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, belongsToPackage, defineAgent, defineHandler, defineHook, defineModel, definePrompt, defineProvider, defineTool, isHandler, isPacked, isVisibleInNamespace, mapReasoningLevel, providerConst, providerEnv, providerValue } from '@standardagents/spec';
package/dist/index.js CHANGED
@@ -12018,6 +12018,13 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
12018
12018
  return namespace.get(namespace.idFromName(userId));
12019
12019
  }
12020
12020
  /** Read one JSON value from a user's account-wide key-value store. */
12021
+ /**
12022
+ * The pre-hub singleton hosts no user room, so it reserves no room prefixes.
12023
+ * Kept to satisfy the shared UserValueStore contract for fallback runtimes.
12024
+ */
12025
+ async roomValuePrefixes() {
12026
+ return [];
12027
+ }
12021
12028
  async getUserValue(userId, key) {
12022
12029
  await this.ensureMigrated();
12023
12030
  this.assertValidUserValueUserId(userId);
@@ -37836,7 +37843,7 @@ ${packedThreadRouteCode}
37836
37843
  // across requests.
37837
37844
  let threadAccess = null;
37838
37845
  // The request handed to the controller. A protected API request carries
37839
- // x-standard-upstream-timing with the authentication cost; the header is
37846
+ // x-agentbuilder-upstream-timing with the authentication cost; the header is
37840
37847
  // overwritten, never merged, so a caller cannot forge upstream time.
37841
37848
  let controllerRequest = request;
37842
37849
 
@@ -39523,7 +39530,7 @@ function createExecutionChain() {
39523
39530
  }
39524
39531
 
39525
39532
  // src/users/upstream-timing.ts
39526
- var UPSTREAM_TIMING_HEADER = "x-standard-upstream-timing";
39533
+ var UPSTREAM_TIMING_HEADER = "x-agentbuilder-upstream-timing";
39527
39534
  var MAX_HEADER_CHARS = 512;
39528
39535
  function formatUpstreamTiming(name, durationMs) {
39529
39536
  const safe = Number.isFinite(durationMs) && durationMs > 0 ? durationMs : 0;
@@ -39992,11 +39999,30 @@ var DurableUserHub = class extends DurableObject {
39992
39999
  }
39993
40000
  return this.roomDefinition;
39994
40001
  }
40002
+ /**
40003
+ * How a room execution presents itself to grant policies: as the endpoint
40004
+ * it declares it fronts, otherwise as a room named by its registry key.
40005
+ */
40006
+ roomCaller(room) {
40007
+ if (typeof room.endpoint === "string" && room.endpoint.length > 0) {
40008
+ return { kind: "userEndpoint", name: room.endpoint };
40009
+ }
40010
+ return { kind: "userRoom", name: this.roomKey ?? "room" };
40011
+ }
39995
40012
  /** Whether `key` is room-owned state, exempt from `user_value_changed`. */
39996
40013
  async roomOwnsKey(key) {
39997
40014
  const room = await this.loadRoom();
39998
40015
  return Boolean(room?.valuePrefix && key.startsWith(room.valuePrefix));
39999
40016
  }
40017
+ /**
40018
+ * The value-key prefixes this user's room declares as its own, so the
40019
+ * client-facing KV routes refuse writes under room-owned state. The platform
40020
+ * reserves whatever the tenant declares via `defineUserRoom({ valuePrefix })`.
40021
+ */
40022
+ async roomValuePrefixes() {
40023
+ const room = await this.loadRoom();
40024
+ return room?.valuePrefix ? [room.valuePrefix] : [];
40025
+ }
40000
40026
  /**
40001
40027
  * Presence runs inside the serialization chain, after any execution the
40002
40028
  * event raced with, so a room's presence write never interleaves with a
@@ -40029,7 +40055,7 @@ var DurableUserHub = class extends DurableObject {
40029
40055
  const run = this.executionChain.run(async () => {
40030
40056
  const room = await this.loadRoom();
40031
40057
  if (!room?.onPresence) return;
40032
- const user = new UserStateImpl(this.roomUserId(), this.scopeHost(), { kind: "userRoom", name: this.roomKey ?? "room" });
40058
+ const user = new UserStateImpl(this.roomUserId(), this.scopeHost(), this.roomCaller(room));
40033
40059
  try {
40034
40060
  await room.onPresence(user, event);
40035
40061
  } catch (error) {
@@ -40051,7 +40077,7 @@ var DurableUserHub = class extends DurableObject {
40051
40077
  this.sendRoomFrame(ws, JSON.stringify({ type: "room", id: frame.id, error: "no_room" }));
40052
40078
  return;
40053
40079
  }
40054
- const user = new UserStateImpl(this.roomUserId(), this.scopeHost(), { kind: "userRoom", name: this.roomKey ?? "room" });
40080
+ const user = new UserStateImpl(this.roomUserId(), this.scopeHost(), this.roomCaller(room));
40055
40081
  try {
40056
40082
  await room.onFrame(user, connection, frame);
40057
40083
  } catch (error) {