@cydm/pie 1.0.43 → 1.0.45
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/init/index.js +1 -1
- 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/chunks/{chunk-VYAW6RAX.js → chunk-75JWZPRK.js} +2 -2
- package/dist/chunks/{chunk-JVLAKTAS.js → chunk-FKAO25XH.js} +1 -1
- package/dist/chunks/{chunk-NGQ3PUOC.js → chunk-K6ZOCJ4V.js} +39 -15
- package/dist/chunks/{chunk-2GVFMYIV.js → chunk-PKR3PO73.js} +10 -3
- package/dist/chunks/{chunk-NTYHFBUA.js → chunk-WLFOBECN.js} +6 -1
- package/dist/chunks/{src-TQNFXZGK.js → src-HYZFAW4V.js} +2 -2
- package/dist/chunks/{test-stream-IPBFEEWH.js → test-stream-XCE2KXJU.js} +1 -1
- package/dist/cli.js +92 -114
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createAskUserCapability
|
|
4
|
-
} from "../../../chunks/chunk-
|
|
5
|
-
import "../../../chunks/chunk-
|
|
6
|
-
import "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-PKR3PO73.js";
|
|
5
|
+
import "../../../chunks/chunk-FKAO25XH.js";
|
|
6
|
+
import "../../../chunks/chunk-K6ZOCJ4V.js";
|
|
7
7
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
8
8
|
|
|
9
9
|
// builtin/extensions/ask-user/index.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
resolveCliProjectRoot
|
|
4
|
-
} from "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-WLFOBECN.js";
|
|
5
5
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
6
6
|
|
|
7
7
|
// builtin/extensions/init/index.ts
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
isPlanModeSafeCommand,
|
|
8
8
|
markCompletedPlanSteps,
|
|
9
9
|
restoreExecutionState
|
|
10
|
-
} from "../../../chunks/chunk-
|
|
11
|
-
import "../../../chunks/chunk-
|
|
10
|
+
} from "../../../chunks/chunk-PKR3PO73.js";
|
|
11
|
+
import "../../../chunks/chunk-FKAO25XH.js";
|
|
12
12
|
import {
|
|
13
13
|
Type
|
|
14
|
-
} from "../../../chunks/chunk-
|
|
14
|
+
} from "../../../chunks/chunk-K6ZOCJ4V.js";
|
|
15
15
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
16
16
|
|
|
17
17
|
// builtin/extensions/plan-mode/index.ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createCliHostCapabilities
|
|
4
|
-
} from "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-75JWZPRK.js";
|
|
5
5
|
import {
|
|
6
6
|
createSharedFileSystemTools,
|
|
7
7
|
createSubagentCapability
|
|
8
|
-
} from "../../../chunks/chunk-
|
|
9
|
-
import "../../../chunks/chunk-
|
|
10
|
-
import "../../../chunks/chunk-
|
|
8
|
+
} from "../../../chunks/chunk-PKR3PO73.js";
|
|
9
|
+
import "../../../chunks/chunk-FKAO25XH.js";
|
|
10
|
+
import "../../../chunks/chunk-K6ZOCJ4V.js";
|
|
11
11
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
12
12
|
|
|
13
13
|
// builtin/extensions/subagent/index.ts
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
executeManageTodoList,
|
|
8
8
|
executionStateToTodos,
|
|
9
9
|
restoreExecutionState
|
|
10
|
-
} from "../../../chunks/chunk-
|
|
11
|
-
import "../../../chunks/chunk-
|
|
12
|
-
import "../../../chunks/chunk-
|
|
10
|
+
} from "../../../chunks/chunk-PKR3PO73.js";
|
|
11
|
+
import "../../../chunks/chunk-FKAO25XH.js";
|
|
12
|
+
import "../../../chunks/chunk-K6ZOCJ4V.js";
|
|
13
13
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
14
14
|
|
|
15
15
|
// builtin/extensions/todo/index.ts
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
createSharedWebSearchTool,
|
|
9
9
|
interpretShellExit,
|
|
10
10
|
requestInteraction
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PKR3PO73.js";
|
|
12
12
|
import {
|
|
13
13
|
Type
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-K6ZOCJ4V.js";
|
|
15
15
|
|
|
16
16
|
// src/config.ts
|
|
17
17
|
import { existsSync, mkdirSync, readFileSync, renameSync } from "fs";
|
|
@@ -4238,9 +4238,10 @@ var NodeHttpClient = class {
|
|
|
4238
4238
|
async request(url, options = {}) {
|
|
4239
4239
|
const requestStartTime = Date.now();
|
|
4240
4240
|
const requestId = `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
|
|
4241
|
+
const reqTag = options.label ? `${requestId}/${options.label}` : requestId;
|
|
4241
4242
|
const requestTimeoutMs = options.timeoutMs ?? 6e4;
|
|
4242
4243
|
let requestTimeoutError;
|
|
4243
|
-
logHttp("DEBUG", `Request [${
|
|
4244
|
+
logHttp("DEBUG", `Request [${reqTag}] started`, {
|
|
4244
4245
|
url: url.slice(0, 100),
|
|
4245
4246
|
method: options.method || "GET",
|
|
4246
4247
|
hasBody: !!options.body
|
|
@@ -4278,7 +4279,7 @@ var NodeHttpClient = class {
|
|
|
4278
4279
|
agentStats.httpReusedConnections++;
|
|
4279
4280
|
}
|
|
4280
4281
|
}
|
|
4281
|
-
logHttp("DEBUG", `Request [${
|
|
4282
|
+
logHttp("DEBUG", `Request [${reqTag}] connected`, {
|
|
4282
4283
|
status: res.statusCode,
|
|
4283
4284
|
connectTimeMs: connectTime,
|
|
4284
4285
|
connectionReused: wasReused,
|
|
@@ -4301,14 +4302,14 @@ var NodeHttpClient = class {
|
|
|
4301
4302
|
res.on("data", (chunk) => chunks.push(chunk));
|
|
4302
4303
|
res.on("end", () => {
|
|
4303
4304
|
const body = Buffer.concat(chunks).toString("utf-8");
|
|
4304
|
-
logHttp("DEBUG", `Request [${
|
|
4305
|
+
logHttp("DEBUG", `Request [${reqTag}] body received`, {
|
|
4305
4306
|
bodyLength: body.length,
|
|
4306
4307
|
totalTimeMs: Date.now() - requestStartTime
|
|
4307
4308
|
});
|
|
4308
4309
|
resolveText(body);
|
|
4309
4310
|
});
|
|
4310
4311
|
res.on("error", (err) => {
|
|
4311
|
-
logHttp("ERROR", `Request [${
|
|
4312
|
+
logHttp("ERROR", `Request [${reqTag}] body read error`, { error: err.message });
|
|
4312
4313
|
rejectText(err);
|
|
4313
4314
|
});
|
|
4314
4315
|
});
|
|
@@ -4318,7 +4319,7 @@ var NodeHttpClient = class {
|
|
|
4318
4319
|
try {
|
|
4319
4320
|
return JSON.parse(text);
|
|
4320
4321
|
} catch (err) {
|
|
4321
|
-
logHttp("ERROR", `Request [${
|
|
4322
|
+
logHttp("ERROR", `Request [${reqTag}] JSON parse error`, {
|
|
4322
4323
|
error: err.message,
|
|
4323
4324
|
textPreview: text.slice(0, 200)
|
|
4324
4325
|
});
|
|
@@ -4351,7 +4352,15 @@ var NodeHttpClient = class {
|
|
|
4351
4352
|
error = e;
|
|
4352
4353
|
done = true;
|
|
4353
4354
|
wake({ done: true, value: void 0 });
|
|
4354
|
-
|
|
4355
|
+
if (signal?.aborted === true || isAbortErrorMessage(e.message)) {
|
|
4356
|
+
logHttp("INFO", `Request [${reqTag}] SSE stream aborted by caller`, { error: e.message });
|
|
4357
|
+
} else if (requestTimeoutError) {
|
|
4358
|
+
logHttp("WARN", `Request [${reqTag}] SSE stream failed (request timeout)`, { error: e.message });
|
|
4359
|
+
} else if (e.message === "SSE stream aborted" || e.message === "SSE stream closed before end" || e.message === "SSE stream ended before response completed") {
|
|
4360
|
+
logHttp("WARN", `Request [${reqTag}] SSE stream closed by remote`, { error: e.message });
|
|
4361
|
+
} else {
|
|
4362
|
+
logHttp("ERROR", `Request [${reqTag}] SSE stream error`, { error: e.message });
|
|
4363
|
+
}
|
|
4355
4364
|
};
|
|
4356
4365
|
const flushBuffer = (final = false) => {
|
|
4357
4366
|
if (final) {
|
|
@@ -4403,7 +4412,7 @@ var NodeHttpClient = class {
|
|
|
4403
4412
|
}
|
|
4404
4413
|
done = true;
|
|
4405
4414
|
wake({ done: true, value: void 0 });
|
|
4406
|
-
logHttp("DEBUG", `Request [${
|
|
4415
|
+
logHttp("DEBUG", `Request [${reqTag}] SSE stream ended`, {
|
|
4407
4416
|
totalBytes,
|
|
4408
4417
|
lineCount,
|
|
4409
4418
|
durationMs: Date.now() - sseStartTime
|
|
@@ -4454,13 +4463,13 @@ var NodeHttpClient = class {
|
|
|
4454
4463
|
});
|
|
4455
4464
|
req.on("error", (e) => {
|
|
4456
4465
|
if (isAbortErrorMessage(e.message) && options.signal?.aborted) {
|
|
4457
|
-
logHttp("DEBUG", `Request [${
|
|
4466
|
+
logHttp("DEBUG", `Request [${reqTag}] aborted`, {
|
|
4458
4467
|
totalTimeMs: Date.now() - requestStartTime
|
|
4459
4468
|
});
|
|
4460
4469
|
reject(e);
|
|
4461
4470
|
return;
|
|
4462
4471
|
}
|
|
4463
|
-
logHttp("ERROR", `Request [${
|
|
4472
|
+
logHttp("ERROR", `Request [${reqTag}] failed`, {
|
|
4464
4473
|
error: e.message,
|
|
4465
4474
|
totalTimeMs: Date.now() - requestStartTime
|
|
4466
4475
|
});
|
|
@@ -4468,13 +4477,13 @@ var NodeHttpClient = class {
|
|
|
4468
4477
|
});
|
|
4469
4478
|
req.on("timeout", () => {
|
|
4470
4479
|
requestTimeoutError = new Error("Request timeout");
|
|
4471
|
-
logHttp("ERROR", `Request [${
|
|
4480
|
+
logHttp("ERROR", `Request [${reqTag}] timeout`);
|
|
4472
4481
|
req.destroy(requestTimeoutError);
|
|
4473
4482
|
});
|
|
4474
4483
|
req.setTimeout(requestTimeoutMs);
|
|
4475
4484
|
if (options.signal) {
|
|
4476
4485
|
options.signal.addEventListener("abort", () => {
|
|
4477
|
-
logHttp("DEBUG", `Request [${
|
|
4486
|
+
logHttp("DEBUG", `Request [${reqTag}] aborted`);
|
|
4478
4487
|
req.destroy(new Error("Request was aborted"));
|
|
4479
4488
|
}, { once: true });
|
|
4480
4489
|
}
|
|
@@ -5723,7 +5732,9 @@ var streamOpenAICompletions = (model, context, options) => {
|
|
|
5723
5732
|
headers,
|
|
5724
5733
|
body: JSON.stringify(params),
|
|
5725
5734
|
signal: options?.signal,
|
|
5726
|
-
timeoutMs: options?.timeoutMs ?? getOpenAICompatStreamTimeoutMs()
|
|
5735
|
+
timeoutMs: options?.timeoutMs ?? getOpenAICompatStreamTimeoutMs(),
|
|
5736
|
+
// Log attribution only (never sent over the wire).
|
|
5737
|
+
label: `${model.provider}/${model.id}`
|
|
5727
5738
|
});
|
|
5728
5739
|
if (!response.ok) {
|
|
5729
5740
|
const errorBody = await response.text().catch(() => "");
|
|
@@ -5993,11 +6004,24 @@ var streamOpenAICompletions = (model, context, options) => {
|
|
|
5993
6004
|
throw createProtocolError(`OpenAI-compatible stream ended with finish_reason=${rawFinishReason} but did not include any tool calls.`);
|
|
5994
6005
|
}
|
|
5995
6006
|
if (output.stopReason === "length" && toolCallEntries.length > 0) {
|
|
5996
|
-
const
|
|
6007
|
+
const truncatedEntries = toolCallEntries.filter(
|
|
5997
6008
|
({ partialArgs }) => tryParseFinalToolArguments(partialArgs) === null
|
|
5998
6009
|
);
|
|
5999
|
-
if (
|
|
6000
|
-
|
|
6010
|
+
if (truncatedEntries.length > 0) {
|
|
6011
|
+
const truncatedBlocks = new Set(truncatedEntries.map((entry) => entry.block));
|
|
6012
|
+
for (let i = toolCallEntries.length - 1; i >= 0; i--) {
|
|
6013
|
+
if (truncatedBlocks.has(toolCallEntries[i].block)) {
|
|
6014
|
+
toolCallEntries.splice(i, 1);
|
|
6015
|
+
}
|
|
6016
|
+
}
|
|
6017
|
+
output.content = output.content.filter(
|
|
6018
|
+
(block) => block.type !== "toolCall" || !truncatedBlocks.has(block)
|
|
6019
|
+
);
|
|
6020
|
+
const dropped = truncatedEntries.map((entry) => entry.block.name || "unnamed").sort().map((name) => `"${name}"`).join(", ");
|
|
6021
|
+
output.content.push({
|
|
6022
|
+
type: "text",
|
|
6023
|
+
text: `[output truncated: finish_reason=length cut ${truncatedEntries.length === 1 ? "a tool call" : `${truncatedEntries.length} tool calls`} mid-arguments (${dropped}); the call${truncatedEntries.length === 1 ? " was" : "s were"} dropped. Re-issue the call or continue with fewer/smaller requests.]`
|
|
6024
|
+
});
|
|
6001
6025
|
}
|
|
6002
6026
|
}
|
|
6003
6027
|
for (const { block, partialArgs, contentIndex } of toolCallEntries) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
Agent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FKAO25XH.js";
|
|
5
5
|
import {
|
|
6
6
|
FileSystemGateway,
|
|
7
7
|
Type,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getPlatformConfig,
|
|
12
12
|
hashText,
|
|
13
13
|
streamSimple
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-K6ZOCJ4V.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__toESM
|
|
@@ -1286,6 +1286,7 @@ function formatSkillSummariesForPrompt(skills) {
|
|
|
1286
1286
|
const lines = [
|
|
1287
1287
|
"\n\nThe following skills provide specialized instructions for specific tasks.",
|
|
1288
1288
|
"Use read_file to load a skill's entry file when the task matches its description.",
|
|
1289
|
+
"Skills that include an inline <content> block are already fully loaded; no read_file is needed for them.",
|
|
1289
1290
|
"When a skill file references a relative path, resolve it against that skill's baseDir and use the resulting ordinary path with file or bash tools.",
|
|
1290
1291
|
"Skills are ordinary files in the current runtime filesystem; do not use special skill/resource tool protocols.",
|
|
1291
1292
|
"",
|
|
@@ -1295,7 +1296,13 @@ function formatSkillSummariesForPrompt(skills) {
|
|
|
1295
1296
|
lines.push(" <skill>");
|
|
1296
1297
|
lines.push(` <name>${escapeXml(skill.name)}</name>`);
|
|
1297
1298
|
lines.push(` <description>${escapeXml(skill.description)}</description>`);
|
|
1298
|
-
if (skill.
|
|
1299
|
+
if (skill.inlineContent !== void 0) {
|
|
1300
|
+
lines.push(" <content>");
|
|
1301
|
+
for (const contentLine of skill.inlineContent.replace(/\r\n/g, "\n").split("\n")) {
|
|
1302
|
+
lines.push(` ${escapeXml(contentLine)}`);
|
|
1303
|
+
}
|
|
1304
|
+
lines.push(" </content>");
|
|
1305
|
+
} else if (skill.filePath) {
|
|
1299
1306
|
lines.push(` <entry>${escapeXml(skill.filePath)}</entry>`);
|
|
1300
1307
|
}
|
|
1301
1308
|
if (skill.baseDir) {
|
|
@@ -7,7 +7,12 @@ function hasGitBoundary(directory) {
|
|
|
7
7
|
const gitPath = path.join(directory, ".git");
|
|
8
8
|
try {
|
|
9
9
|
const stat = fs.statSync(gitPath);
|
|
10
|
-
|
|
10
|
+
if (stat.isDirectory()) return true;
|
|
11
|
+
if (!stat.isFile()) return false;
|
|
12
|
+
const content = fs.readFileSync(gitPath, "utf8");
|
|
13
|
+
const firstLine = content.split("\n", 1)[0] ?? "";
|
|
14
|
+
const gitdir = firstLine.trim().replace(/^gitdir:/, "").trim();
|
|
15
|
+
return firstLine.trim().startsWith("gitdir:") && gitdir.length > 0;
|
|
11
16
|
} catch {
|
|
12
17
|
return false;
|
|
13
18
|
}
|
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
getThemesDir,
|
|
20
20
|
migrateConfigFromAgentDir,
|
|
21
21
|
truncateHeadTail
|
|
22
|
-
} from "./chunks/chunk-
|
|
22
|
+
} from "./chunks/chunk-75JWZPRK.js";
|
|
23
23
|
import {
|
|
24
24
|
AGENTS_CONTEXT_FILE_NAME,
|
|
25
25
|
AgentSessionController,
|
|
@@ -69,8 +69,8 @@ import {
|
|
|
69
69
|
setExtensionEnabledInSettings,
|
|
70
70
|
shouldPreserveExecutionStateForUserText,
|
|
71
71
|
supersedeExecutionState
|
|
72
|
-
} from "./chunks/chunk-
|
|
73
|
-
import "./chunks/chunk-
|
|
72
|
+
} from "./chunks/chunk-PKR3PO73.js";
|
|
73
|
+
import "./chunks/chunk-FKAO25XH.js";
|
|
74
74
|
import {
|
|
75
75
|
Deref,
|
|
76
76
|
EMPTY_ASSISTANT_CONTENT_ERROR,
|
|
@@ -106,10 +106,10 @@ import {
|
|
|
106
106
|
setLogger,
|
|
107
107
|
sortToolModelCandidatesByCapability,
|
|
108
108
|
type_exports
|
|
109
|
-
} from "./chunks/chunk-
|
|
109
|
+
} from "./chunks/chunk-K6ZOCJ4V.js";
|
|
110
110
|
import {
|
|
111
111
|
resolveCliProjectRoot
|
|
112
|
-
} from "./chunks/chunk-
|
|
112
|
+
} from "./chunks/chunk-WLFOBECN.js";
|
|
113
113
|
import {
|
|
114
114
|
__commonJS,
|
|
115
115
|
__require,
|
|
@@ -61840,6 +61840,7 @@ var BUILTIN_SLASH_COMMANDS = [
|
|
|
61840
61840
|
{ name: "settings/theme", description: "Change theme" },
|
|
61841
61841
|
{ name: "settings/thinking", description: "Set thinking level" },
|
|
61842
61842
|
{ name: "settings/calm", description: "Toggle calm mode: show only questions and answers" },
|
|
61843
|
+
{ name: "calm", description: "Alias for /settings/calm" },
|
|
61843
61844
|
{ name: "settings/yolo", description: "Toggle or set YOLO mode" },
|
|
61844
61845
|
{ name: "settings/debugs/cache-test", description: "Run provider cache diagnostics with a dedicated 2-request probe" },
|
|
61845
61846
|
{ name: "settings/debugs/context", description: "Append a context summary to ~/.pie/logs/pie-cli.log" },
|
|
@@ -64018,77 +64019,7 @@ async function loadSession(host, sessionId) {
|
|
|
64018
64019
|
host.lastStatusText = void 0;
|
|
64019
64020
|
host.agentSessionController?.drainQueuedInputsForEditor();
|
|
64020
64021
|
host.updatePendingMessagesDisplay();
|
|
64021
|
-
|
|
64022
|
-
const toolResultMap = /* @__PURE__ */ new Map();
|
|
64023
|
-
for (const msg of messages) {
|
|
64024
|
-
if (msg.role === "toolResult") {
|
|
64025
|
-
const toolMsg = msg;
|
|
64026
|
-
toolResultMap.set(toolMsg.toolCallId, toolMsg);
|
|
64027
|
-
}
|
|
64028
|
-
}
|
|
64029
|
-
for (const msg of messagesToShow) {
|
|
64030
|
-
if (msg.role === "user") {
|
|
64031
|
-
let content = "";
|
|
64032
|
-
if (typeof msg.content === "string") {
|
|
64033
|
-
content = msg.content;
|
|
64034
|
-
} else if (Array.isArray(msg.content)) {
|
|
64035
|
-
content = msg.content.map(textFromContentBlock).join("");
|
|
64036
|
-
}
|
|
64037
|
-
host.chatContainer.addChild(new UserMessageComponent(content));
|
|
64038
|
-
} else if (msg.role === "assistant") {
|
|
64039
|
-
const assistantMsg = msg;
|
|
64040
|
-
const contentBlocks = [];
|
|
64041
|
-
if (Array.isArray(assistantMsg.content)) {
|
|
64042
|
-
for (const c of assistantMsg.content) {
|
|
64043
|
-
if (typeof c !== "object" || !c || !("type" in c)) continue;
|
|
64044
|
-
if (c.type === "text" && "text" in c) {
|
|
64045
|
-
const text = c.text;
|
|
64046
|
-
if (text.trim()) {
|
|
64047
|
-
contentBlocks.push({ type: "text", text });
|
|
64048
|
-
}
|
|
64049
|
-
} else if (c.type === "thinking" && "thinking" in c) {
|
|
64050
|
-
const thinking = c.thinking;
|
|
64051
|
-
if (thinking.trim()) {
|
|
64052
|
-
contentBlocks.push({ type: "thinking", thinking });
|
|
64053
|
-
}
|
|
64054
|
-
}
|
|
64055
|
-
}
|
|
64056
|
-
}
|
|
64057
|
-
if (contentBlocks.length > 0) {
|
|
64058
|
-
const msgComponent = new AssistantMessageComponent(void 0, host.thinkingLevel === "off");
|
|
64059
|
-
msgComponent.setCalmMode(host.calmMode);
|
|
64060
|
-
msgComponent.updateContent({
|
|
64061
|
-
role: "assistant",
|
|
64062
|
-
content: contentBlocks
|
|
64063
|
-
});
|
|
64064
|
-
host.chatContainer.addChild(msgComponent);
|
|
64065
|
-
}
|
|
64066
|
-
if (Array.isArray(assistantMsg.content) && !host.calmMode) {
|
|
64067
|
-
for (const c of assistantMsg.content) {
|
|
64068
|
-
if (typeof c === "object" && c && "type" in c && c.type === "toolCall") {
|
|
64069
|
-
const toolCall = c;
|
|
64070
|
-
const toolId = toolCall.id || toolCall.name;
|
|
64071
|
-
const toolComponent = new ToolExecutionComponent(
|
|
64072
|
-
toolCall.name,
|
|
64073
|
-
toolCall.arguments,
|
|
64074
|
-
{ expanded: host.toolOutputExpanded },
|
|
64075
|
-
host.ui
|
|
64076
|
-
);
|
|
64077
|
-
const toolResult = toolResultMap.get(toolId);
|
|
64078
|
-
if (toolResult) {
|
|
64079
|
-
toolComponent.updateResult({
|
|
64080
|
-
content: toolResult.content,
|
|
64081
|
-
isError: toolResult.isError || false,
|
|
64082
|
-
details: toolResult.details
|
|
64083
|
-
}, false);
|
|
64084
|
-
}
|
|
64085
|
-
host.chatContainer.addChild(toolComponent);
|
|
64086
|
-
host.pendingTools.set(toolId, toolComponent);
|
|
64087
|
-
}
|
|
64088
|
-
}
|
|
64089
|
-
}
|
|
64090
|
-
}
|
|
64091
|
-
}
|
|
64022
|
+
renderChatHistory(host, messages);
|
|
64092
64023
|
if (messages.length > 50) {
|
|
64093
64024
|
host.chatContainer.addChild(new Spacer(1));
|
|
64094
64025
|
host.chatContainer.addChild(
|
|
@@ -64315,38 +64246,81 @@ async function navigateToEntry(host, entryId) {
|
|
|
64315
64246
|
);
|
|
64316
64247
|
}
|
|
64317
64248
|
}
|
|
64318
|
-
function
|
|
64319
|
-
|
|
64320
|
-
|
|
64249
|
+
function renderChatHistory(host, messages) {
|
|
64250
|
+
const messagesToShow = messages.slice(-50);
|
|
64251
|
+
const toolResultMap = /* @__PURE__ */ new Map();
|
|
64252
|
+
for (const msg of messages) {
|
|
64253
|
+
if (msg.role === "toolResult") {
|
|
64254
|
+
const toolMsg = msg;
|
|
64255
|
+
toolResultMap.set(toolMsg.toolCallId, toolMsg);
|
|
64256
|
+
}
|
|
64257
|
+
}
|
|
64258
|
+
for (const msg of messagesToShow) {
|
|
64321
64259
|
if (msg.role === "user") {
|
|
64322
|
-
let
|
|
64260
|
+
let content = "";
|
|
64323
64261
|
if (typeof msg.content === "string") {
|
|
64324
|
-
|
|
64262
|
+
content = msg.content;
|
|
64325
64263
|
} else if (Array.isArray(msg.content)) {
|
|
64326
|
-
|
|
64327
|
-
}
|
|
64328
|
-
if (text.trim()) {
|
|
64329
|
-
host.chatContainer.addChild(new UserMessageComponent(text));
|
|
64264
|
+
content = msg.content.map(textFromContentBlock).join("");
|
|
64330
64265
|
}
|
|
64266
|
+
host.chatContainer.addChild(new UserMessageComponent(content));
|
|
64331
64267
|
} else if (msg.role === "assistant") {
|
|
64332
|
-
const
|
|
64333
|
-
const
|
|
64334
|
-
|
|
64335
|
-
|
|
64336
|
-
if (c
|
|
64337
|
-
if (c.type === "
|
|
64338
|
-
|
|
64339
|
-
|
|
64340
|
-
|
|
64341
|
-
|
|
64342
|
-
|
|
64343
|
-
|
|
64344
|
-
|
|
64345
|
-
|
|
64346
|
-
|
|
64268
|
+
const assistantMsg = msg;
|
|
64269
|
+
const contentBlocks = [];
|
|
64270
|
+
if (Array.isArray(assistantMsg.content)) {
|
|
64271
|
+
for (const c of assistantMsg.content) {
|
|
64272
|
+
if (typeof c !== "object" || !c || !("type" in c)) continue;
|
|
64273
|
+
if (c.type === "text" && "text" in c) {
|
|
64274
|
+
const text = c.text;
|
|
64275
|
+
if (text.trim()) {
|
|
64276
|
+
contentBlocks.push({ type: "text", text });
|
|
64277
|
+
}
|
|
64278
|
+
} else if (c.type === "thinking" && "thinking" in c) {
|
|
64279
|
+
const thinking = c.thinking;
|
|
64280
|
+
if (thinking.trim()) {
|
|
64281
|
+
contentBlocks.push({ type: "thinking", thinking });
|
|
64282
|
+
}
|
|
64283
|
+
}
|
|
64284
|
+
}
|
|
64285
|
+
}
|
|
64286
|
+
if (contentBlocks.length > 0) {
|
|
64287
|
+
const msgComponent = new AssistantMessageComponent(void 0, host.thinkingLevel === "off");
|
|
64288
|
+
msgComponent.setCalmMode(host.calmMode);
|
|
64289
|
+
msgComponent.updateContent({
|
|
64290
|
+
role: "assistant",
|
|
64291
|
+
content: contentBlocks
|
|
64292
|
+
});
|
|
64293
|
+
host.chatContainer.addChild(msgComponent);
|
|
64294
|
+
}
|
|
64295
|
+
if (Array.isArray(assistantMsg.content) && !host.calmMode) {
|
|
64296
|
+
for (const c of assistantMsg.content) {
|
|
64297
|
+
if (typeof c === "object" && c && "type" in c && c.type === "toolCall") {
|
|
64298
|
+
const toolCall = c;
|
|
64299
|
+
const toolId = toolCall.id || toolCall.name;
|
|
64300
|
+
const toolComponent = new ToolExecutionComponent(
|
|
64301
|
+
toolCall.name,
|
|
64302
|
+
toolCall.arguments,
|
|
64303
|
+
{ expanded: host.toolOutputExpanded },
|
|
64304
|
+
host.ui
|
|
64305
|
+
);
|
|
64306
|
+
const toolResult = toolResultMap.get(toolId);
|
|
64307
|
+
if (toolResult) {
|
|
64308
|
+
toolComponent.updateResult({
|
|
64309
|
+
content: toolResult.content,
|
|
64310
|
+
isError: toolResult.isError || false,
|
|
64311
|
+
details: toolResult.details
|
|
64312
|
+
}, false);
|
|
64313
|
+
}
|
|
64314
|
+
host.chatContainer.addChild(toolComponent);
|
|
64315
|
+
host.pendingTools.set(toolId, toolComponent);
|
|
64316
|
+
}
|
|
64317
|
+
}
|
|
64318
|
+
}
|
|
64347
64319
|
}
|
|
64348
64320
|
}
|
|
64349
|
-
|
|
64321
|
+
}
|
|
64322
|
+
function renderMessageHistory(host, messages) {
|
|
64323
|
+
renderChatHistory(host, messages);
|
|
64350
64324
|
}
|
|
64351
64325
|
async function handleForkCommand(host) {
|
|
64352
64326
|
try {
|
|
@@ -65298,6 +65272,10 @@ function registerBuiltinCommands(host) {
|
|
|
65298
65272
|
description: "Toggle calm mode: show only questions and answers (on/off/status)",
|
|
65299
65273
|
handler: (_2, args) => host.handleCalmCommand(args)
|
|
65300
65274
|
});
|
|
65275
|
+
commandTree.register(["calm"], {
|
|
65276
|
+
description: "Alias for /settings/calm (questions and answers only)",
|
|
65277
|
+
handler: (_2, args) => host.handleCalmCommand(args)
|
|
65278
|
+
});
|
|
65301
65279
|
commandTree.register(["settings", "extensions"], {
|
|
65302
65280
|
description: "List extensions and manage enable/disable toggles",
|
|
65303
65281
|
handler: (_2, args) => host.handleExtensionsCommand(args)
|
|
@@ -68262,6 +68240,15 @@ var FooterComponent = class {
|
|
|
68262
68240
|
}
|
|
68263
68241
|
}
|
|
68264
68242
|
const statsParts = [];
|
|
68243
|
+
if (state.planMode) {
|
|
68244
|
+
statsParts.push(theme.fg("accent", "[PLAN]"));
|
|
68245
|
+
}
|
|
68246
|
+
if (state.calmMode) {
|
|
68247
|
+
statsParts.push(theme.fg("dim", "[CALM]"));
|
|
68248
|
+
}
|
|
68249
|
+
if (state.yoloMode) {
|
|
68250
|
+
statsParts.push(theme.fg("warning", "[YOLO]"));
|
|
68251
|
+
}
|
|
68265
68252
|
if (state.inputTokens) statsParts.push(`\u2191${formatTokens(state.inputTokens)}`);
|
|
68266
68253
|
if (state.outputTokens) statsParts.push(`\u2193${formatTokens(state.outputTokens)}`);
|
|
68267
68254
|
if (state.cacheRead) statsParts.push(`R${formatTokens(state.cacheRead)}`);
|
|
@@ -68279,15 +68266,6 @@ var FooterComponent = class {
|
|
|
68279
68266
|
statsParts.push(percentStr);
|
|
68280
68267
|
}
|
|
68281
68268
|
}
|
|
68282
|
-
if (state.planMode) {
|
|
68283
|
-
statsParts.push(theme.fg("accent", "[PLAN]"));
|
|
68284
|
-
}
|
|
68285
|
-
if (state.calmMode) {
|
|
68286
|
-
statsParts.push(theme.fg("dim", "[CALM]"));
|
|
68287
|
-
}
|
|
68288
|
-
if (state.yoloMode) {
|
|
68289
|
-
statsParts.push(theme.fg("warning", "[YOLO]"));
|
|
68290
|
-
}
|
|
68291
68269
|
const statusColor = {
|
|
68292
68270
|
ready: "dim",
|
|
68293
68271
|
thinking: "accent",
|
|
@@ -70736,7 +70714,7 @@ var InteractiveMode = class {
|
|
|
70736
70714
|
if (savedLevel) {
|
|
70737
70715
|
this.thinkingLevel = savedLevel;
|
|
70738
70716
|
}
|
|
70739
|
-
const { Agent } = await import("./chunks/src-
|
|
70717
|
+
const { Agent } = await import("./chunks/src-HYZFAW4V.js");
|
|
70740
70718
|
const activeSession = this.sessionManager.getActiveSession();
|
|
70741
70719
|
this.agent = new Agent({
|
|
70742
70720
|
initialState: {
|
|
@@ -71525,7 +71503,7 @@ async function runPrintMode(params) {
|
|
|
71525
71503
|
`);
|
|
71526
71504
|
console.log("Assistant: ");
|
|
71527
71505
|
}
|
|
71528
|
-
const { Agent: AgentClass } = await import("./chunks/src-
|
|
71506
|
+
const { Agent: AgentClass } = await import("./chunks/src-HYZFAW4V.js");
|
|
71529
71507
|
let agent;
|
|
71530
71508
|
const printModeExtensions = await loadPrintModeExtensions({
|
|
71531
71509
|
cwd: runtime.cwd,
|
|
@@ -72492,7 +72470,7 @@ async function runJsonEventsMode(params) {
|
|
|
72492
72470
|
if (runtime.initialModel.unconfigured || controller) {
|
|
72493
72471
|
return;
|
|
72494
72472
|
}
|
|
72495
|
-
const { Agent: AgentClass } = await import("./chunks/src-
|
|
72473
|
+
const { Agent: AgentClass } = await import("./chunks/src-HYZFAW4V.js");
|
|
72496
72474
|
const jsonModeExtensions = await loadJsonModeExtensions({ runtime, getAgent: () => agent });
|
|
72497
72475
|
const tools = [...runtime.tools, ...jsonModeExtensions.extensionTools];
|
|
72498
72476
|
const restoredApiKey = runtime.modelRegistry.getApiKey(runtime.model);
|
|
@@ -73126,7 +73104,7 @@ async function runWithJsonEventsConsoleIsolation(fn) {
|
|
|
73126
73104
|
}
|
|
73127
73105
|
async function createCliTestStreamFnFromEnv() {
|
|
73128
73106
|
if (!process.env.PIE_TEST_MOCK_STREAM_SEQUENCE) return void 0;
|
|
73129
|
-
return (await import("./chunks/test-stream-
|
|
73107
|
+
return (await import("./chunks/test-stream-XCE2KXJU.js")).createTestStreamFnFromSequenceEnv();
|
|
73130
73108
|
}
|
|
73131
73109
|
async function startChat(initialPrompt, testCommand) {
|
|
73132
73110
|
const rawOutput = process.argv.includes("--raw-output");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cydm/pie",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.45",
|
|
4
4
|
"description": "Pie AI Agent CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"test": "npm run test:offline",
|
|
19
19
|
"pretest:offline": "npm run build --workspace @pie/agent-framework && npm run build --workspace @pie/shared-headless-capabilities && npm run build",
|
|
20
20
|
"posttest:offline": "node --test --import tsx test/remote-model-catalog.test.ts",
|
|
21
|
-
"test:offline": "node --test --import tsx 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/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-extension.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/hierarchical-command-system.test.ts test/extensions-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.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/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/code-intel-typescript-provider.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/terminal-title.test.ts test/interactive-controller-title.test.ts test/todo-title.terminal.test.ts test/plan-mode-extension.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/direct-bash.test.ts test/terminal-bell.test.ts test/calm-mode.test.ts test/daily-agent-smoke.terminal.test.ts",
|
|
21
|
+
"test:offline": "node --test --import tsx 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/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-extension.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/hierarchical-command-system.test.ts test/extensions-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.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/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/code-intel-typescript-provider.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/terminal-title.test.ts test/interactive-controller-title.test.ts test/todo-title.terminal.test.ts test/plan-mode-extension.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/direct-bash.test.ts test/terminal-bell.test.ts test/calm-mode.test.ts test/project-root.test.ts test/daily-agent-smoke.terminal.test.ts",
|
|
22
22
|
"test:all": "npm run test:offline && npm run test:terminal:vitest",
|
|
23
23
|
"test:terminal:vitest": "vitest run test/mention-file-select.terminal.test.ts test/tool-partial-display.terminal.test.ts test/viewport-position-final.test.ts test/resume-header.terminal.test.ts --no-file-parallelism",
|
|
24
24
|
"test:todo-tui": "PIE_REAL_TODO_TUI=1 node --test --import tsx test/todo-closure.terminal.test.ts",
|