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,291 @@
|
|
|
1
|
+
import fsp from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const scriptDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const repositoryRoot = path.resolve(scriptDirectory, "..");
|
|
7
|
+
const testRoot = path.join(repositoryRoot, "test");
|
|
8
|
+
const REPORT_MAX_BYTES = 2 * 1024 * 1024;
|
|
9
|
+
|
|
10
|
+
function boundedLabel(value, fallback = "unknown") {
|
|
11
|
+
if (typeof value !== "string" || value.length === 0 || value.length > 100) return fallback;
|
|
12
|
+
return /^[A-Za-z0-9._-]+$/.test(value) ? value : fallback;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function relativeTestPath(file) {
|
|
16
|
+
if (typeof file !== "string" || file.length === 0) return null;
|
|
17
|
+
let absolutePath;
|
|
18
|
+
try {
|
|
19
|
+
absolutePath = file.startsWith("file:") ? fileURLToPath(file) : path.resolve(repositoryRoot, file);
|
|
20
|
+
} catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const relative = path.relative(testRoot, absolutePath);
|
|
24
|
+
if (
|
|
25
|
+
relative.length === 0 ||
|
|
26
|
+
relative.startsWith(`..${path.sep}`) ||
|
|
27
|
+
relative === ".." ||
|
|
28
|
+
path.isAbsolute(relative) ||
|
|
29
|
+
!relative.endsWith(".test.mjs")
|
|
30
|
+
) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return `test/${relative.split(path.sep).join("/")}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function iso(timestamp) {
|
|
37
|
+
return new Date(timestamp).toISOString();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function identity(stat) {
|
|
41
|
+
return `${stat.dev}:${stat.ino}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function stableFacts(stat) {
|
|
45
|
+
return `${identity(stat)}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function inspectDirectory(target, expectedRoot, expectedRelative) {
|
|
49
|
+
const stat = await fsp.lstat(target, { bigint: true });
|
|
50
|
+
if (!stat.isDirectory() || stat.isSymbolicLink()) {
|
|
51
|
+
throw new Error(`Performance path must be a real directory: ${expectedRelative}`);
|
|
52
|
+
}
|
|
53
|
+
const real = await fsp.realpath(target);
|
|
54
|
+
const relative = path.relative(expectedRoot, real).split(path.sep).join("/");
|
|
55
|
+
if (relative !== expectedRelative) {
|
|
56
|
+
throw new Error(`Performance path escaped the repository: ${expectedRelative}`);
|
|
57
|
+
}
|
|
58
|
+
return { path: target, real, identity: identity(stat) };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function createDirectory(target) {
|
|
62
|
+
try {
|
|
63
|
+
await fsp.mkdir(target);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
if (error?.code !== "EEXIST") throw error;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export async function prepareTestPerformanceDirectory(root = repositoryRoot) {
|
|
70
|
+
const rootReal = await fsp.realpath(root);
|
|
71
|
+
const bridge = path.join(root, ".ai-bridge");
|
|
72
|
+
const performance = path.join(bridge, "performance");
|
|
73
|
+
await createDirectory(bridge);
|
|
74
|
+
const bridgeState = await inspectDirectory(bridge, rootReal, ".ai-bridge");
|
|
75
|
+
await createDirectory(performance);
|
|
76
|
+
const performanceState = await inspectDirectory(performance, rootReal, ".ai-bridge/performance");
|
|
77
|
+
return { rootReal, bridge: bridgeState, performance: performanceState };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export async function verifyTestPerformanceDirectory(state) {
|
|
81
|
+
const bridge = await inspectDirectory(state.bridge.path, state.rootReal, ".ai-bridge");
|
|
82
|
+
const performance = await inspectDirectory(
|
|
83
|
+
state.performance.path,
|
|
84
|
+
state.rootReal,
|
|
85
|
+
".ai-bridge/performance"
|
|
86
|
+
);
|
|
87
|
+
if (bridge.identity !== state.bridge.identity || performance.identity !== state.performance.identity) {
|
|
88
|
+
throw new Error("Performance directory identity changed while tests were running.");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function exactKeys(value, expected, label) {
|
|
93
|
+
assertObject(value, label);
|
|
94
|
+
const actual = Object.keys(value).sort();
|
|
95
|
+
const wanted = [...expected].sort();
|
|
96
|
+
if (actual.length !== wanted.length || actual.some((key, index) => key !== wanted[index])) {
|
|
97
|
+
throw new Error(`${label} has unexpected fields.`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function assertObject(value, label) {
|
|
102
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
103
|
+
throw new Error(`${label} must be an object.`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export async function validateTestPerformanceReport(
|
|
108
|
+
reportPath,
|
|
109
|
+
{
|
|
110
|
+
domain,
|
|
111
|
+
shard,
|
|
112
|
+
testNames,
|
|
113
|
+
platform = process.platform,
|
|
114
|
+
nodeVersion = process.version,
|
|
115
|
+
environment = process.env
|
|
116
|
+
}
|
|
117
|
+
) {
|
|
118
|
+
const handle = await fsp.open(reportPath, "r");
|
|
119
|
+
try {
|
|
120
|
+
const before = await handle.stat({ bigint: true });
|
|
121
|
+
if (!before.isFile() || before.nlink !== 1n || before.size <= 0n || before.size > BigInt(REPORT_MAX_BYTES)) {
|
|
122
|
+
throw new Error("Performance report must be one bounded single-link regular file.");
|
|
123
|
+
}
|
|
124
|
+
const buffer = Buffer.alloc(REPORT_MAX_BYTES + 1);
|
|
125
|
+
let loaded = 0;
|
|
126
|
+
while (loaded < buffer.length) {
|
|
127
|
+
const { bytesRead } = await handle.read(buffer, loaded, buffer.length - loaded, loaded);
|
|
128
|
+
if (bytesRead === 0) break;
|
|
129
|
+
loaded += bytesRead;
|
|
130
|
+
}
|
|
131
|
+
if (loaded > REPORT_MAX_BYTES) throw new Error("Performance report exceeded its read bound.");
|
|
132
|
+
const text = buffer.subarray(0, loaded).toString("utf8");
|
|
133
|
+
const after = await handle.stat({ bigint: true });
|
|
134
|
+
if (stableFacts(before) !== stableFacts(after) || BigInt(loaded) !== after.size) {
|
|
135
|
+
throw new Error("Performance report stable facts changed while it was read.");
|
|
136
|
+
}
|
|
137
|
+
const report = JSON.parse(text);
|
|
138
|
+
exactKeys(
|
|
139
|
+
report,
|
|
140
|
+
["schemaVersion", "domain", "shard", "startedAt", "endedAt", "durationMs", "runtime", "ci", "testFiles"],
|
|
141
|
+
"Performance report"
|
|
142
|
+
);
|
|
143
|
+
if (report.schemaVersion !== 1 || report.domain !== domain || report.shard !== shard) {
|
|
144
|
+
throw new Error("Performance report context does not match the test invocation.");
|
|
145
|
+
}
|
|
146
|
+
if (
|
|
147
|
+
!Number.isFinite(Date.parse(report.startedAt)) ||
|
|
148
|
+
!Number.isFinite(Date.parse(report.endedAt)) ||
|
|
149
|
+
!Number.isFinite(report.durationMs) ||
|
|
150
|
+
report.durationMs < 0
|
|
151
|
+
) {
|
|
152
|
+
throw new Error("Performance report has invalid aggregate timing metadata.");
|
|
153
|
+
}
|
|
154
|
+
exactKeys(report.runtime, ["platform", "architecture", "nodeVersion"], "Performance runtime");
|
|
155
|
+
if (
|
|
156
|
+
report.runtime.platform !== platform ||
|
|
157
|
+
report.runtime.architecture !== process.arch ||
|
|
158
|
+
report.runtime.nodeVersion !== nodeVersion
|
|
159
|
+
) {
|
|
160
|
+
throw new Error("Performance report runtime does not match the test process.");
|
|
161
|
+
}
|
|
162
|
+
if (report.ci !== null) {
|
|
163
|
+
exactKeys(report.ci, ["provider", "runId", "runAttempt", "job"], "Performance CI context");
|
|
164
|
+
if (
|
|
165
|
+
report.ci.provider !== "github-actions" ||
|
|
166
|
+
[report.ci.runId, report.ci.runAttempt, report.ci.job]
|
|
167
|
+
.some((value) => boundedLabel(value) !== value)
|
|
168
|
+
) {
|
|
169
|
+
throw new Error("Performance report contains invalid CI context.");
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (environment.GITHUB_ACTIONS === "true") {
|
|
173
|
+
const expectedCi = {
|
|
174
|
+
provider: "github-actions",
|
|
175
|
+
runId: boundedLabel(environment.GITHUB_RUN_ID),
|
|
176
|
+
runAttempt: boundedLabel(environment.GITHUB_RUN_ATTEMPT),
|
|
177
|
+
job: boundedLabel(environment.GITHUB_JOB)
|
|
178
|
+
};
|
|
179
|
+
if (
|
|
180
|
+
Object.values(expectedCi).includes("unknown") ||
|
|
181
|
+
report.ci === null ||
|
|
182
|
+
Object.entries(expectedCi).some(([key, value]) => report.ci[key] !== value)
|
|
183
|
+
) {
|
|
184
|
+
throw new Error("Performance report does not match the current GitHub Actions context.");
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (!Array.isArray(report.testFiles)) throw new Error("Performance testFiles must be an array.");
|
|
188
|
+
const expected = new Set(testNames.map((name) => `test/${name}`));
|
|
189
|
+
const actual = new Set();
|
|
190
|
+
for (const entry of report.testFiles) {
|
|
191
|
+
exactKeys(entry, ["test", "status", "startedAt", "endedAt", "durationMs"], "Performance test file");
|
|
192
|
+
if (!expected.has(entry.test) || actual.has(entry.test) || path.isAbsolute(entry.test)) {
|
|
193
|
+
throw new Error("Performance report contains an unexpected or duplicate test path.");
|
|
194
|
+
}
|
|
195
|
+
if (!["passed", "failed"].includes(entry.status)) {
|
|
196
|
+
throw new Error("Performance report contains an invalid test status.");
|
|
197
|
+
}
|
|
198
|
+
if (
|
|
199
|
+
!Number.isFinite(Date.parse(entry.startedAt)) ||
|
|
200
|
+
!Number.isFinite(Date.parse(entry.endedAt)) ||
|
|
201
|
+
!Number.isFinite(entry.durationMs) ||
|
|
202
|
+
entry.durationMs < 0
|
|
203
|
+
) {
|
|
204
|
+
throw new Error("Performance report contains invalid timing metadata.");
|
|
205
|
+
}
|
|
206
|
+
actual.add(entry.test);
|
|
207
|
+
}
|
|
208
|
+
if (actual.size !== expected.size) throw new Error("Performance report is missing test files.");
|
|
209
|
+
return report;
|
|
210
|
+
} finally {
|
|
211
|
+
await handle.close();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function createTestPerformanceReporter({
|
|
216
|
+
now = Date.now,
|
|
217
|
+
environment = process.env,
|
|
218
|
+
platform = process.platform,
|
|
219
|
+
architecture = process.arch,
|
|
220
|
+
nodeVersion = process.version
|
|
221
|
+
} = {}) {
|
|
222
|
+
return async function* testPerformanceReporter(source) {
|
|
223
|
+
const files = new Map();
|
|
224
|
+
let reportStartedAt = null;
|
|
225
|
+
let reportEndedAt = null;
|
|
226
|
+
|
|
227
|
+
for await (const event of source) {
|
|
228
|
+
const timestamp = now();
|
|
229
|
+
reportStartedAt ??= timestamp;
|
|
230
|
+
reportEndedAt = timestamp;
|
|
231
|
+
const test = relativeTestPath(event?.data?.file);
|
|
232
|
+
if (test === null) continue;
|
|
233
|
+
|
|
234
|
+
const current = files.get(test) ?? {
|
|
235
|
+
test,
|
|
236
|
+
status: "unknown",
|
|
237
|
+
firstObservedAt: timestamp,
|
|
238
|
+
startedAt: null,
|
|
239
|
+
endedAt: null,
|
|
240
|
+
lastObservedAt: timestamp
|
|
241
|
+
};
|
|
242
|
+
current.lastObservedAt = timestamp;
|
|
243
|
+
if (event.type === "test:dequeue") current.startedAt ??= timestamp;
|
|
244
|
+
if (event.type === "test:complete") current.endedAt = timestamp;
|
|
245
|
+
if (event.type === "test:fail") current.status = "failed";
|
|
246
|
+
if (event.type === "test:pass" && current.status !== "failed") current.status = "passed";
|
|
247
|
+
files.set(test, current);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const testFiles = [...files.values()]
|
|
251
|
+
.map((entry) => {
|
|
252
|
+
const startedAt = entry.startedAt ?? entry.firstObservedAt;
|
|
253
|
+
const endedAt = entry.endedAt ?? entry.lastObservedAt;
|
|
254
|
+
return {
|
|
255
|
+
test: entry.test,
|
|
256
|
+
status: entry.status,
|
|
257
|
+
startedAt: iso(startedAt),
|
|
258
|
+
endedAt: iso(endedAt),
|
|
259
|
+
durationMs: Math.max(0, endedAt - startedAt)
|
|
260
|
+
};
|
|
261
|
+
})
|
|
262
|
+
.sort((left, right) => right.durationMs - left.durationMs || left.test.localeCompare(right.test));
|
|
263
|
+
|
|
264
|
+
const githubActions = environment.GITHUB_ACTIONS === "true";
|
|
265
|
+
const report = {
|
|
266
|
+
schemaVersion: 1,
|
|
267
|
+
domain: boundedLabel(environment.CODEXGPT_TEST_PERFORMANCE_DOMAIN),
|
|
268
|
+
shard: boundedLabel(environment.CODEXGPT_TEST_PERFORMANCE_SHARD),
|
|
269
|
+
startedAt: reportStartedAt === null ? null : iso(reportStartedAt),
|
|
270
|
+
endedAt: reportEndedAt === null ? null : iso(reportEndedAt),
|
|
271
|
+
durationMs: reportStartedAt === null ? 0 : Math.max(0, reportEndedAt - reportStartedAt),
|
|
272
|
+
runtime: {
|
|
273
|
+
platform,
|
|
274
|
+
architecture,
|
|
275
|
+
nodeVersion
|
|
276
|
+
},
|
|
277
|
+
ci: githubActions
|
|
278
|
+
? {
|
|
279
|
+
provider: "github-actions",
|
|
280
|
+
runId: boundedLabel(environment.GITHUB_RUN_ID),
|
|
281
|
+
runAttempt: boundedLabel(environment.GITHUB_RUN_ATTEMPT),
|
|
282
|
+
job: boundedLabel(environment.GITHUB_JOB)
|
|
283
|
+
}
|
|
284
|
+
: null,
|
|
285
|
+
testFiles
|
|
286
|
+
};
|
|
287
|
+
yield `${JSON.stringify(report, null, 2)}\n`;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export default createTestPerformanceReporter();
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import fsp from "node:fs/promises";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { writeJsonAtomicFile } from "./atomic-file.mjs";
|
|
9
|
+
import { createOwnedTempRoot } from "./owned-temp-root.mjs";
|
|
10
|
+
|
|
11
|
+
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const spec = JSON.parse(await fsp.readFile(path.join(scriptDir, "toolchains.json"), "utf8"));
|
|
13
|
+
const argv = process.argv.slice(2);
|
|
14
|
+
const action = argv[0] ?? "status";
|
|
15
|
+
|
|
16
|
+
function option(name, fallback) {
|
|
17
|
+
const index = argv.indexOf(name);
|
|
18
|
+
return index === -1 ? fallback : argv[index + 1];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function fail(message, detail, code = 1) {
|
|
22
|
+
console.error(message);
|
|
23
|
+
if (detail) console.error(detail);
|
|
24
|
+
process.exit(code);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function stableRoot() {
|
|
28
|
+
if (option("--root")) return path.resolve(option("--root"));
|
|
29
|
+
if (process.platform !== "win32") fail("The pinned local toolchain manager currently supports native Windows only.");
|
|
30
|
+
const localAppData = process.env.LOCALAPPDATA?.trim()
|
|
31
|
+
? process.env.LOCALAPPDATA
|
|
32
|
+
: process.env.USERPROFILE
|
|
33
|
+
? path.win32.join(process.env.USERPROFILE, "AppData", "Local")
|
|
34
|
+
: undefined;
|
|
35
|
+
if (!localAppData) fail("LOCALAPPDATA or USERPROFILE is required to locate the stable toolchain root.");
|
|
36
|
+
return path.join(localAppData, "CodexGPT", "toolchains");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function requestedMajors() {
|
|
40
|
+
const value = String(option("--major", "all"));
|
|
41
|
+
if (value === "all") return Object.keys(spec.toolchains);
|
|
42
|
+
if (!spec.toolchains[value]) fail(`Unknown Node major ${value}; expected ${Object.keys(spec.toolchains).join(", ")}.`, undefined, 2);
|
|
43
|
+
return [value];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function toolchainPaths(root, major) {
|
|
47
|
+
const entry = spec.toolchains[major];
|
|
48
|
+
const directoryName = entry.archive.replace(/\.zip$/i, "");
|
|
49
|
+
const directory = path.join(root, directoryName);
|
|
50
|
+
return {
|
|
51
|
+
entry,
|
|
52
|
+
directory,
|
|
53
|
+
node: path.join(directory, "node.exe"),
|
|
54
|
+
npmCli: path.join(directory, "node_modules", "npm", "bin", "npm-cli.js")
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function runVersion(nodePath) {
|
|
59
|
+
const result = spawnSync(nodePath, ["--version"], { encoding: "utf8", windowsHide: true });
|
|
60
|
+
return result.status === 0 ? result.stdout.trim() : undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function hashFile(file) {
|
|
64
|
+
const hash = createHash("sha256");
|
|
65
|
+
await new Promise((resolve, reject) => {
|
|
66
|
+
const stream = fs.createReadStream(file);
|
|
67
|
+
stream.on("data", (chunk) => hash.update(chunk));
|
|
68
|
+
stream.on("error", reject);
|
|
69
|
+
stream.on("end", resolve);
|
|
70
|
+
});
|
|
71
|
+
return hash.digest("hex");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function download(url, destination) {
|
|
75
|
+
const response = await fetch(url, { redirect: "follow" });
|
|
76
|
+
if (!response.ok || !response.body) throw new Error(`Download failed (${response.status}) for ${url}`);
|
|
77
|
+
const file = fs.createWriteStream(destination, { flags: "wx" });
|
|
78
|
+
await new Promise(async (resolve, reject) => {
|
|
79
|
+
file.on("error", reject);
|
|
80
|
+
try {
|
|
81
|
+
for await (const chunk of response.body) {
|
|
82
|
+
if (!file.write(chunk)) await new Promise((drain) => file.once("drain", drain));
|
|
83
|
+
}
|
|
84
|
+
file.end(resolve);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
file.destroy();
|
|
87
|
+
reject(error);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function expectedDigest(shasumsText, archive) {
|
|
93
|
+
const line = shasumsText.split(/\r?\n/).find((candidate) => candidate.trim().endsWith(` ${archive}`));
|
|
94
|
+
if (!line) throw new Error(`Official SHASUMS256.txt does not contain ${archive}.`);
|
|
95
|
+
const digest = line.trim().split(/\s+/)[0];
|
|
96
|
+
if (!/^[0-9a-f]{64}$/i.test(digest)) throw new Error(`Invalid official SHA-256 entry for ${archive}.`);
|
|
97
|
+
return digest.toLowerCase();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function extractZip(archive, destination) {
|
|
101
|
+
const quotePowerShellLiteral = (value) => `'${String(value).replace(/'/g, "''")}'`;
|
|
102
|
+
const script = `Expand-Archive -LiteralPath ${quotePowerShellLiteral(archive)} -DestinationPath ${quotePowerShellLiteral(destination)} -Force`;
|
|
103
|
+
const command = [
|
|
104
|
+
"-NoLogo",
|
|
105
|
+
"-NoProfile",
|
|
106
|
+
"-NonInteractive",
|
|
107
|
+
"-ExecutionPolicy", "Bypass",
|
|
108
|
+
"-Command",
|
|
109
|
+
script
|
|
110
|
+
];
|
|
111
|
+
const result = spawnSync("powershell.exe", command, { encoding: "utf8", windowsHide: true, maxBuffer: 4 * 1024 * 1024 });
|
|
112
|
+
if (result.status !== 0) throw new Error(`PowerShell Expand-Archive failed: ${result.stderr || result.stdout}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async function readManifest(root) {
|
|
116
|
+
try {
|
|
117
|
+
return JSON.parse(await fsp.readFile(path.join(root, "manifest.json"), "utf8"));
|
|
118
|
+
} catch (error) {
|
|
119
|
+
if (error?.code === "ENOENT") return { schemaVersion: 1, installations: {} };
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function writeManifest(root, manifest) {
|
|
125
|
+
await writeJsonAtomicFile(path.join(root, "manifest.json"), manifest);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function installMajor(root, major) {
|
|
129
|
+
const { entry, directory, node } = toolchainPaths(root, major);
|
|
130
|
+
const existing = runVersion(node);
|
|
131
|
+
if (existing === `v${entry.version}`) return { major, status: "present", version: existing, directory };
|
|
132
|
+
if (await fsp.stat(directory).then(() => true, () => false)) {
|
|
133
|
+
fail(`Refusing to overwrite mismatched toolchain directory ${directory}. Relocate it manually before retrying.`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
await fsp.mkdir(root, { recursive: true });
|
|
137
|
+
const ownedTemp = await createOwnedTempRoot(`node-${major}`);
|
|
138
|
+
const tempRoot = ownedTemp.path;
|
|
139
|
+
const archivePath = path.join(tempRoot, entry.archive);
|
|
140
|
+
const shasumsUrl = `${spec.distribution}/v${entry.version}/${entry.shasums}`;
|
|
141
|
+
const archiveUrl = `${spec.distribution}/v${entry.version}/${entry.archive}`;
|
|
142
|
+
try {
|
|
143
|
+
const shasumsResponse = await fetch(shasumsUrl, { redirect: "follow" });
|
|
144
|
+
if (!shasumsResponse.ok) throw new Error(`Download failed (${shasumsResponse.status}) for ${shasumsUrl}`);
|
|
145
|
+
const shasumsText = await shasumsResponse.text();
|
|
146
|
+
const officialSha256 = expectedDigest(shasumsText, entry.archive);
|
|
147
|
+
await download(archiveUrl, archivePath);
|
|
148
|
+
const archiveSha256 = await hashFile(archivePath);
|
|
149
|
+
if (archiveSha256 !== officialSha256) {
|
|
150
|
+
throw new Error(`SHA-256 mismatch for ${entry.archive}: expected ${officialSha256}, received ${archiveSha256}.`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const extractRoot = path.join(tempRoot, "extract");
|
|
154
|
+
await fsp.mkdir(extractRoot);
|
|
155
|
+
extractZip(archivePath, extractRoot);
|
|
156
|
+
const extracted = path.join(extractRoot, entry.archive.replace(/\.zip$/i, ""));
|
|
157
|
+
const extractedVersion = runVersion(path.join(extracted, "node.exe"));
|
|
158
|
+
if (extractedVersion !== `v${entry.version}`) throw new Error(`Extracted runtime reported ${extractedVersion ?? "no version"}.`);
|
|
159
|
+
await fsp.rename(extracted, directory);
|
|
160
|
+
|
|
161
|
+
const manifest = await readManifest(root);
|
|
162
|
+
manifest.schemaVersion = 1;
|
|
163
|
+
manifest.installations ??= {};
|
|
164
|
+
manifest.installations[major] = {
|
|
165
|
+
tool: "node",
|
|
166
|
+
major: Number(major),
|
|
167
|
+
version: entry.version,
|
|
168
|
+
platform: entry.platform,
|
|
169
|
+
source: "official-node-distribution",
|
|
170
|
+
archive: entry.archive,
|
|
171
|
+
archiveUrl,
|
|
172
|
+
shasumsUrl,
|
|
173
|
+
archiveSha256,
|
|
174
|
+
installedPath: directory,
|
|
175
|
+
nodeExecutable: node,
|
|
176
|
+
verifiedAt: new Date().toISOString()
|
|
177
|
+
};
|
|
178
|
+
await writeManifest(root, manifest);
|
|
179
|
+
return { major, status: "installed", version: extractedVersion, directory, archiveSha256 };
|
|
180
|
+
} finally {
|
|
181
|
+
await ownedTemp.cleanup();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async function status(root) {
|
|
186
|
+
const manifest = await readManifest(root);
|
|
187
|
+
return {
|
|
188
|
+
schemaVersion: 1,
|
|
189
|
+
root,
|
|
190
|
+
manifestPath: path.join(root, "manifest.json"),
|
|
191
|
+
toolchains: Object.fromEntries(Object.keys(spec.toolchains).map((major) => {
|
|
192
|
+
const paths = toolchainPaths(root, major);
|
|
193
|
+
const reported = runVersion(paths.node);
|
|
194
|
+
const record = manifest.installations?.[major] ?? null;
|
|
195
|
+
return [major, {
|
|
196
|
+
expectedVersion: `v${paths.entry.version}`,
|
|
197
|
+
reportedVersion: reported ?? null,
|
|
198
|
+
ready: reported === `v${paths.entry.version}` && record?.archiveSha256?.length === 64,
|
|
199
|
+
directory: paths.directory,
|
|
200
|
+
supplyChainRecord: record
|
|
201
|
+
}];
|
|
202
|
+
}))
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function execution(root, major, command) {
|
|
207
|
+
const paths = toolchainPaths(root, major);
|
|
208
|
+
if (runVersion(paths.node) !== `v${paths.entry.version}`) fail(`Node ${major} is not ready. Run toolchain:ensure first.`);
|
|
209
|
+
const [program, ...programArgs] = command;
|
|
210
|
+
if (!program) fail("Missing command after --.", undefined, 2);
|
|
211
|
+
const env = {
|
|
212
|
+
...process.env,
|
|
213
|
+
PATH: `${paths.directory}${path.delimiter}${process.env.PATH ?? ""}`,
|
|
214
|
+
NODE: paths.node,
|
|
215
|
+
npm_node_execpath: paths.node
|
|
216
|
+
};
|
|
217
|
+
if (program === "node") return { executable: paths.node, args: programArgs, env };
|
|
218
|
+
if (program === "npm") {
|
|
219
|
+
return {
|
|
220
|
+
executable: paths.node,
|
|
221
|
+
args: [paths.npmCli, ...programArgs],
|
|
222
|
+
env: { ...env, npm_execpath: paths.npmCli }
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
return { executable: program, args: programArgs, env };
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
async function runOne(root, major, command) {
|
|
229
|
+
const selected = execution(root, major, command);
|
|
230
|
+
const child = spawn(selected.executable, selected.args, {
|
|
231
|
+
cwd: process.cwd(),
|
|
232
|
+
env: selected.env ?? process.env,
|
|
233
|
+
shell: false,
|
|
234
|
+
windowsHide: true,
|
|
235
|
+
stdio: "inherit"
|
|
236
|
+
});
|
|
237
|
+
return await new Promise((resolve) => {
|
|
238
|
+
child.once("error", (error) => {
|
|
239
|
+
console.error(error.stack ?? error.message);
|
|
240
|
+
resolve(127);
|
|
241
|
+
});
|
|
242
|
+
child.once("close", (code) => resolve(code ?? 1));
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const root = stableRoot();
|
|
247
|
+
if (action === "status") {
|
|
248
|
+
console.log(JSON.stringify(await status(root), null, 2));
|
|
249
|
+
} else if (action === "ensure") {
|
|
250
|
+
const results = [];
|
|
251
|
+
for (const major of requestedMajors()) results.push(await installMajor(root, major));
|
|
252
|
+
console.log(JSON.stringify({ root, results }, null, 2));
|
|
253
|
+
} else if (action === "exec" || action === "matrix") {
|
|
254
|
+
const separator = argv.indexOf("--");
|
|
255
|
+
if (separator === -1 || separator === argv.length - 1) fail(`${action} requires -- <command> [args...].`, undefined, 2);
|
|
256
|
+
const command = argv.slice(separator + 1);
|
|
257
|
+
const majors = action === "matrix" ? requestedMajors() : [String(option("--major"))];
|
|
258
|
+
if (majors.some((major) => !spec.toolchains[major])) fail("exec requires --major 20 or --major 24.", undefined, 2);
|
|
259
|
+
for (const major of majors) {
|
|
260
|
+
console.log(`\n=== Node ${major} (${spec.toolchains[major].version}) ===`);
|
|
261
|
+
const code = await runOne(root, major, command);
|
|
262
|
+
if (code !== 0) process.exit(code);
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
fail("Usage: node scripts/toolchain-manager.mjs <status|ensure|exec|matrix> [--major 20|24|all] [--root <dir>] [-- <command> ...]", undefined, 2);
|
|
266
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"stableRoot": "%LOCALAPPDATA%\\CodexGPT\\toolchains",
|
|
4
|
+
"distribution": "https://nodejs.org/dist",
|
|
5
|
+
"toolchains": {
|
|
6
|
+
"20": {
|
|
7
|
+
"version": "20.20.2",
|
|
8
|
+
"platform": "win-x64",
|
|
9
|
+
"archive": "node-v20.20.2-win-x64.zip",
|
|
10
|
+
"shasums": "SHASUMS256.txt"
|
|
11
|
+
},
|
|
12
|
+
"24": {
|
|
13
|
+
"version": "24.15.0",
|
|
14
|
+
"platform": "win-x64",
|
|
15
|
+
"archive": "node-v24.15.0-win-x64.zip",
|
|
16
|
+
"shasums": "SHASUMS256.txt"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const READY = "CXP4_CONPTY_READY";
|
|
4
|
+
const INPUT_ACK = "CXP4_INPUT_ACK";
|
|
5
|
+
const ETX_ACK = "CXP4_ETX_ACK";
|
|
6
|
+
const PROBE_TIMEOUT_MS = 20_000;
|
|
7
|
+
|
|
8
|
+
let buffered = Buffer.alloc(0);
|
|
9
|
+
let etxAcknowledged = false;
|
|
10
|
+
let exiting = false;
|
|
11
|
+
|
|
12
|
+
function writeLine(value) {
|
|
13
|
+
process.stdout.write(`${value}\r\n`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function acknowledgeEtx() {
|
|
17
|
+
if (etxAcknowledged || exiting) return;
|
|
18
|
+
etxAcknowledged = true;
|
|
19
|
+
writeLine(ETX_ACK);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function fail(code) {
|
|
23
|
+
if (exiting) return;
|
|
24
|
+
exiting = true;
|
|
25
|
+
process.stderr.write(`${code}\n`);
|
|
26
|
+
process.exitCode = 1;
|
|
27
|
+
process.stdin.pause();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function finish() {
|
|
31
|
+
if (exiting) return;
|
|
32
|
+
exiting = true;
|
|
33
|
+
process.exitCode = etxAcknowledged ? 0 : 1;
|
|
34
|
+
process.stdin.pause();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function consumeLines() {
|
|
38
|
+
while (true) {
|
|
39
|
+
const newline = buffered.indexOf(0x0a);
|
|
40
|
+
if (newline < 0) return;
|
|
41
|
+
const line = buffered.subarray(0, newline).toString("utf8").replace(/\r$/, "");
|
|
42
|
+
buffered = buffered.subarray(newline + 1);
|
|
43
|
+
if (line === "CXP4_INPUT") {
|
|
44
|
+
writeLine(INPUT_ACK);
|
|
45
|
+
} else if (line === "CXP4_EXIT") {
|
|
46
|
+
finish();
|
|
47
|
+
return;
|
|
48
|
+
} else if (line.length > 0) {
|
|
49
|
+
fail("CXP4_PROBE_COMMAND_INVALID");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
process.on("SIGINT", acknowledgeEtx);
|
|
56
|
+
process.stdin.on("data", (chunk) => {
|
|
57
|
+
if (exiting) return;
|
|
58
|
+
const incoming = Buffer.from(chunk);
|
|
59
|
+
const retained = [];
|
|
60
|
+
for (const byte of incoming) {
|
|
61
|
+
if (byte === 0x03) acknowledgeEtx();
|
|
62
|
+
else retained.push(byte);
|
|
63
|
+
}
|
|
64
|
+
if (retained.length > 0) {
|
|
65
|
+
buffered = Buffer.concat([buffered, Buffer.from(retained)]);
|
|
66
|
+
if (buffered.length > 4096) return fail("CXP4_PROBE_INPUT_TOO_LARGE");
|
|
67
|
+
consumeLines();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
process.stdin.on("end", () => {
|
|
71
|
+
if (!exiting) fail("CXP4_PROBE_INPUT_CLOSED");
|
|
72
|
+
});
|
|
73
|
+
process.stdin.on("error", () => fail("CXP4_PROBE_INPUT_FAILED"));
|
|
74
|
+
|
|
75
|
+
if (process.stdin.isTTY && typeof process.stdin.setRawMode === "function") {
|
|
76
|
+
process.stdin.setRawMode(true);
|
|
77
|
+
}
|
|
78
|
+
process.stdin.resume();
|
|
79
|
+
writeLine(READY);
|
|
80
|
+
|
|
81
|
+
const timeout = setTimeout(() => fail("CXP4_PROBE_TIMEOUT"), PROBE_TIMEOUT_MS);
|
|
82
|
+
timeout.unref?.();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
param(
|
|
2
|
+
[switch]$SimulateCloseHang,
|
|
3
|
+
[switch]$Persistent,
|
|
4
|
+
[string]$NodeExecutable,
|
|
5
|
+
[string]$ProbeScript
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
Set-StrictMode -Version Latest
|
|
9
|
+
$ErrorActionPreference = 'Stop'
|
|
10
|
+
|
|
11
|
+
$scriptRoot = [System.IO.Path]::GetFullPath($PSScriptRoot)
|
|
12
|
+
$sourcePath = [System.IO.Path]::Combine($scriptRoot, 'windows-process-host.cs')
|
|
13
|
+
if (-not [System.IO.File]::Exists($sourcePath)) {
|
|
14
|
+
[Console]::Error.WriteLine('CONPTY_WORKER_SOURCE_MISSING')
|
|
15
|
+
exit 2
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
Add-Type -Path $sourcePath -ReferencedAssemblies @('System.Web.Extensions') -ErrorAction Stop | Out-Null
|
|
19
|
+
if ($Persistent.IsPresent) {
|
|
20
|
+
[CodexGPT.Phase4.ProcessHost]::RunConPtyPersistentWorker()
|
|
21
|
+
exit [Environment]::ExitCode
|
|
22
|
+
}
|
|
23
|
+
[CodexGPT.Phase4.ProcessHost]::RunConPtyWorker($SimulateCloseHang.IsPresent, $NodeExecutable, $ProbeScript)
|
|
24
|
+
exit [Environment]::ExitCode
|