@sema-agent/core 4.0.0 → 5.0.1

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 (60) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/agents/cascade.d.ts +1 -0
  3. package/dist/agents/cascade.js +1 -1
  4. package/dist/agents/repair-loop.d.ts +2 -0
  5. package/dist/agents/repair-loop.js +30 -6
  6. package/dist/agents/roster-store.d.ts +1 -0
  7. package/dist/agents/roster-store.js +1 -1
  8. package/dist/agents/send-message-tool.d.ts +1 -0
  9. package/dist/agents/send-message-tool.js +3 -1
  10. package/dist/agents/subagent.d.ts +3 -1
  11. package/dist/agents/subagent.js +22 -34
  12. package/dist/agents/tool-filter.js +6 -7
  13. package/dist/agents/verify.d.ts +1 -0
  14. package/dist/agents/verify.js +1 -1
  15. package/dist/core/arg-summary.d.ts +21 -1
  16. package/dist/core/arg-summary.js +61 -14
  17. package/dist/core/auto-compaction.d.ts +1 -0
  18. package/dist/core/auto-compaction.js +1 -1
  19. package/dist/core/fs-write-gate-policy.js +2 -3
  20. package/dist/core/hooks.d.ts +1 -0
  21. package/dist/core/hooks.js +1 -1
  22. package/dist/core/mcp.js +0 -6
  23. package/dist/core/permission-rules.d.ts +2 -2
  24. package/dist/core/permission-rules.js +12 -3
  25. package/dist/core/runner/active-skill-scope.js +1 -2
  26. package/dist/core/runner/prepare-task.js +38 -18
  27. package/dist/core/runner/runtask.js +19 -16
  28. package/dist/core/runner/session-rule-policy.d.ts +2 -2
  29. package/dist/core/runner/session-rule-policy.js +4 -4
  30. package/dist/core/sensitive-path-policy.js +2 -3
  31. package/dist/core/session-reconcile.js +1 -2
  32. package/dist/core/skill-tool-specifier.js +2 -3
  33. package/dist/core/skills-directory.js +2 -3
  34. package/dist/core/task-registry-shared.d.ts +1 -1
  35. package/dist/core/task-registry.d.ts +5 -1
  36. package/dist/core/task-registry.js +12 -30
  37. package/dist/core/task-tool-shape.d.ts +0 -2
  38. package/dist/core/task-tool-shape.js +2 -5
  39. package/dist/core/tool-name-aliases.d.ts +1 -2
  40. package/dist/core/tool-name-aliases.js +42 -60
  41. package/dist/core/tool-policy.js +11 -12
  42. package/dist/core/trace.d.ts +7 -0
  43. package/dist/core/untrusted-egress.d.ts +4 -2
  44. package/dist/core/untrusted-egress.js +21 -9
  45. package/dist/engine/execution-env/node-execution-env.js +1 -1
  46. package/dist/engine/loop/agent-loop.js +3 -12
  47. package/dist/index.d.ts +3 -2
  48. package/dist/index.js +2 -2
  49. package/dist/orchestration/run-spec.js +2 -3
  50. package/dist/orchestration/run-workflow-tool.js +0 -1
  51. package/dist/orchestration/workflow-governance.js +2 -1
  52. package/dist/orchestration/workflow.d.ts +1 -0
  53. package/dist/orchestration/workflow.js +1 -1
  54. package/dist/prompt-assembly/packs/sema-default.js +1 -3
  55. package/dist/prompts/default.js +1 -3
  56. package/dist/prompts/simple-sections.d.ts +0 -1
  57. package/dist/prompts/simple-sections.js +0 -1
  58. package/dist/tools/fs/fs-bash.js +6 -8
  59. package/dist/tools/fs/fs-write.js +0 -1
  60. package/package.json +1 -1
