@xemahq/authorization-internal-api-client 0.4.20 → 0.4.27

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 (110) hide show
  1. package/dist/custom-fetch.js +56 -4
  2. package/dist/endpoints/agents/agents.d.ts +7 -1
  3. package/dist/endpoints/agents/agents.js +18 -1
  4. package/dist/endpoints/capability-authority-requests/capability-authority-requests.d.ts +24 -0
  5. package/dist/endpoints/capability-authority-requests/capability-authority-requests.js +89 -0
  6. package/dist/endpoints/roles/roles.d.ts +1 -6
  7. package/dist/endpoints/roles/roles.js +1 -17
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +1 -0
  10. package/dist/models/addRoleGrantDto.d.ts +8 -2
  11. package/dist/models/addTeamMemberDto.d.ts +1 -0
  12. package/dist/models/agentReachTier.d.ts +1 -1
  13. package/dist/models/assignRoleDto.d.ts +9 -2
  14. package/dist/models/authorizationCheckRequestDto.d.ts +24 -6
  15. package/dist/models/authorizationReasonDto.d.ts +1 -0
  16. package/dist/models/authorizationSuggestionDto.d.ts +11 -2
  17. package/dist/models/capabilityAuthorityRequestDto.d.ts +29 -0
  18. package/dist/models/capabilityAuthorityRequestDtoDataArrayEnvelope.d.ts +9 -0
  19. package/dist/models/capabilityAuthorityRequestDtoDataEnvelope.d.ts +9 -0
  20. package/dist/models/capabilityAuthorityRequestDtoDisposition.d.ts +14 -0
  21. package/dist/models/capabilityAuthorityRequestDtoDisposition.js +13 -0
  22. package/dist/models/capabilityAuthorityRequestDtoOutcome.d.ts +16 -0
  23. package/dist/models/capabilityAuthorityRequestDtoOutcome.js +15 -0
  24. package/dist/models/capabilityAuthorityRequestDtoRefusal.d.ts +14 -0
  25. package/dist/models/capabilityAuthorityRequestDtoRefusal.js +13 -0
  26. package/dist/models/{errorDetailsDtoDetails.d.ts → capabilityAuthorityRequestsControllerGetByIdParams.d.ts} +3 -6
  27. package/dist/models/capabilityAuthorityRequestsControllerListForSubjectParams.d.ts +10 -0
  28. package/dist/models/createExecutionEnvironmentDto.d.ts +9 -2
  29. package/dist/models/createGrantDto.d.ts +17 -4
  30. package/dist/models/createRoleDto.d.ts +3 -0
  31. package/dist/models/createTeamDto.d.ts +10 -2
  32. package/dist/models/environmentCeilingSource.d.ts +1 -1
  33. package/dist/models/environmentsControllerFindBySlugParams.d.ts +1 -0
  34. package/dist/models/environmentsControllerListParams.d.ts +1 -0
  35. package/dist/models/environmentsControllerRemoveParams.d.ts +1 -0
  36. package/dist/models/environmentsControllerUpdateParams.d.ts +1 -0
  37. package/dist/models/exactResourceAuthorityDto.d.ts +8 -2
  38. package/dist/models/exactResourceBindingDto.d.ts +8 -2
  39. package/dist/models/executionEnvironmentResponseDto.d.ts +1 -1
  40. package/dist/models/grantConstraintsDto.d.ts +6 -1
  41. package/dist/models/grantsControllerListParams.d.ts +10 -0
  42. package/dist/models/index.d.ts +15 -8
  43. package/dist/models/index.js +15 -8
  44. package/dist/models/listRegisteredResourcesDto.d.ts +4 -1
  45. package/dist/models/listVisibleResourcesDto.d.ts +8 -2
  46. package/dist/models/openCapabilityAuthorityRequestDto.d.ts +35 -0
  47. package/dist/models/openCapabilityAuthorityRequestDtoSubjectKind.d.ts +21 -0
  48. package/dist/models/openCapabilityAuthorityRequestDtoSubjectKind.js +20 -0
  49. package/dist/models/outputRouteAuthorityDto.d.ts +10 -2
  50. package/dist/models/outputRouteRevisionDto.d.ts +10 -2
  51. package/dist/models/policyActingAgentDto.d.ts +14 -0
  52. package/dist/models/policyActingAgentDtoKind.d.ts +9 -0
  53. package/dist/models/{orgRole.js → policyActingAgentDtoKind.js} +3 -5
  54. package/dist/models/policyActingForDto.d.ts +8 -0
  55. package/dist/models/policyBiomeDto.d.ts +2 -0
  56. package/dist/models/policyCallerDto.d.ts +4 -0
  57. package/dist/models/policyCapabilityDto.d.ts +5 -1
  58. package/dist/models/policyCheckRequestDto.d.ts +53 -3
  59. package/dist/models/policyDecisionDto.d.ts +8 -2
  60. package/dist/models/policyEnvironmentDto.d.ts +4 -1
  61. package/dist/models/policyObligationDto.d.ts +9 -2
  62. package/dist/models/policyResourceDto.d.ts +4 -1
  63. package/dist/models/policyRouteHintDto.d.ts +1 -0
  64. package/dist/models/policySpaceRefDto.d.ts +7 -0
  65. package/dist/models/policySubjectRefDto.d.ts +1 -0
  66. package/dist/models/previewOutputRouteImpactDto.d.ts +1 -0
  67. package/dist/models/problemDetailsDto.d.ts +28 -0
  68. package/dist/models/problemDetailsDto.js +2 -0
  69. package/dist/models/problemFieldIssueDto.d.ts +10 -0
  70. package/dist/models/problemFieldIssueDto.js +7 -0
  71. package/dist/models/provisionAgentRequestDto.d.ts +12 -3
  72. package/dist/models/provisionedCapabilityDto.d.ts +4 -1
  73. package/dist/models/recordAgentReachTierRequestDto.d.ts +21 -0
  74. package/dist/models/recordAgentReachTierRequestDto.js +2 -0
  75. package/dist/models/registerResourceOwnershipDto.d.ts +16 -4
  76. package/dist/models/registerResourceRevisionDto.d.ts +16 -4
  77. package/dist/models/registeredResourceRevisionDto.d.ts +8 -2
  78. package/dist/models/relationshipsControllerListParams.d.ts +4 -0
  79. package/dist/models/replaceResourceOwnershipDto.d.ts +8 -2
  80. package/dist/models/requestOutputRouteRetirementDto.d.ts +4 -1
  81. package/dist/models/requestOutputRouteRevisionReleaseDto.d.ts +14 -3
  82. package/dist/models/requestOutputRouteRollbackDto.d.ts +5 -1
  83. package/dist/models/resolveExactOutputRouteDto.d.ts +1 -0
  84. package/dist/models/resolveOutputRouteChannelDto.d.ts +1 -0
  85. package/dist/models/resourceShareRefDto.d.ts +8 -2
  86. package/dist/models/resourceSubjectRefDto.d.ts +4 -1
  87. package/dist/models/rolesControllerListParams.d.ts +3 -0
  88. package/dist/models/rollbackExecutionEnvironmentDto.d.ts +5 -2
  89. package/dist/models/subjectRefDto.d.ts +4 -1
  90. package/dist/models/teamsControllerListParams.d.ts +2 -0
  91. package/dist/models/updateExecutionEnvironmentDto.d.ts +1 -0
  92. package/dist/models/updateGrantDto.d.ts +5 -1
  93. package/dist/models/updateRoleDto.d.ts +1 -0
  94. package/dist/models/updateTeamDto.d.ts +1 -0
  95. package/dist/models/upsertCredentialDefaultDto.d.ts +16 -4
  96. package/package.json +26 -2
  97. package/dist/models/errorDetailsDto.d.ts +0 -10
  98. package/dist/models/errorPayloadDto.d.ts +0 -11
  99. package/dist/models/errorResponseDto.d.ts +0 -9
  100. package/dist/models/orgRole.d.ts +0 -14
  101. package/dist/models/orgRoleSyncDto.d.ts +0 -16
  102. package/dist/models/orgRoleSyncResultDto.d.ts +0 -9
  103. package/dist/models/orgRoleSyncResultDtoDataEnvelope.d.ts +0 -9
  104. /package/dist/models/{errorDetailsDto.js → capabilityAuthorityRequestDto.js} +0 -0
  105. /package/dist/models/{errorPayloadDto.js → capabilityAuthorityRequestDtoDataArrayEnvelope.js} +0 -0
  106. /package/dist/models/{errorResponseDto.js → capabilityAuthorityRequestDtoDataEnvelope.js} +0 -0
  107. /package/dist/models/{errorDetailsDtoDetails.js → capabilityAuthorityRequestsControllerGetByIdParams.js} +0 -0
  108. /package/dist/models/{orgRoleSyncResultDto.js → capabilityAuthorityRequestsControllerListForSubjectParams.js} +0 -0
  109. /package/dist/models/{orgRoleSyncDto.js → openCapabilityAuthorityRequestDto.js} +0 -0
  110. /package/dist/models/{orgRoleSyncResultDtoDataEnvelope.js → policyActingAgentDto.js} +0 -0
