@sema-agent/server 1.299.0 → 1.301.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.
@@ -23,6 +23,7 @@ export interface ScenarioDeps {
23
23
  repoClient?: GiteaClient;
24
24
  requirePrincipal?: boolean;
25
25
  webSearch?: WebSearchConfig;
26
+ webFetchSummarize?: (content: string, prompt: string, signal?: AbortSignal) => Promise<string>;
26
27
  metrics?: Metrics;
27
28
  logger?: Logger;
28
29
  oaApiBaseUrl?: string;
@@ -39,6 +39,7 @@ export function buildScenarios(deps) {
39
39
  tools: [
40
40
  nowTool(),
41
41
  ...assembleFullBodyTools({
42
+ ...(deps.webFetchSummarize ? { webFetch: { summarize: deps.webFetchSummarize } } : {}),
42
43
  todoWrite: false,
43
44
  taskList: true,
44
45
  subagent: {
package/dist/main.js CHANGED
@@ -5,7 +5,7 @@ import { homedir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import { loadRemoteExec } from "@sema-agent/registry-core/node";
7
7
  import { skillContentHash } from "@sema-agent/registry-core";
8
- import { Runner, TtlSessionStore, uuidv7, FileRosterStore, FileBackgroundAgentStore, FileMailboxStore, defaultTaskRegistry, combinePolicies, createDurableQuestionPolicy, createAllowDenyPolicy, tightenTaskSpec, isThinkingLevel, QUESTION_AWAITS_RESUME, FileWorkflowRunStore, InMemoryWorkflowRunStore, workflowsCapability, NodeLspManager, createFileWorkflowScriptStore, expandTiers, NodeExecutionEnv, CenterPromptSource, FilePromptArtifactStore, FilePromptSourceStateStore, MemoryPromptArtifactStore, MemoryPromptSourceStateStore, verifyPromptArtifact } from "@sema-agent/core";
8
+ import { Runner, TtlSessionStore, uuidv7, FileRosterStore, FileBackgroundAgentStore, FileMailboxStore, defaultTaskRegistry, combinePolicies, createDurableQuestionPolicy, createAllowDenyPolicy, tightenTaskSpec, isThinkingLevel, QUESTION_AWAITS_RESUME, FileWorkflowRunStore, InMemoryWorkflowRunStore, workflowsCapability, NodeLspManager, createFileWorkflowScriptStore, expandTiers, NodeExecutionEnv, CenterPromptSource, FilePromptArtifactStore, FilePromptSourceStateStore, MemoryPromptArtifactStore, MemoryPromptSourceStateStore, verifyPromptArtifact, makeWebFetchSummarizer, resolveTaskModel as coreResolveTaskModel } from "@sema-agent/core";
9
9
  import { PgMemoryEngineBackend, ensurePgMemoryEngineSchema } from "./plugins/memory-engine-pg.js";
10
10
  import { TiDBMemoryEngineBackend, ensureTiDBMemoryEngineSchema } from "./plugins/memory-engine-tidb.js";
11
11
  import { PgMemoryHistoryStore, ensurePgMemoryHistorySchema, PgMemorySyncStore, ensurePgMemorySyncSchema } from "./plugins/memory-sync-store-pg.js";
@@ -1318,9 +1318,10 @@ async function main() {
1318
1318
  if (webSearch)
1319
1319
  logger.info(`WebSearch enabled (provider=${webSearchCfg.provider}, maxResults=${webSearch.maxResults})`);
1320
1320
  const ensureChildSessionDurable = checkpointStore && config.sessionBackend === "tidb" ? (sessionId) => ensureChildSessionDurableWithPromotion(sessionStore, subRunnerSessions, sessionId) : undefined;
1321
+ const webFetchSummarize = makeWebFetchSummarizer(brain, coreResolveTaskModel({ modelRole: "summarize" }, { models: config.models, roles: config.roles }).model);
1321
1322
  const scenarioDeps = {
1322
1323
  runner, subRunner, model: "default", skills, repoClient, requirePrincipal: config.requirePrincipal,
1323
- ...(webSearch ? { webSearch } : {}), metrics, logger,
1324
+ ...(webSearch ? { webSearch } : {}), metrics, logger, webFetchSummarize,
1324
1325
  ...(backgroundAgentStore ? { backgroundAgentStore } : {}),
1325
1326
  ...(checkpointStore ? { checkpointStore } : {}),
1326
1327
  ...(ensureChildSessionDurable ? { ensureChildSessionDurable } : {}),
@@ -36,6 +36,7 @@ export type TraceBlock = {
36
36
  output: unknown;
37
37
  isError?: boolean;
38
38
  truncated?: boolean;
39
+ totalChars?: number;
39
40
  structured?: unknown;
40
41
  eventId?: string;
41
42
  parentToolCallId?: string;
@@ -62,6 +63,7 @@ export declare function toolEndEventData(ev: {
62
63
  isError: boolean;
63
64
  output?: unknown;
64
65
  truncated?: boolean;
66
+ totalChars?: number;
65
67
  structured?: unknown;
66
68
  eventId?: string;
67
69
  parentToolCallId?: string;
@@ -62,6 +62,7 @@ export function toolEndEventData(ev) {
62
62
  isError: ev.isError,
63
63
  ...(ev.output !== undefined ? { output: redactDeep(ev.output) } : {}),
64
64
  ...(ev.truncated ? { truncated: true } : {}),
65
+ ...(typeof ev.totalChars === "number" ? { totalChars: ev.totalChars } : {}),
65
66
  ...(ev.structured !== undefined ? { structured: redactDeep(ev.structured) } : {}),
66
67
  ...identityFields(ev),
67
68
  };
@@ -240,7 +241,7 @@ export function projectEvents(events, opts = {}) {
240
241
  break;
241
242
  case "tool_end": {
242
243
  const callId = String(d.toolCallId ?? "");
243
- blocks.push({ type: "tool-result", callId, ...(typeof d.label === "string" ? { label: d.label } : {}), output: d.output, ...(d.isError ? { isError: true } : {}), ...(d.truncated ? { truncated: true } : {}), ...(d.structured !== undefined ? { structured: d.structured } : {}), ...identityFields(d) });
244
+ blocks.push({ type: "tool-result", callId, ...(typeof d.label === "string" ? { label: d.label } : {}), output: d.output, ...(d.isError ? { isError: true } : {}), ...(d.truncated ? { truncated: true } : {}), ...(typeof d.totalChars === "number" ? { totalChars: d.totalChars } : {}), ...(d.structured !== undefined ? { structured: d.structured } : {}), ...identityFields(d) });
244
245
  break;
245
246
  }
246
247
  case "prompt_assembled":
@@ -306,7 +307,7 @@ export function mapTraceEvent(type, seq, data) {
306
307
  case "tool_start":
307
308
  return { event: "tool-call", data: { seq, id: data.toolCallId, name: data.toolName, ...(typeof data.label === "string" ? { label: data.label } : {}), input: data.args, ...identityFields(data) } };
308
309
  case "tool_end":
309
- return { event: "tool-result", data: { seq, callId: data.toolCallId, ...(typeof data.label === "string" ? { label: data.label } : {}), isError: Boolean(data.isError), ...(data.output !== undefined ? { output: data.output } : {}), ...(data.truncated ? { truncated: true } : {}), ...(data.structured !== undefined ? { structured: data.structured } : {}), ...identityFields(data) } };
310
+ return { event: "tool-result", data: { seq, callId: data.toolCallId, ...(typeof data.label === "string" ? { label: data.label } : {}), isError: Boolean(data.isError), ...(data.output !== undefined ? { output: data.output } : {}), ...(data.truncated ? { truncated: true } : {}), ...(typeof data.totalChars === "number" ? { totalChars: data.totalChars } : {}), ...(data.structured !== undefined ? { structured: data.structured } : {}), ...identityFields(data) } };
310
311
  case "turn_end": {
311
312
  const tokens = toContractTokens(data.usage);
312
313
  return { event: "turn", data: { seq, ...(tokens ? { tokens } : {}) } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/server",
3
- "version": "1.299.0",
3
+ "version": "1.301.0",
4
4
  "description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",
@@ -47,7 +47,7 @@
47
47
  "build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
48
48
  },
49
49
  "dependencies": {
50
- "@sema-agent/core": "^1.441.0",
50
+ "@sema-agent/core": "^1.444.0",
51
51
  "@sema-agent/registry-core": "^0.10.21",
52
52
  "e2b": "^2.28.0",
53
53
  "libsodium-wrappers": "^0.8.4",