@sema-agent/core 1.452.0 → 2.0.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/agents/agent-transcript-tool.d.ts +15 -0
- package/dist/agents/agent-transcript-tool.js +122 -0
- package/dist/agents/cascade.js +5 -8
- package/dist/agents/repair-loop.d.ts +1 -1
- package/dist/agents/repair-loop.js +1 -1
- package/dist/agents/retain-ledger.d.ts +60 -0
- package/dist/agents/retain-ledger.js +225 -0
- package/dist/agents/roster-store.d.ts +1 -0
- package/dist/agents/roster-store.js +9 -0
- package/dist/agents/send-message-tool.d.ts +41 -0
- package/dist/agents/send-message-tool.js +469 -0
- package/dist/agents/subagent.d.ts +33 -108
- package/dist/agents/subagent.js +22 -834
- package/dist/agents/teacher.d.ts +0 -1
- package/dist/agents/teacher.js +0 -9
- package/dist/bin/sema-tb.js +3 -3
- package/dist/brain/anthropic.js +15 -40
- package/dist/brain/openai.js +15 -40
- package/dist/brain/reasoning.d.ts +1 -1
- package/dist/brain/stream-engine.js +2 -2
- package/dist/brain/stream-shared.d.ts +17 -0
- package/dist/brain/stream-shared.js +50 -0
- package/dist/brain/timeout.d.ts +1 -1
- package/dist/brain/timeout.js +1 -1
- package/dist/config/catalog.js +1 -3
- package/dist/config/defaults.d.ts +6 -0
- package/dist/config/defaults.js +6 -0
- package/dist/core/ask-question.d.ts +1 -1
- package/dist/core/background-shell.d.ts +1 -1
- package/dist/core/checkpoint-store.d.ts +0 -1
- package/dist/core/exec-gate.d.ts +1 -1
- package/dist/core/exec-output-tail.d.ts +1 -0
- package/dist/core/exec-output-tail.js +6 -0
- package/dist/core/file-snapshot-store.d.ts +1 -1
- package/dist/core/fs-write-gate-policy.d.ts +1 -1
- package/dist/core/git-worktree-env.d.ts +1 -1
- package/dist/core/hooks.d.ts +1 -1
- package/dist/core/image-downsample.d.ts +44 -0
- package/dist/core/image-downsample.js +97 -0
- package/dist/core/lsp.d.ts +1 -1
- package/dist/core/mcp.d.ts +3 -45
- package/dist/core/mcp.js +2 -97
- package/dist/core/media-byte-cap.d.ts +1 -1
- package/dist/core/memory-recall.d.ts +0 -12
- package/dist/core/memory-recall.js +0 -222
- package/dist/core/memory.d.ts +0 -6
- package/dist/core/memory.js +0 -88
- package/dist/core/message-utils.d.ts +1 -1
- package/dist/core/oracle-isolation.d.ts +1 -1
- package/dist/core/remote-env.d.ts +1 -1
- package/dist/core/roles.d.ts +1 -1
- package/dist/core/runner/active-skill-scope.d.ts +1 -1
- package/dist/core/runner/assemble-result.d.ts +0 -2
- package/dist/core/runner/memory-consolidation.d.ts +1 -1
- package/dist/core/runner/prepare-memory.d.ts +16 -0
- package/dist/core/runner/prepare-memory.js +191 -0
- package/dist/core/runner/prepare-task.d.ts +4 -28
- package/dist/core/runner/prepare-task.js +19 -207
- package/dist/core/runner/prompt-suggestions.d.ts +1 -1
- package/dist/core/runner/runtask.d.ts +2 -3
- package/dist/core/runner/runtask.js +337 -529
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/synthetic-tools.d.ts +5 -5
- package/dist/core/runner/synthetic-tools.js +4 -4
- package/dist/core/runner/tool-disclosure.d.ts +3 -3
- package/dist/core/runner/tool-disclosure.js +2 -2
- package/dist/core/runner/tool-output-projection.d.ts +6 -0
- package/dist/core/runner/tool-output-projection.js +81 -0
- package/dist/core/runtime.d.ts +1 -1
- package/dist/core/scheduler.d.ts +1 -1
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/session-reconcile.d.ts +1 -1
- package/dist/core/session-store.d.ts +2 -1
- package/dist/core/session-store.js +2 -1
- package/dist/core/session.d.ts +0 -1
- package/dist/core/task-registry-agent.d.ts +115 -0
- package/dist/core/task-registry-agent.js +1163 -0
- package/dist/core/task-registry-monitor.d.ts +13 -0
- package/dist/core/task-registry-monitor.js +347 -0
- package/dist/core/task-registry-shared.d.ts +294 -0
- package/dist/core/task-registry-shared.js +271 -0
- package/dist/core/task-registry-workflow.d.ts +5 -0
- package/dist/core/task-registry-workflow.js +143 -0
- package/dist/core/task-registry.d.ts +51 -216
- package/dist/core/task-registry.js +127 -1940
- package/dist/core/task-tool-shape.d.ts +32 -0
- package/dist/core/task-tool-shape.js +83 -0
- package/dist/core/tool-policy.d.ts +1 -2
- package/dist/core/tool-result-budget.d.ts +1 -1
- package/dist/core/tool-result-store.d.ts +2 -2
- package/dist/core/tool-result-store.js +1 -1
- package/dist/core/tools.d.ts +2 -3
- package/dist/core/tools.js +0 -8
- package/dist/core/trace.d.ts +2 -2
- package/dist/core/types.d.ts +0 -29
- package/dist/core/workflow-run-store-contract.d.ts +1 -1
- package/dist/core/workflow-run-store-contract.js +19 -19
- package/dist/engine/execution-env/node-execution-env.d.ts +13 -0
- package/dist/engine/execution-env/node-execution-env.js +55 -25
- package/dist/engine/lsp/frame-decoder.d.ts +1 -1
- package/dist/engine/lsp/frame-decoder.js +1 -1
- package/dist/engine/lsp/node-lsp-manager.d.ts +1 -1
- package/dist/engine/lsp/stdio-lsp-transport.js +2 -2
- package/dist/index.d.ts +16 -14
- package/dist/index.js +13 -11
- package/dist/internal/harness-types.d.ts +7 -0
- package/dist/internal/harness-types.js +1 -0
- package/dist/internal/harness.d.ts +1 -7
- package/dist/internal/harness.js +1 -0
- package/dist/orchestration/goal.js +2 -2
- package/dist/orchestration/run-workflow-tool.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +193 -0
- package/dist/orchestration/workflow-types.js +54 -0
- package/dist/orchestration/workflow.d.ts +3 -193
- package/dist/orchestration/workflow.js +7 -59
- package/dist/prompt-assembly/assemble.d.ts +3 -3
- package/dist/prompt-assembly/assemble.js +0 -16
- package/dist/prompt-assembly/explain.d.ts +1 -1
- package/dist/prompt-assembly/tool-catalog.d.ts +1 -1
- package/dist/prompts/default.d.ts +1 -6
- package/dist/prompts/default.js +3 -11
- package/dist/scenarios/env.d.ts +1 -1
- package/dist/scenarios/full-body.d.ts +0 -3
- package/dist/scenarios/full-body.js +0 -2
- package/dist/stores/file/background-agent-store.d.ts +2 -15
- package/dist/stores/file/background-agent-store.js +30 -100
- package/dist/stores/file/checkpoint-store.d.ts +1 -14
- package/dist/stores/file/checkpoint-store.js +47 -119
- package/dist/stores/file/file-snapshot-store.d.ts +1 -1
- package/dist/stores/file/shared-ledger.d.ts +35 -0
- package/dist/stores/file/shared-ledger.js +94 -0
- package/dist/stores/file/workflow-run-store.d.ts +1 -14
- package/dist/stores/file/workflow-run-store.js +24 -93
- package/dist/tools/fs/bash-readonly-classifier.d.ts +8 -0
- package/dist/tools/fs/bash-readonly-classifier.js +166 -0
- package/dist/tools/fs/fs-bash.d.ts +31 -0
- package/dist/tools/fs/fs-bash.js +672 -0
- package/dist/tools/fs/fs-pdf.d.ts +22 -0
- package/dist/tools/fs/fs-pdf.js +236 -0
- package/dist/tools/fs/fs-read.d.ts +8 -0
- package/dist/tools/fs/fs-read.js +286 -0
- package/dist/tools/fs/fs-search-tools.d.ts +5 -0
- package/dist/tools/fs/fs-search-tools.js +173 -0
- package/dist/tools/fs/fs-shared.d.ts +55 -0
- package/dist/tools/fs/fs-shared.js +144 -0
- package/dist/tools/fs/fs-write.d.ts +8 -0
- package/dist/tools/fs/fs-write.js +423 -0
- package/dist/tools/fs/index.d.ts +12 -65
- package/dist/tools/fs/index.js +26 -2090
- package/dist/tools/fs/pdf.d.ts +1 -1
- package/dist/tools/fs/repo-map.d.ts +3 -3
- package/dist/tools/fs/repo-map.js +1 -1
- package/dist/tools/fs/safety.d.ts +1 -1
- package/dist/tools/fs/search.d.ts +1 -1
- package/dist/tools/monitor.d.ts +1 -1
- package/dist/tools/scheduler-tools.d.ts +1 -1
- package/dist/tools/web.d.ts +2 -2
- package/dist/tools/web.js +1 -1
- package/dist/tools/worktree.d.ts +1 -1
- package/package.json +1 -1
- package/dist/core/dynamic-recall.d.ts +0 -32
- package/dist/core/dynamic-recall.js +0 -76
package/dist/tools/fs/pdf.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExecutionEnv } from "../../internal/harness.js";
|
|
1
|
+
import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
2
2
|
export declare const PDF_MAX_PAGES_PER_READ = 20;
|
|
3
3
|
export declare const PDF_INLINE_PAGE_THRESHOLD = 10;
|
|
4
4
|
export declare const PDF_TARGET_RAW_SIZE: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentTool } from "../../internal/harness.js";
|
|
2
|
-
import type { ExecutionEnv } from "../../internal/harness.js";
|
|
1
|
+
import type { AgentTool } from "../../internal/harness-types.js";
|
|
2
|
+
import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
3
3
|
export declare function extractSymbols(text: string): string[];
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function createRepoMapTool(env: ExecutionEnv, rootCanonical: string, additionalRoots?: readonly string[]): AgentTool;
|
|
@@ -79,7 +79,7 @@ function rankEntries(a, b) {
|
|
|
79
79
|
return b.symbols.length - a.symbols.length;
|
|
80
80
|
return a.rel < b.rel ? -1 : a.rel > b.rel ? 1 : 0;
|
|
81
81
|
}
|
|
82
|
-
export function
|
|
82
|
+
export function createRepoMapTool(env, rootCanonical, additionalRoots) {
|
|
83
83
|
return defineTool({
|
|
84
84
|
name: "RepoMap",
|
|
85
85
|
contract: { contractId: "core.repo_map@1", implementationRevision: "1" },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExecutionEnv } from "../../internal/harness.js";
|
|
1
|
+
import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
2
2
|
export declare function fileArgPath(args: unknown): string | undefined;
|
|
3
3
|
export declare function writeTargetPath(canonicalName: string, args: unknown): string | undefined;
|
|
4
4
|
export interface ReadEntry {
|
package/dist/tools/monitor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentTool, ExecutionEnv } from "../internal/harness.js";
|
|
1
|
+
import type { AgentTool, ExecutionEnv } from "../internal/harness-types.js";
|
|
2
2
|
import { type MonitorTimers, type TaskRegistry } from "../core/task-registry.js";
|
|
3
3
|
import type { TaskNotificationPayload } from "../core/task-notification.js";
|
|
4
4
|
export interface MonitorToolOptions {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentTool, ExecutionEnv } from "../internal/harness.js";
|
|
1
|
+
import type { AgentTool, ExecutionEnv } from "../internal/harness-types.js";
|
|
2
2
|
export declare const SCHEDULE_WAKEUP_TOOL_NAME = "ScheduleWakeup";
|
|
3
3
|
export declare const AUTONOMOUS_LOOP_SENTINEL = "<<autonomous-loop>>";
|
|
4
4
|
export declare const AUTONOMOUS_LOOP_DYNAMIC_SENTINEL = "<<autonomous-loop-dynamic>>";
|
package/dist/tools/web.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentTool } from "../internal/harness.js";
|
|
1
|
+
import type { AgentTool } from "../internal/harness-types.js";
|
|
2
2
|
import type { Brain, ToolSpec } from "../core/types.js";
|
|
3
3
|
import type { Model } from "../internal/llm.js";
|
|
4
4
|
export interface WebFetchConfig {
|
|
@@ -14,7 +14,7 @@ export declare function webFetchToolSpec(config?: WebFetchConfig): ToolSpec;
|
|
|
14
14
|
export declare function createWebFetchTool(config?: WebFetchConfig): AgentTool;
|
|
15
15
|
export declare const WEBFETCH_SUMMARY_MAX_CONTENT = 100000;
|
|
16
16
|
export declare const WEBFETCH_SUMMARY_GUIDELINES: string;
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function createWebFetchSummarizer(brain: Brain, model: Model): (content: string, prompt: string, signal?: AbortSignal) => Promise<string>;
|
|
18
18
|
export interface WebSearchConfig {
|
|
19
19
|
search: (query: string, signal?: AbortSignal, opts?: {
|
|
20
20
|
allowedDomains?: string[];
|
package/dist/tools/web.js
CHANGED
|
@@ -550,7 +550,7 @@ export const WEBFETCH_SUMMARY_GUIDELINES = `Provide a concise response based onl
|
|
|
550
550
|
` - Use quotation marks for exact language from articles; any language outside of the quotation should never be word-for-word the same.\n` +
|
|
551
551
|
` - You are not a lawyer and never comment on the legality of your own prompts and responses.\n` +
|
|
552
552
|
` - Never produce or reproduce exact song lyrics.\n`;
|
|
553
|
-
export function
|
|
553
|
+
export function createWebFetchSummarizer(brain, model) {
|
|
554
554
|
return async (content, prompt, signal) => {
|
|
555
555
|
const truncated = content.length > WEBFETCH_SUMMARY_MAX_CONTENT
|
|
556
556
|
? content.slice(0, WEBFETCH_SUMMARY_MAX_CONTENT) + "\n\n[Content truncated due to length...]"
|
package/dist/tools/worktree.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { AgentMessage } from "../internal/harness.js";
|
|
2
|
-
import { type MemorySelector, encodeSurfacedKey } from "./memory-recall.js";
|
|
3
|
-
import type { MemoryStore } from "./memory.js";
|
|
4
|
-
export interface DynamicRecallConfig {
|
|
5
|
-
enabled?: boolean;
|
|
6
|
-
recentMessageWindow?: number;
|
|
7
|
-
maxQueryChars?: number;
|
|
8
|
-
}
|
|
9
|
-
export declare const DEFAULT_RECENT_MESSAGE_WINDOW = 6;
|
|
10
|
-
export declare const DEFAULT_MAX_QUERY_CHARS = 4000;
|
|
11
|
-
export declare function buildRecallQuery(messages: readonly AgentMessage[], window?: number, maxChars?: number): string;
|
|
12
|
-
export interface DynamicRecallOutcome {
|
|
13
|
-
block: string | undefined;
|
|
14
|
-
surfacedIds: readonly string[];
|
|
15
|
-
surfacedKeys: readonly string[];
|
|
16
|
-
}
|
|
17
|
-
export interface DynamicRecallInput {
|
|
18
|
-
store: MemoryStore;
|
|
19
|
-
scopes: readonly string[];
|
|
20
|
-
selector: MemorySelector;
|
|
21
|
-
query: string;
|
|
22
|
-
recentTools?: string[];
|
|
23
|
-
maxSelected?: number;
|
|
24
|
-
maxLinked?: number;
|
|
25
|
-
timeoutMs?: number;
|
|
26
|
-
signal?: AbortSignal;
|
|
27
|
-
nowMs?: number;
|
|
28
|
-
priorSurfacedIds?: ReadonlySet<string>;
|
|
29
|
-
priorSurfacedKeys?: ReadonlySet<string>;
|
|
30
|
-
}
|
|
31
|
-
export declare function runDynamicRecall(input: DynamicRecallInput): Promise<DynamicRecallOutcome>;
|
|
32
|
-
export { encodeSurfacedKey };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { encodeSurfacedKey, selectAndComposeLayeredMemory, selectAndComposeMemory, } from "./memory-recall.js";
|
|
2
|
-
export const DEFAULT_RECENT_MESSAGE_WINDOW = 6;
|
|
3
|
-
export const DEFAULT_MAX_QUERY_CHARS = 4_000;
|
|
4
|
-
export function buildRecallQuery(messages, window = DEFAULT_RECENT_MESSAGE_WINDOW, maxChars = DEFAULT_MAX_QUERY_CHARS) {
|
|
5
|
-
if (window <= 0 || maxChars <= 0)
|
|
6
|
-
return "";
|
|
7
|
-
const recent = messages.slice(-window);
|
|
8
|
-
const parts = [];
|
|
9
|
-
for (const m of recent) {
|
|
10
|
-
const text = messageText(m);
|
|
11
|
-
if (text)
|
|
12
|
-
parts.push(text);
|
|
13
|
-
}
|
|
14
|
-
const joined = parts.join("\n").trim();
|
|
15
|
-
if (joined.length <= maxChars)
|
|
16
|
-
return joined;
|
|
17
|
-
return joined.slice(joined.length - maxChars);
|
|
18
|
-
}
|
|
19
|
-
function messageText(m) {
|
|
20
|
-
const content = m.content;
|
|
21
|
-
if (typeof content === "string")
|
|
22
|
-
return content.trim();
|
|
23
|
-
if (Array.isArray(content)) {
|
|
24
|
-
const out = [];
|
|
25
|
-
for (const c of content) {
|
|
26
|
-
if (typeof c.text === "string" && c.text.length > 0)
|
|
27
|
-
out.push(c.text);
|
|
28
|
-
}
|
|
29
|
-
return out.join(" ").trim();
|
|
30
|
-
}
|
|
31
|
-
return "";
|
|
32
|
-
}
|
|
33
|
-
const EMPTY_OUTCOME = { block: undefined, surfacedIds: [], surfacedKeys: [] };
|
|
34
|
-
export async function runDynamicRecall(input) {
|
|
35
|
-
if (input.scopes.length === 0 || input.query.trim().length === 0)
|
|
36
|
-
return EMPTY_OUTCOME;
|
|
37
|
-
if (input.scopes.length === 1) {
|
|
38
|
-
const res = await selectAndComposeMemory({
|
|
39
|
-
store: input.store,
|
|
40
|
-
scope: input.scopes[0],
|
|
41
|
-
objective: input.query,
|
|
42
|
-
selector: input.selector,
|
|
43
|
-
recentTools: input.recentTools,
|
|
44
|
-
maxSelected: input.maxSelected,
|
|
45
|
-
maxLinked: input.maxLinked,
|
|
46
|
-
timeoutMs: input.timeoutMs,
|
|
47
|
-
signal: input.signal,
|
|
48
|
-
nowMs: input.nowMs,
|
|
49
|
-
priorSurfacedIds: input.priorSurfacedIds,
|
|
50
|
-
});
|
|
51
|
-
if ("degrade" in res)
|
|
52
|
-
return EMPTY_OUTCOME;
|
|
53
|
-
if (res.block === undefined || res.surfacedIds.length === 0)
|
|
54
|
-
return EMPTY_OUTCOME;
|
|
55
|
-
return { block: res.block, surfacedIds: res.surfacedIds, surfacedKeys: [] };
|
|
56
|
-
}
|
|
57
|
-
const res = await selectAndComposeLayeredMemory({
|
|
58
|
-
store: input.store,
|
|
59
|
-
scopes: [...input.scopes],
|
|
60
|
-
objective: input.query,
|
|
61
|
-
selector: input.selector,
|
|
62
|
-
recentTools: input.recentTools,
|
|
63
|
-
maxSelected: input.maxSelected,
|
|
64
|
-
maxLinked: input.maxLinked,
|
|
65
|
-
timeoutMs: input.timeoutMs,
|
|
66
|
-
signal: input.signal,
|
|
67
|
-
nowMs: input.nowMs,
|
|
68
|
-
priorSurfacedKeys: input.priorSurfacedKeys,
|
|
69
|
-
});
|
|
70
|
-
if ("degrade" in res)
|
|
71
|
-
return EMPTY_OUTCOME;
|
|
72
|
-
if (res.block === undefined || res.surfacedKeys.length === 0)
|
|
73
|
-
return EMPTY_OUTCOME;
|
|
74
|
-
return { block: res.block, surfacedIds: [], surfacedKeys: res.surfacedKeys };
|
|
75
|
-
}
|
|
76
|
-
export { encodeSurfacedKey };
|