@sema-agent/core 2.4.0 → 2.5.0

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 (34) hide show
  1. package/dist/agents/subagent.js +17 -14
  2. package/dist/core/auto-compaction.d.ts +2 -0
  3. package/dist/core/auto-compaction.js +2 -1
  4. package/dist/core/mcp.js +4 -1
  5. package/dist/core/runner/prepare-task.d.ts +5 -0
  6. package/dist/core/runner/prepare-task.js +21 -1
  7. package/dist/core/runner/runtask.js +39 -9
  8. package/dist/core/runner/tool-disclosure.d.ts +1 -0
  9. package/dist/core/runner/tool-disclosure.js +16 -5
  10. package/dist/core/session-reconcile.d.ts +1 -0
  11. package/dist/core/session-reconcile.js +40 -20
  12. package/dist/core/task-registry-agent.d.ts +2 -0
  13. package/dist/core/task-registry-agent.js +11 -1
  14. package/dist/core/task-registry-shared.d.ts +1 -0
  15. package/dist/core/task-registry.d.ts +2 -0
  16. package/dist/core/task-registry.js +11 -0
  17. package/dist/core/types.d.ts +10 -3
  18. package/dist/engine/compaction/compaction.d.ts +5 -0
  19. package/dist/engine/compaction/compaction.js +68 -2
  20. package/dist/engine/compaction/utils.d.ts +6 -0
  21. package/dist/engine/compaction/utils.js +53 -3
  22. package/dist/engine/harness/messages.d.ts +1 -1
  23. package/dist/engine/harness/messages.js +11 -3
  24. package/dist/engine/loop/types.d.ts +2 -0
  25. package/dist/engine/session/import-validate.js +30 -1
  26. package/dist/engine/session/session.js +7 -5
  27. package/dist/index.d.ts +7 -0
  28. package/dist/index.js +7 -0
  29. package/dist/internal/harness.d.ts +1 -1
  30. package/dist/internal/harness.js +1 -1
  31. package/dist/orchestration/workflow-types.d.ts +1 -0
  32. package/dist/orchestration/workflow.js +10 -1
  33. package/dist/tools/fs/fs-bash.js +11 -5
  34. package/package.json +1 -1
