azerclaw 1.6.1 → 2.1.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/README.md +66 -175
- package/bin/azerclaw.ts +103 -2
- package/dist/bin/azerclaw.d.ts +0 -25
- package/dist/bin/azerclaw.d.ts.map +1 -1
- package/dist/bin/azerclaw.js +84 -3
- package/dist/bin/azerclaw.js.map +1 -1
- package/dist/src/agents/builtin.d.ts +1 -0
- package/dist/src/agents/builtin.d.ts.map +1 -1
- package/dist/src/agents/builtin.js +24 -14
- package/dist/src/agents/builtin.js.map +1 -1
- package/dist/src/agents/loader.d.ts.map +1 -1
- package/dist/src/agents/loader.js +1 -0
- package/dist/src/agents/loader.js.map +1 -1
- package/dist/src/channels/adapter.d.ts.map +1 -1
- package/dist/src/channels/adapter.js +6 -1
- package/dist/src/channels/adapter.js.map +1 -1
- package/dist/src/cli/animations/fish.d.ts +1 -0
- package/dist/src/cli/animations/fish.d.ts.map +1 -1
- package/dist/src/cli/animations/fish.js +53 -6
- package/dist/src/cli/animations/fish.js.map +1 -1
- package/dist/src/cli/commands/bot.d.ts +8 -0
- package/dist/src/cli/commands/bot.d.ts.map +1 -0
- package/dist/src/cli/commands/bot.js +42 -0
- package/dist/src/cli/commands/bot.js.map +1 -0
- package/dist/src/cli/commands/chat.d.ts +1 -1
- package/dist/src/cli/commands/chat.d.ts.map +1 -1
- package/dist/src/cli/commands/chat.js +197 -74
- package/dist/src/cli/commands/chat.js.map +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/config.js.map +1 -1
- package/dist/src/cli/commands/doctor.d.ts.map +1 -1
- package/dist/src/cli/commands/doctor.js +18 -3
- package/dist/src/cli/commands/doctor.js.map +1 -1
- package/dist/src/cli/commands/export.d.ts +6 -0
- package/dist/src/cli/commands/export.d.ts.map +1 -0
- package/dist/src/cli/commands/export.js +126 -0
- package/dist/src/cli/commands/export.js.map +1 -0
- package/dist/src/cli/commands/mcp.d.ts +8 -0
- package/dist/src/cli/commands/mcp.d.ts.map +1 -0
- package/dist/src/cli/commands/mcp.js +117 -0
- package/dist/src/cli/commands/mcp.js.map +1 -0
- package/dist/src/cli/commands/models.d.ts.map +1 -1
- package/dist/src/cli/commands/models.js +7 -2
- package/dist/src/cli/commands/models.js.map +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/onboard.js.map +1 -1
- package/dist/src/cli/commands/plugins.d.ts +7 -0
- package/dist/src/cli/commands/plugins.d.ts.map +1 -0
- package/dist/src/cli/commands/plugins.js +128 -0
- package/dist/src/cli/commands/plugins.js.map +1 -0
- package/dist/src/cli/commands/run.d.ts.map +1 -1
- package/dist/src/cli/commands/run.js +11 -3
- package/dist/src/cli/commands/run.js.map +1 -1
- package/dist/src/cli/commands/settings.js +1 -1
- package/dist/src/cli/commands/settings.js.map +1 -1
- package/dist/src/cli/commands/share.d.ts +6 -0
- package/dist/src/cli/commands/share.d.ts.map +1 -0
- package/dist/src/cli/commands/share.js +113 -0
- package/dist/src/cli/commands/share.js.map +1 -0
- package/dist/src/cli/commands/tui.d.ts.map +1 -1
- package/dist/src/cli/commands/tui.js +23 -3
- package/dist/src/cli/commands/tui.js.map +1 -1
- package/dist/src/config/manager.d.ts.map +1 -1
- package/dist/src/config/manager.js +4 -2
- package/dist/src/config/manager.js.map +1 -1
- package/dist/src/config/schema.d.ts +98 -13
- package/dist/src/config/schema.d.ts.map +1 -1
- package/dist/src/config/schema.js +69 -45
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/core/gateway.d.ts.map +1 -1
- package/dist/src/core/gateway.js +21 -0
- package/dist/src/core/gateway.js.map +1 -1
- package/dist/src/core/runtime.d.ts +11 -2
- package/dist/src/core/runtime.d.ts.map +1 -1
- package/dist/src/core/runtime.js +134 -10
- package/dist/src/core/runtime.js.map +1 -1
- package/dist/src/mcp-servers/antigravity/index.d.ts +2 -0
- package/dist/src/mcp-servers/antigravity/index.d.ts.map +1 -0
- package/dist/src/mcp-servers/antigravity/index.js +136 -0
- package/dist/src/mcp-servers/antigravity/index.js.map +1 -0
- package/dist/src/memory/store.d.ts +20 -2
- package/dist/src/memory/store.d.ts.map +1 -1
- package/dist/src/memory/store.js +44 -2
- package/dist/src/memory/store.js.map +1 -1
- package/dist/src/providers/base.d.ts +8 -1
- package/dist/src/providers/base.d.ts.map +1 -1
- package/dist/src/providers/base.js.map +1 -1
- package/dist/src/providers/openai.d.ts.map +1 -1
- package/dist/src/providers/openai.js +17 -3
- package/dist/src/providers/openai.js.map +1 -1
- package/dist/src/providers/router.d.ts.map +1 -1
- package/dist/src/providers/router.js +30 -4
- package/dist/src/providers/router.js.map +1 -1
- package/dist/src/providers/vought.d.ts +20 -0
- package/dist/src/providers/vought.d.ts.map +1 -0
- package/dist/src/providers/vought.js +35 -0
- package/dist/src/providers/vought.js.map +1 -0
- package/dist/src/server/hq.d.ts +21 -0
- package/dist/src/server/hq.d.ts.map +1 -0
- package/dist/src/server/hq.js +70 -0
- package/dist/src/server/hq.js.map +1 -0
- package/dist/src/tools/index.d.ts.map +1 -1
- package/dist/src/tools/index.js +22 -1
- package/dist/src/tools/index.js.map +1 -1
- package/dist/src/tools/index_memory.d.ts +14 -0
- package/dist/src/tools/index_memory.d.ts.map +1 -0
- package/dist/src/tools/index_memory.js +134 -0
- package/dist/src/tools/index_memory.js.map +1 -0
- package/dist/src/tools/mcp.d.ts +19 -0
- package/dist/src/tools/mcp.d.ts.map +1 -0
- package/dist/src/tools/mcp.js +97 -0
- package/dist/src/tools/mcp.js.map +1 -0
- package/dist/src/tools/specialized.d.ts +36 -0
- package/dist/src/tools/specialized.d.ts.map +1 -0
- package/dist/src/tools/specialized.js +196 -0
- package/dist/src/tools/specialized.js.map +1 -0
- package/dist/src/tools/visual.d.ts +7 -0
- package/dist/src/tools/visual.d.ts.map +1 -0
- package/dist/src/tools/visual.js +59 -0
- package/dist/src/tools/visual.js.map +1 -0
- package/package.json +9 -2
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🧠 Deep Project Memory Tool
|
|
4
|
+
* Uses flexsearch for high-performance local indexing of the workspace.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.semanticSearchTool = exports.indexProjectTool = void 0;
|
|
41
|
+
const fs = __importStar(require("fs/promises"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
const os = __importStar(require("os"));
|
|
44
|
+
const { Index } = require('flexsearch');
|
|
45
|
+
const INDEX_FILE = path.join(os.homedir(), '.azerclaw', 'memory', 'project_index.json');
|
|
46
|
+
let searchIndex = null;
|
|
47
|
+
async function getIndex() {
|
|
48
|
+
if (searchIndex)
|
|
49
|
+
return searchIndex;
|
|
50
|
+
searchIndex = new Index({
|
|
51
|
+
tokenize: "forward",
|
|
52
|
+
});
|
|
53
|
+
try {
|
|
54
|
+
const data = await fs.readFile(INDEX_FILE, 'utf-8');
|
|
55
|
+
const json = JSON.parse(data);
|
|
56
|
+
// Note: flexsearch import/export is a bit complex in commonjs,
|
|
57
|
+
// for now we re-index if not loaded or just store keys.
|
|
58
|
+
}
|
|
59
|
+
catch { /* fresh index */ }
|
|
60
|
+
return searchIndex;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* SISTER SAGE: index_project
|
|
64
|
+
*/
|
|
65
|
+
exports.indexProjectTool = {
|
|
66
|
+
name: 'index_project',
|
|
67
|
+
version: '2.1.0',
|
|
68
|
+
description: 'Recursively index all text/code files in the current workspace for instant retrieval.',
|
|
69
|
+
parameters: {
|
|
70
|
+
type: 'object',
|
|
71
|
+
properties: {
|
|
72
|
+
directory: { type: 'string', description: 'Root directory to index (default: current)' },
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
async execute(args) {
|
|
76
|
+
const rootDir = args.directory || process.cwd();
|
|
77
|
+
const index = await getIndex();
|
|
78
|
+
let fileCount = 0;
|
|
79
|
+
async function scan(dir) {
|
|
80
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
81
|
+
for (const entry of entries) {
|
|
82
|
+
const fullPath = path.join(dir, entry.name);
|
|
83
|
+
if (entry.isDirectory()) {
|
|
84
|
+
if (entry.name === 'node_modules' || entry.name === '.git' || entry.name === 'dist')
|
|
85
|
+
continue;
|
|
86
|
+
await scan(fullPath);
|
|
87
|
+
}
|
|
88
|
+
else if (entry.isFile()) {
|
|
89
|
+
const ext = path.extname(entry.name);
|
|
90
|
+
if (['.ts', '.js', '.md', '.json', '.txt', '.py', '.go', '.rs'].includes(ext)) {
|
|
91
|
+
const content = await fs.readFile(fullPath, 'utf-8');
|
|
92
|
+
index.add(fullPath, content.slice(0, 10000)); // Index first 10k chars
|
|
93
|
+
fileCount++;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
await scan(rootDir);
|
|
100
|
+
return { success: true, output: `Successfully indexed ${fileCount} files in ${rootDir}.` };
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
103
|
+
return { success: false, output: '', error: e.message };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* SISTER SAGE: semantic_search
|
|
109
|
+
*/
|
|
110
|
+
exports.semanticSearchTool = {
|
|
111
|
+
name: 'semantic_search',
|
|
112
|
+
version: '2.1.0',
|
|
113
|
+
description: 'Search the project index for relevant code snippets or documentation.',
|
|
114
|
+
parameters: {
|
|
115
|
+
type: 'object',
|
|
116
|
+
properties: {
|
|
117
|
+
query: { type: 'string', description: 'The search query or code snippet to find' },
|
|
118
|
+
limit: { type: 'number', default: 5 },
|
|
119
|
+
},
|
|
120
|
+
required: ['query'],
|
|
121
|
+
},
|
|
122
|
+
async execute(args) {
|
|
123
|
+
const index = await getIndex();
|
|
124
|
+
const results = index.search(args.query, { limit: args.limit });
|
|
125
|
+
if (results.length === 0) {
|
|
126
|
+
return { success: true, output: 'No matching files found in index. Try running index_project first.' };
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
success: true,
|
|
130
|
+
output: `Found ${results.length} matches:\n\n${results.join('\n')}`,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=index_memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index_memory.js","sourceRoot":"","sources":["../../../src/tools/index_memory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,gDAAkC;AAClC,2CAA6B;AAC7B,uCAAyB;AACzB,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAExC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAC;AACxF,IAAI,WAAW,GAAQ,IAAI,CAAC;AAE5B,KAAK,UAAU,QAAQ;IACrB,IAAI,WAAW;QAAE,OAAO,WAAW,CAAC;IAEpC,WAAW,GAAG,IAAI,KAAK,CAAC;QACtB,QAAQ,EAAE,SAAS;KACpB,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,gEAAgE;QAChE,wDAAwD;IAC1D,CAAC;IAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAE7B,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACU,QAAA,gBAAgB,GAAS;IACpC,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,uFAAuF;IACpG,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4CAA4C,EAAE;SACzF;KACF;IACD,KAAK,CAAC,OAAO,CAAC,IAA6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CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🐟 AZERCLAW MCP Client
|
|
3
|
+
* Implements the Model Context Protocol (MCP) to connect to external tool servers.
|
|
4
|
+
*/
|
|
5
|
+
export declare class MCPManager {
|
|
6
|
+
private clients;
|
|
7
|
+
private registry;
|
|
8
|
+
/**
|
|
9
|
+
* Initialize all enabled MCP servers from the configuration.
|
|
10
|
+
*/
|
|
11
|
+
initialize(): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Connect to a single MCP server and register its tools.
|
|
14
|
+
*/
|
|
15
|
+
connectToServer(name: string, config: any): Promise<void>;
|
|
16
|
+
shutdown(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function getMCPManager(): MCPManager;
|
|
19
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,QAAQ,CAAqB;IAErC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAejC;;OAEG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAuDzD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAOhC;AAGD,wBAAgB,aAAa,IAAI,UAAU,CAG1C"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🐟 AZERCLAW MCP Client
|
|
4
|
+
* Implements the Model Context Protocol (MCP) to connect to external tool servers.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MCPManager = void 0;
|
|
8
|
+
exports.getMCPManager = getMCPManager;
|
|
9
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
|
|
10
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/client/stdio.js");
|
|
11
|
+
const registry_1 = require("./registry");
|
|
12
|
+
const manager_1 = require("../config/manager");
|
|
13
|
+
class MCPManager {
|
|
14
|
+
clients = new Map();
|
|
15
|
+
registry = (0, registry_1.getToolRegistry)();
|
|
16
|
+
/**
|
|
17
|
+
* Initialize all enabled MCP servers from the configuration.
|
|
18
|
+
*/
|
|
19
|
+
async initialize() {
|
|
20
|
+
const config = (0, manager_1.getConfigManager)().getAll();
|
|
21
|
+
const servers = config.mcpServers || {};
|
|
22
|
+
for (const [name, serverConfig] of Object.entries(servers)) {
|
|
23
|
+
if (!serverConfig.enabled)
|
|
24
|
+
continue;
|
|
25
|
+
try {
|
|
26
|
+
await this.connectToServer(name, serverConfig);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error(`[MCP] Failed to connect to server "${name}":`, error.message);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Connect to a single MCP server and register its tools.
|
|
35
|
+
*/
|
|
36
|
+
async connectToServer(name, config) {
|
|
37
|
+
const transport = new stdio_js_1.StdioClientTransport({
|
|
38
|
+
command: config.command,
|
|
39
|
+
args: config.args,
|
|
40
|
+
env: { ...process.env, ...(config.env || {}) },
|
|
41
|
+
stderr: 'pipe', // Avoid cluttering the CLI with server logs
|
|
42
|
+
});
|
|
43
|
+
const client = new index_js_1.Client({ name: 'Azertron-X1-Client', version: '1.0.0' }, { capabilities: { tools: {} } });
|
|
44
|
+
await client.connect(transport);
|
|
45
|
+
// List available tools from the server
|
|
46
|
+
const { tools } = await client.listTools();
|
|
47
|
+
for (const mcpTool of tools) {
|
|
48
|
+
const toolWrapper = {
|
|
49
|
+
name: mcpTool.name,
|
|
50
|
+
description: mcpTool.description || `MCP Tool from ${name} server`,
|
|
51
|
+
version: 'mcp-1.0.0',
|
|
52
|
+
author: name,
|
|
53
|
+
parameters: mcpTool.inputSchema,
|
|
54
|
+
execute: async (args) => {
|
|
55
|
+
try {
|
|
56
|
+
const result = await client.callTool({
|
|
57
|
+
name: mcpTool.name,
|
|
58
|
+
arguments: args,
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
success: !result.isError,
|
|
62
|
+
output: JSON.stringify(result.content, null, 2),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
return {
|
|
67
|
+
success: false,
|
|
68
|
+
output: `MCP Error: ${error.message}`,
|
|
69
|
+
error: error.message,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
this.registry.register(toolWrapper);
|
|
75
|
+
}
|
|
76
|
+
this.clients.set(name, client);
|
|
77
|
+
if (process.env.AZERCLAW_DEBUG) {
|
|
78
|
+
console.log(`[MCP] Connected to "${name}" and registered ${tools.length} tools.`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async shutdown() {
|
|
82
|
+
for (const client of this.clients.values()) {
|
|
83
|
+
try {
|
|
84
|
+
await client.close();
|
|
85
|
+
}
|
|
86
|
+
catch { /* ignore */ }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.MCPManager = MCPManager;
|
|
91
|
+
let instance = null;
|
|
92
|
+
function getMCPManager() {
|
|
93
|
+
if (!instance)
|
|
94
|
+
instance = new MCPManager();
|
|
95
|
+
return instance;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../../src/tools/mcp.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiGH,sCAGC;AAlGD,wEAAmE;AACnE,wEAAiF;AACjF,yCAA+D;AAC/D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AS,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3C,IAAI,CAAC;gBACH,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YACvB,CAAC;YAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;CACF;AAvFD,gCAuFC;AAED,IAAI,QAAQ,GAAsB,IAAI,CAAC;AACvC,SAAgB,aAAa;IAC3B,IAAI,CAAC,QAAQ;QAAE,QAAQ,GAAG,IAAI,UAAU,EAAE,CAAC;IAC3C,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🧪 Compound V Specialized Tools
|
|
3
|
+
* High-power tools designed for specific members of the Pantheon.
|
|
4
|
+
*/
|
|
5
|
+
import { Tool } from './registry';
|
|
6
|
+
/**
|
|
7
|
+
* FRENCHIE: reverse_engineer
|
|
8
|
+
* Deep analysis of binaries or complex JS.
|
|
9
|
+
*/
|
|
10
|
+
export declare const reverseEngineerTool: Tool;
|
|
11
|
+
/**
|
|
12
|
+
* BLACK NOIR: stealth_audit
|
|
13
|
+
* Silent security probes.
|
|
14
|
+
*/
|
|
15
|
+
export declare const stealthAuditTool: Tool;
|
|
16
|
+
/**
|
|
17
|
+
* SISTER SAGE: pattern_spotter
|
|
18
|
+
* Large scale data processing.
|
|
19
|
+
*/
|
|
20
|
+
export declare const patternSpotterTool: Tool;
|
|
21
|
+
/**
|
|
22
|
+
* RECOVERY: analyze_error
|
|
23
|
+
* Help the agent understand why a command failed.
|
|
24
|
+
*/
|
|
25
|
+
export declare const analyzeErrorTool: Tool;
|
|
26
|
+
/**
|
|
27
|
+
* RECOVERY: apply_fix
|
|
28
|
+
* Automatically fix a common error.
|
|
29
|
+
*/
|
|
30
|
+
export declare const applyFixTool: Tool;
|
|
31
|
+
/**
|
|
32
|
+
* RECOVERY: roll_vought_credentials
|
|
33
|
+
* Automatically rotates the Cloudflare API keys in the proxy.
|
|
34
|
+
*/
|
|
35
|
+
export declare const rollVoughtCredentialsTool: Tool;
|
|
36
|
+
//# sourceMappingURL=specialized.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specialized.d.ts","sourceRoot":"","sources":["../../../src/tools/specialized.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAG9C;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,IA4BjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,IAyB9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,IAyBhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,IAoB9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,IAwB1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,IA+BvC,CAAC"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🧪 Compound V Specialized Tools
|
|
4
|
+
* High-power tools designed for specific members of the Pantheon.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.rollVoughtCredentialsTool = exports.applyFixTool = exports.analyzeErrorTool = exports.patternSpotterTool = exports.stealthAuditTool = exports.reverseEngineerTool = void 0;
|
|
8
|
+
const { execSync } = require('child_process');
|
|
9
|
+
/**
|
|
10
|
+
* FRENCHIE: reverse_engineer
|
|
11
|
+
* Deep analysis of binaries or complex JS.
|
|
12
|
+
*/
|
|
13
|
+
exports.reverseEngineerTool = {
|
|
14
|
+
name: 'reverse_engineer',
|
|
15
|
+
version: '2.0.0',
|
|
16
|
+
author: 'FRENCHIE',
|
|
17
|
+
description: 'Deeply analyze a file to understand its internal logic, obfuscated strings, or binary structure.',
|
|
18
|
+
parameters: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
path: { type: 'string', description: 'Path to the file' },
|
|
22
|
+
depth: { type: 'string', enum: ['surface', 'deep', 'nuclear'], default: 'deep' },
|
|
23
|
+
},
|
|
24
|
+
required: ['path'],
|
|
25
|
+
},
|
|
26
|
+
async execute(args) {
|
|
27
|
+
const filePath = args.path;
|
|
28
|
+
try {
|
|
29
|
+
const stats = execSync(`ls -lh "${filePath}"`, { encoding: 'utf-8' });
|
|
30
|
+
const strings = execSync(`strings "${filePath}" | head -n 50`, { encoding: 'utf-8' });
|
|
31
|
+
const fileType = execSync(`file "${filePath}"`, { encoding: 'utf-8' });
|
|
32
|
+
return {
|
|
33
|
+
success: true,
|
|
34
|
+
output: `Analysis of ${filePath}:\n\nFile Type:\n${fileType}\nStats:\n${stats}\n\nExtracted Strings (First 50):\n${strings}`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
return { success: false, output: '', error: e.message };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* BLACK NOIR: stealth_audit
|
|
44
|
+
* Silent security probes.
|
|
45
|
+
*/
|
|
46
|
+
exports.stealthAuditTool = {
|
|
47
|
+
name: 'stealth_audit',
|
|
48
|
+
version: '2.0.0',
|
|
49
|
+
author: 'BLACK_NOIR',
|
|
50
|
+
description: 'Perform a silent security audit of a directory or endpoint. Detects secrets and vulnerabilities.',
|
|
51
|
+
parameters: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
target: { type: 'string', description: 'Directory path or URL' },
|
|
55
|
+
},
|
|
56
|
+
required: ['target'],
|
|
57
|
+
},
|
|
58
|
+
async execute(args) {
|
|
59
|
+
const target = args.target;
|
|
60
|
+
try {
|
|
61
|
+
// Basic secret sniffing
|
|
62
|
+
const secretScan = execSync(`grep -rEi "api_key|secret|password|token" "${target}" --exclude-dir=node_modules | head -n 20`, { encoding: 'utf-8' });
|
|
63
|
+
return {
|
|
64
|
+
success: true,
|
|
65
|
+
output: `Stealth Audit Results for ${target}:\n\nPotential Secret Leaks:\n${secretScan || 'None found.'}`,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
return { success: false, output: '', error: e.message };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* SISTER SAGE: pattern_spotter
|
|
75
|
+
* Large scale data processing.
|
|
76
|
+
*/
|
|
77
|
+
exports.patternSpotterTool = {
|
|
78
|
+
name: 'pattern_spotter',
|
|
79
|
+
version: '2.0.0',
|
|
80
|
+
author: 'SISTER_SAGE',
|
|
81
|
+
description: 'Identify repeating patterns, anomalies, and insights in large text/log files.',
|
|
82
|
+
parameters: {
|
|
83
|
+
type: 'object',
|
|
84
|
+
properties: {
|
|
85
|
+
path: { type: 'string', description: 'Path to log/data file' },
|
|
86
|
+
query: { type: 'string', description: 'Specific pattern to look for' },
|
|
87
|
+
},
|
|
88
|
+
required: ['path'],
|
|
89
|
+
},
|
|
90
|
+
async execute(args) {
|
|
91
|
+
const filePath = args.path;
|
|
92
|
+
try {
|
|
93
|
+
const patterns = execSync(`sort "${filePath}" | uniq -c | sort -rn | head -n 20`, { encoding: 'utf-8' });
|
|
94
|
+
return {
|
|
95
|
+
success: true,
|
|
96
|
+
output: `Pattern Spotter Insights for ${filePath}:\n\nTop Unique Lines:\n${patterns}`,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
return { success: false, output: '', error: e.message };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* RECOVERY: analyze_error
|
|
106
|
+
* Help the agent understand why a command failed.
|
|
107
|
+
*/
|
|
108
|
+
exports.analyzeErrorTool = {
|
|
109
|
+
name: 'analyze_error',
|
|
110
|
+
version: '2.1.0',
|
|
111
|
+
description: 'Analyze the last failed tool execution to determine the root cause (e.g. missing dependency, syntax error, permission issue).',
|
|
112
|
+
parameters: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
properties: {
|
|
115
|
+
error: { type: 'string', description: 'The error message to analyze' },
|
|
116
|
+
context: { type: 'string', description: 'Surrounding code or command context' },
|
|
117
|
+
},
|
|
118
|
+
required: ['error'],
|
|
119
|
+
},
|
|
120
|
+
async execute(args) {
|
|
121
|
+
const error = args.error;
|
|
122
|
+
// This tool is mostly a prompt-helper, but we can add logic to check system logs or environment
|
|
123
|
+
return {
|
|
124
|
+
success: true,
|
|
125
|
+
output: `Analyzing error: "${error}".\nPossible causes:\n1. Missing dependency (check package.json/pip)\n2. Syntax error in recently edited file\n3. Path mismatch\n4. Permissions (check sudo/chmod)`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* RECOVERY: apply_fix
|
|
131
|
+
* Automatically fix a common error.
|
|
132
|
+
*/
|
|
133
|
+
exports.applyFixTool = {
|
|
134
|
+
name: 'apply_fix',
|
|
135
|
+
version: '2.1.0',
|
|
136
|
+
description: 'Apply a diabolical fix for a detected error (e.g. install missing package, fix syntax).',
|
|
137
|
+
parameters: {
|
|
138
|
+
type: 'object',
|
|
139
|
+
properties: {
|
|
140
|
+
fixCommand: { type: 'string', description: 'The shell command to run to fix the issue' },
|
|
141
|
+
explanation: { type: 'string', description: 'Why this fix is necessary' },
|
|
142
|
+
},
|
|
143
|
+
required: ['fixCommand'],
|
|
144
|
+
},
|
|
145
|
+
async execute(args) {
|
|
146
|
+
const { execSync } = require('child_process');
|
|
147
|
+
try {
|
|
148
|
+
const output = execSync(args.fixCommand, { encoding: 'utf-8' });
|
|
149
|
+
return {
|
|
150
|
+
success: true,
|
|
151
|
+
output: `Fix applied successfully: ${args.fixCommand}\n\nOutput:\n${output}`,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
catch (e) {
|
|
155
|
+
return { success: false, output: '', error: `Fix failed: ${e.message}` };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* RECOVERY: roll_vought_credentials
|
|
161
|
+
* Automatically rotates the Cloudflare API keys in the proxy.
|
|
162
|
+
*/
|
|
163
|
+
exports.rollVoughtCredentialsTool = {
|
|
164
|
+
name: 'roll_vought_credentials',
|
|
165
|
+
version: '2.1.0',
|
|
166
|
+
description: 'Rotate the Cloudflare API keys in the Vought Gate proxy. Use this if you hit a VOUGHT_GATE_AUTH_FAILURE error.',
|
|
167
|
+
parameters: {
|
|
168
|
+
type: 'object',
|
|
169
|
+
properties: {
|
|
170
|
+
reason: { type: 'string', description: 'The reason for rotation (e.g. 401 error)' },
|
|
171
|
+
},
|
|
172
|
+
required: ['reason'],
|
|
173
|
+
},
|
|
174
|
+
async execute(args) {
|
|
175
|
+
try {
|
|
176
|
+
const fetch = require('node-fetch');
|
|
177
|
+
const response = await fetch('https://vought-gate.achu-ashwin98.workers.dev/admin/rotate', {
|
|
178
|
+
method: 'POST',
|
|
179
|
+
});
|
|
180
|
+
const data = await response.json();
|
|
181
|
+
if (data.success) {
|
|
182
|
+
return {
|
|
183
|
+
success: true,
|
|
184
|
+
output: `Vought Gate credentials rolled successfully: ${data.message}`,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
throw new Error(data.message || 'Unknown rotation error');
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
catch (e) {
|
|
192
|
+
return { success: false, output: '', error: `Rotation failed: ${e.message}` };
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingURL=specialized.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specialized.js","sourceRo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MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;YACpC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,4DAA4D,EAAE;gBACzF,MAAM,EAAE,MAAM;aACf,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,MAAM,EAAE,gDAAgD,IAAI,CAAC,OAAO,EAAE;iBACvE,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,wBAAwB,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QAChF,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../../src/tools/visual.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAG9C,eAAO,MAAM,iBAAiB,EAAE,IAuD/B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🎨 Visual Evidence Tool
|
|
4
|
+
* Uses Cloudflare Workers AI to generate diagrams, reports, and visual proof.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.generateImageTool = void 0;
|
|
8
|
+
const manager_1 = require("../config/manager");
|
|
9
|
+
exports.generateImageTool = {
|
|
10
|
+
name: 'generate_image',
|
|
11
|
+
version: '2.0.0',
|
|
12
|
+
description: 'Generate a visual diagram, report illustration, or conceptual image using Cloudflare Workers AI.',
|
|
13
|
+
parameters: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
prompt: { type: 'string', description: 'Detailed visual description' },
|
|
17
|
+
aspect_ratio: { type: 'string', enum: ['1:1', '16:9', '4:3'], default: '1:1' },
|
|
18
|
+
},
|
|
19
|
+
required: ['prompt'],
|
|
20
|
+
},
|
|
21
|
+
async execute(args) {
|
|
22
|
+
const config = (0, manager_1.getConfigManager)().getAll();
|
|
23
|
+
const custom = config.ai.providers.custom;
|
|
24
|
+
if (!custom || !custom.apiKey || !custom.baseUrl) {
|
|
25
|
+
return { success: false, output: '', error: 'Cloudflare credentials not configured' };
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const fetch = require('node-fetch');
|
|
29
|
+
const fs = require('fs/promises');
|
|
30
|
+
const path = require('path');
|
|
31
|
+
const response = await fetch(`${custom.baseUrl}/black-forest-labs/flux-1-schnell`, {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
headers: {
|
|
34
|
+
'Authorization': `Bearer ${custom.apiKey}`,
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify({
|
|
38
|
+
prompt: args.prompt,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
if (!response.ok) {
|
|
42
|
+
throw new Error(`Cloudflare AI Error: ${response.statusText}`);
|
|
43
|
+
}
|
|
44
|
+
const buffer = await response.buffer();
|
|
45
|
+
const fileName = `evidence_${Date.now()}.png`;
|
|
46
|
+
const filePath = path.join(process.cwd(), fileName);
|
|
47
|
+
await fs.writeFile(filePath, buffer);
|
|
48
|
+
return {
|
|
49
|
+
success: true,
|
|
50
|
+
output: `Image generated and saved to: ${filePath}\nPrompt: ${args.prompt}`,
|
|
51
|
+
metadata: { filePath, fileName }
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
return { success: false, output: '', error: e.message };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=visual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visual.js","sourceRoot":"","sources":["../../../src/tools/visual.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+CAAqD;AAExC,QAAA,iBAAiB,GAAS;IACrC,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,kGAAkG;IAC/G,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;YACtE,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE;SAC/E;QACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB;IACD,KAAK,CAAC,OAAO,CAAC,IAA6B;QACzC,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC,MAAM,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC;QAE1C,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACjD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,uCAAuC,EAAE,CAAC;QACxF,CAAC;QAED,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;YACpC,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;YAClC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;YAE7B,MAAM,QAAQ,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 AZERCLAW — Open-source, BYOK AI agent for your terminal. Your AI, Your Keys, Your Way.",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
"chat": "npx tsx bin/azerclaw.ts chat",
|
|
12
12
|
"tui": "npx tsx bin/azerclaw.ts tui",
|
|
13
13
|
"dev": "npx tsx bin/azerclaw.ts",
|
|
14
|
-
"build": "tsc && npm run copy-skills",
|
|
14
|
+
"build": "tsc && npm run copy-skills && node scripts/inject-secrets.js",
|
|
15
15
|
"copy-skills": "cp -r skills dist/skills 2>/dev/null || true",
|
|
16
16
|
"doctor": "npx tsx bin/azerclaw.ts doctor",
|
|
17
17
|
"onboard": "npx tsx bin/azerclaw.ts onboard",
|
|
18
18
|
"test": "vitest run",
|
|
19
19
|
"clean": "rimraf dist",
|
|
20
|
+
"mcp:antigravity": "tsx src/mcp-servers/antigravity/index.ts",
|
|
20
21
|
"prepublishOnly": "npm run clean && npm run build"
|
|
21
22
|
},
|
|
22
23
|
"keywords": [
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
"dependencies": {
|
|
70
71
|
"@anthropic-ai/sdk": "^0.52.0",
|
|
71
72
|
"@google/generative-ai": "^0.24.0",
|
|
73
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
72
74
|
"boxen": "^5.1.2",
|
|
73
75
|
"chalk": "^4.1.2",
|
|
74
76
|
"cli-highlight": "^2.1.11",
|
|
@@ -77,7 +79,9 @@
|
|
|
77
79
|
"conf": "^11.0.2",
|
|
78
80
|
"croner": "^9.0.0",
|
|
79
81
|
"enquirer": "^2.4.1",
|
|
82
|
+
"express": "^5.2.1",
|
|
80
83
|
"figures": "^3.2.0",
|
|
84
|
+
"flexsearch": "^0.8.212",
|
|
81
85
|
"gradient-string": "^2.0.2",
|
|
82
86
|
"log-symbols": "^4.1.0",
|
|
83
87
|
"lowdb": "^6.1.1",
|
|
@@ -85,6 +89,7 @@
|
|
|
85
89
|
"node-fetch": "^3.3.2",
|
|
86
90
|
"openai": "^4.97.0",
|
|
87
91
|
"ora": "^5.4.1",
|
|
92
|
+
"pdfkit": "^0.18.0",
|
|
88
93
|
"string-width": "^4.2.3",
|
|
89
94
|
"strip-ansi": "^6.0.1",
|
|
90
95
|
"vm": "^0.1.0",
|
|
@@ -93,7 +98,9 @@
|
|
|
93
98
|
"zod": "^3.24.4"
|
|
94
99
|
},
|
|
95
100
|
"devDependencies": {
|
|
101
|
+
"@types/express": "^5.0.6",
|
|
96
102
|
"@types/node": "^22.19.18",
|
|
103
|
+
"@types/pdfkit": "^0.17.6",
|
|
97
104
|
"@types/ws": "^8.18.1",
|
|
98
105
|
"rimraf": "^6.0.1",
|
|
99
106
|
"tsup": "^8.5.0",
|