open-multi-agent-kit 0.90.5 → 0.90.7
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 +39 -1
- package/README.md +9 -9
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +2 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/codexbar-cli.d.ts +39 -0
- package/dist/codexbar-cli.d.ts.map +1 -0
- package/dist/codexbar-cli.js +230 -0
- package/dist/codexbar-cli.js.map +1 -0
- package/dist/commands/doctor-provider.d.ts.map +1 -1
- package/dist/commands/doctor-provider.js +16 -3
- package/dist/commands/doctor-provider.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +30 -8
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/codexbar-adapter.d.ts +44 -0
- package/dist/core/codexbar-adapter.d.ts.map +1 -0
- package/dist/core/codexbar-adapter.js +211 -0
- package/dist/core/codexbar-adapter.js.map +1 -0
- package/dist/core/command-safety.d.ts.map +1 -1
- package/dist/core/command-safety.js +7 -0
- package/dist/core/command-safety.js.map +1 -1
- package/dist/core/compaction/index.d.ts +2 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +2 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/model-policy.d.ts +9 -0
- package/dist/core/compaction/model-policy.d.ts.map +1 -0
- package/dist/core/compaction/model-policy.js +37 -0
- package/dist/core/compaction/model-policy.js.map +1 -0
- package/dist/core/compaction/resume-policy.d.ts +6 -0
- package/dist/core/compaction/resume-policy.d.ts.map +1 -0
- package/dist/core/compaction/resume-policy.js +8 -0
- package/dist/core/compaction/resume-policy.js.map +1 -0
- package/dist/core/domain-loadouts.d.ts.map +1 -1
- package/dist/core/domain-loadouts.js +68 -1
- package/dist/core/domain-loadouts.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +12 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +3 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +15 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/grok-harness-dispatch.d.ts +22 -0
- package/dist/core/grok-harness-dispatch.d.ts.map +1 -0
- package/dist/core/grok-harness-dispatch.js +44 -0
- package/dist/core/grok-harness-dispatch.js.map +1 -0
- package/dist/core/grok-harness.d.ts +25 -0
- package/dist/core/grok-harness.d.ts.map +1 -0
- package/dist/core/grok-harness.js +61 -0
- package/dist/core/grok-harness.js.map +1 -0
- package/dist/core/grok-playbook.d.ts +7 -0
- package/dist/core/grok-playbook.d.ts.map +1 -0
- package/dist/core/grok-playbook.js +34 -0
- package/dist/core/grok-playbook.js.map +1 -0
- package/dist/core/reasoning-router-v4-normalize.d.ts +11 -0
- package/dist/core/reasoning-router-v4-normalize.d.ts.map +1 -0
- package/dist/core/reasoning-router-v4-normalize.js +224 -0
- package/dist/core/reasoning-router-v4-normalize.js.map +1 -0
- package/dist/core/reasoning-router-v4-weights.d.ts +13 -5
- package/dist/core/reasoning-router-v4-weights.d.ts.map +1 -1
- package/dist/core/reasoning-router-v4-weights.js +8 -4
- package/dist/core/reasoning-router-v4-weights.js.map +1 -1
- package/dist/core/reasoning-router-v4.d.ts +3 -3
- package/dist/core/reasoning-router-v4.d.ts.map +1 -1
- package/dist/core/reasoning-router-v4.js +394 -58
- package/dist/core/reasoning-router-v4.js.map +1 -1
- package/dist/core/router-feedback-collector.d.ts +1 -1
- package/dist/core/router-feedback-collector.d.ts.map +1 -1
- package/dist/core/router-feedback-collector.js +9 -1
- package/dist/core/router-feedback-collector.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +31 -12
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -3
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +1 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +1 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +2 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +3 -2
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +42 -17
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/adaptorch-preview.md +84 -0
- package/docs/correctness-wall.md +117 -0
- package/docs/grok-harness.md +63 -0
- package/docs/loadout-domains/README.md +2 -1
- package/docs/loadout-domains/ai-agent-ops.md +8 -1
- package/docs/loadout-domains/frontend-ui.md +5 -1
- package/docs/loadout-domains/grok-harness.md +74 -0
- package/docs/providers.md +4 -0
- package/examples/extensions/correctness-wall/LOADOUT.md +87 -0
- package/examples/extensions/correctness-wall/README.md +111 -0
- package/examples/extensions/correctness-wall/adjudication-fixture.ts +151 -0
- package/examples/extensions/correctness-wall/index.ts +470 -0
- package/examples/extensions/correctness-wall/repair-state.ts +77 -0
- package/examples/extensions/correctness-wall/wall-cache.ts +81 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/preset.ts +2 -2
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools-manager.js","sourceRoot":"","sources":["../../src/utils/tools-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAyB,SAAS,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC1G,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAC9B,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAEpC,SAAS,oBAAoB,GAAY;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IACtC,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,KAAK,KAAK,GAAG,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,MAAM,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC;AAAA,CACxF;AAWD,MAAM,KAAK,GAA+B;IACzC,EAAE,EAAE;QACH,IAAI,EAAE,IAAI;QACV,IAAI,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CAAC,EAAE,CAAC,CAAC,CAAC;QACvG,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;AAAA,CACD","sourcesContent":["import chalk from \"chalk\";\nimport { type SpawnSyncReturns, spawnSync } from \"child_process\";\nimport { chmodSync, createWriteStream, existsSync, mkdirSync, readdirSync, renameSync, rmSync } from \"fs\";\nimport { arch, platform } from \"os\";\nimport { join } from \"path\";\nimport { Readable } from \"stream\";\nimport { pipeline } from \"stream/promises\";\nimport { APP_NAME, getBinDir } from \"../config.ts\";\n\nconst TOOLS_DIR = getBinDir();\nconst NETWORK_TIMEOUT_MS = 10_000;\nconst DOWNLOAD_TIMEOUT_MS = 120_000;\n\nfunction isOfflineModeEnabled(): boolean {\n\tconst value = process.env.OMK_OFFLINE;\n\tif (!value) return false;\n\treturn value === \"1\" || value.toLowerCase() === \"true\" || value.toLowerCase() === \"yes\";\n}\n\ninterface ToolConfig {\n\tname: string;\n\trepo: string; // GitHub repo (e.g., \"sharkdp/fd\")\n\tbinaryName: string; // Name of the binary inside the archive\n\tsystemBinaryNames?: string[]; // Alternative system command names to try before downloading\n\ttagPrefix: string; // Prefix for tags (e.g., \"v\" for v1.0.0, \"\" for 1.0.0)\n\tgetAssetName: (version: string, plat: string, architecture: string) => string | null;\n}\n\nconst TOOLS: Record<string, ToolConfig> = {\n\tfd: {\n\t\tname: \"fd\",\n\t\trepo: \"sharkdp/fd\",\n\t\tbinaryName: \"fd\",\n\t\tsystemBinaryNames: [\"fd\", \"fdfind\"],\n\t\ttagPrefix: \"v\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-unknown-linux-gnu.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n\trg: {\n\t\tname: \"ripgrep\",\n\t\trepo: \"BurntSushi/ripgrep\",\n\t\tbinaryName: \"rg\",\n\t\ttagPrefix: \"\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tif (architecture === \"arm64\") {\n\t\t\t\t\treturn `ripgrep-${version}-aarch64-unknown-linux-gnu.tar.gz`;\n\t\t\t\t}\n\t\t\t\treturn `ripgrep-${version}-x86_64-unknown-linux-musl.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n};\n\n// Check if a command exists in PATH by trying to run it\nfunction commandExists(cmd: string): boolean {\n\ttry {\n\t\tconst result = spawnSync(cmd, [\"--version\"], { stdio: \"pipe\" });\n\t\t// Check for ENOENT error (command not found)\n\t\treturn result.error === undefined || result.error === null;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n// Get the path to a tool (system-wide or in our tools dir)\nexport function getToolPath(tool: \"fd\" | \"rg\"): string | null {\n\tconst config = TOOLS[tool];\n\tif (!config) return null;\n\n\t// Check our tools directory first\n\tconst localPath = join(TOOLS_DIR, config.binaryName + (platform() === \"win32\" ? \".exe\" : \"\"));\n\tif (existsSync(localPath)) {\n\t\treturn localPath;\n\t}\n\n\t// Check system PATH - if found, just return the command name (it's in PATH)\n\tconst systemBinaryNames = config.systemBinaryNames ?? [config.binaryName];\n\tfor (const systemBinaryName of systemBinaryNames) {\n\t\tif (commandExists(systemBinaryName)) {\n\t\t\treturn systemBinaryName;\n\t\t}\n\t}\n\n\treturn null;\n}\n\n// Fetch latest release version from GitHub\nasync function getLatestVersion(repo: string): Promise<string> {\n\tconst response = await fetch(`https://api.github.com/repos/${repo}/releases/latest`, {\n\t\theaders: { \"User-Agent\": `${APP_NAME}-coding-agent` },\n\t\tsignal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`GitHub API error: ${response.status}`);\n\t}\n\n\tconst data = (await response.json()) as { tag_name: string };\n\treturn data.tag_name.replace(/^v/, \"\");\n}\n\n// Download a file from URL\nasync function downloadFile(url: string, dest: string): Promise<void> {\n\tconst response = await fetch(url, {\n\t\tsignal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`Failed to download: ${response.status}`);\n\t}\n\n\tif (!response.body) {\n\t\tthrow new Error(\"No response body\");\n\t}\n\n\tconst fileStream = createWriteStream(dest);\n\tawait pipeline(Readable.fromWeb(response.body as any), fileStream);\n}\n\nfunction findBinaryRecursively(rootDir: string, binaryFileName: string): string | null {\n\tconst stack: string[] = [rootDir];\n\n\twhile (stack.length > 0) {\n\t\tconst currentDir = stack.pop();\n\t\tif (!currentDir) continue;\n\n\t\tconst entries = readdirSync(currentDir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = join(currentDir, entry.name);\n\t\t\tif (entry.isFile() && entry.name === binaryFileName) {\n\t\t\t\treturn fullPath;\n\t\t\t}\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tstack.push(fullPath);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction formatSpawnFailure(result: SpawnSyncReturns<Buffer>): string {\n\tif (result.error?.message) {\n\t\treturn result.error.message;\n\t}\n\tconst stderr = result.stderr?.toString().trim();\n\tif (stderr) {\n\t\treturn stderr;\n\t}\n\tconst stdout = result.stdout?.toString().trim();\n\tif (stdout) {\n\t\treturn stdout;\n\t}\n\treturn `exit status ${result.status ?? \"unknown\"}`;\n}\n\nfunction runExtractionCommand(command: string, args: string[]): string | null {\n\tconst result = spawnSync(command, args, { stdio: \"pipe\" });\n\tif (!result.error && result.status === 0) {\n\t\treturn null;\n\t}\n\treturn `${command}: ${formatSpawnFailure(result)}`;\n}\n\nfunction extractTarGzArchive(archivePath: string, extractDir: string, assetName: string): void {\n\tconst failure = runExtractionCommand(\"tar\", [\"xzf\", archivePath, \"-C\", extractDir]);\n\tif (failure) {\n\t\tthrow new Error(`Failed to extract ${assetName}: ${failure}`);\n\t}\n}\n\nfunction getWindowsTarCommand(): string {\n\tconst systemRoot = process.env.SystemRoot ?? process.env.WINDIR;\n\tif (systemRoot) {\n\t\tconst systemTar = join(systemRoot, \"System32\", \"tar.exe\");\n\t\tif (existsSync(systemTar)) {\n\t\t\treturn systemTar;\n\t\t}\n\t}\n\treturn \"tar.exe\";\n}\n\nfunction extractZipArchive(archivePath: string, extractDir: string, assetName: string): void {\n\tconst failures: string[] = [];\n\n\tif (platform() === \"win32\") {\n\t\t// Windows ships bsdtar as tar.exe, which supports zip files. Prefer the\n\t\t// System32 binary over Git Bash's GNU tar, which does not handle zip archives.\n\t\tconst tarFailure = runExtractionCommand(getWindowsTarCommand(), [\"xf\", archivePath, \"-C\", extractDir]);\n\t\tif (!tarFailure) return;\n\t\tfailures.push(tarFailure);\n\n\t\tconst script =\n\t\t\t\"& { param($archive, $destination) $ErrorActionPreference = 'Stop'; Expand-Archive -LiteralPath $archive -DestinationPath $destination -Force }\";\n\t\tconst powershellFailure = runExtractionCommand(\"powershell.exe\", [\n\t\t\t\"-NoLogo\",\n\t\t\t\"-NoProfile\",\n\t\t\t\"-NonInteractive\",\n\t\t\t\"-ExecutionPolicy\",\n\t\t\t\"Bypass\",\n\t\t\t\"-Command\",\n\t\t\tscript,\n\t\t\tarchivePath,\n\t\t\textractDir,\n\t\t]);\n\t\tif (!powershellFailure) return;\n\t\tfailures.push(powershellFailure);\n\t} else {\n\t\tconst unzipFailure = runExtractionCommand(\"unzip\", [\"-q\", archivePath, \"-d\", extractDir]);\n\t\tif (!unzipFailure) return;\n\t\tfailures.push(unzipFailure);\n\n\t\tconst tarFailure = runExtractionCommand(\"tar\", [\"xf\", archivePath, \"-C\", extractDir]);\n\t\tif (!tarFailure) return;\n\t\tfailures.push(tarFailure);\n\t}\n\n\tthrow new Error(`Failed to extract ${assetName}: ${failures.join(\"; \")}`);\n}\n\n// Download and install a tool\nasync function downloadTool(tool: \"fd\" | \"rg\"): Promise<string> {\n\tconst config = TOOLS[tool];\n\tif (!config) throw new Error(`Unknown tool: ${tool}`);\n\n\tconst plat = platform();\n\tconst architecture = arch();\n\n\t// Get latest version\n\tlet version = await getLatestVersion(config.repo);\n\tif (tool === \"fd\" && plat === \"darwin\" && architecture === \"x64\") {\n\t\tversion = \"10.3.0\";\n\t}\n\n\t// Get asset name for this platform\n\tconst assetName = config.getAssetName(version, plat, architecture);\n\tif (!assetName) {\n\t\tthrow new Error(`Unsupported platform: ${plat}/${architecture}`);\n\t}\n\n\t// Create tools directory\n\tmkdirSync(TOOLS_DIR, { recursive: true });\n\n\tconst downloadUrl = `https://github.com/${config.repo}/releases/download/${config.tagPrefix}${version}/${assetName}`;\n\tconst archivePath = join(TOOLS_DIR, assetName);\n\tconst binaryExt = plat === \"win32\" ? \".exe\" : \"\";\n\tconst binaryPath = join(TOOLS_DIR, config.binaryName + binaryExt);\n\n\t// Download\n\tawait downloadFile(downloadUrl, archivePath);\n\n\t// Extract into a unique temp directory. fd and rg downloads can run concurrently\n\t// during startup, so sharing a fixed directory causes races.\n\tconst extractDir = join(\n\t\tTOOLS_DIR,\n\t\t`extract_tmp_${config.binaryName}_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,\n\t);\n\tmkdirSync(extractDir, { recursive: true });\n\n\ttry {\n\t\tif (assetName.endsWith(\".tar.gz\")) {\n\t\t\textractTarGzArchive(archivePath, extractDir, assetName);\n\t\t} else if (assetName.endsWith(\".zip\")) {\n\t\t\textractZipArchive(archivePath, extractDir, assetName);\n\t\t} else {\n\t\t\tthrow new Error(`Unsupported archive format: ${assetName}`);\n\t\t}\n\n\t\t// Find the binary in extracted files. Some archives contain files directly\n\t\t// at root, others nest under a versioned subdirectory.\n\t\tconst binaryFileName = config.binaryName + binaryExt;\n\t\tconst extractedDir = join(extractDir, assetName.replace(/\\.(tar\\.gz|zip)$/, \"\"));\n\t\tconst extractedBinaryCandidates = [join(extractedDir, binaryFileName), join(extractDir, binaryFileName)];\n\t\tlet extractedBinary = extractedBinaryCandidates.find((candidate) => existsSync(candidate));\n\n\t\tif (!extractedBinary) {\n\t\t\textractedBinary = findBinaryRecursively(extractDir, binaryFileName) ?? undefined;\n\t\t}\n\n\t\tif (extractedBinary) {\n\t\t\trenameSync(extractedBinary, binaryPath);\n\t\t} else {\n\t\t\tthrow new Error(`Binary not found in archive: expected ${binaryFileName} under ${extractDir}`);\n\t\t}\n\n\t\t// Make executable (Unix only)\n\t\tif (plat !== \"win32\") {\n\t\t\tchmodSync(binaryPath, 0o755);\n\t\t}\n\t} finally {\n\t\t// Cleanup\n\t\trmSync(archivePath, { force: true });\n\t\trmSync(extractDir, { recursive: true, force: true });\n\t}\n\n\treturn binaryPath;\n}\n\n// Termux package names for tools\nconst TERMUX_PACKAGES: Record<string, string> = {\n\tfd: \"fd\",\n\trg: \"ripgrep\",\n};\n\n// Ensure a tool is available, downloading if necessary\n// Returns the path to the tool, or null if unavailable\nexport async function ensureTool(tool: \"fd\" | \"rg\", silent: boolean = false): Promise<string | undefined> {\n\tconst existingPath = getToolPath(tool);\n\tif (existingPath) {\n\t\treturn existingPath;\n\t}\n\n\tconst config = TOOLS[tool];\n\tif (!config) return undefined;\n\n\tif (isOfflineModeEnabled()) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Offline mode enabled, skipping download.`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// On Android/Termux, Linux binaries don't work due to Bionic libc incompatibility.\n\t// Users must install via pkg.\n\tif (platform() === \"android\") {\n\t\tconst pkgName = TERMUX_PACKAGES[tool] ?? tool;\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Install with: pkg install ${pkgName}`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// Tool not found - download it\n\tif (!silent) {\n\t\tconsole.log(chalk.dim(`${config.name} not found. Downloading...`));\n\t}\n\n\ttry {\n\t\tconst path = await downloadTool(tool);\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.dim(`${config.name} installed to ${path}`));\n\t\t}\n\t\treturn path;\n\t} catch (e) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`Failed to download ${config.name}: ${e instanceof Error ? e.message : e}`));\n\t\t}\n\t\treturn undefined;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tools-manager.js","sourceRoot":"","sources":["../../src/utils/tools-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAyB,SAAS,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC1G,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MA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AAC,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvG,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;AAAA,CACD","sourcesContent":["import chalk from \"chalk\";\nimport { type SpawnSyncReturns, spawnSync } from \"child_process\";\nimport { chmodSync, createWriteStream, existsSync, mkdirSync, readdirSync, renameSync, rmSync } from \"fs\";\nimport { arch, platform } from \"os\";\nimport { join } from \"path\";\nimport { Readable } from \"stream\";\nimport { pipeline } from \"stream/promises\";\nimport { APP_NAME, getBinDir } from \"../config.ts\";\n\nconst TOOLS_DIR = getBinDir();\nconst NETWORK_TIMEOUT_MS = 10_000;\nconst DOWNLOAD_TIMEOUT_MS = 120_000;\n\nfunction isOfflineModeEnabled(): boolean {\n\tconst value = process.env.OMK_OFFLINE;\n\tif (!value) return false;\n\treturn value === \"1\" || value.toLowerCase() === \"true\" || value.toLowerCase() === \"yes\";\n}\n\nexport type ManagedTool = \"fd\" | \"rg\" | \"codexbar\";\n\ninterface ToolConfig {\n\treadonly name: string;\n\treadonly repo?: string; // GitHub repo (e.g., \"sharkdp/fd\") when auto-download is supported\n\treadonly binaryName: string; // Name of the binary inside the archive\n\treadonly systemBinaryNames?: readonly string[]; // Alternative system command names to try before downloading\n\treadonly preferSystemBinary?: boolean;\n\treadonly tagPrefix?: string; // Prefix for tags (e.g., \"v\" for v1.0.0, \"\" for 1.0.0)\n\treadonly getAssetName: (version: string, plat: string, architecture: string) => string | null;\n\treadonly downloadUnsupportedMessage?: string;\n}\n\nconst TOOLS: Record<ManagedTool, ToolConfig> = {\n\tfd: {\n\t\tname: \"fd\",\n\t\trepo: \"sharkdp/fd\",\n\t\tbinaryName: \"fd\",\n\t\tsystemBinaryNames: [\"fd\", \"fdfind\"],\n\t\ttagPrefix: \"v\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-unknown-linux-gnu.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n\trg: {\n\t\tname: \"ripgrep\",\n\t\trepo: \"BurntSushi/ripgrep\",\n\t\tbinaryName: \"rg\",\n\t\ttagPrefix: \"\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tif (architecture === \"arm64\") {\n\t\t\t\t\treturn `ripgrep-${version}-aarch64-unknown-linux-gnu.tar.gz`;\n\t\t\t\t}\n\t\t\t\treturn `ripgrep-${version}-x86_64-unknown-linux-musl.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n\tcodexbar: {\n\t\tname: \"CodexBar\",\n\t\tbinaryName: \"codexbar\",\n\t\tsystemBinaryNames: [\"codexbar\"],\n\t\tpreferSystemBinary: true,\n\t\tgetAssetName: () => null,\n\t\tdownloadUnsupportedMessage: \"CodexBar auto-download is not configured; install codexbar on PATH.\",\n\t},\n};\n\n// Check if a command exists in PATH by trying to run it\nfunction commandExists(cmd: string): boolean {\n\ttry {\n\t\tconst result = spawnSync(cmd, [\"--version\"], { stdio: \"pipe\" });\n\t\t// Check for ENOENT error (command not found)\n\t\treturn result.error === undefined || result.error === null;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n// Get the path to a tool (system-wide or in our tools dir)\nexport function getToolPath(tool: ManagedTool): string | null {\n\tconst config = TOOLS[tool];\n\tconst systemBinaryNames = config.systemBinaryNames ?? [config.binaryName];\n\tconst getSystemPath = (): string | null => {\n\t\tfor (const systemBinaryName of systemBinaryNames) {\n\t\t\tif (commandExists(systemBinaryName)) {\n\t\t\t\treturn systemBinaryName;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t};\n\n\tif (config.preferSystemBinary) {\n\t\tconst systemPath = getSystemPath();\n\t\tif (systemPath) return systemPath;\n\t}\n\n\tconst localPath = join(TOOLS_DIR, config.binaryName + (platform() === \"win32\" ? \".exe\" : \"\"));\n\tif (existsSync(localPath)) {\n\t\treturn localPath;\n\t}\n\n\treturn config.preferSystemBinary ? null : getSystemPath();\n}\n\n// Fetch latest release version from GitHub\nasync function getLatestVersion(repo: string): Promise<string> {\n\tconst response = await fetch(`https://api.github.com/repos/${repo}/releases/latest`, {\n\t\theaders: { \"User-Agent\": `${APP_NAME}-coding-agent` },\n\t\tsignal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`GitHub API error: ${response.status}`);\n\t}\n\n\tconst data = (await response.json()) as { tag_name: string };\n\treturn data.tag_name.replace(/^v/, \"\");\n}\n\n// Download a file from URL\nasync function downloadFile(url: string, dest: string): Promise<void> {\n\tconst response = await fetch(url, {\n\t\tsignal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`Failed to download: ${response.status}`);\n\t}\n\n\tif (!response.body) {\n\t\tthrow new Error(\"No response body\");\n\t}\n\n\tconst fileStream = createWriteStream(dest);\n\tawait pipeline(Readable.fromWeb(response.body as any), fileStream);\n}\n\nfunction findBinaryRecursively(rootDir: string, binaryFileName: string): string | null {\n\tconst stack: string[] = [rootDir];\n\n\twhile (stack.length > 0) {\n\t\tconst currentDir = stack.pop();\n\t\tif (!currentDir) continue;\n\n\t\tconst entries = readdirSync(currentDir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = join(currentDir, entry.name);\n\t\t\tif (entry.isFile() && entry.name === binaryFileName) {\n\t\t\t\treturn fullPath;\n\t\t\t}\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tstack.push(fullPath);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction formatSpawnFailure(result: SpawnSyncReturns<Buffer>): string {\n\tif (result.error?.message) {\n\t\treturn result.error.message;\n\t}\n\tconst stderr = result.stderr?.toString().trim();\n\tif (stderr) {\n\t\treturn stderr;\n\t}\n\tconst stdout = result.stdout?.toString().trim();\n\tif (stdout) {\n\t\treturn stdout;\n\t}\n\treturn `exit status ${result.status ?? \"unknown\"}`;\n}\n\nfunction runExtractionCommand(command: string, args: string[]): string | null {\n\tconst result = spawnSync(command, args, { stdio: \"pipe\" });\n\tif (!result.error && result.status === 0) {\n\t\treturn null;\n\t}\n\treturn `${command}: ${formatSpawnFailure(result)}`;\n}\n\nfunction extractTarGzArchive(archivePath: string, extractDir: string, assetName: string): void {\n\tconst failure = runExtractionCommand(\"tar\", [\"xzf\", archivePath, \"-C\", extractDir]);\n\tif (failure) {\n\t\tthrow new Error(`Failed to extract ${assetName}: ${failure}`);\n\t}\n}\n\nfunction getWindowsTarCommand(): string {\n\tconst systemRoot = process.env.SystemRoot ?? process.env.WINDIR;\n\tif (systemRoot) {\n\t\tconst systemTar = join(systemRoot, \"System32\", \"tar.exe\");\n\t\tif (existsSync(systemTar)) {\n\t\t\treturn systemTar;\n\t\t}\n\t}\n\treturn \"tar.exe\";\n}\n\nfunction extractZipArchive(archivePath: string, extractDir: string, assetName: string): void {\n\tconst failures: string[] = [];\n\n\tif (platform() === \"win32\") {\n\t\t// Windows ships bsdtar as tar.exe, which supports zip files. Prefer the\n\t\t// System32 binary over Git Bash's GNU tar, which does not handle zip archives.\n\t\tconst tarFailure = runExtractionCommand(getWindowsTarCommand(), [\"xf\", archivePath, \"-C\", extractDir]);\n\t\tif (!tarFailure) return;\n\t\tfailures.push(tarFailure);\n\n\t\tconst script =\n\t\t\t\"& { param($archive, $destination) $ErrorActionPreference = 'Stop'; Expand-Archive -LiteralPath $archive -DestinationPath $destination -Force }\";\n\t\tconst powershellFailure = runExtractionCommand(\"powershell.exe\", [\n\t\t\t\"-NoLogo\",\n\t\t\t\"-NoProfile\",\n\t\t\t\"-NonInteractive\",\n\t\t\t\"-ExecutionPolicy\",\n\t\t\t\"Bypass\",\n\t\t\t\"-Command\",\n\t\t\tscript,\n\t\t\tarchivePath,\n\t\t\textractDir,\n\t\t]);\n\t\tif (!powershellFailure) return;\n\t\tfailures.push(powershellFailure);\n\t} else {\n\t\tconst unzipFailure = runExtractionCommand(\"unzip\", [\"-q\", archivePath, \"-d\", extractDir]);\n\t\tif (!unzipFailure) return;\n\t\tfailures.push(unzipFailure);\n\n\t\tconst tarFailure = runExtractionCommand(\"tar\", [\"xf\", archivePath, \"-C\", extractDir]);\n\t\tif (!tarFailure) return;\n\t\tfailures.push(tarFailure);\n\t}\n\n\tthrow new Error(`Failed to extract ${assetName}: ${failures.join(\"; \")}`);\n}\n\n// Download and install a tool\nasync function downloadTool(tool: ManagedTool): Promise<string> {\n\tconst config = TOOLS[tool];\n\tif (config.downloadUnsupportedMessage) {\n\t\tthrow new Error(config.downloadUnsupportedMessage);\n\t}\n\tif (!config.repo || config.tagPrefix === undefined) {\n\t\tthrow new Error(`${config.name} auto-download is not configured; install ${config.binaryName} on PATH.`);\n\t}\n\n\tconst plat = platform();\n\tconst architecture = arch();\n\n\t// Get latest version\n\tlet version = await getLatestVersion(config.repo);\n\tif (tool === \"fd\" && plat === \"darwin\" && architecture === \"x64\") {\n\t\tversion = \"10.3.0\";\n\t}\n\n\t// Get asset name for this platform\n\tconst assetName = config.getAssetName(version, plat, architecture);\n\tif (!assetName) {\n\t\tthrow new Error(`Unsupported platform: ${plat}/${architecture}`);\n\t}\n\n\t// Create tools directory\n\tmkdirSync(TOOLS_DIR, { recursive: true });\n\n\tconst downloadUrl = `https://github.com/${config.repo}/releases/download/${config.tagPrefix}${version}/${assetName}`;\n\tconst archivePath = join(TOOLS_DIR, assetName);\n\tconst binaryExt = plat === \"win32\" ? \".exe\" : \"\";\n\tconst binaryPath = join(TOOLS_DIR, config.binaryName + binaryExt);\n\n\t// Download\n\tawait downloadFile(downloadUrl, archivePath);\n\n\t// Extract into a unique temp directory. fd and rg downloads can run concurrently\n\t// during startup, so sharing a fixed directory causes races.\n\tconst extractDir = join(\n\t\tTOOLS_DIR,\n\t\t`extract_tmp_${config.binaryName}_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,\n\t);\n\tmkdirSync(extractDir, { recursive: true });\n\n\ttry {\n\t\tif (assetName.endsWith(\".tar.gz\")) {\n\t\t\textractTarGzArchive(archivePath, extractDir, assetName);\n\t\t} else if (assetName.endsWith(\".zip\")) {\n\t\t\textractZipArchive(archivePath, extractDir, assetName);\n\t\t} else {\n\t\t\tthrow new Error(`Unsupported archive format: ${assetName}`);\n\t\t}\n\n\t\t// Find the binary in extracted files. Some archives contain files directly\n\t\t// at root, others nest under a versioned subdirectory.\n\t\tconst binaryFileName = config.binaryName + binaryExt;\n\t\tconst extractedDir = join(extractDir, assetName.replace(/\\.(tar\\.gz|zip)$/, \"\"));\n\t\tconst extractedBinaryCandidates = [join(extractedDir, binaryFileName), join(extractDir, binaryFileName)];\n\t\tlet extractedBinary = extractedBinaryCandidates.find((candidate) => existsSync(candidate));\n\n\t\tif (!extractedBinary) {\n\t\t\textractedBinary = findBinaryRecursively(extractDir, binaryFileName) ?? undefined;\n\t\t}\n\n\t\tif (extractedBinary) {\n\t\t\trenameSync(extractedBinary, binaryPath);\n\t\t} else {\n\t\t\tthrow new Error(`Binary not found in archive: expected ${binaryFileName} under ${extractDir}`);\n\t\t}\n\n\t\t// Make executable (Unix only)\n\t\tif (plat !== \"win32\") {\n\t\t\tchmodSync(binaryPath, 0o755);\n\t\t}\n\t} finally {\n\t\t// Cleanup\n\t\trmSync(archivePath, { force: true });\n\t\trmSync(extractDir, { recursive: true, force: true });\n\t}\n\n\treturn binaryPath;\n}\n\n// Termux package names for tools\nconst TERMUX_PACKAGES: Partial<Record<ManagedTool, string>> = {\n\tfd: \"fd\",\n\trg: \"ripgrep\",\n};\n\n// Ensure a tool is available, downloading if necessary\n// Returns the path to the tool, or undefined if unavailable\nexport async function ensureTool(tool: ManagedTool, silent: boolean = false): Promise<string | undefined> {\n\tconst existingPath = getToolPath(tool);\n\tif (existingPath) {\n\t\treturn existingPath;\n\t}\n\n\tconst config = TOOLS[tool];\n\n\tif (isOfflineModeEnabled()) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Offline mode enabled, skipping download.`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// On Android/Termux, Linux binaries don't work due to Bionic libc incompatibility.\n\t// Users must install via pkg.\n\tif (platform() === \"android\") {\n\t\tconst pkgName = TERMUX_PACKAGES[tool];\n\t\tif (!silent) {\n\t\t\tif (pkgName) {\n\t\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Install with: pkg install ${pkgName}`));\n\t\t\t} else {\n\t\t\t\tconsole.log(\n\t\t\t\t\tchalk.yellow(\n\t\t\t\t\t\t`${config.name} not found. No Termux package is configured; install ${config.binaryName} on PATH.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tif (config.downloadUnsupportedMessage) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. ${config.downloadUnsupportedMessage}`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// Tool not found - download it\n\tif (!silent) {\n\t\tconsole.log(chalk.dim(`${config.name} not found. Downloading...`));\n\t}\n\n\ttry {\n\t\tconst path = await downloadTool(tool);\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.dim(`${config.name} installed to ${path}`));\n\t\t}\n\t\treturn path;\n\t} catch (e) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`Failed to download ${config.name}: ${e instanceof Error ? e.message : e}`));\n\t\t}\n\t\treturn undefined;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# AdaptTorch Preview Algorithm
|
|
2
|
+
|
|
3
|
+
## English — AdaptTorch Preview Algorithm
|
|
4
|
+
|
|
5
|
+
**AdaptTorch Preview** is a **read-first planning pipeline** for OMK sessions that need AdaptOrch-aware routing without prematurely submitting control-plane runs. It composes domain loadout signals, optional local topology classification (`adaptorch_capabilities`, `adaptorch_route_topology`), lane grants with explicit write scopes, dispatch cardinality hypotheses, and adjudicator evidence contracts—then hands a `PreviewResult` to the root coordinator for DAG execution or deterministic fallback.
|
|
6
|
+
|
|
7
|
+
Use preview when:
|
|
8
|
+
|
|
9
|
+
- Decomposing a goal into parallel lanes with non-overlapping writers.
|
|
10
|
+
- Deciding whether AdaptOrch adds value beyond local OMK routing (explorer → planner → coder → tester → reviewer).
|
|
11
|
+
- Documenting what evidence must exist before claiming verification or synthesis.
|
|
12
|
+
|
|
13
|
+
Do **not** treat preview output as proof that `adaptorch_run` completed; terminal run status, artifacts, and tests remain the evidence classes for execution claims.
|
|
14
|
+
|
|
15
|
+
Related packages:
|
|
16
|
+
|
|
17
|
+
- Experimental WPL loop design: `packages/adaptorch-wpl/` (design-stage; not wired into the default OMK CLI).
|
|
18
|
+
- Advisory bridge (default-off): `packages/coding-agent/src/core/adaptorch-bridge.ts`.
|
|
19
|
+
- Grok + AdaptOrch presets: [grok-harness.md](./grok-harness.md).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 한국어 — AdaptTorch 프리뷰 알고리즘
|
|
24
|
+
|
|
25
|
+
**AdaptTorch Preview**는 AdaptOrch 제어 평면에 `adaptorch_run`을 **아직 제출하지 않은 상태**에서, OMK가 도메인 신호·토폴로지 분류·레인 그랜트·디스패치 규모 가설·검증 증거 계약을 한 번에 정리하는 **읽기 우선 계획 파이프라인**입니다. 결과 `PreviewResult`는 루트 코디네이터가 DAG 병렬 실행 또는 로컬 폴백을 선택할 때 사용합니다.
|
|
26
|
+
|
|
27
|
+
프리뷰를 쓰는 경우:
|
|
28
|
+
|
|
29
|
+
- 동일 파일을 두 레인이 쓰지 않도록 쓰기 범위를 나눈 병렬 작업을 설계할 때.
|
|
30
|
+
- AdaptOrch가 로컬 OMK 라우팅보다 실질적 이득이 있는지(탐색 → 계획 → 구현 → 테스트 → 리뷰) 판단할 때.
|
|
31
|
+
- "완료"·"검증됨"을 주장하기 전에 어떤 증거 파일·명령 출력이 필요한지 문서화할 때.
|
|
32
|
+
|
|
33
|
+
프리뷰 결과만으로 `adaptorch_run`이 성공했다고 **주장하면 안 됩니다**. 실행 주장에는 터미널 run 상태, 아티팩트, 테스트/체크 출력이 필요합니다.
|
|
34
|
+
|
|
35
|
+
관련 경로:
|
|
36
|
+
|
|
37
|
+
- 실험 WPL 루프: `packages/adaptorch-wpl/` (설계 단계, 기본 CLI 미연결).
|
|
38
|
+
- 어드바이저리 브리지(기본 비활성): `packages/coding-agent/src/core/adaptorch-bridge.ts`.
|
|
39
|
+
- Grok 세션: [grok-harness.md](./grok-harness.md).
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Claim boundary (allowed vs forbidden phrasing)
|
|
44
|
+
|
|
45
|
+
| Forbidden (do not say without execution evidence) | Allowed (preview / planning) |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| "AdaptOrch finished the task" / "run succeeded" | "Topology preview classified as DAG" |
|
|
48
|
+
| "Verified in production" / "deployed via AdaptOrch" | "Lane grants composed; evidence path is …" |
|
|
49
|
+
| "AdaptOrch proved correctness" | "Skipped AdaptOrch: no verified transport" |
|
|
50
|
+
| "Automatically executed the loop" | "Preview recommends `adaptorch_route_topology` then local synthesis" |
|
|
51
|
+
| Implying OAuth/token health without bounded check output | "Use read/local tools only until transport is granted" |
|
|
52
|
+
| "OMK guarantees" outcomes | "Models execute. OMK routes, verifies, measures, and controls." |
|
|
53
|
+
|
|
54
|
+
When in doubt, cite an evidence class from `AGENTS.md` (read, diff, test output, `npm run check`) or point to `.omk/goals/<id>/evidence/`.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Full structured spec (LaTeX-aligned)
|
|
59
|
+
|
|
60
|
+
The canonical stage breakdown (Inputs, Stages A–F, Algorithms 1–3 as pseudocode) lives in the goal artifact:
|
|
61
|
+
|
|
62
|
+
**[laneF-preview-spec.md](../../../.omk/goals/adaptorch-preview-omk-plan-2026-07-08/laneF-preview-spec.md)**
|
|
63
|
+
|
|
64
|
+
Use that file for implementation planning; this page is the operator-facing intro and claim boundary.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## OMK positioning
|
|
69
|
+
|
|
70
|
+
Models execute; **OMK routes, verifies, measures, and controls**. AdaptTorch Preview sits in the **route + verify** layer: it turns ambiguous goals into explicit lane grants and evidence contracts before any model spends write tokens on shared paths. AdaptOrch MCP tools may inform topology, but lane authority, hooks, and success predicates remain OMK-owned unless the user explicitly delegates a mutating control-plane lane.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Grok sessions
|
|
75
|
+
|
|
76
|
+
For provider presets, Imagine tool discipline, and when to load AdaptOrch skills on Grok chat models, see **[grok-harness.md](./grok-harness.md)** (canonical playbook: `~/.omk/agent/grok.md`).
|
|
77
|
+
|
|
78
|
+
## Correctness Wall (preview)
|
|
79
|
+
|
|
80
|
+
For **patch apply safety** (scope, secret-shaped diff lines, optional outcome adjudication), use the B2C **Correctness Wall** harness — not to be confused with this planning preview.
|
|
81
|
+
|
|
82
|
+
- Canonical doc: **[correctness-wall.md](./correctness-wall.md)**
|
|
83
|
+
- User verdicts: **PASS**, **ADVISORY**, **INCONCLUSIVE**, **BLOCKED** with next actions **Apply**, **Deep Check**, **Regenerate**
|
|
84
|
+
- **This wall is not proof of correctness**; it is a conservative, evidence-limited screen before applying AI-generated edits.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Correctness Wall (B2C patch safety harness)
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
The **Correctness Wall** is a **policy- and evidence-limited screen** for AI-proposed patches in OMK. It runs **before** `edit` / `write` apply (via the `correctness-wall` extension) or on demand through the `correctness_wall_evaluate` tool.
|
|
6
|
+
|
|
7
|
+
It helps answer:
|
|
8
|
+
|
|
9
|
+
- Are changed paths inside an **approved write scope**?
|
|
10
|
+
- Does the diff look like it may contain **secrets**?
|
|
11
|
+
- When run evidence exists, does **outcome adjudication** corroborate success?
|
|
12
|
+
|
|
13
|
+
It does **not** prove that code is correct, complete, or safe for production.
|
|
14
|
+
|
|
15
|
+
## 4-state user verdict
|
|
16
|
+
|
|
17
|
+
| Verdict | Meaning (default apply behavior) |
|
|
18
|
+
|---------|----------------------------------|
|
|
19
|
+
| **PASS** | Fast wall (and optional OA) found no blocking issues. |
|
|
20
|
+
| **ADVISORY** | Proceed with caution; preview limits or weak discrimination may apply. |
|
|
21
|
+
| **INCONCLUSIVE** | Not enough evidence (empty diff, missing fixture, verifier error). |
|
|
22
|
+
| **BLOCKED** | Scope, secret heuristic, or OA contradiction — do not apply by default. |
|
|
23
|
+
|
|
24
|
+
Structured next steps on the verdict card: **Apply**, **Deep Check**, **Regenerate** (see `packages/adaptorch-wpl` B2C mapper).
|
|
25
|
+
|
|
26
|
+
**Can apply** vs **should submit** are separate gates on the verification receipt: mechanical apply safety is not the same as trusting downstream submission.
|
|
27
|
+
|
|
28
|
+
## Fast wall vs deep wall
|
|
29
|
+
|
|
30
|
+
- **Fast wall (default):** Pure policy — diff paths, scope globs, secret-shaped lines, preview-only limits (`BATCH1_NO_DOCKER_RUNNER`). No Docker runner in batch 1.
|
|
31
|
+
- **Deep wall (Pro / future):** Hermetic paired base/patch replay. Today `deepWall: true` returns **unavailable** with the same batch-1 limit code.
|
|
32
|
+
|
|
33
|
+
## Relationship to Adaptorch
|
|
34
|
+
|
|
35
|
+
- Hidden engine: `omk-adaptorch-wpl` (`evaluateCorrectnessWall`, outcome adjudicator, repair hints).
|
|
36
|
+
- Optional OA path: `runIds` + `previewOnly: false` + in-memory or MCP transport.
|
|
37
|
+
- Adaptorch **preview** planning is separate; see [adaptorch-preview.md](./adaptorch-preview.md).
|
|
38
|
+
|
|
39
|
+
## Operator environment
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
omk --extension packages/coding-agent/examples/extensions/correctness-wall/index.ts
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
| Variable | Role |
|
|
46
|
+
|----------|------|
|
|
47
|
+
| `OMK_PATCH_SAFETY_WALL_MODE` | `shadow` (default), `soft`, `hard` |
|
|
48
|
+
| `OMK_WALL_SCOPE` | Comma-separated path globs |
|
|
49
|
+
| `OMK_WALL_OVERRIDE` | Soft-mode override for BLOCKED |
|
|
50
|
+
| `OMK_WALL_REPAIR_BUDGET` | Capped regenerate hints (default 1) |
|
|
51
|
+
| `OMK_WALL_OA_FIXTURE_PATH` | JSON fixture for local OA adjudication |
|
|
52
|
+
| `OMK_WALL_AUTO_REGENERATE` | Capped `regeneratePacket` in tool JSON (hints only) |
|
|
53
|
+
| `OMK_WALL_RECEIPT_SIGNING_SECRET` | Optional HMAC `signedReceipt` on verification receipt |
|
|
54
|
+
| `OMK_WALL_DEEP_PHASE` | `stub` (default) or `docker` (intent only; runner not wired) |
|
|
55
|
+
| `OMK_WALL_OA_TRANSPORT` | `fixture` (default) or `mcp` / `live` (session `callTool` injection) |
|
|
56
|
+
|
|
57
|
+
Telemetry (no diff bodies): `.omk/wall-cache/latest.json`, `shadow-telemetry.ndjson`, `repair-budget.json`.
|
|
58
|
+
|
|
59
|
+
## Explicit non-goals
|
|
60
|
+
|
|
61
|
+
- **Not proof of correctness** or formal verification.
|
|
62
|
+
- Does not replace human review, CI, or full `npm run check` / test suites.
|
|
63
|
+
- Does not expose internal thresholds, AST overlap, or raw repro bodies to end users.
|
|
64
|
+
|
|
65
|
+
## Loadout & preset
|
|
66
|
+
|
|
67
|
+
The correctness wall is **not** part of the default `omk-core-verified` preset or any built-in role loadout in `packages/coding-agent/src/core/loadouts.ts`. Operators opt in explicitly:
|
|
68
|
+
|
|
69
|
+
| Surface | How to enable |
|
|
70
|
+
|---------|----------------|
|
|
71
|
+
| **Session** | `omk --extension packages/coding-agent/examples/extensions/correctness-wall/index.ts` (or a copy under `~/.omk/agent/extensions/correctness-wall/`) |
|
|
72
|
+
| **Scope** | `OMK_WALL_SCOPE` — comma-separated path globs that approve write targets in the diff |
|
|
73
|
+
| **Mode** | `OMK_PATCH_SAFETY_WALL_MODE` — `shadow` \| `soft` \| `hard` (see [Operator environment](#operator-environment)) |
|
|
74
|
+
| **Role loadouts** | `code` / `executor` lanes still get `pre-shell-guard`, `protect-secrets`, and `typecheck-after-edit`; the wall **adds** a pre-apply policy gate on `edit` / `write` only when the extension is loaded |
|
|
75
|
+
| **Domain router** | No dedicated domain profile today; patch-safety work may route to [`ai-agent-ops`](./loadout-domains/ai-agent-ops.md) for harness/eval discipline, but that does **not** auto-load this extension |
|
|
76
|
+
|
|
77
|
+
**Future hook (code, not batch-1):** `packages/coding-agent/src/core/domain-loadouts.ts` could gain triggers (e.g. `patch safety`, `correctness wall`) and a curated extension entry pointing at the correctness-wall example. Until then, document-only reference — do not hand-edit auto-generated files under `docs/loadout-domains/`.
|
|
78
|
+
|
|
79
|
+
Regression coverage for the wall library surface lives in `packages/coding-agent/test/suite/regressions/018-b2c-correctness-wall.test.ts` (imports `omk-adaptorch-wpl` the same way the extension does).
|
|
80
|
+
|
|
81
|
+
## Recommended rollout: shadow → soft → hard
|
|
82
|
+
|
|
83
|
+
Roll out in **three phases** so telemetry and false positives are understood before writes are blocked.
|
|
84
|
+
|
|
85
|
+
| Phase | `OMK_PATCH_SAFETY_WALL_MODE` | Operator expectation |
|
|
86
|
+
|-------|------------------------------|--------------------|
|
|
87
|
+
| **1 — Shadow** | `shadow` (default) | All `edit` / `write` calls proceed. Verdicts land in `.omk/wall-cache/latest.json` and `shadow-telemetry.ndjson`. Review BLOCKED/INCONCLUSIVE rates and tune `OMK_WALL_SCOPE`. |
|
|
88
|
+
| **2 — Soft** | `soft` | **BLOCKED** verdicts block apply unless `OMK_WALL_OVERRIDE=1` (or `true` / `yes`). **INCONCLUSIVE** still applies in shadow-like fashion for scope tuning. Use for pilot teams with an explicit override path. |
|
|
89
|
+
| **3 — Hard** | `hard` | **BLOCKED** and **INCONCLUSIVE** both block `edit` / `write`. Reserve for repos with stable scope globs, OA fixtures wired (`OMK_WALL_RUN_IDS` + `OMK_WALL_OA_FIXTURE_PATH`), and acceptable INCONCLUSIVE rate (missing files, empty diff). |
|
|
90
|
+
|
|
91
|
+
**Checklist between phases**
|
|
92
|
+
|
|
93
|
+
1. AC-1 vitest green for `packages/adaptorch-wpl` and regression `018-b2c-correctness-wall`.
|
|
94
|
+
2. Root `npm run check` green after any source touch (includes unrelated **browser-smoke** esbuild gate — wall work does not require loading the extension in that script).
|
|
95
|
+
3. Shadow NDJSON reviewed: no systematic secret false negatives; scope globs cover intended packages only.
|
|
96
|
+
4. Document team override policy before enabling **soft**.
|
|
97
|
+
|
|
98
|
+
## Wave 2 / Wave 3 roadmap (pointer)
|
|
99
|
+
|
|
100
|
+
Goal orchestration v2 artifacts (planner P3) live beside batch-1 plan files:
|
|
101
|
+
|
|
102
|
+
| Artifact | Path |
|
|
103
|
+
|----------|------|
|
|
104
|
+
| 11-step evaluation algorithm + decision table | `.omk/goals/b2c-correctness-wall-2026-07-08/algorithm-v2.md` |
|
|
105
|
+
| Three-wave execution DAG (JSON) | `.omk/goals/b2c-correctness-wall-2026-07-08/dag-v2.json` |
|
|
106
|
+
| Explorer: browser-smoke vs extension load + loadout gaps | `.omk/goals/b2c-correctness-wall-2026-07-08/laneE-explorer.md` |
|
|
107
|
+
|
|
108
|
+
**Wave 2 (prove / integrate):** wire `AdaptOrchClient` on hooks when session has run context; lift `BATCH1_NO_DOCKER_RUNNER` for non-preview deep wall; optional preset documentation in `~/.omk/runtime-preset.json` comments only (no default-on extension).
|
|
109
|
+
|
|
110
|
+
**Wave 3 (productize):** publish `omk-adaptorch-wpl` from `dist/` for out-of-monorepo extensions; optional `domain-loadouts.ts` profile + `gen-domain-docs.mjs` regen; default **soft** for internal dogfood presets after Wave 2 evidence.
|
|
111
|
+
|
|
112
|
+
## See also
|
|
113
|
+
|
|
114
|
+
- [adaptorch-preview.md](./adaptorch-preview.md)
|
|
115
|
+
- [LOADOUT.md](../examples/extensions/correctness-wall/LOADOUT.md) — copy-paste for `omk-core-verified` sessions
|
|
116
|
+
- Goal artifacts: `.omk/goals/b2c-correctness-wall-2026-07-08/` (`algorithm-v2.md`, `dag-v2.json`)
|
|
117
|
+
- Extension README: `packages/coding-agent/examples/extensions/correctness-wall/README.md`
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Grok harness
|
|
2
|
+
|
|
3
|
+
This page is the project-local operator guide for running OMK with the xAI OAuth proxy. The canonical Grok playbook remains `~/.omk/agent/grok.md`; keep this page as a short routing and preset reference, not a duplicate source of truth.
|
|
4
|
+
|
|
5
|
+
## Presets
|
|
6
|
+
|
|
7
|
+
Project presets live in `.omk/presets.json` and are consumed by the preset extension from `packages/coding-agent/examples/extensions/preset.ts`. The shared Grok presets intentionally omit the `tools` key so role/domain lane grants keep control of the active tools.
|
|
8
|
+
|
|
9
|
+
| Preset | Provider | Model | Thinking | Use |
|
|
10
|
+
| --- | --- | --- | --- | --- |
|
|
11
|
+
| `grok-verified` | `grok-oauth-proxy` | `grok-4.5` | `high` | Default Grok text-chat baseline (local OAuth proxy). |
|
|
12
|
+
| `grok-adaptorch-prod` | `grok-oauth-proxy` | `grok-4.5` | `high` | Same baseline, with AdaptOrch reserved for explicit DAG routing, synthesis, or consistency-verification lanes. |
|
|
13
|
+
|
|
14
|
+
Register the provider in `~/.omk/agent/models.json` with `baseUrl: http://127.0.0.1:9996/v1` and chat models including `grok-4.5` (and optional fallbacks such as `grok-4.3`). Loopback proxy accepts a dummy `apiKey`; do not put OAuth tokens in models.json. Confirm proxy health with `curl -fsS http://127.0.0.1:9996/health` before long sessions.
|
|
15
|
+
|
|
16
|
+
Suggested TUI flow:
|
|
17
|
+
|
|
18
|
+
1. Run `/grok` to inject the pointer to `~/.omk/agent/grok.md`.
|
|
19
|
+
2. Select `/preset grok-verified` for normal chat/coding work.
|
|
20
|
+
3. Select `/preset grok-adaptorch-prod` only when the task has an explicit DAG, routing, or synthesis objective.
|
|
21
|
+
4. Keep credentials and OAuth material out of preset JSON.
|
|
22
|
+
|
|
23
|
+
## Domain routing
|
|
24
|
+
|
|
25
|
+
Domain routing is opt-in. Start OMK with `OMK_DOMAIN_ROUTING=1` when you want the domain router to compose the role loadout with a domain profile before dispatch. With the variable unset or any value other than `1`, the domain dispatch layer does not apply a domain access policy.
|
|
26
|
+
|
|
27
|
+
The router selects one of the documented domain profiles under [`loadout-domains/`](loadout-domains/README.md), then composes that profile with the active role loadout. Grok presets do not replace this mechanism; they only set provider, model, thinking level, and instruction pointers.
|
|
28
|
+
|
|
29
|
+
## Composer model
|
|
30
|
+
|
|
31
|
+
`grok-composer-2.5-fast` is a valid Grok chat model, but the project presets keep `grok-4.5` as the default. Use Composer only for explicit Composer validation or comparison work. `grok-4.3` remains a supported fallback chat model. Do not use `grok-imagine-*` ids as chat models; session `setModel` / `prompt` reject them on `grok-oauth-proxy`.
|
|
32
|
+
|
|
33
|
+
## Imagine tools
|
|
34
|
+
|
|
35
|
+
Imagine media generation is tool-based, not model-selection-based:
|
|
36
|
+
|
|
37
|
+
| Task | OMK tool |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| Text-to-image, image edits, restyles | `grok_imagine_image` |
|
|
40
|
+
| Text-to-video or image-to-video | `grok_imagine_video` |
|
|
41
|
+
|
|
42
|
+
Do not select `grok-imagine-image`, `grok-imagine-image-quality`, `grok-imagine-video`, or similar Imagine ids as the chat model. For media tasks, require tool output evidence such as the final saved path or URL before claiming success.
|
|
43
|
+
|
|
44
|
+
## Skill and MCP matrix summary
|
|
45
|
+
|
|
46
|
+
Use the normal OMK lane grant model: grant the smallest skill and MCP surface that matches the task, and keep media exceptions explicit.
|
|
47
|
+
|
|
48
|
+
| Task class | Skills | MCP |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| Multi-package or repo-context work | `packages`; add `headroom` only under context pressure | none by default |
|
|
51
|
+
| Repo graph or broad comprehension | `understand-anything`; optionally `packages` | `understand-anything` |
|
|
52
|
+
| DAG planning or synthesis | `adaptorch` / `adaptorch-route` / `adaptorch-synthesize` | `adaptorch` |
|
|
53
|
+
| TypeScript/Rust/Python/Go edits | `programming`; add `lsp` or `ast-grep` only for symbol/structural work | none by default |
|
|
54
|
+
| Runtime failures or broken behavior | `debugging` | task-specific only |
|
|
55
|
+
| UI/TUI verification | `visual-qa` | `playwright` only when browser/UI evidence is required |
|
|
56
|
+
| Current public URL or docs lookup | task skill as needed | `fetch` |
|
|
57
|
+
| Image prompts or media generation | explicit-only `image-prompt`, `omnigen-vault`, or `gpt-image-2-prompts` | none by default |
|
|
58
|
+
|
|
59
|
+
Relevant evidence hooks for Grok lanes are `pre-shell-guard`, `protect-secrets`, `typecheck-after-edit`, and `stop-verify`. Hook output is incremental evidence; code changes still need the project's required final verification command before claiming type/lint cleanliness.
|
|
60
|
+
|
|
61
|
+
## Canonical reference
|
|
62
|
+
|
|
63
|
+
For proxy health checks, chat model rules, Imagine tool behavior, Hermes parity, Telegram behavior, and unsafe `GROK.MD` handling, read `~/.omk/agent/grok.md`.
|
|
@@ -21,7 +21,7 @@ OMK routes incoming tasks to a **domain capability profile** ("inherited documen
|
|
|
21
21
|
|
|
22
22
|
Thresholds: `STRONG_THRESHOLD = 8`, `WEAK_THRESHOLD = 4`, `AMBIGUITY_MARGIN = 2`.
|
|
23
23
|
|
|
24
|
-
## Domains (
|
|
24
|
+
## Domains (13 + 1 fallback)
|
|
25
25
|
|
|
26
26
|
- [`frontend-ui`](frontend-ui.md) — Frontend & UI
|
|
27
27
|
- [`visual-qa`](visual-qa.md) — Visual QA & Website Cloning
|
|
@@ -34,6 +34,7 @@ Thresholds: `STRONG_THRESHOLD = 8`, `WEAK_THRESHOLD = 4`, `AMBIGUITY_MARGIN = 2`
|
|
|
34
34
|
- [`mobile`](mobile.md) — Mobile (iOS / Android / KMP)
|
|
35
35
|
- [`docs-writing`](docs-writing.md) — Docs & Technical Writing
|
|
36
36
|
- [`qa-testing`](qa-testing.md) — QA & Testing
|
|
37
|
+
- [`grok-harness`](grok-harness.md) — Grok xAI Harness
|
|
37
38
|
- [`ai-agent-ops`](ai-agent-ops.md) — AI Agent Engineering & Ops
|
|
38
39
|
- [`general`](general.md) — General (fallback)
|
|
39
40
|
|
|
@@ -29,6 +29,8 @@ SEQUENCE:
|
|
|
29
29
|
6. Orchestration: harness (team-architecture factory) for multi-agent topology; dispatching-parallel-agents / subagent-driven-development for parallel lanes; ralphinho-rfc-pipeline for DAG + merge queue.
|
|
30
30
|
|
|
31
31
|
HARD RULES: every agent/skill change has an eval; prompts are versioned and tested, not vibe-edited; MCP servers validate inputs; autonomy is bounded by explicit stop conditions + stop-verify hook.
|
|
32
|
+
|
|
33
|
+
PATCH SAFETY (B2C Correctness Wall): for pre-apply patch screening, load the correctness-wall extension explicitly (not in default preset). Read packages/coding-agent/docs/correctness-wall.md and examples/extensions/correctness-wall/README.md. Roll out shadow → soft → hard; never claim formal correctness proof.
|
|
32
34
|
```
|
|
33
35
|
|
|
34
36
|
## Curated skills (23)
|
|
@@ -71,7 +73,7 @@ HARD RULES: every agent/skill change has an eval; prompts are versioned and test
|
|
|
71
73
|
- `stop-verify`
|
|
72
74
|
- `subagent-stop-audit`
|
|
73
75
|
|
|
74
|
-
## Routing triggers (
|
|
76
|
+
## Routing triggers (23)
|
|
75
77
|
|
|
76
78
|
| kind | pattern | weight |
|
|
77
79
|
|---|---|---|
|
|
@@ -93,3 +95,8 @@ HARD RULES: every agent/skill change has an eval; prompts are versioned and test
|
|
|
93
95
|
| path | `.claude/agents` | 6 |
|
|
94
96
|
| path | `.omk/` | 5 |
|
|
95
97
|
| path | `SKILL.md` | 5 |
|
|
98
|
+
| keyword | `correctness wall` | 8 |
|
|
99
|
+
| keyword | `patch safety` | 8 |
|
|
100
|
+
| regex | `\bpatch[- ]safety\b` | 7 |
|
|
101
|
+
| path | `correctness-wall` | 7 |
|
|
102
|
+
| path | `adaptorch-wpl` | 5 |
|
|
@@ -39,7 +39,7 @@ SEQUENCE:
|
|
|
39
39
|
HARD RULES: no inline styles when a token/utility exists; oklch tokens for color; mobile-first responsive; real content over placeholders; pixel-match the target first, customize later; no visual claim without bounded screenshot/diff evidence.
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
## Curated skills (
|
|
42
|
+
## Curated skills (58)
|
|
43
43
|
|
|
44
44
|
- `frontend-design`
|
|
45
45
|
- `frontend-ui-engineering`
|
|
@@ -58,7 +58,11 @@ HARD RULES: no inline styles when a token/utility exists; oklch tokens for color
|
|
|
58
58
|
- `high-end-visual-design`
|
|
59
59
|
- `minimalist-ui`
|
|
60
60
|
- `design-taste-frontend`
|
|
61
|
+
- `design-taste-frontend-v1`
|
|
61
62
|
- `redesign-existing-projects`
|
|
63
|
+
- `brandkit`
|
|
64
|
+
- `imagegen-frontend-web`
|
|
65
|
+
- `imagegen-frontend-mobile`
|
|
62
66
|
- `web-design-guidelines`
|
|
63
67
|
- `fixing-accessibility`
|
|
64
68
|
- `contrast-checker`
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Grok xAI Harness (`grok-harness`)
|
|
2
|
+
|
|
3
|
+
> Inherited domain capability document. Auto-generated from `src/core/domain-loadouts.ts` — do not edit by hand.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Identity
|
|
7
|
+
|
|
8
|
+
| field | value |
|
|
9
|
+
|---|---|
|
|
10
|
+
| id | `grok-harness` |
|
|
11
|
+
| authority | `write-scoped` |
|
|
12
|
+
| tools | read, grep, find, ls, edit, write, bash |
|
|
13
|
+
| command mode | `scoped-shell` |
|
|
14
|
+
|
|
15
|
+
## Routing prompt
|
|
16
|
+
|
|
17
|
+
> Prepended to the lane task prompt when the router selects this domain.
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
DOMAIN: Grok xAI Harness. You are operating in a Grok/xAI integration lane.
|
|
21
|
+
Prioritize the Grok operational playbook, small capability loadouts, and evidence-bound provider/tool routing.
|
|
22
|
+
|
|
23
|
+
SEQUENCE:
|
|
24
|
+
1. Before implementing or routing Grok/xAI provider work, read and enforce ~/.omk/agent/grok.md. Treat it as the required Grok playbook for chat models vs Imagine tools, proxy health, tool-use/loop discipline, and Telegram parity unless higher-priority instructions conflict.
|
|
25
|
+
2. Keep text chat flows and Imagine/media tool flows separate. Text work uses Grok chat/OAuth/provider surfaces; image/video/Imagine work routes through explicit Imagine tools only. Never conflate model ids with Imagine tool names.
|
|
26
|
+
3. Capability discipline: load at most 2-3 skills for any lane. The allowed skill gate is packages, headroom, programming, debugging, adaptorch-route, adaptorch-synthesize, and understand-anything; choose the smallest subset and add headroom only under context pressure.
|
|
27
|
+
4. Adaptorch is advisory only. Use adaptorch-route for routing/decomposition advice and adaptorch-synthesize for evidence synthesis, but do not treat Adaptorch as an automatic executor, source of truth, permission grant, or substitute for explicit tests.
|
|
28
|
+
5. Use minimal MCP: adaptorch for advice/synthesis, fetch for bounded public retrieval, understand-anything for repo comprehension, and playwright only when browser or Imagine UI behavior needs real verification.
|
|
29
|
+
6. Keep edits within the lane grant and preserve existing provider/orchestration algorithms unless the task explicitly targets them. Never route through legacy KIMICLI or deleted wrappers.
|
|
30
|
+
7. Verification: run the narrowest relevant test/typecheck after edits. Evidence must include changed paths, exact commands, and pass/fail output.
|
|
31
|
+
|
|
32
|
+
HARD RULES: grok.md is mandatory context for Grok/xAI harness work; text chat surfaces and Imagine tools are distinct; maximum 2-3 active skills; Adaptorch is advisory route/synthesis support only; never log OAuth tokens, cookies, or proxy credentials; protect-secrets applies.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Curated skills (7)
|
|
36
|
+
|
|
37
|
+
- `packages`
|
|
38
|
+
- `headroom`
|
|
39
|
+
- `programming`
|
|
40
|
+
- `debugging`
|
|
41
|
+
- `adaptorch-route`
|
|
42
|
+
- `adaptorch-synthesize`
|
|
43
|
+
- `understand-anything`
|
|
44
|
+
|
|
45
|
+
## Curated MCP servers (4)
|
|
46
|
+
|
|
47
|
+
- `adaptorch`
|
|
48
|
+
- `fetch`
|
|
49
|
+
- `understand-anything`
|
|
50
|
+
- `playwright`
|
|
51
|
+
|
|
52
|
+
## Curated hooks (5)
|
|
53
|
+
|
|
54
|
+
- `pre-shell-guard`
|
|
55
|
+
- `protect-secrets`
|
|
56
|
+
- `typecheck-after-edit`
|
|
57
|
+
- `stop-verify`
|
|
58
|
+
- `session-context`
|
|
59
|
+
|
|
60
|
+
## Routing triggers (11)
|
|
61
|
+
|
|
62
|
+
| kind | pattern | weight |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| keyword | `grok` | 8 |
|
|
65
|
+
| keyword | `xai` | 7 |
|
|
66
|
+
| keyword | `grok-oauth` | 8 |
|
|
67
|
+
| keyword | `grok oauth` | 8 |
|
|
68
|
+
| keyword | `imagine` | 6 |
|
|
69
|
+
| keyword | `composer` | 5 |
|
|
70
|
+
| keyword | `adaptorch` | 7 |
|
|
71
|
+
| keyword | `adaptorch-route` | 8 |
|
|
72
|
+
| keyword | `adaptorch-synthesize` | 8 |
|
|
73
|
+
| regex | `\b(grok(?:[- ]oauth)?|xai|imagine|composer)\b` | 7 |
|
|
74
|
+
| regex | `\badapt\s*orch\b|\badaptorch[- ]?(route|routing|synthes(?:is|ize))\b` | 8 |
|
package/docs/providers.md
CHANGED
|
@@ -35,6 +35,10 @@ Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party h
|
|
|
35
35
|
- Press Enter for github.com, or enter your GitHub Enterprise Server domain
|
|
36
36
|
- If you get "model not supported", enable it in VS Code: Copilot Chat → model selector → select model → "Enable"
|
|
37
37
|
|
|
38
|
+
### Grok harness presets
|
|
39
|
+
|
|
40
|
+
For `grok-oauth-proxy` project presets, Composer routing, and Imagine tool guidance, see [Grok harness](grok-harness.md).
|
|
41
|
+
|
|
38
42
|
## API Keys
|
|
39
43
|
|
|
40
44
|
### Environment Variables or Auth File
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Correctness Wall — optional loadout (copy-paste)
|
|
2
|
+
|
|
3
|
+
Use this when you run OMK with the default **`omk-core-verified`** preset and want a **B2C patch safety screen** on `edit` / `write` before changes land on disk. The wall is policy- and evidence-limited; it is **not** proof of correctness. Canonical operator doc: [`docs/correctness-wall.md`](../../docs/correctness-wall.md).
|
|
4
|
+
|
|
5
|
+
## When to enable
|
|
6
|
+
|
|
7
|
+
| Situation | Action |
|
|
8
|
+
|-----------|--------|
|
|
9
|
+
| AI-generated or high-risk patches in a scoped lane | Load extension + set `OMK_WALL_SCOPE` |
|
|
10
|
+
| Shadow telemetry only (no blocking) | `OMK_PATCH_SAFETY_WALL_MODE=shadow` (default) |
|
|
11
|
+
| Block out-of-scope or secret-shaped diffs | `soft` or `hard` + explicit scope globs |
|
|
12
|
+
| Full outcome adjudication (OA) | Call tool `correctness_wall_evaluate` with fixture — not on the edit hook path |
|
|
13
|
+
|
|
14
|
+
**Routing note:** Domain router may send similar work to [`qa-testing`](../../docs/loadout-domains/qa-testing.md) (`execute-tests`, green-run evidence). The wall complements that lane: it gates **apply**, not **test execution**. For monorepo layout and extension paths, load skill **`packages`** when wiring paths from a checkout.
|
|
15
|
+
|
|
16
|
+
## Copy-paste: session start
|
|
17
|
+
|
|
18
|
+
From repo root (paths assume monorepo checkout):
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
export OMK_PATCH_SAFETY_WALL_MODE=shadow
|
|
22
|
+
export OMK_WALL_SCOPE='packages/coding-agent/**,packages/adaptorch-wpl/**'
|
|
23
|
+
export OMK_WALL_REPAIR_BUDGET=1
|
|
24
|
+
|
|
25
|
+
omk --extension packages/coding-agent/examples/extensions/correctness-wall/index.ts
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Persistent install (user extensions dir):
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
cp -r packages/coding-agent/examples/extensions/correctness-wall ~/.omk/agent/extensions/correctness-wall/
|
|
32
|
+
# Then start omk; discovery depends on your agent config loading ~/.omk/agent/extensions/
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Dogfood phase 2 (soft) — internal lanes
|
|
36
|
+
|
|
37
|
+
After shadow telemetry review (see [correctness-wall.md](../../docs/correctness-wall.md#recommended-rollout-shadow--soft--hard)):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
export OMK_PATCH_SAFETY_WALL_MODE=soft
|
|
41
|
+
export OMK_WALL_SCOPE='packages/adaptorch-wpl/**,packages/coding-agent/examples/extensions/correctness-wall/**'
|
|
42
|
+
export OMK_WALL_OVERRIDE= # set only for intentional human override
|
|
43
|
+
omk --extension packages/coding-agent/examples/extensions/correctness-wall/index.ts
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Live OA (optional): `OMK_WALL_OA_TRANSPORT=mcp`. The extension entry calls `autoWireLiveAdaptOrch(omk)` so live transport uses host `omk.callMcpTool` when the harness binds a handler at `bindCore`. Until a session MCP hub binds that handler, invocations throw and fixture transport remains the safe default. Manual `setWallAdaptOrchCallTool` is still available for tests.
|
|
47
|
+
|
|
48
|
+
## Copy-paste: `omk-core-verified` + extension
|
|
49
|
+
|
|
50
|
+
Keep your usual preset (`~/.omk/runtime-preset.json` or project default). Add **one** extra flag for this harness:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
omk --extension packages/coding-agent/examples/extensions/correctness-wall/index.ts
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Optional hardening for a single lane (example owned paths only):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
export OMK_PATCH_SAFETY_WALL_MODE=soft
|
|
60
|
+
export OMK_WALL_SCOPE='packages/coding-agent/examples/extensions/correctness-wall/**'
|
|
61
|
+
export OMK_WALL_OVERRIDE= # unset unless human override is intentional
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## On-demand evaluation (tool)
|
|
65
|
+
|
|
66
|
+
Does not require blocking mode; useful for planners/reviewers:
|
|
67
|
+
|
|
68
|
+
- Tool: `correctness_wall_evaluate`
|
|
69
|
+
- Params: `kind`, optional `diffPath`, `approvedWriteScope`, `previewOnly`, `runIds`, `adjudicationFixturePath`
|
|
70
|
+
- OA fixture format: see [README.md](./README.md#oa-adjudication-fixture-format)
|
|
71
|
+
|
|
72
|
+
## Evidence & cache (no secrets in logs)
|
|
73
|
+
|
|
74
|
+
| Artifact | Purpose |
|
|
75
|
+
|----------|---------|
|
|
76
|
+
| `.omk/wall-cache/latest.json` | Last verdict summary |
|
|
77
|
+
| `.omk/wall-cache/shadow-telemetry.ndjson` | Shadow-mode audit trail |
|
|
78
|
+
| `.omk/wall-cache/repair-budget.json` | Capped repair hints per packet |
|
|
79
|
+
|
|
80
|
+
Final claims still need project rules: e.g. `npm run check` / targeted tests per [`AGENTS.md`](../../../../AGENTS.md) — the wall does not replace those.
|
|
81
|
+
|
|
82
|
+
## See also
|
|
83
|
+
|
|
84
|
+
- [correctness-wall.md](../../docs/correctness-wall.md) — verdicts, fast vs deep wall, Adaptorch relationship
|
|
85
|
+
- [adaptorch-preview.md](../../docs/adaptorch-preview.md) — preview planning (separate from apply gate)
|
|
86
|
+
- [README.md](./README.md) — env vars, hook behavior, limitations
|
|
87
|
+
- Domain catalog: [loadout-domains/README.md](../../docs/loadout-domains/README.md)
|