@co-engram/openclaw 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +203 -0
  3. package/dist/adapter.d.ts +36 -0
  4. package/dist/adapter.d.ts.map +1 -0
  5. package/dist/adapter.js +330 -0
  6. package/dist/adapter.js.map +1 -0
  7. package/dist/auto-onboard.d.ts +19 -0
  8. package/dist/auto-onboard.d.ts.map +1 -0
  9. package/dist/auto-onboard.js +35 -0
  10. package/dist/auto-onboard.js.map +1 -0
  11. package/dist/entry-example.d.ts +10 -0
  12. package/dist/entry-example.d.ts.map +1 -0
  13. package/dist/entry-example.js +10 -0
  14. package/dist/entry-example.js.map +1 -0
  15. package/dist/entry.d.ts +96 -0
  16. package/dist/entry.d.ts.map +1 -0
  17. package/dist/entry.js +228 -0
  18. package/dist/entry.js.map +1 -0
  19. package/dist/index.d.ts +14 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +14 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/json-schemas.d.ts +35 -0
  24. package/dist/json-schemas.d.ts.map +1 -0
  25. package/dist/json-schemas.js +432 -0
  26. package/dist/json-schemas.js.map +1 -0
  27. package/dist/list-intent-detector.d.ts +20 -0
  28. package/dist/list-intent-detector.d.ts.map +1 -0
  29. package/dist/list-intent-detector.js +50 -0
  30. package/dist/list-intent-detector.js.map +1 -0
  31. package/dist/llm-client.d.ts +29 -0
  32. package/dist/llm-client.d.ts.map +1 -0
  33. package/dist/llm-client.js +112 -0
  34. package/dist/llm-client.js.map +1 -0
  35. package/dist/maintenance-runtime.d.ts +31 -0
  36. package/dist/maintenance-runtime.d.ts.map +1 -0
  37. package/dist/maintenance-runtime.js +61 -0
  38. package/dist/maintenance-runtime.js.map +1 -0
  39. package/dist/memory-tools.d.ts +82 -0
  40. package/dist/memory-tools.d.ts.map +1 -0
  41. package/dist/memory-tools.js +237 -0
  42. package/dist/memory-tools.js.map +1 -0
  43. package/dist/plugin-entry.d.ts +98 -0
  44. package/dist/plugin-entry.d.ts.map +1 -0
  45. package/dist/plugin-entry.js +444 -0
  46. package/dist/plugin-entry.js.map +1 -0
  47. package/dist/prompt-builder.d.ts +48 -0
  48. package/dist/prompt-builder.d.ts.map +1 -0
  49. package/dist/prompt-builder.js +33 -0
  50. package/dist/prompt-builder.js.map +1 -0
  51. package/dist/types.d.ts +236 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +29 -0
  54. package/dist/types.js.map +1 -0
  55. package/dist/viewer-loader.d.ts +36 -0
  56. package/dist/viewer-loader.d.ts.map +1 -0
  57. package/dist/viewer-loader.js +45 -0
  58. package/dist/viewer-loader.js.map +1 -0
  59. package/openclaw.plugin.json +137 -0
  60. package/package.json +61 -0
  61. package/scripts/setup.mjs +231 -0
  62. package/scripts/sync-deps.mjs +247 -0
