@sema-agent/core 1.447.0 → 1.449.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.
package/dist/bin/sema-tb.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { readFileSync, realpathSync, createWriteStream } from "node:fs";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { Runner, NodeExecutionEnv, createOpenAIBrain, createAnthropicBrain, CODE_SYSTEM_PROMPT, assembleCodeTools, makeWebFetchSummarizer, } from "../index.js";
|
|
5
|
-
import { positiveIntFromEnv } from "./tb-env.js";
|
|
5
|
+
import { positiveIntFromEnv, tbModelInput } from "./tb-env.js";
|
|
6
6
|
import { inferMaxTokensField } from "../brain/openai.js";
|
|
7
7
|
function usage(code = 2) {
|
|
8
8
|
const out = code === 0 ? process.stdout : process.stderr;
|
|
@@ -12,7 +12,7 @@ function usage(code = 2) {
|
|
|
12
12
|
" WARNING: argv is visible to every process in the sandbox (ps / pgrep -f / /proc/*/cmdline) — long\n" +
|
|
13
13
|
" or sensitive instructions should ride --objective-file or stdin, never --message.\n" +
|
|
14
14
|
"Env: <PROVIDER>_API_KEY / <PROVIDER>_BASE_URL, TB_MAX_TURNS, TB_TIMEOUT_SEC, TB_FULLBODY, TB_TODOREMIND, TB_BGTASKS, TB_SUMMARIZE,\n" +
|
|
15
|
-
" TB_FINALVERIFY, TB_CALLCAP, TB_FINALIZE, TB_REASONING, TB_JSONL, TB_CONTEXT_WINDOW, TB_MAX_OUTPUT_TOKENS, TB_TASKLIST\n" +
|
|
15
|
+
" TB_FINALVERIFY, TB_CALLCAP, TB_FINALIZE, TB_REASONING, TB_JSONL, TB_CONTEXT_WINDOW, TB_MAX_OUTPUT_TOKENS, TB_TASKLIST, TB_VISION\n" +
|
|
16
16
|
' TB_COST="input,output[,cacheRead[,cacheWrite]]" — USD per MTok; explicit pricing override (omitted\n' +
|
|
17
17
|
" trailing segments default to 0). Without it, pricing resolves by MODEL FAMILY (deepseek/claude/gpt-o*)\n" +
|
|
18
18
|
" first, then the wire-prefix table; unknown model on an overridden BASE_URL ⇒ cost accounting disabled.\n");
|
|
@@ -185,7 +185,7 @@ function buildModelAndBrain(providerModel) {
|
|
|
185
185
|
provider,
|
|
186
186
|
baseUrl: baseUrlOverride || d.baseUrl,
|
|
187
187
|
reasoning: process.env.TB_REASONING === "0" ? false : process.env.TB_REASONING === "1" ? true : (d?.reasoning ?? false),
|
|
188
|
-
input:
|
|
188
|
+
input: tbModelInput(),
|
|
189
189
|
cost: costRes.cost,
|
|
190
190
|
contextWindow: contextWindowOverride ?? d?.contextWindow ?? 200_000,
|
|
191
191
|
maxTokens: maxOutputTokensOverride ?? d?.maxTokens ?? 32_000,
|
package/dist/bin/tb-env.d.ts
CHANGED
package/dist/bin/tb-env.js
CHANGED
package/dist/core/tools.js
CHANGED
|
@@ -6,6 +6,14 @@ function normalizeContent(ret) {
|
|
|
6
6
|
return { content: [{ type: "text", text: ret }], details: undefined, terminate: false, isError: false };
|
|
7
7
|
}
|
|
8
8
|
const raw = ret.content;
|
|
9
|
+
if (typeof raw !== "string" && !Array.isArray(raw)) {
|
|
10
|
+
return {
|
|
11
|
+
content: [{ type: "text", text: "Tool error: content must be a string or an array of content blocks." }],
|
|
12
|
+
details: undefined,
|
|
13
|
+
terminate: false,
|
|
14
|
+
isError: true,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
9
17
|
const content = typeof raw === "string" ? [{ type: "text", text: raw }] : raw;
|
|
10
18
|
return { content, details: ret.details, terminate: ret.terminate ?? false, isError: ret.isError === true };
|
|
11
19
|
}
|
package/dist/tools/fs/index.js
CHANGED
|
@@ -586,7 +586,14 @@ export function makeReadFileTool(env, state, rootCanonical, cwdRef, additionalRo
|
|
|
586
586
|
if (total > 0 && prev && prev.hash === hash && prev.view && prev.view.start === start && prev.view.end === end) {
|
|
587
587
|
return `[${path}: unchanged since you last read it (lines ${start}-${end} of ${total}); content omitted to save context]`;
|
|
588
588
|
}
|
|
589
|
-
state.set(r.key, {
|
|
589
|
+
state.set(r.key, {
|
|
590
|
+
hash,
|
|
591
|
+
totalLines: countLines(content),
|
|
592
|
+
truncated,
|
|
593
|
+
...(pageMarker !== undefined ? { isPartialView: true } : {}),
|
|
594
|
+
view: { start, end },
|
|
595
|
+
lastReadAt: Date.now(),
|
|
596
|
+
});
|
|
590
597
|
if (total === 0)
|
|
591
598
|
return `<system-reminder>Warning: the file exists but is shorter than the provided offset (${start}). The file has 1 lines.</system-reminder>`;
|
|
592
599
|
const header = pageMarker ?? (truncated ? `[${path}: lines ${start}-${end} of ${total}${end < total ? " — use offset to see more" : ""}]\n` : "");
|
package/dist/tools/fs/safety.js
CHANGED
|
@@ -228,7 +228,8 @@ export function violationText(toolName, v) {
|
|
|
228
228
|
return `Error (${toolName}): ${v.message}`;
|
|
229
229
|
}
|
|
230
230
|
export function requireRead(state, key) {
|
|
231
|
-
|
|
231
|
+
const entry = state.get(key);
|
|
232
|
+
if (entry === undefined || entry.isPartialView) {
|
|
232
233
|
return { code: "not_read", message: "File has not been read yet. Read it first before writing to it." };
|
|
233
234
|
}
|
|
234
235
|
return undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.449.0",
|
|
4
4
|
"description": "Stateless, task-oriented AI agent core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -62,6 +62,9 @@
|
|
|
62
62
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
63
63
|
"typebox": "1.1.39"
|
|
64
64
|
},
|
|
65
|
+
"optionalDependencies": {
|
|
66
|
+
"sharp": "^0.35.0"
|
|
67
|
+
},
|
|
65
68
|
"devDependencies": {
|
|
66
69
|
"@types/node": "22.10.2",
|
|
67
70
|
"@types/pg": "^8.20.0",
|