@oyasmi/pipiclaw 0.9.1 → 0.9.2-beta.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.
Files changed (167) hide show
  1. package/dist/agent/channel-runner.d.ts +15 -1
  2. package/dist/agent/channel-runner.js +76 -24
  3. package/dist/agent/effect-ledger.js +9 -2
  4. package/dist/agent/job-manager.d.ts +4 -0
  5. package/dist/agent/job-manager.js +17 -2
  6. package/dist/agent/prompt/manifest.d.ts +1 -1
  7. package/dist/agent/prompt/manifest.js +1 -1
  8. package/dist/agent/prompt/sections.js +8 -5
  9. package/dist/agent/session-events.d.ts +2 -0
  10. package/dist/agent/session-events.js +29 -14
  11. package/dist/agent/turn-recovery.js +2 -2
  12. package/dist/agent/type-guards.js +5 -1
  13. package/dist/agent/workspace-resources.d.ts +2 -2
  14. package/dist/agent/workspace-resources.js +41 -3
  15. package/dist/executor.d.ts +14 -0
  16. package/dist/executor.js +96 -24
  17. package/dist/file-store.d.ts +96 -0
  18. package/dist/file-store.js +189 -0
  19. package/dist/memory/consolidation.js +2 -26
  20. package/dist/memory/files.js +7 -7
  21. package/dist/memory/maintenance-jobs.js +2 -34
  22. package/dist/memory/maintenance-state.js +2 -1
  23. package/dist/memory/recall.d.ts +10 -0
  24. package/dist/memory/recall.js +15 -7
  25. package/dist/memory/session-search.js +6 -22
  26. package/dist/memory/transcript.d.ts +10 -0
  27. package/dist/memory/transcript.js +39 -0
  28. package/dist/playbooks/agent-delegation.md +7 -5
  29. package/dist/playbooks/background-jobs.md +1 -1
  30. package/dist/playbooks/catalog.d.ts +1 -1
  31. package/dist/playbooks/catalog.js +1 -1
  32. package/dist/playbooks/event-scheduling.md +2 -0
  33. package/dist/playbooks/memory-and-learning.md +11 -11
  34. package/dist/playbooks/runtime-orientation.md +3 -3
  35. package/dist/playbooks/task-driving.md +7 -7
  36. package/dist/playbooks/task-planning.md +5 -5
  37. package/dist/runtime/app-home.js +1 -1
  38. package/dist/runtime/bootstrap.js +10 -0
  39. package/dist/runtime/dingtalk.js +3 -2
  40. package/dist/runtime/durable-dispatch.d.ts +26 -1
  41. package/dist/runtime/durable-dispatch.js +51 -5
  42. package/dist/runtime/event-commands.js +7 -16
  43. package/dist/runtime/events.d.ts +4 -2
  44. package/dist/runtime/events.js +15 -20
  45. package/dist/runtime/subagent-commands.js +1 -1
  46. package/dist/runtime/task-commands.d.ts +1 -1
  47. package/dist/runtime/task-commands.js +17 -12
  48. package/dist/runtime/task-driver.js +2 -2
  49. package/dist/runtime/task-wake.d.ts +2 -2
  50. package/dist/runtime/task-wake.js +2 -2
  51. package/dist/security/block-message.d.ts +11 -0
  52. package/dist/security/block-message.js +12 -0
  53. package/dist/security/path-guard-check.d.ts +13 -0
  54. package/dist/security/path-guard-check.js +39 -0
  55. package/dist/security/path-guard.js +32 -14
  56. package/dist/settings.js +3 -2
  57. package/dist/shared/atomic-file.d.ts +17 -1
  58. package/dist/shared/atomic-file.js +50 -3
  59. package/dist/shared/duration.d.ts +2 -0
  60. package/dist/shared/duration.js +7 -0
  61. package/dist/shared/safe-id.d.ts +19 -0
  62. package/dist/shared/safe-id.js +24 -0
  63. package/dist/shared/text-utils.d.ts +1 -1
  64. package/dist/shared/text-utils.js +3 -8
  65. package/dist/shared/type-guards.d.ts +2 -0
  66. package/dist/shared/type-guards.js +4 -0
  67. package/dist/subagents/discovery.d.ts +44 -17
  68. package/dist/subagents/discovery.js +82 -111
  69. package/dist/subagents/external/claude-code.js +1 -3
  70. package/dist/subagents/external/harness.d.ts +1 -1
  71. package/dist/subagents/external/run.d.ts +6 -0
  72. package/dist/subagents/external/run.js +122 -58
  73. package/dist/subagents/external/settlement.d.ts +3 -0
  74. package/dist/subagents/external/settlement.js +19 -5
  75. package/dist/subagents/format.d.ts +3 -2
  76. package/dist/subagents/format.js +3 -7
  77. package/dist/subagents/runs.d.ts +45 -9
  78. package/dist/subagents/runs.js +184 -64
  79. package/dist/subagents/tool.d.ts +35 -24
  80. package/dist/subagents/tool.js +631 -577
  81. package/dist/subagents/verification-outcome.js +1 -1
  82. package/dist/subagents/workspace-lease.js +1 -1
  83. package/dist/tasks/artifact-subject.d.ts +30 -4
  84. package/dist/tasks/artifact-subject.js +257 -25
  85. package/dist/tasks/control.js +7 -9
  86. package/dist/tasks/ledger.d.ts +2 -2
  87. package/dist/tasks/ledger.js +3 -7
  88. package/dist/tasks/transitions.d.ts +5 -1
  89. package/dist/tasks/transitions.js +2 -2
  90. package/dist/tasks/verification.d.ts +24 -2
  91. package/dist/tasks/verification.js +113 -21
  92. package/dist/tools/bash.d.ts +0 -1
  93. package/dist/tools/bash.js +45 -40
  94. package/dist/tools/config.d.ts +6 -1
  95. package/dist/tools/config.js +9 -0
  96. package/dist/tools/edit.d.ts +2 -3
  97. package/dist/tools/edit.js +274 -86
  98. package/dist/tools/event-manage.d.ts +13 -7
  99. package/dist/tools/event-manage.js +52 -14
  100. package/dist/tools/glob-match.d.ts +11 -0
  101. package/dist/tools/glob-match.js +75 -0
  102. package/dist/tools/glob.d.ts +15 -0
  103. package/dist/tools/glob.js +113 -0
  104. package/dist/tools/grep.d.ts +0 -1
  105. package/dist/tools/grep.js +57 -42
  106. package/dist/tools/ignore-dirs.d.ts +6 -0
  107. package/dist/tools/ignore-dirs.js +15 -0
  108. package/dist/tools/index.d.ts +3 -0
  109. package/dist/tools/index.js +50 -40
  110. package/dist/tools/job.d.ts +0 -1
  111. package/dist/tools/job.js +1 -8
  112. package/dist/tools/line-index.d.ts +16 -0
  113. package/dist/tools/line-index.js +76 -0
  114. package/dist/tools/memory-manage.d.ts +20 -8
  115. package/dist/tools/memory-manage.js +65 -92
  116. package/dist/tools/presentation.d.ts +2 -0
  117. package/dist/tools/presentation.js +109 -0
  118. package/dist/tools/read.d.ts +2 -2
  119. package/dist/tools/read.js +97 -133
  120. package/dist/tools/registry.d.ts +4 -1
  121. package/dist/tools/registry.js +89 -22
  122. package/dist/tools/send-media.d.ts +6 -6
  123. package/dist/tools/send-media.js +16 -49
  124. package/dist/tools/session-search.d.ts +0 -1
  125. package/dist/tools/session-search.js +0 -1
  126. package/dist/tools/skill-security.d.ts +0 -2
  127. package/dist/tools/skill-security.js +0 -24
  128. package/dist/tools/skill.d.ts +31 -0
  129. package/dist/tools/skill.js +153 -0
  130. package/dist/tools/subagent-manage.d.ts +6 -5
  131. package/dist/tools/subagent-manage.js +60 -60
  132. package/dist/tools/task-manage/create.d.ts +2 -2
  133. package/dist/tools/task-manage/create.js +1 -3
  134. package/dist/tools/task-manage/lifecycle.d.ts +9 -6
  135. package/dist/tools/task-manage/lifecycle.js +56 -60
  136. package/dist/tools/task-manage/schema.d.ts +27 -15
  137. package/dist/tools/task-manage/schema.js +58 -74
  138. package/dist/tools/task-manage/shared.d.ts +11 -6
  139. package/dist/tools/task-manage/shared.js +30 -21
  140. package/dist/tools/task-manage/types.d.ts +14 -15
  141. package/dist/tools/task-manage/verification.d.ts +5 -5
  142. package/dist/tools/task-manage/verification.js +18 -15
  143. package/dist/tools/task-manage.d.ts +8 -11
  144. package/dist/tools/task-manage.js +63 -50
  145. package/dist/tools/tool-details.d.ts +17 -1
  146. package/dist/tools/tool-details.js +24 -0
  147. package/dist/tools/truncate.d.ts +5 -5
  148. package/dist/tools/truncate.js +5 -5
  149. package/dist/tools/web-fetch.d.ts +0 -1
  150. package/dist/tools/web-fetch.js +0 -1
  151. package/dist/tools/web-search.d.ts +0 -1
  152. package/dist/tools/web-search.js +0 -1
  153. package/dist/tools/write-content.d.ts +3 -3
  154. package/dist/tools/write-content.js +12 -51
  155. package/dist/tools/write.d.ts +2 -3
  156. package/dist/tools/write.js +3 -4
  157. package/dist/tui/pitui-frontend.js +3 -3
  158. package/dist/usage/ledger.js +7 -4
  159. package/examples/sub-agents/README.md +13 -13
  160. package/examples/sub-agents/documenter.md +2 -1
  161. package/examples/sub-agents/reviewer.md +2 -0
  162. package/examples/sub-agents/scout.md +2 -1
  163. package/examples/sub-agents/verifier.md +6 -4
  164. package/examples/sub-agents/worker.md +2 -1
  165. package/package.json +5 -5
  166. package/dist/tools/skill-manage.d.ts +0 -41
  167. package/dist/tools/skill-manage.js +0 -232
