@agent-surface/core 0.4.0 → 0.5.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/index.d.ts CHANGED
@@ -749,17 +749,10 @@ interface AgentProcedureDescriptor {
749
749
  procedureId: string;
750
750
  /**
751
751
  * The manifest description. Stable across snapshots — the contextual
752
- * `describe()` output is `contextualNote`, not part of this string, unless
753
- * the registry was created with `snapshotMergesContextualNote: true`
754
- * (the 0.2 default, removed in a later minor — D28).
752
+ * `describe()` output is `contextualNote` and is never folded in here (D28).
755
753
  */
756
754
  description: string;
757
- /**
758
- * Volatile: this snapshot's contextual `describe()` output, if any. Always
759
- * populated, in both merge modes, so a host can migrate before the default
760
- * moves. Use {@link stableDescriptionOf} to recover the note-free
761
- * description without parsing.
762
- */
755
+ /** Volatile: this snapshot's contextual `describe()` output, if any. */
763
756
  contextualNote?: string;
764
757
  /** Agent-facing (reduced) input schema per binding rule 1 (docs/05). */
765
758
  inputSchema: JsonSchema;
@@ -783,15 +776,6 @@ interface AgentProcedureDescriptor {
783
776
  meta?: Record<string, JsonValue>;
784
777
  }
785
778
  type AgentCapabilityDescriptorUnion = AgentObservationDescriptor | AgentActionDescriptor | AgentProcedureDescriptor;
786
- /**
787
- * The note-free description of a descriptor, whichever way the registry was
788
- * configured to compose it (D28). The merge rule is `${description} ${note}`,
789
- * so the split is exact — no host ever has to parse a prefix it did not write.
790
- */
791
- declare function stableDescriptionOf(descriptor: {
792
- description: string;
793
- contextualNote?: string;
794
- }): string;
795
779
 
796
780
  interface RegistrationCandidate {
797
781
  definition: AgentComponentDefinition;
@@ -815,15 +799,6 @@ interface RegistryOptions {
815
799
  /** Route descriptor for snapshots (host wires its router here). */
816
800
  route?: () => AgentRouteInfo | undefined;
817
801
  limits?: Partial<AgentSurfaceLimits>;
818
- /**
819
- * D28 compatibility flag. `true` (default, for one minor) folds a procedure
820
- * reference's contextual `describe()` output into
821
- * `AgentProcedureDescriptor.description`, as 0.1 did. `false` keeps the two
822
- * apart, so `description` is stable across snapshots and the live text is
823
- * read from `contextualNote`. Populated either way; the default flips in a
824
- * later minor and the flag is then removed.
825
- */
826
- snapshotMergesContextualNote?: boolean;
827
802
  /** Injectable clock (docs/08 determinism); default Date.now. */
828
803
  now?: () => number;
829
804
  }
@@ -897,23 +872,14 @@ interface AgentToolsetOptions {
897
872
  maxComponents?: number;
898
873
  maxBytes?: number;
899
874
  };
900
- /**
901
- * D28 compatibility flag. `true` (default, for one minor) composes
902
- * availability and the contextual note into `description`, as 0.1 did.
903
- * `false` keeps `description` free of live state, so the provider tool block
904
- * is byte-stable across steps and prompt-prefix caching survives; the host
905
- * renders `AgentTool.state` outside the tool definitions (docs/09
906
- * §rendering-capability-state). `state` is populated either way.
907
- */
908
- descriptionIncludesState?: boolean;
909
875
  }
910
876
  interface AgentTool {
911
877
  /** Wire-safe name (docs/09 §wire-names), ≤ 64 chars, unique in this catalog. */
912
878
  name: string;
913
879
  /**
914
880
  * Plane + effect + confirmation prefix, then the authored description.
915
- * With `descriptionIncludesState: false` this contains NO live state it is
916
- * safe in a provider tool block with prompt-prefix caching across steps.
881
+ * Contains NO live state (D28), so it is safe in a provider tool block with
882
+ * prompt-prefix caching across steps.
917
883
  */
918
884
  description: string;
919
885
  inputSchema: JsonSchema;
@@ -950,4 +916,4 @@ declare function createAgentToolset(registry: AgentSurfaceRegistry, options: Age
950
916
  /** Deep equality over JsonValue (order-sensitive for arrays, docs/06 rule 2). */
951
917
  declare function jsonDeepEqual(a: JsonValue | undefined, b: JsonValue | undefined): boolean;
952
918
 
953
- export { AGENT_CAPABILITY_ERROR_CODES, type AgentActionContext, type AgentActionDefinition, type AgentActionDescriptor, type AgentAuthorizationContext, type AgentCapabilityDescriptorUnion, type AgentCapabilityErrorCode, type AgentCapabilityErrorPayload, type AgentComponentDefinition, type AgentComponentDescriptor, type AgentConcurrency, type AgentConsumer, type AgentEffect, type AgentEnvironment, type AgentErrorRetry, type AgentInvocation, type AgentInvocationPolicyContext, type AgentInvocationResult, type AgentObservationDefinition, type AgentObservationDescriptor, type AgentPlane, type AgentPolicy, type AgentPolicyContext, type AgentProcedureBinding, type AgentProcedureBindingRuntimeConfig, type AgentProcedureDescriptor, type AgentProcedureEffect, type AgentProcedureExecutor, type AgentProcedureRefDescriptor, type AgentReadContext, type AgentRegistrationHandle, type AgentRouteInfo, type AgentSchema, AgentSchemaError, type AgentSchemaIssue, AgentSurfaceDefinitionError, type AgentSurfaceDefinitionErrorCode, AgentSurfaceError, type AgentSurfaceEvent, type AgentSurfaceLimits, type AgentSurfaceRegistry, type AgentSurfaceSnapshot, type AgentTool, type AgentToolset, type AgentToolsetOptions, type AuditEvent, type AuditSink, CONFIRMATION_ESCALATION, type ConfirmationController, type ConfirmationEscalation, DEFAULT_LIMITS, type DiscoveryDecision, type InvokeOptions, type JsonSchema, type JsonValue, MAX_ID_LENGTH, MAX_WIRE_NAME_LENGTH, type ParsedCapabilityId, type PendingConfirmation, type PreconditionFailure, type ProcedureCallInfo, type RegistrationCandidate, type RegistryOptions, type SnapshotContext, type StandardSchemaV1, type Unsubscribe, type WireNameAssignment, type WireNameEntry, action, assignWireNames, audit, authenticated, composeInvokeChain, consoleAuditSink, createAgentSurfaceRegistry, createAgentToolset, decodeWireName, defineAgentComponent, emptyObjectSchema, encodeWireName, encodeWireNameForInstance, environment, evaluateDiscovery, formatDomainCapabilityId, formatViewCapabilityId, fromJsonSchema, fromStandardSchema, hasPermission, isAgentSurfaceError, isValidCapabilityName, isValidComponentType, isValidInstanceId, jsonDeepEqual, memoryAuditSink, observation, parseCapabilityId, rateLimit, requireConfirmation, stableDescriptionOf, tenantBoundary, validateComponentDefinition, validateJsonSchemaDocument, validateValueAgainstSchema };
919
+ export { AGENT_CAPABILITY_ERROR_CODES, type AgentActionContext, type AgentActionDefinition, type AgentActionDescriptor, type AgentAuthorizationContext, type AgentCapabilityDescriptorUnion, type AgentCapabilityErrorCode, type AgentCapabilityErrorPayload, type AgentComponentDefinition, type AgentComponentDescriptor, type AgentConcurrency, type AgentConsumer, type AgentEffect, type AgentEnvironment, type AgentErrorRetry, type AgentInvocation, type AgentInvocationPolicyContext, type AgentInvocationResult, type AgentObservationDefinition, type AgentObservationDescriptor, type AgentPlane, type AgentPolicy, type AgentPolicyContext, type AgentProcedureBinding, type AgentProcedureBindingRuntimeConfig, type AgentProcedureDescriptor, type AgentProcedureEffect, type AgentProcedureExecutor, type AgentProcedureRefDescriptor, type AgentReadContext, type AgentRegistrationHandle, type AgentRouteInfo, type AgentSchema, AgentSchemaError, type AgentSchemaIssue, AgentSurfaceDefinitionError, type AgentSurfaceDefinitionErrorCode, AgentSurfaceError, type AgentSurfaceEvent, type AgentSurfaceLimits, type AgentSurfaceRegistry, type AgentSurfaceSnapshot, type AgentTool, type AgentToolset, type AgentToolsetOptions, type AuditEvent, type AuditSink, CONFIRMATION_ESCALATION, type ConfirmationController, type ConfirmationEscalation, DEFAULT_LIMITS, type DiscoveryDecision, type InvokeOptions, type JsonSchema, type JsonValue, MAX_ID_LENGTH, MAX_WIRE_NAME_LENGTH, type ParsedCapabilityId, type PendingConfirmation, type PreconditionFailure, type ProcedureCallInfo, type RegistrationCandidate, type RegistryOptions, type SnapshotContext, type StandardSchemaV1, type Unsubscribe, type WireNameAssignment, type WireNameEntry, action, assignWireNames, audit, authenticated, composeInvokeChain, consoleAuditSink, createAgentSurfaceRegistry, createAgentToolset, decodeWireName, defineAgentComponent, emptyObjectSchema, encodeWireName, encodeWireNameForInstance, environment, evaluateDiscovery, formatDomainCapabilityId, formatViewCapabilityId, fromJsonSchema, fromStandardSchema, hasPermission, isAgentSurfaceError, isValidCapabilityName, isValidComponentType, isValidInstanceId, jsonDeepEqual, memoryAuditSink, observation, parseCapabilityId, rateLimit, requireConfirmation, tenantBoundary, validateComponentDefinition, validateJsonSchemaDocument, validateValueAgainstSchema };
package/dist/index.js CHANGED
@@ -2572,12 +2572,6 @@ function drainObservationQueues(internals) {
2572
2572
 
2573
2573
  // src/snapshot.ts
2574
2574
  var DEFAULT_CONSUMER2 = { id: "anonymous", kind: "embedded" };
2575
- function stableDescriptionOf(descriptor) {
2576
- const note = descriptor.contextualNote;
2577
- if (!note) return descriptor.description;
2578
- if (descriptor.description === note) return "";
2579
- return descriptor.description.endsWith(` ${note}`) ? descriptor.description.slice(0, -(note.length + 1)) : descriptor.description;
2580
- }
2581
2575
  function matchesScope(type, scope) {
2582
2576
  if (!scope || scope.length === 0) return true;
2583
2577
  return scope.some((prefix) => type === prefix || type.startsWith(`${prefix}.`));
@@ -2692,10 +2686,12 @@ function createSnapshot(internals, ctx) {
2692
2686
  } catch {
2693
2687
  }
2694
2688
  }
2695
- const description = contextualNote && internals.mergesContextualNote ? `${proc.baseDescription} ${contextualNote}`.trim() : proc.baseDescription;
2696
2689
  procedures.push({
2697
2690
  procedureId: proc.capabilityId,
2698
- description,
2691
+ // Never merged with `contextualNote` (D28): the manifest text is the
2692
+ // stable half, and folding volatile text in is what churned the
2693
+ // provider's cached prompt prefix.
2694
+ description: proc.baseDescription,
2699
2695
  ...contextualNote !== void 0 ? { contextualNote } : {},
2700
2696
  inputSchema: proc.reducedInputSchema,
2701
2697
  ...proc.outputJsonSchema ? { outputSchema: proc.outputJsonSchema } : {},
@@ -2763,7 +2759,6 @@ function createAgentSurfaceRegistry(options) {
2763
2759
  const internals = {
2764
2760
  environment: environment2,
2765
2761
  limits,
2766
- mergesContextualNote: options?.snapshotMergesContextualNote ?? true,
2767
2762
  surfaceId: `srf_${randomBase62(22)}`,
2768
2763
  version: 0,
2769
2764
  registrations: /* @__PURE__ */ new Map(),
@@ -3060,11 +3055,6 @@ function describePrefix(plane, effect, confirmation) {
3060
3055
  if (confirmation === "required") parts.push("requires confirmation");
3061
3056
  return `[${parts.join(" \xB7 ")}]`;
3062
3057
  }
3063
- function legacyDescription(prefix, description, state) {
3064
- const unavailable = state.available ? "" : ` [currently unavailable${state.unavailableReason ? `: ${state.unavailableReason}` : ""}]`;
3065
- const note = state.note ? ` ${state.note}` : "";
3066
- return `${prefix}${unavailable} ${description}${note}`;
3067
- }
3068
3058
  function availabilityState(descriptor) {
3069
3059
  return {
3070
3060
  available: descriptor.available,
@@ -3085,7 +3075,6 @@ function createAgentToolset(registry, options) {
3085
3075
  );
3086
3076
  }
3087
3077
  const confirmationsMode = options.confirmations ?? (options.topology === "remote" ? "two-phase" : "wait");
3088
- const descriptionIncludesState = options.descriptionIncludesState ?? true;
3089
3078
  const listeners = /* @__PURE__ */ new Set();
3090
3079
  const pendingWaits = /* @__PURE__ */ new Set();
3091
3080
  let disposed = false;
@@ -3199,7 +3188,7 @@ function createAgentToolset(registry, options) {
3199
3188
  void 0,
3200
3189
  describePrefix("domain", proc.effect, proc.confirmation),
3201
3190
  // The stable half only: a contextual note travels in `state.note`.
3202
- stableDescriptionOf(proc),
3191
+ proc.description,
3203
3192
  proc.inputSchema,
3204
3193
  availabilityState(proc),
3205
3194
  needsSuffix ? proc.context?.instanceId ?? proc.registrationId.replace(/[^A-Za-z0-9_-]/g, "") : void 0
@@ -3208,7 +3197,7 @@ function createAgentToolset(registry, options) {
3208
3197
  const assignment = assignWireNames(pending.map((p) => p.wire));
3209
3198
  const tools = pending.map((p, i) => ({
3210
3199
  name: assignment.names[i],
3211
- description: descriptionIncludesState ? legacyDescription(p.prefix, p.description, p.state) : `${p.prefix} ${p.description}`,
3200
+ description: `${p.prefix} ${p.description}`,
3212
3201
  inputSchema: p.inputSchema,
3213
3202
  state: p.state,
3214
3203
  execute: (input, call) => invokeThroughSurface(p.entry, input, call.toolCallId)
@@ -3490,7 +3479,6 @@ export {
3490
3479
  parseCapabilityId,
3491
3480
  rateLimit,
3492
3481
  requireConfirmation,
3493
- stableDescriptionOf,
3494
3482
  tenantBoundary,
3495
3483
  validateComponentDefinition,
3496
3484
  validateJsonSchemaDocument,