@vertesia/common 1.5.0-dev.20260804.124748Z → 1.5.0-dev.20260806.125520Z

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 (163) hide show
  1. package/lib/Progress.d.ts.map +1 -1
  2. package/lib/Progress.js.map +1 -1
  3. package/lib/access-control-values.d.ts +2 -2
  4. package/lib/access-control-values.d.ts.map +1 -1
  5. package/lib/account-values.d.ts +1 -1
  6. package/lib/account-values.d.ts.map +1 -1
  7. package/lib/api-schemas/access-control.d.ts +19 -19
  8. package/lib/api-schemas/adapter.js.map +1 -1
  9. package/lib/api-schemas/agent-runs.d.ts +520 -515
  10. package/lib/api-schemas/agent-runs.d.ts.map +1 -1
  11. package/lib/api-schemas/agent-runs.js +11 -2
  12. package/lib/api-schemas/agent-runs.js.map +1 -1
  13. package/lib/api-schemas/analytics.d.ts +12 -12
  14. package/lib/api-schemas/apikey.d.ts +10 -10
  15. package/lib/api-schemas/app-lifecycle.d.ts +186 -152
  16. package/lib/api-schemas/app-lifecycle.d.ts.map +1 -1
  17. package/lib/api-schemas/app-lifecycle.js +51 -0
  18. package/lib/api-schemas/app-lifecycle.js.map +1 -1
  19. package/lib/api-schemas/app-runtime.d.ts +4022 -2127
  20. package/lib/api-schemas/app-runtime.d.ts.map +1 -1
  21. package/lib/api-schemas/app-runtime.js +93 -1
  22. package/lib/api-schemas/app-runtime.js.map +1 -1
  23. package/lib/api-schemas/apps.d.ts +43 -19
  24. package/lib/api-schemas/apps.d.ts.map +1 -1
  25. package/lib/api-schemas/apps.js +63 -3
  26. package/lib/api-schemas/apps.js.map +1 -1
  27. package/lib/api-schemas/audit-trail.d.ts +129 -129
  28. package/lib/api-schemas/bulk-operation.d.ts +10 -10
  29. package/lib/api-schemas/content.d.ts +402 -398
  30. package/lib/api-schemas/content.d.ts.map +1 -1
  31. package/lib/api-schemas/content.js +12 -0
  32. package/lib/api-schemas/content.js.map +1 -1
  33. package/lib/api-schemas/cost-analytics.d.ts +12 -12
  34. package/lib/api-schemas/dashboard.d.ts +10 -10
  35. package/lib/api-schemas/data-store.d.ts +556 -556
  36. package/lib/api-schemas/document-processing.d.ts +196 -196
  37. package/lib/api-schemas/embeddings.d.ts +12 -12
  38. package/lib/api-schemas/environment.d.ts +18 -18
  39. package/lib/api-schemas/events.d.ts +723 -685
  40. package/lib/api-schemas/events.d.ts.map +1 -1
  41. package/lib/api-schemas/events.js +59 -3
  42. package/lib/api-schemas/events.js.map +1 -1
  43. package/lib/api-schemas/files.d.ts +1 -1
  44. package/lib/api-schemas/group.d.ts +3 -3
  45. package/lib/api-schemas/indexing.d.ts +3 -3
  46. package/lib/api-schemas/integrations.d.ts +4 -4
  47. package/lib/api-schemas/interaction.d.ts +2744 -2742
  48. package/lib/api-schemas/interaction.d.ts.map +1 -1
  49. package/lib/api-schemas/interaction.js +6 -0
  50. package/lib/api-schemas/interaction.js.map +1 -1
  51. package/lib/api-schemas/invites.d.ts +9 -9
  52. package/lib/api-schemas/oauth-server.d.ts +36 -36
  53. package/lib/api-schemas/parameters.js.map +1 -1
  54. package/lib/api-schemas/process.d.ts +47 -47
  55. package/lib/api-schemas/project-configuration.d.ts +662 -662
  56. package/lib/api-schemas/project.d.ts +979 -979
  57. package/lib/api-schemas/registry.d.ts +14782 -13734
  58. package/lib/api-schemas/registry.d.ts.map +1 -1
  59. package/lib/api-schemas/registry.js +22 -2
  60. package/lib/api-schemas/registry.js.map +1 -1
  61. package/lib/api-schemas/secrets.d.ts +4 -4
  62. package/lib/api-schemas/store.d.ts +3203 -3203
  63. package/lib/api-schemas/sts.d.ts +46 -36
  64. package/lib/api-schemas/sts.d.ts.map +1 -1
  65. package/lib/api-schemas/sts.js +11 -0
  66. package/lib/api-schemas/sts.js.map +1 -1
  67. package/lib/api-schemas/task.d.ts +30 -30
  68. package/lib/api-schemas/tools.d.ts +9 -9
  69. package/lib/api-schemas/user.d.ts +6 -6
  70. package/lib/api-schemas/view-execution.d.ts +569 -569
  71. package/lib/api-schemas/views.d.ts +1124 -1124
  72. package/lib/api-schemas/workflow-runs.d.ts +269 -268
  73. package/lib/api-schemas/workflow-runs.d.ts.map +1 -1
  74. package/lib/apps.d.ts +38 -24
  75. package/lib/apps.d.ts.map +1 -1
  76. package/lib/apps.js +4 -0
  77. package/lib/apps.js.map +1 -1
  78. package/lib/audit-trail.d.ts +3 -3
  79. package/lib/audit-trail.d.ts.map +1 -1
  80. package/lib/data-platform.d.ts +31 -31
  81. package/lib/data-platform.d.ts.map +1 -1
  82. package/lib/environment.d.ts +3 -3
  83. package/lib/index.d.ts +1 -0
  84. package/lib/index.d.ts.map +1 -1
  85. package/lib/index.js +1 -0
  86. package/lib/index.js.map +1 -1
  87. package/lib/platform-event-validation.d.ts.map +1 -1
  88. package/lib/platform-event-validation.js +15 -2
  89. package/lib/platform-event-validation.js.map +1 -1
  90. package/lib/platform-event.d.ts +31 -3
  91. package/lib/platform-event.d.ts.map +1 -1
  92. package/lib/platform-event.js.map +1 -1
  93. package/lib/project.d.ts +1 -1
  94. package/lib/schema-for-extraction.js.map +1 -1
  95. package/lib/store/agent-approval.d.ts +1 -1
  96. package/lib/store/agent-approval.d.ts.map +1 -1
  97. package/lib/store/process-schema.d.ts +1 -1
  98. package/lib/store/process-schema.d.ts.map +1 -1
  99. package/lib/store/process-validation.js.map +1 -1
  100. package/lib/store/schedule.d.ts +6 -6
  101. package/lib/store/schedule.d.ts.map +1 -1
  102. package/lib/store/store.d.ts +3 -3
  103. package/lib/store/store.d.ts.map +1 -1
  104. package/lib/store/workflow.d.ts +6 -0
  105. package/lib/store/workflow.d.ts.map +1 -1
  106. package/lib/store/workflow.js +8 -0
  107. package/lib/store/workflow.js.map +1 -1
  108. package/lib/sts-errors.d.ts +7 -0
  109. package/lib/sts-errors.d.ts.map +1 -0
  110. package/lib/sts-errors.js +11 -0
  111. package/lib/sts-errors.js.map +1 -0
  112. package/lib/sts-token-types.d.ts +2 -1
  113. package/lib/sts-token-types.d.ts.map +1 -1
  114. package/lib/sts-token-types.js.map +1 -1
  115. package/lib/user.d.ts +1 -1
  116. package/lib/user.d.ts.map +1 -1
  117. package/lib/user.js +1 -1
  118. package/lib/user.js.map +1 -1
  119. package/lib/versions.d.ts +10 -0
  120. package/lib/versions.d.ts.map +1 -1
  121. package/lib/versions.js +10 -0
  122. package/lib/versions.js.map +1 -1
  123. package/lib/vertesia-common.js +3 -3
  124. package/lib/vertesia-common.js.map +1 -1
  125. package/lib/view-configuration-validation.js.map +1 -1
  126. package/lib/view-query-validation.js.map +1 -1
  127. package/lib/view-validation-helpers.d.ts +1 -1
  128. package/lib/view-validation-helpers.d.ts.map +1 -1
  129. package/lib/views-schema.d.ts +51 -51
  130. package/lib/views-schema.d.ts.map +1 -1
  131. package/lib/views-validation.js.map +1 -1
  132. package/lib/views.d.ts +2 -2
  133. package/lib/views.d.ts.map +1 -1
  134. package/lib/workflow-analytics.d.ts +10 -3
  135. package/lib/workflow-analytics.d.ts.map +1 -1
  136. package/package.json +4 -4
  137. package/src/api-schemas/agent-runs.ts +12 -2
  138. package/src/api-schemas/app-delete-summary.contract.test.ts +67 -0
  139. package/src/api-schemas/app-lifecycle.ts +59 -0
  140. package/src/api-schemas/app-runtime.ts +103 -0
  141. package/src/api-schemas/apps.ts +72 -3
  142. package/src/api-schemas/content.ts +13 -0
  143. package/src/api-schemas/events.ts +63 -3
  144. package/src/api-schemas/interaction.contract.test.ts +27 -0
  145. package/src/api-schemas/interaction.ts +7 -0
  146. package/src/api-schemas/mcp-api-key.contract.test.ts +86 -0
  147. package/src/api-schemas/registry.ts +25 -0
  148. package/src/api-schemas/store.contract.test.ts +21 -0
  149. package/src/api-schemas/sts.contract.test.ts +33 -1
  150. package/src/api-schemas/sts.ts +13 -0
  151. package/src/apps.test.ts +82 -0
  152. package/src/apps.ts +50 -16
  153. package/src/index.ts +1 -0
  154. package/src/platform-event-validation.test.ts +26 -0
  155. package/src/platform-event-validation.ts +15 -2
  156. package/src/platform-event.ts +43 -0
  157. package/src/store/workflow.ts +9 -0
  158. package/src/sts-errors.ts +13 -0
  159. package/src/sts-token-types.ts +2 -0
  160. package/src/user.ts +1 -1
  161. package/src/versions.test.ts +13 -0
  162. package/src/versions.ts +12 -0
  163. package/src/workflow-analytics.ts +10 -3
