diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index f436e4b56e..3c3c7a7e12 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "loom-code-skill", - "version": "1.2.0", + "version": "1.3.0", "description": "Code search and code intelligence for repositories in a Loom code index (the loom-code Agent Skill: code.* first, then read only that), and the loom Agent Skill: how an agent uses Loom. Skills only, no hooks.", "author": { "name": "ClickHouse" }, "homepage": "https://clickhouse.github.io/loom/", diff --git a/.cursor-plugin/plugin.json b/.cursor-plugin/plugin.json index 98182b16c0..a5e7e69544 100644 --- a/.cursor-plugin/plugin.json +++ b/.cursor-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "clickhouse-loom", - "version": "1.2.0", + "version": "1.3.0", "displayName": "ClickHouse Loom", "description": "Shared long-term memory, document search and a code index for Cursor from a self-hosted ClickHouse Loom server, over MCP, with the loom and loom-code skills that say when to recall, save and ask the code index.", "author": { "name": "ClickHouse" }, diff --git a/.devcontainer/agent-cli/bind-native.cjs b/.devcontainer/agent-cli/bind-native.cjs new file mode 100644 index 0000000000..8779a17a23 --- /dev/null +++ b/.devcontainer/agent-cli/bind-native.cjs @@ -0,0 +1,153 @@ +#!/usr/bin/env node +const fs = require("node:fs"); +const path = require("node:path"); +const { execFileSync } = require("node:child_process"); + +function hostPlatform() { + let arch = process.arch; + if (process.platform === "darwin" && arch === "x64") { + try { + if ( + execFileSync("/usr/sbin/sysctl", ["-n", "sysctl.proc_translated"], { + encoding: "utf8", + timeout: 1000, + stdio: ["ignore", "pipe", "ignore"], + }).trim() === "1" + ) + arch = "arm64"; + } catch (error) { + if (error.status !== 1) throw error; + } + } + const musl = process.platform === "linux" && !process.report.getReport().header.glibcVersionRuntime; + return { platform: process.platform, arch, musl }; +} + +function nativeInfo(tool, { platform, arch, musl = false }) { + if (!["x64", "arm64"].includes(arch)) throw new Error(`Unsupported native architecture: ${arch}`); + const abi = platform === "linux" && musl ? "-musl" : ""; + const exe = platform === "win32" ? ".exe" : ""; + if (tool === "bun") { + const os = { win32: "windows", android: "linux" }[platform] || platform; + const cpu = arch === "arm64" ? "aarch64" : arch; + const suffix = platform === "android" ? "-android" : abi; + const baseline = arch === "x64" && platform !== "android" && platform !== "freebsd" ? "-baseline" : ""; + return { + wrapper: "bun", + native: `@oven/bun-${os}-${cpu}${suffix}${baseline}`, + file: `bin/bun${exe}`, + targets: ["bin/bun.exe", "bin/bunx.exe"], + }; + } + if (tool === "pnpm") { + return { + wrapper: "pnpm", + native: `@pnpm/exe.${platform}-${arch}${abi}`, + file: `pnpm${exe}`, + targets: ["pnpm", "pn", "pnpx", "pnx"].map((name) => name + exe), + }; + } + if (tool === "claude") { + return { + wrapper: "@anthropic-ai/claude-code", + native: `@anthropic-ai/claude-code-${platform}-${arch}${abi}`, + file: `claude${exe}`, + targets: ["bin/claude.exe"], + }; + } + throw new Error(`Unsupported native tool: ${tool}`); +} + +function json(file) { + return JSON.parse(fs.readFileSync(file, "utf8")); +} + +function inside(root, file) { + const relative = path.relative(root, file); + if (!relative || relative === ".." || relative.startsWith(".." + path.sep) || path.isAbsolute(relative)) + throw new Error("Native package path leaves its locked project"); +} + +function bindingPlan(project, tool, host) { + const info = nativeInfo(tool, host); + const manifest = json(path.join(project, "package.json")); + const lock = json(path.join(project, "package-lock.json")); + const wrapperDir = fs.realpathSync(path.join(project, "node_modules", info.wrapper)); + inside(project, wrapperDir); + const wrapper = json(path.join(wrapperDir, "package.json")); + const expected = manifest.dependencies?.[info.wrapper]; + if (!expected || wrapper.name !== info.wrapper || wrapper.version !== expected) + throw new Error(`Native wrapper version mismatch: ${info.wrapper}`); + const declared = wrapper.optionalDependencies?.[info.native] || manifest.optionalDependencies?.[info.native]; + const entry = lock.packages?.[`node_modules/${info.native}`]; + if ( + declared !== expected || + entry?.version !== expected || + !/^sha512-[A-Za-z0-9+/]{86}==$/.test(entry.integrity || "") || + !entry.resolved?.startsWith("https://registry.npmjs.org/") + ) + throw new Error(`Native package is absent from the locked graph: ${info.native}`); + const nativeDir = fs.realpathSync(path.join(project, "node_modules", info.native)); + inside(project, nativeDir); + const native = json(path.join(nativeDir, "package.json")); + if (native.name !== info.native || native.version !== expected) + throw new Error(`Native package version mismatch: ${info.native}`); + const source = fs.realpathSync(path.join(nativeDir, info.file)); + inside(nativeDir, source); + if (!fs.statSync(source).isFile() || fs.statSync(source).size === 0) + throw new Error(`Native binary is missing: ${info.native}`); + return { ...info, source, wrapperDir, host }; +} + +function placeBinary(source, destination) { + fs.mkdirSync(path.dirname(destination), { recursive: true }); + const temporary = destination + ".loom-native"; + fs.rmSync(temporary, { force: true }); + try { + try { + fs.linkSync(source, temporary); + } catch (error) { + if (!["EXDEV", "EPERM"].includes(error.code)) throw error; + fs.copyFileSync(source, temporary, fs.constants.COPYFILE_FICLONE); + } + fs.chmodSync(temporary, 0o755); + fs.renameSync(temporary, destination); + } finally { + fs.rmSync(temporary, { force: true }); + } +} + +function bindNative(project, tools, host = hostPlatform()) { + project = fs.realpathSync(project); + const plans = tools.map((tool) => bindingPlan(project, tool, host)); + for (const plan of plans) { + for (const target of plan.targets) { + const destination = path.join(plan.wrapperDir, target); + fs.mkdirSync(path.dirname(destination), { recursive: true }); + const parent = fs.realpathSync(path.dirname(destination)); + if (parent !== plan.wrapperDir) inside(plan.wrapperDir, parent); + placeBinary(plan.source, destination); + } + if (plan.wrapper === "pnpm" && host.platform === "win32") { + const file = path.join(plan.wrapperDir, "package.json"); + const manifest = json(file); + manifest.bin = Object.fromEntries(["pnpm", "pn", "pnpx", "pnx"].map((name) => [name, name + ".exe"])); + const temporary = file + ".loom-native"; + fs.writeFileSync(temporary, JSON.stringify(manifest, null, 2) + "\n"); + fs.renameSync(temporary, file); + } + } +} + +if (require.main === module) { + try { + const [project, ...tools] = process.argv.slice(2); + if (!project || tools.length === 0) throw new Error("Supply a locked project and native tools to bind"); + bindNative(project, tools); + } catch (error) { + console.error(`Native tool installation refused: ${error.message}`); + process.exitCode = 1; + } +} + +module.exports = { bindNative, nativeInfo }; diff --git a/.devcontainer/agent-cli/package-lock.json b/.devcontainer/agent-cli/package-lock.json new file mode 100644 index 0000000000..5fe87ef671 --- /dev/null +++ b/.devcontainer/agent-cli/package-lock.json @@ -0,0 +1,142 @@ +{ + "name": "loom-devcontainer-agent-cli", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "loom-devcontainer-agent-cli", + "version": "0.0.0", + "dependencies": { + "@anthropic-ai/claude-code": "2.1.319" + } + }, + "node_modules/@anthropic-ai/claude-code": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-2.1.319.tgz", + "integrity": "sha512-XoyAxGXBmNsb9ahz0xLAtyz/I6b1j+4lyLpucyTQIq4FcKUxrMDM2AzA2sHipHoN1DdMJINQQrLZxRZRq7FqBA==", + "hasInstallScript": true, + "license": "SEE LICENSE IN README.md", + "bin": { + "claude": "bin/claude.exe" + }, + "engines": { + "node": ">=22.0.0" + }, + "optionalDependencies": { + "@anthropic-ai/claude-code-darwin-arm64": "2.1.319", + "@anthropic-ai/claude-code-darwin-x64": "2.1.319", + "@anthropic-ai/claude-code-linux-arm64": "2.1.319", + "@anthropic-ai/claude-code-linux-arm64-musl": "2.1.319", + "@anthropic-ai/claude-code-linux-x64": "2.1.319", + "@anthropic-ai/claude-code-linux-x64-musl": "2.1.319", + "@anthropic-ai/claude-code-win32-arm64": "2.1.319", + "@anthropic-ai/claude-code-win32-x64": "2.1.319" + } + }, + "node_modules/@anthropic-ai/claude-code-darwin-arm64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-darwin-arm64/-/claude-code-darwin-arm64-2.1.319.tgz", + "integrity": "sha512-dyAOFnsXbeyGgFJMlo2n6zSgLli5r4fTZ3Tj48eELxjccqM4s/wUmQ6P0DyCbxU0EC44VV44T2qj5xEpen25aA==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@anthropic-ai/claude-code-darwin-x64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-darwin-x64/-/claude-code-darwin-x64-2.1.319.tgz", + "integrity": "sha512-XuzaFESZRKPupllcbbFCy0xdw9G9+VHLWbXaJhJhUD4gNTmt/ALkKMnECwr3umA7if1cAGDNb2tcgRCIpIy+nQ==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-arm64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-arm64/-/claude-code-linux-arm64-2.1.319.tgz", + "integrity": "sha512-PlyxaZTAuU0VF3P/ERF4+deMRjT57cr90SHCrYms3HTebr3eItEWJozw6zq9cs88tc8XoF9ESAIghKXfq9HACg==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-arm64-musl": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-arm64-musl/-/claude-code-linux-arm64-musl-2.1.319.tgz", + "integrity": "sha512-969quP2nXj7GRHzLSe9kov9c/f2p+ZuZrXkrvaenbLOX6zZJtyqZKRUyhDUjaVmSEEGFSxgCr/BtUMOXV8jaOw==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-x64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-x64/-/claude-code-linux-x64-2.1.319.tgz", + "integrity": "sha512-FO4Sd23BO1VCQPiJe5vG3bNnmV5+YiTau7o1lqK3Fr5VlE4TLdKiyYpwQRwEXO91kE2l12Ep2i7J19T8Md2oOQ==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-x64-musl": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-x64-musl/-/claude-code-linux-x64-musl-2.1.319.tgz", + "integrity": "sha512-LAj03VLWWZ+5T2c3dMxWZh5BhFzExwywIpT6y1oHnBj0Tx/ILIXYF1z6lcKSYsmiKChixPWzso35QnIfYLO8jg==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-win32-arm64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-win32-arm64/-/claude-code-win32-arm64-2.1.319.tgz", + "integrity": "sha512-LJXWhy1rZGysmjwmC1/kapdaM55phYFPa3MGad033F01f76+q1lT4N8TCPC6wysHxrkLed/yucLGqMSTNY63cg==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@anthropic-ai/claude-code-win32-x64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-win32-x64/-/claude-code-win32-x64-2.1.319.tgz", + "integrity": "sha512-wncPKSYL/zvjs84k7wZEj+IGQx/LjqQNhgnQhzDEibP0yAVBguAs4p8nBfFAEDbDdUc4Z2co+OaKZV1t02xINA==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "win32" + ] + } + } +} diff --git a/.devcontainer/agent-cli/package.json b/.devcontainer/agent-cli/package.json new file mode 100644 index 0000000000..ea91177227 --- /dev/null +++ b/.devcontainer/agent-cli/package.json @@ -0,0 +1,8 @@ +{ + "name": "loom-devcontainer-agent-cli", + "private": true, + "version": "0.0.0", + "dependencies": { + "@anthropic-ai/claude-code": "2.1.319" + } +} diff --git a/.devcontainer/start-loom.sh b/.devcontainer/start-loom.sh index f8ee5213e8..a4dfc75d3a 100755 --- a/.devcontainer/start-loom.sh +++ b/.devcontainer/start-loom.sh @@ -43,7 +43,10 @@ fi # is connected below, so the installer connects no agent. LOOM_CONNECT=none sh "$installer" -npm install --global --silent @anthropic-ai/claude-code +script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +npm ci --prefix "$script_dir/agent-cli" --ignore-scripts --no-fund --no-audit +node "$script_dir/agent-cli/bind-native.cjs" "$script_dir/agent-cli" claude +npm install --global --offline --ignore-scripts --silent "$script_dir/agent-cli/node_modules/@anthropic-ai/claude-code" claude plugin marketplace list 2>/dev/null | grep -Eq '[[:space:]]loom$' \ || claude plugin marketplace add ClickHouse/loom claude plugin install loom@loom diff --git a/.github/agent-clis/package-lock.json b/.github/agent-clis/package-lock.json new file mode 100644 index 0000000000..36ed216922 --- /dev/null +++ b/.github/agent-clis/package-lock.json @@ -0,0 +1,265 @@ +{ + "name": "loom-github-agent-clis", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "loom-github-agent-clis", + "version": "0.0.0", + "dependencies": { + "@anthropic-ai/claude-code": "2.1.319", + "@openai/codex": "0.162.1" + } + }, + "node_modules/@anthropic-ai/claude-code": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-2.1.319.tgz", + "integrity": "sha512-XoyAxGXBmNsb9ahz0xLAtyz/I6b1j+4lyLpucyTQIq4FcKUxrMDM2AzA2sHipHoN1DdMJINQQrLZxRZRq7FqBA==", + "hasInstallScript": true, + "license": "SEE LICENSE IN README.md", + "bin": { + "claude": "bin/claude.exe" + }, + "engines": { + "node": ">=22.0.0" + }, + "optionalDependencies": { + "@anthropic-ai/claude-code-darwin-arm64": "2.1.319", + "@anthropic-ai/claude-code-darwin-x64": "2.1.319", + "@anthropic-ai/claude-code-linux-arm64": "2.1.319", + "@anthropic-ai/claude-code-linux-arm64-musl": "2.1.319", + "@anthropic-ai/claude-code-linux-x64": "2.1.319", + "@anthropic-ai/claude-code-linux-x64-musl": "2.1.319", + "@anthropic-ai/claude-code-win32-arm64": "2.1.319", + "@anthropic-ai/claude-code-win32-x64": "2.1.319" + } + }, + "node_modules/@anthropic-ai/claude-code-darwin-arm64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-darwin-arm64/-/claude-code-darwin-arm64-2.1.319.tgz", + "integrity": "sha512-dyAOFnsXbeyGgFJMlo2n6zSgLli5r4fTZ3Tj48eELxjccqM4s/wUmQ6P0DyCbxU0EC44VV44T2qj5xEpen25aA==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@anthropic-ai/claude-code-darwin-x64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-darwin-x64/-/claude-code-darwin-x64-2.1.319.tgz", + "integrity": "sha512-XuzaFESZRKPupllcbbFCy0xdw9G9+VHLWbXaJhJhUD4gNTmt/ALkKMnECwr3umA7if1cAGDNb2tcgRCIpIy+nQ==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-arm64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-arm64/-/claude-code-linux-arm64-2.1.319.tgz", + "integrity": "sha512-PlyxaZTAuU0VF3P/ERF4+deMRjT57cr90SHCrYms3HTebr3eItEWJozw6zq9cs88tc8XoF9ESAIghKXfq9HACg==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-arm64-musl": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-arm64-musl/-/claude-code-linux-arm64-musl-2.1.319.tgz", + "integrity": "sha512-969quP2nXj7GRHzLSe9kov9c/f2p+ZuZrXkrvaenbLOX6zZJtyqZKRUyhDUjaVmSEEGFSxgCr/BtUMOXV8jaOw==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-x64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-x64/-/claude-code-linux-x64-2.1.319.tgz", + "integrity": "sha512-FO4Sd23BO1VCQPiJe5vG3bNnmV5+YiTau7o1lqK3Fr5VlE4TLdKiyYpwQRwEXO91kE2l12Ep2i7J19T8Md2oOQ==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-x64-musl": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-x64-musl/-/claude-code-linux-x64-musl-2.1.319.tgz", + "integrity": "sha512-LAj03VLWWZ+5T2c3dMxWZh5BhFzExwywIpT6y1oHnBj0Tx/ILIXYF1z6lcKSYsmiKChixPWzso35QnIfYLO8jg==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-win32-arm64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-win32-arm64/-/claude-code-win32-arm64-2.1.319.tgz", + "integrity": "sha512-LJXWhy1rZGysmjwmC1/kapdaM55phYFPa3MGad033F01f76+q1lT4N8TCPC6wysHxrkLed/yucLGqMSTNY63cg==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@anthropic-ai/claude-code-win32-x64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-win32-x64/-/claude-code-win32-x64-2.1.319.tgz", + "integrity": "sha512-wncPKSYL/zvjs84k7wZEj+IGQx/LjqQNhgnQhzDEibP0yAVBguAs4p8nBfFAEDbDdUc4Z2co+OaKZV1t02xINA==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@openai/codex": { + "version": "0.162.1", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.1.tgz", + "integrity": "sha512-NWZdi/kxyjv/8EUGFupziGU38YyleugZRM4JXgY5XFH7FUmaFA33NZS2Bmq0HPazf7S3jJQQWsZ/jAK9jsrV3Q==", + "license": "Apache-2.0", + "bin": { + "codex": "bin/codex.js" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@openai/codex-darwin-arm64": "npm:@openai/codex@0.162.1-darwin-arm64", + "@openai/codex-darwin-x64": "npm:@openai/codex@0.162.1-darwin-x64", + "@openai/codex-linux-arm64": "npm:@openai/codex@0.162.1-linux-arm64", + "@openai/codex-linux-x64": "npm:@openai/codex@0.162.1-linux-x64", + "@openai/codex-win32-arm64": "npm:@openai/codex@0.162.1-win32-arm64", + "@openai/codex-win32-x64": "npm:@openai/codex@0.162.1-win32-x64" + } + }, + "node_modules/@openai/codex-darwin-arm64": { + "name": "@openai/codex", + "version": "0.162.1-darwin-arm64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.1-darwin-arm64.tgz", + "integrity": "sha512-YVXpg57itBuQxjofay3KDF5UbnZF4Y1ZmNFzUCz0ZQiQN+DndxOjN5V87rnXvPaC4qCPO2El74DzewoBP8JyPQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@openai/codex-darwin-x64": { + "name": "@openai/codex", + "version": "0.162.1-darwin-x64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.1-darwin-x64.tgz", + "integrity": "sha512-0/WHRhbUnM1wAjfyCO54Q8s4vQRxLVBbqW6XuQf7rZTEMTYPKRIQU9aPeRgjG653ZCSjtBrslWQ+G9urY9CksQ==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@openai/codex-linux-arm64": { + "name": "@openai/codex", + "version": "0.162.1-linux-arm64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.1-linux-arm64.tgz", + "integrity": "sha512-Ss7W/SrKtQFNaMtSojNoiykJgX+iDC8daM+YrcvgmJADtQPk0cd3w6Dna4CYH2CYvf9nQranj69fpcTzZ3sQIQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@openai/codex-linux-x64": { + "name": "@openai/codex", + "version": "0.162.1-linux-x64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.1-linux-x64.tgz", + "integrity": "sha512-cjK2mdHIfEepZ1lQ1MX3aTQC+8ncIsvnacl/6vI2dIIcfP8/MrhTQ2+qRlkXFNDzJSj1d36quIszP+3/4CUJWQ==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@openai/codex-win32-arm64": { + "name": "@openai/codex", + "version": "0.162.1-win32-arm64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.1-win32-arm64.tgz", + "integrity": "sha512-teVVACnEcupkR6XSmUQKwlGg/oA15d1DQDPVSoAfilHgctPEpTi5y11jYS6JhJO+AFnYM84gyo5SOS5vlnCQSg==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@openai/codex-win32-x64": { + "name": "@openai/codex", + "version": "0.162.1-win32-x64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.1-win32-x64.tgz", + "integrity": "sha512-dfl4MhHuEi0ARKyNmrTxk+RQmsWNCQAoVLUtrYq+yrW1C8P2sg5ziwgHUUACHjYLKuACV7ARH5Nq5pnCz3GlaQ==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + } + } +} diff --git a/.github/agent-clis/package.json b/.github/agent-clis/package.json new file mode 100644 index 0000000000..e93a1417be --- /dev/null +++ b/.github/agent-clis/package.json @@ -0,0 +1,9 @@ +{ + "name": "loom-github-agent-clis", + "private": true, + "version": "0.0.0", + "dependencies": { + "@anthropic-ai/claude-code": "2.1.319", + "@openai/codex": "0.162.1" + } +} diff --git a/.github/pnpm/package-lock.json b/.github/pnpm/package-lock.json new file mode 100644 index 0000000000..ea460ad8e0 --- /dev/null +++ b/.github/pnpm/package-lock.json @@ -0,0 +1,31 @@ +{ + "name": "loom-github-pnpm", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "loom-github-pnpm", + "version": "0.0.0", + "dependencies": { + "pnpm": "10.34.9" + } + }, + "node_modules/pnpm": { + "version": "10.34.9", + "resolved": "https://registry.npmjs.org/pnpm/-/pnpm-10.34.9.tgz", + "integrity": "sha512-9JtajqD97bRLs8DB1ldQkqU8KVDZW3rRXfEfF5dId6LeOgHAfpNOmyjOcW5RwJqUlixzBtCb4uHksYqMh2L9Mg==", + "license": "MIT", + "bin": { + "pnpm": "bin/pnpm.cjs", + "pnpx": "bin/pnpx.cjs" + }, + "engines": { + "node": ">=18.12" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + } + } + } +} diff --git a/.github/pnpm/package.json b/.github/pnpm/package.json new file mode 100644 index 0000000000..2a9092d796 --- /dev/null +++ b/.github/pnpm/package.json @@ -0,0 +1,8 @@ +{ + "name": "loom-github-pnpm", + "private": true, + "version": "0.0.0", + "dependencies": { + "pnpm": "10.34.9" + } +} diff --git a/.github/workflows/docker-smoke.yml b/.github/workflows/docker-smoke.yml index 3088015c40..55e7c33ca7 100644 --- a/.github/workflows/docker-smoke.yml +++ b/.github/workflows/docker-smoke.yml @@ -15,6 +15,7 @@ on: "frontend/**", "tests/fixtures/docker_provider_app.py", "scripts/install-code-toolchains.sh", + "scripts/code-toolchains/**", "scripts/serve.sh", "scripts/scip_harness/**", "scripts/release/build_stack_bundle.py", @@ -48,6 +49,7 @@ on: "frontend/**", "tests/fixtures/docker_provider_app.py", "scripts/install-code-toolchains.sh", + "scripts/code-toolchains/**", "scripts/serve.sh", "scripts/scip_harness/**", "scripts/release/build_stack_bundle.py", diff --git a/.github/workflows/n8n-publish.yml b/.github/workflows/n8n-publish.yml index 72244adf0f..546c482187 100644 --- a/.github/workflows/n8n-publish.yml +++ b/.github/workflows/n8n-publish.yml @@ -5,6 +5,7 @@ on: paths: - integrations/n8n/** - .github/workflows/n8n-publish.yml + - .github/pnpm/** push: tags: - v* @@ -22,7 +23,10 @@ jobs: - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: "24" - - run: npm install --global pnpm@10.32.1 + - name: Install the locked package manager + run: | + npm ci --prefix .github/pnpm --ignore-scripts --no-fund --no-audit + echo "$PWD/.github/pnpm/node_modules/.bin" >> "$GITHUB_PATH" - run: pnpm install --frozen-lockfile working-directory: integrations/n8n - run: pnpm check @@ -34,7 +38,7 @@ jobs: mkdir "$RUNNER_TEMP/n8n-package-check" cd "$RUNNER_TEMP/n8n-package-check" npm init --yes - npm install "$GITHUB_WORKSPACE/integrations/n8n/package.tgz" + npm install --ignore-scripts "$GITHUB_WORKSPACE/integrations/n8n/package.tgz" node -e 'for (const path of ["Loom/Loom.node", "LoomMemory/LoomMemory.node"]) require("@clickhouse/n8n-nodes-loom/dist/nodes/" + path + ".js")' publish: @@ -57,7 +61,10 @@ jobs: env: RELEASE_TAG: ${{ github.ref_name }} run: '[[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]' - - run: npm install --global pnpm@10.32.1 + - name: Install the locked package manager + run: | + npm ci --prefix .github/pnpm --ignore-scripts --no-fund --no-audit + echo "$PWD/.github/pnpm/node_modules/.bin" >> "$GITHUB_PATH" - run: pnpm install --frozen-lockfile working-directory: integrations/n8n - run: pnpm build diff --git a/.github/workflows/plugin-platforms.yml b/.github/workflows/plugin-platforms.yml index b4d5899165..64aab3b3ae 100644 --- a/.github/workflows/plugin-platforms.yml +++ b/.github/workflows/plugin-platforms.yml @@ -16,6 +16,8 @@ on: - ".agents/plugins/**" - ".gitattributes" - ".github/workflows/plugin-platforms.yml" + - ".github/agent-clis/**" + - "scripts/code-toolchains/bind-native.cjs" pull_request: branches: [main, "release/**"] paths: @@ -24,6 +26,8 @@ on: - ".agents/plugins/**" - ".gitattributes" - ".github/workflows/plugin-platforms.yml" + - ".github/agent-clis/**" + - "scripts/code-toolchains/bind-native.cjs" concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }} @@ -34,9 +38,6 @@ permissions: env: NODE_VERSION: "22" - # The agent versions the end-to-end sessions run. - CLAUDE_CODE_VERSION: "2.1.319" - CODEX_VERSION: "0.162.1" jobs: platform: @@ -70,11 +71,13 @@ jobs: - name: install the agent CLIs if: ${{ !cancelled() }} run: | - npm install --global --no-fund --no-audit "@anthropic-ai/claude-code@$CLAUDE_CODE_VERSION" "@openai/codex@$CODEX_VERSION" - root=$(npm root --global) + npm ci --prefix .github/agent-clis --ignore-scripts --no-fund --no-audit + node scripts/code-toolchains/bind-native.cjs .github/agent-clis claude + root=$(npm root --prefix .github/agent-clis) exe='' if [ "$RUNNER_OS" = Windows ]; then root=$(cygpath -m "$root"); exe=.exe; fi - codex=$(ls "$root"/@openai/codex/node_modules/@openai/codex-*/vendor/*/bin/codex$exe | head -1) + codex=$(ls "$root"/@openai/codex-*/vendor/*/bin/codex$exe | head -1) + test -n "$codex" && test -x "$codex" || { echo "The locked native agent executable is missing" >&2; exit 1; } echo "CLAUDE_BIN=$root/@anthropic-ai/claude-code/bin/claude.exe" >> "$GITHUB_ENV" echo "CODEX_BIN=$codex" >> "$GITHUB_ENV" - name: Claude Code session @@ -123,12 +126,14 @@ jobs: # bash is for Claude Code's own shell tool; the hooks run under BusyBox sh. - name: suite and sessions in node:22-alpine run: | - docker run --rm -v "$PWD:/src:ro" -e CLAUDE_CODE_VERSION -e CODEX_VERSION "$ALPINE_IMAGE" sh -euc ' + docker run --rm -v "$PWD:/src:ro" "$ALPINE_IMAGE" sh -euc ' apk add --quiet git bash cp -r /src /tmp/repo && chown -R node /tmp/repo - npm install --global --no-fund --no-audit "@anthropic-ai/claude-code@$CLAUDE_CODE_VERSION" "@openai/codex@$CODEX_VERSION" >/dev/null - root=$(npm root --global) - codex=$(ls "$root"/@openai/codex/node_modules/@openai/codex-linux-*/vendor/*/bin/codex | head -1) + npm ci --prefix /tmp/repo/.github/agent-clis --ignore-scripts --no-fund --no-audit >/dev/null + node /tmp/repo/scripts/code-toolchains/bind-native.cjs /tmp/repo/.github/agent-clis claude + root=$(npm root --prefix /tmp/repo/.github/agent-clis) + codex=$(ls "$root"/@openai/codex-linux-*/vendor/*/bin/codex | head -1) + test -n "$codex" && test -x "$codex" || { echo "The locked native agent executable is missing" >&2; exit 1; } su node -s /bin/sh -c " set -e cd /tmp/repo @@ -163,9 +168,11 @@ jobs: # A clone inside WSL, with Linux modes and line endings, as a WSL user's is. git -c safe.directory='*' clone --quiet --no-local . /home/ci/repo chown -R ci /home/ci/repo - npm install --global --no-fund --no-audit "@anthropic-ai/claude-code@$CLAUDE_CODE_VERSION" "@openai/codex@$CODEX_VERSION" >/dev/null - root=$(npm root --global) - codex=$(ls "$root"/@openai/codex/node_modules/@openai/codex-linux-*/vendor/*/bin/codex | head -1) + npm ci --prefix /home/ci/repo/.github/agent-clis --ignore-scripts --no-fund --no-audit >/dev/null + node /home/ci/repo/scripts/code-toolchains/bind-native.cjs /home/ci/repo/.github/agent-clis claude + root=$(npm root --prefix /home/ci/repo/.github/agent-clis) + codex=$(ls "$root"/@openai/codex-linux-*/vendor/*/bin/codex | head -1) + test -n "$codex" && test -x "$codex" || { echo "The locked native agent executable is missing" >&2; exit 1; } su ci -s /bin/sh -c " set -e cd /home/ci/repo @@ -177,5 +184,3 @@ jobs: node integrations/claude-code-plugin/tests/e2e/agent-session.mjs claude --bin $root/@anthropic-ai/claude-code/bin/claude.exe --expect-tool Bash node integrations/claude-code-plugin/tests/e2e/agent-session.mjs codex --bin $codex " - env: - WSLENV: CLAUDE_CODE_VERSION:CODEX_VERSION diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml index 98f1210e30..a0505073fe 100644 --- a/.github/workflows/release-check.yml +++ b/.github/workflows/release-check.yml @@ -108,29 +108,197 @@ jobs: if: inputs.sdks runs-on: ubuntu-latest timeout-minutes: 15 + outputs: + python_extras: ${{ steps.sdk-metadata.outputs.python_extras }} + has_python_extras: ${{ steps.sdk-metadata.outputs.has_python_extras }} + node_peers: ${{ steps.sdk-metadata.outputs.node_peers }} steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: refs/tags/v${{ inputs.version }} + persist-credentials: false - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.12" - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: "22" - # The Python SDK names a candidate in its PEP 440 form (1.2.0rc1), as the - # release build writes it. + - name: Validate the checked release tag + env: + VERSION: ${{ inputs.version }} + run: | + python - <<'PY' + import os + from scripts.release.prepare import _tag_version, tag_on_head + version = _tag_version(os.environ["VERSION"]) + if not tag_on_head(version): + raise SystemExit("the checked source is not the requested release tag") + PY + # The wheel uses the tag's PEP 440 version. - name: pip install clickhouse-loom id: pip-sdk env: VERSION: ${{ inputs.version }} run: | python -m venv "$RUNNER_TEMP/sdk" - "$RUNNER_TEMP/sdk/bin/pip" install "clickhouse-loom==$VERSION" + "$RUNNER_TEMP/sdk/bin/pip" --isolated install --index-url https://pypi.org/simple "clickhouse-loom==$VERSION" "$RUNNER_TEMP/sdk/bin/python" -c "import loom, sys; assert loom.__version__ == sys.argv[1], loom.__version__" "${VERSION/-rc./rc}" + "$RUNNER_TEMP/sdk/bin/pip" --isolated check - name: npm install @clickhouse/loom env: VERSION: ${{ inputs.version }} run: | mkdir -p "$RUNNER_TEMP/npm" && cd "$RUNNER_TEMP/npm" npm init -y >/dev/null - npm install --no-audit --no-fund "@clickhouse/loom@$VERSION" + npm install --registry=https://registry.npmjs.org --ignore-scripts --no-audit --no-fund "@clickhouse/loom@$VERSION" + npm audit signatures node -e 'const { SDK_VERSION } = require("@clickhouse/loom"); if (SDK_VERSION !== process.argv[1]) { throw new Error(SDK_VERSION) }' "$VERSION" + - name: Install the metadata checker separately from the SDKs + run: | + python -m venv "$RUNNER_TEMP/metadata-check" + "$RUNNER_TEMP/metadata-check/bin/pip" --isolated install --index-url https://pypi.org/simple packaging==24.2 + - name: Published SDK metadata matches the release tag + id: sdk-metadata + env: + VERSION: ${{ inputs.version }} + run: | + "$RUNNER_TEMP/sdk/bin/python" - <<'METADATA' + import importlib.metadata + import os + from pathlib import Path + text = importlib.metadata.distribution("clickhouse-loom").read_text("METADATA") + if text is None: + raise SystemExit("published Python SDK metadata is missing") + (Path(os.environ["RUNNER_TEMP"]) / "sdk.METADATA").write_text(text) + METADATA + "$RUNNER_TEMP/metadata-check/bin/python" - <<'PY' + import email.parser + import json + import os + import tomllib + from pathlib import Path + from packaging.markers import Marker + from packaging.requirements import Requirement + from packaging.utils import canonicalize_name + from packaging.version import Version + + def marker_terms(tree): + # packaging's parsed tree preserves each original extra condition. + alternatives, conjunction = set(), {frozenset()} + for item in tree: + if item == "or": + alternatives.update(conjunction) + conjunction = {frozenset()} + elif item != "and": + terms = marker_terms(item) if isinstance(item, list) else { + frozenset({tuple(part.serialize() for part in item)}) + } + conjunction = {left | right for left in conjunction for right in terms} + alternatives.update(conjunction) + return {term for term in alternatives if not any(other < term for other in alternatives)} + + def requirements(items): + grouped = {} + for requirement in items: + marker = requirement.marker + terms = marker_terms(marker._markers) if marker else {frozenset()} + requirement.marker = None + requirement.extras = {canonicalize_name(extra) for extra in requirement.extras} + grouped.setdefault(requirement, set()).update(terms) + return { + requirement: {term for term in terms if not any(other < term for other in terms)} + for requirement, terms in grouped.items() + } + + root = Path(os.environ["GITHUB_WORKSPACE"]) + version = os.environ["VERSION"] + final = version.split("-rc.", 1)[0] + source_py = tomllib.loads((root / "sdk/python/pyproject.toml").read_text())["project"] + installed = email.parser.Parser().parsestr((Path(os.environ["RUNNER_TEMP"]) / "sdk.METADATA").read_text()) + if Version(source_py["version"]) != Version(final) or Version(installed["Version"]) != Version(version): + raise SystemExit("Python SDK version differs from the release tag") + extras = [canonicalize_name(name) for name in source_py.get("optional-dependencies", {})] + published_extras = [canonicalize_name(name) for name in installed.get_all("Provides-Extra", [])] + if len(set(extras)) != len(extras) or sorted(extras) != sorted(published_extras): + raise SystemExit("published Python extras differ from the release tag") + expected = [Requirement(text) for text in source_py.get("dependencies", [])] + for extra, dependencies in source_py.get("optional-dependencies", {}).items(): + scope = f"extra == {json.dumps(canonicalize_name(extra))}" + for text in dependencies: + requirement = Requirement(text) + requirement.marker = Marker(f"({requirement.marker}) and {scope}" if requirement.marker else scope) + expected.append(requirement) + actual = [Requirement(text) for text in installed.get_all("Requires-Dist", [])] + if requirements(expected) != requirements(actual): + raise SystemExit("published Python requirements differ from the release tag") + + source_js = json.loads((root / "sdk/typescript/package.json").read_text()) + package = Path(os.environ["RUNNER_TEMP"]) / "npm/node_modules/@clickhouse/loom/package.json" + published_js = json.loads(package.read_text()) + if source_js["version"] != final or published_js["version"] != version: + raise SystemExit("npm SDK version differs from the release tag") + for field in ("peerDependencies", "peerDependenciesMeta", "exports", "engines"): + if source_js.get(field, {}) != published_js.get(field, {}): + raise SystemExit(f"published npm {field} differs from the release tag") + peers = source_js.get("peerDependencies", {}) + node_rows = [{"peer": "none", "requirement": ""}] + node_rows += [{"peer": name, "requirement": f"{name}@{peers[name]}"} for name in sorted(peers)] + outputs = { + "python_extras": json.dumps({"extra": sorted(extras)}, separators=(",", ":")), + "has_python_extras": str(bool(extras)).lower(), + "node_peers": json.dumps({"include": node_rows}, separators=(",", ":")), + } + with open(os.environ["GITHUB_OUTPUT"], "a") as out: + for name, value in outputs.items(): + print(f"{name}={value}", file=out) + PY + + sdk-python-extras: + name: Python SDK extra (${{ matrix.extra }}) + needs: sdks + if: inputs.sdks && needs.sdks.outputs.has_python_extras == 'true' + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.sdks.outputs.python_extras) }} + steps: + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: "3.12" + - name: Install the published extra in a clean virtualenv + env: + VERSION: ${{ inputs.version }} + EXTRA: ${{ matrix.extra }} + run: | + python -m venv "$RUNNER_TEMP/extra" + "$RUNNER_TEMP/extra/bin/pip" --isolated install --index-url https://pypi.org/simple "clickhouse-loom[$EXTRA]==$VERSION" + "$RUNNER_TEMP/extra/bin/pip" --isolated check + "$RUNNER_TEMP/extra/bin/pip" --isolated freeze + + sdk-node-peers: + name: npm SDK peer (${{ matrix.peer }}) + needs: sdks + if: inputs.sdks + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.sdks.outputs.node_peers) }} + steps: + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: "22" + - name: Install the published SDK with its declared peer + env: + VERSION: ${{ inputs.version }} + PEER_SPEC: ${{ matrix.requirement }} + run: | + mkdir -p "$RUNNER_TEMP/peer" && cd "$RUNNER_TEMP/peer" + npm init -y >/dev/null + packages=("@clickhouse/loom@$VERSION") + [ -z "$PEER_SPEC" ] || packages+=("$PEER_SPEC") + npm install --registry=https://registry.npmjs.org --ignore-scripts --no-audit --no-fund "${packages[@]}" npm audit signatures + node -e 'const { SDK_VERSION } = require("@clickhouse/loom"); if (SDK_VERSION !== process.argv[1]) { throw new Error(SDK_VERSION) }' "$VERSION" + npm ls --depth=0 diff --git a/Dockerfile b/Dockerfile index 41de98c023..9a45ff6823 100644 --- a/Dockerfile +++ b/Dockerfile @@ -102,6 +102,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && mkdir -p /usr/local/node && tar -C /usr/local/node --strip-components=1 -xJf /tmp/node.txz && rm /tmp/node.txz /tmp/node.txz.sha256 ENV PATH=/usr/local/node/bin:$PATH COPY scripts/install-code-toolchains.sh /tmp/install-code-toolchains.sh +COPY scripts/code-toolchains /tmp/code-toolchains RUN LOOM_CODE_TOOLCHAIN_PREFIX=/usr/local/node sh /tmp/install-code-toolchains.sh \ && npm cache clean --force diff --git a/deploy/helm/loom/Chart.yaml b/deploy/helm/loom/Chart.yaml index 283ed54f8f..c7f2145d64 100644 --- a/deploy/helm/loom/Chart.yaml +++ b/deploy/helm/loom/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: loom description: Loom on Kubernetes, N identical replicas over one ClickHouse service. type: application -version: 0.2.0 -appVersion: "1.2.0" +version: 0.3.0 +appVersion: "1.3.0" kubeVersion: ">=1.27.0-0" home: https://clickhouse.github.io/loom/ sources: diff --git a/docs/architecture/memory-architecture.md b/docs/architecture/memory-architecture.md index 9a11f7b6af..bdf73fe236 100644 --- a/docs/architecture/memory-architecture.md +++ b/docs/architecture/memory-architecture.md @@ -1026,6 +1026,14 @@ and shared duplicate selection by phrase completion. | verbatim chunks | `chunks.py` | `memory_chunks`: a stage-1 candidate read, then one keyed stage 2 with neighbour windows. | | records | `side_legs.py` | `memory_records`. | + Every chunk statement excludes a known parent that the read would not serve, using + the canonical memory row's status and time predicates. The parent match includes + agent, user, session and key within the org and namespace, so another writer's row + cannot hide a passage. Anonymous user and session spellings compare as the same + sentinel. Blank-session ingests retain independent generated session ids. A chunk + with no matching canonical parent, including such a generated session, stays + eligible. Hard tags also require a matching searchable parent. + A pooled chunk of a long `memory.set` value folds onto the row whose current value cuts it (`pool.py`, `fold_set_chunks`): one read of the writer's served rows of the key with the newest vectors over `memory_embeddings` (`memory_search_set_chunk_rows` of them), diff --git a/examples/course-starter/.devcontainer/agent-cli/bind-native.cjs b/examples/course-starter/.devcontainer/agent-cli/bind-native.cjs new file mode 100644 index 0000000000..8779a17a23 --- /dev/null +++ b/examples/course-starter/.devcontainer/agent-cli/bind-native.cjs @@ -0,0 +1,153 @@ +#!/usr/bin/env node +const fs = require("node:fs"); +const path = require("node:path"); +const { execFileSync } = require("node:child_process"); + +function hostPlatform() { + let arch = process.arch; + if (process.platform === "darwin" && arch === "x64") { + try { + if ( + execFileSync("/usr/sbin/sysctl", ["-n", "sysctl.proc_translated"], { + encoding: "utf8", + timeout: 1000, + stdio: ["ignore", "pipe", "ignore"], + }).trim() === "1" + ) + arch = "arm64"; + } catch (error) { + if (error.status !== 1) throw error; + } + } + const musl = process.platform === "linux" && !process.report.getReport().header.glibcVersionRuntime; + return { platform: process.platform, arch, musl }; +} + +function nativeInfo(tool, { platform, arch, musl = false }) { + if (!["x64", "arm64"].includes(arch)) throw new Error(`Unsupported native architecture: ${arch}`); + const abi = platform === "linux" && musl ? "-musl" : ""; + const exe = platform === "win32" ? ".exe" : ""; + if (tool === "bun") { + const os = { win32: "windows", android: "linux" }[platform] || platform; + const cpu = arch === "arm64" ? "aarch64" : arch; + const suffix = platform === "android" ? "-android" : abi; + const baseline = arch === "x64" && platform !== "android" && platform !== "freebsd" ? "-baseline" : ""; + return { + wrapper: "bun", + native: `@oven/bun-${os}-${cpu}${suffix}${baseline}`, + file: `bin/bun${exe}`, + targets: ["bin/bun.exe", "bin/bunx.exe"], + }; + } + if (tool === "pnpm") { + return { + wrapper: "pnpm", + native: `@pnpm/exe.${platform}-${arch}${abi}`, + file: `pnpm${exe}`, + targets: ["pnpm", "pn", "pnpx", "pnx"].map((name) => name + exe), + }; + } + if (tool === "claude") { + return { + wrapper: "@anthropic-ai/claude-code", + native: `@anthropic-ai/claude-code-${platform}-${arch}${abi}`, + file: `claude${exe}`, + targets: ["bin/claude.exe"], + }; + } + throw new Error(`Unsupported native tool: ${tool}`); +} + +function json(file) { + return JSON.parse(fs.readFileSync(file, "utf8")); +} + +function inside(root, file) { + const relative = path.relative(root, file); + if (!relative || relative === ".." || relative.startsWith(".." + path.sep) || path.isAbsolute(relative)) + throw new Error("Native package path leaves its locked project"); +} + +function bindingPlan(project, tool, host) { + const info = nativeInfo(tool, host); + const manifest = json(path.join(project, "package.json")); + const lock = json(path.join(project, "package-lock.json")); + const wrapperDir = fs.realpathSync(path.join(project, "node_modules", info.wrapper)); + inside(project, wrapperDir); + const wrapper = json(path.join(wrapperDir, "package.json")); + const expected = manifest.dependencies?.[info.wrapper]; + if (!expected || wrapper.name !== info.wrapper || wrapper.version !== expected) + throw new Error(`Native wrapper version mismatch: ${info.wrapper}`); + const declared = wrapper.optionalDependencies?.[info.native] || manifest.optionalDependencies?.[info.native]; + const entry = lock.packages?.[`node_modules/${info.native}`]; + if ( + declared !== expected || + entry?.version !== expected || + !/^sha512-[A-Za-z0-9+/]{86}==$/.test(entry.integrity || "") || + !entry.resolved?.startsWith("https://registry.npmjs.org/") + ) + throw new Error(`Native package is absent from the locked graph: ${info.native}`); + const nativeDir = fs.realpathSync(path.join(project, "node_modules", info.native)); + inside(project, nativeDir); + const native = json(path.join(nativeDir, "package.json")); + if (native.name !== info.native || native.version !== expected) + throw new Error(`Native package version mismatch: ${info.native}`); + const source = fs.realpathSync(path.join(nativeDir, info.file)); + inside(nativeDir, source); + if (!fs.statSync(source).isFile() || fs.statSync(source).size === 0) + throw new Error(`Native binary is missing: ${info.native}`); + return { ...info, source, wrapperDir, host }; +} + +function placeBinary(source, destination) { + fs.mkdirSync(path.dirname(destination), { recursive: true }); + const temporary = destination + ".loom-native"; + fs.rmSync(temporary, { force: true }); + try { + try { + fs.linkSync(source, temporary); + } catch (error) { + if (!["EXDEV", "EPERM"].includes(error.code)) throw error; + fs.copyFileSync(source, temporary, fs.constants.COPYFILE_FICLONE); + } + fs.chmodSync(temporary, 0o755); + fs.renameSync(temporary, destination); + } finally { + fs.rmSync(temporary, { force: true }); + } +} + +function bindNative(project, tools, host = hostPlatform()) { + project = fs.realpathSync(project); + const plans = tools.map((tool) => bindingPlan(project, tool, host)); + for (const plan of plans) { + for (const target of plan.targets) { + const destination = path.join(plan.wrapperDir, target); + fs.mkdirSync(path.dirname(destination), { recursive: true }); + const parent = fs.realpathSync(path.dirname(destination)); + if (parent !== plan.wrapperDir) inside(plan.wrapperDir, parent); + placeBinary(plan.source, destination); + } + if (plan.wrapper === "pnpm" && host.platform === "win32") { + const file = path.join(plan.wrapperDir, "package.json"); + const manifest = json(file); + manifest.bin = Object.fromEntries(["pnpm", "pn", "pnpx", "pnx"].map((name) => [name, name + ".exe"])); + const temporary = file + ".loom-native"; + fs.writeFileSync(temporary, JSON.stringify(manifest, null, 2) + "\n"); + fs.renameSync(temporary, file); + } + } +} + +if (require.main === module) { + try { + const [project, ...tools] = process.argv.slice(2); + if (!project || tools.length === 0) throw new Error("Supply a locked project and native tools to bind"); + bindNative(project, tools); + } catch (error) { + console.error(`Native tool installation refused: ${error.message}`); + process.exitCode = 1; + } +} + +module.exports = { bindNative, nativeInfo }; diff --git a/examples/course-starter/.devcontainer/agent-cli/package-lock.json b/examples/course-starter/.devcontainer/agent-cli/package-lock.json new file mode 100644 index 0000000000..5fe87ef671 --- /dev/null +++ b/examples/course-starter/.devcontainer/agent-cli/package-lock.json @@ -0,0 +1,142 @@ +{ + "name": "loom-devcontainer-agent-cli", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "loom-devcontainer-agent-cli", + "version": "0.0.0", + "dependencies": { + "@anthropic-ai/claude-code": "2.1.319" + } + }, + "node_modules/@anthropic-ai/claude-code": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-2.1.319.tgz", + "integrity": "sha512-XoyAxGXBmNsb9ahz0xLAtyz/I6b1j+4lyLpucyTQIq4FcKUxrMDM2AzA2sHipHoN1DdMJINQQrLZxRZRq7FqBA==", + "hasInstallScript": true, + "license": "SEE LICENSE IN README.md", + "bin": { + "claude": "bin/claude.exe" + }, + "engines": { + "node": ">=22.0.0" + }, + "optionalDependencies": { + "@anthropic-ai/claude-code-darwin-arm64": "2.1.319", + "@anthropic-ai/claude-code-darwin-x64": "2.1.319", + "@anthropic-ai/claude-code-linux-arm64": "2.1.319", + "@anthropic-ai/claude-code-linux-arm64-musl": "2.1.319", + "@anthropic-ai/claude-code-linux-x64": "2.1.319", + "@anthropic-ai/claude-code-linux-x64-musl": "2.1.319", + "@anthropic-ai/claude-code-win32-arm64": "2.1.319", + "@anthropic-ai/claude-code-win32-x64": "2.1.319" + } + }, + "node_modules/@anthropic-ai/claude-code-darwin-arm64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-darwin-arm64/-/claude-code-darwin-arm64-2.1.319.tgz", + "integrity": "sha512-dyAOFnsXbeyGgFJMlo2n6zSgLli5r4fTZ3Tj48eELxjccqM4s/wUmQ6P0DyCbxU0EC44VV44T2qj5xEpen25aA==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@anthropic-ai/claude-code-darwin-x64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-darwin-x64/-/claude-code-darwin-x64-2.1.319.tgz", + "integrity": "sha512-XuzaFESZRKPupllcbbFCy0xdw9G9+VHLWbXaJhJhUD4gNTmt/ALkKMnECwr3umA7if1cAGDNb2tcgRCIpIy+nQ==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-arm64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-arm64/-/claude-code-linux-arm64-2.1.319.tgz", + "integrity": "sha512-PlyxaZTAuU0VF3P/ERF4+deMRjT57cr90SHCrYms3HTebr3eItEWJozw6zq9cs88tc8XoF9ESAIghKXfq9HACg==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-arm64-musl": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-arm64-musl/-/claude-code-linux-arm64-musl-2.1.319.tgz", + "integrity": "sha512-969quP2nXj7GRHzLSe9kov9c/f2p+ZuZrXkrvaenbLOX6zZJtyqZKRUyhDUjaVmSEEGFSxgCr/BtUMOXV8jaOw==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-x64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-x64/-/claude-code-linux-x64-2.1.319.tgz", + "integrity": "sha512-FO4Sd23BO1VCQPiJe5vG3bNnmV5+YiTau7o1lqK3Fr5VlE4TLdKiyYpwQRwEXO91kE2l12Ep2i7J19T8Md2oOQ==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-linux-x64-musl": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-x64-musl/-/claude-code-linux-x64-musl-2.1.319.tgz", + "integrity": "sha512-LAj03VLWWZ+5T2c3dMxWZh5BhFzExwywIpT6y1oHnBj0Tx/ILIXYF1z6lcKSYsmiKChixPWzso35QnIfYLO8jg==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-code-win32-arm64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-win32-arm64/-/claude-code-win32-arm64-2.1.319.tgz", + "integrity": "sha512-LJXWhy1rZGysmjwmC1/kapdaM55phYFPa3MGad033F01f76+q1lT4N8TCPC6wysHxrkLed/yucLGqMSTNY63cg==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@anthropic-ai/claude-code-win32-x64": { + "version": "2.1.319", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code-win32-x64/-/claude-code-win32-x64-2.1.319.tgz", + "integrity": "sha512-wncPKSYL/zvjs84k7wZEj+IGQx/LjqQNhgnQhzDEibP0yAVBguAs4p8nBfFAEDbDdUc4Z2co+OaKZV1t02xINA==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "win32" + ] + } + } +} diff --git a/examples/course-starter/.devcontainer/agent-cli/package.json b/examples/course-starter/.devcontainer/agent-cli/package.json new file mode 100644 index 0000000000..ea91177227 --- /dev/null +++ b/examples/course-starter/.devcontainer/agent-cli/package.json @@ -0,0 +1,8 @@ +{ + "name": "loom-devcontainer-agent-cli", + "private": true, + "version": "0.0.0", + "dependencies": { + "@anthropic-ai/claude-code": "2.1.319" + } +} diff --git a/examples/course-starter/.devcontainer/start-loom.sh b/examples/course-starter/.devcontainer/start-loom.sh index f8ee5213e8..a4dfc75d3a 100755 --- a/examples/course-starter/.devcontainer/start-loom.sh +++ b/examples/course-starter/.devcontainer/start-loom.sh @@ -43,7 +43,10 @@ fi # is connected below, so the installer connects no agent. LOOM_CONNECT=none sh "$installer" -npm install --global --silent @anthropic-ai/claude-code +script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +npm ci --prefix "$script_dir/agent-cli" --ignore-scripts --no-fund --no-audit +node "$script_dir/agent-cli/bind-native.cjs" "$script_dir/agent-cli" claude +npm install --global --offline --ignore-scripts --silent "$script_dir/agent-cli/node_modules/@anthropic-ai/claude-code" claude plugin marketplace list 2>/dev/null | grep -Eq '[[:space:]]loom$' \ || claude plugin marketplace add ClickHouse/loom claude plugin install loom@loom diff --git a/frontend/package-lock.json b/frontend/package-lock.json index f6e55e9f7f..7c573890b7 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "loom-dashboard", - "version": "1.2.0", + "version": "1.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "loom-dashboard", - "version": "1.2.0", + "version": "1.3.0", "dependencies": { "@clickhouse/click-ui": "0.13.0", "@fontsource-variable/inconsolata": "5.3.0", diff --git a/frontend/package.json b/frontend/package.json index 64c1ccbc2c..4aa71111eb 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "loom-dashboard", - "version": "1.2.0", + "version": "1.3.0", "private": true, "type": "module", "engines": { diff --git a/gemini-extension.json b/gemini-extension.json index 7ff4b06b44..423f2fd3fc 100644 --- a/gemini-extension.json +++ b/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "clickhouse-loom", - "version": "1.2.0", + "version": "1.3.0", "description": "Shared long-term memory, document search and a code index for Gemini CLI from a self-hosted ClickHouse Loom server, over MCP.", "mcpServers": { "loom": { diff --git a/integrations/claude-code-plugin/.claude-plugin/plugin.json b/integrations/claude-code-plugin/.claude-plugin/plugin.json index a62501409f..9967ce6430 100644 --- a/integrations/claude-code-plugin/.claude-plugin/plugin.json +++ b/integrations/claude-code-plugin/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "loom", "displayName": "ClickHouse Loom", - "version": "1.2.38", + "version": "1.2.39", "description": "Shared long-term memory and code intelligence for Claude Code, self-hosted on ClickHouse. MCP tools to save and recall decisions, preferences and corrections across sessions and teammates; lifecycle hooks that capture each session with no model call; a code index that answers where-is, who-calls and blast-radius questions with line-accurate units instead of whole-file reads.", "author": { "name": "ClickHouse" diff --git a/integrations/claude-code-plugin/lib/server-version.mjs b/integrations/claude-code-plugin/lib/server-version.mjs index 6e88276dd8..1e9a26f576 100644 --- a/integrations/claude-code-plugin/lib/server-version.mjs +++ b/integrations/claude-code-plugin/lib/server-version.mjs @@ -12,7 +12,7 @@ const MANIFESTS = ["../.claude-plugin/plugin.json", "../.codex-plugin/plugin.jso // The oldest Loom server the hooks support. lib/ is synced, so both plugins // carry the same minimum; a release raises it (docs/development/release-process.md). -export const MIN_SERVER_VERSION = "1.0.0"; +export const MIN_SERVER_VERSION = "1.3.0"; const SEMVER = /^(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/; diff --git a/integrations/codex-plugin/.codex-plugin/plugin.json b/integrations/codex-plugin/.codex-plugin/plugin.json index ba284faba1..f4c6bb172e 100644 --- a/integrations/codex-plugin/.codex-plugin/plugin.json +++ b/integrations/codex-plugin/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "loom", - "version": "1.2.38", + "version": "1.2.39", "description": "Shared long-term memory and code intelligence for Codex, self-hosted on ClickHouse. MCP tools to save and recall decisions, preferences and corrections across sessions and teammates; lifecycle hooks that capture each session with no model call; a code index that answers where-is, who-calls and blast-radius questions with line-accurate units instead of whole-file reads.", "author": { "name": "ClickHouse" diff --git a/integrations/codex-plugin/lib/server-version.mjs b/integrations/codex-plugin/lib/server-version.mjs index 6e88276dd8..1e9a26f576 100644 --- a/integrations/codex-plugin/lib/server-version.mjs +++ b/integrations/codex-plugin/lib/server-version.mjs @@ -12,7 +12,7 @@ const MANIFESTS = ["../.claude-plugin/plugin.json", "../.codex-plugin/plugin.jso // The oldest Loom server the hooks support. lib/ is synced, so both plugins // carry the same minimum; a release raises it (docs/development/release-process.md). -export const MIN_SERVER_VERSION = "1.0.0"; +export const MIN_SERVER_VERSION = "1.3.0"; const SEMVER = /^(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/; diff --git a/plugin.json b/plugin.json index 47fd3099bc..0d25fe54e4 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json", "name": "clickhouse-loom", - "version": "1.2.0", + "version": "1.3.0", "description": "Shared long-term memory, document search and a code index from a self-hosted ClickHouse Loom server, over MCP, with the loom and loom-code skills that say when to recall, save and ask the code index. Experimental: checked with Copilot CLI 1.0.112.", "author": { "name": "ClickHouse", "url": "https://github.com/ClickHouse" }, "homepage": "https://clickhouse.github.io/loom/features/integrations/mcp-clients/#other-editors-and-agents", diff --git a/pyproject.toml b/pyproject.toml index ae73aaf233..5e2e541de9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "clickhouse-loom-server" -version = "1.2.0" +version = "1.3.0" description = "Loom server (control plane). Shared-production agent memory + knowledge plane on ClickHouse. Distributed as a Docker image (ghcr.io/clickhouse/loom) — `pip install` is for local dev / Docker-image build only; do NOT run the server from pip in production." requires-python = ">=3.12" license = { text = "Apache-2.0" } diff --git a/scripts/code-toolchains/bind-native.cjs b/scripts/code-toolchains/bind-native.cjs new file mode 100644 index 0000000000..8779a17a23 --- /dev/null +++ b/scripts/code-toolchains/bind-native.cjs @@ -0,0 +1,153 @@ +#!/usr/bin/env node +const fs = require("node:fs"); +const path = require("node:path"); +const { execFileSync } = require("node:child_process"); + +function hostPlatform() { + let arch = process.arch; + if (process.platform === "darwin" && arch === "x64") { + try { + if ( + execFileSync("/usr/sbin/sysctl", ["-n", "sysctl.proc_translated"], { + encoding: "utf8", + timeout: 1000, + stdio: ["ignore", "pipe", "ignore"], + }).trim() === "1" + ) + arch = "arm64"; + } catch (error) { + if (error.status !== 1) throw error; + } + } + const musl = process.platform === "linux" && !process.report.getReport().header.glibcVersionRuntime; + return { platform: process.platform, arch, musl }; +} + +function nativeInfo(tool, { platform, arch, musl = false }) { + if (!["x64", "arm64"].includes(arch)) throw new Error(`Unsupported native architecture: ${arch}`); + const abi = platform === "linux" && musl ? "-musl" : ""; + const exe = platform === "win32" ? ".exe" : ""; + if (tool === "bun") { + const os = { win32: "windows", android: "linux" }[platform] || platform; + const cpu = arch === "arm64" ? "aarch64" : arch; + const suffix = platform === "android" ? "-android" : abi; + const baseline = arch === "x64" && platform !== "android" && platform !== "freebsd" ? "-baseline" : ""; + return { + wrapper: "bun", + native: `@oven/bun-${os}-${cpu}${suffix}${baseline}`, + file: `bin/bun${exe}`, + targets: ["bin/bun.exe", "bin/bunx.exe"], + }; + } + if (tool === "pnpm") { + return { + wrapper: "pnpm", + native: `@pnpm/exe.${platform}-${arch}${abi}`, + file: `pnpm${exe}`, + targets: ["pnpm", "pn", "pnpx", "pnx"].map((name) => name + exe), + }; + } + if (tool === "claude") { + return { + wrapper: "@anthropic-ai/claude-code", + native: `@anthropic-ai/claude-code-${platform}-${arch}${abi}`, + file: `claude${exe}`, + targets: ["bin/claude.exe"], + }; + } + throw new Error(`Unsupported native tool: ${tool}`); +} + +function json(file) { + return JSON.parse(fs.readFileSync(file, "utf8")); +} + +function inside(root, file) { + const relative = path.relative(root, file); + if (!relative || relative === ".." || relative.startsWith(".." + path.sep) || path.isAbsolute(relative)) + throw new Error("Native package path leaves its locked project"); +} + +function bindingPlan(project, tool, host) { + const info = nativeInfo(tool, host); + const manifest = json(path.join(project, "package.json")); + const lock = json(path.join(project, "package-lock.json")); + const wrapperDir = fs.realpathSync(path.join(project, "node_modules", info.wrapper)); + inside(project, wrapperDir); + const wrapper = json(path.join(wrapperDir, "package.json")); + const expected = manifest.dependencies?.[info.wrapper]; + if (!expected || wrapper.name !== info.wrapper || wrapper.version !== expected) + throw new Error(`Native wrapper version mismatch: ${info.wrapper}`); + const declared = wrapper.optionalDependencies?.[info.native] || manifest.optionalDependencies?.[info.native]; + const entry = lock.packages?.[`node_modules/${info.native}`]; + if ( + declared !== expected || + entry?.version !== expected || + !/^sha512-[A-Za-z0-9+/]{86}==$/.test(entry.integrity || "") || + !entry.resolved?.startsWith("https://registry.npmjs.org/") + ) + throw new Error(`Native package is absent from the locked graph: ${info.native}`); + const nativeDir = fs.realpathSync(path.join(project, "node_modules", info.native)); + inside(project, nativeDir); + const native = json(path.join(nativeDir, "package.json")); + if (native.name !== info.native || native.version !== expected) + throw new Error(`Native package version mismatch: ${info.native}`); + const source = fs.realpathSync(path.join(nativeDir, info.file)); + inside(nativeDir, source); + if (!fs.statSync(source).isFile() || fs.statSync(source).size === 0) + throw new Error(`Native binary is missing: ${info.native}`); + return { ...info, source, wrapperDir, host }; +} + +function placeBinary(source, destination) { + fs.mkdirSync(path.dirname(destination), { recursive: true }); + const temporary = destination + ".loom-native"; + fs.rmSync(temporary, { force: true }); + try { + try { + fs.linkSync(source, temporary); + } catch (error) { + if (!["EXDEV", "EPERM"].includes(error.code)) throw error; + fs.copyFileSync(source, temporary, fs.constants.COPYFILE_FICLONE); + } + fs.chmodSync(temporary, 0o755); + fs.renameSync(temporary, destination); + } finally { + fs.rmSync(temporary, { force: true }); + } +} + +function bindNative(project, tools, host = hostPlatform()) { + project = fs.realpathSync(project); + const plans = tools.map((tool) => bindingPlan(project, tool, host)); + for (const plan of plans) { + for (const target of plan.targets) { + const destination = path.join(plan.wrapperDir, target); + fs.mkdirSync(path.dirname(destination), { recursive: true }); + const parent = fs.realpathSync(path.dirname(destination)); + if (parent !== plan.wrapperDir) inside(plan.wrapperDir, parent); + placeBinary(plan.source, destination); + } + if (plan.wrapper === "pnpm" && host.platform === "win32") { + const file = path.join(plan.wrapperDir, "package.json"); + const manifest = json(file); + manifest.bin = Object.fromEntries(["pnpm", "pn", "pnpx", "pnx"].map((name) => [name, name + ".exe"])); + const temporary = file + ".loom-native"; + fs.writeFileSync(temporary, JSON.stringify(manifest, null, 2) + "\n"); + fs.renameSync(temporary, file); + } + } +} + +if (require.main === module) { + try { + const [project, ...tools] = process.argv.slice(2); + if (!project || tools.length === 0) throw new Error("Supply a locked project and native tools to bind"); + bindNative(project, tools); + } catch (error) { + console.error(`Native tool installation refused: ${error.message}`); + process.exitCode = 1; + } +} + +module.exports = { bindNative, nativeInfo }; diff --git a/scripts/code-toolchains/package-lock.json b/scripts/code-toolchains/package-lock.json new file mode 100644 index 0000000000..0c50229f8e --- /dev/null +++ b/scripts/code-toolchains/package-lock.json @@ -0,0 +1,1299 @@ +{ + "name": "loom-scripts-code-toolchains", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "loom-scripts-code-toolchains", + "version": "0.0.0", + "dependencies": { + "@sourcegraph/scip-python": "0.6.6", + "@sourcegraph/scip-typescript": "0.4.0", + "bun": "1.4.2", + "pnpm": "12.15.0", + "yarn": "1.22.22" + }, + "optionalDependencies": { + "@oven/bun-darwin-x64-baseline": "1.4.2", + "@oven/bun-linux-x64-baseline": "1.4.2", + "@oven/bun-linux-x64-musl-baseline": "1.4.2", + "@oven/bun-windows-x64-baseline": "1.4.2" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@iarna/toml": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz", + "integrity": "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==", + "license": "ISC" + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz", + "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@oven/bun-darwin-aarch64": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.4.2.tgz", + "integrity": "sha512-MXdZkP1featqxZ+/VTXWG1BVjM4OGBehVY2Q88EeUj/7L0UMeCGItmyPYTN+wxvlGJ6F66JEtzsw+GvQWewnag==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oven/bun-darwin-x64": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.4.2.tgz", + "integrity": "sha512-gZTxZuLjkUhAWjTETu3tw0WhsEdNkJ64daj60ybhPf835a2yollV3yTkK9JozvzKPx4TRFzLSl8C+U525pxVbw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oven/bun-darwin-x64-baseline": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.4.2.tgz", + "integrity": "sha512-lVDbk/HkN+RP8QKXBe0aou7EifA2PC9+Z4cvy2VDpmR1ONdDm8e2h/HsU7ABq7mvVs/76iq5H86nMvAhwJDadQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oven/bun-freebsd-aarch64": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-freebsd-aarch64/-/bun-freebsd-aarch64-1.4.2.tgz", + "integrity": "sha512-SMNItMw1Z8QeeQVKnw8jA7xQNkeXdP+OPgin4Wi/QTx/B8RHHLnuZfqmFy7NtVeT2NF0kKYppW4WWd2CCYZjhQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@oven/bun-freebsd-x64": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-freebsd-x64/-/bun-freebsd-x64-1.4.2.tgz", + "integrity": "sha512-THbPKXhO54N0DpFRKZNDZpQ7dpbX0bWASuARckAUS9wRtFIHsiY+uULXJvxJGo2YD1YewvXQ4G8Fj7XT5oBCiw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@oven/bun-linux-aarch64": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.4.2.tgz", + "integrity": "sha512-3BBP9ovJ2RGHFH6Ae1CAtxNtG1+YY6GD6rmYbsUosoAk9+OEl6zeDQ/k4fBkc6dYOJCtWnx8hUxzNzQATSmvYQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-aarch64-android": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64-android/-/bun-linux-aarch64-android-1.4.2.tgz", + "integrity": "sha512-3mZKO2rhsNgbAUtAHC1UKUlF2zTxFraDZT/Elv8wzyH0fJL9h+Iv3TgB9lO63w89PRn3eFe+NRA1bhVgikKNPQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@oven/bun-linux-aarch64-musl": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64-musl/-/bun-linux-aarch64-musl-1.4.2.tgz", + "integrity": "sha512-+Sm6y+lSiSFBOtXmnekp5Q6n1tUKlyv71FCPWBc61Cgb14T5eBs8SN/nh4MUCOKzONkI3O+as3MGUgikS4aCBQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-x64": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.4.2.tgz", + "integrity": "sha512-9/E/UXOTpSo3YsV5g+FhtTd/qTpiWoKuxS12cqtuYA1ssu9fRAoPQnipFgGyck3tWO63iUdxBiygq+kELFawng==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-x64-android": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-android/-/bun-linux-x64-android-1.4.2.tgz", + "integrity": "sha512-6HC5tzcC79113n2IHCTJMWv+HsQImv4ZFEK2XpYLxY6HbT8tM4cUM2Zv1bHZBQsS3jv/zYBamDJ1UX7If0d5tw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@oven/bun-linux-x64-baseline": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.4.2.tgz", + "integrity": "sha512-OKKzX/SOVIUVARCzTg+2r4Rcc4fPyWnQmBsd3K08buxeu7DAof4iwW9zSb6Lt1NhTCu4Uhi8k9UeI6f7GEE4Zg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-x64-musl": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl/-/bun-linux-x64-musl-1.4.2.tgz", + "integrity": "sha512-vVTKUg1bnPhRP/Hp73jIVoFh2vPFNYEqYX0ERKfZBOQEEHitNAeukZzzuUDZS0SoDCIpuWUGSpd/CDMbjdR+Uw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-x64-musl-baseline": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl-baseline/-/bun-linux-x64-musl-baseline-1.4.2.tgz", + "integrity": "sha512-Rn9yJ/7FPA+WZe7L2BvGifFFCiiRfB8zeLZa2Ye0ojOvdN1FJ2ddthH80L4twNMW0N142LrDEaMnTLUYAX971w==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-windows-aarch64": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-windows-aarch64/-/bun-windows-aarch64-1.4.2.tgz", + "integrity": "sha512-8EJ1ST7339WJE3poPW5nBgVW/lWf9HBz4W27ZUNhburKmcBLOByPyE6DP9fHD8FQGm5c+ilUN2hX1mrW0jxq9Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oven/bun-windows-x64": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64/-/bun-windows-x64-1.4.2.tgz", + "integrity": "sha512-+bN6OuVld/9diT/RLSXSW7JE6CvNE3gL9XsAEjULi1nUsXd6DNO6GuA9jNdNb3r8PdJFnYHr5aypNV1Oj3Rd9g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oven/bun-windows-x64-baseline": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64-baseline/-/bun-windows-x64-baseline-1.4.2.tgz", + "integrity": "sha512-lq82LqVjSXAx9gNUcibCdfQdtrelh86FxQqlhpOdiV4SZQAP8HHUxWhnfbjx2fqz+jzglwBvjmlEs7xFyONBZw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@pnpm/exe.android-arm64": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.android-arm64/-/exe.android-arm64-12.15.0.tgz", + "integrity": "sha512-eVCqmscY70LGvgRzu3mi8IBWBFGix+a6mNZoWmXxESsBdeiKEF9xQSuaeel10yn+zI7TXy2jlI63vFLzETk+aQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@pnpm/exe.android-x64": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.android-x64/-/exe.android-x64-12.15.0.tgz", + "integrity": "sha512-Gx/WbkFcdUFUg8g8AShezcS9EiQxfYvdAm2hfKLO8sfJmJvKOCt5fzlgHWDzmGhoclibgW+tUGZ/KF4F4wOTCA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@pnpm/exe.darwin-arm64": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.darwin-arm64/-/exe.darwin-arm64-12.15.0.tgz", + "integrity": "sha512-N0ZykiDWCvqSBJvt71j7cSoBR993FqvYZFtmpCtqvW3pguiI+NAgraLPA5OTwu5mV+/d8hYpVcPktJA3xFDLtA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@pnpm/exe.darwin-x64": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.darwin-x64/-/exe.darwin-x64-12.15.0.tgz", + "integrity": "sha512-7Ntr2HlBUxzwWOg7NwDxCbRW/3vXuqKO+hcXm+w3SBi9rrHY53li1wLqWVT7Gjxd+lVEHM1QJZo6WJEGFU8C6A==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@pnpm/exe.freebsd-x64": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.freebsd-x64/-/exe.freebsd-x64-12.15.0.tgz", + "integrity": "sha512-btOiyL7fL7W4uQGH0aqFai2TNC3IoKcZ7gNHBVbEFZt2dWrnrD0SufL3iGs3fLlmb4OtuU35uf4Zpr9V9Jh9mA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@pnpm/exe.linux-arm64": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.linux-arm64/-/exe.linux-arm64-12.15.0.tgz", + "integrity": "sha512-qML/8aCXslh8td/w4U+HJNqUcZ2+m6EfTbWScIzZRmyPsRFN+xB4LP1U/hymxc1iSJiKtG56HJx2fvUErWFIGw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pnpm/exe.linux-arm64-musl": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.linux-arm64-musl/-/exe.linux-arm64-musl-12.15.0.tgz", + "integrity": "sha512-pNC38k+O+90FOjbPNSnw0E7apq1PKTmz3fFe1amn+lys/U5kL++uzir8bRiho8ONcyA3d9EU7wdqcY0DKkj+JA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pnpm/exe.linux-ppc64": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.linux-ppc64/-/exe.linux-ppc64-12.15.0.tgz", + "integrity": "sha512-tjRDUUl7RCJ6T/6eoNPxOqkwU4Mzi5RtTXmSAxujyz37OTwwsMU7Ps087Zk4gHcUvRSeyF40ZFsew3vtE+nmUA==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pnpm/exe.linux-riscv64": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.linux-riscv64/-/exe.linux-riscv64-12.15.0.tgz", + "integrity": "sha512-bF1uBWEfbwaeryz6lIiaJ8AWD082otZfvzGX5l+6LZRpRwUEpJHUsJrORaYP5/cNMv5ZR2p6TvvcJcQzwtDzmw==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pnpm/exe.linux-s390x": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.linux-s390x/-/exe.linux-s390x-12.15.0.tgz", + "integrity": "sha512-zKMhIzsexYMToeLmqV5jPsvV/f9vwsJb2kUH2NFYzalbxImeBrlA4kL7GwF8gD4pagV6jYYcJb8RjbZIdjHptg==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pnpm/exe.linux-x64": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.linux-x64/-/exe.linux-x64-12.15.0.tgz", + "integrity": "sha512-yc+QlZR+9+nr29J4fRzhMoapgxTBDndq/+peyoq1XUufnQFnfbXUMFudDIKzHi545linGqmOmXfn0NoufNgcOg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pnpm/exe.linux-x64-musl": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.linux-x64-musl/-/exe.linux-x64-musl-12.15.0.tgz", + "integrity": "sha512-A9J0Jg0Rdx+qQU4qXtwyST5tto9IOu1zi4fDk35nbc6DWahggbcKtFvZPKFwL2qgUXGXOX//hXv6z/sp6emO8A==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pnpm/exe.win32-arm64": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.win32-arm64/-/exe.win32-arm64-12.15.0.tgz", + "integrity": "sha512-fPXZxuY1VclkOga9bc53qNCXcegfeoBR8+Ue+AospDwKzuGGSHll0oDxkLfkmpjyRqpe7bH5DyQPYp/xSMaIVA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@pnpm/exe.win32-x64": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/@pnpm/exe.win32-x64/-/exe.win32-x64-12.15.0.tgz", + "integrity": "sha512-nrd+Tp1We1DGj4DGG5Bea9lZNh9y1PjlLBdEwdInS4D0h0UIDtM7JaGGGDJhNzIwcHASyihWI7HLV+dtG+fhYg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@sourcegraph/scip-python": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/@sourcegraph/scip-python/-/scip-python-0.6.6.tgz", + "integrity": "sha512-qoKL1Rggg0o5newAFbCFAKlS0AjWxG5MA+mC28BtgxOv0DhO4zdL8u7151FxEppDpXMVvm7+yXSjXotoVH9cMQ==", + "license": "MIT", + "dependencies": { + "@iarna/toml": "^2.2.5", + "command-exists": "^1.2.9", + "commander": "^9.2.0", + "diff": "^5.0.0", + "glob": "^7.2.0", + "google-protobuf": "^3.19.3", + "ts-node": "^10.5.0", + "vscode-languageserver": "^7.0.0" + }, + "bin": { + "scip-python": "index.js" + } + }, + "node_modules/@sourcegraph/scip-typescript": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@sourcegraph/scip-typescript/-/scip-typescript-0.4.0.tgz", + "integrity": "sha512-k+AtsrqmS41Sd5qjkZlHcmvoSQIvBOonRj4jpgp0KNFM6aqvMGpdSuPUqrUcg8ENTKjUbfaUVszgQwq3bCOvwA==", + "license": "Apache-2.0", + "dependencies": { + "commander": "^12.1.0", + "google-protobuf": "^3.21.4", + "progress": "^2.0.3", + "typescript": "^5.6.2" + }, + "bin": { + "scip-typescript": "dist/src/main.js" + } + }, + "node_modules/@sourcegraph/scip-typescript/node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@sourcegraph/scip-typescript/node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.14.tgz", + "integrity": "sha512-UzoEnKAHteIy/qT3dM0eyyviwfJzEDnrLKALKCvu0ToklMLgiDW5waEu/0Pl+6w4nBxGIaUskiFg7NzvQpPs0g==", + "license": "MIT" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "license": "MIT" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "license": "MIT" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "26.6.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.6.tgz", + "integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==", + "license": "MIT", + "peer": true, + "dependencies": { + "undici-types": "~8.9.0" + } + }, + "node_modules/@typescript/typescript-aix-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz", + "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==", + "cpu": [ + "ppc64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "aix" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz", + "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz", + "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz", + "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz", + "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz", + "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz", + "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-loong64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz", + "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==", + "cpu": [ + "loong64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-mips64el": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz", + "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==", + "cpu": [ + "mips64el" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz", + "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==", + "cpu": [ + "ppc64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-riscv64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz", + "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==", + "cpu": [ + "riscv64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-s390x": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz", + "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz", + "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz", + "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz", + "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz", + "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz", + "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-sunos-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz", + "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "sunos" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz", + "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz", + "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.5", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.5.tgz", + "integrity": "sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==", + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "license": "MIT" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.22", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.22.tgz", + "integrity": "sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/bun": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/bun/-/bun-1.4.2.tgz", + "integrity": "sha512-TrSXo6HJfIEaczpb3kjX82I2pL47vK1QUNmHRCUdz9IzaOwa9lzOXSWwu2l18YHE3sNfGRapVLd4nNm+22vVVA==", + "cpu": [ + "arm64", + "x64" + ], + "hasInstallScript": true, + "license": "MIT", + "os": [ + "darwin", + "linux", + "android", + "freebsd", + "win32" + ], + "bin": { + "bun": "bin/bun.exe", + "bunx": "bin/bunx.exe" + }, + "optionalDependencies": { + "@oven/bun-darwin-aarch64": "1.4.2", + "@oven/bun-darwin-x64": "1.4.2", + "@oven/bun-freebsd-aarch64": "1.4.2", + "@oven/bun-freebsd-x64": "1.4.2", + "@oven/bun-linux-aarch64": "1.4.2", + "@oven/bun-linux-aarch64-android": "1.4.2", + "@oven/bun-linux-aarch64-musl": "1.4.2", + "@oven/bun-linux-x64": "1.4.2", + "@oven/bun-linux-x64-android": "1.4.2", + "@oven/bun-linux-x64-musl": "1.4.2", + "@oven/bun-windows-aarch64": "1.4.2", + "@oven/bun-windows-x64": "1.4.2" + } + }, + "node_modules/command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", + "license": "MIT" + }, + "node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || >=14" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "license": "MIT" + }, + "node_modules/diff": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.2.tgz", + "integrity": "sha512-vtcDfH3TOjP8UekytvnHH1o1P4FcUdt4eQ1Y+Abap1tk/OB2MWQvcwS2ClCd1zuIhc3JKOx6p3kod8Vfys3E+A==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/google-protobuf": { + "version": "3.21.4", + "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.4.tgz", + "integrity": "sha512-MnG7N936zcKTco4Jd2PX2U96Kf9PxygAPKBug+74LHzmHXmceN16MmRcdgZv+DGef/S9YvQAfRsNCn4cjf9yyQ==", + "license": "(BSD-3-Clause AND Apache-2.0)" + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "license": "ISC" + }, + "node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pnpm": { + "version": "12.15.0", + "resolved": "https://registry.npmjs.org/pnpm/-/pnpm-12.15.0.tgz", + "integrity": "sha512-s5UdbW/0qfE9x89WzSjSuOs328ycaOUuHhGRhz6p+CoBcoerULqtxczElPA2xnwOR+sTYIwvo29HcRth6hKOYQ==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "pn": "pn", + "pnpm": "pnpm", + "pnpx": "pnpx", + "pnx": "pnx" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@pnpm/exe.android-arm64": "12.15.0", + "@pnpm/exe.android-x64": "12.15.0", + "@pnpm/exe.darwin-arm64": "12.15.0", + "@pnpm/exe.darwin-x64": "12.15.0", + "@pnpm/exe.freebsd-x64": "12.15.0", + "@pnpm/exe.linux-arm64": "12.15.0", + "@pnpm/exe.linux-arm64-musl": "12.15.0", + "@pnpm/exe.linux-ppc64": "12.15.0", + "@pnpm/exe.linux-riscv64": "12.15.0", + "@pnpm/exe.linux-s390x": "12.15.0", + "@pnpm/exe.linux-x64": "12.15.0", + "@pnpm/exe.linux-x64-musl": "12.15.0", + "@pnpm/exe.win32-arm64": "12.15.0", + "@pnpm/exe.win32-x64": "12.15.0" + } + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz", + "integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/typescript": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz", + "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==", + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc" + }, + "engines": { + "node": ">=16.20.0" + }, + "optionalDependencies": { + "@typescript/typescript-aix-ppc64": "7.0.2", + "@typescript/typescript-darwin-arm64": "7.0.2", + "@typescript/typescript-darwin-x64": "7.0.2", + "@typescript/typescript-freebsd-arm64": "7.0.2", + "@typescript/typescript-freebsd-x64": "7.0.2", + "@typescript/typescript-linux-arm": "7.0.2", + "@typescript/typescript-linux-arm64": "7.0.2", + "@typescript/typescript-linux-loong64": "7.0.2", + "@typescript/typescript-linux-mips64el": "7.0.2", + "@typescript/typescript-linux-ppc64": "7.0.2", + "@typescript/typescript-linux-riscv64": "7.0.2", + "@typescript/typescript-linux-s390x": "7.0.2", + "@typescript/typescript-linux-x64": "7.0.2", + "@typescript/typescript-netbsd-arm64": "7.0.2", + "@typescript/typescript-netbsd-x64": "7.0.2", + "@typescript/typescript-openbsd-arm64": "7.0.2", + "@typescript/typescript-openbsd-x64": "7.0.2", + "@typescript/typescript-sunos-x64": "7.0.2", + "@typescript/typescript-win32-arm64": "7.0.2", + "@typescript/typescript-win32-x64": "7.0.2" + } + }, + "node_modules/undici-types": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", + "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", + "license": "MIT", + "peer": true + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "license": "MIT" + }, + "node_modules/vscode-jsonrpc": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz", + "integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==", + "license": "MIT", + "engines": { + "node": ">=8.0.0 || >=10.0.0" + } + }, + "node_modules/vscode-languageserver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-7.0.0.tgz", + "integrity": "sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw==", + "license": "MIT", + "dependencies": { + "vscode-languageserver-protocol": "3.16.0" + }, + "bin": { + "installServerIntoExtension": "bin/installServerIntoExtension" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz", + "integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==", + "license": "MIT", + "dependencies": { + "vscode-jsonrpc": "6.0.0", + "vscode-languageserver-types": "3.16.0" + } + }, + "node_modules/vscode-languageserver-types": { + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", + "integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==", + "license": "MIT" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/yarn": { + "version": "1.22.22", + "resolved": "https://registry.npmjs.org/yarn/-/yarn-1.22.22.tgz", + "integrity": "sha512-prL3kGtyG7o9Z9Sv8IPfBNrWTDmXB4Qbes8A9rEzt6wkJV8mUvoirjU0Mp3GGAU06Y0XQyA3/2/RQFVuK7MTfg==", + "hasInstallScript": true, + "license": "BSD-2-Clause", + "bin": { + "yarn": "bin/yarn.js", + "yarnpkg": "bin/yarn.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "license": "MIT", + "engines": { + "node": ">=6" + } + } + } +} diff --git a/scripts/code-toolchains/package.json b/scripts/code-toolchains/package.json new file mode 100644 index 0000000000..8150d64ee8 --- /dev/null +++ b/scripts/code-toolchains/package.json @@ -0,0 +1,18 @@ +{ + "name": "loom-scripts-code-toolchains", + "private": true, + "version": "0.0.0", + "dependencies": { + "@sourcegraph/scip-typescript": "0.4.0", + "@sourcegraph/scip-python": "0.6.6", + "pnpm": "12.15.0", + "yarn": "1.22.22", + "bun": "1.4.2" + }, + "optionalDependencies": { + "@oven/bun-darwin-x64-baseline": "1.4.2", + "@oven/bun-linux-x64-baseline": "1.4.2", + "@oven/bun-linux-x64-musl-baseline": "1.4.2", + "@oven/bun-windows-x64-baseline": "1.4.2" + } +} diff --git a/scripts/code-toolchains/yarn-modern/package-lock.json b/scripts/code-toolchains/yarn-modern/package-lock.json new file mode 100644 index 0000000000..5aba16f96a --- /dev/null +++ b/scripts/code-toolchains/yarn-modern/package-lock.json @@ -0,0 +1,28 @@ +{ + "name": "loom-scripts-code-toolchains-yarn-modern", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "loom-scripts-code-toolchains-yarn-modern", + "version": "0.0.0", + "dependencies": { + "@yarnpkg/cli-dist": "4.18.1" + } + }, + "node_modules/@yarnpkg/cli-dist": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/@yarnpkg/cli-dist/-/cli-dist-4.18.1.tgz", + "integrity": "sha512-EH+A4TxAtBWXKE0DGQxW9Bo9crXHLJ73mfxjTQJuv8XonNWWTpei8BQ5JjczHJNU9GROTycwMFn8iOvRIZXUcA==", + "license": "BSD-2-Clause", + "bin": { + "yarn": "bin/yarn.js", + "yarnpkg": "bin/yarn.js" + }, + "engines": { + "node": ">=18.12.0" + } + } + } +} diff --git a/scripts/code-toolchains/yarn-modern/package.json b/scripts/code-toolchains/yarn-modern/package.json new file mode 100644 index 0000000000..55dd869adc --- /dev/null +++ b/scripts/code-toolchains/yarn-modern/package.json @@ -0,0 +1,8 @@ +{ + "name": "loom-scripts-code-toolchains-yarn-modern", + "private": true, + "version": "0.0.0", + "dependencies": { + "@yarnpkg/cli-dist": "4.18.1" + } +} diff --git a/scripts/install-code-toolchains.sh b/scripts/install-code-toolchains.sh index 6fae35d308..c637b097e9 100644 --- a/scripts/install-code-toolchains.sh +++ b/scripts/install-code-toolchains.sh @@ -18,14 +18,23 @@ command -v npm >/dev/null 2>&1 || { toolchain_prefix=${LOOM_CODE_TOOLCHAIN_PREFIX:-"$PWD/var/code-toolchains"} mkdir -p "$toolchain_prefix" toolchain_prefix=$(cd "$toolchain_prefix" && pwd) -npm install --global --prefix "$toolchain_prefix" --no-fund --no-audit \ - '@sourcegraph/scip-typescript@0.4.0' '@sourcegraph/scip-python@0.6.6' \ - 'pnpm@12.15.0' 'yarn@1.22.22' 'bun@1.4.2' +script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +packages="$toolchain_prefix/lib/loom-node-tools" +mkdir -p "$packages" "$toolchain_prefix/bin" +cp "$script_dir/code-toolchains/package.json" "$script_dir/code-toolchains/package-lock.json" "$packages/" +npm ci --prefix "$packages" --ignore-scripts --no-fund --no-audit +node "$script_dir/code-toolchains/bind-native.cjs" "$packages" bun pnpm +npm rebuild --prefix "$packages" --ignore-scripts --offline --no-fund --no-audit +for tool in scip-typescript scip-python pnpm pnpx yarn yarnpkg bun bunx; do + ln -sf "../lib/loom-node-tools/node_modules/.bin/$tool" "$toolchain_prefix/bin/$tool" +done # Keep both Yarn lockfile formats supported without downloading a tool at # indexing time or following a repository's executable yarnPath/plugins. -npm install --global --prefix "$toolchain_prefix/yarn-modern" --no-fund --no-audit \ - '@yarnpkg/cli-dist@4.18.1' -ln -sf ../yarn-modern/bin/yarn "$toolchain_prefix/bin/yarn-modern" +modern="$toolchain_prefix/lib/loom-yarn-modern" +mkdir -p "$modern" +cp "$script_dir/code-toolchains/yarn-modern/package.json" "$script_dir/code-toolchains/yarn-modern/package-lock.json" "$modern/" +npm ci --prefix "$modern" --ignore-scripts --no-fund --no-audit +ln -sf ../lib/loom-yarn-modern/node_modules/.bin/yarn "$toolchain_prefix/bin/yarn-modern" # The TypeScript tier installs with this pnpm and never fetches the one a repository # pins: it must load a workspace that sets lockfile options. diff --git a/sdk/python/loom/_version.py b/sdk/python/loom/_version.py index 518e23df89..2cb0748f59 100644 --- a/sdk/python/loom/_version.py +++ b/sdk/python/loom/_version.py @@ -1,4 +1,4 @@ """The package version. `pyproject.toml` carries the same string, and the transport sends it in `User-Agent` and `X-Loom-SDK`.""" -__version__ = "1.2.0" +__version__ = "1.3.0" diff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.toml index eafbda22d2..71c32e0da6 100644 --- a/sdk/python/pyproject.toml +++ b/sdk/python/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "clickhouse-loom" -version = "1.2.0" +version = "1.3.0" description = "Python SDK for ClickHouse Loom, a self-hosted server that gives AI agents shared long-term memory, document search and a code index." requires-python = ">=3.11" license = "Apache-2.0" diff --git a/sdk/typescript/package-lock.json b/sdk/typescript/package-lock.json index b01bfc6816..78a49fe836 100644 --- a/sdk/typescript/package-lock.json +++ b/sdk/typescript/package-lock.json @@ -1,12 +1,12 @@ { "name": "@clickhouse/loom", - "version": "1.2.0", + "version": "1.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@clickhouse/loom", - "version": "1.2.0", + "version": "1.3.0", "license": "Apache-2.0", "devDependencies": { "@anthropic-ai/sdk": "1.8.0", diff --git a/sdk/typescript/package.json b/sdk/typescript/package.json index 3d896c4e76..f24ab044e9 100644 --- a/sdk/typescript/package.json +++ b/sdk/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@clickhouse/loom", - "version": "1.2.0", + "version": "1.3.0", "description": "TypeScript SDK for ClickHouse Loom, a self-hosted server that gives AI agents shared long-term memory, document search and a code index. Typed over every wire operation the server declares, with retries, rate-limit pacing, idempotency keys and an Agent identity binding.", "type": "module", "sideEffects": false, diff --git a/sdk/typescript/src/version.ts b/sdk/typescript/src/version.ts index b327f2f2a6..4ae4204ee0 100644 --- a/sdk/typescript/src/version.ts +++ b/sdk/typescript/src/version.ts @@ -4,5 +4,5 @@ * transport sends it in `User-Agent` and `X-Loom-SDK`. */ export const SDK_NAME = "loom-ts"; -export const SDK_VERSION = "1.2.0"; +export const SDK_VERSION = "1.3.0"; export const SDK_IDENT = `${SDK_NAME}/${SDK_VERSION}`; diff --git a/server.json b/server.json index ff65512e32..b38d1b97b8 100644 --- a/server.json +++ b/server.json @@ -3,7 +3,7 @@ "name": "io.github.ClickHouse/loom", "title": "ClickHouse Loom", "description": "Shared long-term memory, document search and a code index for AI agents, self-hosted on ClickHouse.", - "version": "1.2.0", + "version": "1.3.0", "websiteUrl": "https://clickhouse.github.io/loom/", "repository": { "url": "https://github.com/ClickHouse/loom", diff --git a/server/__init__.py b/server/__init__.py index 0d24d2aa11..6e40f5feda 100644 --- a/server/__init__.py +++ b/server/__init__.py @@ -1,3 +1,3 @@ """Loom server: the control plane over ClickHouse.""" -__version__ = "1.2.0" +__version__ = "1.3.0" diff --git a/server/memory/app/retrieval/chunks.py b/server/memory/app/retrieval/chunks.py index d9ba90febd..45a99c1df0 100644 --- a/server/memory/app/retrieval/chunks.py +++ b/server/memory/app/retrieval/chunks.py @@ -64,68 +64,70 @@ def _chunk_candidates_sql(agent_pred: str) -> str: """ -def _chunk_parent_pred(q: SearchQuery, params: dict[str, Any]) -> str: - """The read's hard tag filter, `as_of` anchor and served-status set, - carried into the chunk leg through the parent row. - - `memory_chunks` has no `tags`, `valid_at` or `status` column; the parent - in `memory_embeddings` has all three. A search that names `tags` admits - a chunk only when its parent passes the fact leg's own predicates — - `tag_predicate`, `as_of_predicate`, `status_predicate`, the same helpers - with the same parameter names, so the two legs cannot drift. A search - that names only `as_of` excludes the chunks whose parent is known and - was not valid then; a chunk whose parent is a session (no embeddings - row) keeps its session date and stays. Without either filter the leg is - unchanged. Returns "" when nothing applies; binds its parameters into - `params` (the chunk statement's, both stages read them).""" - from server.core.tag_sql import tag_predicate - from server.memory.domain.search_sql import hard_tag_filter +def _chunk_parent_state(q: SearchQuery, params: dict[str, Any]) -> tuple[list[str], list[str]]: + """Share the fact leg's status and time rules without depending on a vector projection.""" from server.memory.domain.temporal_sql import ( as_of_predicate, status_predicate, tombstone_predicate, ) - hard_tags = hard_tag_filter(q.tags, q.tags_soft) replaying = q.as_of is not None - if not hard_tags and not replaying: - return "" identity = ["org = {org:String}", "namespace = {ns:String}"] if q.scope == "private" and q.agent not in ("*", "-"): identity.append("agent = {agent:String}") params["agent"] = q.agent + state = [ + tombstone_predicate(q.as_of_basis, replaying=replaying), + status_predicate( + q.as_of_basis, + replaying=replaying, + include_duplicates=q.include_duplicates, + include_superseded=q.include_superseded, + include_proposed=q.include_proposed, + ), + ] if replaying: params["as_of"] = q.as_of - if hard_tags: - params["tags"] = hard_tags - where = [ - *identity, - tombstone_predicate(q.as_of_basis, replaying=replaying), - status_predicate( - q.as_of_basis, - replaying=replaying, - include_duplicates=q.include_duplicates, - include_superseded=q.include_superseded, - include_proposed=q.include_proposed, - ), - tag_predicate(""), - ] - if replaying: - where.append( - as_of_predicate(q.as_of_basis, invalid_col="invalid_at", tomb_col="tombstoned_at") - ) - return ( - "AND c.parent_memory_key IN (SELECT memory_key FROM loom.memory_embeddings FINAL" - " WHERE " + " AND ".join(where) + ")" + state.append( + as_of_predicate(q.as_of_basis, invalid_col="invalid_at", tomb_col="tombstoned_at") ) - # `as_of` alone: the parents that exist and fail the anchor are excluded; - # an orphan chunk (session parent) is dated by its session, not here. - not_valid = "NOT " + as_of_predicate( - q.as_of_basis, invalid_col="invalid_at", tomb_col="tombstoned_at" + return identity, state + + +def _chunk_parent_pred(q: SearchQuery, params: dict[str, Any]) -> str: + """Exclude an unserved known parent on every read; retain session-only evidence. + + The parent identity keeps anonymous spellings equivalent and named writers + and sessions distinct. Canonical rows carry status even without a vector. + Hard tags additionally require a matching searchable parent. Both stages + and neighbour windows use this predicate. Long point-write chunks have a + synthetic session; the pool checks those against their current value. + """ + from server.core.tag_sql import tag_predicate + from server.memory.domain.search_sql import hard_tag_filter + + identity, state = _chunk_parent_state(q, params) + parent = ( + "AND (c.agent, if(c.user_id = '', '-', c.user_id), " + "if(c.session_id = '', '-', c.session_id), c.parent_memory_key) NOT IN " + "(SELECT agent, if(user_id = '', '-', user_id), " + "if(session_id = '', '-', session_id), memory_key FROM loom.memory FINAL WHERE " + + " AND ".join(identity) + + " AND NOT (" + + " AND ".join(state) + + "))" ) + hard_tags = hard_tag_filter(q.tags, q.tags_soft) + if not hard_tags: + return parent + params["tags"] = hard_tags return ( - "AND c.parent_memory_key NOT IN (SELECT memory_key FROM loom.memory_embeddings FINAL" - " WHERE " + " AND ".join([*identity, not_valid]) + ")" + parent + + "\nAND c.parent_memory_key IN (SELECT memory_key FROM loom.memory_embeddings FINAL" + + " WHERE " + + " AND ".join([*identity, *state, tag_predicate("")]) + + ")" ) diff --git a/skills/loom-code/SKILL.md b/skills/loom-code/SKILL.md index 2f2b4d1591..d14e731250 100644 --- a/skills/loom-code/SKILL.md +++ b/skills/loom-code/SKILL.md @@ -2,7 +2,7 @@ name: loom-code license: Apache-2.0 metadata: - version: "1.2.0" + version: "1.3.0" description: "Route-then-read code intelligence for a loom-indexed repository. WHEN: the repo is indexed by loom (LOOM_BASE_URL set, or a `.loom` marker), and you would otherwise read whole files, grep the tree, or guess who calls a function. Use loom's code.* tools to find the exact unit first, then read only that. FOR SINGLE OPERATIONS: call the code.* MCP tool directly." --- diff --git a/skills/loom/SKILL.md b/skills/loom/SKILL.md index 96ea47fc73..4249cd3ada 100644 --- a/skills/loom/SKILL.md +++ b/skills/loom/SKILL.md @@ -2,7 +2,7 @@ name: loom license: Apache-2.0 metadata: - version: "1.2.0" + version: "1.3.0" description: "How an agent uses Loom: memory, documents, working state, runs and code intelligence that persist across sessions and are shared with other agents. WHEN: you have a Loom server (LOOM_BASE_URL, an SDK `Agent`, `loom_*` MCP tools) and you start a task, learn a durable fact, hold a document or a large blob, need to resume, hand work to another agent, or answer from what an earlier session knew. Covers MCP, the Python and TypeScript SDKs and plain HTTP." --- diff --git a/tests/analyzer/shapes.txt b/tests/analyzer/shapes.txt index f873fa6086..274ba23f21 100644 --- a/tests/analyzer/shapes.txt +++ b/tests/analyzer/shapes.txt @@ -8,7 +8,6 @@ 004f2544bc01 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 005d9c786103 SELECT scope_type, scope_path, summary, pagerank, in_degree, out_degree, key_symbols FROM loom.code_summaries FINAL WHERE org = {org:String} AND namespace = {ns:String} AND embedding_model = {model:St 00e65c7c9771 SELECT DISTINCT toString(namespace) AS ns, agent, user_id, session_id, memory_key, toString(memory_id) AS id FROM (SELECT namespace, agent, user_id, session_id, memory_key, memory_id, tags FROM loom.m -010c320328d0 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 01287768034f SELECT count() AS n FROM loom.memory_record_fields FINAL WHERE org = {org:String} AND record_id IN {ids:Array(UUID)} 017897c60dc2 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 01a34c93d39f SELECT count() OVER () AS total, memory_key, toString(memory_id) AS memory_id, toString(valid_at) AS said_on, substring(JSONExtractString(value), ?, ?) AS text FROM loom.memory FINAL WHERE org = {org: @@ -18,17 +17,18 @@ 01fc37594989 WITH ( SELECT ( arrayFlatten(groupArrayIf(pair, own AND live AND verified)), arrayFlatten(groupArray(arrayConcat( if(own AND NOT (live AND verified), pair, []), if(own, [], released_aliases) ))) ) FRO 022062ef2123 SELECT namespace, source_uri, public_namespace, public_uri FROM (SELECT namespace, source_uri, indexOf({bindings:Array(Tuple(String, String))}, (namespace, right(source_uri, ?))) AS binding, arrayElem 0223e520348c SELECT org, namespace, agent, user_id, session_id, scope, embedding_model, memory_key FROM loom.memory_embeddings PREWHERE embedding_dim = ? WHERE tombstoned_at IS NULL AND embed_failed_at IS NULL AND +022615b444ba SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 0226fcb034d1 SELECT count() AS n FROM loom.code_answers WHERE org = {org:String} AND memory_namespace IN {ns:Array(String)} AND (answer != ? OR citations != ?) AND ? 022dab339693 SELECT count() AS n FROM loom.consolidation_runs WHERE org = {org:String} AND namespace IN {ns:Array(String)} 02309b9227fc ALTER TABLE loom.chunk_term_freq DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 02882e91b704 ALTER TABLE loom.query_history_sources DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync 028cbc46b63f ALTER TABLE loom.memory_evidence DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 02ba759cbc26 SELECT count() AS n FROM loom.dataset_rows WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? +02d00423f108 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 02e87ce1c9ea SELECT toString(evidence_id) AS eid, session_id, role, actor, toString(observed_at) AS observed, content, matched FROM ( SELECT evidence_id, session_id, role, actor, observed_at, content, tombstoned_a 030e592bade2 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 031cbd122ba7 ALTER TABLE loom.memory_ask_precedents DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 0326955f9efe SELECT count() AS n FROM loom.memory_record_conflicts FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} -03606191fafb SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 03637287975f SELECT count() AS n FROM loom.memory_categories FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String} 036cec1eaa08 ALTER TABLE loom.subject_last_seen DELETE WHERE (org = {org:String} AND subject = {p:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 038a0ae6d69c SELECT subject, role, status, pending_role, pending_since, granted_at, granted_by FROM loom.namespace_grants FINAL WHERE org = {org:String} AND namespace = {ns:String} AND revoked_at IS NULL ORDER BY @@ -42,6 +42,7 @@ 0449aa3acc7f ALTER TABLE loom.session_summaries UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = { 0456d239d20d ALTER TABLE loom.memory_extraction_queue DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sy 0473bb3df951 SELECT count() AS n FROM loom.memory_exposures WHERE org = {org:String} AND namespace = {ns:String} +04777ef63345 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 048542c0e8b1 SELECT count() AS n FROM loom.code_context_packs FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL 04a330796db7 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 04c23321e14b SELECT count() AS n FROM loom.conversations WHERE org = {org:String} AND tombstoned_at IS NULL AND user_id = {uid:String} @@ -70,7 +71,6 @@ 07417011df11 SELECT category_id, count() AS item_count FROM loom.memory_categories FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL GROUP BY category_id 0775de50682c SELECT max(updated_at) AS updated_at FROM loom.blacklist_version 079b92892a64 ALTER TABLE loom.documents DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? -07a409d0870d SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 07f0130e01ef SELECT count() AS n FROM ( SELECT evidence_id, tombstoned_at FROM loom.memory_evidence WHERE org = {org:String} AND namespace = {ns:String} AND agent = {agent:String} AND user_id = {uid:String} AND se 07fb8f365a46 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 0816a510f9d6 ALTER TABLE loom.knowledge_ingest_cancels DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? @@ -119,7 +119,6 @@ 0cfc88297bf0 SELECT count() AS n FROM loom.knowledge_ingestions WHERE org = {org:String} AND namespace = {ns:String} 0d0074d068cf SELECT queue_id, agent, user_id, session_id, status, attempts, message_count, content_chars, written, last_error, enqueued_at, updated_at FROM loom.memory_extraction_queue FINAL PREWHERE org = {org:St 0d722791e395 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g -0d7b666e8f66 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 0db9931937d8 SELECT count() AS n FROM loom.memory WHERE org = {org:String} AND has(tags, ?) AND hasAny(tags, {src:Array(String)}) AND hasAny(arrayMap(t -> (namespace, t), tags), {pairs:Array(Tuple(String, String)) 0dcf3fdd00d9 SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, if(length(toString(value_json)) > ?, toString(value_json), value) AS value, -- The stored bytes, for version rows 0df388be7e18 SELECT count() AS n FROM loom.memory_projection_failures WHERE org = {org:String} AND (JSONExtractString(payload, ?) = {uid:String} OR arrayExists(e -> JSONExtractString(e, ?) = {uid:String}, JSONExtr @@ -127,7 +126,7 @@ 0dfeec766c5d SELECT thread_id, count() AS n FROM loom.conversations WHERE org = {org:String} AND namespace = {ns:String} AND thread_id IN {tids:Array(String)} AND tombstoned_at IS NULL AND agent = {agent:String} G 0e2b55bdb693 SELECT count() AS n FROM loom.entity_edge_memories WHERE org = {org:String} AND (namespace, memory_key) IN {keys:Array(Tuple(String, String))} 0e350a5bb24b SELECT memory_key, memory_type, content_excerpt, ? - cosineDistance(embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(temporal_anchor, toDateTime(?))) AS temporal_anchor, temporal_confi -0ea97db9d612 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user +0e38911e0678 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 0eb34d1b24ce SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist 0eb4f21ebd1c ALTER TABLE loom.delete_version_checks DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 0ec5f4fd6da5 SELECT max(version) AS version FROM loom.memory_embeddings WHERE org = {org:String} AND namespace = {ns:String} AND agent = {agent:String} AND user_id = ? AND session_id = ? AND scope = ? AND memory_k @@ -159,6 +158,7 @@ 126f541f3042 SELECT tag, count() AS rows FROM (SELECT arrayJoin(tags) AS tag FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND session_id != {id:String}) GRO 1270dcd15268 SELECT count() AS n FROM loom.agent_runs FINAL WHERE org = {org:String} AND namespace = {ns:String} 1280a70a7618 SELECT conversation_logging_enabled AS e FROM loom.namespaces FINAL WHERE org = {org:String} AND namespace = {ns:String} LIMIT ? +1293be9506e5 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 1295024350b9 ALTER TABLE loom.memory_record_fields UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasu 12fd2ac43350 SELECT count() AS n FROM loom.session_outcomes_by_user WHERE org = {org:String} AND namespace = {ns:String} 1331e86914d6 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g @@ -191,7 +191,6 @@ 16a2b5def24b SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 16cf9f836a3a SELECT count() AS n FROM loom.entity_vectors WHERE org = {org:String} AND namespace IN {ns:Array(String)} 16df003ef8b4 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g -16f03ab0c85a SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 16f21c116c6f SELECT session_id, chunk_index, groupUniqArray(memory_key) AS memory_keys FROM loom.memory_chunk_sources FINAL WHERE org = {org:String} AND namespace = {ns:String} AND session_id IN {sessions:Array(St 172b5834ddd7 ALTER TABLE loom.session_outcomes_by_user DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 1735014353cb SELECT agent, count() AS rows, count() OVER () AS total FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL GROUP BY agent ORDER BY rows DESC, agent L @@ -204,7 +203,6 @@ 17e1defc0d07 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 181170548081 SELECT path, count() AS chunks, min(start_line) AS first_line, count() OVER () AS total FROM ( SELECT path, start_line, tombstoned_at FROM loom.code_chunks WHERE org = {org:String} AND namespace = {ns 181f7665f4ab SELECT count() OVER () AS total, memory_key, toString(memory_id) AS memory_id, dateDiff(?, updated_at, now()) AS age_days, length(conflict_with) AS peers FROM loom.memory FINAL WHERE org = {org:String -1823e479e23f SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 182b2004f117 SELECT active, toString(contact_email) AS contact_email, password_hash = ? AS sso FROM loom.namespaces FINAL WHERE org = {org:String} AND namespace = {ns:String} LIMIT ? 184d9b20b72e SELECT pr_number, any(title) AS title, any(files) AS files, any(author) AS author, any(merge_commit_sha) AS merge_sha, min(merged_at) AS merged_at FROM loom.code_pr_history FINAL WHERE org = {org:Stri 1874492b7e5b SELECT count() AS n FROM loom.code_search_outcome WHERE org = {org:String} AND namespace = {ns:String} @@ -251,11 +249,13 @@ 1d663514724c SELECT pr_number, comment_id, path, line, author, excerpt, comment_created_at, on_file, in_range FROM ( SELECT pr_number, comment_id, path, line, author, excerpt, comment_created_at, in_range, count() 1daffd2ac140 SELECT count() OVER () AS total, a.memory_key AS memory_key, toString(a.memory_id) AS memory_id, a.duplicate_of AS duplicate_of FROM (SELECT memory_key, memory_id, duplicate_of FROM loom.memory FINAL 1db80df6143e SELECT count() AS n FROM loom.knowledge_gaps WHERE org = {org:String} AND namespace = {ns:String} AND ? +1dd58eb93569 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 1deb753bdce4 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 1e0ba863c8be SELECT memory_key, memory_type, confidence, version, created_at, expires_at, valid_at, pinned, status, evidence_count, recall_count, last_recalled_at, tags, entities, source_trace, sensitivity, verifi 1e0e9634872a SELECT mention_text, canonical_text, confidence, evidence_count, created_at FROM loom.entity_canonical_map FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL LIMIT {l 1e223219a756 ALTER TABLE loom.memory_doc_stats DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 1e749bd6ee04 ALTER TABLE loom.memory_chunk_sources DELETE WHERE (org = {org:String} AND (namespace, memory_key) IN {keys:Array(Tuple(String, String))}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:St +1e77b19a345b SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 1ea0c8768c0e SELECT count() AS n FROM loom.shared FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String} 1ef2654703f8 SELECT DISTINCT source_uri FROM loom.documents FINAL WHERE org = {org:String} AND namespace = {ns:String} AND arrayExists(u -> startsWith(source_uri, concat(u, ?)), {uris:Array(String)}) ORDER BY sour 1f46432bb4a5 SELECT src, dst, relation, direction, pair_co_occur, valid_from, valid_to, degree FROM ( SELECT src, dst, relation, direction, pair_co_occur, valid_from, valid_to, row_number() OVER (PARTITION BY src @@ -282,6 +282,7 @@ 220a9f3ad17c SELECT DISTINCT name, qualified_name FROM loom.code_symbol_names FINAL WHERE org = {org:String} AND namespace = {ns:String} AND name IN {bares:Array(String)} AND tombstoned_at IS NULL LIMIT ? 220cd62bab8c SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 2213d888d1fc ALTER TABLE loom.chunk_term_freq DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? +223891b31b82 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 22508f757954 SELECT thread_id, title, metadata, run_id, user_id, created_at, updated_at, agent FROM loom.conversation_threads FINAL WHERE org = {org:String} AND namespace = {ns:String} AND thread_id = {tid:String} 225194c2f6a6 DELETE FROM loom.entity_vectors WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS lightweight_deletes_sync = ? 2257190390fb SELECT path, scope, symbol_ids, start_line, end_line, content, shingles, uniqExact(path) OVER () AS admitted_files FROM ( SELECT path, scope, symbol_ids, start_line, end_line, content, chunk_id, array @@ -291,11 +292,13 @@ 22eb12673f82 SELECT count() AS n FROM loom.memory_extraction_queue FINAL WHERE org = {org:String} AND user_id = {uid:String} 2303571b09cb ALTER TABLE loom.memory_versions DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 230c3ffde92d SELECT toString(failure_id) AS failure_id, org, namespace, agent, projection, source_operation, source_resource_id, memory_keys, error_type, error_message, payload, status, created_at, resolved_at FRO +2313f37fcf40 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 231c46b9c69e SELECT count() AS n FROM loom.search_trace_log WHERE org = {org:String} AND namespace IN {ns:Array(String)} 232204b29bcb ALTER TABLE loom.document_blobs DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 2347071a201b SELECT chunk_id, path, cosineDistance(embedding, {q:Array(Float32)}) AS distance FROM loom.code_chunks FINAL WHERE org = {org:String} AND namespace = {ns:String} AND embedding_model = {model:String} A 23c7e58243f2 SELECT count() AS n FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} 241610b30143 SELECT count() AS n FROM loom.session_briefs WHERE org = {org:String} AND namespace = {ns:String} +24168bc01a22 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 241769ad1a52 SELECT count() AS n FROM loom.datasets WHERE org = {org:String} AND namespace = {ns:String} 242bfccd9b35 SELECT test_name, sum(runs) AS runs_in_window, sum(fails) AS fails_in_window, count() OVER () AS matches FROM loom.qa_test_daily FINAL WHERE org = {org:String} AND qa_namespace = {ns:String} AND day > 2430fc6260ce SELECT count() AS n FROM loom.entity_edge_memories WHERE org = {org:String} AND ((namespace, memory_key) IN (SELECT namespace, memory_key FROM loom.memory WHERE org = {org:String} AND user_id = {uid:S @@ -357,13 +360,13 @@ 2a21b625bbc3 SELECT toString(memory_id) AS memory_id, org, namespace, agent, user_id, session_id, memory_key, toString(value) AS value, pinned, valid_at, created_at, updated_at, version, redacted_at, toString(cont 2a44383c565f SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 2a4c344dc346 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g -2a531c53241e SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 2a5db1d4ffaa SELECT name, category_id FROM loom.categories FINAL WHERE org = {org:String} AND namespace = {ns:String} AND name IN {names:Array(String)} AND tombstoned_at IS NULL 2a8380b2d95e SELECT toUInt32(countDistinct(seq)) AS n FROM loom.code_scip_parts WHERE org = {org:String} AND namespace = {ns:String} AND batch_id = {bid:UUID} 2a9240aaa4fe SELECT session_id, summary_text, cosineDistance(summary_embedding, {q:Array(Float32)}) AS distance, -- NB: alias must NOT be `valid_at` — under the analyzer a -- SELECT alias shadows the base column, 2ac2ff622b95 SELECT op, returned_ids, returned_paths, abstain, route, args_json FROM loom.code_search_trace WHERE org = {org:String} AND namespace = {ns:String} AND trace_run_id = {rid:String} AND ts > now() - INT 2ac704bcfa82 SELECT namespace, max(last_write) AS last_write FROM loom.namespace_write_marks WHERE (org = {org:String} AND namespace IN {nss:Array(String)}) OR (org = ? AND namespace = ?) GROUP BY namespace 2acea788fdac SELECT count() AS n FROM loom.agent_runs WHERE org = {org:String} AND namespace = {ns:String} AND ? +2af0d1f09e9c SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 2b19dd7cec5e SELECT memory_key, toString(memory_id) AS id, version, memory_type, toString(status) AS status, source_class, agent, user_id, session_id, actor, updated_at, sensitivity, org, namespace, redacted_at FR 2b2fcb364a16 SELECT org, namespace, facet_kind, name, path, ordinal, line, confidence, indexed_commit, tombstoned_at, created_at, version FROM loom.code_test_facets FINAL WHERE org = {org:String} AND namespace = { 2b3b54e956dd SELECT count() AS scanned, countIf(symbol_id NOT IN ( SELECT to_symbol_id FROM loom.code_edges WHERE org = {org:String} AND namespace = {ns:String} AND edge_kind = ? AND tombstoned_at IS NULL)) AS unc @@ -373,6 +376,7 @@ 2bc1110dc6d5 WITH docs AS ( SELECT thread_id, msg_id, any(role) AS msg_role, argMax(content, ts) AS body, max(ts) AS saved_at, arrayFilter(t -> length(t) >= ?, splitByNonAlpha(lowerUTF8(body))) AS words FROM loom. 2bc18b5b99bf SELECT count() AS n FROM loom.entity_triple_memories WHERE org = {org:String} AND ((namespace, memory_key) IN (SELECT namespace, memory_key FROM loom.memory WHERE org = {org:String} AND user_id = {uid 2c04b7b2650d SELECT count() AS n FROM loom.entity_summaries FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace IN {ns:Array(String)} +2c5e3c3099fc SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 2cad8bf84992 SELECT org, qa_namespace, issue_number, pr_number, rank, score, bm25_title, bm25_body, bm25_norm, window_hours, component_match, frames_symbols, frames_files, frames_total, closes_mention, terms, pr_t 2cbb59e64f4a SELECT path FROM loom.code_files FINAL WHERE org = {org:String} AND namespace = {ns:String} AND path IN {paths:Array(String)} AND tombstoned_at IS NULL 2cca0bb79079 SELECT org, qa_namespace AS namespace FROM loom.qa_rollup_days WHERE org IN {orgs:Array(String)} AND qa_namespace IN {namespaces:Array(String)} GROUP BY org, namespace @@ -381,10 +385,12 @@ 2cfa7e08e12b SELECT memory_id, memory_key, memory_type, version, pinned, created_at, conflict_with, sensitivity FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND status = ? AND tombst 2cfc2e54fc8d SELECT toString(evidence_id) AS eid, session_id, role, actor, toString(observed_at) AS observed, content, matched FROM ( SELECT evidence_id, session_id, role, actor, observed_at, content, tombstoned_a 2d457ef834a6 SELECT org, namespace, memory_key, valid_to FROM loom.memory FINAL WHERE tombstoned_at IS NULL AND status = ? AND valid_to IS NOT NULL AND valid_to < now() +2d4f8542a110 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 2d7e54998a72 SELECT count() AS n FROM loom.entity_degree WHERE org = {org:String} AND namespace = {ns:String} AND ? 2db7427080f4 SELECT count() AS n FROM loom.documents FINAL WHERE org = {org:String} AND namespace = {ns:String} AND (superseded_at IS NULL OR (blob_path != ? AND blob_erased_at IS NULL)) 2e287ea04766 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist 2e457daf2af4 WITH docs AS ( SELECT thread_id, msg_id, any(role) AS msg_role, argMax(content, ts) AS body, max(ts) AS saved_at, arrayFilter(t -> length(t) >= ?, splitByNonAlpha(lowerUTF8(body))) AS words FROM loom. +2e63bd24d8df SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 2e755b234427 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 2e91f70c748e DELETE FROM loom.memory_chunks WHERE (org = {org:String} AND (user_id = {uid:String} OR (user_id = ? AND (namespace, parent_memory_key) IN {keys:Array(Tuple(String, String))}))) AND ({erasure_mutation 2ed709d1c719 SELECT count() AS n FROM loom.memory_belief_sources FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} @@ -393,7 +399,6 @@ 2fab97e447f4 SELECT count() AS n FROM loom.entity_vectors FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND tombstoned_at IS NULL 2fc0cc735773 SELECT toString(evidence_id) AS eid, session_id, role, actor, toString(observed_at) AS observed, content, matched FROM ( SELECT evidence_id, session_id, role, actor, observed_at, content, tombstoned_a 2fd8ca033214 DELETE FROM loom.memory_chunks WHERE org = {org:String} AND namespace = {ns:String} AND agent = {a:String} AND user_id = {u:String} AND parent_memory_key = {k:String} AND if(session_id = {ss:String}, -30397e6f2199 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 303a1827c22d SELECT DISTINCT msg_id FROM loom.conversations WHERE org = {org:String} AND namespace = {ns:String} AND thread_id = {tid:String} AND msg_id IN {mids:Array(String)} AND is_saved AND tombstoned_at IS NU 30406949d371 SELECT memory_id, version, agent, user_id, session_id, memory_key, created_at FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND memory_key IN {keys:Array(String)} AND tom 30b541a5c832 SELECT chunk_id, path, scope, kind, start_line, end_line, content, symbol_ids, context_description, arraySum( arrayMap( (tok, idf) -> idf * countSubstrings( concat(?, lexemes, ?), concat(?, tok, ?) ), @@ -415,6 +420,7 @@ 326c31c72256 SELECT toString(evidence_id) AS eid, session_id, role, actor, toString(observed_at) AS observed, content, matched FROM ( SELECT evidence_id, session_id, role, actor, observed_at, content, tombstoned_a 3287616dab35 SELECT count() AS n FROM loom.documents WHERE org = {org:String} AND user_id = {uid:String} 328c58ef9dbc SELECT count() AS n FROM loom.knowledge_gaps WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? +32931cd0870a SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 3293b6b09298 SELECT count() AS n FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND session_id = {sid:String} AND startsWith(memory_key, {p:String}) AND hasAl 3296d59f88ce SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 3298846483ff SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g @@ -445,6 +451,7 @@ 34c0098ab598 SELECT count() AS cnt, sum(numeric_value) AS s, avg(numeric_value) AS a, min(occurred_at) AS first_at, max(occurred_at) AS last_at FROM loom.derived_facts WHERE org = {org:String} AND namespace = {ns: 34e802c88a30 SELECT count() AS n FROM loom.events WHERE org = {org:String} AND namespace = {ns:String} 34eadcb6f3af SELECT count() AS n FROM loom.delete_version_checks WHERE org = {org:String} AND user_id = {uid:String} +350d156c1ad6 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 3511c7e369c0 SELECT concat(?, session_id, ?, toString(chunk_index)) AS memory_key, ? AS memory_type, content AS content_excerpt, toString(created_at) AS created_at, toString(created_at) AS valid_at FROM loom.memor 3556360a339b SELECT m.org, m.namespace, m.agent, m.user_id, m.session_id, m.memory_key, m.memory_type, m.value AS content_excerpt, m.run_id, m.entities, m.tags, m.files, m.concepts, m.valid_at, m.valid_to, m.expir 35b95e4edd22 SELECT count() AS n FROM loom.conversations WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL @@ -503,6 +510,7 @@ 3c9ff5ef2dc2 SELECT namespace, source_uri, chunk_idx, doc_version, JSONExtractUInt(chunk_metadata, ?) AS revision, cosineDistance(embedding, {q:Array(Float32)}) AS distance, ? AS lexical, [] AS matched FROM loom.c 3cf6ac8c7aa2 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, e.agent AS agent, e.user_id AS user_id, e.session_id AS 3cfe76db564a SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist +3d1528d28966 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 3d23506b7aab SELECT memory_key, toString(memory_id) AS mid, agent, memory_type, -- a high value is readable by key only if(sensitivity = ?, ?, substring(value, ?, ?)) AS preview, sensitivity, tags, toString(create 3d5f2761d6fe SELECT count() AS cnt, sum(numeric_value) AS s, avg(numeric_value) AS a, min(occurred_at) AS first_at, max(occurred_at) AS last_at FROM loom.derived_facts WHERE org = {org:String} AND namespace = {ns: 3d5ff23ff854 ALTER TABLE loom.memory_code_links DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? @@ -540,7 +548,6 @@ 408a4b37c2ac SELECT path, lang, loc, indexed_commit FROM loom.code_files FINAL WHERE org = {org:String} AND namespace = {ns:String} AND path IN {paths:Array(String)} AND tombstoned_at IS NULL 4091a6de6c4d SELECT count() AS n FROM loom.conversation_threads FINAL WHERE org = {org:String} AND user_id = {uid:String} AND tombstoned_at IS NULL 4094b2b5ad1d SELECT countIf(startsWith(name, ?)) AS patch_parts FROM system.parts WHERE database = {db:String} AND table = {t:String} AND active -40a8dd135b2d SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 40d51d7bb87a ALTER TABLE loom.memory_evidence DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 40d90ca12f13 SELECT number FROM loom.code_gh_items FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND is_pr AND state = ? ORDER BY updated_at DESC, number DESC LIMIT {limit:UI 40dfbf0248ef SELECT namespace, source_uri, chunk_idx, doc_version, JSONExtractUInt(chunk_metadata, ?) AS revision, content, context, tags, chunk_metadata, ingested_at, agent, session_id, toString(source_class) AS @@ -549,7 +556,6 @@ 4162e2756b17 ALTER TABLE loom.memory_term_freq DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 419367e4e84e SELECT org, namespace, agent, user_id, session_id, memory_id, memory_key, memory_type, value, confidence, source_trace, version, tombstoned_at, created_at, expires_at, sensitivity FROM loom.memory FIN 419cf32f1e54 SELECT model, count() AS turns, uniqExact(session_id) AS sessions, sum(toUInt64(input_tokens)) AS input_tokens, sum(toUInt64(cache_read_tokens)) AS cache_read_tokens, sum(toUInt64(cache_creation_5m_to -41a501add289 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 41c05e23323a SELECT tier, edge_kind, to_symbol_id, from_symbol_id, path, line, argMax(from_qualified_name, version) AS from_qualified_name, argMax(to_qualified_name, version) AS to_qualified_name, argMax(confidenc 41d907fd0074 SELECT DISTINCT toString(memory_id) AS id FROM loom.entity_edge_rows WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND memory_id NOT IN (SELECT memory_id FROM loom.memory FINAL WHERE or 41f58f345457 SELECT DISTINCT org, namespace, agent, user_id, session_id, memory_key FROM loom.memory WHERE tombstoned_at IS NULL AND sensitivity = ? AND (expires_at IS NULL OR expires_at > now()) AND (match(value, @@ -581,10 +587,12 @@ 44fe95e059ce ALTER TABLE loom.blob_uploads DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 450e3ad5b8bd ALTER TABLE loom.agent_runs DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 4513efbe8bcb SELECT count() AS n FROM loom.blob_uploads WHERE org = {org:String} AND user_id = {uid:String} AND ? +451e7266e2ed SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 4538aaf92b7c SELECT uniqExact(source_uri, doc_version) AS n FROM loom.chunk_supersessions WHERE org = {org:String} AND namespace = {ns:String} 453a40a43a57 SELECT mutation_id, is_done, parts_to_do, latest_fail_reason FROM system.mutations WHERE database = {db:String} AND table = {t:String} AND command LIKE {pat:String} ORDER BY create_time DESC LIMIT ? 454339363b2d SELECT m.org, m.namespace, m.agent, m.user_id, m.session_id, m.memory_key, m.memory_type, m.value AS content_excerpt, m.run_id, m.entities, m.tags, m.files, m.concepts, m.valid_at, m.valid_to, m.expir 4547fa4a3268 SELECT count() AS n FROM loom.entity_edges WHERE org = {org:String} AND cityHash64(namespace, entity_a, entity_b) IN {owned:Array(UInt64)} +454bd5bfad74 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 45734717bae5 SELECT count() AS n FROM loom.memory_code_link_queue WHERE org = {org:String} AND namespace = {ns:String} 458e28a52d04 SELECT memory_type, toString(status) AS status, source_class, count() AS rows, min(updated_at) AS first_at, max(updated_at) AS last_at FROM loom.memory FINAL WHERE org = {org:String} AND namespace = { 45a082f022ab DELETE FROM loom.task_events WHERE org = {org:String} AND inbox = {inbox:String} AND task_id = {id:UUID} AND seq = {seq:UInt64} AND event = {event:String} @@ -596,6 +604,7 @@ 465fe8dcbff7 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist 46670f879d41 SELECT count() AS n FROM loom.knowledge_ingest_cancels WHERE org = {org:String} AND namespace IN {ns:Array(String)} 4682e39bd224 SELECT DISTINCT org, namespace, agent, user_id, session_id, memory_key FROM loom.memory WHERE tombstoned_at IS NULL AND sensitivity = ? AND (expires_at IS NULL OR expires_at > now()) AND (match(value, +46abdab5dec6 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 46c16fbf6c99 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist 46e9280c500c ALTER TABLE loom.conversations UPDATE tombstoned_at = {now:DateTime} WHERE org = {org:String} AND namespace = {ns:String} AND agent = {agent:String} AND thread_id = {tid:String} AND msg_id IN {ids:Arr 46fb9af13bbe SELECT DISTINCT msg_id FROM loom.conversations WHERE org = {org:String} AND namespace = {ns:String} AND thread_id = {tid:String} AND msg_id IN {mids:Array(String)} AND is_saved AND tombstoned_at IS NU @@ -619,6 +628,7 @@ 49b4574ab213 SELECT concat(?, c.session_id, ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, c.content AS content_excerpt, toString(ss.session_date) AS created_at, toString(ss.session_date) AS valid_at 49bd450f5650 SELECT tag, count() AS rows FROM (SELECT arrayJoin(tags) AS tag FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND user_id != {id:String}) GROUP 49c788209c09 SELECT count() AS n FROM loom.documents FINAL WHERE org = {org:String} AND user_id = {uid:String} AND (superseded_at IS NULL OR (blob_path != ? AND blob_erased_at IS NULL)) +49d358039870 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 49e68b2fe0ca ALTER TABLE loom.memory_chunk_sources DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 49f3550b2531 SELECT count() OVER () AS total, memory_key, toString(memory_id) AS memory_id, agent, evidence FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND 4a071fdc1ffe SELECT count() AS cnt, sum(numeric_value) AS s, avg(numeric_value) AS a, min(occurred_at) AS first_at, max(occurred_at) AS last_at FROM loom.derived_facts WHERE org = {org:String} AND namespace = {ns: @@ -648,11 +658,10 @@ 4d9ea3bc8811 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist 4e6e72b7fe21 SELECT mirror, namespace FROM loom.knowledge_mirrors FINAL WHERE org = {org:String} AND namespace IN {namespaces:Array(String)} AND NOT deleted ORDER BY mirror 4e7c07737d13 SELECT session_id, toString(coalesce(valid_at, created_at)) AS d FROM loom.session_summaries FINAL WHERE org = {o:String} AND namespace = {n:String} AND tombstoned_at IS NULL AND has(derived_from, {k: -4ea6d54ef2ba SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 4ea86416312c SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 4f01d06d9c9a SELECT record_id, parent_memory_key, session_id, schema_name, record_json, field_text, lexical_score, least( ?, ? * lexical_score + ? + if(valid_at IS NOT NULL AND abs(dateDiff(?, valid_at, parseDateT 4f15bec9d213 SELECT toString(memory_id) AS id, version, value_preview, value_len > ? AS cut FROM loom.memory WHERE org = {org:String} AND namespace = {ns:String} AND (memory_id, version) IN {pairs:Array(Tuple(UUID -4f6761819225 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user +4f59cd517107 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 4f71b021bf53 ALTER TABLE loom.knowledge_source_push DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 4fd22a03732e SELECT count() AS n FROM loom.dataset_rows WHERE org = {org:String} AND namespace = {ns:String} 5000543b86ce SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, toString(created_at) AS created_at, toString(valid_at) AS valid_at, version FROM loom.memory_embeddings FINAL WHERE org = { @@ -672,7 +681,6 @@ 52448e9cfd6b ALTER TABLE loom.memory_record_conflicts UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {er 524493debfe9 SELECT count() AS n FROM loom.datasets WHERE org = {org:String} AND namespace IN {ns:Array(String)} 525d9e3b3774 SELECT count() AS n FROM loom.working_memory FINAL WHERE org = {org:String} AND user_id = {uid:String} AND tombstoned_at IS NULL -527e62745e6a SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 5287f5e8fe20 SELECT operation, sumMerge(cost_usd_state) AS cost_usd, sumMerge(tokens_state) AS tokens, sumMerge(embed_tokens_state) AS embed_tokens, countMerge(ops_state) AS ops, sumMerge(errors_state) AS errors, 528a44452aa5 SELECT namespace, agent, user_id, session_id, memory_key, toString(status) AS row_status, duplicate_of AS canonical_id FROM loom.memory FINAL WHERE org = {org:String} AND (namespace, agent, user_id, s 52d32818a393 SELECT namespace, toString(memory_id) AS canonical_id, memory_key, memory_type, value, tags, version, agent, session_id, user_id, source_class, sensitivity, toString(created_at) AS created_at, toStrin @@ -687,6 +695,7 @@ 53a13a7270aa SELECT count() AS n FROM loom.memory_chunks WHERE org = {org:String} AND namespace = {ns:String} AND agent = {a:String} AND user_id = {u:String} AND parent_memory_key = {k:String} AND content_sha256 N 53d24506ef23 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist 53d6938a1b94 ALTER TABLE loom.delete_version_checks DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync +54082f4a0bda SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 541a4c06fca2 SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, created_at, valid_at, version, status FROM ( SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, t 54325369241a SELECT org, namespace, agent, user_id, session_id, memory_key, checked, tombstone, done FROM loom.delete_version_checks FINAL WHERE org = {org:String} AND namespace = {ns:String} AND agent = {agent:St 543f6ef995c8 SELECT count() AS n FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND status != ? AND status != ? AND status != ? AND agent = {agent:String} AND @@ -697,11 +706,13 @@ 54d5d57497e5 ALTER TABLE loom.knowledge_ingestions DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 54e9937abaf0 SELECT count() AS n FROM loom.conversations WHERE org = {org:String} AND namespace = {ns:String} 54ff7b59c788 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g +555ee79d4eb0 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 55833cd394e4 SELECT text, tokens_in, tokens_out FROM loom.llm_response_cache WHERE model = {model:String} AND key = {key:String} ORDER BY created_at DESC LIMIT ? 558f85fadb18 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist 559a2b5dca2e SELECT agent, user_id, session_id, memory_key FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND startsWith(source_trace, {trace:String}) AND (ag 559b58cb70db SELECT memory_key, memory_type, substring(value, ?, if((memory_type = ? OR hasAny(tags, [?, ?])), {whole_bytes:UInt32}, ?)) AS value, tags, confidence, pinned, CAST(status AS String) AS status_text, a 55b4e25fe476 ALTER TABLE loom.memory DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? +55c206904a17 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 55de7547093d SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, toString(created_at) AS created_at, toString(valid_at) AS valid_at, version FROM loom.memory_embeddings FINAL WHERE org = { 55ecce8e6992 SELECT count() AS n FROM loom.memory_record_conflicts FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND (prior_record_id IN {ids:Array(UUID)} OR incoming_record_id IN {ids:Array(UUID)}) 55ef648a10ab SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist @@ -713,7 +724,6 @@ 566af30aabf5 SELECT count() AS n FROM (SELECT ? FROM loom.memory LIMIT ?) SETTINGS select_sequential_consistency = ? 569c9b218f83 ALTER TABLE loom.conflict_allowlist DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = 56a045b3692e SELECT kind, number, source_id, component, is_open, created_at, cosineDistance(embedding, {q:Array(Float32)}) AS distance FROM loom.qa_item_embeddings FINAL WHERE org = {org:String} AND namespace = {n -56c94589098a SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 56f4c4320d80 SELECT f AS path, uniqExact(pr_number) AS prs FROM loom.code_pr_history FINAL ARRAY JOIN files AS f WHERE org = {org:String} AND namespace = {ns:String} AND merged_at > now() - INTERVAL {days:UInt32} 56f6ba832916 SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, toString(created_at) AS created_at, toString(valid_at) AS valid_at, version FROM loom.memory_embeddings FINAL WHERE org = { 56f6eca8bb7f SELECT count() AS n FROM loom.session_briefs WHERE org = {org:String} AND user_id = {uid:String} @@ -740,14 +750,15 @@ 5847616a4d65 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, ? - cosineDistance(e.embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(e.temporal_ 584f5e75de87 SELECT day, partial, rolled_until FROM loom.qa_rollup_days FINAL WHERE org = {org:String} AND qa_namespace = {ns:String} AND day >= {d0:Date} AND day <= {d1:Date} ORDER BY day 5852405dd8a6 SELECT id, org, scope_type, scope_value, requester, actor, urgency, purge, mirror_marked, attempts, steps_completed, requested_at, failure_reason, residue_count, residue, verified_at, census FROM loom -585710567f57 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 5862d4ef7b73 ALTER TABLE loom.session_brief_revisions DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? +586a6ce18c21 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 58dd61abeb39 WITH m AS ( SELECT org, namespace, agent, user_id, session_id, memory_key, argMax(status, version) AS ms, argMax(memory_id, version) AS mid FROM loom.memory WHERE org = {org:String} AND namespace = {n 58f4b29e4e3a SELECT org, namespace, policy_id, effect, description, actions, condition, enabled, mode, created_by, created_at, updated_at, tombstoned_at FROM loom.namespace_policies FINAL WHERE org = {org:String} 58f4d68e658f SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist 5923bd3d36dc SELECT thread_id, count() AS n, argMax((agent, toString(role), substringUTF8(content, ?, {listed:UInt32})), (ts, msg_id)) AS last_turn FROM loom.conversations WHERE org = {org:String} AND namespace = 593e0e151193 SELECT toString(memory_id) AS memory_id FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND agent = {agent:String} AND user_id = {uid:String} AND memory_key = {key:String} 596490bd9ba5 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, ? - cosineDistance(e.embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(e.temporal_ +596642e90401 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 596ef23d53ca SELECT path, count() AS chunks, min(start_line) AS first_line, count() OVER () AS total FROM ( SELECT path, start_line, tombstoned_at FROM loom.code_chunks WHERE org = {org:String} AND namespace = {ns 5985b4690741 ALTER TABLE loom.memory UPDATE value = ?, value_json = ?, evidence = ?, entities = [], concepts = [], redacted_at = {ts:DateTime}, redaction_reason = {rb:String} WHERE org = {org:String} AND ((namespa 599611be357f SELECT count() AS n FROM loom.memory_chunk_sources FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND tombstoned_at IS NULL @@ -760,6 +771,7 @@ 5a71c07a9421 SELECT memory_key, content_excerpt, event_date, distance FROM ( SELECT memory_key, content_excerpt, toDate(coalesce(temporal_anchor, valid_at)) AS event_date, cosineDistance(embedding, {q:Array(Float3 5a7665a73fe8 SELECT ? FROM loom.code_test_facets WHERE org = {org:String} AND namespace = {ns:String} LIMIT ? 5a96034314da SELECT count() AS n FROM loom.memory_extraction_queue FINAL WHERE org = {org:String} AND namespace = {ns:String} AND status IN {waiting:Array(String)} +5aa3e19175ad SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 5aa78267733c SELECT count() AS n FROM loom.memory_code_links FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND tombstoned_at IS NULL 5aa9a77dc0c1 SELECT count() AS n FROM loom.context_blobs FINAL WHERE org = {org:String} AND namespace = {ns:String} 5ab4520a4503 SELECT count() AS n FROM loom.memory_webhook_outbox WHERE org = {org:String} AND namespace = {ns:String} @@ -770,7 +782,7 @@ 5b82b22d8ce2 SELECT namespace, source_uri FROM loom.documents FINAL WHERE org = {org:String} AND (namespace, source_uri) IN {pairs:Array(Tuple(String, String))} LIMIT {limit:UInt32} 5b9b9bcb4313 SELECT symbol_id, qualified_name, path, fan_in_calls, fan_in_nontest, fan_in_name, caller_files, defined_files, is_test FROM loom.code_symbol_stats FINAL WHERE org = {org:String} AND namespace = {ns:S 5bcdfad6f454 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist -5be91c2320a6 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER +5c174b8803f6 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 5c2243636c81 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, ? - cosineDistance(e.embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(e.temporal_ 5c5bd0cdac42 SELECT count() AS n, if(n = ?, NULL, max(ingested_at)) AS latest FROM loom.documents FINAL WHERE org = {org:String} AND namespace = {ns:String} AND superseded_at IS NULL 5c7221c42763 SELECT to_key AS memory_key, relation, toString(created_at) AS created_at FROM loom.operator_edges FINAL WHERE org = {o:String} AND namespace = {n:String} AND from_key = {k:String} AND tombstoned_at I @@ -779,6 +791,7 @@ 5cdfc3908c13 SELECT count() AS n FROM loom.knowledge_group_members WHERE org = {org:String} AND namespace = {ns:String} AND ? 5ced72f46310 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist 5d2e62ce8f95 SELECT count() AS n FROM loom.memory_drops WHERE org = {org:String} AND namespace = {ns:String} +5d4167a48c16 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 5d8fbc4e4072 SELECT count() AS n FROM loom.memory_record_versions WHERE org = {org:String} AND namespace IN {ns:Array(String)} 5da02e185da3 SELECT ? AS present FROM loom.code_files WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL LIMIT ? 5df15c3b47a5 SELECT toString(tier) AS tier, count() AS edges, max(created_at) AS last_at FROM loom.code_edges FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL GROUP BY tier @@ -799,6 +812,7 @@ 5f8abb21c668 SELECT count() AS n FROM loom.memory_embeddings FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} 5f8b57965a78 SELECT f AS path, uniqExact(pr_number) AS prs FROM loom.code_pr_history FINAL ARRAY JOIN files AS f WHERE org = {org:String} AND namespace = {ns:String} AND f IN {paths:Array(String)} AND merged_at > 5f90239138ff ALTER TABLE loom.memory_webhook_outbox DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? +5f90abe11671 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 5fa4c7105dc5 SELECT count() AS n FROM loom.code_search_trace WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? 5fb487a531c5 SELECT org, namespace, agent, user_id, session_id, queue_id, payload, message_count, content_chars, status, attempts, lease_until, last_error, written, enqueued_at, updated_at, version, enqueued_by FR 5fbf0c799d3d SELECT sumIf(toUInt64OrZero(args[?]), mirror_marked = ?) AS cache_hits, sumIf(toFloat64OrZero(args[?]), mirror_marked = ?) AS cache_saved_usd FROM (SELECT ts, org, namespace, agent, user_id, session_i @@ -814,16 +828,18 @@ 611a33ab3983 ALTER TABLE loom.llm_response_cache DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 612ce0b0b345 SELECT c.category_id AS category_id, count() AS rows FROM (SELECT memory_key, category_id FROM loom.memory_categories FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NU 61589fe302c8 SELECT count() AS n FROM loom.memory_exposures WHERE org = {org:String} AND user_id = {uid:String} AND ? +6174a4161e8b SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 6196862f89a0 SELECT count() AS n FROM loom.memory_ask_precedents WHERE org = {org:String} AND namespace = {ns:String} -61a52371ac20 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 61b9266c28fa ALTER TABLE loom.conversations UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_muta 61ba62d47959 SELECT count() AS n FROM loom.entity_triples WHERE org = {org:String} AND namespace = {ns:String} AND ? 61c44c22fa4a SELECT * FROM ( SELECT agent, user_id, session_id, memory_key, cosineDistance(embedding, {emb:Array(Float32)}) AS dist FROM loom.memory_embeddings FINAL WHERE org = {org:String} AND namespace = {ns:St 61c5aba9d271 SELECT count() AS n FROM loom.agent_events_private WHERE org = {org:String} AND (user_id = {uid:String} OR subject = {p:String}) 61ecc04f5fbf SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g +62027e9bfdc3 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 622295445cf6 SELECT if(length(path) >= ?, path[?], ?) AS src, if(length(path) >= ?, path[?], ?) AS dst, note, agent, ts FROM loom.procedure_runs WHERE org = {org:String} AND namespace = {ns:String} AND memory_key 622a78531dec SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 622d8f1d5bfd ALTER TABLE loom.conflict_allowlist UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = +626e478d6985 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 627e872383d3 SELECT memory_id, version, agent, user_id, session_id, memory_key, created_at FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND memory_key IN {keys:Array(String)} AND tom 6281fa34af32 SELECT path, scope, symbol_ids, start_line, end_line, content FROM ( SELECT path, scope, symbol_ids, start_line, end_line, content, chunk_id, tombstoned_at FROM loom.code_chunks WHERE org = {org:Strin 6285f383b808 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, ? - cosineDistance(e.embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(e.temporal_ @@ -838,7 +854,6 @@ 643af0b05264 SELECT chunk_id, path, scope, kind, start_line, end_line, embedding_dim, arraySum( arrayMap( (tok, idf) -> idf * countSubstrings( concat(?, lexemes, ?), concat(?, tok, ?) ), {tokens:Array(String)}, {i 6453a8df6771 DELETE FROM loom.session_summaries WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS lightweight_deletes_sync = ? 64559902c6e0 SELECT label, uniqExact(pr_number) AS prs FROM loom.code_pr_history FINAL ARRAY JOIN labels AS label WHERE org = {org:String} AND namespace = {ns:String} AND merged_at > now() - INTERVAL {days:UInt32} -64887cfc5d04 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 648a6cfb4d1d SELECT id, org, scope_type, scope_value, requester, actor, urgency, purge, mirror_marked, attempts, steps_completed, requested_at, failure_reason, residue_count, residue, verified_at, census FROM loom 64909b47ce31 SELECT memory_id, conflict_with, status FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND memory_id = {mid:UUID} AND tombstoned_at IS NULL LIMIT ? 649be8789c60 SELECT count() AS n FROM loom.memory_versions WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? @@ -847,22 +862,21 @@ 64b38d15c083 SELECT memory_key, memory_type, content_excerpt, ? - cosineDistance(embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(temporal_anchor, toDateTime(?))) AS temporal_anchor, temporal_confi 64c1ff845c88 SELECT count() AS n FROM loom.entity_vectors FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL 64c84281ac98 SELECT count() AS n FROM loom.datasets WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? -64f19d90daf0 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user +64dc469b5155 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 6534ce8bc70f SELECT count() AS n FROM loom.memory_embeddings FINAL WHERE org = {org:String} AND has(tags, ?) AND hasAny(tags, {src:Array(String)}) AND hasAny(arrayMap(t -> (namespace, t), tags), {pairs:Array(Tuple -653d05589d87 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 658d1794d1b8 ALTER TABLE loom.knowledge_ingestions DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 659e2ff307fc SELECT f.indexed_commit AS commit, count() AS files, max(f.created_at) AS ingested_at, any(ifNull(p.pr_number, ?)) AS pr_number FROM ( SELECT indexed_commit, created_at FROM loom.code_files FINAL WHER 65aa1f17328b SELECT count() AS n FROM loom.memory_categories FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} 65c31ffcda22 SELECT count() AS n FROM loom.entity_edge_rows WHERE org = {org:String} AND namespace = {ns:String} AND ? 65e630aa6409 SELECT count() AS n FROM loom.code_files FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND index_error != ? 663c96bc8c2e SELECT count() AS cnt, sum(numeric_value) AS s, avg(numeric_value) AS a, min(occurred_at) AS first_at, max(occurred_at) AS last_at FROM loom.derived_facts WHERE org = {org:String} AND namespace = {ns: +666fcf41eb4a SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 66a80f4706a4 ALTER TABLE loom.operator_edges DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 66b1526f73ec SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist 6703a82deeda SELECT operation, count() AS calls, countIf(success) AS succeeded, min(ts) AS first_at, max(ts) AS last_at FROM (SELECT raw.ts AS ts, raw.org AS org, raw.namespace AS namespace, raw.agent AS agent, ra 674c014bbb89 SELECT count() AS n FROM loom.datasets WHERE org = {org:String} AND user_id = {uid:String} AND ? 675a57195847 SELECT memory_id, version, agent, user_id, session_id, memory_key, created_at FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND memory_key IN {keys:Array(String)} AND tom 6765755688ca SELECT kind, name, status, description, cardinality, created_by, updated_at FROM loom.namespace_ontology FINAL WHERE org = {org:String} AND namespace = {ns:String} AND status = {status:String} ORDER B -679eb23e3a9f SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 67b04af64852 SELECT DISTINCT namespace FROM loom.documents WHERE org = {org:String} AND user_id = {uid:String} ORDER BY namespace 67e29bf73ff4 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 680c3774ab86 SELECT namespace, source_uri, chunk_idx, doc_version, JSONExtractUInt(chunk_metadata, ?) AS revision, cosineDistance(embedding, {q:Array(Float32)}) AS distance, ? AS lexical, arrayIntersect(keys, {key @@ -877,10 +891,7 @@ 69ad2d1a3b4a SELECT count() AS n FROM loom.memory_webhook_outbox WHERE org = {org:String} AND user_id = {uid:String} AND event_type != ? 69c8766f7bf2 ALTER TABLE loom.entity_edge_rows DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 69dd5319d904 SELECT count() AS n FROM loom.memory_code_link_queue WHERE org = {org:String} AND namespace IN {ns:Array(String)} -6a0b53c5496b SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 6a1bf0f50b24 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g -6a25f494ae6f SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user -6a3d9de614ba SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 6a5190d3f6a4 SELECT count() AS n FROM loom.memory_versions WHERE org = {org:String} AND namespace IN {ns:Array(String)} 6a53a350be30 SELECT candidate_id, memory_key, memory_type, proposed_value, status, supporters, rationale, source_kind, source_resource_id, version, seeded_from_thread_id, seeded_from_msg_id, supporter_count, confi 6a6d2a924f0f SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g @@ -894,7 +905,6 @@ 6b2f67cd11ca SELECT path, max(computed_at) AS newest_at FROM loom.code_unit_risk WHERE org = {org:String} AND namespace = {ns:String} GROUP BY path 6b4932fdfd22 ALTER TABLE loom.conflict_allowlist DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 6b6d53e64bd0 ALTER TABLE loom.entity_edges DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? -6b7882fdfb07 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 6b920c15b813 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist 6bb37eccea0d SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, if(length(toString(value_json)) > ?, toString(value_json), value) AS value, -- The stored bytes, for version rows 6bca66927292 SELECT min(ts) AS first_ts, count() AS n FROM loom.audit_log @@ -914,7 +924,6 @@ 6d98dc2e3672 SELECT count() AS n FROM loom.memory_embeddings FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND tombstoned_at IS NULL 6da9f7f60075 SELECT count() AS n FROM loom.entity_canonical_map FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} 6daa2655ee73 SELECT count() AS n FROM loom.entity_degree WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? -6dd1d1253f6c SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 6e07272917e3 SELECT count() AS n FROM loom.memory_versions WHERE org = {org:String} AND namespace = {ns:String} AND ? 6e2bd7b72f84 SELECT DISTINCT org, namespace, agent, user_id, session_id, memory_key, scope, embedding_model FROM loom.memory_embeddings WHERE (org, namespace, agent, user_id, session_id, memory_key) IN {keys:Array 6e894706d089 SELECT count() AS n FROM loom.code_search_outcome WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? @@ -949,13 +958,11 @@ 723f99f654df SELECT count() AS n FROM loom.memory_chunks FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String} 7241de7a778c ALTER TABLE loom.context_blobs UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {eras 72570c0878fd SELECT count() AS n FROM loom.conversation_threads FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String} -728e706870cd SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 72ba39630853 SELECT memory_key, memory_type, value, confidence, source_trace, memory_id, entities, tags, valid_at, char_limit, pinned, tombstoned_at, version, status, superseded_by FROM loom.memory FINAL WHERE org 72e4548118f7 SELECT count() AS n FROM loom.search_misses WHERE org = {org:String} AND namespace IN {ns:Array(String)} 72f06cf9707b SELECT count() AS n FROM loom.memory_record_conflicts FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String} 7321c541af42 SELECT org, code_namespace, branch_namespace, pr_number, branch, verdict, epistemic, basis, reason, cherry_pick_pr, cherry_pick_sha, backport_pr, label_wanted, wanted_branch, wanted_source, settled, p 7361c6265def SELECT count() AS n FROM loom.memory_belief_sources FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND tombstoned_at IS NULL -737049809b0f SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 739aa87ddfaa SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, version, value, toString(value_json) AS object_text FROM loom.memory FINAL WHERE tombstoned_at IS NULL AND sensitivity = ? AND 73abdb3dde9b SELECT count() AS n FROM loom.documents FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} 73ae95bf007c SELECT id, org, scope_type, scope_value, requester, status, current_step, failure_reason, requested_at, completed_at, residue_count, verified_at, residue, census, purge, mirror_marked FROM loom.erasur @@ -965,6 +972,7 @@ 73f3a7e807f8 SELECT tag, count() AS rows FROM (SELECT arrayJoin(tags) AS tag FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND agent = {id:String} AND user_i 743e064d9491 SELECT org, namespace, edges FROM ( SELECT g.org AS org, g.namespace AS namespace, g.edges AS edges FROM ( SELECT org, namespace, count() AS edges FROM loom.entity_edges GROUP BY org, namespace ) AS g 74471905e123 SELECT count() AS n FROM loom.blob_uploads WHERE org = {org:String} AND namespace IN {ns:Array(String)} +74749bb79292 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 747deda3bb6f SELECT namespace, countIf(status=?) AS pending, countIf(status=?) AS promoted, countIf(status=?) AS rejected, if(countIf(status IN (?,?)) > ?, countIf(status=?) / countIf(status IN (?,?)), ?) AS appro 74bd4bd2f460 SELECT path, scope, symbol_ids, start_line, end_line, content, shingles, uniqExact(path) OVER () AS admitted_files FROM ( SELECT path, scope, symbol_ids, start_line, end_line, content, chunk_id, array 74d0f50cae51 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g @@ -1010,6 +1018,7 @@ 79af77cb3b0b ALTER TABLE loom.derived_facts DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 79b7b807206a SELECT count() AS n, max(computed_at) AS newest_at FROM loom.code_unit_risk FINAL WHERE org = {org:String} AND namespace = {ns:String} 79de60794e30 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g +79ec8e98cd5d SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 79ff479094a7 SELECT pr_number, title, author, labels, merged_at, merge_commit_sha, linked_issues, body_excerpt FROM loom.code_pr_history FINAL WHERE org = {org:String} AND namespace = {ns:String} AND has(files, {p 7a102674981e SELECT count() AS n FROM loom.query_history_sources WHERE org = {org:String} AND namespace IN {ns:Array(String)} 7a4159a961af SELECT id, org, scope_type, scope_value, requester, actor, urgency, purge, mirror_marked, attempts, steps_completed, requested_at, failure_reason, residue_count, residue, verified_at, census FROM loom @@ -1053,13 +1062,13 @@ 7ca425af7836 SELECT tag, count() AS rows FROM (SELECT arrayJoin(tags) AS tag FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND agent != {id:String}) GROUP BY 7ca4cd496272 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 7cb115afec15 SELECT count() AS n FROM loom.datasets WHERE org = {org:String} AND user_id = {uid:String} -7cbb19795cf8 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 7cd33526cc9c ALTER TABLE loom.memory_records DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 7ce46ce955fb SELECT count() AS n FROM loom.memory FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String} 7ce74001d489 SELECT count() AS n FROM loom.entity_edge_rows WHERE org = {org:String} AND namespace = {ns:String} 7cf866a2b006 SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, if(length(toString(value_json)) > ?, toString(value_json), value) AS value, -- The stored bytes, for version rows 7cfce8998b1b SELECT memory_key, toString(memory_id) AS id, version, memory_type, toString(status) AS status, source_class, agent, user_id, session_id, actor, updated_at, sensitivity, org, namespace, redacted_at FR 7d0f95e88408 SELECT count() AS n FROM loom.agent_runs WHERE org = {org:String} AND user_id = {uid:String} AND ? +7d1aef7d3300 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 7d43341a2607 ALTER TABLE loom.blacklist UPDATE tombstoned_at = {ts:DateTime} WHERE pattern_id = {pid:UUID} SETTINGS mutations_sync=? 7d82a831fe45 SELECT count() AS n FROM loom.scim_users FINAL WHERE deleted = ? AND has(work_addresses, {a:String}) 7d91600536bc SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, value, ? AS value_truncated, confidence, version, pinned, char_limit, created_at, updated_at, expires_at, valid_a @@ -1069,11 +1078,9 @@ 7de28a89c0a8 SELECT path FROM loom.code_coverage_files FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL 7dfbb777603e ALTER TABLE loom.memory_evidence DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 7e34abf20d24 ALTER TABLE loom.memory_record_versions DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_syn -7e5a743b2e86 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 7e726e6f73c0 SELECT model, count() AS turns, uniqExact(session_id) AS sessions, sum(toUInt64(input_tokens)) AS input_tokens, sum(toUInt64(cache_read_tokens)) AS cache_read_tokens, sum(toUInt64(cache_creation_5m_to 7eccab6dfda3 SELECT org, namespace, name, source_id, kind, source_kind, config_json, items_json, credential_enc, secret_enc, access, credential_mode, owner_subject, connection_id, created_by, active, pending_delet 7ed9e5f6ceb3 ALTER TABLE loom.memory_chunk_sources UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasu -7edcb8934635 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 7ef1d533ac81 SELECT count() AS n FROM loom.memory_evidence WHERE org = {org:String} AND namespace = {ns:String} AND ? 7f22d53d8b16 SELECT uniqExact(k) AS n FROM ( SELECT k FROM (SELECT arrayJoin(memories_used) AS k FROM loom.agent_runs FINAL WHERE org = {org:String} AND namespace = {ns:String} AND agent = {agent:String} AND start 7f3000230a53 SELECT memory_type, toString(status) AS status, source_class, count() AS rows, min(updated_at) AS first_at, max(updated_at) AS last_at FROM loom.memory FINAL WHERE org = {org:String} AND namespace = { @@ -1101,7 +1108,6 @@ 81147eeb107a SELECT count() AS n FROM loom.entity_communities WHERE org = {org:String} AND namespace = {ns:String} 812c33d11f88 ALTER TABLE loom.memory_projection_failures DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations 813e255fc5b3 ALTER TABLE loom.task_events DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? -817ae17746c1 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 81aab80fcd3e SELECT count() AS n FROM loom.memory_record_versions WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? 81ae8ae25511 SELECT jti, revoked_at, expires_at, reason, revoked_by, issued_before FROM loom.revoked_tokens FINAL WHERE expires_at > now() ORDER BY revoked_at DESC 81c34c0a916b SELECT namespace, thread_id, ts, msg_id, row_bytes, bytes_before FROM ( SELECT namespace, thread_id, ts, msg_id, row_bytes, sum(row_bytes) OVER (ORDER BY namespace, thread_id, ts, msg_id ROWS BETWEEN @@ -1113,6 +1119,7 @@ 82ab558f7ff1 SELECT * FROM loom.scim_users FINAL WHERE lowerUTF8(user_name) = lowerUTF8({n:String}) AND deleted = ? LIMIT ? 82bcb1da6f37 SELECT chunk_id, path, scope, kind, start_line, end_line, embedding_dim, arraySum( arrayMap( (tok, idf) -> idf * countSubstrings( concat(?, lexemes, ?), concat(?, tok, ?) ), {tokens:Array(String)}, {i 82c613217f47 SELECT DISTINCT org, namespace, agent, user_id, session_id, memory_key FROM loom.memory WHERE tombstoned_at IS NULL AND sensitivity = ? AND (expires_at IS NULL OR expires_at > now()) AND (match(value, +82fff045a9ab SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 8304a44da344 ALTER TABLE loom.entity_canonical_map UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasu 833e61e70cec ALTER TABLE loom.code_search_trace DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 834a21e3a869 SELECT namespace, JSONExtractString(payload, ?) AS operation, toUInt64(sum(? + JSONExtractUInt(payload, ?))) AS violations, max(JSONExtractFloat(payload, ?)) AS max_overage_ratio, round(avg(JSONExtrac @@ -1128,12 +1135,11 @@ 847f10f435b6 SELECT memory_id, memory_key, memory_type, version, pinned, created_at, conflict_with, sensitivity FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND status = ? AND tombst 8483426b1032 SELECT hit.? - ? AS qidx, m.memory_id, m.memory_key, m.value, m.pinned, m.agent, m.user_id, m.session_id, m.run_id, m.valid_at, hit.? AS dist FROM loom.memory m FINAL JOIN loom.memory_embeddings e FIN 8499dcb5bf9a SELECT path, scope, symbol_ids, start_line, end_line, content FROM ( SELECT path, scope, symbol_ids, start_line, end_line, content, chunk_id, tombstoned_at FROM loom.code_chunks WHERE org = {org:Strin -84b34ad66254 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 84bdbba6f76c ALTER TABLE loom.knowledge_gaps DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 84c7b32e7dac ALTER TABLE loom.agent_events UPDATE user_id = ?, memory_key = if(memory_key = ?, ?, ?), args = mapApply((k, v) -> (k, if(k IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), ?, v)), args), subject = if(s -84cec7a119bc SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 84cf65787e43 SELECT count() AS n FROM loom.entity_edge_rows WHERE org = {org:String} AND user_id = {uid:String} AND memory_id NOT IN (SELECT memory_id FROM loom.memory FINAL WHERE org = {org:String} AND memory_id 84ef09b6678f ALTER TABLE loom.datasets DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? +85033c8ab570 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 850f03574fca ALTER TABLE loom.memory_records UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_muta 855313d7b202 SELECT chunk_id, path, scope, kind, start_line, end_line, content, symbol_ids, context_description, cosineDistance(embedding, {q:Array(Float32)}) AS distance FROM loom.code_chunks FINAL WHERE org = {o 85652b8c731b SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, toString(created_at) AS created_at, version FROM loom.memory_embeddings FINAL WHERE org = {org:String} AND namespace = {ns: @@ -1149,6 +1155,7 @@ 8670b419f394 SELECT DISTINCT path FROM loom.code_symbols FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tier = ? AND path IN {paths:Array(String)} AND tombstoned_at IS NULL 8679f24b8161 SELECT DISTINCT content_sha256 AS t FROM loom.memory_chunks FINAL WHERE org = {org:String} AND namespace = {ns:String} AND agent = {a:String} AND user_id = {u:String} AND parent_memory_key = {k:String 868dfc8b0f10 SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, if(length(toString(value_json)) > ?, toString(value_json), value) AS value, -- The stored bytes, for version rows +86c577a1b8e4 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 86d4b775dab0 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, ? - cosineDistance(e.embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(e.temporal_ 87050a4708a4 SELECT count() AS n FROM loom.delete_version_checks WHERE org = {org:String} AND namespace = {ns:String} AND ? 8710a0088ece SELECT count() AS n FROM loom.knowledge_source_listings WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? @@ -1162,15 +1169,12 @@ 8821bc6c7261 SELECT count() AS n FROM loom.session_briefs WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? 884c1941f3ed SELECT candidate_id, memory_key, memory_type, proposed_value, supporter_count, confidence_avg, supporters, rationale, source_kind, source_resource_id, agent, status, proposed_at, decided_at, decided_b 8863d1cc780b SELECT author, uniqExact(pr_number) AS prs FROM loom.code_pr_reviews FINAL WHERE org = {org:String} AND namespace = {ns:String} AND comment_created_at >= now() - INTERVAL {days:UInt32} DAY AND is_bot -88729ea3700f SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 888ce735eb8f SELECT DISTINCT source_uri, toString(doc_id) AS id FROM loom.documents WHERE org = {org:String} AND namespace = {ns:String} AND source_uri >= {uri:String} AND (source_uri, id) > ({uri:String}, {id:Str 888f7269df70 ALTER TABLE loom.memory_exposures DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 88917e6300cc SELECT count() AS n FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND agent = {agent:String} AND user_id = {uid:String} AND session_id = {sid:St -89131bbe7046 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 8915a58efbcd SELECT namespace, toString(memory_id) AS canonical_id, memory_key, memory_type, value, tags, version, agent, session_id, user_id, source_class, sensitivity, toString(created_at) AS created_at, toStrin 891d25765442 SELECT count() AS n FROM loom.shared FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} 8934b9b24243 SELECT toString(evidence_id) AS eid, session_id, role, actor, toString(observed_at) AS observed, content, matched FROM ( SELECT evidence_id, session_id, role, actor, observed_at, content, tombstoned_a -8949988d76ac SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 8956703f37a9 SELECT p.pr_number AS pr_number, p.merge_commit_sha AS merge_commit_sha, p.pack_tokens AS pack_tokens, p.created_at AS created_at, ifNull(h.title, ?) AS title, ifNull(h.author, ?) AS author, h.merged_ 89676ac16aab SELECT toString(memory_id) AS memory_id, org, namespace, agent, user_id, session_id, memory_key, value, actor, version, redacted_at, toString(coalesce(valid_at, updated_at)) AS since FROM loom.memory 8968185eda3b SELECT source_uri, title, version, revision, ingestion_id, ingested_at, if(format != ?, toString(format), if(JSONExtractString(metadata, ?) != ?, JSONExtractString(metadata, ?), if(blob_content_type ! @@ -1219,6 +1223,7 @@ 8e1b7f890fb2 SELECT org, namespace, agent, user_id, session_id, name, source_id, host, port, secure, user, password_enc, cluster, databases, actor, source_class, created_at, tombstoned_at, version FROM loom.query_ 8e580377c32a SELECT count() AS n FROM loom.search_trace_log WHERE org = {org:String} AND namespace = {ns:String} 8e674bf368f7 SELECT namespace, source_uri, chunk_idx, doc_version, JSONExtractUInt(chunk_metadata, ?) AS revision, cosineDistance(embedding, {q:Array(Float32)}) AS distance, ? AS lexical, arrayIntersect(keys, {key +8e7711e9fddb SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 8e7d98f3f0b7 SELECT memory_key, content_excerpt, event_date, distance FROM ( SELECT memory_key, content_excerpt, toDate(coalesce(temporal_anchor, valid_at)) AS event_date, cosineDistance(embedding, {q:Array(Float3 8ea78684e9ed SELECT entities, sensitivity FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND agent = {agent:String} AND user_id = {uid:String} AND session_id = {sid:String} AND memory_ 8ee4f33d0c2f SELECT count() AS n FROM loom.entity_summaries FINAL WHERE org = {org:String} AND namespace = {ns:String} @@ -1235,13 +1240,11 @@ 9017f74f4c3d SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, toString(created_at) AS created_at, toString(valid_at) AS valid_at, version FROM loom.memory_embeddings FINAL WHERE org = { 90332816a040 SELECT toString(memory_id) AS memory_id, version, value, tags, valid_at, pinned, lock_mode, lock_until, sensitivity FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND user 9034f734be88 SELECT toString(memory_id) AS memory_id, memory_key, agent, user_id, session_id, duplicate_of FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND -904e495f5bda SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 90779505e93e SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, ? - cosineDistance(e.embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(e.temporal_ -911446ada799 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 9121adbb70ab ALTER TABLE loom.memory_embeddings UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_m 919b26f50c2c SELECT count() AS n FROM loom.delete_version_checks WHERE org = {org:String} AND namespace = {ns:String} 91a5c9a0b15e ALTER TABLE loom.memory_versions UPDATE value = ?, value_json = ?, evidence = ?, entities = [], concepts = [], redacted_at = {ts:DateTime}, redaction_reason = {rb:String} WHERE org = {org:String} AND -91be01a12caf SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user +91c2100096c0 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 91d49a7a3197 SELECT toString(memory_id) AS memory_id, org, namespace, agent, user_id, session_id, memory_key, value, actor, version, redacted_at, toString(coalesce(valid_at, updated_at)) AS since FROM loom.memory 91d550909ae3 ALTER TABLE loom.operator_edges UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mut 91f981e96977 SELECT path, scope, symbol_ids, start_line, end_line, content FROM ( SELECT path, scope, symbol_ids, start_line, end_line, content, chunk_id, tombstoned_at FROM loom.code_chunks WHERE org = {org:Strin @@ -1254,21 +1257,22 @@ 92e6b8baf91e SELECT m.org AS org, m.namespace AS namespace, count() AS live_rows, max(m.created_at) AS last_write FROM loom.memory AS m FINAL LEFT ANTI JOIN (SELECT org, namespace FROM loom.namespaces) AS n ON m.o 931aec345d53 SELECT memory_key, memory_type, confidence, version, created_at, expires_at, valid_at, pinned, status, evidence_count, recall_count, last_recalled_at, tags, entities, source_trace, sensitivity, verifi 9320702d5e1e SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g +9339ac2a7139 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 9353e65f71a0 SELECT count() AS n FROM loom.conflict_allowlist FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} 935ffe795d8b ALTER TABLE loom.entity_edges DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 9361e22125e3 SELECT chunk_id, path, scope, kind, start_line, end_line, content, symbol_ids, context_description, distance FROM ( SELECT chunk_id, path, scope, kind, start_line, end_line, content, symbol_ids, conte +936b90406cce SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 936f42f73802 SELECT symbol_id, qualified_name, name, signature, path, start_line, end_line, tier, kind FROM loom.code_symbols FINAL WHERE org = {org:String} AND namespace = {ns:String} AND path IN {paths:Array(Str 9385536d2dcd ALTER TABLE loom.session_outcomes_by_user DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 9394972b7b22 ALTER TABLE loom.documents UPDATE superseded_at = {now:DateTime} WHERE (org = {org:String} AND user_id = {uid:String} AND superseded_at IS NULL) AND ({erasure_mutation_tag:String} = {erasure_mutation_ 93991ed10580 SELECT count() AS n FROM loom.entity_triple_rows WHERE org = {org:String} AND user_id = {uid:String} +939f4aded6d7 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 93b20af9b346 SELECT concat(?, c.session_id, ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, c.content AS content_excerpt, toString(ss.session_date) AS created_at, toString(ss.session_date) AS valid_at 93b6309f14f7 SELECT agent, count() AS rows, count() OVER () AS total, sum(count()) OVER () AS total_rows FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND st 93fb8239f3f5 SELECT count() AS n FROM loom.memory_record_fields FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace IN {ns:Array(String)} -9400c6629683 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 9411c8127eba SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, if(length(toString(value_json)) > ?, toString(value_json), value) AS value, -- The stored bytes, for version rows 945db02b838d SELECT count() AS n FROM loom.session_brief_revisions WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? 946786a56b8c SELECT agent, user_id, session_id, memory_key FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND startsWith(source_trace, {trace:String}) AND (ag -946c9c2f75b5 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 9476186d6a8c SELECT c.category_id AS category_id, count() AS rows FROM (SELECT memory_key, category_id FROM loom.memory_categories FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NU 948ef2d049e7 SELECT schema_name, memory_key, field_name, prior_value, incoming_value, toString(prior_record_id) AS prid, toString(incoming_record_id) AS irid, toString(prior_memory_id) AS pmid, toString(incoming_m 94a853966856 ALTER TABLE loom.entity_edge_rows DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? @@ -1282,25 +1286,22 @@ 95a1f85e91e0 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, ? - cosineDistance(e.embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(e.temporal_ 95f859dcea00 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 9610f3c84686 SELECT org, namespace, agent, user_id, session_id, scope, embedding_model, memory_key FROM loom.memory_embeddings WHERE (org, namespace, agent, user_id, session_id, scope, embedding_model, memory_key) -9616a0e00554 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 96291ba85a09 SELECT DISTINCT org, namespace, agent, user_id, session_id, memory_key FROM loom.memory WHERE tombstoned_at IS NULL AND sensitivity = ? AND (expires_at IS NULL OR expires_at > now()) AND (match(value, 9648988c847c SELECT count() AS n FROM loom.documents FINAL WHERE org = {org:String} AND namespace = {ns:String} 96638e980bfa SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, value, ? AS value_truncated, confidence, version, pinned, char_limit, created_at, updated_at, expires_at, valid_a 96a4e124aaa7 SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, toString(created_at) AS created_at, toString(valid_at) AS valid_at, version FROM loom.memory_embeddings FINAL WHERE org = { 96cd9708162d SELECT count() AS n FROM loom.memory_reinforcement WHERE org = {org:String} AND user_id = {uid:String} 96ecb876ec8c SELECT * FROM loom.scim_users FINAL WHERE id = {id:String} -96f6898359c7 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 971a9c534152 SELECT entity, substring(summary_text, ?, ?) AS content_excerpt, cosineDistance(summary_embedding, {q:Array(Float32)}) AS distance, -- alias must NOT be `valid_from`: it would shadow the base column - 9761b739c189 SELECT m.org AS org, m.namespace AS namespace, m.user_id AS user_id, count() AS n FROM loom.memory AS m FINAL INNER JOIN loom.namespaces AS n FINAL ON m.org = n.org AND m.namespace = n.namespace WHERE 976a3206306b SELECT toUInt64(toUnixTimestamp64Milli(now64(?))) AS ms 979ee17b2127 SELECT memory_key, toString(memory_id) AS id, version, memory_type, toString(status) AS status, source_class, agent, user_id, session_id, actor, updated_at, sensitivity, org, namespace, redacted_at FR 97b465efed16 SELECT source_uri, count() AS live, countIf(embedding_model = {model:String} AND embedding_dim > ?) AS searchable, countIf(embedding_dim = ?) AS unembedded, countIf(embedding_model != {model:String}) -97f1fa79ed2d SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 97f2b91effdf SELECT id, org, scope_type, scope_value, requester, actor, urgency, purge, mirror_marked, attempts, steps_completed, requested_at, failure_reason, residue FROM loom.erasure_requests FINAL WHERE status 982795414e49 SELECT agent, user_id, session_id, memory_key, cosineDistance(embedding, {emb:Array(Float32)}) AS dist FROM loom.memory_embeddings FINAL WHERE org = {org:String} AND namespace = {ns:String} AND memory -98461c6a7614 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 9848ee046655 ALTER TABLE loom.memory_belief_sources DELETE WHERE (org = {org:String} AND (namespace, memory_key) IN {keys:Array(Tuple(String, String))}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:S 985f96df6202 SELECT chunk_id, path, scope, kind, start_line, end_line, content, symbol_ids, context_description, arraySum( arrayMap( (tok, idf) -> idf * countSubstrings( concat(?, lexemes, ?), concat(?, tok, ?) ), +98649b515546 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 9874fd318676 SELECT ? FROM loom.memory WHERE tombstoned_at IS NULL AND expires_at IS NOT NULL AND expires_at <= now() AND (org, namespace) NOT IN (SELECT org, namespace FROM loom.namespaces FINAL WHERE retention_d 98b76c9dedf3 DELETE FROM loom.code_answers WHERE (org = {org:String} AND memory_namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS lightweight_deletes_sync = ? 98da281b2e93 SELECT n.namespace AS namespace, n.description AS description, n.kind AS kind, n.owner_email AS owner_email, n.requires_approval AS requires_approval, toString(n.visibility) AS visibility, toString(n. @@ -1310,8 +1311,8 @@ 994458797835 SELECT ts, org, namespace, agent, user_id, session_id, operation, request_id, mode, decision, enforced, determining_rules, errors, detail, latency_ms FROM loom.policy_decisions WHERE org = {org:String 995eaec3e18b ALTER TABLE loom.tasks DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 997fedaf1436 SELECT count() AS n FROM loom.chunk_term_freq WHERE org = {org:String} AND namespace IN {ns:Array(String)} -9989fc368fb9 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 998d3948018f ALTER TABLE loom.session_brief_revisions DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? +99a41729ee1c SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 99b2b4b77f2a SELECT memory_key, memory_type, content_excerpt, ? - cosineDistance(embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(temporal_anchor, toDateTime(?))) AS temporal_anchor, temporal_confi 99bb0fb8f03c ALTER TABLE loom.session_summaries UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_m 99d86c8fa8ea SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g @@ -1325,6 +1326,7 @@ 9adfa8216cee ALTER TABLE loom.memory_code_link_queue DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? 9ae3708317b3 SELECT if(consumer = ?, args[?], consumer) AS consumer_key, count() AS calls, countIf(NOT success) AS errors, countIf(NOT success AND error_code = ?) AS server_errors, round(errors / calls, ?) AS erro 9b1e4cc93d63 ALTER TABLE loom.memory_exposures DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? +9b3d6ec905f6 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 9b5464e2b15d SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 9b6b77417df3 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g 9babe2e9da64 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g @@ -1345,7 +1347,6 @@ 9cea5db2333b SELECT m.org, m.namespace, m.agent, m.user_id, m.session_id, m.memory_key FROM loom.memory AS m FINAL LEFT ANTI JOIN ( SELECT org, namespace, agent, user_id, session_id, memory_key FROM loom.memory_em 9d336f6da7c7 SELECT uniqExact(embedding_model, chunk_idx) AS chunk_count FROM loom.chunks WHERE org = {org:String} AND namespace = {ns:String} AND source_uri = {uri:String} AND JSONExtractUInt(chunk_metadata, ?) = 9d4138cd6c9a SELECT src_path, max(confidence) AS best_confidence FROM loom.code_test_map FINAL WHERE org = {org:String} AND namespace = {ns:String} AND test_path IN {paths:Array(String)} AND tombstoned_at IS NULL -9d979d81e4ab SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user 9daeeb2ab9a4 SELECT org, namespace, memory_key, status, tombstoned_at FROM loom.memory FINAL WHERE tombstoned_at IS NOT NULL AND status != ? 9dafb689b559 SELECT DISTINCT cityHash64(namespace, source_uri) AS h FROM loom.documents FINAL WHERE org = {org:String} AND user_id = {uid:String} 9de706c43448 SELECT count() AS n FROM loom.query_nodes WHERE org = {org:String} AND namespace IN {ns:Array(String)} @@ -1363,7 +1364,7 @@ 9ed6e8cc8634 SELECT count() AS n FROM loom.dataset_rows WHERE org = {org:String} AND namespace = {ns:String} AND ? 9efc25f1a6fe SELECT normalized FROM loom.search_misses WHERE org = {org:String} AND namespace = {ns:String} AND normalized IN {queries:Array(String)} AND ts > now() - toIntervalDay({days:UInt32}) GROUP BY normaliz 9f27e9d4a145 SELECT role, granted_by, status, pending_role, pending_since FROM loom.namespace_grants FINAL WHERE org = {org:String} AND namespace = {ns:String} AND subject = {sub:String} AND revoked_at IS NULL LIM -9f2b2ef74833 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER +9f28894e137d SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER 9f30f09f17f1 SELECT memory_key, count() AS matches FROM (SELECT tm.memory_key FROM loom.entity_triple_memories AS tm INNER JOIN loom.entity_triples AS t ON t.org = tm.org AND t.namespace = tm.namespace AND t.subje 9f3688435054 SELECT count() AS n FROM loom.conversations WHERE org = {org:String} AND user_id = {uid:String} AND tombstoned_at IS NULL 9f3874c7363e SELECT pr_number, title, author, labels, merged_at, merge_commit_sha, linked_issues, body_excerpt FROM loom.code_pr_history FINAL WHERE org = {org:String} AND namespace = {ns:String} AND has(files, {p @@ -1377,13 +1378,13 @@ a0585852a421 SELECT memory_id, memory_key, value, pinned, agent, user_id, sessio a0706937823b SELECT memory_type, toString(status) AS status, source_class, count() AS rows, min(updated_at) AS first_at, max(updated_at) AS last_at FROM loom.memory FINAL WHERE org = {org:String} AND namespace = { a08014de0c22 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g a09ec2d88823 SELECT pr_number, title, author, labels, files, merged_at, opened_at, linked_issues, lexemes FROM loom.code_pr_history FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS N -a0ba61ad8f25 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER a0be1210dc79 SELECT count() AS n FROM loom.memory_ask_precedents WHERE org = {org:String} AND namespace = {ns:String} AND ? a0e30a489601 SELECT * EXCEPT (embedding) FROM loom.code_chunks FINAL WHERE org = {org:String} AND namespace = {ns:String} AND path = {path:String} AND embedding_model = {model:String} AND tombstoned_at IS NULL a0f9368cb508 SELECT count() AS n FROM loom.code_answers WHERE org = {org:String} AND hasAny(memory_keys, arrayConcat((SELECT groupUniqArray(memory_key) FROM loom.memory WHERE org = {org:String} AND user_id = {uid: a10fe1ecf830 SELECT count() AS n FROM loom.knowledge_uploads WHERE org = {org:String} AND namespace IN {ns:Array(String)} a130991a0fb2 SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, if(length(toString(value_json)) > ?, toString(value_json), value) AS value, -- The stored bytes, for version rows a13edb4155ab UPDATE loom.memory SET evidence_count = greatest(evidence_count, transform((org, namespace, toString(memory_id)), {keys:Array(Tuple(String, String, String))}, {evs:Array(UInt32)}, toUInt32(?))), recal +a1498841d4b7 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER a14fb4b432ac SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist a15f5abcdc5f SELECT sum(evidence_count) AS evidence_count FROM loom.memory_usage_totals WHERE org = {org:String} AND namespace = {ns:String} AND memory_id = {mid:String} a175ce2b58cf ALTER TABLE loom.memory_extraction_queue DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? @@ -1397,7 +1398,7 @@ a1efde55bcc4 SELECT toString(schema_id) AS schema_id, name, description, status a216c9e22af7 ALTER TABLE loom.memory_chunks UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_muta a219f248e90c SELECT org, namespace, agent, user_id, session_id, memory_id, memory_key, memory_type, value, confidence, source_trace, version, tombstoned_at, created_at, expires_at, sensitivity FROM loom.memory FIN a247e662ca98 SELECT src, dst, relation, direction, pair_co_occur, provenance, degree FROM ( SELECT p.src AS src, p.dst AS dst, p.relation AS relation, p.direction AS direction, p.pair_co_occur AS pair_co_occur, p. -a2622b2210a9 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user +a270b5e25de9 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user a28f385fb356 SELECT agent AS name, count() AS n, count() OVER () AS total FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND status IN (?, ?) AND agent != ? G a2e086bfc0e6 SELECT org, namespace, agent, user_id, thread_id, msg_id, role, content, reasoning, metadata, tokens, run_id, ts, is_saved, saved_at, tombstoned_at, length(content) + length(reasoning) + length(metada a2f33ec966a9 SELECT tag, count() AS rows FROM (SELECT arrayJoin(tags) AS tag FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND user_id = {scope_uid:String}) @@ -1457,7 +1458,7 @@ a819ade52d8a SELECT org, namespace, source_uri, version, revision, title, ingest a85f83c11660 SELECT count() AS n FROM loom.memory_chunk_sources FINAL WHERE org = {org:String} AND (namespace, memory_key) IN (SELECT namespace, memory_key FROM loom.memory WHERE org = {org:String} AND user_id = { a86e1a806af2 SELECT DISTINCT src_path FROM loom.code_test_map FINAL WHERE org = {org:String} AND namespace = {ns:String} AND src_path IN {paths:Array(String)} AND tombstoned_at IS NULL a883073e33de SELECT count() AS n, if(n = ?, NULL, max(created_at)) AS latest FROM loom.memory_webhooks FINAL WHERE org = {org:String} AND namespace = {ns:String} AND is_deleted = ? -a89b0f382e73 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user +a8b303321d91 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER a8c6e74f4e8d SELECT event_type, count() AS cnt, min(ts) AS first_ts, max(ts) AS last_ts FROM loom.audit_log WHERE ts >= toDateTime64(now() - INTERVAL {since:UInt32} SECOND, ?, ?) AND NOT match(namespace, ?) AND or a8ef32fbad8c SELECT content_sha256, count() AS chunk_count, uniqExact(source_uri) AS uri_count, groupArray(?)((source_uri, chunk_idx)) AS samples FROM loom.chunks WHERE org = {org:String} AND namespace = {ns:Strin a8f2636209f6 SELECT ts, event_type, org, namespace, actor, subject, request_id, row_hash FROM loom.audit_log WHERE org = {org:String} AND (NOT startsWith(namespace, {col_prefix:String}) OR namespace IN {col_readab @@ -1472,7 +1473,6 @@ a9ace0ac3910 SELECT memory_type, toString(status) AS status, source_class, count a9c65c860017 DELETE FROM loom.memory_evidence WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS lightweight_deletes_sync = a9cdda19d241 SELECT kind, number, text_sha256, tombstoned_at, updated_at, embedding_dim, embedding_model FROM loom.qa_item_embeddings FINAL WHERE org = {org:String} AND namespace = {ns:String} a9e0fce6c2f6 SELECT concat(?, session_id, ?, toString(chunk_index)) AS memory_key, ? AS memory_type, content AS content_excerpt, toString(created_at) AS created_at, toString(created_at) AS valid_at FROM loom.memor -aa038e90eefc SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER aa1c3c567b1c SELECT count() AS n FROM loom.events WHERE org = {org:String} AND user_id = {uid:String} aa344c2b976f SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, toString(created_at) AS created_at, toString(valid_at) AS valid_at, version FROM loom.memory_embeddings FINAL WHERE org = { aa79267b2600 SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, toString(created_at) AS created_at, version FROM loom.memory_embeddings FINAL WHERE org = {org:String} AND namespace = {ns: @@ -1498,6 +1498,7 @@ ac2681a0817a ALTER TABLE loom.entity_summaries DELETE WHERE (org = {org:String} ac3b913795e1 SELECT org, namespace, source_uri, chunk_idx, content, context, tags, doc_metadata, chunk_metadata, ingested_at, doc_superseded_at, embedding_model, embedding_dim FROM loom.chunks WHERE org = {org:Str ac5554b059ee SELECT count() AS n FROM loom.documents FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND (superseded_at IS NULL OR (blob_path != ? AND blob_erased_at IS NULL)) ac6327130ea4 SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, value, ? AS value_truncated, confidence, version, pinned, char_limit, created_at, updated_at, expires_at, valid_a +ac764a1f9e9a SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user ac9b92d71654 SELECT ts, event_type, org, namespace, actor, subject, request_id, row_hash FROM loom.audit_log WHERE org = {org:String} AND namespace = {ns:String} AND event_type = {et:String} AND ts >= {since:DateT acc895d8097c SELECT queue_id, agent, user_id, session_id, status, attempts, message_count, content_chars, written, last_error, enqueued_at, updated_at FROM loom.memory_extraction_queue FINAL WHERE org = {org:Strin acdf77ff85a4 SELECT count() AS n FROM loom.shared FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND tombstoned_at IS NULL @@ -1516,12 +1517,10 @@ ae454dd59278 WITH cand AS ( SELECT path FROM loom.code_test_facets FINAL WHERE o ae4e819b95ea SELECT count() AS n FROM loom.entity_edge_rows WHERE org = {org:String} AND namespace IN {ns:Array(String)} ae5b8ffb587a SELECT l.memory_key AS memory_key, toString(l.memory_id) AS memory_id, l.code_namespace AS code_namespace, l.path AS path, l.qualified_name AS qualified_name, l.state AS state, l.changed_since AS chan ae7d2da05030 SELECT count() AS n FROM loom.memory_extraction_queue WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? -aea79f481695 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user +ae99c20b3d1e SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user af399844e950 ALTER TABLE loom.memory_record_fields DELETE WHERE (org = {org:String} AND record_id IN {ids:Array(UUID)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = -af5b1da5f84d SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user af8aae57db93 SELECT count() AS n FROM loom.memory_chunk_sources FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String} af9585af4ffb SELECT session_id, role, toString(observed_at) AS observed_at, content FROM ( SELECT session_id, role, observed_at, content, evidence_id, tombstoned_at FROM loom.memory_evidence WHERE org = {org:Strin -afb7fd86d506 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user afdcda2bf23a SELECT count() AS n FROM loom.memory_ask_precedents WHERE org = {org:String} AND hasAny(arrayConcat(window_keys, cited_keys), arrayConcat((SELECT groupUniqArray(memory_key) FROM loom.memory WHERE org aff1e632ca9c SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, e.agent AS agent, e.user_id AS user_id, e.session_id AS b0198f2a1337 SELECT uniqExact(path) AS n FROM loom.code_chunks FINAL WHERE org = {org:String} AND namespace = {ns:String} AND embedding_model = {model:String} AND tombstoned_at IS NULL AND startsWith(path, {prefix @@ -1569,7 +1568,6 @@ b46d982f0a46 SELECT path, scope, symbol_ids, start_line, end_line, content FROM b478870f3be3 SELECT count() AS n FROM loom.context_blobs FINAL WHERE org = {org:String} AND user_id = {uid:String} AND tombstoned_at IS NULL b49285646859 SELECT agent, session_id, memory_key, max(version) AS newest FROM loom.memory_versions WHERE org = {org:String} AND namespace = {ns:String} AND agent = ? AND user_id = {u:String} AND memory_type = ? A b4bd124a4089 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist -b4d50190286a SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user b4eaaee7f731 SELECT org, namespace, agent, user_id, session_id, name, source_id, host, port, secure, user, password_enc, cluster, databases, actor, source_class, created_at, tombstoned_at, version FROM loom.query_ b4fcede7dd0d SELECT * EXCEPT (embedding) FROM loom.code_summaries FINAL WHERE (org, namespace, embedding_model, scope_type, scope_path) IN {keys:Array(Tuple(String, String, String, String, String))} AND embedding_ b50bb3c82af0 SELECT c.category_id AS category_id, count() AS rows FROM (SELECT memory_key, category_id FROM loom.memory_categories FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NU @@ -1582,7 +1580,6 @@ b5c1f249d43b ALTER TABLE loom.delete_version_checks DELETE WHERE (org = {org:Str b5cfdd2b8732 DELETE FROM loom.memory_embeddings WHERE (org = {org:String} AND scope = ? AND (namespace, memory_key) IN {keys:Array(Tuple(String, String))}) AND ({erasure_mutation_tag:String} = {erasure_mutation_ta b5e2a1f0e361 SELECT count() AS n FROM loom.memory_chunks FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL b5e835a9912a SELECT user_id FROM loom.conversations WHERE org = {org:String} AND namespace = {ns:String} AND agent = {agent:String} AND thread_id = {tid:String} AND msg_id = {mid:String} AND is_saved AND tombstone -b60509844987 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user b6559a8e5adb SELECT number, state, author, title, labels, opened_at, closed_at, updated_at, files, title_hits, file_hit FROM ( SELECT number, state, author, title, labels, opened_at, closed_at, updated_at, files, b66012743fd9 SELECT DISTINCT path FROM loom.code_chunks FINAL WHERE org = {org:String} AND namespace = {ns:String} AND path IN {paths:Array(String)} AND lower(content) LIKE {gp_0:String} AND position(content, {pat b66541ee51e6 SELECT memory_key, content_excerpt, event_date, distance FROM ( SELECT memory_key, content_excerpt, toDate(coalesce(temporal_anchor, valid_at)) AS event_date, cosineDistance(embedding, {q:Array(Float3 @@ -1601,7 +1598,6 @@ b70fca4e1adf SELECT count() AS n FROM loom.knowledge_ingest_cancels WHERE org = b71446085294 SELECT count() AS total, countIf(ok) AS ok FROM loom.procedure_runs WHERE org = {org:String} AND namespace = {ns:String} AND memory_key = {key:String} AND ts > {since:DateTime64(?)} b71b52607a5e SELECT path, lang, size_bytes, loc, indexed_commit, count() OVER () AS total FROM loom.code_files FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND startsWith(pa b72f652f8cd3 SELECT org, qa_namespace, issue_number, pr_number, rank, score, bm25_title, bm25_body, bm25_norm, window_hours, component_match, frames_symbols, frames_files, frames_total, closes_mention, terms, pr_t -b735924f94c7 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user b75c692879fc SELECT namespace, thread_id, ts, msg_id, row_bytes, bytes_before FROM ( SELECT namespace, thread_id, ts, msg_id, row_bytes, sum(row_bytes) OVER (ORDER BY namespace, thread_id, ts, msg_id ROWS BETWEEN b7673cb46abc SELECT concat(?, session_id, ?, toString(chunk_index)) AS memory_key, ? AS memory_type, content AS content_excerpt, toString(created_at) AS created_at, toString(created_at) AS valid_at FROM loom.memor b76b606d5ec4 SELECT count() AS n FROM loom.memory_records FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String} @@ -1654,10 +1650,8 @@ bccb3b408622 SELECT count() AS n FROM loom.memory_embeddings FINAL WHERE org = { bcd0d6a01148 SELECT count() AS n FROM loom.code_search_trace WHERE org = {org:String} AND namespace IN {ns:Array(String)} bcf5fd2c0231 SELECT count() AS n FROM ( SELECT evidence_id, tombstoned_at FROM loom.memory_evidence WHERE org = {org:String} AND namespace = {ns:String} AND hasAnyTokens(content_lc, {tokens:Array(String)}) ORDER B bd095b55bf5d SELECT count() AS n FROM loom.memory_embeddings WHERE org = {org:String} AND namespace = {ns:String} AND agent = {a:String} AND user_id = {u:String} AND session_id = {s:String} AND memory_key = {k:Str -bd413bd54669 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user bd4266cbfe15 SELECT count() AS n FROM loom.conflict_allowlist FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String} bda43b1f632f WITH arrayConcat(splitByNonAlpha(context_lc), splitByNonAlpha(content_lc)) AS words SELECT namespace, source_uri, chunk_idx, doc_version, JSONExtractUInt(chunk_metadata, ?) AS revision, cosineDistance -bdaaa249a629 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER bde7c432bca1 ALTER TABLE loom.entity_communities DELETE WHERE (org = {org:String} AND (cityHash64(namespace, entity) IN {entities:Array(UInt64)} OR cityHash64(namespace, label) IN {entities:Array(UInt64)})) AND ({ bde98d358a2b SELECT path, uniqExact(facet_kind, name) AS matched, groupArray((facet_kind, name, ordinal, line, confidence)) AS hits, length(arrayIntersect(groupUniqArrayIf(ordinal, facet_kind = {k0:String} AND nam be29d7515a0a SELECT count() AS n FROM loom.memory_doc_stats WHERE org = {org:String} AND namespace = {ns:String} @@ -1665,6 +1659,7 @@ be6f152846ae SELECT arrayFirst( u -> startsWith(source_resource_id, concat({pref be735bd4b1cf ALTER TABLE loom.namespace_guides DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? bea1afdda413 SELECT tier, edge_kind, to_symbol_id, from_symbol_id, path, line, argMax(from_qualified_name, version) AS from_qualified_name, argMax(to_qualified_name, version) AS to_qualified_name, argMax(confidenc bec371801c0a ALTER TABLE loom.derived_facts DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? +bed325c3c41c SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user bed39ddf4ed3 SELECT f AS path, uniqExact(pr_number) AS prs FROM loom.code_pr_history FINAL ARRAY JOIN files AS f WHERE org = {org:String} AND namespace = {ns:String} AND merged_at > now() - INTERVAL {days:UInt32} bee252fc856c SELECT count() AS n FROM loom.session_briefs WHERE org = {org:String} AND namespace = {ns:String} AND ? bef8fe4e58b7 SELECT tier, edge_kind, to_symbol_id, from_symbol_id, path, line, argMax(from_qualified_name, version) AS from_qualified_name, argMax(to_qualified_name, version) AS to_qualified_name, argMax(confidenc @@ -1683,6 +1678,7 @@ c08820c92bcf SELECT symbol_id, qualified_name, path, fan_in_calls, fan_in_nontes c089ec35a685 SELECT org, namespace, source_uri, version, revision, title, description, tags, ingested_at, superseded_at, blob_path, blob_size, toString(blob_content_type) AS blob_content_type, original_filename, c c08d6d75fc0e SELECT max(toUInt32OrZero(extract(path, ?))) AS n FROM loom.code_files FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND startsWith(path, ?) c095360ca752 ALTER TABLE loom.memory_projection_failures DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = +c0ce0f6f148d SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER c120bd746afc SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g c14310076fa0 SELECT org, namespace, agent, thread_id, msg_id, role, content, reasoning, user_id, run_id, metadata, tokens, ts FROM loom.conversations WHERE org = {org:String} AND namespace = {ns:String} AND thread c1434f6b0ebe SELECT count() AS n FROM loom.knowledge_uploads WHERE org = {org:String} AND namespace = {ns:String} AND ? @@ -1705,7 +1701,6 @@ c2f0775652ce SELECT tag, count() AS rows FROM (SELECT arrayJoin(tags) AS tag FRO c2f0af86ef00 SELECT identity_agent, user_id, session_id, record_json, created_at FROM loom.memory_records FINAL WHERE org = {org:String} AND namespace = {ns:String} AND schema_name = {schema:String} AND status = ? c31024bfff78 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist c33a4f7fda0e SELECT p.namespace AS namespace, ifNull(n.kind, ?) AS kind, p.subject AS subject, p.role AS role, p.status AS status, p.pending_role AS pending_role, p.pending_since AS pending_since, p.granted_at AS -c346e781ad7d SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user c3761ab74dee SELECT path, count() AS chunks, min(start_line) AS first_line, count() OVER () AS total FROM ( SELECT path, start_line, tombstoned_at FROM loom.code_chunks WHERE org = {org:String} AND namespace = {ns c38a4fe1ee03 SELECT count() AS n FROM loom.memory_record_fields FINAL WHERE org = {org:String} AND record_id IN (SELECT record_id FROM loom.memory_records WHERE org = {org:String} AND user_id = {uid:String}) AND t c3b3b37f4f4e SELECT count() AS n FROM loom.entity_degree WHERE org = {org:String} AND namespace = {ns:String} @@ -1723,6 +1718,7 @@ c4e9948e3b0a SELECT count() AS n FROM loom.events WHERE org = {org:String} AND u c4f78bf506c2 ALTER TABLE loom.chunks UPDATE doc_superseded_at = {now:DateTime} WHERE (org = {org:String} AND namespace IN {ns:Array(String)} AND doc_superseded_at IS NULL) AND ({erasure_mutation_tag:String} = {era c4fb2b7ac3e8 ALTER TABLE loom.tasks DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? c505e5d9fbf9 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g +c53355b3cf3a SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER c562da6b7b7f SELECT count() AS n FROM loom.entity_communities WHERE org = {org:String} AND namespace IN {ns:Array(String)} c5f2a81cdd02 SELECT count() AS n FROM loom.consolidation_runs WHERE org = {org:String} AND user_id = {uid:String} c6056fca9bec ALTER TABLE loom.conflict_allowlist UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure @@ -1744,6 +1740,7 @@ c7c5d35e8502 SELECT memory_id, org, namespace, agent, user_id, session_id, memor c7c8b7f2f21c ALTER TABLE loom.memory_record_conflicts DELETE WHERE (org = {org:String} AND (prior_record_id IN {ids:Array(UUID)} OR incoming_record_id IN {ids:Array(UUID)})) AND ({erasure_mutation_tag:String} = {e c7ec8090e470 SELECT memory_key, memory_type, content_excerpt, ? - cosineDistance(embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(temporal_anchor, toDateTime(?))) AS temporal_anchor, temporal_confi c8167139ec34 DELETE FROM loom.memory_embeddings WHERE (org = {org:String} AND has(tags, ?) AND hasAny(tags, {src:Array(String)}) AND hasAny(arrayMap(t -> (namespace, t), tags), {pairs:Array(Tuple(String, String))} +c8342f918649 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user c8424367f9c9 SELECT namespace, source_uri, count() AS chunk_count FROM loom.chunks WHERE org = {org:String} AND (namespace, source_uri) IN {keys:Array(Tuple(String, String))} AND doc_superseded_at IS NULL AND (org c850ef07bf65 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g c853d7bbd170 SELECT org, agent, count() AS calls, countIf(if(consumer = ?, args[?], consumer) NOT IN {untagged:Array(String)}) AS tagged, calls - tagged AS untagged, round(tagged / calls, ?) AS tagged_ratio, anyIf @@ -1788,6 +1785,7 @@ cb5546d93aee ALTER TABLE loom.memory_versions DELETE WHERE (org = {org:String} A cbd6cc077d01 SELECT org, namespace, agent, user_id, session_id, memory_key, tags FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND has(tags, ?) AND has(tags, {srctag:String}) AND tomb cbf399def5b1 SELECT org, namespace, agent, user_id, session_id, memory_key, version FROM loom.memory FINAL PREWHERE (org, namespace, agent, user_id, session_id, memory_key) IN {keys:Array(Tuple(String, String, Str cc115227ad18 SELECT count() AS n FROM loom.namespace_guides WHERE org = {org:String} AND namespace = {ns:String} +cc216db24930 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user cc23f4e1f7d2 SELECT count() AS n FROM loom.memory_chunks FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} cc5e9c8e7936 SELECT namespace, name, credential_mode, toString(source_id) AS source_id FROM loom.knowledge_sources FINAL WHERE org = {org:String} AND namespace IN {names:Array(String)} AND active AND access = ? OR cc63d1a2772c SELECT count() AS n FROM loom.session_summaries FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace IN {ns:Array(String)} @@ -1797,7 +1795,6 @@ cc8b705f6161 SELECT version, status, toString(created_at) AS created_at FROM loo cca5aae3c65b SELECT count() AS n FROM loom.code_answers WHERE org = {org:String} AND hasAny(memory_keys, {keys:Array(String)}) ccb7e2e443b4 SELECT toUInt64(count()) AS n, sumForEach( arrayMap(t -> toUInt64(position(concat(?, lexemes, ?), concat(?, t, ?)) > ?), {tokens:Array(String)}) ) AS dfs FROM loom.code_pr_history FINAL WHERE org = {o ccd7f511f67e SELECT count() AS n FROM loom.entity_canonical_map FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace IN {ns:Array(String)} -ccde8cd3aa99 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user ccee06cc12d6 SELECT pattern_id, org, namespace, scope, pattern, pattern_type FROM loom.blacklist FINAL WHERE pattern_id = {pid:UUID} AND tombstoned_at IS NULL AND org = {org:String} LIMIT ? cd413b93aa2f SELECT m.memory_id, m.memory_key, m.value, m.pinned, m.agent, m.user_id, m.session_id, m.run_id, m.valid_at, cosineDistance(e.embedding, {emb:Array(Float32)}) AS dist FROM loom.memory m FINAL JOIN loo cd417678bb2f SELECT count() AS n FROM loom.session_brief_revisions WHERE org = {org:String} AND namespace = {ns:String} @@ -1824,6 +1821,7 @@ cf1e114983a0 SELECT count() AS n FROM loom.memory_embeddings FINAL WHERE org = { cf1f27acd065 SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, toString(created_at) AS created_at, version FROM loom.memory_embeddings FINAL WHERE org = {org:String} AND namespace = {ns: cf33a2b90679 SELECT path, scope, symbol_ids, start_line, end_line, content, shingles, uniqExact(path) OVER () AS admitted_files FROM ( SELECT path, scope, symbol_ids, start_line, end_line, content, chunk_id, array cf3d0a421f45 SELECT s.org AS org, s.namespace AS namespace, s.schema_json AS schema_json, s.schema_sha256 AS schema_sha256 FROM loom.profile_schemas AS s FINAL WHERE s.tombstoned_at IS NULL AND NOT has({off:Array( +cf7f4af684cc SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER cfb372c74ad9 SELECT memory_key, toString(memory_id) AS id, version, memory_type, toString(status) AS status, source_class, agent, user_id, session_id, actor, updated_at, sensitivity, org, namespace, redacted_at FR cfb97a41eb8f SELECT count() AS n FROM loom.code_pr_history FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL cfc0533b440e SELECT count() AS n FROM loom.entity_triple_memories WHERE org = {org:String} AND namespace = {ns:String} @@ -1833,26 +1831,30 @@ cff998bacc10 ALTER TABLE loom.dataset_rows DELETE WHERE (org = {org:String} AND d043dcfa2c2b SELECT count() AS n FROM loom.session_summaries FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace = {ns:String} d04bc22409e3 SELECT uniqExact(msg_id) AS n FROM loom.conversation_embeddings FINAL WHERE org = {org:String} AND namespace = {ns:String} AND thread_id = {tid:String} AND tombstoned_at IS NOT NULL AND (agent = {agen d06419919bf2 SELECT count() AS n FROM loom.memory_chunks FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND tombstoned_at IS NULL +d06c9096df61 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER d0802f441bc2 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g d082fe47bb46 SELECT chunk_id, path, scope, kind, start_line, end_line, content, symbol_ids, context_description, arraySum( arrayMap( (tok, idf) -> idf * countSubstrings( concat(?, lexemes, ?), concat(?, tok, ?) ), d089a672528c SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g d0a888305d0b SELECT org, code_namespace, branch_namespace, pr_number, branch, verdict, epistemic, basis, reason, cherry_pick_pr, cherry_pick_sha, backport_pr, label_wanted, wanted_branch, wanted_source, settled, p d0be57c846ee SELECT if(consumer = ?, args[?], consumer) AS consumer_key, count() AS calls, countIf(NOT success) AS errors, countIf(NOT success AND error_code = ?) AS server_errors, round(errors / calls, ?) AS erro +d0c98dde6333 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user d0cd0cac2c88 SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, if(length(toString(value_json)) > ?, toString(value_json), value) AS value, -- The stored bytes, for version rows -d10328ed7469 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user d10a174bff69 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g +d11e82174d2d SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user d19be6e39b44 SELECT org, namespace, agent, user_id, session_id, scope, embedding_model, memory_key, created_at, version FROM loom.memory_embeddings FINAL PREWHERE (org, namespace, agent, user_id, session_id, memor d19d31a3306d SELECT count() AS n FROM loom.memory_reinforcement WHERE org = {org:String} AND user_id = {uid:String} AND ? d1b71b21db97 SELECT count() AS n FROM loom.conversation_embeddings FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND user_id = {uid:String} d1c4411c6c0d SELECT count() AS n FROM loom.code_summaries WHERE org = {org:String} AND namespace = {ns:String} AND ? -d23ba55fc1eb SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user +d1fdd2b5059d SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER d266cd6ee697 SELECT count() AS n FROM loom.memory_webhook_outbox WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND event_type != ? d29ac64ab9c1 SELECT schema_name, memory_key, field_name, prior_value, incoming_value, toString(prior_record_id) AS prid, toString(incoming_record_id) AS irid, toString(prior_memory_id) AS pmid, toString(incoming_m d2c01d2cb202 SELECT count() AS n FROM loom.entity_canonical_map FINAL WHERE org = {org:String} AND namespace = {ns:String} d2c964f328e6 SELECT path FROM loom.code_files FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND arrayExists(s -> endsWith(path, s), {suffixes:Array(String)}) ORDER BY path LI d2f86e5a0e3b SELECT count() AS n FROM loom.learnings_supporters WHERE org = {org:String} AND namespace = {ns:String} AND ? +d33262f73e11 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER d33dae31077e SELECT toString(schema_id) AS schema_id, name, description, status FROM loom.memory_schemas FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND status = ? ORDER BY d35499a6e1bc SELECT embedder_model, similar_p10, similar_p25, similar_p50, similar_p75, distractor_p50, distractor_p90, noise_floor, rerank_skip_above, hyde_fallback_threshold, query_rewrite_threshold, abstain_thr +d35fe6a14ec5 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user d3736e2bab36 SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, if(length(toString(value_json)) > ?, toString(value_json), value) AS value, -- The stored bytes, for version rows d39cc1decd97 SELECT pr_number, title, merge_commit_sha, files, merged_at FROM loom.code_pr_history FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND merge_commit_sha != ? AND d3a1a1a7adba SELECT count() AS c FROM loom.session_summaries FINAL WHERE org = {o:String} AND namespace = {n:String} AND tombstoned_at IS NULL @@ -1862,6 +1864,8 @@ d3d02217087a SELECT agent, user_id, session_id, memory_key, memory_type, content d3e20e869a25 SELECT count() OVER () AS total, a.memory_key AS memory_key, toString(a.memory_id) AS memory_id, a.superseded_by AS superseded_by FROM (SELECT memory_key, memory_id, superseded_by FROM loom.memory FIN d3eb5e38ab39 ALTER TABLE loom.entity_degree DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? d3ec29699853 SELECT count() AS n FROM loom.code_answers WHERE org = {org:String} AND memory_namespace IN {ns:Array(String)} +d41fb49bc0a1 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user +d44a207c193a SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user d455eae6762a SELECT count() AS n FROM loom.procedure_runs WHERE org = {org:String} AND namespace = {ns:String} d469073eeef7 SELECT subject, relation, object, sum(co_occur) AS co_occur, max(last_seen) AS last_seen, -- The strongest tier behind the aggregated triple. -- Not `AS provenance`: with the provenance filter in WHER d4a86d775cfd SELECT path, chunk_id, argMax(tombstoned_at IS NULL, version) AS is_live FROM loom.code_chunks WHERE org = {org:String} AND namespace = {ns:String} AND embedding_model = {model:String} AND path IN {pa @@ -1907,10 +1911,10 @@ d94876cb7709 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e. d99357c88d12 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g d9b16651542c ALTER TABLE loom.entity_edge_memories DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync da16c635942f SELECT count() AS n FROM loom.memory_embeddings FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND user_id = {uid:String} -da1a4070fe91 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user da1d5a654f1e SELECT count() AS n FROM loom.knowledge_uploads WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? da366d9eb046 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist daa35ab01384 SELECT count() AS n, countIf(embedding_dim > ?) AS embedded, countIf(NOT startsWith(embed_last_error, {unembedded:String})) AS embeddable FROM loom.code_chunks FINAL WHERE org = {org:String} AND names +daa9953aad14 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user dabe37717488 SELECT state_key, state_value, detail, updated_at FROM loom.code_index_state FINAL WHERE org = {org:String} AND namespace = {ns:String} ORDER BY state_key dae0d2378112 SELECT count() AS n FROM loom.memory_code_links FINAL WHERE org = {org:String} AND user_id = {uid:String} AND tombstoned_at IS NULL dae4a1968b69 ALTER TABLE loom.context_blobs UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutat @@ -1927,13 +1931,13 @@ dba4103aafba SELECT count() AS n FROM loom.document_blobs WHERE org = {org:Strin dbd04ba47fb3 SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, created_at, valid_at, version, status FROM ( SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, t dbe0f33a89a7 SELECT toString(memory_id) AS memory_id, org, namespace, agent, user_id, session_id, memory_key, value, created_at, valid_at, version, redacted_at, toString(content_sha256) AS content_sha256 FROM loom dbe745784521 SELECT memory_type, toString(status) AS status, source_class, count() AS rows, min(updated_at) AS first_at, max(updated_at) AS last_at FROM loom.memory FINAL WHERE org = {org:String} AND namespace = { +dbefbb4f200e SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user dbf737bf992e ALTER TABLE loom.knowledge_uploads DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? dbfe0a193e5b SELECT count() AS n FROM loom.documents FINAL WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND superseded_at IS NULL dc003d9f3eb2 SELECT toString(failure_id) AS failure_id, org, namespace, agent, projection, source_operation, source_resource_id, memory_keys, error_type, error_message, payload, status, created_at, resolved_at FRO dc06a0e4e9ec SELECT count() AS n FROM loom.code_search_outcome WHERE org = {org:String} AND namespace IN {ns:Array(String)} dc0b35f711b3 INSERT INTO loom._migration_lock (name, holder, acquired_at, renewed_at, ttl_s, build_commit) SETTINGS keeper_map_strict_mode = ?, async_insert = ? VALUES ({name:String}, {me:String}, now64(?), now64( dc258476c8e1 SELECT count() AS n FROM loom.conversation_embeddings FINAL WHERE org = {org:String} AND user_id = {uid:String} AND tombstoned_at IS NULL -dc8264f2b066 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user dc8f7f26ff35 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g dcaad5caba4b SELECT agent, user_id, memory_key, argMax(reinforcement_count, version) AS reinforcement_count, argMax(last_reinforced_at, version) AS last_reinforced_at FROM loom.memory_reinforcement WHERE org = {or dcacca961d46 WITH arrayConcat(splitByNonAlpha(context_lc), splitByNonAlpha(content_lc)) AS words SELECT namespace, source_uri, chunk_idx, doc_version, JSONExtractUInt(chunk_metadata, ?) AS revision, cosineDistance @@ -1956,13 +1960,12 @@ dde8208a93a2 SELECT count() AS n FROM loom.entity_triple_memories WHERE org = {o ddfb30beb525 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g de25c2cb1919 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g de2873bc124f SELECT tier, edge_kind, to_symbol_id, from_symbol_id, path, line, argMax(from_qualified_name, version) AS from_qualified_name, argMax(to_qualified_name, version) AS to_qualified_name, argMax(confidenc -de2f7fb66a40 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user de6e3a798fff DELETE FROM loom.entity_vectors WHERE (org = {org:String} AND (user_id = {uid:String} OR (namespace, memory_key) IN {keys:Array(Tuple(String, String))})) AND ({erasure_mutation_tag:String} = {erasure_ de7bbe4a4ec2 ALTER TABLE loom.memory_categories UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = { +de842ab13a32 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user de88ab6d445d SELECT queue_id, agent, user_id, session_id, status, attempts, message_count, content_chars, written, last_error, enqueued_at, updated_at FROM loom.memory_extraction_queue FINAL PREWHERE org = {org:St de897aab140e ALTER TABLE loom.memory_projection_failures DELETE WHERE (org = {org:String} AND (JSONExtractString(payload, ?) = {uid:String} OR arrayExists(e -> JSONExtractString(e, ?) = {uid:String}, JSONExtractAr deafbec33253 SELECT count() AS n FROM loom.memory_belief_sources FINAL WHERE org = {org:String} AND namespace = {ns:String} -deb0da856668 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER deb47fbf6e50 SELECT neighbor, role, sum(co_occur) AS co_occur FROM ( SELECT object AS neighbor, ? AS role, sum(co_occur) AS co_occur FROM loom.entity_triples WHERE org = {org:String} AND namespace = {ns:String} AN ded4dbaaf6b9 SELECT toString(schema_id) AS schema_id, name, description, status FROM loom.memory_schemas FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL ORDER BY name LIMIT {li dedc23bcedfb SELECT namespace, thread_id, ts, msg_id, row_bytes, bytes_before FROM ( SELECT namespace, thread_id, ts, msg_id, row_bytes, sum(row_bytes) OVER (ORDER BY namespace, thread_id, ts, msg_id ROWS BETWEEN @@ -1973,6 +1976,7 @@ df31f9f54e16 SELECT from_key, to_key, relation FROM loom.operator_edges FINAL WH df32750b2fbe SELECT pr_number, title, author, merged_at, files, linked_issues, (match(title, {revert_re:String}) OR positionCaseInsensitive(body_excerpt, ?) > ? ) AS is_revert FROM loom.code_pr_history FINAL WHERE df3311f16690 SELECT lang, count() AS files, countIf(index_error != ?) AS errored, max(created_at) AS last_at, min(created_at) AS first_at FROM loom.code_files FINAL WHERE org = {org:String} AND namespace = {ns:Str df5c577c685a SELECT sid, argMin(content_hash, start_line) AS h FROM ( SELECT arrayJoin(symbol_ids) AS sid, content_hash, start_line FROM loom.code_chunks FINAL WHERE org = {org:String} AND namespace = {ns:String} +df62986ef9b7 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user df875c426404 SELECT count() AS n FROM loom.memory_ask_precedents WHERE org = {org:String} AND namespace IN {ns:Array(String)} df886269fbb5 SELECT org, namespace FROM loom.namespace_grants FINAL WHERE role = ? AND revoked_at IS NULL AND status = ? AND (org, namespace) IN {keys:Array(Tuple(String, String))} GROUP BY org, namespace df9a592b3176 SELECT min(version) AS v FROM loom.memory_versions WHERE org = {org:String} AND namespace = {ns:String} @@ -2015,10 +2019,10 @@ e2c47c02f88d SELECT pr_number, any(merge_commit_sha) AS sha FROM loom.code_pr_hi e2c7ea266e58 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g e2d6458239f7 SELECT number, is_pr, state, state_reason, author, title, opened_at, closed_at, merged_at, updated_at FROM loom.code_gh_items FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_ e2dfec65926a SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g -e2f28997a399 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user e30e0afa7cd0 ALTER TABLE loom.memory_record_versions DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? e33eba4d561f SELECT path, count() AS chunks, min(start_line) AS first_line, count() OVER () AS total FROM ( SELECT path, start_line, tombstoned_at FROM loom.code_chunks WHERE org = {org:String} AND namespace = {ns e37d6af3680a SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist +e3a91311885a SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user e3ac6b4d5b37 SELECT count() AS n FROM loom.conversations WHERE org = {org:String} AND namespace IN {ns:Array(String)} e437129a1eed SELECT path, lang, index_error, indexed_commit, created_at FROM loom.code_files FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND index_error != ? ORDER BY creat e43d0c378314 SELECT org, namespace, consumer, query AS pattern, path_prefix, count() AS calls FROM loom.code_search_trace WHERE ts > now() - INTERVAL {hours:UInt32} HOUR AND op = ? AND abstain = ? AND route IN (?, @@ -2041,6 +2045,7 @@ e60347067264 SELECT DISTINCT org, namespace, agent, user_id, session_id, memory_ e67a89c4f6c6 SELECT group_id, members FROM loom.principal_groups FINAL WHERE org = {org:String} AND NOT deleted e6990fcc8c82 SELECT thread_id, msg_id, role, content_excerpt AS embedded_text, ts, cosineDistance(embedding, {q:Array(Float32)}) AS distance FROM loom.conversation_embeddings FINAL WHERE org = {org:String} AND nam e6f6f6bc74e2 SELECT count() AS n FROM loom.memory_chunks FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND namespace IN {ns:Array(String)} +e7331ee31d1b SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user e747c3134919 ALTER TABLE loom.memory_record_fields UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND record_id IN {ids:Array(UUID)}) AND ({erasure_mutation_tag:String} = e75f4a024984 SELECT count() AS n FROM loom.derived_facts WHERE org = {org:String} AND namespace = {ns:String} AND ? e77afbb3fb28 SELECT count() AS n FROM loom.chunks WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND doc_superseded_at IS NULL AND (org, namespace, embedding_model, source_uri, doc_version) NOT IN (S @@ -2058,7 +2063,6 @@ e95e0aaed16c SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e. e9b0e6383969 ALTER TABLE loom.knowledge_source_listings DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_ e9bc797f59c7 SELECT org, namespace, agent, user_id, session_id, memory_key, argMax(status, version) AS status, argMax(duplicate_of, version) AS duplicate_of, argMax(tombstoned_at IS NULL, version) AS live, argMax( e9dddc21ebf5 SELECT count() AS n FROM loom.entity_triple_memories WHERE org = {org:String} AND namespace = {ns:String} AND ? -e9edf7e6c9de SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user e9efca2433f5 SELECT mirror, namespace FROM loom.knowledge_mirrors FINAL WHERE org = {org:String} AND namespace IN {namespaces:Array(String)} ORDER BY mirror ea49543b4032 ALTER TABLE loom.learnings_queue DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? ea8e13fd604a SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist @@ -2070,7 +2074,6 @@ ead2332c233c SELECT count() AS n FROM loom.conversation_threads FINAL WHERE org eaee9f2c8348 SELECT sumIf(toUInt64OrZero(args[?]), mirror_marked = ?) AS cache_hits, sumIf(toFloat64OrZero(args[?]), mirror_marked = ?) AS cache_saved_usd FROM (SELECT ts, org, namespace, agent, user_id, session_i eafd4ba9f362 ALTER TABLE loom.memory UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag eb2a9ef8d52f SELECT org FROM loom.org_model_calls FINAL WHERE enabled = ? -eb3a8a768cd2 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user eb3c62272b82 SELECT pr_number, toString(merge_commit_sha) AS sha FROM loom.code_pr_history FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND ({below:UInt32} = ? OR pr_number eb430aeb667b SELECT org, namespace, agent, user_id, thread_id, msg_id, role, content, reasoning, metadata, tokens, run_id, ts, is_saved, saved_at, tombstoned_at, length(content) + length(reasoning) + length(metada eb49c309cbd8 SELECT org, namespace, agent, user_id, thread_id, title, metadata, run_id, created_at, updated_at, tombstoned_at FROM loom.conversation_threads FINAL WHERE org = {org:String} AND user_id = {scope:Stri @@ -2078,14 +2081,15 @@ eb6d8b657224 ALTER TABLE loom.entity_degree DELETE WHERE (org = {org:String} AND ebda0f2e731d SELECT number, title FROM loom.code_gh_items FINAL WHERE org = {org:String} AND namespace = {ns:String} AND number IN {nums:Array(UInt32)} AND tombstoned_at IS NULL ebf804c151c9 SELECT * FROM loom.scim_users FINAL WHERE deleted = ? AND has(work_addresses, {a:String}) ORDER BY user_name LIMIT {count:UInt32} OFFSET {skip:UInt32} ebfbbf224b6e SELECT agent, user_id, session_id, memory_key, version_now, tombstoned_now, version_at FROM ( SELECT agent, user_id, session_id, memory_key, version AS version_now, toUInt8(tombstoned_at IS NOT NULL) -ec01efdbb47a SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER ec18664b705f SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, if(length(toString(value_json)) > ?, toString(value_json), value) AS value, -- The stored bytes, for version rows +ec411682b641 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user ec4e02f089ad SELECT pr_number, any(title) AS pr_title, any(merge_commit_sha) AS merge_sha, min(merged_at) AS merged FROM loom.code_pr_history FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombston ec567ce8ec8a SELECT count() AS n FROM loom.datasets WHERE org = {org:String} AND namespace = {ns:String} AND ? ec8349287ea0 SELECT sum(upstream_cost_usd) AS spent, countDistinct(namespace) AS ns_count FROM (SELECT ts, org, namespace, agent, user_id, session_id, run_id, operation, request_id, trace_id, memory_key, impersona ecad23572860 SELECT count() AS n FROM loom.entity_triple_rows WHERE org = {org:String} AND namespace = {ns:String} ecbcf4ca3679 SELECT ts, event_type, org, namespace, actor, subject, request_id, row_hash FROM loom.audit_log WHERE org = {org:String} AND namespace IN {ns_list:Array(String)} ORDER BY ts DESC, request_id DESC, row ed30af4d157c SELECT term, df, avgdl FROM loom.code_term_df WHERE org = {org:String} AND namespace = {ns:String} AND term IN {terms:Array(String)} +ed3dcc0014f8 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user ed4fa5b45c9d WITH (SELECT (toFloat64(count()), sumMap(arrayFilter(s -> has({stems:Array(String)}, s), arrayDistinct(arrayMap( t -> stem(t, ?), splitByChar(?, translate(lower(memory_key), ?, ?))))) AS ks, arrayResi ed5e89f5c5cf SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist ed7542958aa8 SELECT count() AS n FROM loom.entity_edge_memories WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? @@ -2105,6 +2109,7 @@ ef8cb8bc2b6e SELECT count() AS n FROM loom.entity_summaries FINAL WHERE org = {o ef96a51ef6af SELECT jti, issued_before, version FROM loom.revoked_tokens FINAL WHERE expires_at > now() UNION ALL SELECT id AS jti, NULL AS issued_before, toUInt64(?) AS version FROM loom.oauth_state FINAL WHERE r efa2b6714b3e SELECT count() AS n FROM loom.memory_exposures WHERE org = {org:String} AND namespace IN {ns:Array(String)} efa6167981bc SELECT agent, user_id, session_id, memory_key, memory_type, content_excerpt, toString(created_at) AS created_at, toString(valid_at) AS valid_at, version FROM loom.memory_embeddings FINAL WHERE org = { +efc26291c06f SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user efc70e07070c SELECT memory_key, memory_type, content_excerpt, ? - cosineDistance(embedding, {qv:Array(Float32)}) AS similarity, toString(coalesce(temporal_anchor, toDateTime(?))) AS temporal_anchor, temporal_confi efe2ebe9cea3 SELECT org, namespace, agent, user_id, session_id, queue_id, payload, message_count, content_chars, status, attempts, lease_until, last_error, written, enqueued_at, updated_at, version, enqueued_by FR f0269d04cc56 SELECT count() AS n FROM loom.memory_projection_failures WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? @@ -2112,8 +2117,10 @@ f06c74498575 SELECT tag, count() AS rows FROM (SELECT arrayJoin(tags) AS tag FRO f072c6c29b23 SELECT memory_type, toString(status) AS status, source_class, count() AS rows, min(updated_at) AS first_at, max(updated_at) AS last_at FROM loom.memory FINAL WHERE org = {org:String} AND namespace = { f08249ee1acf SELECT kind, name, status, description, cardinality, created_by, updated_at FROM loom.namespace_ontology FINAL WHERE org = {org:String} AND namespace = {ns:String} AND kind = {kind:String} AND status f0c46bd2964b SELECT org, toString(memory_id) AS memory_id, namespace, agent, user_id, session_id, memory_key, version, content_sha256, tags FROM ( SELECT org, memory_id, namespace, agent, user_id, session_id, memo +f0d1a655888a SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER f0e13f039554 ALTER TABLE loom.knowledge_source_listings DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? f0f965973223 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g +f106a32ca75c SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user f11d60301350 SELECT count() AS n FROM loom.code_answers WHERE org = {org:String} AND memory_namespace = {ns:String} AND (answer != ? OR citations != ?) AND ? f14fa202dddc SELECT count() AS n FROM loom.code_chunks WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? f1a48bd7f91b ALTER TABLE loom.datasets DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? @@ -2135,6 +2142,7 @@ f3369b63ff2f ALTER TABLE loom.consolidation_runs DELETE WHERE (org = {org:String f343363836cf SELECT count() AS n FROM loom.conflict_allowlist FINAL WHERE org = {org:String} AND namespace = {ns:String} f348283abeae SELECT * EXCEPT (embedding) FROM loom.code_chunks FINAL WHERE (org, namespace, embedding_model, path, chunk_id) IN {keys:Array(Tuple(String, String, String, String, UUID))} AND embedding_dim = ? AND t f36a74131100 SELECT uniqExact(embedding_model, chunk_idx) AS chunk_count FROM loom.chunks WHERE org = {org:String} AND namespace = {ns:String} AND source_uri = {uri:String} AND JSONExtractUInt(chunk_metadata, ?) = +f38dc7d9c2fc SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER f39c3befadc3 WITH (SELECT (toFloat64(count()), sumMap(arrayFilter(s -> has({stems:Array(String)}, s), arrayDistinct(arrayMap( t -> stem(t, ?), splitByChar(?, translate(lower(memory_key), ?, ?))))) AS ks, arrayResi f3a3885da999 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g f3bd7999e18e SELECT tag, count() AS rows FROM (SELECT arrayJoin(tags) AS tag FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND session_id = {id:String} AND u @@ -2148,11 +2156,9 @@ f4249afc51bd SELECT toString(memory_id) AS memory_id, org, namespace, agent, use f426fd45f2ab SELECT subject FROM loom.audit_log WHERE org = ? AND namespace = ? AND event_type = {et:String} AND ts >= toDateTime64(now() - INTERVAL {s:UInt32} SECOND, ?, ?) f428423c6236 SELECT path, scope, symbol_ids, start_line, end_line, content FROM ( SELECT path, scope, symbol_ids, start_line, end_line, content, chunk_id, tombstoned_at FROM loom.code_chunks WHERE org = {org:Strin f44dcb1cb8df ALTER TABLE loom.documents UPDATE superseded_at = {now:DateTime} WHERE (org = {org:String} AND namespace IN {ns:Array(String)} AND superseded_at IS NULL) AND ({erasure_mutation_tag:String} = {erasure_ -f45136da88f9 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER f4a4dc94c981 SELECT count() AS n FROM loom.memory_extraction_queue FINAL WHERE org = {org:String} AND namespace = {ns:String} f4a7b1b62a06 ALTER TABLE loom.conversation_threads DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync f4cf9d7c7d76 SELECT memory_key, toString(memory_id) AS id, version, memory_type, toString(status) AS status, source_class, agent, user_id, session_id, actor, updated_at, sensitivity, org, namespace, redacted_at FR -f4d7a157aa99 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user f4e0b9f1ec2c SELECT path, count() AS chunks, min(start_line) AS first_line, count() OVER () AS total FROM ( SELECT path, start_line, tombstoned_at FROM loom.code_chunks WHERE org = {org:String} AND namespace = {ns f4e0e618ad7d SELECT count() AS n FROM loom.memory_extraction_queue FINAL WHERE org = {org:String} AND namespace = {ns:String} AND status IN {waiting:Array(String)} AND agent = {agent:String} AND user_id = {uid:Str f516a9cc81d3 SELECT * FROM loom.entity_vectors FINAL WHERE org = {org:String} AND namespace = {ns:String} AND memory_key IN {keys:Array(String)} AND tombstoned_at IS NULL @@ -2162,6 +2168,7 @@ f52e30d82733 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e. f5622add735c SELECT session_id, summary_text, length(key_facts) AS kf, length(derived_from) AS df, coalesce(valid_at, created_at) AS d FROM loom.session_summaries FINAL WHERE org = {o:String} AND namespace = {n:St f5976b529f94 SELECT path, scope, symbol_ids, start_line, end_line, content, shingles, uniqExact(path) OVER () AS admitted_files FROM ( SELECT path, scope, symbol_ids, start_line, end_line, content, chunk_id, array f5ddaf977ab5 SELECT state_key, state_value AS value FROM loom.code_index_state FINAL WHERE org = {org:String} AND namespace = {ns:String} AND state_key IN {keys:Array(String)} +f60a04215196 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user f617d9867707 SELECT count() AS n FROM loom.memory_code_links WHERE org = {org:String} AND namespace IN {ns:Array(String)} f646cb42e8e3 ALTER TABLE loom.derived_facts DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? f65fc198c24d ALTER TABLE loom.memory_record_conflicts UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:Strin @@ -2175,7 +2182,6 @@ f6e57db3ddca SELECT org, namespace, name, source_id, provider, generation, finge f6e8ef149574 INSERT INTO loom.chunk_supersessions (org, namespace, embedding_model, source_uri, doc_version, superseded_at) SELECT DISTINCT org, namespace, embedding_model, source_uri, doc_version, {when:DateTime} f703eaf640ff SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist f70eb483657a SELECT agent, user_id, session_id, memory_key, embedding FROM loom.memory_embeddings FINAL PREWHERE org = {org:String} AND namespace = {ns:String} AND embedding_model = {model:String} AND (agent, user -f724749a6216 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user f72c5a682989 SELECT toString(evidence_id) AS eid, session_id, role, actor, toString(observed_at) AS observed, content, matched FROM ( SELECT evidence_id, session_id, role, actor, observed_at, content, tombstoned_a f7453051daff SELECT org, name, sa_subject, created_by, created_at, lineage, revoked_at IS NULL AS live FROM loom.service_accounts FINAL WHERE (created_by IN {subs:Array(String)} OR hasAny(lineage, {subs:Array(Stri f749b37e03cc SELECT org, qa_namespace AS namespace FROM loom.qa_test_daily WHERE org IN {orgs:Array(String)} AND qa_namespace IN {namespaces:Array(String)} GROUP BY org, namespace @@ -2185,8 +2191,10 @@ f7a4c34b39d8 SELECT count() AS n FROM loom.entity_triples WHERE org = {org:Strin f7ba11c1dbcc SELECT count() AS n FROM loom.memory_belief_sources FINAL WHERE org = {org:String} AND (namespace, memory_key) IN (SELECT namespace, memory_key FROM loom.memory WHERE org = {org:String} AND user_id = f7bfa7426c75 SELECT count() AS n FROM loom.entity_summaries FINAL WHERE org = {org:String} AND tombstoned_at IS NULL AND user_id = {uid:String} f7c04f2fe996 SELECT count() AS n FROM loom.document_blobs WHERE org = {org:String} AND namespace IN {ns:Array(String)} AND ? +f8081de4841b SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user f833c025305d SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g f83401bb2bae SELECT * FROM loom.service_accounts FINAL WHERE org = {org:String} AND name = {name:String} AND (created_by IN {subs:Array(String)} OR hasAny(lineage, {subs:Array(String)})) AND revoked_at IS NULL AND +f8544e732b91 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user f86ba4e3e00f SELECT conflict_threshold, duplicate_threshold, default_conflict_policy FROM loom.namespaces FINAL WHERE org = {org:String} AND namespace = {ns:String} LIMIT ? f86df7b89de1 SELECT chunk_id, path, cosineDistance(embedding, {q:Array(Float32)}) AS distance FROM loom.code_chunks FINAL WHERE org = {org:String} AND namespace = {ns:String} AND embedding_model = {model:String} A f8a8c065cbe1 SELECT path, scope, symbol_ids, start_line, end_line, content FROM ( SELECT path, scope, symbol_ids, start_line, end_line, content, chunk_id, tombstoned_at FROM loom.code_chunks WHERE org = {org:Strin @@ -2206,6 +2214,7 @@ fa2feed872ed SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e. fa42f3c303c9 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, cosineDistance(e.embedding, {q:Array(Float32)}) AS dist faa46c762ea5 SELECT org, namespace, edges FROM ( SELECT g.org AS org, g.namespace AS namespace, g.edges AS edges FROM ( SELECT org, namespace, count() AS edges FROM loom.entity_edges GROUP BY org, namespace ) AS g fadae2c61913 DELETE FROM loom.conversations WHERE org = {org:String} AND namespace = {ns:String} AND agent = {agent:String} AND thread_id = {tid:String} AND msg_id = {mid:String} AND tombstoned_at IS NULL AND is_s +faf71d48ebd2 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user fb620293a3f5 SELECT version, pinned, lock_mode, lock_until, sensitivity, tags FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND user_id = {uid:String} AND agent = ? AND session_id = ? fb7fc150938f SELECT namespace, thread_id, ts, msg_id, row_bytes, bytes_before FROM ( SELECT namespace, thread_id, ts, msg_id, row_bytes, sum(row_bytes) OVER (ORDER BY namespace, thread_id, ts, msg_id ROWS BETWEEN fb8a291d93a5 SELECT e.memory_key AS memory_key, e.memory_type AS memory_type, e.content_excerpt AS content_excerpt, e.status AS status, e.version AS version, -- Multi-vector axis: min(value_dist, key_dist). CH?t g @@ -2215,20 +2224,20 @@ fbd1ef24012c SELECT count() AS n FROM loom.tasks WHERE org = {org:String} AND na fc00cc1815db SELECT namespace, countIf(status=?) AS pending, countIf(status=?) AS promoted, countIf(status=?) AS rejected, if(countIf(status IN (?,?)) > ?, countIf(status=?) / countIf(status IN (?,?)), ?) AS appro fc0e3b7e1c36 SELECT agent, count() AS rows, count() OVER () AS total FROM loom.memory FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL AND user_id = {scope_uid:String} GROUP BY fc162bd6bbf5 SELECT * FROM loom.code_symbols FINAL WHERE org = {org:String} AND namespace = {ns:String} AND lower(name) LIKE {like:String} AND positionCaseInsensitive(name, {needle:String}) > ? AND tombstoned_at I -fc32d25c72ea SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user fc33b8a8753c ALTER TABLE loom.conversation_embeddings UPDATE tombstoned_at = {now:DateTime} WHERE (org = {org:String} AND tombstoned_at IS NULL AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:Strin fc3695edeeb2 SELECT toString(embedding_model) AS model, count() AS live, countIf(embedding_dim > ?) AS embedded FROM loom.chunks WHERE org = {org:String} AND namespace = {ns:String} AND doc_superseded_at IS NULL A fc3dedc0112f SELECT count() AS n FROM loom.learnings_queue WHERE org = {org:String} AND source_kind = ? AND proposed_value != ? AND candidate_id NOT IN (SELECT candidate_id FROM loom.learnings_supporters WHERE org fc4aa7b41b6f ALTER TABLE loom.dataset_rows DELETE WHERE (org = {org:String} AND user_id = {uid:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? +fc6c8b0fd1c4 SELECT c.session_id AS session_id, c.chunk_index AS chunk_index, c.parent_memory_key AS parent_memory_key, cosineDistance(c.embedding, {q:Array(Float32)}) AS distance FROM loom.memory_chunks AS c WHER fc810db578e0 SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, if(length(toString(value_json)) > ?, toString(value_json), value) AS value, -- The stored bytes, for version rows fc8917f4e0b5 SELECT count() AS n FROM loom.memory_embeddings FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NULL fcb2b681c3cc SELECT pr_number, title, author, files, merged_at, linked_issues, arraySum( arrayMap( (tok, idf) -> idf * countSubstrings(concat(?, lexemes, ?), concat(?, tok, ?)), {tokens:Array(String)}, {idfs:Array -fce198350da2 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user fcf47e494773 SELECT count() AS n FROM loom.knowledge_group_members WHERE org = {org:String} AND namespace IN {ns:Array(String)} fd4b9de98c6f SELECT count() AS live_docs, countIf(ifNull(c.live, ?) = ?) AS without_chunks, groupArrayIf(?)(d.source_uri, ifNull(c.live, ?) = ?) AS without_chunks_uris, countIf(ifNull(c.live, ?) = ? AND d.ingestio fd68c20c1c4c SELECT content_sha256, count() AS doc_count, groupArray(?)((doc_id, source_uri, title, ingested_at)) AS docs FROM loom.documents FINAL WHERE org = {org:String} AND namespace = {ns:String} AND supersed fd6f4e8d47c8 SELECT path, scope, symbol_ids, start_line, end_line, content, shingles, uniqExact(path) OVER () AS admitted_files FROM ( SELECT path, scope, symbol_ids, start_line, end_line, content, chunk_id, array fd8bd0425be6 INSERT INTO loom.knowledge_ingest_cancels (org, namespace, ingestion_id, requested_at) SELECT org, namespace, ingestion_id, requested_at FROM loom.knowledge_ingest_cancels WHERE org = {org:String} AND +fd94b00f3b5d SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user fd95e7268232 ALTER TABLE loom.events DELETE WHERE (org = {org:String} AND namespace IN {ns:Array(String)}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? fdceada98fca SELECT count() AS n FROM loom.procedure_runs WHERE org = {org:String} AND namespace = {ns:String} AND memory_key = {key:String} fdd8cdfb2f2c SELECT org, namespace, agent, user_id, session_id, name, source_id, host, port, secure, user, password_enc, cluster, databases, actor, source_class, created_at, tombstoned_at, version FROM loom.query_ @@ -2243,7 +2252,6 @@ fed00127661d SELECT org, namespace, agent, user_id, thread_id, msg_id, role, con fef350e42e77 ALTER TABLE loom.learnings_queue DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? ff00b5b19dc0 SELECT count() AS n, max(tombstoned_at) AS gone FROM loom.conversations WHERE org = {org:String} AND namespace = {ns:String} AND agent = {agent:String} AND thread_id = {tid:String} AND msg_id = {mid:S ff23e7932268 ALTER TABLE loom.working_memory DELETE WHERE (org = {org:String} AND namespace = {ns:String}) AND ({erasure_mutation_tag:String} = {erasure_mutation_tag:String}) SETTINGS mutations_sync = ? -ff3644c517f4 SELECT concat(?, toString(c.session_id), ?, toString(c.chunk_index)) AS memory_key, ? AS memory_type, substring(c.content, ?, ?) AS content_excerpt, c.content AS content_full, c.agent AS agent, c.user ff8211fc1da3 SELECT memory_id, org, namespace, agent, user_id, session_id, memory_key, memory_type, if(length(toString(value_json)) > ?, toString(value_json), value) AS value, -- The stored bytes, for version rows ffa5c94364aa SELECT DISTINCT namespace FROM ( SELECT namespace FROM loom.memory WHERE org = {org:String} AND (namespace, agent, user_id, session_id, memory_key) IN ( SELECT namespace, agent, user_id, session_id, m ffa9b9e1eddc SELECT c.category_id AS category_id, count() AS rows FROM (SELECT memory_key, category_id FROM loom.memory_categories FINAL WHERE org = {org:String} AND namespace = {ns:String} AND tombstoned_at IS NU diff --git a/tests/integration/test_chunk_parent_status.py b/tests/integration/test_chunk_parent_status.py new file mode 100644 index 0000000000..4bd265eb8d --- /dev/null +++ b/tests/integration/test_chunk_parent_status.py @@ -0,0 +1,210 @@ +"""Known-parent status filters exclude retired text beside live and session-only chunks.""" + +from __future__ import annotations + +import hashlib +import uuid +from datetime import datetime + +import pytest + +from server.memory.app.retrieval.chunks import _chunk_parent_pred +from tests.integration._resources import unique_org +from tests.unit.test_memory_search_service import _q + +ORG = unique_org("chunk-parent-status") +_BASE = {"active", "conflicted", "session-only", "point-write"} +_VECTOR = [1.0] + [0.0] * 3071 + + +def _parent(ch, ns, key, status, *, user="reader", session="session", invalid_at=None): + columns = [ + "org", + "namespace", + "agent", + "user_id", + "session_id", + "memory_key", + "memory_type", + "value", + "status", + "created_at", + "invalid_at", + ] + ch.insert( + "loom.memory", + [ + [ + ORG, + ns, + "writer", + user, + session, + key, + "semantic", + '"parent text"', + status, + datetime(2020, 1, 1), + invalid_at, + ] + ], + column_names=columns, + ) + + +def _chunk(ch, ns, key, index, *, user="reader", session="session", content=None): + content = content or key + columns = [ + "org", + "namespace", + "agent", + "user_id", + "session_id", + "chunk_index", + "content_sha256", + "content", + "parent_memory_key", + "embedding_model", + "embedding_dim", + "embedding", + ] + ch.insert( + "loom.memory_chunks", + [ + [ + ORG, + ns, + "writer", + user, + session, + index, + hashlib.sha256(content.encode()).hexdigest(), + content, + key, + "fixture-model", + len(_VECTOR), + _VECTOR, + ] + ], + column_names=columns, + ) + + +def _read(ch, ns, **options): + q = _q(org=ORG, namespace=ns, agent="*", **options) + params = {"org": ORG, "ns": ns} + pred = _chunk_parent_pred(q, params) + return { + r[0] + for r in ch.query( + "SELECT c.content FROM loom.memory_chunks AS c FINAL " + "WHERE c.org = {org:String} AND c.namespace = {ns:String} " + pred, + parameters=params, + ).result_rows + } + + +@pytest.fixture +def parents(ch_client): + ns = "parents-" + uuid.uuid4().hex + for index, status in enumerate( + ["active", "conflicted", "rejected", "superseded", "duplicate", "proposed", "tombstoned"] + ): + _parent(ch_client, ns, status, status) + _chunk(ch_client, ns, status, index) + ch_client.insert( + "loom.memory_embeddings", + [ + [ + ORG, + ns, + "writer", + "reader", + "session", + status, + "semantic", + "private", + "parent text", + "fixture-model", + status, + ["topic"], + len(_VECTOR), + _VECTOR, + len(_VECTOR), + _VECTOR, + ] + ], + column_names=[ + "org", + "namespace", + "agent", + "user_id", + "session_id", + "memory_key", + "memory_type", + "scope", + "content_excerpt", + "embedding_model", + "status", + "tags", + "embedding_dim", + "embedding", + "memory_key_embedding_dim", + "memory_key_embedding", + ], + ) + _chunk(ch_client, ns, "no-extracted-parent", 8, content="session-only") + _chunk(ch_client, ns, "rejected", 0, session="memory.set:rejected", content="point-write") + # Another identity's row cannot hide a live passage or revive rejected text. + _parent(ch_client, ns, "active", "rejected", user="other-reader") + _parent(ch_client, ns, "conflicted", "rejected", session="other-session") + _parent(ch_client, ns, "rejected", "active", user="other-reader") + return ns + + +def test_default_parent_status_keeps_populated_neighbours_and_session_evidence(ch_client, parents): + assert _read(ch_client, parents) == _BASE + + +@pytest.mark.parametrize( + "flag,status", + [ + ("include_proposed", "proposed"), + ("include_duplicates", "duplicate"), + ("include_superseded", "superseded"), + ], +) +def test_parent_status_opt_in_is_specific_to_the_requested_state(ch_client, parents, flag, status): + assert _read(ch_client, parents, **{flag: True}) == _BASE | {status} + + +def test_hard_tags_require_a_matching_parent_and_still_exclude_retired_text(ch_client, parents): + assert _read(ch_client, parents, tags=["topic"]) == {"active", "conflicted"} + + +def test_knowledge_time_keeps_only_parents_that_were_served_at_the_anchor(ch_client): + ns = "history-" + uuid.uuid4().hex + for index, (key, retirement) in enumerate( + [ + ("retired-after", datetime(2020, 1, 3)), + ("retired-before", datetime(2020, 1, 1, 12)), + ] + ): + _parent(ch_client, ns, key, "superseded", invalid_at=retirement) + _chunk(ch_client, ns, key, index) + _parent(ch_client, ns, "active", "active") + _chunk(ch_client, ns, "active", 2) + assert _read(ch_client, ns) == {"active"} + assert _read(ch_client, ns, as_of=datetime(2020, 1, 2), as_of_basis="knowledge_time") == { + "active", + "retired-after", + } + + +@pytest.mark.parametrize("user,session", [("", "session"), ("reader", ""), ("", "")]) +def test_explicit_blank_parent_identity_still_excludes_rejected_text(ch_client, user, session): + ns = "blank-parent-" + uuid.uuid4().hex + for index, status in enumerate(["active", "rejected"]): + _parent(ch_client, ns, status, status, user=user, session=session) + _chunk(ch_client, ns, status, index, user=user or "-", session=session or "-") + assert _read(ch_client, ns) == {"active"} diff --git a/tests/unit/test_chunk_leg_filters.py b/tests/unit/test_chunk_leg_filters.py index 7960d82cb4..6152cb3fab 100644 --- a/tests/unit/test_chunk_leg_filters.py +++ b/tests/unit/test_chunk_leg_filters.py @@ -1,10 +1,8 @@ """A chunk hit obeys the read's filters. -`memory_chunks` carries no tags, `valid_at` or `status`; the fact leg's hard -tag filter, `as_of` anchor and served-status set reach the chunk leg through -the parent row in `memory_embeddings`, with the fact leg's own predicate -helpers and parameter names. Both stages carry the predicate. Without a -filter the leg is unchanged. +The canonical memory parent supplies the served-status and time gate. Hard +tags additionally require a matching `memory_embeddings` parent. Both stages +and neighbour windows share the predicates; session-only chunks remain eligible. """ from __future__ import annotations @@ -17,7 +15,12 @@ from tests.unit.test_memory_search_service import StubCH, _q _PARENT_IN = "c.parent_memory_key IN (SELECT memory_key FROM loom.memory_embeddings FINAL" -_PARENT_NOT_IN = "c.parent_memory_key NOT IN (SELECT memory_key FROM loom.memory_embeddings FINAL" +_PARENT_NOT_IN = ( + "(c.agent, if(c.user_id = '', '-', c.user_id), " + "if(c.session_id = '', '-', c.session_id), c.parent_memory_key) NOT IN " + "(SELECT agent, if(user_id = '', '-', user_id), " + "if(session_id = '', '-', session_id), memory_key FROM loom.memory FINAL" +) def _cands(*pairs: tuple[str, int]) -> list[dict[str, Any]]: @@ -38,18 +41,24 @@ async def _both_stages(q) -> tuple[tuple[str, dict], tuple[str, dict]]: return ch.query_all_calls[0], ch.query_all_calls[1] -def test_no_filter_leaves_the_leg_unchanged() -> None: +def test_default_read_excludes_nonserved_known_parents_without_dropping_orphans() -> None: from server.memory.app.retrieval.chunks import _chunk_parent_pred params: dict[str, Any] = {} - assert _chunk_parent_pred(_q(), params) == "" and params == {} + pred = _chunk_parent_pred(_q(), params) + assert _PARENT_NOT_IN in pred + assert "NOT (tombstoned_at IS NULL AND status IN ('active', 'conflicted'))" in pred + assert "WHERE org = {org:String} AND namespace = {ns:String}" in pred + assert _PARENT_IN not in pred # A session without a memory parent is still evidence. def test_soft_tags_are_a_boost_not_a_gate() -> None: from server.memory.app.retrieval.chunks import _chunk_parent_pred params: dict[str, Any] = {} - assert _chunk_parent_pred(_q(tags=["workflow:w"], tags_soft=True), params) == "" + pred = _chunk_parent_pred(_q(tags=["workflow:w"], tags_soft=True), params) + assert _PARENT_NOT_IN in pred + assert "hasAny(tags" not in pred @pytest.mark.asyncio @@ -154,3 +163,37 @@ def test_the_neighbour_fallback_binds_every_parameter_its_predicate_names( named = set(re.findall(r"\{(\w+):", sql)) assert named <= set(bound), named - set(bound) assert "chunk_limit" not in bound + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "flag,status", + [ + ("include_duplicates", "duplicate"), + ("include_superseded", "superseded"), + ("include_proposed", "proposed"), + ], +) +async def test_default_parent_status_gate_respects_explicit_include_flags(flag, status) -> None: + for enabled in (False, True): + (sql1, _), (sql2, _) = await _both_stages(_q(**{flag: enabled})) + for sql in (sql1, sql2): + assert _PARENT_NOT_IN in sql + assert (f"'{status}'" in sql) is enabled + + +@pytest.mark.asyncio +async def test_hard_tag_lookup_cannot_replace_the_known_parents_status_gate() -> None: + (sql1, _), (sql2, _) = await _both_stages(_q(tags=["topic"])) + for sql in (sql1, sql2): + assert _PARENT_NOT_IN in sql + assert _PARENT_IN in sql + + +def test_knowledge_time_replays_retirement_and_deletion_of_the_known_parent() -> None: + from server.memory.app.retrieval.chunks import _chunk_parent_pred + + pred = _chunk_parent_pred(_q(as_of=datetime(2020, 1, 1), as_of_basis="knowledge_time"), {}) + assert _PARENT_NOT_IN in pred + assert "invalid_at > {as_of:DateTime}" in pred + assert "tombstoned_at > {as_of:DateTime}" in pred diff --git a/tests/unit/test_chunk_parent_identity.py b/tests/unit/test_chunk_parent_identity.py new file mode 100644 index 0000000000..6acff7aa7a --- /dev/null +++ b/tests/unit/test_chunk_parent_identity.py @@ -0,0 +1,54 @@ +"""Anonymous identity spellings bind projections to their parent and keep readable keys.""" + +from types import SimpleNamespace +from unittest.mock import AsyncMock + +import pytest + +from server.memory.app import chunk_projection + + +async def _project(monkeypatch, user, session): + ch = SimpleNamespace(insert=AsyncMock()) + + async def embedded(text, ranges, chunks, embed): + return [SimpleNamespace(written=True, vector=[1.0, 0.0]) for _ in chunks] + + monkeypatch.setattr("server.core.ch.get_client", lambda: ch) + monkeypatch.setattr("server.embedding.get_embedder", lambda: SimpleNamespace(model_name="fake")) + monkeypatch.setattr(chunk_projection, "embed_chunks_of", embedded) + parent = SimpleNamespace(org="o", namespace="n", agent="a", user_id=user, session_id=session) + await chunk_projection.write_memory_chunks( + parent, + [{"role": "user", "content": "A conversation passage linked to a durable parent memory."}], + parent_memory_keys=["parent"], + ) + call = next(c for c in ch.insert.call_args_list if c.args[0] == "loom.memory_chunks") + assert call.args[1] + return call.args[1] + + +@pytest.mark.parametrize("user,session", [("", "s"), ("u", "s"), ("", "-"), ("-", "-")]) +async def test_chunk_projection_keeps_explicit_sessions(monkeypatch, user, session): + rows = await _project(monkeypatch, user, session) + assert {(r["agent"], r["user_id"], r["session_id"], r["parent_memory_key"]) for r in rows} == { + ("a", user or "-", session, "parent") + } + + +@pytest.mark.parametrize("second_user", ["first", "second"]) +async def test_blank_sessions_keep_distinct_readable_chunk_identities(monkeypatch, second_user): + from uuid import UUID + + from server.memory.app.handlers import split_chunk_key + from server.memory.app.retrieval.chunks import _chunk_anchor_keys + + first = (await _project(monkeypatch, "first", ""))[0] + second = (await _project(monkeypatch, second_user, ""))[0] + sessions = [first["session_id"], second["session_id"]] + assert len(set(sessions)) == 2 + for row in [first, second]: + sid = row["session_id"] + assert UUID(sid).hex == sid + assert split_chunk_key(f"chunk:{sid}:{row['chunk_index']}") == (sid, row["chunk_index"]) + assert _chunk_anchor_keys([row]) == [(sid, row["chunk_index"])] diff --git a/tests/unit/test_chunk_two_stage.py b/tests/unit/test_chunk_two_stage.py index cfe735f00a..0a9336c333 100644 --- a/tests/unit/test_chunk_two_stage.py +++ b/tests/unit/test_chunk_two_stage.py @@ -62,7 +62,10 @@ async def test_stage_two_is_a_pk_lookup_under_final_over_the_candidates() -> Non assert len(ch.query_all_calls) == 2 sql1, p1 = ch.query_all_calls[0] sql2, p2 = ch.query_all_calls[1] - assert " FINAL" not in sql1 and "FROM loom.memory_chunks AS c FINAL" in sql2 + # Parent heads need FINAL; only the vector candidate table must avoid it. + assert "FROM loom.memory_chunks AS c FINAL" not in sql1 + assert "FROM loom.memory_chunks AS c FINAL" in sql2 + assert "FROM loom.memory FINAL" in sql1 assert ( "(c.session_id, c.chunk_index) IN arrayZip({cand_sess:Array(String)}, {cand_idx:Array(UInt32)})" in sql2 @@ -219,7 +222,7 @@ async def test_neighbor_window_predicates_are_table_qualified_and_deduped() -> N # the date joins are present and expose no bare session_id / memory_key assert ") AS ss ON ss.ss_session_id = c.session_id" in sql3 assert ") AS pd ON pd.pd_memory_key = c.parent_memory_key" in sql3 - assert "(session_id = " not in sql3 and " AND chunk_index BETWEEN" not in sql3 + assert "(session_id = {ns" not in sql3 and " AND chunk_index BETWEEN" not in sql3 # -------------------------------------------------------------------------- diff --git a/tests/unit/test_course_starter.py b/tests/unit/test_course_starter.py index 72e3347a9b..8a8383de95 100644 --- a/tests/unit/test_course_starter.py +++ b/tests/unit/test_course_starter.py @@ -50,9 +50,25 @@ def test_devcontainer_matches_the_root_one() -> None: } -def test_start_script_is_the_root_one() -> None: - root = ROOT / ".devcontainer" / "start-loom.sh" - assert (STARTER / ".devcontainer" / "start-loom.sh").read_bytes() == root.read_bytes() +@pytest.mark.parametrize( + "name", + [ + "start-loom.sh", + "agent-cli/package.json", + "agent-cli/package-lock.json", + "agent-cli/bind-native.cjs", + ], +) +def test_start_script_is_the_root_one(name: str) -> None: + root = ROOT / ".devcontainer" / name + assert (STARTER / ".devcontainer" / name).read_bytes() == root.read_bytes() + + +def test_copied_native_binding_helper_matches_the_installer() -> None: + helper = ROOT / "scripts" / "code-toolchains" / "bind-native.cjs" + assert ( + ROOT / ".devcontainer" / "agent-cli" / "bind-native.cjs" + ).read_bytes() == helper.read_bytes() def test_workflow_actions_are_pinned_to_commits() -> None: diff --git a/tests/unit/test_node_native_bindings.py b/tests/unit/test_node_native_bindings.py new file mode 100644 index 0000000000..7e47375066 --- /dev/null +++ b/tests/unit/test_node_native_bindings.py @@ -0,0 +1,210 @@ +"""Locked tooling never delegates a missing native package to an installer download.""" + +from __future__ import annotations + +import json +import os +import shlex +import shutil +import subprocess +from pathlib import Path + +import pytest + +ROOT = Path(__file__).resolve().parents[2] +HELPER = ROOT / "scripts/code-toolchains/bind-native.cjs" +HOST = {"platform": "linux", "arch": "x64", "musl": False} +CASES = { + "bun": ("bun", "@oven/bun-linux-x64-baseline", "bin/bun", ("bin/bun.exe", "bin/bunx.exe")), + "pnpm": ("pnpm", "@pnpm/exe.linux-x64", "pnpm", ("pnpm", "pn", "pnpx", "pnx")), + "claude": ( + "@anthropic-ai/claude-code", + "@anthropic-ai/claude-code-linux-x64", + "claude", + ("bin/claude.exe",), + ), +} +NATIVE = b"native binary from the locked optional package\n" +PLACEHOLDER = b"unbound placeholder\n" + + +def make_project(tmp_path: Path, tools: tuple[str, ...]) -> Path: + project = tmp_path / "project" + project.mkdir() + manifest: dict = {"dependencies": {}, "optionalDependencies": {}} + lock: dict = {"packages": {}} + for tool in tools: + wrapper, native, binary, targets = CASES[tool] + manifest["dependencies"][wrapper] = "1.2.3" + manifest["optionalDependencies"][native] = "1.2.3" + wrapper_dir = project / "node_modules" / wrapper + native_dir = project / "node_modules" / native + wrapper_dir.mkdir(parents=True) + native_dir.mkdir(parents=True) + (wrapper_dir / "package.json").write_text(json.dumps({"name": wrapper, "version": "1.2.3"})) + (native_dir / "package.json").write_text(json.dumps({"name": native, "version": "1.2.3"})) + source = native_dir / binary + source.parent.mkdir(parents=True, exist_ok=True) + source.write_bytes(NATIVE) + for target in targets: + dest = wrapper_dir / target + dest.parent.mkdir(parents=True, exist_ok=True) + dest.write_bytes(PLACEHOLDER) + lock["packages"][f"node_modules/{native}"] = { + "version": "1.2.3", + "integrity": "sha512-" + "A" * 86 + "==", + "resolved": f"https://registry.npmjs.org/{native}/-/native.tgz", + } + (project / "package.json").write_text(json.dumps(manifest)) + (project / "package-lock.json").write_text(json.dumps(lock)) + return project + + +def bind( + project: Path, + tools: tuple[str, ...], + tmp_path: Path, + host: dict[str, object] | None = None, +) -> subprocess.CompletedProcess[str]: + guard = tmp_path / "network-guard.cjs" + guard.write_text( + "const fs = require('node:fs');\n" + "function blocked() { fs.appendFileSync(process.env.BIND_LEAK_LOG, 'leak\\n'); throw Error('network or process launch'); }\n" + "globalThis.fetch = blocked;\n" + "for (const name of ['node:http', 'node:https']) { const api = require(name); api.get = api.request = blocked; }\n" + "const net = require('node:net'); net.connect = net.createConnection = blocked;\n" + "const cp = require('node:child_process');\n" + "for (const name of ['spawn', 'spawnSync', 'exec', 'execSync', 'execFile', 'execFileSync', 'fork']) cp[name] = blocked;\n" + ) + return subprocess.run( + [ + shutil.which("node") or "node", + "--require", + str(guard), + "-e", + "require(process.argv[1]).bindNative(process.argv[2], JSON.parse(process.argv[3]), JSON.parse(process.argv[4]));", + str(HELPER), + str(project), + json.dumps(tools), + json.dumps(HOST if host is None else host), + ], + env={**os.environ, "BIND_LEAK_LOG": str(tmp_path / "leaks")}, + capture_output=True, + text=True, + timeout=10, + ) + + +@pytest.mark.parametrize("tool", CASES) +def test_native_binding_uses_the_locked_optional_package(tmp_path: Path, tool: str) -> None: + project = make_project(tmp_path, (tool,)) + result = bind(project, (tool,), tmp_path) + assert result.returncode == 0, result.stderr + wrapper, _, _, targets = CASES[tool] + assert all( + (project / "node_modules" / wrapper / target).read_bytes() == NATIVE for target in targets + ) + assert not (tmp_path / "leaks").exists() + + +@pytest.mark.parametrize("tool", CASES) +@pytest.mark.parametrize("missing", ["package", "binary"]) +def test_missing_native_fails_without_a_download(tmp_path: Path, tool: str, missing: str) -> None: + project = make_project(tmp_path, (tool,)) + wrapper, native, binary, targets = CASES[tool] + native_dir = project / "node_modules" / native + if missing == "package": + shutil.rmtree(native_dir) + else: + (native_dir / binary).unlink() + result = bind(project, (tool,), tmp_path) + assert result.returncode != 0 + assert all( + (project / "node_modules" / wrapper / target).read_bytes() == PLACEHOLDER + for target in targets + ) + assert not (tmp_path / "leaks").exists() + + +def test_all_required_packages_are_checked_before_binding(tmp_path: Path) -> None: + project = make_project(tmp_path, ("bun", "pnpm")) + (project / "node_modules" / CASES["pnpm"][1] / "pnpm").unlink() + result = bind(project, ("bun", "pnpm"), tmp_path) + assert result.returncode != 0 + assert (project / "node_modules/bun/bin/bun.exe").read_bytes() == PLACEHOLDER + assert not (tmp_path / "leaks").exists() + + +def test_native_binary_cannot_escape_its_locked_package(tmp_path: Path) -> None: + project = make_project(tmp_path, ("bun",)) + source = project / "node_modules" / CASES["bun"][1] / "bin/bun" + source.unlink() + outside = tmp_path / "unlocked" + outside.write_bytes(NATIVE) + source.symlink_to(outside) + result = bind(project, ("bun",), tmp_path) + assert result.returncode != 0 + assert (project / "node_modules/bun/bin/bun.exe").read_bytes() == PLACEHOLDER + assert not (tmp_path / "leaks").exists() + + +def test_windows_package_manager_targets_native_executables(tmp_path: Path) -> None: + project = make_project(tmp_path, ("pnpm",)) + old_name = CASES["pnpm"][1] + native = "@pnpm/exe.win32-x64" + native_dir = project / "node_modules" / native + (project / "node_modules" / old_name).rename(native_dir) + (native_dir / "pnpm").rename(native_dir / "pnpm.exe") + (native_dir / "package.json").write_text(json.dumps({"name": native, "version": "1.2.3"})) + file = project / "package.json" + manifest = json.loads(file.read_text()) + manifest["optionalDependencies"] = {native: "1.2.3"} + file.write_text(json.dumps(manifest)) + file = project / "package-lock.json" + lock = json.loads(file.read_text()) + lock["packages"][f"node_modules/{native}"] = lock["packages"].pop(f"node_modules/{old_name}") + file.write_text(json.dumps(lock)) + result = bind(project, ("pnpm",), tmp_path, {"platform": "win32", "arch": "x64"}) + assert result.returncode == 0, result.stderr + wrapper = project / "node_modules/pnpm" + targets = {name: name + ".exe" for name in ("pnpm", "pn", "pnpx", "pnx")} + assert json.loads((wrapper / "package.json").read_text())["bin"] == targets + assert all((wrapper / target).read_bytes() == NATIVE for target in targets.values()) + assert not (tmp_path / "leaks").exists() + + +def test_the_leak_control_intercepts_a_nested_package_install(tmp_path: Path) -> None: + project = make_project(tmp_path, ("bun",)) + assert bind(project, ("bun",), tmp_path).returncode == 0 + result = subprocess.run( + [ + shutil.which("node") or "node", + "--require", + str(tmp_path / "network-guard.cjs"), + "-e", + "try { require('node:child_process').spawnSync('npm', ['install', 'unlocked']); } catch {}", + ], + env={**os.environ, "BIND_LEAK_LOG": str(tmp_path / "leaks")}, + capture_output=True, + timeout=10, + ) + assert result.returncode == 0 + assert (tmp_path / "leaks").read_text() == "leak\n" + + +def test_tool_projects_never_run_vendor_lifecycle_scripts() -> None: + paths = [ + "scripts/install-code-toolchains.sh", + ".devcontainer/start-loom.sh", + "examples/course-starter/.devcontainer/start-loom.sh", + ".github/workflows/plugin-platforms.yml", + ".github/workflows/n8n-publish.yml", + ] + for filename in paths: + commands = [ + shlex.split(line.strip()) + for line in (ROOT / filename).read_text().splitlines() + if line.strip().startswith("npm ci ") + ] + assert commands, filename + assert all("--ignore-scripts" in command for command in commands), filename diff --git a/tests/unit/test_release_preflight.py b/tests/unit/test_release_preflight.py index 6859d8ecea..b1b4a1e3eb 100644 --- a/tests/unit/test_release_preflight.py +++ b/tests/unit/test_release_preflight.py @@ -5,7 +5,9 @@ from __future__ import annotations +import json import os +import shlex import subprocess import sys from pathlib import Path @@ -621,3 +623,168 @@ def test_the_python_sdk_takes_the_tags_pep440_version( assert result.returncode == 0, result.stderr assert f'version = "{python_version}"' in (sdk / "pyproject.toml").read_text() assert (sdk / "loom" / "_version.py").read_text() == f'__version__ = "{python_version}"\n' + + +def _sdk_metadata_check( + tmp_path: Path, + *, + extras: tuple[str, ...] = ("first_extra",), + published_extras: tuple[str, ...] = ("first-extra",), + npm_change: tuple[str, object] | None = None, + requires_dist: tuple[str, ...] | None = None, +) -> tuple[subprocess.CompletedProcess[str], dict[str, str]]: + jobs = yaml.safe_load((ROOT / ".github/workflows/release-check.yml").read_text())["jobs"] + (step,) = [s for s in jobs["sdks"]["steps"] if s.get("id") == "sdk-metadata"] + sdk = tmp_path / "sdk/python" + sdk.mkdir(parents=True) + adapter = json.dumps(["AG2>=1.3,<1.4; python_version >= '3.11'"]) + (sdk / "pyproject.toml").write_text( + '[project]\nversion = "1.3.0"\ndependencies = ["httpx[http2]>=0.27"]\n' + "[project.optional-dependencies]\n" + "".join(f"{extra} = {adapter}\n" for extra in extras) + ) + dist = tmp_path / "clickhouse_loom-1.3.0rc2.dist-info" + dist.mkdir() + if requires_dist is None: + requires_dist = ("httpx[http2]>=0.27",) + tuple( + f'ag2<1.4,>=1.3; extra == "{extra.replace("_", "-")}" and python_version >= "3.11"' + for extra in extras + ) + (dist / "METADATA").write_text( + "Metadata-Version: 2.3\nName: clickhouse-loom\nVersion: 1.3.0rc2\n" + + "".join(f"Provides-Extra: {extra}\n" for extra in published_extras) + + "".join(f"Requires-Dist: {requirement}\n" for requirement in requires_dist) + ) + source = { + "version": "1.3.0", + "peerDependencies": {"@example/adapter": ">=1 <2"}, + "peerDependenciesMeta": {"@example/adapter": {"optional": True}}, + "exports": {".": "./dist/index.mjs"}, + "engines": {"node": ">=20"}, + } + source_path = tmp_path / "sdk/typescript/package.json" + source_path.parent.mkdir() + source_path.write_text(json.dumps(source)) + package = {**source, "version": "1.3.0-rc.2"} + if npm_change is not None: + package[npm_change[0]] = npm_change[1] + package_path = tmp_path / "runner/npm/node_modules/@clickhouse/loom/package.json" + package_path.parent.mkdir(parents=True) + package_path.write_text(json.dumps(package)) + for environment in ("sdk", "metadata-check"): + python = tmp_path / f"runner/{environment}/bin/python" + python.parent.mkdir(parents=True) + python.write_text(f'#!/bin/sh\nexec {shlex.quote(sys.executable)} "$@"\n') + python.chmod(0o755) + output = tmp_path / "outputs" + env = { + **os.environ, + "VERSION": "1.3.0-rc.2", + "GITHUB_WORKSPACE": str(tmp_path), + "RUNNER_TEMP": str(tmp_path / "runner"), + "GITHUB_OUTPUT": str(output), + } + result = subprocess.run( + ["bash", "-e", "-o", "pipefail", "-c", step["run"]], + cwd=tmp_path, + env=env, + capture_output=True, + text=True, + ) + outputs = ( + dict(line.split("=", 1) for line in output.read_text().splitlines()) + if output.exists() + else {} + ) + return result, outputs + + +@pytest.mark.parametrize( + ("published_extras", "npm_change"), + [ + ((), None), + (("first-extra", "unexpected"), None), + (("first-extra",), ("peerDependencies", {})), + (("first-extra",), ("peerDependenciesMeta", {"@example/adapter": {"optional": False}})), + (("first-extra",), ("exports", {})), + (("first-extra",), ("engines", {"node": ">=24"})), + ], + ids=[ + "missing extra", + "unexpected extra", + "missing peer", + "peer optionality", + "exports", + "engines", + ], +) +def test_release_sdk_inventory_rejects_published_metadata_mismatch( + tmp_path: Path, + published_extras: tuple[str, ...], + npm_change: tuple[str, object] | None, +) -> None: + result, outputs = _sdk_metadata_check( + tmp_path, published_extras=published_extras, npm_change=npm_change + ) + assert result.returncode != 0 + assert "differs from the release tag" in result.stderr or "extras differ" in result.stderr + assert outputs == {} + + +def test_release_sdk_inventory_generates_canonical_extra_and_peerless_row(tmp_path: Path) -> None: + result, outputs = _sdk_metadata_check(tmp_path) + assert result.returncode == 0, result.stderr + assert outputs["has_python_extras"] == "true" + assert json.loads(outputs["python_extras"]) == {"extra": ["first-extra"]} + assert json.loads(outputs["node_peers"]) == { + "include": [ + {"peer": "none", "requirement": ""}, + {"peer": "@example/adapter", "requirement": "@example/adapter@>=1 <2"}, + ] + } + + +def test_release_sdk_inventory_allows_an_older_release_with_no_extras(tmp_path: Path) -> None: + result, outputs = _sdk_metadata_check(tmp_path, extras=(), published_extras=()) + assert result.returncode == 0, result.stderr + assert outputs["has_python_extras"] == "false" + assert json.loads(outputs["python_extras"]) == {"extra": []} + + +@pytest.mark.parametrize( + "requires_dist", + [ + ("httpx[http2]>=0.27",), + ( + "httpx[http2]>=0.27", + 'ag2>=1.3,<1.5; extra == "first-extra" and python_version >= "3.11"', + ), + ( + "httpx[http2]>=0.27", + 'ag2>=1.3,<1.4; extra == "another-extra" and python_version >= "3.11"', + ), + ( + "httpx[http2]>=0.27", + 'ag2>=1.3,<1.4; extra == "first-extra" and python_version < "3.11"', + ), + ( + "httpx>=0.27", + 'ag2>=1.3,<1.4; extra == "first-extra" and python_version >= "3.11"', + ), + ('ag2>=1.3,<1.4; extra == "first-extra" and python_version >= "3.11"',), + ], + ids=[ + "named extra loses dependency", + "wrong range", + "wrong extra scope", + "wrong environment marker", + "base loses dependency extra", + "missing base dependency", + ], +) +def test_release_sdk_inventory_rejects_changed_requirements_with_extra_name_retained( + tmp_path: Path, requires_dist: tuple[str, ...] +) -> None: + result, outputs = _sdk_metadata_check(tmp_path, requires_dist=requires_dist) + assert result.returncode != 0 + assert "published Python requirements differ from the release tag" in result.stderr + assert outputs == {} diff --git a/uv.lock b/uv.lock index 58ac70f00d..49ba6c530f 100644 --- a/uv.lock +++ b/uv.lock @@ -778,7 +778,7 @@ wheels = [ [[package]] name = "clickhouse-loom-server" -version = "1.2.0" +version = "1.3.0" source = { editable = "." } dependencies = [ { name = "aiohttp" },