@shareai-lab/kode-sdk 2.7.1 → 2.7.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.
- package/dist/core/agent/breakpoint-manager.js +36 -0
- package/dist/core/agent/message-queue.js +57 -0
- package/dist/core/agent/permission-manager.js +32 -0
- package/dist/core/agent/todo-manager.js +91 -0
- package/dist/core/agent/tool-runner.js +45 -0
- package/dist/core/agent.js +2035 -0
- package/dist/core/config.js +2 -0
- package/dist/core/context-manager.js +241 -0
- package/dist/core/errors.js +49 -0
- package/dist/core/events.js +329 -0
- package/dist/core/file-pool.d.ts +2 -0
- package/dist/core/file-pool.js +125 -0
- package/dist/core/hooks.js +71 -0
- package/dist/core/permission-modes.js +61 -0
- package/dist/core/pool.js +301 -0
- package/dist/core/room.js +57 -0
- package/dist/core/scheduler.js +58 -0
- package/dist/core/skills/index.js +20 -0
- package/dist/core/skills/management-manager.js +557 -0
- package/dist/core/skills/manager.js +243 -0
- package/dist/core/skills/operation-queue.js +113 -0
- package/dist/core/skills/sandbox-file-manager.js +183 -0
- package/dist/core/skills/types.js +9 -0
- package/dist/core/skills/xml-generator.js +70 -0
- package/dist/core/template.js +35 -0
- package/dist/core/time-bridge.js +100 -0
- package/dist/core/todo.js +89 -0
- package/dist/core/types.js +3 -0
- package/dist/index.js +148 -60461
- package/dist/infra/db/postgres/postgres-store.js +1073 -0
- package/dist/infra/db/sqlite/sqlite-store.js +800 -0
- package/dist/infra/e2b/e2b-fs.js +128 -0
- package/dist/infra/e2b/e2b-sandbox.js +156 -0
- package/dist/infra/e2b/e2b-template.js +105 -0
- package/dist/infra/e2b/index.js +9 -0
- package/dist/infra/e2b/types.js +2 -0
- package/dist/infra/provider.js +67 -0
- package/dist/infra/providers/anthropic.js +308 -0
- package/dist/infra/providers/core/errors.js +353 -0
- package/dist/infra/providers/core/fork.js +418 -0
- package/dist/infra/providers/core/index.js +76 -0
- package/dist/infra/providers/core/logger.js +191 -0
- package/dist/infra/providers/core/retry.js +189 -0
- package/dist/infra/providers/core/usage.js +376 -0
- package/dist/infra/providers/gemini.js +493 -0
- package/dist/infra/providers/index.js +83 -0
- package/dist/infra/providers/openai.js +662 -0
- package/dist/infra/providers/types.js +20 -0
- package/dist/infra/providers/utils.js +400 -0
- package/dist/infra/sandbox-factory.js +30 -0
- package/dist/infra/sandbox.js +243 -0
- package/dist/infra/store/factory.js +80 -0
- package/dist/infra/store/index.js +26 -0
- package/dist/infra/store/json-store.js +606 -0
- package/dist/infra/store/types.js +2 -0
- package/dist/infra/store.js +29 -0
- package/dist/tools/bash_kill/index.js +35 -0
- package/dist/tools/bash_kill/prompt.js +14 -0
- package/dist/tools/bash_logs/index.js +40 -0
- package/dist/tools/bash_logs/prompt.js +14 -0
- package/dist/tools/bash_run/index.js +61 -0
- package/dist/tools/bash_run/prompt.js +18 -0
- package/dist/tools/builtin.js +26 -0
- package/dist/tools/define.js +214 -0
- package/dist/tools/fs_edit/index.js +62 -0
- package/dist/tools/fs_edit/prompt.js +15 -0
- package/dist/tools/fs_glob/index.js +40 -0
- package/dist/tools/fs_glob/prompt.js +15 -0
- package/dist/tools/fs_grep/index.js +66 -0
- package/dist/tools/fs_grep/prompt.js +16 -0
- package/dist/tools/fs_multi_edit/index.js +106 -0
- package/dist/tools/fs_multi_edit/prompt.js +16 -0
- package/dist/tools/fs_read/index.js +40 -0
- package/dist/tools/fs_read/prompt.js +16 -0
- package/dist/tools/fs_write/index.js +40 -0
- package/dist/tools/fs_write/prompt.js +15 -0
- package/dist/tools/index.js +61 -0
- package/dist/tools/mcp.js +185 -0
- package/dist/tools/registry.js +26 -0
- package/dist/tools/scripts.js +205 -0
- package/dist/tools/skills.js +115 -0
- package/dist/tools/task_run/index.js +58 -0
- package/dist/tools/task_run/prompt.js +25 -0
- package/dist/tools/todo_read/index.js +29 -0
- package/dist/tools/todo_read/prompt.js +18 -0
- package/dist/tools/todo_write/index.js +42 -0
- package/dist/tools/todo_write/prompt.js +23 -0
- package/dist/tools/tool.js +211 -0
- package/dist/tools/toolkit.js +98 -0
- package/dist/tools/type-inference.js +207 -0
- package/dist/utils/agent-id.js +28 -0
- package/dist/utils/logger.js +44 -0
- package/dist/utils/session-id.js +64 -0
- package/package.json +7 -38
- package/dist/index.js.map +0 -7
- package/dist/index.mjs +0 -60385
- package/dist/index.mjs.map +0 -7
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStore = createStore;
|
|
4
|
+
exports.createExtendedStore = createExtendedStore;
|
|
5
|
+
const json_store_1 = require("./json-store");
|
|
6
|
+
/**
|
|
7
|
+
* Store 工厂函数
|
|
8
|
+
* 根据配置创建对应类型的 Store 实例
|
|
9
|
+
*
|
|
10
|
+
* @param config - Store 配置
|
|
11
|
+
* @returns Store 实例
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // 创建 JSON Store
|
|
16
|
+
* const jsonStore = createStore({ type: 'json', baseDir: './data' });
|
|
17
|
+
*
|
|
18
|
+
* // 创建 SQLite Store
|
|
19
|
+
* const sqliteStore = createStore({
|
|
20
|
+
* type: 'sqlite',
|
|
21
|
+
* dbPath: './agents.db',
|
|
22
|
+
* fileStoreBaseDir: './data'
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // 创建 PostgreSQL Store
|
|
26
|
+
* const pgStore = createStore({
|
|
27
|
+
* type: 'postgres',
|
|
28
|
+
* connection: {
|
|
29
|
+
* host: 'localhost',
|
|
30
|
+
* port: 5432,
|
|
31
|
+
* database: 'agents',
|
|
32
|
+
* user: 'postgres',
|
|
33
|
+
* password: 'secret'
|
|
34
|
+
* },
|
|
35
|
+
* fileStoreBaseDir: './data'
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
function createStore(config) {
|
|
40
|
+
switch (config.type) {
|
|
41
|
+
case 'json':
|
|
42
|
+
return new json_store_1.JSONStore(config.baseDir);
|
|
43
|
+
case 'sqlite': {
|
|
44
|
+
// 动态导入避免不需要时加载依赖
|
|
45
|
+
const { SqliteStore } = require('../db/sqlite/sqlite-store');
|
|
46
|
+
return new SqliteStore(config.dbPath, config.fileStoreBaseDir);
|
|
47
|
+
}
|
|
48
|
+
case 'postgres': {
|
|
49
|
+
// 动态导入避免不需要时加载依赖
|
|
50
|
+
const { PostgresStore } = require('../db/postgres/postgres-store');
|
|
51
|
+
return new PostgresStore(config.connection, config.fileStoreBaseDir);
|
|
52
|
+
}
|
|
53
|
+
default:
|
|
54
|
+
// TypeScript exhaustive check
|
|
55
|
+
const _exhaustive = config;
|
|
56
|
+
throw new Error(`未知的 Store 类型: ${_exhaustive.type}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 创建 ExtendedStore(带高级功能)
|
|
61
|
+
* 仅支持 SQLite 和 PostgreSQL
|
|
62
|
+
*
|
|
63
|
+
* @param config - Store 配置(必须是 sqlite 或 postgres)
|
|
64
|
+
* @returns ExtendedStore 实例
|
|
65
|
+
*/
|
|
66
|
+
function createExtendedStore(config) {
|
|
67
|
+
switch (config.type) {
|
|
68
|
+
case 'sqlite': {
|
|
69
|
+
const { SqliteStore } = require('../db/sqlite/sqlite-store');
|
|
70
|
+
return new SqliteStore(config.dbPath, config.fileStoreBaseDir);
|
|
71
|
+
}
|
|
72
|
+
case 'postgres': {
|
|
73
|
+
const { PostgresStore } = require('../db/postgres/postgres-store');
|
|
74
|
+
return new PostgresStore(config.connection, config.fileStoreBaseDir);
|
|
75
|
+
}
|
|
76
|
+
default:
|
|
77
|
+
const _exhaustive = config;
|
|
78
|
+
throw new Error(`未知的 Store 类型: ${_exhaustive.type}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.createExtendedStore = exports.createStore = exports.JSONStore = void 0;
|
|
18
|
+
// 导出所有类型定义
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
// 导出 JSONStore 实现
|
|
21
|
+
var json_store_1 = require("./json-store");
|
|
22
|
+
Object.defineProperty(exports, "JSONStore", { enumerable: true, get: function () { return json_store_1.JSONStore; } });
|
|
23
|
+
// 导出工厂函数
|
|
24
|
+
var factory_1 = require("./factory");
|
|
25
|
+
Object.defineProperty(exports, "createStore", { enumerable: true, get: function () { return factory_1.createStore; } });
|
|
26
|
+
Object.defineProperty(exports, "createExtendedStore", { enumerable: true, get: function () { return factory_1.createExtendedStore; } });
|