@vertesia/common 1.6.0-dev.20261014.015055Z → 1.6.0-dev.20261022.120426Z

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 (126) hide show
  1. package/lib/api-contract/components.generated.json +1243 -121
  2. package/lib/api-schemas/agent-runs.d.ts +52 -0
  3. package/lib/api-schemas/agent-runs.d.ts.map +1 -1
  4. package/lib/api-schemas/agent-runs.js +5 -4
  5. package/lib/api-schemas/agent-runs.js.map +1 -1
  6. package/lib/api-schemas/apikey.d.ts +3 -40
  7. package/lib/api-schemas/apikey.d.ts.map +1 -1
  8. package/lib/api-schemas/apikey.js +3 -17
  9. package/lib/api-schemas/apikey.js.map +1 -1
  10. package/lib/api-schemas/app-lifecycle.d.ts +126 -0
  11. package/lib/api-schemas/app-lifecycle.d.ts.map +1 -1
  12. package/lib/api-schemas/app-lifecycle.js +134 -1
  13. package/lib/api-schemas/app-lifecycle.js.map +1 -1
  14. package/lib/api-schemas/app-runtime.d.ts +466 -0
  15. package/lib/api-schemas/app-runtime.d.ts.map +1 -1
  16. package/lib/api-schemas/app-runtime.js +50 -1
  17. package/lib/api-schemas/app-runtime.js.map +1 -1
  18. package/lib/api-schemas/apps.d.ts +73 -0
  19. package/lib/api-schemas/apps.d.ts.map +1 -1
  20. package/lib/api-schemas/apps.js +41 -0
  21. package/lib/api-schemas/apps.js.map +1 -1
  22. package/lib/api-schemas/audit-trail.d.ts.map +1 -1
  23. package/lib/api-schemas/audit-trail.js +5 -5
  24. package/lib/api-schemas/audit-trail.js.map +1 -1
  25. package/lib/api-schemas/content.d.ts +25 -0
  26. package/lib/api-schemas/content.d.ts.map +1 -1
  27. package/lib/api-schemas/content.js +5 -5
  28. package/lib/api-schemas/content.js.map +1 -1
  29. package/lib/api-schemas/data-store.d.ts.map +1 -1
  30. package/lib/api-schemas/data-store.js +17 -1
  31. package/lib/api-schemas/data-store.js.map +1 -1
  32. package/lib/api-schemas/document-processing.d.ts +15 -0
  33. package/lib/api-schemas/document-processing.d.ts.map +1 -1
  34. package/lib/api-schemas/events.d.ts +45 -0
  35. package/lib/api-schemas/events.d.ts.map +1 -1
  36. package/lib/api-schemas/inference-profile.d.ts +30 -0
  37. package/lib/api-schemas/inference-profile.d.ts.map +1 -1
  38. package/lib/api-schemas/interaction.d.ts +405 -0
  39. package/lib/api-schemas/interaction.d.ts.map +1 -1
  40. package/lib/api-schemas/interaction.js +38 -7
  41. package/lib/api-schemas/interaction.js.map +1 -1
  42. package/lib/api-schemas/oauth-server.d.ts +128 -0
  43. package/lib/api-schemas/oauth-server.d.ts.map +1 -1
  44. package/lib/api-schemas/oauth-server.js +95 -2
  45. package/lib/api-schemas/oauth-server.js.map +1 -1
  46. package/lib/api-schemas/process.d.ts +11 -0
  47. package/lib/api-schemas/process.d.ts.map +1 -1
  48. package/lib/api-schemas/process.js +12 -0
  49. package/lib/api-schemas/process.js.map +1 -1
  50. package/lib/api-schemas/project-configuration.d.ts +50 -0
  51. package/lib/api-schemas/project-configuration.d.ts.map +1 -1
  52. package/lib/api-schemas/project.d.ts +75 -0
  53. package/lib/api-schemas/project.d.ts.map +1 -1
  54. package/lib/api-schemas/prompt.d.ts.map +1 -1
  55. package/lib/api-schemas/prompt.js +5 -2
  56. package/lib/api-schemas/prompt.js.map +1 -1
  57. package/lib/api-schemas/registry.d.ts +1271 -30
  58. package/lib/api-schemas/registry.d.ts.map +1 -1
  59. package/lib/api-schemas/registry.js +39 -9
  60. package/lib/api-schemas/registry.js.map +1 -1
  61. package/lib/api-schemas/schema-primitives.d.ts +8 -0
  62. package/lib/api-schemas/schema-primitives.d.ts.map +1 -1
  63. package/lib/api-schemas/schema-primitives.js +8 -0
  64. package/lib/api-schemas/schema-primitives.js.map +1 -1
  65. package/lib/api-schemas/store.d.ts +250 -0
  66. package/lib/api-schemas/store.d.ts.map +1 -1
  67. package/lib/api-schemas/store.js +3 -3
  68. package/lib/api-schemas/store.js.map +1 -1
  69. package/lib/api-schemas/task.d.ts.map +1 -1
  70. package/lib/api-schemas/task.js +3 -2
  71. package/lib/api-schemas/task.js.map +1 -1
  72. package/lib/api-schemas/workflow-runs.d.ts +10 -0
  73. package/lib/api-schemas/workflow-runs.d.ts.map +1 -1
  74. package/lib/apikey.d.ts +7 -2
  75. package/lib/apikey.d.ts.map +1 -1
  76. package/lib/apikey.js.map +1 -1
  77. package/lib/apps.d.ts +37 -1
  78. package/lib/apps.d.ts.map +1 -1
  79. package/lib/apps.js +74 -3
  80. package/lib/apps.js.map +1 -1
  81. package/lib/interaction.d.ts +3 -3
  82. package/lib/interaction.d.ts.map +1 -1
  83. package/lib/interaction.js.map +1 -1
  84. package/lib/oauth-server.d.ts +5 -0
  85. package/lib/oauth-server.d.ts.map +1 -1
  86. package/lib/store/index.d.ts +1 -0
  87. package/lib/store/index.d.ts.map +1 -1
  88. package/lib/store/index.js +1 -0
  89. package/lib/store/index.js.map +1 -1
  90. package/lib/store/intake-policy-schema.generated.d.ts.map +1 -1
  91. package/lib/store/intake-policy-schema.generated.js +1 -2
  92. package/lib/store/intake-policy-schema.generated.js.map +1 -1
  93. package/lib/store/text-limits.d.ts +18 -0
  94. package/lib/store/text-limits.d.ts.map +1 -0
  95. package/lib/store/text-limits.js +56 -0
  96. package/lib/store/text-limits.js.map +1 -0
  97. package/lib/vertesia-common.js +4 -2
  98. package/lib/vertesia-common.js.map +1 -1
  99. package/lib/wire-types.generated.d.ts +261 -34
  100. package/lib/wire-types.generated.d.ts.map +1 -1
  101. package/package.json +12 -7
  102. package/src/api-contract/components.generated.json +1243 -121
  103. package/src/api-schemas/agent-runs.ts +5 -3
  104. package/src/api-schemas/apikey.ts +3 -21
  105. package/src/api-schemas/app-lifecycle.ts +163 -1
  106. package/src/api-schemas/app-runtime.ts +54 -0
  107. package/src/api-schemas/apps.ts +46 -0
  108. package/src/api-schemas/audit-trail.ts +5 -5
  109. package/src/api-schemas/content.ts +5 -5
  110. package/src/api-schemas/data-store.ts +19 -1
  111. package/src/api-schemas/interaction.ts +48 -7
  112. package/src/api-schemas/oauth-server.ts +103 -2
  113. package/src/api-schemas/process.ts +13 -0
  114. package/src/api-schemas/prompt.ts +5 -2
  115. package/src/api-schemas/registry.ts +60 -6
  116. package/src/api-schemas/schema-primitives.ts +9 -0
  117. package/src/api-schemas/store.ts +3 -3
  118. package/src/api-schemas/task.ts +3 -2
  119. package/src/apikey.ts +8 -2
  120. package/src/apps.ts +116 -3
  121. package/src/interaction.ts +6 -3
  122. package/src/oauth-server.ts +10 -0
  123. package/src/store/index.ts +1 -0
  124. package/src/store/intake-policy-schema.generated.ts +1 -2
  125. package/src/store/text-limits.ts +64 -0
  126. package/src/wire-types.generated.ts +281 -34
