@sema-agent/core 7.23.1 → 7.23.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.
- package/CHANGELOG.md +22 -0
- package/dist/agents/agent-transcript-tool.js +2 -1
- package/dist/agents/cascade.js +2 -1
- package/dist/agents/list-agents-tool.js +2 -1
- package/dist/agents/observer.js +3 -2
- package/dist/agents/peer-session-drain.js +2 -1
- package/dist/agents/retain-ledger.js +2 -1
- package/dist/agents/send-message-tool.js +11 -10
- package/dist/agents/subagent.js +18 -17
- package/dist/agents/teacher.js +5 -4
- package/dist/brain/circuit-breaker.js +2 -1
- package/dist/brain/degrading.js +2 -1
- package/dist/brain/errors.js +24 -15
- package/dist/brain/failover.js +2 -1
- package/dist/brain/stream-engine.js +2 -1
- package/dist/core/a2a.js +4 -3
- package/dist/core/artifact-host.js +2 -1
- package/dist/core/ask-question.js +3 -2
- package/dist/core/auto-promote.js +3 -2
- package/dist/core/gate-bounded-await.js +2 -1
- package/dist/core/gate-fold.js +4 -1
- package/dist/core/gate-lanes.js +4 -2
- package/dist/core/git-worktree-env.js +6 -5
- package/dist/core/hooks.js +4 -4
- package/dist/core/lsp-session.js +3 -2
- package/dist/core/mcp.js +4 -3
- package/dist/core/memory-admission.js +2 -1
- package/dist/core/memory-engine/consolidation-driver.js +5 -4
- package/dist/core/memory-engine/consolidation.js +2 -1
- package/dist/core/memory-engine/delegation-settlement.js +4 -3
- package/dist/core/memory-engine/distiller.js +8 -4
- package/dist/core/memory-engine/engine.js +63 -55
- package/dist/core/memory-engine/file-backend.js +11 -10
- package/dist/core/memory-engine/layout.js +5 -4
- package/dist/core/memory-engine/session-incarnation.js +2 -1
- package/dist/core/memory.js +2 -1
- package/dist/core/oracle-isolation.js +3 -2
- package/dist/core/permission-rule-store.js +2 -1
- package/dist/core/runner/announce-once-ledger.js +2 -1
- package/dist/core/runner/compaction-seams.js +3 -2
- package/dist/core/runner/gate-exit.d.ts +5 -0
- package/dist/core/runner/git-leg-delivery.js +4 -3
- package/dist/core/runner/git-status-frame.js +2 -1
- package/dist/core/runner/mcp-redial.js +2 -1
- package/dist/core/runner/memory-consolidation-driver.js +2 -1
- package/dist/core/runner/permission-rule-lanes.js +3 -2
- package/dist/core/runner/prepare-artifact.js +2 -1
- package/dist/core/runner/prepare-ask-lane.js +2 -1
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-inherited-gate.js +2 -1
- package/dist/core/runner/prepare-memory-engine-session.js +2 -1
- package/dist/core/runner/prepare-memory.js +5 -4
- package/dist/core/runner/prepare-policy-chain.js +3 -2
- package/dist/core/runner/prepare-project-context.js +3 -2
- package/dist/core/runner/prepare-protocol-tools.js +3 -2
- package/dist/core/runner/prepare-suspend-saga.js +2 -1
- package/dist/core/runner/prepare-task.js +6 -5
- package/dist/core/runner/prepare-turn-wiring.js +2 -1
- package/dist/core/runner/resume-apply.js +5 -4
- package/dist/core/runner/resume-preflight.js +3 -2
- package/dist/core/runner/run-git-lane.js +4 -3
- package/dist/core/runner/run-leg.js +4 -3
- package/dist/core/runner/run-recovery-lanes.js +3 -2
- package/dist/core/runner/run-settle-and-teardown.js +2 -1
- package/dist/core/runner/run-stop-and-final-verify.js +2 -1
- package/dist/core/runner/run-telemetry-and-budget-seats.js +2 -1
- package/dist/core/runner/run-terminal-adoption.js +6 -5
- package/dist/core/runner/run-turn-boundary.js +5 -4
- package/dist/core/runner/runtask.js +2 -1
- package/dist/core/runner/stream-settle-backstop.js +5 -4
- package/dist/core/runner/stream-steer-verb.js +2 -1
- package/dist/core/runner/strict-output-schema.js +2 -1
- package/dist/core/runner/teardown-bounded.js +2 -1
- package/dist/core/safe-notify.js +2 -1
- package/dist/core/skills-directory.js +2 -1
- package/dist/core/strategy-store.js +2 -1
- package/dist/core/task-registry-agent.js +2 -1
- package/dist/core/task-registry-monitor.js +2 -1
- package/dist/core/task-registry-workflow.js +2 -1
- package/dist/core/task-registry.js +3 -2
- package/dist/core/thrown-value.d.ts +79 -0
- package/dist/core/thrown-value.js +56 -0
- package/dist/core/tool-errors.d.ts +0 -6
- package/dist/core/tool-errors.js +36 -14
- package/dist/core/tool-model-gate.js +2 -1
- package/dist/core/tool-policy.js +6 -13
- package/dist/core/tool-result-store.js +2 -1
- package/dist/core/tool-spec.d.ts +12 -0
- package/dist/core/write-protect.js +3 -2
- package/dist/engine/compaction/compaction.js +3 -4
- package/dist/engine/harness/agent-harness.js +2 -1
- package/dist/engine/harness/types.js +8 -7
- package/dist/engine/loop/agent-loop.js +7 -6
- package/dist/engine/lsp/node-lsp-manager.js +5 -4
- package/dist/engine/lsp/stdio-lsp-transport.js +12 -5
- package/dist/orchestration/dev-vm-script-runner.js +2 -1
- package/dist/orchestration/run-workflow-tool.js +7 -6
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-sandbox-conformance.js +3 -2
- package/dist/orchestration/workflow-script-store.js +2 -1
- package/dist/orchestration/workflow.js +15 -14
- package/dist/server/http.js +3 -2
- package/dist/stores/file/adoption/adopt.js +3 -2
- package/dist/stores/file/fs-atomic.js +2 -1
- package/dist/stores/file/permission-rule-adopt.js +2 -1
- package/dist/stores/file/permission-rule-store.js +2 -1
- package/dist/stores/file/session-store.js +4 -3
- package/dist/stores/file/strategy-store.js +7 -6
- package/dist/tools/artifact/artifact-tool.js +3 -2
- package/dist/tools/artifact/conformance.js +4 -3
- package/dist/tools/fs/bash-readonly-classifier.d.ts +14 -5
- package/dist/tools/fs/bash-readonly-classifier.js +7 -3
- package/dist/tools/fs/fs-bash.d.ts +16 -10
- package/dist/tools/fs/fs-bash.js +18 -7
- package/dist/tools/fs/fs-write.js +3 -2
- package/dist/tools/fs/safety.js +2 -1
- package/dist/tools/fs/search.js +3 -2
- package/dist/tools/monitor.js +3 -2
- package/dist/tools/sql.js +2 -1
- package/dist/tools/web.js +5 -15
- package/dist/tools/worktree.js +12 -9
- package/package.json +2 -1
- package/wire-changes/core@7.23.2.json +42 -0
package/dist/tools/monitor.js
CHANGED
|
@@ -3,6 +3,7 @@ import { defineTool, errorResult } from "../core/tools.js";
|
|
|
3
3
|
import { hasBackgroundShell } from "../core/background-shell.js";
|
|
4
4
|
import { MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_MAX_TIMEOUT_MS, } from "../core/task-registry.js";
|
|
5
5
|
import { toolFace } from "../core/tool-catalog-entries.js";
|
|
6
|
+
import { thrownText } from "../core/thrown-value.js";
|
|
6
7
|
const MONITOR_DESCRIPTION = "Run a shell command in the background and watch its stdout as a stream of events.\n" +
|
|
7
8
|
"\n" +
|
|
8
9
|
"- Each line the command writes to stdout becomes a notification event delivered to you between turns; " +
|
|
@@ -98,7 +99,7 @@ export function createMonitorTool(env, opts) {
|
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
catch (e) {
|
|
101
|
-
const why =
|
|
102
|
+
const why = thrownText(e);
|
|
102
103
|
let killDetail;
|
|
103
104
|
try {
|
|
104
105
|
const kill = await env.killBackground(spawn.value.shellId);
|
|
@@ -106,7 +107,7 @@ export function createMonitorTool(env, opts) {
|
|
|
106
107
|
killDetail = `${kill.error.code}: ${kill.error.message}`;
|
|
107
108
|
}
|
|
108
109
|
catch (killErr) {
|
|
109
|
-
killDetail =
|
|
110
|
+
killDetail = thrownText(killErr);
|
|
110
111
|
}
|
|
111
112
|
return errorResult(killDetail === undefined
|
|
112
113
|
? `Error (Monitor): the watch process was started but could not be registered (${why}); it has been terminated.`
|
package/dist/tools/sql.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
|
+
import { thrownText } from "../core/thrown-value.js";
|
|
2
3
|
const FORBIDDEN = /\b(insert|update|delete|drop|alter|create|truncate|grant|revoke|merge|replace|attach|detach|pragma|vacuum|exec|execute|call|copy|lock|reindex)\b/i;
|
|
3
4
|
class SqlValidationError extends Error {
|
|
4
5
|
}
|
|
@@ -82,7 +83,7 @@ export function createSqlTool(opts) {
|
|
|
82
83
|
validateReadOnlySql(sql, opts.allowTables);
|
|
83
84
|
}
|
|
84
85
|
catch (e) {
|
|
85
|
-
const msg =
|
|
86
|
+
const msg = thrownText(e);
|
|
86
87
|
return { content: `SQL rejected: ${msg}`, details: { error: msg }, terminate: false };
|
|
87
88
|
}
|
|
88
89
|
const rows = await opts.query(stripTrailingSemicolon(sql.trim()));
|
package/dist/tools/web.js
CHANGED
|
@@ -8,6 +8,7 @@ import { DEFAULT_CHARS_PER_TOKEN } from "../internal/harness.js";
|
|
|
8
8
|
import { binaryMagicFormat } from "./fs/safety.js";
|
|
9
9
|
import { pdfMagicMatches } from "./fs/pdf.js";
|
|
10
10
|
import { toolFace } from "../core/tool-catalog-entries.js";
|
|
11
|
+
import { thrownText } from "../core/thrown-value.js";
|
|
11
12
|
const MAX_REDIRECTS = 10;
|
|
12
13
|
const MAX_URL_LENGTH = 2048;
|
|
13
14
|
const WEBFETCH_ACCEPT = "text/markdown, text/html, */*";
|
|
@@ -447,7 +448,7 @@ export function webFetchToolSpec(config = {}) {
|
|
|
447
448
|
};
|
|
448
449
|
}
|
|
449
450
|
return {
|
|
450
|
-
content: `Error (WebFetch): request failed: ${
|
|
451
|
+
content: `Error (WebFetch): request failed: ${thrownText(e)}`,
|
|
451
452
|
details: errDetails,
|
|
452
453
|
isError: true,
|
|
453
454
|
};
|
|
@@ -594,7 +595,7 @@ export function webFetchToolSpec(config = {}) {
|
|
|
594
595
|
catch (e) {
|
|
595
596
|
out = text;
|
|
596
597
|
note =
|
|
597
|
-
`[note: summarization failed (${inlineUntrusted(
|
|
598
|
+
`[note: summarization failed (${inlineUntrusted(thrownText(e), 160)}) — ` +
|
|
598
599
|
`raw page content follows; the requested analysis ("${inlineUntrusted(prompt, 120)}") was NOT applied]`;
|
|
599
600
|
}
|
|
600
601
|
}
|
|
@@ -910,7 +911,7 @@ export function createWebSearchTool(config) {
|
|
|
910
911
|
return abortedFrame();
|
|
911
912
|
if (ac.signal.aborted)
|
|
912
913
|
return timedOutFrame();
|
|
913
|
-
const msg = redactSecrets(
|
|
914
|
+
const msg = redactSecrets(thrownText(e)).trim();
|
|
914
915
|
const headline = "Error (WebSearch): the search backend failed.";
|
|
915
916
|
const verdict = classifySearchFailure(msg);
|
|
916
917
|
const composed = (msg ? `${headline} The backend's error text follows:\n\n${delimitUntrusted("WebSearch backend error", msg, SEARCH_ERROR_EXCERPT_CHARS)}` : headline) + `\n\n${verdict.hint}`;
|
|
@@ -1029,18 +1030,7 @@ export async function probeSearchBackend(search, options) {
|
|
|
1029
1030
|
return { ok: true, results: results.length };
|
|
1030
1031
|
}
|
|
1031
1032
|
catch (e) {
|
|
1032
|
-
|
|
1033
|
-
if (e instanceof Error)
|
|
1034
|
-
text = e.message;
|
|
1035
|
-
else {
|
|
1036
|
-
try {
|
|
1037
|
-
text = String(e);
|
|
1038
|
-
}
|
|
1039
|
-
catch {
|
|
1040
|
-
text = Object.prototype.toString.call(e);
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
return { ok: false, error: text };
|
|
1033
|
+
return { ok: false, error: thrownText(e) };
|
|
1044
1034
|
}
|
|
1045
1035
|
finally {
|
|
1046
1036
|
clearTimeout(timer);
|
package/dist/tools/worktree.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Type } from "typebox";
|
|
|
3
3
|
import { defineTool, errorResult } from "../core/tools.js";
|
|
4
4
|
import { addWorktree, pruneWorktrees, WORKTREE_PARENT } from "../core/git-worktree-env.js";
|
|
5
5
|
import { toolFace } from "../core/tool-catalog-entries.js";
|
|
6
|
+
import { thrownText } from "../core/thrown-value.js";
|
|
6
7
|
const ENTER_DESCRIPTION = "Use this tool ONLY when explicitly instructed to work in a worktree — either by the user directly, or by " +
|
|
7
8
|
"project instructions. This tool creates an isolated git worktree and switches the current session into it.\n" +
|
|
8
9
|
"\n" +
|
|
@@ -67,14 +68,16 @@ const EXIT_DESCRIPTION = "Exit a worktree session created by EnterWorktree and r
|
|
|
67
68
|
"- Once exited, EnterWorktree can be called again to create a fresh worktree.";
|
|
68
69
|
const shq = (s) => `'${s.replace(/'/g, "'\\''")}'`;
|
|
69
70
|
function reasonOf(e) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
try {
|
|
72
|
+
if (typeof e === "object" && e !== null && !(e instanceof Error)) {
|
|
73
|
+
const m = e.message;
|
|
74
|
+
if (typeof m === "string" && m !== "")
|
|
75
|
+
return m;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
76
79
|
}
|
|
77
|
-
return
|
|
80
|
+
return thrownText(e);
|
|
78
81
|
}
|
|
79
82
|
async function resolveBaseCommit(env, repoRoot, baseRef) {
|
|
80
83
|
const rev = async (ref) => {
|
|
@@ -147,7 +150,7 @@ export function createWorktreeTools(env, opts) {
|
|
|
147
150
|
try {
|
|
148
151
|
const probe = await env.exec("git rev-parse --is-inside-work-tree", { cwd: repoRoot });
|
|
149
152
|
if (!probe.ok || probe.value.exitCode !== 0) {
|
|
150
|
-
const detail = probe.ok ? (probe.value.stderr || probe.value.stdout).trim().split("\n")[0] :
|
|
153
|
+
const detail = probe.ok ? (probe.value.stderr || probe.value.stdout).trim().split("\n")[0] : thrownText(probe.error);
|
|
151
154
|
return errorResult(`Error (EnterWorktree): the working directory ${repoRoot} is not a git repository` +
|
|
152
155
|
`${detail ? ` (${detail})` : ""}. This deployment has no VCS-agnostic worktree extension point, ` +
|
|
153
156
|
"so worktree isolation is unavailable here.");
|
|
@@ -214,7 +217,7 @@ export function createWorktreeTools(env, opts) {
|
|
|
214
217
|
createdDir = worktreeDir;
|
|
215
218
|
}
|
|
216
219
|
catch (e) {
|
|
217
|
-
return errorResult(`Error (EnterWorktree): ${
|
|
220
|
+
return errorResult(`Error (EnterWorktree): ${thrownText(e)}`);
|
|
218
221
|
}
|
|
219
222
|
session.current = {
|
|
220
223
|
worktreeDir: createdDir,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/core",
|
|
3
|
-
"version": "7.23.
|
|
3
|
+
"version": "7.23.2",
|
|
4
4
|
"description": "Stateless, task-oriented AI agent core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"gate:field-liveness": "node scripts/verify-field-liveness.mjs",
|
|
71
71
|
"gate:debts": "node scripts/verify-debts.mjs",
|
|
72
72
|
"handoff:diff": "node scripts/dist-handoff-diff.mjs",
|
|
73
|
+
"post-ship": "node scripts/post-ship.mjs",
|
|
73
74
|
"gate:debts:rc": "node scripts/verify-debts.mjs --rc-gate",
|
|
74
75
|
"gate:error-surface": "node scripts/verify-error-surface.mjs",
|
|
75
76
|
"gate:criteria": "node scripts/criteria-lint.mjs",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"repo": "core",
|
|
3
|
+
"version": "7.23.2",
|
|
4
|
+
"from": "e9bf8451c623a118a6589a6f860bd7b828c3aa3e",
|
|
5
|
+
"to": "v7.23.2",
|
|
6
|
+
"added": [],
|
|
7
|
+
"removed": [],
|
|
8
|
+
"changed": [],
|
|
9
|
+
"narrowed": [],
|
|
10
|
+
"closedSetMembers": [],
|
|
11
|
+
"closedSetsUnreadable": [],
|
|
12
|
+
"typeKeys": [
|
|
13
|
+
{
|
|
14
|
+
"type": "ReversibilityVerdict",
|
|
15
|
+
"at": [
|
|
16
|
+
"src/core/tool-spec.ts:50"
|
|
17
|
+
],
|
|
18
|
+
"added": [
|
|
19
|
+
"boundaryDeclined"
|
|
20
|
+
],
|
|
21
|
+
"removed": [],
|
|
22
|
+
"breaking": false,
|
|
23
|
+
"criteriaCovered": false
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"declarationMoves": [],
|
|
27
|
+
"mintMoves": [],
|
|
28
|
+
"criteriaObserves": [],
|
|
29
|
+
"consumersHint": {
|
|
30
|
+
"cli": [
|
|
31
|
+
"ReversibilityVerdict"
|
|
32
|
+
],
|
|
33
|
+
"server": [
|
|
34
|
+
"ReversibilityVerdict"
|
|
35
|
+
],
|
|
36
|
+
"sdk": [],
|
|
37
|
+
"note": "scanned cli@8dd52617 server@7d768b71 sdk@3b02abb — a name listed is MENTIONED there today, which is evidence of consumption, not proof of it"
|
|
38
|
+
},
|
|
39
|
+
"breakingCount": 0,
|
|
40
|
+
"breakingItems": [],
|
|
41
|
+
"toResolvedAt": "cb5240a4a8289d28ed37ef84df8ee1bfb2139905"
|
|
42
|
+
}
|