@tekmidian/pai 0.66.3 → 0.66.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chain-Fz4NLm4D.mjs → chain-BhPwBDXB.mjs} +2 -2
- package/dist/{chain-Fz4NLm4D.mjs.map → chain-BhPwBDXB.mjs.map} +1 -1
- package/dist/cli/index.mjs +8 -8
- package/dist/cli/program.mjs +8 -8
- package/dist/{context-handover-cache-DcPEW6vf.mjs → context-handover-cache-BbCYQUGo.mjs} +3 -3
- package/dist/{context-handover-cache-DcPEW6vf.mjs.map → context-handover-cache-BbCYQUGo.mjs.map} +1 -1
- package/dist/daemon/index.mjs +5 -5
- package/dist/{daemon-Bl8TpHdM.mjs → daemon-DzXOfieK.mjs} +5 -5
- package/dist/{daemon-Bl8TpHdM.mjs.map → daemon-DzXOfieK.mjs.map} +1 -1
- package/dist/{daemon-ZhHU6D0i.mjs → daemon-UJtRscyO.mjs} +5 -5
- package/dist/daemon-mcp/index.mjs +5 -5
- package/dist/{factory-BUnZgnKW.mjs → factory-CXFHwvcv.mjs} +2 -2
- package/dist/{factory-BUnZgnKW.mjs.map → factory-CXFHwvcv.mjs.map} +1 -1
- package/dist/{factory-CrVlo2hY.mjs → factory-CnKsU6zX.mjs} +2 -2
- package/dist/{fallback-awOmq_9A.mjs → fallback-CoooFqyA.mjs} +2 -2
- package/dist/{fallback-awOmq_9A.mjs.map → fallback-CoooFqyA.mjs.map} +1 -1
- package/dist/hooks/load-project-context.mjs.map +2 -2
- package/dist/hooks/security-validator.mjs.map +2 -2
- package/dist/hooks/worker-status-line.mjs.map +2 -2
- package/dist/{main-resolver-DDShdDBm.mjs → main-resolver-DrHtx8iW.mjs} +1 -1
- package/dist/{main-resolver-CVGPICy-.mjs → main-resolver-SfGGg1DB.mjs} +3 -3
- package/dist/{main-resolver-CVGPICy-.mjs.map → main-resolver-SfGGg1DB.mjs.map} +1 -1
- package/dist/{planner-GdiYe2FO.mjs → planner-C43lzcw5.mjs} +5 -5
- package/dist/{planner-GdiYe2FO.mjs.map → planner-C43lzcw5.mjs.map} +1 -1
- package/dist/postgres-B2BEBT-J.mjs +5 -0
- package/dist/{postgres-H85VSYHI.mjs → postgres-BxmyQHoA.mjs} +52 -4
- package/dist/postgres-BxmyQHoA.mjs.map +1 -0
- package/dist/{program-D3MSfx86.mjs → program-DB-hoyfW.mjs} +38 -121
- package/dist/program-DB-hoyfW.mjs.map +1 -0
- package/dist/{run-D9YbWsnL.mjs → run-wi5NEkJd.mjs} +116 -7
- package/dist/run-wi5NEkJd.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/postgres-DKyiCA5V.mjs +0 -5
- package/dist/postgres-H85VSYHI.mjs.map +0 -1
- package/dist/program-D3MSfx86.mjs.map +0 -1
- package/dist/run-D9YbWsnL.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as readWorkersSection } from "./run-env-CQRnxNht.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { L as appendLedger, Y as newWorkerId, mt as workersLogDir, n as runWorker, pt as ledgerPath, rt as shortText } from "./run-wi5NEkJd.mjs";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
|
|
@@ -161,4 +161,4 @@ async function runChain(opts, deps = {}) {
|
|
|
161
161
|
|
|
162
162
|
//#endregion
|
|
163
163
|
export { swapPromptArg as n, runChain as t };
|
|
164
|
-
//# sourceMappingURL=chain-
|
|
164
|
+
//# sourceMappingURL=chain-BhPwBDXB.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-Fz4NLm4D.mjs","names":[],"sources":["../src/workers/chain.ts"],"sourcesContent":["/**\n * chain.ts — draft-then-implement chains: `--chain draft,implement[,review]`.\n *\n * The chain runs each stage as its own worker (own id, own pane, `parent` set\n * to the chain id), so `ps` shows the chain as a tree and every stage can be\n * followed, replayed and said to like any other worker:\n *\n * - draft turns the operator's brief into a full spec file under\n * <logDir>/specs/<chain id>.md (goal, constraints, files likely\n * touched, acceptance checks, verification commands);\n * - any other stage (implement, plan, …) runs with that spec as its prompt\n * and the original brief attached;\n * - review reads the spec and the working-tree diff and produces the\n * structured report.\n *\n * A stage that fails (or a draft that produces no spec file) stops the chain;\n * the caller then writes the spec itself and re-runs without the draft stage.\n */\n\nimport { existsSync, mkdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { readWorkersSection } from \"./config.js\";\nimport { appendLedger } from \"./ledger.js\";\nimport { ledgerPath, workersLogDir } from \"./paths.js\";\nimport { newWorkerId } from \"./status.js\";\nimport { shortText } from \"./args.js\";\nimport { runWorker, type RunOptions } from \"./run.js\";\n\n/** Where a chain's spec file lives: <logDir>/specs/<chain id>.md. */\nexport function specPathFor(logDir: string, chainId: string): string {\n return join(logDir, \"specs\", `${chainId}.md`);\n}\n\n/**\n * Replace the caller's -p value with `prompt`, dropping every existing\n * -p/--print pair first (two -p flags on one claude command line are an error,\n * so the chain must never leave the brief in place when swapping prompts).\n */\nexport function swapPromptArg(claudeArgs: string[], prompt: string): string[] {\n const out: string[] = [];\n for (let i = 0; i < claudeArgs.length; i++) {\n const a = claudeArgs[i];\n if (a === \"-p\" || a === \"--print\") {\n if (i + 1 < claudeArgs.length && !claudeArgs[i + 1].startsWith(\"-\")) i += 1;\n continue;\n }\n out.push(a);\n }\n out.push(\"-p\", prompt);\n return out;\n}\n\nexport function draftPrompt(brief: string, specPath: string): string {\n return [\n \"You are the DRAFT stage of a worker chain. Turn the operator's brief below into a full implementation spec and write it to\",\n specPath,\n \"with the Write tool.\",\n \"\",\n \"Use exactly these five sections as Markdown headings:\",\n \"# Goal\",\n \"# Constraints\",\n \"# Files likely touched\",\n \"# Acceptance checks\",\n \"# Verification commands\",\n \"\",\n \"Read the repository first (Glob/Grep/Read) so the spec names real files and real commands. Do not implement anything.\",\n \"\",\n \"## Operator brief\",\n \"\",\n brief,\n ].join(\"\\n\");\n}\n\nexport function implementPrompt(brief: string, specPath: string | null, spec: string | null): string {\n const head = spec\n ? [\n \"You are the IMPLEMENT stage of a worker chain. The draft stage wrote the spec below (also at \" +\n specPath +\n \"). Implement it exactly, then run the spec's verification commands before finishing.\",\n \"\",\n \"## Spec\",\n \"\",\n spec,\n ]\n : [\"Implement the operator's brief below.\"];\n return [...head, \"\", \"## Operator brief\", \"\", brief].join(\"\\n\");\n}\n\nexport function reviewPrompt(brief: string, specPath: string | null, spec: string | null): string {\n const specPart = spec\n ? [\n \"\",\n \"## Spec (also at \" + specPath + \")\",\n \"\",\n spec,\n ]\n : [];\n return [\n \"You are the REVIEW stage of a worker chain. The implement stage just ran. Read the repository's diff (run `git diff` and `git status`; use `git diff --stat` for the overview) and check it against the spec's acceptance checks and verification commands — run the checks when they are cheap. Do not fix anything you find; report it.\",\n ...specPart,\n \"\",\n \"## Operator brief\",\n \"\",\n brief,\n ].join(\"\\n\");\n}\n\nexport interface ChainOptions {\n /** Class names, run in order: e.g. [\"draft\", \"implement\", \"review\"]. */\n stages: string[];\n /** Overrides the class of every stage when given (--class with --chain). */\n className?: string;\n providerFlag?: string;\n modelFlag?: string;\n label?: string;\n noPane?: boolean;\n mcpFlag?: string;\n /** --spec value, resolved for display/recording (\"-\" for stdin). */\n specPath?: string;\n /** The operator's brief — the -p value of the run. */\n brief: string;\n /** The caller's claude args (allowedTools etc.); the -p value is swapped. */\n claudeArgs: string[];\n cwd?: string;\n /** Internal: notified with the chain id once it exists (worker_run uses it). */\n onChainStart?: (chainId: string) => void;\n /** Internal: suppress result printing (the MCP shim's stdout is the RPC channel). */\n quiet?: boolean;\n}\n\nexport interface ChainDeps {\n /** Stage runner; tests inject a mock, production uses runWorker. */\n runStage?: (opts: RunOptions) => Promise<number>;\n /** logDir override for tests; default: the configured workers logDir. */\n logDir?: string;\n}\n\n/** Run a chain of stages; returns the exit code of the first failed stage, 0 when all pass. */\nexport async function runChain(opts: ChainOptions, deps: ChainDeps = {}): Promise<number> {\n const stages = opts.stages.map((s) => s.trim()).filter(Boolean);\n if (!stages.length) throw new Error(\"--chain needs at least one class, e.g. --chain draft,implement\");\n const runStage = deps.runStage ?? runWorker;\n const logDir = deps.logDir ?? workersLogDir(readWorkersSection().workers);\n const chainId = newWorkerId();\n const specPath = specPathFor(logDir, chainId);\n mkdirSync(join(logDir, \"specs\"), { recursive: true }); // the draft stage writes into it\n const baseLabel = opts.label ?? shortText(opts.brief, 40);\n\n appendLedger(ledgerPath(logDir), \"WORKER-CHAIN\", {\n chain: chainId,\n stages: stages.join(\",\"),\n label: baseLabel,\n });\n opts.onChainStart?.(chainId);\n\n let spec: string | null = null;\n for (let i = 0; i < stages.length; i++) {\n const stage = stages[i];\n if (stage === \"draft\") {\n spec = null; // a chain may legally start over; the draft rewrites it\n } else if (spec === null && existsSync(specPath)) {\n spec = readFileSync(specPath, \"utf8\");\n }\n const prompt =\n stage === \"draft\"\n ? draftPrompt(opts.brief, specPath)\n : stage === \"review\"\n ? reviewPrompt(opts.brief, spec ? specPath : null, spec)\n : implementPrompt(opts.brief, spec ? specPath : null, spec);\n process.stderr.write(\n `chain ${chainId}: stage ${i + 1}/${stages.length} ${stage} (spec: ${specPath})\\n`\n );\n const rc = await runStage({\n className: opts.className ?? stage,\n providerFlag: opts.providerFlag,\n modelFlag: opts.modelFlag,\n label: `${baseLabel} · ${stage}`,\n noPane: opts.noPane,\n mcpFlag: opts.mcpFlag,\n specPath: opts.specPath,\n claudeArgs: swapPromptArg(opts.claudeArgs, prompt),\n cwd: opts.cwd,\n parent: chainId,\n stage,\n quiet: opts.quiet,\n });\n if (stage === \"draft\") {\n if (!existsSync(specPath)) {\n process.stderr.write(\n `chain ${chainId}: draft stage produced no spec at ${specPath} — stopping. ` +\n `Write the spec yourself and re-run without the draft stage.\\n`\n );\n appendLedger(ledgerPath(logDir), \"WORKER-CHAIN-END\", {\n chain: chainId,\n rc: rc !== 0 ? rc : 1,\n failed: \"draft\",\n });\n return rc !== 0 ? rc : 1;\n }\n spec = readFileSync(specPath, \"utf8\");\n }\n if (rc !== 0) {\n appendLedger(ledgerPath(logDir), \"WORKER-CHAIN-END\", {\n chain: chainId,\n rc,\n failed: stage,\n });\n return rc;\n }\n }\n appendLedger(ledgerPath(logDir), \"WORKER-CHAIN-END\", { chain: chainId, rc: 0 });\n return 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,YAAY,QAAgB,SAAyB;AACnE,QAAO,KAAK,QAAQ,SAAS,GAAG,QAAQ,KAAK;;;;;;;AAQ/C,SAAgB,cAAc,YAAsB,QAA0B;CAC5E,MAAM,MAAgB,EAAE;AACxB,MAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;EAC1C,MAAM,IAAI,WAAW;AACrB,MAAI,MAAM,QAAQ,MAAM,WAAW;AACjC,OAAI,IAAI,IAAI,WAAW,UAAU,CAAC,WAAW,IAAI,GAAG,WAAW,IAAI,CAAE,MAAK;AAC1E;;AAEF,MAAI,KAAK,EAAE;;AAEb,KAAI,KAAK,MAAM,OAAO;AACtB,QAAO;;AAGT,SAAgB,YAAY,OAAe,UAA0B;AACnE,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,KAAK,KAAK;;AAGd,SAAgB,gBAAgB,OAAe,UAAyB,MAA6B;AAYnG,QAAO;EAAC,GAXK,OACT;GACE,kGACE,WACA;GACF;GACA;GACA;GACA;GACD,GACD,CAAC,wCAAwC;EAC5B;EAAI;EAAqB;EAAI;EAAM,CAAC,KAAK,KAAK;;AAGjE,SAAgB,aAAa,OAAe,UAAyB,MAA6B;AAShG,QAAO;EACL;EACA,GAVe,OACb;GACE;GACA,sBAAsB,WAAW;GACjC;GACA;GACD,GACD,EAAE;EAIJ;EACA;EACA;EACA;EACD,CAAC,KAAK,KAAK;;;AAkCd,eAAsB,SAAS,MAAoB,OAAkB,E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KAAK;GACV,QAAQ;GACR;GACA,OAAO,KAAK;GACb,CAAC;AACF,MAAI,UAAU,SAAS;AACrB,OAAI,CAAC,WAAW,SAAS,EAAE;AACzB,YAAQ,OAAO,MACb,SAAS,QAAQ,oCAAoC,SAAS,4EAE/D;AACD,iBAAa,WAAW,OAAO,EAAE,oBAAoB;KACnD,OAAO;KACP,IAAI,OAAO,IAAI,KAAK;KACpB,QAAQ;KACT,CAAC;AACF,WAAO,OAAO,IAAI,KAAK;;AAEzB,UAAO,aAAa,UAAU,OAAO;;AAEvC,MAAI,OAAO,GAAG;AACZ,gBAAa,WAAW,OAAO,EAAE,oBAAoB;IACnD,OAAO;IACP;IACA,QAAQ;IACT,CAAC;AACF,UAAO;;;AAGX,cAAa,WAAW,OAAO,EAAE,oBAAoB;EAAE,OAAO;EAAS,IAAI;EAAG,CAAC;AAC/E,QAAO"}
|
|
1
|
+
{"version":3,"file":"chain-BhPwBDXB.mjs","names":[],"sources":["../src/workers/chain.ts"],"sourcesContent":["/**\n * chain.ts — draft-then-implement chains: `--chain draft,implement[,review]`.\n *\n * The chain runs each stage as its own worker (own id, own pane, `parent` set\n * to the chain id), so `ps` shows the chain as a tree and every stage can be\n * followed, replayed and said to like any other worker:\n *\n * - draft turns the operator's brief into a full spec file under\n * <logDir>/specs/<chain id>.md (goal, constraints, files likely\n * touched, acceptance checks, verification commands);\n * - any other stage (implement, plan, …) runs with that spec as its prompt\n * and the original brief attached;\n * - review reads the spec and the working-tree diff and produces the\n * structured report.\n *\n * A stage that fails (or a draft that produces no spec file) stops the chain;\n * the caller then writes the spec itself and re-runs without the draft stage.\n */\n\nimport { existsSync, mkdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { readWorkersSection } from \"./config.js\";\nimport { appendLedger } from \"./ledger.js\";\nimport { ledgerPath, workersLogDir } from \"./paths.js\";\nimport { newWorkerId } from \"./status.js\";\nimport { shortText } from \"./args.js\";\nimport { runWorker, type RunOptions } from \"./run.js\";\n\n/** Where a chain's spec file lives: <logDir>/specs/<chain id>.md. */\nexport function specPathFor(logDir: string, chainId: string): string {\n return join(logDir, \"specs\", `${chainId}.md`);\n}\n\n/**\n * Replace the caller's -p value with `prompt`, dropping every existing\n * -p/--print pair first (two -p flags on one claude command line are an error,\n * so the chain must never leave the brief in place when swapping prompts).\n */\nexport function swapPromptArg(claudeArgs: string[], prompt: string): string[] {\n const out: string[] = [];\n for (let i = 0; i < claudeArgs.length; i++) {\n const a = claudeArgs[i];\n if (a === \"-p\" || a === \"--print\") {\n if (i + 1 < claudeArgs.length && !claudeArgs[i + 1].startsWith(\"-\")) i += 1;\n continue;\n }\n out.push(a);\n }\n out.push(\"-p\", prompt);\n return out;\n}\n\nexport function draftPrompt(brief: string, specPath: string): string {\n return [\n \"You are the DRAFT stage of a worker chain. Turn the operator's brief below into a full implementation spec and write it to\",\n specPath,\n \"with the Write tool.\",\n \"\",\n \"Use exactly these five sections as Markdown headings:\",\n \"# Goal\",\n \"# Constraints\",\n \"# Files likely touched\",\n \"# Acceptance checks\",\n \"# Verification commands\",\n \"\",\n \"Read the repository first (Glob/Grep/Read) so the spec names real files and real commands. Do not implement anything.\",\n \"\",\n \"## Operator brief\",\n \"\",\n brief,\n ].join(\"\\n\");\n}\n\nexport function implementPrompt(brief: string, specPath: string | null, spec: string | null): string {\n const head = spec\n ? [\n \"You are the IMPLEMENT stage of a worker chain. The draft stage wrote the spec below (also at \" +\n specPath +\n \"). Implement it exactly, then run the spec's verification commands before finishing.\",\n \"\",\n \"## Spec\",\n \"\",\n spec,\n ]\n : [\"Implement the operator's brief below.\"];\n return [...head, \"\", \"## Operator brief\", \"\", brief].join(\"\\n\");\n}\n\nexport function reviewPrompt(brief: string, specPath: string | null, spec: string | null): string {\n const specPart = spec\n ? [\n \"\",\n \"## Spec (also at \" + specPath + \")\",\n \"\",\n spec,\n ]\n : [];\n return [\n \"You are the REVIEW stage of a worker chain. The implement stage just ran. Read the repository's diff (run `git diff` and `git status`; use `git diff --stat` for the overview) and check it against the spec's acceptance checks and verification commands — run the checks when they are cheap. Do not fix anything you find; report it.\",\n ...specPart,\n \"\",\n \"## Operator brief\",\n \"\",\n brief,\n ].join(\"\\n\");\n}\n\nexport interface ChainOptions {\n /** Class names, run in order: e.g. [\"draft\", \"implement\", \"review\"]. */\n stages: string[];\n /** Overrides the class of every stage when given (--class with --chain). */\n className?: string;\n providerFlag?: string;\n modelFlag?: string;\n label?: string;\n noPane?: boolean;\n mcpFlag?: string;\n /** --spec value, resolved for display/recording (\"-\" for stdin). */\n specPath?: string;\n /** The operator's brief — the -p value of the run. */\n brief: string;\n /** The caller's claude args (allowedTools etc.); the -p value is swapped. */\n claudeArgs: string[];\n cwd?: string;\n /** Internal: notified with the chain id once it exists (worker_run uses it). */\n onChainStart?: (chainId: string) => void;\n /** Internal: suppress result printing (the MCP shim's stdout is the RPC channel). */\n quiet?: boolean;\n}\n\nexport interface ChainDeps {\n /** Stage runner; tests inject a mock, production uses runWorker. */\n runStage?: (opts: RunOptions) => Promise<number>;\n /** logDir override for tests; default: the configured workers logDir. */\n logDir?: string;\n}\n\n/** Run a chain of stages; returns the exit code of the first failed stage, 0 when all pass. */\nexport async function runChain(opts: ChainOptions, deps: ChainDeps = {}): Promise<number> {\n const stages = opts.stages.map((s) => s.trim()).filter(Boolean);\n if (!stages.length) throw new Error(\"--chain needs at least one class, e.g. --chain draft,implement\");\n const runStage = deps.runStage ?? runWorker;\n const logDir = deps.logDir ?? workersLogDir(readWorkersSection().workers);\n const chainId = newWorkerId();\n const specPath = specPathFor(logDir, chainId);\n mkdirSync(join(logDir, \"specs\"), { recursive: true }); // the draft stage writes into it\n const baseLabel = opts.label ?? shortText(opts.brief, 40);\n\n appendLedger(ledgerPath(logDir), \"WORKER-CHAIN\", {\n chain: chainId,\n stages: stages.join(\",\"),\n label: baseLabel,\n });\n opts.onChainStart?.(chainId);\n\n let spec: string | null = null;\n for (let i = 0; i < stages.length; i++) {\n const stage = stages[i];\n if (stage === \"draft\") {\n spec = null; // a chain may legally start over; the draft rewrites it\n } else if (spec === null && existsSync(specPath)) {\n spec = readFileSync(specPath, \"utf8\");\n }\n const prompt =\n stage === \"draft\"\n ? draftPrompt(opts.brief, specPath)\n : stage === \"review\"\n ? reviewPrompt(opts.brief, spec ? specPath : null, spec)\n : implementPrompt(opts.brief, spec ? specPath : null, spec);\n process.stderr.write(\n `chain ${chainId}: stage ${i + 1}/${stages.length} ${stage} (spec: ${specPath})\\n`\n );\n const rc = await runStage({\n className: opts.className ?? stage,\n providerFlag: opts.providerFlag,\n modelFlag: opts.modelFlag,\n label: `${baseLabel} · ${stage}`,\n noPane: opts.noPane,\n mcpFlag: opts.mcpFlag,\n specPath: opts.specPath,\n claudeArgs: swapPromptArg(opts.claudeArgs, prompt),\n cwd: opts.cwd,\n parent: chainId,\n stage,\n quiet: opts.quiet,\n });\n if (stage === \"draft\") {\n if (!existsSync(specPath)) {\n process.stderr.write(\n `chain ${chainId}: draft stage produced no spec at ${specPath} — stopping. ` +\n `Write the spec yourself and re-run without the draft stage.\\n`\n );\n appendLedger(ledgerPath(logDir), \"WORKER-CHAIN-END\", {\n chain: chainId,\n rc: rc !== 0 ? rc : 1,\n failed: \"draft\",\n });\n return rc !== 0 ? rc : 1;\n }\n spec = readFileSync(specPath, \"utf8\");\n }\n if (rc !== 0) {\n appendLedger(ledgerPath(logDir), \"WORKER-CHAIN-END\", {\n chain: chainId,\n rc,\n failed: stage,\n });\n return rc;\n }\n }\n appendLedger(ledgerPath(logDir), \"WORKER-CHAIN-END\", { chain: chainId, rc: 0 });\n return 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,YAAY,QAAgB,SAAyB;AACnE,QAAO,KAAK,QAAQ,SAAS,GAAG,QAAQ,KAAK;;;;;;;AAQ/C,SAAgB,cAAc,YAAsB,QAA0B;CAC5E,MAAM,MAAgB,EAAE;AACxB,MAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAA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,OAAO,EAAE,oBAAoB;EAAE,OAAO;EAAS,IAAI;EAAG,CAAC;AAC/E,QAAO"}
|
package/dist/cli/index.mjs
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
import { i as err } from "../utils-DddRwMsG.mjs";
|
|
3
3
|
import "../migrate-Bq0esMOa.mjs";
|
|
4
4
|
import "../helpers-CZsi_49C.mjs";
|
|
5
|
-
import "../postgres-
|
|
6
|
-
import "../factory-
|
|
5
|
+
import "../postgres-BxmyQHoA.mjs";
|
|
6
|
+
import "../factory-CXFHwvcv.mjs";
|
|
7
7
|
import "../embeddings-DMVzpvRZ.mjs";
|
|
8
8
|
import "../router-BaTbc9VX.mjs";
|
|
9
9
|
import "../config-Ddc4DIPk.mjs";
|
|
10
|
-
import { n as drainStdio, t as buildProgram } from "../program-
|
|
11
|
-
import "../context-handover-cache-
|
|
10
|
+
import { n as drainStdio, t as buildProgram } from "../program-DB-hoyfW.mjs";
|
|
11
|
+
import "../context-handover-cache-BbCYQUGo.mjs";
|
|
12
12
|
import "../run-env-CQRnxNht.mjs";
|
|
13
|
-
import "../run-
|
|
13
|
+
import "../run-wi5NEkJd.mjs";
|
|
14
14
|
import "../ipc-client-DkxRay-o.mjs";
|
|
15
|
-
import "../fallback-
|
|
16
|
-
import "../main-resolver-
|
|
15
|
+
import "../fallback-CoooFqyA.mjs";
|
|
16
|
+
import "../main-resolver-SfGGg1DB.mjs";
|
|
17
17
|
import "../aibroker-client-WCZi_tn-.mjs";
|
|
18
|
-
import "../chain-
|
|
18
|
+
import "../chain-BhPwBDXB.mjs";
|
|
19
19
|
import { t as dropItermBundleId } from "../env-DiolswKQ.mjs";
|
|
20
20
|
import { CommanderError } from "commander";
|
|
21
21
|
|
package/dist/cli/program.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import "../utils-DddRwMsG.mjs";
|
|
2
2
|
import "../migrate-Bq0esMOa.mjs";
|
|
3
3
|
import "../helpers-CZsi_49C.mjs";
|
|
4
|
-
import "../postgres-
|
|
5
|
-
import "../factory-
|
|
4
|
+
import "../postgres-BxmyQHoA.mjs";
|
|
5
|
+
import "../factory-CXFHwvcv.mjs";
|
|
6
6
|
import "../embeddings-DMVzpvRZ.mjs";
|
|
7
7
|
import "../router-BaTbc9VX.mjs";
|
|
8
8
|
import "../config-Ddc4DIPk.mjs";
|
|
9
|
-
import { t as buildProgram } from "../program-
|
|
10
|
-
import "../context-handover-cache-
|
|
9
|
+
import { t as buildProgram } from "../program-DB-hoyfW.mjs";
|
|
10
|
+
import "../context-handover-cache-BbCYQUGo.mjs";
|
|
11
11
|
import "../run-env-CQRnxNht.mjs";
|
|
12
|
-
import "../run-
|
|
12
|
+
import "../run-wi5NEkJd.mjs";
|
|
13
13
|
import "../ipc-client-DkxRay-o.mjs";
|
|
14
|
-
import "../fallback-
|
|
15
|
-
import "../main-resolver-
|
|
14
|
+
import "../fallback-CoooFqyA.mjs";
|
|
15
|
+
import "../main-resolver-SfGGg1DB.mjs";
|
|
16
16
|
import "../aibroker-client-WCZi_tn-.mjs";
|
|
17
|
-
import "../chain-
|
|
17
|
+
import "../chain-BhPwBDXB.mjs";
|
|
18
18
|
|
|
19
19
|
export { buildProgram };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { c as ok, g as warn, i as err, n as dim, r as encodeDir, s as now, t as bold } from "./utils-DddRwMsG.mjs";
|
|
2
2
|
import { a as slugify, i as parseSessionFilename, n as decodeEncodedDir, t as buildEncodedDirMap } from "./migrate-Bq0esMOa.mjs";
|
|
3
3
|
import { n as ensurePaiMarker, t as discoverPaiMarkers } from "./pai-marker-DXVpFsYz.mjs";
|
|
4
|
-
import { i as getRegistryBackend } from "./factory-
|
|
4
|
+
import { i as getRegistryBackend } from "./factory-CXFHwvcv.mjs";
|
|
5
5
|
import { y as writeJsonAtomic } from "./config-Ddc4DIPk.mjs";
|
|
6
6
|
import { a as paiHomePath, o as resolvePaiFile, r as migratePaiFile } from "./pai-home-UncxWxlX.mjs";
|
|
7
7
|
import { r as daemonPidPath } from "./runtime-paths-Bw3Jk8qJ.mjs";
|
|
8
8
|
import { D as readWorkersSection, k as resolveModelCapability, t as buildRunEnv, v as defaultWorkersConfig } from "./run-env-CQRnxNht.mjs";
|
|
9
|
-
import { C as itermUuid,
|
|
9
|
+
import { C as itermUuid, L as appendLedger, N as worktreesDir, T as sessionMapPath, at as ensureProxyRunning, dt as ensureNoMcpConfig, it as DEFAULT_PROXY_PORT, mt as workersLogDir, ut as resolveTarget } from "./run-wi5NEkJd.mjs";
|
|
10
10
|
import { i as sendToSession, n as fetchLiveSessions } from "./aibroker-client-WCZi_tn-.mjs";
|
|
11
11
|
import { createReadStream, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
12
12
|
import { homedir, setPriority, tmpdir, userInfo } from "node:os";
|
|
@@ -4412,4 +4412,4 @@ function writeContextHandoverCache(cache) {
|
|
|
4412
4412
|
|
|
4413
4413
|
//#endregion
|
|
4414
4414
|
export { shutdownRequested as $, indexInProgress as A, claudeProjectsDir as At, setEmbedInProgress as B, handleSessionSummary as C, loadScanConfig as Ct, daemonConfig as D, saveScanConfig as Dt, cacheKeepaliveTimer as E, resolveHome as Et, notificationConfig as F, formatDetection as Ft, setLastIndexTime as G, setIndexInProgress as H, passFailures as I, formatDetectionJson as It, setRegistryBackend as J, setLastVaultIndexTime as K, registryBackend as L, lastEmbedTime as M, scanTranscriptFolders as Mt, lastIndexTime as N, transcriptFiles as Nt, embedInProgress as O, upsertProject as Ot, lastVaultIndexTime as P, detectProject as Pt, setVaultIndexInProgress as Q, setCacheKeepaliveTimer as R, getGitContext as S, cmdScan as St, spawnSummarizer as T, performScan as Tt, setIndexSchedulerTimer as U, setEmbedSchedulerTimer as V, setLastEmbedTime as W, setStartTime as X, setShutdownRequested as Y, setStorageBackend as Z, markCompleted as _, buildWakeupContext as _t, sessionKeepaliveLedgerSummary as a, updateTodoContinue as at, contentToText as b, reexecBackground as bt, removeDaemonPidfile as c, findLatestNote as ct, cleanup as d, addWorkToSessionNote as dt, startTime as et, dequeue as f, appendCheckpoint as ft, loadQueue as g, findNotesDir$1 as gt, hasPendingOrProcessingOfType as h, archiveSessionFilesToSessionsDir as ht, runSessionKeepaliveTick as i, sessionIdFromTranscript as it, indexSchedulerTimer as j, findMovedProjects as jt, embedSchedulerTimer as k, upsertSession as kt, resolveDaemonPid as l, findNotesDir as lt, getStats as m, getCurrentNotePath as mt, writeContextHandoverCache as n, vaultIndexInProgress as nt, parseSessionUsage as o, appendCheckpointToNote as ot, enqueue as p, finalizeSessionNote as pt, setNotificationConfig as q, loadSessionKeepaliveState as r, extractAndStoreTriples$1 as rt, totalUsageTokens as s, applyContinue as st, readContextHandoverCache as t, storageBackend as tt, writeDaemonPidfile as u, readBodyFile as ut, markFailed as v, migrateIdentityFile as vt, migrateSummaryCooldowns as w, migrateScanConfig as wt, findLatestJsonl as x, runPassChild as xt, migrateWorkQueue as y, PassSpawnError as yt, setDaemonConfig as z };
|
|
4415
|
-
//# sourceMappingURL=context-handover-cache-
|
|
4415
|
+
//# sourceMappingURL=context-handover-cache-BbCYQUGo.mjs.map
|