snow-flow 4.1.0 → 4.1.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.
Files changed (44) hide show
  1. package/README.md +15 -40
  2. package/dist/cli.js +0 -81
  3. package/dist/dynamic-version.js +1 -1
  4. package/dist/index.js +3 -1
  5. package/dist/intelligence/performance-recommendations-engine.js +1 -0
  6. package/dist/mcp/advanced/servicenow-advanced-features-mcp.js +12 -12
  7. package/dist/mcp/servicenow-development-assistant-mcp.js +1 -1
  8. package/dist/mcp/servicenow-local-development-mcp.d.ts +0 -3
  9. package/dist/mcp/servicenow-local-development-mcp.js +7 -204
  10. package/dist/mcp/servicenow-machine-learning-mcp.js +2 -2
  11. package/dist/mcp/servicenow-reporting-analytics-mcp.js +1 -1
  12. package/dist/mcp/shared/response-limiter.js +1 -1
  13. package/dist/memory/snow-flow-memory-patterns.d.ts +29 -30
  14. package/dist/memory/snow-flow-memory-patterns.js +26 -37
  15. package/dist/snow-flow-system.js +1 -0
  16. package/dist/testing/integration-test-suite.js +1 -0
  17. package/dist/utils/artifact-local-sync.js +0 -17
  18. package/dist/utils/artifact-sync/artifact-registry.js +11 -11
  19. package/dist/utils/smart-field-fetcher.js +9 -11
  20. package/package.json +2 -2
  21. package/dist/agent/interactive.d.ts +0 -11
  22. package/dist/agent/interactive.js +0 -190
  23. package/dist/agent/session.d.ts +0 -12
  24. package/dist/agent/session.js +0 -106
  25. package/dist/cli/auth.d.ts +0 -3
  26. package/dist/cli/auth.js +0 -59
  27. package/dist/cli/session.d.ts +0 -3
  28. package/dist/cli/session.js +0 -46
  29. package/dist/llm/keys.d.ts +0 -5
  30. package/dist/llm/keys.js +0 -29
  31. package/dist/llm/providers.d.ts +0 -11
  32. package/dist/llm/providers.js +0 -77
  33. package/dist/mcp/bridge.d.ts +0 -10
  34. package/dist/mcp/bridge.js +0 -31
  35. package/dist/mcp/shared/mcp-types.d.ts +0 -37
  36. package/dist/mcp/shared/mcp-types.js +0 -7
  37. package/dist/memory/hierarchical-memory-system.d.ts +0 -32
  38. package/dist/memory/hierarchical-memory-system.js +0 -60
  39. package/dist/memory/memory-system.d.ts +0 -25
  40. package/dist/memory/memory-system.js +0 -36
  41. package/dist/session/store.d.ts +0 -47
  42. package/dist/session/store.js +0 -74
  43. package/dist/utils/chunking-manager.d.ts +0 -39
  44. package/dist/utils/chunking-manager.js +0 -143