@@ -173,7 +173,7 @@ async function runShell(env, cwd, toolName, command, timeoutSec, caps, signal, c
173
173
  const rawRemainSec = Math.floor((deadline - Date.now()) / 1000);
174
174
  const maxSec = Math.max(1, rawRemainSec);
175
175
  if (maxSec < timeout) {
176
- execClamp.onClamp?.(timeout, maxSec);
176
+ execClamp.onClamp?.(requestedSec, maxSec);
177
177
  timeout = maxSec;
178
178
  clampedByDeadline = true;
179
179
  deadlineExhausted = rawRemainSec < 1;
@@ -310,6 +310,9 @@ async function runShell(env, cwd, toolName, command, timeoutSec, caps, signal, c
310
310
  cwdOutsideNote = `NOTE: working directory is now outside the task root(s) (${cwdRef.current}); relative paths in the structured file tools (Read/Edit/Write/Grep/Glob) will resolve there and may be refused. Pass absolute in-root paths, or \`cd\` back inside.`;
311
311
  }
312
312
  }
313
+ const survivedCapNote = cappedByMaxTimeout
314
+ ? `NOTE: requested timeout ${requestedSec}s was capped to the ${caps.maxSec}s engine ceiling (requests above the max are reduced to it) — no effect on this run (the command completed in time); use run_in_background for work that needs longer.`
315
+ : "";
313
316
  const clippedStdout = clipShellOutput(stdout);
314
317
  const clippedStderr = clipShellOutput(stderr);
315
318
  const stdoutImage = dataUriImageFromStdout(stdout);
@@ -319,9 +322,9 @@ async function runShell(env, cwd, toolName, command, timeoutSec, caps, signal, c
319
322
  return {
320
323
  content: [
321
324
  { type: "image", data: stdoutImage.data, mimeType: stdoutImage.mime },
322
- { type: "text", text: `exit code: ${exitCode}\n[Image data detected in stdout and shown above]${stderr.trim() !== "" ? `\n--- stderr ---\n${clippedStderr}` : ""}${imgOverflowNote}${cwdOutsideNote ? `\n${cwdOutsideNote}` : ""}` },
325
+ { type: "text", text: `exit code: ${exitCode}\n[Image data detected in stdout and shown above]${stderr.trim() !== "" ? `\n--- stderr ---\n${clippedStderr}` : ""}${imgOverflowNote}${cwdOutsideNote ? `\n${cwdOutsideNote}` : ""}${survivedCapNote ? `\n${survivedCapNote}` : ""}` },
323
326
  ],
324
- details: { type: "bash", stdout: "[image data]", stderr: clippedStderr, exitCode, isImage: true, ...(imgOverflowFile !== undefined ? { output_file: imgOverflowFile } : {}) },
327
+ details: { type: "bash", stdout: "[image data]", stderr: clippedStderr, exitCode, isImage: true, ...(imgOverflowFile !== undefined ? { output_file: imgOverflowFile } : {}), ...(cappedByMaxTimeout ? { requestedTimeoutSec: requestedSec, cappedToMaxTimeoutSec: caps.maxSec } : {}) },
325
328
  };
326
329
  }
327
330
  const cleanOverflowFile = stdout.length > bashMaxOutputChars() || stderr.length > bashMaxOutputChars() ? await writeShellOverflowFile(env, stdout, stderr) : undefined;
@@ -334,6 +337,8 @@ async function runShell(env, cwd, toolName, command, timeoutSec, caps, signal, c
334
337
  parts.push(overflowNote.trim());
335
338
  if (cwdOutsideNote)
336
339
  parts.push(cwdOutsideNote);
340
+ if (survivedCapNote)
341
+ parts.push(survivedCapNote);
337
342
  return {
338
343
  content: parts.join("\n"),
339
344
  details: {
@@ -343,6 +348,7 @@ async function runShell(env, cwd, toolName, command, timeoutSec, caps, signal, c
343
348
  exitCode,
344
349
  ...(exit1Note ? { returnCodeInterpretation: exit1Note } : {}),
345
350
  ...(cleanOverflowFile !== undefined ? { output_file: cleanOverflowFile } : {}),
351
+ ...(cappedByMaxTimeout ? { requestedTimeoutSec: requestedSec, cappedToMaxTimeoutSec: caps.maxSec } : {}),
346
352
  },
347
353
  };
348
354
  }
@@ -379,7 +385,7 @@ export function createBashTool(env, rootCanonical, coAuthor = false, cwdRef = {
379
385
  description: bashDescription(coAuthor, timeoutCaps, bgNotifies, bgRetained),
380
386
  parameters: Type.Object({
381
387
  command: Type.String({ description: "The command to execute" }),
382
- timeout: Type.Optional(Type.Number({ description: `Optional timeout in milliseconds (max ${timeoutCaps.maxMs})` })),
388
+ timeout: Type.Optional(Type.Number({ description: `Optional timeout in milliseconds (max ${timeoutCaps.maxMs}; requests above the max are capped to it)` })),
383
389
  description: Type.Optional(Type.String({
384
390
  description: 'Clear, concise description of what this command does in active voice. Never use words like "complex" or "risk" in the description - just describe what it does.\n' +
385
391
  "\n" +
@@ -632,7 +638,7 @@ export function createBashReadonlyTool(env, rootCanonical, allow, execClamp, tim
632
638
  "allowlisted commands run. Still subject to the deployment's approval policy.",
633
639
  parameters: Type.Object({
634
640
  command: Type.String({ description: "A single allowlisted read-only command (no shell operators)." }),
635
- timeout: Type.Optional(Type.Number({ description: `Timeout in milliseconds (default ${timeoutCaps.defaultMs}, max ${timeoutCaps.maxMs}).` })),
641
+ timeout: Type.Optional(Type.Number({ description: `Timeout in milliseconds (default ${timeoutCaps.defaultMs}, max ${timeoutCaps.maxMs}; requests above the max are capped to it).` })),
636
642
  }),
637
643
  effect: "read",
638
644
  execute: async (args, ctx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/core",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Stateless, task-oriented AI agent core",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",