@cydm/pie 2.5.0 → 2.5.2
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 +3 -3
- package/dist/builtin/extensions/computer-use/index.js +17 -2
- package/dist/builtin/extensions/computer-use/prebuilt/macos/arm64/pie-computer-use +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/universal/pie-computer-use.app/Contents/MacOS/pie-computer-use +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/x64/pie-computer-use +0 -0
- package/dist/builtin/extensions/computer-use/scripts/setup-helper.mjs +90 -9
- package/dist/builtin/extensions/herdr-agent-state/index.js +39 -3
- package/dist/builtin/extensions/mcp-adapter/index.js +161 -35
- package/dist/builtin/extensions/plan-mode/index.js +3 -3
- package/dist/builtin/extensions/subagent/index.js +4 -4
- package/dist/builtin/extensions/todo/index.js +3 -3
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-bridge.js +5 -0
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-cli.js +5 -2
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-runtime.js +1 -1
- package/dist/builtin/skills/chrome-devtools-axi/{cli-P4VG6ZZG.js → cli-EJ5MQZNA.js} +76 -27
- package/dist/builtin/skills/tui-use/tui-use-cli.cjs +25 -9
- package/dist/builtin/skills/tui-use/tui-use-daemon.cjs +7 -1
- package/dist/chunks/{chunk-JXY3YLDS.js → chunk-LO2V5DZZ.js} +46 -9
- package/dist/chunks/{chunk-PU7IIEKH.js → chunk-M4OJARWJ.js} +25 -15
- package/dist/chunks/{chunk-ZKHMNEXL.js → chunk-RTTGO2A6.js} +1 -1
- package/dist/chunks/{chunk-YRXXRLMQ.js → chunk-UD7KYQ6J.js} +9 -0
- package/dist/chunks/{src-SXUQ7OY6.js → src-33WRCQWX.js} +2 -2
- package/dist/chunks/{test-stream-OD3B57AS.js → test-stream-LFR6GSKQ.js} +1 -1
- package/dist/cli.js +117 -20
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
createCliWebResearchHealthStore,
|
|
8
8
|
formatSize,
|
|
9
9
|
truncateHeadTail
|
|
10
|
-
} from "./chunks/chunk-
|
|
10
|
+
} from "./chunks/chunk-M4OJARWJ.js";
|
|
11
11
|
import {
|
|
12
12
|
AGENTS_CONTEXT_FILE_NAME,
|
|
13
13
|
AgentSessionController,
|
|
@@ -60,8 +60,8 @@ import {
|
|
|
60
60
|
setExtensionEnabledInSettings,
|
|
61
61
|
shouldPreserveExecutionStateForUserText,
|
|
62
62
|
supersedeExecutionState
|
|
63
|
-
} from "./chunks/chunk-
|
|
64
|
-
import "./chunks/chunk-
|
|
63
|
+
} from "./chunks/chunk-LO2V5DZZ.js";
|
|
64
|
+
import "./chunks/chunk-RTTGO2A6.js";
|
|
65
65
|
import {
|
|
66
66
|
Deref,
|
|
67
67
|
EMPTY_ASSISTANT_CONTENT_ERROR,
|
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
setLogger,
|
|
86
86
|
sortToolModelCandidatesByCapability,
|
|
87
87
|
type_exports
|
|
88
|
-
} from "./chunks/chunk-
|
|
88
|
+
} from "./chunks/chunk-UD7KYQ6J.js";
|
|
89
89
|
import {
|
|
90
90
|
VERSION,
|
|
91
91
|
getAgentDir,
|
|
@@ -55209,11 +55209,47 @@ function canonicalSessionDir(sessionsDir, sessionId) {
|
|
|
55209
55209
|
function publishJournalPath(sessionsDir, safeTargetId) {
|
|
55210
55210
|
return path7.join(sessionsDir, PUBLISH_JOURNAL_DIR, `${safeTargetId}.json`);
|
|
55211
55211
|
}
|
|
55212
|
+
var FSYNC_UNSUPPORTED_CODES = /* @__PURE__ */ new Set(["EPERM", "EINVAL", "ENOTSUP", "EOPNOTSUPP", "EACCES", "EBADF"]);
|
|
55213
|
+
var fsyncDirectoryFaultForTests = {};
|
|
55214
|
+
function fsyncDirectory(dirPath) {
|
|
55215
|
+
try {
|
|
55216
|
+
const injected = fsyncDirectoryFaultForTests.fault?.(dirPath);
|
|
55217
|
+
if (injected) throw injected;
|
|
55218
|
+
const fd = fs7.openSync(dirPath, "r");
|
|
55219
|
+
try {
|
|
55220
|
+
fs7.fsyncSync(fd);
|
|
55221
|
+
} finally {
|
|
55222
|
+
fs7.closeSync(fd);
|
|
55223
|
+
}
|
|
55224
|
+
} catch (error) {
|
|
55225
|
+
const code = error?.code;
|
|
55226
|
+
if (code !== void 0 && FSYNC_UNSUPPORTED_CODES.has(code)) return;
|
|
55227
|
+
throw error;
|
|
55228
|
+
}
|
|
55229
|
+
}
|
|
55212
55230
|
function writePublishJournal(journalPath, record) {
|
|
55213
|
-
|
|
55231
|
+
const journalDir = path7.dirname(journalPath);
|
|
55232
|
+
fs7.mkdirSync(journalDir, { recursive: true });
|
|
55214
55233
|
const tempPath = `${journalPath}.tmp`;
|
|
55215
55234
|
fs7.writeFileSync(tempPath, JSON.stringify(record, void 0, " "));
|
|
55235
|
+
const tempFd = fs7.openSync(tempPath, "r+");
|
|
55236
|
+
try {
|
|
55237
|
+
fs7.fsyncSync(tempFd);
|
|
55238
|
+
} finally {
|
|
55239
|
+
fs7.closeSync(tempFd);
|
|
55240
|
+
}
|
|
55216
55241
|
fs7.renameSync(tempPath, journalPath);
|
|
55242
|
+
fsyncDirectory(journalDir);
|
|
55243
|
+
fsyncDirectory(path7.dirname(journalDir));
|
|
55244
|
+
}
|
|
55245
|
+
function markPublishJournalFailed(journalPath) {
|
|
55246
|
+
if (!journalPath) return;
|
|
55247
|
+
try {
|
|
55248
|
+
const record = JSON.parse(fs7.readFileSync(journalPath, "utf8"));
|
|
55249
|
+
if (record?.v !== 1 || typeof record.failedAt === "number") return;
|
|
55250
|
+
writePublishJournal(journalPath, { ...record, failedAt: Date.now() });
|
|
55251
|
+
} catch {
|
|
55252
|
+
}
|
|
55217
55253
|
}
|
|
55218
55254
|
function clearPublishJournal(journalPath) {
|
|
55219
55255
|
if (!journalPath) return;
|
|
@@ -55266,6 +55302,7 @@ async function rewindStoredSession(params) {
|
|
|
55266
55302
|
}
|
|
55267
55303
|
async function forkStoredSession(params) {
|
|
55268
55304
|
let stagingId;
|
|
55305
|
+
let preserveStagingForRecovery = false;
|
|
55269
55306
|
try {
|
|
55270
55307
|
const sanitizedTargetId = params.targetSessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
55271
55308
|
if (sanitizedTargetId.startsWith(STAGING_SESSION_ID_PREFIX)) {
|
|
@@ -55400,9 +55437,21 @@ async function forkStoredSession(params) {
|
|
|
55400
55437
|
clearPublishJournal(journalPath);
|
|
55401
55438
|
throw error;
|
|
55402
55439
|
}
|
|
55440
|
+
try {
|
|
55441
|
+
if (params.sessionsDir) fsyncDirectory(params.sessionsDir);
|
|
55442
|
+
} catch (error) {
|
|
55443
|
+
markPublishJournalFailed(journalPath);
|
|
55444
|
+
preserveStagingForRecovery = true;
|
|
55445
|
+
throw new SessionControlError(
|
|
55446
|
+
"session_io_error",
|
|
55447
|
+
`Fork publish durability failure after moving the previous session aside; it is preserved as ${backupId} and startup recovery will restore it: ${String(error)}`,
|
|
55448
|
+
false
|
|
55449
|
+
);
|
|
55450
|
+
}
|
|
55403
55451
|
}
|
|
55404
55452
|
try {
|
|
55405
55453
|
params.store.moveSession(stagingId, params.targetSessionId);
|
|
55454
|
+
if (params.sessionsDir) fsyncDirectory(params.sessionsDir);
|
|
55406
55455
|
} catch (error) {
|
|
55407
55456
|
if (hadPreviousTarget) {
|
|
55408
55457
|
try {
|
|
@@ -55410,8 +55459,11 @@ async function forkStoredSession(params) {
|
|
|
55410
55459
|
throw new Error("target path is occupied");
|
|
55411
55460
|
}
|
|
55412
55461
|
params.store.moveSession(backupId, params.targetSessionId);
|
|
55462
|
+
if (params.sessionsDir) fsyncDirectory(params.sessionsDir);
|
|
55413
55463
|
clearPublishJournal(journalPath);
|
|
55414
55464
|
} catch (restoreError) {
|
|
55465
|
+
markPublishJournalFailed(journalPath);
|
|
55466
|
+
preserveStagingForRecovery = true;
|
|
55415
55467
|
throw new SessionControlError(
|
|
55416
55468
|
"session_io_error",
|
|
55417
55469
|
`Fork publication failed; previous session is preserved as ${backupId}. Restore failed: ${String(restoreError)}`,
|
|
@@ -55446,7 +55498,7 @@ async function forkStoredSession(params) {
|
|
|
55446
55498
|
} catch (error) {
|
|
55447
55499
|
throw toIoError(error);
|
|
55448
55500
|
} finally {
|
|
55449
|
-
if (stagingId) {
|
|
55501
|
+
if (stagingId && !preserveStagingForRecovery) {
|
|
55450
55502
|
try {
|
|
55451
55503
|
params.store.delete(stagingId);
|
|
55452
55504
|
} catch {
|
|
@@ -55519,7 +55571,7 @@ function recoverOnePublishJournal(params) {
|
|
|
55519
55571
|
try {
|
|
55520
55572
|
const parsed = JSON.parse(fs7.readFileSync(params.journalPath, "utf8"));
|
|
55521
55573
|
const safeId = /^[a-zA-Z0-9_-]+$/;
|
|
55522
|
-
if (parsed?.v !== 1 || !safeId.test(parsed.targetId ?? "") || !safeId.test(parsed.stagingId ?? "") || !((parsed.backupDir ?? null) === null || safeId.test(parsed.backupDir))) {
|
|
55574
|
+
if (parsed?.v !== 1 || !safeId.test(parsed.targetId ?? "") || !safeId.test(parsed.stagingId ?? "") || !((parsed.backupDir ?? null) === null || safeId.test(parsed.backupDir)) || !((parsed.failedAt ?? void 0) === void 0 || typeof parsed.failedAt === "number")) {
|
|
55523
55575
|
throw new Error("journal record has unexpected shape");
|
|
55524
55576
|
}
|
|
55525
55577
|
record = parsed;
|
|
@@ -55545,7 +55597,7 @@ function recoverOnePublishJournal(params) {
|
|
|
55545
55597
|
const backupExists = record.backupDir ? dirExists(record.backupDir) : false;
|
|
55546
55598
|
const stagingExists = dirExists(record.stagingId);
|
|
55547
55599
|
try {
|
|
55548
|
-
if (targetExists && !stagingExists) {
|
|
55600
|
+
if (targetExists && !stagingExists && record.failedAt === void 0) {
|
|
55549
55601
|
if (backupExists && record.backupDir) removeSessionDir(record.backupDir);
|
|
55550
55602
|
removeJournal();
|
|
55551
55603
|
return { action: "publish-completed", targetId: record.targetId };
|
|
@@ -55555,22 +55607,32 @@ function recoverOnePublishJournal(params) {
|
|
|
55555
55607
|
path7.join(params.sessionsDir, record.backupDir),
|
|
55556
55608
|
path7.join(params.sessionsDir, record.targetId)
|
|
55557
55609
|
);
|
|
55558
|
-
|
|
55610
|
+
fsyncDirectory(params.sessionsDir);
|
|
55559
55611
|
if (stagingExists) {
|
|
55560
55612
|
try {
|
|
55561
55613
|
removeSessionDir(record.stagingId);
|
|
55562
55614
|
} catch (error) {
|
|
55563
55615
|
warn(`[session-control] Restored ${record.targetId} but could not remove its abandoned staging copy ${record.stagingId}: ${String(error)}`);
|
|
55616
|
+
return { action: "ambiguous-preserved", targetId: record.targetId, message: `Staging cleanup failed after restore; journal preserved: ${String(error)}` };
|
|
55564
55617
|
}
|
|
55565
55618
|
}
|
|
55619
|
+
removeJournal();
|
|
55566
55620
|
return { action: "restored-previous-target", targetId: record.targetId };
|
|
55567
55621
|
}
|
|
55568
55622
|
if (!targetExists && !backupExists) {
|
|
55569
|
-
if (stagingExists)
|
|
55623
|
+
if (stagingExists) {
|
|
55624
|
+
try {
|
|
55625
|
+
removeSessionDir(record.stagingId);
|
|
55626
|
+
} catch (error) {
|
|
55627
|
+
warn(`[session-control] Could not remove abandoned staging copy ${record.stagingId}: ${String(error)}`);
|
|
55628
|
+
return { action: "ambiguous-preserved", targetId: record.targetId, message: `Staging cleanup failed; journal preserved: ${String(error)}` };
|
|
55629
|
+
}
|
|
55630
|
+
}
|
|
55570
55631
|
removeJournal();
|
|
55571
55632
|
return stagingExists ? { action: "discarded-incomplete-fork", targetId: record.targetId } : { action: "nothing-to-recover", targetId: record.targetId };
|
|
55572
55633
|
}
|
|
55573
|
-
const
|
|
55634
|
+
const reason = record.failedAt !== void 0 ? "the publish failed in-process (restore failed) and the backup was preserved" : `target=${targetExists}, backup=${backupExists}, staging=${stagingExists}`;
|
|
55635
|
+
const message = `[session-control] Ambiguous interrupted publish for target ${record.targetId} (${reason}); nothing was deleted \u2014 inspect ${params.sessionsDir} and ${journalName} manually`;
|
|
55574
55636
|
warn(message);
|
|
55575
55637
|
return { action: "ambiguous-preserved", targetId: record.targetId, message };
|
|
55576
55638
|
} catch (error) {
|
|
@@ -70088,22 +70150,40 @@ var SettingsSelectorComponent = class extends Container {
|
|
|
70088
70150
|
};
|
|
70089
70151
|
|
|
70090
70152
|
// src/core/session-display.ts
|
|
70153
|
+
function looksAutoGeneratedSessionName(name) {
|
|
70154
|
+
return /^Session (\d|[a-z0-9]{6,8}$)/i.test(name.trim());
|
|
70155
|
+
}
|
|
70156
|
+
function persistedNameIsAuthoritative(metadata) {
|
|
70157
|
+
if (metadata.nameSource === "derived") return true;
|
|
70158
|
+
if (metadata.nameSource === void 0) return !looksAutoGeneratedSessionName(metadata.name);
|
|
70159
|
+
return false;
|
|
70160
|
+
}
|
|
70091
70161
|
function deriveSessionTitle(options) {
|
|
70092
70162
|
const { activeSession, messages } = options;
|
|
70093
70163
|
if (!activeSession) {
|
|
70094
70164
|
return "No session";
|
|
70095
70165
|
}
|
|
70166
|
+
if (activeSession.metadata.nameSource === "manual") {
|
|
70167
|
+
const manual = normalizeSessionTitle(activeSession.metadata.name);
|
|
70168
|
+
if (manual) return manual;
|
|
70169
|
+
}
|
|
70170
|
+
if (persistedNameIsAuthoritative(activeSession.metadata)) {
|
|
70171
|
+
const persisted = normalizeSessionTitle(activeSession.metadata.name);
|
|
70172
|
+
if (persisted) return persisted;
|
|
70173
|
+
}
|
|
70096
70174
|
for (const msg of messages) {
|
|
70097
70175
|
if (msg.role !== "user") continue;
|
|
70098
70176
|
const text = extractUserText(msg);
|
|
70099
70177
|
if (isCompactSummaryMessage(text.trimStart())) continue;
|
|
70100
70178
|
const normalized = normalizeSessionTitle(text);
|
|
70101
70179
|
if (normalized) {
|
|
70180
|
+
activeSession.metadata.name = normalized;
|
|
70181
|
+
activeSession.metadata.nameSource = "derived";
|
|
70102
70182
|
return normalized;
|
|
70103
70183
|
}
|
|
70104
70184
|
}
|
|
70105
70185
|
const metadataName = normalizeSessionTitle(activeSession.metadata.name);
|
|
70106
|
-
if (metadataName &&
|
|
70186
|
+
if (metadataName && persistedNameIsAuthoritative(activeSession.metadata)) {
|
|
70107
70187
|
return metadataName;
|
|
70108
70188
|
}
|
|
70109
70189
|
return `S:${activeSession.id.slice(-6)}`;
|
|
@@ -77045,7 +77125,9 @@ function updatePendingMessagesDisplay(host) {
|
|
|
77045
77125
|
host.pendingMessagesContainer.addChild(new Text(text, 1, 0));
|
|
77046
77126
|
}
|
|
77047
77127
|
const dequeueHint = host.keybindings.getKeys("dequeue")[0] || "alt+up";
|
|
77048
|
-
const
|
|
77128
|
+
const steerHint = host.keybindings.getKeys("steer")[0];
|
|
77129
|
+
const promotionHint = followUpMessages.length > 0 && !followUpMessages[followUpMessages.length - 1].deliveredToAgent && steerHint ? `${steerHint} with empty editor: steer latest follow-up \xB7 ` : "";
|
|
77130
|
+
const hintText = theme.fg("dim", `\u21B3 ${promotionHint}${dequeueHint}: edit all queued messages`);
|
|
77049
77131
|
host.pendingMessagesContainer.addChild(new Text(hintText, 1, 0));
|
|
77050
77132
|
}
|
|
77051
77133
|
function dequeueMessages(host) {
|
|
@@ -77101,7 +77183,7 @@ function queueMessage(host, text, mode, options = {}) {
|
|
|
77101
77183
|
}
|
|
77102
77184
|
updatePendingMessagesDisplay(host);
|
|
77103
77185
|
host.showStatus(
|
|
77104
|
-
options.statusMessage ||
|
|
77186
|
+
options.statusMessage || (mode === "steer" ? "Queued message for steering" : `Queued for follow-up after the current task.${host.keybindings.getKeys("steer")[0] ? ` With empty editor, press ${host.keybindings.getKeys("steer")[0]} to steer the current task instead.` : ""}`)
|
|
77105
77187
|
);
|
|
77106
77188
|
host.ui.requestRender();
|
|
77107
77189
|
}
|
|
@@ -77120,7 +77202,22 @@ function handleFollowUp(host) {
|
|
|
77120
77202
|
}
|
|
77121
77203
|
function handleSteer(host) {
|
|
77122
77204
|
const text = host.editor.getText().trim();
|
|
77123
|
-
if (!text)
|
|
77205
|
+
if (!text) {
|
|
77206
|
+
const promoted = host.agentSessionController?.promoteLatestFollowUpToSteer();
|
|
77207
|
+
if (!promoted) {
|
|
77208
|
+
host.showStatus("No waiting follow-up to steer (it may already be processing)");
|
|
77209
|
+
return;
|
|
77210
|
+
}
|
|
77211
|
+
if (host.executionState.applyUserTextLifecycle(promoted.displayText)) {
|
|
77212
|
+
host.persistExecutionState();
|
|
77213
|
+
void host.refreshTodoWidget();
|
|
77214
|
+
}
|
|
77215
|
+
host.logDebug("queue:promote", { id: promoted.id, mode: promoted.mode });
|
|
77216
|
+
updatePendingMessagesDisplay(host);
|
|
77217
|
+
host.showStatus("Latest follow-up changed to steer; it will guide the current task at the next message boundary");
|
|
77218
|
+
host.ui.requestRender();
|
|
77219
|
+
return;
|
|
77220
|
+
}
|
|
77124
77221
|
if (isCommandLikeInput(text)) {
|
|
77125
77222
|
host.editor.onSubmit?.(text);
|
|
77126
77223
|
return;
|
|
@@ -79937,7 +80034,7 @@ var InteractiveMode = class {
|
|
|
79937
80034
|
async init() {
|
|
79938
80035
|
const activeSession = this.sessionManager.getActiveSession();
|
|
79939
80036
|
this.thinkingLevel = resolveInitialThinkingLevel({ session: activeSession, settingsManager: this.options.settingsManager });
|
|
79940
|
-
const { Agent } = await import("./chunks/src-
|
|
80037
|
+
const { Agent } = await import("./chunks/src-33WRCQWX.js");
|
|
79941
80038
|
this.agent = new Agent({
|
|
79942
80039
|
initialState: {
|
|
79943
80040
|
systemPrompt: this.buildSystemPrompt(),
|
|
@@ -80771,7 +80868,7 @@ async function runPrintMode(params) {
|
|
|
80771
80868
|
`);
|
|
80772
80869
|
console.log("Assistant: ");
|
|
80773
80870
|
}
|
|
80774
|
-
const { Agent: AgentClass } = await import("./chunks/src-
|
|
80871
|
+
const { Agent: AgentClass } = await import("./chunks/src-33WRCQWX.js");
|
|
80775
80872
|
let agent;
|
|
80776
80873
|
const printModeExtensions = await loadPrintModeExtensions({
|
|
80777
80874
|
cwd: runtime.cwd,
|
|
@@ -81632,7 +81729,7 @@ async function runJsonEventsMode(params) {
|
|
|
81632
81729
|
return;
|
|
81633
81730
|
}
|
|
81634
81731
|
const parent = agent;
|
|
81635
|
-
const { Agent: AgentClass } = await import("./chunks/src-
|
|
81732
|
+
const { Agent: AgentClass } = await import("./chunks/src-33WRCQWX.js");
|
|
81636
81733
|
const sideAgent = new AgentClass({
|
|
81637
81734
|
initialState: {
|
|
81638
81735
|
systemPrompt: parent.state.systemPrompt,
|
|
@@ -81976,7 +82073,7 @@ async function runJsonEventsMode(params) {
|
|
|
81976
82073
|
if (runtime.initialModel.unconfigured || controller) {
|
|
81977
82074
|
return;
|
|
81978
82075
|
}
|
|
81979
|
-
const { Agent: AgentClass } = await import("./chunks/src-
|
|
82076
|
+
const { Agent: AgentClass } = await import("./chunks/src-33WRCQWX.js");
|
|
81980
82077
|
const jsonModeExtensions = await loadJsonModeExtensions({ runtime, getAgent: () => agent });
|
|
81981
82078
|
extensionRunner = jsonModeExtensions.runner;
|
|
81982
82079
|
const tools = [...runtime.tools, ...jsonModeExtensions.extensionTools];
|
|
@@ -82565,7 +82662,7 @@ async function runWithJsonEventsConsoleIsolation(fn) {
|
|
|
82565
82662
|
}
|
|
82566
82663
|
async function createCliTestStreamFnFromEnv() {
|
|
82567
82664
|
if (!process.env.PIE_TEST_MOCK_STREAM_SEQUENCE) return void 0;
|
|
82568
|
-
return (await import("./chunks/test-stream-
|
|
82665
|
+
return (await import("./chunks/test-stream-LFR6GSKQ.js")).createTestStreamFnFromSequenceEnv();
|
|
82569
82666
|
}
|
|
82570
82667
|
function resolveJsonEventsDetailFlag() {
|
|
82571
82668
|
for (let index = 0; index < process.argv.length; index += 1) {
|