@agntk/core 0.3.0 → 0.3.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.
- package/dist/agent-v2.d.ts +48 -0
- package/dist/agent-v2.d.ts.map +1 -0
- package/dist/agent-v2.js +365 -0
- package/dist/agent-v2.js.map +1 -0
- package/dist/memory/engine.d.ts +130 -0
- package/dist/memory/engine.d.ts.map +1 -0
- package/dist/memory/engine.js +227 -0
- package/dist/memory/engine.js.map +1 -0
- package/dist/memory/vectra-store.d.ts +31 -0
- package/dist/memory/vectra-store.d.ts.map +1 -0
- package/dist/memory/vectra-store.js +122 -0
- package/dist/memory/vectra-store.js.map +1 -0
- package/dist/models.js +1 -1
- package/dist/models.js.map +1 -1
- package/dist/pool/index.d.ts +7 -0
- package/dist/pool/index.d.ts.map +1 -0
- package/dist/pool/index.js +6 -0
- package/dist/pool/index.js.map +1 -0
- package/dist/pool/specialist-pool.d.ts +59 -0
- package/dist/pool/specialist-pool.d.ts.map +1 -0
- package/dist/pool/specialist-pool.js +224 -0
- package/dist/pool/specialist-pool.js.map +1 -0
- package/dist/pool/tools.d.ts +63 -0
- package/dist/pool/tools.d.ts.map +1 -0
- package/dist/pool/tools.js +83 -0
- package/dist/pool/tools.js.map +1 -0
- package/dist/pool/types.d.ts +79 -0
- package/dist/pool/types.d.ts.map +1 -0
- package/dist/pool/types.js +5 -0
- package/dist/pool/types.js.map +1 -0
- package/dist/presets/index.d.ts +5 -0
- package/dist/presets/index.d.ts.map +1 -0
- package/dist/presets/index.js +5 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/role-registry.d.ts +41 -0
- package/dist/presets/role-registry.d.ts.map +1 -0
- package/dist/presets/role-registry.js +213 -0
- package/dist/presets/role-registry.js.map +1 -0
- package/dist/presets/roles.d.ts +105 -0
- package/dist/presets/roles.d.ts.map +1 -0
- package/dist/presets/roles.js +207 -0
- package/dist/presets/roles.js.map +1 -0
- package/dist/prompts/templates.d.ts +11 -0
- package/dist/prompts/templates.d.ts.map +1 -0
- package/dist/prompts/templates.js +115 -0
- package/dist/prompts/templates.js.map +1 -0
- package/dist/streaming/data-parts.d.ts +163 -0
- package/dist/streaming/data-parts.d.ts.map +1 -0
- package/dist/streaming/data-parts.js +14 -0
- package/dist/streaming/data-parts.js.map +1 -0
- package/dist/streaming/index.d.ts +8 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/index.js +10 -0
- package/dist/streaming/index.js.map +1 -0
- package/dist/streaming/transient.d.ts +136 -0
- package/dist/streaming/transient.d.ts.map +1 -0
- package/dist/streaming/transient.js +201 -0
- package/dist/streaming/transient.js.map +1 -0
- package/dist/tools/factory.d.ts +109 -0
- package/dist/tools/factory.d.ts.map +1 -0
- package/dist/tools/factory.js +166 -0
- package/dist/tools/factory.js.map +1 -0
- package/dist/tools/provider.d.ts +97 -0
- package/dist/tools/provider.d.ts.map +1 -0
- package/dist/tools/provider.js +178 -0
- package/dist/tools/provider.js.map +1 -0
- package/dist/types/agent-v2.d.ts +83 -0
- package/dist/types/agent-v2.d.ts.map +1 -0
- package/dist/types/agent-v2.js +8 -0
- package/dist/types/agent-v2.js.map +1 -0
- package/dist/utils/logger.d.ts +35 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +149 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/workflow/builders/adapt.d.ts +20 -0
- package/dist/workflow/builders/adapt.d.ts.map +1 -0
- package/dist/workflow/builders/adapt.js +33 -0
- package/dist/workflow/builders/adapt.js.map +1 -0
- package/dist/workflow/builders/index.d.ts +8 -0
- package/dist/workflow/builders/index.d.ts.map +1 -0
- package/dist/workflow/builders/index.js +7 -0
- package/dist/workflow/builders/index.js.map +1 -0
- package/dist/workflow/builders/parallel.d.ts +25 -0
- package/dist/workflow/builders/parallel.d.ts.map +1 -0
- package/dist/workflow/builders/parallel.js +60 -0
- package/dist/workflow/builders/parallel.js.map +1 -0
- package/dist/workflow/builders/pipeline.d.ts +22 -0
- package/dist/workflow/builders/pipeline.d.ts.map +1 -0
- package/dist/workflow/builders/pipeline.js +48 -0
- package/dist/workflow/builders/pipeline.js.map +1 -0
- package/dist/workflow/builders/types.d.ts +54 -0
- package/dist/workflow/builders/types.d.ts.map +1 -0
- package/dist/workflow/builders/types.js +5 -0
- package/dist/workflow/builders/types.js.map +1 -0
- package/dist/workflow/durable-agent.d.ts +128 -0
- package/dist/workflow/durable-agent.d.ts.map +1 -0
- package/dist/workflow/durable-agent.js +323 -0
- package/dist/workflow/durable-agent.js.map +1 -0
- package/dist/workflow/schedulers.d.ts +231 -0
- package/dist/workflow/schedulers.d.ts.map +1 -0
- package/dist/workflow/schedulers.js +250 -0
- package/dist/workflow/schedulers.js.map +1 -0
- package/dist/workflow/team/create-team.d.ts +34 -0
- package/dist/workflow/team/create-team.d.ts.map +1 -0
- package/dist/workflow/team/create-team.js +242 -0
- package/dist/workflow/team/create-team.js.map +1 -0
- package/dist/workflow/team/index.d.ts +9 -0
- package/dist/workflow/team/index.d.ts.map +1 -0
- package/dist/workflow/team/index.js +8 -0
- package/dist/workflow/team/index.js.map +1 -0
- package/dist/workflow/team/machines.d.ts +152 -0
- package/dist/workflow/team/machines.d.ts.map +1 -0
- package/dist/workflow/team/machines.js +197 -0
- package/dist/workflow/team/machines.js.map +1 -0
- package/dist/workflow/team/task-board.d.ts +47 -0
- package/dist/workflow/team/task-board.d.ts.map +1 -0
- package/dist/workflow/team/task-board.js +111 -0
- package/dist/workflow/team/task-board.js.map +1 -0
- package/dist/workflow/team/tools.d.ts +66 -0
- package/dist/workflow/team/tools.d.ts.map +1 -0
- package/dist/workflow/team/tools.js +100 -0
- package/dist/workflow/team/tools.js.map +1 -0
- package/dist/workflow/team/types.d.ts +109 -0
- package/dist/workflow/team/types.d.ts.map +1 -0
- package/dist/workflow/team/types.js +5 -0
- package/dist/workflow/team/types.js.map +1 -0
- package/dist/workflow/templates.d.ts +71 -0
- package/dist/workflow/templates.d.ts.map +1 -0
- package/dist/workflow/templates.js +132 -0
- package/dist/workflow/templates.js.map +1 -0
- package/package.json +13 -13
- package/LICENSE +0 -22
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agntk/core - V2 Agent Factory
|
|
3
|
+
*
|
|
4
|
+
* A fully-equipped agent that shows up ready. No roles, no tool presets,
|
|
5
|
+
* no feature flags. You give it a name, tell it what it's doing, and
|
|
6
|
+
* point it at a task. It figures out the rest.
|
|
7
|
+
*
|
|
8
|
+
* Every capability is auto-detected from the environment:
|
|
9
|
+
* - Tools: ALL tools, always
|
|
10
|
+
* - Memory: always on, stored at ~/.agntk/agents/{name}/
|
|
11
|
+
* - Durability: auto-detected (workflow package installed → on)
|
|
12
|
+
* - Telemetry: auto-detected (LANGFUSE_PUBLIC_KEY set → on)
|
|
13
|
+
* - Skills: auto-discovered from standard directories
|
|
14
|
+
* - Sub-agents: always enabled with team coordination
|
|
15
|
+
* - Reflection: always on (reflact strategy)
|
|
16
|
+
* - Approval: always on for dangerous tools
|
|
17
|
+
* - Model: auto-selected from available API keys
|
|
18
|
+
*/
|
|
19
|
+
import type { AgentOptionsV2, AgentV2 } from './types/agent-v2.js';
|
|
20
|
+
/**
|
|
21
|
+
* Create a v2 agent — fully equipped, zero config.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const agent = createAgentV2({
|
|
26
|
+
* name: 'deploy-bot',
|
|
27
|
+
* instructions: 'You manage deployments for our k8s cluster.',
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* const result = await agent.stream({ prompt: 'Roll back staging to yesterday' });
|
|
31
|
+
* for await (const chunk of result.fullStream) {
|
|
32
|
+
* if (chunk.type === 'text-delta') process.stdout.write(chunk.text ?? '');
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Internal options not exposed in the public API.
|
|
38
|
+
* Used by the factory when recursively creating sub-agents.
|
|
39
|
+
*/
|
|
40
|
+
interface InternalV2Options {
|
|
41
|
+
/** Current spawn depth. 0 = top-level agent. */
|
|
42
|
+
_spawnDepth?: number;
|
|
43
|
+
/** Parent agent name, for naming sub-agents. */
|
|
44
|
+
_parentName?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare function createAgentV2(options: AgentOptionsV2, _internal?: InternalV2Options): AgentV2;
|
|
47
|
+
export default createAgentV2;
|
|
48
|
+
//# sourceMappingURL=agent-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-v2.d.ts","sourceRoot":"","sources":["../src/agent-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAuB,MAAM,kBAAkB,CAAC;AAuGrF;;;;;;;;;;;;;;;GAeG;AACH;;;GAGG;AACH,UAAU,iBAAiB;IACzB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,GAAE,iBAAsB,GAAG,OAAO,CAkTjG;AAED,eAAe,aAAa,CAAC"}
|
package/dist/agent-v2.js
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agntk/core - V2 Agent Factory
|
|
3
|
+
*
|
|
4
|
+
* A fully-equipped agent that shows up ready. No roles, no tool presets,
|
|
5
|
+
* no feature flags. You give it a name, tell it what it's doing, and
|
|
6
|
+
* point it at a task. It figures out the rest.
|
|
7
|
+
*
|
|
8
|
+
* Every capability is auto-detected from the environment:
|
|
9
|
+
* - Tools: ALL tools, always
|
|
10
|
+
* - Memory: always on, stored at ~/.agntk/agents/{name}/
|
|
11
|
+
* - Durability: auto-detected (workflow package installed → on)
|
|
12
|
+
* - Telemetry: auto-detected (LANGFUSE_PUBLIC_KEY set → on)
|
|
13
|
+
* - Skills: auto-discovered from standard directories
|
|
14
|
+
* - Sub-agents: always enabled with team coordination
|
|
15
|
+
* - Reflection: always on (reflact strategy)
|
|
16
|
+
* - Approval: always on for dangerous tools
|
|
17
|
+
* - Model: auto-selected from available API keys
|
|
18
|
+
*/
|
|
19
|
+
import { resolve } from 'node:path';
|
|
20
|
+
import { homedir } from 'node:os';
|
|
21
|
+
import { ToolLoopAgent, stepCountIs } from 'ai';
|
|
22
|
+
import { createLogger } from '@agntk/logger';
|
|
23
|
+
import { usageLimitStop } from './usage-limits.js';
|
|
24
|
+
import { resolveModel } from './models.js';
|
|
25
|
+
import { createToolPreset } from './presets/tools.js';
|
|
26
|
+
import { createSpawnAgentTool } from './tools/spawn-agent/index.js';
|
|
27
|
+
import { wrapAllToolsWithRetry } from './tools/model-retry.js';
|
|
28
|
+
import { discoverSkills, filterEligibleSkills, buildSkillsSystemPrompt, loadSkillContent } from './skills/index.js';
|
|
29
|
+
import { checkWorkflowAvailability } from './workflow/utils.js';
|
|
30
|
+
import { wrapToolsAsDurable } from './workflow/durable-tool.js';
|
|
31
|
+
import { createReflectionPrepareStep } from './reflection.js';
|
|
32
|
+
// import { applyApproval } from './tools/approval.js'; // Disabled until approval handler is wired up
|
|
33
|
+
import { runGuardrails, handleGuardrailResults } from './guardrails/runner.js';
|
|
34
|
+
import { contentFilter } from './guardrails/built-ins.js';
|
|
35
|
+
import { MarkdownMemoryStore } from './memory/store.js';
|
|
36
|
+
import { loadMemoryContext } from './memory/loader.js';
|
|
37
|
+
import { createMemoryTools } from './memory/tools.js';
|
|
38
|
+
import { initObservability, createTelemetrySettings } from './observability/index.js';
|
|
39
|
+
import { buildDynamicSystemPrompt } from './prompts/context.js';
|
|
40
|
+
// ============================================================================
|
|
41
|
+
// Logger
|
|
42
|
+
// ============================================================================
|
|
43
|
+
const log = createLogger('@agntk/core:agent-v2');
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// Constants
|
|
46
|
+
// ============================================================================
|
|
47
|
+
const DEFAULT_MAX_STEPS = 25;
|
|
48
|
+
const SUB_AGENT_MAX_STEPS = 15;
|
|
49
|
+
const DEFAULT_MAX_SPAWN_DEPTH = 2;
|
|
50
|
+
const AGENT_STATE_BASE = '.agntk/agents';
|
|
51
|
+
// ============================================================================
|
|
52
|
+
// Helpers
|
|
53
|
+
// ============================================================================
|
|
54
|
+
/**
|
|
55
|
+
* Resolve the persistent state directory for a named agent.
|
|
56
|
+
* ~/.agntk/agents/{name}/
|
|
57
|
+
*/
|
|
58
|
+
function resolveAgentStatePath(name) {
|
|
59
|
+
// Sanitize name for filesystem
|
|
60
|
+
const safeName = name.replace(/[^a-zA-Z0-9_-]/g, '_').toLowerCase();
|
|
61
|
+
return resolve(homedir(), AGENT_STATE_BASE, safeName);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Detect if telemetry should be enabled from env vars.
|
|
65
|
+
*/
|
|
66
|
+
function detectTelemetry() {
|
|
67
|
+
return !!(process.env.LANGFUSE_PUBLIC_KEY &&
|
|
68
|
+
process.env.LANGFUSE_SECRET_KEY);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Build the base instructions for the agent.
|
|
72
|
+
* Combines user instructions with auto-discovered skills.
|
|
73
|
+
*/
|
|
74
|
+
function buildBaseInstructions(name, userInstructions, skillsPrompt) {
|
|
75
|
+
const parts = [];
|
|
76
|
+
// Core identity
|
|
77
|
+
parts.push(`You are ${name}, a capable AI agent.`);
|
|
78
|
+
// User instructions
|
|
79
|
+
if (userInstructions) {
|
|
80
|
+
parts.push('');
|
|
81
|
+
parts.push(userInstructions);
|
|
82
|
+
}
|
|
83
|
+
// Agent capabilities reminder
|
|
84
|
+
parts.push('');
|
|
85
|
+
parts.push('You have access to a full suite of tools including file operations, ' +
|
|
86
|
+
'shell commands, code search (grep, glob, ast-grep), a browser, ' +
|
|
87
|
+
'deep reasoning, planning, and persistent memory. ' +
|
|
88
|
+
'You can spawn sub-agents for complex tasks that benefit from delegation. ' +
|
|
89
|
+
'Use the remember tool to persist important findings across sessions. ' +
|
|
90
|
+
'Use the recall tool to search your memory for relevant context.');
|
|
91
|
+
// Skills
|
|
92
|
+
if (skillsPrompt) {
|
|
93
|
+
parts.push('');
|
|
94
|
+
parts.push(skillsPrompt);
|
|
95
|
+
}
|
|
96
|
+
return parts.join('\n');
|
|
97
|
+
}
|
|
98
|
+
export function createAgentV2(options, _internal = {}) {
|
|
99
|
+
const { name, instructions, workspaceRoot = process.cwd(), } = options;
|
|
100
|
+
const spawnDepth = _internal._spawnDepth ?? 0;
|
|
101
|
+
const isSubAgent = spawnDepth > 0;
|
|
102
|
+
const maxSteps = options.maxSteps ?? (isSubAgent ? SUB_AGENT_MAX_STEPS : DEFAULT_MAX_STEPS);
|
|
103
|
+
log.info('Creating v2 agent', { name, maxSteps, workspaceRoot, spawnDepth });
|
|
104
|
+
// ── 1. Resolve model ──────────────────────────────────────────────────
|
|
105
|
+
// User override takes priority, otherwise auto-select from available API keys.
|
|
106
|
+
const model = options.model ?? resolveModel({ tier: 'standard' });
|
|
107
|
+
log.debug('Model resolved', { hasExplicitModel: !!options.model });
|
|
108
|
+
// ── 2. Build ALL tools (no presets, no filtering) ─────────────────────
|
|
109
|
+
// The 'full' preset creates every tool we have.
|
|
110
|
+
let tools = createToolPreset('full', { workspaceRoot });
|
|
111
|
+
log.debug('Base tools built', { count: Object.keys(tools).length, tools: Object.keys(tools) });
|
|
112
|
+
// ── 3. Memory — always on ─────────────────────────────────────────────
|
|
113
|
+
// Each named agent gets persistent state at ~/.agntk/agents/{name}/
|
|
114
|
+
const agentStatePath = resolveAgentStatePath(name);
|
|
115
|
+
const memoryStore = new MarkdownMemoryStore({
|
|
116
|
+
projectDir: agentStatePath,
|
|
117
|
+
globalDir: '.agntk', // Global identity/preferences at ~/.agntk/
|
|
118
|
+
workspaceRoot,
|
|
119
|
+
});
|
|
120
|
+
const memoryTools = createMemoryTools({ store: memoryStore, model });
|
|
121
|
+
Object.assign(tools, memoryTools);
|
|
122
|
+
log.info('Memory enabled', {
|
|
123
|
+
agentStatePath,
|
|
124
|
+
projectPath: memoryStore.getProjectPath(),
|
|
125
|
+
globalPath: memoryStore.getGlobalPath(),
|
|
126
|
+
tools: Object.keys(memoryTools),
|
|
127
|
+
});
|
|
128
|
+
// ── 4. Sub-agents — recursive v2 creation ──────────────────────────────
|
|
129
|
+
// Sub-agents are full v2 agents. At max depth, spawn tool is omitted.
|
|
130
|
+
if (spawnDepth < DEFAULT_MAX_SPAWN_DEPTH) {
|
|
131
|
+
const spawnTool = createSpawnAgentTool({
|
|
132
|
+
maxSpawnDepth: DEFAULT_MAX_SPAWN_DEPTH,
|
|
133
|
+
currentDepth: spawnDepth,
|
|
134
|
+
createAgent: (subAgentOptions) => {
|
|
135
|
+
const subName = `${name}/${subAgentOptions.role}`;
|
|
136
|
+
log.info('Spawning sub-agent', { parentName: name, subName, role: subAgentOptions.role });
|
|
137
|
+
// Create a full v2 sub-agent with depth+1.
|
|
138
|
+
// It gets all tools, its own memory under the parent's state dir,
|
|
139
|
+
// and won't get a spawn tool if at max depth.
|
|
140
|
+
const subAgent = createAgentV2({
|
|
141
|
+
name: subName,
|
|
142
|
+
instructions: subAgentOptions.instructions,
|
|
143
|
+
workspaceRoot,
|
|
144
|
+
maxSteps: SUB_AGENT_MAX_STEPS,
|
|
145
|
+
model: options.model, // Inherit parent's model
|
|
146
|
+
}, {
|
|
147
|
+
_spawnDepth: spawnDepth + 1,
|
|
148
|
+
_parentName: name,
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
stream: (input) => {
|
|
152
|
+
const streamPromise = subAgent.stream(input);
|
|
153
|
+
return {
|
|
154
|
+
fullStream: (async function* () {
|
|
155
|
+
const result = await streamPromise;
|
|
156
|
+
for await (const chunk of result.fullStream) {
|
|
157
|
+
yield chunk;
|
|
158
|
+
}
|
|
159
|
+
})(),
|
|
160
|
+
text: streamPromise.then((r) => r.text),
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
tools = { ...tools, spawn_agent: spawnTool };
|
|
167
|
+
log.debug('Sub-agents enabled', { maxSpawnDepth: DEFAULT_MAX_SPAWN_DEPTH, currentDepth: spawnDepth });
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
log.debug('Sub-agents disabled (at max spawn depth)', { spawnDepth });
|
|
171
|
+
}
|
|
172
|
+
// ── 5. Approval — off by default ─────────────────────────────────────
|
|
173
|
+
// The v2 agent is run by a person who trusts it. Approval can be
|
|
174
|
+
// re-enabled when we add a proper approval handler to the CLI/SDK.
|
|
175
|
+
// Without a handler, needsApproval: true silently blocks tool execution.
|
|
176
|
+
log.debug('Approval disabled (no handler configured)');
|
|
177
|
+
// ── 6. Durability — auto-detect (deferred to init) ──────────────────
|
|
178
|
+
// Wrapping is only applied if the 'workflow' package is installed.
|
|
179
|
+
// Checked in ensureInit() since the detection is async.
|
|
180
|
+
// ── 7. ModelRetry — always on ─────────────────────────────────────────
|
|
181
|
+
tools = wrapAllToolsWithRetry(tools, 3);
|
|
182
|
+
log.debug('ModelRetry wrapping applied');
|
|
183
|
+
// ── 8. Auto-discover skills ───────────────────────────────────────────
|
|
184
|
+
let skillsPrompt = '';
|
|
185
|
+
try {
|
|
186
|
+
const discovered = discoverSkills(undefined, workspaceRoot);
|
|
187
|
+
const eligible = filterEligibleSkills(discovered);
|
|
188
|
+
if (eligible.length > 0) {
|
|
189
|
+
const loaded = eligible.map((s) => loadSkillContent(s));
|
|
190
|
+
skillsPrompt = buildSkillsSystemPrompt(loaded);
|
|
191
|
+
log.info('Skills discovered', { count: eligible.length, names: eligible.map((s) => s.name) });
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
log.warn('Skill discovery failed', { error: err instanceof Error ? err.message : String(err) });
|
|
196
|
+
}
|
|
197
|
+
// ── 9. Build system prompt ────────────────────────────────────────────
|
|
198
|
+
let augmentedSystemPrompt = buildBaseInstructions(name, instructions, skillsPrompt);
|
|
199
|
+
// ── 10. Stop conditions ───────────────────────────────────────────────
|
|
200
|
+
const stopConditions = [
|
|
201
|
+
stepCountIs(maxSteps),
|
|
202
|
+
];
|
|
203
|
+
if (options.usageLimits) {
|
|
204
|
+
stopConditions.push(usageLimitStop(options.usageLimits));
|
|
205
|
+
log.debug('Usage limits configured', { limits: options.usageLimits });
|
|
206
|
+
}
|
|
207
|
+
// ── 11. Reflection — always on (reflact strategy) ─────────────────────
|
|
208
|
+
const prepareStep = createReflectionPrepareStep(augmentedSystemPrompt, {
|
|
209
|
+
strategy: 'reflact',
|
|
210
|
+
});
|
|
211
|
+
log.debug('Reflection enabled', { strategy: 'reflact' });
|
|
212
|
+
// ── 12. Guardrails — always on (output: PII content filter) ──────────
|
|
213
|
+
// Default output guardrails run on the final text to catch PII leaks.
|
|
214
|
+
// Uses 'filter' mode: PII is silently redacted, not blocked.
|
|
215
|
+
const outputGuardrails = [contentFilter()];
|
|
216
|
+
log.debug('Output guardrails enabled', { guards: outputGuardrails.map((g) => g.name) });
|
|
217
|
+
// ── 13. Telemetry — auto-detect ──────────────────────────────────────
|
|
218
|
+
const telemetryEnabled = detectTelemetry();
|
|
219
|
+
const telemetrySettings = telemetryEnabled
|
|
220
|
+
? createTelemetrySettings({ functionId: `agent-v2:${name}` })
|
|
221
|
+
: undefined;
|
|
222
|
+
if (telemetryEnabled) {
|
|
223
|
+
log.debug('Telemetry will be initialized on first call');
|
|
224
|
+
}
|
|
225
|
+
// ── 14. Build the ToolLoopAgent ───────────────────────────────────────
|
|
226
|
+
const toolLoopAgent = new ToolLoopAgent({
|
|
227
|
+
model,
|
|
228
|
+
instructions: augmentedSystemPrompt,
|
|
229
|
+
tools,
|
|
230
|
+
stopWhen: stopConditions,
|
|
231
|
+
// Dynamic system prompt injection — picks up memory context after lazy load
|
|
232
|
+
prepareCall: (opts) => ({ ...opts, instructions: augmentedSystemPrompt }),
|
|
233
|
+
prepareStep,
|
|
234
|
+
...(telemetrySettings ? { experimental_telemetry: telemetrySettings } : {}),
|
|
235
|
+
});
|
|
236
|
+
log.debug('ToolLoopAgent created', {
|
|
237
|
+
promptLength: augmentedSystemPrompt.length,
|
|
238
|
+
toolCount: Object.keys(tools).length,
|
|
239
|
+
telemetry: !!telemetrySettings,
|
|
240
|
+
});
|
|
241
|
+
// ── Lazy initializers ─────────────────────────────────────────────────
|
|
242
|
+
const agentLog = log.child({ agent: name });
|
|
243
|
+
let initialized = false;
|
|
244
|
+
let initPromise = null;
|
|
245
|
+
async function ensureInit() {
|
|
246
|
+
if (initialized)
|
|
247
|
+
return;
|
|
248
|
+
if (initPromise)
|
|
249
|
+
return initPromise;
|
|
250
|
+
initPromise = (async () => {
|
|
251
|
+
// Load memory context into system prompt
|
|
252
|
+
try {
|
|
253
|
+
const memoryContext = await loadMemoryContext(memoryStore);
|
|
254
|
+
if (memoryContext) {
|
|
255
|
+
augmentedSystemPrompt = memoryContext + '\n\n' + augmentedSystemPrompt;
|
|
256
|
+
agentLog.debug('Memory context injected', { chars: memoryContext.length });
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
catch (err) {
|
|
260
|
+
agentLog.warn('Memory context loading failed', {
|
|
261
|
+
error: err instanceof Error ? err.message : String(err),
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
// Inject dynamic environment context (time, platform, workspace)
|
|
265
|
+
try {
|
|
266
|
+
augmentedSystemPrompt = await buildDynamicSystemPrompt(augmentedSystemPrompt, {
|
|
267
|
+
workspaceRoot,
|
|
268
|
+
includeWorkspaceMap: true,
|
|
269
|
+
});
|
|
270
|
+
agentLog.debug('Dynamic context injected');
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
agentLog.warn('Dynamic context injection failed', {
|
|
274
|
+
error: err instanceof Error ? err.message : String(err),
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
// Apply durable wrapping if workflow runtime is available
|
|
278
|
+
try {
|
|
279
|
+
const workflowAvailable = await checkWorkflowAvailability();
|
|
280
|
+
if (workflowAvailable) {
|
|
281
|
+
tools = wrapToolsAsDurable(tools, { retryCount: 3 });
|
|
282
|
+
agentLog.info('Durable tool wrapping active (workflow package detected)');
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
agentLog.debug('Workflow package not installed — skipping durable wrapping');
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
agentLog.debug('Workflow detection failed — skipping durable wrapping');
|
|
290
|
+
}
|
|
291
|
+
// Initialize telemetry if detected
|
|
292
|
+
if (telemetryEnabled) {
|
|
293
|
+
try {
|
|
294
|
+
await initObservability({
|
|
295
|
+
provider: 'langfuse',
|
|
296
|
+
});
|
|
297
|
+
agentLog.info('Telemetry initialized');
|
|
298
|
+
}
|
|
299
|
+
catch (err) {
|
|
300
|
+
agentLog.warn('Telemetry initialization failed', {
|
|
301
|
+
error: err instanceof Error ? err.message : String(err),
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
initialized = true;
|
|
306
|
+
})();
|
|
307
|
+
return initPromise;
|
|
308
|
+
}
|
|
309
|
+
// ── Build the agent instance ──────────────────────────────────────────
|
|
310
|
+
const agent = {
|
|
311
|
+
name,
|
|
312
|
+
init: ensureInit,
|
|
313
|
+
getSystemPrompt: () => augmentedSystemPrompt,
|
|
314
|
+
getToolNames: () => Object.keys(tools),
|
|
315
|
+
stream: async (input) => {
|
|
316
|
+
await ensureInit();
|
|
317
|
+
agentLog.info('stream() called', { promptLength: input.prompt.length });
|
|
318
|
+
const result = await toolLoopAgent.stream({ prompt: input.prompt });
|
|
319
|
+
// Apply output guardrails to the final text (async, runs after stream completes).
|
|
320
|
+
// Uses 'filter' mode — PII is silently redacted, agent is never blocked.
|
|
321
|
+
const guardedText = result.text.then(async (text) => {
|
|
322
|
+
if (!text || outputGuardrails.length === 0)
|
|
323
|
+
return text;
|
|
324
|
+
try {
|
|
325
|
+
const { results, filteredText } = await runGuardrails(outputGuardrails, text, {
|
|
326
|
+
prompt: input.prompt,
|
|
327
|
+
phase: 'output',
|
|
328
|
+
});
|
|
329
|
+
const check = handleGuardrailResults(results, text, filteredText, 'output', 'filter');
|
|
330
|
+
if (check.blocked) {
|
|
331
|
+
agentLog.info('Output guardrails filtered content', {
|
|
332
|
+
guards: results.filter((r) => !r.passed).map((r) => r.name),
|
|
333
|
+
});
|
|
334
|
+
return check.text;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
catch (err) {
|
|
338
|
+
agentLog.warn('Output guardrails failed', {
|
|
339
|
+
error: err instanceof Error ? err.message : String(err),
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
return text;
|
|
343
|
+
});
|
|
344
|
+
return {
|
|
345
|
+
fullStream: result.fullStream,
|
|
346
|
+
text: guardedText,
|
|
347
|
+
usage: result.totalUsage,
|
|
348
|
+
};
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
log.info('V2 agent created', {
|
|
352
|
+
name,
|
|
353
|
+
spawnDepth,
|
|
354
|
+
toolCount: Object.keys(tools).length,
|
|
355
|
+
tools: Object.keys(tools),
|
|
356
|
+
memoryPath: agentStatePath,
|
|
357
|
+
durable: 'auto-detect',
|
|
358
|
+
telemetry: telemetryEnabled,
|
|
359
|
+
reflection: 'reflact',
|
|
360
|
+
guardrails: outputGuardrails.map((g) => g.name),
|
|
361
|
+
});
|
|
362
|
+
return agent;
|
|
363
|
+
}
|
|
364
|
+
export default createAgentV2;
|
|
365
|
+
//# sourceMappingURL=agent-v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-v2.js","sourceRoot":"","sources":["../src/agent-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE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AC,OAAO,GAAG,EAAE,CAAC;oBACb,QAAQ,CAAC,IAAI,CAAC,0BAA0B,EAAE;wBACxC,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;qBACxD,CAAC,CAAC;gBACL,CAAC;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;YAEH,OAAO;gBACL,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,MAAM,CAAC,UAAU;aACzB,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,GAAG,CAAC,IAAI,CAAC,kBAAkB,EAAE;QAC3B,IAAI;QACJ,UAAU;QACV,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM;QACpC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QACzB,UAAU,EAAE,cAAc;QAC1B,OAAO,EAAE,aAAa;QACtB,SAAS,EAAE,gBAAgB;QAC3B,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;KAChD,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agntk/core - Unified Memory Engine
|
|
3
|
+
*
|
|
4
|
+
* Single write path: remember() → LLM extraction → parallel writes to Vectra + Graph.
|
|
5
|
+
* Implements Mem0 ADD/UPDATE/DELETE/NOOP pattern with Hindsight 4-network taxonomy.
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - VectorStore: Semantic similarity search (Vectra)
|
|
9
|
+
* - GraphStore: Structural relationships (Graphology via QueryPort)
|
|
10
|
+
* - ExtractionModel: LLM-powered fact extraction
|
|
11
|
+
* - ContradictionDetector: Write-time conflict detection
|
|
12
|
+
*/
|
|
13
|
+
import type { LanguageModel } from 'ai';
|
|
14
|
+
import type { MemoryStore, MemorySearchResult } from './vectra-store.js';
|
|
15
|
+
import { type ExtractedFact, type MemoryOperation } from './extraction.js';
|
|
16
|
+
/** Graph store interface — matches QueryPort episode/entity methods */
|
|
17
|
+
export interface MemoryGraphStore {
|
|
18
|
+
upsertEpisode(episode: {
|
|
19
|
+
id: string;
|
|
20
|
+
timestamp: string;
|
|
21
|
+
type: 'conversation' | 'observation' | 'action' | 'decision' | 'learning';
|
|
22
|
+
summary: string;
|
|
23
|
+
content: string;
|
|
24
|
+
entities: string[];
|
|
25
|
+
relationships: string[];
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
linkEpisodeEntity(episodeId: string, entityName: string): Promise<void>;
|
|
28
|
+
getEpisodesByQuery(query: string, limit: number): Promise<Array<{
|
|
29
|
+
id?: string;
|
|
30
|
+
summary?: string;
|
|
31
|
+
content?: string;
|
|
32
|
+
timestamp?: string;
|
|
33
|
+
type?: string;
|
|
34
|
+
properties?: Record<string, unknown>;
|
|
35
|
+
}>>;
|
|
36
|
+
upsertContradiction(contradiction: {
|
|
37
|
+
id: string;
|
|
38
|
+
detectedAt: string;
|
|
39
|
+
resolution_winner: string | null;
|
|
40
|
+
resolution_reasoning: string | null;
|
|
41
|
+
factA_id: string;
|
|
42
|
+
factA_statement: string;
|
|
43
|
+
factA_source: string;
|
|
44
|
+
factA_timestamp: string;
|
|
45
|
+
factB_id: string;
|
|
46
|
+
factB_statement: string;
|
|
47
|
+
factB_source: string;
|
|
48
|
+
factB_timestamp: string;
|
|
49
|
+
}): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
/** Contradiction detector interface — matches brain's ContradictionDetector */
|
|
52
|
+
export interface ContradictionDetectorPort {
|
|
53
|
+
detect(statementA: string, statementB: string, metadataA?: {
|
|
54
|
+
id: string;
|
|
55
|
+
source: string;
|
|
56
|
+
timestamp: string;
|
|
57
|
+
}, metadataB?: {
|
|
58
|
+
id: string;
|
|
59
|
+
source: string;
|
|
60
|
+
timestamp: string;
|
|
61
|
+
}): {
|
|
62
|
+
id: string;
|
|
63
|
+
factA: Record<string, string>;
|
|
64
|
+
factB: Record<string, string>;
|
|
65
|
+
detectedAt: string;
|
|
66
|
+
} | null;
|
|
67
|
+
}
|
|
68
|
+
/** Result of a unified remember() operation */
|
|
69
|
+
export interface MemoryWriteResult {
|
|
70
|
+
id: string;
|
|
71
|
+
operation: MemoryOperation;
|
|
72
|
+
facts: ExtractedFact[];
|
|
73
|
+
vectorStoreId?: string;
|
|
74
|
+
graphStoreId?: string;
|
|
75
|
+
contradiction?: {
|
|
76
|
+
id: string;
|
|
77
|
+
existingFact: string;
|
|
78
|
+
newFact: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** Configuration for the unified memory engine */
|
|
82
|
+
export interface MemoryEngineConfig {
|
|
83
|
+
/** Vector store for semantic search (Vectra) */
|
|
84
|
+
vectorStore: MemoryStore;
|
|
85
|
+
/** Graph store for structural queries (Graphology via QueryPort) — optional */
|
|
86
|
+
graphStore?: MemoryGraphStore;
|
|
87
|
+
/** LLM for extraction pipeline — optional, extraction disabled without it */
|
|
88
|
+
extractionModel?: LanguageModel;
|
|
89
|
+
/** Contradiction detector — optional */
|
|
90
|
+
contradictionDetector?: ContradictionDetectorPort;
|
|
91
|
+
/** Default top-K for recall */
|
|
92
|
+
defaultTopK?: number;
|
|
93
|
+
/** Default similarity threshold */
|
|
94
|
+
defaultThreshold?: number;
|
|
95
|
+
}
|
|
96
|
+
/** The unified memory engine interface */
|
|
97
|
+
export interface MemoryEngine {
|
|
98
|
+
/** Store text with LLM extraction → parallel writes to vector + graph */
|
|
99
|
+
remember(text: string, metadata?: Record<string, unknown>): Promise<MemoryWriteResult>;
|
|
100
|
+
/** Semantic search via vector store */
|
|
101
|
+
recall(query: string, options?: {
|
|
102
|
+
topK?: number;
|
|
103
|
+
threshold?: number;
|
|
104
|
+
}): Promise<MemorySearchResult[]>;
|
|
105
|
+
/** Graph-based knowledge query — returns episodes/entities matching query */
|
|
106
|
+
queryKnowledge(query: string, limit?: number): Promise<Array<Record<string, unknown>>>;
|
|
107
|
+
/** Remove a memory by ID from both stores */
|
|
108
|
+
forget(id: string): Promise<boolean>;
|
|
109
|
+
/** Get stats */
|
|
110
|
+
count(): Promise<number>;
|
|
111
|
+
/** Cleanup */
|
|
112
|
+
close(): Promise<void>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Create a unified memory engine.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const engine = createMemoryEngine({
|
|
120
|
+
* vectorStore: await createMemoryStore({ path: './.memory' }),
|
|
121
|
+
* graphStore: new GraphologyAdapter(),
|
|
122
|
+
* extractionModel: openai('gpt-4o-mini'),
|
|
123
|
+
* });
|
|
124
|
+
*
|
|
125
|
+
* // Single remember() does extraction + parallel writes
|
|
126
|
+
* const result = await engine.remember('TypeScript 5.3 supports import attributes');
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare function createMemoryEngine(config: MemoryEngineConfig): MemoryEngine;
|
|
130
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/memory/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AAQtB,uEAAuE;AACvE,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,OAAO,EAAE;QACrB,EAAE,EAAE,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