@cydm/pie 1.0.43 → 1.0.44

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.
@@ -1,7 +1,7 @@
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-2GVFMYIV.js";
4
+ } from "../../../chunks/chunk-7C5E245X.js";
5
5
  import "../../../chunks/chunk-JVLAKTAS.js";
6
6
  import "../../../chunks/chunk-NGQ3PUOC.js";
7
7
  import "../../../chunks/chunk-LZQXQOPJ.js";
@@ -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-NTYHFBUA.js";
4
+ } from "../../../chunks/chunk-WLFOBECN.js";
5
5
  import "../../../chunks/chunk-LZQXQOPJ.js";
6
6
 
7
7
  // builtin/extensions/init/index.ts
@@ -7,7 +7,7 @@ import {
7
7
  isPlanModeSafeCommand,
8
8
  markCompletedPlanSteps,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-2GVFMYIV.js";
10
+ } from "../../../chunks/chunk-7C5E245X.js";
11
11
  import "../../../chunks/chunk-JVLAKTAS.js";
12
12
  import {
13
13
  Type
@@ -1,11 +1,11 @@
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-VYAW6RAX.js";
4
+ } from "../../../chunks/chunk-DSVPYK5S.js";
5
5
  import {
6
6
  createSharedFileSystemTools,
7
7
  createSubagentCapability
8
- } from "../../../chunks/chunk-2GVFMYIV.js";
8
+ } from "../../../chunks/chunk-7C5E245X.js";
9
9
  import "../../../chunks/chunk-JVLAKTAS.js";
10
10
  import "../../../chunks/chunk-NGQ3PUOC.js";
11
11
  import "../../../chunks/chunk-LZQXQOPJ.js";
@@ -7,7 +7,7 @@ import {
7
7
  executeManageTodoList,
8
8
  executionStateToTodos,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-2GVFMYIV.js";
10
+ } from "../../../chunks/chunk-7C5E245X.js";
11
11
  import "../../../chunks/chunk-JVLAKTAS.js";
12
12
  import "../../../chunks/chunk-NGQ3PUOC.js";
13
13
  import "../../../chunks/chunk-LZQXQOPJ.js";
@@ -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.filePath) {
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) {
@@ -8,7 +8,7 @@ import {
8
8
  createSharedWebSearchTool,
9
9
  interpretShellExit,
10
10
  requestInteraction
11
- } from "./chunk-2GVFMYIV.js";
11
+ } from "./chunk-7C5E245X.js";
12
12
  import {
13
13
  Type
14
14
  } from "./chunk-NGQ3PUOC.js";
@@ -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
- return stat.isDirectory() || stat.isFile();
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-VYAW6RAX.js";
22
+ } from "./chunks/chunk-DSVPYK5S.js";
23
23
  import {
24
24
  AGENTS_CONTEXT_FILE_NAME,
25
25
  AgentSessionController,
@@ -69,7 +69,7 @@ import {
69
69
  setExtensionEnabledInSettings,
70
70
  shouldPreserveExecutionStateForUserText,
71
71
  supersedeExecutionState
72
- } from "./chunks/chunk-2GVFMYIV.js";
72
+ } from "./chunks/chunk-7C5E245X.js";
73
73
  import "./chunks/chunk-JVLAKTAS.js";
74
74
  import {
75
75
  Deref,
@@ -109,7 +109,7 @@ import {
109
109
  } from "./chunks/chunk-NGQ3PUOC.js";
110
110
  import {
111
111
  resolveCliProjectRoot
112
- } from "./chunks/chunk-NTYHFBUA.js";
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
- const messagesToShow = messages.slice(-50);
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 renderMessageHistory(host, messages) {
64319
- for (const message of messages) {
64320
- const msg = message;
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 text = "";
64260
+ let content = "";
64323
64261
  if (typeof msg.content === "string") {
64324
- text = msg.content;
64262
+ content = msg.content;
64325
64263
  } else if (Array.isArray(msg.content)) {
64326
- text = msg.content.filter((c) => typeof c === "object" && c !== null && "type" in c && c.type === "text").map((c) => c.text || "").join("");
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 content = msg.content || [];
64333
- const assistantMsg = {
64334
- role: "assistant",
64335
- content: content.map((c) => {
64336
- if (c.type === "text") return { type: "text", text: c.text || "" };
64337
- if (c.type === "thinking") return { type: "thinking", thinking: c.thinking || "" };
64338
- if (c.type === "toolCall") return { type: "toolCall", name: c.name || "", arguments: c.arguments, id: c.id };
64339
- return { type: "text", text: "" };
64340
- }),
64341
- stopReason: msg.stopReason,
64342
- errorMessage: msg.errorMessage
64343
- };
64344
- const msgComponent = new AssistantMessageComponent(assistantMsg, host.thinkingLevel === "off");
64345
- msgComponent.setCalmMode(host.calmMode);
64346
- host.chatContainer.addChild(msgComponent);
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
- host.ui.requestRender();
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
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",