@agent-surface/core 0.16.0 → 0.18.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.
@@ -720,7 +720,7 @@ type AgentCapabilityDescriptorUnion = AgentObservationDescriptor | AgentActionDe
720
720
  declare function matchesScope(type: string, scope: string[] | undefined): boolean;
721
721
 
722
722
  /** Contract format emitted by @agent-surface/compiler. */
723
- declare const CAPABILITY_CONTRACT_FORMAT_VERSION: 3;
723
+ declare const CAPABILITY_CONTRACT_FORMAT_VERSION: 5;
724
724
  type CapabilityContractKind = "observation" | "action" | "procedure" | "external";
725
725
  interface CapabilityPolicyAttachment {
726
726
  name: string;
@@ -741,39 +741,48 @@ interface CapabilityContractEntry {
741
741
  targets: string[];
742
742
  origin: string;
743
743
  }
744
- interface ExternalCapabilityContractDigest {
745
- package?: string;
744
+ /**
745
+ * How a dependency's capabilities entered this manifest.
746
+ *
747
+ * Two facts are recorded separately because they answer different questions.
748
+ * `contractDigest` is *integrity*: what the dependency actually contributed to
749
+ * this build. `authorization` is *consent*: what the consumer approved. A
750
+ * dependency that changes its contract moves the first and not the second, and
751
+ * the build fails until a human updates the allow list.
752
+ */
753
+ interface ExternalContractAttribution {
754
+ /** npm package name — the stable key an allow list is written against. */
755
+ package: string;
756
+ /** Where the contribution came from, relative to the build root. */
746
757
  source: string;
747
- digest: string;
758
+ /** How the dependency contributed. */
759
+ route: "sidecar" | "source";
760
+ /** sha256 of the contribution as this build computed it. */
761
+ contractDigest: string;
762
+ /** What the consumer explicitly approved. */
763
+ authorization: {
764
+ mode: "pinned";
765
+ expectedDigest: string;
766
+ };
748
767
  }
749
768
  interface CapabilityContractManifest {
750
769
  formatVersion: typeof CAPABILITY_CONTRACT_FORMAT_VERSION;
751
770
  compilerVersion: string;
752
771
  targets: string[];
753
772
  capabilities: CapabilityContractEntry[];
754
- externalContracts: ExternalCapabilityContractDigest[];
773
+ externalContracts: ExternalContractAttribution[];
755
774
  completeness: {
756
775
  status: "proven";
757
776
  };
758
777
  /** sha256 of the canonical manifest payload without this field. */
759
778
  hash: string;
760
779
  }
761
- interface CompiledCapabilityToken {
762
- manifestHash: string;
763
- declarationId: string;
764
- capabilityId: string;
765
- contractHash: string;
766
- }
767
- interface CompiledComponentProvenance {
768
- manifestHash: string;
769
- declarationId: string;
770
- capabilities: Record<string, CompiledCapabilityToken>;
780
+ declare const CAPABILITY_AUTHORITY_TYPE: unique symbol;
781
+ /** Immutable runtime source of truth. Only objects minted here are accepted. */
782
+ interface CapabilityAuthority {
783
+ readonly manifest: CapabilityContractManifest;
784
+ readonly [CAPABILITY_AUTHORITY_TYPE]: true;
771
785
  }
772
- /** Shared across duplicate copies of core in a bundle. Not enumerable/serializable. */
773
- declare const COMPILED_CAPABILITY_PROVENANCE: unique symbol;
774
- type ProvenanceCarrier = {
775
- [COMPILED_CAPABILITY_PROVENANCE]?: CompiledComponentProvenance | CompiledCapabilityToken;
776
- };
777
786
  interface AgentObservationContract<TOut extends JsonValue> {
778
787
  description: string;
779
788
  output: AgentSchema<TOut>;
@@ -848,7 +857,7 @@ interface AgentComponentContract<TObservations extends Record<string, AgentObser
848
857
  * Compiler macro. The second argument is injected by @agent-surface/compiler;
849
858
  * author code must never supply it.
850
859
  */
851
- declare function defineAgentComponentContract<TObservations extends Record<string, AgentObservationContract<any>> = Record<never, never>, TActions extends Record<string, AgentActionContract<any, any>> = Record<never, never>>(definition: AgentComponentContractDefinition<TObservations, TActions>, compiled?: CompiledComponentProvenance): AgentComponentContract<TObservations, TActions>;
860
+ declare function defineAgentComponentContract<TObservations extends Record<string, AgentObservationContract<any>> = Record<never, never>, TActions extends Record<string, AgentActionContract<any, any>> = Record<never, never>>(definition: AgentComponentContractDefinition<TObservations, TActions>): AgentComponentContract<TObservations, TActions>;
852
861
  interface ExternalAgentToolContractDefinition<TIn extends JsonValue, TOut extends JsonValue> {
853
862
  id: string;
854
863
  description: string;
@@ -869,17 +878,16 @@ interface AgentProcedureContractDefinition<TIn extends JsonValue, TOut extends J
869
878
  policies?: CapabilityPolicyAttachment[];
870
879
  tags?: string[];
871
880
  }
872
- interface AgentProcedureContract<TIn extends JsonValue, TOut extends JsonValue> extends ProvenanceCarrier {
881
+ interface AgentProcedureContract<TIn extends JsonValue, TOut extends JsonValue> {
873
882
  readonly kind: "agent-procedure-contract";
874
883
  readonly definition: AgentProcedureContractDefinition<TIn, TOut>;
875
884
  }
876
- declare function defineAgentProcedureContract<TIn extends JsonValue, TOut extends JsonValue = JsonValue>(definition: AgentProcedureContractDefinition<TIn, TOut>, compiled?: CompiledCapabilityToken): AgentProcedureContract<TIn, TOut>;
885
+ declare function defineAgentProcedureContract<TIn extends JsonValue, TOut extends JsonValue = JsonValue>(definition: AgentProcedureContractDefinition<TIn, TOut>): AgentProcedureContract<TIn, TOut>;
877
886
  interface CompiledExternalAgentTool<TIn extends JsonValue = JsonValue, TOut extends JsonValue = JsonValue> {
878
887
  name: string;
879
888
  description: string;
880
889
  inputSchema: JsonSchema;
881
890
  execute(input: TIn): TOut | Promise<TOut>;
882
- [COMPILED_CAPABILITY_PROVENANCE]: CompiledCapabilityToken;
883
891
  }
884
892
  interface ExternalAgentToolContract<TIn extends JsonValue, TOut extends JsonValue> {
885
893
  readonly kind: "external-agent-tool-contract";
@@ -888,16 +896,19 @@ interface ExternalAgentToolContract<TIn extends JsonValue, TOut extends JsonValu
888
896
  execute(input: TIn): TOut | Promise<TOut>;
889
897
  }): CompiledExternalAgentTool<TIn, TOut>;
890
898
  }
891
- declare function defineExternalAgentToolContract<TIn extends JsonValue, TOut extends JsonValue = JsonValue>(definition: ExternalAgentToolContractDefinition<TIn, TOut>, compiled?: CompiledCapabilityToken): ExternalAgentToolContract<TIn, TOut>;
892
- declare function compiledCapabilityToken(contract: AgentProcedureContract<any, any> | ExternalAgentToolContract<any, any>): CompiledCapabilityToken;
893
- declare function tryCompiledCapabilityToken(contract: AgentProcedureContract<any, any> | ExternalAgentToolContract<any, any>): CompiledCapabilityToken | undefined;
894
- /** Runtime exposure ceiling used by the registry. */
895
- declare function assertDefinitionInManifest(definition: AgentComponentDefinition, manifest: CapabilityContractManifest): void;
899
+ declare function defineExternalAgentToolContract<TIn extends JsonValue, TOut extends JsonValue = JsonValue>(definition: ExternalAgentToolContractDefinition<TIn, TOut>): ExternalAgentToolContract<TIn, TOut>;
900
+ /** Preserve compiler proof while an adapter replaces handlers with latest-ref delegates. */
901
+ declare function deriveAgentComponentBinding(source: AgentComponentDefinition, derived: AgentComponentDefinition): AgentComponentDefinition;
902
+ /** Bind a compiled procedure contract to its contextual runtime definition. */
903
+ declare function authorizeAgentProcedureBinding(contract: AgentProcedureContract<any, any>, definition: AgentComponentDefinition): AgentComponentDefinition;
904
+ declare function createCapabilityAuthority(manifest: CapabilityContractManifest): CapabilityAuthority;
905
+ /** Mandatory runtime authority check used by every registry registration. */
906
+ declare function assertDefinitionAuthorized(definition: AgentComponentDefinition, authority: CapabilityAuthority): void;
896
907
  interface AgentExposureGateway {
897
908
  expose<T extends CompiledExternalAgentTool>(tools: readonly T[]): T[];
898
909
  }
899
910
  /** Final provider/MCP boundary: arbitrary tool objects cannot pass. */
900
- declare function createAgentExposureGateway(manifest: CapabilityContractManifest): AgentExposureGateway;
911
+ declare function createAgentExposureGateway(authority: CapabilityAuthority): AgentExposureGateway;
901
912
 
902
913
  interface RegistrationCandidate {
903
914
  definition: AgentComponentDefinition;
@@ -923,8 +934,8 @@ interface RegistryOptions {
923
934
  limits?: Partial<AgentSurfaceLimits>;
924
935
  /** Injectable clock (docs/08 determinism); default Date.now. */
925
936
  now?: () => number;
926
- /** Compiler-generated runtime ceiling. When present, raw/stale bindings fail closed. */
927
- manifest?: CapabilityContractManifest;
937
+ /** Compiler-generated runtime source of truth. Required outside repository tests. */
938
+ authority?: CapabilityAuthority;
928
939
  }
929
940
  interface AgentRegistrationHandle {
930
941
  readonly registrationId: string;
@@ -956,4 +967,4 @@ interface AgentSurfaceRegistry {
956
967
  }
957
968
  declare function createAgentSurfaceRegistry(options?: RegistryOptions): AgentSurfaceRegistry;
958
969
 
959
- export { type AgentSurfaceLimits as $, type AgentRouteInfo as A, type AgentObservationContract as B, type AgentObservationDefinition as C, type DiscoveryDecision as D, type AgentObservationDescriptor as E, type AgentPolicy as F, type AgentPolicyContext as G, type AgentProcedureBinding as H, type AgentProcedureBindingRuntimeConfig as I, type JsonSchema as J, type AgentProcedureContract as K, type AgentProcedureContractDefinition as L, type AgentProcedureDescriptor as M, type AgentProcedureEffect as N, type AgentProcedureExecutor as O, type AgentProcedureRefDescriptor as P, type AgentReadContext as Q, type AgentRegistrationHandle as R, type SnapshotContext as S, type AgentSchema as T, type Unsubscribe as U, AgentSchemaError as V, type AgentSchemaIssue as W, AgentSurfaceDefinitionError as X, type AgentSurfaceDefinitionErrorCode as Y, AgentSurfaceError as Z, type AgentSurfaceEvent as _, type AgentConsumer as a, type AgentSurfaceSnapshot as a0, type AuditEvent as a1, type AuditSink as a2, CAPABILITY_CONTRACT_FORMAT_VERSION as a3, COMPILED_CAPABILITY_PROVENANCE as a4, CONFIRMATION_ESCALATION as a5, type CapabilityContractEntry as a6, type CapabilityContractKind as a7, type CapabilityContractManifest as a8, type CapabilityPolicyAttachment as a9, defineAgentComponent as aA, defineAgentComponentContract as aB, defineAgentProcedureContract as aC, defineExternalAgentToolContract as aD, emptyObjectSchema as aE, environment as aF, evaluateDiscovery as aG, fromJsonSchema as aH, fromStandardSchema as aI, hasPermission as aJ, isAgentSurfaceError as aK, memoryAuditSink as aL, observation as aM, observationContract as aN, rateLimit as aO, requireConfirmation as aP, tenantBoundary as aQ, tryCompiledCapabilityToken as aR, validateComponentDefinition as aS, validateJsonSchemaDocument as aT, validateValueAgainstSchema as aU, type CompiledCapabilityToken as aa, type CompiledComponentProvenance as ab, type CompiledExternalAgentTool as ac, type ConfirmationController as ad, type ConfirmationEscalation as ae, DEFAULT_LIMITS as af, type ExternalAgentToolContract as ag, type ExternalAgentToolContractDefinition as ah, type ExternalCapabilityContractDigest as ai, type InvokeOptions as aj, type PendingConfirmation as ak, type PreconditionFailure as al, type ProcedureCallInfo as am, type RegistrationCandidate as an, type RegistryOptions as ao, type StandardSchemaV1 as ap, action as aq, actionContract as ar, assertDefinitionInManifest as as, audit as at, authenticated as au, compiledCapabilityToken as av, composeInvokeChain as aw, consoleAuditSink as ax, createAgentExposureGateway as ay, createAgentSurfaceRegistry as az, type AgentSurfaceRegistry as b, type JsonValue as c, type AgentInvocationResult as d, AGENT_CAPABILITY_ERROR_CODES as e, type AgentActionContext as f, type AgentActionContract as g, type AgentActionDefinition as h, type AgentActionDescriptor as i, type AgentAuthorizationContext as j, type AgentCapabilityDescriptorUnion as k, type AgentCapabilityErrorCode as l, matchesScope as m, type AgentCapabilityErrorPayload as n, type AgentComponentContract as o, type AgentComponentContractDefinition as p, type AgentComponentDefinition as q, type AgentComponentDescriptor as r, type AgentComponentRuntimeBindings as s, type AgentConcurrency as t, type AgentEffect as u, type AgentEnvironment as v, type AgentErrorRetry as w, type AgentExposureGateway as x, type AgentInvocation as y, type AgentInvocationPolicyContext as z };
970
+ export { type AgentSurfaceLimits as $, type AgentRouteInfo as A, type AgentObservationContract as B, type AgentObservationDefinition as C, type DiscoveryDecision as D, type AgentObservationDescriptor as E, type AgentPolicy as F, type AgentPolicyContext as G, type AgentProcedureBinding as H, type AgentProcedureBindingRuntimeConfig as I, type JsonSchema as J, type AgentProcedureContract as K, type AgentProcedureContractDefinition as L, type AgentProcedureDescriptor as M, type AgentProcedureEffect as N, type AgentProcedureExecutor as O, type AgentProcedureRefDescriptor as P, type AgentReadContext as Q, type AgentRegistrationHandle as R, type SnapshotContext as S, type AgentSchema as T, type Unsubscribe as U, AgentSchemaError as V, type AgentSchemaIssue as W, AgentSurfaceDefinitionError as X, type AgentSurfaceDefinitionErrorCode as Y, AgentSurfaceError as Z, type AgentSurfaceEvent as _, type AgentConsumer as a, type AgentSurfaceSnapshot as a0, type AuditEvent as a1, type AuditSink as a2, CAPABILITY_CONTRACT_FORMAT_VERSION as a3, CONFIRMATION_ESCALATION as a4, type CapabilityAuthority as a5, type CapabilityContractEntry as a6, type CapabilityContractKind as a7, type CapabilityContractManifest as a8, type CapabilityPolicyAttachment as a9, defineAgentComponentContract as aA, defineAgentProcedureContract as aB, defineExternalAgentToolContract as aC, deriveAgentComponentBinding as aD, emptyObjectSchema as aE, environment as aF, evaluateDiscovery as aG, fromJsonSchema as aH, fromStandardSchema as aI, hasPermission as aJ, isAgentSurfaceError as aK, memoryAuditSink as aL, observation as aM, observationContract as aN, rateLimit as aO, requireConfirmation as aP, tenantBoundary as aQ, validateComponentDefinition as aR, validateJsonSchemaDocument as aS, validateValueAgainstSchema as aT, type CompiledExternalAgentTool as aa, type ConfirmationController as ab, type ConfirmationEscalation as ac, DEFAULT_LIMITS as ad, type ExternalAgentToolContract as ae, type ExternalAgentToolContractDefinition as af, type ExternalContractAttribution as ag, type InvokeOptions as ah, type PendingConfirmation as ai, type PreconditionFailure as aj, type ProcedureCallInfo as ak, type RegistrationCandidate as al, type RegistryOptions as am, type StandardSchemaV1 as an, action as ao, actionContract as ap, assertDefinitionAuthorized as aq, audit as ar, authenticated as as, authorizeAgentProcedureBinding as at, composeInvokeChain as au, consoleAuditSink as av, createAgentExposureGateway as aw, createAgentSurfaceRegistry as ax, createCapabilityAuthority as ay, defineAgentComponent as az, type AgentSurfaceRegistry as b, type JsonValue as c, type AgentInvocationResult as d, AGENT_CAPABILITY_ERROR_CODES as e, type AgentActionContext as f, type AgentActionContract as g, type AgentActionDefinition as h, type AgentActionDescriptor as i, type AgentAuthorizationContext as j, type AgentCapabilityDescriptorUnion as k, type AgentCapabilityErrorCode as l, matchesScope as m, type AgentCapabilityErrorPayload as n, type AgentComponentContract as o, type AgentComponentContractDefinition as p, type AgentComponentDefinition as q, type AgentComponentDescriptor as r, type AgentComponentRuntimeBindings as s, type AgentConcurrency as t, type AgentEffect as u, type AgentEnvironment as v, type AgentErrorRetry as w, type AgentExposureGateway as x, type AgentInvocation as y, type AgentInvocationPolicyContext as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-surface/core",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "Framework-agnostic registry, types, policies, errors, snapshot, invocation for frontend agent surfaces",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -58,7 +58,7 @@
58
58
  "size-limit": [
59
59
  {
60
60
  "path": "dist/index.js",
61
- "limit": "20.5 kB"
61
+ "limit": "22 kB"
62
62
  },
63
63
  {
64
64
  "path": "dist/explain.js",