@standardagents/builder 0.41.11 → 0.41.13

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.
@@ -1950,6 +1950,12 @@ declare class DurableUserHub extends DurableObject<DurableUserHubEnv> {
1950
1950
  private roomCaller;
1951
1951
  /** Whether `key` is room-owned state, exempt from `user_value_changed`. */
1952
1952
  private roomOwnsKey;
1953
+ /**
1954
+ * The value-key prefixes this user's room declares as its own, so the
1955
+ * client-facing KV routes refuse writes under room-owned state. The platform
1956
+ * reserves whatever the tenant declares via `defineUserRoom({ valuePrefix })`.
1957
+ */
1958
+ roomValuePrefixes(): Promise<string[]>;
1953
1959
  /**
1954
1960
  * Presence runs inside the serialization chain, after any execution the
1955
1961
  * event raced with, so a room's presence write never interleaves with a
@@ -2513,6 +2519,11 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
2513
2519
  */
2514
2520
  private userHub;
2515
2521
  /** Read one JSON value from a user's account-wide key-value store. */
2522
+ /**
2523
+ * The pre-hub singleton hosts no user room, so it reserves no room prefixes.
2524
+ * Kept to satisfy the shared UserValueStore contract for fallback runtimes.
2525
+ */
2526
+ roomValuePrefixes(): Promise<string[]>;
2516
2527
  getUserValue(userId: string, key: string): Promise<unknown | null>;
2517
2528
  /** Write one JSON value to a user's account-wide store; null/undefined deletes. */
2518
2529
  setUserValue(userId: string, key: string, value: unknown): Promise<void>;
package/dist/runtime.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { m as AgentBuilderEnv, n as AgentBuilderEvent, A as AgentDefinition, 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, M as ModelDefinition, 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-Db4EfjkK.js';
1
+ export { m as AgentBuilderEnv, n as AgentBuilderEvent, A as AgentDefinition, 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, M as ModelDefinition, 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';
2
2
  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';
3
3
  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, 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, ThreadHookName, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, belongsToPackage, defineAgent, defineHandler, defineHook, defineModel, definePrompt, defineProvider, defineTool, isHandler, isPacked, isVisibleInNamespace, mapReasoningLevel, providerConst, providerEnv, providerValue } from '@standardagents/spec';
4
4
  export { N as NamespacedRegistry } from './types-Dhd0M369.js';
package/dist/runtime.js CHANGED
@@ -12011,6 +12011,13 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
12011
12011
  return namespace.get(namespace.idFromName(userId));
12012
12012
  }
12013
12013
  /** Read one JSON value from a user's account-wide key-value store. */
12014
+ /**
12015
+ * The pre-hub singleton hosts no user room, so it reserves no room prefixes.
12016
+ * Kept to satisfy the shared UserValueStore contract for fallback runtimes.
12017
+ */
12018
+ async roomValuePrefixes() {
12019
+ return [];
12020
+ }
12014
12021
  async getUserValue(userId, key) {
12015
12022
  await this.ensureMigrated();
12016
12023
  this.assertValidUserValueUserId(userId);
@@ -30199,7 +30206,7 @@ function canAccessThread(auth, thread) {
30199
30206
  }
30200
30207
 
30201
30208
  // src/users/upstream-timing.ts
30202
- var UPSTREAM_TIMING_HEADER = "x-standard-upstream-timing";
30209
+ var UPSTREAM_TIMING_HEADER = "x-agentbuilder-upstream-timing";
30203
30210
  var MAX_HEADER_CHARS = 512;
30204
30211
  function formatUpstreamTiming(name, durationMs) {
30205
30212
  const safe = Number.isFinite(durationMs) && durationMs > 0 ? durationMs : 0;
@@ -30538,11 +30545,19 @@ var UserStateImpl = class {
30538
30545
  const { entries, total } = await this.host.listUserValues(this.userId, options);
30539
30546
  return { entries, total };
30540
30547
  }
30548
+ /** User-account value first, then the instance's (Users §2.3). */
30541
30549
  async env(name) {
30542
- const values = await this.singleton().getUserEnv(this.userId);
30543
- const value = values[name];
30544
- if (value === void 0) throw new Error(`Environment variable not found: ${name}`);
30545
- return value;
30550
+ const singleton = this.singleton();
30551
+ const userValues = await singleton.getUserEnv(this.userId);
30552
+ if (userValues[name] !== void 0) return userValues[name];
30553
+ const instanceValues = await singleton.getInstanceEnv();
30554
+ if (instanceValues[name] !== void 0) return instanceValues[name];
30555
+ throw new Error(`Environment variable not found: ${name}`);
30556
+ }
30557
+ /** The instance's value only, for trust anchors (Users §2.3). */
30558
+ async instanceEnv(name) {
30559
+ const values = await this.singleton().getInstanceEnv();
30560
+ return values[name];
30546
30561
  }
30547
30562
  emit(event, data) {
30548
30563
  this.host.broadcastUserEvent(this.userId, event, data);
@@ -31070,6 +31085,15 @@ var DurableUserHub = class extends DurableObject {
31070
31085
  const room = await this.loadRoom();
31071
31086
  return Boolean(room?.valuePrefix && key.startsWith(room.valuePrefix));
31072
31087
  }
31088
+ /**
31089
+ * The value-key prefixes this user's room declares as its own, so the
31090
+ * client-facing KV routes refuse writes under room-owned state. The platform
31091
+ * reserves whatever the tenant declares via `defineUserRoom({ valuePrefix })`.
31092
+ */
31093
+ async roomValuePrefixes() {
31094
+ const room = await this.loadRoom();
31095
+ return room?.valuePrefix ? [room.valuePrefix] : [];
31096
+ }
31073
31097
  /**
31074
31098
  * Presence runs inside the serialization chain, after any execution the
31075
31099
  * event raced with, so a room's presence write never interleaves with a