@@ -109,9 +109,11 @@ import {
109
109
  AgentRunTypeSchema,
110
110
  AgentToolApprovalClassSchema,
111
111
  AgentToolDefinitionSchema,
112
+ AppApiKeyCollectionParamsSchema,
112
113
  AppBuildProgressSchema,
113
114
  AppBuildProgressStatusSchema,
114
115
  AppBuildTriggerSchema,
116
+ AppDeleteSummarySchema,
115
117
  AppDevelopmentTaskDetailsSchema,
116
118
  AppDevelopmentTaskListSchema,
117
119
  AppDevelopmentTaskSchema,
@@ -155,6 +157,7 @@ import {
155
157
  EventRefSchema,
156
158
  Extract_AppVersionGitRefType_branch_tag_commitSchema,
157
159
  InCodeTypeRefSchema,
160
+ McpApiKeyCredentialSchema,
158
161
  OAuthClientCredentialsMapSchema,
159
162
  OAuthClientCredentialsSchema,
160
163
  RunKindSchema,
@@ -178,6 +181,7 @@ import {
178
181
  AppSourceConfigSchema,
179
182
  AppUIConfigSchema,
180
183
  MCPToolAnnotationsSchema,
184
+ McpApiKeyStatusSchema,
181
185
  McpOAuthConnectResponseSchema,
182
186
  McpOAuthDisconnectResponseSchema,
183
187
  McpOAuthTokenRequestSchema,
@@ -186,6 +190,7 @@ import {
186
190
  OAuthAuthStatusArraySchema,
187
191
  OAuthAuthStatusSchema,
188
192
  OAuthMetadataResponseSchema,
193
+ SetMcpApiKeyRequestSchema,
189
194
  ToolCollectionObjectSchema,
190
195
  } from './apps.js';
191
196
  import {
@@ -1585,17 +1590,21 @@ const EVENT_DELIVERY_SCHEMAS = {
1585
1590
  EventOutboxStatus: EventSchemas.EventOutboxStatusSchema,
1586
1591
  EventDeliverySortField: EventSchemas.EventDeliverySortFieldSchema,
1587
1592
  WebhookEventDeliveryTarget: EventSchemas.WebhookEventDeliveryTargetSchema,
1593
+ AppEventDeliveryTarget: EventSchemas.AppEventDeliveryTargetSchema,
1588
1594
  WorkflowEventDeliveryTarget: EventSchemas.WorkflowEventDeliveryTargetSchema,
1589
1595
  EventDeliveryQueueFailureSummary: EventSchemas.EventDeliveryQueueFailureSummarySchema,
1590
1596
  EventOutboxQueueSummary: EventSchemas.EventOutboxQueueSummarySchema,
1591
1597
  EventDeliveryQueueSortField: EventSchemas.EventDeliveryQueueSortFieldSchema,
1592
1598
  AgentEventDeliveryTarget: EventSchemas.AgentEventDeliveryTargetSchema,
1593
1599
  WebhookEventDeliveryTargetInput: EventSchemas.WebhookEventDeliveryTargetInputSchema,
1600
+ AppEventDeliveryTargetInput: EventSchemas.AppEventDeliveryTargetInputSchema,
1594
1601
  WorkflowEventDeliveryTargetInput: EventSchemas.WorkflowEventDeliveryTargetInputSchema,
1595
1602
  SemanticEvaluator: EventSchemas.SemanticEvaluatorSchema,
1596
1603
  SemanticEvaluationRecord: EventSchemas.SemanticEvaluationRecordSchema,
1597
1604
  EventDeliveryQueueSubscriptionSummary: EventSchemas.EventDeliveryQueueSubscriptionSummarySchema,
1598
1605
  EventDeliveryQueueSummaryPayload: EventSchemas.EventDeliveryQueueSummaryPayloadSchema,
1606
+ CancelEventDeliveryIntentsPayload: EventSchemas.CancelEventDeliveryIntentsPayloadSchema,
1607
+ CancelEventDeliveryIntentsResponse: EventSchemas.CancelEventDeliveryIntentsResponseSchema,
1599
1608
  EventSemanticCondition: EventSchemas.EventSemanticConditionSchema,
1600
1609
  EventDeliveryIntentSummary: EventSchemas.EventDeliveryIntentSummarySchema,
1601
1610
  EventDeliveryQueueSummaryResponse: EventSchemas.EventDeliveryQueueSummaryResponseSchema,
@@ -1806,6 +1815,10 @@ const REMOTE_MCP_SCHEMAS = {
1806
1815
  McpOAuthConnectResponse: McpOAuthConnectResponseSchema,
1807
1816
  OAuthAuthorizeResponse: OAuthAuthorizeResponseSchema,
1808
1817
  OAuthAuthStatusArray: OAuthAuthStatusArraySchema,
1818
+ // The static-key alternative to that handshake: the key itself is write-only, so only the
1819
+ // setter payload and the configured/hint projection are published.
1820
+ SetMcpApiKeyRequest: SetMcpApiKeyRequestSchema,
1821
+ McpApiKeyStatus: McpApiKeyStatusSchema,
1809
1822
  } as const satisfies Record<string, z.ZodType>;
1810
1823
 
1811
1824
  const AUDIT_TRAIL_SCHEMAS = {
@@ -1919,6 +1932,7 @@ const APP_LIFECYCLE_SCHEMAS = {
1919
1932
  RunType: RunTypeSchema,
1920
1933
  AppBuildProgressStatus: AppBuildProgressStatusSchema,
1921
1934
  DeleteAppVersionResponse: DeleteAppVersionResponseSchema,
1935
+ AppDeleteSummary: AppDeleteSummarySchema,
1922
1936
  AppRepoBranch: AppRepoBranchSchema,
1923
1937
  AppRepoDocumentCommit: AppRepoDocumentCommitSchema,
1924
1938
  AppVersionGitSource: AppVersionGitSourceSchema,
@@ -1928,6 +1942,8 @@ const APP_LIFECYCLE_SCHEMAS = {
1928
1942
  AppDevelopmentTaskList: AppDevelopmentTaskListSchema,
1929
1943
  OAuthClientCredentialsMap: OAuthClientCredentialsMapSchema,
1930
1944
  AppOAuthCollectionParams: AppOAuthCollectionParamsSchema,
1945
+ McpApiKeyCredential: McpApiKeyCredentialSchema,
1946
+ AppApiKeyCollectionParams: AppApiKeyCollectionParamsSchema,
1931
1947
  AppInspectionIssue: AppInspectionIssueSchema,
1932
1948
  AppScaffoldProgress: AppScaffoldProgressSchema,
1933
1949
  AppRepoTree: AppRepoTreeSchema,
@@ -2077,6 +2093,7 @@ const STS_SCHEMAS = {
2077
2093
  ServiceAccountTokenRequest: StsSchemas.ServiceAccountTokenRequestSchema,
2078
2094
  IssueTokenRequest: StsSchemas.IssueTokenRequestSchema,
2079
2095
  IssueTokenResponse: StsSchemas.IssueTokenResponseSchema,
2096
+ IssueTokenForbiddenResponse: StsSchemas.IssueTokenForbiddenResponseSchema,
2080
2097
  IssueTokenUnavailableResponse: StsSchemas.IssueTokenUnavailableResponseSchema,
2081
2098
  } as const satisfies Record<string, z.ZodType>;
2082
2099
 
@@ -2224,6 +2241,7 @@ const STRICT_COMPONENTS: ReadonlySet<string> = new Set<string>([
2224
2241
  'AgentTokenRequest',
2225
2242
  'ServiceAccountTokenRequest',
2226
2243
  'IssueTokenResponse',
2244
+ 'IssueTokenForbiddenResponse',
2227
2245
  'IssueTokenUnavailableResponse',
2228
2246
  'ApiKeyListQuery',
2229
2247
  // These payloads previously referenced closed generated utility components. They now own their
@@ -2371,6 +2389,7 @@ const STRICT_COMPONENTS: ReadonlySet<string> = new Set<string>([
2371
2389
  'AppUIConfig',
2372
2390
  'AppUINavItem',
2373
2391
  'MCPOAuthConfig',
2392
+ 'MCPApiKeyConfig',
2374
2393
  'MCPToolCollectionObject',
2375
2394
  'VertesiaSDKToolCollectionObject',
2376
2395
  // File, task, content-type and command components. Every one is published closed
@@ -2662,6 +2681,8 @@ const STRICT_COMPONENTS: ReadonlySet<string> = new Set<string>([
2662
2681
  'ListWorkflowRunsResponse',
2663
2682
  'EventDeliveryQueueSubscriptionSummary',
2664
2683
  'EventDeliveryQueueSummaryPayload',
2684
+ 'CancelEventDeliveryIntentsPayload',
2685
+ 'CancelEventDeliveryIntentsResponse',
2665
2686
  'ContentObjectExportStatusResponse',
2666
2687
  'TimerTask',
2667
2688
  'SignalTask',
@@ -2929,6 +2950,8 @@ const STRICT_COMPONENTS: ReadonlySet<string> = new Set<string>([
2929
2950
  'McpOAuthDisconnectResponse',
2930
2951
  'McpOAuthConnectResponse',
2931
2952
  'OAuthAuthorizeResponse',
2953
+ 'SetMcpApiKeyRequest',
2954
+ 'McpApiKeyStatus',
2932
2955
  'AuditMeter',
2933
2956
  'AuditAggregationDimensionMap',
2934
2957
  'AuditAggregationRow',
@@ -2982,6 +3005,7 @@ const STRICT_COMPONENTS: ReadonlySet<string> = new Set<string>([
2982
3005
  'AppInstallationProviderBinding',
2983
3006
  'AppInstallationOAuthBinding',
2984
3007
  'OAuthClientCredentials',
3008
+ 'McpApiKeyCredential',
2985
3009
  'AppInspectionCapabilityReport',
2986
3010
  'AppRepoTreeEntry',
2987
3011
  'AppRepoRef',
@@ -2990,6 +3014,7 @@ const STRICT_COMPONENTS: ReadonlySet<string> = new Set<string>([
2990
3014
  'InCodeTypeRef',
2991
3015
  'StoredTypeRef',
2992
3016
  'DeleteAppVersionResponse',
3017
+ 'AppDeleteSummary',
2993
3018
  'AppRepoBranch',
2994
3019
  'AppRepoDocumentCommit',
2995
3020
  'AppVersionGitSource',
@@ -131,6 +131,27 @@ describe.skipIf(!publishedDocument)('gate — generated artifact = canonical com
131
131
  });
132
132
  });
133
133
 
134
+ describe('content object response classification', () => {
135
+ it('accepts the current sensitivity and compartments fields', () => {
136
+ const result = validateApiResponse('ContentObjectApiResponse', {
137
+ id: 'content-object-id',
138
+ name: 'Classified document',
139
+ updated_by: 'user-id',
140
+ created_by: 'user-id',
141
+ created_at: '2026-08-06T09:00:00.000Z',
142
+ updated_at: '2026-08-06T09:00:00.000Z',
143
+ location: '/',
144
+ status: 'completed',
145
+ properties: {},
146
+ revision: { root: 'content-object-id', head: true },
147
+ sensitivity: 3,
148
+ compartments: ['legal'],
149
+ });
150
+
151
+ expect(result).toMatchObject({ valid: true });
152
+ });
153
+ });
154
+
134
155
  /**
135
156
  * Bodies that probe where the two validators could disagree.
136
157
  *
@@ -4,6 +4,7 @@ import type {
4
4
  AgentTokenRequest,
5
5
  ApiKeyTokenRequest,
6
6
  EnvironmentTokenRequest,
7
+ IssueTokenForbiddenResponse,
7
8
  IssueTokenRequest,
8
9
  IssueTokenResponse,
9
10
  ProjectTokenRequest,
@@ -16,6 +17,7 @@ import type {
16
17
  AgentTokenRequestSchema,
17
18
  ApiKeyTokenRequestSchema,
18
19
  EnvironmentTokenRequestSchema,
20
+ IssueTokenForbiddenResponseSchema,
19
21
  IssueTokenRequestSchema,
20
22
  IssueTokenResponseSchema,
21
23
  ProjectTokenRequestSchema,
@@ -38,6 +40,7 @@ describe('STS canonical contracts', () => {
38
40
  assertType<Equals<ServiceAccountTokenRequest, z.infer<typeof ServiceAccountTokenRequestSchema>>>(true);
39
41
  assertType<Equals<IssueTokenRequest, z.infer<typeof IssueTokenRequestSchema>>>(true);
40
42
  assertType<Equals<IssueTokenResponse, z.infer<typeof IssueTokenResponseSchema>>>(true);
43
+ assertType<Equals<IssueTokenForbiddenResponse, z.infer<typeof IssueTokenForbiddenResponseSchema>>>(true);
41
44
  expect(true).toBe(true);
42
45
  });
43
46
 
@@ -60,9 +63,38 @@ describe('STS canonical contracts', () => {
60
63
  expect(validateApiRequest('IssueTokenRequest', { type: 'project', account_id: 'acc_1' }).valid).toBe(false);
61
64
  });
62
65
 
63
- it('checks both documented response shapes', () => {
66
+ it('checks every documented response shape and forbidden error-code literal', () => {
64
67
  expect(validateApiResponse('IssueTokenResponse', { token: 'signed', token_type: 'Bearer' }).valid).toBe(true);
65
68
  expect(validateApiResponse('IssueTokenResponse', { token: 'signed', token_type: 'bearer' }).valid).toBe(false);
69
+ for (const errorCode of [
70
+ 'requested_scope_unavailable',
71
+ 'no_accessible_account',
72
+ 'restricted_environment',
73
+ 'token_issuance_forbidden',
74
+ ]) {
75
+ expect(
76
+ validateApiResponse('IssueTokenForbiddenResponse', {
77
+ error: 'Forbidden',
78
+ message: 'The requested scope is unavailable',
79
+ errorCode,
80
+ }).valid,
81
+ ).toBe(true);
82
+ }
83
+ expect(
84
+ validateApiResponse('IssueTokenForbiddenResponse', {
85
+ error: 'Forbidden',
86
+ message: 'No',
87
+ errorCode: 'resource_not_found',
88
+ }).valid,
89
+ ).toBe(false);
90
+ expect(
91
+ validateApiResponse('IssueTokenForbiddenResponse', {
92
+ error: 'Forbidden',
93
+ message: 'No',
94
+ errorCode: 'requested_scope_unavailable',
95
+ project_id: 'secret',
96
+ }).valid,
97
+ ).toBe(false);
66
98
  expect(
67
99
  validateApiResponse('IssueTokenUnavailableResponse', {
68
100
  error: 'Service Unavailable',
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { ISSUE_TOKEN_FORBIDDEN_ERROR_CODES } from '../sts-errors.js';
2
3
  import { SystemRolesSchema } from './apikey.js';
3
4
 
4
5
  const ALGORITHM_DESCRIPTION = 'Signing algorithm - defaults to ES256. Use RS256 for Azure AD compatibility.';
@@ -105,6 +106,18 @@ export const IssueTokenResponseSchema = z
105
106
  })
106
107
  .meta({ id: 'IssueTokenResponse' });
107
108
 
109
+ export const IssueTokenForbiddenResponseSchema = z
110
+ .strictObject({
111
+ error: z.string(),
112
+ message: z.string(),
113
+ errorCode: z.enum(ISSUE_TOKEN_FORBIDDEN_ERROR_CODES),
114
+ })
115
+ .meta({
116
+ id: 'IssueTokenForbiddenResponse',
117
+ description:
118
+ 'A safe, machine-readable denial response. Requested resources are intentionally not identified or confirmed.',
119
+ });
120
+
108
121
  export const IssueTokenUnavailableResponseSchema = z
109
122
  .strictObject({ error: z.string(), message: z.string() })
110
123
  .meta({ id: 'IssueTokenUnavailableResponse' });
package/src/apps.test.ts CHANGED
@@ -1,4 +1,9 @@
1
1
  import { describe, expect, it } from 'vitest';
2
+ import {
3
+ AppEventHookPayloadSchema,
4
+ AppEventSubscriptionDefinitionSchema,
5
+ AppPackageHooksSchema,
6
+ } from './api-schemas/app-runtime.js';
2
7
  import { APP_ARTIFACT_TYPES, APP_CAPABILITIES, APP_PACKAGE_SCOPES, effectiveAppAccessControl } from './apps.js';
3
8
 
4
9
  describe('app capability contracts', () => {
@@ -6,6 +11,83 @@ describe('app capability contracts', () => {
6
11
  expect(APP_CAPABILITIES).toContain('views');
7
12
  expect(APP_PACKAGE_SCOPES).toContain('views');
8
13
  expect(APP_ARTIFACT_TYPES).toContain('view');
14
+ expect(APP_ARTIFACT_TYPES).toContain('hook');
15
+ expect(APP_ARTIFACT_TYPES).toContain('subscription');
16
+ });
17
+
18
+ it('exposes app hooks as a package query scope', () => {
19
+ expect(APP_PACKAGE_SCOPES).toContain('hooks');
20
+ expect(APP_PACKAGE_SCOPES).toContain('subscriptions');
21
+ });
22
+
23
+ it('accepts app-owned subscriptions without a deployment-specific target', () => {
24
+ expect(
25
+ AppEventSubscriptionDefinitionSchema.parse({
26
+ id: 'content-updated',
27
+ name: 'Content updated',
28
+ hook: 'content-updated',
29
+ filter: { action: ['update'], resource_type: ['content_object'] },
30
+ run_as_role: 'automation',
31
+ }),
32
+ ).toEqual({
33
+ id: 'content-updated',
34
+ name: 'Content updated',
35
+ hook: 'content-updated',
36
+ filter: { action: ['update'], resource_type: ['content_object'] },
37
+ run_as_role: 'automation',
38
+ });
39
+ });
40
+
41
+ it('validates the canonical app event-hook envelope', () => {
42
+ const payload = {
43
+ event: {
44
+ event_id: 'event-1',
45
+ root_event_id: 'event-1',
46
+ hop_count: 0,
47
+ event_category: 'content',
48
+ action: 'update',
49
+ resource_type: 'content_object',
50
+ resource_id: 'object-1',
51
+ account_id: 'account-1',
52
+ project_id: 'project-1',
53
+ tenant_id: 'account-1_project-1',
54
+ timestamp: '2026-08-05T10:00:00.000Z',
55
+ source: 'zeno-server',
56
+ details: { changed: ['title'] },
57
+ },
58
+ delivery: {
59
+ id: 'delivery-1',
60
+ subscription_id: 'subscription-1',
61
+ attempt: 1,
62
+ },
63
+ };
64
+
65
+ expect(AppEventHookPayloadSchema.parse(payload)).toEqual(payload);
66
+ expect(() => AppEventHookPayloadSchema.parse({ event: payload.event })).toThrow();
67
+ });
68
+
69
+ it('accepts lifecycle and event hook package metadata', () => {
70
+ expect(
71
+ AppPackageHooksSchema.parse({
72
+ install: '/api/hooks/install',
73
+ events: [
74
+ {
75
+ name: 'content-updated',
76
+ path: '/api/hooks/content-updated',
77
+ description: 'Processes updated content.',
78
+ },
79
+ ],
80
+ }),
81
+ ).toEqual({
82
+ install: '/api/hooks/install',
83
+ events: [
84
+ {
85
+ name: 'content-updated',
86
+ path: '/api/hooks/content-updated',
87
+ description: 'Processes updated content.',
88
+ },
89
+ ],
90
+ });
9
91
  });
10
92
  });
11
93
 
package/src/apps.ts CHANGED
@@ -2,9 +2,11 @@ import type { z } from 'zod';
2
2
  import type {
3
3
  AgentToolApprovalClassSchema,
4
4
  AgentToolDefinitionSchema,
5
+ AppApiKeyCollectionParamsSchema,
5
6
  AppBuildProgressSchema,
6
7
  AppBuildProgressStatusSchema,
7
8
  AppBuildTriggerSchema,
9
+ AppDeleteSummarySchema,
8
10
  AppDevelopmentTaskDetailsSchema,
9
11
  AppDevelopmentTaskListSchema,
10
12
  AppDevelopmentTaskSchema,
@@ -40,6 +42,7 @@ import type {
40
42
  AppVersionTargetSchema,
41
43
  AppVersionUrlsSchema,
42
44
  DeleteAppVersionResponseSchema,
45
+ McpApiKeyCredentialSchema,
43
46
  OAuthClientCredentialsSchema,
44
47
  StartAppBuildRequestSchema,
45
48
  StartAppBuildResponseSchema,
@@ -51,11 +54,16 @@ import type {
51
54
  ValidateUrlResponseSchema,
52
55
  } from './api-schemas/app-lifecycle.js';
53
56
  import type {
57
+ AppEventHookDeliverySchema,
58
+ AppEventHookPayloadSchema,
59
+ AppEventSubscriptionDefinitionSchema,
54
60
  AppInstallationListEntrySchema,
55
61
  AppInstallationSchema,
56
62
  AppInstallationWithManifestSchema,
57
63
  AppManifestDataSchema,
58
64
  AppManifestSchema,
65
+ AppPackageEventHookSchema,
66
+ AppPackageHooksSchema,
59
67
  AppPackageSchema,
60
68
  AppWidgetInfoSchema,
61
69
  CompositeAppCardOverridesSchema,
@@ -86,9 +94,11 @@ import type {
86
94
  AppManifestSourceSchema,
87
95
  AppSourceConfigSchema,
88
96
  AppUIConfigSchema,
97
+ MCPApiKeyConfigSchema,
89
98
  MCPOAuthConfigSchema,
90
99
  MCPToolAnnotationsSchema,
91
100
  MCPToolCollectionObjectSchema,
101
+ McpApiKeyStatusSchema,
92
102
  McpOAuthConnectResponseSchema,
93
103
  McpOAuthDisconnectResponseSchema,
94
104
  McpOAuthTokenRequestSchema,
@@ -96,6 +106,7 @@ import type {
96
106
  OAuthAuthorizeResponseSchema,
97
107
  OAuthAuthStatusSchema,
98
108
  OAuthMetadataResponseSchema,
109
+ SetMcpApiKeyRequestSchema,
99
110
  ToolCollectionAuthTypeSchema,
100
111
  ToolCollectionObjectSchema,
101
112
  VertesiaSDKToolCollectionObjectSchema,
@@ -162,6 +173,9 @@ export type ToolCollectionType = 'mcp' | 'vertesia_sdk';
162
173
 
163
174
  export type MCPOAuthConfig = z.infer<typeof MCPOAuthConfigSchema>;
164
175
 
176
+ /** Install-time provisioning blueprint for an `auth: 'api_key'` MCP collection. Never holds the key. */
177
+ export type MCPApiKeyConfig = z.infer<typeof MCPApiKeyConfigSchema>;
178
+
165
179
  export type MCPToolCollectionObject = z.infer<typeof MCPToolCollectionObjectSchema>;
166
180
 
167
181
  export type VertesiaSDKToolCollectionObject = z.infer<typeof VertesiaSDKToolCollectionObjectSchema>;
@@ -296,6 +310,8 @@ export const APP_ARTIFACT_TYPES = [
296
310
  'dashboard',
297
311
  'activity',
298
312
  'tool',
313
+ 'hook',
314
+ 'subscription',
299
315
  ] as const;
300
316
 
301
317
  export type AppArtifactType = (typeof APP_ARTIFACT_TYPES)[number];
@@ -304,7 +320,7 @@ export type AppArtifactType = (typeof APP_ARTIFACT_TYPES)[number];
304
320
  * A single platform artifact the App Solution Architect requires the build to create.
305
321
  * `id` is the app-owned in-code id the implementation must register and reference
306
322
  * (e.g. `app:<name>:main:extract-item` for interactions/agents, `app:<name>:<type>` for
307
- * types, `app:<name>:<process>` for processes).
323
+ * types, `app:<name>:<process>` for processes, and `app:<name>:<local-id>` for hooks/subscriptions).
308
324
  */
309
325
  /**
310
326
  * Build progress for one artifact, maintained by the developer agent as a living checklist:
@@ -337,10 +353,10 @@ export interface AppPlannedArtifact {
337
353
 
338
354
  /**
339
355
  * Structured result the App Solution Architect emits alongside its prose artifacts — the
340
- * machine-readable contract for the build. The implementation MUST create and successfully
341
- * exercise every required artifact before building a deployable version. Persisted into the app repo as
342
- * {@link APP_CAPABILITY_MANIFEST_PATH} so it survives across runs and the version-build
343
- * capability gate can verify against it deterministically. If the builder finds the plan
356
+ * machine-readable contract for the build. The implementation MUST register every required artifact
357
+ * before building a candidate, then successfully exercise it after that candidate is installed and
358
+ * version-pinned. Persisted into the app repo as {@link APP_CAPABILITY_MANIFEST_PATH} so it survives
359
+ * across runs and the package-registration gate can verify it deterministically. If the builder finds the plan
344
360
  * wrong or insufficient, the orchestrator relaunches the architect to revise the manifest;
345
361
  * the gate always checks against the latest committed copy.
346
362
  */
@@ -600,10 +616,17 @@ export const APP_PACKAGE_SCOPES = [
600
616
  'settings',
601
617
  'widgets',
602
618
  'activities',
619
+ 'hooks',
620
+ 'subscriptions',
603
621
  'all',
604
622
  ] as const;
605
623
 
606
624
  export type AppPackageScope = (typeof APP_PACKAGE_SCOPES)[number];
625
+ export type AppPackageEventHook = z.infer<typeof AppPackageEventHookSchema>;
626
+ export type AppPackageHooks = z.infer<typeof AppPackageHooksSchema>;
627
+ export type AppEventHookDelivery = z.infer<typeof AppEventHookDeliverySchema>;
628
+ export type AppEventHookPayload = z.infer<typeof AppEventHookPayloadSchema>;
629
+ export type AppEventSubscriptionDefinition = z.infer<typeof AppEventSubscriptionDefinitionSchema>;
607
630
  export type AppPackage = z.infer<typeof AppPackageSchema>;
608
631
 
609
632
  /**
@@ -663,6 +686,12 @@ export interface OrphanedAppInstallation extends Omit<AppInstallation, 'manifest
663
686
  export type OAuthClientCredentials = z.infer<typeof OAuthClientCredentialsSchema>;
664
687
 
665
688
  export type AppOAuthCollectionParams = z.infer<typeof AppOAuthCollectionParamsSchema>;
689
+
690
+ /** One installer-supplied MCP API key. */
691
+ export type McpApiKeyCredential = z.infer<typeof McpApiKeyCredentialSchema>;
692
+
693
+ /** Installer-supplied MCP API keys, keyed by collection id. */
694
+ export type AppApiKeyCollectionParams = z.infer<typeof AppApiKeyCollectionParamsSchema>;
666
695
  export type AppOAuthProviderParams = z.infer<typeof AppOAuthProviderParamsSchema>;
667
696
 
668
697
  export type AppInstallationPayload = z.infer<typeof AppInstallationPayloadSchema>;
@@ -697,6 +726,15 @@ export interface McpOAuthCollectionRef {
697
726
  collection_id: string;
698
727
  }
699
728
 
729
+ /**
730
+ * Payload for storing the static bearer token of an `auth: 'api_key'` MCP collection.
731
+ * The key is write-only — it is never echoed back by any endpoint.
732
+ */
733
+ export type SetMcpApiKeyRequest = z.infer<typeof SetMcpApiKeyRequestSchema>;
734
+
735
+ /** Whether an `auth: 'api_key'` MCP collection has a key stored, plus a display-only hint. */
736
+ export type McpApiKeyStatus = z.infer<typeof McpApiKeyStatusSchema>;
737
+
700
738
  export type McpOAuthTokenRequest = z.infer<typeof McpOAuthTokenRequestSchema>;
701
739
 
702
740
  export type McpOAuthTokenResponse = z.infer<typeof McpOAuthTokenResponseSchema>;
@@ -873,15 +911,11 @@ export type ValidateUrlResponse = z.infer<typeof ValidateUrlResponseSchema>;
873
911
  * Result of DELETE /api/v1/apps/:id. With `?confirm=true` the cascade runs and
874
912
  * `deleted: true` is set; without it the endpoint returns a dry-run summary so
875
913
  * the UI can show what would be removed.
914
+ *
915
+ * Inferred from the published component rather than hand-written: the endpoint
916
+ * had been declaring `CountResult`, so response validation reported a missing
917
+ * `count` and every field here as unexpected — and in local development, where
918
+ * the check fails closed, that surfaced as a 500 raised AFTER the app was
919
+ * already deleted. Deriving the type is what keeps the two from drifting again.
876
920
  */
877
- export interface AppDeleteSummary {
878
- confirmed: boolean;
879
- app_id: string;
880
- app_name: string;
881
- versions: number;
882
- installations: number;
883
- storage_prefix: string;
884
- git_repo_url?: string;
885
- deleted: boolean;
886
- warnings: string[];
887
- }
921
+ export type AppDeleteSummary = z.infer<typeof AppDeleteSummarySchema>;
package/src/index.ts CHANGED
@@ -75,6 +75,7 @@ export type {
75
75
  ZenoBulkContentObjectExportSplitShardRequest,
76
76
  ZenoBulkContentObjectExportSplitShardResponse,
77
77
  } from './store/store.js';
78
+ export * from './sts-errors.js';
78
79
  export * from './sts-token-types.js';
79
80
  export * from './tenant.js';
80
81
  export * from './tool-execution.js';
@@ -63,6 +63,32 @@ describe('event subscription input validation', () => {
63
63
  expect(result.errors.join(' ')).toContain('timeout_ms');
64
64
  });
65
65
 
66
+ it('accepts a fully resolved app hook target', () => {
67
+ const result = getCreateEventSubscriptionValidationResult(
68
+ validCreate({
69
+ target: {
70
+ type: 'app',
71
+ app_id: 'content-app',
72
+ installation_id: 'installation-1',
73
+ hook: 'content-updated',
74
+ url: 'https://gateway.example/apps/content-app/api/hooks/content-updated',
75
+ },
76
+ }),
77
+ );
78
+ expect(result.valid).toBe(true);
79
+ });
80
+
81
+ it('requires app hook identity and URL fields', () => {
82
+ const result = getCreateEventSubscriptionValidationResult(
83
+ validCreate({ target: { type: 'app', app_id: '', installation_id: '', hook: '', url: '' } }),
84
+ );
85
+ expect(result.valid).toBe(false);
86
+ expect(result.errors.join(' ')).toContain('app_id');
87
+ expect(result.errors.join(' ')).toContain('installation_id');
88
+ expect(result.errors.join(' ')).toContain('hook');
89
+ expect(result.errors.join(' ')).toContain('url');
90
+ });
91
+
66
92
  it('requires endpoint for workflow targets', () => {
67
93
  const result = getCreateEventSubscriptionValidationResult(
68
94
  validCreate({ target: { type: 'workflow' } as never }),
@@ -163,8 +163,8 @@ function validateTarget(target: unknown, errors: string[]): void {
163
163
  return;
164
164
  }
165
165
  const type = target.type;
166
- if (type !== 'workflow' && type !== 'webhook' && type !== 'agent' && type !== 'process') {
167
- errors.push('target.type must be one of workflow, webhook, agent, process');
166
+ if (type !== 'workflow' && type !== 'webhook' && type !== 'app' && type !== 'agent' && type !== 'process') {
167
+ errors.push('target.type must be one of workflow, webhook, app, agent, process');
168
168
  return;
169
169
  }
170
170
  const t = target as EventDeliveryTargetInput;
@@ -204,6 +204,19 @@ function validateTarget(target: unknown, errors: string[]): void {
204
204
  }
205
205
  break;
206
206
  }
207
+ case 'app': {
208
+ for (const field of ['app_id', 'installation_id', 'hook', 'url'] as const) {
209
+ if (typeof t[field] !== 'string' || t[field].length === 0) {
210
+ errors.push(`app target requires a non-empty "${field}"`);
211
+ }
212
+ }
213
+ if (t.timeout_ms !== undefined) {
214
+ if (!Number.isInteger(t.timeout_ms) || t.timeout_ms <= 0 || t.timeout_ms > MAX_WEBHOOK_TIMEOUT_MS) {
215
+ errors.push(`app target.timeout_ms must be an integer between 1 and ${MAX_WEBHOOK_TIMEOUT_MS}`);
216
+ }
217
+ }
218
+ break;
219
+ }
207
220
  case 'process':
208
221
  if ((typeof t.process_ref !== 'string' || t.process_ref.length === 0) && !isRecord(t.process_definition)) {
209
222
  errors.push('process target requires "process_ref" or an inline "process_definition"');