@xemahq/authorization-internal-api-client 0.3.4 → 0.4.3

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.
Files changed (43) hide show
  1. package/dist/custom-fetch.d.ts +22 -0
  2. package/dist/custom-fetch.js +27 -0
  3. package/dist/endpoints/authorization/authorization.d.ts +2 -2
  4. package/dist/endpoints/authorization/authorization.js +2 -2
  5. package/dist/endpoints/resources/resources.d.ts +7 -1
  6. package/dist/endpoints/resources/resources.js +18 -1
  7. package/dist/models/addResourceShareDto.d.ts +4 -1
  8. package/dist/models/addRoleGrantDto.d.ts +0 -1
  9. package/dist/models/{biomeTrustTier.d.ts → biomeExecutionTrustTier.d.ts} +2 -4
  10. package/dist/models/{biomeTrustTier.js → biomeExecutionTrustTier.js} +2 -4
  11. package/dist/models/capabilityGrantDto.d.ts +0 -1
  12. package/dist/models/createExecutionEnvironmentDto.d.ts +3 -0
  13. package/dist/models/createGrantDto.d.ts +0 -2
  14. package/dist/models/credentialDefaultDto.d.ts +2 -0
  15. package/dist/models/credentialDefaultsControllerDeleteParams.d.ts +4 -0
  16. package/dist/models/credentialDefaultsControllerGetParams.d.ts +4 -0
  17. package/dist/models/credentialPrecedenceSource.d.ts +1 -0
  18. package/dist/models/credentialPrecedenceSource.js +1 -0
  19. package/dist/models/dataResidency.d.ts +0 -2
  20. package/dist/models/dataResidency.js +0 -2
  21. package/dist/models/environmentCeilingSource.d.ts +14 -0
  22. package/dist/models/environmentCeilingSource.js +13 -0
  23. package/dist/models/executionEnvironmentResponseDto.d.ts +8 -0
  24. package/dist/models/grantVersionResponseDto.d.ts +1 -1
  25. package/dist/models/index.d.ts +5 -1
  26. package/dist/models/index.js +5 -1
  27. package/dist/models/policyBiomeDto.d.ts +2 -2
  28. package/dist/models/policyCheckRequestDto.d.ts +3 -0
  29. package/dist/models/policyCheckRequestDtoAperture.d.ts +11 -0
  30. package/dist/models/policyCheckRequestDtoAperture.js +7 -0
  31. package/dist/models/policyResourceDto.d.ts +2 -1
  32. package/dist/models/registerResourceOwnershipDto.d.ts +3 -2
  33. package/dist/models/replaceResourceOwnershipDto.d.ts +16 -0
  34. package/dist/models/replaceResourceOwnershipDto.js +2 -0
  35. package/dist/models/resourceOwnershipEntryDto.d.ts +6 -0
  36. package/dist/models/resourceOwnershipReadDto.d.ts +5 -3
  37. package/dist/models/resourceShareRefDto.d.ts +15 -0
  38. package/dist/models/resourceShareRefDto.js +2 -0
  39. package/dist/models/roleGrantDto.d.ts +0 -1
  40. package/dist/models/updateExecutionEnvironmentDto.d.ts +3 -0
  41. package/dist/models/updateGrantDto.d.ts +0 -1
  42. package/dist/models/upsertCredentialDefaultDto.d.ts +2 -0
  43. package/package.json +2 -2
@@ -47,6 +47,28 @@ export interface ClientConfig {
47
47
  getAuthToken?: () => Promise<string>;
48
48
  /** Optional callback returning headers to inject on every request. Per-call headers take precedence. */
49
49
  getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
50
+ /**
51
+ * Optional resolver for the CORRELATION ID of the request being made — the
52
+ * handle that ties one causal chain together across every service hop.
53
+ *
54
+ * WHY IT IS A CALLBACK AND NOT A VALUE. `ClientConfig` is process-global
55
+ * (`configureClient` is called once at wiring time), and a correlation id is
56
+ * per-request. This is invoked INSIDE the request, so a server can point it
57
+ * at whatever carries its ambient request context and get the CURRENT id
58
+ * rather than the one that happened to be live at boot.
59
+ *
60
+ * WHY THE TRANSPORT DOES NOT MINT ONE. Returning `undefined` sends no header,
61
+ * and the receiving service's `RequestContextMiddleware` mints its own — a
62
+ * new trace, which is honest. A transport that minted per call would produce
63
+ * a FRESH id on every hop while looking like propagation, which is strictly
64
+ * worse than none: every row would carry a correlation id and no two rows
65
+ * that belong together would share one. That is the exact defect this exists
66
+ * to fix, so the transport must not reproduce it one layer down.
67
+ *
68
+ * A caller-supplied `X-Correlation-Id` header always wins, and so does one
69
+ * from `getHeaders`.
70
+ */
71
+ getCorrelationId?: () => string | undefined | Promise<string | undefined>;
50
72
  /**
51
73
  * Optional callback invoked on a 401 before ONE re-attempt. Supplying it is
52
74
  * what opts this client into that re-attempt; without it a 401 comes back to
@@ -89,6 +89,16 @@ function getClientConfig() {
89
89
  */
90
90
  /** The only statuses that state the request was NOT processed. See above. */
91
91
  const RETRYABLE_STATUSES = [429, 503];
92
+ /**
93
+ * The platform's correlation header, spelled once.
94
+ *
95
+ * Value-identical to what `RequestContextMiddleware` reads in
96
+ * `@xemahq/platform-common`. It is a literal here rather than an import
97
+ * because this file has ZERO imports on purpose: it ships byte-identical into
98
+ * browser-target clients as well as server-target ones, and a dependency on a
99
+ * NestJS-peer package would follow it into every one of them.
100
+ */
101
+ const CORRELATION_ID_HEADER = 'X-Correlation-Id';
92
102
  /** Backoff floor, doubling per attempt up to {@link MAX_BACKOFF_MS}. */
93
103
  const BASE_BACKOFF_MS = 1000;
94
104
  /** Ceiling on a single backoff, however many attempts have elapsed. */
@@ -104,6 +114,23 @@ async function buildHeaders(config, callerHeaders) {
104
114
  }
105
115
  }
