@opengeni/contracts 3.0.1 → 3.0.2-canary.1
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 +2 -1
- package/dist/{chunk-IRR7CBBW.js → chunk-GJ5SNVJW.js} +2 -2
- package/dist/chunk-WBYTNVIW.js +28 -0
- package/dist/chunk-WBYTNVIW.js.map +1 -0
- package/dist/{chunk-EHHDZLGY.js → chunk-YRCMZTY2.js} +50 -7
- package/dist/chunk-YRCMZTY2.js.map +1 -0
- package/dist/connect.js +2 -1
- package/dist/connect.js.map +1 -1
- package/dist/connection-authority.js +3 -2
- package/dist/google-drive.js +2 -1
- package/dist/google-drive.js.map +1 -1
- package/dist/host-mcp-bindings.js +3 -2
- package/dist/host-mcp-bindings.js.map +1 -1
- package/dist/index.d.ts +53 -1
- package/dist/index.js +11 -1
- package/dist/mcp-endpoint.d.ts +7 -0
- package/dist/personal-github.js +2 -1
- package/dist/personal-github.js.map +1 -1
- package/dist/plugin-discovery.d.ts +35 -0
- package/dist/plugin-discovery.js +7 -0
- package/dist/plugin-discovery.js.map +1 -0
- package/dist/sandbox-snapshots.d.ts +18 -0
- package/package.json +5 -1
- package/src/index.ts +21 -0
- package/src/mcp-endpoint.ts +30 -0
- package/src/plugin-discovery.ts +33 -0
- package/src/sandbox-snapshots.ts +67 -3
- package/src/skill-metadata.ts +6 -2
- package/dist/chunk-EHHDZLGY.js.map +0 -1
- /package/dist/{chunk-IRR7CBBW.js.map → chunk-GJ5SNVJW.js.map} +0 -0
package/dist/connect.js
CHANGED
package/dist/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connect.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { IntegrationInstanceKey, IntegrationSource } from \"./index\";\n\nconst opaqueId = z.string().min(1).max(512);\nexport const ConnectOwnership = z.enum([\"personal\", \"workspace\"]);\nexport type ConnectOwnership = z.infer<typeof ConnectOwnership>;\nexport const ConnectProvider = z\n .object({\n id: opaqueId,\n label: z.string().min(1).max(256),\n family: opaqueId,\n readiness: z.enum([\"available\", \"needs_configuration\", \"operator_only\", \"unsupported\"]),\n reason: z.string().max(1024).optional(),\n ownership: z.array(ConnectOwnership).max(2),\n setup: z\n .array(\n z.enum([\"none\", \"oauth\", \"credentials\", \"device\", \"installation\", \"openapi\", \"graphql\"]),\n )\n .max(7),\n })\n .strict();\nexport type ConnectProvider = z.infer<typeof ConnectProvider>;\nexport const ConnectAccount = z\n .object({\n id: opaqueId,\n providerId: opaqueId,\n version: z.number().int().positive().optional(),\n label: z.string().max(256),\n ownership: ConnectOwnership,\n status: z.enum([\"connected\", \"auth_needed\", \"disabled\"]),\n })\n .strict();\nexport type ConnectAccount = z.infer<typeof ConnectAccount>;\nexport const ConnectResource = z\n .object({ id: opaqueId, label: z.string().max(512), kind: opaqueId })\n .strict();\nexport type ConnectResource = z.infer<typeof ConnectResource>;\nexport const ConnectNextAction = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"authorize\"), url: z.string().url().max(16_384) }).strict(),\n z\n .object({\n type: z.literal(\"credentials\"),\n fields: z\n .array(\n z\n .object({\n name: opaqueId,\n label: z.string().max(256),\n required: z.boolean(),\n secret: z.boolean(),\n options: z\n .array(z.object({ value: opaqueId, label: z.string().max(512) }).strict())\n .max(1000)\n .optional(),\n })\n .strict(),\n )\n .max(32),\n })\n .strict(),\n z\n .object({\n type: z.literal(\"wait\"),\n pollAfterMs: z.number().int().min(250).max(60_000),\n userCode: z.string().max(128).optional(),\n verificationUrl: z.string().url().max(2048).optional(),\n })\n .strict(),\n z\n .object({ type: z.literal(\"select_account\"), accounts: z.array(ConnectAccount).max(100) })\n .strict(),\n z\n .object({\n type: z.literal(\"select_resources\"),\n resources: z.array(ConnectResource).max(100),\n cursor: z.string().max(2048).optional(),\n })\n .strict(),\n z\n .object({\n type: z.literal(\"preview\"),\n previewId: opaqueId,\n contentHash: opaqueId,\n operations: z.array(ConnectResource).max(2000),\n })\n .strict(),\n z.object({ type: z.literal(\"none\") }).strict(),\n]);\nexport type ConnectNextAction = z.infer<typeof ConnectNextAction>;\nexport const ConnectInstallationTarget = z\n .object({\n instanceKey: IntegrationInstanceKey,\n displayName: z.string().min(1).max(200),\n expectedInstanceVersion: z.number().int().positive().optional(),\n })\n .strict();\nexport type ConnectInstallationTarget = z.infer<typeof ConnectInstallationTarget>;\nexport const ConnectAttemptState = z.enum([\n \"ready\",\n \"requires_user_action\",\n \"credential_input\",\n \"provider_wait\",\n \"account_selection\",\n \"resource_selection\",\n \"preview\",\n \"installing\",\n \"connected_but_incomplete\",\n \"complete\",\n \"cancelled\",\n \"expired\",\n \"failed\",\n \"uncertain\",\n]);\nexport const ConnectAttempt = z\n .object({\n id: opaqueId,\n workspaceId: opaqueId,\n providerId: opaqueId,\n ownership: ConnectOwnership,\n revision: z.number().int().positive(),\n state: ConnectAttemptState,\n credentialsCommitted: z.boolean(),\n integrationInstalled: z.boolean(),\n completionRequirement: z.enum([\"connection\", \"integration\", \"provider_setup\"]),\n nextAction: ConnectNextAction,\n expiresAt: z.string().datetime({ offset: true }),\n account: ConnectAccount.optional(),\n installationTarget: ConnectInstallationTarget.optional(),\n source: IntegrationSource.optional(),\n error: z\n .object({ code: opaqueId, message: z.string().max(2048), retryable: z.boolean() })\n .strict()\n .optional(),\n })\n .strict()\n .superRefine((value, context) => {\n if (\n value.state === \"complete\" &&\n value.completionRequirement === \"integration\" &&\n !value.integrationInstalled\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"Complete setup requires an installed integration\",\n });\n }\n if (\n value.state === \"complete\" &&\n value.completionRequirement === \"connection\" &&\n !value.credentialsCommitted\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"Connection setup requires committed credentials\",\n });\n }\n if (\n [\"complete\", \"cancelled\", \"expired\"].includes(value.state) &&\n value.nextAction.type !== \"none\"\n ) {\n context.addIssue({ code: \"custom\", message: \"A terminal setup has no next action\" });\n }\n });\nexport type ConnectAttempt = z.infer<typeof ConnectAttempt>;\nexport const ConnectAdvance = z.discriminatedUnion(\"type\", [\n z\n .object({\n type: z.literal(\"credentials\"),\n values: z.record(z.string().max(256), z.string().max(16_384)),\n })\n .strict(),\n z.object({ type: z.literal(\"account\"), accountId: opaqueId }).strict(),\n z.object({ type: z.literal(\"resources\"), resourceIds: z.array(opaqueId).max(1000) }).strict(),\n z\n .object({\n type: z.literal(\"install\"),\n previewId: opaqueId,\n contentHash: opaqueId,\n operationIds: z.array(opaqueId).max(2000),\n })\n .strict(),\n z.object({ type: z.literal(\"retry\") }).strict(),\n]);\nexport type ConnectAdvance = z.infer<typeof ConnectAdvance>;\nexport const ConnectOperationRequest = z\n .object({\n expectedRevision: z.number().int().positive().safe(),\n idempotencyKey: opaqueId,\n })\n .strict();\nexport const AdvanceConnectRequest = ConnectOperationRequest.extend({ action: ConnectAdvance });\nexport const BeginConnectRequest = z\n .object({\n providerId: opaqueId,\n ownership: ConnectOwnership,\n // URL parsing validates separately; never transform this original string.\n returnUrl: z.string().min(1).max(4096),\n idempotencyKey: opaqueId,\n reconnectAccountId: opaqueId.optional(),\n installationTarget: ConnectInstallationTarget.optional(),\n })\n .strict();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAGlB,IAAM,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AACnC,IAAM,mBAAmB,EAAE,KAAK,CAAC,YAAY,WAAW,CAAC;AAEzD,IAAM,kBAAkB,EAC5B,OAAO;AAAA,EACN,IAAI;AAAA,EACJ,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAChC,QAAQ;AAAA,EACR,WAAW,EAAE,KAAK,CAAC,aAAa,uBAAuB,iBAAiB,aAAa,CAAC;AAAA,EACtF,QAAQ,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,SAAS;AAAA,EACtC,WAAW,EAAE,MAAM,gBA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\"zod\";\nimport { IntegrationInstanceKey, IntegrationSource } from \"./index\";\n\nconst opaqueId = z.string().min(1).max(512);\nexport const ConnectOwnership = z.enum([\"personal\", \"workspace\"]);\nexport type ConnectOwnership = z.infer<typeof ConnectOwnership>;\nexport const ConnectProvider = z\n .object({\n id: opaqueId,\n label: z.string().min(1).max(256),\n family: opaqueId,\n readiness: z.enum([\"available\", \"needs_configuration\", \"operator_only\", \"unsupported\"]),\n reason: z.string().max(1024).optional(),\n ownership: z.array(ConnectOwnership).max(2),\n setup: z\n .array(\n z.enum([\"none\", \"oauth\", \"credentials\", \"device\", \"installation\", \"openapi\", \"graphql\"]),\n )\n .max(7),\n })\n .strict();\nexport type ConnectProvider = z.infer<typeof ConnectProvider>;\nexport const ConnectAccount = z\n .object({\n id: opaqueId,\n providerId: opaqueId,\n version: z.number().int().positive().optional(),\n label: z.string().max(256),\n ownership: ConnectOwnership,\n status: z.enum([\"connected\", \"auth_needed\", \"disabled\"]),\n })\n .strict();\nexport type ConnectAccount = z.infer<typeof ConnectAccount>;\nexport const ConnectResource = z\n .object({ id: opaqueId, label: z.string().max(512), kind: opaqueId })\n .strict();\nexport type ConnectResource = z.infer<typeof ConnectResource>;\nexport const ConnectNextAction = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"authorize\"), url: z.string().url().max(16_384) }).strict(),\n z\n .object({\n type: z.literal(\"credentials\"),\n fields: z\n .array(\n z\n .object({\n name: opaqueId,\n label: z.string().max(256),\n required: z.boolean(),\n secret: z.boolean(),\n options: z\n .array(z.object({ value: opaqueId, label: z.string().max(512) }).strict())\n .max(1000)\n .optional(),\n })\n .strict(),\n )\n .max(32),\n })\n .strict(),\n z\n .object({\n type: z.literal(\"wait\"),\n pollAfterMs: z.number().int().min(250).max(60_000),\n userCode: z.string().max(128).optional(),\n verificationUrl: z.string().url().max(2048).optional(),\n })\n .strict(),\n z\n .object({ type: z.literal(\"select_account\"), accounts: z.array(ConnectAccount).max(100) })\n .strict(),\n z\n .object({\n type: z.literal(\"select_resources\"),\n resources: z.array(ConnectResource).max(100),\n cursor: z.string().max(2048).optional(),\n })\n .strict(),\n z\n .object({\n type: z.literal(\"preview\"),\n previewId: opaqueId,\n contentHash: opaqueId,\n operations: z.array(ConnectResource).max(2000),\n })\n .strict(),\n z.object({ type: z.literal(\"none\") }).strict(),\n]);\nexport type ConnectNextAction = z.infer<typeof ConnectNextAction>;\nexport const ConnectInstallationTarget = z\n .object({\n instanceKey: IntegrationInstanceKey,\n displayName: z.string().min(1).max(200),\n expectedInstanceVersion: z.number().int().positive().optional(),\n })\n .strict();\nexport type ConnectInstallationTarget = z.infer<typeof ConnectInstallationTarget>;\nexport const ConnectAttemptState = z.enum([\n \"ready\",\n \"requires_user_action\",\n \"credential_input\",\n \"provider_wait\",\n \"account_selection\",\n \"resource_selection\",\n \"preview\",\n \"installing\",\n \"connected_but_incomplete\",\n \"complete\",\n \"cancelled\",\n \"expired\",\n \"failed\",\n \"uncertain\",\n]);\nexport const ConnectAttempt = z\n .object({\n id: opaqueId,\n workspaceId: opaqueId,\n providerId: opaqueId,\n ownership: ConnectOwnership,\n revision: z.number().int().positive(),\n state: ConnectAttemptState,\n credentialsCommitted: z.boolean(),\n integrationInstalled: z.boolean(),\n completionRequirement: z.enum([\"connection\", \"integration\", \"provider_setup\"]),\n nextAction: ConnectNextAction,\n expiresAt: z.string().datetime({ offset: true }),\n account: ConnectAccount.optional(),\n installationTarget: ConnectInstallationTarget.optional(),\n source: IntegrationSource.optional(),\n error: z\n .object({ code: opaqueId, message: z.string().max(2048), retryable: z.boolean() })\n .strict()\n .optional(),\n })\n .strict()\n .superRefine((value, context) => {\n if (\n value.state === \"complete\" &&\n value.completionRequirement === \"integration\" &&\n !value.integrationInstalled\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"Complete setup requires an installed integration\",\n });\n }\n if (\n value.state === \"complete\" &&\n value.completionRequirement === \"connection\" &&\n !value.credentialsCommitted\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"Connection setup requires committed credentials\",\n });\n }\n if (\n [\"complete\", \"cancelled\", \"expired\"].includes(value.state) &&\n value.nextAction.type !== \"none\"\n ) {\n context.addIssue({ code: \"custom\", message: \"A terminal setup has no next action\" });\n }\n });\nexport type ConnectAttempt = z.infer<typeof ConnectAttempt>;\nexport const ConnectAdvance = z.discriminatedUnion(\"type\", [\n z\n .object({\n type: z.literal(\"credentials\"),\n values: z.record(z.string().max(256), z.string().max(16_384)),\n })\n .strict(),\n z.object({ type: z.literal(\"account\"), accountId: opaqueId }).strict(),\n z.object({ type: z.literal(\"resources\"), resourceIds: z.array(opaqueId).max(1000) }).strict(),\n z\n .object({\n type: z.literal(\"install\"),\n previewId: opaqueId,\n contentHash: opaqueId,\n operationIds: z.array(opaqueId).max(2000),\n })\n .strict(),\n z.object({ type: z.literal(\"retry\") }).strict(),\n]);\nexport type ConnectAdvance = z.infer<typeof ConnectAdvance>;\nexport const ConnectOperationRequest = z\n .object({\n expectedRevision: z.number().int().positive().safe(),\n idempotencyKey: opaqueId,\n })\n .strict();\nexport const AdvanceConnectRequest = ConnectOperationRequest.extend({ action: ConnectAdvance });\nexport const BeginConnectRequest = z\n .object({\n providerId: opaqueId,\n ownership: ConnectOwnership,\n // URL parsing validates separately; never transform this original string.\n returnUrl: z.string().min(1).max(4096),\n idempotencyKey: opaqueId,\n reconnectAccountId: opaqueId.optional(),\n installationTarget: ConnectInstallationTarget.optional(),\n })\n .strict();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAGlB,IAAM,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AACnC,IAAM,mBAAmB,EAAE,KAAK,CAAC,YAAY,WAAW,CAAC;AAEzD,IAAM,kBAAkB,EAC5B,OAAO;AAAA,EACN,IAAI;AAAA,EACJ,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAChC,QAAQ;AAAA,EACR,WA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AAA,EAChB,oBAAoB,SAAS,SAAS;AAAA,EACtC,oBAAoB,0BAA0B,SAAS;AACzD,CAAC,EACA,OAAO;","names":[]}
|
|
@@ -16,8 +16,9 @@ import {
|
|
|
16
16
|
ListConnectionAuthoritiesQuery,
|
|
17
17
|
ListConnectionAuthoritiesResponse,
|
|
18
18
|
RevokeConnectionUseGrantQuery
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-GJ5SNVJW.js";
|
|
20
|
+
import "./chunk-YRCMZTY2.js";
|
|
21
|
+
import "./chunk-WBYTNVIW.js";
|
|
21
22
|
import "./chunk-YBW5JSA3.js";
|
|
22
23
|
import "./chunk-O5LEQHDM.js";
|
|
23
24
|
import "./chunk-GRG7PHWQ.js";
|
package/dist/google-drive.js
CHANGED
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.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,kBAAmB,cAAa,KAAK,kBAAkB;AAC3D,MAAI,aAAc,cAAa,KAAK,cAAc;AAClD,MAAI,2BAA4B,cAAa,KAAK,2BAA2B;AAC7E,MAAI,sBAAsB;AACxB,iBAAa,KAAK,uBAAuB,uBAAuB;AA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CAAC,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EAC7C,YAAY,EAAE,KAAK,CAAC,YAAY,gBAAgB,QAAQ,CAAC;AAAA,EACzD,oBAAoB,EAAE,QAAQ;AAChC,CAAC;AAGM,IAAM,wCAAwC,EAAE,OAAO;AAAA,EAC5D,eAAe,EAAE,KAAK,CAAC,gBAAgB,aAAa,UAAU,CAAC;AAAA,EAC/D,oBAAoB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAC7C,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,C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,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,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConnectionUseAuthoritySnapshot,
|
|
3
3
|
IssueConnectionUseGrantRequest
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GJ5SNVJW.js";
|
|
5
5
|
import {
|
|
6
6
|
HostMcpCreateSelections,
|
|
7
7
|
McpServerConnectionRef,
|
|
8
8
|
SessionTenancyVisibility
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YRCMZTY2.js";
|
|
10
|
+
import "./chunk-WBYTNVIW.js";
|
|
10
11
|
import "./chunk-YBW5JSA3.js";
|
|
11
12
|
import "./chunk-O5LEQHDM.js";
|
|
12
13
|
import "./chunk-GRG7PHWQ.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/host-mcp-bindings.ts"],"sourcesContent":["import { z } from \"zod\";\nexport { HostMcpCreateSelections, type HostMcpCreateSelection } from \"./index\";\nimport { McpServerConnectionRef, SessionTenancyVisibility } from \"./index\";\nimport {\n ConnectionUseAuthoritySnapshot,\n IssueConnectionUseGrantRequest,\n} from \"./connection-authority\";\nimport { ExternalIdentity } from \"./external-identities\";\nexport const HostMcpOwnerSubject = z.union([\n ExternalIdentity.shape.subjectId,\n z\n .string()\n .max(4096)\n .regex(/^user:[^\\r\\n\\u0000]+$/),\n]);\n\n/** Credential-free, immutable destination and host connection selection. */\nexport const HostMcpBindingDefinition = z\n .object({\n serverId: z.string().min(1).max(256),\n destinationUrl: z\n .string()\n .url()\n .max(4096)\n .refine((value) => {\n const url = new URL(value);\n return url.protocol === \"https:\" && !url.username && !url.password && !url.hash;\n }, \"Host binding requires an HTTPS destination without userinfo or fragment\")\n .transform((value) => new URL(value).toString()),\n connectionRef: McpServerConnectionRef,\n })\n .strict()\n .superRefine((value, context) => {\n if (value.connectionRef.hostBinding)\n context.addIssue({\n code: \"custom\",\n path: [\"connectionRef\", \"hostBinding\"],\n message: \"A binding definition cannot reference another binding\",\n });\n if (value.connectionRef.authoritySource !== \"host\" || !value.connectionRef.connectionId)\n context.addIssue({\n code: \"custom\",\n path: [\"connectionRef\"],\n message: \"Explicit host connection authority is required\",\n });\n if (new TextEncoder().encode(JSON.stringify(value)).byteLength > 65_536)\n context.addIssue({ code: \"custom\", message: \"Host binding definition exceeds 64 KiB\" });\n });\nexport type HostMcpBindingDefinition = z.infer<typeof HostMcpBindingDefinition>;\n\nexport const HostMcpBinding = z\n .object({\n id: z.string().uuid(),\n accountId: z.string().uuid(),\n workspaceId: z.string().uuid(),\n ownerSubjectId: HostMcpOwnerSubject,\n authorizationRevision: z.number().int().positive().safe(),\n generation: z.number().int().positive().safe(),\n status: z.enum([\"active\", \"revoked\"]),\n definition: HostMcpBindingDefinition,\n createdAt: z.string().datetime({ offset: true }),\n revokedAt: z.string().datetime({ offset: true }).nullable(),\n })\n .strict();\nexport type HostMcpBinding = z.infer<typeof HostMcpBinding>;\n\nexport const CreateHostMcpBindingRequest = z\n .object({\n operationId: z.string().uuid(),\n definition: HostMcpBindingDefinition,\n })\n .strict();\nexport type CreateHostMcpBindingRequest = z.infer<typeof CreateHostMcpBindingRequest>;\n\n/** Internal owner-authorized issuance; never itself proves caller identity. */\nconst HostMcpDelegationGrant = IssueConnectionUseGrantRequest.superRefine((value, context) => {\n if (\n Boolean(value.sessionId) !== (value.expectedAuthorityEpoch != null) ||\n (value.expectedAuthorityEpoch != null && !Number.isSafeInteger(value.expectedAuthorityEpoch))\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"Host session grants require a matching safe authority epoch\",\n });\n }\n});\nexport const IssueHostMcpDelegationRequest = z\n .object({\n operationId: z.string().uuid(),\n bindingId: z.string().uuid(),\n expectedBindingGeneration: z.number().int().positive().safe(),\n grant: HostMcpDelegationGrant,\n })\n .strict();\nexport type IssueHostMcpDelegationRequest = z.infer<typeof IssueHostMcpDelegationRequest>;\n\nexport const HostMcpDelegation = z\n .object({\n id: z.string().uuid(),\n accountId: z.string().uuid(),\n workspaceId: z.string().uuid(),\n ownerSubjectId: HostMcpOwnerSubject,\n ownerAuthorizationRevision: z.number().int().positive().safe(),\n bindingId: z.string().uuid(),\n bindingGeneration: z.number().int().positive().safe(),\n grant: HostMcpDelegationGrant,\n generation: z.number().int().positive().safe(),\n status: z.enum([\"active\", \"revoked\"]),\n createdAt: z.string().datetime({ offset: true }),\n revokedAt: z.string().datetime({ offset: true }).nullable(),\n })\n .strict();\nexport type HostMcpDelegation = z.infer<typeof HostMcpDelegation>;\n\n/** Internal admission evidence, not a caller-supplied permission or credential.\n * Persistence must construct this from live authenticated authority and freeze\n * it with accepted work. Runtime use must independently revalidate that work,\n * membership, binding and delegation. No API key is retained as execution rights.\n */\nexport const HostMcpAcceptedAuthority = z\n .object({\n version: z.literal(1),\n accountId: z.string().uuid(),\n workspaceId: z.string().uuid(),\n targetSessionId: z.string().uuid(),\n targetSessionVisibility: SessionTenancyVisibility,\n targetSessionAuthorityEpoch: z.number().int().positive().safe(),\n acceptedWork: ConnectionUseAuthoritySnapshot.shape.acceptedWork,\n bindingId: z.string().uuid(),\n bindingGeneration: z.number().int().positive().safe(),\n definition: HostMcpBindingDefinition,\n ownerSubjectId: HostMcpOwnerSubject,\n ownerOrganizationMembershipId: z.string().uuid(),\n ownerMembershipAuthorizationRevision: z.number().int().positive().safe(),\n delegationId: z.string().uuid(),\n delegationGeneration: z.number().int().positive().safe(),\n scheduledOrigin: z\n .object({\n taskId: z.string().uuid(),\n taskAuthorityRevision: z.number().int().positive().safe(),\n runId: z.string().uuid(),\n })\n .strict()\n .optional(),\n source: z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"direct\") }).strict(),\n z.object({ kind: z.literal(\"scheduled_task\") }).strict(),\n z\n .object({\n kind: z.literal(\"child_turn\"),\n sessionId: z.string().uuid(),\n turnId: z.string().uuid(),\n })\n .strict(),\n z\n .object({\n kind: z.literal(\"inherited_turn\"),\n sessionId: z.string().uuid(),\n turnId: z.string().uuid(),\n })\n .strict(),\n ]),\n })\n .strict()\n .superRefine((value, context) => {\n if (\n (value.source.kind === \"direct\" && value.scheduledOrigin) ||\n (value.source.kind === \"scheduled_task\" &&\n (!value.scheduledOrigin ||\n value.acceptedWork.kind !== \"scheduled_task\" ||\n value.scheduledOrigin.taskId !== value.acceptedWork.taskId ||\n value.scheduledOrigin.runId !== value.acceptedWork.runId ||\n value.scheduledOrigin.taskAuthorityRevision !== value.acceptedWork.taskAuthorityRevision))\n )\n context.addIssue({\n code: \"custom\",\n message: \"Scheduled host authority must retain its exact run origin\",\n });\n if (\n value.acceptedWork.kind === \"turn\" &&\n value.source.kind === \"inherited_turn\" &&\n value.acceptedWork.turnId === value.source.turnId\n ) {\n context.addIssue({\n code: \"custom\",\n path: [\"source\"],\n message: \"Accepted work cannot inherit from itself\",\n });\n }\n if (\n value.acceptedWork.kind === \"scheduled_task\" &&\n !Number.isSafeInteger(value.acceptedWork.taskAuthorityRevision)\n ) {\n context.addIssue({\n code: \"custom\",\n path: [\"acceptedWork\"],\n message: \"Task authority revision must be a safe integer\",\n });\n }\n if (new TextEncoder().encode(JSON.stringify(value)).byteLength > 65_536) {\n context.addIssue({ code: \"custom\", message: \"Host accepted authority exceeds 64 KiB\" });\n }\n });\nexport type HostMcpAcceptedAuthority = z.infer<typeof HostMcpAcceptedAuthority>;\n\n/** Credential-free selection frozen on one immutable scheduled-task revision. */\nexport const HostMcpTaskAuthority = z\n .object({\n version: z.literal(1),\n accountId: z.string().uuid(),\n workspaceId: z.string().uuid(),\n taskId: z.string().uuid(),\n taskAuthorityRevision: z.number().int().positive().safe(),\n taskExecutionDigest: z.string().regex(/^[0-9a-f]{64}$/),\n ownerSubjectId: HostMcpOwnerSubject,\n ownerOrganizationMembershipId: z.string().uuid(),\n ownerMembershipAuthorizationRevision: z.number().int().positive().safe(),\n bindingId: z.string().uuid(),\n bindingGeneration: z.number().int().positive().safe(),\n delegationId: z.string().uuid(),\n delegationGeneration: z.number().int().positive().safe(),\n definition: HostMcpBindingDefinition,\n context: SessionTenancyVisibility,\n })\n .strict();\nexport type HostMcpTaskAuthority = z.infer<typeof HostMcpTaskAuthority>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAQX,IAAM,sBAAsB,EAAE,MAAM;AAAA,EACzC,iBAAiB,MAAM;AAAA,EACvB,EACG,OAAO,EACP,IAAI,IAAI,EACR,MAAM,uBAAuB;AAClC,CAAC;AAGM,IAAM,2BAA2B,EACrC,OAAO;AAAA,EACN,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EACnC,gBAAgB,EACb,OAAO,EACP,IAAI,EACJ,IAAI,IAAI,EACR,OAAO,CAAC,UAAU;AACjB,UAAM,MAAM,IAAI,IAAI,KAAK;AACzB,WAAO,IAAI,aAAa,YAAY,CAAC,IAAI,YAAY,CAAC,IAAI,YAAY,CAAC,IAAI;AAAA,EAC7E,GAAG,yEAAyE,EAC3E,UAAU,CAAC,UAAU,IAAI,IAAI,KAAK,EAAE,SAAS,CAAC;AAAA,EACjD,eAAe;AACjB,CAAC,EACA,OAAO,EACP,YAAY,CAAC,OAAO,YAAY;AAC/B,MAAI,MAAM,cAAc;AACtB,YAAQ,SAAS;AAAA,MACf,MAAM;AAAA,MACN,MAAM,CAAC,iBAAiB,aAAa;AAAA,MACrC,SAAS;AAAA,IACX,CAAC;AACH,MAAI,MAAM,cAAc,oBAAoB,UAAU,CAAC,MAAM,cAAc;AACzE,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S,EAAE,KAAK;AAAA,EACvE,WAAW,EAAE,OAAO,EAAE,KAAK;AAAA,EAC3B,mBAAmB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK;AAAA,EACpD,cAAc,EAAE,OAAO,EAAE,KAAK;AAAA,EAC9B,sBAAsB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK;AAAA,EACvD,YAAY;AAAA,EACZ,SAAS;AACX,CAAC,EACA,OAAO;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/host-mcp-bindings.ts"],"sourcesContent":["import { z } from \"zod\";\nexport { HostMcpCreateSelections, type HostMcpCreateSelection } from \"./index\";\nimport { McpServerConnectionRef, SessionTenancyVisibility } from \"./index\";\nimport {\n ConnectionUseAuthoritySnapshot,\n IssueConnectionUseGrantRequest,\n} from \"./connection-authority\";\nimport { ExternalIdentity } from \"./external-identities\";\nexport const HostMcpOwnerSubject = z.union([\n ExternalIdentity.shape.subjectId,\n z\n .string()\n .max(4096)\n .regex(/^user:[^\\r\\n\\u0000]+$/),\n]);\n\n/** Credential-free, immutable destination and host connection selection. */\nexport const HostMcpBindingDefinition = z\n .object({\n serverId: z.string().min(1).max(256),\n destinationUrl: z\n .string()\n .url()\n .max(4096)\n .refine((value) => {\n const url = new URL(value);\n return url.protocol === \"https:\" && !url.username && !url.password && !url.hash;\n }, \"Host binding requires an HTTPS destination without userinfo or fragment\")\n .transform((value) => new URL(value).toString()),\n connectionRef: McpServerConnectionRef,\n })\n .strict()\n .superRefine((value, context) => {\n if (value.connectionRef.hostBinding)\n context.addIssue({\n code: \"custom\",\n path: [\"connectionRef\", \"hostBinding\"],\n message: \"A binding definition cannot reference another binding\",\n });\n if (value.connectionRef.authoritySource !== \"host\" || !value.connectionRef.connectionId)\n context.addIssue({\n code: \"custom\",\n path: [\"connectionRef\"],\n message: \"Explicit host connection authority is required\",\n });\n if (new TextEncoder().encode(JSON.stringify(value)).byteLength > 65_536)\n context.addIssue({ code: \"custom\", message: \"Host binding definition exceeds 64 KiB\" });\n });\nexport type HostMcpBindingDefinition = z.infer<typeof HostMcpBindingDefinition>;\n\nexport const HostMcpBinding = z\n .object({\n id: z.string().uuid(),\n accountId: z.string().uuid(),\n workspaceId: z.string().uuid(),\n ownerSubjectId: HostMcpOwnerSubject,\n authorizationRevision: z.number().int().positive().safe(),\n generation: z.number().int().positive().safe(),\n status: z.enum([\"active\", \"revoked\"]),\n definition: HostMcpBindingDefinition,\n createdAt: z.string().datetime({ offset: true }),\n revokedAt: z.string().datetime({ offset: true }).nullable(),\n })\n .strict();\nexport type HostMcpBinding = z.infer<typeof HostMcpBinding>;\n\nexport const CreateHostMcpBindingRequest = z\n .object({\n operationId: z.string().uuid(),\n definition: HostMcpBindingDefinition,\n })\n .strict();\nexport type CreateHostMcpBindingRequest = z.infer<typeof CreateHostMcpBindingRequest>;\n\n/** Internal owner-authorized issuance; never itself proves caller identity. */\nconst HostMcpDelegationGrant = IssueConnectionUseGrantRequest.superRefine((value, context) => {\n if (\n Boolean(value.sessionId) !== (value.expectedAuthorityEpoch != null) ||\n (value.expectedAuthorityEpoch != null && !Number.isSafeInteger(value.expectedAuthorityEpoch))\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"Host session grants require a matching safe authority epoch\",\n });\n }\n});\nexport const IssueHostMcpDelegationRequest = z\n .object({\n operationId: z.string().uuid(),\n bindingId: z.string().uuid(),\n expectedBindingGeneration: z.number().int().positive().safe(),\n grant: HostMcpDelegationGrant,\n })\n .strict();\nexport type IssueHostMcpDelegationRequest = z.infer<typeof IssueHostMcpDelegationRequest>;\n\nexport const HostMcpDelegation = z\n .object({\n id: z.string().uuid(),\n accountId: z.string().uuid(),\n workspaceId: z.string().uuid(),\n ownerSubjectId: HostMcpOwnerSubject,\n ownerAuthorizationRevision: z.number().int().positive().safe(),\n bindingId: z.string().uuid(),\n bindingGeneration: z.number().int().positive().safe(),\n grant: HostMcpDelegationGrant,\n generation: z.number().int().positive().safe(),\n status: z.enum([\"active\", \"revoked\"]),\n createdAt: z.string().datetime({ offset: true }),\n revokedAt: z.string().datetime({ offset: true }).nullable(),\n })\n .strict();\nexport type HostMcpDelegation = z.infer<typeof HostMcpDelegation>;\n\n/** Internal admission evidence, not a caller-supplied permission or credential.\n * Persistence must construct this from live authenticated authority and freeze\n * it with accepted work. Runtime use must independently revalidate that work,\n * membership, binding and delegation. No API key is retained as execution rights.\n */\nexport const HostMcpAcceptedAuthority = z\n .object({\n version: z.literal(1),\n accountId: z.string().uuid(),\n workspaceId: z.string().uuid(),\n targetSessionId: z.string().uuid(),\n targetSessionVisibility: SessionTenancyVisibility,\n targetSessionAuthorityEpoch: z.number().int().positive().safe(),\n acceptedWork: ConnectionUseAuthoritySnapshot.shape.acceptedWork,\n bindingId: z.string().uuid(),\n bindingGeneration: z.number().int().positive().safe(),\n definition: HostMcpBindingDefinition,\n ownerSubjectId: HostMcpOwnerSubject,\n ownerOrganizationMembershipId: z.string().uuid(),\n ownerMembershipAuthorizationRevision: z.number().int().positive().safe(),\n delegationId: z.string().uuid(),\n delegationGeneration: z.number().int().positive().safe(),\n scheduledOrigin: z\n .object({\n taskId: z.string().uuid(),\n taskAuthorityRevision: z.number().int().positive().safe(),\n runId: z.string().uuid(),\n })\n .strict()\n .optional(),\n source: z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"direct\") }).strict(),\n z.object({ kind: z.literal(\"scheduled_task\") }).strict(),\n z\n .object({\n kind: z.literal(\"child_turn\"),\n sessionId: z.string().uuid(),\n turnId: z.string().uuid(),\n })\n .strict(),\n z\n .object({\n kind: z.literal(\"inherited_turn\"),\n sessionId: z.string().uuid(),\n turnId: z.string().uuid(),\n })\n .strict(),\n ]),\n })\n .strict()\n .superRefine((value, context) => {\n if (\n (value.source.kind === \"direct\" && value.scheduledOrigin) ||\n (value.source.kind === \"scheduled_task\" &&\n (!value.scheduledOrigin ||\n value.acceptedWork.kind !== \"scheduled_task\" ||\n value.scheduledOrigin.taskId !== value.acceptedWork.taskId ||\n value.scheduledOrigin.runId !== value.acceptedWork.runId ||\n value.scheduledOrigin.taskAuthorityRevision !== value.acceptedWork.taskAuthorityRevision))\n )\n context.addIssue({\n code: \"custom\",\n message: \"Scheduled host authority must retain its exact run origin\",\n });\n if (\n value.acceptedWork.kind === \"turn\" &&\n value.source.kind === \"inherited_turn\" &&\n value.acceptedWork.turnId === value.source.turnId\n ) {\n context.addIssue({\n code: \"custom\",\n path: [\"source\"],\n message: \"Accepted work cannot inherit from itself\",\n });\n }\n if (\n value.acceptedWork.kind === \"scheduled_task\" &&\n !Number.isSafeInteger(value.acceptedWork.taskAuthorityRevision)\n ) {\n context.addIssue({\n code: \"custom\",\n path: [\"acceptedWork\"],\n message: \"Task authority revision must be a safe integer\",\n });\n }\n if (new TextEncoder().encode(JSON.stringify(value)).byteLength > 65_536) {\n context.addIssue({ code: \"custom\", message: \"Host accepted authority exceeds 64 KiB\" });\n }\n });\nexport type HostMcpAcceptedAuthority = z.infer<typeof HostMcpAcceptedAuthority>;\n\n/** Credential-free selection frozen on one immutable scheduled-task revision. */\nexport const HostMcpTaskAuthority = z\n .object({\n version: z.literal(1),\n accountId: z.string().uuid(),\n workspaceId: z.string().uuid(),\n taskId: z.string().uuid(),\n taskAuthorityRevision: z.number().int().positive().safe(),\n taskExecutionDigest: z.string().regex(/^[0-9a-f]{64}$/),\n ownerSubjectId: HostMcpOwnerSubject,\n ownerOrganizationMembershipId: z.string().uuid(),\n ownerMembershipAuthorizationRevision: z.number().int().positive().safe(),\n bindingId: z.string().uuid(),\n bindingGeneration: z.number().int().positive().safe(),\n delegationId: z.string().uuid(),\n delegationGeneration: z.number().int().positive().safe(),\n definition: HostMcpBindingDefinition,\n context: SessionTenancyVisibility,\n })\n .strict();\nexport type HostMcpTaskAuthority = z.infer<typeof HostMcpTaskAuthority>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAQX,IAAM,sBAAsB,EAAE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CAAC,OAAO,cAAc,MAAM,aAAa,qBAAqB,GAC9D;AACA,YAAQ,SAAS;AAAA,MACf,MAAM;AAAA,MACN,MAAM,CAAC,cAAc;AAAA,MACrB,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACA,MAAI,IAAI,YAAY,EAAE,OAAO,KAAK,UAAU,KAAK,CAAC,EAAE,aAAa,OAAQ;AACvE,YAAQ,SAAS,EAAE,MAAM,UAAU,SAAS,yCAAyC,CAAC;AAAA,EACxF;AACF,CAAC;AAII,IAAM,uBAAuB,EACjC,OAAO;AAAA,EACN,SAAS,EAAE,QAAQ,CAAC;AAAA,EACpB,WAAW,EAAE,OAAO,EAAE,KAAK;AAAA,EAC3B,aAAa,EAAE,OAAO,EAAE,KAAK;AAAA,EAC7B,QAAQ,EAAE,OAAO,EAAE,KAAK;AAAA,EACxB,uBAAuB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK;AAAA,EACxD,qBAAqB,EAAE,OAAO,EAAE,MAAM,gBAAgB;AAAA,EACtD,gBAAgB;AAAA,EAChB,+BAA+B,EAAE,OAAO,EAAE,KAAK;AAAA,EAC/C,sCAAsC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK;AAAA,EACvE,WAAW,EAAE,OAAO,EAAE,KAAK;AAAA,EAC3B,mBAAmB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK;AAAA,EACpD,cAAc,EAAE,OAAO,EAAE,KAAK;AAAA,EAC9B,sBAAsB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK;AAAA,EACvD,YAAY;AAAA,EACZ,SAAS;AACX,CAAC,EACA,OAAO;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export { CreateWorkspaceArtifactRequest, PublishWorkspaceArtifactVersionRequest,
|
|
|
37
37
|
export { MCP_MUTATION_RECEIPT_MAX_BYTES, MCP_MUTATION_RECEIPT_VERSION, McpMutationReceipt, McpMutationReceiptIdempotencyStatus, McpMutationReceiptOutcome, McpMutationResource, type McpMutationReceipt as McpMutationReceiptType, type McpMutationReceiptIdempotencyStatus as McpMutationReceiptIdempotencyStatusType, type McpMutationReceiptOutcome as McpMutationReceiptOutcomeType, type McpMutationResource as McpMutationResourceType, } from "./mcp-receipts.js";
|
|
38
38
|
export { SESSION_EVENT_PAYLOAD_MAX_BYTES, approximateSessionEventTokens, boundSessionEventPayload, measureSessionEventJson, sessionEventJsonBytes, sessionEventMediaPreview, sessionEventMediaPreviewFromDataUrl, sessionEventPayloadTruncation, type BoundSessionEventPayloadOptions, type SessionEventBoundarySurface, type SessionEventMediaPreview, type SessionEventJsonMeasurement, type SessionEventPayloadTruncation, } from "./event-preview.js";
|
|
39
39
|
export { COMPUTER_SCREENSHOT_MAX_BYTES, COMPUTER_SCREENSHOT_MAX_DIMENSION, COMPUTER_SCREENSHOT_MAX_PIXELS, COMPUTER_SCREENSHOT_RETENTION_MS, COMPUTER_SCREENSHOT_WORKSPACE_QUOTA_BYTES, GENERATED_IMAGE_MAX_BYTES, GENERATED_VIDEO_MAX_BYTES, RETAINED_OUTPUT_DEFAULT_PAGE_BYTES, RETAINED_OUTPUT_MAX_PAGE_BYTES, RETAINED_OUTPUT_RECEIPT_MAX_BYTES, RetainedArtifactMetadataSchema, RetainedArtifactReferenceSchema, RetainedArtifactUnavailableSchema, RetainedOutputEvidenceSchema, RetainedOutputKind, RetainedOutputUnavailableReason, retainedArtifactReferenceFromFile, retainedGeneratedImageReferenceFromFile, retainedGeneratedVideoReferenceFromFile, retainedScreenshotReferenceFromFile, retainedOutputUnavailable, resolveRetainedOutputRange, validateRetainedOutputEvidence, type RetainedArtifactFileInput, type RetainedArtifactMetadata, type RetainedArtifactReference, type RetainedGeneratedImageArtifactInput, type RetainedGeneratedVideoArtifactInput, type RetainedScreenshotArtifactInput, type RetainedArtifactUnavailable, type RetainedOutputAvailableEvidence, type RetainedOutputEvidence, type RetainedOutputRangeResolution, type RetainedOutputResolvedRange, } from "./retained-output.js";
|
|
40
|
-
export { NATIVE_SNAPSHOT_PREFIXES, WORKSPACE_ARCHIVE_DESCRIPTOR_VERSION, WORKSPACE_ARCHIVE_OBJECT_REF_SCHEMA, backendForNativeSnapshotProvider, decodeNativeSnapshotRef, encodeNativeSnapshotRef, omitInlineWorkspaceArchiveWhenObjectRefPresent, parseWorkspaceArchiveDescriptor, parseWorkspaceArchiveObjectRef, workspaceArchiveObjectKey, workspaceArchivePayloadPresent, type NativeSnapshotDescriptor, type NativeSnapshotProvider, type NativeSnapshotRef, type TarWorkspaceArchiveDescriptor, type WorkspaceArchiveDescriptor, type WorkspaceArchiveObjectRef, type WorkspaceTreeFingerprint, } from "./sandbox-snapshots.js";
|
|
40
|
+
export { NATIVE_SNAPSHOT_PREFIXES, WORKSPACE_ARCHIVE_DESCRIPTOR_VERSION, WORKSPACE_ARCHIVE_OBJECT_REF_SCHEMA, backendForNativeSnapshotProvider, decodeNativeSnapshotRef, encodeNativeSnapshotRef, omitInlineWorkspaceArchiveWhenObjectRefPresent, parseWorkspaceArchiveDescriptor, parseWorkspaceArchiveObjectKey, parseWorkspaceArchiveObjectRef, validateWorkspaceArchiveObjectRef, workspaceArchiveObjectKey, workspaceArchivePayloadPresent, type NativeSnapshotDescriptor, type NativeSnapshotProvider, type NativeSnapshotRef, type TarWorkspaceArchiveDescriptor, type WorkspaceArchiveDescriptor, type WorkspaceArchiveObjectRef, type WorkspaceArchiveObjectKey, type WorkspaceTreeFingerprint, } from "./sandbox-snapshots.js";
|
|
41
41
|
export { canonicalModalCheckpointProviderBinding, type ModalCheckpointProviderBinding, } from "./checkpoint-provider-bindings.js";
|
|
42
42
|
export declare const SandboxBackend: z.ZodEnum<{
|
|
43
43
|
blaxel: "blaxel";
|
|
@@ -24195,6 +24195,7 @@ export declare const SkillImportFileSummary: z.ZodObject<{
|
|
|
24195
24195
|
}, z.core.$strip>;
|
|
24196
24196
|
export type SkillImportFileSummary = z.infer<typeof SkillImportFileSummary>;
|
|
24197
24197
|
export declare const SkillImportPreview: z.ZodObject<{
|
|
24198
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
24198
24199
|
source: z.ZodEnum<{
|
|
24199
24200
|
github: "github";
|
|
24200
24201
|
skills_sh: "skills_sh";
|
|
@@ -25418,6 +25419,7 @@ export declare const PluginInstallationSummary: z.ZodObject<{
|
|
|
25418
25419
|
description: z.ZodString;
|
|
25419
25420
|
category: z.ZodString;
|
|
25420
25421
|
tags: z.ZodArray<z.ZodString>;
|
|
25422
|
+
logoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25421
25423
|
sourceUrl: z.ZodNullable<z.ZodString>;
|
|
25422
25424
|
manifestDigest: z.ZodString;
|
|
25423
25425
|
installationVersion: z.ZodNumber;
|
|
@@ -25438,6 +25440,7 @@ export declare const ListInstalledPluginsResponse: z.ZodObject<{
|
|
|
25438
25440
|
description: z.ZodString;
|
|
25439
25441
|
category: z.ZodString;
|
|
25440
25442
|
tags: z.ZodArray<z.ZodString>;
|
|
25443
|
+
logoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25441
25444
|
sourceUrl: z.ZodNullable<z.ZodString>;
|
|
25442
25445
|
manifestDigest: z.ZodString;
|
|
25443
25446
|
installationVersion: z.ZodNumber;
|
|
@@ -25691,6 +25694,13 @@ export declare const Session: z.ZodObject<{
|
|
|
25691
25694
|
running: "running";
|
|
25692
25695
|
waiting_capacity: "waiting_capacity";
|
|
25693
25696
|
}>;
|
|
25697
|
+
failureDiagnostics: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
25698
|
+
eventId: z.ZodString;
|
|
25699
|
+
sequence: z.ZodNumber;
|
|
25700
|
+
turnId: z.ZodNullable<z.ZodString>;
|
|
25701
|
+
occurredAt: z.ZodString;
|
|
25702
|
+
payload: z.ZodUnknown;
|
|
25703
|
+
}, z.core.$strip>>>;
|
|
25694
25704
|
backgroundCommandActivity: z.ZodOptional<z.ZodObject<{
|
|
25695
25705
|
state: z.ZodEnum<{
|
|
25696
25706
|
running: "running";
|
|
@@ -26329,6 +26339,13 @@ export declare const CreateSessionResponse: z.ZodObject<{
|
|
|
26329
26339
|
running: "running";
|
|
26330
26340
|
waiting_capacity: "waiting_capacity";
|
|
26331
26341
|
}>;
|
|
26342
|
+
failureDiagnostics: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
26343
|
+
eventId: z.ZodString;
|
|
26344
|
+
sequence: z.ZodNumber;
|
|
26345
|
+
turnId: z.ZodNullable<z.ZodString>;
|
|
26346
|
+
occurredAt: z.ZodString;
|
|
26347
|
+
payload: z.ZodUnknown;
|
|
26348
|
+
}, z.core.$strip>>>;
|
|
26332
26349
|
backgroundCommandActivity: z.ZodOptional<z.ZodObject<{
|
|
26333
26350
|
state: z.ZodEnum<{
|
|
26334
26351
|
running: "running";
|
|
@@ -26973,6 +26990,13 @@ export declare const SessionListResponse: z.ZodObject<{
|
|
|
26973
26990
|
running: "running";
|
|
26974
26991
|
waiting_capacity: "waiting_capacity";
|
|
26975
26992
|
}>;
|
|
26993
|
+
failureDiagnostics: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
26994
|
+
eventId: z.ZodString;
|
|
26995
|
+
sequence: z.ZodNumber;
|
|
26996
|
+
turnId: z.ZodNullable<z.ZodString>;
|
|
26997
|
+
occurredAt: z.ZodString;
|
|
26998
|
+
payload: z.ZodUnknown;
|
|
26999
|
+
}, z.core.$strip>>>;
|
|
26976
27000
|
backgroundCommandActivity: z.ZodOptional<z.ZodObject<{
|
|
26977
27001
|
state: z.ZodEnum<{
|
|
26978
27002
|
running: "running";
|
|
@@ -27608,6 +27632,13 @@ export declare const SessionListResponse: z.ZodObject<{
|
|
|
27608
27632
|
running: "running";
|
|
27609
27633
|
waiting_capacity: "waiting_capacity";
|
|
27610
27634
|
}>;
|
|
27635
|
+
failureDiagnostics: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
27636
|
+
eventId: z.ZodString;
|
|
27637
|
+
sequence: z.ZodNumber;
|
|
27638
|
+
turnId: z.ZodNullable<z.ZodString>;
|
|
27639
|
+
occurredAt: z.ZodString;
|
|
27640
|
+
payload: z.ZodUnknown;
|
|
27641
|
+
}, z.core.$strip>>>;
|
|
27611
27642
|
backgroundCommandActivity: z.ZodOptional<z.ZodObject<{
|
|
27612
27643
|
state: z.ZodEnum<{
|
|
27613
27644
|
running: "running";
|
|
@@ -28276,6 +28307,13 @@ export declare const OrganizationSessionListResponse: z.ZodObject<{
|
|
|
28276
28307
|
running: "running";
|
|
28277
28308
|
waiting_capacity: "waiting_capacity";
|
|
28278
28309
|
}>;
|
|
28310
|
+
failureDiagnostics: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
28311
|
+
eventId: z.ZodString;
|
|
28312
|
+
sequence: z.ZodNumber;
|
|
28313
|
+
turnId: z.ZodNullable<z.ZodString>;
|
|
28314
|
+
occurredAt: z.ZodString;
|
|
28315
|
+
payload: z.ZodUnknown;
|
|
28316
|
+
}, z.core.$strip>>>;
|
|
28279
28317
|
backgroundCommandActivity: z.ZodOptional<z.ZodObject<{
|
|
28280
28318
|
state: z.ZodEnum<{
|
|
28281
28319
|
running: "running";
|
|
@@ -28918,6 +28956,13 @@ export declare const SessionLineageResponse: z.ZodObject<{
|
|
|
28918
28956
|
running: "running";
|
|
28919
28957
|
waiting_capacity: "waiting_capacity";
|
|
28920
28958
|
}>;
|
|
28959
|
+
failureDiagnostics: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
28960
|
+
eventId: z.ZodString;
|
|
28961
|
+
sequence: z.ZodNumber;
|
|
28962
|
+
turnId: z.ZodNullable<z.ZodString>;
|
|
28963
|
+
occurredAt: z.ZodString;
|
|
28964
|
+
payload: z.ZodUnknown;
|
|
28965
|
+
}, z.core.$strip>>>;
|
|
28921
28966
|
backgroundCommandActivity: z.ZodOptional<z.ZodObject<{
|
|
28922
28967
|
state: z.ZodEnum<{
|
|
28923
28968
|
running: "running";
|
|
@@ -35141,6 +35186,7 @@ export declare const MachineRuntimeCapabilities: z.ZodObject<{
|
|
|
35141
35186
|
browserBridge: z.ZodBoolean;
|
|
35142
35187
|
operationResourcePolicy: z.ZodBoolean;
|
|
35143
35188
|
operationCpuQuota: z.ZodBoolean;
|
|
35189
|
+
transactionalFsWrite: z.ZodDefault<z.ZodBoolean>;
|
|
35144
35190
|
}, z.core.$strip>;
|
|
35145
35191
|
export type MachineRuntimeCapabilities = z.infer<typeof MachineRuntimeCapabilities>;
|
|
35146
35192
|
export declare const MachineUpdateStatus: z.ZodEnum<{
|
|
@@ -35204,6 +35250,7 @@ export declare const MachineRuntime: z.ZodObject<{
|
|
|
35204
35250
|
browserBridge: z.ZodBoolean;
|
|
35205
35251
|
operationResourcePolicy: z.ZodBoolean;
|
|
35206
35252
|
operationCpuQuota: z.ZodBoolean;
|
|
35253
|
+
transactionalFsWrite: z.ZodDefault<z.ZodBoolean>;
|
|
35207
35254
|
}, z.core.$strip>;
|
|
35208
35255
|
update: z.ZodNullable<z.ZodObject<{
|
|
35209
35256
|
operationId: z.ZodString;
|
|
@@ -35335,6 +35382,7 @@ export declare const MachineView: z.ZodObject<{
|
|
|
35335
35382
|
browserBridge: z.ZodBoolean;
|
|
35336
35383
|
operationResourcePolicy: z.ZodBoolean;
|
|
35337
35384
|
operationCpuQuota: z.ZodBoolean;
|
|
35385
|
+
transactionalFsWrite: z.ZodDefault<z.ZodBoolean>;
|
|
35338
35386
|
}, z.core.$strip>;
|
|
35339
35387
|
update: z.ZodNullable<z.ZodObject<{
|
|
35340
35388
|
operationId: z.ZodString;
|
|
@@ -35464,6 +35512,7 @@ export declare const MachinesResponse: z.ZodObject<{
|
|
|
35464
35512
|
browserBridge: z.ZodBoolean;
|
|
35465
35513
|
operationResourcePolicy: z.ZodBoolean;
|
|
35466
35514
|
operationCpuQuota: z.ZodBoolean;
|
|
35515
|
+
transactionalFsWrite: z.ZodDefault<z.ZodBoolean>;
|
|
35467
35516
|
}, z.core.$strip>;
|
|
35468
35517
|
update: z.ZodNullable<z.ZodObject<{
|
|
35469
35518
|
operationId: z.ZodString;
|
|
@@ -37499,3 +37548,6 @@ export * from "./organization-membership-lifecycle.js";
|
|
|
37499
37548
|
export * from "./remember.js";
|
|
37500
37549
|
export * from "./agent-authored-durable-text.js";
|
|
37501
37550
|
export * from "./feedback.js";
|
|
37551
|
+
export type { PluginDiscoveryItem, PluginDiscoveryPage } from "./plugin-discovery.js";
|
|
37552
|
+
export { mcpEndpointIdentity } from "./mcp-endpoint.js";
|
|
37553
|
+
export { pluginMcpUnavailableReason } from "./mcp-endpoint.js";
|
package/dist/index.js
CHANGED
|
@@ -1798,6 +1798,7 @@ import {
|
|
|
1798
1798
|
omitInlineWorkspaceArchiveWhenObjectRefPresent,
|
|
1799
1799
|
parseSkillFrontmatter,
|
|
1800
1800
|
parseWorkspaceArchiveDescriptor,
|
|
1801
|
+
parseWorkspaceArchiveObjectKey,
|
|
1801
1802
|
parseWorkspaceArchiveObjectRef,
|
|
1802
1803
|
prefixedMcpToolName,
|
|
1803
1804
|
readCodexCredentialPolicySnapshotV1,
|
|
@@ -1851,6 +1852,7 @@ import {
|
|
|
1851
1852
|
toolResultSpillSandboxPath,
|
|
1852
1853
|
turnExecutionPolicyAuditMetadata,
|
|
1853
1854
|
validateSkillTextFiles,
|
|
1855
|
+
validateWorkspaceArchiveObjectRef,
|
|
1854
1856
|
variableSetVariableNameReservation,
|
|
1855
1857
|
verifyDelegatedAccessToken,
|
|
1856
1858
|
verifyEnrollToken,
|
|
@@ -1864,7 +1866,11 @@ import {
|
|
|
1864
1866
|
workspaceLearningPolicyRouterContext,
|
|
1865
1867
|
workspaceLearningSourceKey,
|
|
1866
1868
|
workspaceSlackReactionChannelAllowed
|
|
1867
|
-
} from "./chunk-
|
|
1869
|
+
} from "./chunk-YRCMZTY2.js";
|
|
1870
|
+
import {
|
|
1871
|
+
mcpEndpointIdentity,
|
|
1872
|
+
pluginMcpUnavailableReason
|
|
1873
|
+
} from "./chunk-WBYTNVIW.js";
|
|
1868
1874
|
import {
|
|
1869
1875
|
CONNECTOR_ATTACHMENT_FILENAME_MAX_UTF8_BYTES,
|
|
1870
1876
|
CONNECTOR_ATTACHMENT_MAX_BYTES,
|
|
@@ -4191,6 +4197,7 @@ export {
|
|
|
4191
4197
|
isToolResultSpilledReceipt,
|
|
4192
4198
|
latencyModeForMetadata,
|
|
4193
4199
|
legacyWorkspaceConnectorDocumentDestination,
|
|
4200
|
+
mcpEndpointIdentity,
|
|
4194
4201
|
measureSessionEventJson,
|
|
4195
4202
|
mergeResourceRefs,
|
|
4196
4203
|
mergeToolRefs,
|
|
@@ -4215,7 +4222,9 @@ export {
|
|
|
4215
4222
|
parseConnectorAttachmentTransferEnvelope,
|
|
4216
4223
|
parseSkillFrontmatter,
|
|
4217
4224
|
parseWorkspaceArchiveDescriptor,
|
|
4225
|
+
parseWorkspaceArchiveObjectKey,
|
|
4218
4226
|
parseWorkspaceArchiveObjectRef,
|
|
4227
|
+
pluginMcpUnavailableReason,
|
|
4219
4228
|
prefixedMcpToolName,
|
|
4220
4229
|
readCodexCredentialPolicySnapshotV1,
|
|
4221
4230
|
readCodexFleetReplayRecordV1,
|
|
@@ -4279,6 +4288,7 @@ export {
|
|
|
4279
4288
|
turnExecutionPolicyAuditMetadata,
|
|
4280
4289
|
validateRetainedOutputEvidence,
|
|
4281
4290
|
validateSkillTextFiles,
|
|
4291
|
+
validateWorkspaceArchiveObjectRef,
|
|
4282
4292
|
variableSetVariableNameReservation,
|
|
4283
4293
|
verifyDelegatedAccessToken,
|
|
4284
4294
|
verifyEnrollToken,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Exact endpoint identity: normalize URL syntax, preserve paths and query parameters. */
|
|
2
|
+
export declare function mcpEndpointIdentity(value: string | null | undefined): string | null;
|
|
3
|
+
export declare function pluginMcpUnavailableReason(server: {
|
|
4
|
+
endpoint: string | null;
|
|
5
|
+
transport?: string;
|
|
6
|
+
requiresConfiguration?: boolean;
|
|
7
|
+
}): string | null;
|
package/dist/personal-github.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/personal-github.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\n\nexport const PERSONAL_GITHUB_PROVIDER_DOMAIN = \"github.com\" as const;\nexport const PERSONAL_GITHUB_PROVIDER_FAMILY = \"github\" as const;\nexport const PERSONAL_GITHUB_CREDENTIAL_ROLE = \"opengeni_github_personal\" as const;\nexport const PERSONAL_GITHUB_CONNECTION_SURFACE_ID = \"github:personal\" as const;\nexport const PERSONAL_GITHUB_REQUESTED_SCOPES = [\"repo\"] as const;\nexport const PERSONAL_GITHUB_AUTHORIZATION_URL =\n \"https://github.com/login/oauth/authorize\" as const;\nexport const PERSONAL_GITHUB_TOKEN_URL = \"https://github.com/login/oauth/access_token\" as const;\nexport const PERSONAL_GITHUB_USER_URL = \"https://api.github.com/user\" as const;\nexport const PERSONAL_GITHUB_API_ORIGIN = \"https://api.github.com\" as const;\nexport const PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX = 100 as const;\n\nexport const PersonalGitHubRepositoryId = z.string().regex(/^[1-9]\\d*$/u);\nexport type PersonalGitHubRepositoryId = z.infer<typeof PersonalGitHubRepositoryId>;\n\nexport const PersonalGitHubRepositoryAccess = z.enum([\"read\", \"write\"]);\nexport type PersonalGitHubRepositoryAccess = z.infer<typeof PersonalGitHubRepositoryAccess>;\n\nexport const PersonalGitHubRepositoryPermissions = z\n .object({\n pull: z.boolean(),\n push: z.boolean(),\n admin: z.boolean(),\n maintain: z.boolean(),\n triage: z.boolean(),\n })\n .strict();\nexport type PersonalGitHubRepositoryPermissions = z.infer<\n typeof PersonalGitHubRepositoryPermissions\n>;\n\nexport const PersonalGitHubRepositoryVisibility = z.enum([\"public\", \"private\", \"internal\"]);\nexport type PersonalGitHubRepositoryVisibility = z.infer<typeof PersonalGitHubRepositoryVisibility>;\n\nconst PersonalGitHubRepositoryFullName = z\n .string()\n .min(3)\n .max(140)\n .regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\\/[A-Za-z0-9_.-]{1,100}$/u);\n\nexport function canonicalPersonalGitHubRepositoryUrl(fullName: string): string {\n return `https://github.com/${fullName}`;\n}\n\n/** A bounded, credential-free projection verified directly against GitHub. */\nexport const PersonalGitHubRepository = z\n .object({\n repositoryId: PersonalGitHubRepositoryId,\n fullName: PersonalGitHubRepositoryFullName,\n canonicalUrl: z.string().url().max(512),\n defaultBranch: z.string().min(1).max(255),\n visibility: PersonalGitHubRepositoryVisibility,\n private: z.boolean(),\n archived: z.boolean(),\n disabled: z.boolean(),\n permissions: PersonalGitHubRepositoryPermissions,\n })\n .strict()\n .superRefine((repository, context) => {\n if (repository.canonicalUrl !== canonicalPersonalGitHubRepositoryUrl(repository.fullName)) {\n context.addIssue({\n code: \"custom\",\n path: [\"canonicalUrl\"],\n message: \"canonicalUrl must be derived from fullName\",\n });\n }\n if (repository.private !== (repository.visibility === \"private\")) {\n context.addIssue({\n code: \"custom\",\n path: [\"private\"],\n message: \"private must agree with visibility\",\n });\n }\n });\nexport type PersonalGitHubRepository = z.infer<typeof PersonalGitHubRepository>;\n\nexport const PersonalGitHubSelectedRepository = PersonalGitHubRepository.safeExtend({\n selectedAccess: PersonalGitHubRepositoryAccess,\n selectionGeneration: z.number().int().positive(),\n selectedAt: z.string().datetime({ offset: true }),\n lastVerifiedAt: z.string().datetime({ offset: true }),\n}).strict();\nexport type PersonalGitHubSelectedRepository = z.infer<typeof PersonalGitHubSelectedRepository>;\n\nexport const PersonalGitHubRepositorySelectionState = z\n .object({\n connectionAuthorityGeneration: z.number().int().positive(),\n credentialBindingId: z.string().uuid(),\n providerPrincipalId: PersonalGitHubRepositoryId,\n selectionGeneration: z.number().int().nonnegative(),\n repositories: z\n .array(PersonalGitHubSelectedRepository)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n })\n .strict();\nexport type PersonalGitHubRepositorySelectionState = z.infer<\n typeof PersonalGitHubRepositorySelectionState\n>;\n\nexport const ListPersonalGitHubRepositoriesQuery = z\n .object({\n cursor: z.coerce.number().int().positive().max(10_000).default(1),\n limit: z.coerce.number().int().min(1).max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX).default(50),\n })\n .strict();\nexport type ListPersonalGitHubRepositoriesQuery = z.infer<\n typeof ListPersonalGitHubRepositoriesQuery\n>;\n\nexport const PersonalGitHubRepositoryCatalogItem = PersonalGitHubRepository.safeExtend({\n selectedAccess: PersonalGitHubRepositoryAccess.nullable(),\n}).strict();\nexport type PersonalGitHubRepositoryCatalogItem = z.infer<\n typeof PersonalGitHubRepositoryCatalogItem\n>;\n\nexport const ListPersonalGitHubRepositoriesResponse = z\n .object({\n repositories: z\n .array(PersonalGitHubRepositoryCatalogItem)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n nextCursor: z.number().int().positive().nullable(),\n selection: PersonalGitHubRepositorySelectionState,\n })\n .strict();\nexport type ListPersonalGitHubRepositoriesResponse = z.infer<\n typeof ListPersonalGitHubRepositoriesResponse\n>;\n\nexport const PersonalGitHubRepositorySelectionInput = z\n .object({\n repositoryId: PersonalGitHubRepositoryId,\n fullName: PersonalGitHubRepositoryFullName,\n access: PersonalGitHubRepositoryAccess,\n })\n .strict();\nexport type PersonalGitHubRepositorySelectionInput = z.infer<\n typeof PersonalGitHubRepositorySelectionInput\n>;\n\nexport const ReplacePersonalGitHubRepositorySelectionsRequest = z\n .object({\n expectedConnectionAuthorityGeneration: z.number().int().positive(),\n expectedSelectionGeneration: z.number().int().nonnegative(),\n idempotencyKey: z.string().trim().min(1).max(200),\n repositories: z\n .array(PersonalGitHubRepositorySelectionInput)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n })\n .strict()\n .superRefine((request, context) => {\n const repositoryIds = new Set<string>();\n const fullNames = new Set<string>();\n request.repositories.forEach((repository, index) => {\n const normalizedFullName = repository.fullName.toLowerCase();\n if (repositoryIds.has(repository.repositoryId)) {\n context.addIssue({\n code: \"custom\",\n path: [\"repositories\", index, \"repositoryId\"],\n message: \"repositoryId must be unique\",\n });\n }\n if (fullNames.has(normalizedFullName)) {\n context.addIssue({\n code: \"custom\",\n path: [\"repositories\", index, \"fullName\"],\n message: \"fullName must be unique\",\n });\n }\n repositoryIds.add(repository.repositoryId);\n fullNames.add(normalizedFullName);\n });\n });\nexport type ReplacePersonalGitHubRepositorySelectionsRequest = z.infer<\n typeof ReplacePersonalGitHubRepositorySelectionsRequest\n>;\n\nexport const VerifyPersonalGitHubRepositorySelectionsRequest = z\n .object({\n expectedConnectionAuthorityGeneration: z.number().int().positive(),\n expectedSelectionGeneration: z.number().int().nonnegative(),\n idempotencyKey: z.string().trim().min(1).max(200),\n })\n .strict();\nexport type VerifyPersonalGitHubRepositorySelectionsRequest = z.infer<\n typeof VerifyPersonalGitHubRepositorySelectionsRequest\n>;\n\n/**\n * Owner-visible, credential-free metadata for one dedicated personal GitHub\n * OAuth connection. Repository selections are a separate authority and never\n * live in this credential record.\n */\nexport const PersonalGitHubConnectionMetadata = z\n .object({\n credentialRole: z.literal(PERSONAL_GITHUB_CREDENTIAL_ROLE),\n providerFamily: z.literal(PERSONAL_GITHUB_PROVIDER_FAMILY),\n providerPrincipalId: z.string().regex(/^\\d+$/u),\n githubUserId: z.string().regex(/^\\d+$/u),\n githubLogin: z.string().min(1).max(100),\n oauthEnvironment: z.string().min(1).max(128),\n oauthClientMarker: z.string().regex(/^[a-f0-9]{32}$/u),\n credentialBindingId: z.string().uuid(),\n connectedAt: z.string().datetime({ offset: true }),\n lastVerifiedAt: z.string().datetime({ offset: true }),\n disconnectedAt: z.string().datetime({ offset: true }).nullable().optional(),\n refreshTokenExpiresAt: z.string().datetime({ offset: true }).nullable().optional(),\n })\n .passthrough();\nexport type PersonalGitHubConnectionMetadata = z.infer<typeof PersonalGitHubConnectionMetadata>;\n\nexport const PersonalGitHubOAuthStartRequest = z\n .object({\n /** Existing exact connection generation to re-authorize in place. */\n connectionId: z.string().uuid().optional(),\n /** Same-workspace UI path restored after the callback. */\n returnPath: z.string().min(1).max(2048).optional(),\n })\n .strict();\nexport type PersonalGitHubOAuthStartRequest = z.infer<typeof PersonalGitHubOAuthStartRequest>;\n\nexport const PersonalGitHubOAuthStartResponse = z\n .object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n })\n .strict();\nexport type PersonalGitHubOAuthStartResponse = z.infer<typeof PersonalGitHubOAuthStartResponse>;\n\nexport const PersonalGitHubConnectionStatusResponse = z\n .object({\n enabled: z.boolean(),\n connection: ConnectionMetadata.nullable(),\n reviewUrl: z.string().url().nullable(),\n })\n .strict();\nexport type PersonalGitHubConnectionStatusResponse = z.infer<\n typeof PersonalGitHubConnectionStatusResponse\n>;\n\nexport const PersonalGitHubDisconnectRequest = z\n .object({\n expectedVersion: z.number().int().positive(),\n idempotencyKey: z.string().trim().min(1).max(200),\n })\n .strict();\nexport type PersonalGitHubDisconnectRequest = z.infer<typeof PersonalGitHubDisconnectRequest>;\n\nexport function isPersonalGitHubConnection(\n connection: Pick<z.infer<typeof ConnectionMetadata>, \"providerDomain\" | \"kind\" | \"metadata\">,\n): boolean {\n return (\n connection.providerDomain.toLowerCase() === PERSONAL_GITHUB_PROVIDER_DOMAIN &&\n connection.kind === \"oauth2\" &&\n PersonalGitHubConnectionMetadata.safeParse(connection.metadata).success\n );\n}\n\nexport function hasReservedPersonalGitHubMetadata(\n metadata: Record<string, unknown> | undefined,\n): boolean {\n return metadata?.credentialRole === PERSONAL_GITHUB_CREDENTIAL_ROLE;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAIX,IAAM,kCAAkC;AACxC,IAAM,kCAAkC;AACxC,IAAM,kCAAkC;AACxC,IAAM,wCAAwC;AAC9C,IAAM,mCAAmC,CAAC,MAAM;AAChD,IAAM,oCACX;AACK,IAAM,4BAA4B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mBAAmB,SAAS;AAAA,EACxC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AACvC,CAAC,EACA,OAAO;AAKH,IAAM,kCAAkC,EAC5C,OAAO;AAAA,EACN,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAC3C,gBAAgB,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAClD,CAAC,EACA,OAAO;AAGH,SAAS,2BACd,YACS;AACT,SACE,WAAW,eAAe,YAAY,MAAM,mCAC5C,WAAW,SAAS,YACpB,iCAAiC,UAAU,WAAW,QAAQ,EAAE;AAEpE;AAEO,SAAS,kCACd,UACS;AACT,SAAO,UAAU,mBAAmB;AACtC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/personal-github.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\n\nexport const PERSONAL_GITHUB_PROVIDER_DOMAIN = \"github.com\" as const;\nexport const PERSONAL_GITHUB_PROVIDER_FAMILY = \"github\" as const;\nexport const PERSONAL_GITHUB_CREDENTIAL_ROLE = \"opengeni_github_personal\" as const;\nexport const PERSONAL_GITHUB_CONNECTION_SURFACE_ID = \"github:personal\" as const;\nexport const PERSONAL_GITHUB_REQUESTED_SCOPES = [\"repo\"] as const;\nexport const PERSONAL_GITHUB_AUTHORIZATION_URL =\n \"https://github.com/login/oauth/authorize\" as const;\nexport const PERSONAL_GITHUB_TOKEN_URL = \"https://github.com/login/oauth/access_token\" as const;\nexport const PERSONAL_GITHUB_USER_URL = \"https://api.github.com/user\" as const;\nexport const PERSONAL_GITHUB_API_ORIGIN = \"https://api.github.com\" as const;\nexport const PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX = 100 as const;\n\nexport const PersonalGitHubRepositoryId = z.string().regex(/^[1-9]\\d*$/u);\nexport type PersonalGitHubRepositoryId = z.infer<typeof PersonalGitHubRepositoryId>;\n\nexport const PersonalGitHubRepositoryAccess = z.enum([\"read\", \"write\"]);\nexport type PersonalGitHubRepositoryAccess = z.infer<typeof PersonalGitHubRepositoryAccess>;\n\nexport const PersonalGitHubRepositoryPermissions = z\n .object({\n pull: z.boolean(),\n push: z.boolean(),\n admin: z.boolean(),\n maintain: z.boolean(),\n triage: z.boolean(),\n })\n .strict();\nexport type PersonalGitHubRepositoryPermissions = z.infer<\n typeof PersonalGitHubRepositoryPermissions\n>;\n\nexport const PersonalGitHubRepositoryVisibility = z.enum([\"public\", \"private\", \"internal\"]);\nexport type PersonalGitHubRepositoryVisibility = z.infer<typeof PersonalGitHubRepositoryVisibility>;\n\nconst PersonalGitHubRepositoryFullName = z\n .string()\n .min(3)\n .max(140)\n .regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\\/[A-Za-z0-9_.-]{1,100}$/u);\n\nexport function canonicalPersonalGitHubRepositoryUrl(fullName: string): string {\n return `https://github.com/${fullName}`;\n}\n\n/** A bounded, credential-free projection verified directly against GitHub. */\nexport const PersonalGitHubRepository = z\n .object({\n repositoryId: PersonalGitHubRepositoryId,\n fullName: PersonalGitHubRepositoryFullName,\n canonicalUrl: z.string().url().max(512),\n defaultBranch: z.string().min(1).max(255),\n visibility: PersonalGitHubRepositoryVisibility,\n private: z.boolean(),\n archived: z.boolean(),\n disabled: z.boolean(),\n permissions: PersonalGitHubRepositoryPermissions,\n })\n .strict()\n .superRefine((repository, context) => {\n if (repository.canonicalUrl !== canonicalPersonalGitHubRepositoryUrl(repository.fullName)) {\n context.addIssue({\n code: \"custom\",\n path: [\"canonicalUrl\"],\n message: \"canonicalUrl must be derived from fullName\",\n });\n }\n if (repository.private !== (repository.visibility === \"private\")) {\n context.addIssue({\n code: \"custom\",\n path: [\"private\"],\n message: \"private must agree with visibility\",\n });\n }\n });\nexport type PersonalGitHubRepository = z.infer<typeof PersonalGitHubRepository>;\n\nexport const PersonalGitHubSelectedRepository = PersonalGitHubRepository.safeExtend({\n selectedAccess: PersonalGitHubRepositoryAccess,\n selectionGeneration: z.number().int().positive(),\n selectedAt: z.string().datetime({ offset: true }),\n lastVerifiedAt: z.string().datetime({ offset: true }),\n}).strict();\nexport type PersonalGitHubSelectedRepository = z.infer<typeof PersonalGitHubSelectedRepository>;\n\nexport const PersonalGitHubRepositorySelectionState = z\n .object({\n connectionAuthorityGeneration: z.number().int().positive(),\n credentialBindingId: z.string().uuid(),\n providerPrincipalId: PersonalGitHubRepositoryId,\n selectionGeneration: z.number().int().nonnegative(),\n repositories: z\n .array(PersonalGitHubSelectedRepository)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n })\n .strict();\nexport type PersonalGitHubRepositorySelectionState = z.infer<\n typeof PersonalGitHubRepositorySelectionState\n>;\n\nexport const ListPersonalGitHubRepositoriesQuery = z\n .object({\n cursor: z.coerce.number().int().positive().max(10_000).default(1),\n limit: z.coerce.number().int().min(1).max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX).default(50),\n })\n .strict();\nexport type ListPersonalGitHubRepositoriesQuery = z.infer<\n typeof ListPersonalGitHubRepositoriesQuery\n>;\n\nexport const PersonalGitHubRepositoryCatalogItem = PersonalGitHubRepository.safeExtend({\n selectedAccess: PersonalGitHubRepositoryAccess.nullable(),\n}).strict();\nexport type PersonalGitHubRepositoryCatalogItem = z.infer<\n typeof PersonalGitHubRepositoryCatalogItem\n>;\n\nexport const ListPersonalGitHubRepositoriesResponse = z\n .object({\n repositories: z\n .array(PersonalGitHubRepositoryCatalogItem)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n nextCursor: z.number().int().positive().nullable(),\n selection: PersonalGitHubRepositorySelectionState,\n })\n .strict();\nexport type ListPersonalGitHubRepositoriesResponse = z.infer<\n typeof ListPersonalGitHubRepositoriesResponse\n>;\n\nexport const PersonalGitHubRepositorySelectionInput = z\n .object({\n repositoryId: PersonalGitHubRepositoryId,\n fullName: PersonalGitHubRepositoryFullName,\n access: PersonalGitHubRepositoryAccess,\n })\n .strict();\nexport type PersonalGitHubRepositorySelectionInput = z.infer<\n typeof PersonalGitHubRepositorySelectionInput\n>;\n\nexport const ReplacePersonalGitHubRepositorySelectionsRequest = z\n .object({\n expectedConnectionAuthorityGeneration: z.number().int().positive(),\n expectedSelectionGeneration: z.number().int().nonnegative(),\n idempotencyKey: z.string().trim().min(1).max(200),\n repositories: z\n .array(PersonalGitHubRepositorySelectionInput)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n })\n .strict()\n .superRefine((request, context) => {\n const repositoryIds = new Set<string>();\n const fullNames = new Set<string>();\n request.repositories.forEach((repository, index) => {\n const normalizedFullName = repository.fullName.toLowerCase();\n if (repositoryIds.has(repository.repositoryId)) {\n context.addIssue({\n code: \"custom\",\n path: [\"repositories\", index, \"repositoryId\"],\n message: \"repositoryId must be unique\",\n });\n }\n if (fullNames.has(normalizedFullName)) {\n context.addIssue({\n code: \"custom\",\n path: [\"repositories\", index, \"fullName\"],\n message: \"fullName must be unique\",\n });\n }\n repositoryIds.add(repository.repositoryId);\n fullNames.add(normalizedFullName);\n });\n });\nexport type ReplacePersonalGitHubRepositorySelectionsRequest = z.infer<\n typeof ReplacePersonalGitHubRepositorySelectionsRequest\n>;\n\nexport const VerifyPersonalGitHubRepositorySelectionsRequest = z\n .object({\n expectedConnectionAuthorityGeneration: z.number().int().positive(),\n expectedSelectionGeneration: z.number().int().nonnegative(),\n idempotencyKey: z.string().trim().min(1).max(200),\n })\n .strict();\nexport type VerifyPersonalGitHubRepositorySelectionsRequest = z.infer<\n typeof VerifyPersonalGitHubRepositorySelectionsRequest\n>;\n\n/**\n * Owner-visible, credential-free metadata for one dedicated personal GitHub\n * OAuth connection. Repository selections are a separate authority and never\n * live in this credential record.\n */\nexport const PersonalGitHubConnectionMetadata = z\n .object({\n credentialRole: z.literal(PERSONAL_GITHUB_CREDENTIAL_ROLE),\n providerFamily: z.literal(PERSONAL_GITHUB_PROVIDER_FAMILY),\n providerPrincipalId: z.string().regex(/^\\d+$/u),\n githubUserId: z.string().regex(/^\\d+$/u),\n githubLogin: z.string().min(1).max(100),\n oauthEnvironment: z.string().min(1).max(128),\n oauthClientMarker: z.string().regex(/^[a-f0-9]{32}$/u),\n credentialBindingId: z.string().uuid(),\n connectedAt: z.string().datetime({ offset: true }),\n lastVerifiedAt: z.string().datetime({ offset: true }),\n disconnectedAt: z.string().datetime({ offset: true }).nullable().optional(),\n refreshTokenExpiresAt: z.string().datetime({ offset: true }).nullable().optional(),\n })\n .passthrough();\nexport type PersonalGitHubConnectionMetadata = z.infer<typeof PersonalGitHubConnectionMetadata>;\n\nexport const PersonalGitHubOAuthStartRequest = z\n .object({\n /** Existing exact connection generation to re-authorize in place. */\n connectionId: z.string().uuid().optional(),\n /** Same-workspace UI path restored after the callback. */\n returnPath: z.string().min(1).max(2048).optional(),\n })\n .strict();\nexport type PersonalGitHubOAuthStartRequest = z.infer<typeof PersonalGitHubOAuthStartRequest>;\n\nexport const PersonalGitHubOAuthStartResponse = z\n .object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n })\n .strict();\nexport type PersonalGitHubOAuthStartResponse = z.infer<typeof PersonalGitHubOAuthStartResponse>;\n\nexport const PersonalGitHubConnectionStatusResponse = z\n .object({\n enabled: z.boolean(),\n connection: ConnectionMetadata.nullable(),\n reviewUrl: z.string().url().nullable(),\n })\n .strict();\nexport type PersonalGitHubConnectionStatusResponse = z.infer<\n typeof PersonalGitHubConnectionStatusResponse\n>;\n\nexport const PersonalGitHubDisconnectRequest = z\n .object({\n expectedVersion: z.number().int().positive(),\n idempotencyKey: z.string().trim().min(1).max(200),\n })\n .strict();\nexport type PersonalGitHubDisconnectRequest = z.infer<typeof PersonalGitHubDisconnectRequest>;\n\nexport function isPersonalGitHubConnection(\n connection: Pick<z.infer<typeof ConnectionMetadata>, \"providerDomain\" | \"kind\" | \"metadata\">,\n): boolean {\n return (\n connection.providerDomain.toLowerCase() === PERSONAL_GITHUB_PROVIDER_DOMAIN &&\n connection.kind === \"oauth2\" &&\n PersonalGitHubConnectionMetadata.safeParse(connection.metadata).success\n );\n}\n\nexport function hasReservedPersonalGitHubMetadata(\n metadata: Record<string, unknown> | undefined,\n): boolean {\n return metadata?.credentialRole === PERSONAL_GITHUB_CREDENTIAL_ROLE;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAIX,IAAM,kCAAkC;AACxC,IAAM,kCAAkC;AACxC,IAAM,kCAAkC;AACxC,IAAM,wCAAwC;AAC9C,IAAM,mCAAmC,CAAC,MAAM;AAChD,IAAM,oCACX;AACK,IAAM,4BAA4B;AAClC,IAAM,2BAA2B;AACjC,IAAM,6BAA6B;AACnC,IAAM,yCAAyC;AAE/C,IAAM,6BAA6B,EAAE,OAAO,EAAE,MAAM,aAAa;AAGjE,IAAM,iCAAiC,EAAE,KAAK,CAAC,QAAQ,OAAO,CAAC;AAG/D,IAAM,sCAAsC,EAChD,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ;AAAA,EAChB,MAAM,EAAE,QAAQ;AAAA,EAChB,OAAO,EAAE,QAAQ;AAAA,EACjB,UAAU,EAAE,QAAQ;AAAA,EACpB,QAAQ,EAAE,QAAQ;AACpB,CAAC,EACA,OAAO;AAKH,IAAM,qCAAqC,EAAE,KAAK,CAAC,UAAU,WAAW,UAAU,CAAC;AAG1F,IAAM,mCAAmC,EACtC,OAAO,EACP,IAAI,CAAC,EACL,IAAI,GAAG,EACP,MAAM,6DAA6D;AAE/D,SAAS,qCAAqC,UAA0B;AAC7E,SAAO,sBAAsB,QAAQ;AACvC;AAGO,IAAM,2BAA2B,EACrC,OAAO;AAAA,EACN,cAAc;AAAA,EACd,UAAU;AAAA,EACV,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG;AAAA,EACtC,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EACxC,YAAY;AAAA,EACZ,SAAS,EAAE,QAAQ;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