@@ -1,3 +1,6 @@
1
+ import { Agent, type ThinkingLevel } from "@earendil-works/pi-agent-core";
2
+ import type { Api, Model } from "@earendil-works/pi-ai";
3
+ import { AgentSession, SettingsManager as SDKSettingsManager, SessionManager } from "@earendil-works/pi-coding-agent";
1
4
  import type { MemoryMaintenanceRuntimeContext } from "../memory/scheduler.js";
2
5
  import type { ChannelContext } from "../runtime/channel-context.js";
3
6
  import type { ChannelStore } from "../runtime/store.js";
@@ -6,8 +9,14 @@ import { type SubAgentDiscoveryResult } from "../subagents/discovery.js";
6
9
  import { type RunnerBuiltInCommand } from "./commands.js";
7
10
  import type { RunnerFactoryPaths } from "./runner-factory.js";
8
11
  import { type AgentRunner, type RunnerStatusSnapshot, type TurnStatus } from "./types.js";
12
+ /** Apply the pi 0.83 source-model thinking compatibility branch to one real AgentSession. */
13
+ export declare function setModelWithThinkingPreservation(session: AgentSession, manager: SDKSettingsManager, model: Model<Api>): Promise<void>;
14
+ export declare function setThinkingLevelWithConditionalPersist(session: AgentSession, level: ThinkingLevel): void;
15
+ export declare function cycleThinkingLevelWithConditionalPersist(session: AgentSession): ThinkingLevel | undefined;
16
+ export declare function initializeThinkingLevelCompat(agent: Agent, model: Model<Api>, sessionManager: SessionManager, configuredDefault: ThinkingLevel | undefined): ThinkingLevel;
9
17
  export declare class ChannelRunner implements AgentRunner {
10
18
  private readonly executor;
19
+ private readonly fileStore;
11
20
  private readonly channelId;
12
21
  private readonly channelDir;
13
22
  private readonly appHomeDir;
@@ -24,6 +33,8 @@ export declare class ChannelRunner implements AgentRunner {
24
33
  */
25
34
  private readonly projectScope;
26
35
  private session;
36
+ /** Settings manager owned by the currently bound AgentSession. */
37
+ private sessionSettingsManager;
27
38
  private agent;
28
39
  private sessionManager;
29
40
  private readonly settingsManager;
@@ -167,6 +178,9 @@ export declare class ChannelRunner implements AgentRunner {
167
178
  * switch back to the preferred model. Silent — no user notice on recovery.
168
179
  */
169
180
  private maybeRestorePrimaryModel;
181
+ private setModelWithThinkingPreservation;
182
+ private setThinkingLevelCompat;
183
+ private cycleThinkingLevelCompat;
170
184
  /**
171
185
  * Resolve the configured backup model reference against available models.
172
186
  * Returns null when unset, unresolvable/ambiguous, or missing an API key —
@@ -213,7 +227,7 @@ export declare class ChannelRunner implements AgentRunner {
213
227
  */
214
228
  private setSessionBaseToolsOverride;
215
229
  private subscribeToSessionEvents;
216
- /** Gated by the same master autonomy switch as task_manage and the TaskDriver. */
230
+ /** Gated by the same master autonomy switch as the task_* tools and the TaskDriver. */
217
231
  private buildTaskDigestForTurn;
218
232
  private buildFirstTurnMemoryBootstrap;
219
233
  }
@@ -4,6 +4,7 @@ import { AgentSession, AgentSessionRuntime, convertToLlm, createExtensionRuntime
4
4
  import { mkdir, readFile, writeFile } from "fs/promises";
5
5
  import { dirname, join, resolve } from "path";
6
6
  import { createExecutor } from "../executor.js";
7
+ import { createFileStore } from "../file-store.js";
7
8
  import * as log from "../log.js";
8
9
  import { buildFirstTurnMemoryBootstrapResult, FIRST_TURN_BOOTSTRAP_MAX_UNITS, } from "../memory/bootstrap.js";
9
10
  import { createMemoryCandidateStore } from "../memory/candidates.js";
@@ -21,7 +22,7 @@ import { resolveProjectScope } from "../runtime/project-scope-store.js";
21
22
  import { loadSecurityConfigWithDiagnostics } from "../security/config.js";
22
23
  import { resolveProjectAccessPolicy } from "../security/project-scope.js";
23
24
  import { formatConfigDiagnostic } from "../shared/config-diagnostic.js";
24
- import { formatLocalTime, localStampForFilename } from "../shared/local-time.js";
25
+ import { formatLocalTime, localStampForFilename, parseLocalTime } from "../shared/local-time.js";
25
26
  import { countPromptUnits } from "../shared/prompt-units.js";
26
27
  import { errorMessage } from "../shared/text-utils.js";
27
28
  import { isRecord } from "../shared/type-guards.js";
@@ -63,12 +64,58 @@ function asSdkSettingsManager(manager) {
63
64
  return SDKSettingsManager.inMemory({
64
65
  defaultProvider: manager.getDefaultProvider(),
65
66
  defaultModel: manager.getDefaultModel(),
66
- defaultThinkingLevel: manager.getDefaultThinkingLevel(),
67
+ defaultThinkingLevel: manager.getDefaultThinkingLevel() ?? DEFAULT_MAIN_THINKING_LEVEL,
67
68
  compaction: manager.getCompactionSettings(),
68
69
  retry: manager.getRetrySettings(),
69
70
  });
70
71
  }
71
72
  const DEFAULT_MAIN_THINKING_LEVEL = "medium";
73
+ /** Apply the pi 0.83 source-model thinking compatibility branch to one real AgentSession. */
74
+ export async function setModelWithThinkingPreservation(session, manager, model) {
75
+ const source = session.model;
76
+ if (!source?.reasoning) {
77
+ await session.setModel(model);
78
+ return;
79
+ }
80
+ const previousDefault = manager.getDefaultThinkingLevel();
81
+ manager.setDefaultThinkingLevel(session.thinkingLevel);
82
+ try {
83
+ await session.setModel(model);
84
+ }
85
+ finally {
86
+ manager.setDefaultThinkingLevel(previousDefault ?? DEFAULT_MAIN_THINKING_LEVEL);
87
+ }
88
+ }
89
+ export function setThinkingLevelWithConditionalPersist(session, level) {
90
+ const before = session.thinkingLevel;
91
+ session.setThinkingLevel(level);
92
+ const effective = session.thinkingLevel;
93
+ if (effective === before)
94
+ return;
95
+ if (!session.model?.reasoning && effective === "off")
96
+ return;
97
+ session.setThinkingLevel(effective, { persist: true });
98
+ }
99
+ export function cycleThinkingLevelWithConditionalPersist(session) {
100
+ const before = session.thinkingLevel;
101
+ const next = session.cycleThinkingLevel();
102
+ const effective = session.thinkingLevel;
103
+ if (next && effective !== before && (session.model?.reasoning || effective !== "off")) {
104
+ session.setThinkingLevel(effective, { persist: true });
105
+ }
106
+ return next;
107
+ }
108
+ export function initializeThinkingLevelCompat(agent, model, sessionManager, configuredDefault) {
109
+ const branch = sessionManager.getBranch();
110
+ const hasThinkingEntry = branch.some((entry) => entry.type === "thinking_level_change");
111
+ const historical = sessionManager.buildSessionContext().thinkingLevel;
112
+ const requested = hasThinkingEntry ? historical : (configuredDefault ?? DEFAULT_MAIN_THINKING_LEVEL);
113
+ const effective = clampThinkingLevel(model, requested);
114
+ agent.state.thinkingLevel = effective;
115
+ if (!hasThinkingEntry)
116
+ sessionManager.appendThinkingLevelChange(effective);
117
+ return effective;
118
+ }
72
119
  /**
73
120
  * Ceilings for the two awaited steps of a session-resource reload. Both reach
74
121
  * the network (model/auth re-resolution; the SDK session's own reload) and
@@ -111,6 +158,7 @@ export class ChannelRunner {
111
158
  this.mediaSender = paths.mediaSender;
112
159
  const executor = createExecutor();
113
160
  this.executor = executor;
161
+ this.fileStore = createFileStore();
114
162
  this.workspaceDir = resolve(dirname(channelDir));
115
163
  // Resolve and freeze this generation's ProjectScope (spec 043, D2/D3/D4.2). A channel with
116
164
  // no persisted selection gets the app default, materialized as its first selection right
@@ -387,7 +435,7 @@ export class ChannelRunner {
387
435
  getCurrentModelRef: () => formatModelReference(this.session.model ?? this.activeModel),
388
436
  resolveFallbackModel: () => this.resolveFallbackModel(),
389
437
  setModel: async (model) => {
390
- await this.session.setModel(model);
438
+ await this.setModelWithThinkingPreservation(model);
391
439
  },
392
440
  notifySwitch: (from, to, errorSummary) => {
393
441
  fallbackTargetRef = to;
@@ -815,9 +863,9 @@ export class ChannelRunner {
815
863
  */
816
864
  recordMemoryActivity(event) {
817
865
  const maintenanceSettings = this.settingsManager.getMemoryMaintenanceSettings();
818
- const eventTime = Date.parse(event.timestamp);
819
- const eligibleAfter = Number.isFinite(eventTime)
820
- ? new Date(eventTime + Math.max(0, maintenanceSettings.minIdleMinutesBeforeLlmWork) * 60_000).toISOString()
866
+ const eventTime = parseLocalTime(event.timestamp);
867
+ const eligibleAfter = eventTime !== undefined
868
+ ? formatLocalTime(new Date(eventTime + Math.max(0, maintenanceSettings.minIdleMinutesBeforeLlmWork) * 60_000))
821
869
  : undefined;
822
870
  this.memoryActivityRecorder.record({ ...event, eligibleAfter });
823
871
  }
@@ -928,7 +976,7 @@ export class ChannelRunner {
928
976
  return;
929
977
  }
930
978
  try {
931
- await this.session.setModel(this.activeModel);
979
+ await this.setModelWithThinkingPreservation(this.activeModel);
932
980
  this.primaryFailedAt = null;
933
981
  log.logInfo(`[${this.channelId}] Restored primary model ${formatModelReference(this.activeModel)}`);
934
982
  }
@@ -936,6 +984,15 @@ export class ChannelRunner {
936
984
  log.logWarning(`[${this.channelId}] Failed to restore primary model`, errorMessage(err));
937
985
  }
938
986
  }
987
+ async setModelWithThinkingPreservation(model) {
988
+ await setModelWithThinkingPreservation(this.session, this.sessionSettingsManager, model);
989
+ }
990
+ setThinkingLevelCompat(level) {
991
+ setThinkingLevelWithConditionalPersist(this.session, level);
992
+ }
993
+ cycleThinkingLevelCompat() {
994
+ return cycleThinkingLevelWithConditionalPersist(this.session);
995
+ }
939
996
  /**
940
997
  * Resolve the configured backup model reference against available models.
941
998
  * Returns null when unset, unresolvable/ambiguous, or missing an API key —
@@ -977,10 +1034,11 @@ export class ChannelRunner {
977
1034
  this.subAgentDiscovery = await this.refreshSubAgentDiscovery();
978
1035
  const initialResourceLoader = this.createResourceLoader();
979
1036
  const baseToolsOverride = Object.fromEntries(this.currentTools.map((tool) => [tool.name, tool]));
1037
+ this.sessionSettingsManager = asSdkSettingsManager(this.settingsManager);
980
1038
  this.session = new AgentSession({
981
1039
  agent: this.agent,
982
1040
  sessionManager: this.sessionManager,
983
- settingsManager: asSdkSettingsManager(this.settingsManager),
1041
+ settingsManager: this.sessionSettingsManager,
984
1042
  cwd: this.projectScope.projectRoot,
985
1043
  modelRuntime: this.modelRuntime,
986
1044
  resourceLoader: initialResourceLoader,
@@ -1172,11 +1230,11 @@ export class ChannelRunner {
1172
1230
  getSessionStats: () => this.session.getSessionStats(),
1173
1231
  getThinkingLevel: () => this.session.thinkingLevel,
1174
1232
  getAvailableThinkingLevels: () => this.session.getAvailableThinkingLevels(),
1175
- setThinkingLevel: (level) => this.session.setThinkingLevel(level),
1176
- cycleThinkingLevel: () => this.session.cycleThinkingLevel(),
1233
+ setThinkingLevel: (level) => this.setThinkingLevelCompat(level),
1234
+ cycleThinkingLevel: () => this.cycleThinkingLevelCompat(),
1177
1235
  getLastResponseModel: () => getLastAssistantUsage(this.session.messages)?.responseModel,
1178
1236
  switchModel: async (model) => {
1179
- await this.session.setModel(model);
1237
+ await this.setModelWithThinkingPreservation(model);
1180
1238
  this.activeModel = model;
1181
1239
  // Manual /model switch redefines the preferred model and clears fallback state.
1182
1240
  this.primaryFailedAt = null;
@@ -1228,17 +1286,7 @@ export class ChannelRunner {
1228
1286
  * clamped to the selected model before the session starts.
1229
1287
  */
1230
1288
  initializeThinkingLevel(agent, model, sessionManager) {
1231
- const branch = sessionManager.getBranch();
1232
- const hasThinkingEntry = branch.some((entry) => entry.type === "thinking_level_change");
1233
- const sessionThinkingLevel = sessionManager.buildSessionContext().thinkingLevel;
1234
- const requestedLevel = hasThinkingEntry
1235
- ? sessionThinkingLevel
1236
- : (this.settingsManager.getDefaultThinkingLevel() ?? DEFAULT_MAIN_THINKING_LEVEL);
1237
- const effectiveLevel = clampThinkingLevel(model, requestedLevel);
1238
- agent.state.thinkingLevel = effectiveLevel;
1239
- if (!hasThinkingEntry) {
1240
- sessionManager.appendThinkingLevelChange(effectiveLevel);
1241
- }
1289
+ initializeThinkingLevelCompat(agent, model, sessionManager, this.settingsManager.getDefaultThinkingLevel());
1242
1290
  }
1243
1291
  createSessionRuntime(sessionManager, sessionStartEvent) {
1244
1292
  const tools = this.buildRuntimeTools();
@@ -1255,16 +1303,18 @@ export class ChannelRunner {
1255
1303
  });
1256
1304
  this.initializeThinkingLevel(agent, this.activeModel, sessionManager);
1257
1305
  const resourceLoader = this.createResourceLoader();
1306
+ const sessionSettingsManager = asSdkSettingsManager(this.settingsManager);
1258
1307
  const session = new AgentSession({
1259
1308
  agent,
1260
1309
  sessionManager,
1261
- settingsManager: asSdkSettingsManager(this.settingsManager),
1310
+ settingsManager: sessionSettingsManager,
1262
1311
  cwd: this.projectScope.projectRoot,
1263
1312
  modelRuntime: this.modelRuntime,
1264
1313
  resourceLoader,
1265
1314
  baseToolsOverride: Object.fromEntries(tools.map((tool) => [tool.name, tool])),
1266
1315
  sessionStartEvent,
1267
1316
  });
1317
+ this.sessionSettingsManager = sessionSettingsManager;
1268
1318
  return { agent, session, resourceLoader };
1269
1319
  }
1270
1320
  buildRuntimeTools() {
@@ -1274,6 +1324,7 @@ export class ChannelRunner {
1274
1324
  this.tasksEnabled = toolsLoad.config.tools.tasks.enabled;
1275
1325
  const tools = createPipiclawTools({
1276
1326
  executor: this.executor,
1327
+ fileStore: this.fileStore,
1277
1328
  getCurrentModel: () => this.activeModel,
1278
1329
  getAvailableModels: () => this.modelRegistry.getAvailable(),
1279
1330
  resolveApiKey: async (model) => getApiKeyForModel(this.modelRegistry, model),
@@ -1357,12 +1408,13 @@ export class ChannelRunner {
1357
1408
  refreshSessionResources: async () => {
1358
1409
  await this.refreshSessionResources();
1359
1410
  },
1411
+ skillsDir: join(this.workspaceDir, "skills"),
1360
1412
  }).catch((err) => {
1361
1413
  log.logWarning(`[${this.channelId}] session event handler failed`, errorMessage(err));
1362
1414
  });
1363
1415
  });
1364
1416
  }
1365
- /** Gated by the same master autonomy switch as task_manage and the TaskDriver. */
1417
+ /** Gated by the same master autonomy switch as the task_* tools and the TaskDriver. */
1366
1418
  buildTaskDigestForTurn() {
1367
1419
  const taskDigestSettings = this.settingsManager.getTaskDigestSettings();
1368
1420
  return buildTaskDigest({
@@ -9,7 +9,7 @@ import { isRecord } from "../shared/type-guards.js";
9
9
  *
10
10
  * Effects are counted here instead, and only for things that change the world outside the task
11
11
  * ledger: writes, outbound media, sub-agent runs, background job launches, and a user-visible
12
- * reply. Self-report tools (`task_manage`, `memory_manage`) and read-only tools deliberately do
12
+ * reply. Self-report tools (`task_create`/`task_update`/`task_close`/`task_verify`, `memory_save`/`memory_search`/`memory_forget`) and read-only tools deliberately do
13
13
  * not count — a claim of progress is not evidence of it.
14
14
  *
15
15
  * The tally lives in process memory, exactly like the driver's futile counter it feeds; a restart
@@ -21,7 +21,7 @@ import { isRecord } from "../shared/type-guards.js";
21
21
  const counts = new Map();
22
22
  const taskCounts = new Map();
23
23
  /** Tools whose successful completion is, by itself, a visible change to the world. */
24
- const EFFECT_TOOLS = new Set(["write", "edit", "send_media", "subagent"]);
24
+ const EFFECT_TOOLS = new Set(["write", "edit", "send_media", "subagent", "subagent_inline"]);
25
25
  export function noteChannelEffect(channelId) {
26
26
  counts.set(channelId, (counts.get(channelId) ?? 0) + 1);
27
27
  }
@@ -71,6 +71,13 @@ export function resetChannelEffects() {
71
71
  * claims to look. What "futile" now means is the honest thing: a wake that executed nothing at all.
72
72
  */
73
73
  export function isEffectfulTool(toolName, details) {
74
+ if (toolName === "subagent_run") {
75
+ // Spec 047, F6/D3.2: op=follow_up dispatches a new external run — as much a visible change
76
+ // to the world as `subagent` itself. show/cancel are not. The discriminator is `resumedFrom`
77
+ // in `details` rather than `op`, because only a successful dispatch sets it: every follow_up
78
+ // failure path throws or returns a RecoverableToolError, so a rejection can never count.
79
+ return isRecord(details) && typeof details.resumedFrom === "string";
80
+ }
74
81
  if (toolName === "bash") {
75
82
  if (!isRecord(details))
76
83
  return false;
@@ -1,4 +1,5 @@
1
1
  import type { Executor } from "../executor.js";
2
+ import { type FileStore } from "../file-store.js";
2
3
  import type { ChannelEvent } from "../runtime/channel-event.js";
3
4
  /**
4
5
  * Per-channel manager for background bash jobs. A long command that ran synchronously would hold
@@ -59,6 +60,8 @@ export interface JobManagerOptions {
59
60
  /** Delivers the completion wake. Omit to disable waking (sub-agent and test paths). */
60
61
  dispatch?: (event: ChannelEvent) => boolean | Promise<boolean>;
61
62
  sweepIntervalMs?: number;
63
+ /** File-content port for reading a job's spill file (spec 044, D8). Defaults to `createFileStore()`. */
64
+ fileStore?: FileStore;
62
65
  }
63
66
  /** Cap on concurrently running jobs per channel, so a runaway model can't spawn unbounded processes. */
64
67
  export declare const MAX_RUNNING_JOBS = 5;
@@ -88,6 +91,7 @@ export declare class ChannelJobManager {
88
91
  private sweeping;
89
92
  private readonly options;
90
93
  private readonly sweepIntervalMs;
94
+ private readonly fileStore;
91
95
  constructor(channelId: string, executor: Executor, options?: JobManagerOptions | number);
92
96
  private recordPath;
93
97
  /** Mirror a record to disk. Persistence is best-effort: it must never fail a job operation. */
@@ -2,6 +2,7 @@ import { randomBytes } from "node:crypto";
2
2
  import { chmod, mkdir, readdir, readFile, unlink } from "node:fs/promises";
3
3
  import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
5
+ import { createFileStore } from "../file-store.js";
5
6
  import * as log from "../log.js";
6
7
  import { writeFileAtomically } from "../shared/atomic-file.js";
7
8
  import { createSerialQueue } from "../shared/serial-queue.js";
@@ -30,6 +31,8 @@ export const SWEEP_INTERVAL_MS = 10_000;
30
31
  export const FINISHED_JOB_RETENTION_MS = 24 * 60 * 60_000;
31
32
  /** Bytes of captured output carried inline in the completion wake. */
32
33
  const WAKE_OUTPUT_TAIL_BYTES = 2_000;
34
+ /** Upper bound on how much of a spill file's tail `readOutput` reads (spec 044, D8). */
35
+ const JOB_OUTPUT_READ_MAX_BYTES = 512 * 1024;
33
36
  function jobSpillPath(id) {
34
37
  return join(tmpdir(), `pipiclaw-job-${id}.log`);
35
38
  }
@@ -82,6 +85,7 @@ export class ChannelJobManager {
82
85
  // A bare number keeps the original `sweepIntervalMs` positional form working for tests.
83
86
  this.options = typeof options === "number" ? { sweepIntervalMs: options } : options;
84
87
  this.sweepIntervalMs = this.options.sweepIntervalMs ?? SWEEP_INTERVAL_MS;
88
+ this.fileStore = this.options.fileStore ?? createFileStore();
85
89
  }
86
90
  recordPath(id) {
87
91
  return this.options.stateDir ? join(this.options.stateDir, `${id}.json`) : undefined;
@@ -531,8 +535,19 @@ export class ChannelJobManager {
531
535
  if (!record) {
532
536
  return undefined;
533
537
  }
534
- const result = await this.executor.exec(`cat ${shellEscape(record.spillFile)} 2>/dev/null || true`, { signal });
535
- return { spillFile: record.spillFile, text: result.stdout };
538
+ // Both callers (the completion wake and the `job` tool) only ever want the *tail* of a job's
539
+ // output, so read it via `FileStore` straight from the end of the file rather than shelling
540
+ // out to `cat` (spec 044, D8) -- no 10MB shell-capture cap silently eating the head of a long
541
+ // job's output before the tail-truncation logic even runs, and no subprocess for what's a
542
+ // plain local-file read.
543
+ const stat = await this.fileStore.stat(record.spillFile);
544
+ if (!stat) {
545
+ return { spillFile: record.spillFile, text: "" };
546
+ }
547
+ const start = Math.max(0, stat.size - JOB_OUTPUT_READ_MAX_BYTES);
548
+ const { data } = await this.fileStore.readBytes(record.spillFile, { start, signal });
549
+ const text = start > 0 ? `[...output truncated...]\n${data.toString("utf-8")}` : data.toString("utf-8");
550
+ return { spillFile: record.spillFile, text };
536
551
  }
537
552
  }
538
553
  // One manager per channel, shared across tool rebuilds so job records survive a resource reload —
@@ -18,7 +18,7 @@ export declare const AUTOMATIC_TURN_CONTEXT_BUDGET_UNITS = 3000;
18
18
  * Tool schemas are the larger half of the fixed per-turn cost and were the only part of it with
19
19
  * no budget at all: the runtime-authored prompt is capped at 700 units while the schemas beside it
20
20
  * run several thousand. They sit in the provider's cache prefix, so the steady-state price is low —
21
- * but every `rebuildSessionTools` (a `skill_manage` write, `/reload`, any resource reload) swaps
21
+ * but every `rebuildSessionTools` (a workspace skill write, `/reload`, any resource reload) swaps
22
22
  * that prefix and pays for all of it again.
23
23
  *
24
24
  * There is no hard cap on purpose. A schema cannot be auto-trimmed the way a prompt section can:
@@ -19,7 +19,7 @@ export const AUTOMATIC_TURN_CONTEXT_BUDGET_UNITS = 3_000;
19
19
  * Tool schemas are the larger half of the fixed per-turn cost and were the only part of it with
20
20
  * no budget at all: the runtime-authored prompt is capped at 700 units while the schemas beside it
21
21
  * run several thousand. They sit in the provider's cache prefix, so the steady-state price is low —
22
- * but every `rebuildSessionTools` (a `skill_manage` write, `/reload`, any resource reload) swaps
22
+ * but every `rebuildSessionTools` (a workspace skill write, `/reload`, any resource reload) swaps
23
23
  * that prefix and pays for all of it again.
24
24
  *
25
25
  * There is no hard cap on purpose. A schema cannot be auto-trimmed the way a prompt section can:
@@ -72,8 +72,8 @@ export const INVARIANTS_SECTION = {
72
72
  maxChars: 900,
73
73
  overflow: "error",
74
74
  render: (context) => {
75
- const memoryLine = hasTool(context, "memory_manage")
76
- ? "- SESSION.md, MEMORY.md and HISTORY.md are runtime-managed; do not edit them with file tools. Use `memory_manage` in the same turn when the user explicitly asks to remember or forget something."
75
+ const memoryLine = hasTool(context, "memory_save")
76
+ ? "- SESSION.md, MEMORY.md and HISTORY.md are runtime-managed; do not edit them with file tools. Use `memory_save` / `memory_forget` in the same turn when the user explicitly asks to remember or forget something."
77
77
  : "- SESSION.md, MEMORY.md and HISTORY.md are runtime-managed; do not edit them with file tools.";
78
78
  return [
79
79
  "## Runtime Boundaries",
@@ -90,12 +90,12 @@ export const TASK_CORE_SECTION = {
90
90
  source: "runtime/tasks",
91
91
  authority: "runtime-hard",
92
92
  cacheClass: "runtime-stable",
93
- requiresAllTools: ["task_manage"],
93
+ requiresAllTools: ["task_create", "task_update", "task_close"],
94
94
  maxChars: 600,
95
95
  overflow: "error",
96
96
  render: () => [
97
97
  "## Persistent Work",
98
- "Use a task only when work must survive this turn. Follow the exact task file and runtime guide named by a task wake; use `task_manage` for lifecycle state and never expand the task's stated scope or bypass its verification gate.",
98
+ "Use a task only when work must survive this turn. Follow the exact task file and runtime guide named by a task wake; use `task_update`/`task_close` for lifecycle state and never expand the task's stated scope or bypass its verification gate.",
99
99
  ].join("\n"),
100
100
  };
101
101
  export const PLAYBOOKS_SECTION = {
@@ -129,9 +129,12 @@ export const SUBAGENTS_SECTION = {
129
129
  // (it does not count toward the 700/1200 unit budget — see builder.ts's
130
130
  // RUNTIME_AUTHORED_SECTION_IDS — so it must not be padded just because it is "free").
131
131
  if (context.subAgents.length === 0) {
132
+ const hasInline = context.tools.some((tool) => tool.name === "subagent_inline");
132
133
  return [
133
134
  "## Sub-Agents",
134
- "Delegate with `subagent`: pass an inline `systemPrompt` (no configured agent is required).",
135
+ hasInline
136
+ ? "No configured agent exists yet: delegate with `subagent_inline`, passing a `systemPrompt` (no configured agent is required)."
137
+ : "No configured agent exists and `subagent_inline` is off; ask the deployer to add a role or enable it.",
135
138
  "A sub-agent starts blank — state goal, scope, paths, constraints, acceptance criteria in `task`.",
136
139
  "Read agent-delegation.md before non-trivial delegation.",
137
140
  ].join("\n");
@@ -14,5 +14,7 @@ export interface SessionEventHandlerContext {
14
14
  ledger: UsageLedger;
15
15
  isModelCostKnown?: (modelReference: string) => boolean;
16
16
  refreshSessionResources?: () => Promise<void>;
17
+ /** Absolute path to `<workspaceDir>/skills` — see `isWorkspaceSkillWrite`. */
18
+ skillsDir?: string;
17
19
  }
18
20
  export declare function handleSessionEvent(event: unknown, context: SessionEventHandlerContext): Promise<void>;
@@ -1,12 +1,25 @@
1
1
  import * as log from "../log.js";
2
- import { extractLabelFromArgs, truncate } from "../shared/text-utils.js";
2
+ import { truncate } from "../shared/text-utils.js";
3
3
  import { isRecord } from "../shared/type-guards.js";
4
- import { isRecoverableRejection, toolResultDetails } from "../tools/tool-details.js";
4
+ import { describeToolCall } from "../tools/presentation.js";
5
+ import { isArgumentValidationFailure, isRecoverableRejection, toolResultDetails, } from "../tools/tool-details.js";
5
6
  import { isEffectfulTool, noteChannelEffect } from "./effect-ledger.js";
6
7
  import { extractToolResultText, formatProgressEntry } from "./progress-formatter.js";
7
8
  import { extractCustomCommandResultText, isAssistantEventMessage, isAutoCompactionEndEvent, isAutoCompactionStartEvent, isAutoRetryStartEvent, isMessageEndEvent, isMessageStartEvent, isSubAgentToolDetails, isTextPart, isThinkingPart, isToolExecutionEndEvent, isToolExecutionStartEvent, isToolExecutionUpdateEvent, isTurnEndEvent, } from "./type-guards.js";
8
- function isSkillManageDetails(value) {
9
- return isRecord(value) && value.kind === "skill_manage";
9
+ /**
10
+ * A `write`/`edit` result whose resolved target landed inside the workspace `skills/` tree. The
11
+ * `skill` tool is read-only (spec 045); authoring a workspace skill goes through the generic file
12
+ * tools, so this is the only way the runtime learns "the skill catalog may have changed" — no
13
+ * per-tool `requiresResourceRefresh` flag to keep in sync any more.
14
+ */
15
+ function isWorkspaceSkillWrite(toolName, details, skillsDir) {
16
+ if (toolName !== "write" && toolName !== "edit") {
17
+ return false;
18
+ }
19
+ if (!isRecord(details) || typeof details.path !== "string") {
20
+ return false;
21
+ }
22
+ return details.path === skillsDir || details.path.startsWith(`${skillsDir}/`);
10
23
  }
11
24
  function mergeSubAgentUsage(totalUsage, details) {
12
25
  totalUsage.input += details.usage.input;
@@ -43,7 +56,7 @@ export async function handleSessionEvent(event, context) {
43
56
  const showProgress = ctx.progressStyle !== "none";
44
57
  const finalToCard = ctx.finalDelivery === "card";
45
58
  if (isToolExecutionStartEvent(event)) {
46
- const label = extractLabelFromArgs(event.args) || event.toolName;
59
+ const label = describeToolCall(event.toolName, event.args);
47
60
  pendingTools.set(event.toolCallId, {
48
61
  toolName: event.toolName,
49
62
  args: event.args,
@@ -93,21 +106,23 @@ export async function handleSessionEvent(event, context) {
93
106
  subAgentDetails.usage.cost.total > 0 || (context.isModelCostKnown?.(subAgentDetails.model) ?? false);
94
107
  }
95
108
  const details = toolResultDetails(event.result);
96
- if (isSkillManageDetails(details)) {
97
- if (details.requiresResourceRefresh && context.refreshSessionResources) {
98
- queue.enqueue(() => context.refreshSessionResources?.() ?? Promise.resolve(), "refresh skills");
99
- }
100
- if (details.notice) {
101
- queue.enqueue(() => ctx.respondInThread(details.notice ?? ""), "skill notice");
102
- }
109
+ if (context.skillsDir &&
110
+ context.refreshSessionResources &&
111
+ isWorkspaceSkillWrite(event.toolName, details, context.skillsDir)) {
112
+ queue.enqueue(() => context.refreshSessionResources?.() ?? Promise.resolve(), "refresh skills");
113
+ queue.enqueue(() => ctx.respondInThread("已沉淀:workspace skill 已更新,下一轮生效。"), "skill notice");
103
114
  }
104
115
  // A recoverable rejection (bad arguments, unmet precondition the model can fix) is not a
105
116
  // fault: the model normally corrects it on the next call. It is logged so the retry is
106
117
  // still diagnosable, but never rendered to the user — a red bubble would report a failure
107
118
  // that never happened and make the assistant look broken mid-turn. Rejections the *user*
108
119
  // must resolve (a security guard refusal or an external decision) stay plain errors and remain visible.
109
- const rejected = isRecoverableRejection(event.result);
110
- const treatAsError = event.isError || Boolean(subAgentDetails?.failed);
120
+ // Spec 047, D4.2: a schema-validation failure is rejected by the SDK before `execute`, so it
121
+ // never passes through `withToolDetails` and carries no `recoverable` flag — but it is still
122
+ // something the model fixes by re-issuing correct arguments, so it must not surface as a
123
+ // user-visible error. `event.isError` is true for it, so it has to win over `treatAsError`.
124
+ const rejected = isRecoverableRejection(event.result) || isArgumentValidationFailure(event.result, event.isError === true);
125
+ const treatAsError = (event.isError || Boolean(subAgentDetails?.failed)) && !rejected;
111
126
  if (treatAsError) {
112
127
  log.logToolError(logCtx, event.toolName, durationMs, resultStr);
113
128
  }
@@ -17,8 +17,8 @@ const SYNTHETIC_TOOL_RESULT_HEADER = "Error: Pipiclaw restarted before a durable
17
17
  "do not repeat the operation blindly.";
18
18
  const SYNTHETIC_ABORTED_ASSISTANT_TEXT = "Error: Pipiclaw restarted before a response was generated. Re-send the request if it is still needed.";
19
19
  function toolGuidance(toolName) {
20
- if (toolName === "subagent" || toolName === "subagent_manage") {
21
- return "先用 `subagent_manage op=list` / `show` 查询这次委派是否已经作为一个 durable run 存在。";
20
+ if (toolName === "subagent" || toolName === "subagent_list" || toolName === "subagent_run") {
21
+ return "先用 `subagent_list` / `subagent_run op=show` 查询这次委派是否已经作为一个 durable run 存在。";
22
22
  }
23
23
  if (toolName === "job" || toolName === "bash") {
24
24
  return "若这是一次异步操作(后台 job 或已启动的进程),先用 job `list` / `poll` 查记录,再决定是否需要重跑。";
@@ -78,7 +78,11 @@ export function isAutoRetryStartEvent(value) {
78
78
  typeof value.errorMessage === "string");
79
79
  }
80
80
  export function isSubAgentToolDetails(value) {
81
- if (!value || typeof value !== "object" || !("kind" in value) || value.kind !== "subagent") {
81
+ if (!value || typeof value !== "object" || !("kind" in value)) {
82
+ return false;
83
+ }
84
+ const kind = value.kind;
85
+ if (kind !== "subagent" && kind !== "subagent_inline") {
82
86
  return false;
83
87
  }
84
88
  if (!("usage" in value)) {
@@ -12,8 +12,8 @@ export interface PipiclawSkillsResult {
12
12
  /**
13
13
  * Load skills from the workspace-level skill directory.
14
14
  *
15
- * Diagnostics (an unreadable SKILL.md, bad frontmatter, a duplicate name) were
16
- * previously dropped on the floor, so a broken workspace skill silently vanished
15
+ * Diagnostics (an unreadable SKILL.md, bad frontmatter, a duplicate name, content that failed the
16
+ * scan above) were previously dropped on the floor, so a broken workspace skill silently vanished
17
17
  * from the prompt. They are returned now and surfaced by the runner.
18
18
  */
19
19
  export declare function loadPipiclawSkills(channelDir: string): PipiclawSkillsResult;
@@ -4,19 +4,57 @@
4
4
  * SOUL.md and AGENTS.md are loaded by the prompt pipeline itself
5
5
  * (`agent/prompt/resources.ts`), which owns their budgets and framing.
6
6
  */
7
+ import { readFileSync } from "node:fs";
7
8
  import { loadSkillsFromDir } from "@earendil-works/pi-coding-agent";
8
9
  import { join } from "path";
10
+ import { scanSkillContent } from "../tools/skill-security.js";
11
+ /**
12
+ * Content scanning moved here from the old `skill_manage` write path (spec 045): `skill` is now
13
+ * read-only and workspace skills are authored through the generic `write`/`edit` tools, which have
14
+ * no reason to know about skill-specific content rules. `Skill` (from pi's resource loader) carries
15
+ * only catalog metadata, not the file body, so this reads each candidate's `SKILL.md` itself --
16
+ * that read is also what keeps a scan-failing skill out of the `<available_skills>` catalog
17
+ * entirely, not just out of the (optional) `skill read` tool: the catalog is what tells the model
18
+ * the skill exists in the first place. An unreadable file is treated as "keep it" here -- a race or
19
+ * permission glitch should not itself become a silent content-policy rejection.
20
+ */
21
+ function filterScannedSkills(skills) {
22
+ const kept = [];
23
+ const diagnostics = [];
24
+ for (const skill of skills) {
25
+ let content;
26
+ try {
27
+ content = readFileSync(skill.filePath, "utf-8");
28
+ }
29
+ catch {
30
+ kept.push(skill);
31
+ continue;
32
+ }
33
+ const scan = scanSkillContent(content);
34
+ if (scan.ok) {
35
+ kept.push(skill);
36
+ continue;
37
+ }
38
+ diagnostics.push({
39
+ type: "warning",
40
+ message: `Skill "${skill.name}" was not loaded: ${scan.error}.`,
41
+ path: skill.filePath,
42
+ });
43
+ }
44
+ return { skills: kept, diagnostics };
45
+ }
9
46
  /**
10
47
  * Load skills from the workspace-level skill directory.
11
48
  *
12
- * Diagnostics (an unreadable SKILL.md, bad frontmatter, a duplicate name) were
13
- * previously dropped on the floor, so a broken workspace skill silently vanished
49
+ * Diagnostics (an unreadable SKILL.md, bad frontmatter, a duplicate name, content that failed the
50
+ * scan above) were previously dropped on the floor, so a broken workspace skill silently vanished
14
51
  * from the prompt. They are returned now and surfaced by the runner.
15
52
  */
16
53
  export function loadPipiclawSkills(channelDir) {
17
54
  const workspaceSkillsDir = join(channelDir, "..", "skills");
18
55
  const loaded = loadSkillsFromDir({ dir: workspaceSkillsDir, source: "workspace" });
19
- return { skills: loaded.skills, diagnostics: loaded.diagnostics };
56
+ const scanned = filterScannedSkills(loaded.skills);
57
+ return { skills: scanned.skills, diagnostics: [...loaded.diagnostics, ...scanned.diagnostics] };
20
58
  }
21
59
  /**
22
60
  * Merge pi's auto-discovered skills with the workspace ones. Workspace wins on a
@@ -28,9 +28,23 @@ export interface ExecOptions {
28
28
  stdin?: string;
29
29
  /** Directory to run the command in. Defaults to the daemon's own working directory. */
30
30
  cwd?: string;
31
+ /** Override the default 10MB in-memory capture cap for this call (spec 044, D6.2). */
32
+ maxCaptureBytes?: number;
33
+ /**
34
+ * When set, every stdout/stderr byte is also streamed to this path as it arrives, independent
35
+ * of `maxCaptureBytes` -- so a caller (e.g. `bash`) can offer a genuinely complete "full output"
36
+ * file even for a command whose captured `ExecResult.stdout`/`stderr` was truncated (spec 044,
37
+ * D6.3). Best-effort: a stream failure is swallowed, since the capped in-memory result is still
38
+ * returned either way. Interleaves stdout and stderr in arrival order.
39
+ */
40
+ spillTo?: string;
31
41
  }
32
42
  export interface ExecResult {
33
43
  stdout: string;
34
44
  stderr: string;
35
45
  code: number;
46
+ /** True when `stdout` was cut at the capture cap and does not hold the command's full output. */
47
+ stdoutTruncated?: boolean;
48
+ /** True when `stderr` was cut at the capture cap and does not hold the command's full output. */
49
+ stderrTruncated?: boolean;
36
50
  }