@brucewaynedecoy/make-docs 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{backup-CM7RL2Q7.js → backup-P5NUPAJL.js} +4 -4
- package/dist/{chunk-M7DMFIKU.js → chunk-2WC74W66.js} +224 -20
- package/dist/chunk-2WC74W66.js.map +1 -0
- package/dist/{chunk-OR5ZVGLG.js → chunk-B7QF7XZT.js} +151 -5
- package/dist/chunk-B7QF7XZT.js.map +1 -0
- package/dist/{chunk-LV3CBXZB.js → chunk-DNPFQB24.js} +3 -3
- package/dist/{chunk-52FTNVXS.js → chunk-EF47XIIR.js} +8977 -2891
- package/dist/chunk-EF47XIIR.js.map +1 -0
- package/dist/{chunk-GERMRLJ2.js → chunk-KFYUB4AX.js} +6 -4
- package/dist/chunk-KFYUB4AX.js.map +1 -0
- package/dist/{chunk-ADVNSMA7.js → chunk-LK6BLVZA.js} +3 -3
- package/dist/{chunk-65QWMODG.js → chunk-PI7W5QDB.js} +3 -3
- package/dist/{chunk-65QWMODG.js.map → chunk-PI7W5QDB.js.map} +1 -1
- package/dist/{chunk-YVSASZMT.js → chunk-SFKYGFUV.js} +277 -79
- package/dist/chunk-SFKYGFUV.js.map +1 -0
- package/dist/{chunk-J5QDGRZ7.js → chunk-TDB6UW4M.js} +116 -37
- package/dist/chunk-TDB6UW4M.js.map +1 -0
- package/dist/{chunk-7R2PPKTB.js → chunk-XFFESINU.js} +2 -2
- package/dist/index.js +408 -86
- package/dist/index.js.map +1 -1
- package/dist/registry-44WLX4F5.js +50 -0
- package/dist/registry-44WLX4F5.js.map +1 -0
- package/dist/{self-36ULRIJ6.js → self-WRWI5XNE.js} +10 -10
- package/dist/server-FYRDPOBR.js +1117 -0
- package/dist/server-FYRDPOBR.js.map +1 -0
- package/dist/{setup-system-JI36YJ6D.js → setup-system-XX6NSVXZ.js} +263 -40
- package/dist/setup-system-XX6NSVXZ.js.map +1 -0
- package/dist/{skills-command-IGDVLNKY.js → skills-command-YAQP24JM.js} +17 -7
- package/dist/skills-command-YAQP24JM.js.map +1 -0
- package/dist/{uninstall-VBGMQQLA.js → uninstall-3YJKZ6UF.js} +9 -9
- package/dist/virtual_make-docs-first-party-skills-5TYTCD5U.js +11 -0
- package/dist/virtual_make-docs-first-party-skills-5TYTCD5U.js.map +1 -0
- package/package.json +5 -5
- package/skill-registry.json +24 -8
- package/skill-registry.schema.json +2 -1
- package/template/.make-docs/system/contracts/system-resource-contract.md +16 -0
- package/template/.make-docs/system-resources.catalog.json +415 -0
- package/template/.make-docs/system-resources.schema.json +25 -0
- package/dist/chunk-52FTNVXS.js.map +0 -1
- package/dist/chunk-GERMRLJ2.js.map +0 -1
- package/dist/chunk-J5QDGRZ7.js.map +0 -1
- package/dist/chunk-M7DMFIKU.js.map +0 -1
- package/dist/chunk-OR5ZVGLG.js.map +0 -1
- package/dist/chunk-YVSASZMT.js.map +0 -1
- package/dist/server-H754TA4Q.js +0 -512
- package/dist/server-H754TA4Q.js.map +0 -1
- package/dist/setup-system-JI36YJ6D.js.map +0 -1
- package/dist/skills-command-IGDVLNKY.js.map +0 -1
- package/dist/virtual_make-docs-first-party-skills-H3FC47C2.js +0 -11
- package/dist/virtual_make-docs-first-party-skills-H3FC47C2.js.map +0 -1
- /package/dist/{backup-CM7RL2Q7.js.map → backup-P5NUPAJL.js.map} +0 -0
- /package/dist/{chunk-LV3CBXZB.js.map → chunk-DNPFQB24.js.map} +0 -0
- /package/dist/{chunk-ADVNSMA7.js.map → chunk-LK6BLVZA.js.map} +0 -0
- /package/dist/{chunk-7R2PPKTB.js.map → chunk-XFFESINU.js.map} +0 -0
- /package/dist/{self-36ULRIJ6.js.map → self-WRWI5XNE.js.map} +0 -0
- /package/dist/{uninstall-VBGMQQLA.js.map → uninstall-3YJKZ6UF.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/harness-access/contract.ts","../src/harness-access/native.ts","../src/harness-access/registry.ts","../src/operations/access.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readFileSync, realpathSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { platform } from \"../platform\";\nexport type HarnessId = \"codex\" | \"claude-code\";\nexport type HarnessScope = \"machine\" | \"project\";\nexport type HarnessConnectionMethod = \"mcp\" | \"command-rules\" | \"permission-rules\";\nexport type HarnessMethodSelection = \"none\" | HarnessConnectionMethod;\nexport type HarnessAccessState =\n | \"current\"\n | \"missing\"\n | \"drifted\"\n | \"unsupported\"\n | \"blocked\";\n\nexport type HarnessNativeFormat =\n | \"codex-mcp-toml\"\n | \"codex-command-rules\"\n | \"claude-mcp-json\"\n | \"claude-permission-json\";\n\nexport interface VerifiedExecutableIdentity {\n kind: \"make-docs\";\n /** The path used to launch Make Docs. It can be a verified package-manager link. */\n launchPath?: string;\n /** The resolved package bin. Native entries use this stable path. */\n path: string;\n sha256: string;\n size: number;\n productMarker: \"@brucewaynedecoy/make-docs:package-bin\";\n packageName: \"@brucewaynedecoy/make-docs\";\n packageVersion: string;\n packageRoot: string;\n binRelativePath: string;\n}\n\nexport const HARNESS_CALLER_IDENTITY_ENV = \"MAKE_DOCS_HARNESS_CALLER_IDENTITY\" as const;\nexport const HARNESS_CALLER_IDENTITY_ARG = \"--make-docs-harness-caller\" as const;\nexport const HARNESS_CALLER_REFERENCE_ARG = \"--make-docs-harness-caller-ref\" as const;\n\n/**\n * Launch identity emitted by a first-party MCP native entry. This value is an\n * input to receipt verification. It does not grant access by itself.\n */\nexport interface HarnessCallerIdentity {\n schemaVersion: 1;\n kind: \"make-docs-harness-caller\";\n adapterId: string;\n adapterVersion: number;\n harnessId: HarnessId;\n connectionMethod: HarnessConnectionMethod;\n scope: \"machine\";\n root: string;\n executable: VerifiedExecutableIdentity;\n}\n\n/** A generic MCP client must present the reviewed secret proof. */\nexport interface GenericMcpCallerIdentity {\n schemaVersion: 1;\n kind: \"make-docs-generic-mcp-caller\";\n adapterId: \"generic-mcp\";\n adapterVersion: 1;\n harnessId: string;\n connectionMethod: \"mcp\";\n scope: \"machine\";\n root: string;\n executable: VerifiedExecutableIdentity;\n proof: string;\n}\n\nexport type ParsedHarnessCallerIdentity = HarnessCallerIdentity | GenericMcpCallerIdentity;\n\n/**\n * Compact Claude Code permission-rule carrier. This reference is not authority.\n * Store-backed calls must rebuild and verify the full caller identity and receipt.\n */\nexport interface HarnessCallerReference {\n raw: string;\n harnessId: \"claude-code\";\n connectionMethod: \"permission-rules\";\n adapterVersion: 1;\n root: string;\n identitySha256: string;\n}\n\nexport interface VerifyExecutableInput {\n executablePath: string;\n expectedSha256?: string;\n}\n\nexport type ExecutableVerificationCode =\n | \"executable-path-not-absolute\"\n | \"executable-fingerprint-invalid\"\n | \"executable-path-missing\"\n | \"executable-link-broken\"\n | \"executable-not-file\"\n | \"executable-not-executable\"\n | \"executable-runner-forbidden\"\n | \"executable-fingerprint-mismatch\"\n | \"executable-package-mismatch\";\n\nexport class ExecutableVerificationError extends Error {\n readonly name = \"ExecutableVerificationError\";\n\n constructor(\n readonly code: ExecutableVerificationCode,\n message: string,\n readonly launchPath: string,\n readonly resolvedPath: string | null,\n readonly failedRule: string,\n readonly nextAction: string,\n ) {\n super(message);\n }\n}\n\nexport interface HarnessCommandRule {\n id: string;\n commandPrefix: readonly string[];\n operationIds: readonly string[];\n access: {\n store: \"none\" | \"read\" | \"write\";\n project: \"none\" | \"read\" | \"write\";\n hostConfig: \"none\";\n };\n}\n\n/**\n * The composition root supplies the operation registry through this leaf contract.\n * This keeps the adapter independent from registry module assembly while still\n * requiring the registry to validate every native command rule.\n */\nexport interface HarnessCommandRuleAuthority {\n list(): readonly HarnessCommandRule[];\n validate(rules: readonly HarnessCommandRule[]): readonly HarnessCommandRule[];\n}\n\nexport interface HarnessMethodDefinition {\n id: HarnessConnectionMethod;\n scopes: readonly HarnessScope[];\n nativeFormat: HarnessNativeFormat;\n requiresExecutable: true;\n requiresCommandRules: boolean;\n nativeFile(scope: HarnessScope): string;\n ownedEntries: readonly string[];\n allowedStoreOperations: \"active-operation-registry\" | \"bounded-command-rule-registry\";\n implementationState: \"implemented\";\n availability: \"available\" | \"blocked\";\n blocker: string | null;\n nextAction: string;\n}\n\nexport interface HarnessDetectionResult {\n adapterId: string;\n harnessId: HarnessId;\n scope: HarnessScope;\n state: \"detected\" | \"not-detected\" | \"blocked\";\n evidence: readonly string[];\n reason?: string;\n}\n\nexport interface ResolvedHarnessMethodSupport {\n state: \"available\" | \"blocked\" | \"unsupported\";\n selectable: boolean;\n reason: string;\n nextAction: string;\n}\n\nexport type NativeEntryValue =\n | null\n | boolean\n | number\n | string\n | NativeEntryValue[]\n | { [key: string]: NativeEntryValue };\n\nexport interface HarnessReceiptEntry {\n path: string;\n entryId: string;\n ownership: \"make-docs\";\n beforeEntryFingerprint: string | null;\n beforeFileFingerprint: string | null;\n beforeValue: NativeEntryValue | null;\n entryFingerprint: string;\n fileFingerprint: string;\n value: NativeEntryValue;\n}\n\nexport interface HarnessAccessReceipt {\n /**\n * Schema 1 receipts retain the executable that was current when setup ran.\n * Schema 2 receipts prove only the managed native entry and its history.\n */\n schemaVersion: 1 | 2;\n operationId: string;\n adapterId: string;\n adapterVersion: number;\n harnessId: HarnessId;\n connectionMethod: HarnessConnectionMethod;\n scope: HarnessScope;\n executable?: VerifiedExecutableIdentity;\n appliedVersion: string;\n verifiedAt: string;\n entries: readonly HarnessReceiptEntry[];\n result: \"verified\";\n verificationResult: \"passed\";\n driftState: \"current\";\n recoveryStatus: \"complete\";\n}\n\nexport interface HarnessNativeChange {\n path: string;\n entryId: string;\n action: \"create\" | \"update\" | \"remove\" | \"none\";\n ownership: \"missing\" | \"make-docs-owned\" | \"unverified\";\n beforeFileFingerprint: string | null;\n afterFileFingerprint: string | null;\n beforeEntryValue: NativeEntryValue | null;\n beforeEntryFingerprint: string | null;\n afterEntryFingerprint: string | null;\n afterEntryValue: NativeEntryValue | null;\n blockedReason?: string;\n}\n\nexport interface HarnessAccessPlan {\n schemaVersion: 1;\n kind: \"apply\" | \"remove\";\n adapterId: string;\n adapterVersion: number;\n harnessId: HarnessId;\n connectionMethod: HarnessConnectionMethod;\n scope: HarnessScope;\n root: string;\n executable: VerifiedExecutableIdentity;\n state: HarnessAccessState;\n changes: readonly HarnessNativeChange[];\n reviewFingerprint: string;\n nextAction: string;\n}\n\nexport interface HarnessPlanInput {\n method: HarnessConnectionMethod;\n scope: HarnessScope;\n root: string;\n executable: VerifiedExecutableIdentity;\n commandRules?: readonly HarnessCommandRule[];\n commandRuleAuthority?: HarnessCommandRuleAuthority;\n receipt?: HarnessAccessReceipt;\n}\n\nexport interface HarnessRemoveInput {\n method: HarnessConnectionMethod;\n scope: HarnessScope;\n root: string;\n executable: VerifiedExecutableIdentity;\n receipt: HarnessAccessReceipt;\n}\n\nexport interface HarnessVerifyInput extends HarnessPlanInput {}\n\nexport interface HarnessVerificationResult {\n adapterId: string;\n adapterVersion: number;\n harnessId: HarnessId;\n connectionMethod: HarnessConnectionMethod;\n scope: HarnessScope;\n state: HarnessAccessState;\n entries: readonly HarnessReceiptEntry[];\n reason?: string;\n}\n\nexport interface HarnessApplyResult {\n changedPaths: readonly string[];\n verification: HarnessVerificationResult;\n receipt: HarnessAccessReceipt;\n}\n\nexport interface HarnessRemovalResult {\n changedPaths: readonly string[];\n verification: HarnessVerificationResult;\n}\n\nexport interface HarnessAdapter {\n id: string;\n version: number;\n harnessId: HarnessId;\n displayName: string;\n executableNames: readonly string[];\n projectRouterFiles: readonly string[];\n skillRoots: readonly string[];\n methods: readonly HarnessMethodDefinition[];\n detect(input: { scope: HarnessScope; root: string; path?: string }): HarnessDetectionResult;\n plan(input: HarnessPlanInput): HarnessAccessPlan;\n apply(input: {\n plan: HarnessAccessPlan;\n approved: boolean;\n operationId: string;\n appliedVersion: string;\n verifiedAt?: string;\n }): HarnessApplyResult;\n applyRemoval(input: {\n plan: HarnessAccessPlan;\n approved: boolean;\n }): HarnessRemovalResult;\n verify(input: HarnessVerifyInput): HarnessVerificationResult;\n repair(input: HarnessPlanInput): HarnessAccessPlan;\n planRemoval(input: HarnessRemoveInput): HarnessAccessPlan;\n}\n\nconst FORBIDDEN_EXECUTABLE_NAMES = new Set([\n \"bash\",\n \"bun\",\n \"cmd\",\n \"deno\",\n \"node\",\n \"npm\",\n \"npx\",\n \"pnpm\",\n \"powershell\",\n \"pwsh\",\n \"sh\",\n \"yarn\",\n \"zsh\",\n]);\n\nconst FORBIDDEN_COMMAND_WORDS = new Set([\n \"backup\",\n \"remove\",\n \"setup\",\n \"uninstall\",\n \"update\",\n]);\n\nconst SAFE_COMMAND_WORD = /^[A-Za-z0-9][A-Za-z0-9._:-]*$/;\nconst SHA256 = /^[0-9a-f]{64}$/;\nconst PACKAGE_NAME = \"@brucewaynedecoy/make-docs\" as const;\nconst PRODUCT_MARKER = \"@brucewaynedecoy/make-docs:package-bin\" as const;\nexport function sha256(value: string | Buffer): string {\n return createHash(\"sha256\").update(value).digest(\"hex\");\n}\n\nexport function verifyMakeDocsExecutable(\n input: VerifyExecutableInput,\n): VerifiedExecutableIdentity {\n return verifyExecutableAgainstPackage(input, resolvePackagedExecutableIdentity());\n}\n\n/** Recheck one identity against the package that owns this running process. */\nexport function reverifyMakeDocsExecutableIdentity(\n executable: VerifiedExecutableIdentity,\n): VerifiedExecutableIdentity {\n return verifyMakeDocsExecutable({\n executablePath: executable.launchPath ?? executable.path,\n expectedSha256: executable.sha256,\n });\n}\n\nfunction verifyExecutableAgainstPackage(\n input: VerifyExecutableInput,\n packaged: ReturnType<typeof resolvePackagedExecutableIdentity>,\n): VerifiedExecutableIdentity {\n if (!path.isAbsolute(input.executablePath)) {\n throw verificationError(\n \"executable-path-not-absolute\",\n \"The Make Docs executable path must be absolute.\",\n input.executablePath,\n null,\n \"absolute-launch-path\",\n \"Run the installed `make-docs` command through its absolute package-manager link.\",\n );\n }\n if (input.expectedSha256 !== undefined && !SHA256.test(input.expectedSha256)) {\n throw verificationError(\n \"executable-fingerprint-invalid\",\n \"The expected Make Docs executable fingerprint must be a SHA-256 digest.\",\n input.executablePath,\n null,\n \"expected-sha256\",\n \"Create a new setup review from the active installed executable.\",\n );\n }\n\n let launchStat: ReturnType<typeof lstatSync>;\n try {\n launchStat = lstatSync(input.executablePath);\n } catch (error) {\n throw verificationError(\n \"executable-path-missing\",\n `The Make Docs launch path cannot be read: ${toMessage(error)}`,\n input.executablePath,\n null,\n \"launch-path-present\",\n \"Run setup from the installed `make-docs` command or reinstall the package if the link is missing.\",\n );\n }\n\n let actualPath: string;\n try {\n actualPath = realpathSync(input.executablePath);\n } catch (error) {\n throw verificationError(\n \"executable-link-broken\",\n `The Make Docs launch path cannot resolve to a package binary: ${toMessage(error)}`,\n input.executablePath,\n null,\n \"resolved-package-bin\",\n \"Repair or reinstall the broken package-manager link, then review setup again.\",\n );\n }\n\n const stat = lstatSync(actualPath);\n if (!stat.isFile()) {\n throw verificationError(\n \"executable-not-file\",\n \"The resolved Make Docs package binary is not a regular file.\",\n input.executablePath,\n actualPath,\n \"regular-package-bin\",\n \"Repair the installed package and review setup again.\",\n );\n }\n if (!platform.acceptsExecutableMode(stat.mode)) {\n throw verificationError(\n \"executable-not-executable\",\n \"The resolved Make Docs package binary is not executable.\",\n input.executablePath,\n actualPath,\n \"executable-package-bin\",\n \"Repair the package file mode or reinstall the package, then review setup again.\",\n );\n }\n\n const executableName = path.basename(input.executablePath).toLowerCase().replace(/\\.exe$/, \"\");\n if (FORBIDDEN_EXECUTABLE_NAMES.has(executableName)) {\n throw verificationError(\n \"executable-runner-forbidden\",\n `A package runner or shell cannot be used as the Make Docs executable: ${executableName}.`,\n input.executablePath,\n actualPath,\n \"direct-make-docs-launcher\",\n \"Run the installed `make-docs` command directly, then review setup again.\",\n );\n }\n\n const bytes = readFileSync(actualPath);\n const actualSha256 = sha256(bytes);\n if (input.expectedSha256 !== undefined && actualSha256 !== input.expectedSha256) {\n throw verificationError(\n \"executable-fingerprint-mismatch\",\n \"The Make Docs executable fingerprint does not match the reviewed executable.\",\n input.executablePath,\n actualPath,\n \"reviewed-sha256\",\n \"Create a new setup review from the current installed executable.\",\n );\n }\n\n if (actualPath !== packaged.path) {\n throw verificationError(\n \"executable-package-mismatch\",\n \"The executable is not the exact Make Docs package binary for this installation.\",\n input.executablePath,\n actualPath,\n \"declared-package-bin\",\n \"Run the `make-docs` command installed by this package, then review setup again.\",\n );\n }\n\n return {\n kind: \"make-docs\",\n launchPath: input.executablePath,\n path: packaged.path,\n sha256: actualSha256,\n size: bytes.byteLength,\n productMarker: PRODUCT_MARKER,\n packageName: PACKAGE_NAME,\n packageVersion: packaged.packageVersion,\n packageRoot: packaged.packageRoot,\n binRelativePath: packaged.binRelativePath,\n };\n}\n\nfunction verificationError(\n code: ExecutableVerificationCode,\n message: string,\n launchPath: string,\n resolvedPath: string | null,\n failedRule: string,\n nextAction: string,\n): ExecutableVerificationError {\n return new ExecutableVerificationError(\n code,\n message,\n launchPath,\n resolvedPath,\n failedRule,\n nextAction,\n );\n}\n\nfunction toMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nfunction resolvePackagedExecutableIdentity(): {\n path: string;\n packageVersion: string;\n packageRoot: string;\n binRelativePath: string;\n} {\n let candidate = path.dirname(fileURLToPath(import.meta.url));\n for (let depth = 0; depth < 5; depth += 1) {\n const manifestPath = path.join(candidate, \"package.json\");\n try {\n const manifest = JSON.parse(readFileSync(manifestPath, \"utf8\")) as Record<string, unknown>;\n const bin = manifest.bin;\n if (\n manifest.name === PACKAGE_NAME &&\n typeof manifest.version === \"string\" &&\n manifest.version.trim() &&\n bin &&\n typeof bin === \"object\" &&\n typeof (bin as Record<string, unknown>)[\"make-docs\"] === \"string\"\n ) {\n const binRelativePath = (bin as Record<string, string>)[\"make-docs\"];\n const packageRoot = realpathSync(candidate);\n const executablePath = realpathSync(path.resolve(packageRoot, binRelativePath));\n const relative = path.relative(packageRoot, executablePath);\n if (relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {\n throw new Error(\"The Make Docs package binary escapes its package root.\");\n }\n return {\n path: executablePath,\n packageVersion: manifest.version,\n packageRoot,\n binRelativePath,\n };\n }\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n }\n const parent = path.dirname(candidate);\n if (parent === candidate) break;\n candidate = parent;\n }\n throw new Error(\"The active Make Docs package identity could not be proved.\");\n}\n\nexport function validateHarnessCommandRules(\n rules: readonly HarnessCommandRule[] | undefined,\n authority?: HarnessCommandRuleAuthority,\n): readonly HarnessCommandRule[] {\n if (!rules || rules.length === 0) {\n throw new Error(\"A command-rule method needs at least one registry-derived command prefix.\");\n }\n if (!authority) {\n throw new Error(\"A command-rule method needs the operation registry validation authority.\");\n }\n\n const ids = new Set<string>();\n const prefixes = new Set<string>();\n for (const rule of rules) {\n if (!rule.id.trim() || ids.has(rule.id)) {\n throw new Error(`Command-rule identifiers must be non-empty and unique: ${rule.id || \"<empty>\"}.`);\n }\n ids.add(rule.id);\n if (rule.commandPrefix.length < 2) {\n throw new Error(`Command rule ${rule.id} is too broad. Use a command and subcommand.`);\n }\n if (rule.operationIds.length === 0) {\n throw new Error(`Command rule ${rule.id} has no admitted operation.`);\n }\n if (isAdministrativeCommandRule(rule)) {\n throw new Error(`Command rule ${rule.id} cannot approve lifecycle or recovery administration.`);\n }\n if (rule.access.hostConfig !== \"none\") {\n throw new Error(`Command rule ${rule.id} cannot approve host-configuration writes.`);\n }\n for (const word of rule.commandPrefix) {\n if (!SAFE_COMMAND_WORD.test(word)) {\n throw new Error(`Command rule ${rule.id} contains an unsafe command word: ${word}.`);\n }\n if (FORBIDDEN_COMMAND_WORDS.has(word.toLowerCase())) {\n throw new Error(`Command rule ${rule.id} cannot approve ${word}.`);\n }\n if (FORBIDDEN_EXECUTABLE_NAMES.has(word.toLowerCase().replace(/\\.exe$/, \"\"))) {\n throw new Error(`Command rule ${rule.id} cannot approve a wrapper or package runner: ${word}.`);\n }\n if (word.toLowerCase() === \"make-docs\") {\n throw new Error(`Command rule ${rule.id} contains an extra executable token.`);\n }\n }\n const prefixKey = rule.commandPrefix.join(\"\\0\");\n if (prefixes.has(prefixKey)) {\n throw new Error(`Command prefixes must be unique: ${rule.commandPrefix.join(\" \")}.`);\n }\n prefixes.add(prefixKey);\n }\n\n authority.validate(rules);\n const registryRules = authority.list();\n const candidates = new Map(registryRules.map(rule => [rule.id, rule]));\n if (registryRules.length !== rules.length || candidates.size !== registryRules.length) {\n throw new Error(\"Command rules must contain every exact operation-registry candidate once.\");\n }\n for (const rule of rules) {\n const candidate = candidates.get(rule.id);\n if (!candidate) {\n throw new Error(`Command rule ${rule.id} is not an exact operation-registry candidate.`);\n }\n if (\n rule.operationIds.length !== 1 ||\n rule.operationIds[0] !== candidate.operationIds[0] ||\n rule.commandPrefix.length !== candidate.commandPrefix.length ||\n rule.commandPrefix.some((word, index) => word !== candidate.commandPrefix[index]) ||\n rule.access.store !== candidate.access.store ||\n rule.access.project !== candidate.access.project ||\n rule.access.hostConfig !== candidate.access.hostConfig\n ) {\n throw new Error(`Command rule ${rule.id} does not match its exact operation-registry command and access declaration.`);\n }\n }\n return Object.freeze([...rules]);\n}\n\nexport function listBoundedHarnessCommandRules(\n authority?: HarnessCommandRuleAuthority,\n): readonly HarnessCommandRule[] {\n if (!authority) return Object.freeze([]);\n return validateHarnessCommandRules(authority.list(), authority);\n}\n\nfunction isAdministrativeCommandRule(rule: HarnessCommandRule): boolean {\n return rule.operationIds.some(\n operationId =>\n operationId.startsWith(\"lifecycle.\") ||\n operationId === \"project.state.recover\",\n );\n}\n\nexport function canonicalJson(value: NativeEntryValue): string {\n return JSON.stringify(sortJson(value));\n}\n\nexport function fingerprintEntry(value: NativeEntryValue): string {\n return sha256(canonicalJson(value));\n}\n\nexport function encodeHarnessCallerIdentity(identity: ParsedHarnessCallerIdentity): string {\n assertHarnessCallerIdentityShape(identity);\n return canonicalJson(identity as unknown as NativeEntryValue);\n}\n\n/** Encode one caller identity as a shell-safe, plain command argument. */\nexport function encodeHarnessCallerIdentityArgument(identity: HarnessCallerIdentity): string {\n return Buffer.from(encodeHarnessCallerIdentity(identity), \"utf8\").toString(\"base64url\");\n}\n\n/** Encode the compact, non-secret carrier used only by Claude Code permission rules. */\nexport function encodeHarnessCallerReference(identity: HarnessCallerIdentity): string {\n assertHarnessCallerIdentityShape(identity);\n if (\n identity.kind !== \"make-docs-harness-caller\" ||\n identity.harnessId !== \"claude-code\" ||\n identity.connectionMethod !== \"permission-rules\" ||\n identity.adapterVersion !== 1\n ) {\n throw new Error(\"A caller reference needs the Claude Code permission-rules v1 identity.\");\n }\n const root = canonicalMachineRoot(identity.root);\n if (root !== identity.root) {\n throw new Error(\"The caller reference machine root must be canonical.\");\n }\n const encodedRoot = Buffer.from(root, \"utf8\").toString(\"base64url\");\n const digest = sha256(encodeHarnessCallerIdentity(identity));\n return `claude-code.permission-rules.v1.${encodedRoot}.${digest}`;\n}\n\n/** Parse and validate the compact Claude Code permission-rule carrier. */\nexport function parseHarnessCallerReference(raw: string): HarnessCallerReference {\n const match = /^claude-code\\.permission-rules\\.v1\\.([A-Za-z0-9_-]+)\\.([0-9a-f]{64})$/.exec(raw);\n if (!match) {\n throw new Error(\"The harness caller reference has an invalid format.\");\n }\n const encodedRoot = match[1];\n const decodedBytes = Buffer.from(encodedRoot, \"base64url\");\n const root = decodedBytes.toString(\"utf8\");\n if (!root || Buffer.from(root, \"utf8\").toString(\"base64url\") !== encodedRoot) {\n throw new Error(\"The harness caller reference root is not canonical base64url.\");\n }\n if (canonicalMachineRoot(root) !== root) {\n throw new Error(\"The harness caller reference root is not a canonical absolute path.\");\n }\n return Object.freeze({\n raw,\n harnessId: \"claude-code\",\n connectionMethod: \"permission-rules\",\n adapterVersion: 1,\n root,\n identitySha256: match[2],\n });\n}\n\nfunction canonicalMachineRoot(root: string): string {\n if (!path.isAbsolute(root) || root.includes(\"\\0\") || path.normalize(root) !== root) {\n throw new Error(\"The harness caller reference root must be an absolute normalized path.\");\n }\n try {\n const stat = lstatSync(root);\n if (!stat.isDirectory() || stat.isSymbolicLink()) throw new Error(\"not-directory\");\n return platform.describePath(root).canonicalPath;\n } catch {\n throw new Error(\"The harness caller reference root does not exist.\");\n }\n}\n\n/** Decode one shell-safe caller identity argument before normal CLI dispatch. */\nexport function parseHarnessCallerIdentityArgument(raw: string): ParsedHarnessCallerIdentity {\n if (!raw || !/^[A-Za-z0-9_-]+$/.test(raw)) {\n throw new Error(\"The harness caller identity argument is not valid base64url.\");\n }\n const decoded = Buffer.from(raw, \"base64url\").toString(\"utf8\");\n if (Buffer.from(decoded, \"utf8\").toString(\"base64url\") !== raw) {\n throw new Error(\"The harness caller identity argument is not canonical base64url.\");\n }\n return parseHarnessCallerIdentityValue(decoded);\n}\n\n/** Parse the marker shape only. The caller must still verify its receipt and package identity. */\nexport function parseHarnessCallerIdentityValue(raw: string): ParsedHarnessCallerIdentity {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n throw new Error(\"The harness caller identity is not valid JSON.\");\n }\n assertHarnessCallerIdentityShape(parsed);\n return Object.freeze({\n ...parsed,\n executable: Object.freeze({ ...parsed.executable }),\n });\n}\n\n/** Parse the first-party identity used by native adapter tests and rule carriers. */\nexport function parseHarnessCallerIdentity(raw: string): HarnessCallerIdentity {\n const parsed = parseHarnessCallerIdentityValue(raw);\n if (parsed.kind !== \"make-docs-harness-caller\") {\n throw new Error(\"The harness caller identity is not a first-party adapter identity.\");\n }\n return parsed;\n}\n\nfunction assertHarnessCallerIdentityShape(value: unknown): asserts value is ParsedHarnessCallerIdentity {\n const generic = Boolean(\n value && typeof value === \"object\" && !Array.isArray(value) &&\n (value as Record<string, unknown>).kind === \"make-docs-generic-mcp-caller\",\n );\n if (!isExactRecord(value, [\n \"schemaVersion\",\n \"kind\",\n \"adapterId\",\n \"adapterVersion\",\n \"harnessId\",\n \"connectionMethod\",\n \"scope\",\n \"root\",\n \"executable\",\n ...(generic ? [\"proof\"] : []),\n ])) {\n throw new Error(\"The harness caller identity has an invalid object shape.\");\n }\n if (\n value.schemaVersion !== 1 ||\n (value.kind !== \"make-docs-harness-caller\" && value.kind !== \"make-docs-generic-mcp-caller\") ||\n typeof value.adapterId !== \"string\" ||\n !value.adapterId.trim() ||\n !Number.isSafeInteger(value.adapterVersion) ||\n (value.adapterVersion as number) < 1 ||\n (generic\n ? typeof value.harnessId !== \"string\" || !/^generic-mcp-[a-z][a-z0-9-]*$/.test(value.harnessId)\n : value.harnessId !== \"codex\" && value.harnessId !== \"claude-code\") ||\n ![\"mcp\", \"command-rules\", \"permission-rules\"].includes(value.connectionMethod as string) ||\n value.scope !== \"machine\" ||\n typeof value.root !== \"string\" ||\n !path.isAbsolute(value.root)\n ) {\n throw new Error(\"The harness caller identity fields are invalid.\");\n }\n if (generic && (\n value.adapterId !== \"generic-mcp\" ||\n value.adapterVersion !== 1 ||\n value.connectionMethod !== \"mcp\" ||\n typeof value.proof !== \"string\" ||\n !/^[A-Za-z0-9_-]{32,}$/.test(value.proof)\n )) {\n throw new Error(\"The generic MCP caller identity fields are invalid.\");\n }\n assertExecutableIdentityShape(value.executable);\n}\n\nfunction assertExecutableIdentityShape(value: unknown): asserts value is VerifiedExecutableIdentity {\n if (!isExactRecordWithOptionalKeys(value, [\n \"kind\",\n \"path\",\n \"sha256\",\n \"size\",\n \"productMarker\",\n \"packageName\",\n \"packageVersion\",\n \"packageRoot\",\n \"binRelativePath\",\n ], [\"launchPath\"])) {\n throw new Error(\"The harness caller executable identity has an invalid object shape.\");\n }\n if (\n value.kind !== \"make-docs\" ||\n (value.launchPath !== undefined &&\n (typeof value.launchPath !== \"string\" || !path.isAbsolute(value.launchPath))) ||\n typeof value.path !== \"string\" ||\n !path.isAbsolute(value.path) ||\n typeof value.sha256 !== \"string\" ||\n !SHA256.test(value.sha256) ||\n !Number.isSafeInteger(value.size) ||\n (value.size as number) < 1 ||\n value.productMarker !== PRODUCT_MARKER ||\n value.packageName !== PACKAGE_NAME ||\n typeof value.packageVersion !== \"string\" ||\n !value.packageVersion.trim() ||\n typeof value.packageRoot !== \"string\" ||\n !path.isAbsolute(value.packageRoot) ||\n typeof value.binRelativePath !== \"string\" ||\n !value.binRelativePath ||\n path.isAbsolute(value.binRelativePath) ||\n value.binRelativePath.split(/[\\\\/]/).includes(\"..\")\n ) {\n throw new Error(\"The harness caller executable identity fields are invalid.\");\n }\n}\n\nfunction isExactRecordWithOptionalKeys(\n value: unknown,\n requiredKeys: readonly string[],\n optionalKeys: readonly string[],\n): value is Record<string, unknown> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n const actual = Object.keys(value);\n const allowed = new Set([...requiredKeys, ...optionalKeys]);\n return requiredKeys.every(key => actual.includes(key)) && actual.every(key => allowed.has(key));\n}\n\nfunction isExactRecord(value: unknown, keys: readonly string[]): value is Record<string, unknown> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n const actual = Object.keys(value).sort();\n const expected = [...keys].sort();\n return actual.length === expected.length && actual.every((key, index) => key === expected[index]);\n}\n\nexport function resolveHarnessMethodSupport(\n adapter: HarnessAdapter,\n methodId: HarnessConnectionMethod,\n): ResolvedHarnessMethodSupport {\n const method = adapter.methods.find(candidate => candidate.id === methodId);\n if (!method) {\n return {\n state: \"unsupported\",\n selectable: false,\n reason: `${adapter.displayName} does not implement ${methodId}.`,\n nextAction: `Choose one of the methods admitted by ${adapter.displayName}.`,\n };\n }\n if (method.availability === \"blocked\") {\n return {\n state: \"blocked\",\n selectable: false,\n reason: method.blocker ?? `${adapter.displayName} ${methodId} is blocked.`,\n nextAction: method.nextAction,\n };\n }\n return {\n state: \"available\",\n selectable: true,\n reason: `${adapter.displayName} ${methodId} is a product-owned setup method.`,\n nextAction: method.nextAction,\n };\n}\n\nfunction sortJson(value: NativeEntryValue): NativeEntryValue {\n if (Array.isArray(value)) return value.map(sortJson);\n if (value && typeof value === \"object\") {\n return Object.fromEntries(\n Object.entries(value)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([key, child]) => [key, sortJson(child)]),\n );\n }\n return value;\n}\n","import {\n closeSync,\n constants,\n existsSync,\n fstatSync,\n lstatSync,\n mkdirSync,\n openSync,\n readFileSync,\n unlinkSync,\n writeFileSync,\n type BigIntStats,\n} from \"node:fs\";\nimport path from \"node:path\";\nimport { randomUUID } from \"node:crypto\";\nimport { assertManagedPathHasNoSymlinks } from \"../utils\";\nimport { platform, type FileMutationGuard } from \"../platform\";\nimport {\n HARNESS_CALLER_IDENTITY_ARG,\n HARNESS_CALLER_IDENTITY_ENV,\n HARNESS_CALLER_REFERENCE_ARG,\n canonicalJson,\n encodeHarnessCallerIdentity,\n encodeHarnessCallerIdentityArgument,\n encodeHarnessCallerReference,\n fingerprintEntry,\n reverifyMakeDocsExecutableIdentity,\n sha256,\n validateHarnessCommandRules,\n type HarnessAccessPlan,\n type HarnessAccessReceipt,\n type HarnessAdapter,\n type HarnessApplyResult,\n type HarnessCommandRule,\n type HarnessCommandRuleAuthority,\n type HarnessCallerIdentity,\n type HarnessConnectionMethod,\n type HarnessDetectionResult,\n type HarnessId,\n type HarnessMethodDefinition,\n type HarnessNativeChange,\n type HarnessNativeFormat,\n type HarnessPlanInput,\n type HarnessReceiptEntry,\n type HarnessRemovalResult,\n type HarnessRemoveInput,\n type HarnessScope,\n type HarnessVerificationResult,\n type HarnessVerifyInput,\n type NativeEntryValue,\n type VerifiedExecutableIdentity,\n} from \"./contract\";\n\nexport interface HarnessAdapterDefinition {\n id: string;\n version: number;\n harnessId: HarnessId;\n displayName: string;\n executableNames: readonly string[];\n projectRouterFiles: readonly string[];\n skillRoots: readonly string[];\n methods: readonly HarnessMethodDefinition[];\n}\n\ninterface DesiredEntry {\n path: string;\n entryId: string;\n value: NativeEntryValue;\n}\n\ninterface InspectedEntry {\n exists: boolean;\n value: NativeEntryValue | null;\n}\n\ninterface LocatedManagedBlock {\n start: number;\n end: number;\n content: string;\n}\n\ninterface HarnessNativeMutationHookContext {\n action: \"remove\" | \"replace\";\n absolutePath: string;\n relativePath: string;\n}\n\nlet harnessNativeMutationHookForTests:\n | ((context: HarnessNativeMutationHookContext) => void)\n | null = null;\n\n/** Test-only seam for a path swap at the final mutation boundary. */\nexport function __setHarnessNativeMutationHookForTests(\n hook: ((context: HarnessNativeMutationHookContext) => void) | null,\n): void {\n if (process.env.NODE_ENV !== \"test\") {\n throw new Error(\"The harness native mutation hook is available only to tests.\");\n }\n harnessNativeMutationHookForTests = hook;\n}\n\nconst CODEX_MCP_BEGIN = \"# make-docs:begin harness-access codex mcp\";\nconst CODEX_MCP_END = \"# make-docs:end harness-access codex mcp\";\n\nexport function createHarnessAdapter(definition: HarnessAdapterDefinition): HarnessAdapter {\n const adapter: HarnessAdapter = {\n ...definition,\n detect: input => detectHarness(definition, input.scope, input.root, input.path),\n plan: input => planHarnessAccess(adapter, input),\n apply: input =>\n applyHarnessAccessPlan(\n adapter,\n input.plan,\n input.approved,\n input.operationId,\n input.appliedVersion,\n input.verifiedAt,\n ),\n applyRemoval: input => applyHarnessRemovalPlan(adapter, input.plan, input.approved),\n verify: input => verifyHarnessAccess(adapter, input),\n repair: input => planHarnessAccess(adapter, input),\n planRemoval: input => planHarnessAccessRemoval(adapter, input),\n };\n return Object.freeze(adapter);\n}\n\nfunction detectHarness(\n adapter: HarnessAdapterDefinition,\n scope: HarnessScope,\n root: string,\n executablePath?: string,\n): HarnessDetectionResult {\n try {\n assertSafeRoot(root);\n const evidence = new Set<string>();\n for (const executableName of adapter.executableNames) {\n if (findExecutableOnPath(executableName, executablePath)) evidence.add(`executable:${executableName}`);\n }\n for (const method of adapter.methods.filter(candidate => candidate.scopes.includes(scope))) {\n const relativePath = method.nativeFile(scope);\n assertNativePath(root, relativePath);\n const absolutePath = path.join(root, relativePath);\n if (existsSync(absolutePath)) evidence.add(relativePath);\n const nativeRoot = path.normalize(relativePath).split(path.sep)[0];\n if (nativeRoot && existsSync(path.join(root, nativeRoot))) evidence.add(nativeRoot);\n }\n return {\n adapterId: adapter.id,\n harnessId: adapter.harnessId,\n scope,\n state: evidence.size > 0 ? \"detected\" : \"not-detected\",\n evidence: [...evidence].sort(),\n };\n } catch (error) {\n return {\n adapterId: adapter.id,\n harnessId: adapter.harnessId,\n scope,\n state: \"blocked\",\n evidence: [],\n reason: toMessage(error),\n };\n }\n}\n\nfunction findExecutableOnPath(executableName: string, executablePath = process.env.PATH ?? \"\"): string | null {\n return platform.findExecutable(executableName, executablePath);\n}\n\nfunction planHarnessAccess(adapter: HarnessAdapter, input: HarnessPlanInput): HarnessAccessPlan {\n const method = requireMethod(adapter, input.method, input.scope);\n validateExecutableIdentity(input.executable);\n assertSafeRoot(input.root);\n const desired = desiredEntry(\n adapter,\n method,\n input.scope,\n input.root,\n input.executable,\n input.commandRules,\n input.commandRuleAuthority,\n );\n assertNativePath(input.root, desired.path);\n const beforeContent = readNativeContent(input.root, desired.path);\n const receiptEntry = receiptEntryFor(adapter, input, desired.path, desired.entryId);\n\n let change: HarnessNativeChange;\n let state: HarnessAccessPlan[\"state\"];\n if (method.nativeFormat === \"claude-permission-json\") {\n ({ change, state } = planClaudePermissionChange(desired, beforeContent, receiptEntry));\n } else try {\n const inspected = inspectEntry(method.nativeFormat, beforeContent, desired.value);\n const beforeEntryFingerprint = inspected.exists && inspected.value !== null\n ? fingerprintEntry(inspected.value)\n : null;\n\n if (inspected.exists && !receiptEntry) {\n change = blockedChange(\n desired,\n beforeContent,\n beforeEntryFingerprint,\n \"The matching native entry has no exact Make Docs ownership receipt.\",\n );\n state = \"blocked\";\n } else if (\n inspected.exists &&\n receiptEntry &&\n beforeEntryFingerprint !== receiptEntry.entryFingerprint\n ) {\n change = blockedChange(\n desired,\n beforeContent,\n beforeEntryFingerprint,\n \"The native entry changed after the last verified receipt. Preserve it and review the change.\",\n );\n state = \"drifted\";\n } else if (\n inspected.exists &&\n beforeEntryFingerprint === fingerprintEntry(desired.value)\n ) {\n change = {\n path: desired.path,\n entryId: desired.entryId,\n action: \"none\",\n ownership: \"make-docs-owned\",\n beforeFileFingerprint: fingerprintFile(beforeContent),\n afterFileFingerprint: fingerprintFile(beforeContent),\n beforeEntryValue: inspected.value,\n beforeEntryFingerprint,\n afterEntryFingerprint: beforeEntryFingerprint,\n afterEntryValue: desired.value,\n };\n state = \"current\";\n } else {\n const afterContent = applyEntry(method.nativeFormat, beforeContent, desired.value);\n change = {\n path: desired.path,\n entryId: desired.entryId,\n action: beforeContent === null ? \"create\" : \"update\",\n ownership: inspected.exists ? \"make-docs-owned\" : \"missing\",\n beforeFileFingerprint: fingerprintFile(beforeContent),\n afterFileFingerprint: fingerprintFile(afterContent),\n beforeEntryValue: inspected.value,\n beforeEntryFingerprint,\n afterEntryFingerprint: fingerprintEntry(desired.value),\n afterEntryValue: desired.value,\n };\n state = inspected.exists ? \"drifted\" : \"missing\";\n }\n } catch (error) {\n change = blockedChange(desired, beforeContent, null, toMessage(error));\n state = \"blocked\";\n }\n\n return sealPlan({\n schemaVersion: 1,\n kind: \"apply\",\n adapterId: adapter.id,\n adapterVersion: adapter.version,\n harnessId: adapter.harnessId,\n connectionMethod: method.id,\n scope: input.scope,\n root: path.normalize(input.root),\n executable: input.executable,\n state,\n changes: [change],\n reviewFingerprint: \"\",\n nextAction:\n state === \"blocked\" || (state === \"drifted\" && change.action === \"none\")\n ? change.blockedReason ?? \"Review the native entry before any change.\"\n : change.action === \"none\"\n ? \"No change is needed.\"\n : \"Review and approve this exact native-file change.\",\n });\n}\n\nfunction applyHarnessAccessPlan(\n adapter: HarnessAdapter,\n plan: HarnessAccessPlan,\n approved: boolean,\n operationId: string,\n appliedVersion: string,\n verifiedAt = new Date().toISOString(),\n): HarnessApplyResult {\n assertPlanForAdapter(adapter, plan, \"apply\");\n assertReviewFingerprint(plan);\n if (!approved) throw new Error(\"Harness access apply needs explicit approval.\");\n if (!operationId.trim()) throw new Error(\"Harness access apply needs an operation identifier.\");\n if (!appliedVersion.trim()) throw new Error(\"Harness access apply needs an applied product version.\");\n if (!Number.isFinite(Date.parse(verifiedAt))) {\n throw new Error(\"Harness access apply needs a valid verification time.\");\n }\n if (plan.state === \"blocked\" || plan.state === \"unsupported\") {\n throw new Error(`Harness access cannot apply while its state is ${plan.state}.`);\n }\n const blocker = plan.changes.find(change => change.blockedReason);\n if (blocker?.blockedReason) throw new Error(blocker.blockedReason);\n\n const changedPaths: string[] = [];\n for (const change of plan.changes) {\n if (change.action === \"none\") continue;\n if (change.blockedReason) throw new Error(change.blockedReason);\n const liveContent = readNativeContent(plan.root, change.path);\n if (fingerprintFile(liveContent) === change.afterFileFingerprint) continue;\n if (fingerprintFile(liveContent) !== change.beforeFileFingerprint) {\n throw new Error(`Native configuration changed after review: ${change.path}.`);\n }\n if (change.afterEntryValue === null) {\n throw new Error(`The reviewed plan has no target native entry for ${change.path}.`);\n }\n const method = requireMethod(adapter, plan.connectionMethod, plan.scope);\n const afterContent = applyEntry(\n method.nativeFormat,\n liveContent,\n change.afterEntryValue,\n change.beforeEntryValue,\n );\n if (fingerprintFile(afterContent) !== change.afterFileFingerprint) {\n throw new Error(`The live native file cannot reproduce the reviewed change: ${change.path}.`);\n }\n writeNativeContent(\n plan.root,\n change.path,\n afterContent,\n change.beforeFileFingerprint,\n );\n changedPaths.push(change.path);\n }\n\n const entries = receiptEntriesFromPlan(plan);\n const receipt: HarnessAccessReceipt = {\n schemaVersion: 2,\n operationId,\n adapterId: adapter.id,\n adapterVersion: adapter.version,\n harnessId: adapter.harnessId,\n connectionMethod: plan.connectionMethod,\n scope: plan.scope,\n appliedVersion,\n verifiedAt,\n entries,\n result: \"verified\",\n verificationResult: \"passed\",\n driftState: \"current\",\n recoveryStatus: \"complete\",\n };\n const verification = verifyAgainstReceipt(adapter, plan.root, receipt);\n if (verification.state !== \"current\") {\n throw new Error(verification.reason ?? \"The native harness change did not verify.\");\n }\n return { changedPaths, verification, receipt };\n}\n\nfunction verifyHarnessAccess(\n adapter: HarnessAdapter,\n input: HarnessVerifyInput,\n): HarnessVerificationResult {\n const method = requireMethod(adapter, input.method, input.scope);\n validateExecutableIdentity(input.executable);\n assertSafeRoot(input.root);\n const desired = desiredEntry(\n adapter,\n method,\n input.scope,\n input.root,\n input.executable,\n input.commandRules,\n input.commandRuleAuthority,\n );\n const receiptEntry = receiptEntryFor(adapter, input, desired.path, desired.entryId);\n const content = readNativeContent(input.root, desired.path);\n try {\n const inspected = inspectEntry(method.nativeFormat, content, desired.value);\n if (!inspected.exists || inspected.value === null) {\n return verification(adapter, method.id, input.scope, \"missing\", [], \"The native entry is absent.\");\n }\n const entryFingerprint = fingerprintEntry(inspected.value);\n if (!receiptEntry) {\n return verification(\n adapter,\n method.id,\n input.scope,\n \"blocked\",\n [],\n \"The native entry exists, but no exact Make Docs ownership receipt proves it.\",\n );\n }\n if (entryFingerprint !== receiptEntry.entryFingerprint) {\n return verification(\n adapter,\n method.id,\n input.scope,\n \"drifted\",\n [],\n \"The native entry differs from the verified receipt.\",\n );\n }\n if (entryFingerprint !== fingerprintEntry(desired.value)) {\n return verification(\n adapter,\n method.id,\n input.scope,\n \"drifted\",\n [],\n \"The verified native entry does not match the current reviewed intent.\",\n );\n }\n return verification(adapter, method.id, input.scope, \"current\", [\n makeReceiptEntry(desired.path, desired.entryId, inspected.value, content, receiptEntry),\n ]);\n } catch (error) {\n return verification(adapter, method.id, input.scope, \"blocked\", [], toMessage(error));\n }\n}\n\nfunction planHarnessAccessRemoval(\n adapter: HarnessAdapter,\n input: HarnessRemoveInput,\n): HarnessAccessPlan {\n const method = requireMethod(adapter, input.method, input.scope);\n validateExecutableIdentity(input.executable);\n assertSafeRoot(input.root);\n validateReceiptIdentity(adapter, input, input.receipt);\n const receiptEntry = input.receipt.entries[0];\n if (!receiptEntry || input.receipt.entries.length !== 1) {\n throw new Error(\"This adapter expects one exact native entry receipt.\");\n }\n assertNativePath(input.root, receiptEntry.path);\n const beforeContent = readNativeContent(input.root, receiptEntry.path);\n let change: HarnessNativeChange;\n let state: HarnessAccessPlan[\"state\"] = \"current\";\n try {\n const inspected = inspectEntry(method.nativeFormat, beforeContent, receiptEntry.value);\n if (!inspected.exists || inspected.value === null) {\n change = {\n path: receiptEntry.path,\n entryId: receiptEntry.entryId,\n action: \"none\",\n ownership: \"missing\",\n beforeFileFingerprint: fingerprintFile(beforeContent),\n afterFileFingerprint: fingerprintFile(beforeContent),\n beforeEntryValue: null,\n beforeEntryFingerprint: null,\n afterEntryFingerprint: null,\n afterEntryValue: null,\n };\n state = \"missing\";\n } else if (fingerprintEntry(inspected.value) !== receiptEntry.entryFingerprint) {\n change = blockedChange(\n { path: receiptEntry.path, entryId: receiptEntry.entryId, value: receiptEntry.value },\n beforeContent,\n fingerprintEntry(inspected.value),\n \"The native entry changed after the receipt. Preserve it and review removal manually.\",\n );\n state = \"drifted\";\n } else {\n const afterContent = removeEntry(method.nativeFormat, beforeContent, receiptEntry.value);\n change = {\n path: receiptEntry.path,\n entryId: receiptEntry.entryId,\n action: \"remove\",\n ownership: \"make-docs-owned\",\n beforeFileFingerprint: fingerprintFile(beforeContent),\n afterFileFingerprint: fingerprintFile(afterContent),\n beforeEntryValue: inspected.value,\n beforeEntryFingerprint: receiptEntry.entryFingerprint,\n afterEntryFingerprint: null,\n afterEntryValue: null,\n };\n }\n } catch (error) {\n change = blockedChange(\n { path: receiptEntry.path, entryId: receiptEntry.entryId, value: receiptEntry.value },\n beforeContent,\n null,\n toMessage(error),\n );\n state = \"blocked\";\n }\n\n return sealPlan({\n schemaVersion: 1,\n kind: \"remove\",\n adapterId: adapter.id,\n adapterVersion: adapter.version,\n harnessId: adapter.harnessId,\n connectionMethod: method.id,\n scope: input.scope,\n root: path.normalize(input.root),\n executable: input.executable,\n state,\n changes: [change],\n reviewFingerprint: \"\",\n nextAction:\n change.blockedReason ??\n (change.action === \"none\"\n ? \"The exact Make Docs entry is already absent.\"\n : \"Review and approve removal of this exact Make Docs-owned entry.\"),\n });\n}\n\nfunction applyHarnessRemovalPlan(\n adapter: HarnessAdapter,\n plan: HarnessAccessPlan,\n approved: boolean,\n): HarnessRemovalResult {\n assertPlanForAdapter(adapter, plan, \"remove\");\n assertReviewFingerprint(plan);\n if (!approved) throw new Error(\"Harness access removal needs explicit approval.\");\n if (plan.state === \"blocked\" || plan.state === \"drifted\" || plan.state === \"unsupported\") {\n throw new Error(`Harness access cannot be removed while its state is ${plan.state}.`);\n }\n const changedPaths: string[] = [];\n for (const change of plan.changes) {\n if (change.action === \"none\") continue;\n const liveContent = readNativeContent(plan.root, change.path);\n if (fingerprintFile(liveContent) === change.afterFileFingerprint) continue;\n if (fingerprintFile(liveContent) !== change.beforeFileFingerprint) {\n throw new Error(`Native configuration changed after removal review: ${change.path}.`);\n }\n if (change.beforeEntryValue === null) {\n throw new Error(`The reviewed removal has no exact native entry for ${change.path}.`);\n }\n const method = requireMethod(adapter, plan.connectionMethod, plan.scope);\n const afterContent = removeEntry(method.nativeFormat, liveContent, change.beforeEntryValue);\n if (fingerprintFile(afterContent) !== change.afterFileFingerprint) {\n throw new Error(`The live native file cannot reproduce the reviewed removal: ${change.path}.`);\n }\n writeNativeContent(\n plan.root,\n change.path,\n afterContent,\n change.beforeFileFingerprint,\n );\n changedPaths.push(change.path);\n }\n const removalVerification = verifyRemovalPlan(adapter, plan);\n if (removalVerification.state !== \"missing\") {\n throw new Error(removalVerification.reason ?? \"The native harness removal did not verify.\");\n }\n return { changedPaths, verification: removalVerification };\n}\n\nfunction verifyRemovalPlan(\n adapter: HarnessAdapter,\n plan: HarnessAccessPlan,\n): HarnessVerificationResult {\n const method = requireMethod(adapter, plan.connectionMethod, plan.scope);\n try {\n for (const change of plan.changes) {\n if (change.beforeEntryValue === null) continue;\n const content = readNativeContent(plan.root, change.path);\n const inspected = inspectEntry(method.nativeFormat, content, change.beforeEntryValue);\n if (inspected.exists) {\n return verification(\n adapter,\n plan.connectionMethod,\n plan.scope,\n \"drifted\",\n [],\n `The exact Make Docs-owned native entry remains after removal: ${change.path}.`,\n );\n }\n }\n return verification(\n adapter,\n plan.connectionMethod,\n plan.scope,\n \"missing\",\n [],\n \"The exact Make Docs-owned native entry is absent.\",\n );\n } catch (error) {\n return verification(adapter, plan.connectionMethod, plan.scope, \"blocked\", [], toMessage(error));\n }\n}\n\nfunction desiredEntry(\n adapter: HarnessAdapter,\n method: HarnessMethodDefinition,\n scope: HarnessScope,\n root: string,\n executable: VerifiedExecutableIdentity,\n commandRules: readonly HarnessCommandRule[] | undefined,\n commandRuleAuthority: HarnessCommandRuleAuthority | undefined,\n): DesiredEntry {\n const nativePath = method.nativeFile(scope);\n const callerIdentity = makeHarnessCallerIdentity(adapter, method.id, root, executable);\n const encodedCallerIdentity = encodeHarnessCallerIdentity(callerIdentity);\n switch (method.nativeFormat) {\n case \"codex-mcp-toml\": {\n const command = tomlString(executable.path);\n const value = [\n CODEX_MCP_BEGIN,\n \"[mcp_servers.make_docs]\",\n `command = ${command}`,\n `args = [${tomlString(\"mcp\")}]`,\n \"[mcp_servers.make_docs.env]\",\n `${HARNESS_CALLER_IDENTITY_ENV} = ${tomlString(encodedCallerIdentity)}`,\n CODEX_MCP_END,\n ].join(\"\\n\");\n return { path: nativePath, entryId: \"mcp_servers.make_docs\", value };\n }\n case \"claude-mcp-json\":\n return {\n path: nativePath,\n entryId: \"mcpServers.make-docs\",\n value: {\n command: executable.path,\n args: [\"mcp\"],\n env: { [HARNESS_CALLER_IDENTITY_ENV]: encodedCallerIdentity },\n },\n };\n case \"codex-command-rules\": {\n if (/\\s/.test(executable.path)) {\n throw new Error(\"Codex command rules need an executable path with no whitespace.\");\n }\n const rules = validateHarnessCommandRules(commandRules, commandRuleAuthority);\n const launchPrefix = codexRuleLaunchPrefix(\n encodeHarnessCallerIdentityArgument(callerIdentity),\n executable.path,\n );\n const lines = [\n \"# Managed by Make Docs. Review through make-docs setup.\",\n ...[...rules]\n .sort((left, right) => left.id.localeCompare(right.id))\n .map(rule =>\n `prefix_rule(pattern = [${[...launchPrefix, ...rule.commandPrefix]\n .map(word => JSON.stringify(word))\n .join(\", \")}], decision = \"allow\")`,\n ),\n \"\",\n ];\n return { path: nativePath, entryId: \"make-docs.command-rules\", value: lines.join(\"\\n\") };\n }\n case \"claude-permission-json\": {\n if (/\\s/.test(executable.path)) {\n throw new Error(\"Claude Code permission rules need an executable path with no whitespace.\");\n }\n const rules = validateHarnessCommandRules(commandRules, commandRuleAuthority);\n const launchPrefix = claudePermissionRuleLaunchPrefix(\n encodeHarnessCallerReference(callerIdentity),\n executable.path,\n );\n const values = [...rules]\n .sort((left, right) => left.id.localeCompare(right.id))\n .map(rule => `Bash(${[...launchPrefix, ...rule.commandPrefix].join(\" \")}:*)`)\n .sort();\n return { path: nativePath, entryId: \"permissions.allow.make-docs\", value: values };\n }\n }\n}\n\nfunction codexRuleLaunchPrefix(\n encodedCallerIdentity: string,\n executablePath: string,\n): readonly string[] {\n return Object.freeze([\n executablePath,\n HARNESS_CALLER_IDENTITY_ARG,\n encodedCallerIdentity,\n ]);\n}\n\nfunction claudePermissionRuleLaunchPrefix(\n callerReference: string,\n executablePath: string,\n): readonly string[] {\n return Object.freeze([\n executablePath,\n HARNESS_CALLER_REFERENCE_ARG,\n callerReference,\n ]);\n}\n\nfunction makeHarnessCallerIdentity(\n adapter: HarnessAdapter,\n connectionMethod: HarnessConnectionMethod,\n root: string,\n executable: VerifiedExecutableIdentity,\n): HarnessCallerIdentity {\n return {\n schemaVersion: 1,\n kind: \"make-docs-harness-caller\",\n adapterId: adapter.id,\n adapterVersion: adapter.version,\n harnessId: adapter.harnessId,\n connectionMethod,\n scope: \"machine\",\n root: platform.describePath(root).canonicalPath,\n executable: { ...executable },\n };\n}\n\nfunction planClaudePermissionChange(\n desired: DesiredEntry,\n content: string | null,\n receiptEntry: HarnessReceiptEntry | undefined,\n): { change: HarnessNativeChange; state: HarnessAccessPlan[\"state\"] } {\n try {\n const desiredInspected = inspectEntry(\"claude-permission-json\", content, desired.value);\n const desiredFingerprint = fingerprintEntry(desired.value);\n const receiptValues = receiptEntry\n ? requireClaudePermissionRuleArray(receiptEntry.value, \"receipt\")\n : [];\n if (receiptValues.some(value => !isMakeDocsClaudePermissionRule(value))) {\n throw new Error(\"The receipt contains a permission rule that Make Docs cannot prove it owns.\");\n }\n const receiptSet = new Set(receiptValues);\n const unowned = listMakeDocsClaudePermissionRules(content)\n .filter(value => !receiptSet.has(value));\n if (unowned.length > 0) {\n return {\n change: blockedChange(\n desired,\n content,\n desiredInspected.value === null ? null : fingerprintEntry(desiredInspected.value),\n \"A Make Docs-shaped Claude permission rule has no exact ownership receipt.\",\n ),\n state: \"blocked\",\n };\n }\n\n const desiredIsComplete = desiredInspected.exists &&\n desiredInspected.value !== null &&\n fingerprintEntry(desiredInspected.value) === desiredFingerprint;\n if (desiredIsComplete) {\n if (!receiptEntry) {\n return {\n change: blockedChange(\n desired,\n content,\n desiredFingerprint,\n \"The matching native entry has no exact Make Docs ownership receipt.\",\n ),\n state: \"blocked\",\n };\n }\n if (receiptEntry.entryFingerprint !== desiredFingerprint) {\n return {\n change: blockedChange(\n desired,\n content,\n desiredFingerprint,\n \"The Claude permission rules do not match the exact rules in the ownership receipt.\",\n ),\n state: \"drifted\",\n };\n }\n return {\n change: {\n path: desired.path,\n entryId: desired.entryId,\n action: \"none\",\n ownership: \"make-docs-owned\",\n beforeFileFingerprint: fingerprintFile(content),\n afterFileFingerprint: fingerprintFile(content),\n beforeEntryValue: desiredInspected.value,\n beforeEntryFingerprint: desiredFingerprint,\n afterEntryFingerprint: desiredFingerprint,\n afterEntryValue: desired.value,\n },\n state: \"current\",\n };\n }\n\n if (receiptEntry) {\n const ownedInspected = inspectEntry(\"claude-permission-json\", content, receiptEntry.value);\n const ownedFingerprint = ownedInspected.value === null\n ? null\n : fingerprintEntry(ownedInspected.value);\n if (!ownedInspected.exists || ownedFingerprint !== receiptEntry.entryFingerprint) {\n return {\n change: blockedChange(\n desired,\n content,\n ownedFingerprint,\n \"The receipt-owned Claude permission rules are missing, changed, or incomplete.\",\n ),\n state: \"drifted\",\n };\n }\n const afterContent = applyEntry(\n \"claude-permission-json\",\n content,\n desired.value,\n receiptEntry.value,\n );\n return {\n change: {\n path: desired.path,\n entryId: desired.entryId,\n action: \"update\",\n ownership: \"make-docs-owned\",\n beforeFileFingerprint: fingerprintFile(content),\n afterFileFingerprint: fingerprintFile(afterContent),\n beforeEntryValue: ownedInspected.value,\n beforeEntryFingerprint: ownedFingerprint,\n afterEntryFingerprint: desiredFingerprint,\n afterEntryValue: desired.value,\n },\n state: \"drifted\",\n };\n }\n\n if (desiredInspected.exists) {\n return {\n change: blockedChange(\n desired,\n content,\n desiredInspected.value === null ? null : fingerprintEntry(desiredInspected.value),\n \"The partial Make Docs Claude permission entry has no exact ownership receipt.\",\n ),\n state: \"blocked\",\n };\n }\n const afterContent = applyEntry(\"claude-permission-json\", content, desired.value);\n return {\n change: {\n path: desired.path,\n entryId: desired.entryId,\n action: content === null ? \"create\" : \"update\",\n ownership: \"missing\",\n beforeFileFingerprint: fingerprintFile(content),\n afterFileFingerprint: fingerprintFile(afterContent),\n beforeEntryValue: null,\n beforeEntryFingerprint: null,\n afterEntryFingerprint: desiredFingerprint,\n afterEntryValue: desired.value,\n },\n state: \"missing\",\n };\n } catch (error) {\n return {\n change: blockedChange(desired, content, null, toMessage(error)),\n state: \"blocked\",\n };\n }\n}\n\nfunction requireClaudePermissionRuleArray(\n value: NativeEntryValue,\n source: \"receipt\" | \"reviewed\",\n): string[] {\n if (!Array.isArray(value) || value.some(entry => typeof entry !== \"string\")) {\n throw new Error(`The ${source} Claude permission entry is malformed.`);\n }\n return value as string[];\n}\n\nfunction listMakeDocsClaudePermissionRules(content: string | null): string[] {\n if (content === null) return [];\n const root = parseJsonObject(content);\n if (root.permissions === undefined) return [];\n if (!isRecord(root.permissions)) throw new Error(\"The native permissions value is not an object.\");\n const allow = root.permissions.allow;\n if (allow === undefined) return [];\n if (!Array.isArray(allow) || allow.some(value => typeof value !== \"string\")) {\n throw new Error(\"The native permissions.allow value is not a string array.\");\n }\n return (allow as string[]).filter(isMakeDocsClaudePermissionRule);\n}\n\nfunction isMakeDocsClaudePermissionRule(value: string): boolean {\n return value.startsWith(`Bash(/usr/bin/env ${HARNESS_CALLER_IDENTITY_ENV}=`) ||\n value.includes(` ${HARNESS_CALLER_REFERENCE_ARG} `);\n}\n\nfunction inspectEntry(\n format: HarnessNativeFormat,\n content: string | null,\n expectedValue: NativeEntryValue,\n): InspectedEntry {\n if (content === null) return { exists: false, value: null };\n switch (format) {\n case \"codex-mcp-toml\": {\n const block = locateCodexMcpBlock(content);\n if (!block && /\\[\\s*mcp_servers\\.make_docs\\s*\\]/.test(content)) {\n throw new Error(\"A user-owned Codex MCP entry already uses mcp_servers.make_docs.\");\n }\n return block ? { exists: true, value: block.content } : { exists: false, value: null };\n }\n case \"codex-command-rules\":\n return { exists: content.length > 0, value: content.length > 0 ? content : null };\n case \"claude-mcp-json\": {\n const root = parseJsonObject(content);\n const servers = root.mcpServers;\n if (servers === undefined) return { exists: false, value: null };\n if (!isRecord(servers)) throw new Error(\"The native mcpServers value is not an object.\");\n return Object.hasOwn(servers, \"make-docs\")\n ? { exists: true, value: asNativeValue(servers[\"make-docs\"]) }\n : { exists: false, value: null };\n }\n case \"claude-permission-json\": {\n const root = parseJsonObject(content);\n const permissions = root.permissions;\n if (permissions === undefined) return { exists: false, value: null };\n if (!isRecord(permissions)) throw new Error(\"The native permissions value is not an object.\");\n const allow = permissions.allow;\n if (allow === undefined) return { exists: false, value: null };\n if (!Array.isArray(allow) || allow.some(value => typeof value !== \"string\")) {\n throw new Error(\"The native permissions.allow value is not a string array.\");\n }\n if (!Array.isArray(expectedValue) || expectedValue.some(value => typeof value !== \"string\")) {\n throw new Error(\"The reviewed Make Docs permission entry is malformed.\");\n }\n const expected = new Set(expectedValue as string[]);\n const present = (allow as string[]).filter(value => expected.has(value)).sort();\n return present.length > 0 ? { exists: true, value: present } : { exists: false, value: null };\n }\n }\n}\n\nfunction applyEntry(\n format: HarnessNativeFormat,\n content: string | null,\n value: NativeEntryValue,\n priorOwnedValue?: NativeEntryValue | null,\n): string {\n switch (format) {\n case \"codex-mcp-toml\": {\n if (typeof value !== \"string\") throw new Error(\"The Codex MCP entry is malformed.\");\n const source = content ?? \"\";\n const block = locateCodexMcpBlock(source);\n if (block) return source.slice(0, block.start) + value + source.slice(block.end);\n return source.trimEnd() ? `${source.trimEnd()}\\n\\n${value}\\n` : `${value}\\n`;\n }\n case \"codex-command-rules\":\n if (typeof value !== \"string\") throw new Error(\"The Codex command-rule entry is malformed.\");\n return value;\n case \"claude-mcp-json\": {\n const root = content === null ? {} : parseJsonObject(content);\n const servers = root.mcpServers === undefined ? {} : root.mcpServers;\n if (!isRecord(servers)) throw new Error(\"The native mcpServers value is not an object.\");\n root.mcpServers = { ...servers, \"make-docs\": value };\n return `${JSON.stringify(root, null, 2)}\\n`;\n }\n case \"claude-permission-json\": {\n const desired = requireClaudePermissionRuleArray(value, \"reviewed\");\n const root = content === null ? {} : parseJsonObject(content);\n const permissions = root.permissions === undefined ? {} : root.permissions;\n if (!isRecord(permissions)) throw new Error(\"The native permissions value is not an object.\");\n const allow = permissions.allow === undefined ? [] : permissions.allow;\n if (!Array.isArray(allow) || allow.some(entry => typeof entry !== \"string\")) {\n throw new Error(\"The native permissions.allow value is not a string array.\");\n }\n const remove = priorOwnedValue === undefined || priorOwnedValue === null\n ? new Set<string>()\n : new Set(requireClaudePermissionRuleArray(priorOwnedValue, \"receipt\"));\n const preserved = (allow as string[]).filter(entry => !remove.has(entry));\n const merged = [...new Set([...preserved, ...desired])];\n root.permissions = { ...permissions, allow: merged };\n return `${JSON.stringify(root, null, 2)}\\n`;\n }\n }\n}\n\nfunction removeEntry(\n format: HarnessNativeFormat,\n content: string | null,\n receiptValue: NativeEntryValue,\n): string | null {\n if (content === null) return null;\n switch (format) {\n case \"codex-mcp-toml\": {\n const block = locateCodexMcpBlock(content);\n if (!block) return content;\n const remaining = `${content.slice(0, block.start)}${content.slice(block.end)}`\n .replace(/\\n{3,}/g, \"\\n\\n\")\n .trim();\n return remaining ? `${remaining}\\n` : null;\n }\n case \"codex-command-rules\":\n return null;\n case \"claude-mcp-json\": {\n const root = parseJsonObject(content);\n if (!isRecord(root.mcpServers)) throw new Error(\"The native mcpServers value is not an object.\");\n const servers = { ...root.mcpServers };\n delete servers[\"make-docs\"];\n root.mcpServers = servers;\n return `${JSON.stringify(root, null, 2)}\\n`;\n }\n case \"claude-permission-json\": {\n if (!Array.isArray(receiptValue) || receiptValue.some(entry => typeof entry !== \"string\")) {\n throw new Error(\"The receipt permission entry is malformed.\");\n }\n const root = parseJsonObject(content);\n if (!isRecord(root.permissions)) throw new Error(\"The native permissions value is not an object.\");\n const permissions = { ...root.permissions };\n if (!Array.isArray(permissions.allow) || permissions.allow.some(entry => typeof entry !== \"string\")) {\n throw new Error(\"The native permissions.allow value is not a string array.\");\n }\n const remove = new Set(receiptValue as string[]);\n permissions.allow = (permissions.allow as string[]).filter(entry => !remove.has(entry));\n root.permissions = permissions;\n return `${JSON.stringify(root, null, 2)}\\n`;\n }\n }\n}\n\nfunction locateCodexMcpBlock(content: string): LocatedManagedBlock | null {\n if (content.includes(\"\\0\")) throw new Error(\"The Codex configuration contains a null byte.\");\n if (/^(<{7}|={7}|>{7})/m.test(content)) {\n throw new Error(\"The Codex configuration contains unresolved conflict markers.\");\n }\n validateCodexTomlContainer(content);\n const begins = indexesOf(content, CODEX_MCP_BEGIN);\n const ends = indexesOf(content, CODEX_MCP_END);\n if (begins.length !== ends.length || begins.length > 1) {\n throw new Error(\"The Codex Make Docs managed block markers are malformed.\");\n }\n if (begins.length === 0) return null;\n if (ends[0] < begins[0]) throw new Error(\"The Codex Make Docs managed block markers are reversed.\");\n const lineEnd = content.indexOf(\"\\n\", ends[0] + CODEX_MCP_END.length);\n const end = lineEnd === -1 ? content.length : lineEnd + 1;\n return { start: begins[0], end, content: content.slice(begins[0], ends[0] + CODEX_MCP_END.length) };\n}\n\ntype TomlTableDeclaration =\n | \"root\"\n | \"implicit-header\"\n | \"implicit-assignment\"\n | \"explicit\";\n\ninterface TomlTableNode {\n kind: \"table\";\n declaration: TomlTableDeclaration;\n entries: Map<string, TomlContainerNode>;\n}\n\ninterface TomlArrayTableNode {\n kind: \"array-table\";\n elements: TomlTableNode[];\n}\n\ninterface TomlValueNode {\n kind: \"value\";\n}\n\ntype TomlContainerNode = TomlTableNode | TomlArrayTableNode | TomlValueNode;\n\nconst TOML_VALUE_NODE: TomlValueNode = Object.freeze({ kind: \"value\" });\n\nfunction tomlTable(declaration: TomlTableDeclaration): TomlTableNode {\n return { kind: \"table\", declaration, entries: new Map() };\n}\n\nfunction resolveTomlHeader(\n root: TomlTableNode,\n path: readonly string[],\n arrayTable: boolean,\n): TomlTableNode {\n let parent = root;\n for (const part of path.slice(0, -1)) {\n const existing = parent.entries.get(part);\n if (existing === undefined) {\n const implicit = tomlTable(\"implicit-header\");\n parent.entries.set(part, implicit);\n parent = implicit;\n continue;\n }\n if (existing.kind === \"table\") {\n parent = existing;\n continue;\n }\n if (existing.kind === \"array-table\") {\n const active = existing.elements.at(-1);\n if (active) {\n parent = active;\n continue;\n }\n }\n throw new Error(\"The Codex configuration has a duplicate or conflicting table header.\");\n }\n\n const leaf = path.at(-1);\n if (leaf === undefined) {\n throw new Error(\"The Codex configuration has a malformed table header.\");\n }\n const existing = parent.entries.get(leaf);\n if (arrayTable) {\n if (existing !== undefined && existing.kind !== \"array-table\") {\n throw new Error(\"The Codex configuration has a duplicate or conflicting table header.\");\n }\n const array = existing ?? { kind: \"array-table\" as const, elements: [] };\n if (existing === undefined) parent.entries.set(leaf, array);\n const element = tomlTable(\"explicit\");\n array.elements.push(element);\n return element;\n }\n\n if (existing === undefined) {\n const table = tomlTable(\"explicit\");\n parent.entries.set(leaf, table);\n return table;\n }\n if (existing.kind !== \"table\" || existing.declaration !== \"implicit-header\") {\n throw new Error(\"The Codex configuration has a duplicate or conflicting table header.\");\n }\n existing.declaration = \"explicit\";\n return existing;\n}\n\nfunction defineTomlValue(table: TomlTableNode, path: readonly string[]): void {\n let parent = table;\n for (const part of path.slice(0, -1)) {\n const existing = parent.entries.get(part);\n if (existing === undefined) {\n const implicit = tomlTable(\"implicit-assignment\");\n parent.entries.set(part, implicit);\n parent = implicit;\n continue;\n }\n if (existing.kind !== \"table\") {\n throw new Error(\"The Codex configuration has a duplicate or conflicting assignment.\");\n }\n parent = existing;\n }\n\n const leaf = path.at(-1);\n if (leaf === undefined || parent.entries.has(leaf)) {\n throw new Error(\"The Codex configuration has a duplicate or conflicting assignment.\");\n }\n parent.entries.set(leaf, TOML_VALUE_NODE);\n}\n\nfunction validateCodexTomlContainer(content: string): void {\n if (content.includes('\"\"\"') || content.includes(\"'''\")) {\n throw new Error(\"The Codex configuration contains multiline TOML that this bounded writer cannot validate.\");\n }\n const root = tomlTable(\"root\");\n let table = root;\n for (const statement of splitTomlStatements(content)) {\n if (statement.startsWith(\"[\")) {\n const arrayTable = statement.startsWith(\"[[\");\n const openLength = arrayTable ? 2 : 1;\n const close = arrayTable ? \"]]\" : \"]\";\n if (!statement.endsWith(close)) {\n throw new Error(\"The Codex configuration has a malformed table header.\");\n }\n const key = statement.slice(openLength, -openLength).trim();\n table = resolveTomlHeader(root, parseTomlKeyPath(key, \"table header\"), arrayTable);\n continue;\n }\n\n const equals = findTopLevelTomlEquals(statement);\n if (equals < 0) {\n throw new Error(\"The Codex configuration has a malformed assignment.\");\n }\n const keyPath = parseTomlKeyPath(statement.slice(0, equals).trim(), \"assignment key\");\n const valueSource = statement.slice(equals + 1).trim();\n if (!valueSource) throw new Error(\"The Codex configuration has an empty assignment value.\");\n new TomlValueSyntaxParser(valueSource).parse();\n defineTomlValue(table, keyPath);\n }\n}\n\nfunction splitTomlStatements(content: string): string[] {\n const statements: string[] = [];\n let pending = \"\";\n let collectionStack: string[] = [];\n for (const sourceLine of content.split(/\\r?\\n/)) {\n const line = stripTomlComment(sourceLine);\n if (!line.trim() && !pending) continue;\n pending += `${pending ? \"\\n\" : \"\"}${line}`;\n collectionStack = scanTomlCollections(line, collectionStack);\n if (collectionStack.includes(\"}\")) {\n throw new Error(\"The Codex configuration has a multiline inline table.\");\n }\n if (collectionStack.length === 0) {\n if (pending.trim()) statements.push(pending.trim());\n pending = \"\";\n }\n }\n if (collectionStack.length !== 0) {\n throw new Error(\"The Codex configuration has an unfinished collection value.\");\n }\n if (pending.trim()) statements.push(pending.trim());\n return statements;\n}\n\nfunction stripTomlComment(line: string): string {\n let quote: \"'\" | '\"' | null = null;\n let escaped = false;\n for (let index = 0; index < line.length; index += 1) {\n const character = line[index];\n if (quote) {\n if (escaped) {\n escaped = false;\n continue;\n }\n if (quote === '\"' && character === \"\\\\\") {\n escaped = true;\n continue;\n }\n if (character === quote) quote = null;\n if (character === \"\\n\" || character === \"\\r\") {\n throw new Error(\"The Codex configuration has an unfinished string value.\");\n }\n continue;\n }\n if (character === \"#\") return line.slice(0, index);\n if (character === \"'\" || character === '\"') {\n quote = character;\n }\n }\n if (quote) throw new Error(\"The Codex configuration has an unfinished string value.\");\n return line;\n}\n\nfunction scanTomlCollections(line: string, initial: readonly string[]): string[] {\n const stack = [...initial];\n let quote: \"'\" | '\"' | null = null;\n let escaped = false;\n for (const character of line) {\n if (quote) {\n if (escaped) {\n escaped = false;\n } else if (quote === '\"' && character === \"\\\\\") {\n escaped = true;\n } else if (character === quote) {\n quote = null;\n }\n continue;\n }\n if (character === \"'\" || character === '\"') {\n quote = character;\n continue;\n }\n if (character === \"[\" || character === \"{\") {\n stack.push(character === \"[\" ? \"]\" : \"}\");\n } else if (character === \"]\" || character === \"}\") {\n if (stack.pop() !== character) {\n throw new Error(\"The Codex configuration has unbalanced collection delimiters.\");\n }\n }\n }\n return stack;\n}\n\nfunction findTopLevelTomlEquals(source: string): number {\n let quote: \"'\" | '\"' | null = null;\n let escaped = false;\n let depth = 0;\n for (let index = 0; index < source.length; index += 1) {\n const character = source[index];\n if (quote) {\n if (escaped) escaped = false;\n else if (quote === '\"' && character === \"\\\\\") escaped = true;\n else if (character === quote) quote = null;\n continue;\n }\n if (character === \"'\" || character === '\"') quote = character;\n else if (character === \"[\" || character === \"{\") depth += 1;\n else if (character === \"]\" || character === \"}\") depth -= 1;\n else if (character === \"=\" && depth === 0) return index;\n }\n return -1;\n}\n\nfunction parseTomlKeyPath(source: string, location: string): string[] {\n const parser = new TomlKeySyntaxParser(source);\n const pathParts = parser.parse();\n if (pathParts.length === 0) {\n throw new Error(`The Codex configuration has an empty ${location}.`);\n }\n return pathParts;\n}\n\nclass TomlKeySyntaxParser {\n private index = 0;\n\n constructor(private readonly source: string) {}\n\n parse(): string[] {\n const parts: string[] = [];\n while (true) {\n this.skipWhitespace();\n parts.push(this.parsePart());\n this.skipWhitespace();\n if (this.index === this.source.length) return parts;\n if (this.source[this.index] !== \".\") {\n throw new Error(\"The Codex configuration has a malformed key.\");\n }\n this.index += 1;\n this.skipWhitespace();\n if (this.index === this.source.length) {\n throw new Error(\"The Codex configuration has an unfinished dotted key.\");\n }\n }\n }\n\n private parsePart(): string {\n const quote = this.source[this.index];\n if (quote === \"'\" || quote === '\"') {\n const start = this.index;\n this.index = consumeTomlString(this.source, this.index);\n const quoted = this.source.slice(start, this.index);\n return quote === \"'\" ? quoted.slice(1, -1) : JSON.parse(quoted) as string;\n }\n const start = this.index;\n while (/[A-Za-z0-9_-]/.test(this.source[this.index] ?? \"\")) this.index += 1;\n if (start === this.index) throw new Error(\"The Codex configuration has a malformed key.\");\n return this.source.slice(start, this.index);\n }\n\n private skipWhitespace(): void {\n while (this.source[this.index] === \" \" || this.source[this.index] === \"\\t\") this.index += 1;\n }\n}\n\nclass TomlValueSyntaxParser {\n private index = 0;\n\n constructor(private readonly source: string) {}\n\n parse(): void {\n this.skipWhitespaceAndNewlines();\n this.parseValue();\n this.skipWhitespaceAndNewlines();\n if (this.index !== this.source.length) {\n throw new Error(\"The Codex configuration has trailing text after a value.\");\n }\n }\n\n private parseValue(): void {\n const character = this.source[this.index];\n if (character === \"'\" || character === '\"') {\n this.index = consumeTomlString(this.source, this.index);\n return;\n }\n if (character === \"[\") return this.parseArray();\n if (character === \"{\") return this.parseInlineTable();\n const start = this.index;\n while (this.index < this.source.length && !/[\\s,\\]}]/.test(this.source[this.index])) {\n this.index += 1;\n }\n const token = this.source.slice(start, this.index);\n if (!isValidTomlBareValue(token)) {\n throw new Error(`The Codex configuration has an invalid TOML value: ${token || \"<empty>\"}.`);\n }\n }\n\n private parseArray(): void {\n this.index += 1;\n this.skipWhitespaceAndNewlines();\n if (this.source[this.index] === \"]\") {\n this.index += 1;\n return;\n }\n while (true) {\n this.parseValue();\n this.skipWhitespaceAndNewlines();\n if (this.source[this.index] === \"]\") {\n this.index += 1;\n return;\n }\n if (this.source[this.index] !== \",\") {\n throw new Error(\"The Codex configuration has a malformed TOML array.\");\n }\n this.index += 1;\n this.skipWhitespaceAndNewlines();\n if (this.source[this.index] === \"]\") {\n this.index += 1;\n return;\n }\n }\n }\n\n private parseInlineTable(): void {\n this.index += 1;\n this.skipInlineWhitespace();\n if (this.source[this.index] === \"}\") {\n this.index += 1;\n return;\n }\n while (true) {\n const keyStart = this.index;\n const equals = this.findInlineEquals();\n parseTomlKeyPath(this.source.slice(keyStart, equals).trim(), \"inline-table key\");\n this.index = equals + 1;\n this.skipInlineWhitespace();\n this.parseValue();\n this.skipInlineWhitespace();\n if (this.source[this.index] === \"}\") {\n this.index += 1;\n return;\n }\n if (this.source[this.index] !== \",\") {\n throw new Error(\"The Codex configuration has a malformed TOML inline table.\");\n }\n this.index += 1;\n this.skipInlineWhitespace();\n if (this.source[this.index] === \"}\") {\n throw new Error(\"The Codex configuration has a trailing inline-table comma.\");\n }\n }\n }\n\n private findInlineEquals(): number {\n let quote: \"'\" | '\"' | null = null;\n let escaped = false;\n for (let index = this.index; index < this.source.length; index += 1) {\n const character = this.source[index];\n if (quote) {\n if (escaped) escaped = false;\n else if (quote === '\"' && character === \"\\\\\") escaped = true;\n else if (character === quote) quote = null;\n continue;\n }\n if (character === \"'\" || character === '\"') quote = character;\n else if (character === \"=\") return index;\n else if (character === \",\" || character === \"}\" || character === \"\\n\") break;\n }\n throw new Error(\"The Codex configuration has a malformed TOML inline table.\");\n }\n\n private skipWhitespaceAndNewlines(): void {\n while (/\\s/.test(this.source[this.index] ?? \"\")) this.index += 1;\n }\n\n private skipInlineWhitespace(): void {\n while (this.source[this.index] === \" \" || this.source[this.index] === \"\\t\") this.index += 1;\n if (this.source[this.index] === \"\\n\" || this.source[this.index] === \"\\r\") {\n throw new Error(\"The Codex configuration has a multiline TOML inline table.\");\n }\n }\n}\n\nfunction consumeTomlString(source: string, start: number): number {\n const quote = source[start];\n let escaped = false;\n for (let index = start + 1; index < source.length; index += 1) {\n const character = source[index];\n if (character === \"\\n\" || character === \"\\r\") {\n throw new Error(\"The Codex configuration has an unfinished string value.\");\n }\n if (quote === '\"' && escaped) {\n if (!/[btnfr\"\\\\]/.test(character) && character !== \"u\" && character !== \"U\") {\n throw new Error(\"The Codex configuration has an invalid TOML string escape.\");\n }\n if (character === \"u\" || character === \"U\") {\n const length = character === \"u\" ? 4 : 8;\n const hex = source.slice(index + 1, index + 1 + length);\n if (!new RegExp(`^[0-9A-Fa-f]{${length}}$`).test(hex)) {\n throw new Error(\"The Codex configuration has an invalid TOML Unicode escape.\");\n }\n const codePoint = Number.parseInt(hex, 16);\n if (\n codePoint <= 0x08 ||\n (codePoint >= 0x0b && codePoint <= 0x1f) ||\n codePoint === 0x7f ||\n codePoint > 0x10ffff ||\n (codePoint >= 0xd800 && codePoint <= 0xdfff)\n ) {\n throw new Error(\"The Codex configuration has an invalid TOML Unicode code point.\");\n }\n index += length;\n }\n escaped = false;\n continue;\n }\n if (quote === '\"' && character === \"\\\\\") {\n escaped = true;\n continue;\n }\n if (character === quote) return index + 1;\n const codePoint = character.codePointAt(0) ?? 0;\n if (codePoint <= 0x08 || (codePoint >= 0x0b && codePoint <= 0x1f) || codePoint === 0x7f) {\n throw new Error(\"The Codex configuration has a control character in a string.\");\n }\n }\n throw new Error(\"The Codex configuration has an unfinished string value.\");\n}\n\nfunction isValidTomlBareValue(value: string): boolean {\n if (value === \"true\" || value === \"false\" || value === \"inf\" || value === \"+inf\" || value === \"-inf\") {\n return true;\n }\n if (value === \"nan\" || value === \"+nan\" || value === \"-nan\") return true;\n if (/^0x[0-9A-Fa-f](?:_?[0-9A-Fa-f])*$/.test(value)) return true;\n if (/^0o[0-7](?:_?[0-7])*$/.test(value)) return true;\n if (/^0b[01](?:_?[01])*$/.test(value)) return true;\n if (/^[+-]?(?:0|[1-9](?:_?\\d)*)$/.test(value)) return true;\n if (/^[+-]?(?:(?:0|[1-9](?:_?\\d)*)\\.\\d(?:_?\\d)*(?:[eE][+-]?\\d(?:_?\\d)*)?|(?:0|[1-9](?:_?\\d)*)[eE][+-]?\\d(?:_?\\d)*)$/.test(value)) {\n return true;\n }\n return isValidTomlDateOrTime(value);\n}\n\nfunction isValidTomlDateOrTime(value: string): boolean {\n const dateTime = /^(\\d{4})-(\\d{2})-(\\d{2})[Tt ](\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d+)?(?:[Zz]|([+-])(\\d{2}):(\\d{2}))?$/.exec(value);\n if (dateTime) {\n const [, year, month, day, hour, minute, second, , offsetHour, offsetMinute] = dateTime;\n return isValidTomlDate(year, month, day) && isValidTomlTime(hour, minute, second) &&\n (!offsetHour || (Number(offsetHour) <= 23 && Number(offsetMinute) <= 59));\n }\n const date = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value);\n if (date) return isValidTomlDate(date[1], date[2], date[3]);\n const time = /^(\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d+)?$/.exec(value);\n return Boolean(time && isValidTomlTime(time[1], time[2], time[3]));\n}\n\nfunction isValidTomlDate(year: string, month: string, day: string): boolean {\n const date = new Date(Date.UTC(Number(year), Number(month) - 1, Number(day)));\n return Number(month) >= 1 && Number(month) <= 12 && Number(day) >= 1 &&\n date.getUTCFullYear() === Number(year) &&\n date.getUTCMonth() === Number(month) - 1 &&\n date.getUTCDate() === Number(day);\n}\n\nfunction isValidTomlTime(hour: string, minute: string, second: string): boolean {\n return Number(hour) <= 23 && Number(minute) <= 59 && Number(second) <= 59;\n}\n\nfunction receiptEntryFor(\n adapter: HarnessAdapter,\n input: HarnessPlanInput,\n nativePath: string,\n entryId: string,\n): HarnessReceiptEntry | undefined {\n if (!input.receipt) return undefined;\n validateReceiptIdentity(adapter, input, input.receipt);\n if (input.receipt.entries.length !== 1) {\n throw new Error(\"This adapter expects one exact native entry receipt.\");\n }\n const entry = input.receipt.entries[0];\n if (entry.path !== nativePath || entry.entryId !== entryId) {\n throw new Error(\"The harness receipt does not identify this exact native entry.\");\n }\n return entry;\n}\n\nfunction validateReceiptIdentity(\n adapter: HarnessAdapter,\n input: Pick<HarnessPlanInput, \"method\" | \"scope\">,\n receipt: HarnessAccessReceipt,\n): void {\n if (\n (receipt.schemaVersion !== 1 && receipt.schemaVersion !== 2) ||\n receipt.adapterId !== adapter.id ||\n receipt.adapterVersion !== adapter.version ||\n receipt.harnessId !== adapter.harnessId ||\n receipt.connectionMethod !== input.method ||\n receipt.scope !== input.scope ||\n receipt.result !== \"verified\" ||\n receipt.verificationResult !== \"passed\" ||\n receipt.driftState !== \"current\" ||\n receipt.recoveryStatus !== \"complete\" ||\n !receipt.appliedVersion.trim() ||\n !Number.isFinite(Date.parse(receipt.verifiedAt)) ||\n receipt.entries.some(\n entry =>\n entry.ownership !== \"make-docs\" ||\n fingerprintEntry(entry.value) !== entry.entryFingerprint ||\n !/^[0-9a-f]{64}$/.test(entry.fileFingerprint),\n )\n ) {\n throw new Error(\"The harness receipt does not match this exact adapter, method, scope, and managed entry.\");\n }\n}\n\nfunction receiptEntriesFromPlan(plan: HarnessAccessPlan): HarnessReceiptEntry[] {\n return plan.changes.map(change => {\n if (\n change.afterEntryValue === null ||\n !change.afterEntryFingerprint ||\n !change.afterFileFingerprint\n ) {\n throw new Error(`The reviewed plan has no verifiable result for ${change.path}.`);\n }\n const live = readNativeContent(plan.root, change.path);\n if (fingerprintFile(live) !== change.afterFileFingerprint) {\n throw new Error(`The applied native file does not match the reviewed result: ${change.path}.`);\n }\n return makeReceiptEntry(change.path, change.entryId, change.afterEntryValue, live, {\n beforeEntryFingerprint: change.beforeEntryFingerprint,\n beforeFileFingerprint: change.beforeFileFingerprint,\n beforeValue: change.beforeEntryValue,\n });\n });\n}\n\nfunction verifyAgainstReceipt(\n adapter: HarnessAdapter,\n root: string,\n receipt: HarnessAccessReceipt,\n): HarnessVerificationResult {\n const method = requireMethod(adapter, receipt.connectionMethod, receipt.scope);\n const verifiedEntries: HarnessReceiptEntry[] = [];\n try {\n for (const entry of receipt.entries) {\n const content = readNativeContent(root, entry.path);\n const inspected = inspectEntry(method.nativeFormat, content, entry.value);\n if (!inspected.exists || inspected.value === null) {\n return verification(adapter, method.id, receipt.scope, \"missing\", [], \"The applied native entry is absent.\");\n }\n if (fingerprintEntry(inspected.value) !== entry.entryFingerprint) {\n return verification(adapter, method.id, receipt.scope, \"drifted\", [], \"The applied native entry differs from its receipt.\");\n }\n verifiedEntries.push(makeReceiptEntry(entry.path, entry.entryId, inspected.value, content, entry));\n }\n return verification(adapter, method.id, receipt.scope, \"current\", verifiedEntries);\n } catch (error) {\n return verification(adapter, method.id, receipt.scope, \"blocked\", [], toMessage(error));\n }\n}\n\nfunction makeReceiptEntry(\n nativePath: string,\n entryId: string,\n value: NativeEntryValue,\n content: string | null,\n previous?: Pick<\n HarnessReceiptEntry,\n \"beforeEntryFingerprint\" | \"beforeFileFingerprint\" | \"beforeValue\"\n >,\n): HarnessReceiptEntry {\n if (content === null) throw new Error(`Cannot record an absent native file: ${nativePath}.`);\n return {\n path: nativePath,\n entryId,\n ownership: \"make-docs\",\n beforeEntryFingerprint: previous?.beforeEntryFingerprint ?? null,\n beforeFileFingerprint: previous?.beforeFileFingerprint ?? null,\n beforeValue: previous?.beforeValue ?? null,\n entryFingerprint: fingerprintEntry(value),\n fileFingerprint: sha256(content),\n value,\n };\n}\n\nfunction requireMethod(\n adapter: HarnessAdapter,\n methodId: HarnessConnectionMethod,\n scope: HarnessScope,\n): HarnessMethodDefinition {\n const method = adapter.methods.find(candidate => candidate.id === methodId);\n if (!method || !method.scopes.includes(scope)) {\n throw new Error(`${adapter.displayName} does not implement ${methodId} for ${scope} scope.`);\n }\n return method;\n}\n\nfunction assertSafeRoot(root: string): void {\n if (!path.isAbsolute(root)) throw new Error(\"A harness native-configuration root must be absolute.\");\n const stat = lstatSync(root);\n if (stat.isSymbolicLink()) throw new Error(\"A harness native-configuration root must not be a symbolic link.\");\n if (!stat.isDirectory()) throw new Error(\"A harness native-configuration root must be a directory.\");\n}\n\nfunction assertNativePath(root: string, relativePath: string): void {\n if (!relativePath || path.isAbsolute(relativePath)) {\n throw new Error(`Harness native path must be relative: ${relativePath}.`);\n }\n assertManagedPathHasNoSymlinks(root, relativePath);\n}\n\nfunction readNativeContent(root: string, relativePath: string): string | null {\n assertNativePath(root, relativePath);\n const absolutePath = path.join(root, relativePath);\n const noFollow = typeof constants.O_NOFOLLOW === \"number\" ? constants.O_NOFOLLOW : 0;\n let fd: number;\n try {\n fd = openSync(absolutePath, constants.O_RDONLY | noFollow);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return null;\n if ((error as NodeJS.ErrnoException).code === \"ELOOP\") {\n throw new Error(`Harness native file is a symbolic link: ${relativePath}.`);\n }\n throw error;\n }\n let bytes: Buffer;\n try {\n const stat = fstatSync(fd);\n if (!stat.isFile()) {\n throw new Error(`Harness native path is not a regular file: ${relativePath}.`);\n }\n bytes = readFileSync(fd);\n } finally {\n closeSync(fd);\n }\n try {\n return new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes);\n } catch {\n throw new Error(`Harness native file is not valid UTF-8: ${relativePath}.`);\n }\n}\n\nfunction writeNativeContent(\n root: string,\n relativePath: string,\n content: string | null,\n expectedBeforeFingerprint: string | null,\n): void {\n assertNativePath(root, relativePath);\n const absolutePath = path.join(root, relativePath);\n if (content !== null) ensureNativeParent(root, relativePath);\n const parent = path.dirname(absolutePath);\n const guard = openParentGuard(parent);\n try {\n assertParentGuard(root, relativePath, guard);\n const liveBefore = readNativeContent(root, relativePath);\n if (fingerprintFile(liveBefore) !== expectedBeforeFingerprint) {\n throw new Error(`Native configuration changed immediately before replacement: ${relativePath}.`);\n }\n if (content === null) {\n if (liveBefore === null) return;\n const targetGuard = openTargetGuard(absolutePath, relativePath);\n try {\n prepareNativeMutationGuards(guard, targetGuard);\n harnessNativeMutationHookForTests?.({\n action: \"remove\",\n absolutePath,\n relativePath,\n });\n assertNativeMutationBoundary(root, relativePath, guard, targetGuard);\n unlinkSync(absolutePath);\n assertParentGuard(root, relativePath, guard);\n if (readNativeContent(root, relativePath) !== null) {\n throw new Error(`Harness native file still exists after removal: ${relativePath}.`);\n }\n } finally {\n closeTargetGuard(targetGuard);\n }\n return;\n }\n const temporary = path.join(\n parent,\n `.${path.basename(relativePath)}.${randomUUID()}.tmp`,\n );\n writeFileSync(temporary, content, { encoding: \"utf8\", flag: \"wx\", mode: 0o600 });\n try {\n assertParentGuard(root, relativePath, guard);\n const finalBefore = readNativeContent(root, relativePath);\n if (fingerprintFile(finalBefore) !== expectedBeforeFingerprint) {\n throw new Error(\n `Native configuration changed immediately before replacement: ${relativePath}.`,\n );\n }\n const targetGuard = openTargetGuard(absolutePath, relativePath);\n try {\n prepareNativeMutationGuards(guard, targetGuard);\n harnessNativeMutationHookForTests?.({\n action: \"replace\",\n absolutePath,\n relativePath,\n });\n assertNativeMutationBoundary(root, relativePath, guard, targetGuard);\n platform.atomicReplace(temporary, absolutePath);\n assertParentGuard(root, relativePath, guard);\n if (fingerprintFile(readNativeContent(root, relativePath)) !== fingerprintFile(content)) {\n throw new Error(`Harness native file does not match the reviewed content: ${relativePath}.`);\n }\n } finally {\n closeTargetGuard(targetGuard);\n }\n } catch (error) {\n try {\n assertParentGuard(root, relativePath, guard);\n if (existsSync(temporary)) unlinkSync(temporary);\n } catch {\n // A replaced parent is unsafe to traverse for cleanup. The temporary\n // file stays in the original reviewed directory for manual recovery.\n }\n throw error;\n }\n } finally {\n if (guard.fd !== null) closeSync(guard.fd);\n }\n}\n\ninterface ParentGuard {\n fd: number | null;\n path: string;\n guard: FileMutationGuard;\n objectIdentity: NativeObjectIdentity;\n}\n\ntype TargetGuard =\n | { exists: false }\n | {\n exists: true;\n fd: number | null;\n guard: FileMutationGuard;\n objectIdentity: NativeObjectIdentity;\n };\n\ninterface NativeObjectIdentity {\n device: bigint;\n inode: bigint;\n mode: bigint;\n size: bigint;\n birthtimeNs: bigint;\n ctimeNs: bigint;\n}\n\nfunction captureNativeObjectIdentity(stats: BigIntStats): NativeObjectIdentity {\n return {\n device: stats.dev,\n inode: stats.ino,\n mode: stats.mode,\n size: stats.size,\n birthtimeNs: stats.birthtimeNs,\n ctimeNs: stats.ctimeNs,\n };\n}\n\nfunction matchesNativeObjectIdentity(\n stats: BigIntStats,\n identity: NativeObjectIdentity,\n): boolean {\n if (identity.device !== 0n || identity.inode !== 0n) {\n return stats.dev === identity.device && stats.ino === identity.inode;\n }\n const stableBirth = identity.birthtimeNs > 0n && stats.birthtimeNs > 0n;\n return stats.mode === identity.mode && stats.size === identity.size &&\n (stableBirth ? stats.birthtimeNs === identity.birthtimeNs : stats.ctimeNs === identity.ctimeNs);\n}\n\nfunction ensureNativeParent(root: string, relativePath: string): void {\n const parentRelative = path.dirname(relativePath);\n if (parentRelative === \".\") return;\n let current = root;\n for (const segment of path.normalize(parentRelative).split(path.sep).filter(Boolean)) {\n current = path.join(current, segment);\n try {\n mkdirSync(current, { mode: 0o700 });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"EEXIST\") throw error;\n }\n assertManagedPathHasNoSymlinks(root, path.relative(root, current));\n const stat = lstatSync(current);\n if (!stat.isDirectory()) {\n throw new Error(`Harness native parent is not a directory: ${path.relative(root, current)}.`);\n }\n }\n}\n\nfunction openParentGuard(parent: string): ParentGuard {\n const noFollow = typeof constants.O_NOFOLLOW === \"number\" ? constants.O_NOFOLLOW : 0;\n const directory = typeof constants.O_DIRECTORY === \"number\" ? constants.O_DIRECTORY : 0;\n const fd = openSync(parent, constants.O_RDONLY | noFollow | directory);\n const stat = fstatSync(fd);\n if (!stat.isDirectory()) {\n closeSync(fd);\n throw new Error(\"Harness native parent is not a directory.\");\n }\n return {\n fd,\n path: parent,\n guard: platform.captureFileGuard(stat, \"directory\"),\n objectIdentity: captureNativeObjectIdentity(fstatSync(fd, { bigint: true })),\n };\n}\n\nfunction assertParentGuard(root: string, relativePath: string, guard: ParentGuard): void {\n assertNativePath(root, relativePath);\n const descriptor = guard.fd === null ? null : fstatSync(guard.fd);\n const descriptorIdentity = guard.fd === null ? null : fstatSync(guard.fd, { bigint: true });\n const live = lstatSync(guard.path);\n const liveIdentity = lstatSync(guard.path, { bigint: true });\n if (\n live.isSymbolicLink() ||\n !live.isDirectory() ||\n !platform.matchesFileGuard(live, guard.guard) ||\n !matchesNativeObjectIdentity(liveIdentity, guard.objectIdentity) ||\n (descriptorIdentity !== null &&\n !matchesNativeObjectIdentity(descriptorIdentity, guard.objectIdentity)) ||\n (descriptor !== null && !platform.matchesFileGuard(descriptor, guard.guard))\n ) {\n throw new Error(`Harness native parent changed after review: ${relativePath}.`);\n }\n}\n\nfunction openTargetGuard(absolutePath: string, relativePath: string): TargetGuard {\n const noFollow = typeof constants.O_NOFOLLOW === \"number\" ? constants.O_NOFOLLOW : 0;\n let fd: number;\n try {\n fd = openSync(absolutePath, constants.O_RDONLY | noFollow);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return { exists: false };\n if ((error as NodeJS.ErrnoException).code === \"ELOOP\") {\n throw new Error(`Harness native file is a symbolic link: ${relativePath}.`);\n }\n throw error;\n }\n try {\n const descriptor = fstatSync(fd);\n const live = lstatSync(absolutePath);\n if (\n !descriptor.isFile() ||\n live.isSymbolicLink() ||\n !live.isFile() ||\n !platform.sameFileObject(descriptor, live, \"file\")\n ) {\n throw new Error(`Harness native target changed after review: ${relativePath}.`);\n }\n return {\n exists: true,\n fd,\n guard: platform.captureFileGuard(descriptor, \"file\"),\n objectIdentity: captureNativeObjectIdentity(fstatSync(fd, { bigint: true })),\n };\n } catch (error) {\n closeSync(fd);\n throw error;\n }\n}\n\nfunction closeTargetGuard(guard: TargetGuard): void {\n if (guard.exists && guard.fd !== null) {\n closeSync(guard.fd);\n guard.fd = null;\n }\n}\n\nfunction prepareNativeMutationGuards(parentGuard: ParentGuard, targetGuard: TargetGuard): void {\n if (platform.canMutateOpenPaths) return;\n closeTargetGuard(targetGuard);\n if (parentGuard.fd !== null) {\n closeSync(parentGuard.fd);\n parentGuard.fd = null;\n }\n}\n\nfunction assertNativeMutationBoundary(\n root: string,\n relativePath: string,\n parentGuard: ParentGuard,\n targetGuard: TargetGuard,\n): void {\n // Keep this check next to rename/unlink. Node does not expose renameat or\n // unlinkat, so the open descriptors prove that both reviewed path objects\n // still name the same directory and target at the last available boundary.\n assertParentGuard(root, relativePath, parentGuard);\n const absolutePath = path.join(root, relativePath);\n if (!targetGuard.exists) {\n try {\n lstatSync(absolutePath);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return;\n throw error;\n }\n throw new Error(`Harness native target changed after review: ${relativePath}.`);\n }\n const descriptor = targetGuard.fd === null ? null : fstatSync(targetGuard.fd);\n const descriptorIdentity = targetGuard.fd === null\n ? null\n : fstatSync(targetGuard.fd, { bigint: true });\n let live: ReturnType<typeof lstatSync>;\n let liveIdentity: BigIntStats;\n try {\n live = lstatSync(absolutePath);\n liveIdentity = lstatSync(absolutePath, { bigint: true });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n throw new Error(`Harness native target changed after review: ${relativePath}.`);\n }\n throw error;\n }\n if (\n (descriptor !== null && (!descriptor.isFile() || !platform.matchesFileGuard(descriptor, targetGuard.guard))) ||\n (descriptorIdentity !== null &&\n !matchesNativeObjectIdentity(descriptorIdentity, targetGuard.objectIdentity)) ||\n live.isSymbolicLink() ||\n !live.isFile() ||\n !platform.matchesFileGuard(live, targetGuard.guard) ||\n !matchesNativeObjectIdentity(liveIdentity, targetGuard.objectIdentity)\n ) {\n throw new Error(`Harness native target changed after review: ${relativePath}.`);\n }\n}\n\nfunction blockedChange(\n desired: DesiredEntry,\n beforeContent: string | null,\n beforeEntryFingerprint: string | null,\n reason: string,\n): HarnessNativeChange {\n return {\n path: desired.path,\n entryId: desired.entryId,\n action: \"none\",\n ownership: \"unverified\",\n beforeFileFingerprint: fingerprintFile(beforeContent),\n afterFileFingerprint: fingerprintFile(beforeContent),\n beforeEntryValue: null,\n beforeEntryFingerprint,\n afterEntryFingerprint: null,\n afterEntryValue: null,\n blockedReason: reason,\n };\n}\n\nfunction verification(\n adapter: HarnessAdapter,\n connectionMethod: HarnessConnectionMethod,\n scope: HarnessScope,\n state: HarnessVerificationResult[\"state\"],\n entries: readonly HarnessReceiptEntry[],\n reason?: string,\n): HarnessVerificationResult {\n return {\n adapterId: adapter.id,\n adapterVersion: adapter.version,\n harnessId: adapter.harnessId,\n connectionMethod,\n scope,\n state,\n entries,\n ...(reason ? { reason } : {}),\n };\n}\n\nfunction sealPlan(plan: HarnessAccessPlan): HarnessAccessPlan {\n const reviewFingerprint = planFingerprint(plan);\n return { ...plan, reviewFingerprint };\n}\n\nfunction planFingerprint(plan: HarnessAccessPlan): string {\n const { reviewFingerprint: _ignored, ...reviewed } = plan;\n return sha256(JSON.stringify(reviewed));\n}\n\nfunction assertReviewFingerprint(plan: HarnessAccessPlan): void {\n if (plan.reviewFingerprint !== planFingerprint(plan)) {\n throw new Error(\"The harness access plan changed after review.\");\n }\n}\n\nfunction assertPlanForAdapter(\n adapter: HarnessAdapter,\n plan: HarnessAccessPlan,\n kind: HarnessAccessPlan[\"kind\"],\n): void {\n if (\n plan.schemaVersion !== 1 ||\n plan.kind !== kind ||\n plan.adapterId !== adapter.id ||\n plan.adapterVersion !== adapter.version ||\n plan.harnessId !== adapter.harnessId\n ) {\n throw new Error(\"The harness access plan does not belong to this adapter and action.\");\n }\n assertSafeRoot(plan.root);\n}\n\nfunction validateExecutableIdentity(executable: VerifiedExecutableIdentity): void {\n if (\n executable.kind !== \"make-docs\" ||\n !path.isAbsolute(executable.path) ||\n !/^[0-9a-f]{64}$/.test(executable.sha256) ||\n !Number.isSafeInteger(executable.size) ||\n executable.size < 1 ||\n executable.productMarker !== \"@brucewaynedecoy/make-docs:package-bin\" ||\n executable.packageName !== \"@brucewaynedecoy/make-docs\" ||\n !executable.packageVersion.trim() ||\n !path.isAbsolute(executable.packageRoot) ||\n !executable.binRelativePath\n ) {\n throw new Error(\"The adapter needs a verified Make Docs executable identity.\");\n }\n const stat = lstatSync(executable.path);\n if (stat.isSymbolicLink() || !stat.isFile()) {\n throw new Error(\"The verified Make Docs executable is no longer a regular file.\");\n }\n const bytes = readFileSync(executable.path);\n if (bytes.byteLength !== executable.size || sha256(bytes) !== executable.sha256) {\n throw new Error(\"The verified Make Docs executable changed after verification.\");\n }\n const verified = reverifyMakeDocsExecutableIdentity(executable);\n if (\n verified.productMarker !== executable.productMarker ||\n verified.packageName !== executable.packageName ||\n verified.packageVersion !== executable.packageVersion ||\n verified.packageRoot !== executable.packageRoot ||\n verified.binRelativePath !== executable.binRelativePath\n ) {\n throw new Error(\"The verified Make Docs package identity changed after verification.\");\n }\n}\n\nfunction parseJsonObject(content: string): Record<string, unknown> {\n let value: unknown;\n try {\n value = JSON.parse(content);\n } catch (error) {\n throw new Error(`The native JSON file is malformed: ${toMessage(error)}`);\n }\n if (!isRecord(value)) throw new Error(\"The native JSON root is not an object.\");\n return value;\n}\n\nfunction asNativeValue(value: unknown): NativeEntryValue {\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n ) return value;\n if (Array.isArray(value)) return value.map(asNativeValue);\n if (isRecord(value)) {\n return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, asNativeValue(child)]));\n }\n throw new Error(\"The native entry contains a value that JSON cannot preserve.\");\n}\n\nfunction isRecord(value: unknown): value is Record<string, any> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction fingerprintFile(content: string | null): string | null {\n return content === null ? null : sha256(content);\n}\n\nfunction indexesOf(content: string, token: string): number[] {\n const indexes: number[] = [];\n let offset = 0;\n while (offset < content.length) {\n const index = content.indexOf(token, offset);\n if (index === -1) break;\n indexes.push(index);\n offset = index + token.length;\n }\n return indexes;\n}\n\nfunction tomlString(value: string): string {\n return JSON.stringify(value);\n}\n\nfunction toMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n","import type {\n HarnessAdapter,\n HarnessConnectionMethod,\n HarnessMethodSelection,\n HarnessMethodDefinition,\n HarnessScope,\n} from \"./contract\";\nimport { createHarnessAdapter } from \"./native\";\n\nfunction method(\n id: HarnessConnectionMethod,\n nativeFormat: HarnessMethodDefinition[\"nativeFormat\"],\n nativeFile: (scope: HarnessScope) => string,\n options: {\n ownedEntry: string;\n requiresCommandRules?: boolean;\n availability?: HarnessMethodDefinition[\"availability\"];\n blocker?: string | null;\n nextAction?: string;\n },\n): HarnessMethodDefinition {\n return Object.freeze({\n id,\n scopes: Object.freeze([\"machine\", \"project\"] as const),\n nativeFormat,\n requiresExecutable: true,\n requiresCommandRules: options.requiresCommandRules ?? false,\n nativeFile,\n ownedEntries: Object.freeze([options.ownedEntry]),\n allowedStoreOperations: options.requiresCommandRules\n ? \"bounded-command-rule-registry\"\n : \"active-operation-registry\",\n implementationState: \"implemented\",\n availability: options.availability ?? \"available\",\n blocker: options.blocker ?? null,\n nextAction: options.nextAction ?? \"Review this method, then apply the grouped setup plan\",\n });\n}\n\nexport const CODEX_HARNESS_ADAPTER = createHarnessAdapter({\n id: \"make-docs.codex\",\n version: 1,\n harnessId: \"codex\",\n displayName: \"Codex\",\n executableNames: Object.freeze([\"codex\"]),\n projectRouterFiles: Object.freeze([\"AGENTS.md\"]),\n skillRoots: Object.freeze([\".agents/skills\", \".codex/skills\"]),\n methods: Object.freeze([\n method(\"mcp\", \"codex-mcp-toml\", () => \".codex/config.toml\", {\n ownedEntry: \"mcp_servers.make_docs\",\n }),\n method(\n \"command-rules\",\n \"codex-command-rules\",\n () => \".codex/rules/make-docs.rules\",\n { ownedEntry: \"make-docs.command-rules\", requiresCommandRules: true },\n ),\n ]),\n});\n\nexport const CLAUDE_CODE_HARNESS_ADAPTER = createHarnessAdapter({\n id: \"make-docs.claude-code\",\n version: 1,\n harnessId: \"claude-code\",\n displayName: \"Claude Code\",\n executableNames: Object.freeze([\"claude\"]),\n projectRouterFiles: Object.freeze([\"CLAUDE.md\"]),\n skillRoots: Object.freeze([\".claude/skills\"]),\n methods: Object.freeze([\n method(\n \"mcp\",\n \"claude-mcp-json\",\n scope => (scope === \"machine\" ? \".claude.json\" : \".mcp.json\"),\n { ownedEntry: \"mcpServers.make-docs\" },\n ),\n method(\n \"permission-rules\",\n \"claude-permission-json\",\n () => \".claude/settings.json\",\n {\n ownedEntry: \"permissions.allow.make-docs\",\n requiresCommandRules: true,\n availability: \"blocked\",\n blocker:\n \"Claude Code does not select or preserve the exact receipt-bound Make Docs command for permission-rule matching.\",\n nextAction:\n \"Use Claude Code MCP setup while Make Docs evaluates a shorter safe command carrier\",\n },\n ),\n ]),\n});\n\nexport const FIRST_PARTY_HARNESS_ADAPTERS: readonly HarnessAdapter[] = Object.freeze([\n CODEX_HARNESS_ADAPTER,\n CLAUDE_CODE_HARNESS_ADAPTER,\n]);\n\nexport const PI_HARNESS_SUPPORT = Object.freeze({\n harnessId: \"pi\" as const,\n state: \"unsupported\" as const,\n publicSupportClaim: false as const,\n reason:\n \"Make Docs does not ship a first-party Pi adapter.\",\n});\n\nexport function getFirstPartyHarnessAdapter(harnessId: string): HarnessAdapter | undefined {\n return FIRST_PARTY_HARNESS_ADAPTERS.find(adapter => adapter.harnessId === harnessId);\n}\n\nexport function requireFirstPartyHarnessAdapter(harnessId: string): HarnessAdapter {\n const adapter = getFirstPartyHarnessAdapter(harnessId);\n if (!adapter) throw new Error(`No admitted first-party harness adapter exists for ${harnessId}.`);\n return adapter;\n}\n\nexport function validateHarnessMethodSelection(input: {\n harnessId: string;\n method: HarnessMethodSelection;\n scope?: HarnessScope;\n}): HarnessMethodDefinition | null {\n const adapter = requireFirstPartyHarnessAdapter(input.harnessId);\n if (input.method === \"none\") return null;\n const method = adapter.methods.find(candidate => candidate.id === input.method);\n if (!method || (input.scope && !method.scopes.includes(input.scope))) {\n const scope = input.scope ? ` for ${input.scope} scope` : \"\";\n throw new Error(`${adapter.displayName} does not admit ${input.method}${scope}.`);\n }\n return method;\n}\n","export type StoreAccess = \"none\" | \"read\" | \"write\";\nexport type ProjectAccess = \"none\" | \"read\" | \"write\";\nexport type HostConfigAccess = \"none\" | \"write\";\n\nexport interface OperationAccess {\n readonly store: StoreAccess;\n readonly project: ProjectAccess;\n readonly hostConfig: HostConfigAccess;\n}\n\nexport const NO_ACCESS: OperationAccess = Object.freeze({\n store: \"none\",\n project: \"none\",\n hostConfig: \"none\",\n});\n\nexport const PROJECT_READ_ACCESS: OperationAccess = Object.freeze({\n store: \"none\",\n project: \"read\",\n hostConfig: \"none\",\n});\n\nexport const STORE_READ_PROJECT_READ_ACCESS: OperationAccess = Object.freeze({\n store: \"read\",\n project: \"read\",\n hostConfig: \"none\",\n});\n\nexport const STORE_WRITE_PROJECT_READ_ACCESS: OperationAccess = Object.freeze({\n store: \"write\",\n project: \"read\",\n hostConfig: \"none\",\n});\n\nexport const STORE_WRITE_PROJECT_WRITE_ACCESS: OperationAccess = Object.freeze({\n store: \"write\",\n project: \"write\",\n hostConfig: \"none\",\n});\n\nexport const PROJECT_WRITE_ACCESS: OperationAccess = Object.freeze({\n store: \"none\",\n project: \"write\",\n hostConfig: \"none\",\n});\n\nexport function cloneOperationAccess(access: OperationAccess): OperationAccess {\n return { ...access };\n}\n\nexport function assertOperationAccess(\n operation: string,\n access: unknown,\n mutation: \"read\" | \"write\",\n): asserts access is OperationAccess {\n if (!isRecord(access)) {\n throw new Error(`Operation \\`${operation}\\` must declare complete access metadata.`);\n }\n\n const keys = Object.keys(access).sort();\n if (keys.join(\",\") !== \"hostConfig,project,store\") {\n throw new Error(\n `Operation \\`${operation}\\` access metadata must declare only store, project, and hostConfig.`,\n );\n }\n\n if (!isAccessLevel(access.store) || !isAccessLevel(access.project)) {\n throw new Error(\n `Operation \\`${operation}\\` access.store and access.project must be none, read, or write.`,\n );\n }\n if (access.hostConfig !== \"none\" && access.hostConfig !== \"write\") {\n throw new Error(\n `Operation \\`${operation}\\` access.hostConfig must be none or write.`,\n );\n }\n\n if (\n mutation === \"read\" &&\n (access.store === \"write\" || access.project === \"write\" || access.hostConfig === \"write\")\n ) {\n throw new Error(\n `Read-only operation \\`${operation}\\` cannot declare write access.`,\n );\n }\n if (\n mutation === \"write\" &&\n access.store !== \"write\" &&\n access.project !== \"write\" &&\n access.hostConfig !== \"write\"\n ) {\n throw new Error(\n `Mutating operation \\`${operation}\\` must declare the state that it writes.`,\n );\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isAccessLevel(value: unknown): value is StoreAccess | ProjectAccess {\n return value === \"none\" || value === \"read\" || value === \"write\";\n}\n"],"mappings":";;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,WAAW,cAAc,oBAAoB;AACtD,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAkCvB,IAAM,8BAA8B;AACpC,IAAM,8BAA8B;AACpC,IAAM,+BAA+B;AA+DrC,IAAM,8BAAN,cAA0C,MAAM;AAAA,EAGrD,YACW,MACT,SACS,YACA,cACA,YACA,YACT;AACA,UAAM,OAAO;AAPJ;AAEA;AACA;AACA;AACA;AAAA,EAGX;AAAA,EAXS,OAAO;AAYlB;AAmMA,IAAM,6BAA6B,oBAAI,IAAI;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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AAAA,EACT,YAAY;AACd,CAAC;AAEM,IAAM,uBAAwC,OAAO,OAAO;AAAA,EACjE,OAAO;AAAA,EACP,SAAS;AAAA,EACT,YAAY;AACd,CAAC;AAEM,SAAS,qBAAqB,QAA0C;AAC7E,SAAO,EAAE,GAAG,OAAO;AACrB;AAEO,SAAS,sBACd,WACA,QACA,UACmC;AACnC,MAAI,CAACC,UAAS,MAAM,GAAG;AACrB,UAAM,IAAI,MAAM,eAAe,SAAS,2CAA2C;AAAA,EACrF;AAEA,QAAM,OAAO,OAAO,KAAK,MAAM,EAAE,KAAK;AACtC,MAAI,KAAK,KAAK,GAAG,MAAM,4BAA4B;AACjD,UAAM,IAAI;AAAA,MACR,eAAe,SAAS;AAAA,IAC1B;AAAA,EACF;AAEA,MAAI,CAAC,cAAc,OAAO,KAAK,KAAK,CAAC,cAAc,OAAO,OAAO,GAAG;AAClE,UAAM,IAAI;AAAA,MACR,eAAe,SAAS;AAAA,IAC1B;AAAA,EACF;AACA,MAAI,OAAO,eAAe,UAAU,OAAO,eAAe,SAAS;AACjE,UAAM,IAAI;AAAA,MACR,eAAe,SAAS;AAAA,IAC1B;AAAA,EACF;AAEA,MACE,aAAa,WACZ,OAAO,UAAU,WAAW,OAAO,YAAY,WAAW,OAAO,eAAe,UACjF;AACA,UAAM,IAAI;AAAA,MACR,yBAAyB,SAAS;AAAA,IACpC;AAAA,EACF;AACA,MACE,aAAa,WACb,OAAO,UAAU,WACjB,OAAO,YAAY,WACnB,OAAO,eAAe,SACtB;AACA,UAAM,IAAI;AAAA,MACR,wBAAwB,SAAS;AAAA,IACnC;AAAA,EACF;AACF;AAEA,SAASA,UAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,cAAc,OAAsD;AAC3E,SAAO,UAAU,UAAU,UAAU,UAAU,UAAU;AAC3D;","names":["method","lstatSync","readFileSync","path","method","path","toMessage","verification","afterContent","existing","start","codePoint","lstatSync","readFileSync","method","isRecord"]}
|