@@ -1,7 +1,6 @@
1
1
  export declare const SIMPLE_COMMUNICATING_FABLE = "# Communicating with the user\n\nYour text output is what the user reads; they usually can't see your thinking or the raw tool results. Write it for a teammate who stepped away and is catching up, not for a log file: they don't know the codenames or shorthand you created along the way, and they didn't watch your process unfold. Before your first tool call, say in a sentence what you're about to do; while working, give brief updates when you find something load-bearing or change direction.\n\nText you write between tool calls may not be shown to the user. Everything the user needs from this turn \u2014 answers, summaries, findings, conclusions, deliverables \u2014 must be in the final text message of your turn, with no tool calls after it. Keep text between tool calls to brief status notes. If something important appeared only mid-turn or in your thinking, restate it in that final message.\n\nLead with the outcome. Your first sentence after finishing should answer \"what happened\" or \"what did you find\" \u2014 the thing the user would ask for if they said \"just give me the TLDR.\" Supporting detail and reasoning come after, for readers who want them.\n\nBeing readable and being concise are different things, and readable matters more. If the user has to reread your summary or ask you to explain, any time saved by brevity is gone. The way to keep output short is to be selective about what you include (drop details that don't change what the reader would do next), not to compress the writing into fragments, abbreviations, arrow chains like `A \u2192 B \u2192 fails`, or jargon. What you do include, write in complete sentences with the technical terms spelled out. Don't make the reader cross-reference labels or numbering you invented earlier; say what you mean in place.\n\nMatch the response to the question: a simple question gets a direct answer in prose, not headers and sections. Use tables only for short enumerable facts, with explanations in the surrounding prose rather than the cells. Calibrate to the user \u2014 a bit tighter for an expert, more explanatory for someone newer.\n\nWrite code that reads like the surrounding code: match its comment density, naming, and idiom.\nOnly write a code comment to state a constraint the code itself can't show \u2014 never to say where it came from, what the next line does, or why your change is correct; that's you talking to the reviewer, not the next reader, and it's noise the moment the PR merges.";
2
2
  export declare const SIMPLE_COMMUNICATING_LEAN = "Write code that reads like the surrounding code: match its comment density, naming, and idiom.";
3
3
  export declare const SIMPLE_ACTION_CAUTION = "For actions that are hard to reverse or outward-facing, confirm first unless durably authorized or explicitly told to proceed without asking; approval in one context doesn't extend to the next. Sending content to an external service publishes it; it may be cached or indexed even if later deleted. Before deleting or overwriting, look at the target \u2014 if what you find contradicts how it was described, or you didn't create it, surface that instead of proceeding. Report outcomes faithfully: if tests fail, say so with the output; if a step was skipped, say that; when something is done and verified, state it plainly without hedging.";
4
- export declare const SIMPLE_TASK_CONTINUITY = "When a task has been agreed, the approval covers it end to end \u2014 in-scope steps don't need re-confirmation (irreversible or shared-system actions still do). Announcing a step without the tool call in the same turn hands control back with the work still pending; if the next step is decided, run it. Hand back only when done, waiting on something external, or the next step needs the user's decision. If the user asks something mid-task, answer and continue.";
5
4
  export declare const SIMPLE_INVESTIGATE_FIRST = "Asking the user a clarifying question has a cost: it interrupts them, and often they could have answered it themselves with a grep. Before asking, spend up to a minute on read-only investigation (grep the codebase, check docs, search memory) so your question is specific. \"I found tunnels X and Y in the config \u2014 which one?\" beats \"what tunnel?\"";
6
5
  export declare const SIMPLE_CONTEXT_MANAGEMENT = "# Context management\nWhen the conversation grows long, some or all of the current context is summarized; the summary, along with any remaining unsummarized context, is provided in the next context window so work can continue \u2014 you don't need to wrap up early or hand off mid-task.";
