@tekmidian/pai 0.62.0 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chain-CuaDawK9.mjs → chain-CUfE6WYK.mjs} +2 -2
- package/dist/{chain-CuaDawK9.mjs.map → chain-CUfE6WYK.mjs.map} +1 -1
- package/dist/cli/index.mjs +5 -5
- package/dist/cli/program.mjs +5 -5
- package/dist/daemon/index.mjs +3 -3
- package/dist/{daemon-bJi1gDkG.mjs → daemon-C8-uzOuV.mjs} +3 -3
- package/dist/{daemon-Bf7Eock4.mjs → daemon-Cex3dT9f.mjs} +3 -3
- package/dist/{daemon-Bf7Eock4.mjs.map → daemon-Cex3dT9f.mjs.map} +1 -1
- package/dist/daemon-mcp/index.mjs +3 -3
- package/dist/{fallback-F0TWGVM2.mjs → fallback-ktbR0aR7.mjs} +2 -2
- package/dist/{fallback-F0TWGVM2.mjs.map → fallback-ktbR0aR7.mjs.map} +1 -1
- package/dist/hooks/load-project-context.mjs +6 -0
- package/dist/hooks/load-project-context.mjs.map +2 -2
- package/dist/{planner-BG9ivPj0.mjs → planner-DAQMTMjP.mjs} +3 -3
- package/dist/{planner-BG9ivPj0.mjs.map → planner-DAQMTMjP.mjs.map} +1 -1
- package/dist/{program-BRvCzhjx.mjs → program-De1GVVM4.mjs} +27 -14
- package/dist/program-De1GVVM4.mjs.map +1 -0
- package/dist/{run-BVQZI79D.mjs → run-CZVCCvXE.mjs} +75 -51
- package/dist/run-CZVCCvXE.mjs.map +1 -0
- package/dist/{session-keepalive-DJA97K2X.mjs → session-keepalive-CWGzLBVU.mjs} +2 -2
- package/dist/{session-keepalive-DJA97K2X.mjs.map → session-keepalive-CWGzLBVU.mjs.map} +1 -1
- package/docs/commands/README.md +2 -0
- package/docs/commands/project.md +14 -5
- package/docs/commands/projects.md +14 -5
- package/package.json +1 -1
- package/src/hooks/ts/session-start/load-project-context.ts +9 -0
- package/dist/program-BRvCzhjx.mjs.map +0 -1
- package/dist/run-BVQZI79D.mjs.map +0 -1
|
@@ -157,6 +157,72 @@ function describeMcp(config, claudeJson = CLAUDE_JSON) {
|
|
|
157
157
|
return lines;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/workers/project-config.ts
|
|
162
|
+
/**
|
|
163
|
+
* project-config.ts — the project registry's optional launch pin, read for
|
|
164
|
+
* the interactive branch of run.ts only: which MCP servers and built-in
|
|
165
|
+
* tools a project's supervisor session (`pai worker run`, no -p) loads. Set
|
|
166
|
+
* with `pai project mcp` / `pai project tools` (src/cli/commands/project/
|
|
167
|
+
* session-config.ts), stored in the same `projects.session_config` JSON
|
|
168
|
+
* column as the rest of a project's launch config. Unset = today's
|
|
169
|
+
* behavior: every server, every tool.
|
|
170
|
+
*
|
|
171
|
+
* A standalone SQL lookup rather than importing the CLI's detectProject:
|
|
172
|
+
* workers/ is a dependency of cli/, not the other way around.
|
|
173
|
+
*/
|
|
174
|
+
function asStringArray(v) {
|
|
175
|
+
if (!Array.isArray(v)) return void 0;
|
|
176
|
+
const out = v.filter((x) => typeof x === "string");
|
|
177
|
+
return out.length ? out : void 0;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The launch config of the project whose root_path is `cwd` or an ancestor
|
|
181
|
+
* of it (longest match wins) — null when no registered project covers it,
|
|
182
|
+
* or when the matching project has no mcp/tools pin set. `registry` is
|
|
183
|
+
* injectable for tests; production callers take the process-wide backend.
|
|
184
|
+
*/
|
|
185
|
+
async function projectLaunchConfig(cwd, registry) {
|
|
186
|
+
const target = resolve(cwd);
|
|
187
|
+
const rows = await (registry ?? await getRegistryBackend()).listProjectsByPathLengthDesc({ excludeArchived: true });
|
|
188
|
+
for (const row of rows) {
|
|
189
|
+
const root = resolve(row.root_path);
|
|
190
|
+
if (target !== root && !target.startsWith(root + "/")) continue;
|
|
191
|
+
if (!row.session_config) return null;
|
|
192
|
+
let parsed;
|
|
193
|
+
try {
|
|
194
|
+
parsed = JSON.parse(row.session_config);
|
|
195
|
+
} catch {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
const mcp = asStringArray(parsed.mcp);
|
|
199
|
+
const tools = asStringArray(parsed.tools);
|
|
200
|
+
return mcp || tools ? {
|
|
201
|
+
slug: row.slug,
|
|
202
|
+
mcp,
|
|
203
|
+
tools
|
|
204
|
+
} : null;
|
|
205
|
+
}
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* One line per active pin, so a pin never silently removes a server or tool:
|
|
210
|
+
* shown by the SessionStart hook and by `pai worker run`'s interactive launch.
|
|
211
|
+
* `claudeJson` is injectable for tests; read-only.
|
|
212
|
+
*/
|
|
213
|
+
function pinNotices(launch, claudeJson) {
|
|
214
|
+
if (!launch) return [];
|
|
215
|
+
const lines = [];
|
|
216
|
+
if (launch.mcp) {
|
|
217
|
+
const all = Object.keys(readMcpServers(claudeJson));
|
|
218
|
+
const loaded = all.filter((n) => launch.mcp.includes(n));
|
|
219
|
+
const missing = all.filter((n) => !launch.mcp.includes(n));
|
|
220
|
+
lines.push(`MCP pinned for ${launch.slug}: loading ${loaded.length} of ${all.length} servers; not loaded: ${missing.join(", ") || "(none)"} — \`pai project mcp --clear\` to load all`);
|
|
221
|
+
}
|
|
222
|
+
if (launch.tools) lines.push(`Tools pinned for ${launch.slug}: ${launch.tools.join(",")} — \`pai project tools --clear\``);
|
|
223
|
+
return lines;
|
|
224
|
+
}
|
|
225
|
+
|
|
160
226
|
//#endregion
|
|
161
227
|
//#region src/workers/args.ts
|
|
162
228
|
function parseRunnerArgs(argv) {
|
|
@@ -2959,54 +3025,6 @@ function relShort(p, cwd) {
|
|
|
2959
3025
|
return r && !r.startsWith("..") ? r : p;
|
|
2960
3026
|
}
|
|
2961
3027
|
|
|
2962
|
-
//#endregion
|
|
2963
|
-
//#region src/workers/project-config.ts
|
|
2964
|
-
/**
|
|
2965
|
-
* project-config.ts — the project registry's optional launch pin, read for
|
|
2966
|
-
* the interactive branch of run.ts only: which MCP servers and built-in
|
|
2967
|
-
* tools a project's supervisor session (`pai worker run`, no -p) loads. Set
|
|
2968
|
-
* with `pai project mcp` / `pai project tools` (src/cli/commands/project/
|
|
2969
|
-
* session-config.ts), stored in the same `projects.session_config` JSON
|
|
2970
|
-
* column as the rest of a project's launch config. Unset = today's
|
|
2971
|
-
* behavior: every server, every tool.
|
|
2972
|
-
*
|
|
2973
|
-
* A standalone SQL lookup rather than importing the CLI's detectProject:
|
|
2974
|
-
* workers/ is a dependency of cli/, not the other way around.
|
|
2975
|
-
*/
|
|
2976
|
-
function asStringArray(v) {
|
|
2977
|
-
if (!Array.isArray(v)) return void 0;
|
|
2978
|
-
const out = v.filter((x) => typeof x === "string");
|
|
2979
|
-
return out.length ? out : void 0;
|
|
2980
|
-
}
|
|
2981
|
-
/**
|
|
2982
|
-
* The launch config of the project whose root_path is `cwd` or an ancestor
|
|
2983
|
-
* of it (longest match wins) — null when no registered project covers it,
|
|
2984
|
-
* or when the matching project has no mcp/tools pin set. `registry` is
|
|
2985
|
-
* injectable for tests; production callers take the process-wide backend.
|
|
2986
|
-
*/
|
|
2987
|
-
async function projectLaunchConfig(cwd, registry) {
|
|
2988
|
-
const target = resolve(cwd);
|
|
2989
|
-
const rows = await (registry ?? await getRegistryBackend()).listProjectsByPathLengthDesc({ excludeArchived: true });
|
|
2990
|
-
for (const row of rows) {
|
|
2991
|
-
const root = resolve(row.root_path);
|
|
2992
|
-
if (target !== root && !target.startsWith(root + "/")) continue;
|
|
2993
|
-
if (!row.session_config) return null;
|
|
2994
|
-
let parsed;
|
|
2995
|
-
try {
|
|
2996
|
-
parsed = JSON.parse(row.session_config);
|
|
2997
|
-
} catch {
|
|
2998
|
-
return null;
|
|
2999
|
-
}
|
|
3000
|
-
const mcp = asStringArray(parsed.mcp);
|
|
3001
|
-
const tools = asStringArray(parsed.tools);
|
|
3002
|
-
return mcp || tools ? {
|
|
3003
|
-
mcp,
|
|
3004
|
-
tools
|
|
3005
|
-
} : null;
|
|
3006
|
-
}
|
|
3007
|
-
return null;
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
3028
|
//#endregion
|
|
3011
3029
|
//#region src/workers/codex.ts
|
|
3012
3030
|
/**
|
|
@@ -3415,7 +3433,7 @@ async function runWorker(opts) {
|
|
|
3415
3433
|
if (gc?.length) process.stderr.write(`pai worker: archived ${gc.length} leftover worktree(s) (pai worker gc)\n`);
|
|
3416
3434
|
} catch {}
|
|
3417
3435
|
if (opts.className === "plan" && !opts._planner) {
|
|
3418
|
-
const { runPlanner } = await import("./planner-
|
|
3436
|
+
const { runPlanner } = await import("./planner-DAQMTMjP.mjs");
|
|
3419
3437
|
return runPlanner(opts);
|
|
3420
3438
|
}
|
|
3421
3439
|
const parent = launchParent(opts.parent);
|
|
@@ -3864,6 +3882,12 @@ async function executeRun(a) {
|
|
|
3864
3882
|
const explicitMcp = [...a.mcpFlag ? [a.mcpFlag] : [], ...parsed.mcp];
|
|
3865
3883
|
const projectLaunch = await projectLaunchConfig(cwd);
|
|
3866
3884
|
const picked = interactiveMcpTools(explicitMcp, parsed.callerTools, projectLaunch);
|
|
3885
|
+
const applied = projectLaunch && {
|
|
3886
|
+
...projectLaunch,
|
|
3887
|
+
mcp: explicitMcp.length ? void 0 : projectLaunch.mcp,
|
|
3888
|
+
tools: picked.tools.length ? projectLaunch.tools : void 0
|
|
3889
|
+
};
|
|
3890
|
+
for (const line of pinNotices(applied)) console.error(line);
|
|
3867
3891
|
if (picked.mcpNames.length) mcpArgs = [
|
|
3868
3892
|
"--strict-mcp-config",
|
|
3869
3893
|
"--mcp-config",
|
|
@@ -4570,5 +4594,5 @@ function resultFromOutput(out) {
|
|
|
4570
4594
|
}
|
|
4571
4595
|
|
|
4572
4596
|
//#endregion
|
|
4573
|
-
export {
|
|
4574
|
-
//# sourceMappingURL=run-
|
|
4597
|
+
export { expandMcpNames as $, ledgerSummary as A, loadStatuses as B, discardWorker as C, uncommittedPaths as D, mergeWorker as E, contextPercent as F, setWorkerLabel as G, nowStamp as H, elapsedOf as I, parseRunnerArgs as J, waitForTerminalStatus as K, isChatPane as L, ageOf as M, alive as N, worktreesDir as O, contextLabel as P, describeMcp as Q, isLive as R, workerInScope as S, git as T, ownsPid as U, newWorkerId as V, saveStatus as W, pinNotices as X, shortText as Y, projectLaunchConfig as Z, itermForClaudeSession as _, parseWorkerReport as a, sessionMapPath as b, readInbox as c, checkPaneForWorker as d, openFollowPane as f, currentTabKey as g, markControlsHeld as h, usageContextTokens as i, UNLABELED as j, appendLedger as k, sayToWorker as l, clickrControlsArgv as m, runWorker as n, renderReport as o, openPaneForWorker as p, longInlinePromptHint as q, testProvider as r, handoffFromInside as s, printResult as t, workerDepth as u, itermUuid as v, gcWorktrees as w, sessionTag as x, resolveSession as y, loadStatus as z };
|
|
4598
|
+
//# sourceMappingURL=run-CZVCCvXE.mjs.map
|