@dyyz1993/pi-coding-agent 0.74.40 → 0.74.41

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.
@@ -73,20 +73,21 @@ type BashToolDetails = _BashToolDetails & {
73
73
  };
74
74
 
75
75
  const DEFAULT_TIMEOUT_SECONDS = 300;
76
- const DEFAULT_BACKGROUND_AFTER_SECONDS = 120;
76
+ const MAX_TIMEOUT_SECONDS = 14400; // 4 hours — foreground commands shouldn't run longer
77
+ const DEFAULT_BACKGROUND_AFTER_SECONDS = 600;
77
78
 
78
79
  const bashSchema = Type.Object({
79
80
  command: Type.String({ description: "Bash command to execute" }),
80
81
  description: Type.String({ description: "Clear, concise description of what this command does in 5-10 words" }),
81
82
  timeout: Type.Optional(
82
83
  Type.Number({
83
- description: `Hard timeout in seconds. Process is killed if still running after this duration. Defaults to ${DEFAULT_TIMEOUT_SECONDS}s (5 minutes). Acts as a safety net to prevent zombie processes.`,
84
+ description: `Hard timeout in seconds (max ${MAX_TIMEOUT_SECONDS}s = 4h). Process is killed if still running after this duration. Defaults to ${DEFAULT_TIMEOUT_SECONDS}s (5 minutes). Acts as a safety net to prevent zombie processes.`,
84
85
  }),
85
86
  ),
86
87
  backgroundAfter: Type.Optional(
87
88
  Type.Number({
88
89
  description:
89
- "Soft limit in seconds. If the command runs longer than this, it is automatically moved to background instead of blocking the agent. The process continues running; the agent receives a background notification and can proceed with other work. Must be less than timeout if both are set. Use for long-running tasks like builds or installs where you want the agent to stay productive.",
90
+ `Soft limit in seconds. If the command runs longer than this, it is automatically moved to background instead of blocking the agent. Default: ${DEFAULT_BACKGROUND_AFTER_SECONDS}s (10 min). Must be less than timeout if set. Use for long-running tasks where the agent should stay productive.`,
90
91
  }),
91
92
  ),
92
93
  cwd: Type.Optional(
@@ -317,8 +318,8 @@ export default function (pi: ExtensionAPI) {
317
318
  `Execute a bash command. Returns stdout and stderr. Output is truncated to last ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). If truncated, full output is saved to a temp file.`,
318
319
  "",
319
320
  "Timeout and background behavior:",
320
- `- timeout: Hard limit in seconds. Process is killed after this duration. Default: ${DEFAULT_TIMEOUT_SECONDS}s (5 min). This is a safety net — always present.`,
321
- "- backgroundAfter: Soft limit in seconds. If the command runs longer, it is automatically moved to background. The process keeps running, the agent receives a notification and can continue other work.",
321
+ `- timeout: Hard limit in seconds. Process is killed after this duration. Default: ${DEFAULT_TIMEOUT_SECONDS}s (5 min). Max: ${MAX_TIMEOUT_SECONDS}s (4h). This is a safety net — always present.`,
322
+ "- backgroundAfter: Soft limit in seconds. If the command runs longer, it is automatically moved to background. Default: ${DEFAULT_BACKGROUND_AFTER_SECONDS}s (10 min). The process keeps running, the agent receives a notification and can continue other work.",
322
323
  "- If backgroundAfter < timeout: command goes to background first, then gets killed if it reaches timeout.",
323
324
  "- If backgroundAfter >= timeout (or not set): command runs until timeout, then gets killed.",
324
325
  "",
@@ -341,7 +342,7 @@ export default function (pi: ExtensionAPI) {
341
342
  _ctx?: ExtensionContext,
342
343
  ): Promise<AgentToolResult<BashToolDetails>> {
343
344
  return new Promise((resolve, reject) => {
344
- const effectiveTimeout = timeout ?? DEFAULT_TIMEOUT_SECONDS;
345
+ const effectiveTimeout = Math.min(timeout ?? DEFAULT_TIMEOUT_SECONDS, MAX_TIMEOUT_SECONDS);
345
346
  const rawBackgroundAfter = backgroundAfter ?? DEFAULT_BACKGROUND_AFTER_SECONDS;
346
347
  const effectiveBackgroundAfter = rawBackgroundAfter < effectiveTimeout ? rawBackgroundAfter : undefined;
347
348
  const cwd = cwdParam ?? _ctx?.cwd ?? process.cwd();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dyyz1993/pi-coding-agent",
3
- "version": "0.74.40",
3
+ "version": "0.74.41",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {