@cydm/pie 4.3.7 → 4.3.12
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/builtin/extensions/ask-user/index.js +1 -1
- package/dist/builtin/extensions/cron/index.js +112 -8
- package/dist/builtin/extensions/im-forward/README.md +17 -1
- package/dist/builtin/extensions/im-forward/index.js +918 -347
- package/dist/builtin/extensions/mcp-adapter/index.js +2 -2
- package/dist/builtin/extensions/memory/index.js +10 -3
- package/dist/builtin/extensions/pie-ipc/index.js +179 -378
- package/dist/builtin/extensions/pie-proc/index.js +36 -4
- package/dist/builtin/extensions/plan-mode/index.js +6 -5
- package/dist/builtin/extensions/subagent/index.js +15 -5
- package/dist/builtin/extensions/todo/index.js +6 -2
- package/dist/chunks/{chunk-N3BWFAMZ.js → chunk-EGNGHINP.js} +521 -161
- package/dist/chunks/{chunk-BJ4XN5VX.js → chunk-GY47MKCJ.js} +13 -8
- package/dist/chunks/{chunk-2SAFRLFJ.js → chunk-I7PBXG5Q.js} +1 -1
- package/dist/chunks/{chunk-WZLO5V2X.js → chunk-N5B5IGJ6.js} +355 -231
- package/dist/chunks/{manager-cli-QNMCCIFG.js → manager-cli-4Z6RZ7F4.js} +195 -205
- package/dist/chunks/{src-UVULNQOO.js → src-V2M7FLWY.js} +7 -1
- package/dist/cli.js +143 -20
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
runDistillWorkerMain,
|
|
15
15
|
spawnDistillAutoWorker,
|
|
16
16
|
spawnDistillWorker
|
|
17
|
-
} from "./chunks/chunk-
|
|
17
|
+
} from "./chunks/chunk-GY47MKCJ.js";
|
|
18
18
|
import {
|
|
19
19
|
CLI_RETRY_MAX_RETRIES,
|
|
20
20
|
classifyCliFailure,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
logTransportLifecycle,
|
|
32
32
|
setYoloGrantListener,
|
|
33
33
|
truncateHeadTail
|
|
34
|
-
} from "./chunks/chunk-
|
|
34
|
+
} from "./chunks/chunk-I7PBXG5Q.js";
|
|
35
35
|
import {
|
|
36
36
|
VERSION,
|
|
37
37
|
getAgentDir,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
shouldPreserveExecutionStateForUserText,
|
|
77
77
|
supersedeExecutionState,
|
|
78
78
|
todayKey
|
|
79
|
-
} from "./chunks/chunk-
|
|
79
|
+
} from "./chunks/chunk-N5B5IGJ6.js";
|
|
80
80
|
import {
|
|
81
81
|
AGENTS_CONTEXT_FILE_NAME,
|
|
82
82
|
AgentSessionController,
|
|
@@ -137,9 +137,6 @@ import {
|
|
|
137
137
|
streamSimple,
|
|
138
138
|
type_exports
|
|
139
139
|
} from "./chunks/chunk-6JEYRAQM.js";
|
|
140
|
-
import {
|
|
141
|
-
readImageFormat
|
|
142
|
-
} from "./chunks/chunk-F7EBZTZO.js";
|
|
143
140
|
import {
|
|
144
141
|
IsArray,
|
|
145
142
|
IsBigInt,
|
|
@@ -154,6 +151,9 @@ import {
|
|
|
154
151
|
TypeBoxError,
|
|
155
152
|
TypeSystemPolicy
|
|
156
153
|
} from "./chunks/chunk-XXGYUYXI.js";
|
|
154
|
+
import {
|
|
155
|
+
readImageFormat
|
|
156
|
+
} from "./chunks/chunk-F7EBZTZO.js";
|
|
157
157
|
import {
|
|
158
158
|
resolveCliProjectRoot
|
|
159
159
|
} from "./chunks/chunk-WLFOBECN.js";
|
|
@@ -51976,6 +51976,14 @@ var SettingsManager = class {
|
|
|
51976
51976
|
if (this.managerScopedEnv.provider) return this.managerScopedEnv.provider;
|
|
51977
51977
|
return this.settings.defaultProvider || this.legacyConfig.provider;
|
|
51978
51978
|
}
|
|
51979
|
+
/** 4.3.9 (priority inversion fix): the manager workspace-config pair as a
|
|
51980
|
+
* REFERENCE — `provider/modelId` when the manager bootstrap env applies,
|
|
51981
|
+
* undefined for every ordinary process. The session-restore path uses it
|
|
51982
|
+
* to keep the workspace config over the session metadata. */
|
|
51983
|
+
getManagerScopedModelRef() {
|
|
51984
|
+
if (!this.managerScopedEnv.provider || !this.managerScopedEnv.model) return void 0;
|
|
51985
|
+
return { provider: this.managerScopedEnv.provider, modelId: this.managerScopedEnv.model };
|
|
51986
|
+
}
|
|
51979
51987
|
getDefaultModel() {
|
|
51980
51988
|
if (this.managerScopedEnv.model) return this.managerScopedEnv.model;
|
|
51981
51989
|
return this.settings.defaultModel || this.legacyConfig.modelId;
|
|
@@ -53671,6 +53679,9 @@ async function runMemoryCommand(args) {
|
|
|
53671
53679
|
const runs = Object.entries(store.loadState().runs).sort(([a], [b2]) => a < b2 ? 1 : -1);
|
|
53672
53680
|
const schedule = describeMemorySchedule();
|
|
53673
53681
|
if (schedule) console.log(`schedule: ${schedule}`);
|
|
53682
|
+
const latestOk = runs.find(([, run]) => run.ops !== void 0 && (run.failures ?? 0) === 0);
|
|
53683
|
+
if (latestOk) console.log(`last successful distillation: ${latestOk[0]} (${new Date(latestOk[1].ranAt).toISOString()})`);
|
|
53684
|
+
else console.log("last successful distillation: none recorded (check `pie memory log` for failures)");
|
|
53674
53685
|
for (const line of consumptionSummary(store.loadEntries())) console.log(line);
|
|
53675
53686
|
if (runs.length === 0) {
|
|
53676
53687
|
console.log("No distillation runs recorded yet.");
|
|
@@ -53700,7 +53711,8 @@ async function cronStore() {
|
|
|
53700
53711
|
function managedMemoryCommand() {
|
|
53701
53712
|
const entry = process.argv[1] ? path5.resolve(process.argv[1]) : null;
|
|
53702
53713
|
if (!entry) throw new Error("cannot determine the CLI entrypoint for the managed schedule");
|
|
53703
|
-
|
|
53714
|
+
const loaderArgs = process.execArgv.filter((a) => a.startsWith("--import") || a.startsWith("--loader"));
|
|
53715
|
+
return [process.execPath, ...loaderArgs, entry, "memory", "distill", "--worker", "--auto", "--memory-root", path5.join(getConfigDir(), "memory")];
|
|
53704
53716
|
}
|
|
53705
53717
|
function timeToCron(value) {
|
|
53706
53718
|
const match = value.match(/^(\d{1,2}):(\d{2})$/);
|
|
@@ -53739,18 +53751,30 @@ async function runScheduleCommand(rest) {
|
|
|
53739
53751
|
const cron = timeToCron(time);
|
|
53740
53752
|
if ("error" in cron) die(cron.error);
|
|
53741
53753
|
const command = managedMemoryCommand();
|
|
53754
|
+
const replacedBefore = store.findProcess(MEMORY_MANAGER);
|
|
53742
53755
|
let job;
|
|
53743
53756
|
try {
|
|
53744
|
-
job = store.addProcess(command, MEMORY_MANAGER, process.cwd(), cron);
|
|
53757
|
+
job = store.addProcess(command, MEMORY_MANAGER, process.cwd(), cron, Date.now(), { forceReplace: true });
|
|
53745
53758
|
} catch (error) {
|
|
53746
53759
|
die(String(error instanceof Error ? error.message : error));
|
|
53747
53760
|
}
|
|
53761
|
+
try {
|
|
53762
|
+
fs5.rmSync(path5.join(getConfigDir(), "cron", "memory-disabled"), { force: true });
|
|
53763
|
+
} catch {
|
|
53764
|
+
}
|
|
53748
53765
|
console.log(`memory schedule on: daily at ${time} local (${cron.cron} UTC; fixed-UTC \u2014 DST shifts the local time). Runs: ${command.join(" ")}`);
|
|
53766
|
+
if (replacedBefore && replacedBefore.id !== job.id && (replacedBefore.state === "blocked" || replacedBefore.enabled === false)) {
|
|
53767
|
+
console.log(`note: replaced an existing ${replacedBefore.state === "blocked" ? "BLOCKED" : "paused"} job (was id ${replacedBefore.id.slice(0, 8)}); its pending review record is reset.`);
|
|
53768
|
+
}
|
|
53749
53769
|
console.log("The cron extension triggers it whenever at least one cron-enabled Pie is open; missed days are caught up by --auto.");
|
|
53750
53770
|
return;
|
|
53751
53771
|
}
|
|
53752
53772
|
if (action === "off") {
|
|
53753
53773
|
const existing = store.findProcess(MEMORY_MANAGER);
|
|
53774
|
+
try {
|
|
53775
|
+
fs5.writeFileSync(path5.join(getConfigDir(), "cron", "memory-disabled"), (/* @__PURE__ */ new Date()).toISOString());
|
|
53776
|
+
} catch {
|
|
53777
|
+
}
|
|
53754
53778
|
if (!existing) {
|
|
53755
53779
|
console.log("memory schedule off: no managed job found (already off).");
|
|
53756
53780
|
return;
|
|
@@ -55260,6 +55284,9 @@ function createExtensionContext(extension, cwd, uiContext, abortFn, isIdleFn, ca
|
|
|
55260
55284
|
getSessionDisplayName() {
|
|
55261
55285
|
return actions?.getSessionDisplayName?.() ?? actions?.getSessionName?.();
|
|
55262
55286
|
},
|
|
55287
|
+
getCurrentModel() {
|
|
55288
|
+
return actions?.getCurrentModel?.();
|
|
55289
|
+
},
|
|
55263
55290
|
registerProvider(name, config) {
|
|
55264
55291
|
if (!actions?.registerProvider) throw new Error("registerProvider is not available in this host mode");
|
|
55265
55292
|
return actions.registerProvider(name, config);
|
|
@@ -63556,6 +63583,11 @@ var ExtensionRunner = class {
|
|
|
63556
63583
|
extensions;
|
|
63557
63584
|
uiContext;
|
|
63558
63585
|
actions;
|
|
63586
|
+
/** Test/introspection access to the host action surface (4.3.9: the TUI
|
|
63587
|
+
* applyIpcControl parity tests assert the wired control frames). */
|
|
63588
|
+
getActionSurface() {
|
|
63589
|
+
return this.actions;
|
|
63590
|
+
}
|
|
63559
63591
|
contextActions;
|
|
63560
63592
|
capabilities;
|
|
63561
63593
|
/** Unregister handles created through this runner, revoked on reload/teardown. */
|
|
@@ -63766,6 +63798,7 @@ var ExtensionRunner = class {
|
|
|
63766
63798
|
},
|
|
63767
63799
|
getSessionName: () => runner.actions.getSessionName?.(),
|
|
63768
63800
|
getSessionDisplayName: () => runner.actions.getSessionDisplayName?.() ?? runner.actions.getSessionName?.(),
|
|
63801
|
+
getCurrentModel: () => runner.actions.getCurrentModel?.(),
|
|
63769
63802
|
registerProvider: (name, config) => {
|
|
63770
63803
|
if (!runner.actions.registerProvider) throw new Error("registerProvider is not available in this host mode");
|
|
63771
63804
|
return runner.trackUnregisterHandle(runner.actions.registerProvider(name, config));
|
|
@@ -63926,7 +63959,7 @@ var ExtensionRunner = class {
|
|
|
63926
63959
|
const result = await handler({ ...event, text }, ctx);
|
|
63927
63960
|
if (!result || typeof result !== "object" || !("action" in result)) continue;
|
|
63928
63961
|
if (result.action === "consume") return { action: "consume" };
|
|
63929
|
-
if (result.action === "reject") return { action: "reject" };
|
|
63962
|
+
if (result.action === "reject") return { action: "reject", ...typeof result.reason === "string" && result.reason ? { reason: result.reason } : {} };
|
|
63930
63963
|
if (result.action === "transform" && typeof result.text === "string") {
|
|
63931
63964
|
text = result.text;
|
|
63932
63965
|
current = { action: "transform", text };
|
|
@@ -64243,6 +64276,13 @@ function restoreSessionModelState(options) {
|
|
|
64243
64276
|
thinkingLevel
|
|
64244
64277
|
};
|
|
64245
64278
|
}
|
|
64279
|
+
if (options.managerScopedSelection && options.currentModel) {
|
|
64280
|
+
return {
|
|
64281
|
+
model: options.currentModel,
|
|
64282
|
+
thinkingLevel,
|
|
64283
|
+
fallbackMessage: `Manager workspace model ${options.currentModel.provider}/${options.currentModel.id} kept (session had ${provider}/${modelId}).`
|
|
64284
|
+
};
|
|
64285
|
+
}
|
|
64246
64286
|
const restored = restoreModelFromSession({
|
|
64247
64287
|
registry: options.registry,
|
|
64248
64288
|
savedProvider: provider,
|
|
@@ -73625,6 +73665,28 @@ function cliAttention(host) {
|
|
|
73625
73665
|
var STREAM_RENDER_MIN_INTERVAL_MS = 80;
|
|
73626
73666
|
var lastStreamRenderAt = 0;
|
|
73627
73667
|
var trailingStreamRenderTimer = null;
|
|
73668
|
+
var AUTO_SAVE_FAILURE_CAP = 16;
|
|
73669
|
+
var autoSaveFailureCounts = /* @__PURE__ */ new Map();
|
|
73670
|
+
function reportAutoSaveFailure(err) {
|
|
73671
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
73672
|
+
const seen = autoSaveFailureCounts.get(message) ?? 0;
|
|
73673
|
+
if (seen >= 3) return;
|
|
73674
|
+
if (autoSaveFailureCounts.size >= AUTO_SAVE_FAILURE_CAP && !autoSaveFailureCounts.has(message)) {
|
|
73675
|
+
const oldest = autoSaveFailureCounts.keys().next().value;
|
|
73676
|
+
if (oldest !== void 0) autoSaveFailureCounts.delete(oldest);
|
|
73677
|
+
}
|
|
73678
|
+
autoSaveFailureCounts.set(message, seen + 1);
|
|
73679
|
+
if (seen > 0) return;
|
|
73680
|
+
console.error("[Session] Auto-save failed:", err);
|
|
73681
|
+
if (/Entry id sequence conflict/.test(message)) {
|
|
73682
|
+
console.error(
|
|
73683
|
+
"[Session] The journal head moved under this process (another pie writing the same session, or a damaged head). Stop the other writer, then resume with --session-id."
|
|
73684
|
+
);
|
|
73685
|
+
}
|
|
73686
|
+
}
|
|
73687
|
+
function resetAutoSaveFailures() {
|
|
73688
|
+
autoSaveFailureCounts.clear();
|
|
73689
|
+
}
|
|
73628
73690
|
function requestStreamingRender(host) {
|
|
73629
73691
|
const now = Date.now();
|
|
73630
73692
|
if (now - lastStreamRenderAt >= STREAM_RENDER_MIN_INTERVAL_MS) {
|
|
@@ -73732,8 +73794,10 @@ function bindInteractiveRuntimeEvents(host) {
|
|
|
73732
73794
|
});
|
|
73733
73795
|
applyContextSignalsWithTrace(host);
|
|
73734
73796
|
host.safeRequestRender();
|
|
73735
|
-
host.sessionManager.save().
|
|
73736
|
-
|
|
73797
|
+
host.sessionManager.save().then(() => {
|
|
73798
|
+
resetAutoSaveFailures();
|
|
73799
|
+
}, (err) => {
|
|
73800
|
+
reportAutoSaveFailure(err);
|
|
73737
73801
|
host.logDebug("session:save:failed", { error: err instanceof Error ? err.message : String(err) });
|
|
73738
73802
|
});
|
|
73739
73803
|
break;
|
|
@@ -79361,7 +79425,7 @@ function setupInteractiveKeybindings(host) {
|
|
|
79361
79425
|
|
|
79362
79426
|
// src/clipboard/read-clipboard-image.ts
|
|
79363
79427
|
import { spawn as spawn4 } from "node:child_process";
|
|
79364
|
-
import { chmodSync, closeSync as closeSync2, existsSync as existsSync16, fchmodSync, mkdtempSync, openSync as openSync2, readFileSync as readFileSync17, rmdirSync, statSync as statSync12, unlinkSync as unlinkSync5, writeFileSync as
|
|
79428
|
+
import { chmodSync, closeSync as closeSync2, existsSync as existsSync16, fchmodSync, mkdtempSync, openSync as openSync2, readFileSync as readFileSync17, rmdirSync, statSync as statSync12, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "node:fs";
|
|
79365
79429
|
import { tmpdir } from "node:os";
|
|
79366
79430
|
import { join as join19 } from "node:path";
|
|
79367
79431
|
var MAX_IMAGE_BYTES = 50 * 1024 * 1024;
|
|
@@ -79670,7 +79734,7 @@ function writeImageBytes(bytes, declaredMime, mkTempPath) {
|
|
|
79670
79734
|
const mimeType = detectMimeFromMagic(bytes) ?? declaredMime;
|
|
79671
79735
|
const targetPath = mkTempPath(extensionForMime(mimeType));
|
|
79672
79736
|
try {
|
|
79673
|
-
|
|
79737
|
+
writeFileSync10(targetPath, bytes, { flag: "r+", mode: 384 });
|
|
79674
79738
|
} catch (err) {
|
|
79675
79739
|
return { ok: false, kind: "failed", message: `Failed to write temp image: ${errorMessage4(err)}` };
|
|
79676
79740
|
}
|
|
@@ -79741,7 +79805,7 @@ function formatBytes2(bytes) {
|
|
|
79741
79805
|
}
|
|
79742
79806
|
|
|
79743
79807
|
// src/input/image-paste.ts
|
|
79744
|
-
import { mkdtempSync as mkdtempSync2, writeFileSync as
|
|
79808
|
+
import { mkdtempSync as mkdtempSync2, writeFileSync as writeFileSync11, rmSync as rmSync4 } from "node:fs";
|
|
79745
79809
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
79746
79810
|
import { join as join20 } from "node:path";
|
|
79747
79811
|
var pastingHosts = /* @__PURE__ */ new WeakSet();
|
|
@@ -79770,14 +79834,14 @@ function terminalResultToClipboardResult(result) {
|
|
|
79770
79834
|
try {
|
|
79771
79835
|
dir = mkdtempSync2(join20(tmpdir2(), "pie-osc5522-"));
|
|
79772
79836
|
const path35 = join20(dir, formatPastedImageName(/* @__PURE__ */ new Date(), ext));
|
|
79773
|
-
|
|
79837
|
+
writeFileSync11(path35, result.bytes);
|
|
79774
79838
|
return {
|
|
79775
79839
|
ok: true,
|
|
79776
79840
|
path: path35,
|
|
79777
79841
|
mimeType: result.mimeType,
|
|
79778
79842
|
cleanup: () => {
|
|
79779
79843
|
try {
|
|
79780
|
-
|
|
79844
|
+
rmSync4(dir, { recursive: true, force: true });
|
|
79781
79845
|
} catch {
|
|
79782
79846
|
}
|
|
79783
79847
|
}
|
|
@@ -79785,7 +79849,7 @@ function terminalResultToClipboardResult(result) {
|
|
|
79785
79849
|
} catch (err) {
|
|
79786
79850
|
if (dir) {
|
|
79787
79851
|
try {
|
|
79788
|
-
|
|
79852
|
+
rmSync4(dir, { recursive: true, force: true });
|
|
79789
79853
|
} catch {
|
|
79790
79854
|
}
|
|
79791
79855
|
}
|
|
@@ -82421,12 +82485,19 @@ function beginUserInput(host, extensionIsCurrent = () => true) {
|
|
|
82421
82485
|
unsubscribe();
|
|
82422
82486
|
});
|
|
82423
82487
|
const isCurrent = () => !retired && host.sessionManager.getActiveSession() === session && host.agentSessionController === controller && host.extensionRunner === runner && host.attachmentMentionHandler?.() === handlerAtCapture && extensionIsCurrent();
|
|
82488
|
+
let lastRejectReason;
|
|
82424
82489
|
return {
|
|
82425
82490
|
isCurrent,
|
|
82426
82491
|
dispose,
|
|
82492
|
+
/** Reason string from the last terminal:input rejection, if the
|
|
82493
|
+
* rejecting extension provided one (cleared on each submit). */
|
|
82494
|
+
get lastRejectReason() {
|
|
82495
|
+
return lastRejectReason;
|
|
82496
|
+
},
|
|
82427
82497
|
async submit(text, files = []) {
|
|
82428
82498
|
if (used || !isCurrent() || !text.trim() && !files.length) return false;
|
|
82429
82499
|
used = true;
|
|
82500
|
+
lastRejectReason = void 0;
|
|
82430
82501
|
try {
|
|
82431
82502
|
const mentions = [];
|
|
82432
82503
|
for (const file of files) {
|
|
@@ -82438,7 +82509,11 @@ function beginUserInput(host, extensionIsCurrent = () => true) {
|
|
|
82438
82509
|
}
|
|
82439
82510
|
let content = [text.trim(), ...mentions].filter(Boolean).join("\n");
|
|
82440
82511
|
const decision = await runner.emitTerminalInput({ type: "terminal:input", text: content });
|
|
82441
|
-
if (!isCurrent() || decision.action === "consume"
|
|
82512
|
+
if (!isCurrent() || decision.action === "consume") return false;
|
|
82513
|
+
if (decision.action === "reject") {
|
|
82514
|
+
lastRejectReason = decision.reason;
|
|
82515
|
+
return false;
|
|
82516
|
+
}
|
|
82442
82517
|
if (decision.action === "transform") content = decision.text.trim();
|
|
82443
82518
|
if (!content || mentions.some((mention) => !content.includes(mention))) return false;
|
|
82444
82519
|
host.queueMessage(content, "followUp", { clearEditor: false, deliverWhileStreaming: false });
|
|
@@ -82512,6 +82587,30 @@ async function loadInteractiveExtensions(host) {
|
|
|
82512
82587
|
void host.refreshTodoWidget();
|
|
82513
82588
|
return next;
|
|
82514
82589
|
},
|
|
82590
|
+
// 4.3.9: TUI hosts accept ipc control frames. model.set runs the
|
|
82591
|
+
// host's CANONICAL switch path (identical to the /model command:
|
|
82592
|
+
// agent.setModel + options + footer + session metadata sync) — a
|
|
82593
|
+
// remote switch therefore persists through the ordinary autoSave,
|
|
82594
|
+
// closing the "external head.json surgery gets overwritten" hazard:
|
|
82595
|
+
// the file surgery is no longer needed. Structured refusals mirror
|
|
82596
|
+
// the json-events implementation.
|
|
82597
|
+
applyIpcControl: async (control, payload) => {
|
|
82598
|
+
if (control !== "model.set") return { ok: false, message: `unknown control: ${control}` };
|
|
82599
|
+
if (!host.switchModel) return { ok: false, message: "host does not expose a model switch path" };
|
|
82600
|
+
const ref = payload && typeof payload === "object" && "model" in payload ? String(payload.model) : void 0;
|
|
82601
|
+
if (!ref || !/^[^/\s]+\/[^/\s]+$/.test(ref)) return { ok: false, message: "model.set requires payload.model as 'provider/modelId'" };
|
|
82602
|
+
const provider = ref.slice(0, ref.indexOf("/"));
|
|
82603
|
+
const modelId = ref.slice(ref.indexOf("/") + 1);
|
|
82604
|
+
const model = host.options.modelRegistry.find(provider, modelId);
|
|
82605
|
+
if (!model) return { ok: false, message: `model "${ref}" not found` };
|
|
82606
|
+
if (!host.options.modelRegistry.getApiKey(model)) return { ok: false, message: `model "${ref}" has no API key configured` };
|
|
82607
|
+
try {
|
|
82608
|
+
await host.switchModel(ref);
|
|
82609
|
+
return { ok: true, message: `model set to ${ref}` };
|
|
82610
|
+
} catch (error) {
|
|
82611
|
+
return { ok: false, message: error instanceof Error ? error.message : String(error) };
|
|
82612
|
+
}
|
|
82613
|
+
},
|
|
82515
82614
|
cwd: process.cwd(),
|
|
82516
82615
|
get apiKey() {
|
|
82517
82616
|
return host.options.apiKey;
|
|
@@ -82556,6 +82655,13 @@ async function loadInteractiveExtensions(host) {
|
|
|
82556
82655
|
// Optional on purpose: hand-rolled test harnesses and older hosts may
|
|
82557
82656
|
// not implement it; falling back to the routing name keeps display sane.
|
|
82558
82657
|
getSessionDisplayName: () => host.sessionManager.getSessionDisplayName?.() ?? host.sessionManager.getSessionName?.(),
|
|
82658
|
+
// panel v2 (review P2-1): the LIVE model for the status heartbeat —
|
|
82659
|
+
// read from the host's current options on every call (never captured
|
|
82660
|
+
// at startup: /model and model.set controls change it at runtime).
|
|
82661
|
+
getCurrentModel: () => {
|
|
82662
|
+
const model = host.options.model;
|
|
82663
|
+
return model?.provider && model?.id ? `${model.provider}/${model.id}` : void 0;
|
|
82664
|
+
},
|
|
82559
82665
|
registerProvider: (name, config) => {
|
|
82560
82666
|
const unregister = host.options.modelRegistry.registerProvider(name, config);
|
|
82561
82667
|
host.noteRuntimeModeChanged("extension_register_provider");
|
|
@@ -83300,6 +83406,13 @@ var InteractiveMode = class {
|
|
|
83300
83406
|
async switchModel(fullModelId) {
|
|
83301
83407
|
return switchModel(this, fullModelId);
|
|
83302
83408
|
}
|
|
83409
|
+
/** 4.3.9: ipc control parity — applyIpcControl(model.set) on the TUI host
|
|
83410
|
+
* delegates here (the /model command's canonical path: agent + options +
|
|
83411
|
+
* footer + session metadata sync, so a remote switch persists through
|
|
83412
|
+
* the ordinary autoSave instead of being overwritten by it). */
|
|
83413
|
+
async switchModelForIpcControl(fullModelId) {
|
|
83414
|
+
return this.switchModel(fullModelId);
|
|
83415
|
+
}
|
|
83303
83416
|
showThinkingLevelSelector() {
|
|
83304
83417
|
return showThinkingLevelSelector(this);
|
|
83305
83418
|
}
|
|
@@ -83634,6 +83747,8 @@ async function composeCliRuntime(params) {
|
|
|
83634
83747
|
const sessionManager = createSessionManager({ sessionsDir: paths.sessionsDir });
|
|
83635
83748
|
let createdNewSession = false;
|
|
83636
83749
|
if (params.explicitSessionId) {
|
|
83750
|
+
const ref = settingsManager.getManagerScopedModelRef();
|
|
83751
|
+
const managerScopedSelection = !!ref && !!model && model.id === ref.modelId && normalizeProviderName(model.provider) === normalizeProviderName(ref.provider);
|
|
83637
83752
|
const sessionFileExists = params.requireExistingSession ? await sessionManager.hasSession(params.explicitSessionId) : false;
|
|
83638
83753
|
const loaded = await sessionManager.loadSession(params.explicitSessionId, {
|
|
83639
83754
|
warnIfMissing: params.warnIfExplicitSessionMissing
|
|
@@ -83651,7 +83766,8 @@ async function composeCliRuntime(params) {
|
|
|
83651
83766
|
const restored = restoreSessionModelState({
|
|
83652
83767
|
activeSession: sessionManager.getActiveSession(),
|
|
83653
83768
|
registry: modelRegistry,
|
|
83654
|
-
currentModel: model
|
|
83769
|
+
currentModel: model,
|
|
83770
|
+
managerScopedSelection
|
|
83655
83771
|
});
|
|
83656
83772
|
if (restored.model) {
|
|
83657
83773
|
model = restored.model;
|
|
@@ -84602,6 +84718,13 @@ async function loadJsonModeExtensions(params) {
|
|
|
84602
84718
|
},
|
|
84603
84719
|
getSessionName: () => params.runtime.sessionManager.getSessionName(),
|
|
84604
84720
|
getSessionDisplayName: () => params.runtime.sessionManager.getSessionDisplayName(),
|
|
84721
|
+
// panel v2 (4.3.13): the live active model for the status heartbeat —
|
|
84722
|
+
// provider/modelId, updated by model.set and the session's own /model.
|
|
84723
|
+
getCurrentModel: () => {
|
|
84724
|
+
const provider = params.runtime.provider;
|
|
84725
|
+
const modelId = params.runtime.modelId;
|
|
84726
|
+
return provider && modelId ? `${provider}/${modelId}` : void 0;
|
|
84727
|
+
},
|
|
84605
84728
|
getSessionMetadata: () => ({
|
|
84606
84729
|
...params.runtime.sessionManager.getActiveSession()?.metadata ?? {}
|
|
84607
84730
|
}),
|
|
@@ -86921,7 +87044,7 @@ async function main() {
|
|
|
86921
87044
|
return;
|
|
86922
87045
|
}
|
|
86923
87046
|
if (args[0] === STABLE_CLI_COMMANDS.manager) {
|
|
86924
|
-
const { runManagerCommand } = await import("./chunks/manager-cli-
|
|
87047
|
+
const { runManagerCommand } = await import("./chunks/manager-cli-4Z6RZ7F4.js");
|
|
86925
87048
|
try {
|
|
86926
87049
|
await runManagerCommand(args.slice(1));
|
|
86927
87050
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cydm/pie",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.12",
|
|
4
4
|
"description": "Pie AI Agent CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"test:skill-regressions": "node --test --test-force-exit --import tsx test/axi-bridge-lifecycle.test.ts test/bash-lifecycle.test.ts test/bash-powershell-display.test.ts test/skill-creator-runner.test.ts test/tui-use-contract.test.ts test/tui-use-runtime.test.ts test/tui-use-reap.test.ts test/tui-use-kill-escalation.test.ts test/browser-runtime.test.ts test/axi-stop-semantics.test.ts test/axi-page-routing.test.ts test/computer-use-axi.test.ts test/computer-evidence.test.ts test/interactive-lifecycle.test.ts",
|
|
21
21
|
"test:offline:post": "node --test --test-force-exit --import tsx test/remote-model-catalog.test.ts",
|
|
22
22
|
"test:offline": "node ../../scripts/run-cli-offline.mjs",
|
|
23
|
-
"test:offline:main": "node --test --test-concurrency=2 --test-force-exit --import tsx test/cli-attention.test.ts test/cron.test.ts test/cron-process.test.ts test/cron-poll-gate.test.ts test/memory-distill.test.ts test/memory-injection-freeze.test.ts test/memory-consumption-e2e.test.ts test/memory-frozen-matching.test.ts test/memory-soul-injection.test.ts test/config-dir-fail-closed.test.ts test/cron-concurrency.test.ts test/cron-dogfood.test.ts test/cron.terminal.test.ts test/cron-journey.terminal.test.ts test/builtin-extensions.test.ts test/im-forward.test.ts test/im-forward-cli.test.ts test/im-forward-integration.test.ts test/im-forward-dogfood.terminal.test.ts test/thread-registry.test.ts test/im-forward-event-hub.test.ts test/im-forward-session-anchors.test.ts test/extension-user-input.test.ts test/pie-ipc-pure.test.ts test/pie-ipc-discovery.test.ts test/pie-ipc-transport.test.ts test/pie-ipc-delivery.test.ts test/pie-ipc-extension.test.ts test/pie-ipc-e2e.test.ts test/pie-ipc-security.test.ts test/pie-ipc-dogfood.test.ts test/pie-ipc-resident-dispatch.test.ts test/pie-proc.test.ts test/pie-ipc-host.terminal.test.ts test/core-services.test.ts test/cli.test.ts test/cli-auto-compaction.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/todo-steering-ownership.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-provider.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/auto-compaction-ui.test.ts test/tool-compaction-dogfood.terminal.test.ts test/hierarchical-command-system.test.ts test/mcp-adapter.test.ts test/herdr-agent-state.test.ts test/extensions-enablement.test.ts test/extension-selector-shortcuts.test.ts test/skill-tool-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/json-events-event-sink.test.ts test/json-events-lifecycle-bridge.test.ts test/json-events-self-input.test.ts test/json-events-idle-mode.test.ts test/manager-cli.test.ts test/json-events-sidechat-diagnostics.test.ts test/json-events-prewarm-shutdown.test.ts test/json-envelope-composition.test.ts test/subagent-session-store.test.ts test/supervisor-anchor-inject.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/retry-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/footer-waiting-for-user.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/package-artifacts.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/skills-agents-discovery.test.ts test/skills-symlink.test.ts test/model-overrides.test.ts test/auth-storage.test.ts test/extension-register-provider.test.ts test/extension-reload.test.ts test/extension-terminal-input.test.ts test/extension-session-before-events.test.ts test/extension-widgets.test.ts test/extension-render-hint.test.ts test/extension-oauth-restore.test.ts test/cross-host-parity.test.ts test/tool-name-rendering.test.ts test/session-selector.test.ts test/tree-selector-pagination.test.ts test/context-report.test.ts test/context-signals.test.ts test/plan-cache-stability.test.ts test/cache-invalidation-trace.test.ts test/cache-retention.test.ts test/trace-report.test.ts test/boot-report.test.ts test/compaction-diff.test.ts test/entry-body-and-usage.test.ts test/session-control.test.ts test/terminal-title.test.ts test/interactive-controller-title.test.ts test/todo-title.terminal.test.ts test/host-envelope-dogfood.terminal.test.ts test/host-envelope-cross-mode.test.ts test/host-envelope-registry-lifecycle.test.ts test/host-envelope-migration-roundtrip.test.ts test/host-envelope-intake-order.test.ts test/plan-mode-extension.test.ts test/extension-interaction-signals.test.ts test/rendered-page-reader.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/bash-yolo.test.ts test/terminal-state-hygiene.test.ts test/terminal-mode-filter-families.test.ts test/manager-model-env.test.ts test/bash-mode-sequence-boundary.test.ts test/bash-contract.test.ts test/bash-confirm-pending.test.ts test/interaction-status-lifecycle.test.ts test/bash-process-group.test.ts test/bash-artifact-sink.test.ts test/direct-bash.test.ts test/terminal-bell.test.ts test/ctrl-d-exit.test.ts test/session-display-title.test.ts test/calm-mode.test.ts test/stream-render-throttle.test.ts test/assistant-message-performance.test.ts test/streaming-split-parity.test.ts test/message-display-resync.test.ts test/project-root.test.ts test/guard-advisory-context.test.ts test/clear-command-usage.test.ts test/daily-agent-smoke.terminal.test.ts test/slash-menu-toggles.terminal.test.ts test/cli-args.test.ts test/session-resume-cwd.test.ts test/session-resume-restart.test.ts test/session-resume-picker.test.ts test/extensions-configured-paths.test.ts test/extensions-loader-path.test.ts test/file-picker.test.ts test/interrupt-recovery.test.ts test/mention-insert-regression.test.ts test/image-paste.test.ts test/clipboard-read-image.test.ts test/clipboard-races.test.ts test/clipboard-dogfood.terminal.test.ts test/mention-picker-navigation.test.ts test/pie-unity-rpc-skill.test.ts test/skill-creator-scripts.test.ts test/interactive-compact-command.test.ts test/computer-use-broker.test.ts test/computer-use-review-regressions.test.ts test/computer-use-safety.test.ts ../../scripts/node-test-diagnostics.test.js ../../scripts/offline-test-runner.test.js ../../scripts/unity-consumer.test.mjs ../../scripts/owned-process-cleanup.test.mjs",
|
|
23
|
+
"test:offline:main": "node --test --test-concurrency=2 --test-force-exit --import tsx test/cli-attention.test.ts test/cron.test.ts test/cron-process.test.ts test/cron-poll-gate.test.ts test/memory-distill.test.ts test/memory-injection-budget.test.ts test/memory-injection-freeze.test.ts test/memory-consumption-e2e.test.ts test/memory-frozen-matching.test.ts test/memory-soul-injection.test.ts test/config-dir-fail-closed.test.ts test/cron-concurrency.test.ts test/cron-dogfood.test.ts test/cron.terminal.test.ts test/cron-journey.terminal.test.ts test/builtin-extensions.test.ts test/im-forward.test.ts test/im-forward-cli.test.ts test/im-forward-userassigned.test.ts test/im-forward-bus-health.test.ts test/im-forward-panel-fastpath.test.ts test/im-forward-consumer.test.ts test/im-forward-card-compiler.test.ts test/im-forward-integration.test.ts test/im-forward-dogfood.terminal.test.ts test/thread-registry.test.ts test/im-forward-event-hub.test.ts test/im-forward-session-anchors.test.ts test/extension-user-input.test.ts test/pie-ipc-pure.test.ts test/pie-ipc-resolve.test.ts test/pie-ipc-discovery.test.ts test/pie-ipc-transport.test.ts test/pie-ipc-delivery.test.ts test/pie-ipc-extension.test.ts test/pie-ipc-e2e.test.ts test/pie-ipc-security.test.ts test/pie-ipc-dogfood.test.ts test/pie-ipc-resident-dispatch.test.ts test/pie-proc.test.ts test/pie-ipc-host.terminal.test.ts test/core-services.test.ts test/cli.test.ts test/cli-auto-compaction.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/todo-steering-ownership.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-provider.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/auto-compaction-ui.test.ts test/tool-compaction-dogfood.terminal.test.ts test/hierarchical-command-system.test.ts test/mcp-adapter.test.ts test/herdr-agent-state.test.ts test/extensions-enablement.test.ts test/extension-selector-shortcuts.test.ts test/skill-tool-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/json-events-event-sink.test.ts test/json-events-lifecycle-bridge.test.ts test/json-events-self-input.test.ts test/json-events-idle-mode.test.ts test/manager-cli.test.ts test/json-events-sidechat-diagnostics.test.ts test/json-events-prewarm-shutdown.test.ts test/json-envelope-composition.test.ts test/subagent-session-store.test.ts test/subagent-resolution.test.ts test/supervisor-anchor-inject.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/retry-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/footer-waiting-for-user.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/package-artifacts.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/skills-agents-discovery.test.ts test/skills-symlink.test.ts test/model-overrides.test.ts test/auth-storage.test.ts test/extension-register-provider.test.ts test/extension-reload.test.ts test/extension-terminal-input.test.ts test/extension-session-before-events.test.ts test/extension-widgets.test.ts test/extension-render-hint.test.ts test/extension-oauth-restore.test.ts test/cross-host-parity.test.ts test/tool-name-rendering.test.ts test/session-selector.test.ts test/tree-selector-pagination.test.ts test/context-report.test.ts test/context-signals.test.ts test/plan-cache-stability.test.ts test/cache-invalidation-trace.test.ts test/cache-retention.test.ts test/trace-report.test.ts test/boot-report.test.ts test/compaction-diff.test.ts test/entry-body-and-usage.test.ts test/session-control.test.ts test/terminal-title.test.ts test/interactive-controller-title.test.ts test/todo-title.terminal.test.ts test/host-envelope-dogfood.terminal.test.ts test/host-envelope-cross-mode.test.ts test/host-envelope-registry-lifecycle.test.ts test/host-envelope-migration-roundtrip.test.ts test/host-envelope-intake-order.test.ts test/plan-mode-extension.test.ts test/extension-interaction-signals.test.ts test/rendered-page-reader.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/bash-yolo.test.ts test/terminal-state-hygiene.test.ts test/terminal-mode-filter-families.test.ts test/manager-model-env.test.ts test/bash-mode-sequence-boundary.test.ts test/bash-contract.test.ts test/bash-confirm-pending.test.ts test/interaction-status-lifecycle.test.ts test/bash-process-group.test.ts test/bash-artifact-sink.test.ts test/direct-bash.test.ts test/terminal-bell.test.ts test/ctrl-d-exit.test.ts test/session-display-title.test.ts test/calm-mode.test.ts test/stream-render-throttle.test.ts test/assistant-message-performance.test.ts test/streaming-split-parity.test.ts test/message-display-resync.test.ts test/project-root.test.ts test/guard-advisory-context.test.ts test/clear-command-usage.test.ts test/daily-agent-smoke.terminal.test.ts test/slash-menu-toggles.terminal.test.ts test/cli-args.test.ts test/session-resume-cwd.test.ts test/session-resume-restart.test.ts test/session-resume-picker.test.ts test/extensions-configured-paths.test.ts test/extensions-loader-path.test.ts test/file-picker.test.ts test/interrupt-recovery.test.ts test/mention-insert-regression.test.ts test/image-paste.test.ts test/clipboard-read-image.test.ts test/clipboard-races.test.ts test/clipboard-dogfood.terminal.test.ts test/mention-picker-navigation.test.ts test/pie-unity-rpc-skill.test.ts test/skill-creator-scripts.test.ts test/interactive-compact-command.test.ts test/computer-use-broker.test.ts test/computer-use-review-regressions.test.ts test/computer-use-safety.test.ts ../../scripts/node-test-diagnostics.test.js ../../scripts/offline-test-runner.test.js ../../scripts/unity-consumer.test.mjs ../../scripts/owned-process-cleanup.test.mjs",
|
|
24
24
|
"test:all": "npm run test:offline && npm run test:terminal:vitest",
|
|
25
25
|
"test:cron:tui": "node ../../scripts/run-with-env.mjs PIE_REAL_CRON_TUI=1 -- --test --import tsx test/cron.terminal.test.ts test/cron-journey.terminal.test.ts",
|
|
26
26
|
"test:ipc:tui": "node ../../scripts/run-with-env.mjs PIE_REAL_IPC_TUI=1 -- --test --import tsx test/pie-ipc-host.terminal.test.ts",
|