package/src/apps.ts CHANGED
@@ -1,8 +1,28 @@
1
+ import type { AuthTokenPayload } from './apikey.js';
1
2
  import type * as Wire from './wire-types.generated.js';
2
3
 
3
4
  /** Allowed values for AppUINavItem.preferredSection */
4
5
  export const PREFERRED_SECTIONS = ['default', 'footer', 'settings'] as const;
5
6
 
7
+ function trimBoundaryHyphens(value: string): string {
8
+ let start = 0;
9
+ let end = value.length;
10
+ while (start < end && value[start] === '-') start++;
11
+ while (end > start && value[end - 1] === '-') end--;
12
+ return value.slice(start, end);
13
+ }
14
+
15
+ /** Convert an app display/package name into the canonical persisted app id. */
16
+ export function slugifyAppId(value: string): string {
17
+ const normalized = value
18
+ .trim()
19
+ .toLowerCase()
20
+ .replace(/[^a-z0-9._-]+/g, '-');
21
+ const slug = trimBoundaryHyphens(normalized).slice(0, 80);
22
+ if (!slug) throw new Error('App name must contain at least one letter or number');
23
+ return slug;
24
+ }
25
+
6
26
  // The app-manifest closure is declared once, as the Zod schemas in `./api-schemas/apps.ts`, and