@@ -0,0 +1,35 @@
1
+ /**
2
+ * OpenClaw 插件专属:auto-onboard bundle 路径解析。
3
+ *
4
+ * 核心逻辑(findGitRepoRoot / autoOnboardMergeDriver 等)在 `@co-engram/core/merge/auto-onboard`,
5
+ * 这里只保留 host-specific 的 bundle 定位(取决于 host 的 node_modules 布局)。
6
+ *
7
+ * @module @co-engram/openclaw
8
+ */
9
+ import { createRequire } from "node:module";
10
+ import { resolveMergeDriverBundle } from "@co-engram/core";
11
+ export { resolveMergeDriverBundle, findGitRepoRoot, autoOnboardMergeDriver, } from "@co-engram/core";
12
+ /**
13
+ * 自动定位已安装的 `@co-engram/core` 中的 merge-driver bundle。
14
+ *
15
+ * 通过 `createRequire` 解析 `@co-engram/core/types` 子路径,exports 字段已暴露。
16
+ * 该子路径只能 import 不能 require,所以显式传 `conditions: ['import','default']`。
17
+ *
18
+ * 失败(如 bundle 未构建 / 解析不到)返回 null,不抛错 —— auto-onboard 按跳过处理。
19
+ */
20
+ export function findInstalledMergeDriverBundle() {
21
+ try {
22
+ const require = createRequire(import.meta.url);
23
+ // @co-engram/core 的 exports 只声明 import 条件,默认 require.resolve 走 require 条件会失败。
24
+ // 显式传 conditions 让 resolver 接受 import-only 入口。
25
+ // Node 22 运行时支持 conditions,但部分 @types/node 版本未声明字段,所以做 unknown cast。
26
+ const opts = { conditions: ["import", "default"] };
27
+ const typesEntryPath = require.resolve("@co-engram/core/types", opts);
28
+ const coreDistDir = typesEntryPath.replace(/\/types\/[^/]+$/, "");
29
+ return resolveMergeDriverBundle(coreDistDir);
30
+ }
31
+ catch {
32
+ return null;
33
+ }
34
+ }
35
+ //# sourceMappingURL=auto-onboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-onboard.js","sourceRoot":"","sources":["../src/auto-onboard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,sBAAsB,GAEvB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B;IAC5C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,8EAA8E;QAC9E,+CAA+C;QAC/C,qEAAqE;QACrE,MAAM,IAAI,GAAG,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,EAE5C,CAAC;QACL,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;QACtE,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QAClE,OAAO,wBAAwB,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 示例:如何在 openclaw 项目里注册 Co-Engram
3
+ *
4
+ * 这个文件不导出任何东西,仅作为使用文档。
5
+ * 用户在自己的 openclaw 扩展里复制下面的代码即可。
6
+ *
7
+ * @module @co-engram/openclaw/example
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=entry-example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-example.d.ts","sourceRoot":"","sources":["../src/entry-example.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH,OAAO,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 示例:如何在 openclaw 项目里注册 Co-Engram
3
+ *
4
+ * 这个文件不导出任何东西,仅作为使用文档。
5
+ * 用户在自己的 openclaw 扩展里复制下面的代码即可。
6
+ *
7
+ * @module @co-engram/openclaw/example
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=entry-example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-example.js","sourceRoot":"","sources":["../src/entry-example.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * OpenClaw 默认 plugin entry(开箱即用)
3
+ *
4
+ * 用户只需:
5
+ * 1. 把 @co-engram/openclaw 安装到 openclaw 的 extensions 目录
6
+ * 2. 在 openclaw config 里(可选)配置 plugins.entries.co-engram.config
7
+ *
8
+ * 不需要自己写 plugin-entry 文件。
9
+ *
10
+ * Loader 接受 plain object(含 register(api)),不强制走 definePluginEntry。
11
+ * 参见 src/plugins/loader.ts:1384 resolvePluginModuleExport。
12
+ *
13
+ * ## OpenClaw low-friction 默认
14
+ *
15
+ * 与 @co-engram/core 的 DEFAULT_CONFIG(给保守主机用)不同,OpenClaw plugin
16
+ * 默认开启常用功能:proposal engine / maintenance runtime / web viewer。
17
+ * 用户可通过显式传 `false` 关闭任一项(low-friction-defaults 原则)。
18
+ *
19
+ * @module @co-engram/openclaw
20
+ */
21
+ import type { CoEngramPluginHostApi } from "./types.js";
22
+ declare const entry: {
23
+ id: string;
24
+ name: string;
25
+ description: string;
26
+ configSchema: {
27
+ type: string;
28
+ additionalProperties: boolean;
29
+ properties: {
30
+ enabled: {
31
+ type: string;
32
+ default: boolean;
33
+ description: string;
34
+ };
35
+ dataRoot: {
36
+ type: string;
37
+ description: string;
38
+ };
39
+ defaultCreatedBy: {
40
+ type: string;
41
+ description: string;
42
+ };
43
+ language: {
44
+ type: string;
45
+ enum: string[];
46
+ default: string;
47
+ description: string;
48
+ };
49
+ startMaintenance: {
50
+ type: string;
51
+ default: boolean;
52
+ description: string;
53
+ };
54
+ maintenanceConfig: {
55
+ type: string;
56
+ additionalProperties: boolean;
57
+ description: string;
58
+ };
59
+ auditEnabled: {
60
+ type: string;
61
+ default: boolean;
62
+ description: string;
63
+ };
64
+ effectivenessEnabled: {
65
+ type: string;
66
+ default: boolean;
67
+ description: string;
68
+ };
69
+ proposalEnabled: {
70
+ type: string;
71
+ default: boolean;
72
+ description: string;
73
+ };
74
+ proposalConfig: {
75
+ type: string;
76
+ additionalProperties: boolean;
77
+ description: string;
78
+ };
79
+ startViewer: {
80
+ type: string;
81
+ default: boolean;
82
+ description: string;
83
+ };
84
+ viewerConfig: {
85
+ type: string;
86
+ additionalProperties: boolean;
87
+ description: string;
88
+ };
89
+ };
90
+ };
91
+ register(api: CoEngramPluginHostApi & {
92
+ pluginConfig?: Record<string, unknown>;
93
+ }): void;
94
+ };
95
+ export default entry;
96
+ //# sourceMappingURL=entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAWH,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AA8H9E,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgFF,qBAAqB,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;CA6B1E,CAAC;AAEF,eAAe,KAAK,CAAC"}
package/dist/entry.js ADDED
@@ -0,0 +1,228 @@
1
+ /**
2
+ * OpenClaw 默认 plugin entry(开箱即用)
3
+ *
4
+ * 用户只需:
5
+ * 1. 把 @co-engram/openclaw 安装到 openclaw 的 extensions 目录
6
+ * 2. 在 openclaw config 里(可选)配置 plugins.entries.co-engram.config
7
+ *
8
+ * 不需要自己写 plugin-entry 文件。
9
+ *
10
+ * Loader 接受 plain object(含 register(api)),不强制走 definePluginEntry。
11
+ * 参见 src/plugins/loader.ts:1384 resolvePluginModuleExport。
12
+ *
13
+ * ## OpenClaw low-friction 默认
14
+ *
15
+ * 与 @co-engram/core 的 DEFAULT_CONFIG(给保守主机用)不同,OpenClaw plugin
16
+ * 默认开启常用功能:proposal engine / maintenance runtime / web viewer。
17
+ * 用户可通过显式传 `false` 关闭任一项(low-friction-defaults 原则)。
18
+ *
19
+ * @module @co-engram/openclaw
20
+ */
21
+ import { readFileSync, existsSync } from "node:fs";
22
+ import { join as joinPath } from "node:path";
23
+ import { registerCoEngramTools, startCoEngramViewer } from "./plugin-entry.js";
24
+ import { resolveLanguage, parseLanguage, } from "@co-engram/core";
25
+ /**
26
+ * 从 api.pluginConfig(openclaw 配置文件 plugins.entries.co-engram.config)
27
+ * 提取用户配置,转换成 CoEngramPluginConfig。
28
+ */
29
+ function readUserConfig(pluginConfig) {
30
+ if (!pluginConfig)
31
+ return {};
32
+ const parts = [];
33
+ if (typeof pluginConfig.dataRoot === "string") {
34
+ parts.push({ dataRoot: pluginConfig.dataRoot });
35
+ }
36
+ if (typeof pluginConfig.enabled === "boolean") {
37
+ parts.push({ enabled: pluginConfig.enabled });
38
+ }
39
+ if (typeof pluginConfig.defaultCreatedBy === "string") {
40
+ parts.push({ defaultCreatedBy: pluginConfig.defaultCreatedBy });
41
+ }
42
+ if (typeof pluginConfig.language === "string") {
43
+ parts.push({ language: parseLanguage(pluginConfig.language) });
44
+ }
45
+ if (typeof pluginConfig.startMaintenance === "boolean") {
46
+ parts.push({ startMaintenance: pluginConfig.startMaintenance });
47
+ }
48
+ if (pluginConfig.maintenanceConfig &&
49
+ typeof pluginConfig.maintenanceConfig === "object") {
50
+ parts.push({
51
+ maintenanceConfig: pluginConfig.maintenanceConfig,
52
+ });
53
+ }
54
+ if (typeof pluginConfig.auditEnabled === "boolean") {
55
+ parts.push({ auditEnabled: pluginConfig.auditEnabled });
56
+ }
57
+ if (typeof pluginConfig.effectivenessEnabled === "boolean") {
58
+ parts.push({ effectivenessEnabled: pluginConfig.effectivenessEnabled });
59
+ }
60
+ if (typeof pluginConfig.proposalEnabled === "boolean") {
61
+ parts.push({ proposalEnabled: pluginConfig.proposalEnabled });
62
+ }
63
+ if (pluginConfig.proposalConfig &&
64
+ typeof pluginConfig.proposalConfig === "object") {
65
+ parts.push({
66
+ proposalConfig: pluginConfig.proposalConfig,
67
+ });
68
+ }
69
+ if (typeof pluginConfig.startViewer === "boolean") {
70
+ parts.push({ startViewer: pluginConfig.startViewer });
71
+ }
72
+ if (pluginConfig.viewerConfig &&
73
+ typeof pluginConfig.viewerConfig === "object") {
74
+ parts.push({
75
+ viewerConfig: pluginConfig.viewerConfig,
76
+ });
77
+ }
78
+ return Object.assign({}, ...parts);
79
+ }
80
+ /**
81
+ * 同步读取 team-memory 持久化配置(JSON)
82
+ *
83
+ * OpenClaw 1.8+ 要求 register() 必须同步,所以这里用 readFileSync 替代
84
+ * core 包的 async readTeamMemoryConfig。失败/缺失时返回 undefined。
85
+ */
86
+ function readTeamMemoryConfigSync(dataRoot) {
87
+ const path = joinPath(dataRoot, ".co-engram", "config.json");
88
+ try {
89
+ if (!existsSync(path))
90
+ return undefined;
91
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
92
+ if (parsed && typeof parsed === "object" && parsed.version === 1)
93
+ return parsed;
94
+ return undefined;
95
+ }
96
+ catch {
97
+ return undefined;
98
+ }
99
+ }
100
+ /**
101
+ * 同步读取 prompt signals 缓存(JSON)
102
+ */
103
+ function readPromptSignalsSync(dataRoot) {
104
+ const path = joinPath(dataRoot, ".co-engram", "prompt-signals.json");
105
+ try {
106
+ if (!existsSync(path))
107
+ return undefined;
108
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
109
+ if (parsed && typeof parsed === "object" && parsed.version === 1)
110
+ return parsed;
111
+ return undefined;
112
+ }
113
+ catch {
114
+ return undefined;
115
+ }
116
+ }
117
+ /**
118
+ * 同步解析配置语言
119
+ */
120
+ function resolveConfigLanguageSync(userConfig) {
121
+ if (userConfig.language)
122
+ return userConfig;
123
+ const dataRoot = userConfig.dataRoot ?? `${process.env.HOME ?? "/tmp"}/team-memory`;
124
+ const persisted = readTeamMemoryConfigSync(dataRoot);
125
+ if (persisted?.language) {
126
+ return { ...userConfig, language: resolveLanguage(undefined, persisted) };
127
+ }
128
+ return userConfig;
129
+ }
130
+ const entry = {
131
+ id: "co-engram",
132
+ name: "Co-Engram",
133
+ description: "Team memory with neuroscience-inspired plasticity. Self-editing tools for engrams / synapses / skills.",
134
+ configSchema: {
135
+ type: "object",
136
+ additionalProperties: false,
137
+ properties: {
138
+ enabled: {
139
+ type: "boolean",
140
+ default: true,
141
+ description: "Enable or disable Co-Engram tool registration.",
142
+ },
143
+ dataRoot: {
144
+ type: "string",
145
+ description: "Absolute path to the team-memory repository (default: $HOME/team-memory).",
146
+ },
147
+ defaultCreatedBy: {
148
+ type: "string",
149
+ description: "Default creator identifier when not specified on writes.",
150
+ },
151
+ language: {
152
+ type: "string",
153
+ enum: ["en", "zh"],
154
+ default: "en",
155
+ description: "Language for tool descriptions, viewer UI, and system prompts. Falls back to team-memory persisted config if unset.",
156
+ },
157
+ startMaintenance: {
158
+ type: "boolean",
159
+ default: true,
160
+ description: "Start the auto-maintenance engine (light/deep/rem stages). On by default for low-friction onboarding.",
161
+ },
162
+ maintenanceConfig: {
163
+ type: "object",
164
+ additionalProperties: true,
165
+ description: "Maintenance engine config (lightIntervalMs / deepIntervalMs / remIntervalMs / learningRate / enabledStages).",
166
+ },
167
+ auditEnabled: {
168
+ type: "boolean",
169
+ default: true,
170
+ description: "Enable audit log (.co-engram/audit.jsonl).",
171
+ },
172
+ effectivenessEnabled: {
173
+ type: "boolean",
174
+ default: true,
175
+ description: "Enable effectiveness tracking (retrieve_hit → effective/inconclusive).",
176
+ },
177
+ proposalEnabled: {
178
+ type: "boolean",
179
+ default: true,
180
+ description: "Enable implicit memory proposal engine (on by default for low-friction onboarding).",
181
+ },
182
+ proposalConfig: {
183
+ type: "object",
184
+ additionalProperties: true,
185
+ description: "Proposal engine config (threshold / similarityThreshold / maxSamples / defaultDismissDays / minMessageLength).",
186
+ },
187
+ startViewer: {
188
+ type: "boolean",
189
+ default: true,
190
+ description: "Start the web viewer HTTP server (on by default for low-friction onboarding; configured port via viewerConfig.port).",
191
+ },
192
+ viewerConfig: {
193
+ type: "object",
194
+ additionalProperties: true,
195
+ description: "Viewer config (port / token). Default port 18799 unless overridden by openclaw.json.",
196
+ },
197
+ },
198
+ },
199
+ register(api) {
200
+ const baseConfig = readUserConfig(api.pluginConfig);
201
+ // OpenClaw low-friction 默认:proposal/maintenance/viewer 默认全开,
202
+ // 仅当用户显式传 false 时才关闭。参考 claude code mcp 的默认行为并对齐到
203
+ // "常用功能开箱即用"。其他主机(MCP server 等)仍走 DEFAULT_CONFIG 保守默认。
204
+ // 注意:openclaw 用 openclaw.plugin.json 的 configSchema 做默认值填充,
205
+ // 那里也必须 default: true,否则会被填成 false 覆盖此处的 low-friction 默认。
206
+ const openclawDefaults = {
207
+ proposalEnabled: baseConfig.proposalEnabled !== false,
208
+ startMaintenance: baseConfig.startMaintenance !== false,
209
+ startViewer: baseConfig.startViewer !== false,
210
+ };
211
+ const mergedConfig = {
212
+ ...openclawDefaults,
213
+ ...baseConfig,
214
+ };
215
+ const userConfig = resolveConfigLanguageSync(mergedConfig);
216
+ const dataRootForSignals = userConfig.dataRoot ?? `${process.env.HOME ?? "/tmp"}/team-memory`;
217
+ const promptSignals = readPromptSignalsSync(dataRootForSignals);
218
+ const ctx = registerCoEngramTools(api, {
219
+ ...userConfig,
220
+ ...(promptSignals ? { promptSignals } : {}),
221
+ });
222
+ if (userConfig.startViewer === true) {
223
+ void startCoEngramViewer(ctx, userConfig);
224
+ }
225
+ },
226
+ };
227
+ export default entry;
228
+ //# sourceMappingURL=entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.js","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EACL,eAAe,EACf,aAAa,GAGd,MAAM,iBAAiB,CAAC;AAGzB;;;GAGG;AACH,SAAS,cAAc,CACrB,YAAiD;IAEjD,IAAI,CAAC,YAAY;QAAE,OAAO,EAAE,CAAC;IAC7B,MAAM,KAAK,GAA2B,EAAE,CAAC;IAEzC,IAAI,OAAO,YAAY,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9C,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,OAAO,YAAY,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC9C,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;IACD,IAAI,OAAO,YAAY,CAAC,gBAAgB,KAAK,QAAQ,EAAE,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,EAAE,gBAAg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AM,YAAY,GAAyB;YACzC,GAAG,gBAAgB;YACnB,GAAG,UAAU;SACd,CAAC;QACF,MAAM,UAAU,GAAG,yBAAyB,CAAC,YAAY,CAAC,CAAC;QAC3D,MAAM,kBAAkB,GACtB,UAAU,CAAC,QAAQ,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,cAAc,CAAC;QACrE,MAAM,aAAa,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;QAChE,MAAM,GAAG,GAAG,qBAAqB,CAAC,GAAG,EAAE;YACrC,GAAG,UAAU;YACb,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5C,CAAC,CAAC;QACH,IAAI,UAAU,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;YACpC,KAAK,mBAAmB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;CACF,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @co-engram/openclaw - OpenClaw Plugin Adapter
3
+ *
4
+ * 把 host-agnostic 的 @co-engram/core 工具适配为 OpenClaw Plugin
5
+ *
6
+ * @module @co-engram/openclaw
7
+ */
8
+ export * from "./types.js";
9
+ export * from "./json-schemas.js";
10
+ export * from "./adapter.js";
11
+ export * from "./plugin-entry.js";
12
+ export * from "./maintenance-runtime.js";
13
+ export * from "./viewer-loader.js";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @co-engram/openclaw - OpenClaw Plugin Adapter
3
+ *
4
+ * 把 host-agnostic 的 @co-engram/core 工具适配为 OpenClaw Plugin
5
+ *
6
+ * @module @co-engram/openclaw
7
+ */
8
+ export * from "./types.js";
9
+ export * from "./json-schemas.js";
10
+ export * from "./adapter.js";
11
+ export * from "./plugin-entry.js";
12
+ export * from "./maintenance-runtime.js";
13
+ export * from "./viewer-loader.js";
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * 手写 JSON Schema 字典
3
+ *
4
+ * 与 packages/core/src/tools/schemas.ts 中的 Zod schemas 保持一致。
5
+ * P0 阶段手写避免引入 zod-to-json-schema 依赖。
6
+ * P1 阶段可改用 zod v4 的 z.toJSONSchema() 自动生成。
7
+ *
8
+ * @module @co-engram/openclaw
9
+ */
10
+ import type { JsonSchemaObject } from "./types.js";
11
+ export declare const engramCreateSchema: JsonSchemaObject;
12
+ export declare const engramGetSchema: JsonSchemaObject;
13
+ export declare const engramUpdateSchema: JsonSchemaObject;
14
+ export declare const engramDeleteSchema: JsonSchemaObject;
15
+ export declare const engramReinforceSchema: JsonSchemaObject;
16
+ export declare const engramReportFailureSchema: JsonSchemaObject;
17
+ export declare const engramArchiveSchema: JsonSchemaObject;
18
+ export declare const engramRestoreSchema: JsonSchemaObject;
19
+ export declare const engramForgetSchema: JsonSchemaObject;
20
+ export declare const engramRecomputeImportanceSchema: JsonSchemaObject;
21
+ export declare const contradictionResolveSchema: JsonSchemaObject;
22
+ export declare const closeLearningLoopSchema: JsonSchemaObject;
23
+ export declare const engramSearchSchema: JsonSchemaObject;
24
+ export declare const engramListSchema: JsonSchemaObject;
25
+ export declare const synapseCreateSchema: JsonSchemaObject;
26
+ export declare const synapseGetSchema: JsonSchemaObject;
27
+ export declare const synapseDeleteSchema: JsonSchemaObject;
28
+ export declare const synapseListSchema: JsonSchemaObject;
29
+ export declare const skillGetSchema: JsonSchemaObject;
30
+ export declare const skillInvokeSchema: JsonSchemaObject;
31
+ /**
32
+ * 工具名 → JSON Schema 映射
33
+ */
34
+ export declare const TOOL_JSON_SCHEMAS: Readonly<Record<string, JsonSchemaObject>>;
35
+ //# sourceMappingURL=json-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schemas.d.ts","sourceRoot":"","sources":["../src/json-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA8GnD,eAAO,MAAM,kBAAkB,EAAE,gBAmChC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,gBAiC7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBA2BhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAOhC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,gBAenC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,gBASvC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,gBAQjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,gBAAsC,CAAC;AAEzE,eAAO,MAAM,kBAAkB,EAAE,gBAQhC,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,gBAwB7C,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,gBAexC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,gBAoBrC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAShC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAA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