106
116
  }
117
+ // Correlation id (caller and global headers still take precedence).
118
+ //
119
+ // Without this, every server-to-server hop through a generated client started
120
+ // a NEW trace: the id is read-or-minted per hop by the receiving service's
121
+ // RequestContextMiddleware, and nothing carried it outbound — so an audit
122
+ // journal could record a whole causal chain and offer no way to join it back
123
+ // together.
124
+ //
125
+ // Absent resolver, or a resolver that answers `undefined`: NO header. The
126
+ // receiver mints and a new trace begins, which is the truthful outcome when
127
+ // there is nothing to continue.
128
+ if (config.getCorrelationId && !headers.has(CORRELATION_ID_HEADER)) {
129
+ const correlationId = await Promise.resolve(config.getCorrelationId());
130
+ if (correlationId) {
131
+ headers.set(CORRELATION_ID_HEADER, correlationId);
132
+ }
133
+ }
107
134
  // Auth token (caller or global headers take precedence)
108
135
  if (config.getAuthToken && !headers.has('Authorization')) {
109
136
  const token = await config.getAuthToken();
@@ -6,14 +6,14 @@
6
6
  import type { AuthorizationCheckRequestDto, AuthorizationCheckResponseDtoDataEnvelope, GrantVersionResponseDtoDataEnvelope, PolicyCheckBatchRequestDto, PolicyCheckBatchResponseDtoDataEnvelope, PolicyCheckRequestDto, PolicyDecisionDtoDataEnvelope } from '../../models';
7
7
  export declare const getAuthorizationControllerCheckUrl: () => string;
8
8
  /**
9
- * Called by xema-capability-router on every invocation. Phase 3 returns `allowed=true` for any non-revoked grant matching `(subject, capability)`; `environment` is stored but not yet enforced. Phase 4 will enforce environment, resource-glob, rate-limit, and approval.
9
+ * Called by xema-capability-router on every invocation. The verdict is OpenFGA-authoritative and then narrowed, in order, by the delegation clamp, the agent reach tier, and the ENVIRONMENT reach ceiling (the environment runs last on purpose: it is the outer boundary, so it must see the tier's output — a `connected` tier extends a deny into an allow, and the environment may then take that away). `requiresApproval` denies with APPROVAL_REQUIRED. NOT enforced here: `rateLimit` (accepted on a grant, read by nothing) and `ExecutionEnvironment.allowedCapabilities` (an enumerated per-ref list, deliberately not wired for the built-ins — see `environment-reach-ceiling`; it is enforced only by app-function-broker, for org-custom environments).
10
10
  * @summary Runtime allow/deny decision for a (subject, capability) tuple
11
11
  */
12
12
  export declare const authorizationControllerCheck: (authorizationCheckRequestDto: AuthorizationCheckRequestDto, options?: RequestInit) => Promise<AuthorizationCheckResponseDtoDataEnvelope>;
13
13
  export declare const getAuthorizationControllerGrantVersionUrl: (orgId: string) => string;
14
14
  /**
15
15
  * A cheap read of the per-org grant-version counter — bumped on every grant/environment/membership change. Consumers (e.g. app-platform delegated-session verify) key a short-lived effective-capability cache by it so a revoked role takes effect at the next miss rather than at token expiry. Fail-closed: an unavailable version store surfaces as a 5xx so the caller denies.
16
- * @summary Current monotonic grant-version for an org (Wave 8.2)
16
+ * @summary Current durable monotonic grant-version for an org
17
17
  */
18
18
  export declare const authorizationControllerGrantVersion: (orgId: string, options?: RequestInit) => Promise<GrantVersionResponseDtoDataEnvelope>;
19
19
  export declare const getAuthorizationControllerPolicyCheckUrl: () => string;
@@ -7,7 +7,7 @@ const getAuthorizationControllerCheckUrl = () => {
7
7
  };
8
8
  exports.getAuthorizationControllerCheckUrl = getAuthorizationControllerCheckUrl;
9
9
  /**
10
- * Called by xema-capability-router on every invocation. Phase 3 returns `allowed=true` for any non-revoked grant matching `(subject, capability)`; `environment` is stored but not yet enforced. Phase 4 will enforce environment, resource-glob, rate-limit, and approval.
10
+ * Called by xema-capability-router on every invocation. The verdict is OpenFGA-authoritative and then narrowed, in order, by the delegation clamp, the agent reach tier, and the ENVIRONMENT reach ceiling (the environment runs last on purpose: it is the outer boundary, so it must see the tier's output — a `connected` tier extends a deny into an allow, and the environment may then take that away). `requiresApproval` denies with APPROVAL_REQUIRED. NOT enforced here: `rateLimit` (accepted on a grant, read by nothing) and `ExecutionEnvironment.allowedCapabilities` (an enumerated per-ref list, deliberately not wired for the built-ins — see `environment-reach-ceiling`; it is enforced only by app-function-broker, for org-custom environments).
11
11
  * @summary Runtime allow/deny decision for a (subject, capability) tuple
12
12
  */
13
13
  const authorizationControllerCheck = async (authorizationCheckRequestDto, options) => {
@@ -25,7 +25,7 @@ const getAuthorizationControllerGrantVersionUrl = (orgId) => {
25
25
  exports.getAuthorizationControllerGrantVersionUrl = getAuthorizationControllerGrantVersionUrl;
26
26
  /**
27
27
  * A cheap read of the per-org grant-version counter — bumped on every grant/environment/membership change. Consumers (e.g. app-platform delegated-session verify) key a short-lived effective-capability cache by it so a revoked role takes effect at the next miss rather than at token expiry. Fail-closed: an unavailable version store surfaces as a 5xx so the caller denies.
28
- * @summary Current monotonic grant-version for an org (Wave 8.2)
28
+ * @summary Current durable monotonic grant-version for an org
29
29
  */
30
30
  const authorizationControllerGrantVersion = async (orgId, options) => {
31
31
  return (0, custom_fetch_1.customFetch)((0, exports.getAuthorizationControllerGrantVersionUrl)(orgId), {
@@ -3,7 +3,7 @@
3
3
  * Authorization API
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
- import type { AddResourceShareDto, ListVisibleResourcesDto, RegisterResourceOwnershipDto, RemoveResourceShareDto, ResourceOwnershipDtoDataEnvelope, ResourceOwnershipReadDtoDataEnvelope, VisibleResourcesDtoDataEnvelope } from '../../models';
6
+ import type { AddResourceShareDto, ListVisibleResourcesDto, RegisterResourceOwnershipDto, RemoveResourceShareDto, ReplaceResourceOwnershipDto, ResourceOwnershipDtoDataEnvelope, ResourceOwnershipReadDtoDataEnvelope, VisibleResourcesDtoDataEnvelope } from '../../models';
7
7
  export declare const getResourcesControllerRegisterUrl: () => string;
8
8
  /**
9
9
  * Writes the ownership rows + OpenFGA tuples so the PDP ANDs the verb verdict with instance ownership. Idempotent (upsert + ignore-duplicate tuples). Org scope is forced from the caller context.
@@ -22,6 +22,12 @@ export declare const getResourcesControllerGetOwnershipUrl: (type: string, id: s
22
22
  * @summary Read a resource instance’s current visibility + subjects
23
23
  */
24
24
  export declare const resourcesControllerGetOwnership: (type: string, id: string, options?: RequestInit) => Promise<ResourceOwnershipReadDtoDataEnvelope>;
25
+ export declare const getResourcesControllerReplaceOwnershipUrl: (type: string, id: string) => string;
26
+ /**
27
+ * The whole post-state: after this call the instance’s registered subjects are EXACTLY `owners` ∪ `explicitShares`, and a subject named by neither loses its authority row AND its `shared_with` tuple. This is the ONLY surface that can express a revocation as part of a set write — `resource.register` upserts what it is handed and never touches a subject outside that list, so re-registering with a subject removed reports 200 and leaves both its row and its tuple live. Removals delete the tuple BEFORE the row (a crash between them leaves the subject WITHOUT access); additions write the row before the tuple. Serialised per instance by an advisory lock, so two concurrent replaces cannot interleave into a mixed set. Idempotent. Refuses (409 `RESOURCE_SUBJECT_IS_OWNER`) when a currently-registered OWNER is absent from the new `owners` list — dropping or demoting an owner is `resource.deregister`. Org scope is forced from the caller context.
28
+ * @summary REPLACE a resource instance’s ownership set
29
+ */
30
+ export declare const resourcesControllerReplaceOwnership: (type: string, id: string, replaceResourceOwnershipDto: ReplaceResourceOwnershipDto, options?: RequestInit) => Promise<ResourceOwnershipDtoDataEnvelope>;
25
31
  export declare const getResourcesControllerDeregisterUrl: (type: string, id: string) => string;
26
32
  /**
27
33
  * Idempotent — a no-op when the instance was never registered.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resourcesControllerRemoveShare = exports.getResourcesControllerRemoveShareUrl = exports.resourcesControllerAddShare = exports.getResourcesControllerAddShareUrl = exports.resourcesControllerDeregister = exports.getResourcesControllerDeregisterUrl = exports.resourcesControllerGetOwnership = exports.getResourcesControllerGetOwnershipUrl = exports.resourcesControllerListVisible = exports.getResourcesControllerListVisibleUrl = exports.resourcesControllerRegister = exports.getResourcesControllerRegisterUrl = void 0;
3
+ exports.resourcesControllerRemoveShare = exports.getResourcesControllerRemoveShareUrl = exports.resourcesControllerAddShare = exports.getResourcesControllerAddShareUrl = exports.resourcesControllerDeregister = exports.getResourcesControllerDeregisterUrl = exports.resourcesControllerReplaceOwnership = exports.getResourcesControllerReplaceOwnershipUrl = exports.resourcesControllerGetOwnership = exports.getResourcesControllerGetOwnershipUrl = exports.resourcesControllerListVisible = exports.getResourcesControllerListVisibleUrl = exports.resourcesControllerRegister = exports.getResourcesControllerRegisterUrl = void 0;
4
4
  const custom_fetch_1 = require("../../custom-fetch");
5
5
  const getResourcesControllerRegisterUrl = () => {
6
6
  return `/resources`;
@@ -51,6 +51,23 @@ const resourcesControllerGetOwnership = async (type, id, options) => {
51
51
  });
52
52
  };
53
53
  exports.resourcesControllerGetOwnership = resourcesControllerGetOwnership;
54
+ const getResourcesControllerReplaceOwnershipUrl = (type, id) => {
55
+ return `/resources/${type}/${id}`;
56
+ };
57
+ exports.getResourcesControllerReplaceOwnershipUrl = getResourcesControllerReplaceOwnershipUrl;
58
+ /**
59
+ * The whole post-state: after this call the instance’s registered subjects are EXACTLY `owners` ∪ `explicitShares`, and a subject named by neither loses its authority row AND its `shared_with` tuple. This is the ONLY surface that can express a revocation as part of a set write — `resource.register` upserts what it is handed and never touches a subject outside that list, so re-registering with a subject removed reports 200 and leaves both its row and its tuple live. Removals delete the tuple BEFORE the row (a crash between them leaves the subject WITHOUT access); additions write the row before the tuple. Serialised per instance by an advisory lock, so two concurrent replaces cannot interleave into a mixed set. Idempotent. Refuses (409 `RESOURCE_SUBJECT_IS_OWNER`) when a currently-registered OWNER is absent from the new `owners` list — dropping or demoting an owner is `resource.deregister`. Org scope is forced from the caller context.
60
+ * @summary REPLACE a resource instance’s ownership set
61
+ */
62
+ const resourcesControllerReplaceOwnership = async (type, id, replaceResourceOwnershipDto, options) => {
63
+ return (0, custom_fetch_1.customFetch)((0, exports.getResourcesControllerReplaceOwnershipUrl)(type, id), {
64
+ ...options,
65
+ method: 'PUT',
66
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
67
+ body: JSON.stringify(replaceResourceOwnershipDto)
68
+ });
69
+ };
70
+ exports.resourcesControllerReplaceOwnership = resourcesControllerReplaceOwnership;
54
71
  const getResourcesControllerDeregisterUrl = (type, id) => {
55
72
  return `/resources/${type}/${id}`;
56
73
  };
@@ -3,7 +3,10 @@
3
3
  * Authorization API
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
+ import type { ResourceShareRefDto } from './resourceShareRefDto.js';
6
7
  import type { ResourceSubjectRefDto } from './resourceSubjectRefDto.js';
7
8
  export interface AddResourceShareDto {
8
- share: ResourceSubjectRefDto;
9
+ share: ResourceShareRefDto;
10
+ /** The subject GRANTING this share, when it is not the instance owner. Used to apply the two delegation rules: a grantor may never confer more than they hold, and re-sharing is itself a level. Omitted means the caller asserts owner authority, which this service verifies against the tuple store — it is never taken on the caller's word. */
11
+ grantor?: ResourceSubjectRefDto;
9
12
  }
@@ -7,7 +7,6 @@ import type { GrantConstraintsDto } from './grantConstraintsDto.js';
7
7
  export interface AddRoleGrantDto {
8
8
  /** Canonical CapabilityRef from `@xemahq/kernel-contracts/capability`. */
9
9
  capability: string;
10
- resourceGlob?: string;
11
10
  /** Built-in environment slug. */
12
11
  environment: string;
13
12
  constraints?: GrantConstraintsDto;
@@ -3,10 +3,8 @@
3
3
  * Authorization API
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
- export type BiomeTrustTier = typeof BiomeTrustTier[keyof typeof BiomeTrustTier];
7
- export declare const BiomeTrustTier: {
6
+ export type BiomeExecutionTrustTier = typeof BiomeExecutionTrustTier[keyof typeof BiomeExecutionTrustTier];
7
+ export declare const BiomeExecutionTrustTier: {
8
8
  readonly official: "official";
9
9
  readonly verified: "verified";
10
- readonly community: "community";
11
- readonly untrusted: "untrusted";
12
10
  };
@@ -5,10 +5,8 @@
5
5
  * OpenAPI spec version: 0.1.1
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.BiomeTrustTier = void 0;
9
- exports.BiomeTrustTier = {
8
+ exports.BiomeExecutionTrustTier = void 0;
9
+ exports.BiomeExecutionTrustTier = {
10
10
  official: 'official',
11
11
  verified: 'verified',
12
- community: 'community',
13
- untrusted: 'untrusted',
14
12
  };
@@ -13,7 +13,6 @@ export interface CapabilityGrantDto {
13
13
  subjectKind: SubjectKind;
14
14
  subjectRef: string;
15
15
  capability: string;
16
- resourceGlob: string;
17
16
  environment: string;
18
17
  constraints?: GrantConstraintsDto | null;
19
18
  requiresApproval: boolean;
@@ -6,6 +6,7 @@
6
6
  import type { CreateExecutionEnvironmentDtoAllowedCapabilitiesItem } from './createExecutionEnvironmentDtoAllowedCapabilitiesItem.js';
7
7
  import type { CreateExecutionEnvironmentDtoApprovalRulesItem } from './createExecutionEnvironmentDtoApprovalRulesItem.js';
8
8
  import type { CreateExecutionEnvironmentDtoRuntimeLimits } from './createExecutionEnvironmentDtoRuntimeLimits.js';
9
+ import type { DataClassification } from './dataClassification.js';
9
10
  import type { ExecutionEnvironmentKind } from './executionEnvironmentKind.js';
10
11
  export interface CreateExecutionEnvironmentDto {
11
12
  /** Owning organization. Scopes the custom environment to the tenant. */
@@ -21,4 +22,6 @@ export interface CreateExecutionEnvironmentDto {
21
22
  approvalRules?: CreateExecutionEnvironmentDtoApprovalRulesItem[];
22
23
  /** Runtime limits (`RuntimeLimits`). Defaults to `{}`. */
23
24
  runtimeLimits?: CreateExecutionEnvironmentDtoRuntimeLimits;
25
+ /** The environment's DATA ceiling: the most restrictive `DataClassification` an invocation may carry and still run here. The PDP compares it against `join(space floor, resource tag)` and DENIES when it is exceeded. `regulated` (the top of the rank) admits everything and is the default, so the ceiling refuses nothing until it is lowered. Defaults to `regulated`. */
26
+ maxDataClassification?: DataClassification;
24
27
  }
@@ -13,8 +13,6 @@ export interface CreateGrantDto {
13
13
  subjectRef: string;
14
14
  /** Canonical CapabilityRef from `@xemahq/kernel-contracts/capability`. */
15
15
  capability: string;
16
- /** Resource-scope glob for this grant. STORED ONLY — it is part of the grant uniqueness key and nothing in the decision path reads it, so a value narrower than `**` grants exactly what `**` grants today and must not be relied on to restrict anything. The vocabulary it will be matched against is deliberately NOT specified: instance refs are the canonical `resource:<type>:<id>` (see `PolicyResourceDto.ref`), and whether this glob matches those or a different addressing scheme is the decision of the phase that makes it enforceable. It previously advertised `xema://orgs/acme/projects/support/kb/**` — an XVFS path form the platform rejects wherever it IS parsed, and that stale vocabulary is what led five producers to send refs the PDP refuses. */
17
- resourceGlob?: string;
18
16
  /** Built-in environment slug. Phase 3 stores but does not enforce. */
19
17
  environment: string;
20
18
  constraints?: GrantConstraintsDto;
@@ -12,6 +12,8 @@ export interface CredentialDefaultDto {
12
12
  * @nullable
13
13
  */
14
14
  projectId?: string | null;
15
+ /** The external provider this default is for. */
16
+ provider: string;
15
17
  /** Opaque credential-binding pointer. Not a secret. */
16
18
  credentialBindingId: string;
17
19
  createdAt: string;
@@ -12,4 +12,8 @@ export type CredentialDefaultsControllerDeleteParams = {
12
12
  * Project identifier. Omit for the ORG-wide default; set for a per-project default.
13
13
  */
14
14
  projectId?: string;
15
+ /**
16
+ * The external provider whose default is being addressed. Required: a default is per (scope, provider), so a scope alone does not name one.
17
+ */
18
+ provider: string;
15
19
  };
@@ -12,4 +12,8 @@ export type CredentialDefaultsControllerGetParams = {
12
12
  * Project identifier. Omit for the ORG-wide default; set for a per-project default.
13
13
  */
14
14
  projectId?: string;
15
+ /**
16
+ * The external provider whose default is being addressed. Required: a default is per (scope, provider), so a scope alone does not name one.
17
+ */
18
+ provider: string;
15
19
  };
@@ -10,6 +10,7 @@ export type CredentialPrecedenceSource = typeof CredentialPrecedenceSource[keyof
10
10
  export declare const CredentialPrecedenceSource: {
11
11
  readonly explicit: "explicit";
12
12
  readonly capability_default: "capability_default";
13
+ readonly user_default: "user_default";
13
14
  readonly project_default: "project_default";
14
15
  readonly org_default: "org_default";
15
16
  readonly platform_default: "platform_default";
@@ -9,6 +9,7 @@ exports.CredentialPrecedenceSource = void 0;
9
9
  exports.CredentialPrecedenceSource = {
10
10
  explicit: 'explicit',
11
11
  capability_default: 'capability_default',
12
+ user_default: 'user_default',
12
13
  project_default: 'project_default',
13
14
  org_default: 'org_default',
14
15
  platform_default: 'platform_default',
@@ -5,7 +5,5 @@
5
5
  */
6
6
  export type DataResidency = typeof DataResidency[keyof typeof DataResidency];
7
7
  export declare const DataResidency: {
8
- readonly eu: "eu";
9
- readonly us: "us";
10
8
  readonly 'customer-private': "customer-private";
11
9
  };
@@ -7,7 +7,5 @@
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.DataResidency = void 0;
9
9
  exports.DataResidency = {
10
- eu: 'eu',
11
- us: 'us',
12
10
  'customer-private': 'customer-private',
13
11
  };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generated by @xemahq/api-client-generator — do not edit manually.
3
+ * Authorization API
4
+ * OpenAPI spec version: 0.1.1
5
+ */
6
+ /**
7
+ * WHICH row set `maxDataClassification`: the kernel-seeded global row (`platform-built-in`), this org's override of it (`org-override`), or an org-custom environment's own column (`org-custom-environment`). An override that the installation ceiling already swallowed reads as `platform-built-in`, because it is deciding nothing.
8
+ */
9
+ export type EnvironmentCeilingSource = typeof EnvironmentCeilingSource[keyof typeof EnvironmentCeilingSource];
10
+ export declare const EnvironmentCeilingSource: {
11
+ readonly 'platform-built-in': "platform-built-in";
12
+ readonly 'org-override': "org-override";
13
+ readonly 'org-custom-environment': "org-custom-environment";
14
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Generated by @xemahq/api-client-generator — do not edit manually.
4
+ * Authorization API
5
+ * OpenAPI spec version: 0.1.1
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.EnvironmentCeilingSource = void 0;
9
+ exports.EnvironmentCeilingSource = {
10
+ 'platform-built-in': 'platform-built-in',
11
+ 'org-override': 'org-override',
12
+ 'org-custom-environment': 'org-custom-environment',
13
+ };
@@ -3,6 +3,8 @@
3
3
  * Authorization API
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
+ import type { DataClassification } from './dataClassification.js';
7
+ import type { EnvironmentCeilingSource } from './environmentCeilingSource.js';
6
8
  import type { ExecutionEnvironmentKind } from './executionEnvironmentKind.js';
7
9
  import type { ExecutionEnvironmentResponseDtoAllowedCapabilitiesItem } from './executionEnvironmentResponseDtoAllowedCapabilitiesItem.js';
8
10
  import type { ExecutionEnvironmentResponseDtoApprovalRulesItem } from './executionEnvironmentResponseDtoApprovalRulesItem.js';
@@ -30,6 +32,12 @@ export interface ExecutionEnvironmentResponseDto {
30
32
  approvalRules: ExecutionEnvironmentResponseDtoApprovalRulesItem[];
31
33
  /** Runtime limits (`RuntimeLimits` from the kernel contracts). */
32
34
  runtimeLimits: ExecutionEnvironmentResponseDtoRuntimeLimits;
35
+ /** The environment's DATA ceiling: the most restrictive `DataClassification` an invocation may carry and still run here. The PDP compares it against `join(space floor, resource tag)` and DENIES when it is exceeded. `regulated` (the top of the rank) admits everything and is the default, so the ceiling refuses nothing until it is lowered. */
36
+ maxDataClassification: DataClassification;
37
+ /** The INSTALLATION-wide ceiling for this environment, before any organisation override. Equal to `maxDataClassification` whenever no override is in force. Present so a screen can say "your org lowered this" rather than showing one number and leaving the reader to guess who set it. */
38
+ platformMaxDataClassification: DataClassification;
39
+ /** WHICH row set `maxDataClassification`: the kernel-seeded global row (`platform-built-in`), this org's override of it (`org-override`), or an org-custom environment's own column (`org-custom-environment`). An override that the installation ceiling already swallowed reads as `platform-built-in`, because it is deciding nothing. */
40
+ dataCeilingSource: EnvironmentCeilingSource;
33
41
  createdAt: string;
34
42
  updatedAt: string;
35
43
  }
@@ -6,6 +6,6 @@
6
6
  export interface GrantVersionResponseDto {
7
7
  /** Organization the version belongs to. */
8
8
  orgId: string;
9
- /** Monotonic grant version for this org, folding in changes to org-independent (global) grants. `0` means no relevant grant change has been recorded yet (a valid baseline, not an error). Compare only against a previous value for the SAME org. */
9
+ /** Durable monotonic grant version for this org, folding in changes to org-independent (global) grants. It is an opaque comparison token, not a count: the baseline is a large offset rather than `0`. Compare only against a previous value for the SAME org. */
10
10
  grantVersion: number;
11
11
  }
@@ -12,8 +12,8 @@ export * from './authorizationDecisionCode';
12
12
  export * from './authorizationReasonDto';
13
13
  export * from './authorizationSuggestionDto';
14
14
  export * from './authorizationSuggestionKind';
15
+ export * from './biomeExecutionTrustTier';
15
16
  export * from './biomePermissionProfile';
16
- export * from './biomeTrustTier';
17
17
  export * from './callerKind';
18
18
  export * from './capabilityGrantDto';
19
19
  export * from './capabilityGrantDtoDataEnvelope';
@@ -38,6 +38,7 @@ export * from './dataClassification';
38
38
  export * from './dataResidency';
39
39
  export * from './describeObjectsResponseDto';
40
40
  export * from './describeObjectsResponseDtoDataEnvelope';
41
+ export * from './environmentCeilingSource';
41
42
  export * from './environmentsControllerFindBySlugParams';
42
43
  export * from './environmentsControllerListParams';
43
44
  export * from './environmentsControllerRemoveParams';
@@ -75,6 +76,7 @@ export * from './policyCheckBatchRequestDto';
75
76
  export * from './policyCheckBatchResponseDto';
76
77
  export * from './policyCheckBatchResponseDtoDataEnvelope';
77
78
  export * from './policyCheckRequestDto';
79
+ export * from './policyCheckRequestDtoAperture';
78
80
  export * from './policyConstraintsDto';
79
81
  export * from './policyDecisionDto';
80
82
  export * from './policyDecisionDtoDataEnvelope';
@@ -97,12 +99,14 @@ export * from './provisionedCapabilityDto';
97
99
  export * from './registerResourceOwnershipDto';
98
100
  export * from './relationshipsControllerListParams';
99
101
  export * from './removeResourceShareDto';
102
+ export * from './replaceResourceOwnershipDto';
100
103
  export * from './resourceManagedBy';
101
104
  export * from './resourceOwnershipDto';
102
105
  export * from './resourceOwnershipDtoDataEnvelope';
103
106
  export * from './resourceOwnershipEntryDto';
104
107
  export * from './resourceOwnershipReadDto';
105
108
  export * from './resourceOwnershipReadDtoDataEnvelope';
109
+ export * from './resourceShareRefDto';
106
110
  export * from './resourceSubjectRefDto';
107
111
  export * from './resourceVisibilityPattern';
108
112
  export * from './roleAssignmentDto';
@@ -29,8 +29,8 @@ __exportStar(require("./authorizationDecisionCode"), exports);
29
29
  __exportStar(require("./authorizationReasonDto"), exports);
30
30
  __exportStar(require("./authorizationSuggestionDto"), exports);
31
31
  __exportStar(require("./authorizationSuggestionKind"), exports);
32
+ __exportStar(require("./biomeExecutionTrustTier"), exports);
32
33
  __exportStar(require("./biomePermissionProfile"), exports);
33
- __exportStar(require("./biomeTrustTier"), exports);
34
34
  __exportStar(require("./callerKind"), exports);
35
35
  __exportStar(require("./capabilityGrantDto"), exports);
36
36
  __exportStar(require("./capabilityGrantDtoDataEnvelope"), exports);
@@ -55,6 +55,7 @@ __exportStar(require("./dataClassification"), exports);
55
55
  __exportStar(require("./dataResidency"), exports);
56
56
  __exportStar(require("./describeObjectsResponseDto"), exports);
57
57
  __exportStar(require("./describeObjectsResponseDtoDataEnvelope"), exports);
58
+ __exportStar(require("./environmentCeilingSource"), exports);
58
59
  __exportStar(require("./environmentsControllerFindBySlugParams"), exports);
59
60
  __exportStar(require("./environmentsControllerListParams"), exports);
60
61
  __exportStar(require("./environmentsControllerRemoveParams"), exports);
@@ -92,6 +93,7 @@ __exportStar(require("./policyCheckBatchRequestDto"), exports);
92
93
  __exportStar(require("./policyCheckBatchResponseDto"), exports);
93
94
  __exportStar(require("./policyCheckBatchResponseDtoDataEnvelope"), exports);
94
95
  __exportStar(require("./policyCheckRequestDto"), exports);
96
+ __exportStar(require("./policyCheckRequestDtoAperture"), exports);
95
97
  __exportStar(require("./policyConstraintsDto"), exports);
96
98
  __exportStar(require("./policyDecisionDto"), exports);
97
99
  __exportStar(require("./policyDecisionDtoDataEnvelope"), exports);
@@ -114,12 +116,14 @@ __exportStar(require("./provisionedCapabilityDto"), exports);
114
116
  __exportStar(require("./registerResourceOwnershipDto"), exports);
115
117
  __exportStar(require("./relationshipsControllerListParams"), exports);
116
118
  __exportStar(require("./removeResourceShareDto"), exports);
119
+ __exportStar(require("./replaceResourceOwnershipDto"), exports);
117
120
  __exportStar(require("./resourceManagedBy"), exports);
118
121
  __exportStar(require("./resourceOwnershipDto"), exports);
119
122
  __exportStar(require("./resourceOwnershipDtoDataEnvelope"), exports);
120
123
  __exportStar(require("./resourceOwnershipEntryDto"), exports);
121
124
  __exportStar(require("./resourceOwnershipReadDto"), exports);
122
125
  __exportStar(require("./resourceOwnershipReadDtoDataEnvelope"), exports);
126
+ __exportStar(require("./resourceShareRefDto"), exports);
123
127
  __exportStar(require("./resourceSubjectRefDto"), exports);
124
128
  __exportStar(require("./resourceVisibilityPattern"), exports);
125
129
  __exportStar(require("./roleAssignmentDto"), exports);
@@ -3,10 +3,10 @@
3
3
  * Authorization API
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
- import type { BiomeTrustTier } from './biomeTrustTier.js';
6
+ import type { BiomeExecutionTrustTier } from './biomeExecutionTrustTier.js';
7
7
  export interface PolicyBiomeDto {
8
8
  id: string;
9
9
  version: string;
10
- trustTier: BiomeTrustTier;
10
+ trustTier: BiomeExecutionTrustTier;
11
11
  signatureVerified: boolean;
12
12
  }
@@ -8,6 +8,7 @@ import type { PolicyActingForDto } from './policyActingForDto.js';
8
8
  import type { PolicyBiomeDto } from './policyBiomeDto.js';
9
9
  import type { PolicyCallerDto } from './policyCallerDto.js';
10
10
  import type { PolicyCapabilityDto } from './policyCapabilityDto.js';
11
+ import type { PolicyCheckRequestDtoAperture } from './policyCheckRequestDtoAperture.js';
11
12
  import type { PolicyConstraintsDto } from './policyConstraintsDto.js';
12
13
  import type { PolicyEnvironmentDto } from './policyEnvironmentDto.js';
13
14
  import type { PolicyResourceDto } from './policyResourceDto.js';
@@ -32,4 +33,6 @@ export interface PolicyCheckRequestDto {
32
33
  reachTier?: AgentReachTier;
33
34
  /** Role the acting subject holds in the originating agent session. Precedence `owner > editor > viewer`. Absent for non-session invocations (workflow steps, service calls). */
34
35
  participantRole?: SessionParticipantRole;
36
+ /** The acting agent's capability aperture (kernel `CapabilityAperture`): `{ kind: "unrestricted" }` or `{ kind: "armed", refs: string[] }`. Enforced at the capability-router funnel, carried here for the audit trail. */
37
+ aperture?: PolicyCheckRequestDtoAperture;
35
38
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Generated by @xemahq/api-client-generator — do not edit manually.
3
+ * Authorization API
4
+ * OpenAPI spec version: 0.1.1
5
+ */
6
+ /**
7
+ * The acting agent's capability aperture (kernel `CapabilityAperture`): `{ kind: "unrestricted" }` or `{ kind: "armed", refs: string[] }`. Enforced at the capability-router funnel, carried here for the audit trail.
8
+ */
9
+ export type PolicyCheckRequestDtoAperture = {
10
+ [key: string]: unknown;
11
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Generated by @xemahq/api-client-generator — do not edit manually.
4
+ * Authorization API
5
+ * OpenAPI spec version: 0.1.1
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,5 +7,6 @@ import type { DataClassification } from './dataClassification.js';
7
7
  export interface PolicyResourceDto {
8
8
  /** Canonical kernel resource-instance ref `resource:<type>:<id>` naming the instance this invocation targets. Build it with `composeResourceRef(type, id)` from `@xemahq/kernel-contracts/resource`. The server resolves it with `parseResourceRef` and answers `400 RESOURCE_REF_MALFORMED` for any other shape — a bare `<type>:<id>` and an `xema://…` path are BOTH rejected. Omit the whole `resource` block for a verb-only check; do not send a placeholder. */
9
9
  ref: string;
10
- classification: DataClassification;
10
+ /** The classification the target resource carries. OMIT IT when the producer has none to declare — the effective classification is then the Space floor alone, and the request still gets the resource-ownership clamp. Omitting the whole `resource` block is NOT the same thing: that downgrades the call to a verb-only check and discards the ownership clamp. Never send a placeholder value. */
11
+ classification?: DataClassification;
11
12
  }
@@ -3,6 +3,7 @@
3
3
  * Authorization API
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
+ import type { ResourceShareRefDto } from './resourceShareRefDto.js';
6
7
  import type { ResourceSubjectRefDto } from './resourceSubjectRefDto.js';
7
8
  import type { ResourceVisibilityPattern } from './resourceVisibilityPattern.js';
8
9
  export interface RegisterResourceOwnershipDto {
@@ -14,6 +15,6 @@ export interface RegisterResourceOwnershipDto {
14
15
  visibility: ResourceVisibilityPattern;
15
16
  /** Subjects that OWN the instance (full visibility). */
16
17
  owners: ResourceSubjectRefDto[];
17
- /** Subjects explicitly granted visibility (shared-with). */
18
- explicitShares?: ResourceSubjectRefDto[];
18
+ /** Subjects explicitly granted visibility, each at a LEVEL and with an optional expiry. */
19
+ explicitShares?: ResourceShareRefDto[];
19
20
  }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Generated by @xemahq/api-client-generator — do not edit manually.
3
+ * Authorization API
4
+ * OpenAPI spec version: 0.1.1
5
+ */
6
+ import type { ResourceShareRefDto } from './resourceShareRefDto.js';
7
+ import type { ResourceSubjectRefDto } from './resourceSubjectRefDto.js';
8
+ import type { ResourceVisibilityPattern } from './resourceVisibilityPattern.js';
9
+ export interface ReplaceResourceOwnershipDto {
10
+ /** Instance visibility pattern. The PDP ANDs the verb verdict with the ownership check resolved per this pattern. */
11
+ visibility: ResourceVisibilityPattern;
12
+ /** Subjects that OWN the instance (full visibility). */
13
+ owners: ResourceSubjectRefDto[];
14
+ /** Subjects explicitly granted visibility, each at a LEVEL and with an optional expiry. */
15
+ explicitShares?: ResourceShareRefDto[];
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,4 +8,10 @@ export interface ResourceOwnershipEntryDto {
8
8
  id: string;
9
9
  ownerKind: SubjectKind;
10
10
  ownerRef: string;
11
+ /** The level this share confers, in the resource kind's vocabulary. ABSENT on an owner row — ownership is not a rung. */
12
+ level?: string;
13
+ /** When the share stops granting. Absent = never. */
14
+ expiresAt?: string;
15
+ /** `<subjectKind>:<subjectRef>` of whoever granted this share. Absent on an owner row. */
16
+ grantedBy?: string;
11
17
  }
@@ -3,12 +3,14 @@
3
3
  * Authorization API
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
- import type { ResourceSubjectRefDto } from './resourceSubjectRefDto.js';
6
+ import type { ResourceOwnershipEntryDto } from './resourceOwnershipEntryDto.js';
7
7
  import type { ResourceVisibilityPattern } from './resourceVisibilityPattern.js';
8
8
  export interface ResourceOwnershipReadDto {
9
9
  resourceType: string;
10
10
  resourceId: string;
11
11
  visibility: ResourceVisibilityPattern;
12
- /** All registered subjects (owners + shares combined; the SQL authority does not split the two). */
13
- subjects: ResourceSubjectRefDto[];
12
+ /** Subjects that OWN the instance. */
13
+ owners: ResourceOwnershipEntryDto[];
14
+ /** Subjects the instance is SHARED with, each with its level, expiry and grantor. */
15
+ shares: ResourceOwnershipEntryDto[];
14
16
  }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generated by @xemahq/api-client-generator — do not edit manually.
3
+ * Authorization API
4
+ * OpenAPI spec version: 0.1.1
5
+ */
6
+ import type { SubjectKind } from './subjectKind.js';
7
+ export interface ResourceShareRefDto {
8
+ kind: SubjectKind;
9
+ /** Subject id (the `<id>` in `<kind>:<id>`). */
10
+ ref: string;
11
+ /** The resource kind's own name for the level this share confers. Levels are declared per kind (a document has `viewer < editor < manager`; a mailbox's `editor` is not a meaningful authority) and are totally ordered with monotone verb expansion. OMITTED means the LOWEST level the kind declares — never the highest. */
12
+ level?: string;
13
+ /** ISO-8601 instant after which the share stops granting. Enforced by an OpenFGA condition evaluated at DECISION time, not by a sweeper — a sweeper leaves a window in which a lapsed share still passes. Omitted means the share does not expire. An instant in the past is a 400. */
14
+ expiresAt?: string;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,7 +8,6 @@ export interface RoleGrantDto {
8
8
  id: string;
9
9
  roleId: string;
10
10
  capability: string;
11
- resourceGlob: string;
12
11
  environment: string;
13
12
  constraints?: GrantConstraintsDto | null;
14
13
  requiresApproval: boolean;
@@ -3,6 +3,7 @@
3
3
  * Authorization API
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
+ import type { DataClassification } from './dataClassification.js';
6
7
  import type { UpdateExecutionEnvironmentDtoAllowedCapabilitiesItem } from './updateExecutionEnvironmentDtoAllowedCapabilitiesItem.js';
7
8
  import type { UpdateExecutionEnvironmentDtoApprovalRulesItem } from './updateExecutionEnvironmentDtoApprovalRulesItem.js';
8
9
  import type { UpdateExecutionEnvironmentDtoRuntimeLimits } from './updateExecutionEnvironmentDtoRuntimeLimits.js';
@@ -14,4 +15,6 @@ export interface UpdateExecutionEnvironmentDto {
14
15
  approvalRules?: UpdateExecutionEnvironmentDtoApprovalRulesItem[];
15
16
  /** Runtime limits (`RuntimeLimits`). */
16
17
  runtimeLimits?: UpdateExecutionEnvironmentDtoRuntimeLimits;
18
+ /** The environment's DATA ceiling: the most restrictive `DataClassification` an invocation may carry and still run here. The PDP compares it against `join(space floor, resource tag)` and DENIES when it is exceeded. `regulated` (the top of the rank) admits everything and is the default, so the ceiling refuses nothing until it is lowered. Lowering it is what ARMS the control for this environment. */
19
+ maxDataClassification?: DataClassification;
17
20
  }
@@ -6,7 +6,6 @@
6
6
  import type { BiomePermissionProfile } from './biomePermissionProfile.js';
7
7
  import type { GrantConstraintsDto } from './grantConstraintsDto.js';
8
8
  export interface UpdateGrantDto {
9
- resourceGlob?: string;
10
9
  environment?: string;
11
10
  constraints?: GrantConstraintsDto;
12
11
  requiresApproval?: boolean;
@@ -8,6 +8,8 @@ export interface UpsertCredentialDefaultDto {
8
8
  orgId: string;
9
9
  /** Project identifier. Omit (or null) for the ORG-wide default; set for a per-project default. */
10
10
  projectId?: string;
11
+ /** The EXTERNAL PROVIDER this default is for — `github`, `slack`, an MCP server's provider slug. A default is per (scope, provider): without it an organisation would have one default binding for every provider at once. Must be a value a capability ref can derive (lowercase kebab), because the ladder looks it up by exactly that derivation. */
12
+ provider: string;
11
13
  /** Opaque credential-binding pointer the gateway resolves the external credential from. Not a secret. */
12
14
  credentialBindingId: string;
13
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/authorization-internal-api-client",
3
- "version": "0.3.4",
3
+ "version": "0.4.3",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -19,7 +19,7 @@
19
19
  "service": "authorization-api",
20
20
  "biome": "authorization",
21
21
  "target": "server",
22
- "generator": "@xemahq/api-client-generator@0.12.1",
22
+ "generator": "@xemahq/api-client-generator@0.14.1",
23
23
  "source": "openapi.internal.json"
24
24
  },
25
25
  "license": "LicenseRef-Xema-BSL-1.1",