7
27
  // inferred below. The documentation moved with it: what a published component says about a field now
8
28
  // comes from the schema's own `.meta({ description })` rather than from a TSDoc comment a generator
@@ -41,6 +61,7 @@ export interface AppUINavItem {
41
61
  }
42
62
 
43
63
  export type AppUIConfig = Wire.AppUIConfig;
64
+ export type AppOAuthClientConfig = Wire.AppOAuthClientConfig;
44
65
 
45
66
  export type AppInstallationProjectsQuery = Wire.AppInstallationProjectsQuery;
46
67
 
@@ -81,11 +102,24 @@ function deriveMCPCollectionId(input: string): string {
81
102
  * @param vars - Optional endpoint variables to substitute in URLs
82
103
  * @returns Normalized ToolCollectionObject
83
104
  */
84
- export function normalizeToolCollection(collection: ToolCollectionObject, vars?: Endpoints): ToolCollectionObject {
105
+ export function normalizeToolCollection(
106
+ collection: ToolCollectionObject,
107
+ vars?: Endpoints,
108
+ sharedParameters?: MCPToolCollectionObject['parameters'],
109
+ ): ToolCollectionObject {
85
110
  if (!collection || typeof collection !== 'object') {
86
111
  throw new TypeError('Tool collection must be an object');
87
112
  }
88
- const substitutedUrl = vars && collection.url ? substituteEndpoints(collection.url, vars) : collection.url;
113
+ const substitutedUrl =
114
+ vars && collection.url
115
+ ? substituteEndpoints(
116
+ collection.url,
117
+ vars,
118
+ collection.type === 'mcp'
119
+ ? [...Object.keys(sharedParameters ?? {}), ...Object.keys(collection.parameters ?? {})]
120
+ : [],
121
+ )
122
+ : collection.url;
89
123
  const urlChanged = substitutedUrl !== collection.url;
90
124
  if (collection.type === 'mcp') {
91
125
  const fallbackId = deriveMCPCollectionId(collection.id || collection.name || collection.url);
@@ -191,10 +225,26 @@ export type AppBuildProgress = Wire.AppBuildProgress;
191
225
 
192
226
  export type AppScaffoldModule = Wire.AppScaffoldModule;
193
227
 
228
+ export type AppScaffoldSourceMode = Wire.AppScaffoldSourceMode;
229
+
194
230
  export type StartAppScaffoldRequest = Wire.StartAppScaffoldRequest;
195
231
 
196
232
  export type StartAppScaffoldResponse = Wire.StartAppScaffoldResponse;
197
233
 
234
+ export type AppGithubConfiguration = Wire.AppGithubConfiguration;
235
+ export type StartAppGithubAuthorizationResponse = Wire.StartAppGithubAuthorizationResponse;
236
+ export type ExchangeAppGithubAuthorizationRequest = Wire.ExchangeAppGithubAuthorizationRequest;
237
+ export type AppGithubRepositoriesQuery = Wire.AppGithubRepositoriesQuery;
238
+ export type AppGithubInstallation = Wire.AppGithubInstallation;
239
+ export type AppGithubAccount = Wire.AppGithubAccount;
240
+ export type ExchangeAppGithubAuthorizationResponse = Wire.ExchangeAppGithubAuthorizationResponse;
241
+ export type AppGithubRepository = Wire.AppGithubRepository;
242
+ export type AppGithubRepositoryCreation = Wire.AppGithubRepositoryCreation;
243
+ export type AppGithubRepositoryList = Wire.AppGithubRepositoryList;
244
+ export type AppGithubRepositorySetupQuery = Wire.AppGithubRepositorySetupQuery;
245
+ export type AppGithubBranchState = Wire.AppGithubBranchState;
246
+ export type AppGithubRepositorySetup = Wire.AppGithubRepositorySetup;
247
+
198
248
  export type StartAppDevelopmentTaskRequest = Wire.StartAppDevelopmentTaskRequest;
199
249
 
200
250
  export type AppScaffoldProgressStatus = Wire.AppScaffoldProgressStatus;
@@ -232,6 +282,7 @@ export type AppManifestData = Wire.AppManifestData;
232
282
  export type UpdateAppPayload = Wire.UpdateAppPayload;
233
283
 
234
284
  export type AppGitSourceConfig = Wire.AppGitSourceConfig;
285
+ export type AppGitSourceProvider = Wire.AppGitSourceProvider;
235
286
 
236
287
  export type AppSourceConfig = Wire.AppSourceConfig;
237
288
 
@@ -262,9 +313,11 @@ export interface Endpoints {
262
313
  * with the unresolved placeholder visible, rather than silently pointing nowhere).
263
314
  * Trailing slashes on replacement values are stripped to avoid `//api/...` joins.
264
315
  */
265
- function substituteEndpoints(url: string, endpoints?: Endpoints): string {
316
+ function substituteEndpoints(url: string, endpoints?: Endpoints, parameterNames: string[] = []): string {
266
317
  if (!url || !endpoints) return url;
267
318
  return url.replace(/\{\{\s*(\w+)\s*\}\}/g, (match, key: string) => {
319
+ // Explicit installation parameters take precedence over legacy platform endpoint placeholders.
320
+ if (parameterNames.includes(key)) return match;
268
321
  const value = (endpoints as Record<string, string | undefined>)[key];
269
322
  if (typeof value !== 'string' || !value) return match;
270
323
  return trimTrailingSlashes(value);
@@ -632,3 +685,63 @@ export type ValidateUrlResponse = Wire.ValidateUrlResponse;
632
685
  export type AppDeleteSummary = Wire.AppDeleteSummary;
633
686
 
634
687
  export type UpdateAppInstallationOAuthApprovalPayload = Wire.UpdateAppInstallationOAuthApprovalPayload;
688
+
689
+ /** Check exact installation grants; legacy app-name grants authorize only the default instance. */
690
+ export function hasAppInstallationAccess(
691
+ token: AuthTokenPayload,
692
+ installation: { id: string; project: string; instance_key?: string; manifest: { name: string } },
693
+ ui = false,
694
+ ): boolean {
695
+ if (token.project?.id !== installation.project) return false;
696
+ const grants = token.app_installations;
697
+ if (grants !== undefined) {
698
+ if (grants.version !== 1 || grants.project_id !== installation.project) return false;
699
+ if (grants.ids.includes(installation.id)) {
700
+ return !ui || !grants.ui_restrictions?.includes(installation.id);
701
+ }
702
+ }
703
+ // Default app-name grants survive reinstalling the same app with a new installation ID.
704
+ // Named instances never inherit these grants, including on refreshed running-agent tokens.
705
+ return (
706
+ (!installation.instance_key || installation.instance_key === 'default') &&
707
+ (token.apps ?? []).includes(installation.manifest.name) &&
708
+ (!ui || !token.ui_restrictions?.includes(installation.manifest.name))
709
+ );
710
+ }
711
+
712
+ /** Persist this effective collection in catalogs so discovery and execution use the same namespace. */
713
+ export function resolveInstallationCollection(
714
+ collection: ToolCollectionObject,
715
+ installation: Pick<AppInstallation, 'instance_key' | 'namespace_overrides' | 'namespace_conflicts'>,
716
+ ): ToolCollectionObject {
717
+ if (collection.type === 'mcp' && installation.namespace_conflicts?.includes(collection.id)) {
718
+ throw new Error(`Namespace conflict for MCP collection '${collection.id}'; resolve it in project app settings`);
719
+ }
720
+ if (collection.type !== 'mcp') return collection;
721
+ const overrides = installation.namespace_overrides;
722
+ if (overrides && Object.hasOwn(overrides, collection.id)) {
723
+ const namespace = overrides[collection.id];
724
+ if (typeof namespace === 'string' && namespace.length > 0) return { ...collection, namespace };
725
+ } else if (!installation.instance_key || installation.instance_key === 'default') {
726
+ return collection;
727
+ }
728
+ throw new Error(`Namespace allocation required for MCP collection '${collection.id}'`);
729
+ }
730
+
731
+ export type AppInstanceAvailability = Wire.AppInstanceAvailability;
732
+ export type McpPublicParameter = Wire.McpPublicParameter;
733
+ export type McpSecretParameter = Wire.McpSecretParameter;
734
+ export type McpConnectionParameter = Wire.McpConnectionParameter;
735
+
736
+ /** Whether a manifest can safely back an additional MCP-only installation. */
737
+ export function isMcpOnlyInstanceManifest(
738
+ manifest: Pick<AppManifestData, 'endpoint' | 'ui' | 'capabilities' | 'tool_collections'>,
739
+ ): boolean {
740
+ return (
741
+ !manifest.endpoint &&
742
+ !manifest.ui &&
743
+ !manifest.capabilities?.some((capability) => capability !== 'tools') &&
744
+ !!manifest.tool_collections?.length &&
745
+ manifest.tool_collections.every((collection) => normalizeToolCollection(collection).type === 'mcp')
746
+ );
747
+ }
@@ -2,6 +2,7 @@ import type {
2
2
  CompletionResult,
3
3
  ExecutionTokenUsage,
4
4
  JSONSchema,
5
+ // biome-ignore lint/suspicious/noDeprecatedImports: Legacy output_modality contracts still require this enum.
5
6
  Modalities,
6
7
  PromptCacheDiagnostic,
7
8
  StatelessExecutionOptions,
@@ -48,9 +49,11 @@ export interface StoredCatalogInteractionsQuery extends CatalogTagQuery {
48
49
  published?: boolean;
49
50
  }
50
51
 
51
- export interface ExecuteInteractionByEndpointQuery {
52
- tag?: string;
53
- }
52
+ export type ExecuteNamedInteractionQuery = Wire.ExecuteNamedInteractionQuery;
53
+
54
+ export type GetRunQuery = Wire.GetRunQuery;
55
+
56
+ export type ExecuteInteractionByEndpointQuery = Wire.ExecuteInteractionByEndpointQuery;
54
57
 
55
58
  export interface ExecuteInteractionByEndpointHeaders {
56
59
  'x-interaction-tag'?: string;
@@ -62,3 +62,13 @@ export type OAuthLoginPayload = Wire.OAuthLoginPayload;
62
62
  export type OAuthLoginDecisionResponse = Wire.OAuthLoginDecisionResponse;
63
63
 
64
64
  export type OAuthLoginUserNotFoundResponse = Wire.OAuthLoginUserNotFoundResponse;
65
+
66
+ export type OidcFederationConnectionPayload = Wire.OidcFederationConnectionPayload;
67
+
68
+ export type OidcFederationConnection = Wire.OidcFederationConnection;
69
+
70
+ export type OidcFederationConnectionArray = Wire.OidcFederationConnectionArray;
71
+
72
+ export type OAuthTokenExchangeRequest = Wire.OAuthTokenExchangeRequest;
73
+
74
+ export type OAuthTokenExchangeResponse = Wire.OAuthTokenExchangeResponse;
@@ -15,4 +15,5 @@ export * from './schedule.js';
15
15
  export * from './signals.js';
16
16
  export * from './store.js';
17
17
  export * from './task.js';
18
+ export * from './text-limits.js';
18
19
  export * from './workflow.js';
@@ -1236,8 +1236,7 @@ export const ContentTypeIntakePolicySchema: JSONObject = {
1236
1236
  },
1237
1237
  },
1238
1238
  effort: {
1239
- type: 'string',
1240
- enum: ['none', 'high'],
1239
+ $ref: '#/$defs/ReasoningEffort',
1241
1240
  },
1242
1241
  random_seed: {
1243
1242
  type: 'integer',
@@ -0,0 +1,64 @@
1
+ /** Maximum UTF-8 size persisted for extracted document text. */
2
+ export const MAX_EXTRACTED_TEXT_BYTES = 10 * 1024 * 1024;
3
+
4
+ /**
5
+ * Request-body allowance for the JSON envelope carrying extracted text and its source etag.
6
+ * This is transport headroom, not a larger stored-text limit.
7
+ */
8
+ export const SET_OBJECT_TEXT_BODY_LIMIT_BYTES = 16 * 1024 * 1024;
9
+
10
+ export const EXTRACTED_TEXT_TRUNCATION_MARKER = '\n\n[... truncated at max text limit 10 MiB ...]';
11
+
12
+ export interface ExtractedTextLimitResult {
13
+ text: string;
14
+ truncated: boolean;
15
+ }
16
+
17
+ /**
18
+ * Retain the largest Unicode-safe prefix that fits together with the truncation marker.
19
+ * The marker is part of the byte budget, so persisted text never exceeds the declared limit.
20
+ */
21
+ export function truncateExtractedText(text: string): ExtractedTextLimitResult {
22
+ if (utf8PrefixEnd(text, MAX_EXTRACTED_TEXT_BYTES) === text.length) {
23
+ return { text, truncated: false };
24
+ }
25
+
26
+ const markerBytes = utf8ByteLength(EXTRACTED_TEXT_TRUNCATION_MARKER);
27
+ const prefixEnd = utf8PrefixEnd(text, MAX_EXTRACTED_TEXT_BYTES - markerBytes);
28
+ return {
29
+ text: text.slice(0, prefixEnd) + EXTRACTED_TEXT_TRUNCATION_MARKER,
30
+ truncated: true,
31
+ };
32
+ }
33
+
34
+ function utf8ByteLength(text: string): number {
35
+ let bytes = 0;
36
+ for (let index = 0; index < text.length; ) {
37
+ const codePoint = text.codePointAt(index) ?? 0;
38
+ bytes += utf8CodePointBytes(codePoint);
39
+ index += codePoint > 0xffff ? 2 : 1;
40
+ }
41
+ return bytes;
42
+ }
43
+
44
+ function utf8PrefixEnd(text: string, maxBytes: number): number {
45
+ let bytes = 0;
46
+ let index = 0;
47
+ while (index < text.length) {
48
+ const codePoint = text.codePointAt(index) ?? 0;
49
+ const codePointBytes = utf8CodePointBytes(codePoint);
50
+ if (bytes + codePointBytes > maxBytes) {
51
+ break;
52
+ }
53
+ bytes += codePointBytes;
54
+ index += codePoint > 0xffff ? 2 : 1;
55
+ }
56
+ return index;
57
+ }
58
+
59
+ function utf8CodePointBytes(codePoint: number): number {
60
+ if (codePoint <= 0x7f) return 1;
61
+ if (codePoint <= 0x7ff) return 2;
62
+ if (codePoint <= 0xffff) return 3;
63
+ return 4;
64
+ }