@@ -223,14 +223,66 @@ const customFetch = async (url, options) => {
223
223
  }
224
224
  };
225
225
  exports.customFetch = customFetch;
226
- async function parseBody(response) {
227
- const contentType = response.headers.get('content-type');
228
- if (contentType?.includes('application/json')) {
229
- return response.json();
226
+ /**
227
+ * Does this media type carry JSON?
228
+ *
229
+ * ── THE OUTAGE THIS FIXES ────────────────────────────────────────────────
230
+ *
231
+ * This used to be `contentType?.includes('application/json')`, and EVERY error
232
+ * this fleet returns failed that test. The platform's `GlobalExceptionFilter`
233
+ * emits RFC 9457 problem documents and sets the media type explicitly —
234
+ * `.type(PROBLEM_DETAILS_CONTENT_TYPE)` before `.json()`, so it cannot be
235
+ * overridden — and that constant is `application/problem+json`, which does NOT
236
+ * contain the substring `application/json`: after `application/` comes
237
+ * `problem+json`.
238
+ *
239
+ * So every non-2xx body fell through to `response.text()` and reached the
240
+ * caller as an UNPARSED STRING. `ClientError.body` is typed `unknown`, so
241
+ * nothing complained; every consumer that reads a machine-readable code off an
242
+ * error — `error.body.code`, `error.body.details.code` — silently read
243
+ * `undefined` instead, for every error, in every service.
244
+ *
245
+ * Measured in production on 2026-09-15: skill-registry-api's
246
+ * `resolveOrNull()` absorbs `RELEASE_CHANNEL_NOT_FOUND` into `null` by exactly
247
+ * that read. With the code unreadable the absorb never fired, a routine "no
248
+ * pointer on this channel" 404 became a 500 on `GET /skills` and
249
+ * `GET /describe-objects`, and agent-session-api's `apply_control_bundle` step
250
+ * aborted EVERY session launch in the organisation — 7,871 failed resolutions
251
+ * an hour. A fix written for that exact page months earlier was present in the
252
+ * running image and could not help, because the classifier it repaired was
253
+ * being handed a string.
254
+ *
255
+ * ── WHY THE STRUCTURED SUFFIX, NOT A SECOND SUBSTRING ────────────────────
256
+ *
257
+ * Adding `|| includes('application/problem+json')` would fix this one media
258
+ * type and leave the next one — `application/vnd.api+json`, and anything else
259
+ * a service legitimately emits. RFC 6839 defines `+json` as the structured
260
+ * syntax suffix meaning "this is JSON"; that is the actual rule, so it is the
261
+ * rule implemented. Parameters are stripped first, because
262
+ * `application/problem+json; charset=utf-8` is the same media type.
263
+ */
264
+ function isJsonMediaType(contentType) {
265
+ if (contentType === null) {
266
+ return false;
230
267
  }
268
+ const essence = contentType.split(';')[0]?.trim().toLowerCase() ?? '';
269
+ return essence === 'application/json' || essence.endsWith('+json');
270
+ }
271
+ async function parseBody(response) {
272
+ // 204 FIRST, and deliberately — this ORDER is carried from `develop`, which
273
+ // fixed the same defect independently and got this half right where `main`
274
+ // did not. A 204 carries no body, so `response.json()` on one throws
275
+ // SyntaxError; and a 204 whose headers STILL declare a JSON content type is
276
+ // ordinary, because the framework sets the header before the handler returns
277
+ // nothing. With the JSON branch first, a documented `undefined` becomes a
278
+ // thrown parse error. Pinned by a case in `transport-problem-json.test.cjs`.
231
279
  if (response.status === 204) {
232
280
  return undefined;
233
281
  }
282
+ const contentType = response.headers.get('content-type');
283
+ if (isJsonMediaType(contentType)) {
284
+ return response.json();
285
+ }
234
286
  return response.text();
235
287
  }
236
288
  function parseRetryAfter(value) {
@@ -3,7 +3,13 @@
3
3
  * Authorization API
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
- import type { ProvisionAgentRequestDto, ProvisionAgentResultDtoDataEnvelope } from '../../models';
6
+ import type { ProvisionAgentRequestDto, ProvisionAgentResultDtoDataEnvelope, RecordAgentReachTierRequestDto } from '../../models';
7
+ export declare const getAgentsControllerRecordReachTierUrl: () => string;
8
+ /**
9
+ * Projects `(orgId, agentSlug) -> reachTier` into this service's own store, which is what the verdict path resolves an agent ceiling from. A `null` `orgId` declares a GLOBALLY-owned agent (system-seeded or biome-contributed) and is stored slug-keyed, applying in every org; an org row always wins over it. An OMITTED `orgId` is a 400, never read as global. Idempotent (upsert on the key), so a re-save, a retry and a concurrent save from another replica all converge. Writes NO grant — that is `POST /agents/provision`, and keeping the two apart is the point: a ceiling is a restriction, a grant is an authority, and fusing them put the restriction behind the grant feature flag.
10
+ * @summary Record an agent's DECLARED reach-tier ceiling
11
+ */
12
+ export declare const agentsControllerRecordReachTier: (recordAgentReachTierRequestDto: RecordAgentReachTierRequestDto, options?: RequestInit) => Promise<void>;
7
13
  export declare const getAgentsControllerProvisionUrl: () => string;
8
14
  /**
9
15
  * Auto-grants low/medium-risk, owner-held, non-approval-gated capabilities as full grants; writes everything else as approval-gated grants. Idempotent (each grant upserts on its natural tuple). Returns a summary for the Studio review UI.
@@ -1,7 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.agentsControllerProvision = exports.getAgentsControllerProvisionUrl = void 0;
3
+ exports.agentsControllerProvision = exports.getAgentsControllerProvisionUrl = exports.agentsControllerRecordReachTier = exports.getAgentsControllerRecordReachTierUrl = void 0;
4
4
  const custom_fetch_1 = require("../../custom-fetch");
5
+ const getAgentsControllerRecordReachTierUrl = () => {
6
+ return `/agents/reach-tier`;
7
+ };
8
+ exports.getAgentsControllerRecordReachTierUrl = getAgentsControllerRecordReachTierUrl;
9
+ /**
10
+ * Projects `(orgId, agentSlug) -> reachTier` into this service's own store, which is what the verdict path resolves an agent ceiling from. A `null` `orgId` declares a GLOBALLY-owned agent (system-seeded or biome-contributed) and is stored slug-keyed, applying in every org; an org row always wins over it. An OMITTED `orgId` is a 400, never read as global. Idempotent (upsert on the key), so a re-save, a retry and a concurrent save from another replica all converge. Writes NO grant — that is `POST /agents/provision`, and keeping the two apart is the point: a ceiling is a restriction, a grant is an authority, and fusing them put the restriction behind the grant feature flag.
11
+ * @summary Record an agent's DECLARED reach-tier ceiling
12
+ */
13
+ const agentsControllerRecordReachTier = async (recordAgentReachTierRequestDto, options) => {
14
+ return (0, custom_fetch_1.customFetch)((0, exports.getAgentsControllerRecordReachTierUrl)(), {
15
+ ...options,
16
+ method: 'PUT',
17
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
18
+ body: JSON.stringify(recordAgentReachTierRequestDto)
19
+ });
20
+ };
21
+ exports.agentsControllerRecordReachTier = agentsControllerRecordReachTier;
5
22
  const getAgentsControllerProvisionUrl = () => {
6
23
  return `/agents/provision`;
7
24
  };
@@ -0,0 +1,24 @@
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 { CapabilityAuthorityRequestDtoDataArrayEnvelope, CapabilityAuthorityRequestDtoDataEnvelope, CapabilityAuthorityRequestsControllerGetByIdParams, CapabilityAuthorityRequestsControllerListForSubjectParams, OpenCapabilityAuthorityRequestDto } from '../../models';
7
+ export declare const getCapabilityAuthorityRequestsControllerOpenUrl: () => string;
8
+ /**
9
+ * The organisation policy answers immediately with one of three dispositions. `auto-allow` means the grant already exists by the time this returns and the runtime may retry its invocation. `decision-required` means a human has been asked and the runtime must poll or wait — it is NOT a denial. `refuse` is terminal and carries a machine-readable reason. A request for a capability the subject already holds is a 409 rather than a silent no-op, and a second live request for the same capability is a 409 rather than a second question in front of an administrator.
10
+ * @summary Request capability authority for an App or agent
11
+ */
12
+ export declare const capabilityAuthorityRequestsControllerOpen: (openCapabilityAuthorityRequestDto: OpenCapabilityAuthorityRequestDto, options?: RequestInit) => Promise<CapabilityAuthorityRequestDtoDataEnvelope>;
13
+ export declare const getCapabilityAuthorityRequestsControllerListForSubjectUrl: (params: CapabilityAuthorityRequestsControllerListForSubjectParams) => string;
14
+ /**
15
+ * The list a runtime reads to learn what happened to an ask it opened. Deliberately keyed on the SUBJECT rather than on the caller: the runtime relaying the request is not the subject of it, and a "requests I made" list would answer for the service instead of for the App.
16
+ * @summary One subject's own authority requests
17
+ */
18
+ export declare const capabilityAuthorityRequestsControllerListForSubject: (params: CapabilityAuthorityRequestsControllerListForSubjectParams, options?: RequestInit) => Promise<CapabilityAuthorityRequestDtoDataArrayEnvelope>;
19
+ export declare const getCapabilityAuthorityRequestsControllerGetByIdUrl: (id: string, params: CapabilityAuthorityRequestsControllerGetByIdParams) => string;
20
+ /**
21
+ * The live status of an ask. Read from THIS plane's row; the decision's own lifecycle is decision-api's to report, and this service does not mirror it — a settled ask cannot show as pending here because the row is written by the same handler that acts on the answer.
22
+ * @summary One authority request
23
+ */
24
+ export declare const capabilityAuthorityRequestsControllerGetById: (id: string, params: CapabilityAuthorityRequestsControllerGetByIdParams, options?: RequestInit) => Promise<CapabilityAuthorityRequestDtoDataEnvelope>;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.capabilityAuthorityRequestsControllerGetById = exports.getCapabilityAuthorityRequestsControllerGetByIdUrl = exports.capabilityAuthorityRequestsControllerListForSubject = exports.getCapabilityAuthorityRequestsControllerListForSubjectUrl = exports.capabilityAuthorityRequestsControllerOpen = exports.getCapabilityAuthorityRequestsControllerOpenUrl = void 0;
4
+ const custom_fetch_1 = require("../../custom-fetch");
5
+ const getCapabilityAuthorityRequestsControllerOpenUrl = () => {
6
+ return `/internal/capability-authority-requests`;
7
+ };
8
+ exports.getCapabilityAuthorityRequestsControllerOpenUrl = getCapabilityAuthorityRequestsControllerOpenUrl;
9
+ /**
10
+ * The organisation policy answers immediately with one of three dispositions. `auto-allow` means the grant already exists by the time this returns and the runtime may retry its invocation. `decision-required` means a human has been asked and the runtime must poll or wait — it is NOT a denial. `refuse` is terminal and carries a machine-readable reason. A request for a capability the subject already holds is a 409 rather than a silent no-op, and a second live request for the same capability is a 409 rather than a second question in front of an administrator.
11
+ * @summary Request capability authority for an App or agent
12
+ */
13
+ const capabilityAuthorityRequestsControllerOpen = async (openCapabilityAuthorityRequestDto, options) => {
14
+ return (0, custom_fetch_1.customFetch)((0, exports.getCapabilityAuthorityRequestsControllerOpenUrl)(), {
15
+ ...options,
16
+ method: 'POST',
17
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
18
+ body: JSON.stringify(openCapabilityAuthorityRequestDto)
19
+ });
20
+ };
21
+ exports.capabilityAuthorityRequestsControllerOpen = capabilityAuthorityRequestsControllerOpen;
22
+ const getCapabilityAuthorityRequestsControllerListForSubjectUrl = (params) => {
23
+ const normalizedParams = new URLSearchParams();
24
+ Object.entries(params || {}).forEach(([key, value]) => {
25
+ if (value === undefined)
26
+ return;
27
+ if (value === null) {
28
+ normalizedParams.append(key, 'null');
29
+ return;
30
+ }
31
+ if (Array.isArray(value)) {
32
+ for (const item of value) {
33
+ if (item === undefined || item === null)
34
+ continue;
35
+ normalizedParams.append(key, item.toString());
36
+ }
37
+ return;
38
+ }
39
+ normalizedParams.append(key, value.toString());
40
+ });
41
+ const stringifiedParams = normalizedParams.toString();
42
+ return stringifiedParams.length > 0 ? `/internal/capability-authority-requests?${stringifiedParams}` : `/internal/capability-authority-requests`;
43
+ };
44
+ exports.getCapabilityAuthorityRequestsControllerListForSubjectUrl = getCapabilityAuthorityRequestsControllerListForSubjectUrl;
45
+ /**
46
+ * The list a runtime reads to learn what happened to an ask it opened. Deliberately keyed on the SUBJECT rather than on the caller: the runtime relaying the request is not the subject of it, and a "requests I made" list would answer for the service instead of for the App.
47
+ * @summary One subject's own authority requests
48
+ */
49
+ const capabilityAuthorityRequestsControllerListForSubject = async (params, options) => {
50
+ return (0, custom_fetch_1.customFetch)((0, exports.getCapabilityAuthorityRequestsControllerListForSubjectUrl)(params), {
51
+ ...options,
52
+ method: 'GET'
53
+ });
54
+ };
55
+ exports.capabilityAuthorityRequestsControllerListForSubject = capabilityAuthorityRequestsControllerListForSubject;
56
+ const getCapabilityAuthorityRequestsControllerGetByIdUrl = (id, params) => {
57
+ const normalizedParams = new URLSearchParams();
58
+ Object.entries(params || {}).forEach(([key, value]) => {
59
+ if (value === undefined)
60
+ return;
61
+ if (value === null) {
62
+ normalizedParams.append(key, 'null');
63
+ return;
64
+ }
65
+ if (Array.isArray(value)) {
66
+ for (const item of value) {
67
+ if (item === undefined || item === null)
68
+ continue;
69
+ normalizedParams.append(key, item.toString());
70
+ }
71
+ return;
72
+ }
73
+ normalizedParams.append(key, value.toString());
74
+ });
75
+ const stringifiedParams = normalizedParams.toString();
76
+ return stringifiedParams.length > 0 ? `/internal/capability-authority-requests/${id}?${stringifiedParams}` : `/internal/capability-authority-requests/${id}`;
77
+ };
78
+ exports.getCapabilityAuthorityRequestsControllerGetByIdUrl = getCapabilityAuthorityRequestsControllerGetByIdUrl;
79
+ /**
80
+ * The live status of an ask. Read from THIS plane's row; the decision's own lifecycle is decision-api's to report, and this service does not mirror it — a settled ask cannot show as pending here because the row is written by the same handler that acts on the answer.
81
+ * @summary One authority request
82
+ */
83
+ const capabilityAuthorityRequestsControllerGetById = async (id, params, options) => {
84
+ return (0, custom_fetch_1.customFetch)((0, exports.getCapabilityAuthorityRequestsControllerGetByIdUrl)(id, params), {
85
+ ...options,
86
+ method: 'GET'
87
+ });
88
+ };
89
+ exports.capabilityAuthorityRequestsControllerGetById = capabilityAuthorityRequestsControllerGetById;
@@ -3,7 +3,7 @@
3
3
  * Authorization API
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
- import type { AddRoleGrantDto, AssignRoleDto, CreateRoleDto, OrgRoleSyncDto, OrgRoleSyncResultDtoDataEnvelope, RoleAssignmentDtoDataArrayEnvelope, RoleAssignmentDtoDataEnvelope, RoleDtoDataArrayEnvelope, RoleDtoDataEnvelope, RoleGrantDtoDataArrayEnvelope, RoleGrantDtoDataEnvelope, RolesControllerListParams, UpdateRoleDto } from '../../models';
6
+ import type { AddRoleGrantDto, AssignRoleDto, CreateRoleDto, RoleAssignmentDtoDataArrayEnvelope, RoleAssignmentDtoDataEnvelope, RoleDtoDataArrayEnvelope, RoleDtoDataEnvelope, RoleGrantDtoDataArrayEnvelope, RoleGrantDtoDataEnvelope, RolesControllerListParams, UpdateRoleDto } from '../../models';
7
7
  export declare const getRolesControllerCreateUrl: () => string;
8
8
  /**
9
9
  * @summary Create a custom role
@@ -59,8 +59,3 @@ export declare const getRolesControllerUnassignUrl: (id: string, assignmentId: s
59
59
  * @summary Remove a role assignment
60
60
  */
61
61
  export declare const rolesControllerUnassign: (id: string, assignmentId: string, options?: RequestInit) => Promise<void>;
62
- export declare const getOrgRoleSyncControllerSyncUrl: () => string;
63
- /**
64
- * @summary Ensure a subject holds the given org role, correctly org-scoped (idempotent).
65
- */
66
- export declare const orgRoleSyncControllerSync: (orgRoleSyncDto: OrgRoleSyncDto, options?: RequestInit) => Promise<OrgRoleSyncResultDtoDataEnvelope>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.orgRoleSyncControllerSync = exports.getOrgRoleSyncControllerSyncUrl = exports.rolesControllerUnassign = exports.getRolesControllerUnassignUrl = exports.rolesControllerAssign = exports.getRolesControllerAssignUrl = exports.rolesControllerListAssignments = exports.getRolesControllerListAssignmentsUrl = exports.rolesControllerRemoveGrant = exports.getRolesControllerRemoveGrantUrl = exports.rolesControllerAddGrant = exports.getRolesControllerAddGrantUrl = exports.rolesControllerListGrants = exports.getRolesControllerListGrantsUrl = exports.rolesControllerDelete = exports.getRolesControllerDeleteUrl = exports.rolesControllerUpdate = exports.getRolesControllerUpdateUrl = exports.rolesControllerGetById = exports.getRolesControllerGetByIdUrl = exports.rolesControllerList = exports.getRolesControllerListUrl = exports.rolesControllerCreate = exports.getRolesControllerCreateUrl = void 0;
3
+ exports.rolesControllerUnassign = exports.getRolesControllerUnassignUrl = exports.rolesControllerAssign = exports.getRolesControllerAssignUrl = exports.rolesControllerListAssignments = exports.getRolesControllerListAssignmentsUrl = exports.rolesControllerRemoveGrant = exports.getRolesControllerRemoveGrantUrl = exports.rolesControllerAddGrant = exports.getRolesControllerAddGrantUrl = exports.rolesControllerListGrants = exports.getRolesControllerListGrantsUrl = exports.rolesControllerDelete = exports.getRolesControllerDeleteUrl = exports.rolesControllerUpdate = exports.getRolesControllerUpdateUrl = exports.rolesControllerGetById = exports.getRolesControllerGetByIdUrl = exports.rolesControllerList = exports.getRolesControllerListUrl = exports.rolesControllerCreate = exports.getRolesControllerCreateUrl = void 0;
4
4
  const custom_fetch_1 = require("../../custom-fetch");
5
5
  const getRolesControllerCreateUrl = () => {
6
6
  return `/roles`;
@@ -183,19 +183,3 @@ const rolesControllerUnassign = async (id, assignmentId, options) => {
183
183
  });
184
184
  };
185
185
  exports.rolesControllerUnassign = rolesControllerUnassign;
186
- const getOrgRoleSyncControllerSyncUrl = () => {
187
- return `/internal/org-role-sync`;
188
- };
189
- exports.getOrgRoleSyncControllerSyncUrl = getOrgRoleSyncControllerSyncUrl;
190
- /**
191
- * @summary Ensure a subject holds the given org role, correctly org-scoped (idempotent).
192
- */
193
- const orgRoleSyncControllerSync = async (orgRoleSyncDto, options) => {
194
- return (0, custom_fetch_1.customFetch)((0, exports.getOrgRoleSyncControllerSyncUrl)(), {
195
- ...options,
196
- method: 'POST',
197
- headers: { 'Content-Type': 'application/json', ...options?.headers },
198
- body: JSON.stringify(orgRoleSyncDto)
199
- });
200
- };
201
- exports.orgRoleSyncControllerSync = orgRoleSyncControllerSync;
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { configureClient, getClientConfig, ClientError, customFetch, type Client
2
2
  export * from './models';
3
3
  export * from './endpoints/agents/agents';
4
4
  export * from './endpoints/authorization/authorization';
5
+ export * from './endpoints/capability-authority-requests/capability-authority-requests';
5
6
  export * from './endpoints/contribution-sync/contribution-sync';
6
7
  export * from './endpoints/credential-defaults/credential-defaults';
7
8
  export * from './endpoints/describe-objects/describe-objects';
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "customFetch", { enumerable: true, get: function
24
24
  __exportStar(require("./models"), exports);
25
25
  __exportStar(require("./endpoints/agents/agents"), exports);
26
26
  __exportStar(require("./endpoints/authorization/authorization"), exports);
27
+ __exportStar(require("./endpoints/capability-authority-requests/capability-authority-requests"), exports);
27
28
  __exportStar(require("./endpoints/contribution-sync/contribution-sync"), exports);
28
29
  __exportStar(require("./endpoints/credential-defaults/credential-defaults"), exports);
29
30
  __exportStar(require("./endpoints/describe-objects/describe-objects"), exports);
@@ -5,9 +5,15 @@
5
5
  */
6
6
  import type { GrantConstraintsDto } from './grantConstraintsDto.js';
7
7
  export interface AddRoleGrantDto {
8
- /** Canonical CapabilityRef from `@xemahq/kernel-contracts/capability`. */
8
+ /**
9
+ * Canonical CapabilityRef from `@xemahq/kernel-contracts/capability`.
10
+ * @minLength 1
11
+ */
9
12
  capability: string;
10
- /** Built-in environment slug. */
13
+ /**
14
+ * Built-in environment slug.
15
+ * @minLength 1
16
+ */
11
17
  environment: string;
12
18
  constraints?: GrantConstraintsDto;
13
19
  requiresApproval?: boolean;
@@ -6,5 +6,6 @@
6
6
  import type { SubjectKind } from './subjectKind.js';
7
7
  export interface AddTeamMemberDto {
8
8
  subjectKind: SubjectKind;
9
+ /** @minLength 1 */
9
10
  subjectRef: string;
10
11
  }
@@ -4,7 +4,7 @@
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
6
  /**
7
- * The agent's permission CEILING — ordered supersets `sandbox ⊂ as-owner ⊂ connected ⊂ full`. Intersected with the agent's armed tools and its owner's authority at resolution, so it can only RESTRICT, never amplify. Absent ⇒ `as-owner`.
7
+ * The agent's permission CEILING — ordered supersets `sandbox ⊂ as-owner ⊂ connected ⊂ full`. Intersected with the agent's armed tools and its owner's authority at resolution, so it can only RESTRICT, never amplify.
8
8
  */
9
9
  export type AgentReachTier = typeof AgentReachTier[keyof typeof AgentReachTier];
10
10
  export declare const AgentReachTier: {
@@ -5,10 +5,17 @@
5
5
  */
6
6
  import type { SubjectKind } from './subjectKind.js';
7
7
  export interface AssignRoleDto {
8
- /** The org this assignment is scoped to. For a custom role it must equal the role’s org; for a built-in role (system sentinel) it is the real consuming org. */
8
+ /**
9
+ * The org this assignment is scoped to. For a custom role it must equal the role’s org; for a built-in role (system sentinel) it is the real consuming org.
10
+ * @minLength 1
11
+ */
9
12
  orgId: string;
10
13
  subjectKind?: SubjectKind;
14
+ /** @minLength 1 */
11
15
  subjectRef?: string;
12
- /** Assign the role to every member of this team. */
16
+ /**
17
+ * Assign the role to every member of this team.
18
+ * @minLength 1
19
+ */
13
20
  teamId?: string;
14
21
  }
@@ -5,17 +5,35 @@
5
5
  */
6
6
  import type { SubjectRefDto } from './subjectRefDto.js';
7
7
  export interface AuthorizationCheckRequestDto {
8
- /** Organization identifier. Scopes the grant lookup to the tenant. */
8
+ /**
9
+ * Organization identifier. Scopes the grant lookup to the tenant.
10
+ * @minLength 1
11
+ */
9
12
  orgId: string;
10
- /** Canonical CapabilityRef `<domain>:<resource>.<verb>@<major>` from `@xemahq/kernel-contracts/capability`. */
13
+ /**
14
+ * Canonical CapabilityRef `<domain>:<resource>.<verb>@<major>` from `@xemahq/kernel-contracts/capability`.
15
+ * @minLength 1
16
+ */
11
17
  capability: string;
12
18
  subject: SubjectRefDto;
13
- /** ExecutionEnvironmentRef in `environment:<slug>` format (e.g. `"environment:project"`). The service parses the prefix and checks the slug against the ExecutionEnvironmentKind enum. */
19
+ /**
20
+ * ExecutionEnvironmentRef in `environment:<slug>` format (e.g. `"environment:project"`). The service parses the prefix and checks the slug against the ExecutionEnvironmentKind enum.
21
+ * @minLength 1
22
+ */
14
23
  environment: string;
15
- /** CANONICAL kernel resource-instance ref `resource:<type>:<id>` naming the instance the capability targets. Optional — omit it for a verb-only check. When PRESENT it must be canonical: the service resolves it with `parseResourceRef` and answers `400 RESOURCE_REF_MALFORMED` for any other shape. Build it with `composeResourceRef(type, id)` from `@xemahq/kernel-contracts/resource`; a bare `<type>:<id>` and an `xema://…` path are BOTH rejected. */
24
+ /**
25
+ * Canonical `xema://<Space>/resource/<type>/<id>[@version]` address naming the instance the capability targets. Optional — omit it for a verb-only check; do not send a placeholder. The legacy `resource:<type>:<id>` form is still accepted, but it cannot express the org scope the canonical form carries. Any other shape is refused at the edge with `400 RESOURCE_REF_MALFORMED`.
26
+ * @minLength 1
27
+ */
16
28
  resource?: string;
17
- /** Audience policy slug; Phase 3 ignores this dimension. */
29
+ /**
30
+ * Audience policy slug; Phase 3 ignores this dimension.
31
+ * @minLength 1
32
+ */
18
33
  audience?: string;
19
- /** Caller-supplied correlation id surfaced in audit logs. */
34
+ /**
35
+ * Caller-supplied correlation id surfaced in audit logs.
36
+ * @minLength 1
37
+ */
20
38
  correlationId?: string;
21
39
  }
@@ -6,5 +6,6 @@
6
6
  import type { AuthorizationDecisionCode } from './authorizationDecisionCode.js';
7
7
  export interface AuthorizationReasonDto {
8
8
  code: AuthorizationDecisionCode;
9
+ /** @minLength 1 */
9
10
  detail: string;
10
11
  }
@@ -6,11 +6,20 @@
6
6
  import type { AuthorizationSuggestionKind } from './authorizationSuggestionKind.js';
7
7
  export interface AuthorizationSuggestionDto {
8
8
  kind: AuthorizationSuggestionKind;
9
+ /** @minLength 1 */
9
10
  capability?: string;
11
+ /** @minLength 1 */
10
12
  environment?: string;
13
+ /** @minLength 1 */
11
14
  resource?: string;
12
- /** For `switch-environment`: the environment the request was sent with (denied). For other kinds, undefined. */
15
+ /**
16
+ * For `switch-environment`: the environment the request was sent with (denied). For other kinds, undefined.
17
+ * @minLength 1
18
+ */
13
19
  from?: string;
14
- /** For `switch-environment`: a environment the caller already holds a matching grant in. For other kinds, undefined. */
20
+ /**
21
+ * For `switch-environment`: a environment the caller already holds a matching grant in. For other kinds, undefined.
22
+ * @minLength 1
23
+ */
15
24
  to?: string;
16
25
  }
@@ -0,0 +1,29 @@
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 { CapabilityAuthorityRequestDtoDisposition } from './capabilityAuthorityRequestDtoDisposition.js';
7
+ import type { CapabilityAuthorityRequestDtoOutcome } from './capabilityAuthorityRequestDtoOutcome.js';
8
+ import type { CapabilityAuthorityRequestDtoRefusal } from './capabilityAuthorityRequestDtoRefusal.js';
9
+ export interface CapabilityAuthorityRequestDto {
10
+ id: string;
11
+ orgId: string;
12
+ subjectKind: string;
13
+ subjectRef: string;
14
+ capability: string;
15
+ environment: string;
16
+ justification?: string;
17
+ /** What the organisation policy decided. */
18
+ disposition: CapabilityAuthorityRequestDtoDisposition;
19
+ /** Set iff the disposition is `refuse`. */
20
+ refusal?: CapabilityAuthorityRequestDtoRefusal;
21
+ /** The decision-api ask, set iff a human is being asked. Its live status is read from decision-api rather than mirrored here, so a settled ask cannot show as pending because an event was lost. */
22
+ decisionId?: string;
23
+ /** Terminal state. Absent while the ask is live. */
24
+ outcome?: CapabilityAuthorityRequestDtoOutcome;
25
+ /** The grant this request produced, if any. A POINTER for the audit trail — authority itself lives in `capability_grants`, and nothing reads this field as permission. */
26
+ grantId?: string;
27
+ createdAt: string;
28
+ settledAt?: string;
29
+ }
@@ -0,0 +1,9 @@
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 { CapabilityAuthorityRequestDto } from './capabilityAuthorityRequestDto.js';
7
+ export interface CapabilityAuthorityRequestDtoDataArrayEnvelope {
8
+ data: CapabilityAuthorityRequestDto[];
9
+ }
@@ -0,0 +1,9 @@
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 { CapabilityAuthorityRequestDto } from './capabilityAuthorityRequestDto.js';
7
+ export interface CapabilityAuthorityRequestDtoDataEnvelope {
8
+ data: CapabilityAuthorityRequestDto;
9
+ }
@@ -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
+ * What the organisation policy decided.
8
+ */
9
+ export type CapabilityAuthorityRequestDtoDisposition = typeof CapabilityAuthorityRequestDtoDisposition[keyof typeof CapabilityAuthorityRequestDtoDisposition];
10
+ export declare const CapabilityAuthorityRequestDtoDisposition: {
11
+ readonly 'auto-allow': "auto-allow";
12
+ readonly 'decision-required': "decision-required";
13
+ readonly refuse: "refuse";
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.CapabilityAuthorityRequestDtoDisposition = void 0;
9
+ exports.CapabilityAuthorityRequestDtoDisposition = {
10
+ 'auto-allow': 'auto-allow',
11
+ 'decision-required': 'decision-required',
12
+ refuse: 'refuse',
13
+ };
@@ -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
+ /**
7
+ * Terminal state. Absent while the ask is live.
8
+ */
9
+ export type CapabilityAuthorityRequestDtoOutcome = typeof CapabilityAuthorityRequestDtoOutcome[keyof typeof CapabilityAuthorityRequestDtoOutcome];
10
+ export declare const CapabilityAuthorityRequestDtoOutcome: {
11
+ readonly granted: "granted";
12
+ readonly refused: "refused";
13
+ readonly refused_by_policy: "refused_by_policy";
14
+ readonly no_judgement: "no_judgement";
15
+ readonly grant_write_refused: "grant_write_refused";
16
+ };
@@ -0,0 +1,15 @@
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.CapabilityAuthorityRequestDtoOutcome = void 0;
9
+ exports.CapabilityAuthorityRequestDtoOutcome = {
10
+ granted: 'granted',
11
+ refused: 'refused',
12
+ refused_by_policy: 'refused_by_policy',
13
+ no_judgement: 'no_judgement',
14
+ grant_write_refused: 'grant_write_refused',
15
+ };
@@ -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
+ * Set iff the disposition is `refuse`.
8
+ */
9
+ export type CapabilityAuthorityRequestDtoRefusal = typeof CapabilityAuthorityRequestDtoRefusal[keyof typeof CapabilityAuthorityRequestDtoRefusal];
10
+ export declare const CapabilityAuthorityRequestDtoRefusal: {
11
+ readonly SUBJECT_KIND_MAY_NOT_REQUEST: "SUBJECT_KIND_MAY_NOT_REQUEST";
12
+ readonly REACH_EXCEEDS_ORG_AUTHORITY: "REACH_EXCEEDS_ORG_AUTHORITY";
13
+ readonly ORG_REFUSED_CAPABILITY: "ORG_REFUSED_CAPABILITY";
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.CapabilityAuthorityRequestDtoRefusal = void 0;
9
+ exports.CapabilityAuthorityRequestDtoRefusal = {
10
+ SUBJECT_KIND_MAY_NOT_REQUEST: 'SUBJECT_KIND_MAY_NOT_REQUEST',
11
+ REACH_EXCEEDS_ORG_AUTHORITY: 'REACH_EXCEEDS_ORG_AUTHORITY',
12
+ ORG_REFUSED_CAPABILITY: 'ORG_REFUSED_CAPABILITY',
13
+ };
@@ -3,9 +3,6 @@
3
3
  * Authorization API
4
4
  * OpenAPI spec version: 0.1.1
5
5
  */
6
- /**
7
- * @nullable
8
- */
9
- export type ErrorDetailsDtoDetails = {
10
- [key: string]: unknown;
11
- } | null;
6
+ export type CapabilityAuthorityRequestsControllerGetByIdParams = {
7
+ orgId: string;
8
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Generated by @xemahq/api-client-generator — do not edit manually.
3
+ * Authorization API
4
+ * OpenAPI spec version: 0.1.1
5
+ */
6
+ export type CapabilityAuthorityRequestsControllerListForSubjectParams = {
7
+ orgId: string;
8
+ subjectKind: string;
9
+ subjectRef: string;
10
+ };
@@ -9,12 +9,19 @@ import type { CreateExecutionEnvironmentDtoRuntimeLimits } from './createExecuti
9
9
  import type { DataClassification } from './dataClassification.js';
10
10
  import type { ExecutionEnvironmentKind } from './executionEnvironmentKind.js';
11
11
  export interface CreateExecutionEnvironmentDto {
12
- /** Owning organization. Scopes the custom environment to the tenant. */
12
+ /**
13
+ * Owning organization. Scopes the custom environment to the tenant.
14
+ * @minLength 1
15
+ */
13
16
  orgId: string;
14
- /** Environment slug (lowercase kebab, must start with a letter). Unique per org; must not collide with a built-in slug. */
17
+ /**
18
+ * Environment slug (lowercase kebab, must start with a letter). Unique per org; must not collide with a built-in slug.
19
+ * @pattern ENVIRONMENT_SLUG_REGEX
20
+ */
15
21
  slug: string;
16
22
  /** ExecutionEnvironmentKind classification for this environment. */
17
23
  kind: ExecutionEnvironmentKind;
24
+ /** @minLength 1 */
18
25
  description: string;
19
26
  /** Per-environment capability allow-list (`CapabilityPolicy[]`). Defaults to `[]`. */
20
27
  allowedCapabilities?: CreateExecutionEnvironmentDtoAllowedCapabilitiesItem[];