7
6
  export declare const SIMPLE_ACT_DONT_REDERIVE = "When you have enough information to act, act. Do not re-derive facts already established in the conversation, re-litigate a decision the user has already made, or narrate options you will not pursue. If you are weighing a choice, give a recommendation, not an exhaustive survey";
@@ -14,7 +14,6 @@ Write code that reads like the surrounding code: match its comment density, nami
14
14
  Only write a code comment to state a constraint the code itself can't show — never to say where it came from, what the next line does, or why your change is correct; that's you talking to the reviewer, not the next reader, and it's noise the moment the PR merges.`;
15
15
  export const SIMPLE_COMMUNICATING_LEAN = "Write code that reads like the surrounding code: match its comment density, naming, and idiom.";
16
16
  export const SIMPLE_ACTION_CAUTION = "For actions that are hard to reverse or outward-facing, confirm first unless durably authorized or explicitly told to proceed without asking; approval in one context doesn't extend to the next. Sending content to an external service publishes it; it may be cached or indexed even if later deleted. Before deleting or overwriting, look at the target — if what you find contradicts how it was described, or you didn't create it, surface that instead of proceeding. Report outcomes faithfully: if tests fail, say so with the output; if a step was skipped, say that; when something is done and verified, state it plainly without hedging.";
17
- export const SIMPLE_TASK_CONTINUITY = "When a task has been agreed, the approval covers it end to end — in-scope steps don't need re-confirmation (irreversible or shared-system actions still do). Announcing a step without the tool call in the same turn hands control back with the work still pending; if the next step is decided, run it. Hand back only when done, waiting on something external, or the next step needs the user's decision. If the user asks something mid-task, answer and continue.";
18
17
  export const SIMPLE_INVESTIGATE_FIRST = 'Asking the user a clarifying question has a cost: it interrupts them, and often they could have answered it themselves with a grep. Before asking, spend up to a minute on read-only investigation (grep the codebase, check docs, search memory) so your question is specific. "I found tunnels X and Y in the config — which one?" beats "what tunnel?"';
19
18
  export const SIMPLE_CONTEXT_MANAGEMENT = `# Context management
20
19
  When the conversation grows long, some or all of the current context is summarized; the summary, along with any remaining unsummarized context, is provided in the next context window so work can continue — you don't need to wrap up early or hand off mid-task.`;
@@ -2,7 +2,7 @@ import { Type } from "typebox";
2
2
  import { defineTool, errorResult } from "../../core/tools.js";
3
3
  import { defaultTaskRegistry } from "../../core/task-registry.js";
4
4
  import { accountDroppedBytes, spoolDropNote } from "../../core/task-registry-shared.js";
5
- import { TASK_OUTPUT_TOOL_NAME, TASK_STOP_TOOL_NAME, TASK_OUTPUT_ALIASES, TASK_STOP_ALIASES, TASK_OUTPUT_CONTRACT, TASK_STOP_CONTRACT, TASK_OUTPUT_MISSING_ID_MESSAGE, TASK_STOP_MISSING_ID_MESSAGE, TASK_STOP_PARAMS, resolveTaskIdArg, ENV_DIRECT_TASK_TOOL_CAPS, composeTaskOutputDescription, composeTaskOutputParams, composeTaskStopDescription, } from "../../core/task-tool-shape.js";
5
+ import { TASK_OUTPUT_TOOL_NAME, TASK_STOP_TOOL_NAME, TASK_OUTPUT_CONTRACT, TASK_STOP_CONTRACT, TASK_OUTPUT_MISSING_ID_MESSAGE, TASK_STOP_MISSING_ID_MESSAGE, TASK_STOP_PARAMS, resolveTaskIdArg, ENV_DIRECT_TASK_TOOL_CAPS, composeTaskOutputDescription, composeTaskOutputParams, composeTaskStopDescription, } from "../../core/task-tool-shape.js";
6
6
  import { hasBackgroundShell } from "../../core/background-shell.js";
