@opengeni/contracts 2.15.2 → 3.0.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atlassian.js +10 -9
- package/dist/{chunk-NPYLOZAP.js → chunk-5LYFSZ7O.js} +12 -12
- package/dist/{chunk-6TCVR53X.js → chunk-O5LEQHDM.js} +2 -2
- package/dist/{chunk-QP3BIGSC.js → chunk-OO4AEMQB.js} +7633 -7650
- package/dist/chunk-OO4AEMQB.js.map +1 -0
- package/dist/chunk-P3HLDT77.js +59 -0
- package/dist/chunk-P3HLDT77.js.map +1 -0
- package/dist/chunk-SSWEWU3V.js +348 -0
- package/dist/chunk-SSWEWU3V.js.map +1 -0
- package/dist/chunk-TEMFILR7.js +143 -0
- package/dist/chunk-TEMFILR7.js.map +1 -0
- package/dist/connect.d.ts +325 -0
- package/dist/connect.js +182 -0
- package/dist/connect.js.map +1 -0
- package/dist/connection-authority.js +28 -334
- package/dist/connection-authority.js.map +1 -1
- package/dist/editable-artifact-codec-registry.js +2 -2
- package/dist/editable-artifact-live.js +2 -2
- package/dist/editable-artifact-serialized-commit.js +3 -3
- package/dist/editable-artifacts.js +24 -24
- package/dist/external-identities.d.ts +620 -0
- package/dist/external-identities.js +34 -0
- package/dist/external-identities.js.map +1 -0
- package/dist/google-drive.js +12 -11
- package/dist/google-drive.js.map +1 -1
- package/dist/host-mcp-bindings.d.ts +297 -0
- package/dist/host-mcp-bindings.js +195 -0
- package/dist/host-mcp-bindings.js.map +1 -0
- package/dist/index.d.ts +149 -71
- package/dist/index.js +85 -81
- package/dist/personal-github.js +10 -9
- package/dist/personal-github.js.map +1 -1
- package/package.json +13 -1
- package/src/connect.ts +202 -0
- package/src/external-identities.ts +213 -0
- package/src/host-mcp-bindings.ts +226 -0
- package/src/index.ts +158 -68
- package/dist/chunk-QP3BIGSC.js.map +0 -1
- /package/dist/{chunk-NPYLOZAP.js.map → chunk-5LYFSZ7O.js.map} +0 -0
- /package/dist/{chunk-6TCVR53X.js.map → chunk-O5LEQHDM.js.map} +0 -0
package/dist/google-drive.js
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConnectionMetadata
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OO4AEMQB.js";
|
|
4
4
|
import "./chunk-YBW5JSA3.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-O5LEQHDM.js";
|
|
6
6
|
import "./chunk-GRG7PHWQ.js";
|
|
7
7
|
import "./chunk-MRWYRAS5.js";
|
|
8
8
|
import "./chunk-3SIZGL3O.js";
|
|
9
|
+
import "./chunk-NVJMJWLL.js";
|
|
10
|
+
import "./chunk-YRKRZ6OF.js";
|
|
9
11
|
import "./chunk-JUFK3T4Q.js";
|
|
10
12
|
import "./chunk-M5ZGRVIQ.js";
|
|
11
13
|
import "./chunk-BCS7WHCK.js";
|
|
14
|
+
import "./chunk-5LYFSZ7O.js";
|
|
15
|
+
import "./chunk-Y3KNXVTD.js";
|
|
16
|
+
import "./chunk-D2HKF2EF.js";
|
|
17
|
+
import "./chunk-TXTQIYCV.js";
|
|
18
|
+
import "./chunk-RIY7GYQS.js";
|
|
19
|
+
import "./chunk-MYBZRDTY.js";
|
|
20
|
+
import "./chunk-PX3VCKAU.js";
|
|
12
21
|
import "./chunk-UGTBTPTQ.js";
|
|
13
22
|
import {
|
|
14
23
|
ConnectorDocumentDestination,
|
|
15
24
|
ConnectorDocumentDestinationSelection
|
|
16
25
|
} from "./chunk-WYBDERIY.js";
|
|
26
|
+
import "./chunk-P3HLDT77.js";
|
|
17
27
|
import "./chunk-7ABONTXE.js";
|
|
18
|
-
import "./chunk-NVJMJWLL.js";
|
|
19
|
-
import "./chunk-YRKRZ6OF.js";
|
|
20
|
-
import "./chunk-NPYLOZAP.js";
|
|
21
|
-
import "./chunk-D2HKF2EF.js";
|
|
22
|
-
import "./chunk-Y3KNXVTD.js";
|
|
23
|
-
import "./chunk-TXTQIYCV.js";
|
|
24
|
-
import "./chunk-RIY7GYQS.js";
|
|
25
|
-
import "./chunk-MYBZRDTY.js";
|
|
26
|
-
import "./chunk-PX3VCKAU.js";
|
|
27
28
|
|
|
28
29
|
// src/google-drive.ts
|
|
29
30
|
import { z } from "zod";
|
package/dist/google-drive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/google-drive.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\nimport {\n ConnectorDocumentDestination,\n ConnectorDocumentDestinationSelection,\n} from \"./connector-destinations\";\n\nexport const GOOGLE_DRIVE_PROVIDER_DOMAIN = \"googleapis.com\" as const;\nexport const GOOGLE_DRIVE_FULL_SCOPE = \"https://www.googleapis.com/auth/drive\" as const;\nexport const GOOGLE_DRIVE_FILE_SCOPE = \"https://www.googleapis.com/auth/drive.file\" as const;\nexport const GOOGLE_DRIVE_METADATA_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.metadata.readonly\" as const;\nexport const GOOGLE_DRIVE_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.readonly\" as const;\n/** Stable serialized role retained for existing connection rows; not product-facing copy. */\nexport const GOOGLE_DRIVE_CREDENTIAL_ROLE = \"google_drive_metadata\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_LABEL = \"Google Drive read-only source sync\" as const;\nexport const GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL = \"Google Drive metadata browser\" as const;\nexport const GOOGLE_DRIVE_PUBLICATION_SERVER_ID = \"google-drive-publishing\" as const;\nexport const GOOGLE_DRIVE_PUBLICATION_TOOL_NAME = \"google_drive_publish_file\" as const;\nexport const GOOGLE_DRIVE_PUBLICATION_CREATE_ACTION = \"create\" as const;\n\nexport const GoogleDriveOAuthCapability = z.enum([\n \"picker_file_read\",\n \"publish_file\",\n \"source_metadata_discovery\",\n \"source_content_read\",\n \"recursive_source_sync\",\n]);\nexport type GoogleDriveOAuthCapability = z.infer<typeof GoogleDriveOAuthCapability>;\n\nexport type GoogleDriveOAuthScopeDecision = {\n accessMode: \"file_only\" | \"metadata_readonly\" | \"readonly\" | null;\n capabilities: GoogleDriveOAuthCapability[];\n};\n\n/**\n * Converts exact Google OAuth grants into the Drive capabilities OpenGeni may\n * rely on. Unknown or malformed grants add no authority. In particular,\n * drive.file covers only files explicitly opened or shared with the app and\n * never authorizes arbitrary recursive descendant discovery.\n */\nexport function googleDriveOAuthScopeDecision(\n grantedScopes: readonly string[],\n): GoogleDriveOAuthScopeDecision {\n const granted = new Set(grantedScopes);\n const hasFullDrive = granted.has(GOOGLE_DRIVE_FULL_SCOPE);\n const hasSourceContentRead = hasFullDrive || granted.has(GOOGLE_DRIVE_READONLY_SCOPE);\n const hasFileWrite = hasFullDrive || granted.has(GOOGLE_DRIVE_FILE_SCOPE);\n const hasSourceMetadataDiscovery =\n hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);\n const hasPickerFileRead = hasSourceContentRead || hasFileWrite;\n const capabilities: GoogleDriveOAuthCapability[] = [];\n if (hasPickerFileRead) capabilities.push(\"picker_file_read\");\n if (hasFileWrite) capabilities.push(\"publish_file\");\n if (hasSourceMetadataDiscovery) capabilities.push(\"source_metadata_discovery\");\n if (hasSourceContentRead) {\n capabilities.push(\"source_content_read\", \"recursive_source_sync\");\n }\n return {\n accessMode: hasSourceContentRead\n ? \"readonly\"\n : hasSourceMetadataDiscovery\n ? \"metadata_readonly\"\n : hasFileWrite\n ? \"file_only\"\n : null,\n capabilities,\n };\n}\n\nexport function googleDriveScopesAllowCapability(\n grantedScopes: readonly string[],\n capability: GoogleDriveOAuthCapability,\n): boolean {\n return googleDriveOAuthScopeDecision(grantedScopes).capabilities.includes(capability);\n}\n\n/** @deprecated Connector document destinations use organization/workspace/personal authority. */\nexport const GoogleDriveTargetScope = z.enum([\"user\", \"workspace\", \"organization\"]);\nexport type GoogleDriveTargetScope = z.infer<typeof GoogleDriveTargetScope>;\n\nexport const GoogleDriveSyncCadence = z.enum([\"manual\", \"hourly\", \"daily\"]);\nexport type GoogleDriveSyncCadence = z.infer<typeof GoogleDriveSyncCadence>;\n\nexport const GoogleDriveReadPolicy = z.enum([\"allow\", \"ask\", \"block\"]);\nexport type GoogleDriveReadPolicy = z.infer<typeof GoogleDriveReadPolicy>;\n\nexport const GoogleDriveConnectionLifecycleState = z.enum([\n \"active\",\n \"paused\",\n \"token_revoked\",\n \"app_removed\",\n \"disconnected\",\n \"reconnect_required\",\n \"reconsent_required\",\n]);\nexport type GoogleDriveConnectionLifecycleState = z.infer<\n typeof GoogleDriveConnectionLifecycleState\n>;\n\nconst GoogleDriveLifecycleObservedAt = z.string().datetime({ offset: true });\nexport const GoogleDriveConnectionLifecycle = z.discriminatedUnion(\"state\", [\n z.object({\n state: z.literal(\"active\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"paused\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"token_revoked\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"app_removed\"),\n recoverable: z.literal(false),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"disconnected\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"reconnect_required\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"reconsent_required\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n]);\nexport type GoogleDriveConnectionLifecycle = z.infer<typeof GoogleDriveConnectionLifecycle>;\n\nexport const GoogleDriveSelectedSource = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n driveId: z.string().min(1).max(256).nullable().default(null),\n destination: ConnectorDocumentDestination.optional(),\n /** @deprecated Missing destinations resolve to the current workspace boundary. */\n targetScope: GoogleDriveTargetScope.optional(),\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n syncEnabled: z.boolean().default(false),\n configGeneration: z.number().int().positive().default(1),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n selectedAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;\n\nexport const GoogleDriveOutputDestination = z\n .object({\n folderId: z.string().min(1).max(256),\n folderName: z.string().min(1).max(1024),\n driveId: z.string().min(1).max(256).nullable(),\n location: z.enum([\"my_drive\", \"shared_drive\"]),\n selectedAt: z.string().datetime({ offset: true }),\n })\n .strict()\n .superRefine((value, context) => {\n if ((value.location === \"my_drive\") !== (value.driveId === null)) {\n context.addIssue({\n code: \"custom\",\n path: [\"driveId\"],\n message: \"Google Drive destination location does not match its drive identity\",\n });\n }\n });\nexport type GoogleDriveOutputDestination = z.infer<typeof GoogleDriveOutputDestination>;\n\nexport const GoogleDriveConnectionMetadata = z\n .object({\n credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),\n credentialLabel: z.union([\n z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),\n z.literal(GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL),\n ]),\n googlePermissionId: z.string().min(1).max(256),\n googleEmail: z.string().email().max(320),\n googleDisplayName: z.string().min(1).max(512).nullable(),\n verifiedAt: z.string().datetime({ offset: true }),\n accessMode: z.enum([\"file_only\", \"metadata_readonly\", \"readonly\"]),\n lifecycle: GoogleDriveConnectionLifecycle.optional(),\n outputDestination: GoogleDriveOutputDestination.optional(),\n documentDestination: ConnectorDocumentDestination.optional(),\n selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),\n /** @deprecated Read `selectedSources`; retained while existing connections migrate. */\n selectedSource: GoogleDriveSelectedSource.nullable().optional(),\n })\n .passthrough();\nexport type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnectionMetadata>;\n\nexport const GoogleDriveOAuthStartRequest = z.object({\n connectionId: z.string().uuid().optional(),\n capability: z.enum([\"source_read\", \"publish\"]).default(\"source_read\"),\n});\nexport type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;\n\nexport const GoogleDriveOAuthStartResponse = z.object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveOAuthStartResponse = z.infer<typeof GoogleDriveOAuthStartResponse>;\n\nexport const GoogleDriveLifecycleActionRequest = z.object({\n action: z.enum([\"pause\", \"resume\"]),\n expectedVersion: z.number().int().positive(),\n});\nexport type GoogleDriveLifecycleActionRequest = z.infer<typeof GoogleDriveLifecycleActionRequest>;\n\nexport const GoogleDriveDisconnectRequest = z.object({\n expectedVersion: z.number().int().positive(),\n idempotencyKey: z.string().trim().min(1).max(200),\n});\nexport type GoogleDriveDisconnectRequest = z.infer<typeof GoogleDriveDisconnectRequest>;\n\nexport const GoogleDrivePublicationExportFile = z\n .object({\n fileId: z.string().uuid(),\n filename: z.string().trim().min(1).max(512),\n contentType: z.string().trim().min(1).max(256),\n sizeBytes: z.number().int().positive(),\n sha256: z.string().regex(/^[0-9a-f]{64}$/u),\n artifactId: z.string().regex(/^[0-9a-f]{32}$/u),\n versionId: z.string().regex(/^[0-9a-f]{32}$/u),\n materializationJobId: z.string().regex(/^[0-9a-f]{32}$/u),\n sourceHeadSequence: z.number().int().nonnegative(),\n sourceStateHash: z.string().regex(/^sha256:[0-9a-f]{64}$/u),\n })\n .strict();\nexport type GoogleDrivePublicationExportFile = z.infer<typeof GoogleDrivePublicationExportFile>;\n\nexport const GoogleDrivePublicationToolInput = z\n .object({\n title: z.string().trim().min(1).max(512),\n modality: z.enum([\"document\", \"spreadsheet\", \"presentation\"]),\n file: GoogleDrivePublicationExportFile,\n idempotencyKey: z.string().trim().min(1).max(200),\n })\n .strict();\nexport type GoogleDrivePublicationToolInput = z.infer<typeof GoogleDrivePublicationToolInput>;\n\nexport const GoogleDrivePublicationReceipt = z\n .object({\n connectionId: z.string().uuid(),\n providerFileId: z.string().min(1).max(256),\n webViewLink: z.string().url(),\n mimeType: z.enum([\n \"application/vnd.google-apps.document\",\n \"application/vnd.google-apps.spreadsheet\",\n \"application/vnd.google-apps.presentation\",\n ]),\n destination: GoogleDriveOutputDestination,\n replayed: z.boolean(),\n })\n .strict();\nexport type GoogleDrivePublicationReceipt = z.infer<typeof GoogleDrivePublicationReceipt>;\n\nexport const GoogleDriveBrowseItem = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n kind: z.enum([\"folder\", \"file\"]),\n driveId: z.string().min(1).max(256).nullable(),\n modifiedTime: z.string().datetime({ offset: true }).nullable(),\n size: z.string().regex(/^\\d+$/).nullable(),\n webViewLink: z.string().url().nullable(),\n});\nexport type GoogleDriveBrowseItem = z.infer<typeof GoogleDriveBrowseItem>;\n\nexport const GoogleDriveBrowseResponse = z.object({\n connection: z.lazy(() => ConnectionMetadata),\n parentId: z.string().min(1).max(256),\n current: GoogleDriveBrowseItem.nullable(),\n items: z.array(GoogleDriveBrowseItem),\n nextPageToken: z.string().min(1).max(4096).nullable(),\n incompleteSearch: z.boolean(),\n});\nexport type GoogleDriveBrowseResponse = z.infer<typeof GoogleDriveBrowseResponse>;\n\nconst GoogleDriveSourceSelection = z\n .array(\n GoogleDriveBrowseItem.pick({\n id: true,\n name: true,\n mimeType: true,\n driveId: true,\n }),\n )\n .max(100)\n .refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {\n message: \"Google Drive sources must be unique\",\n });\n\nexport const SaveGoogleDriveSourceRequest = z\n .object({\n sources: GoogleDriveSourceSelection,\n destination: ConnectorDocumentDestinationSelection.optional(),\n /** @deprecated Legacy requests are accepted but resolve to workspace authority. */\n targetScope: GoogleDriveTargetScope.optional(),\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n syncEnabled: z.boolean().default(false),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n })\n .refine((request) => request.destination !== undefined || request.targetScope !== undefined, {\n message: \"Google Drive document destination is required\",\n });\nexport type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;\n\nexport const GoogleDriveKnowledgeSourceItem = z.object({\n id: z.string().min(1).max(512),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n driveId: z.string().min(1).max(512).optional(),\n sourceKind: z.enum([\"my_drive\", \"shared_drive\", \"folder\"]),\n includeDescendants: z.boolean(),\n});\nexport type GoogleDriveKnowledgeSourceItem = z.infer<typeof GoogleDriveKnowledgeSourceItem>;\n\nexport const GoogleDriveKnowledgeSourceDestination = z.object({\n authorityKind: z.enum([\"organization\", \"workspace\", \"personal\"]),\n authorityAccountId: z.string().min(1).max(128),\n authorityWorkspaceId: z.string().min(1).max(128).optional(),\n authoritySubjectId: z.string().min(1).max(512).optional(),\n collectionId: z.string().min(1).max(512).optional(),\n});\nexport type GoogleDriveKnowledgeSourceDestination = z.infer<\n typeof GoogleDriveKnowledgeSourceDestination\n>;\n\nexport const GoogleDriveKnowledgeSourceConfig = z.object({\n sources: z.array(GoogleDriveKnowledgeSourceItem).min(1).max(100),\n destination: GoogleDriveKnowledgeSourceDestination,\n syncCadence: GoogleDriveSyncCadence,\n readPolicy: GoogleDriveReadPolicy,\n});\nexport type GoogleDriveKnowledgeSourceConfig = z.infer<typeof GoogleDriveKnowledgeSourceConfig>;\n\nexport const SaveGoogleDriveIntegrationSourceRequest = z.intersection(\n SaveGoogleDriveSourceRequest,\n z.object({\n sources: GoogleDriveSourceSelection.refine((sources) => sources.length > 0, {\n message: \"At least one Google Drive source is required\",\n }),\n expectedVersion: z.number().int().positive().optional(),\n idempotencyKey: z.string().uuid(),\n }),\n);\nexport type SaveGoogleDriveIntegrationSourceRequest = z.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C7C,sBAAsB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EAC1D,oBAAoB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EACxD,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,SAAS;AACpD,CAAC;AAKM,IAAM,mCAAmC,EAAE,OAAO;AAAA,EACvD,SAAS,EAAE,MAAM,8BAA8B,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAC/D,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AACd,CAAC;AAGM,IAAM,0CAA0C,EAAE;AAAA,EACvD;AAAA,EACA,EAAE,OAAO;AAAA,IACP,SAAS,2BAA2B,OAAO,CAAC,YAAY,QAAQ,SAAS,GAAG;AAAA,MAC1E,SAAS;AAAA,IACX,CAAC;AAAA,IACD,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,IACtD,gBAAgB,EAAE,OAAO,EAAE,KAAK;AAAA,EAClC,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/google-drive.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\nimport {\n ConnectorDocumentDestination,\n ConnectorDocumentDestinationSelection,\n} from \"./connector-destinations\";\n\nexport const GOOGLE_DRIVE_PROVIDER_DOMAIN = \"googleapis.com\" as const;\nexport const GOOGLE_DRIVE_FULL_SCOPE = \"https://www.googleapis.com/auth/drive\" as const;\nexport const GOOGLE_DRIVE_FILE_SCOPE = \"https://www.googleapis.com/auth/drive.file\" as const;\nexport const GOOGLE_DRIVE_METADATA_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.metadata.readonly\" as const;\nexport const GOOGLE_DRIVE_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.readonly\" as const;\n/** Stable serialized role retained for existing connection rows; not product-facing copy. */\nexport const GOOGLE_DRIVE_CREDENTIAL_ROLE = \"google_drive_metadata\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_LABEL = \"Google Drive read-only source sync\" as const;\nexport const GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL = \"Google Drive metadata browser\" as const;\nexport const GOOGLE_DRIVE_PUBLICATION_SERVER_ID = \"google-drive-publishing\" as const;\nexport const GOOGLE_DRIVE_PUBLICATION_TOOL_NAME = \"google_drive_publish_file\" as const;\nexport const GOOGLE_DRIVE_PUBLICATION_CREATE_ACTION = \"create\" as const;\n\nexport const GoogleDriveOAuthCapability = z.enum([\n \"picker_file_read\",\n \"publish_file\",\n \"source_metadata_discovery\",\n \"source_content_read\",\n \"recursive_source_sync\",\n]);\nexport type GoogleDriveOAuthCapability = z.infer<typeof GoogleDriveOAuthCapability>;\n\nexport type GoogleDriveOAuthScopeDecision = {\n accessMode: \"file_only\" | \"metadata_readonly\" | \"readonly\" | null;\n capabilities: GoogleDriveOAuthCapability[];\n};\n\n/**\n * Converts exact Google OAuth grants into the Drive capabilities OpenGeni may\n * rely on. Unknown or malformed grants add no authority. In particular,\n * drive.file covers only files explicitly opened or shared with the app and\n * never authorizes arbitrary recursive descendant discovery.\n */\nexport function googleDriveOAuthScopeDecision(\n grantedScopes: readonly string[],\n): GoogleDriveOAuthScopeDecision {\n const granted = new Set(grantedScopes);\n const hasFullDrive = granted.has(GOOGLE_DRIVE_FULL_SCOPE);\n const hasSourceContentRead = hasFullDrive || granted.has(GOOGLE_DRIVE_READONLY_SCOPE);\n const hasFileWrite = hasFullDrive || granted.has(GOOGLE_DRIVE_FILE_SCOPE);\n const hasSourceMetadataDiscovery =\n hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);\n const hasPickerFileRead = hasSourceContentRead || hasFileWrite;\n const capabilities: GoogleDriveOAuthCapability[] = [];\n if (hasPickerFileRead) capabilities.push(\"picker_file_read\");\n if (hasFileWrite) capabilities.push(\"publish_file\");\n if (hasSourceMetadataDiscovery) capabilities.push(\"source_metadata_discovery\");\n if (hasSourceContentRead) {\n capabilities.push(\"source_content_read\", \"recursive_source_sync\");\n }\n return {\n accessMode: hasSourceContentRead\n ? \"readonly\"\n : hasSourceMetadataDiscovery\n ? \"metadata_readonly\"\n : hasFileWrite\n ? \"file_only\"\n : null,\n capabilities,\n };\n}\n\nexport function googleDriveScopesAllowCapability(\n grantedScopes: readonly string[],\n capability: GoogleDriveOAuthCapability,\n): boolean {\n return googleDriveOAuthScopeDecision(grantedScopes).capabilities.includes(capability);\n}\n\n/** @deprecated Connector document destinations use organization/workspace/personal authority. */\nexport const GoogleDriveTargetScope = z.enum([\"user\", \"workspace\", \"organization\"]);\nexport type GoogleDriveTargetScope = z.infer<typeof GoogleDriveTargetScope>;\n\nexport const GoogleDriveSyncCadence = z.enum([\"manual\", \"hourly\", \"daily\"]);\nexport type GoogleDriveSyncCadence = z.infer<typeof GoogleDriveSyncCadence>;\n\nexport const GoogleDriveReadPolicy = z.enum([\"allow\", \"ask\", \"block\"]);\nexport type GoogleDriveReadPolicy = z.infer<typeof GoogleDriveReadPolicy>;\n\nexport const GoogleDriveConnectionLifecycleState = z.enum([\n \"active\",\n \"paused\",\n \"token_revoked\",\n \"app_removed\",\n \"disconnected\",\n \"reconnect_required\",\n \"reconsent_required\",\n]);\nexport type GoogleDriveConnectionLifecycleState = z.infer<\n typeof GoogleDriveConnectionLifecycleState\n>;\n\nconst GoogleDriveLifecycleObservedAt = z.string().datetime({ offset: true });\nexport const GoogleDriveConnectionLifecycle = z.discriminatedUnion(\"state\", [\n z.object({\n state: z.literal(\"active\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"paused\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"token_revoked\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"app_removed\"),\n recoverable: z.literal(false),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"disconnected\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"reconnect_required\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"reconsent_required\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n]);\nexport type GoogleDriveConnectionLifecycle = z.infer<typeof GoogleDriveConnectionLifecycle>;\n\nexport const GoogleDriveSelectedSource = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n driveId: z.string().min(1).max(256).nullable().default(null),\n destination: ConnectorDocumentDestination.optional(),\n /** @deprecated Missing destinations resolve to the current workspace boundary. */\n targetScope: GoogleDriveTargetScope.optional(),\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n syncEnabled: z.boolean().default(false),\n configGeneration: z.number().int().positive().default(1),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n selectedAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;\n\nexport const GoogleDriveOutputDestination = z\n .object({\n folderId: z.string().min(1).max(256),\n folderName: z.string().min(1).max(1024),\n driveId: z.string().min(1).max(256).nullable(),\n location: z.enum([\"my_drive\", \"shared_drive\"]),\n selectedAt: z.string().datetime({ offset: true }),\n })\n .strict()\n .superRefine((value, context) => {\n if ((value.location === \"my_drive\") !== (value.driveId === null)) {\n context.addIssue({\n code: \"custom\",\n path: [\"driveId\"],\n message: \"Google Drive destination location does not match its drive identity\",\n });\n }\n });\nexport type GoogleDriveOutputDestination = z.infer<typeof GoogleDriveOutputDestination>;\n\nexport const GoogleDriveConnectionMetadata = z\n .object({\n credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),\n credentialLabel: z.union([\n z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),\n z.literal(GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL),\n ]),\n googlePermissionId: z.string().min(1).max(256),\n googleEmail: z.string().email().max(320),\n googleDisplayName: z.string().min(1).max(512).nullable(),\n verifiedAt: z.string().datetime({ offset: true }),\n accessMode: z.enum([\"file_only\", \"metadata_readonly\", \"readonly\"]),\n lifecycle: GoogleDriveConnectionLifecycle.optional(),\n outputDestination: GoogleDriveOutputDestination.optional(),\n documentDestination: ConnectorDocumentDestination.optional(),\n selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),\n /** @deprecated Read `selectedSources`; retained while existing connections migrate. */\n selectedSource: GoogleDriveSelectedSource.nullable().optional(),\n })\n .passthrough();\nexport type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnectionMetadata>;\n\nexport const GoogleDriveOAuthStartRequest = z.object({\n connectionId: z.string().uuid().optional(),\n capability: z.enum([\"source_read\", \"publish\"]).default(\"source_read\"),\n});\nexport type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;\n\nexport const GoogleDriveOAuthStartResponse = z.object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveOAuthStartResponse = z.infer<typeof GoogleDriveOAuthStartResponse>;\n\nexport const GoogleDriveLifecycleActionRequest = z.object({\n action: z.enum([\"pause\", \"resume\"]),\n expectedVersion: z.number().int().positive(),\n});\nexport type GoogleDriveLifecycleActionRequest = z.infer<typeof GoogleDriveLifecycleActionRequest>;\n\nexport const GoogleDriveDisconnectRequest = z.object({\n expectedVersion: z.number().int().positive(),\n idempotencyKey: z.string().trim().min(1).max(200),\n});\nexport type GoogleDriveDisconnectRequest = z.infer<typeof GoogleDriveDisconnectRequest>;\n\nexport const GoogleDrivePublicationExportFile = z\n .object({\n fileId: z.string().uuid(),\n filename: z.string().trim().min(1).max(512),\n contentType: z.string().trim().min(1).max(256),\n sizeBytes: z.number().int().positive(),\n sha256: z.string().regex(/^[0-9a-f]{64}$/u),\n artifactId: z.string().regex(/^[0-9a-f]{32}$/u),\n versionId: z.string().regex(/^[0-9a-f]{32}$/u),\n materializationJobId: z.string().regex(/^[0-9a-f]{32}$/u),\n sourceHeadSequence: z.number().int().nonnegative(),\n sourceStateHash: z.string().regex(/^sha256:[0-9a-f]{64}$/u),\n })\n .strict();\nexport type GoogleDrivePublicationExportFile = z.infer<typeof GoogleDrivePublicationExportFile>;\n\nexport const GoogleDrivePublicationToolInput = z\n .object({\n title: z.string().trim().min(1).max(512),\n modality: z.enum([\"document\", \"spreadsheet\", \"presentation\"]),\n file: GoogleDrivePublicationExportFile,\n idempotencyKey: z.string().trim().min(1).max(200),\n })\n .strict();\nexport type GoogleDrivePublicationToolInput = z.infer<typeof GoogleDrivePublicationToolInput>;\n\nexport const GoogleDrivePublicationReceipt = z\n .object({\n connectionId: z.string().uuid(),\n providerFileId: z.string().min(1).max(256),\n webViewLink: z.string().url(),\n mimeType: z.enum([\n \"application/vnd.google-apps.document\",\n \"application/vnd.google-apps.spreadsheet\",\n \"application/vnd.google-apps.presentation\",\n ]),\n destination: GoogleDriveOutputDestination,\n replayed: z.boolean(),\n })\n .strict();\nexport type GoogleDrivePublicationReceipt = z.infer<typeof GoogleDrivePublicationReceipt>;\n\nexport const GoogleDriveBrowseItem = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n kind: z.enum([\"folder\", \"file\"]),\n driveId: z.string().min(1).max(256).nullable(),\n modifiedTime: z.string().datetime({ offset: true }).nullable(),\n size: z.string().regex(/^\\d+$/).nullable(),\n webViewLink: z.string().url().nullable(),\n});\nexport type GoogleDriveBrowseItem = z.infer<typeof GoogleDriveBrowseItem>;\n\nexport const GoogleDriveBrowseResponse = z.object({\n connection: z.lazy(() => ConnectionMetadata),\n parentId: z.string().min(1).max(256),\n current: GoogleDriveBrowseItem.nullable(),\n items: z.array(GoogleDriveBrowseItem),\n nextPageToken: z.string().min(1).max(4096).nullable(),\n incompleteSearch: z.boolean(),\n});\nexport type GoogleDriveBrowseResponse = z.infer<typeof GoogleDriveBrowseResponse>;\n\nconst GoogleDriveSourceSelection = z\n .array(\n GoogleDriveBrowseItem.pick({\n id: true,\n name: true,\n mimeType: true,\n driveId: true,\n }),\n )\n .max(100)\n .refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {\n message: \"Google Drive sources must be unique\",\n });\n\nexport const SaveGoogleDriveSourceRequest = z\n .object({\n sources: GoogleDriveSourceSelection,\n destination: ConnectorDocumentDestinationSelection.optional(),\n /** @deprecated Legacy requests are accepted but resolve to workspace authority. */\n targetScope: GoogleDriveTargetScope.optional(),\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n syncEnabled: z.boolean().default(false),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n })\n .refine((request) => request.destination !== undefined || request.targetScope !== undefined, {\n message: \"Google Drive document destination is required\",\n });\nexport type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;\n\nexport const GoogleDriveKnowledgeSourceItem = z.object({\n id: z.string().min(1).max(512),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n driveId: z.string().min(1).max(512).optional(),\n sourceKind: z.enum([\"my_drive\", \"shared_drive\", \"folder\"]),\n includeDescendants: z.boolean(),\n});\nexport type GoogleDriveKnowledgeSourceItem = z.infer<typeof GoogleDriveKnowledgeSourceItem>;\n\nexport const GoogleDriveKnowledgeSourceDestination = z.object({\n authorityKind: z.enum([\"organization\", \"workspace\", \"personal\"]),\n authorityAccountId: z.string().min(1).max(128),\n authorityWorkspaceId: z.string().min(1).max(128).optional(),\n authoritySubjectId: z.string().min(1).max(512).optional(),\n collectionId: z.string().min(1).max(512).optional(),\n});\nexport type GoogleDriveKnowledgeSourceDestination = z.infer<\n typeof GoogleDriveKnowledgeSourceDestination\n>;\n\nexport const GoogleDriveKnowledgeSourceConfig = z.object({\n sources: z.array(GoogleDriveKnowledgeSourceItem).min(1).max(100),\n destination: GoogleDriveKnowledgeSourceDestination,\n syncCadence: GoogleDriveSyncCadence,\n readPolicy: GoogleDriveReadPolicy,\n});\nexport type GoogleDriveKnowledgeSourceConfig = z.infer<typeof GoogleDriveKnowledgeSourceConfig>;\n\nexport const SaveGoogleDriveIntegrationSourceRequest = z.intersection(\n SaveGoogleDriveSourceRequest,\n z.object({\n sources: GoogleDriveSourceSelection.refine((sources) => sources.length > 0, {\n message: \"At least one Google Drive source is required\",\n }),\n expectedVersion: z.number().int().positive().optional(),\n idempotencyKey: z.string().uuid(),\n }),\n);\nexport type SaveGoogleDriveIntegrationSourceRequest = z.infer<\n typeof SaveGoogleDriveIntegrationSourceRequest\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAQX,IAAM,+BAA+B;AACrC,IAAM,0BAA0B;AAChC,IAAM,0BAA0B;AAChC,IAAM,uCACX;AACK,IAAM,8BACX;AAEK,IAAM,+BAA+B;AACrC,IAAM,gCAAgC;AACtC,IAAM,uCAAuC;AAC7C,IAAM,qCAAqC;AAC3C,IAAM,qCAAqC;AAC3C,IAAM,yCAAyC;AAE/C,IAAM,6BAA6B,EAAE,KAAK;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAcM,SAAS,8BACd,eAC+B;AAC/B,QAAM,UAAU,IAAI,IAAI,aAAa;AACrC,QAAM,eAAe,QAAQ,IAAI,uBAAuB;AACxD,QAAM,uBAAuB,gBAAgB,QAAQ,IAAI,2BAA2B;AACpF,QAAM,eAAe,gBAAgB,QAAQ,IAAI,uBAAuB;AACxE,QAAM,6BACJ,wBAAwB,QAAQ,IAAI,oCAAoC;AAC1E,QAAM,oBAAoB,wBAAwB;AAClD,QAAM,eAA6C,CAAC;AACpD,MAAI,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|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export { HostMcpCreateSelections, type HostMcpCreateSelection } from "./index.js";
|
|
3
|
+
export declare const HostMcpOwnerSubject: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
4
|
+
/** Credential-free, immutable destination and host connection selection. */
|
|
5
|
+
export declare const HostMcpBindingDefinition: z.ZodObject<{
|
|
6
|
+
serverId: z.ZodString;
|
|
7
|
+
destinationUrl: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
8
|
+
connectionRef: z.ZodObject<{
|
|
9
|
+
connectionId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
authoritySource: z.ZodOptional<z.ZodLiteral<"host">>;
|
|
11
|
+
hostBinding: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
bindingId: z.ZodString;
|
|
13
|
+
generation: z.ZodNumber;
|
|
14
|
+
}, z.core.$strict>>;
|
|
15
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
16
|
+
providerDomain: z.ZodString;
|
|
17
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
18
|
+
api_key: "api_key";
|
|
19
|
+
app_install: "app_install";
|
|
20
|
+
delegated: "delegated";
|
|
21
|
+
oauth2: "oauth2";
|
|
22
|
+
}>>;
|
|
23
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
25
|
+
selectedResources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
26
|
+
id: z.ZodString;
|
|
27
|
+
kind: z.ZodLiteral<"repository">;
|
|
28
|
+
}, z.core.$strict>>>;
|
|
29
|
+
subjectScope: z.ZodOptional<z.ZodEnum<{
|
|
30
|
+
subject: "subject";
|
|
31
|
+
workspace: "workspace";
|
|
32
|
+
}>>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
export type HostMcpBindingDefinition = z.infer<typeof HostMcpBindingDefinition>;
|
|
36
|
+
export declare const HostMcpBinding: z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
accountId: z.ZodString;
|
|
39
|
+
workspaceId: z.ZodString;
|
|
40
|
+
ownerSubjectId: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
41
|
+
authorizationRevision: z.ZodNumber;
|
|
42
|
+
generation: z.ZodNumber;
|
|
43
|
+
status: z.ZodEnum<{
|
|
44
|
+
active: "active";
|
|
45
|
+
revoked: "revoked";
|
|
46
|
+
}>;
|
|
47
|
+
definition: z.ZodObject<{
|
|
48
|
+
serverId: z.ZodString;
|
|
49
|
+
destinationUrl: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
50
|
+
connectionRef: z.ZodObject<{
|
|
51
|
+
connectionId: z.ZodOptional<z.ZodString>;
|
|
52
|
+
authoritySource: z.ZodOptional<z.ZodLiteral<"host">>;
|
|
53
|
+
hostBinding: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
bindingId: z.ZodString;
|
|
55
|
+
generation: z.ZodNumber;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
58
|
+
providerDomain: z.ZodString;
|
|
59
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
60
|
+
api_key: "api_key";
|
|
61
|
+
app_install: "app_install";
|
|
62
|
+
delegated: "delegated";
|
|
63
|
+
oauth2: "oauth2";
|
|
64
|
+
}>>;
|
|
65
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
67
|
+
selectedResources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
68
|
+
id: z.ZodString;
|
|
69
|
+
kind: z.ZodLiteral<"repository">;
|
|
70
|
+
}, z.core.$strict>>>;
|
|
71
|
+
subjectScope: z.ZodOptional<z.ZodEnum<{
|
|
72
|
+
subject: "subject";
|
|
73
|
+
workspace: "workspace";
|
|
74
|
+
}>>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
createdAt: z.ZodString;
|
|
78
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
export type HostMcpBinding = z.infer<typeof HostMcpBinding>;
|
|
81
|
+
export declare const CreateHostMcpBindingRequest: z.ZodObject<{
|
|
82
|
+
operationId: z.ZodString;
|
|
83
|
+
definition: z.ZodObject<{
|
|
84
|
+
serverId: z.ZodString;
|
|
85
|
+
destinationUrl: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
86
|
+
connectionRef: z.ZodObject<{
|
|
87
|
+
connectionId: z.ZodOptional<z.ZodString>;
|
|
88
|
+
authoritySource: z.ZodOptional<z.ZodLiteral<"host">>;
|
|
89
|
+
hostBinding: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
bindingId: z.ZodString;
|
|
91
|
+
generation: z.ZodNumber;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
94
|
+
providerDomain: z.ZodString;
|
|
95
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
96
|
+
api_key: "api_key";
|
|
97
|
+
app_install: "app_install";
|
|
98
|
+
delegated: "delegated";
|
|
99
|
+
oauth2: "oauth2";
|
|
100
|
+
}>>;
|
|
101
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
102
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
103
|
+
selectedResources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
kind: z.ZodLiteral<"repository">;
|
|
106
|
+
}, z.core.$strict>>>;
|
|
107
|
+
subjectScope: z.ZodOptional<z.ZodEnum<{
|
|
108
|
+
subject: "subject";
|
|
109
|
+
workspace: "workspace";
|
|
110
|
+
}>>;
|
|
111
|
+
}, z.core.$strict>;
|
|
112
|
+
}, z.core.$strict>;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
export type CreateHostMcpBindingRequest = z.infer<typeof CreateHostMcpBindingRequest>;
|
|
115
|
+
export declare const IssueHostMcpDelegationRequest: z.ZodObject<{
|
|
116
|
+
operationId: z.ZodString;
|
|
117
|
+
bindingId: z.ZodString;
|
|
118
|
+
expectedBindingGeneration: z.ZodNumber;
|
|
119
|
+
grant: z.ZodObject<{
|
|
120
|
+
scope: z.ZodLiteral<"user">;
|
|
121
|
+
mode: z.ZodEnum<{
|
|
122
|
+
always: "always";
|
|
123
|
+
session: "session";
|
|
124
|
+
}>;
|
|
125
|
+
context: z.ZodEnum<{
|
|
126
|
+
user_private: "user_private";
|
|
127
|
+
workspace_shared: "workspace_shared";
|
|
128
|
+
}>;
|
|
129
|
+
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
130
|
+
expectedAuthorityEpoch: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
131
|
+
workspaceSharedAcknowledged: z.ZodDefault<z.ZodBoolean>;
|
|
132
|
+
}, z.core.$strict>;
|
|
133
|
+
}, z.core.$strict>;
|
|
134
|
+
export type IssueHostMcpDelegationRequest = z.infer<typeof IssueHostMcpDelegationRequest>;
|
|
135
|
+
export declare const HostMcpDelegation: z.ZodObject<{
|
|
136
|
+
id: z.ZodString;
|
|
137
|
+
accountId: z.ZodString;
|
|
138
|
+
workspaceId: z.ZodString;
|
|
139
|
+
ownerSubjectId: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
140
|
+
ownerAuthorizationRevision: z.ZodNumber;
|
|
141
|
+
bindingId: z.ZodString;
|
|
142
|
+
bindingGeneration: z.ZodNumber;
|
|
143
|
+
grant: z.ZodObject<{
|
|
144
|
+
scope: z.ZodLiteral<"user">;
|
|
145
|
+
mode: z.ZodEnum<{
|
|
146
|
+
always: "always";
|
|
147
|
+
session: "session";
|
|
148
|
+
}>;
|
|
149
|
+
context: z.ZodEnum<{
|
|
150
|
+
user_private: "user_private";
|
|
151
|
+
workspace_shared: "workspace_shared";
|
|
152
|
+
}>;
|
|
153
|
+
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
154
|
+
expectedAuthorityEpoch: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
155
|
+
workspaceSharedAcknowledged: z.ZodDefault<z.ZodBoolean>;
|
|
156
|
+
}, z.core.$strict>;
|
|
157
|
+
generation: z.ZodNumber;
|
|
158
|
+
status: z.ZodEnum<{
|
|
159
|
+
active: "active";
|
|
160
|
+
revoked: "revoked";
|
|
161
|
+
}>;
|
|
162
|
+
createdAt: z.ZodString;
|
|
163
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
164
|
+
}, z.core.$strict>;
|
|
165
|
+
export type HostMcpDelegation = z.infer<typeof HostMcpDelegation>;
|
|
166
|
+
/** Internal admission evidence, not a caller-supplied permission or credential.
|
|
167
|
+
* Persistence must construct this from live authenticated authority and freeze
|
|
168
|
+
* it with accepted work. Runtime use must independently revalidate that work,
|
|
169
|
+
* membership, binding and delegation. No API key is retained as execution rights.
|
|
170
|
+
*/
|
|
171
|
+
export declare const HostMcpAcceptedAuthority: z.ZodObject<{
|
|
172
|
+
version: z.ZodLiteral<1>;
|
|
173
|
+
accountId: z.ZodString;
|
|
174
|
+
workspaceId: z.ZodString;
|
|
175
|
+
targetSessionId: z.ZodString;
|
|
176
|
+
targetSessionVisibility: z.ZodEnum<{
|
|
177
|
+
user_private: "user_private";
|
|
178
|
+
workspace_shared: "workspace_shared";
|
|
179
|
+
}>;
|
|
180
|
+
targetSessionAuthorityEpoch: z.ZodNumber;
|
|
181
|
+
acceptedWork: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
182
|
+
kind: z.ZodLiteral<"turn">;
|
|
183
|
+
turnId: z.ZodString;
|
|
184
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
185
|
+
kind: z.ZodLiteral<"scheduled_task">;
|
|
186
|
+
taskId: z.ZodString;
|
|
187
|
+
taskAuthorityRevision: z.ZodNumber;
|
|
188
|
+
runId: z.ZodString;
|
|
189
|
+
}, z.core.$strict>], "kind">;
|
|
190
|
+
bindingId: z.ZodString;
|
|
191
|
+
bindingGeneration: z.ZodNumber;
|
|
192
|
+
definition: z.ZodObject<{
|
|
193
|
+
serverId: z.ZodString;
|
|
194
|
+
destinationUrl: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
195
|
+
connectionRef: z.ZodObject<{
|
|
196
|
+
connectionId: z.ZodOptional<z.ZodString>;
|
|
197
|
+
authoritySource: z.ZodOptional<z.ZodLiteral<"host">>;
|
|
198
|
+
hostBinding: z.ZodOptional<z.ZodObject<{
|
|
199
|
+
bindingId: z.ZodString;
|
|
200
|
+
generation: z.ZodNumber;
|
|
201
|
+
}, z.core.$strict>>;
|
|
202
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
203
|
+
providerDomain: z.ZodString;
|
|
204
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
205
|
+
api_key: "api_key";
|
|
206
|
+
app_install: "app_install";
|
|
207
|
+
delegated: "delegated";
|
|
208
|
+
oauth2: "oauth2";
|
|
209
|
+
}>>;
|
|
210
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
211
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
212
|
+
selectedResources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
kind: z.ZodLiteral<"repository">;
|
|
215
|
+
}, z.core.$strict>>>;
|
|
216
|
+
subjectScope: z.ZodOptional<z.ZodEnum<{
|
|
217
|
+
subject: "subject";
|
|
218
|
+
workspace: "workspace";
|
|
219
|
+
}>>;
|
|
220
|
+
}, z.core.$strict>;
|
|
221
|
+
}, z.core.$strict>;
|
|
222
|
+
ownerSubjectId: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
223
|
+
ownerOrganizationMembershipId: z.ZodString;
|
|
224
|
+
ownerMembershipAuthorizationRevision: z.ZodNumber;
|
|
225
|
+
delegationId: z.ZodString;
|
|
226
|
+
delegationGeneration: z.ZodNumber;
|
|
227
|
+
scheduledOrigin: z.ZodOptional<z.ZodObject<{
|
|
228
|
+
taskId: z.ZodString;
|
|
229
|
+
taskAuthorityRevision: z.ZodNumber;
|
|
230
|
+
runId: z.ZodString;
|
|
231
|
+
}, z.core.$strict>>;
|
|
232
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
233
|
+
kind: z.ZodLiteral<"direct">;
|
|
234
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
235
|
+
kind: z.ZodLiteral<"scheduled_task">;
|
|
236
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
237
|
+
kind: z.ZodLiteral<"child_turn">;
|
|
238
|
+
sessionId: z.ZodString;
|
|
239
|
+
turnId: z.ZodString;
|
|
240
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
241
|
+
kind: z.ZodLiteral<"inherited_turn">;
|
|
242
|
+
sessionId: z.ZodString;
|
|
243
|
+
turnId: z.ZodString;
|
|
244
|
+
}, z.core.$strict>], "kind">;
|
|
245
|
+
}, z.core.$strict>;
|
|
246
|
+
export type HostMcpAcceptedAuthority = z.infer<typeof HostMcpAcceptedAuthority>;
|
|
247
|
+
/** Credential-free selection frozen on one immutable scheduled-task revision. */
|
|
248
|
+
export declare const HostMcpTaskAuthority: z.ZodObject<{
|
|
249
|
+
version: z.ZodLiteral<1>;
|
|
250
|
+
accountId: z.ZodString;
|
|
251
|
+
workspaceId: z.ZodString;
|
|
252
|
+
taskId: z.ZodString;
|
|
253
|
+
taskAuthorityRevision: z.ZodNumber;
|
|
254
|
+
taskExecutionDigest: z.ZodString;
|
|
255
|
+
ownerSubjectId: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
256
|
+
ownerOrganizationMembershipId: z.ZodString;
|
|
257
|
+
ownerMembershipAuthorizationRevision: z.ZodNumber;
|
|
258
|
+
bindingId: z.ZodString;
|
|
259
|
+
bindingGeneration: z.ZodNumber;
|
|
260
|
+
delegationId: z.ZodString;
|
|
261
|
+
delegationGeneration: z.ZodNumber;
|
|
262
|
+
definition: z.ZodObject<{
|
|
263
|
+
serverId: z.ZodString;
|
|
264
|
+
destinationUrl: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
265
|
+
connectionRef: z.ZodObject<{
|
|
266
|
+
connectionId: z.ZodOptional<z.ZodString>;
|
|
267
|
+
authoritySource: z.ZodOptional<z.ZodLiteral<"host">>;
|
|
268
|
+
hostBinding: z.ZodOptional<z.ZodObject<{
|
|
269
|
+
bindingId: z.ZodString;
|
|
270
|
+
generation: z.ZodNumber;
|
|
271
|
+
}, z.core.$strict>>;
|
|
272
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
273
|
+
providerDomain: z.ZodString;
|
|
274
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
275
|
+
api_key: "api_key";
|
|
276
|
+
app_install: "app_install";
|
|
277
|
+
delegated: "delegated";
|
|
278
|
+
oauth2: "oauth2";
|
|
279
|
+
}>>;
|
|
280
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
281
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
282
|
+
selectedResources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
283
|
+
id: z.ZodString;
|
|
284
|
+
kind: z.ZodLiteral<"repository">;
|
|
285
|
+
}, z.core.$strict>>>;
|
|
286
|
+
subjectScope: z.ZodOptional<z.ZodEnum<{
|
|
287
|
+
subject: "subject";
|
|
288
|
+
workspace: "workspace";
|
|
289
|
+
}>>;
|
|
290
|
+
}, z.core.$strict>;
|
|
291
|
+
}, z.core.$strict>;
|
|
292
|
+
context: z.ZodEnum<{
|
|
293
|
+
user_private: "user_private";
|
|
294
|
+
workspace_shared: "workspace_shared";
|
|
295
|
+
}>;
|
|
296
|
+
}, z.core.$strict>;
|
|
297
|
+
export type HostMcpTaskAuthority = z.infer<typeof HostMcpTaskAuthority>;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConnectionUseAuthoritySnapshot,
|
|
3
|
+
IssueConnectionUseGrantRequest
|
|
4
|
+
} from "./chunk-SSWEWU3V.js";
|
|
5
|
+
import {
|
|
6
|
+
HostMcpCreateSelections,
|
|
7
|
+
McpServerConnectionRef,
|
|
8
|
+
SessionTenancyVisibility
|
|
9
|
+
} from "./chunk-OO4AEMQB.js";
|
|
10
|
+
import "./chunk-YBW5JSA3.js";
|
|
11
|
+
import "./chunk-O5LEQHDM.js";
|
|
12
|
+
import "./chunk-GRG7PHWQ.js";
|
|
13
|
+
import "./chunk-MRWYRAS5.js";
|
|
14
|
+
import "./chunk-3SIZGL3O.js";
|
|
15
|
+
import "./chunk-NVJMJWLL.js";
|
|
16
|
+
import "./chunk-YRKRZ6OF.js";
|
|
17
|
+
import "./chunk-JUFK3T4Q.js";
|
|
18
|
+
import "./chunk-M5ZGRVIQ.js";
|
|
19
|
+
import "./chunk-BCS7WHCK.js";
|
|
20
|
+
import "./chunk-5LYFSZ7O.js";
|
|
21
|
+
import "./chunk-Y3KNXVTD.js";
|
|
22
|
+
import "./chunk-D2HKF2EF.js";
|
|
23
|
+
import "./chunk-TXTQIYCV.js";
|
|
24
|
+
import "./chunk-RIY7GYQS.js";
|
|
25
|
+
import "./chunk-MYBZRDTY.js";
|
|
26
|
+
import "./chunk-PX3VCKAU.js";
|
|
27
|
+
import "./chunk-UGTBTPTQ.js";
|
|
28
|
+
import "./chunk-WYBDERIY.js";
|
|
29
|
+
import {
|
|
30
|
+
ExternalIdentity
|
|
31
|
+
} from "./chunk-TEMFILR7.js";
|
|
32
|
+
import "./chunk-P3HLDT77.js";
|
|
33
|
+
import "./chunk-7ABONTXE.js";
|
|
34
|
+
|
|
35
|
+
// src/host-mcp-bindings.ts
|
|
36
|
+
import { z } from "zod";
|
|
37
|
+
var HostMcpOwnerSubject = z.union([
|
|
38
|
+
ExternalIdentity.shape.subjectId,
|
|
39
|
+
z.string().max(4096).regex(/^user:[^\r\n\u0000]+$/)
|
|
40
|
+
]);
|
|
41
|
+
var HostMcpBindingDefinition = z.object({
|
|
42
|
+
serverId: z.string().min(1).max(256),
|
|
43
|
+
destinationUrl: z.string().url().max(4096).refine((value) => {
|
|
44
|
+
const url = new URL(value);
|
|
45
|
+
return url.protocol === "https:" && !url.username && !url.password && !url.hash;
|
|
46
|
+
}, "Host binding requires an HTTPS destination without userinfo or fragment").transform((value) => new URL(value).toString()),
|
|
47
|
+
connectionRef: McpServerConnectionRef
|
|
48
|
+
}).strict().superRefine((value, context) => {
|
|
49
|
+
if (value.connectionRef.hostBinding)
|
|
50
|
+
context.addIssue({
|
|
51
|
+
code: "custom",
|
|
52
|
+
path: ["connectionRef", "hostBinding"],
|
|
53
|
+
message: "A binding definition cannot reference another binding"
|
|
54
|
+
});
|
|
55
|
+
if (value.connectionRef.authoritySource !== "host" || !value.connectionRef.connectionId)
|
|
56
|
+
context.addIssue({
|
|
57
|
+
code: "custom",
|
|
58
|
+
path: ["connectionRef"],
|
|
59
|
+
message: "Explicit host connection authority is required"
|
|
60
|
+
});
|
|
61
|
+
if (new TextEncoder().encode(JSON.stringify(value)).byteLength > 65536)
|
|
62
|
+
context.addIssue({ code: "custom", message: "Host binding definition exceeds 64 KiB" });
|
|
63
|
+
});
|
|
64
|
+
var HostMcpBinding = z.object({
|
|
65
|
+
id: z.string().uuid(),
|
|
66
|
+
accountId: z.string().uuid(),
|
|
67
|
+
workspaceId: z.string().uuid(),
|
|
68
|
+
ownerSubjectId: HostMcpOwnerSubject,
|
|
69
|
+
authorizationRevision: z.number().int().positive().safe(),
|
|
70
|
+
generation: z.number().int().positive().safe(),
|
|
71
|
+
status: z.enum(["active", "revoked"]),
|
|
72
|
+
definition: HostMcpBindingDefinition,
|
|
73
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
74
|
+
revokedAt: z.string().datetime({ offset: true }).nullable()
|
|
75
|
+
}).strict();
|
|
76
|
+
var CreateHostMcpBindingRequest = z.object({
|
|
77
|
+
operationId: z.string().uuid(),
|
|
78
|
+
definition: HostMcpBindingDefinition
|
|
79
|
+
}).strict();
|
|
80
|
+
var HostMcpDelegationGrant = IssueConnectionUseGrantRequest.superRefine((value, context) => {
|
|
81
|
+
if (Boolean(value.sessionId) !== (value.expectedAuthorityEpoch != null) || value.expectedAuthorityEpoch != null && !Number.isSafeInteger(value.expectedAuthorityEpoch)) {
|
|
82
|
+
context.addIssue({
|
|
83
|
+
code: "custom",
|
|
84
|
+
message: "Host session grants require a matching safe authority epoch"
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
var IssueHostMcpDelegationRequest = z.object({
|
|
89
|
+
operationId: z.string().uuid(),
|
|
90
|
+
bindingId: z.string().uuid(),
|
|
91
|
+
expectedBindingGeneration: z.number().int().positive().safe(),
|
|
92
|
+
grant: HostMcpDelegationGrant
|
|
93
|
+
}).strict();
|
|
94
|
+
var HostMcpDelegation = z.object({
|
|
95
|
+
id: z.string().uuid(),
|
|
96
|
+
accountId: z.string().uuid(),
|
|
97
|
+
workspaceId: z.string().uuid(),
|
|
98
|
+
ownerSubjectId: HostMcpOwnerSubject,
|
|
99
|
+
ownerAuthorizationRevision: z.number().int().positive().safe(),
|
|
100
|
+
bindingId: z.string().uuid(),
|
|
101
|
+
bindingGeneration: z.number().int().positive().safe(),
|
|
102
|
+
grant: HostMcpDelegationGrant,
|
|
103
|
+
generation: z.number().int().positive().safe(),
|
|
104
|
+
status: z.enum(["active", "revoked"]),
|
|
105
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
106
|
+
revokedAt: z.string().datetime({ offset: true }).nullable()
|
|
107
|
+
}).strict();
|
|
108
|
+
var HostMcpAcceptedAuthority = z.object({
|
|
109
|
+
version: z.literal(1),
|
|
110
|
+
accountId: z.string().uuid(),
|
|
111
|
+
workspaceId: z.string().uuid(),
|
|
112
|
+
targetSessionId: z.string().uuid(),
|
|
113
|
+
targetSessionVisibility: SessionTenancyVisibility,
|
|
114
|
+
targetSessionAuthorityEpoch: z.number().int().positive().safe(),
|
|
115
|
+
acceptedWork: ConnectionUseAuthoritySnapshot.shape.acceptedWork,
|
|
116
|
+
bindingId: z.string().uuid(),
|
|
117
|
+
bindingGeneration: z.number().int().positive().safe(),
|
|
118
|
+
definition: HostMcpBindingDefinition,
|
|
119
|
+
ownerSubjectId: HostMcpOwnerSubject,
|
|
120
|
+
ownerOrganizationMembershipId: z.string().uuid(),
|
|
121
|
+
ownerMembershipAuthorizationRevision: z.number().int().positive().safe(),
|
|
122
|
+
delegationId: z.string().uuid(),
|
|
123
|
+
delegationGeneration: z.number().int().positive().safe(),
|
|
124
|
+
scheduledOrigin: z.object({
|
|
125
|
+
taskId: z.string().uuid(),
|
|
126
|
+
taskAuthorityRevision: z.number().int().positive().safe(),
|
|
127
|
+
runId: z.string().uuid()
|
|
128
|
+
}).strict().optional(),
|
|
129
|
+
source: z.discriminatedUnion("kind", [
|
|
130
|
+
z.object({ kind: z.literal("direct") }).strict(),
|
|
131
|
+
z.object({ kind: z.literal("scheduled_task") }).strict(),
|
|
132
|
+
z.object({
|
|
133
|
+
kind: z.literal("child_turn"),
|
|
134
|
+
sessionId: z.string().uuid(),
|
|
135
|
+
turnId: z.string().uuid()
|
|
136
|
+
}).strict(),
|
|
137
|
+
z.object({
|
|
138
|
+
kind: z.literal("inherited_turn"),
|
|
139
|
+
sessionId: z.string().uuid(),
|
|
140
|
+
turnId: z.string().uuid()
|
|
141
|
+
}).strict()
|
|
142
|
+
])
|
|
143
|
+
}).strict().superRefine((value, context) => {
|
|
144
|
+
if (value.source.kind === "direct" && value.scheduledOrigin || value.source.kind === "scheduled_task" && (!value.scheduledOrigin || value.acceptedWork.kind !== "scheduled_task" || value.scheduledOrigin.taskId !== value.acceptedWork.taskId || value.scheduledOrigin.runId !== value.acceptedWork.runId || value.scheduledOrigin.taskAuthorityRevision !== value.acceptedWork.taskAuthorityRevision))
|
|
145
|
+
context.addIssue({
|
|
146
|
+
code: "custom",
|
|
147
|
+
message: "Scheduled host authority must retain its exact run origin"
|
|
148
|
+
});
|
|
149
|
+
if (value.acceptedWork.kind === "turn" && value.source.kind === "inherited_turn" && value.acceptedWork.turnId === value.source.turnId) {
|
|
150
|
+
context.addIssue({
|
|
151
|
+
code: "custom",
|
|
152
|
+
path: ["source"],
|
|
153
|
+
message: "Accepted work cannot inherit from itself"
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (value.acceptedWork.kind === "scheduled_task" && !Number.isSafeInteger(value.acceptedWork.taskAuthorityRevision)) {
|
|
157
|
+
context.addIssue({
|
|
158
|
+
code: "custom",
|
|
159
|
+
path: ["acceptedWork"],
|
|
160
|
+
message: "Task authority revision must be a safe integer"
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
if (new TextEncoder().encode(JSON.stringify(value)).byteLength > 65536) {
|
|
164
|
+
context.addIssue({ code: "custom", message: "Host accepted authority exceeds 64 KiB" });
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
var HostMcpTaskAuthority = z.object({
|
|
168
|
+
version: z.literal(1),
|
|
169
|
+
accountId: z.string().uuid(),
|
|
170
|
+
workspaceId: z.string().uuid(),
|
|
171
|
+
taskId: z.string().uuid(),
|
|
172
|
+
taskAuthorityRevision: z.number().int().positive().safe(),
|
|
173
|
+
taskExecutionDigest: z.string().regex(/^[0-9a-f]{64}$/),
|
|
174
|
+
ownerSubjectId: HostMcpOwnerSubject,
|
|
175
|
+
ownerOrganizationMembershipId: z.string().uuid(),
|
|
176
|
+
ownerMembershipAuthorizationRevision: z.number().int().positive().safe(),
|
|
177
|
+
bindingId: z.string().uuid(),
|
|
178
|
+
bindingGeneration: z.number().int().positive().safe(),
|
|
179
|
+
delegationId: z.string().uuid(),
|
|
180
|
+
delegationGeneration: z.number().int().positive().safe(),
|
|
181
|
+
definition: HostMcpBindingDefinition,
|
|
182
|
+
context: SessionTenancyVisibility
|
|
183
|
+
}).strict();
|
|
184
|
+
export {
|
|
185
|
+
CreateHostMcpBindingRequest,
|
|
186
|
+
HostMcpAcceptedAuthority,
|
|
187
|
+
HostMcpBinding,
|
|
188
|
+
HostMcpBindingDefinition,
|
|
189
|
+
HostMcpCreateSelections,
|
|
190
|
+
HostMcpDelegation,
|
|
191
|
+
HostMcpOwnerSubject,
|
|
192
|
+
HostMcpTaskAuthority,
|
|
193
|
+
IssueHostMcpDelegationRequest
|
|
194
|
+
};
|
|
195
|
+
//# sourceMappingURL=host-mcp-bindings.js.map
|