@@ -1,106 +0,0 @@
1
- "use strict";
2
- // Agent session placeholder to keep build green.
3
- // Will be replaced with streaming + tool-calling using the AI SDK.
4
- var __importDefault = (this && this.__importDefault) || function (mod) {
5
- return (mod && mod.__esModule) ? mod : { "default": mod };
6
- };
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.runAgent = runAgent;
9
- const bridge_1 = require("../mcp/bridge");
10
- const boxen_1 = __importDefault(require("boxen"));
11
- const chalk_1 = __importDefault(require("chalk"));
12
- const store_js_1 = require("../session/store.js");
13
- async function runAgent(opts) {
14
- const { mcp, system, user, maxSteps = 40, provider, model, baseURL, apiKeyEnv, showReasoning = true, saveOutputPath } = opts;
15
- // Resolve model via provider registry
16
- let llm;
17
- try {
18
- // eslint-disable-next-line @typescript-eslint/no-var-requires
19
- const prov = require('../llm/providers.js');
20
- llm = prov.getModel({ provider, model, baseURL, apiKeyEnv });
21
- }
22
- catch (e) {
23
- console.error('❌ LLM provider init error:', e instanceof Error ? e.message : String(e));
24
- throw e;
25
- }
26
- // Load MCP tools (if AI SDK MCP client is available)
27
- const { tools, close } = await (0, bridge_1.loadMCPTools)(mcp);
28
- // Stream using AI SDK
29
- try {
30
- // eslint-disable-next-line @typescript-eslint/no-var-requires
31
- const { streamText } = require('ai');
32
- const sessionId = (0, store_js_1.createSessionId)();
33
- (0, store_js_1.startSession)({
34
- id: sessionId,
35
- startedAt: new Date().toISOString(),
36
- objective: user,
37
- provider: { id: String(provider), model: String(model), baseURL },
38
- mcp: { cmd: mcp.cmd, args: mcp.args },
39
- });
40
- (0, store_js_1.appendMessage)(sessionId, { role: 'user', content: user, timestamp: new Date().toISOString() });
41
- const result = await streamText({
42
- model: llm,
43
- system: system ?? 'You are Snow-Flow, a ServiceNow engineering agent. Be precise. Use tools when helpful.',
44
- messages: [{ role: 'user', content: user }],
45
- tools,
46
- maxSteps,
47
- });
48
- let buffer = '';
49
- let inReasoning = false;
50
- const writeChunk = (s) => {
51
- buffer += s;
52
- const colored = inReasoning && showReasoning ? chalk_1.default.yellow.dim(s) : s;
53
- process.stdout.write(colored);
54
- };
55
- // Optional: stream tool call events if provided by SDK
56
- if (result.toolCallStream && typeof result.toolCallStream[Symbol.asyncIterator] === 'function') {
57
- (async () => {
58
- for await (const ev of result.toolCallStream) {
59
- const name = ev?.toolName || ev?.name || 'tool';
60
- const args = ev?.args ? JSON.stringify(ev.args).slice(0, 200) : '';
61
- process.stdout.write('\n' + chalk_1.default.cyan(`🔧 Tool → ${name} ${args}`) + '\n');
62
- (0, store_js_1.appendToolEvent)(sessionId, { name, argsPreview: args });
63
- }
64
- })().catch(() => { });
65
- }
66
- if (result.toolResultStream && typeof result.toolResultStream[Symbol.asyncIterator] === 'function') {
67
- (async () => {
68
- for await (const ev of result.toolResultStream) {
69
- const name = ev?.toolName || ev?.name || 'tool';
70
- const out = ev?.result ? JSON.stringify(ev.result).slice(0, 200) : '';
71
- process.stdout.write(chalk_1.default.magenta(`📦 Result ← ${name} ${out}`) + '\n');
72
- (0, store_js_1.appendToolEvent)(sessionId, { name, resultPreview: out });
73
- }
74
- })().catch(() => { });
75
- }
76
- for await (const chunk of result.textStream) {
77
- const str = String(chunk);
78
- // Heuristic: detect reasoning blocks (```reasoning, <thinking>, [reasoning])
79
- if (showReasoning) {
80
- if (str.includes('```reasoning') || str.toLowerCase().includes('<thinking>') || /\[\s*reasoning\s*\]/i.test(str))
81
- inReasoning = true;
82
- if (str.includes('```') || str.toLowerCase().includes('</thinking>'))
83
- inReasoning = false;
84
- }
85
- writeChunk(str);
86
- }
87
- // Render a boxed summary if output is long
88
- if (buffer.length > 4000) {
89
- const preview = buffer.slice(0, 1200) + '…';
90
- const box = (0, boxen_1.default)(preview, { padding: 1, borderColor: 'green', title: 'Preview (truncated)', titleAlignment: 'center' });
91
- process.stdout.write('\n' + box + '\n');
92
- process.stdout.write(chalk_1.default.gray(`Full length: ${buffer.length} chars`) + '\n');
93
- }
94
- if (saveOutputPath) {
95
- const fs = require('fs');
96
- fs.writeFileSync(saveOutputPath, buffer, 'utf8');
97
- process.stdout.write(chalk_1.default.gray(`Saved full output to ${saveOutputPath}`) + '\n');
98
- }
99
- (0, store_js_1.appendMessage)(sessionId, { role: 'assistant', content: buffer, timestamp: new Date().toISOString() });
100
- (0, store_js_1.endSession)(sessionId);
101
- }
102
- finally {
103
- await close();
104
- }
105
- }
106
- //# sourceMappingURL=session.js.map
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function registerAuthCommands(program: Command): void;
3
- //# sourceMappingURL=auth.d.ts.map
package/dist/cli/auth.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.registerAuthCommands = registerAuthCommands;
7
- const inquirer_1 = __importDefault(require("inquirer"));
8
- const chalk_1 = __importDefault(require("chalk"));
9
- const keys_js_1 = require("../llm/keys.js");
10
- function registerAuthCommands(program) {
11
- const auth = program.command('auth').description('Manage provider API credentials for Snow-Flow');
12
- auth
13
- .command('login')
14
- .description('Interactive login to store API keys for a provider')
15
- .option('--provider <provider>', 'Provider id (openai|google|openrouter|openai-compatible|ollama)')
16
- .action(async (opts) => {
17
- const p = opts.provider || (await inquirer_1.default.prompt([{ name: 'provider', message: 'Provider', type: 'list', choices: ['openai', 'google', 'openrouter', 'openai-compatible', 'ollama'] }])).provider;
18
- const existing = (0, keys_js_1.getApiKey)(p);
19
- const { apiKey } = await inquirer_1.default.prompt([{ name: 'apiKey', message: `API key for ${p}${existing ? ' (leave blank to keep existing)' : ''}`, type: 'password', mask: '*' }]);
20
- if (!apiKey && existing) {
21
- console.log(chalk_1.default.yellow('Keeping existing key.'));
22
- return;
23
- }
24
- if (!apiKey) {
25
- console.error(chalk_1.default.red('No key entered. Aborting.'));
26
- process.exit(1);
27
- }
28
- (0, keys_js_1.setApiKey)(p, apiKey);
29
- console.log(chalk_1.default.green(`Saved API key for ${p}.`));
30
- });
31
- auth
32
- .command('set-key')
33
- .description('Set API key non-interactively')
34
- .requiredOption('--provider <provider>', 'Provider id')
35
- .requiredOption('--api-key <key>', 'API key value')
36
- .action((opts) => {
37
- (0, keys_js_1.setApiKey)(opts.provider, opts.apiKey);
38
- console.log(chalk_1.default.green(`Saved API key for ${opts.provider}.`));
39
- });
40
- auth
41
- .command('show')
42
- .description('Show configured providers (keys partially masked)')
43
- .action(() => {
44
- const entries = (0, keys_js_1.listKeys)();
45
- for (const [p, v] of Object.entries(entries)) {
46
- const mask = v ? `${v.substring(0, 4)}…${v.substring(v.length - 4)}` : '—';
47
- console.log(`${p.padEnd(18)} ${mask}`);
48
- }
49
- });
50
- auth
51
- .command('clear')
52
- .description('Clear a stored API key')
53
- .requiredOption('--provider <provider>', 'Provider id')
54
- .action((opts) => {
55
- (0, keys_js_1.clearApiKey)(opts.provider);
56
- console.log(chalk_1.default.yellow(`Cleared API key for ${opts.provider}.`));
57
- });
58
- }
59
- //# sourceMappingURL=auth.js.map
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function registerSessionCommands(program: Command): void;
3
- //# sourceMappingURL=session.d.ts.map
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.registerSessionCommands = registerSessionCommands;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const store_js_1 = require("../session/store.js");
9
- function registerSessionCommands(program) {
10
- const sess = program.command('session').description('Manage and inspect Snow-Flow sessions');
11
- sess
12
- .command('list')
13
- .description('List recent sessions')
14
- .action(() => {
15
- const rows = (0, store_js_1.listSessions)().slice(0, 30);
16
- if (!rows.length)
17
- return console.log('No sessions yet.');
18
- for (const r of rows) {
19
- console.log(`${chalk_1.default.gray(r.startedAt)} ${chalk_1.default.cyan(r.id)} ${r.objective}`);
20
- }
21
- });
22
- sess
23
- .command('show <id>')
24
- .description('Show session details')
25
- .action((id) => {
26
- const rec = (0, store_js_1.readSession)(id);
27
- if (!rec)
28
- return console.error(chalk_1.default.red('Session not found.'));
29
- console.log(chalk_1.default.cyan(`Session ${rec.id}`));
30
- console.log(`${chalk_1.default.gray(rec.startedAt)} → ${chalk_1.default.gray(rec.endedAt ?? '…')}`);
31
- console.log('Objective:', rec.objective);
32
- console.log('Provider:', `${rec.provider.id} ${rec.provider.model}`);
33
- console.log('MCP:', `${rec.mcp.cmd} ${(rec.mcp.args || []).join(' ')}`);
34
- console.log('\nMessages:');
35
- for (const m of rec.messages) {
36
- console.log(`- ${chalk_1.default.yellow(m.role)} ${chalk_1.default.gray(m.timestamp)}\n ${m.content.slice(0, 400)}${m.content.length > 400 ? '…' : ''}`);
37
- }
38
- if (rec.toolEvents?.length) {
39
- console.log('\nTool events:');
40
- for (const ev of rec.toolEvents) {
41
- console.log(` 🔧 ${ev.name} ${chalk_1.default.gray(ev.when)} ${ev.argsPreview ? ('args:' + ev.argsPreview) : ''} ${ev.resultPreview ? ('res:' + ev.resultPreview) : ''}`);
42
- }
43
- }
44
- });
45
- }
46
- //# sourceMappingURL=session.js.map
@@ -1,5 +0,0 @@
1
- export declare function setApiKey(provider: string, value: string): void;
2
- export declare function getApiKey(provider: string): string | undefined;
3
- export declare function clearApiKey(provider: string): void;
4
- export declare function listKeys(): Record<string, string | undefined>;
5
- //# sourceMappingURL=keys.d.ts.map
package/dist/llm/keys.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.setApiKey = setApiKey;
7
- exports.getApiKey = getApiKey;
8
- exports.clearApiKey = clearApiKey;
9
- exports.listKeys = listKeys;
10
- const conf_1 = __importDefault(require("conf"));
11
- // Avoid generic type for broader compatibility with shimmed types
12
- const store = new conf_1.default({ projectName: 'snow-flow' });
13
- function setApiKey(provider, value) {
14
- store.set(`keys.${provider}`, value);
15
- }
16
- function getApiKey(provider) {
17
- return store.get(`keys.${provider}`);
18
- }
19
- function clearApiKey(provider) {
20
- store.delete(`keys.${provider}`);
21
- }
22
- function listKeys() {
23
- const providers = ['openai', 'google', 'openrouter', 'openai-compatible', 'ollama'];
24
- const out = {};
25
- for (const p of providers)
26
- out[p] = getApiKey(p);
27
- return out;
28
- }
29
- //# sourceMappingURL=keys.js.map
@@ -1,11 +0,0 @@
1
- import type { SnowFlowConfig } from '../config/llm-config-loader';
2
- export type ProviderId = SnowFlowConfig['llm']['provider'];
3
- export interface ProviderOptions {
4
- provider: ProviderId;
5
- model: string;
6
- baseURL?: string;
7
- apiKeyEnv?: string;
8
- extraBody?: Record<string, unknown>;
9
- }
10
- export declare function getModel(opts: ProviderOptions): unknown;
11
- //# sourceMappingURL=providers.d.ts.map
@@ -1,77 +0,0 @@
1
- "use strict";
2
- // Compile-safe placeholder registry. Real providers will be wired via AI SDK in a follow-up step.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getModel = getModel;
5
- const keys_js_1 = require("./keys.js");
6
- function getModel(opts) {
7
- const { provider, model, baseURL, apiKeyEnv, extraBody } = opts;
8
- const requireOrThrow = (name) => {
9
- try {
10
- // eslint-disable-next-line @typescript-eslint/no-var-requires
11
- return require(name);
12
- }
13
- catch (err) {
14
- const hint = `Missing dependency ${name}. Run: npm i ai @ai-sdk/openai @ai-sdk/google @openrouter/ai-sdk-provider`;
15
- throw new Error(hint);
16
- }
17
- };
18
- switch (provider) {
19
- case 'anthropic': {
20
- // Prefer AI SDK anthropic provider if installed; otherwise instruct
21
- try {
22
- // Dynamic require to avoid hard dep
23
- const anthropic = require('@ai-sdk/anthropic');
24
- const key = process.env[apiKeyEnv || 'ANTHROPIC_API_KEY'] || (0, keys_js_1.getApiKey)('anthropic');
25
- if (!key)
26
- throw new Error('Missing ANTHROPIC_API_KEY');
27
- return anthropic.anthropic({ apiKey: key, baseURL }).languageModel(model);
28
- }
29
- catch (e) {
30
- throw new Error('Anthropic provider not available. Install @ai-sdk/anthropic or use OpenRouter with an Anthropic model.');
31
- }
32
- }
33
- case 'openai': {
34
- const { openai } = requireOrThrow('@ai-sdk/openai');
35
- const apiKey = process.env[apiKeyEnv || 'OPENAI_API_KEY'] || (0, keys_js_1.getApiKey)('openai');
36
- if (!apiKey)
37
- throw new Error('Missing OPENAI_API_KEY');
38
- return openai({ apiKey, baseURL }).languageModel(model);
39
- }
40
- case 'google': {
41
- const { google } = requireOrThrow('@ai-sdk/google');
42
- const apiKey = process.env[apiKeyEnv || 'GOOGLE_API_KEY']
43
- || process.env['GOOGLE_GENERATIVE_AI_API_KEY']
44
- || (0, keys_js_1.getApiKey)('google');
45
- if (!apiKey)
46
- throw new Error('Missing GOOGLE_API_KEY or GOOGLE_GENERATIVE_AI_API_KEY');
47
- return google({ apiKey, baseURL }).languageModel(model);
48
- }
49
- case 'openrouter': {
50
- const { createOpenRouter } = requireOrThrow('@openrouter/ai-sdk-provider');
51
- const apiKey = process.env[apiKeyEnv || 'OPENROUTER_API_KEY'] || (0, keys_js_1.getApiKey)('openrouter');
52
- if (!apiKey)
53
- throw new Error('Missing OPENROUTER_API_KEY');
54
- const or = createOpenRouter({ apiKey, baseURL, extraBody });
55
- return or(model);
56
- }
57
- case 'openai-compatible': {
58
- const { openai } = requireOrThrow('@ai-sdk/openai');
59
- const keyName = apiKeyEnv || 'OPENAI_COMPAT_API_KEY';
60
- const apiKey = process.env[keyName] || (0, keys_js_1.getApiKey)('openai-compatible');
61
- if (!baseURL)
62
- throw new Error('openai-compatible requires baseURL');
63
- if (!apiKey)
64
- throw new Error(`Missing ${keyName}`);
65
- return openai({ apiKey, baseURL }).languageModel(model);
66
- }
67
- case 'ollama': {
68
- const { openai } = requireOrThrow('@ai-sdk/openai');
69
- const keyName = apiKeyEnv || 'OLLAMA_API_KEY';
70
- const apiKey = process.env[keyName] || (0, keys_js_1.getApiKey)('ollama');
71
- if (!baseURL)
72
- throw new Error('ollama requires baseURL (e.g., http://localhost:11434/v1)');
73
- return openai({ apiKey, baseURL }).languageModel(model);
74
- }
75
- }
76
- }
77
- //# sourceMappingURL=providers.js.map
@@ -1,10 +0,0 @@
1
- export interface MCPStartup {
2
- cmd: string;
3
- args?: string[];
4
- env?: Record<string, string>;
5
- }
6
- export declare function loadMCPTools(start: MCPStartup): Promise<{
7
- tools: any[];
8
- close: () => Promise<void>;
9
- }>;
10
- //# sourceMappingURL=bridge.d.ts.map
@@ -1,31 +0,0 @@
1
- "use strict";
2
- // Minimal MCP bridge placeholder. We will hook this into AI SDK tools in a next step.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.loadMCPTools = loadMCPTools;
5
- async function loadMCPTools(start) {
6
- // Prefer using AI SDK's experimental MCP client to yield ready-to-use Tool[]
7
- try {
8
- // eslint-disable-next-line @typescript-eslint/no-var-requires
9
- const { experimental_createMCPClient } = require('ai');
10
- // Use SDK-provided stdio transport
11
- // eslint-disable-next-line @typescript-eslint/no-var-requires
12
- const { StdioClientTransport } = require('@modelcontextprotocol/sdk/client/stdio');
13
- const client = await experimental_createMCPClient({
14
- name: 'snow-flow',
15
- transport: new StdioClientTransport({
16
- command: start.cmd,
17
- args: start.args ?? [],
18
- env: start.env ?? {},
19
- }),
20
- });
21
- const tools = await client.tools();
22
- return { tools, close: client.close };
23
- }
24
- catch (err) {
25
- // Fallback: no AI SDK available, return empty tools and noop close but with a hint.
26
- const hint = 'AI SDK MCP bridge not available. Install "ai" or verify version to enable MCP tools.';
27
- console.warn(`[snow-flow] ${hint}`);
28
- return { tools: [], close: async () => { } };
29
- }
30
- }
31
- //# sourceMappingURL=bridge.js.map
@@ -1,37 +0,0 @@
1
- /**
2
- * MCP Types
3
- * Common types for MCP server implementations
4
- */
5
- export interface MCPServerConfig {
6
- name: string;
7
- description?: string;
8
- version?: string;
9
- }
10
- export interface MCPTool {
11
- name: string;
12
- description: string;
13
- inputSchema: any;
14
- }
15
- export interface MCPResponse<T = any> {
16
- success: boolean;
17
- data?: T;
18
- error?: string;
19
- message?: string;
20
- }
21
- export interface MCPRequest {
22
- tool: string;
23
- params: any;
24
- }
25
- export interface MCPLogger {
26
- info(message: string, meta?: any): void;
27
- warn(message: string, meta?: any): void;
28
- error(message: string, meta?: any): void;
29
- debug(message: string, meta?: any): void;
30
- }
31
- export interface MCPMemoryManager {
32
- store(key: string, value: any): Promise<void>;
33
- retrieve(key: string): Promise<any>;
34
- delete(key: string): Promise<boolean>;
35
- list(): Promise<string[]>;
36
- }
37
- //# sourceMappingURL=mcp-types.d.ts.map
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * MCP Types
4
- * Common types for MCP server implementations
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=mcp-types.js.map
@@ -1,32 +0,0 @@
1
- /**
2
- * Hierarchical Memory System
3
- * Extended memory system with hierarchical organization
4
- */
5
- import { MemorySystem } from './memory-system';
6
- export interface HierarchicalMemorySystem extends MemorySystem {
7
- dbPath?: string;
8
- namespace?: string;
9
- storeInNamespace(namespace: string, key: string, value: any): Promise<void>;
10
- retrieveFromNamespace(namespace: string, key: string): Promise<any>;
11
- listNamespaces(): Promise<string[]>;
12
- clearNamespace(namespace: string): Promise<void>;
13
- }
14
- export declare class DefaultHierarchicalMemorySystem implements HierarchicalMemorySystem {
15
- private memory;
16
- dbPath?: string;
17
- namespace?: string;
18
- constructor(dbPath?: string, namespace?: string);
19
- private getNamespaceMap;
20
- store(key: string, value: any): Promise<void>;
21
- retrieve(key: string): Promise<any>;
22
- get(key: string): Promise<any>;
23
- delete(key: string): Promise<boolean>;
24
- clear(): Promise<void>;
25
- list(): Promise<string[]>;
26
- exists(key: string): Promise<boolean>;
27
- storeInNamespace(namespace: string, key: string, value: any): Promise<void>;
28
- retrieveFromNamespace(namespace: string, key: string): Promise<any>;
29
- listNamespaces(): Promise<string[]>;
30
- clearNamespace(namespace: string): Promise<void>;
31
- }
32
- //# sourceMappingURL=hierarchical-memory-system.d.ts.map
@@ -1,60 +0,0 @@
1
- "use strict";
2
- /**
3
- * Hierarchical Memory System
4
- * Extended memory system with hierarchical organization
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.DefaultHierarchicalMemorySystem = void 0;
8
- class DefaultHierarchicalMemorySystem {
9
- constructor(dbPath, namespace) {
10
- this.memory = new Map();
11
- this.dbPath = dbPath;
12
- this.namespace = namespace || 'default';
13
- }
14
- getNamespaceMap(namespace) {
15
- if (!this.memory.has(namespace)) {
16
- this.memory.set(namespace, new Map());
17
- }
18
- return this.memory.get(namespace);
19
- }
20
- async store(key, value) {
21
- await this.storeInNamespace(this.namespace || 'default', key, value);
22
- }
23
- async retrieve(key) {
24
- return this.retrieveFromNamespace(this.namespace || 'default', key);
25
- }
26
- async get(key) {
27
- return this.retrieve(key);
28
- }
29
- async delete(key) {
30
- const nsMap = this.getNamespaceMap(this.namespace || 'default');
31
- return nsMap.delete(key);
32
- }
33
- async clear() {
34
- await this.clearNamespace(this.namespace || 'default');
35
- }
36
- async list() {
37
- const nsMap = this.getNamespaceMap(this.namespace || 'default');
38
- return Array.from(nsMap.keys());
39
- }
40
- async exists(key) {
41
- const nsMap = this.getNamespaceMap(this.namespace || 'default');
42
- return nsMap.has(key);
43
- }
44
- async storeInNamespace(namespace, key, value) {
45
- const nsMap = this.getNamespaceMap(namespace);
46
- nsMap.set(key, value);
47
- }
48
- async retrieveFromNamespace(namespace, key) {
49
- const nsMap = this.getNamespaceMap(namespace);
50
- return nsMap.get(key);
51
- }
52
- async listNamespaces() {
53
- return Array.from(this.memory.keys());
54
- }
55
- async clearNamespace(namespace) {
56
- this.memory.delete(namespace);
57
- }
58
- }
59
- exports.DefaultHierarchicalMemorySystem = DefaultHierarchicalMemorySystem;
60
- //# sourceMappingURL=hierarchical-memory-system.js.map
@@ -1,25 +0,0 @@
1
- /**
2
- * Basic Memory System Interface
3
- * Minimal implementation to satisfy missing imports
4
- */
5
- export interface MemorySystem {
6
- store(key: string, value: any): Promise<void>;
7
- retrieve(key: string): Promise<any>;
8
- get(key: string): Promise<any>;
9
- delete(key: string): Promise<boolean>;
10
- clear(): Promise<void>;
11
- list(): Promise<string[]>;
12
- exists(key: string): Promise<boolean>;
13
- }
14
- export declare class BasicMemorySystem implements MemorySystem {
15
- private memory;
16
- store(key: string, value: any): Promise<void>;
17
- retrieve(key: string): Promise<any>;
18
- get(key: string): Promise<any>;
19
- delete(key: string): Promise<boolean>;
20
- clear(): Promise<void>;
21
- list(): Promise<string[]>;
22
- exists(key: string): Promise<boolean>;
23
- }
24
- export declare const defaultMemorySystem: BasicMemorySystem;
25
- //# sourceMappingURL=memory-system.d.ts.map
@@ -1,36 +0,0 @@
1
- "use strict";
2
- /**
3
- * Basic Memory System Interface
4
- * Minimal implementation to satisfy missing imports
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.defaultMemorySystem = exports.BasicMemorySystem = void 0;
8
- class BasicMemorySystem {
9
- constructor() {
10
- this.memory = new Map();
11
- }
12
- async store(key, value) {
13
- this.memory.set(key, value);
14
- }
15
- async retrieve(key) {
16
- return this.memory.get(key);
17
- }
18
- async get(key) {
19
- return this.memory.get(key);
20
- }
21
- async delete(key) {
22
- return this.memory.delete(key);
23
- }
24
- async clear() {
25
- this.memory.clear();
26
- }
27
- async list() {
28
- return Array.from(this.memory.keys());
29
- }
30
- async exists(key) {
31
- return this.memory.has(key);
32
- }
33
- }
34
- exports.BasicMemorySystem = BasicMemorySystem;
35
- exports.defaultMemorySystem = new BasicMemorySystem();
36
- //# sourceMappingURL=memory-system.js.map
@@ -1,47 +0,0 @@
1
- export interface SessionMessage {
2
- role: 'system' | 'user' | 'assistant' | 'tool';
3
- content: string;
4
- timestamp: string;
5
- meta?: Record<string, unknown>;
6
- }
7
- export interface SessionRecord {
8
- id: string;
9
- startedAt: string;
10
- endedAt?: string;
11
- objective: string;
12
- provider: {
13
- id: string;
14
- model: string;
15
- baseURL?: string;
16
- };
17
- mcp: {
18
- cmd: string;
19
- args?: string[];
20
- };
21
- messages: SessionMessage[];
22
- toolEvents?: {
23
- name: string;
24
- when: string;
25
- argsPreview?: string;
26
- resultPreview?: string;
27
- }[];
28
- summary?: string;
29
- }
30
- export declare function createSessionId(): string;
31
- export declare function startSession(rec: Omit<SessionRecord, 'messages' | 'toolEvents'> & {
32
- messages?: SessionMessage[];
33
- }): SessionRecord;
34
- export declare function readSession(id: string): SessionRecord | undefined;
35
- export declare function listSessions(): {
36
- id: string;
37
- startedAt: string;
38
- objective: string;
39
- }[];
40
- export declare function appendMessage(id: string, msg: SessionMessage): void;
41
- export declare function appendToolEvent(id: string, ev: {
42
- name: string;
43
- argsPreview?: string;
44
- resultPreview?: string;
45
- }): void;
46
- export declare function endSession(id: string, summary?: string): void;
47
- //# sourceMappingURL=store.d.ts.map