@standardagents/builder 0.41.9 → 0.41.11

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.
@@ -1904,8 +1904,10 @@ declare class DurableUserHub extends DurableObject<DurableUserHubEnv> {
1904
1904
  private roomLimits;
1905
1905
  /** Detach notices held for the presence grace window, by client id. */
1906
1906
  private pendingDetach;
1907
- /** The project's room definition, loaded once per instance. */
1907
+ /** The project's room definition, loaded once per instance, and its
1908
+ * registry key, which names room executions for grant policies. */
1908
1909
  private roomDefinition;
1910
+ private roomKey;
1909
1911
  constructor(ctx: DurableObjectState, env: DurableUserHubEnv);
1910
1912
  private ensureMigrated;
1911
1913
  /**
@@ -1941,6 +1943,11 @@ declare class DurableUserHub extends DurableObject<DurableUserHubEnv> {
1941
1943
  private limitsFor;
1942
1944
  /** Load the project's room definition from the users registry, once. */
1943
1945
  private loadRoom;
1946
+ /**
1947
+ * How a room execution presents itself to grant policies: as the endpoint
1948
+ * it declares it fronts, otherwise as a room named by its registry key.
1949
+ */
1950
+ private roomCaller;
1944
1951
  /** Whether `key` is room-owned state, exempt from `user_value_changed`. */
1945
1952
  private roomOwnsKey;
1946
1953
  /**
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-DWuGxI4w.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-Db4EfjkK.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
@@ -30808,6 +30808,9 @@ function callerAllowed(allow, caller) {
30808
30808
  endpoint: allow.endpoints,
30809
30809
  userEndpoint: allow.userEndpoints,
30810
30810
  userHook: allow.userEndpoints,
30811
+ // A room execution is policy-named by its registry key; a policy may
30812
+ // list it under `userRooms` or alongside the endpoints it serves.
30813
+ userRoom: allow.userRooms ?? allow.userEndpoints,
30811
30814
  agent: allow.agents
30812
30815
  };
30813
30816
  const list = lists[caller.kind];
@@ -30845,8 +30848,10 @@ var DurableUserHub = class extends DurableObject {
30845
30848
  roomLimits = /* @__PURE__ */ new Map();
30846
30849
  /** Detach notices held for the presence grace window, by client id. */
30847
30850
  pendingDetach = /* @__PURE__ */ new Map();
30848
- /** The project's room definition, loaded once per instance. */
30851
+ /** The project's room definition, loaded once per instance, and its
30852
+ * registry key, which names room executions for grant policies. */
30849
30853
  roomDefinition = null;
30854
+ roomKey = null;
30850
30855
  constructor(ctx, env) {
30851
30856
  super(ctx, env);
30852
30857
  ctx.blockConcurrencyWhile(async () => {
@@ -31038,7 +31043,10 @@ var DurableUserHub = class extends DurableObject {
31038
31043
  try {
31039
31044
  const loaded = await registry[key]();
31040
31045
  const candidate = loaded.default ?? loaded;
31041
- if (isUserRoom(candidate)) return candidate;
31046
+ if (isUserRoom(candidate)) {
31047
+ this.roomKey = key;
31048
+ return candidate;
31049
+ }
31042
31050
  } catch {
31043
31051
  }
31044
31052
  }
@@ -31047,6 +31055,16 @@ var DurableUserHub = class extends DurableObject {
31047
31055
  }
31048
31056
  return this.roomDefinition;
31049
31057
  }
31058
+ /**
31059
+ * How a room execution presents itself to grant policies: as the endpoint
31060
+ * it declares it fronts, otherwise as a room named by its registry key.
31061
+ */
31062
+ roomCaller(room) {
31063
+ if (typeof room.endpoint === "string" && room.endpoint.length > 0) {
31064
+ return { kind: "userEndpoint", name: room.endpoint };
31065
+ }
31066
+ return { kind: "userRoom", name: this.roomKey ?? "room" };
31067
+ }
31050
31068
  /** Whether `key` is room-owned state, exempt from `user_value_changed`. */
31051
31069
  async roomOwnsKey(key) {
31052
31070
  const room = await this.loadRoom();
@@ -31084,7 +31102,7 @@ var DurableUserHub = class extends DurableObject {
31084
31102
  const run = this.executionChain.run(async () => {
31085
31103
  const room = await this.loadRoom();
31086
31104
  if (!room?.onPresence) return;
31087
- const user = new UserStateImpl(this.roomUserId(), this.scopeHost(), { kind: "userRoom", name: "presence" });
31105
+ const user = new UserStateImpl(this.roomUserId(), this.scopeHost(), this.roomCaller(room));
31088
31106
  try {
31089
31107
  await room.onPresence(user, event);
31090
31108
  } catch (error) {
@@ -31106,7 +31124,7 @@ var DurableUserHub = class extends DurableObject {
31106
31124
  this.sendRoomFrame(ws, JSON.stringify({ type: "room", id: frame.id, error: "no_room" }));
31107
31125
  return;
31108
31126
  }
31109
- const user = new UserStateImpl(this.roomUserId(), this.scopeHost(), { kind: "userRoom", name: "frame" });
31127
+ const user = new UserStateImpl(this.roomUserId(), this.scopeHost(), this.roomCaller(room));
31110
31128
  try {
31111
31129
  await room.onFrame(user, connection, frame);
31112
31130
  } catch (error) {