opencode-plugin-flow 5.3.4 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.md +183 -311
- package/dist/index.js +2907 -13983
- package/dist/index.js.map +27 -41
- package/package.json +4 -20
- package/dist/cli.js +0 -2925
- package/dist/cli.js.map +0 -15
package/dist/cli.js.map
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/distribution/activation.ts", "../src/platform/opencode/leadership.ts", "../src/version.ts", "../src/distribution/legacy-cleanup.ts", "../src/guidance/ids.ts", "../src/cli.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { createHash, randomUUID } from \"node:crypto\";\nimport { constants } from \"node:fs\";\nimport {\n\taccess,\n\tlstat,\n\tmkdir,\n\topen,\n\treaddir,\n\trename,\n\trm,\n\trmdir,\n\twriteFile,\n} from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport {\n\tbasename,\n\tdirname,\n\tisAbsolute,\n\tjoin,\n\tnormalize,\n\trelative,\n\tresolve,\n\tsep,\n} from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { compareSemanticVersions } from \"../platform/opencode/leadership.js\";\nimport { resolveFlowPluginVersion } from \"../version.js\";\n\nconst FLOW_PACKAGE_NAME = \"opencode-plugin-flow\";\nconst OWNED_WRAPPER_MARKER = \"// @opencode-plugin-flow-owned-wrapper v1\";\nconst NO_FOLLOW = constants.O_NOFOLLOW ?? 0;\nconst MAX_LOCAL_PLUGIN_BYTES = 1024 * 1024;\nconst EXACT_VERSION_PATTERN =\n\t/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$/;\nconst FLOW_NPM_SPECIFIER_PATTERN = /^opencode-plugin-flow(?:@(.+))?$/;\n// OpenCode's plugin-directory glob is {plugin,plugins}/*.{js,ts}.\nconst LOCAL_PLUGIN_EXTENSION_PATTERN = /\\.(?:js|ts)$/i;\n\nexport type ActivationScope = \"global\" | \"project\";\nexport type ActivationRecordScope =\n\t| ActivationScope\n\t| \"custom\"\n\t| \"inline\"\n\t| \"managed\";\nexport type ActivationSource =\n\t| \"global-config\"\n\t| \"project-config\"\n\t| \"project-directory-config\"\n\t| \"custom-config\"\n\t| \"custom-directory-config\"\n\t| \"inline-config\"\n\t| \"managed-config\"\n\t| \"global-plugin-directory\"\n\t| \"home-plugin-directory\"\n\t| \"project-plugin-directory\"\n\t| \"custom-plugin-directory\";\n\nexport type ActivationOwnership =\n\t| \"flow-npm\"\n\t| \"marker-owned-wrapper\"\n\t| \"legacy-flow-wrapper\"\n\t| \"unknown-flow-like\";\n\nexport type ActivationRecord = {\n\tsource: ActivationSource;\n\tscope: ActivationRecordScope;\n\tpath: string;\n\tspecifier: string;\n\tresolvedVersion: string | null;\n\townership: ActivationOwnership;\n\tstatus: \"target\" | \"conflict\" | \"refused\";\n\treason?: string;\n};\n\nexport type ActivationIssue = {\n\tsource: ActivationSource | \"project\" | \"cache\" | \"environment\" | \"recovery\";\n\tpath: string;\n\tcode:\n\t\t| \"invalid-project\"\n\t\t| \"invalid-config\"\n\t\t| \"invalid-plugin-directory\"\n\t\t| \"ambiguous-cache-artifact\"\n\t\t| \"unsafe-symlink\"\n\t\t| \"incomplete-recovery\";\n\tmessage: string;\n};\n\nexport type ActivationLimitation = {\n\tsource: \"remote-config\" | \"managed-preferences\";\n\tcoverage: \"runtime-leadership\";\n\tblocking: false;\n\tdetail: string;\n};\n\nexport type FlowCacheArtifact = {\n\tpath: string;\n\tspecifier: string;\n\tresolvedVersion: string | null;\n\tstatus: \"target\" | \"inactive\" | \"ambiguous\";\n\treason?: string;\n};\n\nexport type ActivationPaths = {\n\tproject: string;\n\thome: string;\n\tconfigRoot: string;\n\tcacheRoot: string;\n\tglobalConfig: string;\n\tprojectConfig: string;\n\tglobalPluginDirectory: string;\n\tprojectPluginDirectory: string;\n\tglobalConfigFiles: string[];\n\tprojectConfigFiles: string[];\n\tprojectDirectoryConfigFiles: string[];\n\tcustomConfigFile: string | null;\n\tcustomConfigDirectory: string | null;\n\tcustomDirectoryConfigFiles: string[];\n\tmanagedConfigRoot: string;\n\tmanagedConfigFiles: string[];\n\tpluginDirectories: Array<{\n\t\tsource: Extract<\n\t\t\tActivationSource,\n\t\t\t| \"global-plugin-directory\"\n\t\t\t| \"home-plugin-directory\"\n\t\t\t| \"project-plugin-directory\"\n\t\t\t| \"custom-plugin-directory\"\n\t\t>;\n\t\tscope: ActivationRecordScope;\n\t\tpath: string;\n\t\tsafetyRoot: string;\n\t}>;\n\tmanagedPreferencePaths: string[];\n\thasInlineConfig: boolean;\n\tpackageCacheRoot: string;\n\tjournalRoot: string;\n\tglobalWrapperRecoveryRoot: string;\n\tprojectWrapperRecoveryRoot: string;\n\tcacheRecoveryRoot: string;\n};\n\nexport type ActivationPathOptions = {\n\thome?: string;\n\tconfigRoot?: string;\n\tcacheRoot?: string;\n\tmanagedConfigRoot?: string;\n\tmanagedPreferencePaths?: string[];\n\tplatform?: NodeJS.Platform;\n\tenv?: NodeJS.ProcessEnv;\n};\n\nexport type ActivationCheckReport = {\n\tmode: \"check\";\n\tproject: string;\n\ttarget: string;\n\tcoverage: {\n\t\tglobalSources: true;\n\t\tselectedProject: string;\n\t\totherProjectTrees: false;\n\t};\n\tpaths: ActivationPaths;\n\trecords: ActivationRecord[];\n\tcacheArtifacts: FlowCacheArtifact[];\n\tissues: ActivationIssue[];\n\tlimitations: ActivationLimitation[];\n\tsingleVersionSatisfied: boolean;\n\treasons: string[];\n};\n\nexport type ActivationPlanOperation = {\n\taction:\n\t\t| \"rewrite-config\"\n\t\t| \"remove-wrapper\"\n\t\t| \"remove-cache\"\n\t\t| \"manual-remediation\";\n\tscope?: ActivationRecordScope;\n\tpath: string;\n\tdetail: string;\n};\n\nexport type ActivationApplyReport = {\n\tmode: \"dry-run\" | \"apply\";\n\tproject: string;\n\ttarget: string;\n\tscope: ActivationScope;\n\tstatus: \"ready\" | \"applied\" | \"refused\";\n\tbefore: ActivationCheckReport;\n\tplan: ActivationPlanOperation[];\n\trefusals: string[];\n\trecovery?: {\n\t\trunId: string;\n\t\tjournalPath: string;\n\t};\n\tfailure?: {\n\t\tmessage: string;\n\t\trecoveryState: \"rolled-back\" | \"rollback-failed\" | \"cleanup-failed\";\n\t\tguidance: string[];\n\t};\n\tafter?: ActivationCheckReport;\n};\n\ntype PluginOptions = Record<string, unknown>;\ntype PluginSpec = string | [string, PluginOptions];\n\ntype ConfigDescriptor = {\n\tsource: Extract<\n\t\tActivationSource,\n\t\t| \"global-config\"\n\t\t| \"project-config\"\n\t\t| \"project-directory-config\"\n\t\t| \"custom-config\"\n\t\t| \"custom-directory-config\"\n\t\t| \"managed-config\"\n\t>;\n\tscope: ActivationRecordScope;\n\tpath: string;\n\tmutable: boolean;\n\tsafetyRoot: string;\n\tmanualRemediation: string;\n};\n\ntype PluginDirectoryDescriptor = {\n\tsource: Extract<\n\t\tActivationSource,\n\t\t| \"global-plugin-directory\"\n\t\t| \"home-plugin-directory\"\n\t\t| \"project-plugin-directory\"\n\t\t| \"custom-plugin-directory\"\n\t>;\n\tscope: ActivationRecordScope;\n\tpath: string;\n\tsafetyRoot: string;\n};\n\ntype StrictConfigSnapshot = {\n\tdescriptor: ConfigDescriptor;\n\texists: boolean;\n\tcontent: string | null;\n\tdigest: string | null;\n\tvalue: Record<string, unknown>;\n\tplugin: PluginSpec[];\n\tformat: \"strict-json\" | \"jsonc\";\n\tindent: string;\n\tnewline: \"\\n\" | \"\\r\\n\";\n\tfinalNewline: boolean;\n\tmode: number;\n};\n\ntype OwnedWrapper = {\n\tpath: string;\n\tscope: ActivationRecordScope;\n\tsource: ActivationSource;\n\tversion: string;\n\townership: \"marker-owned-wrapper\" | \"legacy-flow-wrapper\";\n};\n\ntype JournalAction = {\n\taction: ActivationPlanOperation[\"action\"];\n\tpath: string;\n\tsource?: ActivationSource;\n\tscope?: ActivationRecordScope;\n\tresolvedVersion?: string;\n\townership?: Extract<\n\t\tActivationOwnership,\n\t\t\"marker-owned-wrapper\" | \"legacy-flow-wrapper\"\n\t>;\n\tspecifier?: string;\n\tstagingPath?: string;\n\trecoveryPath?: string;\n\tbackupPath?: string;\n\toriginalAbsent?: boolean;\n\toriginalMode?: number;\n\tappliedDigest?: string;\n\tdeleted?: boolean;\n\tstate: \"pending\" | \"complete\" | \"rolled-back\" | \"rollback-failed\";\n\terror?: string;\n};\n\ntype ActivationJournal = {\n\tformat: \"flow-activation-journal-v2\";\n\trunId: string;\n\tcreatedAt: string;\n\townerPid?: number;\n\tproject: string;\n\ttarget: string;\n\tscope: ActivationScope;\n\tstate:\n\t\t| \"prepared\"\n\t\t| \"applying\"\n\t\t| \"committed\"\n\t\t| \"complete\"\n\t\t| \"failed\"\n\t\t| \"cleanup-failed\"\n\t\t| \"rolled-back\"\n\t\t| \"rollback-failed\";\n\terror?: string;\n\tactions: JournalAction[];\n};\n\ntype LegacyActivationJournal = {\n\tformat: \"flow-activation-journal-v1\";\n\trunId: string;\n\tstate:\n\t\t| \"prepared\"\n\t\t| \"applying\"\n\t\t| \"complete\"\n\t\t| \"failed\"\n\t\t| \"rolled-back\"\n\t\t| \"rollback-failed\";\n};\n\ntype ReadActivationJournal = ActivationJournal | LegacyActivationJournal;\n\nfunction sha256(value: string): string {\n\treturn createHash(\"sha256\").update(value).digest(\"hex\");\n}\n\nfunction configuredHome(env: NodeJS.ProcessEnv): string {\n\treturn env.HOME?.trim() || env.USERPROFILE?.trim() || homedir();\n}\n\nfunction normalizedInjectedRoot(path: string): string {\n\treturn normalize(resolve(path));\n}\n\nfunction resolveEnvironmentPath(value: string, project: string): string {\n\treturn normalize(isAbsolute(value) ? value : resolve(project, value));\n}\n\nfunction systemManagedConfigRoot(\n\tplatform: NodeJS.Platform,\n\tenv: NodeJS.ProcessEnv,\n): string {\n\tif (platform === \"darwin\") return \"/Library/Application Support/opencode\";\n\tif (platform === \"win32\") {\n\t\treturn join(env.ProgramData?.trim() || \"C:\\\\ProgramData\", \"opencode\");\n\t}\n\treturn \"/etc/opencode\";\n}\n\nfunction systemManagedPreferencePaths(\n\tplatform: NodeJS.Platform,\n\thome: string,\n): string[] {\n\tif (platform !== \"darwin\") return [];\n\tconst username = basename(home) || \"user\";\n\treturn [\n\t\tjoin(\"/Library/Managed Preferences\", username, \"ai.opencode.managed.plist\"),\n\t\tjoin(\"/Library/Managed Preferences\", \"ai.opencode.managed.plist\"),\n\t];\n}\n\nexport function isExactFlowVersion(value: string): boolean {\n\treturn EXACT_VERSION_PATTERN.test(value);\n}\n\nexport function resolveActivationTarget(target?: string): string {\n\tconst resolved = target ?? resolveFlowPluginVersion();\n\tif (!isExactFlowVersion(resolved)) {\n\t\tthrow new Error(\n\t\t\t`Flow activation target '${resolved}' must be an exact semantic version; tags and ranges are not resolved.`,\n\t\t);\n\t}\n\treturn resolved;\n}\n\nexport function resolveActivationPaths(\n\tproject: string,\n\toptions: ActivationPathOptions = {},\n): ActivationPaths {\n\tif (!isAbsolute(project)) {\n\t\tthrow new Error(\n\t\t\t`Flow activation project path must be absolute: ${project}`,\n\t\t);\n\t}\n\tconst env = options.env ?? process.env;\n\tconst home = normalizedInjectedRoot(options.home ?? configuredHome(env));\n\tconst configRoot = normalizedInjectedRoot(\n\t\toptions.configRoot ??\n\t\t\t(options.home\n\t\t\t\t? join(home, \".config\", \"opencode\")\n\t\t\t\t: env.XDG_CONFIG_HOME\n\t\t\t\t\t? join(env.XDG_CONFIG_HOME, \"opencode\")\n\t\t\t\t\t: join(home, \".config\", \"opencode\")),\n\t);\n\tconst cacheRoot = normalizedInjectedRoot(\n\t\toptions.cacheRoot ??\n\t\t\t(options.home\n\t\t\t\t? join(home, \".cache\", \"opencode\")\n\t\t\t\t: env.XDG_CACHE_HOME\n\t\t\t\t\t? join(env.XDG_CACHE_HOME, \"opencode\")\n\t\t\t\t\t: join(home, \".cache\", \"opencode\")),\n\t);\n\tconst absoluteProject = normalizedInjectedRoot(project);\n\tconst platform = options.platform ?? process.platform;\n\tconst customConfigFile = env.OPENCODE_CONFIG?.trim()\n\t\t? resolveEnvironmentPath(env.OPENCODE_CONFIG.trim(), absoluteProject)\n\t\t: null;\n\tconst customConfigDirectory = env.OPENCODE_CONFIG_DIR?.trim()\n\t\t? resolveEnvironmentPath(env.OPENCODE_CONFIG_DIR.trim(), absoluteProject)\n\t\t: null;\n\tconst managedConfigRoot = normalizedInjectedRoot(\n\t\toptions.managedConfigRoot ??\n\t\t\tenv.OPENCODE_TEST_MANAGED_CONFIG_DIR ??\n\t\t\tsystemManagedConfigRoot(platform, env),\n\t);\n\tconst globalConfigFiles = [\n\t\tjoin(configRoot, \"config.json\"),\n\t\tjoin(configRoot, \"opencode.json\"),\n\t\tjoin(configRoot, \"opencode.jsonc\"),\n\t];\n\tconst projectConfigFiles = [\n\t\tjoin(absoluteProject, \"opencode.jsonc\"),\n\t\tjoin(absoluteProject, \"opencode.json\"),\n\t];\n\tconst projectDirectoryRoot = join(absoluteProject, \".opencode\");\n\tconst projectDirectoryConfigFiles = [\n\t\tjoin(projectDirectoryRoot, \"opencode.json\"),\n\t\tjoin(projectDirectoryRoot, \"opencode.jsonc\"),\n\t];\n\tconst customDirectoryConfigFiles = customConfigDirectory\n\t\t? [\n\t\t\t\tjoin(customConfigDirectory, \"opencode.json\"),\n\t\t\t\tjoin(customConfigDirectory, \"opencode.jsonc\"),\n\t\t\t]\n\t\t: [];\n\tconst managedConfigFiles = [\n\t\tjoin(managedConfigRoot, \"opencode.json\"),\n\t\tjoin(managedConfigRoot, \"opencode.jsonc\"),\n\t];\n\tconst pluginDirectories: ActivationPaths[\"pluginDirectories\"] = [\n\t\t...([\"plugin\", \"plugins\"] as const).map((name) => ({\n\t\t\tsource: \"global-plugin-directory\" as const,\n\t\t\tscope: \"global\" as const,\n\t\t\tpath: join(configRoot, name),\n\t\t\tsafetyRoot: dirname(configRoot),\n\t\t})),\n\t\t...([\"plugin\", \"plugins\"] as const).map((name) => ({\n\t\t\tsource: \"home-plugin-directory\" as const,\n\t\t\tscope: \"global\" as const,\n\t\t\tpath: join(home, \".opencode\", name),\n\t\t\tsafetyRoot: home,\n\t\t})),\n\t\t...([\"plugin\", \"plugins\"] as const).map((name) => ({\n\t\t\tsource: \"project-plugin-directory\" as const,\n\t\t\tscope: \"project\" as const,\n\t\t\tpath: join(projectDirectoryRoot, name),\n\t\t\tsafetyRoot: absoluteProject,\n\t\t})),\n\t\t...(customConfigDirectory\n\t\t\t? ([\"plugin\", \"plugins\"] as const).map((name) => ({\n\t\t\t\t\tsource: \"custom-plugin-directory\" as const,\n\t\t\t\t\tscope: \"custom\" as const,\n\t\t\t\t\tpath: join(customConfigDirectory, name),\n\t\t\t\t\tsafetyRoot: dirname(customConfigDirectory),\n\t\t\t\t}))\n\t\t\t: []),\n\t];\n\treturn {\n\t\tproject: absoluteProject,\n\t\thome,\n\t\tconfigRoot,\n\t\tcacheRoot,\n\t\tglobalConfig: join(configRoot, \"opencode.json\"),\n\t\tprojectConfig: join(absoluteProject, \"opencode.json\"),\n\t\tglobalPluginDirectory: join(configRoot, \"plugins\"),\n\t\tprojectPluginDirectory: join(absoluteProject, \".opencode\", \"plugins\"),\n\t\tglobalConfigFiles,\n\t\tprojectConfigFiles,\n\t\tprojectDirectoryConfigFiles,\n\t\tcustomConfigFile,\n\t\tcustomConfigDirectory,\n\t\tcustomDirectoryConfigFiles,\n\t\tmanagedConfigRoot,\n\t\tmanagedConfigFiles,\n\t\tpluginDirectories,\n\t\tmanagedPreferencePaths:\n\t\t\toptions.managedPreferencePaths?.map(normalizedInjectedRoot) ??\n\t\t\tsystemManagedPreferencePaths(platform, home),\n\t\thasInlineConfig: Boolean(env.OPENCODE_CONFIG_CONTENT?.trim()),\n\t\tpackageCacheRoot: join(cacheRoot, \"packages\"),\n\t\tjournalRoot: join(configRoot, \"flow-activation-recovery\"),\n\t\tglobalWrapperRecoveryRoot: join(configRoot, \"flow-activation-recovery\"),\n\t\tprojectWrapperRecoveryRoot: join(\n\t\t\tabsoluteProject,\n\t\t\t\".opencode\",\n\t\t\t\"flow-activation-recovery\",\n\t\t),\n\t\tcacheRecoveryRoot: join(cacheRoot, \"flow-activation-recovery\"),\n\t};\n}\n\nasync function optionalLstat(path: string) {\n\ttry {\n\t\treturn await lstat(path);\n\t} catch (error) {\n\t\tif ((error as NodeJS.ErrnoException).code === \"ENOENT\") return null;\n\t\tthrow error;\n\t}\n}\n\nasync function removeEmptyDirectory(path: string): Promise<void> {\n\ttry {\n\t\tawait rmdir(path);\n\t} catch (error) {\n\t\tconst code = (error as NodeJS.ErrnoException).code;\n\t\tif (code !== \"ENOENT\" && code !== \"ENOTEMPTY\") throw error;\n\t}\n}\n\nasync function symlinkInPathRange(\n\tsafetyRoot: string,\n\ttarget: string,\n): Promise<string | null> {\n\tconst root = normalize(safetyRoot);\n\tconst destination = normalize(target);\n\tconst pathFromRoot = relative(root, destination);\n\tif (\n\t\tpathFromRoot === \"..\" ||\n\t\tpathFromRoot.startsWith(`..${sep}`) ||\n\t\tisAbsolute(pathFromRoot)\n\t) {\n\t\tthrow new Error(\n\t\t\t`${destination} is outside its mutation safety root ${root}`,\n\t\t);\n\t}\n\tlet current = root;\n\tconst parts = pathFromRoot ? pathFromRoot.split(sep) : [];\n\tfor (let index = -1; index < parts.length; index += 1) {\n\t\tif (index >= 0) {\n\t\t\tconst part = parts[index];\n\t\t\tif (!part) continue;\n\t\t\tcurrent = join(current, part);\n\t\t}\n\t\tconst metadata = await optionalLstat(current);\n\t\tif (!metadata) return null;\n\t\tif (metadata.isSymbolicLink()) return current;\n\t}\n\treturn null;\n}\n\nasync function assertSafeMutationPath(\n\tsafetyRoot: string,\n\ttarget: string,\n): Promise<void> {\n\tconst symlink = await symlinkInPathRange(safetyRoot, target);\n\tif (symlink) {\n\t\tthrow new Error(\n\t\t\t`${target}: mutation refused because ancestor ${symlink} is a symbolic link`,\n\t\t);\n\t}\n}\n\nasync function readRegularFileWithoutFollowing(\n\tpath: string,\n\tmaximumBytes?: number,\n): Promise<string> {\n\tconst pathMetadata = await lstat(path);\n\tif (pathMetadata.isSymbolicLink()) {\n\t\tthrow new Error(\"symbolic link refused\");\n\t}\n\tif (!pathMetadata.isFile()) throw new Error(\"not a regular file\");\n\tif (maximumBytes !== undefined && pathMetadata.size > maximumBytes) {\n\t\tthrow new Error(`file exceeds ${maximumBytes} bytes`);\n\t}\n\tconst handle = await open(path, constants.O_RDONLY | NO_FOLLOW);\n\ttry {\n\t\tconst metadata = await handle.stat();\n\t\tif (!metadata.isFile()) throw new Error(\"not a regular file\");\n\t\tif (\n\t\t\tmetadata.dev !== pathMetadata.dev ||\n\t\t\tmetadata.ino !== pathMetadata.ino\n\t\t) {\n\t\t\tthrow new Error(\"file changed while activation was running\");\n\t\t}\n\t\treturn await handle.readFile({ encoding: \"utf8\" });\n\t} catch (error) {\n\t\tif ((error as NodeJS.ErrnoException).code === \"ELOOP\") {\n\t\t\tthrow new Error(\"symbolic link refused\");\n\t\t}\n\t\tthrow error;\n\t} finally {\n\t\tawait handle.close();\n\t}\n}\n\nfunction configDescriptors(paths: ActivationPaths): ConfigDescriptor[] {\n\tconst descriptors: ConfigDescriptor[] = [\n\t\t...paths.globalConfigFiles.map((path) => ({\n\t\t\tsource: \"global-config\" as const,\n\t\t\tscope: \"global\" as const,\n\t\t\tpath,\n\t\t\tmutable: true,\n\t\t\tsafetyRoot: dirname(paths.configRoot),\n\t\t\tmanualRemediation: `edit ${path} manually`,\n\t\t})),\n\t\t...(paths.customConfigFile\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tsource: \"custom-config\" as const,\n\t\t\t\t\t\tscope: \"custom\" as const,\n\t\t\t\t\t\tpath: paths.customConfigFile,\n\t\t\t\t\t\tmutable: true,\n\t\t\t\t\t\tsafetyRoot: dirname(paths.customConfigFile),\n\t\t\t\t\t\tmanualRemediation: `edit OPENCODE_CONFIG file ${paths.customConfigFile} manually`,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...paths.projectConfigFiles.map((path) => ({\n\t\t\tsource: \"project-config\" as const,\n\t\t\tscope: \"project\" as const,\n\t\t\tpath,\n\t\t\tmutable: true,\n\t\t\tsafetyRoot: paths.project,\n\t\t\tmanualRemediation: `edit ${path} manually`,\n\t\t})),\n\t\t...paths.projectDirectoryConfigFiles.map((path) => ({\n\t\t\tsource: \"project-directory-config\" as const,\n\t\t\tscope: \"project\" as const,\n\t\t\tpath,\n\t\t\tmutable: true,\n\t\t\tsafetyRoot: paths.project,\n\t\t\tmanualRemediation: `edit ${path} manually`,\n\t\t})),\n\t\t...paths.customDirectoryConfigFiles.map((path) => ({\n\t\t\tsource: \"custom-directory-config\" as const,\n\t\t\tscope: \"custom\" as const,\n\t\t\tpath,\n\t\t\tmutable: true,\n\t\t\tsafetyRoot: dirname(paths.customConfigDirectory as string),\n\t\t\tmanualRemediation: `edit OPENCODE_CONFIG_DIR file ${path} manually`,\n\t\t})),\n\t\t...paths.managedConfigFiles.map((path) => ({\n\t\t\tsource: \"managed-config\" as const,\n\t\t\tscope: \"managed\" as const,\n\t\t\tpath,\n\t\t\tmutable: false,\n\t\t\tsafetyRoot: dirname(paths.managedConfigRoot),\n\t\t\tmanualRemediation: `ask the OpenCode administrator to remove the Flow entry from ${path}`,\n\t\t})),\n\t];\n\tconst unique = new Map<string, ConfigDescriptor>();\n\tfor (const descriptor of descriptors) {\n\t\tconst previous = unique.get(descriptor.path);\n\t\tif (!previous || (!descriptor.mutable && previous.mutable)) {\n\t\t\tunique.set(descriptor.path, descriptor);\n\t\t}\n\t}\n\treturn [...unique.values()];\n}\n\nfunction pluginDirectoryDescriptors(\n\tpaths: ActivationPaths,\n): PluginDirectoryDescriptor[] {\n\tconst unique = new Map<string, PluginDirectoryDescriptor>();\n\tfor (const descriptor of paths.pluginDirectories) {\n\t\tif (!unique.has(descriptor.path)) unique.set(descriptor.path, descriptor);\n\t}\n\treturn [...unique.values()];\n}\n\nfunction parseFlowNpmSpecifier(specifier: string): {\n\tisFlow: boolean;\n\tversion: string | null;\n} {\n\tconst match = FLOW_NPM_SPECIFIER_PATTERN.exec(specifier);\n\tif (!match) return { isFlow: false, version: null };\n\tconst candidate = match[1];\n\treturn {\n\t\tisFlow: true,\n\t\tversion: candidate && isExactFlowVersion(candidate) ? candidate : null,\n\t};\n}\n\nfunction pluginSpecifier(entry: PluginSpec): string {\n\treturn Array.isArray(entry) ? entry[0] : entry;\n}\n\nfunction isPluginOptions(value: unknown): value is PluginOptions {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction parsePluginSpecs(value: unknown): PluginSpec[] {\n\tif (value === undefined) return [];\n\tif (!Array.isArray(value)) {\n\t\tthrow new Error(\"config plugin must be an array\");\n\t}\n\treturn value.map((entry, index) => {\n\t\tif (typeof entry === \"string\") return entry;\n\t\tif (\n\t\t\tArray.isArray(entry) &&\n\t\t\tentry.length === 2 &&\n\t\t\ttypeof entry[0] === \"string\" &&\n\t\t\tisPluginOptions(entry[1])\n\t\t) {\n\t\t\treturn [entry[0], entry[1]];\n\t\t}\n\t\tthrow new Error(\n\t\t\t`config plugin[${index}] must be a string or [specifier, options] tuple`,\n\t\t);\n\t});\n}\n\nfunction stripJsoncComments(content: string): string {\n\tlet output = \"\";\n\tlet inString = false;\n\tlet escaped = false;\n\tfor (let index = 0; index < content.length; index += 1) {\n\t\tconst character = content[index];\n\t\tif (!character) continue;\n\t\tif (inString) {\n\t\t\toutput += character;\n\t\t\tif (escaped) escaped = false;\n\t\t\telse if (character === \"\\\\\") escaped = true;\n\t\t\telse if (character === '\"') inString = false;\n\t\t\tcontinue;\n\t\t}\n\t\tif (character === '\"') {\n\t\t\tinString = true;\n\t\t\toutput += character;\n\t\t\tcontinue;\n\t\t}\n\t\tconst next = content[index + 1];\n\t\tif (character === \"/\" && next === \"/\") {\n\t\t\toutput += \" \";\n\t\t\tindex += 2;\n\t\t\twhile (index < content.length) {\n\t\t\t\tconst commentCharacter = content[index];\n\t\t\t\tif (commentCharacter === \"\\n\" || commentCharacter === \"\\r\") {\n\t\t\t\t\tindex -= 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toutput += \" \";\n\t\t\t\tindex += 1;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (character === \"/\" && next === \"*\") {\n\t\t\toutput += \" \";\n\t\t\tindex += 2;\n\t\t\tlet closed = false;\n\t\t\twhile (index < content.length) {\n\t\t\t\tconst commentCharacter = content[index];\n\t\t\t\tconst following = content[index + 1];\n\t\t\t\tif (commentCharacter === \"*\" && following === \"/\") {\n\t\t\t\t\toutput += \" \";\n\t\t\t\t\tindex += 1;\n\t\t\t\t\tclosed = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toutput +=\n\t\t\t\t\tcommentCharacter === \"\\n\" || commentCharacter === \"\\r\"\n\t\t\t\t\t\t? commentCharacter\n\t\t\t\t\t\t: \" \";\n\t\t\t\tindex += 1;\n\t\t\t}\n\t\t\tif (!closed) throw new Error(\"unterminated block comment\");\n\t\t\tcontinue;\n\t\t}\n\t\toutput += character;\n\t}\n\tif (inString) throw new Error(\"unterminated JSON string\");\n\treturn output;\n}\n\nfunction removeJsoncTrailingCommas(content: string): string {\n\tlet output = \"\";\n\tlet inString = false;\n\tlet escaped = false;\n\tfor (let index = 0; index < content.length; index += 1) {\n\t\tconst character = content[index];\n\t\tif (!character) continue;\n\t\tif (inString) {\n\t\t\toutput += character;\n\t\t\tif (escaped) escaped = false;\n\t\t\telse if (character === \"\\\\\") escaped = true;\n\t\t\telse if (character === '\"') inString = false;\n\t\t\tcontinue;\n\t\t}\n\t\tif (character === '\"') {\n\t\t\tinString = true;\n\t\t\toutput += character;\n\t\t\tcontinue;\n\t\t}\n\t\tif (character === \",\") {\n\t\t\tlet lookahead = index + 1;\n\t\t\twhile (/\\s/.test(content[lookahead] ?? \"\")) lookahead += 1;\n\t\t\tif (content[lookahead] === \"}\" || content[lookahead] === \"]\") {\n\t\t\t\toutput += \" \";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\toutput += character;\n\t}\n\treturn output;\n}\n\nfunction parseConfigContent(content: string): {\n\tvalue: Record<string, unknown>;\n\tplugin: PluginSpec[];\n\tformat: \"strict-json\" | \"jsonc\";\n} {\n\tlet parsed: unknown;\n\tlet format: \"strict-json\" | \"jsonc\" = \"strict-json\";\n\ttry {\n\t\tparsed = JSON.parse(content);\n\t} catch {\n\t\tformat = \"jsonc\";\n\t\tparsed = JSON.parse(removeJsoncTrailingCommas(stripJsoncComments(content)));\n\t}\n\tif (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n\t\tthrow new Error(\"config root must be a JSON object\");\n\t}\n\tconst value = parsed as Record<string, unknown>;\n\treturn { value, plugin: parsePluginSpecs(value.plugin), format };\n}\n\nfunction looksLikeFlowPath(path: string): boolean {\n\tconst name = basename(path);\n\treturn (\n\t\t/opencode-plugin-flow/i.test(path) ||\n\t\t/(?:^|[-_.])flow(?:[-_.].*)?(?:plugin|wrapper)|(?:plugin|wrapper).*flow/i.test(\n\t\t\tname,\n\t\t)\n\t);\n}\n\nfunction parseOwnedWrapper(\n\tcontent: string,\n):\n\t| { kind: \"owned\"; version: string }\n\t| { kind: \"not-owned\" }\n\t| { kind: \"invalid\"; reason: string } {\n\tif (!content.startsWith(OWNED_WRAPPER_MARKER)) {\n\t\treturn { kind: \"not-owned\" };\n\t}\n\tconst firstNewline = content.indexOf(\"\\n\");\n\tconst secondNewline = content.indexOf(\"\\n\", firstNewline + 1);\n\tconst thirdNewline = content.indexOf(\"\\n\", secondNewline + 1);\n\tif (firstNewline < 0 || secondNewline < 0 || thirdNewline < 0) {\n\t\treturn { kind: \"invalid\", reason: \"owned wrapper marker is incomplete\" };\n\t}\n\tconst versionLine = content.slice(firstNewline + 1, secondNewline);\n\tconst hashLine = content.slice(secondNewline + 1, thirdNewline);\n\tconst version = /^\\/\\/ version=(.+)$/.exec(versionLine)?.[1];\n\tconst expectedHash = /^\\/\\/ body-sha256=([a-f0-9]{64})$/.exec(hashLine)?.[1];\n\tif (!version || !isExactFlowVersion(version)) {\n\t\treturn { kind: \"invalid\", reason: \"owned wrapper version is invalid\" };\n\t}\n\tif (!expectedHash) {\n\t\treturn { kind: \"invalid\", reason: \"owned wrapper hash is invalid\" };\n\t}\n\tconst body = content.slice(thirdNewline + 1);\n\tif (sha256(body) !== expectedHash) {\n\t\treturn { kind: \"invalid\", reason: \"owned wrapper was edited\" };\n\t}\n\tif (!body.includes(`${FLOW_PACKAGE_NAME}@${version}`)) {\n\t\treturn {\n\t\t\tkind: \"invalid\",\n\t\t\treason: \"owned wrapper body does not reference its declared Flow version\",\n\t\t};\n\t}\n\treturn { kind: \"owned\", version };\n}\n\nfunction legacyFlowWrapperContent(version: string): string {\n\treturn [\n\t\t\"const flowPluginUrl = new URL(\",\n\t\t` \"../.cache/opencode/packages/${FLOW_PACKAGE_NAME}@${version}/node_modules/${FLOW_PACKAGE_NAME}/dist/index.js\",`,\n\t\t` \\`file://\\${process.env.HOME}/\\`,`,\n\t\t\")\",\n\t\t\"\",\n\t\t\"export default async function flowPlugin(input, options) {\",\n\t\t' process.env.BUN_BE_BUN = \"1\"',\n\t\t\" const { default: plugin } = await import(flowPluginUrl.href)\",\n\t\t\" return plugin(input, options)\",\n\t\t\"}\",\n\t\t\"\",\n\t].join(\"\\n\");\n}\n\nfunction parseLegacyFlowWrapper(\n\tpath: string,\n\tcontent: string,\n): { version: string } | null {\n\tconst normalized = content.replaceAll(\"\\r\\n\", \"\\n\");\n\tconst version = hintedFlowVersion(normalized);\n\tif (!version || basename(path) !== `flow-${version}-wrapper.js`) return null;\n\treturn normalized === legacyFlowWrapperContent(version) ? { version } : null;\n}\n\n/** Create the marker-owned local-wrapper format activation may remove. */\nexport function createMarkerOwnedFlowWrapper(version: string): string {\n\tconst exactVersion = resolveActivationTarget(version);\n\tconst body = `export { default } from \"${FLOW_PACKAGE_NAME}@${exactVersion}\";\\n`;\n\treturn [\n\t\tOWNED_WRAPPER_MARKER,\n\t\t`// version=${exactVersion}`,\n\t\t`// body-sha256=${sha256(body)}`,\n\t\tbody,\n\t].join(\"\\n\");\n}\n\nfunction hintedFlowVersion(content: string): string | null {\n\tconst candidate = new RegExp(\n\t\t`${FLOW_PACKAGE_NAME.replaceAll(\"-\", \"\\\\-\")}@([^/\\\\s\"']+)`,\n\t).exec(content)?.[1];\n\treturn candidate && isExactFlowVersion(candidate) ? candidate : null;\n}\n\nasync function classifyLocalPlugin(\n\tpath: string,\n\tsource: ActivationSource,\n\tscope: ActivationRecordScope,\n\ttarget: string,\n\tspecifier: string,\n): Promise<ActivationRecord | null> {\n\tconst metadata = await optionalLstat(path);\n\tif (!metadata) {\n\t\tif (!looksLikeFlowPath(specifier)) return null;\n\t\treturn {\n\t\t\tsource,\n\t\t\tscope,\n\t\t\tpath,\n\t\t\tspecifier,\n\t\t\tresolvedVersion: null,\n\t\t\townership: \"unknown-flow-like\",\n\t\t\tstatus: \"refused\",\n\t\t\treason: \"referenced local plugin is absent\",\n\t\t};\n\t}\n\tif (metadata.isSymbolicLink()) {\n\t\tif (!looksLikeFlowPath(specifier) && !looksLikeFlowPath(path)) return null;\n\t\treturn {\n\t\t\tsource,\n\t\t\tscope,\n\t\t\tpath,\n\t\t\tspecifier,\n\t\t\tresolvedVersion: null,\n\t\t\townership: \"unknown-flow-like\",\n\t\t\tstatus: \"refused\",\n\t\t\treason: \"symbolic link refused\",\n\t\t};\n\t}\n\tif (!metadata.isFile()) {\n\t\tif (!looksLikeFlowPath(specifier) && !looksLikeFlowPath(path)) return null;\n\t\treturn {\n\t\t\tsource,\n\t\t\tscope,\n\t\t\tpath,\n\t\t\tspecifier,\n\t\t\tresolvedVersion: null,\n\t\t\townership: \"unknown-flow-like\",\n\t\t\tstatus: \"refused\",\n\t\t\treason: \"local plugin is not a regular file\",\n\t\t};\n\t}\n\tlet content: string;\n\ttry {\n\t\tcontent = await readRegularFileWithoutFollowing(\n\t\t\tpath,\n\t\t\tMAX_LOCAL_PLUGIN_BYTES,\n\t\t);\n\t} catch (error) {\n\t\tif (!looksLikeFlowPath(specifier) && !looksLikeFlowPath(path)) return null;\n\t\treturn {\n\t\t\tsource,\n\t\t\tscope,\n\t\t\tpath,\n\t\t\tspecifier,\n\t\t\tresolvedVersion: null,\n\t\t\townership: \"unknown-flow-like\",\n\t\t\tstatus: \"refused\",\n\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t};\n\t}\n\tconst owned = parseOwnedWrapper(content);\n\tif (owned.kind === \"owned\") {\n\t\treturn {\n\t\t\tsource,\n\t\t\tscope,\n\t\t\tpath,\n\t\t\tspecifier,\n\t\t\tresolvedVersion: owned.version,\n\t\t\townership: \"marker-owned-wrapper\",\n\t\t\tstatus: \"conflict\",\n\t\t\treason:\n\t\t\t\towned.version === target\n\t\t\t\t\t? \"local wrapper duplicates the canonical npm activation source\"\n\t\t\t\t\t: \"local wrapper activates another Flow version\",\n\t\t};\n\t}\n\tconst legacy = parseLegacyFlowWrapper(path, content);\n\tif (legacy) {\n\t\treturn {\n\t\t\tsource,\n\t\t\tscope,\n\t\t\tpath,\n\t\t\tspecifier,\n\t\t\tresolvedVersion: legacy.version,\n\t\t\townership: \"legacy-flow-wrapper\",\n\t\t\tstatus: \"conflict\",\n\t\t\treason: \"exact known legacy Flow wrapper must be removed\",\n\t\t};\n\t}\n\tconst flowLike =\n\t\tlooksLikeFlowPath(specifier) ||\n\t\tlooksLikeFlowPath(path) ||\n\t\tcontent.includes(FLOW_PACKAGE_NAME) ||\n\t\tcontent.includes(OWNED_WRAPPER_MARKER);\n\tif (!flowLike) return null;\n\treturn {\n\t\tsource,\n\t\tscope,\n\t\tpath,\n\t\tspecifier,\n\t\tresolvedVersion: hintedFlowVersion(content),\n\t\townership: \"unknown-flow-like\",\n\t\tstatus: \"refused\",\n\t\treason:\n\t\t\towned.kind === \"invalid\"\n\t\t\t\t? owned.reason\n\t\t\t\t: \"Flow-like local plugin has no verifiable ownership marker\",\n\t};\n}\n\nfunction relativeLocalSpecifier(configPath: string, specifier: string): string {\n\tif (specifier.startsWith(\"file:\")) return fileURLToPath(specifier);\n\tif (isAbsolute(specifier)) return normalize(specifier);\n\treturn resolve(dirname(configPath), specifier);\n}\n\nfunction isLocalPluginSpecifier(specifier: string): boolean {\n\treturn (\n\t\tspecifier.startsWith(\".\") ||\n\t\tspecifier.startsWith(\"file:\") ||\n\t\tisAbsolute(specifier)\n\t);\n}\n\nasync function inspectConfig(\n\tdescriptor: ConfigDescriptor,\n\ttarget: string,\n): Promise<{ records: ActivationRecord[]; issues: ActivationIssue[] }> {\n\tconst records: ActivationRecord[] = [];\n\tconst issues: ActivationIssue[] = [];\n\tconst symlinkAncestor = await symlinkInPathRange(\n\t\tdescriptor.safetyRoot,\n\t\tdescriptor.path,\n\t);\n\tif (symlinkAncestor) {\n\t\tissues.push({\n\t\t\tsource: descriptor.source,\n\t\t\tpath: descriptor.path,\n\t\t\tcode: \"unsafe-symlink\",\n\t\t\tmessage: `config ancestor ${symlinkAncestor} is a symbolic link`,\n\t\t});\n\t\treturn { records, issues };\n\t}\n\tconst metadata = await optionalLstat(descriptor.path);\n\tif (!metadata) return { records, issues };\n\tif (metadata.isSymbolicLink() || !metadata.isFile()) {\n\t\tissues.push({\n\t\t\tsource: descriptor.source,\n\t\t\tpath: descriptor.path,\n\t\t\tcode: \"invalid-config\",\n\t\t\tmessage: metadata.isSymbolicLink()\n\t\t\t\t? \"config symbolic link refused\"\n\t\t\t\t: \"config is not a regular file\",\n\t\t});\n\t\treturn { records, issues };\n\t}\n\tlet content: string;\n\ttry {\n\t\tcontent = await readRegularFileWithoutFollowing(descriptor.path);\n\t} catch (error) {\n\t\tissues.push({\n\t\t\tsource: descriptor.source,\n\t\t\tpath: descriptor.path,\n\t\t\tcode: \"invalid-config\",\n\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t});\n\t\treturn { records, issues };\n\t}\n\tlet parsed: ReturnType<typeof parseConfigContent>;\n\ttry {\n\t\tparsed = parseConfigContent(content);\n\t} catch (error) {\n\t\tissues.push({\n\t\t\tsource: descriptor.source,\n\t\t\tpath: descriptor.path,\n\t\t\tcode: \"invalid-config\",\n\t\t\tmessage: `config cannot be conservatively parsed as JSON/JSONC: ${error instanceof Error ? error.message : String(error)}`,\n\t\t});\n\t\treturn { records, issues };\n\t}\n\tfor (const entry of parsed.plugin) {\n\t\tconst specifier = pluginSpecifier(entry);\n\t\tconst npm = parseFlowNpmSpecifier(specifier);\n\t\tif (npm.isFlow) {\n\t\t\tconst record: ActivationRecord = {\n\t\t\t\tsource: descriptor.source,\n\t\t\t\tscope: descriptor.scope,\n\t\t\t\tpath: descriptor.path,\n\t\t\t\tspecifier,\n\t\t\t\tresolvedVersion: npm.version,\n\t\t\t\townership: \"flow-npm\",\n\t\t\t\tstatus: npm.version === target ? \"target\" : \"conflict\",\n\t\t\t};\n\t\t\tif (npm.version === null) {\n\t\t\t\trecord.reason = \"Flow npm activation is not pinned to an exact version\";\n\t\t\t} else if (npm.version !== target) {\n\t\t\t\trecord.reason = \"Flow npm activation targets another version\";\n\t\t\t}\n\t\t\trecords.push(record);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!looksLikeFlowPath(specifier) && !isLocalPluginSpecifier(specifier)) {\n\t\t\tcontinue;\n\t\t}\n\t\tlet localPath: string;\n\t\ttry {\n\t\t\tlocalPath = relativeLocalSpecifier(descriptor.path, specifier);\n\t\t} catch {\n\t\t\tif (!looksLikeFlowPath(specifier)) continue;\n\t\t\trecords.push({\n\t\t\t\tsource: descriptor.source,\n\t\t\t\tscope: descriptor.scope,\n\t\t\t\tpath: specifier,\n\t\t\t\tspecifier,\n\t\t\t\tresolvedVersion: null,\n\t\t\t\townership: \"unknown-flow-like\",\n\t\t\t\tstatus: \"refused\",\n\t\t\t\treason: \"local Flow-like plugin specifier is invalid\",\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst local = await classifyLocalPlugin(\n\t\t\tlocalPath,\n\t\t\tdescriptor.source,\n\t\t\tdescriptor.scope,\n\t\t\ttarget,\n\t\t\tspecifier,\n\t\t);\n\t\tif (local) records.push(local);\n\t}\n\treturn { records, issues };\n}\n\nasync function inspectInlineConfig(\n\tcontent: string,\n\tproject: string,\n\ttarget: string,\n): Promise<{ records: ActivationRecord[]; issues: ActivationIssue[] }> {\n\tconst records: ActivationRecord[] = [];\n\tconst issues: ActivationIssue[] = [];\n\tlet parsed: ReturnType<typeof parseConfigContent>;\n\ttry {\n\t\tparsed = parseConfigContent(content);\n\t} catch (error) {\n\t\tissues.push({\n\t\t\tsource: \"inline-config\",\n\t\t\tpath: \"env:OPENCODE_CONFIG_CONTENT\",\n\t\t\tcode: \"invalid-config\",\n\t\t\tmessage: `inline config cannot be conservatively parsed as JSON/JSONC: ${error instanceof Error ? error.message : String(error)}`,\n\t\t});\n\t\treturn { records, issues };\n\t}\n\tconst virtualConfigPath = join(project, \"opencode.inline.json\");\n\tfor (const entry of parsed.plugin) {\n\t\tconst specifier = pluginSpecifier(entry);\n\t\tconst npm = parseFlowNpmSpecifier(specifier);\n\t\tif (npm.isFlow) {\n\t\t\tconst record: ActivationRecord = {\n\t\t\t\tsource: \"inline-config\",\n\t\t\t\tscope: \"inline\",\n\t\t\t\tpath: \"env:OPENCODE_CONFIG_CONTENT\",\n\t\t\t\tspecifier,\n\t\t\t\tresolvedVersion: npm.version,\n\t\t\t\townership: \"flow-npm\",\n\t\t\t\tstatus: npm.version === target ? \"target\" : \"conflict\",\n\t\t\t};\n\t\t\tif (npm.version === null) {\n\t\t\t\trecord.reason = \"Flow npm activation is not pinned to an exact version\";\n\t\t\t} else if (npm.version !== target) {\n\t\t\t\trecord.reason = \"Flow npm activation targets another version\";\n\t\t\t}\n\t\t\trecords.push(record);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!looksLikeFlowPath(specifier) && !isLocalPluginSpecifier(specifier)) {\n\t\t\tcontinue;\n\t\t}\n\t\tlet localPath: string;\n\t\ttry {\n\t\t\tlocalPath = relativeLocalSpecifier(virtualConfigPath, specifier);\n\t\t} catch {\n\t\t\tif (!looksLikeFlowPath(specifier)) continue;\n\t\t\trecords.push({\n\t\t\t\tsource: \"inline-config\",\n\t\t\t\tscope: \"inline\",\n\t\t\t\tpath: \"env:OPENCODE_CONFIG_CONTENT\",\n\t\t\t\tspecifier,\n\t\t\t\tresolvedVersion: null,\n\t\t\t\townership: \"unknown-flow-like\",\n\t\t\t\tstatus: \"refused\",\n\t\t\t\treason: \"inline local Flow-like plugin specifier is invalid\",\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst local = await classifyLocalPlugin(\n\t\t\tlocalPath,\n\t\t\t\"inline-config\",\n\t\t\t\"inline\",\n\t\t\ttarget,\n\t\t\tspecifier,\n\t\t);\n\t\tif (local) records.push(local);\n\t}\n\treturn { records, issues };\n}\n\nasync function inspectPluginDirectory(\n\tdescriptor: PluginDirectoryDescriptor,\n\ttarget: string,\n): Promise<{ records: ActivationRecord[]; issues: ActivationIssue[] }> {\n\tconst records: ActivationRecord[] = [];\n\tconst issues: ActivationIssue[] = [];\n\tconst symlinkAncestor = await symlinkInPathRange(\n\t\tdescriptor.safetyRoot,\n\t\tdescriptor.path,\n\t);\n\tif (symlinkAncestor) {\n\t\tissues.push({\n\t\t\tsource: descriptor.source,\n\t\t\tpath: descriptor.path,\n\t\t\tcode: \"unsafe-symlink\",\n\t\t\tmessage: `plugin directory ancestor ${symlinkAncestor} is a symbolic link`,\n\t\t});\n\t\treturn { records, issues };\n\t}\n\tconst metadata = await optionalLstat(descriptor.path);\n\tif (!metadata) return { records, issues };\n\tif (metadata.isSymbolicLink() || !metadata.isDirectory()) {\n\t\tissues.push({\n\t\t\tsource: descriptor.source,\n\t\t\tpath: descriptor.path,\n\t\t\tcode: \"invalid-plugin-directory\",\n\t\t\tmessage: metadata.isSymbolicLink()\n\t\t\t\t? \"plugin directory symbolic link refused\"\n\t\t\t\t: \"plugin directory is not a real directory\",\n\t\t});\n\t\treturn { records, issues };\n\t}\n\tconst entries = await readdir(descriptor.path, { withFileTypes: true });\n\tfor (const entry of entries) {\n\t\tif (!LOCAL_PLUGIN_EXTENSION_PATTERN.test(entry.name)) continue;\n\t\tconst path = join(descriptor.path, entry.name);\n\t\tconst record = await classifyLocalPlugin(\n\t\t\tpath,\n\t\t\tdescriptor.source,\n\t\t\tdescriptor.scope,\n\t\t\ttarget,\n\t\t\tpath,\n\t\t);\n\t\tif (record) records.push(record);\n\t}\n\treturn { records, issues };\n}\n\nasync function inspectCacheArtifact(\n\tpath: string,\n\tspecifier: string,\n\ttarget: string,\n): Promise<FlowCacheArtifact> {\n\tconst metadata = await optionalLstat(path);\n\tif (!metadata?.isDirectory() || metadata.isSymbolicLink()) {\n\t\treturn {\n\t\t\tpath,\n\t\t\tspecifier,\n\t\t\tresolvedVersion: null,\n\t\t\tstatus: \"ambiguous\",\n\t\t\treason: \"cache artifact is not a real directory\",\n\t\t};\n\t}\n\tconst nodeModulesPath = join(path, \"node_modules\");\n\tconst packagePath = join(nodeModulesPath, FLOW_PACKAGE_NAME);\n\tconst manifestPath = join(packagePath, \"package.json\");\n\ttry {\n\t\tfor (const directory of [nodeModulesPath, packagePath]) {\n\t\t\tconst directoryMetadata = await lstat(directory);\n\t\t\tif (\n\t\t\t\tdirectoryMetadata.isSymbolicLink() ||\n\t\t\t\t!directoryMetadata.isDirectory()\n\t\t\t) {\n\t\t\t\tthrow new Error(\"nested package path is not a real directory\");\n\t\t\t}\n\t\t}\n\t\tconst manifest = JSON.parse(\n\t\t\tawait readRegularFileWithoutFollowing(manifestPath),\n\t\t) as { name?: unknown; version?: unknown };\n\t\tif (\n\t\t\tmanifest.name !== FLOW_PACKAGE_NAME ||\n\t\t\ttypeof manifest.version !== \"string\" ||\n\t\t\t!isExactFlowVersion(manifest.version)\n\t\t) {\n\t\t\tthrow new Error(\"nested package manifest does not prove a Flow version\");\n\t\t}\n\t\treturn {\n\t\t\tpath,\n\t\t\tspecifier,\n\t\t\tresolvedVersion: manifest.version,\n\t\t\tstatus: manifest.version === target ? \"target\" : \"inactive\",\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\tpath,\n\t\t\tspecifier,\n\t\t\tresolvedVersion: null,\n\t\t\tstatus: \"ambiguous\",\n\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t};\n\t}\n}\n\nasync function inspectCache(\n\tpaths: ActivationPaths,\n\ttarget: string,\n): Promise<{ artifacts: FlowCacheArtifact[]; issues: ActivationIssue[] }> {\n\tconst artifacts: FlowCacheArtifact[] = [];\n\tconst issues: ActivationIssue[] = [];\n\tconst symlinkAncestor = await symlinkInPathRange(\n\t\tdirname(paths.cacheRoot),\n\t\tpaths.packageCacheRoot,\n\t);\n\tif (symlinkAncestor) {\n\t\tissues.push({\n\t\t\tsource: \"cache\",\n\t\t\tpath: paths.packageCacheRoot,\n\t\t\tcode: \"unsafe-symlink\",\n\t\t\tmessage: `cache ancestor ${symlinkAncestor} is a symbolic link`,\n\t\t});\n\t\treturn { artifacts, issues };\n\t}\n\tconst metadata = await optionalLstat(paths.packageCacheRoot);\n\tif (!metadata) return { artifacts, issues };\n\tif (metadata.isSymbolicLink() || !metadata.isDirectory()) {\n\t\tissues.push({\n\t\t\tsource: \"cache\",\n\t\t\tpath: paths.packageCacheRoot,\n\t\t\tcode: \"ambiguous-cache-artifact\",\n\t\t\tmessage: \"OpenCode package cache root is not a real directory\",\n\t\t});\n\t\treturn { artifacts, issues };\n\t}\n\tfor (const entry of await readdir(paths.packageCacheRoot, {\n\t\twithFileTypes: true,\n\t})) {\n\t\tif (\n\t\t\tentry.name !== FLOW_PACKAGE_NAME &&\n\t\t\t!entry.name.startsWith(`${FLOW_PACKAGE_NAME}@`)\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst artifact = await inspectCacheArtifact(\n\t\t\tjoin(paths.packageCacheRoot, entry.name),\n\t\t\tentry.name,\n\t\t\ttarget,\n\t\t);\n\t\tartifacts.push(artifact);\n\t\tif (artifact.status === \"ambiguous\") {\n\t\t\tissues.push({\n\t\t\t\tsource: \"cache\",\n\t\t\t\tpath: artifact.path,\n\t\t\t\tcode: \"ambiguous-cache-artifact\",\n\t\t\t\tmessage:\n\t\t\t\t\tartifact.reason ?? \"cache artifact does not prove a Flow version\",\n\t\t\t});\n\t\t}\n\t}\n\treturn { artifacts, issues };\n}\n\nasync function activationLimitations(\n\tpaths: ActivationPaths,\n): Promise<ActivationLimitation[]> {\n\tconst limitations: ActivationLimitation[] = [\n\t\t{\n\t\t\tsource: \"remote-config\",\n\t\t\tcoverage: \"runtime-leadership\",\n\t\t\tblocking: false,\n\t\t\tdetail:\n\t\t\t\t\"Authenticated .well-known and organization API configs cannot be inspected offline; Flow runtime leadership detects duplicate loaded versions within each OpenCode project context and fails closed there.\",\n\t\t},\n\t];\n\tif (paths.managedPreferencePaths.length > 0) {\n\t\tconst detected: string[] = [];\n\t\tfor (const path of paths.managedPreferencePaths) {\n\t\t\ttry {\n\t\t\t\tif (await optionalLstat(path)) detected.push(path);\n\t\t\t} catch {\n\t\t\t\t// Preference files can be intentionally unreadable to an unprivileged\n\t\t\t\t// process. Preserve that uncertainty instead of failing the inventory.\n\t\t\t\tdetected.push(`${path} (unreadable)`);\n\t\t\t}\n\t\t}\n\t\tlimitations.push({\n\t\t\tsource: \"managed-preferences\",\n\t\t\tcoverage: \"runtime-leadership\",\n\t\t\tblocking: false,\n\t\t\tdetail:\n\t\t\t\tdetected.length > 0\n\t\t\t\t\t? `Detected managed preference source(s) ${detected.join(\", \")}; plist/MDM plugin values are not decoded by this dependency-free preflight, and runtime leadership fails closed on same-project duplicates.`\n\t\t\t\t\t: \"macOS MDM preferences may add runtime config outside readable JSON/JSONC files; Flow runtime leadership fails closed on duplicate loaded versions within each OpenCode project context.\",\n\t\t});\n\t}\n\treturn limitations;\n}\n\nfunction activationReasons(\n\trecords: ActivationRecord[],\n\tcacheArtifacts: FlowCacheArtifact[],\n\tissues: ActivationIssue[],\n\ttarget: string,\n): string[] {\n\tconst reasons = issues.map((issue) => `${issue.path}: ${issue.message}`);\n\tconst targetPins = records.filter(\n\t\t(record) =>\n\t\t\trecord.ownership === \"flow-npm\" &&\n\t\t\trecord.resolvedVersion === target &&\n\t\t\trecord.status === \"target\",\n\t);\n\tif (targetPins.length !== 1) {\n\t\treasons.push(\n\t\t\t`expected one exact ${FLOW_PACKAGE_NAME}@${target} activation, found ${targetPins.length}`,\n\t\t);\n\t}\n\tif (records.length !== 1) {\n\t\treasons.push(\n\t\t\t`expected one Flow activation source, found ${records.length}`,\n\t\t);\n\t}\n\tconst inactive = cacheArtifacts.filter(\n\t\t(artifact) => artifact.status === \"inactive\",\n\t);\n\tif (inactive.length > 0) {\n\t\treasons.push(`found ${inactive.length} inactive Flow cache artifact(s)`);\n\t}\n\treturn [...new Set(reasons)];\n}\n\nexport async function checkFlowActivation(options: {\n\tproject: string;\n\ttarget?: string;\n\tpaths?: ActivationPathOptions;\n\t/** @internal The journal for this in-process post-apply verification. */\n\tignoreRecoveryRunId?: string;\n}): Promise<ActivationCheckReport> {\n\tconst target = resolveActivationTarget(options.target);\n\tconst paths = resolveActivationPaths(options.project, options.paths);\n\tconst env = options.paths?.env ?? process.env;\n\tconst records: ActivationRecord[] = [];\n\tconst issues: ActivationIssue[] = [];\n\ttry {\n\t\tconst projectMetadata = await lstat(paths.project);\n\t\tif (projectMetadata.isSymbolicLink()) {\n\t\t\tissues.push({\n\t\t\t\tsource: \"project\",\n\t\t\t\tpath: paths.project,\n\t\t\t\tcode: \"unsafe-symlink\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"project root symbolic link refused for activation mutation safety\",\n\t\t\t});\n\t\t} else if (!projectMetadata.isDirectory()) {\n\t\t\tissues.push({\n\t\t\t\tsource: \"project\",\n\t\t\t\tpath: paths.project,\n\t\t\t\tcode: \"invalid-project\",\n\t\t\t\tmessage: \"project path is not a directory\",\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tissues.push({\n\t\t\tsource: \"project\",\n\t\t\tpath: paths.project,\n\t\t\tcode: \"invalid-project\",\n\t\t\tmessage:\n\t\t\t\t(error as NodeJS.ErrnoException).code === \"ENOENT\"\n\t\t\t\t\t? \"project path does not exist\"\n\t\t\t\t\t: error instanceof Error\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: String(error),\n\t\t});\n\t}\n\tfor (const descriptor of configDescriptors(paths)) {\n\t\ttry {\n\t\t\tconst inspected = await inspectConfig(descriptor, target);\n\t\t\trecords.push(...inspected.records);\n\t\t\tissues.push(...inspected.issues);\n\t\t} catch (error) {\n\t\t\tissues.push({\n\t\t\t\tsource: descriptor.source,\n\t\t\t\tpath: descriptor.path,\n\t\t\t\tcode: \"invalid-config\",\n\t\t\t\tmessage: `config could not be inspected safely: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t});\n\t\t}\n\t}\n\tif (env.OPENCODE_CONFIG_CONTENT?.trim()) {\n\t\tconst inspected = await inspectInlineConfig(\n\t\t\tenv.OPENCODE_CONFIG_CONTENT,\n\t\t\tpaths.project,\n\t\t\ttarget,\n\t\t);\n\t\trecords.push(...inspected.records);\n\t\tissues.push(...inspected.issues);\n\t}\n\tfor (const descriptor of pluginDirectoryDescriptors(paths)) {\n\t\ttry {\n\t\t\tconst inspected = await inspectPluginDirectory(descriptor, target);\n\t\t\trecords.push(...inspected.records);\n\t\t\tissues.push(...inspected.issues);\n\t\t} catch (error) {\n\t\t\tissues.push({\n\t\t\t\tsource: descriptor.source,\n\t\t\t\tpath: descriptor.path,\n\t\t\t\tcode: \"invalid-plugin-directory\",\n\t\t\t\tmessage: `plugin directory could not be inspected safely: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t});\n\t\t}\n\t}\n\tlet cache: Awaited<ReturnType<typeof inspectCache>>;\n\ttry {\n\t\tcache = await inspectCache(paths, target);\n\t} catch (error) {\n\t\tcache = {\n\t\t\tartifacts: [],\n\t\t\tissues: [\n\t\t\t\t{\n\t\t\t\t\tsource: \"cache\",\n\t\t\t\t\tpath: paths.packageCacheRoot,\n\t\t\t\t\tcode: \"ambiguous-cache-artifact\",\n\t\t\t\t\tmessage: `package cache could not be inspected safely: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\tissues.push(...cache.issues);\n\tissues.push(\n\t\t...(await activationJournalIssues(paths, options.ignoreRecoveryRunId)),\n\t);\n\tconst limitations = await activationLimitations(paths);\n\tconst reasons = activationReasons(records, cache.artifacts, issues, target);\n\treturn {\n\t\tmode: \"check\",\n\t\tproject: paths.project,\n\t\ttarget,\n\t\tcoverage: {\n\t\t\tglobalSources: true,\n\t\t\tselectedProject: paths.project,\n\t\t\totherProjectTrees: false,\n\t\t},\n\t\tpaths,\n\t\trecords,\n\t\tcacheArtifacts: cache.artifacts,\n\t\tissues,\n\t\tlimitations,\n\t\tsingleVersionSatisfied: reasons.length === 0,\n\t\treasons,\n\t};\n}\n\nfunction detectIndent(content: string): string {\n\treturn /\\n([ \\t]+)\"/.exec(content)?.[1] ?? \"\\t\";\n}\n\nasync function readConfigSnapshot(\n\tdescriptor: ConfigDescriptor,\n): Promise<StrictConfigSnapshot> {\n\tconst metadata = await optionalLstat(descriptor.path);\n\tif (!metadata) {\n\t\treturn {\n\t\t\tdescriptor,\n\t\t\texists: false,\n\t\t\tcontent: null,\n\t\t\tdigest: null,\n\t\t\tvalue: {},\n\t\t\tplugin: [],\n\t\t\tformat: \"strict-json\",\n\t\t\tindent: \"\\t\",\n\t\t\tnewline: \"\\n\",\n\t\t\tfinalNewline: true,\n\t\t\tmode: 0o600,\n\t\t};\n\t}\n\tif (metadata.isSymbolicLink() || !metadata.isFile()) {\n\t\tthrow new Error(`${descriptor.path}: config must be a regular file`);\n\t}\n\tawait assertSafeMutationPath(descriptor.safetyRoot, descriptor.path);\n\tconst content = await readRegularFileWithoutFollowing(descriptor.path);\n\tlet parsed: ReturnType<typeof parseConfigContent>;\n\ttry {\n\t\tparsed = parseConfigContent(content);\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`${descriptor.path}: config cannot be conservatively parsed as JSON/JSONC: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t}\n\treturn {\n\t\tdescriptor,\n\t\texists: true,\n\t\tcontent,\n\t\tdigest: sha256(content),\n\t\tvalue: parsed.value,\n\t\tplugin: parsed.plugin,\n\t\tformat: parsed.format,\n\t\tindent: detectIndent(content),\n\t\tnewline: content.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\",\n\t\tfinalNewline: content.endsWith(\"\\n\"),\n\t\tmode: metadata.mode & 0o777,\n\t};\n}\n\nfunction updatedConfigContent(\n\tsnapshot: StrictConfigSnapshot,\n\tentries: PluginSpec[],\n): string {\n\tconst value = { ...snapshot.value, plugin: entries };\n\tlet content = JSON.stringify(value, null, snapshot.indent).replaceAll(\n\t\t\"\\n\",\n\t\tsnapshot.newline,\n\t);\n\tif (snapshot.finalNewline) content += snapshot.newline;\n\treturn content;\n}\n\nfunction wrapperRecoveryRoot(\n\tpaths: ActivationPaths,\n\twrapper: OwnedWrapper,\n): string {\n\tif (\n\t\t[\n\t\t\t\"global-config\",\n\t\t\t\"project-config\",\n\t\t\t\"project-directory-config\",\n\t\t\t\"custom-config\",\n\t\t\t\"custom-directory-config\",\n\t\t].includes(wrapper.source)\n\t) {\n\t\treturn join(dirname(wrapper.path), \".flow-activation-recovery\");\n\t}\n\tif (wrapper.source === \"home-plugin-directory\") {\n\t\treturn join(paths.home, \".opencode\", \"flow-activation-recovery\");\n\t}\n\tif (wrapper.scope === \"global\") return paths.globalWrapperRecoveryRoot;\n\tif (wrapper.scope === \"custom\" && paths.customConfigDirectory) {\n\t\treturn join(paths.customConfigDirectory, \"flow-activation-recovery\");\n\t}\n\treturn paths.projectWrapperRecoveryRoot;\n}\n\nfunction wrapperMutationSafetyRoot(\n\tpaths: ActivationPaths,\n\twrapper: OwnedWrapper,\n): string {\n\tconst directory = pluginDirectoryDescriptors(paths).find((descriptor) => {\n\t\tif (descriptor.source !== wrapper.source) return false;\n\t\tconst fromDirectory = relative(descriptor.path, wrapper.path);\n\t\treturn (\n\t\t\tfromDirectory !== \"..\" &&\n\t\t\t!fromDirectory.startsWith(`..${sep}`) &&\n\t\t\t!isAbsolute(fromDirectory)\n\t\t);\n\t});\n\tif (directory) return directory.safetyRoot;\n\tconst config = configDescriptors(paths).find(\n\t\t(descriptor) => descriptor.source === wrapper.source,\n\t);\n\treturn config?.safetyRoot ?? dirname(wrapper.path);\n}\n\nfunction uniqueOwnedWrappers(records: ActivationRecord[]): OwnedWrapper[] {\n\tconst wrappers = new Map<string, OwnedWrapper>();\n\tfor (const record of records) {\n\t\tif (\n\t\t\t(record.ownership !== \"marker-owned-wrapper\" &&\n\t\t\t\trecord.ownership !== \"legacy-flow-wrapper\") ||\n\t\t\trecord.resolvedVersion === null\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\t\twrappers.set(record.path, {\n\t\t\tpath: record.path,\n\t\t\tscope: record.scope,\n\t\t\tsource: record.source,\n\t\t\tversion: record.resolvedVersion,\n\t\t\townership: record.ownership,\n\t\t});\n\t}\n\treturn [...wrappers.values()];\n}\n\nfunction removableConfigEntry(\n\tentry: PluginSpec,\n\tdescriptor: ConfigDescriptor,\n\trecords: ActivationRecord[],\n): boolean {\n\tconst specifier = pluginSpecifier(entry);\n\tif (parseFlowNpmSpecifier(specifier).isFlow) return true;\n\tif (!isLocalPluginSpecifier(specifier) && !looksLikeFlowPath(specifier)) {\n\t\treturn false;\n\t}\n\tlet localPath: string;\n\ttry {\n\t\tlocalPath = relativeLocalSpecifier(descriptor.path, specifier);\n\t} catch {\n\t\treturn false;\n\t}\n\treturn records.some(\n\t\t(record) =>\n\t\t\trecord.source === descriptor.source &&\n\t\t\trecord.specifier === specifier &&\n\t\t\trecord.path === localPath &&\n\t\t\t(record.ownership === \"marker-owned-wrapper\" ||\n\t\t\t\trecord.ownership === \"legacy-flow-wrapper\"),\n\t);\n}\n\nfunction activationRefusals(before: ActivationCheckReport): string[] {\n\treturn [\n\t\t...before.issues.map((issue) => `${issue.path}: ${issue.message}`),\n\t\t...before.records\n\t\t\t.filter((record) => record.ownership === \"unknown-flow-like\")\n\t\t\t.map(\n\t\t\t\t(record) =>\n\t\t\t\t\t`${record.path}: ${record.reason ?? \"unknown Flow-like activation refused\"}`,\n\t\t\t),\n\t\t...before.cacheArtifacts\n\t\t\t.filter((artifact) => artifact.status === \"ambiguous\")\n\t\t\t.map(\n\t\t\t\t(artifact) =>\n\t\t\t\t\t`${artifact.path}: ${artifact.reason ?? \"ambiguous cache artifact refused\"}`,\n\t\t\t),\n\t];\n}\n\nfunction downgradeRefusals(before: ActivationCheckReport): string[] {\n\tconst newerVersions = new Set<string>();\n\tfor (const version of [\n\t\t...before.records.map((record) => record.resolvedVersion),\n\t\t...before.cacheArtifacts.map((artifact) => artifact.resolvedVersion),\n\t]) {\n\t\tif (version && compareSemanticVersions(version, before.target) > 0) {\n\t\t\tnewerVersions.add(version);\n\t\t}\n\t}\n\treturn [...newerVersions]\n\t\t.sort((left, right) => compareSemanticVersions(right, left))\n\t\t.map(\n\t\t\t(version) =>\n\t\t\t\t`refusing to replace newer installed Flow ${version} with older target ${before.target}; run ${FLOW_PACKAGE_NAME}@latest instead`,\n\t\t);\n}\n\nasync function assertUnchangedConfig(\n\tsnapshot: StrictConfigSnapshot,\n): Promise<void> {\n\tawait assertSafeMutationPath(\n\t\tsnapshot.descriptor.safetyRoot,\n\t\tsnapshot.descriptor.path,\n\t);\n\tconst metadata = await optionalLstat(snapshot.descriptor.path);\n\tif (!snapshot.exists) {\n\t\tif (metadata) {\n\t\t\tthrow new Error(\n\t\t\t\t`${snapshot.descriptor.path}: config appeared while activation was running`,\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\tif (!metadata?.isFile() || metadata.isSymbolicLink()) {\n\t\tthrow new Error(\n\t\t\t`${snapshot.descriptor.path}: config changed while activation was running`,\n\t\t);\n\t}\n\tconst current = await readRegularFileWithoutFollowing(\n\t\tsnapshot.descriptor.path,\n\t);\n\tif (sha256(current) !== snapshot.digest) {\n\t\tthrow new Error(\n\t\t\t`${snapshot.descriptor.path}: config changed while activation was running`,\n\t\t);\n\t}\n}\n\nasync function atomicWriteConfig(\n\tsnapshot: StrictConfigSnapshot,\n\tcontent: string,\n\trunId: string,\n): Promise<void> {\n\tawait assertUnchangedConfig(snapshot);\n\tawait mkdir(dirname(snapshot.descriptor.path), { recursive: true });\n\tawait assertSafeMutationPath(\n\t\tsnapshot.descriptor.safetyRoot,\n\t\tsnapshot.descriptor.path,\n\t);\n\tconst temporaryPath = join(\n\t\tdirname(snapshot.descriptor.path),\n\t\t`.${basename(snapshot.descriptor.path)}.flow-${runId}.tmp`,\n\t);\n\ttry {\n\t\tawait writeFile(temporaryPath, content, {\n\t\t\tencoding: \"utf8\",\n\t\t\tflag: \"wx\",\n\t\t\tmode: snapshot.mode,\n\t\t});\n\t\tawait rename(temporaryPath, snapshot.descriptor.path);\n\t} finally {\n\t\tawait rm(temporaryPath, { force: true });\n\t}\n}\n\nasync function configIsWritable(\n\tsnapshot: StrictConfigSnapshot,\n): Promise<boolean> {\n\tif (!snapshot.descriptor.mutable) return false;\n\ttry {\n\t\tawait assertSafeMutationPath(\n\t\t\tsnapshot.descriptor.safetyRoot,\n\t\t\tsnapshot.descriptor.path,\n\t\t);\n\t\tif (snapshot.exists) {\n\t\t\tawait access(snapshot.descriptor.path, constants.W_OK);\n\t\t\treturn true;\n\t\t}\n\t\tlet parent = dirname(snapshot.descriptor.path);\n\t\twhile (!(await optionalLstat(parent))) {\n\t\t\tconst next = dirname(parent);\n\t\t\tif (next === parent) return false;\n\t\t\tparent = next;\n\t\t}\n\t\tawait access(parent, constants.W_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function pathCanBeMoved(\n\tsource: string,\n\tdestinationRoot: string,\n): Promise<boolean> {\n\ttry {\n\t\tawait access(dirname(source), constants.W_OK);\n\t\tlet parent = destinationRoot;\n\t\twhile (!(await optionalLstat(parent))) {\n\t\t\tconst next = dirname(parent);\n\t\t\tif (next === parent) return false;\n\t\t\tparent = next;\n\t\t}\n\t\tawait access(parent, constants.W_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function writeJournal(\n\tjournalPath: string,\n\tjournal: ActivationJournal,\n): Promise<void> {\n\tawait mkdir(dirname(journalPath), { recursive: true, mode: 0o700 });\n\tconst temporaryPath = `${journalPath}.${randomUUID()}.tmp`;\n\ttry {\n\t\tawait writeFile(temporaryPath, `${JSON.stringify(journal, null, 2)}\\n`, {\n\t\t\tencoding: \"utf8\",\n\t\t\tflag: \"wx\",\n\t\t\tmode: 0o600,\n\t\t});\n\t\tawait rename(temporaryPath, journalPath);\n\t} finally {\n\t\tawait rm(temporaryPath, { force: true });\n\t}\n}\n\ntype ActivationJournalEntry = {\n\tjournalPath: string;\n\tjournal?: ReadActivationJournal;\n\terror?: string;\n};\n\nconst TERMINAL_JOURNAL_STATES = new Set<ActivationJournal[\"state\"]>([\n\t\"complete\",\n\t\"rolled-back\",\n]);\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction parseActivationJournal(\n\tcontent: string,\n\tjournalPath: string,\n): ReadActivationJournal {\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(content);\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`${journalPath}: recovery journal is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t}\n\tif (\n\t\t!isRecord(value) ||\n\t\ttypeof value.runId !== \"string\" ||\n\t\tvalue.runId !== basename(dirname(journalPath)) ||\n\t\ttypeof value.state !== \"string\"\n\t) {\n\t\tthrow new Error(`${journalPath}: recovery journal schema is invalid`);\n\t}\n\tif (value.format === \"flow-activation-journal-v1\") {\n\t\tif (\n\t\t\t![\n\t\t\t\t\"prepared\",\n\t\t\t\t\"applying\",\n\t\t\t\t\"complete\",\n\t\t\t\t\"failed\",\n\t\t\t\t\"rolled-back\",\n\t\t\t\t\"rollback-failed\",\n\t\t\t].includes(value.state)\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t`${journalPath}: legacy recovery journal state is invalid`,\n\t\t\t);\n\t\t}\n\t\treturn value as LegacyActivationJournal;\n\t}\n\tif (\n\t\tvalue.format !== \"flow-activation-journal-v2\" ||\n\t\ttypeof value.createdAt !== \"string\" ||\n\t\ttypeof value.project !== \"string\" ||\n\t\t!isAbsolute(value.project) ||\n\t\ttypeof value.target !== \"string\" ||\n\t\t!isExactFlowVersion(value.target) ||\n\t\t(value.scope !== \"global\" && value.scope !== \"project\") ||\n\t\t![\n\t\t\t\"prepared\",\n\t\t\t\"applying\",\n\t\t\t\"committed\",\n\t\t\t\"complete\",\n\t\t\t\"failed\",\n\t\t\t\"cleanup-failed\",\n\t\t\t\"rolled-back\",\n\t\t\t\"rollback-failed\",\n\t\t].includes(value.state) ||\n\t\t!Array.isArray(value.actions)\n\t) {\n\t\tthrow new Error(`${journalPath}: recovery journal schema is invalid`);\n\t}\n\tfor (const action of value.actions) {\n\t\tif (\n\t\t\t!isRecord(action) ||\n\t\t\t![\"rewrite-config\", \"remove-wrapper\", \"remove-cache\"].includes(\n\t\t\t\tString(action.action),\n\t\t\t) ||\n\t\t\ttypeof action.path !== \"string\" ||\n\t\t\t!isAbsolute(action.path) ||\n\t\t\t![\"pending\", \"complete\", \"rolled-back\", \"rollback-failed\"].includes(\n\t\t\t\tString(action.state),\n\t\t\t)\n\t\t) {\n\t\t\tthrow new Error(`${journalPath}: recovery journal action is invalid`);\n\t\t}\n\t}\n\tif (\n\t\tvalue.ownerPid !== undefined &&\n\t\t(!Number.isSafeInteger(value.ownerPid) || Number(value.ownerPid) <= 0)\n\t) {\n\t\tthrow new Error(`${journalPath}: recovery journal owner pid is invalid`);\n\t}\n\treturn value as ActivationJournal;\n}\n\nasync function readActivationJournalEntries(\n\tpaths: ActivationPaths,\n): Promise<ActivationJournalEntry[]> {\n\ttry {\n\t\tawait assertSafeMutationPath(dirname(paths.configRoot), paths.journalRoot);\n\t} catch (error) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tjournalPath: paths.journalRoot,\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t},\n\t\t];\n\t}\n\tconst rootMetadata = await optionalLstat(paths.journalRoot);\n\tif (!rootMetadata) return [];\n\tif (rootMetadata.isSymbolicLink() || !rootMetadata.isDirectory()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tjournalPath: paths.journalRoot,\n\t\t\t\terror: `${paths.journalRoot}: recovery root is not a real directory`,\n\t\t\t},\n\t\t];\n\t}\n\tconst entries: ActivationJournalEntry[] = [];\n\tfor (const directory of await readdir(paths.journalRoot, {\n\t\twithFileTypes: true,\n\t})) {\n\t\tconst runRoot = join(paths.journalRoot, directory.name);\n\t\tconst journalPath = join(runRoot, \"journal.json\");\n\t\tif (directory.isSymbolicLink()) {\n\t\t\tentries.push({\n\t\t\t\tjournalPath,\n\t\t\t\terror: `${runRoot}: symbolic recovery directory refused`,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (!directory.isDirectory() || !(await optionalLstat(journalPath))) {\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\tconst content = await readRegularFileWithoutFollowing(\n\t\t\t\tjournalPath,\n\t\t\t\tMAX_LOCAL_PLUGIN_BYTES,\n\t\t\t);\n\t\t\tentries.push({\n\t\t\t\tjournalPath,\n\t\t\t\tjournal: parseActivationJournal(content, journalPath),\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tentries.push({\n\t\t\t\tjournalPath,\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t}\n\t}\n\treturn entries.sort((left, right) =>\n\t\tleft.journalPath.localeCompare(right.journalPath),\n\t);\n}\n\nfunction processIsAlive(pid: number): boolean {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn (error as NodeJS.ErrnoException).code === \"EPERM\";\n\t}\n}\n\nasync function activationJournalIssues(\n\tpaths: ActivationPaths,\n\tignoreRunId?: string,\n): Promise<ActivationIssue[]> {\n\tconst issues: ActivationIssue[] = [];\n\tfor (const entry of await readActivationJournalEntries(paths)) {\n\t\tif (entry.error) {\n\t\t\tissues.push({\n\t\t\t\tsource: \"recovery\",\n\t\t\t\tpath: entry.journalPath,\n\t\t\t\tcode: \"incomplete-recovery\",\n\t\t\t\tmessage: entry.error,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst journal = entry.journal as ReadActivationJournal;\n\t\tif (\n\t\t\tjournal.runId === ignoreRunId ||\n\t\t\tTERMINAL_JOURNAL_STATES.has(journal.state)\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst activeOwner =\n\t\t\tjournal.format === \"flow-activation-journal-v2\" &&\n\t\t\tjournal.ownerPid !== undefined &&\n\t\t\tprocessIsAlive(journal.ownerPid);\n\t\tissues.push({\n\t\t\tsource: \"recovery\",\n\t\t\tpath: entry.journalPath,\n\t\t\tcode: \"incomplete-recovery\",\n\t\t\tmessage: activeOwner\n\t\t\t\t? `activation recovery is still owned by running process ${journal.ownerPid}`\n\t\t\t\t: journal.format === \"flow-activation-journal-v1\"\n\t\t\t\t\t? `legacy activation recovery is incomplete in state ${journal.state}; follow that journal's manual recovery guidance before installing`\n\t\t\t\t\t: journal.state === \"rollback-failed\"\n\t\t\t\t\t\t? \"activation rollback previously failed and requires the journal's manual recovery guidance\"\n\t\t\t\t\t\t: `activation recovery is incomplete in state ${journal.state}; rerun install to reconcile it before evaluating success`,\n\t\t});\n\t}\n\treturn issues;\n}\n\nasync function verifyOwnedWrapper(wrapper: OwnedWrapper): Promise<void> {\n\tconst content = await readRegularFileWithoutFollowing(\n\t\twrapper.path,\n\t\tMAX_LOCAL_PLUGIN_BYTES,\n\t);\n\tconst version =\n\t\twrapper.ownership === \"marker-owned-wrapper\"\n\t\t\t? (() => {\n\t\t\t\t\tconst parsed = parseOwnedWrapper(content);\n\t\t\t\t\treturn parsed.kind === \"owned\" ? parsed.version : null;\n\t\t\t\t})()\n\t\t\t: parseLegacyFlowWrapper(wrapper.path, content)?.version;\n\tif (version !== wrapper.version) {\n\t\tthrow new Error(\n\t\t\t`${wrapper.path}: removable wrapper changed while activation was running`,\n\t\t);\n\t}\n}\n\nasync function verifyCacheArtifact(\n\tartifact: FlowCacheArtifact,\n\ttarget: string,\n): Promise<void> {\n\tconst inspected = await inspectCacheArtifact(\n\t\tartifact.path,\n\t\tartifact.specifier,\n\t\ttarget,\n\t);\n\tif (\n\t\tinspected.status !== \"inactive\" ||\n\t\tinspected.resolvedVersion !== artifact.resolvedVersion\n\t) {\n\t\tthrow new Error(\n\t\t\t`${artifact.path}: cache artifact changed while activation was running`,\n\t\t);\n\t}\n}\n\nasync function replaceKnownConfigContent(options: {\n\tdescriptor: ConfigDescriptor;\n\texpectedDigest: string;\n\tcontent: string;\n\tmode: number;\n\trunId: string;\n}): Promise<void> {\n\tawait assertSafeMutationPath(\n\t\toptions.descriptor.safetyRoot,\n\t\toptions.descriptor.path,\n\t);\n\tconst current = await readRegularFileWithoutFollowing(\n\t\toptions.descriptor.path,\n\t);\n\tif (sha256(current) !== options.expectedDigest) {\n\t\tthrow new Error(\n\t\t\t`${options.descriptor.path}: automatic restore refused because the applied config changed`,\n\t\t);\n\t}\n\tconst temporaryPath = join(\n\t\tdirname(options.descriptor.path),\n\t\t`.${basename(options.descriptor.path)}.restore-${options.runId}.tmp`,\n\t);\n\ttry {\n\t\tawait writeFile(temporaryPath, options.content, {\n\t\t\tencoding: \"utf8\",\n\t\t\tflag: \"wx\",\n\t\t\tmode: options.mode,\n\t\t});\n\t\tawait rename(temporaryPath, options.descriptor.path);\n\t} finally {\n\t\tawait rm(temporaryPath, { force: true });\n\t}\n}\n\nasync function rollbackCompletedActions(options: {\n\tjournal: ActivationJournal;\n\tjournalPath: string;\n\trunId: string;\n\tsnapshots: StrictConfigSnapshot[];\n\tpaths: ActivationPaths;\n\twrappers: OwnedWrapper[];\n}): Promise<string[]> {\n\tconst failures: string[] = [];\n\tfor (const action of options.journal.actions.toReversed()) {\n\t\tif (action.state !== \"complete\") continue;\n\t\ttry {\n\t\t\tif (action.action === \"rewrite-config\") {\n\t\t\t\tconst snapshot = options.snapshots.find(\n\t\t\t\t\t(candidate) => candidate.descriptor.path === action.path,\n\t\t\t\t);\n\t\t\t\tif (!snapshot || !action.appliedDigest) {\n\t\t\t\t\tthrow new Error(\"restore metadata is incomplete\");\n\t\t\t\t}\n\t\t\t\tif (action.originalAbsent) {\n\t\t\t\t\tawait assertSafeMutationPath(\n\t\t\t\t\t\tsnapshot.descriptor.safetyRoot,\n\t\t\t\t\t\taction.path,\n\t\t\t\t\t);\n\t\t\t\t\tconst current = await readRegularFileWithoutFollowing(action.path);\n\t\t\t\t\tif (sha256(current) !== action.appliedDigest) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\"created config changed after apply; automatic removal refused\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (!action.recoveryPath) {\n\t\t\t\t\t\tthrow new Error(\"created config recovery path is missing\");\n\t\t\t\t\t}\n\t\t\t\t\tawait assertSafeMutationPath(\n\t\t\t\t\t\tsnapshot.descriptor.safetyRoot,\n\t\t\t\t\t\taction.recoveryPath,\n\t\t\t\t\t);\n\t\t\t\t\tawait mkdir(dirname(action.recoveryPath), {\n\t\t\t\t\t\trecursive: true,\n\t\t\t\t\t\tmode: 0o700,\n\t\t\t\t\t});\n\t\t\t\t\tawait rename(action.path, action.recoveryPath);\n\t\t\t\t} else {\n\t\t\t\t\tif (!action.backupPath) throw new Error(\"config backup is missing\");\n\t\t\t\t\tconst backup = await readRegularFileWithoutFollowing(\n\t\t\t\t\t\taction.backupPath,\n\t\t\t\t\t);\n\t\t\t\t\tawait replaceKnownConfigContent({\n\t\t\t\t\t\tdescriptor: snapshot.descriptor,\n\t\t\t\t\t\texpectedDigest: action.appliedDigest,\n\t\t\t\t\t\tcontent: backup,\n\t\t\t\t\t\tmode: action.originalMode ?? snapshot.mode,\n\t\t\t\t\t\trunId: options.runId,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\taction.action === \"remove-wrapper\" ||\n\t\t\t\taction.action === \"remove-cache\"\n\t\t\t) {\n\t\t\t\tif (!action.stagingPath) throw new Error(\"staging path is missing\");\n\t\t\t\tlet safetyRoot: string;\n\t\t\t\tif (action.action === \"remove-cache\") {\n\t\t\t\t\tsafetyRoot = dirname(options.paths.cacheRoot);\n\t\t\t\t} else {\n\t\t\t\t\tconst wrapper = options.wrappers.find(\n\t\t\t\t\t\t(candidate) => candidate.path === action.path,\n\t\t\t\t\t);\n\t\t\t\t\tif (!wrapper) throw new Error(\"wrapper safety metadata is missing\");\n\t\t\t\t\tsafetyRoot = wrapperMutationSafetyRoot(options.paths, wrapper);\n\t\t\t\t}\n\t\t\t\tawait assertSafeMutationPath(safetyRoot, action.path);\n\t\t\t\tawait assertSafeMutationPath(safetyRoot, action.stagingPath);\n\t\t\t\tif (await optionalLstat(action.path)) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"original path is occupied; automatic restore refused\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst staged = await optionalLstat(action.stagingPath);\n\t\t\t\tif (!staged || staged.isSymbolicLink()) {\n\t\t\t\t\tthrow new Error(\"staged artifact is missing or symbolic\");\n\t\t\t\t}\n\t\t\t\tawait mkdir(dirname(action.path), { recursive: true });\n\t\t\t\tawait rename(action.stagingPath, action.path);\n\t\t\t}\n\t\t\taction.state = \"rolled-back\";\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\taction.state = \"rollback-failed\";\n\t\t\taction.error = message;\n\t\t\tfailures.push(`${action.path}: ${message}`);\n\t\t}\n\t\ttry {\n\t\t\tawait writeJournal(options.journalPath, options.journal);\n\t\t} catch (error) {\n\t\t\tfailures.push(\n\t\t\t\t`journal update: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t);\n\t\t}\n\t}\n\treturn failures;\n}\n\nfunction journalConfigDescriptor(\n\tpaths: ActivationPaths,\n\taction: JournalAction,\n): ConfigDescriptor {\n\tconst descriptor = configDescriptors(paths).find(\n\t\t(candidate) =>\n\t\t\tcandidate.path === action.path &&\n\t\t\t(action.source === undefined || candidate.source === action.source),\n\t);\n\tif (!descriptor) {\n\t\tthrow new Error(`${action.path}: journal config path is outside inventory`);\n\t}\n\treturn descriptor;\n}\n\nfunction journalOwnedWrapper(\n\tpaths: ActivationPaths,\n\tjournal: ActivationJournal,\n\taction: JournalAction,\n): { wrapper: OwnedWrapper; safetyRoot: string } {\n\tif (\n\t\t(action.ownership !== \"marker-owned-wrapper\" &&\n\t\t\taction.ownership !== \"legacy-flow-wrapper\") ||\n\t\ttypeof action.resolvedVersion !== \"string\" ||\n\t\t!isExactFlowVersion(action.resolvedVersion) ||\n\t\ttypeof action.source !== \"string\" ||\n\t\ttypeof action.scope !== \"string\"\n\t) {\n\t\tthrow new Error(`${action.path}: wrapper recovery metadata is incomplete`);\n\t}\n\tconst wrapper: OwnedWrapper = {\n\t\tpath: action.path,\n\t\tsource: action.source as ActivationSource,\n\t\tscope: action.scope as ActivationRecordScope,\n\t\tversion: action.resolvedVersion,\n\t\townership: action.ownership,\n\t};\n\tconst pluginDirectory = pluginDirectoryDescriptors(paths).find(\n\t\t(descriptor) =>\n\t\t\tdescriptor.source === wrapper.source &&\n\t\t\tdescriptor.scope === wrapper.scope &&\n\t\t\tdirname(wrapper.path) === descriptor.path,\n\t);\n\tconst config = configDescriptors(paths).find((descriptor) => {\n\t\tif (\n\t\t\tdescriptor.source !== wrapper.source ||\n\t\t\tdescriptor.scope !== wrapper.scope\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\tconst fromRoot = relative(descriptor.safetyRoot, wrapper.path);\n\t\treturn (\n\t\t\tfromRoot !== \"..\" &&\n\t\t\t!fromRoot.startsWith(`..${sep}`) &&\n\t\t\t!isAbsolute(fromRoot)\n\t\t);\n\t});\n\tconst safetyRoot = pluginDirectory?.safetyRoot ?? config?.safetyRoot;\n\tif (!safetyRoot) {\n\t\tthrow new Error(`${action.path}: wrapper path is outside inventory`);\n\t}\n\tconst expectedStagingPath = join(\n\t\twrapperRecoveryRoot(paths, wrapper),\n\t\tjournal.runId,\n\t\tsha256(action.path).slice(0, 12),\n\t\tbasename(action.path),\n\t);\n\tif (action.stagingPath !== expectedStagingPath) {\n\t\tthrow new Error(\n\t\t\t`${action.path}: wrapper staging path does not match journal`,\n\t\t);\n\t}\n\treturn { wrapper, safetyRoot };\n}\n\nfunction journalCacheArtifact(\n\tpaths: ActivationPaths,\n\tjournal: ActivationJournal,\n\taction: JournalAction,\n): FlowCacheArtifact {\n\tif (\n\t\ttypeof action.specifier !== \"string\" ||\n\t\t(action.specifier !== FLOW_PACKAGE_NAME &&\n\t\t\t!action.specifier.startsWith(`${FLOW_PACKAGE_NAME}@`)) ||\n\t\taction.specifier.includes(\"/\") ||\n\t\taction.specifier.includes(\"\\\\\") ||\n\t\ttypeof action.resolvedVersion !== \"string\" ||\n\t\t!isExactFlowVersion(action.resolvedVersion) ||\n\t\taction.path !== join(paths.packageCacheRoot, action.specifier)\n\t) {\n\t\tthrow new Error(`${action.path}: cache recovery metadata is incomplete`);\n\t}\n\tconst expectedStagingPath = join(\n\t\tpaths.cacheRecoveryRoot,\n\t\tjournal.runId,\n\t\tsha256(action.path).slice(0, 12),\n\t\tbasename(action.path),\n\t);\n\tif (action.stagingPath !== expectedStagingPath) {\n\t\tthrow new Error(\n\t\t\t`${action.path}: cache staging path does not match journal`,\n\t\t);\n\t}\n\treturn {\n\t\tpath: action.path,\n\t\tspecifier: action.specifier,\n\t\tresolvedVersion: action.resolvedVersion,\n\t\tstatus: \"inactive\",\n\t};\n}\n\nasync function rollbackInterruptedConfigAction(options: {\n\tjournal: ActivationJournal;\n\tjournalPath: string;\n\taction: JournalAction;\n\tpaths: ActivationPaths;\n}): Promise<void> {\n\tconst { action, journal, journalPath, paths } = options;\n\tconst descriptor = journalConfigDescriptor(paths, action);\n\tawait assertSafeMutationPath(descriptor.safetyRoot, action.path);\n\tconst currentMetadata = await optionalLstat(action.path);\n\tif (\n\t\tcurrentMetadata?.isSymbolicLink() ||\n\t\t(currentMetadata && !currentMetadata.isFile())\n\t) {\n\t\tthrow new Error(`${action.path}: interrupted config is not a regular file`);\n\t}\n\tconst current = currentMetadata\n\t\t? await readRegularFileWithoutFollowing(action.path)\n\t\t: null;\n\tif (action.originalAbsent === true) {\n\t\tconst expectedRecoveryPath = join(\n\t\t\tdirname(action.path),\n\t\t\t\".flow-activation-recovery\",\n\t\t\tjournal.runId,\n\t\t\t`${basename(action.path)}-${sha256(action.path).slice(0, 12)}`,\n\t\t);\n\t\tif (action.recoveryPath !== expectedRecoveryPath) {\n\t\t\tthrow new Error(\n\t\t\t\t`${action.path}: created-config recovery path is invalid`,\n\t\t\t);\n\t\t}\n\t\tif (current === null) return;\n\t\tif (!action.appliedDigest || sha256(current) !== action.appliedDigest) {\n\t\t\tthrow new Error(\n\t\t\t\t`${action.path}: interrupted created config changed; automatic recovery refused`,\n\t\t\t);\n\t\t}\n\t\tawait assertSafeMutationPath(descriptor.safetyRoot, action.recoveryPath);\n\t\tif (await optionalLstat(action.recoveryPath)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${action.path}: created-config recovery path is occupied`,\n\t\t\t);\n\t\t}\n\t\tawait mkdir(dirname(action.recoveryPath), {\n\t\t\trecursive: true,\n\t\t\tmode: 0o700,\n\t\t});\n\t\tawait rename(action.path, action.recoveryPath);\n\t\treturn;\n\t}\n\tconst expectedBackupPath = join(\n\t\tdirname(journalPath),\n\t\t\"configs\",\n\t\t`${descriptor.source}-${sha256(action.path).slice(0, 12)}.backup`,\n\t);\n\tif (action.backupPath !== expectedBackupPath) {\n\t\tthrow new Error(`${action.path}: config backup path is invalid`);\n\t}\n\tconst backup = await readRegularFileWithoutFollowing(\n\t\taction.backupPath,\n\t\tMAX_LOCAL_PLUGIN_BYTES,\n\t);\n\tif (current === null) {\n\t\tthrow new Error(`${action.path}: interrupted config is missing`);\n\t}\n\tif (sha256(current) === sha256(backup)) return;\n\tif (!action.appliedDigest || sha256(current) !== action.appliedDigest) {\n\t\tthrow new Error(\n\t\t\t`${action.path}: interrupted config changed; automatic recovery refused`,\n\t\t);\n\t}\n\tawait replaceKnownConfigContent({\n\t\tdescriptor,\n\t\texpectedDigest: action.appliedDigest,\n\t\tcontent: backup,\n\t\tmode: action.originalMode ?? 0o600,\n\t\trunId: journal.runId,\n\t});\n}\n\nasync function rollbackInterruptedRemovalAction(options: {\n\tjournal: ActivationJournal;\n\taction: JournalAction;\n\tpaths: ActivationPaths;\n}): Promise<void> {\n\tconst { action, journal, paths } = options;\n\tlet safetyRoot: string;\n\tlet verifyStaged: () => Promise<void>;\n\tif (action.action === \"remove-wrapper\") {\n\t\tconst { wrapper, safetyRoot: wrapperSafetyRoot } = journalOwnedWrapper(\n\t\t\tpaths,\n\t\t\tjournal,\n\t\t\taction,\n\t\t);\n\t\tsafetyRoot = wrapperSafetyRoot;\n\t\tverifyStaged = () =>\n\t\t\tverifyOwnedWrapper({ ...wrapper, path: action.stagingPath as string });\n\t} else {\n\t\tconst artifact = journalCacheArtifact(paths, journal, action);\n\t\tsafetyRoot = dirname(paths.cacheRoot);\n\t\tverifyStaged = () =>\n\t\t\tverifyCacheArtifact(\n\t\t\t\t{ ...artifact, path: action.stagingPath as string },\n\t\t\t\tjournal.target,\n\t\t\t);\n\t}\n\tawait assertSafeMutationPath(safetyRoot, action.path);\n\tawait assertSafeMutationPath(safetyRoot, action.stagingPath as string);\n\tconst original = await optionalLstat(action.path);\n\tconst staged = await optionalLstat(action.stagingPath as string);\n\tif (original && staged) {\n\t\tthrow new Error(`${action.path}: both original and staged artifacts exist`);\n\t}\n\tif (original) {\n\t\tif (original.isSymbolicLink()) {\n\t\t\tthrow new Error(`${action.path}: restored artifact is symbolic`);\n\t\t}\n\t\treturn;\n\t}\n\tif (!staged || staged.isSymbolicLink()) {\n\t\tthrow new Error(`${action.path}: interrupted staged artifact is missing`);\n\t}\n\tawait verifyStaged();\n\tawait mkdir(dirname(action.path), { recursive: true });\n\tawait rename(action.stagingPath as string, action.path);\n}\n\nasync function rollbackInterruptedJournal(\n\tjournal: ActivationJournal,\n\tjournalPath: string,\n\tpaths: ActivationPaths,\n): Promise<void> {\n\tfor (const action of journal.actions.toReversed()) {\n\t\tif (action.state === \"rolled-back\") continue;\n\t\tif (action.action === \"rewrite-config\") {\n\t\t\tawait rollbackInterruptedConfigAction({\n\t\t\t\tjournal,\n\t\t\t\tjournalPath,\n\t\t\t\taction,\n\t\t\t\tpaths,\n\t\t\t});\n\t\t} else {\n\t\t\tawait rollbackInterruptedRemovalAction({ journal, action, paths });\n\t\t}\n\t\taction.state = \"rolled-back\";\n\t\tdelete action.error;\n\t\tawait writeJournal(journalPath, journal);\n\t}\n\tjournal.state = \"rolled-back\";\n\tdelete journal.ownerPid;\n\tdelete journal.error;\n\tawait writeJournal(journalPath, journal);\n}\n\nasync function finishCommittedJournalCleanup(\n\tjournal: ActivationJournal,\n\tjournalPath: string,\n\tpaths: ActivationPaths,\n): Promise<void> {\n\tconst removalActions = journal.actions.filter(\n\t\t(action) =>\n\t\t\taction.action === \"remove-wrapper\" || action.action === \"remove-cache\",\n\t);\n\tfor (const action of removalActions) {\n\t\tlet safetyRoot: string;\n\t\tlet verifyStaged: () => Promise<void>;\n\t\tif (action.action === \"remove-wrapper\") {\n\t\t\tconst { wrapper, safetyRoot: wrapperSafetyRoot } = journalOwnedWrapper(\n\t\t\t\tpaths,\n\t\t\t\tjournal,\n\t\t\t\taction,\n\t\t\t);\n\t\t\tsafetyRoot = wrapperSafetyRoot;\n\t\t\tverifyStaged = () =>\n\t\t\t\tverifyOwnedWrapper({ ...wrapper, path: action.stagingPath as string });\n\t\t} else {\n\t\t\tconst artifact = journalCacheArtifact(paths, journal, action);\n\t\t\tsafetyRoot = dirname(paths.cacheRoot);\n\t\t\tverifyStaged = () =>\n\t\t\t\tverifyCacheArtifact(\n\t\t\t\t\t{ ...artifact, path: action.stagingPath as string },\n\t\t\t\t\tjournal.target,\n\t\t\t\t);\n\t\t}\n\t\tawait assertSafeMutationPath(safetyRoot, action.path);\n\t\tawait assertSafeMutationPath(safetyRoot, action.stagingPath as string);\n\t\tif (await optionalLstat(action.path)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${action.path}: obsolete original path reappeared after activation commit`,\n\t\t\t);\n\t\t}\n\t\tif (await optionalLstat(action.stagingPath as string)) {\n\t\t\tawait verifyStaged();\n\t\t\tawait rm(action.stagingPath as string, {\n\t\t\t\trecursive: action.action === \"remove-cache\",\n\t\t\t});\n\t\t}\n\t\tif (await optionalLstat(action.stagingPath as string)) {\n\t\t\tthrow new Error(`${action.path}: obsolete staged artifact still exists`);\n\t\t}\n\t\taction.deleted = true;\n\t\tawait removeEmptyDirectory(dirname(action.stagingPath as string));\n\t\tawait writeJournal(journalPath, journal);\n\t}\n\tfor (const runDirectory of new Set(\n\t\tremovalActions.map((action) =>\n\t\t\tdirname(dirname(action.stagingPath as string)),\n\t\t),\n\t)) {\n\t\tawait removeEmptyDirectory(runDirectory);\n\t}\n\tawait removeEmptyDirectory(paths.cacheRecoveryRoot);\n\tjournal.state = \"complete\";\n\tdelete journal.ownerPid;\n\tdelete journal.error;\n\tawait writeJournal(journalPath, journal);\n}\n\nasync function reconcileIncompleteActivationJournals(\n\tpaths: ActivationPaths,\n\tpathOptions?: ActivationPathOptions,\n): Promise<string[]> {\n\tconst failures: string[] = [];\n\tfor (const entry of await readActivationJournalEntries(paths)) {\n\t\tif (entry.error) {\n\t\t\tfailures.push(\n\t\t\t\t`recovery journal could not be inspected safely at ${entry.journalPath}: ${entry.error}`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tconst journal = entry.journal as ReadActivationJournal;\n\t\tif (TERMINAL_JOURNAL_STATES.has(journal.state)) continue;\n\t\tif (journal.format === \"flow-activation-journal-v1\") {\n\t\t\tfailures.push(\n\t\t\t\t`${entry.journalPath}: legacy activation recovery is incomplete in state ${journal.state}; follow its manual recovery guidance before retrying`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tif (journal.ownerPid !== undefined && processIsAlive(journal.ownerPid)) {\n\t\t\tfailures.push(\n\t\t\t\t`${entry.journalPath}: activation is still owned by running process ${journal.ownerPid}`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tif (journal.state === \"rollback-failed\") {\n\t\t\tfailures.push(\n\t\t\t\t`${entry.journalPath}: previous rollback failed; follow its manual recovery guidance before retrying`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tconst journalPaths = resolveActivationPaths(journal.project, pathOptions);\n\t\tif (journalPaths.journalRoot !== paths.journalRoot) {\n\t\t\tfailures.push(\n\t\t\t\t`${entry.journalPath}: journal resolves to a different recovery root`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\tif (journal.state === \"committed\" || journal.state === \"cleanup-failed\") {\n\t\t\t\tawait finishCommittedJournalCleanup(\n\t\t\t\t\tjournal,\n\t\t\t\t\tentry.journalPath,\n\t\t\t\t\tjournalPaths,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tawait rollbackInterruptedJournal(\n\t\t\t\t\tjournal,\n\t\t\t\t\tentry.journalPath,\n\t\t\t\t\tjournalPaths,\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tjournal.state =\n\t\t\t\tjournal.state === \"committed\" || journal.state === \"cleanup-failed\"\n\t\t\t\t\t? \"cleanup-failed\"\n\t\t\t\t\t: \"rollback-failed\";\n\t\t\tjournal.error = error instanceof Error ? error.message : String(error);\n\t\t\tdelete journal.ownerPid;\n\t\t\ttry {\n\t\t\t\tawait writeJournal(entry.journalPath, journal);\n\t\t\t} catch {\n\t\t\t\t// The original reconciliation failure remains the actionable result.\n\t\t\t}\n\t\t\tfailures.push(`${entry.journalPath}: ${journal.error}`);\n\t\t}\n\t}\n\treturn failures;\n}\n\nexport async function applyFlowActivation(options: {\n\tproject: string;\n\tscope: ActivationScope;\n\ttarget?: string;\n\tapply?: boolean;\n\tpaths?: ActivationPathOptions;\n\t/** @internal Deterministic failure-injection seam for recovery tests. */\n\tafterMutation?: (operation: ActivationPlanOperation) => Promise<void>;\n\t/** @internal Simulates interruption after the durable removal commit point. */\n\tafterRemovalCommit?: () => Promise<void>;\n}): Promise<ActivationApplyReport> {\n\tconst target = resolveActivationTarget(options.target);\n\tconst paths = resolveActivationPaths(options.project, options.paths);\n\tconst recoveryRefusals =\n\t\toptions.apply === true\n\t\t\t? await reconcileIncompleteActivationJournals(paths, options.paths)\n\t\t\t: [];\n\tconst before = await checkFlowActivation({\n\t\tproject: options.project,\n\t\ttarget,\n\t\t...(options.paths ? { paths: options.paths } : {}),\n\t});\n\tconst refusals = [\n\t\t...recoveryRefusals,\n\t\t...activationRefusals(before),\n\t\t...downgradeRefusals(before),\n\t];\n\tconst snapshots: StrictConfigSnapshot[] = [];\n\tfor (const descriptor of configDescriptors(before.paths)) {\n\t\ttry {\n\t\t\tsnapshots.push(await readConfigSnapshot(descriptor));\n\t\t} catch (error) {\n\t\t\trefusals.push(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\tconst pin = `${FLOW_PACKAGE_NAME}@${target}`;\n\tconst canonicalPath =\n\t\toptions.scope === \"global\"\n\t\t\t? before.paths.globalConfig\n\t\t\t: before.paths.projectConfig;\n\tconst nextEntries = new Map<string, PluginSpec[]>();\n\tfor (const snapshot of snapshots) {\n\t\tconst retained = snapshot.plugin.filter(\n\t\t\t(entry) =>\n\t\t\t\t!removableConfigEntry(entry, snapshot.descriptor, before.records),\n\t\t);\n\t\tif (snapshot.descriptor.path === canonicalPath) retained.push(pin);\n\t\tnextEntries.set(snapshot.descriptor.path, retained);\n\t}\n\tconst ownedWrappers = uniqueOwnedWrappers(before.records).filter(\n\t\t(wrapper) =>\n\t\t\twrapper.source !== \"inline-config\" && wrapper.source !== \"managed-config\",\n\t);\n\tconst wrappers: OwnedWrapper[] = [];\n\tfor (const wrapper of ownedWrappers) {\n\t\ttry {\n\t\t\tconst safetyRoot = wrapperMutationSafetyRoot(before.paths, wrapper);\n\t\t\tconst recoveryRoot = wrapperRecoveryRoot(before.paths, wrapper);\n\t\t\tawait assertSafeMutationPath(safetyRoot, wrapper.path);\n\t\t\tawait assertSafeMutationPath(safetyRoot, recoveryRoot);\n\t\t\tif (!(await pathCanBeMoved(wrapper.path, recoveryRoot))) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`${wrapper.path}: removable wrapper or staging parent is not writable; remove it manually and rerun activation-apply`,\n\t\t\t\t);\n\t\t\t}\n\t\t\twrappers.push(wrapper);\n\t\t} catch (error) {\n\t\t\trefusals.push(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\tconst provenInactiveCache = before.cacheArtifacts.filter(\n\t\t(artifact) => artifact.status === \"inactive\",\n\t);\n\tconst inactiveCache: FlowCacheArtifact[] = [];\n\tfor (const artifact of provenInactiveCache) {\n\t\ttry {\n\t\t\tconst safetyRoot = dirname(before.paths.cacheRoot);\n\t\t\tawait assertSafeMutationPath(safetyRoot, artifact.path);\n\t\t\tawait assertSafeMutationPath(safetyRoot, before.paths.cacheRecoveryRoot);\n\t\t\tif (\n\t\t\t\t!(await pathCanBeMoved(artifact.path, before.paths.cacheRecoveryRoot))\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`${artifact.path}: proven inactive cache artifact or recovery parent is not writable; move it outside ${before.paths.packageCacheRoot} manually and rerun activation-apply`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tinactiveCache.push(artifact);\n\t\t} catch (error) {\n\t\t\trefusals.push(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\tconst plan: ActivationPlanOperation[] = [];\n\tconst changedSnapshots: StrictConfigSnapshot[] = [];\n\tconst addManualRemediation = (\n\t\tsnapshot: StrictConfigSnapshot | null,\n\t\tpath: string,\n\t\tdetail: string,\n\t) => {\n\t\tplan.push({\n\t\t\taction: \"manual-remediation\",\n\t\t\t...(snapshot ? { scope: snapshot.descriptor.scope } : {}),\n\t\t\tpath,\n\t\t\tdetail,\n\t\t});\n\t\trefusals.push(`${path}: ${detail}`);\n\t};\n\tconst scheduleConfigRewrite = async (\n\t\tsnapshot: StrictConfigSnapshot,\n\t\tdetail: string,\n\t) => {\n\t\tif (changedSnapshots.includes(snapshot)) return;\n\t\tif (!snapshot.descriptor.mutable) {\n\t\t\taddManualRemediation(\n\t\t\t\tsnapshot,\n\t\t\t\tsnapshot.descriptor.path,\n\t\t\t\t`managed config is immutable; ${snapshot.descriptor.manualRemediation}`,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tif (snapshot.format === \"jsonc\") {\n\t\t\taddManualRemediation(\n\t\t\t\tsnapshot,\n\t\t\t\tsnapshot.descriptor.path,\n\t\t\t\t`JSONC Flow activation was inventoried but cannot be edited losslessly without a JSONC editor; ${snapshot.descriptor.manualRemediation}, remove every ${FLOW_PACKAGE_NAME} entry, then rerun activation-apply`,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tif (!(await configIsWritable(snapshot))) {\n\t\t\taddManualRemediation(\n\t\t\t\tsnapshot,\n\t\t\t\tsnapshot.descriptor.path,\n\t\t\t\t`config or its mutation path is not safely writable; ${snapshot.descriptor.manualRemediation}`,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tchangedSnapshots.push(snapshot);\n\t\tplan.push({\n\t\t\taction: \"rewrite-config\",\n\t\t\tscope: snapshot.descriptor.scope,\n\t\t\tpath: snapshot.descriptor.path,\n\t\t\tdetail,\n\t\t});\n\t};\n\tfor (const snapshot of snapshots) {\n\t\tconst entries = nextEntries.get(snapshot.descriptor.path) ?? [];\n\t\tconst changed =\n\t\t\t(snapshot.descriptor.path === canonicalPath && !snapshot.exists) ||\n\t\t\tJSON.stringify(entries) !== JSON.stringify(snapshot.plugin);\n\t\tif (!changed) continue;\n\t\tawait scheduleConfigRewrite(\n\t\t\tsnapshot,\n\t\t\tsnapshot.descriptor.path === canonicalPath\n\t\t\t\t? `write canonical exact pin ${pin} last`\n\t\t\t\t: \"remove recognized Flow activation entries while preserving string/tuple entries and options\",\n\t\t);\n\t}\n\tfor (const record of before.records.filter(\n\t\t(record) => record.source === \"inline-config\",\n\t)) {\n\t\taddManualRemediation(\n\t\t\tnull,\n\t\t\t\"env:OPENCODE_CONFIG_CONTENT\",\n\t\t\t`inline Flow activation ${record.specifier} is immutable; remove it from OPENCODE_CONFIG_CONTENT or unset that variable, then rerun activation-apply`,\n\t\t);\n\t}\n\tconst canonicalSnapshot = snapshots.find(\n\t\t(snapshot) => snapshot.descriptor.path === canonicalPath,\n\t);\n\tfor (const wrapper of wrappers) {\n\t\tplan.push({\n\t\t\taction: \"remove-wrapper\",\n\t\t\tscope: wrapper.scope,\n\t\t\tpath: wrapper.path,\n\t\t\tdetail:\n\t\t\t\t\"permanently remove the proven Flow wrapper after reversible staging and activation verification\",\n\t\t});\n\t}\n\tfor (const artifact of inactiveCache) {\n\t\tplan.push({\n\t\t\taction: \"remove-cache\",\n\t\t\tpath: artifact.path,\n\t\t\tdetail: `permanently remove proven inactive Flow ${artifact.resolvedVersion} after reversible staging; preserve the cache root and unrelated packages`,\n\t\t});\n\t}\n\tconst base: ActivationApplyReport = {\n\t\tmode: options.apply === true ? \"apply\" : \"dry-run\",\n\t\tproject: before.project,\n\t\ttarget,\n\t\tscope: options.scope,\n\t\tstatus: refusals.length > 0 ? \"refused\" : \"ready\",\n\t\tbefore,\n\t\tplan,\n\t\trefusals: [...new Set(refusals)],\n\t};\n\tif (options.apply !== true || refusals.length > 0) return base;\n\tif (plan.length === 0) {\n\t\treturn { ...base, status: \"applied\", after: before };\n\t}\n\n\tconst runId = `${new Date().toISOString().replaceAll(\":\", \"-\")}-${randomUUID()}`;\n\tconst runRoot = join(before.paths.journalRoot, runId);\n\tconst journalPath = join(runRoot, \"journal.json\");\n\tconst actions: JournalAction[] = [];\n\tfor (const snapshot of changedSnapshots) {\n\t\tconst action: JournalAction = {\n\t\t\taction: \"rewrite-config\",\n\t\t\tpath: snapshot.descriptor.path,\n\t\t\tsource: snapshot.descriptor.source,\n\t\t\tscope: snapshot.descriptor.scope,\n\t\t\toriginalAbsent: !snapshot.exists,\n\t\t\toriginalMode: snapshot.mode,\n\t\t\tstate: \"pending\",\n\t\t};\n\t\tif (snapshot.exists) {\n\t\t\taction.backupPath = join(\n\t\t\t\trunRoot,\n\t\t\t\t\"configs\",\n\t\t\t\t`${snapshot.descriptor.source}-${sha256(snapshot.descriptor.path).slice(0, 12)}.backup`,\n\t\t\t);\n\t\t} else {\n\t\t\taction.recoveryPath = join(\n\t\t\t\tdirname(snapshot.descriptor.path),\n\t\t\t\t\".flow-activation-recovery\",\n\t\t\t\trunId,\n\t\t\t\t`${basename(snapshot.descriptor.path)}-${sha256(snapshot.descriptor.path).slice(0, 12)}`,\n\t\t\t);\n\t\t}\n\t\tactions.push(action);\n\t}\n\tfor (const wrapper of wrappers) {\n\t\tactions.push({\n\t\t\taction: \"remove-wrapper\",\n\t\t\tpath: wrapper.path,\n\t\t\tsource: wrapper.source,\n\t\t\tscope: wrapper.scope,\n\t\t\tresolvedVersion: wrapper.version,\n\t\t\townership: wrapper.ownership,\n\t\t\tstagingPath: join(\n\t\t\t\twrapperRecoveryRoot(before.paths, wrapper),\n\t\t\t\trunId,\n\t\t\t\tsha256(wrapper.path).slice(0, 12),\n\t\t\t\tbasename(wrapper.path),\n\t\t\t),\n\t\t\tstate: \"pending\",\n\t\t});\n\t}\n\tfor (const artifact of inactiveCache) {\n\t\tactions.push({\n\t\t\taction: \"remove-cache\",\n\t\t\tpath: artifact.path,\n\t\t\t...(artifact.resolvedVersion\n\t\t\t\t? { resolvedVersion: artifact.resolvedVersion }\n\t\t\t\t: {}),\n\t\t\tspecifier: artifact.specifier,\n\t\t\tstagingPath: join(\n\t\t\t\tbefore.paths.cacheRecoveryRoot,\n\t\t\t\trunId,\n\t\t\t\tsha256(artifact.path).slice(0, 12),\n\t\t\t\tbasename(artifact.path),\n\t\t\t),\n\t\t\tstate: \"pending\",\n\t\t});\n\t}\n\tconst journal: ActivationJournal = {\n\t\tformat: \"flow-activation-journal-v2\",\n\t\trunId,\n\t\tcreatedAt: new Date().toISOString(),\n\t\townerPid: process.pid,\n\t\tproject: before.project,\n\t\ttarget,\n\t\tscope: options.scope,\n\t\tstate: \"prepared\",\n\t\tactions,\n\t};\n\ttry {\n\t\tawait assertSafeMutationPath(dirname(before.paths.configRoot), runRoot);\n\t\tawait mkdir(runRoot, { recursive: true, mode: 0o700 });\n\t\tawait writeJournal(journalPath, journal);\n\t} catch (error) {\n\t\tconst message = `recovery journal could not be prepared safely at ${journalPath}: ${error instanceof Error ? error.message : String(error)}`;\n\t\treturn {\n\t\t\t...base,\n\t\t\tstatus: \"refused\",\n\t\t\trefusals: [...new Set([...base.refusals, message])],\n\t\t};\n\t}\n\n\tlet removalCommitStarted = false;\n\tlet committedAfter: ActivationCheckReport | undefined;\n\ttry {\n\t\tfor (const snapshot of changedSnapshots) {\n\t\t\tawait assertUnchangedConfig(snapshot);\n\t\t\tconst action = actions.find(\n\t\t\t\t(candidate) =>\n\t\t\t\t\tcandidate.action === \"rewrite-config\" &&\n\t\t\t\t\tcandidate.path === snapshot.descriptor.path,\n\t\t\t);\n\t\t\tif (snapshot.exists && action?.backupPath) {\n\t\t\t\tawait mkdir(dirname(action.backupPath), {\n\t\t\t\t\trecursive: true,\n\t\t\t\t\tmode: 0o700,\n\t\t\t\t});\n\t\t\t\tawait writeFile(action.backupPath, snapshot.content as string, {\n\t\t\t\t\tencoding: \"utf8\",\n\t\t\t\t\tflag: \"wx\",\n\t\t\t\t\tmode: 0o600,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tif (canonicalSnapshot && !changedSnapshots.includes(canonicalSnapshot)) {\n\t\t\tawait assertUnchangedConfig(canonicalSnapshot);\n\t\t}\n\t\tfor (const wrapper of wrappers) await verifyOwnedWrapper(wrapper);\n\t\tfor (const artifact of inactiveCache) {\n\t\t\tawait verifyCacheArtifact(artifact, target);\n\t\t}\n\t\tjournal.state = \"applying\";\n\t\tawait writeJournal(journalPath, journal);\n\t\tconst nonTargetConfigs = changedSnapshots.filter(\n\t\t\t(snapshot) => snapshot.descriptor.path !== canonicalPath,\n\t\t);\n\t\tconst targetConfig = changedSnapshots.find(\n\t\t\t(snapshot) => snapshot.descriptor.path === canonicalPath,\n\t\t);\n\t\tfor (const snapshot of nonTargetConfigs) {\n\t\t\tconst entries = nextEntries.get(snapshot.descriptor.path) ?? [];\n\t\t\tconst content = updatedConfigContent(snapshot, entries);\n\t\t\tconst action = actions.find(\n\t\t\t\t(candidate) =>\n\t\t\t\t\tcandidate.action === \"rewrite-config\" &&\n\t\t\t\t\tcandidate.path === snapshot.descriptor.path,\n\t\t\t);\n\t\t\tif (action) {\n\t\t\t\taction.appliedDigest = sha256(content);\n\t\t\t}\n\t\t\tawait writeJournal(journalPath, journal);\n\t\t\tawait atomicWriteConfig(snapshot, content, runId);\n\t\t\tif (action) action.state = \"complete\";\n\t\t\tawait writeJournal(journalPath, journal);\n\t\t\tawait options.afterMutation?.(\n\t\t\t\tplan.find(\n\t\t\t\t\t(operation) =>\n\t\t\t\t\t\toperation.action === \"rewrite-config\" &&\n\t\t\t\t\t\toperation.path === snapshot.descriptor.path,\n\t\t\t\t) as ActivationPlanOperation,\n\t\t\t);\n\t\t}\n\t\tfor (const wrapper of wrappers) {\n\t\t\tconst action = actions.find(\n\t\t\t\t(candidate) =>\n\t\t\t\t\tcandidate.action === \"remove-wrapper\" &&\n\t\t\t\t\tcandidate.path === wrapper.path,\n\t\t\t);\n\t\t\tif (!action?.stagingPath) {\n\t\t\t\tthrow new Error(`${wrapper.path}: missing wrapper staging path`);\n\t\t\t}\n\t\t\tawait verifyOwnedWrapper(wrapper);\n\t\t\tawait assertSafeMutationPath(\n\t\t\t\twrapperMutationSafetyRoot(before.paths, wrapper),\n\t\t\t\twrapper.path,\n\t\t\t);\n\t\t\tawait assertSafeMutationPath(\n\t\t\t\twrapperMutationSafetyRoot(before.paths, wrapper),\n\t\t\t\taction.stagingPath,\n\t\t\t);\n\t\t\tawait mkdir(dirname(action.stagingPath), {\n\t\t\t\trecursive: true,\n\t\t\t\tmode: 0o700,\n\t\t\t});\n\t\t\tawait rename(wrapper.path, action.stagingPath);\n\t\t\taction.state = \"complete\";\n\t\t\tawait writeJournal(journalPath, journal);\n\t\t\tawait options.afterMutation?.(\n\t\t\t\tplan.find(\n\t\t\t\t\t(operation) =>\n\t\t\t\t\t\toperation.action === \"remove-wrapper\" &&\n\t\t\t\t\t\toperation.path === wrapper.path,\n\t\t\t\t) as ActivationPlanOperation,\n\t\t\t);\n\t\t}\n\t\tfor (const artifact of inactiveCache) {\n\t\t\tconst action = actions.find(\n\t\t\t\t(candidate) =>\n\t\t\t\t\tcandidate.action === \"remove-cache\" &&\n\t\t\t\t\tcandidate.path === artifact.path,\n\t\t\t);\n\t\t\tif (!action?.stagingPath) {\n\t\t\t\tthrow new Error(`${artifact.path}: missing cache staging path`);\n\t\t\t}\n\t\t\tawait verifyCacheArtifact(artifact, target);\n\t\t\tawait assertSafeMutationPath(\n\t\t\t\tdirname(before.paths.cacheRoot),\n\t\t\t\tartifact.path,\n\t\t\t);\n\t\t\tawait assertSafeMutationPath(\n\t\t\t\tdirname(before.paths.cacheRoot),\n\t\t\t\taction.stagingPath,\n\t\t\t);\n\t\t\tawait mkdir(dirname(action.stagingPath), {\n\t\t\t\trecursive: true,\n\t\t\t\tmode: 0o700,\n\t\t\t});\n\t\t\tawait rename(artifact.path, action.stagingPath);\n\t\t\taction.state = \"complete\";\n\t\t\tawait writeJournal(journalPath, journal);\n\t\t\tawait options.afterMutation?.(\n\t\t\t\tplan.find(\n\t\t\t\t\t(operation) =>\n\t\t\t\t\t\toperation.action === \"remove-cache\" &&\n\t\t\t\t\t\toperation.path === artifact.path,\n\t\t\t\t) as ActivationPlanOperation,\n\t\t\t);\n\t\t}\n\t\tif (targetConfig) {\n\t\t\tconst targetEntries = nextEntries.get(targetConfig.descriptor.path) ?? [];\n\t\t\tconst targetContent = updatedConfigContent(targetConfig, targetEntries);\n\t\t\tconst targetAction = actions.find(\n\t\t\t\t(candidate) =>\n\t\t\t\t\tcandidate.action === \"rewrite-config\" &&\n\t\t\t\t\tcandidate.path === targetConfig.descriptor.path,\n\t\t\t);\n\t\t\tif (targetAction) {\n\t\t\t\ttargetAction.appliedDigest = sha256(targetContent);\n\t\t\t}\n\t\t\tawait writeJournal(journalPath, journal);\n\t\t\tawait atomicWriteConfig(targetConfig, targetContent, runId);\n\t\t\tif (targetAction) targetAction.state = \"complete\";\n\t\t\tawait writeJournal(journalPath, journal);\n\t\t\tawait options.afterMutation?.(\n\t\t\t\tplan.find(\n\t\t\t\t\t(operation) =>\n\t\t\t\t\t\toperation.action === \"rewrite-config\" &&\n\t\t\t\t\t\toperation.path === targetConfig.descriptor.path,\n\t\t\t\t) as ActivationPlanOperation,\n\t\t\t);\n\t\t}\n\t\tconst after = await checkFlowActivation({\n\t\t\tproject: before.project,\n\t\t\ttarget,\n\t\t\tignoreRecoveryRunId: runId,\n\t\t\t...(options.paths ? { paths: options.paths } : {}),\n\t\t});\n\t\tif (!after.singleVersionSatisfied) {\n\t\t\tthrow new Error(\n\t\t\t\t`post-apply inventory did not prove a single version: ${after.reasons.join(\"; \")}`,\n\t\t\t);\n\t\t}\n\t\tcommittedAfter = after;\n\t\tfor (const wrapper of wrappers) {\n\t\t\tconst action = actions.find(\n\t\t\t\t(candidate) =>\n\t\t\t\t\tcandidate.action === \"remove-wrapper\" &&\n\t\t\t\t\tcandidate.path === wrapper.path,\n\t\t\t);\n\t\t\tif (!action?.stagingPath) {\n\t\t\t\tthrow new Error(`${wrapper.path}: missing staged wrapper at commit`);\n\t\t\t}\n\t\t\tawait verifyOwnedWrapper({ ...wrapper, path: action.stagingPath });\n\t\t}\n\t\tfor (const artifact of inactiveCache) {\n\t\t\tconst action = actions.find(\n\t\t\t\t(candidate) =>\n\t\t\t\t\tcandidate.action === \"remove-cache\" &&\n\t\t\t\t\tcandidate.path === artifact.path,\n\t\t\t);\n\t\t\tif (!action?.stagingPath) {\n\t\t\t\tthrow new Error(`${artifact.path}: missing staged cache at commit`);\n\t\t\t}\n\t\t\tawait verifyCacheArtifact(\n\t\t\t\t{ ...artifact, path: action.stagingPath },\n\t\t\t\ttarget,\n\t\t\t);\n\t\t}\n\t\tconst removalActions = actions.filter(\n\t\t\t(candidate) =>\n\t\t\t\tcandidate.action === \"remove-wrapper\" ||\n\t\t\t\tcandidate.action === \"remove-cache\",\n\t\t);\n\t\tif (removalActions.length > 0) {\n\t\t\tjournal.state = \"committed\";\n\t\t\tawait writeJournal(journalPath, journal);\n\t\t\tremovalCommitStarted = true;\n\t\t\tawait options.afterRemovalCommit?.();\n\t\t}\n\t\tfor (const action of removalActions) {\n\t\t\tif (!action.stagingPath) {\n\t\t\t\tthrow new Error(`${action.path}: missing staging path at deletion`);\n\t\t\t}\n\t\t\tawait rm(action.stagingPath, {\n\t\t\t\trecursive: action.action === \"remove-cache\",\n\t\t\t});\n\t\t\tif (await optionalLstat(action.stagingPath)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`${action.path}: staged obsolete artifact still exists`,\n\t\t\t\t);\n\t\t\t}\n\t\t\taction.deleted = true;\n\t\t\tawait removeEmptyDirectory(dirname(action.stagingPath));\n\t\t\tawait writeJournal(journalPath, journal);\n\t\t}\n\t\tfor (const runDirectory of new Set(\n\t\t\tremovalActions.flatMap((action) =>\n\t\t\t\taction.stagingPath ? [dirname(dirname(action.stagingPath))] : [],\n\t\t\t),\n\t\t)) {\n\t\t\tawait removeEmptyDirectory(runDirectory);\n\t\t}\n\t\tawait removeEmptyDirectory(before.paths.cacheRecoveryRoot);\n\t\tjournal.state = \"complete\";\n\t\tdelete journal.ownerPid;\n\t\tawait writeJournal(journalPath, journal);\n\t\treturn {\n\t\t\t...base,\n\t\t\tstatus: \"applied\",\n\t\t\trecovery: { runId, journalPath },\n\t\t\tafter,\n\t\t\trefusals: [],\n\t\t};\n\t} catch (error) {\n\t\tif (removalCommitStarted) {\n\t\t\tjournal.state = \"cleanup-failed\";\n\t\t\tdelete journal.ownerPid;\n\t\t\tjournal.error = error instanceof Error ? error.message : String(error);\n\t\t\ttry {\n\t\t\t\tawait writeJournal(journalPath, journal);\n\t\t\t} catch {\n\t\t\t\t// The stable journal path is still returned below for manual inspection.\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...base,\n\t\t\t\tstatus: \"refused\",\n\t\t\t\trecovery: { runId, journalPath },\n\t\t\t\t...(committedAfter ? { after: committedAfter } : {}),\n\t\t\t\tfailure: {\n\t\t\t\t\tmessage: journal.error,\n\t\t\t\t\trecoveryState: \"cleanup-failed\",\n\t\t\t\t\tguidance: [\n\t\t\t\t\t\t\"The newest Flow activation is committed and remains authoritative; do not restore an older config or plugin source.\",\n\t\t\t\t\t\t`Inspect ${journalPath} and permanently delete each remaining remove-wrapper or remove-cache stagingPath after verifying it still contains only the recorded obsolete Flow version.`,\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\trefusals: [journal.error],\n\t\t\t};\n\t\t}\n\t\tjournal.state = \"failed\";\n\t\tjournal.error = error instanceof Error ? error.message : String(error);\n\t\ttry {\n\t\t\tawait writeJournal(journalPath, journal);\n\t\t} catch {\n\t\t\t// The stable journal path is still returned below for manual inspection.\n\t\t}\n\t\tconst rollbackFailures = await rollbackCompletedActions({\n\t\t\tjournal,\n\t\t\tjournalPath,\n\t\t\trunId,\n\t\t\tsnapshots: changedSnapshots,\n\t\t\tpaths: before.paths,\n\t\t\twrappers,\n\t\t});\n\t\tconst recoveryState =\n\t\t\trollbackFailures.length === 0 ? \"rolled-back\" : \"rollback-failed\";\n\t\tjournal.state = recoveryState;\n\t\tdelete journal.ownerPid;\n\t\tif (rollbackFailures.length > 0) {\n\t\t\tjournal.error = `${journal.error ?? \"apply failed\"}; rollback: ${rollbackFailures.join(\"; \")}`;\n\t\t}\n\t\ttry {\n\t\t\tawait writeJournal(journalPath, journal);\n\t\t} catch {\n\t\t\t// Keep returning the known journal path even when its final update fails.\n\t\t}\n\t\tconst guidance =\n\t\t\trecoveryState === \"rolled-back\"\n\t\t\t\t? [\n\t\t\t\t\t\t\"All completed mutations were restored from exact backups or reversible staging moves.\",\n\t\t\t\t\t\t`Inspect ${journalPath} and resolve the recorded failure before retrying.`,\n\t\t\t\t\t]\n\t\t\t\t: [\n\t\t\t\t\t\t\"Stop OpenCode before manual recovery.\",\n\t\t\t\t\t\t`Inspect ${journalPath}; for rollback-failed actions, restore backupPath to path or rename stagingPath back to path only after verifying the destination is absent or unchanged.`,\n\t\t\t\t\t\t\"Do not delete the recovery directory until activation-check succeeds.\",\n\t\t\t\t\t];\n\t\treturn {\n\t\t\t...base,\n\t\t\tstatus: \"refused\",\n\t\t\trecovery: { runId, journalPath },\n\t\t\tfailure: {\n\t\t\t\tmessage: journal.error ?? \"activation apply failed\",\n\t\t\t\trecoveryState,\n\t\t\t\tguidance,\n\t\t\t},\n\t\t\trefusals: [journal.error ?? \"activation apply failed\"],\n\t\t};\n\t}\n}\n",
|
|
6
|
-
"const REGISTRY_KIND = \"opencode-plugin-flow.runtime-leadership\";\nconst REGISTRY_FORMAT_VERSION = 1;\nconst MAX_PACKAGE_NAME_LENGTH = 214;\nconst MAX_VERSION_LENGTH = 256;\nconst MAX_INSTANCE_ID_LENGTH = 128;\nconst MAX_SCOPE_ID_LENGTH = 32_768;\n\nexport const FLOW_LEADERSHIP_PROTOCOL_VERSION = 1;\nexport const FLOW_LEADERSHIP_MAX_INSTANCES = 32;\nexport const FLOW_LEADERSHIP_REGISTRY_SYMBOL = Symbol.for(REGISTRY_KIND);\n\nconst SEMVER_PATTERN =\n\t/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?$/;\n\ntype SemanticIdentifier =\n\t| { readonly kind: \"numeric\"; readonly value: bigint }\n\t| { readonly kind: \"text\"; readonly value: string };\n\ninterface SemanticVersion {\n\treadonly major: bigint;\n\treadonly minor: bigint;\n\treadonly patch: bigint;\n\treadonly prerelease: readonly SemanticIdentifier[] | null;\n}\n\nexport interface FlowPluginIdentity {\n\treadonly packageName: string;\n\treadonly version: string;\n\treadonly protocolVersion: number;\n\treadonly instanceId: string;\n}\n\ninterface RegisteredFlowInstance extends FlowPluginIdentity {\n\treadonly scopeId?: string;\n}\n\ninterface FlowLeadershipRegistry {\n\treadonly kind: typeof REGISTRY_KIND;\n\treadonly formatVersion: typeof REGISTRY_FORMAT_VERSION;\n\treadonly registrations: Map<string, RegisteredFlowInstance>;\n\tcapacityExceeded: boolean;\n\tcapacityExceededScopes?: Set<string>;\n}\n\nexport type FlowLeadershipRole =\n\t| \"leader\"\n\t| \"nonleader\"\n\t| \"unregistered\"\n\t| \"indeterminate\";\n\nexport type FlowLeadershipReason =\n\t| \"sole-instance\"\n\t| \"duplicate-instances\"\n\t| \"not-registered\"\n\t| \"released\"\n\t| \"incompatible-registry\"\n\t| \"registry-capacity-exceeded\";\n\nexport interface FlowLeadershipStatus {\n\treadonly instanceId: string;\n\treadonly registered: boolean;\n\treadonly operational: boolean;\n\treadonly role: FlowLeadershipRole;\n\treadonly reason: FlowLeadershipReason;\n\treadonly registeredCount: number | null;\n\treadonly diagnosticLeader: FlowPluginIdentity | null;\n\treadonly registrations: readonly FlowPluginIdentity[];\n\treadonly message: string;\n}\n\nexport interface FlowLeadershipHandle {\n\treadonly identity: FlowPluginIdentity;\n\treadonly scopeId: string;\n\tquery(): FlowLeadershipStatus;\n\tisOperational(): boolean;\n\tassertOperational(action?: string): void;\n\trelease(): boolean;\n}\n\nexport class FlowLeadershipError extends Error {\n\treadonly code = \"FLOW_LEADERSHIP_BLOCKED\";\n\treadonly status: FlowLeadershipStatus;\n\n\tconstructor(status: FlowLeadershipStatus, action?: string) {\n\t\tconst actionPrefix = action ? `Flow cannot ${action}. ` : \"\";\n\t\tsuper(`${actionPrefix}${status.message}`);\n\t\tthis.name = \"FlowLeadershipError\";\n\t\tthis.status = status;\n\t}\n}\n\nfunction parseSemanticVersion(version: string): SemanticVersion | null {\n\tif (version.length === 0 || version.length > MAX_VERSION_LENGTH) return null;\n\tconst match = SEMVER_PATTERN.exec(version);\n\tconst major = match?.[1];\n\tconst minor = match?.[2];\n\tconst patch = match?.[3];\n\tif (major === undefined || minor === undefined || patch === undefined) {\n\t\treturn null;\n\t}\n\tconst prereleaseText = match?.[4];\n\tconst prerelease = prereleaseText\n\t\t? prereleaseText\n\t\t\t\t.split(\".\")\n\t\t\t\t.map<SemanticIdentifier>((identifier) =>\n\t\t\t\t\t/^\\d+$/.test(identifier)\n\t\t\t\t\t\t? { kind: \"numeric\", value: BigInt(identifier) }\n\t\t\t\t\t\t: { kind: \"text\", value: identifier },\n\t\t\t\t)\n\t\t: null;\n\treturn {\n\t\tmajor: BigInt(major),\n\t\tminor: BigInt(minor),\n\t\tpatch: BigInt(patch),\n\t\tprerelease,\n\t};\n}\n\nfunction compareBigInts(left: bigint, right: bigint): -1 | 0 | 1 {\n\tif (left < right) return -1;\n\tif (left > right) return 1;\n\treturn 0;\n}\n\nfunction compareText(left: string, right: string): -1 | 0 | 1 {\n\tif (left < right) return -1;\n\tif (left > right) return 1;\n\treturn 0;\n}\n\nfunction comparePrerelease(\n\tleft: readonly SemanticIdentifier[] | null,\n\tright: readonly SemanticIdentifier[] | null,\n): -1 | 0 | 1 {\n\tif (left === null && right === null) return 0;\n\tif (left === null) return 1;\n\tif (right === null) return -1;\n\tconst length = Math.max(left.length, right.length);\n\tfor (let index = 0; index < length; index += 1) {\n\t\tconst leftIdentifier = left[index];\n\t\tconst rightIdentifier = right[index];\n\t\tif (leftIdentifier === undefined) return -1;\n\t\tif (rightIdentifier === undefined) return 1;\n\t\tif (\n\t\t\tleftIdentifier.kind === \"numeric\" &&\n\t\t\trightIdentifier.kind === \"numeric\"\n\t\t) {\n\t\t\tconst comparison = compareBigInts(\n\t\t\t\tleftIdentifier.value,\n\t\t\t\trightIdentifier.value,\n\t\t\t);\n\t\t\tif (comparison !== 0) return comparison;\n\t\t\tcontinue;\n\t\t}\n\t\tif (leftIdentifier.kind === \"numeric\") return -1;\n\t\tif (rightIdentifier.kind === \"numeric\") return 1;\n\t\tconst comparison = compareText(leftIdentifier.value, rightIdentifier.value);\n\t\tif (comparison !== 0) return comparison;\n\t}\n\treturn 0;\n}\n\nexport function compareSemanticVersions(\n\tleft: string,\n\tright: string,\n): -1 | 0 | 1 {\n\tconst leftVersion = parseSemanticVersion(left);\n\tconst rightVersion = parseSemanticVersion(right);\n\tif (!leftVersion || !rightVersion) {\n\t\tthrow new TypeError(\n\t\t\t\"Flow leadership versions must be valid exact semantic versions.\",\n\t\t);\n\t}\n\tfor (const [leftPart, rightPart] of [\n\t\t[leftVersion.major, rightVersion.major],\n\t\t[leftVersion.minor, rightVersion.minor],\n\t\t[leftVersion.patch, rightVersion.patch],\n\t] as const) {\n\t\tconst comparison = compareBigInts(leftPart, rightPart);\n\t\tif (comparison !== 0) return comparison;\n\t}\n\treturn comparePrerelease(leftVersion.prerelease, rightVersion.prerelease);\n}\n\nfunction assertNonemptyBoundedString(\n\tvalue: string,\n\tname: string,\n\tmaxLength: number,\n): void {\n\tif (\n\t\tvalue.length === 0 ||\n\t\tvalue.length > maxLength ||\n\t\tvalue.trim() !== value\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`Flow leadership ${name} must be a non-empty, trimmed string of at most ${maxLength} characters.`,\n\t\t);\n\t}\n}\n\nfunction validateIdentity(identity: FlowPluginIdentity): void {\n\tassertNonemptyBoundedString(\n\t\tidentity.packageName,\n\t\t\"package name\",\n\t\tMAX_PACKAGE_NAME_LENGTH,\n\t);\n\tassertNonemptyBoundedString(\n\t\tidentity.instanceId,\n\t\t\"instance ID\",\n\t\tMAX_INSTANCE_ID_LENGTH,\n\t);\n\tif (!parseSemanticVersion(identity.version)) {\n\t\tthrow new TypeError(\n\t\t\t`Flow leadership version '${identity.version}' is not a valid exact semantic version.`,\n\t\t);\n\t}\n\tif (\n\t\t!Number.isSafeInteger(identity.protocolVersion) ||\n\t\tidentity.protocolVersion < 1\n\t) {\n\t\tthrow new TypeError(\n\t\t\t\"Flow leadership protocol version must be a positive safe integer.\",\n\t\t);\n\t}\n}\n\nfunction validateScopeId(scopeId: string): void {\n\tif (\n\t\tscopeId.length === 0 ||\n\t\tscopeId.length > MAX_SCOPE_ID_LENGTH ||\n\t\tscopeId.includes(\"\\0\")\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`Flow leadership scope ID must be a non-empty string without null bytes and at most ${MAX_SCOPE_ID_LENGTH} characters.`,\n\t\t);\n\t}\n}\n\nfunction snapshotIdentity(identity: FlowPluginIdentity): FlowPluginIdentity {\n\treturn Object.freeze({\n\t\tpackageName: identity.packageName,\n\t\tversion: identity.version,\n\t\tprotocolVersion: identity.protocolVersion,\n\t\tinstanceId: identity.instanceId,\n\t});\n}\n\nfunction scopedRegistration(\n\tidentity: FlowPluginIdentity,\n\tscopeId: string,\n): RegisteredFlowInstance {\n\treturn Object.freeze({ ...identity, scopeId });\n}\n\nfunction isRegisteredFlowInstance(\n\tvalue: unknown,\n): value is RegisteredFlowInstance {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst candidate = value as Partial<RegisteredFlowInstance>;\n\treturn (\n\t\ttypeof candidate.packageName === \"string\" &&\n\t\tcandidate.packageName.length > 0 &&\n\t\tcandidate.packageName.length <= MAX_PACKAGE_NAME_LENGTH &&\n\t\tcandidate.packageName.trim() === candidate.packageName &&\n\t\ttypeof candidate.version === \"string\" &&\n\t\tparseSemanticVersion(candidate.version) !== null &&\n\t\ttypeof candidate.protocolVersion === \"number\" &&\n\t\tNumber.isSafeInteger(candidate.protocolVersion) &&\n\t\tcandidate.protocolVersion >= 1 &&\n\t\ttypeof candidate.instanceId === \"string\" &&\n\t\tcandidate.instanceId.length > 0 &&\n\t\tcandidate.instanceId.length <= MAX_INSTANCE_ID_LENGTH &&\n\t\tcandidate.instanceId.trim() === candidate.instanceId &&\n\t\t(candidate.scopeId === undefined ||\n\t\t\t(typeof candidate.scopeId === \"string\" &&\n\t\t\t\tcandidate.scopeId.length > 0 &&\n\t\t\t\tcandidate.scopeId.length <= MAX_SCOPE_ID_LENGTH &&\n\t\t\t\t!candidate.scopeId.includes(\"\\0\")))\n\t);\n}\n\nfunction isCompatibleRegistry(value: unknown): value is FlowLeadershipRegistry {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst candidate = value as Partial<FlowLeadershipRegistry>;\n\tif (\n\t\tcandidate.kind !== REGISTRY_KIND ||\n\t\tcandidate.formatVersion !== REGISTRY_FORMAT_VERSION ||\n\t\t!(candidate.registrations instanceof Map) ||\n\t\ttypeof candidate.capacityExceeded !== \"boolean\" ||\n\t\t(candidate.capacityExceededScopes !== undefined &&\n\t\t\t!(candidate.capacityExceededScopes instanceof Set))\n\t) {\n\t\treturn false;\n\t}\n\tif (candidate.capacityExceededScopes) {\n\t\tfor (const scopeId of candidate.capacityExceededScopes) {\n\t\t\tif (\n\t\t\t\ttypeof scopeId !== \"string\" ||\n\t\t\t\tscopeId.length === 0 ||\n\t\t\t\tscopeId.length > MAX_SCOPE_ID_LENGTH ||\n\t\t\t\tscopeId.includes(\"\\0\")\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\tfor (const [instanceId, registration] of candidate.registrations) {\n\t\tif (\n\t\t\ttypeof instanceId !== \"string\" ||\n\t\t\t!isRegisteredFlowInstance(registration) ||\n\t\t\tregistration.instanceId !== instanceId\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction readRegistrySlot(): unknown {\n\ttry {\n\t\treturn Reflect.get(globalThis, FLOW_LEADERSHIP_REGISTRY_SYMBOL);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction createRegistry(): FlowLeadershipRegistry {\n\treturn {\n\t\tkind: REGISTRY_KIND,\n\t\tformatVersion: REGISTRY_FORMAT_VERSION,\n\t\tregistrations: new Map(),\n\t\tcapacityExceeded: false,\n\t\tcapacityExceededScopes: new Set(),\n\t};\n}\n\nfunction acquireRegistry():\n\t| { readonly ok: true; readonly registry: FlowLeadershipRegistry }\n\t| { readonly ok: false } {\n\tconst existing = readRegistrySlot();\n\tif (existing !== undefined) {\n\t\treturn isCompatibleRegistry(existing)\n\t\t\t? { ok: true, registry: existing }\n\t\t\t: { ok: false };\n\t}\n\tconst registry = createRegistry();\n\ttry {\n\t\tif (!Reflect.set(globalThis, FLOW_LEADERSHIP_REGISTRY_SYMBOL, registry)) {\n\t\t\treturn { ok: false };\n\t\t}\n\t} catch {\n\t\treturn { ok: false };\n\t}\n\tconst installed = readRegistrySlot();\n\treturn isCompatibleRegistry(installed)\n\t\t? { ok: true, registry: installed }\n\t\t: { ok: false };\n}\n\nfunction compareRegistrationTieBreakers(\n\tleft: RegisteredFlowInstance,\n\tright: RegisteredFlowInstance,\n): -1 | 0 | 1 {\n\tfor (const comparison of [\n\t\tcompareText(left.version, right.version),\n\t\tcompareText(left.packageName, right.packageName),\n\t\tleft.protocolVersion < right.protocolVersion\n\t\t\t? -1\n\t\t\t: left.protocolVersion > right.protocolVersion\n\t\t\t\t? 1\n\t\t\t\t: 0,\n\t\tcompareText(left.instanceId, right.instanceId),\n\t] as const) {\n\t\tif (comparison !== 0) return comparison;\n\t}\n\treturn 0;\n}\n\nfunction compareRegistrations(\n\tleft: RegisteredFlowInstance,\n\tright: RegisteredFlowInstance,\n): -1 | 0 | 1 {\n\tconst versionComparison = compareSemanticVersions(\n\t\tleft.version,\n\t\tright.version,\n\t);\n\treturn versionComparison === 0\n\t\t? compareRegistrationTieBreakers(left, right)\n\t\t: versionComparison;\n}\n\nfunction diagnosticLeader(\n\tregistrations: readonly RegisteredFlowInstance[],\n): RegisteredFlowInstance | null {\n\tlet leader: RegisteredFlowInstance | null = null;\n\tfor (const candidate of registrations) {\n\t\tif (\n\t\t\tleader === null ||\n\t\t\tcompareSemanticVersions(candidate.version, leader.version) > 0 ||\n\t\t\t(compareSemanticVersions(candidate.version, leader.version) === 0 &&\n\t\t\t\tcompareRegistrationTieBreakers(candidate, leader) < 0)\n\t\t) {\n\t\t\tleader = candidate;\n\t\t}\n\t}\n\treturn leader;\n}\n\nfunction identityLabel(identity: FlowPluginIdentity): string {\n\treturn `${identity.packageName}@${identity.version} (instance ${identity.instanceId}, protocol ${identity.protocolVersion})`;\n}\n\nfunction freezeStatus(status: FlowLeadershipStatus): FlowLeadershipStatus {\n\treturn Object.freeze({\n\t\t...status,\n\t\tregistrations: Object.freeze([...status.registrations]),\n\t});\n}\n\nfunction incompatibleStatus(instanceId: string): FlowLeadershipStatus {\n\treturn freezeStatus({\n\t\tinstanceId,\n\t\tregistered: false,\n\t\toperational: false,\n\t\trole: \"indeterminate\",\n\t\treason: \"incompatible-registry\",\n\t\tregisteredCount: null,\n\t\tdiagnosticLeader: null,\n\t\tregistrations: [],\n\t\tmessage:\n\t\t\t\"Flow is disabled because the process-global leadership registry is incompatible; its existing value was left untouched.\",\n\t});\n}\n\nfunction queryRegistryStatus(\n\tscopeId: string,\n\tinstanceId: string,\n\texpectedRecord: RegisteredFlowInstance | null,\n\tmatchAnyRecord: boolean,\n\tlocalReason: FlowLeadershipReason | null,\n\treleased: boolean,\n): FlowLeadershipStatus {\n\tif (released) {\n\t\treturn freezeStatus({\n\t\t\tinstanceId,\n\t\t\tregistered: false,\n\t\t\toperational: false,\n\t\t\trole: \"unregistered\",\n\t\t\treason: \"released\",\n\t\t\tregisteredCount: 0,\n\t\t\tdiagnosticLeader: null,\n\t\t\tregistrations: [],\n\t\t\tmessage: `Flow instance '${instanceId}' has released its leadership registration.`,\n\t\t});\n\t}\n\tconst value = readRegistrySlot();\n\tif (value === undefined) {\n\t\tconst reason = localReason ?? \"not-registered\";\n\t\treturn freezeStatus({\n\t\t\tinstanceId,\n\t\t\tregistered: false,\n\t\t\toperational: false,\n\t\t\trole:\n\t\t\t\treason === \"incompatible-registry\" ? \"indeterminate\" : \"unregistered\",\n\t\t\treason,\n\t\t\tregisteredCount: 0,\n\t\t\tdiagnosticLeader: null,\n\t\t\tregistrations: [],\n\t\t\tmessage:\n\t\t\t\treason === \"registry-capacity-exceeded\"\n\t\t\t\t\t? \"Flow is disabled because the leadership registry exceeded its bounded instance capacity.\"\n\t\t\t\t\t: reason === \"incompatible-registry\"\n\t\t\t\t\t\t? \"Flow is disabled because its leadership registration could not use the process-global registry.\"\n\t\t\t\t\t\t: `Flow instance '${instanceId}' is not registered.`,\n\t\t});\n\t}\n\tif (!isCompatibleRegistry(value)) return incompatibleStatus(instanceId);\n\tconst records = [...value.registrations.values()]\n\t\t.filter(\n\t\t\t(registration) =>\n\t\t\t\tregistration.scopeId === undefined || registration.scopeId === scopeId,\n\t\t)\n\t\t.sort(compareRegistrations);\n\tconst current = value.registrations.get(instanceId);\n\tconst registered =\n\t\tcurrent !== undefined &&\n\t\t(current.scopeId === undefined || current.scopeId === scopeId) &&\n\t\t(matchAnyRecord || current === expectedRecord);\n\tconst leader = diagnosticLeader(records);\n\tconst registrations = records.map(snapshotIdentity);\n\tconst leaderSnapshot = leader ? snapshotIdentity(leader) : null;\n\tif (\n\t\tvalue.capacityExceeded ||\n\t\tvalue.capacityExceededScopes?.has(scopeId) ||\n\t\tlocalReason === \"registry-capacity-exceeded\"\n\t) {\n\t\treturn freezeStatus({\n\t\t\tinstanceId,\n\t\t\tregistered,\n\t\t\toperational: false,\n\t\t\trole:\n\t\t\t\t!registered || !leader\n\t\t\t\t\t? \"unregistered\"\n\t\t\t\t\t: current === leader\n\t\t\t\t\t\t? \"leader\"\n\t\t\t\t\t\t: \"nonleader\",\n\t\t\treason: \"registry-capacity-exceeded\",\n\t\t\tregisteredCount: records.length,\n\t\t\tdiagnosticLeader: leaderSnapshot,\n\t\t\tregistrations,\n\t\t\tmessage: `Flow is disabled because this project leadership scope exceeded its bounded capacity of ${FLOW_LEADERSHIP_MAX_INSTANCES} instances.`,\n\t\t});\n\t}\n\tif (!registered || !current) {\n\t\treturn freezeStatus({\n\t\t\tinstanceId,\n\t\t\tregistered: false,\n\t\t\toperational: false,\n\t\t\trole:\n\t\t\t\tlocalReason === \"incompatible-registry\"\n\t\t\t\t\t? \"indeterminate\"\n\t\t\t\t\t: \"unregistered\",\n\t\t\treason: localReason ?? \"not-registered\",\n\t\t\tregisteredCount: records.length,\n\t\t\tdiagnosticLeader: leaderSnapshot,\n\t\t\tregistrations,\n\t\t\tmessage:\n\t\t\t\tlocalReason === \"incompatible-registry\"\n\t\t\t\t\t? \"Flow is disabled because its leadership registration could not use the process-global registry.\"\n\t\t\t\t\t: `Flow instance '${instanceId}' is not registered.`,\n\t\t});\n\t}\n\tif (records.length === 1 && leader === current) {\n\t\treturn freezeStatus({\n\t\t\tinstanceId,\n\t\t\tregistered: true,\n\t\t\toperational: true,\n\t\t\trole: \"leader\",\n\t\t\treason: \"sole-instance\",\n\t\t\tregisteredCount: 1,\n\t\t\tdiagnosticLeader: snapshotIdentity(current),\n\t\t\tregistrations,\n\t\t\tmessage: `Flow instance ${identityLabel(current)} is the sole active instance.`,\n\t\t});\n\t}\n\tif (!leader) {\n\t\treturn incompatibleStatus(instanceId);\n\t}\n\treturn freezeStatus({\n\t\tinstanceId,\n\t\tregistered: true,\n\t\toperational: false,\n\t\trole: current === leader ? \"leader\" : \"nonleader\",\n\t\treason: \"duplicate-instances\",\n\t\tregisteredCount: records.length,\n\t\tdiagnosticLeader: snapshotIdentity(leader),\n\t\tregistrations,\n\t\tmessage: `Flow is disabled while ${records.length} instances are registered in this project context. The deterministic diagnostic leader is ${identityLabel(leader)}.`,\n\t});\n}\n\nfunction identitiesMatch(\n\tleft: FlowPluginIdentity,\n\tright: FlowPluginIdentity,\n): boolean {\n\treturn (\n\t\tleft.packageName === right.packageName &&\n\t\tleft.version === right.version &&\n\t\tleft.protocolVersion === right.protocolVersion &&\n\t\tleft.instanceId === right.instanceId\n\t);\n}\n\nfunction removeEmptyRegistry(registry: FlowLeadershipRegistry): void {\n\tif (registry.registrations.size !== 0) return;\n\tif (readRegistrySlot() !== registry) return;\n\ttry {\n\t\tReflect.deleteProperty(globalThis, FLOW_LEADERSHIP_REGISTRY_SYMBOL);\n\t} catch {\n\t\t// An empty compatible registry is safe to reuse if the slot is not configurable.\n\t}\n}\n\nfunction clearEmptyScopeCapacity(\n\tregistry: FlowLeadershipRegistry,\n\tscopeId: string,\n): void {\n\tif (\n\t\t[...registry.registrations.values()].some(\n\t\t\t(registration) => registration.scopeId === scopeId,\n\t\t)\n\t) {\n\t\treturn;\n\t}\n\tregistry.capacityExceededScopes?.delete(scopeId);\n}\n\nexport function createFlowPluginInstanceId(): string {\n\treturn globalThis.crypto.randomUUID();\n}\n\nexport function queryFlowPluginLeadership(\n\tscopeId: string,\n\tinstanceId: string,\n): FlowLeadershipStatus {\n\tvalidateScopeId(scopeId);\n\tassertNonemptyBoundedString(\n\t\tinstanceId,\n\t\t\"instance ID\",\n\t\tMAX_INSTANCE_ID_LENGTH,\n\t);\n\treturn queryRegistryStatus(scopeId, instanceId, null, true, null, false);\n}\n\nexport function unregisterFlowPluginInstance(\n\tscopeId: string,\n\tinstanceId: string,\n): boolean {\n\tvalidateScopeId(scopeId);\n\tassertNonemptyBoundedString(\n\t\tinstanceId,\n\t\t\"instance ID\",\n\t\tMAX_INSTANCE_ID_LENGTH,\n\t);\n\tconst value = readRegistrySlot();\n\tif (!isCompatibleRegistry(value)) return false;\n\tconst registration = value.registrations.get(instanceId);\n\tif (\n\t\t!registration ||\n\t\t(registration.scopeId !== undefined && registration.scopeId !== scopeId) ||\n\t\t!value.registrations.delete(instanceId)\n\t) {\n\t\treturn false;\n\t}\n\tclearEmptyScopeCapacity(value, scopeId);\n\tremoveEmptyRegistry(value);\n\treturn true;\n}\n\nexport function registerFlowPluginInstance(\n\tscopeId: string,\n\tinput: FlowPluginIdentity,\n): FlowLeadershipHandle {\n\tvalidateScopeId(scopeId);\n\tvalidateIdentity(input);\n\tconst identity = snapshotIdentity(input);\n\tconst registration = scopedRegistration(identity, scopeId);\n\tconst acquired = acquireRegistry();\n\tlet record: RegisteredFlowInstance | null = null;\n\tlet localReason: FlowLeadershipReason | null = null;\n\tif (!acquired.ok) {\n\t\tlocalReason = \"incompatible-registry\";\n\t} else {\n\t\tconst existing = acquired.registry.registrations.get(identity.instanceId);\n\t\tif (existing) {\n\t\t\tif (\n\t\t\t\t!identitiesMatch(existing, identity) ||\n\t\t\t\texisting.scopeId !== scopeId\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Flow leadership instance ID '${identity.instanceId}' is already registered with different identity data.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\trecord = existing;\n\t\t} else if (\n\t\t\t[...acquired.registry.registrations.values()].filter(\n\t\t\t\t(candidate) =>\n\t\t\t\t\tcandidate.scopeId === undefined || candidate.scopeId === scopeId,\n\t\t\t).length >= FLOW_LEADERSHIP_MAX_INSTANCES\n\t\t) {\n\t\t\tacquired.registry.capacityExceededScopes ??= new Set();\n\t\t\tacquired.registry.capacityExceededScopes.add(scopeId);\n\t\t\tlocalReason = \"registry-capacity-exceeded\";\n\t\t} else {\n\t\t\trecord = registration;\n\t\t\tacquired.registry.registrations.set(identity.instanceId, record);\n\t\t}\n\t}\n\tlet released = false;\n\treturn Object.freeze({\n\t\tidentity,\n\t\tscopeId,\n\t\tquery(): FlowLeadershipStatus {\n\t\t\treturn queryRegistryStatus(\n\t\t\t\tscopeId,\n\t\t\t\tidentity.instanceId,\n\t\t\t\trecord,\n\t\t\t\tfalse,\n\t\t\t\tlocalReason,\n\t\t\t\treleased,\n\t\t\t);\n\t\t},\n\t\tisOperational(): boolean {\n\t\t\treturn this.query().operational;\n\t\t},\n\t\tassertOperational(action?: string): void {\n\t\t\tconst status = this.query();\n\t\t\tif (!status.operational) throw new FlowLeadershipError(status, action);\n\t\t},\n\t\trelease(): boolean {\n\t\t\tif (released || !record) return false;\n\t\t\tconst value = readRegistrySlot();\n\t\t\tif (!isCompatibleRegistry(value)) return false;\n\t\t\tif (value.registrations.get(identity.instanceId) !== record) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvalue.registrations.delete(identity.instanceId);\n\t\t\treleased = true;\n\t\t\tclearEmptyScopeCapacity(value, scopeId);\n\t\t\tremoveEmptyRegistry(value);\n\t\t\treturn true;\n\t\t},\n\t} satisfies FlowLeadershipHandle);\n}\n",
|
|
7
|
-
"import { createRequire } from \"node:module\";\n\nexport function resolveFlowPluginVersion(): string {\n\ttry {\n\t\tconst require = createRequire(import.meta.url);\n\t\tconst manifest = require(\"../package.json\") as { version?: string };\n\t\tif (manifest.version) return manifest.version;\n\t} catch {\n\t\t// Fall through to the development sentinel.\n\t}\n\treturn \"0.0.0\";\n}\n",
|
|
8
|
-
"import { createHash } from \"node:crypto\";\nimport { constants } from \"node:fs\";\nimport {\n\ttype FileHandle,\n\tlstat,\n\tmkdir,\n\topen,\n\treaddir,\n\trename,\n} from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { isAbsolute, join, normalize, sep } from \"node:path\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\nimport { FLOW_GUIDANCE_TOPICS } from \"../guidance/ids.js\";\n\nconst LEGACY_MARKER = \".flow-skill-version\";\nconst NO_FOLLOW = constants.O_NOFOLLOW ?? 0;\nconst SUPPORTED_LEGACY_MAJOR = \"4\";\nconst POST_MOVE_VERIFICATION_ATTEMPTS = 4;\nconst POST_MOVE_VERIFICATION_RETRY_MS = 25;\nconst SEMVER_PATTERN =\n\t/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$/;\n\ntype ParsedMarker = {\n\tversion: string;\n\tfiles: Map<string, string>;\n};\n\nexport type LegacySkillCleanupResult = {\n\tname: string;\n\tpath: string;\n\tstatus: \"absent\" | \"eligible\" | \"archived\" | \"refused\" | \"quarantined\";\n\treason?: string;\n\tarchivePath?: string;\n};\n\nexport type LegacyCleanupReport = {\n\tmode: \"dry-run\" | \"apply\";\n\troot: string;\n\tarchiveRoot: string;\n\tresults: LegacySkillCleanupResult[];\n};\n\nfunction configuredHome(): string {\n\treturn (\n\t\tprocess.env.HOME?.trim() || process.env.USERPROFILE?.trim() || homedir()\n\t);\n}\n\nexport function resolveLegacySkillsRoot(home = configuredHome()): string {\n\treturn join(home, \".config\", \"opencode\", \"skills\");\n}\n\nexport function resolveLegacyArchiveRoot(home = configuredHome()): string {\n\treturn join(home, \".config\", \"opencode\", \"flow-legacy-skills\");\n}\n\nfunction sha256(content: string): string {\n\treturn createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\nfunction safeLegacyPath(folder: string, relativePath: string): string {\n\tif (\n\t\t!relativePath ||\n\t\tisAbsolute(relativePath) ||\n\t\trelativePath.includes(\"\\\\\") ||\n\t\trelativePath\n\t\t\t.split(\"/\")\n\t\t\t.some((part) => !part || part === \".\" || part === \"..\")\n\t) {\n\t\tthrow new Error(`unsafe marker path '${relativePath}'`);\n\t}\n\tconst resolved = normalize(join(folder, ...relativePath.split(\"/\")));\n\tif (!resolved.startsWith(`${folder}${sep}`)) {\n\t\tthrow new Error(`unsafe marker path '${relativePath}'`);\n\t}\n\treturn resolved;\n}\n\nasync function optionalStat(path: string) {\n\ttry {\n\t\treturn await lstat(path, { bigint: false });\n\t} catch (error) {\n\t\tif ((error as NodeJS.ErrnoException).code === \"ENOENT\") return null;\n\t\tthrow error;\n\t}\n}\n\nasync function readRegularFileWithoutFollowing(path: string): Promise<string> {\n\tlet handle: FileHandle | undefined;\n\ttry {\n\t\tconst pathMetadata = await lstat(path);\n\t\tif (pathMetadata.isSymbolicLink()) {\n\t\t\tthrow new Error(`symbolic link refused: ${path}`);\n\t\t}\n\t\tif (!pathMetadata.isFile()) throw new Error(`not a regular file: ${path}`);\n\t\thandle = await open(path, constants.O_RDONLY | NO_FOLLOW);\n\t\tconst metadata = await handle.stat();\n\t\tif (!metadata.isFile()) throw new Error(`not a regular file: ${path}`);\n\t\tif (\n\t\t\tmetadata.dev !== pathMetadata.dev ||\n\t\t\tmetadata.ino !== pathMetadata.ino\n\t\t) {\n\t\t\tthrow new Error(`file changed while cleanup was running: ${path}`);\n\t\t}\n\t\treturn await handle.readFile({ encoding: \"utf8\" });\n\t} catch (error) {\n\t\tif ((error as NodeJS.ErrnoException).code === \"ELOOP\") {\n\t\t\tthrow new Error(`symbolic link refused: ${path}`);\n\t\t}\n\t\tthrow error;\n\t} finally {\n\t\tawait handle?.close();\n\t}\n}\n\nfunction parseMarker(content: string): ParsedMarker {\n\tlet version: string | undefined;\n\tconst files = new Map<string, string>();\n\tfor (const line of content.split(/\\r?\\n/)) {\n\t\tif (!line) continue;\n\t\tconst versionMatch = /^version=(.+)$/.exec(line);\n\t\tif (versionMatch?.[1]) {\n\t\t\tif (version) throw new Error(\"marker contains duplicate versions\");\n\t\t\tversion = versionMatch[1];\n\t\t\tcontinue;\n\t\t}\n\t\tconst fileMatch =\n\t\t\t/^file=(.+) sha256=([a-f0-9]{64})$/.exec(line) ??\n\t\t\t/^file=(.+)=sha256:([a-f0-9]{64})$/.exec(line);\n\t\tif (fileMatch?.[1] && fileMatch[2]) {\n\t\t\tif (files.has(fileMatch[1])) {\n\t\t\t\tthrow new Error(`marker contains duplicate file '${fileMatch[1]}'`);\n\t\t\t}\n\t\t\tfiles.set(fileMatch[1], fileMatch[2]);\n\t\t\tcontinue;\n\t\t}\n\t\tconst topLevelHash = /^hash=sha256:([a-f0-9]{64})$/.exec(line);\n\t\tif (topLevelHash?.[1] && !files.has(\"SKILL.md\")) {\n\t\t\tfiles.set(\"SKILL.md\", topLevelHash[1]);\n\t\t\tcontinue;\n\t\t}\n\t\tthrow new Error(`marker contains an invalid line: '${line}'`);\n\t}\n\tif (!version) throw new Error(\"marker has no version\");\n\tif (!files.has(\"SKILL.md\")) throw new Error(\"marker does not own SKILL.md\");\n\treturn { version, files };\n}\n\nfunction assertSupportedLegacyVersion(version: string): void {\n\tconst match = SEMVER_PATTERN.exec(version);\n\tif (!match) {\n\t\tthrow new Error(\n\t\t\t`marker version '${version}' is not a valid semantic version`,\n\t\t);\n\t}\n\tif (match[1] !== SUPPORTED_LEGACY_MAJOR) {\n\t\tthrow new Error(\n\t\t\t`marker version '${version}' is outside the supported legacy range >=4.0.0 <5.0.0`,\n\t\t);\n\t}\n}\n\nfunction expectedDirectoryEntries(\n\tmarker: ParsedMarker,\n): Map<string, Set<string>> {\n\tconst entries = new Map<string, Set<string>>([\n\t\t[\"\", new Set([LEGACY_MARKER])],\n\t]);\n\tfor (const relativePath of marker.files.keys()) {\n\t\tconst parts = relativePath.split(\"/\");\n\t\tlet parent = \"\";\n\t\tfor (let index = 0; index < parts.length; index += 1) {\n\t\t\tconst part = parts[index];\n\t\t\tif (!part) throw new Error(`unsafe marker path '${relativePath}'`);\n\t\t\tconst children = entries.get(parent) ?? new Set<string>();\n\t\t\tchildren.add(part);\n\t\t\tentries.set(parent, children);\n\t\t\tif (index < parts.length - 1) {\n\t\t\t\tparent = parent ? `${parent}/${part}` : part;\n\t\t\t\tif (!entries.has(parent)) entries.set(parent, new Set());\n\t\t\t}\n\t\t}\n\t}\n\treturn entries;\n}\n\nasync function inspectLegacyFolder(\n\tname: string,\n\tfolder: string,\n): Promise<LegacySkillCleanupResult> {\n\tconst metadata = await optionalStat(folder);\n\tif (!metadata) return { name, path: folder, status: \"absent\" };\n\tif (!metadata.isDirectory()) {\n\t\treturn {\n\t\t\tname,\n\t\t\tpath: folder,\n\t\t\tstatus: \"refused\",\n\t\t\treason: \"path is not a real directory\",\n\t\t};\n\t}\n\n\ttry {\n\t\tconst markerPath = join(folder, LEGACY_MARKER);\n\t\tconst marker = parseMarker(\n\t\t\tawait readRegularFileWithoutFollowing(markerPath),\n\t\t);\n\t\tassertSupportedLegacyVersion(marker.version);\n\t\tconst directories = expectedDirectoryEntries(marker);\n\t\tfor (const [relativeDirectory, expectedEntries] of directories) {\n\t\t\tconst directory = relativeDirectory\n\t\t\t\t? safeLegacyPath(folder, relativeDirectory)\n\t\t\t\t: folder;\n\t\t\tconst directoryMetadata = await optionalStat(directory);\n\t\t\tif (!directoryMetadata?.isDirectory()) {\n\t\t\t\tthrow new Error(`expected real directory: ${relativeDirectory || \".\"}`);\n\t\t\t}\n\t\t\tconst actualEntries = await readdir(directory);\n\t\t\tconst unexpected = actualEntries.filter(\n\t\t\t\t(entry) => !expectedEntries.has(entry),\n\t\t\t);\n\t\t\tconst missing = [...expectedEntries].filter(\n\t\t\t\t(entry) => !actualEntries.includes(entry),\n\t\t\t);\n\t\t\tif (unexpected.length > 0 || missing.length > 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t[\n\t\t\t\t\t\tunexpected.length > 0\n\t\t\t\t\t\t\t? `unexpected entries: ${unexpected.join(\", \")}`\n\t\t\t\t\t\t\t: \"\",\n\t\t\t\t\t\tmissing.length > 0 ? `missing entries: ${missing.join(\", \")}` : \"\",\n\t\t\t\t\t]\n\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t.join(\"; \"),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tfor (const [relativePath, expectedHash] of marker.files) {\n\t\t\tconst path = safeLegacyPath(folder, relativePath);\n\t\t\tconst content = await readRegularFileWithoutFollowing(path);\n\t\t\tif (sha256(content) !== expectedHash) {\n\t\t\t\tthrow new Error(`edited file refused: ${relativePath}`);\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tname,\n\t\t\tpath: folder,\n\t\t\tstatus: \"eligible\",\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\tname,\n\t\t\tpath: folder,\n\t\t\tstatus: \"refused\",\n\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t};\n\t}\n}\n\nasync function ensureRealArchiveRoot(path: string): Promise<void> {\n\tconst existing = await optionalStat(path);\n\tif (existing) {\n\t\tif (!existing.isDirectory()) {\n\t\t\tthrow new Error(`Legacy archive path is not a real directory: ${path}`);\n\t\t}\n\t\treturn;\n\t}\n\ttry {\n\t\tawait mkdir(path, { mode: 0o700 });\n\t} catch (error) {\n\t\tif ((error as NodeJS.ErrnoException).code !== \"EEXIST\") throw error;\n\t\tconst raced = await optionalStat(path);\n\t\tif (!raced?.isDirectory()) {\n\t\t\tthrow new Error(`Legacy archive path is not a real directory: ${path}`);\n\t\t}\n\t}\n}\n\nasync function verifyMovedLegacyFolder(\n\tname: string,\n\tarchivePath: string,\n): Promise<LegacySkillCleanupResult> {\n\tlet verified = await inspectLegacyFolder(name, archivePath);\n\tfor (\n\t\tlet attempt = 1;\n\t\tattempt < POST_MOVE_VERIFICATION_ATTEMPTS && verified.status !== \"eligible\";\n\t\tattempt += 1\n\t) {\n\t\t// Windows may briefly report a just-renamed directory as missing or\n\t\t// inaccessible while a competing inspection releases its file handles.\n\t\t// Retrying never weakens cleanup safety: only a complete byte-pristine\n\t\t// inspection can return eligible, while persistent edits still quarantine.\n\t\tawait sleep(POST_MOVE_VERIFICATION_RETRY_MS * attempt);\n\t\tverified = await inspectLegacyFolder(name, archivePath);\n\t}\n\treturn verified;\n}\n\nexport async function cleanupLegacySkills(options?: {\n\thome?: string;\n\tapply?: boolean;\n\t/** @internal Deterministic race-testing seam; package consumers should omit it. */\n\tafterQuarantine?: (context: {\n\t\tname: string;\n\t\tpath: string;\n\t\tarchivePath: string;\n\t}) => Promise<void>;\n}): Promise<LegacyCleanupReport> {\n\tconst home = options?.home ?? configuredHome();\n\tconst root = resolveLegacySkillsRoot(home);\n\tconst archiveRoot = resolveLegacyArchiveRoot(home);\n\tconst apply = options?.apply === true;\n\tconst results: LegacySkillCleanupResult[] = [];\n\n\tlet archiveReady = false;\n\tfor (const name of FLOW_GUIDANCE_TOPICS) {\n\t\tconst path = join(root, name);\n\t\tconst inspected = await inspectLegacyFolder(name, path);\n\t\tif (!apply || inspected.status !== \"eligible\") {\n\t\t\tresults.push(inspected);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!archiveReady) {\n\t\t\tawait ensureRealArchiveRoot(archiveRoot);\n\t\t\tarchiveReady = true;\n\t\t}\n\t\tconst archivePath = join(\n\t\t\tarchiveRoot,\n\t\t\t`${name}-${new Date().toISOString().replaceAll(\":\", \"-\")}-${crypto.randomUUID()}`,\n\t\t);\n\t\ttry {\n\t\t\tawait rename(path, archivePath);\n\t\t} catch (error) {\n\t\t\tif ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n\t\t\tresults.push({\n\t\t\t\tname,\n\t\t\t\tpath,\n\t\t\t\tstatus: \"refused\",\n\t\t\t\treason: \"folder changed while cleanup was running\",\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tawait options?.afterQuarantine?.({ name, path, archivePath });\n\t\tconst verified = await verifyMovedLegacyFolder(name, archivePath);\n\t\tif (verified.status === \"absent\") {\n\t\t\t// On Windows, two concurrent path-based renames can both report success\n\t\t\t// while the later rename relocates the same directory again. Do not claim\n\t\t\t// that our now-missing destination is quarantined; the competing cleanup\n\t\t\t// owns verification of the final archive path.\n\t\t\tresults.push({\n\t\t\t\tname,\n\t\t\t\tpath,\n\t\t\t\tstatus: \"refused\",\n\t\t\t\treason:\n\t\t\t\t\t\"archive moved again while cleanup was running; inspect the legacy archive root\",\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (verified.status !== \"eligible\") {\n\t\t\tresults.push({\n\t\t\t\tname,\n\t\t\t\tpath,\n\t\t\t\tstatus: \"quarantined\",\n\t\t\t\treason:\n\t\t\t\t\t\"folder changed while cleanup was running; preserved for manual recovery\",\n\t\t\t\tarchivePath,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tresults.push({\n\t\t\tname,\n\t\t\tpath,\n\t\t\tstatus: \"archived\",\n\t\t\tarchivePath,\n\t\t});\n\t}\n\n\treturn {\n\t\tmode: apply ? \"apply\" : \"dry-run\",\n\t\troot,\n\t\tarchiveRoot,\n\t\tresults,\n\t};\n}\n",
|
|
9
|
-
"export const FLOW_GUIDANCE_TOPICS = [\n\t\"flow\",\n\t\"flow-plan\",\n\t\"flow-run\",\n\t\"flow-test\",\n\t\"flow-review\",\n\t\"flow-deslop\",\n\t\"flow-ui-quality\",\n\t\"flow-commit\",\n] as const;\n\nexport type FlowGuidanceTopic = (typeof FLOW_GUIDANCE_TOPICS)[number];\n\nexport const FLOW_GUIDANCE_IDS = [\n\t\"flow\",\n\t\"flow/references/recovery-playbook.md\",\n\t\"flow/references/parallel-orchestration.md\",\n\t\"flow/references/parallel-decision.md\",\n\t\"flow/references/parallel-manifest.md\",\n\t\"flow/references/parallel-execution.md\",\n\t\"flow/references/parallel-synthesis.md\",\n\t\"flow/references/parallel-pass-example.md\",\n\t\"flow/references/handoff-format.md\",\n\t\"flow-plan\",\n\t\"flow-plan/references/planning-examples.md\",\n\t\"flow-plan/references/plan-quality-checklist.md\",\n\t\"flow-plan/references/parallel-discovery.md\",\n\t\"flow-run\",\n\t\"flow-run/references/validation-rubric.md\",\n\t\"flow-run/references/audit-rubric.md\",\n\t\"flow-test\",\n\t\"flow-review\",\n\t\"flow-review/references/hidden-reviewer-contract.md\",\n\t\"flow-review/references/review-rubric.md\",\n\t\"flow-deslop\",\n\t\"flow-deslop/references/smell-rubric.md\",\n\t\"flow-deslop/references/refactor-workflow.md\",\n\t\"flow-ui-quality\",\n\t\"flow-ui-quality/references/ui-rubric.md\",\n\t\"flow-ui-quality/references/visual-verification.md\",\n\t\"flow-commit\",\n] as const;\n\nexport type FlowGuidanceId = (typeof FLOW_GUIDANCE_IDS)[number];\n",
|
|
10
|
-
"import {\n\ttype ActivationApplyReport,\n\ttype ActivationCheckReport,\n\ttype ActivationScope,\n\tapplyFlowActivation,\n\tcheckFlowActivation,\n} from \"./distribution/activation.js\";\nimport {\n\tcleanupLegacySkills,\n\ttype LegacyCleanupReport,\n} from \"./distribution/legacy-cleanup.js\";\nimport { resolveFlowPluginVersion } from \"./version.js\";\n\nfunction usage(): string {\n\treturn [\n\t\t\"usage:\",\n\t\t\" opencode-plugin-flow install --project <absolute-path> --scope <global|project> [--json]\",\n\t\t\" opencode-plugin-flow activation-check --project <absolute-path> [--target <exact-version>] [--json]\",\n\t\t\" opencode-plugin-flow activation-apply --project <absolute-path> --scope <global|project> [--target <exact-version>] [--apply] [--json]\",\n\t\t\" opencode-plugin-flow legacy-cleanup <--dry-run|--apply> [--json]\",\n\t\t\"\",\n\t\t\"commands:\",\n\t\t\" install Converge immediately to this package's exact version and remove proven older copies\",\n\t\t\" activation-check Inventory global sources, one selected project, and cache artifacts\",\n\t\t\" activation-apply Plan a single-version activation; mutate only with --apply\",\n\t\t\" legacy-cleanup Inspect or archive marker-proven legacy global Flow skills\",\n\t\t\"\",\n\t\t\"activation options:\",\n\t\t\" --project <path> Absolute project/worktree path; other project trees are not scanned\",\n\t\t\" --scope <scope> Config that receives the one canonical exact npm pin\",\n\t\t\" --target <version> Exact version only; defaults to this package's embedded version\",\n\t\t\" --apply Create backups/journal and apply the activation plan\",\n\t\t\" Without --apply, activation-apply is read-only\",\n\t\t\"\",\n\t\t\"legacy cleanup options:\",\n\t\t\" --dry-run Report eligible folders without changing the filesystem\",\n\t\t\" --apply Move eligible folders to a recoverable archive outside skill discovery\",\n\t\t\" Cleanup never deletes legacy folders\",\n\t\t\"\",\n\t\t\"common options:\",\n\t\t\" --json Write the report as JSON\",\n\t\t\" --help Show this help\",\n\t\t\" --version Print the plugin version\",\n\t].join(\"\\n\");\n}\n\nfunction writeLegacyReport(report: LegacyCleanupReport, json: boolean): void {\n\tif (json) {\n\t\tprocess.stdout.write(`${JSON.stringify(report, null, 2)}\\n`);\n\t\treturn;\n\t}\n\tprocess.stdout.write(`Flow legacy skill cleanup (${report.mode})\\n`);\n\tprocess.stdout.write(`- legacy root: ${report.root}\\n`);\n\tprocess.stdout.write(`- archive root: ${report.archiveRoot}\\n`);\n\tfor (const result of report.results) {\n\t\tprocess.stdout.write(`- ${result.name}: ${result.status}\\n`);\n\t\tif (result.reason) process.stdout.write(` reason: ${result.reason}\\n`);\n\t\tif (result.archivePath) {\n\t\t\tconst label = result.status === \"archived\" ? \"archived\" : \"preserved\";\n\t\t\tprocess.stdout.write(` ${label} at: ${result.archivePath}\\n`);\n\t\t}\n\t}\n}\n\nfunction writeActivationCheck(\n\treport: ActivationCheckReport,\n\tjson: boolean,\n): void {\n\tif (json) {\n\t\tprocess.stdout.write(`${JSON.stringify(report, null, 2)}\\n`);\n\t\treturn;\n\t}\n\tprocess.stdout.write(\n\t\t`Flow activation check: ${report.singleVersionSatisfied ? \"satisfied\" : \"not satisfied\"}\\n`,\n\t);\n\tprocess.stdout.write(`- project: ${report.project}\\n`);\n\tprocess.stdout.write(\n\t\t\"- coverage: global sources plus the selected project; other project trees are not scanned\\n\",\n\t);\n\tprocess.stdout.write(`- target: opencode-plugin-flow@${report.target}\\n`);\n\tprocess.stdout.write(`- activation sources: ${report.records.length}\\n`);\n\tfor (const record of report.records) {\n\t\tprocess.stdout.write(\n\t\t\t` - ${record.source}: ${record.specifier} (${record.ownership}, ${record.status}, version=${record.resolvedVersion ?? \"unresolved\"})\\n`,\n\t\t);\n\t\tif (record.reason) process.stdout.write(` reason: ${record.reason}\\n`);\n\t}\n\tprocess.stdout.write(\n\t\t`- Flow cache artifacts: ${report.cacheArtifacts.length}\\n`,\n\t);\n\tfor (const artifact of report.cacheArtifacts) {\n\t\tprocess.stdout.write(\n\t\t\t` - ${artifact.specifier}: ${artifact.status} (version=${artifact.resolvedVersion ?? \"unresolved\"})\\n`,\n\t\t);\n\t\tif (artifact.reason)\n\t\t\tprocess.stdout.write(` reason: ${artifact.reason}\\n`);\n\t}\n\tfor (const limitation of report.limitations) {\n\t\tprocess.stdout.write(\n\t\t\t`- limitation (${limitation.coverage}): ${limitation.source}\\n ${limitation.detail}\\n`,\n\t\t);\n\t}\n\tfor (const reason of report.reasons) {\n\t\tprocess.stdout.write(`- blocked: ${reason}\\n`);\n\t}\n}\n\nfunction writeActivationApply(\n\treport: ActivationApplyReport,\n\tjson: boolean,\n): void {\n\tif (json) {\n\t\tprocess.stdout.write(`${JSON.stringify(report, null, 2)}\\n`);\n\t\treturn;\n\t}\n\tprocess.stdout.write(`Flow activation ${report.mode}: ${report.status}\\n`);\n\tprocess.stdout.write(`- project: ${report.project}\\n`);\n\tprocess.stdout.write(\n\t\t\"- coverage: global sources plus the selected project; other project trees are not scanned\\n\",\n\t);\n\tprocess.stdout.write(`- canonical scope: ${report.scope}\\n`);\n\tprocess.stdout.write(`- target: opencode-plugin-flow@${report.target}\\n`);\n\tfor (const refusal of report.refusals) {\n\t\tprocess.stdout.write(`- refused: ${refusal}\\n`);\n\t}\n\tif (report.status === \"refused\" && report.plan.length > 0) {\n\t\tprocess.stdout.write(\"- blocked plan (not executed):\\n\");\n\t}\n\tfor (const operation of report.plan) {\n\t\tconst action =\n\t\t\treport.status === \"refused\"\n\t\t\t\t? `would-${operation.action}`\n\t\t\t\t: operation.action;\n\t\tprocess.stdout.write(\n\t\t\t`- ${action}: ${operation.path}\\n ${operation.detail}\\n`,\n\t\t);\n\t}\n\tif (report.recovery) {\n\t\tprocess.stdout.write(\n\t\t\t`- recovery journal: ${report.recovery.journalPath}\\n`,\n\t\t);\n\t}\n\tif (report.failure) {\n\t\tprocess.stdout.write(\n\t\t\t`- recovery state: ${report.failure.recoveryState}\\n- failure: ${report.failure.message}\\n`,\n\t\t);\n\t\tfor (const guidance of report.failure.guidance) {\n\t\t\tprocess.stdout.write(` recovery: ${guidance}\\n`);\n\t\t}\n\t}\n\tif (report.mode === \"dry-run\" && report.status === \"ready\") {\n\t\tprocess.stdout.write(\n\t\t\t\"- no files changed; repeat with --apply to execute\\n\",\n\t\t);\n\t}\n}\n\ntype ParsedActivationFlags = {\n\tproject?: string;\n\ttarget?: string;\n\tscope?: string;\n\tapply: boolean;\n\tjson: boolean;\n\thelp: boolean;\n};\n\nfunction parseActivationFlags(flags: string[]): ParsedActivationFlags | null {\n\tconst parsed: ParsedActivationFlags = {\n\t\tapply: false,\n\t\tjson: false,\n\t\thelp: false,\n\t};\n\tconst seen = new Set<string>();\n\tfor (let index = 0; index < flags.length; index += 1) {\n\t\tconst flag = flags[index];\n\t\tif (!flag || seen.has(flag)) return null;\n\t\tseen.add(flag);\n\t\tif (flag === \"--apply\") {\n\t\t\tparsed.apply = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (flag === \"--json\") {\n\t\t\tparsed.json = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (flag === \"--help\" || flag === \"-h\") {\n\t\t\tparsed.help = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (![\"--project\", \"--target\", \"--scope\"].includes(flag)) return null;\n\t\tconst value = flags[index + 1];\n\t\tif (!value || value.startsWith(\"--\")) return null;\n\t\tindex += 1;\n\t\tif (flag === \"--project\") parsed.project = value;\n\t\tif (flag === \"--target\") parsed.target = value;\n\t\tif (flag === \"--scope\") parsed.scope = value;\n\t}\n\treturn parsed;\n}\n\nfunction activationScope(value: string | undefined): ActivationScope | null {\n\treturn value === \"global\" || value === \"project\" ? value : null;\n}\n\nasync function runActivationCheck(flags: string[]): Promise<void> {\n\tconst parsed = parseActivationFlags(flags);\n\tif (\n\t\t!parsed ||\n\t\tparsed.apply ||\n\t\tparsed.scope ||\n\t\t(!parsed.project && !parsed.help)\n\t) {\n\t\tprocess.stderr.write(`${usage()}\\n`);\n\t\tprocess.exitCode = 2;\n\t\treturn;\n\t}\n\tif (parsed.help) {\n\t\tprocess.stdout.write(`${usage()}\\n`);\n\t\treturn;\n\t}\n\tconst report = await checkFlowActivation({\n\t\tproject: parsed.project as string,\n\t\t...(parsed.target ? { target: parsed.target } : {}),\n\t});\n\twriteActivationCheck(report, parsed.json);\n\tif (!report.singleVersionSatisfied) process.exitCode = 1;\n}\n\nasync function runActivationApply(flags: string[]): Promise<void> {\n\tconst parsed = parseActivationFlags(flags);\n\tconst scope = activationScope(parsed?.scope);\n\tif (\n\t\t!parsed ||\n\t\t(!parsed.project && !parsed.help) ||\n\t\t(!scope && !parsed.help)\n\t) {\n\t\tprocess.stderr.write(`${usage()}\\n`);\n\t\tprocess.exitCode = 2;\n\t\treturn;\n\t}\n\tif (parsed.help) {\n\t\tprocess.stdout.write(`${usage()}\\n`);\n\t\treturn;\n\t}\n\tconst report = await applyFlowActivation({\n\t\tproject: parsed.project as string,\n\t\tscope: scope as ActivationScope,\n\t\tapply: parsed.apply,\n\t\t...(parsed.target ? { target: parsed.target } : {}),\n\t});\n\twriteActivationApply(report, parsed.json);\n\tif (report.status === \"refused\") process.exitCode = 1;\n}\n\nasync function runInstall(flags: string[]): Promise<void> {\n\tconst parsed = parseActivationFlags(flags);\n\tconst scope = activationScope(parsed?.scope);\n\tif (\n\t\t!parsed ||\n\t\tparsed.apply ||\n\t\tparsed.target ||\n\t\t(!parsed.project && !parsed.help) ||\n\t\t(!scope && !parsed.help)\n\t) {\n\t\tprocess.stderr.write(`${usage()}\\n`);\n\t\tprocess.exitCode = 2;\n\t\treturn;\n\t}\n\tif (parsed.help) {\n\t\tprocess.stdout.write(`${usage()}\\n`);\n\t\treturn;\n\t}\n\tconst report = await applyFlowActivation({\n\t\tproject: parsed.project as string,\n\t\tscope: scope as ActivationScope,\n\t\tapply: true,\n\t});\n\twriteActivationApply(report, parsed.json);\n\tif (report.status === \"refused\") process.exitCode = 1;\n}\n\nasync function runLegacyCleanup(flags: string[]): Promise<void> {\n\tconst knownFlags = new Set([\"--dry-run\", \"--apply\", \"--json\"]);\n\tconst validFlags = flags.every((flag) => knownFlags.has(flag));\n\tconst dryRun = flags.includes(\"--dry-run\");\n\tconst apply = flags.includes(\"--apply\");\n\tif (!validFlags || dryRun === apply) {\n\t\tprocess.stderr.write(`${usage()}\\n`);\n\t\tprocess.exitCode = 2;\n\t\treturn;\n\t}\n\tconst report = await cleanupLegacySkills({ apply });\n\twriteLegacyReport(report, flags.includes(\"--json\"));\n\tif (\n\t\tapply &&\n\t\treport.results.some((result) =>\n\t\t\t[\"refused\", \"quarantined\"].includes(result.status),\n\t\t)\n\t) {\n\t\tprocess.exitCode = 1;\n\t}\n}\n\nasync function main(argv: string[]): Promise<void> {\n\tconst [command, ...flags] = argv.slice(2);\n\tif (command === \"--help\" || command === \"-h\") {\n\t\tprocess.stdout.write(`${usage()}\\n`);\n\t\treturn;\n\t}\n\tif (command === \"--version\" || command === \"-v\") {\n\t\tprocess.stdout.write(`${resolveFlowPluginVersion()}\\n`);\n\t\treturn;\n\t}\n\tif (command === \"activation-check\") {\n\t\tawait runActivationCheck(flags);\n\t\treturn;\n\t}\n\tif (command === \"install\") {\n\t\tawait runInstall(flags);\n\t\treturn;\n\t}\n\tif (command === \"activation-apply\") {\n\t\tawait runActivationApply(flags);\n\t\treturn;\n\t}\n\tif (command === \"legacy-cleanup\") {\n\t\tawait runLegacyCleanup(flags);\n\t\treturn;\n\t}\n\tprocess.stderr.write(`${usage()}\\n`);\n\tprocess.exitCode = 2;\n}\n\nmain(process.argv).catch((error) => {\n\tprocess.stderr.write(\n\t\t`${error instanceof Error ? error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