codexgpt 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.example.md +20 -0
- package/CHANGELOG.md +342 -0
- package/CHATGPT_PROMPT.md +12 -0
- package/CLOUDFLARED_VERIFIED_INSTALL.md +94 -0
- package/CODEX_PROMPT.md +12 -0
- package/CONTRIBUTING.md +62 -0
- package/DOMAIN_SETUP.md +275 -0
- package/FAQ.md +366 -0
- package/FAQ_ZH.md +329 -0
- package/LICENSE +21 -0
- package/PUBLIC_LAUNCH_CHECKLIST.md +111 -0
- package/README.md +490 -0
- package/README_ZH.md +747 -0
- package/SECURITY.md +295 -0
- package/config.example.env +103 -0
- package/dist/access/fullAccessLease.js +148 -0
- package/dist/access/fullAccessLease.js.map +1 -0
- package/dist/access/protectedRoots.js +122 -0
- package/dist/access/protectedRoots.js.map +1 -0
- package/dist/access/rootAdmission.js +347 -0
- package/dist/access/rootAdmission.js.map +1 -0
- package/dist/analysis/cache.js +27 -0
- package/dist/analysis/cache.js.map +1 -0
- package/dist/analysis/classify.js +102 -0
- package/dist/analysis/classify.js.map +1 -0
- package/dist/analysis/extract.js +139 -0
- package/dist/analysis/extract.js.map +1 -0
- package/dist/analysis/graph.js +22 -0
- package/dist/analysis/graph.js.map +1 -0
- package/dist/analysis/impact.js +167 -0
- package/dist/analysis/impact.js.map +1 -0
- package/dist/analysis/index.js +215 -0
- package/dist/analysis/index.js.map +1 -0
- package/dist/analysis/inventory.js +51 -0
- package/dist/analysis/inventory.js.map +1 -0
- package/dist/analysis/providers.js +24 -0
- package/dist/analysis/providers.js.map +1 -0
- package/dist/analysis/rank.js +27 -0
- package/dist/analysis/rank.js.map +1 -0
- package/dist/analysis/types.js +8 -0
- package/dist/analysis/types.js.map +1 -0
- package/dist/audit/canonicalJson.js +79 -0
- package/dist/audit/canonicalJson.js.map +1 -0
- package/dist/audit/diagnostics.js +128 -0
- package/dist/audit/diagnostics.js.map +1 -0
- package/dist/audit/index.js +12 -0
- package/dist/audit/index.js.map +1 -0
- package/dist/audit/lifecycleV3.js +53 -0
- package/dist/audit/lifecycleV3.js.map +1 -0
- package/dist/audit/lifecycleV4.js +70 -0
- package/dist/audit/lifecycleV4.js.map +1 -0
- package/dist/audit/lock.js +195 -0
- package/dist/audit/lock.js.map +1 -0
- package/dist/audit/queryTool.js +120 -0
- package/dist/audit/queryTool.js.map +1 -0
- package/dist/audit/runtime.js +48 -0
- package/dist/audit/runtime.js.map +1 -0
- package/dist/audit/schemas.js +640 -0
- package/dist/audit/schemas.js.map +1 -0
- package/dist/audit/store.js +1309 -0
- package/dist/audit/store.js.map +1 -0
- package/dist/audit/transactionParticipant.js +45 -0
- package/dist/audit/transactionParticipant.js.map +1 -0
- package/dist/audit/types.js +11 -0
- package/dist/audit/types.js.map +1 -0
- package/dist/auth/audit.js +44 -0
- package/dist/auth/audit.js.map +1 -0
- package/dist/auth/authorizationStore.js +333 -0
- package/dist/auth/authorizationStore.js.map +1 -0
- package/dist/auth/challenges.js +25 -0
- package/dist/auth/challenges.js.map +1 -0
- package/dist/auth/clientStore.js +469 -0
- package/dist/auth/clientStore.js.map +1 -0
- package/dist/auth/cloudflareConfig.js +112 -0
- package/dist/auth/cloudflareConfig.js.map +1 -0
- package/dist/auth/configuration.js +167 -0
- package/dist/auth/configuration.js.map +1 -0
- package/dist/auth/credentialStore.js +65 -0
- package/dist/auth/credentialStore.js.map +1 -0
- package/dist/auth/deploymentLock.js +220 -0
- package/dist/auth/deploymentLock.js.map +1 -0
- package/dist/auth/deploymentRegistry.js +149 -0
- package/dist/auth/deploymentRegistry.js.map +1 -0
- package/dist/auth/errors.js +26 -0
- package/dist/auth/errors.js.map +1 -0
- package/dist/auth/grantStore.js +307 -0
- package/dist/auth/grantStore.js.map +1 -0
- package/dist/auth/index.js +39 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/keyManager.js +148 -0
- package/dist/auth/keyManager.js.map +1 -0
- package/dist/auth/localAdminSession.js +173 -0
- package/dist/auth/localAdminSession.js.map +1 -0
- package/dist/auth/metadata.js +69 -0
- package/dist/auth/metadata.js.map +1 -0
- package/dist/auth/oauthProvider.js +589 -0
- package/dist/auth/oauthProvider.js.map +1 -0
- package/dist/auth/ownerApproval.js +51 -0
- package/dist/auth/ownerApproval.js.map +1 -0
- package/dist/auth/policyIdentity.js +189 -0
- package/dist/auth/policyIdentity.js.map +1 -0
- package/dist/auth/rateLimits.js +66 -0
- package/dist/auth/rateLimits.js.map +1 -0
- package/dist/auth/recovery.js +275 -0
- package/dist/auth/recovery.js.map +1 -0
- package/dist/auth/requestContext.js +34 -0
- package/dist/auth/requestContext.js.map +1 -0
- package/dist/auth/resourceMiddleware.js +147 -0
- package/dist/auth/resourceMiddleware.js.map +1 -0
- package/dist/auth/runtimeStatus.js +51 -0
- package/dist/auth/runtimeStatus.js.map +1 -0
- package/dist/auth/schemas.js +84 -0
- package/dist/auth/schemas.js.map +1 -0
- package/dist/auth/stateStore.js +468 -0
- package/dist/auth/stateStore.js.map +1 -0
- package/dist/auth/tokenService.js +631 -0
- package/dist/auth/tokenService.js.map +1 -0
- package/dist/auth/toolSecurity.js +108 -0
- package/dist/auth/toolSecurity.js.map +1 -0
- package/dist/auth/types.js +6 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/auth/windowsDpapi.js +193 -0
- package/dist/auth/windowsDpapi.js.map +1 -0
- package/dist/bashOps.js +292 -0
- package/dist/bashOps.js.map +1 -0
- package/dist/capabilitiesOps.js +412 -0
- package/dist/capabilitiesOps.js.map +1 -0
- package/dist/changesets/crypto.js +92 -0
- package/dist/changesets/crypto.js.map +1 -0
- package/dist/changesets/index.js +9 -0
- package/dist/changesets/index.js.map +1 -0
- package/dist/changesets/moveStore.js +237 -0
- package/dist/changesets/moveStore.js.map +1 -0
- package/dist/changesets/moveUndo.js +386 -0
- package/dist/changesets/moveUndo.js.map +1 -0
- package/dist/changesets/schemas.js +234 -0
- package/dist/changesets/schemas.js.map +1 -0
- package/dist/changesets/store.js +573 -0
- package/dist/changesets/store.js.map +1 -0
- package/dist/changesets/types.js +9 -0
- package/dist/changesets/types.js.map +1 -0
- package/dist/changesets/undo.js +525 -0
- package/dist/changesets/undo.js.map +1 -0
- package/dist/changesets/unifiedUndo.js +31 -0
- package/dist/changesets/unifiedUndo.js.map +1 -0
- package/dist/cliEnvironment.js +85 -0
- package/dist/cliEnvironment.js.map +1 -0
- package/dist/codexSessions.js +733 -0
- package/dist/codexSessions.js.map +1 -0
- package/dist/codexgptSupertool.js +216 -0
- package/dist/codexgptSupertool.js.map +1 -0
- package/dist/codexproSupertool.js +204 -0
- package/dist/codexproSupertool.js.map +1 -0
- package/dist/config.js +733 -0
- package/dist/config.js.map +1 -0
- package/dist/control/localApprovalClient.js +287 -0
- package/dist/control/localApprovalClient.js.map +1 -0
- package/dist/control/localApprovalServer.js +466 -0
- package/dist/control/localApprovalServer.js.map +1 -0
- package/dist/control/runtime.js +178 -0
- package/dist/control/runtime.js.map +1 -0
- package/dist/control/schemas.js +184 -0
- package/dist/control/schemas.js.map +1 -0
- package/dist/control/windowsLocalControl.js +348 -0
- package/dist/control/windowsLocalControl.js.map +1 -0
- package/dist/fsOps.js +541 -0
- package/dist/fsOps.js.map +1 -0
- package/dist/git/admission.js +26 -0
- package/dist/git/admission.js.map +1 -0
- package/dist/git/branchService.js +51 -0
- package/dist/git/branchService.js.map +1 -0
- package/dist/git/capabilities.js +143 -0
- package/dist/git/capabilities.js.map +1 -0
- package/dist/git/commitService.js +344 -0
- package/dist/git/commitService.js.map +1 -0
- package/dist/git/durableState.js +151 -0
- package/dist/git/durableState.js.map +1 -0
- package/dist/git/execution.js +451 -0
- package/dist/git/execution.js.map +1 -0
- package/dist/git/fileTransaction.js +50 -0
- package/dist/git/fileTransaction.js.map +1 -0
- package/dist/git/indexService.js +421 -0
- package/dist/git/indexService.js.map +1 -0
- package/dist/git/integrations.js +653 -0
- package/dist/git/integrations.js.map +1 -0
- package/dist/git/locks.js +287 -0
- package/dist/git/locks.js.map +1 -0
- package/dist/git/mutationContext.js +92 -0
- package/dist/git/mutationContext.js.map +1 -0
- package/dist/git/mutationJournal.js +91 -0
- package/dist/git/mutationJournal.js.map +1 -0
- package/dist/git/mutationService.js +352 -0
- package/dist/git/mutationService.js.map +1 -0
- package/dist/git/normalization.js +57 -0
- package/dist/git/normalization.js.map +1 -0
- package/dist/git/objectQuarantine.js +243 -0
- package/dist/git/objectQuarantine.js.map +1 -0
- package/dist/git/opaqueRecordStore.js +187 -0
- package/dist/git/opaqueRecordStore.js.map +1 -0
- package/dist/git/operationStore.js +287 -0
- package/dist/git/operationStore.js.map +1 -0
- package/dist/git/parsers.js +311 -0
- package/dist/git/parsers.js.map +1 -0
- package/dist/git/privateIndex.js +79 -0
- package/dist/git/privateIndex.js.map +1 -0
- package/dist/git/productionBootstrap.js +39 -0
- package/dist/git/productionBootstrap.js.map +1 -0
- package/dist/git/readService.js +846 -0
- package/dist/git/readService.js.map +1 -0
- package/dist/git/recovery.js +417 -0
- package/dist/git/recovery.js.map +1 -0
- package/dist/git/repositoryIdentity.js +611 -0
- package/dist/git/repositoryIdentity.js.map +1 -0
- package/dist/git/repositoryStore.js +237 -0
- package/dist/git/repositoryStore.js.map +1 -0
- package/dist/git/resources.js +113 -0
- package/dist/git/resources.js.map +1 -0
- package/dist/git/restoreService.js +178 -0
- package/dist/git/restoreService.js.map +1 -0
- package/dist/git/reviewToken.js +86 -0
- package/dist/git/reviewToken.js.map +1 -0
- package/dist/git/stashService.js +566 -0
- package/dist/git/stashService.js.map +1 -0
- package/dist/git/stateToken.js +139 -0
- package/dist/git/stateToken.js.map +1 -0
- package/dist/gitOps.js +147 -0
- package/dist/gitOps.js.map +1 -0
- package/dist/guard.js +608 -0
- package/dist/guard.js.map +1 -0
- package/dist/guidance/diagnostics.js +14 -0
- package/dist/guidance/diagnostics.js.map +1 -0
- package/dist/guidance/instructions.js +167 -0
- package/dist/guidance/instructions.js.map +1 -0
- package/dist/guidance/mode.js +18 -0
- package/dist/guidance/mode.js.map +1 -0
- package/dist/guidance/openaiSkillMetadata.js +29 -0
- package/dist/guidance/openaiSkillMetadata.js.map +1 -0
- package/dist/guidance/safeTextReader.js +171 -0
- package/dist/guidance/safeTextReader.js.map +1 -0
- package/dist/guidance/skillCatalog.js +70 -0
- package/dist/guidance/skillCatalog.js.map +1 -0
- package/dist/guidance/skillDiscovery.js +353 -0
- package/dist/guidance/skillDiscovery.js.map +1 -0
- package/dist/guidance/skillMetadata.js +115 -0
- package/dist/guidance/skillMetadata.js.map +1 -0
- package/dist/guidance/skillResources.js +146 -0
- package/dist/guidance/skillResources.js.map +1 -0
- package/dist/handoffOps.js +449 -0
- package/dist/handoffOps.js.map +1 -0
- package/dist/http/localAdminApp.js +203 -0
- package/dist/http/localAdminApp.js.map +1 -0
- package/dist/http/oauthMcpRuntime.js +294 -0
- package/dist/http/oauthMcpRuntime.js.map +1 -0
- package/dist/http/publicApp.js +350 -0
- package/dist/http/publicApp.js.map +1 -0
- package/dist/http/securityHeaders.js +11 -0
- package/dist/http/securityHeaders.js.map +1 -0
- package/dist/http.js +2076 -0
- package/dist/http.js.map +1 -0
- package/dist/moves/engine.js +1079 -0
- package/dist/moves/engine.js.map +1 -0
- package/dist/moves/index.js +6 -0
- package/dist/moves/index.js.map +1 -0
- package/dist/moves/planner.js +270 -0
- package/dist/moves/planner.js.map +1 -0
- package/dist/moves/recovery.js +557 -0
- package/dist/moves/recovery.js.map +1 -0
- package/dist/moves/service.js +300 -0
- package/dist/moves/service.js.map +1 -0
- package/dist/moves/types.js +11 -0
- package/dist/moves/types.js.map +1 -0
- package/dist/mutations/index.js +4 -0
- package/dist/mutations/index.js.map +1 -0
- package/dist/mutations/lifecycle.js +165 -0
- package/dist/mutations/lifecycle.js.map +1 -0
- package/dist/mutations/localService.js +163 -0
- package/dist/mutations/localService.js.map +1 -0
- package/dist/mutations/runtime.js +322 -0
- package/dist/mutations/runtime.js.map +1 -0
- package/dist/mutations/types.js +2 -0
- package/dist/mutations/types.js.map +1 -0
- package/dist/mutations/writers.js +360 -0
- package/dist/mutations/writers.js.map +1 -0
- package/dist/patchOps.js +420 -0
- package/dist/patchOps.js.map +1 -0
- package/dist/policy/approval.js +306 -0
- package/dist/policy/approval.js.map +1 -0
- package/dist/policy/audit.js +88 -0
- package/dist/policy/audit.js.map +1 -0
- package/dist/policy/authorizationFacts.js +187 -0
- package/dist/policy/authorizationFacts.js.map +1 -0
- package/dist/policy/compat.js +104 -0
- package/dist/policy/compat.js.map +1 -0
- package/dist/policy/context.js +31 -0
- package/dist/policy/context.js.map +1 -0
- package/dist/policy/enforcement.js +46 -0
- package/dist/policy/enforcement.js.map +1 -0
- package/dist/policy/evaluator.js +338 -0
- package/dist/policy/evaluator.js.map +1 -0
- package/dist/policy/executionCapabilities.js +80 -0
- package/dist/policy/executionCapabilities.js.map +1 -0
- package/dist/policy/executionResources.js +192 -0
- package/dist/policy/executionResources.js.map +1 -0
- package/dist/policy/fullAccessResources.js +23 -0
- package/dist/policy/fullAccessResources.js.map +1 -0
- package/dist/policy/hardPolicy.js +50 -0
- package/dist/policy/hardPolicy.js.map +1 -0
- package/dist/policy/identity.js +142 -0
- package/dist/policy/identity.js.map +1 -0
- package/dist/policy/integration.js +331 -0
- package/dist/policy/integration.js.map +1 -0
- package/dist/policy/pendingApprovals.js +301 -0
- package/dist/policy/pendingApprovals.js.map +1 -0
- package/dist/policy/profileStore.js +367 -0
- package/dist/policy/profileStore.js.map +1 -0
- package/dist/policy/resources.js +249 -0
- package/dist/policy/resources.js.map +1 -0
- package/dist/policy/runtime.js +713 -0
- package/dist/policy/runtime.js.map +1 -0
- package/dist/policy/schemas.js +625 -0
- package/dist/policy/schemas.js.map +1 -0
- package/dist/policy/toolPolicy.js +141 -0
- package/dist/policy/toolPolicy.js.map +1 -0
- package/dist/policy/transport.js +10 -0
- package/dist/policy/transport.js.map +1 -0
- package/dist/policy/types.js +31 -0
- package/dist/policy/types.js.map +1 -0
- package/dist/proContext.js +675 -0
- package/dist/proContext.js.map +1 -0
- package/dist/process/authority.js +18 -0
- package/dist/process/authority.js.map +1 -0
- package/dist/process/backendDiscovery.js +83 -0
- package/dist/process/backendDiscovery.js.map +1 -0
- package/dist/process/commandCompiler.js +71 -0
- package/dist/process/commandCompiler.js.map +1 -0
- package/dist/process/outputCursor.js +67 -0
- package/dist/process/outputCursor.js.map +1 -0
- package/dist/process/outputQuota.js +94 -0
- package/dist/process/outputQuota.js.map +1 -0
- package/dist/process/outputRing.js +138 -0
- package/dist/process/outputRing.js.map +1 -0
- package/dist/process/processAuditCoordinator.js +52 -0
- package/dist/process/processAuditCoordinator.js.map +1 -0
- package/dist/process/processManager.js +311 -0
- package/dist/process/processManager.js.map +1 -0
- package/dist/process/runCommand.js +332 -0
- package/dist/process/runCommand.js.map +1 -0
- package/dist/process/streamingRedactor.js +105 -0
- package/dist/process/streamingRedactor.js.map +1 -0
- package/dist/process/types.js +2 -0
- package/dist/process/types.js.map +1 -0
- package/dist/process/windowsHostClient.js +604 -0
- package/dist/process/windowsHostClient.js.map +1 -0
- package/dist/process/windowsHostProtocol.js +270 -0
- package/dist/process/windowsHostProtocol.js.map +1 -0
- package/dist/process/windowsPersistentBackend.js +263 -0
- package/dist/process/windowsPersistentBackend.js.map +1 -0
- package/dist/productionRuntime.js +907 -0
- package/dist/productionRuntime.js.map +1 -0
- package/dist/profileStore.js +231 -0
- package/dist/profileStore.js.map +1 -0
- package/dist/redact.js +124 -0
- package/dist/redact.js.map +1 -0
- package/dist/searchOps.js +186 -0
- package/dist/searchOps.js.map +1 -0
- package/dist/selfTestOps.js +786 -0
- package/dist/selfTestOps.js.map +1 -0
- package/dist/semantic/budgets.js +12 -0
- package/dist/semantic/budgets.js.map +1 -0
- package/dist/semantic/builtin/typescriptAssets.js +68 -0
- package/dist/semantic/builtin/typescriptAssets.js.map +1 -0
- package/dist/semantic/builtin/typescriptProvider.js +211 -0
- package/dist/semantic/builtin/typescriptProvider.js.map +1 -0
- package/dist/semantic/builtin/typescriptWorker.js +365 -0
- package/dist/semantic/builtin/typescriptWorker.js.map +1 -0
- package/dist/semantic/diffPreview.js +36 -0
- package/dist/semantic/diffPreview.js.map +1 -0
- package/dist/semantic/index.js +11 -0
- package/dist/semantic/index.js.map +1 -0
- package/dist/semantic/manager.js +522 -0
- package/dist/semantic/manager.js.map +1 -0
- package/dist/semantic/positions.js +86 -0
- package/dist/semantic/positions.js.map +1 -0
- package/dist/semantic/previewStore.js +276 -0
- package/dist/semantic/previewStore.js.map +1 -0
- package/dist/semantic/projectResolver.js +309 -0
- package/dist/semantic/projectResolver.js.map +1 -0
- package/dist/semantic/sourceSnapshot.js +54 -0
- package/dist/semantic/sourceSnapshot.js.map +1 -0
- package/dist/semantic/status.js +46 -0
- package/dist/semantic/status.js.map +1 -0
- package/dist/semantic/types.js +2 -0
- package/dist/semantic/types.js.map +1 -0
- package/dist/server.js +8676 -0
- package/dist/server.js.map +1 -0
- package/dist/stdio.js +64 -0
- package/dist/stdio.js.map +1 -0
- package/dist/toolCardWidget.js +2000 -0
- package/dist/toolCardWidget.js.map +1 -0
- package/dist/tools/contracts/catalog.js +111 -0
- package/dist/tools/contracts/catalog.js.map +1 -0
- package/dist/tools/contracts/index.js +8 -0
- package/dist/tools/contracts/index.js.map +1 -0
- package/dist/tools/contracts/registration.js +27 -0
- package/dist/tools/contracts/registration.js.map +1 -0
- package/dist/tools/contracts/schemas.js +11 -0
- package/dist/tools/contracts/schemas.js.map +1 -0
- package/dist/tools/contracts/types.js +2 -0
- package/dist/tools/contracts/types.js.map +1 -0
- package/dist/tools/contracts/v3.js +76 -0
- package/dist/tools/contracts/v3.js.map +1 -0
- package/dist/tools/contracts/v4.js +39 -0
- package/dist/tools/contracts/v4.js.map +1 -0
- package/dist/tools/contracts/v5.js +20 -0
- package/dist/tools/contracts/v5.js.map +1 -0
- package/dist/tools/phase3dServer.js +350 -0
- package/dist/tools/phase3dServer.js.map +1 -0
- package/dist/tools/schemas/applyPatch.js +388 -0
- package/dist/tools/schemas/applyPatch.js.map +1 -0
- package/dist/tools/schemas/bash.js +202 -0
- package/dist/tools/schemas/bash.js.map +1 -0
- package/dist/tools/schemas/closeWorkspace.js +105 -0
- package/dist/tools/schemas/closeWorkspace.js.map +1 -0
- package/dist/tools/schemas/codexContext.js +402 -0
- package/dist/tools/schemas/codexContext.js.map +1 -0
- package/dist/tools/schemas/codexSessions.js +328 -0
- package/dist/tools/schemas/codexSessions.js.map +1 -0
- package/dist/tools/schemas/codexgpt.js +1068 -0
- package/dist/tools/schemas/codexgpt.js.map +1 -0
- package/dist/tools/schemas/codexgptInventory.js +359 -0
- package/dist/tools/schemas/codexgptInventory.js.map +1 -0
- package/dist/tools/schemas/codexgptSelfTest.js +563 -0
- package/dist/tools/schemas/codexgptSelfTest.js.map +1 -0
- package/dist/tools/schemas/codexpro.js +917 -0
- package/dist/tools/schemas/codexpro.js.map +1 -0
- package/dist/tools/schemas/codexproInventory.js +352 -0
- package/dist/tools/schemas/codexproInventory.js.map +1 -0
- package/dist/tools/schemas/codexproSelfTest.js +546 -0
- package/dist/tools/schemas/codexproSelfTest.js.map +1 -0
- package/dist/tools/schemas/common.js +21 -0
- package/dist/tools/schemas/common.js.map +1 -0
- package/dist/tools/schemas/createTaskWorktree.js +51 -0
- package/dist/tools/schemas/createTaskWorktree.js.map +1 -0
- package/dist/tools/schemas/edit.js +321 -0
- package/dist/tools/schemas/edit.js.map +1 -0
- package/dist/tools/schemas/execution.js +330 -0
- package/dist/tools/schemas/execution.js.map +1 -0
- package/dist/tools/schemas/exportProContext.js +370 -0
- package/dist/tools/schemas/exportProContext.js.map +1 -0
- package/dist/tools/schemas/getTaskWorktree.js +19 -0
- package/dist/tools/schemas/getTaskWorktree.js.map +1 -0
- package/dist/tools/schemas/gitBranch.js +42 -0
- package/dist/tools/schemas/gitBranch.js.map +1 -0
- package/dist/tools/schemas/gitCommit.js +40 -0
- package/dist/tools/schemas/gitCommit.js.map +1 -0
- package/dist/tools/schemas/gitCreateBranch.js +22 -0
- package/dist/tools/schemas/gitCreateBranch.js.map +1 -0
- package/dist/tools/schemas/gitDiff.js +222 -0
- package/dist/tools/schemas/gitDiff.js.map +1 -0
- package/dist/tools/schemas/gitLog.js +41 -0
- package/dist/tools/schemas/gitLog.js.map +1 -0
- package/dist/tools/schemas/gitRestore.js +47 -0
- package/dist/tools/schemas/gitRestore.js.map +1 -0
- package/dist/tools/schemas/gitStage.js +33 -0
- package/dist/tools/schemas/gitStage.js.map +1 -0
- package/dist/tools/schemas/gitStash.js +102 -0
- package/dist/tools/schemas/gitStash.js.map +1 -0
- package/dist/tools/schemas/gitStatus.js +226 -0
- package/dist/tools/schemas/gitStatus.js.map +1 -0
- package/dist/tools/schemas/gitV4Common.js +205 -0
- package/dist/tools/schemas/gitV4Common.js.map +1 -0
- package/dist/tools/schemas/guidance.js +40 -0
- package/dist/tools/schemas/guidance.js.map +1 -0
- package/dist/tools/schemas/handoffToAgent.js +276 -0
- package/dist/tools/schemas/handoffToAgent.js.map +1 -0
- package/dist/tools/schemas/handoffToCodex.js +137 -0
- package/dist/tools/schemas/handoffToCodex.js.map +1 -0
- package/dist/tools/schemas/inspectWorkspace.js +379 -0
- package/dist/tools/schemas/inspectWorkspace.js.map +1 -0
- package/dist/tools/schemas/listTaskWorktrees.js +21 -0
- package/dist/tools/schemas/listTaskWorktrees.js.map +1 -0
- package/dist/tools/schemas/listWorkspaces.js +134 -0
- package/dist/tools/schemas/listWorkspaces.js.map +1 -0
- package/dist/tools/schemas/loadSkill.js +619 -0
- package/dist/tools/schemas/loadSkill.js.map +1 -0
- package/dist/tools/schemas/mergeTaskWorktree.js +105 -0
- package/dist/tools/schemas/mergeTaskWorktree.js.map +1 -0
- package/dist/tools/schemas/movePaths.js +175 -0
- package/dist/tools/schemas/movePaths.js.map +1 -0
- package/dist/tools/schemas/openCurrentWorkspace.js +174 -0
- package/dist/tools/schemas/openCurrentWorkspace.js.map +1 -0
- package/dist/tools/schemas/openFullAccessWorkspace.js +81 -0
- package/dist/tools/schemas/openFullAccessWorkspace.js.map +1 -0
- package/dist/tools/schemas/openWorkspace.js +193 -0
- package/dist/tools/schemas/openWorkspace.js.map +1 -0
- package/dist/tools/schemas/queryAuditEvents.js +193 -0
- package/dist/tools/schemas/queryAuditEvents.js.map +1 -0
- package/dist/tools/schemas/read.js +199 -0
- package/dist/tools/schemas/read.js.map +1 -0
- package/dist/tools/schemas/readCodexSession.js +353 -0
- package/dist/tools/schemas/readCodexSession.js.map +1 -0
- package/dist/tools/schemas/readHandoff.js +446 -0
- package/dist/tools/schemas/readHandoff.js.map +1 -0
- package/dist/tools/schemas/removeTaskWorktree.js +40 -0
- package/dist/tools/schemas/removeTaskWorktree.js.map +1 -0
- package/dist/tools/schemas/search.js +235 -0
- package/dist/tools/schemas/search.js.map +1 -0
- package/dist/tools/schemas/semantic.js +195 -0
- package/dist/tools/schemas/semantic.js.map +1 -0
- package/dist/tools/schemas/serverConfig.js +157 -0
- package/dist/tools/schemas/serverConfig.js.map +1 -0
- package/dist/tools/schemas/showChanges.js +283 -0
- package/dist/tools/schemas/showChanges.js.map +1 -0
- package/dist/tools/schemas/transactionResult.js +11 -0
- package/dist/tools/schemas/transactionResult.js.map +1 -0
- package/dist/tools/schemas/tree.js +136 -0
- package/dist/tools/schemas/tree.js.map +1 -0
- package/dist/tools/schemas/undoChangeSet.js +152 -0
- package/dist/tools/schemas/undoChangeSet.js.map +1 -0
- package/dist/tools/schemas/waitForHandoff.js +462 -0
- package/dist/tools/schemas/waitForHandoff.js.map +1 -0
- package/dist/tools/schemas/workspaceSnapshot.js +145 -0
- package/dist/tools/schemas/workspaceSnapshot.js.map +1 -0
- package/dist/tools/schemas/write.js +285 -0
- package/dist/tools/schemas/write.js.map +1 -0
- package/dist/transactions/atomicFs.js +438 -0
- package/dist/transactions/atomicFs.js.map +1 -0
- package/dist/transactions/atomicStateFile.js +190 -0
- package/dist/transactions/atomicStateFile.js.map +1 -0
- package/dist/transactions/engine.js +574 -0
- package/dist/transactions/engine.js.map +1 -0
- package/dist/transactions/index.js +12 -0
- package/dist/transactions/index.js.map +1 -0
- package/dist/transactions/installation.js +158 -0
- package/dist/transactions/installation.js.map +1 -0
- package/dist/transactions/manifestV2Store.js +96 -0
- package/dist/transactions/manifestV2Store.js.map +1 -0
- package/dist/transactions/participantRecovery.js +98 -0
- package/dist/transactions/participantRecovery.js.map +1 -0
- package/dist/transactions/recovery.js +513 -0
- package/dist/transactions/recovery.js.map +1 -0
- package/dist/transactions/schemas.js +365 -0
- package/dist/transactions/schemas.js.map +1 -0
- package/dist/transactions/stateRoot.js +63 -0
- package/dist/transactions/stateRoot.js.map +1 -0
- package/dist/transactions/types.js +11 -0
- package/dist/transactions/types.js.map +1 -0
- package/dist/transactions/workspaceLock.js +201 -0
- package/dist/transactions/workspaceLock.js.map +1 -0
- package/dist/workspaceOps.js +924 -0
- package/dist/workspaceOps.js.map +1 -0
- package/dist/worktrees/candidateWorkspace.js +566 -0
- package/dist/worktrees/candidateWorkspace.js.map +1 -0
- package/dist/worktrees/manager.js +258 -0
- package/dist/worktrees/manager.js.map +1 -0
- package/dist/worktrees/materializer.js +60 -0
- package/dist/worktrees/materializer.js.map +1 -0
- package/dist/worktrees/mergeExecute.js +498 -0
- package/dist/worktrees/mergeExecute.js.map +1 -0
- package/dist/worktrees/mergePlanStore.js +247 -0
- package/dist/worktrees/mergePlanStore.js.map +1 -0
- package/dist/worktrees/mergePrepare.js +709 -0
- package/dist/worktrees/mergePrepare.js.map +1 -0
- package/dist/worktrees/recovery.js +294 -0
- package/dist/worktrees/recovery.js.map +1 -0
- package/dist/worktrees/remove.js +296 -0
- package/dist/worktrees/remove.js.map +1 -0
- package/dist/worktrees/remover.js +57 -0
- package/dist/worktrees/remover.js.map +1 -0
- package/dist/worktrees/root.js +47 -0
- package/dist/worktrees/root.js.map +1 -0
- package/dist/worktrees/service.js +245 -0
- package/dist/worktrees/service.js.map +1 -0
- package/dist/worktrees/store.js +156 -0
- package/dist/worktrees/store.js.map +1 -0
- package/dist/worktrees/treeManifest.js +106 -0
- package/dist/worktrees/treeManifest.js.map +1 -0
- package/dist/worktrees/verificationReceipts.js +215 -0
- package/dist/worktrees/verificationReceipts.js.map +1 -0
- package/dist/worktrees/verificationTerminal.js +23 -0
- package/dist/worktrees/verificationTerminal.js.map +1 -0
- package/dist/worktrees/workspaceAuthority.js +64 -0
- package/dist/worktrees/workspaceAuthority.js.map +1 -0
- package/docs/favicon.svg +5 -0
- package/docs/index.html +624 -0
- package/docs/og.svg +52 -0
- package/docs/script.js +33 -0
- package/docs/star.svg +11 -0
- package/docs/styles.css +1571 -0
- package/docs/zh.html +428 -0
- package/package.json +121 -0
- package/scripts/analysis-cli-smoke.mjs +81 -0
- package/scripts/analysis-smoke.mjs +179 -0
- package/scripts/atomic-file.mjs +137 -0
- package/scripts/ci-change-classifier.mjs +59 -0
- package/scripts/ci-failure-summary.mjs +92 -0
- package/scripts/cloudflared-installer.mjs +215 -0
- package/scripts/cloudflared-release.mjs +63 -0
- package/scripts/codexgpt-entry.mjs +235 -0
- package/scripts/codexgpt.mjs +4987 -0
- package/scripts/connector-auth-output-shim.cjs +66 -0
- package/scripts/doctor-smoke.mjs +90 -0
- package/scripts/doctor.mjs +165 -0
- package/scripts/exact-head-ci.mjs +126 -0
- package/scripts/execute-handoff-smoke-platform-compat.mjs +38 -0
- package/scripts/execute-handoff-smoke.mjs +1117 -0
- package/scripts/g8-u-live-probe.mjs +208 -0
- package/scripts/http-smoke-compat.mjs +151 -0
- package/scripts/http-smoke.mjs +776 -0
- package/scripts/long-task-runner.mjs +1037 -0
- package/scripts/oauth-admin.mjs +1608 -0
- package/scripts/output-bounds.mjs +29 -0
- package/scripts/owned-temp-root.d.mts +50 -0
- package/scripts/owned-temp-root.mjs +567 -0
- package/scripts/phase-4a-smoke.mjs +36 -0
- package/scripts/policy-windows-spike.mjs +135 -0
- package/scripts/pro-apply.mjs +152 -0
- package/scripts/pro-bundle.mjs +121 -0
- package/scripts/pro-smoke.mjs +97 -0
- package/scripts/process-identity.mjs +67 -0
- package/scripts/repository-policy.mjs +166 -0
- package/scripts/run-and-summarize.mjs +134 -0
- package/scripts/run-smoke.mjs +52 -0
- package/scripts/run-with-cleanup.mjs +98 -0
- package/scripts/settings-smoke-platform-compat.mjs +85 -0
- package/scripts/settings-smoke.mjs +769 -0
- package/scripts/smoke-platform-compat.mjs +302 -0
- package/scripts/smoke.mjs +1180 -0
- package/scripts/stress-contract-compat.mjs +94 -0
- package/scripts/stress.mjs +882 -0
- package/scripts/test-domains.mjs +247 -0
- package/scripts/test-execution-profile-manifest.mjs +273 -0
- package/scripts/test-execution-profiles.mjs +147 -0
- package/scripts/test-performance-reporter.mjs +291 -0
- package/scripts/toolchain-manager.mjs +266 -0
- package/scripts/toolchains.json +19 -0
- package/scripts/windows-conpty-probe-child.mjs +82 -0
- package/scripts/windows-conpty-worker.ps1 +24 -0
- package/scripts/windows-credential-host-manifest.json +16 -0
- package/scripts/windows-credential-host-protocol-v1.json +16 -0
- package/scripts/windows-credential-host.cs +256 -0
- package/scripts/windows-credential-host.ps1 +26 -0
- package/scripts/windows-local-control-manifest.json +23 -0
- package/scripts/windows-local-control-spike.cs +738 -0
- package/scripts/windows-local-control-spike.mjs +415 -0
- package/scripts/windows-local-control-spike.ps1 +35 -0
- package/scripts/windows-local-control.cs +738 -0
- package/scripts/windows-local-control.ps1 +35 -0
- package/scripts/windows-native-api-inventory-v1.json +90 -0
- package/scripts/windows-process-host-manifest.json +20 -0
- package/scripts/windows-process-host-protocol-v1.json +59 -0
- package/scripts/windows-process-host.cs +2385 -0
- package/scripts/windows-process-host.ps1 +59 -0
- package/scripts/windows-realpath-shim.cjs +78 -0
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
import fsp from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { sha256Git } from "./mutationContext.js";
|
|
4
|
+
const HOOK_NAMES = Object.freeze([
|
|
5
|
+
"pre-commit",
|
|
6
|
+
"prepare-commit-msg",
|
|
7
|
+
"commit-msg",
|
|
8
|
+
"post-commit",
|
|
9
|
+
"post-index-change",
|
|
10
|
+
"post-rewrite",
|
|
11
|
+
"reference-transaction",
|
|
12
|
+
"pre-merge-commit",
|
|
13
|
+
"post-merge"
|
|
14
|
+
]);
|
|
15
|
+
const MAX_INTEGRATION_EXECUTABLE_BYTES = 256n * 1024n * 1024n;
|
|
16
|
+
const MAX_INTEGRATION_EXECUTABLE_TOTAL_BYTES = 512n * 1024n * 1024n;
|
|
17
|
+
const MAX_INTEGRATION_EXECUTABLES = 32;
|
|
18
|
+
const MAX_INTEGRATION_PATH_CHARS = 2048;
|
|
19
|
+
const SCRIPT_DEPENDENCY_EXTENSIONS = new Set([
|
|
20
|
+
".bat", ".cmd", ".cjs", ".dll", ".jar", ".js", ".mjs", ".pl", ".ps1", ".py", ".rb", ".sh"
|
|
21
|
+
]);
|
|
22
|
+
const INTEGRATION_CONFIG_PATTERN = "^(include(if\\..*)?\\.path|core\\.(hookspath|fsmonitor|attributesfile)|commit\\.gpgsign|gpg\\.(program|format|openpgp\\.program|x509\\.program|ssh\\.(program|defaultkeycommand))|user\\.(name|email|signingkey)|filter\\..*\\.(clean|smudge|process|required)|merge\\.(default|renormalize)|merge\\..*\\.(driver|recursive))$";
|
|
23
|
+
const INTEGRATION_IMPLEMENTATION_REVISION = sha256Git(JSON.stringify({
|
|
24
|
+
schemaVersion: 3,
|
|
25
|
+
hooks: HOOK_NAMES,
|
|
26
|
+
configPattern: INTEGRATION_CONFIG_PATTERN,
|
|
27
|
+
scriptDependencyExtensions: [...SCRIPT_DEPENDENCY_EXTENSIONS].sort(),
|
|
28
|
+
limits: {
|
|
29
|
+
executableBytes: String(MAX_INTEGRATION_EXECUTABLE_BYTES),
|
|
30
|
+
executableTotalBytes: String(MAX_INTEGRATION_EXECUTABLE_TOTAL_BYTES),
|
|
31
|
+
executables: MAX_INTEGRATION_EXECUTABLES,
|
|
32
|
+
pathChars: MAX_INTEGRATION_PATH_CHARS,
|
|
33
|
+
identities: 128
|
|
34
|
+
},
|
|
35
|
+
configIncludes: "rejected",
|
|
36
|
+
externalAttributesFile: "rejected",
|
|
37
|
+
signingSelectors: "explicit-effective-program-and-key-v1",
|
|
38
|
+
executionBundle: "stable-config-and-executable-snapshot-v3",
|
|
39
|
+
executionIsolation: "none"
|
|
40
|
+
}));
|
|
41
|
+
function integrationError() {
|
|
42
|
+
return new Error("GIT_INTEGRATION_REQUIRED");
|
|
43
|
+
}
|
|
44
|
+
function commandTokens(value) {
|
|
45
|
+
const trimmed = value.trim();
|
|
46
|
+
if (/[\u0000\r\n&|;<>`']/u.test(trimmed) ||
|
|
47
|
+
trimmed.includes("$(") ||
|
|
48
|
+
trimmed.includes("${"))
|
|
49
|
+
throw integrationError();
|
|
50
|
+
const tokens = [];
|
|
51
|
+
let offset = 0;
|
|
52
|
+
while (offset < trimmed.length) {
|
|
53
|
+
while (/\s/u.test(trimmed[offset] ?? ""))
|
|
54
|
+
offset += 1;
|
|
55
|
+
if (offset >= trimmed.length)
|
|
56
|
+
break;
|
|
57
|
+
if (trimmed[offset] === '"') {
|
|
58
|
+
const closing = trimmed.indexOf('"', offset + 1);
|
|
59
|
+
if (closing < 0 || (closing + 1 < trimmed.length && !/\s/u.test(trimmed[closing + 1]))) {
|
|
60
|
+
throw integrationError();
|
|
61
|
+
}
|
|
62
|
+
const token = trimmed.slice(offset + 1, closing);
|
|
63
|
+
if (!token || token.includes('"'))
|
|
64
|
+
throw integrationError();
|
|
65
|
+
tokens.push(token);
|
|
66
|
+
offset = closing + 1;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
let closing = offset;
|
|
70
|
+
while (closing < trimmed.length && !/\s/u.test(trimmed[closing]))
|
|
71
|
+
closing += 1;
|
|
72
|
+
const token = trimmed.slice(offset, closing);
|
|
73
|
+
if (!token || token.includes('"'))
|
|
74
|
+
throw integrationError();
|
|
75
|
+
tokens.push(token);
|
|
76
|
+
offset = closing;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (tokens.length < 1 || !path.isAbsolute(tokens[0]))
|
|
80
|
+
throw integrationError();
|
|
81
|
+
return tokens;
|
|
82
|
+
}
|
|
83
|
+
function bindConfigurationFact(kind, key, value) {
|
|
84
|
+
return Object.freeze({
|
|
85
|
+
kind,
|
|
86
|
+
configKeyDigest: sha256Git(key),
|
|
87
|
+
executableDigest: null,
|
|
88
|
+
contentDigest: sha256Git(Buffer.from(`${key}\0${value}`, "utf8")),
|
|
89
|
+
canonicalPath: null,
|
|
90
|
+
stableIdentity: null,
|
|
91
|
+
snapshotContent: null,
|
|
92
|
+
hookName: null
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async function bindExecutable(kind, key, executable, value, budget, hookName = null) {
|
|
96
|
+
const canonicalPath = await fsp.realpath(executable).catch(() => {
|
|
97
|
+
throw integrationError();
|
|
98
|
+
});
|
|
99
|
+
if (canonicalPath.length > MAX_INTEGRATION_PATH_CHARS)
|
|
100
|
+
throw new Error("GIT_SCAN_LIMIT");
|
|
101
|
+
const cacheKey = process.platform === "win32"
|
|
102
|
+
? canonicalPath.toLocaleLowerCase("en-US")
|
|
103
|
+
: canonicalPath;
|
|
104
|
+
const cached = budget.cache.get(cacheKey);
|
|
105
|
+
if (cached) {
|
|
106
|
+
return Object.freeze({
|
|
107
|
+
kind,
|
|
108
|
+
configKeyDigest: sha256Git(key),
|
|
109
|
+
executableDigest: cached.executableDigest,
|
|
110
|
+
contentDigest: sha256Git(JSON.stringify({ value, executableContentDigest: cached.contentDigest })),
|
|
111
|
+
canonicalPath: cached.canonicalPath,
|
|
112
|
+
stableIdentity: cached.stableIdentity,
|
|
113
|
+
snapshotContent: cached.content,
|
|
114
|
+
hookName
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
const lexical = await fsp.lstat(canonicalPath, { bigint: true }).catch(() => {
|
|
118
|
+
throw integrationError();
|
|
119
|
+
});
|
|
120
|
+
if (!lexical.isFile() ||
|
|
121
|
+
lexical.isSymbolicLink() ||
|
|
122
|
+
lexical.nlink !== 1n ||
|
|
123
|
+
lexical.size > MAX_INTEGRATION_EXECUTABLE_BYTES)
|
|
124
|
+
throw integrationError();
|
|
125
|
+
if (budget.cache.size >= MAX_INTEGRATION_EXECUTABLES ||
|
|
126
|
+
budget.totalBytes + lexical.size > MAX_INTEGRATION_EXECUTABLE_TOTAL_BYTES)
|
|
127
|
+
throw new Error("GIT_SCAN_LIMIT");
|
|
128
|
+
budget.totalBytes += lexical.size;
|
|
129
|
+
const handle = await fsp.open(canonicalPath, "r").catch(() => {
|
|
130
|
+
throw integrationError();
|
|
131
|
+
});
|
|
132
|
+
try {
|
|
133
|
+
const [content, stat] = await Promise.all([handle.readFile(), handle.stat({ bigint: true })]);
|
|
134
|
+
if (!stat.isFile() ||
|
|
135
|
+
stat.nlink !== 1n ||
|
|
136
|
+
stat.dev !== lexical.dev ||
|
|
137
|
+
stat.ino !== lexical.ino ||
|
|
138
|
+
stat.size !== lexical.size ||
|
|
139
|
+
stat.mtimeNs !== lexical.mtimeNs)
|
|
140
|
+
throw integrationError();
|
|
141
|
+
const fingerprint = Object.freeze({
|
|
142
|
+
canonicalPath,
|
|
143
|
+
executableDigest: sha256Git(canonicalPath),
|
|
144
|
+
contentDigest: sha256Git(content),
|
|
145
|
+
stableIdentity: sha256Git(`${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.nlink}`),
|
|
146
|
+
content
|
|
147
|
+
});
|
|
148
|
+
budget.cache.set(cacheKey, fingerprint);
|
|
149
|
+
return Object.freeze({
|
|
150
|
+
kind,
|
|
151
|
+
configKeyDigest: sha256Git(key),
|
|
152
|
+
executableDigest: fingerprint.executableDigest,
|
|
153
|
+
contentDigest: sha256Git(JSON.stringify({ value, executableContentDigest: fingerprint.contentDigest })),
|
|
154
|
+
canonicalPath: fingerprint.canonicalPath,
|
|
155
|
+
stableIdentity: fingerprint.stableIdentity,
|
|
156
|
+
snapshotContent: fingerprint.content,
|
|
157
|
+
hookName
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
await handle.close();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
async function bindCommand(kind, key, value, repository, budget, serialization = "shell") {
|
|
165
|
+
const tokens = commandTokens(value);
|
|
166
|
+
if (serialization === "program" && tokens.length !== 1)
|
|
167
|
+
throw integrationError();
|
|
168
|
+
const bindings = [await bindExecutable(kind, key, tokens[0], value, budget)];
|
|
169
|
+
const paths = [{ tokenIndex: 0, canonicalPath: bindings[0].canonicalPath }];
|
|
170
|
+
for (let index = 1; index < tokens.length; index += 1) {
|
|
171
|
+
const token = tokens[index];
|
|
172
|
+
const candidateValue = token.includes("=") ? token.slice(token.indexOf("=") + 1) : token;
|
|
173
|
+
if (!SCRIPT_DEPENDENCY_EXTENSIONS.has(path.extname(candidateValue).toLocaleLowerCase("en-US")))
|
|
174
|
+
continue;
|
|
175
|
+
const candidate = path.isAbsolute(candidateValue)
|
|
176
|
+
? candidateValue
|
|
177
|
+
: path.resolve(repository.worktreeRoot, candidateValue);
|
|
178
|
+
const binding = await bindExecutable(kind, `${key}:dependency:${index}`, candidate, `${value}\0dependency:${index}`, budget);
|
|
179
|
+
bindings.push(binding);
|
|
180
|
+
paths.push({ tokenIndex: index, canonicalPath: binding.canonicalPath });
|
|
181
|
+
}
|
|
182
|
+
return { bindings, command: { key, tokens, paths, serialization } };
|
|
183
|
+
}
|
|
184
|
+
function parseConfigRecords(value) {
|
|
185
|
+
let text;
|
|
186
|
+
try {
|
|
187
|
+
text = new TextDecoder("utf-8", { fatal: true }).decode(value);
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
throw integrationError();
|
|
191
|
+
}
|
|
192
|
+
const output = [];
|
|
193
|
+
for (const record of text.split("\0").filter(Boolean)) {
|
|
194
|
+
const separator = record.indexOf("\n");
|
|
195
|
+
if (separator < 1)
|
|
196
|
+
throw integrationError();
|
|
197
|
+
const key = record.slice(0, separator).toLocaleLowerCase("en-US");
|
|
198
|
+
const child = record.slice(separator + 1).trim();
|
|
199
|
+
if (!child || /[\u0000\r\n]/u.test(key))
|
|
200
|
+
throw integrationError();
|
|
201
|
+
output.push({ key, value: child });
|
|
202
|
+
}
|
|
203
|
+
return output;
|
|
204
|
+
}
|
|
205
|
+
function identitiesDigest(identities) {
|
|
206
|
+
return sha256Git(JSON.stringify({
|
|
207
|
+
implementationRevision: INTEGRATION_IMPLEMENTATION_REVISION,
|
|
208
|
+
identities: identities.map((identity) => ({
|
|
209
|
+
kind: identity.kind,
|
|
210
|
+
configKeyDigest: identity.configKeyDigest,
|
|
211
|
+
executableDigest: identity.executableDigest,
|
|
212
|
+
contentDigest: identity.contentDigest,
|
|
213
|
+
stableIdentity: identity.stableIdentity
|
|
214
|
+
}))
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
function reviewBinding(identity) {
|
|
218
|
+
return Object.freeze({
|
|
219
|
+
kind: identity.kind,
|
|
220
|
+
configKeyDigest: identity.configKeyDigest,
|
|
221
|
+
executableDigest: identity.executableDigest,
|
|
222
|
+
contentDigest: identity.contentDigest,
|
|
223
|
+
canonicalPath: identity.canonicalPath,
|
|
224
|
+
stableIdentity: identity.stableIdentity
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
async function readStableConfig(repository) {
|
|
228
|
+
const file = path.join(repository.commonDir, "config");
|
|
229
|
+
const lexical = await fsp.lstat(file, { bigint: true }).catch(() => {
|
|
230
|
+
throw integrationError();
|
|
231
|
+
});
|
|
232
|
+
if (!lexical.isFile() ||
|
|
233
|
+
lexical.isSymbolicLink() ||
|
|
234
|
+
lexical.nlink !== 1n ||
|
|
235
|
+
lexical.size < 1n ||
|
|
236
|
+
lexical.size > 1024n * 1024n)
|
|
237
|
+
throw integrationError();
|
|
238
|
+
const handle = await fsp.open(file, "r").catch(() => {
|
|
239
|
+
throw integrationError();
|
|
240
|
+
});
|
|
241
|
+
try {
|
|
242
|
+
const [bytes, stable] = await Promise.all([handle.readFile(), handle.stat({ bigint: true })]);
|
|
243
|
+
if (!stable.isFile() ||
|
|
244
|
+
stable.nlink !== 1n ||
|
|
245
|
+
stable.dev !== lexical.dev ||
|
|
246
|
+
stable.ino !== lexical.ino ||
|
|
247
|
+
stable.size !== lexical.size ||
|
|
248
|
+
stable.mtimeNs !== lexical.mtimeNs)
|
|
249
|
+
throw integrationError();
|
|
250
|
+
return {
|
|
251
|
+
bytes,
|
|
252
|
+
digest: sha256Git(bytes),
|
|
253
|
+
identity: sha256Git(`${stable.dev}:${stable.ino}:${stable.size}:${stable.mtimeNs}:${stable.nlink}`)
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
finally {
|
|
257
|
+
await handle.close();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function commandToken(value) {
|
|
261
|
+
if (!value || /[\u0000\r\n"]/u.test(value))
|
|
262
|
+
throw integrationError();
|
|
263
|
+
return `"${value}"`;
|
|
264
|
+
}
|
|
265
|
+
async function removePrivateConfigKey(executor, configPath, key, required) {
|
|
266
|
+
const options = { stdoutLimitBytes: 256, stderrLimitBytes: 4096, timeoutMs: 30_000 };
|
|
267
|
+
const removed = await executor.run(null, ["config", "--file", configPath, "--unset-all", key], options);
|
|
268
|
+
if (removed.timedOut ||
|
|
269
|
+
removed.stdoutTruncated ||
|
|
270
|
+
removed.stderrTruncated ||
|
|
271
|
+
(removed.status !== 0 && !(removed.status === 5 && !required)))
|
|
272
|
+
throw integrationError();
|
|
273
|
+
const verified = await executor.run(null, ["config", "--file", configPath, "--get-all", key], options);
|
|
274
|
+
if (verified.timedOut ||
|
|
275
|
+
verified.stdoutTruncated ||
|
|
276
|
+
verified.stderrTruncated ||
|
|
277
|
+
verified.status !== 1 ||
|
|
278
|
+
verified.stdout.length !== 0)
|
|
279
|
+
throw integrationError();
|
|
280
|
+
}
|
|
281
|
+
export class GitIntegrationGateV4 {
|
|
282
|
+
options;
|
|
283
|
+
constructor(options) {
|
|
284
|
+
this.options = options;
|
|
285
|
+
}
|
|
286
|
+
get enabled() {
|
|
287
|
+
return this.options.enabled;
|
|
288
|
+
}
|
|
289
|
+
async #discover(repository) {
|
|
290
|
+
if (!this.options.enabled) {
|
|
291
|
+
return {
|
|
292
|
+
identities: [],
|
|
293
|
+
hooksPath: "",
|
|
294
|
+
configBytes: Buffer.alloc(0),
|
|
295
|
+
configDigest: sha256Git(Buffer.alloc(0)),
|
|
296
|
+
configIdentity: sha256Git("disabled"),
|
|
297
|
+
commands: []
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
const configBefore = await readStableConfig(repository);
|
|
301
|
+
const result = await this.options.executor.run(repository, [
|
|
302
|
+
"config", "--local", "--no-includes", "--null", "--get-regexp",
|
|
303
|
+
INTEGRATION_CONFIG_PATTERN
|
|
304
|
+
], { stdoutLimitBytes: 128 * 1024 });
|
|
305
|
+
if (result.timedOut ||
|
|
306
|
+
result.stdoutTruncated ||
|
|
307
|
+
result.stderrTruncated ||
|
|
308
|
+
(result.status !== 0 && result.status !== 1))
|
|
309
|
+
throw integrationError();
|
|
310
|
+
const records = result.status === 1 ? [] : parseConfigRecords(result.stdout);
|
|
311
|
+
const identities = [];
|
|
312
|
+
const commands = [];
|
|
313
|
+
let hooksRoot = path.join(repository.commonDir, "hooks");
|
|
314
|
+
let signingEnabled = null;
|
|
315
|
+
let signingFormat = "openpgp";
|
|
316
|
+
let signingFormatSeen = false;
|
|
317
|
+
let signingKeyPresent = false;
|
|
318
|
+
const signingPrograms = new Map();
|
|
319
|
+
const signingDefaultKeyCommands = [];
|
|
320
|
+
const executableBudget = { cache: new Map(), totalBytes: 0n };
|
|
321
|
+
for (const record of records) {
|
|
322
|
+
if (record.key.startsWith("include.") || record.key.startsWith("includeif.")) {
|
|
323
|
+
throw integrationError();
|
|
324
|
+
}
|
|
325
|
+
if (record.key === "core.attributesfile")
|
|
326
|
+
throw integrationError();
|
|
327
|
+
if (record.key === "core.hookspath") {
|
|
328
|
+
if (!record.value ||
|
|
329
|
+
record.value.includes("\0") ||
|
|
330
|
+
(!path.isAbsolute(record.value) && record.value.split(/[\\/]/u).some((segment) => segment === "..")))
|
|
331
|
+
throw integrationError();
|
|
332
|
+
hooksRoot = path.resolve(repository.worktreeRoot, record.value);
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
if (record.key === "commit.gpgsign") {
|
|
336
|
+
if (signingEnabled !== null)
|
|
337
|
+
throw integrationError();
|
|
338
|
+
if (/^(?:true|yes|on|1)$/iu.test(record.value))
|
|
339
|
+
signingEnabled = true;
|
|
340
|
+
else if (/^(?:false|no|off|0)$/iu.test(record.value))
|
|
341
|
+
signingEnabled = false;
|
|
342
|
+
else
|
|
343
|
+
throw integrationError();
|
|
344
|
+
identities.push(bindConfigurationFact("signing", record.key, record.value));
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
if (record.key === "gpg.format") {
|
|
348
|
+
if (signingFormatSeen || !/^(?:openpgp|x509|ssh)$/u.test(record.value))
|
|
349
|
+
throw integrationError();
|
|
350
|
+
signingFormat = record.value;
|
|
351
|
+
signingFormatSeen = true;
|
|
352
|
+
identities.push(bindConfigurationFact("signing", record.key, record.value));
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
if (record.key === "gpg.program" ||
|
|
356
|
+
record.key === "gpg.openpgp.program" ||
|
|
357
|
+
record.key === "gpg.x509.program" ||
|
|
358
|
+
record.key === "gpg.ssh.program") {
|
|
359
|
+
const values = signingPrograms.get(record.key) ?? [];
|
|
360
|
+
values.push(record);
|
|
361
|
+
signingPrograms.set(record.key, values);
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
if (record.key === "gpg.ssh.defaultkeycommand") {
|
|
365
|
+
signingDefaultKeyCommands.push(record);
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
if (record.key === "user.signingkey" ||
|
|
369
|
+
record.key === "user.name" ||
|
|
370
|
+
record.key === "user.email") {
|
|
371
|
+
if (record.key === "user.signingkey")
|
|
372
|
+
signingKeyPresent = true;
|
|
373
|
+
identities.push(bindConfigurationFact(record.key.startsWith("user.") && record.key !== "user.signingkey" ? "identity" : "signing", record.key, record.value));
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
if (record.key.endsWith(".required") ||
|
|
377
|
+
record.key.endsWith(".recursive") ||
|
|
378
|
+
record.key === "merge.default" ||
|
|
379
|
+
record.key === "merge.renormalize") {
|
|
380
|
+
identities.push(bindConfigurationFact(record.key.startsWith("filter.") ? "filter" : "merge_driver", record.key, record.value));
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
if (record.key === "core.fsmonitor" && /^(?:false|no|off|0)$/iu.test(record.value)) {
|
|
384
|
+
identities.push(bindConfigurationFact("fsmonitor", record.key, record.value));
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
const kind = record.key === "core.fsmonitor"
|
|
388
|
+
? "fsmonitor"
|
|
389
|
+
: record.key.startsWith("filter.")
|
|
390
|
+
? "filter"
|
|
391
|
+
: record.key.startsWith("merge.")
|
|
392
|
+
? "merge_driver"
|
|
393
|
+
: "signing";
|
|
394
|
+
const bound = await bindCommand(kind, record.key, record.value, repository, executableBudget);
|
|
395
|
+
identities.push(...bound.bindings);
|
|
396
|
+
commands.push(bound.command);
|
|
397
|
+
}
|
|
398
|
+
if (signingEnabled === true) {
|
|
399
|
+
if (!signingKeyPresent || signingDefaultKeyCommands.length !== 0)
|
|
400
|
+
throw integrationError();
|
|
401
|
+
const effectiveKey = signingFormat === "openpgp"
|
|
402
|
+
? (signingPrograms.has("gpg.openpgp.program") ? "gpg.openpgp.program" : "gpg.program")
|
|
403
|
+
: `gpg.${signingFormat}.program`;
|
|
404
|
+
const effectivePrograms = signingPrograms.get(effectiveKey) ?? [];
|
|
405
|
+
if (effectivePrograms.length !== 1)
|
|
406
|
+
throw integrationError();
|
|
407
|
+
const program = effectivePrograms[0];
|
|
408
|
+
const bound = await bindCommand("signing", program.key, program.value, repository, executableBudget, "program");
|
|
409
|
+
identities.push(...bound.bindings);
|
|
410
|
+
commands.push(bound.command);
|
|
411
|
+
for (const [key, values] of signingPrograms) {
|
|
412
|
+
if (key === effectiveKey)
|
|
413
|
+
continue;
|
|
414
|
+
for (const value of values)
|
|
415
|
+
identities.push(bindConfigurationFact("signing", value.key, value.value));
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
for (const values of signingPrograms.values()) {
|
|
420
|
+
for (const program of values) {
|
|
421
|
+
identities.push(bindConfigurationFact("signing", program.key, program.value));
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
for (const command of signingDefaultKeyCommands) {
|
|
425
|
+
identities.push(bindConfigurationFact("signing", command.key, command.value));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
const hooksRootIdentity = await fsp.lstat(hooksRoot, { bigint: true }).catch((error) => error.code === "ENOENT" ? null : Promise.reject(error));
|
|
429
|
+
if (hooksRootIdentity) {
|
|
430
|
+
if (!hooksRootIdentity.isDirectory() || hooksRootIdentity.isSymbolicLink())
|
|
431
|
+
throw integrationError();
|
|
432
|
+
for (const hook of HOOK_NAMES) {
|
|
433
|
+
const candidate = path.join(hooksRoot, hook);
|
|
434
|
+
const exists = await fsp.lstat(candidate, { bigint: true }).catch((error) => error.code === "ENOENT" ? null : Promise.reject(error));
|
|
435
|
+
if (!exists)
|
|
436
|
+
continue;
|
|
437
|
+
identities.push(await bindExecutable("hook", `hook:${hook}`, candidate, hook, executableBudget, hook));
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
identities.sort((left, right) => `${left.kind}:${left.configKeyDigest}:${left.contentDigest}`.localeCompare(`${right.kind}:${right.configKeyDigest}:${right.contentDigest}`, "en"));
|
|
441
|
+
if (identities.length > 128)
|
|
442
|
+
throw new Error("GIT_SCAN_LIMIT");
|
|
443
|
+
const configAfter = await readStableConfig(repository);
|
|
444
|
+
if (configAfter.digest !== configBefore.digest ||
|
|
445
|
+
configAfter.identity !== configBefore.identity)
|
|
446
|
+
throw new Error("GIT_STATE_CHANGED");
|
|
447
|
+
return {
|
|
448
|
+
identities,
|
|
449
|
+
hooksPath: await fsp.realpath(hooksRoot).catch(() => hooksRoot),
|
|
450
|
+
configBytes: configAfter.bytes,
|
|
451
|
+
configDigest: configAfter.digest,
|
|
452
|
+
configIdentity: configAfter.identity,
|
|
453
|
+
commands
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
async discover(repository) {
|
|
457
|
+
if (!this.options.enabled)
|
|
458
|
+
return [];
|
|
459
|
+
return (await this.#discover(repository)).identities;
|
|
460
|
+
}
|
|
461
|
+
async review(input) {
|
|
462
|
+
if (!this.options.enabled ||
|
|
463
|
+
!/^[a-f0-9]{64}$/u.test(input.semanticStateDigest))
|
|
464
|
+
throw integrationError();
|
|
465
|
+
const discovered = await this.#discover(input.repository);
|
|
466
|
+
const identities = discovered.identities;
|
|
467
|
+
const reviewedIdentities = identities.map(reviewBinding);
|
|
468
|
+
const digest = identitiesDigest(reviewedIdentities);
|
|
469
|
+
const reviewToken = this.options.reviews.mint("git_integration", {
|
|
470
|
+
workspaceId: input.workspaceId,
|
|
471
|
+
repositoryId: input.repository.repositoryId,
|
|
472
|
+
repositoryFingerprint: input.repository.repositoryFingerprint,
|
|
473
|
+
capabilityRevision: input.repository.capabilityRevision,
|
|
474
|
+
identities: reviewedIdentities,
|
|
475
|
+
identitiesDigest: digest,
|
|
476
|
+
semanticStateDigest: input.semanticStateDigest,
|
|
477
|
+
hooksPath: discovered.hooksPath,
|
|
478
|
+
configDigest: discovered.configDigest,
|
|
479
|
+
implementationRevision: INTEGRATION_IMPLEMENTATION_REVISION
|
|
480
|
+
});
|
|
481
|
+
return {
|
|
482
|
+
reviewToken,
|
|
483
|
+
identities: reviewedIdentities.map(({ kind, configKeyDigest, executableDigest, contentDigest }) => ({
|
|
484
|
+
kind,
|
|
485
|
+
configKeyDigest,
|
|
486
|
+
executableDigest,
|
|
487
|
+
contentDigest
|
|
488
|
+
})),
|
|
489
|
+
identitiesDigest: digest
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
inspect(reviewToken) {
|
|
493
|
+
if (!this.options.enabled)
|
|
494
|
+
throw integrationError();
|
|
495
|
+
const reviewed = this.options.reviews.inspect(reviewToken, "git_integration");
|
|
496
|
+
if (reviewed.implementationRevision !== INTEGRATION_IMPLEMENTATION_REVISION) {
|
|
497
|
+
throw new Error("GIT_STATE_TOKEN_INVALID");
|
|
498
|
+
}
|
|
499
|
+
return reviewed;
|
|
500
|
+
}
|
|
501
|
+
approvalPreview(reviewToken) {
|
|
502
|
+
const reviewed = this.inspect(reviewToken);
|
|
503
|
+
const byPath = new Map();
|
|
504
|
+
for (const identity of reviewed.identities) {
|
|
505
|
+
if (!identity.canonicalPath)
|
|
506
|
+
continue;
|
|
507
|
+
const kinds = byPath.get(identity.canonicalPath) ?? new Set();
|
|
508
|
+
kinds.add(identity.kind);
|
|
509
|
+
byPath.set(identity.canonicalPath, kinds);
|
|
510
|
+
}
|
|
511
|
+
if (byPath.size > MAX_INTEGRATION_EXECUTABLES)
|
|
512
|
+
throw new Error("GIT_SCAN_LIMIT");
|
|
513
|
+
return [...byPath.entries()]
|
|
514
|
+
.sort(([left], [right]) => left.localeCompare(right, "en"))
|
|
515
|
+
.map(([canonicalPath, kinds]) => `${[...kinds].sort().join("+")}: ${canonicalPath}`);
|
|
516
|
+
}
|
|
517
|
+
async #materialize(discovered, request) {
|
|
518
|
+
const privateRoot = await this.options.executor.createPrivateDirectory?.("git-integration-bundle");
|
|
519
|
+
if (!privateRoot || !this.options.executor.removePrivateDirectory)
|
|
520
|
+
throw integrationError();
|
|
521
|
+
const hooksPath = path.join(privateRoot, "hooks");
|
|
522
|
+
const binPath = path.join(privateRoot, "bin");
|
|
523
|
+
const integrationGitDir = request.operation === "commit"
|
|
524
|
+
? request.shadowGitDir
|
|
525
|
+
: path.join(privateRoot, "repo.git");
|
|
526
|
+
const snapshotPaths = new Map();
|
|
527
|
+
try {
|
|
528
|
+
await Promise.all([
|
|
529
|
+
fsp.mkdir(hooksPath, { mode: 0o700 }),
|
|
530
|
+
fsp.mkdir(binPath, { mode: 0o700 }),
|
|
531
|
+
fsp.mkdir(path.join(integrationGitDir, "objects"), { recursive: true, mode: 0o700 }),
|
|
532
|
+
request.operation === "commit"
|
|
533
|
+
? Promise.resolve()
|
|
534
|
+
: fsp.mkdir(path.join(integrationGitDir, "refs", "heads"), { recursive: true, mode: 0o700 })
|
|
535
|
+
]);
|
|
536
|
+
if (request.operation !== "commit") {
|
|
537
|
+
await fsp.writeFile(path.join(integrationGitDir, "HEAD"), "ref: refs/heads/codexgpt-integration\n", { flag: "wx", mode: 0o600 });
|
|
538
|
+
}
|
|
539
|
+
const privateConfigPath = path.join(integrationGitDir, "config");
|
|
540
|
+
await fsp.writeFile(privateConfigPath, discovered.configBytes, {
|
|
541
|
+
flag: "wx",
|
|
542
|
+
mode: 0o600
|
|
543
|
+
});
|
|
544
|
+
for (const key of [...new Set(discovered.commands.map((command) => command.key))].sort()) {
|
|
545
|
+
await removePrivateConfigKey(this.options.executor, privateConfigPath, key, true);
|
|
546
|
+
}
|
|
547
|
+
await removePrivateConfigKey(this.options.executor, privateConfigPath, "core.hookspath", false);
|
|
548
|
+
let executableIndex = 0;
|
|
549
|
+
for (const identity of discovered.identities) {
|
|
550
|
+
if (!identity.snapshotContent || !identity.canonicalPath)
|
|
551
|
+
continue;
|
|
552
|
+
if (identity.hookName) {
|
|
553
|
+
await fsp.writeFile(path.join(hooksPath, identity.hookName), identity.snapshotContent, {
|
|
554
|
+
flag: "wx",
|
|
555
|
+
mode: 0o700
|
|
556
|
+
});
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
const cacheKey = process.platform === "win32"
|
|
560
|
+
? identity.canonicalPath.toLocaleLowerCase("en-US")
|
|
561
|
+
: identity.canonicalPath;
|
|
562
|
+
if (snapshotPaths.has(cacheKey))
|
|
563
|
+
continue;
|
|
564
|
+
const extension = path.extname(identity.canonicalPath);
|
|
565
|
+
const destination = path.join(binPath, `integration-${executableIndex}${extension}`);
|
|
566
|
+
executableIndex += 1;
|
|
567
|
+
await fsp.writeFile(destination, identity.snapshotContent, { flag: "wx", mode: 0o700 });
|
|
568
|
+
snapshotPaths.set(cacheKey, destination);
|
|
569
|
+
}
|
|
570
|
+
const integrationConfigOverrides = discovered.commands.map((command) => {
|
|
571
|
+
const tokens = [...command.tokens];
|
|
572
|
+
for (const item of command.paths) {
|
|
573
|
+
const cacheKey = process.platform === "win32"
|
|
574
|
+
? item.canonicalPath.toLocaleLowerCase("en-US")
|
|
575
|
+
: item.canonicalPath;
|
|
576
|
+
const snapshot = snapshotPaths.get(cacheKey);
|
|
577
|
+
if (!snapshot)
|
|
578
|
+
throw integrationError();
|
|
579
|
+
const original = tokens[item.tokenIndex];
|
|
580
|
+
const separator = original.indexOf("=");
|
|
581
|
+
tokens[item.tokenIndex] = separator >= 0
|
|
582
|
+
? `${original.slice(0, separator + 1)}${snapshot}`
|
|
583
|
+
: snapshot;
|
|
584
|
+
}
|
|
585
|
+
const value = command.serialization === "program"
|
|
586
|
+
? tokens[0]
|
|
587
|
+
: tokens.map(commandToken).join(" ");
|
|
588
|
+
return `${command.key}=${value}`;
|
|
589
|
+
});
|
|
590
|
+
return {
|
|
591
|
+
request: {
|
|
592
|
+
...request,
|
|
593
|
+
integrationGitDir,
|
|
594
|
+
integrationConfigOverrides,
|
|
595
|
+
hooksPath
|
|
596
|
+
},
|
|
597
|
+
cleanup: () => this.options.executor.removePrivateDirectory(privateRoot)
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
catch (error) {
|
|
601
|
+
await this.options.executor.removePrivateDirectory(privateRoot).catch(() => { });
|
|
602
|
+
throw error;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
async execute(input) {
|
|
606
|
+
if (!this.options.enabled ||
|
|
607
|
+
!input.authorization ||
|
|
608
|
+
input.authorization.outcome !== "allow" ||
|
|
609
|
+
input.authorization.riskClass !== "R3" ||
|
|
610
|
+
!input.authorization.approvalId ||
|
|
611
|
+
!input.authorization.grantId ||
|
|
612
|
+
input.authorization.toolName !== input.expectedToolName ||
|
|
613
|
+
input.authorization.canonicalAction !== input.expectedCanonicalAction ||
|
|
614
|
+
input.authorization.workspaceId !== input.workspaceId ||
|
|
615
|
+
input.authorization.repositoryId !== input.repository.repositoryId ||
|
|
616
|
+
!this.options.executor.runApprovedIntegration)
|
|
617
|
+
throw integrationError();
|
|
618
|
+
const reviewed = this.inspect(input.reviewToken);
|
|
619
|
+
if (reviewed.workspaceId !== input.workspaceId ||
|
|
620
|
+
reviewed.repositoryId !== input.repository.repositoryId ||
|
|
621
|
+
reviewed.repositoryFingerprint !== input.repository.repositoryFingerprint ||
|
|
622
|
+
reviewed.capabilityRevision !== input.repository.capabilityRevision ||
|
|
623
|
+
reviewed.semanticStateDigest !== input.semanticStateDigest) {
|
|
624
|
+
this.options.reviews.consume(input.reviewToken, "git_integration");
|
|
625
|
+
throw new Error("GIT_STATE_CHANGED");
|
|
626
|
+
}
|
|
627
|
+
const current = await this.#discover(input.repository);
|
|
628
|
+
if (identitiesDigest(current.identities) !== reviewed.identitiesDigest ||
|
|
629
|
+
current.hooksPath !== reviewed.hooksPath ||
|
|
630
|
+
current.configDigest !== reviewed.configDigest) {
|
|
631
|
+
this.options.reviews.consume(input.reviewToken, "git_integration");
|
|
632
|
+
throw new Error("GIT_STATE_CHANGED");
|
|
633
|
+
}
|
|
634
|
+
this.options.reviews.consume(input.reviewToken, "git_integration");
|
|
635
|
+
const materialized = await this.#materialize(current, input.request);
|
|
636
|
+
try {
|
|
637
|
+
const execution = await this.options.executor.runApprovedIntegration(input.repository, materialized.request);
|
|
638
|
+
return {
|
|
639
|
+
...execution,
|
|
640
|
+
identities: current.identities.map(({ kind, configKeyDigest, executableDigest, contentDigest }) => ({
|
|
641
|
+
kind,
|
|
642
|
+
configKeyDigest,
|
|
643
|
+
executableDigest,
|
|
644
|
+
contentDigest
|
|
645
|
+
}))
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
finally {
|
|
649
|
+
await materialized.cleanup();
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
//# sourceMappingURL=integrations.js.map
|