7
7
  import { delimitUntrusted } from "../../core/untrusted-text.js";
8
8
  import { MCP_IMAGE_MAX_BASE64 } from "../../core/mcp.js";
@@ -618,7 +618,7 @@ export function createBashTool(env, rootCanonical, coAuthor = false, cwdRef = {
618
618
  budgetNote +
619
619
  lifetimeNote;
620
620
  }
621
- return (`Started in background; task_id=${r.value.shellId}. Legacy bash_id=${r.value.shellId}. ` +
621
+ return (`Started in background; task_id=${r.value.shellId}. ` +
622
622
  `Use TaskOutput("${r.value.shellId}") to read output (poll until status is no longer "running"); ` +
623
623
  `TaskStop("${r.value.shellId}") to stop. No '&' needed.` +
624
624
  budgetNote +
@@ -1003,14 +1003,13 @@ export function createBashReadonlyTool(env, rootCanonical, allow, execClamp, opt
1003
1003
  export function createEnvTaskOutputTool(env) {
1004
1004
  return defineTool({
1005
1005
  name: TASK_OUTPUT_TOOL_NAME,
1006
- aliases: [...TASK_OUTPUT_ALIASES],
1007
1006
  contract: TASK_OUTPUT_CONTRACT,
1008
1007
  description: composeTaskOutputDescription(ENV_DIRECT_TASK_TOOL_CAPS),
1009
1008
  parameters: composeTaskOutputParams(ENV_DIRECT_TASK_TOOL_CAPS),
1010
1009
  effect: "read",
1011
1010
  execute: async (args) => {
1012
- const { task_id, bash_id, runId, filter } = args;
1013
- const id = resolveTaskIdArg(task_id, bash_id, runId);
1011
+ const { task_id, filter } = args;
1012
+ const id = resolveTaskIdArg(task_id);
1014
1013
  if (!id)
1015
1014
  return errorResult(TASK_OUTPUT_MISSING_ID_MESSAGE);
1016
1015
  if (!hasBackgroundShell(env)) {
@@ -1042,14 +1041,13 @@ export function createEnvTaskOutputTool(env) {
1042
1041
  export function createEnvTaskStopTool(env, registry = defaultTaskRegistry) {
1043
1042
  return defineTool({
1044
1043
  name: TASK_STOP_TOOL_NAME,
1045
- aliases: [...TASK_STOP_ALIASES],
1046
1044
  contract: TASK_STOP_CONTRACT,
1047
1045
  description: composeTaskStopDescription(ENV_DIRECT_TASK_TOOL_CAPS),
1048
1046
  parameters: TASK_STOP_PARAMS,
1049
1047
  effect: "write",
1050
1048
  execute: async (args) => {
1051
- const { task_id, shell_id, runId } = args;
1052
- const id = resolveTaskIdArg(task_id, shell_id, runId);
1049
+ const { task_id, shell_id } = args;
1050
+ const id = resolveTaskIdArg(task_id, shell_id);
1053
1051
  if (!id)
1054
1052
  return errorResult(TASK_STOP_MISSING_ID_MESSAGE);
1055
1053
  if (!hasBackgroundShell(env)) {
@@ -28,7 +28,6 @@ export function createEditFileTool(env, state, rootCanonical, cwdRef, additional
28
28
  "- `old_string` must match the file exactly, including indentation, and be unique — the edit fails otherwise. Strip the Read line prefix (line number + tab) before matching.\n" +
29
29
  "- `replace_all: true` replaces every occurrence instead.\n" +
30
30
  "- The edit also fails if the file changed on disk since you read it — Read it again first.",
31
- aliases: ["MultiEdit"],
32
31
  parameters: Type.Object({
33
32
  ...FILE_PATH_PARAMS,
34
33
  old_string: Type.Optional(Type.String({ description: "The text to replace" })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/core",
3
- "version": "4.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Stateless, task-oriented AI agent core",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",