openclaw-cloudflare-vectorize-memory 0.1.4 → 0.1.5

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/cli-metadata.ts CHANGED
@@ -1,26 +1,24 @@
1
- import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
2
-
3
- export default definePluginEntry({
4
- id: "memory-cloudflare-vectorize",
5
- name: "Cloudflare Vectorize Memory",
6
- description: "OpenClaw memory plugin backed by Cloudflare Vectorize and Workers AI embeddings.",
7
- register(api) {
8
- api.registerCli(async ({ program }) => {
9
- const cliModulePath = "./dist/cli.js";
10
- const { registerCloudflareMemoryCli }: typeof import("./src/cli.js") = await import(cliModulePath);
11
- registerCloudflareMemoryCli(program, {
12
- pluginConfig: api.pluginConfig,
13
- openClawConfig: api.config,
14
- resolvePath: api.resolvePath,
15
- });
16
- }, {
17
- descriptors: [
18
- {
19
- name: "cf-memory",
20
- description: "Manage Cloudflare Vectorize memory",
21
- hasSubcommands: true,
22
- },
23
- ],
24
- });
25
- },
26
- });
1
+ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
2
+ import { CLI_ROOT_COMMAND } from "./src/constants.js";
3
+
4
+ export default definePluginEntry({
5
+ id: "memory-cloudflare-vectorize",
6
+ name: "Cloudflare Vectorize Memory",
7
+ description: "OpenClaw memory plugin backed by Cloudflare Vectorize and Workers AI embeddings.",
8
+ register(api) {
9
+ api.registerCli(
10
+ async ({ program }) => {
11
+ const cliModulePath = "./dist/cli.js";
12
+ const { registerCloudflareMemoryCli }: typeof import("./src/cli.js") = await import(cliModulePath);
13
+ registerCloudflareMemoryCli(program, {
14
+ pluginConfig: api.pluginConfig,
15
+ openClawConfig: api.config,
16
+ resolvePath: api.resolvePath,
17
+ });
18
+ },
19
+ {
20
+ commands: [CLI_ROOT_COMMAND],
21
+ },
22
+ );
23
+ },
24
+ });
package/dist/constants.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region src/constants.ts
2
- var e = "memory-cloudflare-vectorize", t = "Cloudflare Vectorize Memory", n = "OpenClaw memory plugin backed by Cloudflare Vectorize and Workers AI embeddings.", r = "CLOUDFLARE_ACCOUNT_ID", i = "CLOUDFLARE_API_TOKEN", a = "CLOUDFLARE_VECTORIZE_INDEX_NAME", o = "CLOUDFLARE_VECTORIZE_NAMESPACE", s = "CLOUDFLARE_WORKERS_AI_EMBEDDING_MODEL", c = "CLOUDFLARE_VECTORIZE_TOP_K", l = "OPENCLAW_CF_MEMORY_STORAGE_MODE", u = "OPENCLAW_CF_MEMORY_COMPANION_PATH", d = "@cf/baai/bge-base-en-v1.5", f = 6e3, p = "cosine", m = "vectorize-inline", h = "https://api.cloudflare.com/client/v4", g = "OpenClaw memory index backed by Cloudflare Vectorize.", _ = {
2
+ var e = "memory-cloudflare-vectorize", t = "Cloudflare Vectorize Memory", n = "OpenClaw memory plugin backed by Cloudflare Vectorize and Workers AI embeddings.", r = "cf-memory", i = "CLOUDFLARE_ACCOUNT_ID", a = "CLOUDFLARE_API_TOKEN", o = "CLOUDFLARE_VECTORIZE_INDEX_NAME", s = "CLOUDFLARE_VECTORIZE_NAMESPACE", c = "CLOUDFLARE_WORKERS_AI_EMBEDDING_MODEL", l = "CLOUDFLARE_VECTORIZE_TOP_K", u = "OPENCLAW_CF_MEMORY_STORAGE_MODE", d = "OPENCLAW_CF_MEMORY_COMPANION_PATH", f = "@cf/baai/bge-base-en-v1.5", p = 6e3, m = "cosine", h = "vectorize-inline", g = "https://api.cloudflare.com/client/v4", _ = "OpenClaw memory index backed by Cloudflare Vectorize.", v = {
3
3
  logicalId: "oc_record_id",
4
4
  title: "oc_title",
5
5
  text: "oc_text",
@@ -10,6 +10,6 @@ var e = "memory-cloudflare-vectorize", t = "Cloudflare Vectorize Memory", n = "O
10
10
  updatedAt: "oc_updated_at"
11
11
  };
12
12
  //#endregion
13
- export { r as CLOUDFLARE_ACCOUNT_ID_ENV, i as CLOUDFLARE_API_TOKEN_ENV, u as COMPANION_PATH_ENV, h as DEFAULT_CLOUDFLARE_API_BASE_URL, d as DEFAULT_EMBEDDING_MODEL, g as DEFAULT_INDEX_DESCRIPTION, f as DEFAULT_INLINE_TEXT_MAX_BYTES, m as DEFAULT_STORAGE_MODE, p as DEFAULT_VECTORIZE_METRIC, n as PLUGIN_DESCRIPTION, e as PLUGIN_ID, t as PLUGIN_NAME, _ as RESERVED_METADATA_KEYS, l as STORAGE_MODE_ENV, a as VECTORIZE_INDEX_ENV, o as VECTORIZE_NAMESPACE_ENV, c as VECTORIZE_TOP_K_ENV, s as WORKERS_AI_MODEL_ENV };
13
+ export { r as CLI_ROOT_COMMAND, i as CLOUDFLARE_ACCOUNT_ID_ENV, a as CLOUDFLARE_API_TOKEN_ENV, d as COMPANION_PATH_ENV, g as DEFAULT_CLOUDFLARE_API_BASE_URL, f as DEFAULT_EMBEDDING_MODEL, _ as DEFAULT_INDEX_DESCRIPTION, p as DEFAULT_INLINE_TEXT_MAX_BYTES, h as DEFAULT_STORAGE_MODE, m as DEFAULT_VECTORIZE_METRIC, n as PLUGIN_DESCRIPTION, e as PLUGIN_ID, t as PLUGIN_NAME, v as RESERVED_METADATA_KEYS, u as STORAGE_MODE_ENV, o as VECTORIZE_INDEX_ENV, s as VECTORIZE_NAMESPACE_ENV, l as VECTORIZE_TOP_K_ENV, c as WORKERS_AI_MODEL_ENV };
14
14
 
15
15
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import type { StorageMode, VectorizeMetric } from \"./types.js\";\n\nexport const PLUGIN_ID = \"memory-cloudflare-vectorize\";\nexport const PLUGIN_NAME = \"Cloudflare Vectorize Memory\";\nexport const PLUGIN_DESCRIPTION = \"OpenClaw memory plugin backed by Cloudflare Vectorize and Workers AI embeddings.\";\n\nexport const CLOUDFLARE_ACCOUNT_ID_ENV = \"CLOUDFLARE_ACCOUNT_ID\";\nexport const CLOUDFLARE_API_TOKEN_ENV = \"CLOUDFLARE_API_TOKEN\";\nexport const VECTORIZE_INDEX_ENV = \"CLOUDFLARE_VECTORIZE_INDEX_NAME\";\nexport const VECTORIZE_NAMESPACE_ENV = \"CLOUDFLARE_VECTORIZE_NAMESPACE\";\nexport const WORKERS_AI_MODEL_ENV = \"CLOUDFLARE_WORKERS_AI_EMBEDDING_MODEL\";\nexport const VECTORIZE_TOP_K_ENV = \"CLOUDFLARE_VECTORIZE_TOP_K\";\nexport const STORAGE_MODE_ENV = \"OPENCLAW_CF_MEMORY_STORAGE_MODE\";\nexport const COMPANION_PATH_ENV = \"OPENCLAW_CF_MEMORY_COMPANION_PATH\";\n\nexport const DEFAULT_EMBEDDING_MODEL = \"@cf/baai/bge-base-en-v1.5\";\nexport const DEFAULT_TOP_K = 5;\nexport const DEFAULT_MIN_SCORE = 0;\nexport const DEFAULT_INLINE_TEXT_MAX_BYTES = 6_000;\nexport const DEFAULT_VECTORIZE_METRIC: VectorizeMetric = \"cosine\";\nexport const DEFAULT_STORAGE_MODE: StorageMode = \"vectorize-inline\";\nexport const DEFAULT_CLOUDFLARE_API_BASE_URL = \"https://api.cloudflare.com/client/v4\";\nexport const DEFAULT_INDEX_DESCRIPTION = \"OpenClaw memory index backed by Cloudflare Vectorize.\";\n\nexport const RESERVED_METADATA_PREFIX = \"oc_\";\nexport const RESERVED_METADATA_KEYS = {\n\tlogicalId: \"oc_record_id\",\n\ttitle: \"oc_title\",\n\ttext: \"oc_text\",\n\tstorageMode: \"oc_storage_mode\",\n\tpointer: \"oc_pointer\",\n\tsource: \"oc_source\",\n\tcreatedAt: \"oc_created_at\",\n\tupdatedAt: \"oc_updated_at\",\n} as const;\n"],"mappings":";AAEA,IAAa,IAAY,+BACZ,IAAc,+BACd,IAAqB,oFAErB,IAA4B,yBAC5B,IAA2B,wBAC3B,IAAsB,mCACtB,IAA0B,kCAC1B,IAAuB,yCACvB,IAAsB,8BACtB,IAAmB,mCACnB,IAAqB,qCAErB,IAA0B,6BAG1B,IAAgC,KAChC,IAA4C,UAC5C,IAAoC,oBACpC,IAAkC,wCAClC,IAA4B,yDAG5B,IAAyB;CACrC,WAAW;CACX,OAAO;CACP,MAAM;CACN,aAAa;CACb,SAAS;CACT,QAAQ;CACR,WAAW;CACX,WAAW;CACX"}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import type { StorageMode, VectorizeMetric } from \"./types.js\";\n\nexport const PLUGIN_ID = \"memory-cloudflare-vectorize\";\nexport const PLUGIN_NAME = \"Cloudflare Vectorize Memory\";\nexport const PLUGIN_DESCRIPTION = \"OpenClaw memory plugin backed by Cloudflare Vectorize and Workers AI embeddings.\";\nexport const CLI_ROOT_COMMAND = \"cf-memory\";\n\nexport const CLOUDFLARE_ACCOUNT_ID_ENV = \"CLOUDFLARE_ACCOUNT_ID\";\nexport const CLOUDFLARE_API_TOKEN_ENV = \"CLOUDFLARE_API_TOKEN\";\nexport const VECTORIZE_INDEX_ENV = \"CLOUDFLARE_VECTORIZE_INDEX_NAME\";\nexport const VECTORIZE_NAMESPACE_ENV = \"CLOUDFLARE_VECTORIZE_NAMESPACE\";\nexport const WORKERS_AI_MODEL_ENV = \"CLOUDFLARE_WORKERS_AI_EMBEDDING_MODEL\";\nexport const VECTORIZE_TOP_K_ENV = \"CLOUDFLARE_VECTORIZE_TOP_K\";\nexport const STORAGE_MODE_ENV = \"OPENCLAW_CF_MEMORY_STORAGE_MODE\";\nexport const COMPANION_PATH_ENV = \"OPENCLAW_CF_MEMORY_COMPANION_PATH\";\n\nexport const DEFAULT_EMBEDDING_MODEL = \"@cf/baai/bge-base-en-v1.5\";\nexport const DEFAULT_TOP_K = 5;\nexport const DEFAULT_MIN_SCORE = 0;\nexport const DEFAULT_INLINE_TEXT_MAX_BYTES = 6_000;\nexport const DEFAULT_VECTORIZE_METRIC: VectorizeMetric = \"cosine\";\nexport const DEFAULT_STORAGE_MODE: StorageMode = \"vectorize-inline\";\nexport const DEFAULT_CLOUDFLARE_API_BASE_URL = \"https://api.cloudflare.com/client/v4\";\nexport const DEFAULT_INDEX_DESCRIPTION = \"OpenClaw memory index backed by Cloudflare Vectorize.\";\n\nexport const RESERVED_METADATA_PREFIX = \"oc_\";\nexport const RESERVED_METADATA_KEYS = {\n\tlogicalId: \"oc_record_id\",\n\ttitle: \"oc_title\",\n\ttext: \"oc_text\",\n\tstorageMode: \"oc_storage_mode\",\n\tpointer: \"oc_pointer\",\n\tsource: \"oc_source\",\n\tcreatedAt: \"oc_created_at\",\n\tupdatedAt: \"oc_updated_at\",\n} as const;\n"],"mappings":";AAEA,IAAa,IAAY,+BACZ,IAAc,+BACd,IAAqB,oFACrB,IAAmB,aAEnB,IAA4B,yBAC5B,IAA2B,wBAC3B,IAAsB,mCACtB,IAA0B,kCAC1B,IAAuB,yCACvB,IAAsB,8BACtB,IAAmB,mCACnB,IAAqB,qCAErB,IAA0B,6BAG1B,IAAgC,KAChC,IAA4C,UAC5C,IAAoC,oBACpC,IAAkC,wCAClC,IAA4B,yDAG5B,IAAyB;CACrC,WAAW;CACX,OAAO;CACP,MAAM;CACN,aAAa;CACb,SAAS;CACT,QAAQ;CACR,WAAW;CACX,WAAW;CACX"}
package/dist/index.js CHANGED
@@ -1,25 +1,25 @@
1
- import { DEFAULT_EMBEDDING_MODEL as e, PLUGIN_DESCRIPTION as t, PLUGIN_ID as n, PLUGIN_NAME as r } from "./constants.js";
2
- import { getPluginConfigFromOpenClawConfig as i, pluginConfigSchema as a, resolvePluginConfig as o } from "./config.js";
3
- import { CloudflareMemoryService as s } from "./service.js";
4
- import { registerCloudflareMemoryCli as c } from "./cli.js";
5
- import { buildPromptSection as l } from "./prompt.js";
6
- import { createPublicArtifactsProvider as u } from "./public-artifacts.js";
7
- import { createMemoryRuntime as d } from "./runtime.js";
8
- import { createDeleteTool as f, createGetTool as p, createSearchTool as m, createUpsertTool as h } from "./tools.js";
9
- import { definePluginEntry as g } from "openclaw/plugin-sdk/plugin-entry";
1
+ import { CLI_ROOT_COMMAND as e, DEFAULT_EMBEDDING_MODEL as t, PLUGIN_DESCRIPTION as n, PLUGIN_ID as r, PLUGIN_NAME as i } from "./constants.js";
2
+ import { getPluginConfigFromOpenClawConfig as a, pluginConfigSchema as o, resolvePluginConfig as s } from "./config.js";
3
+ import { CloudflareMemoryService as c } from "./service.js";
4
+ import { registerCloudflareMemoryCli as l } from "./cli.js";
5
+ import { buildPromptSection as u } from "./prompt.js";
6
+ import { createPublicArtifactsProvider as d } from "./public-artifacts.js";
7
+ import { createMemoryRuntime as f } from "./runtime.js";
8
+ import { createDeleteTool as p, createGetTool as m, createSearchTool as h, createUpsertTool as g } from "./tools.js";
9
+ import { definePluginEntry as _ } from "openclaw/plugin-sdk/plugin-entry";
10
10
  //#region src/index.ts
11
- function _() {
11
+ function v() {
12
12
  return {
13
13
  id: "cloudflare-workers-ai",
14
- defaultModel: e,
14
+ defaultModel: t,
15
15
  transport: "remote",
16
16
  allowExplicitWhenConfiguredAuto: !0,
17
17
  async create(e) {
18
- let t = await o({
19
- pluginConfig: i(e.config),
18
+ let t = await s({
19
+ pluginConfig: a(e.config),
20
20
  openClawConfig: e.config,
21
21
  env: process.env
22
- }), n = new s({
22
+ }), n = new c({
23
23
  ...t,
24
24
  model: e.model || t.model,
25
25
  workersAiBaseUrl: e.remote?.baseUrl && e.remote.baseUrl.trim().length > 0 ? e.remote.baseUrl : t.workersAiBaseUrl,
@@ -43,47 +43,43 @@ function _() {
43
43
  }
44
44
  };
45
45
  }
46
- function v(e) {
47
- e.registerCli(({ program: t }) => {
48
- c(t, {
49
- pluginConfig: e.pluginConfig,
50
- openClawConfig: e.config,
51
- resolvePath: e.resolvePath
46
+ function y(t) {
47
+ t.registerCli(({ program: e }) => {
48
+ l(e, {
49
+ pluginConfig: t.pluginConfig,
50
+ openClawConfig: t.config,
51
+ resolvePath: t.resolvePath
52
52
  });
53
- }, { descriptors: [{
54
- name: "cf-memory",
55
- description: "Manage Cloudflare Vectorize memory",
56
- hasSubcommands: !0
57
- }] });
53
+ }, { commands: [e] });
58
54
  }
59
- var y = g({
60
- id: n,
61
- name: r,
62
- description: t,
55
+ var b = _({
56
+ id: r,
57
+ name: i,
58
+ description: n,
63
59
  kind: "memory",
64
- configSchema: a,
60
+ configSchema: o,
65
61
  register(e) {
66
- a.parse?.(e.pluginConfig ?? {}), v(e), !(e.registrationMode === "cli-metadata" || typeof e.registerMemoryEmbeddingProvider != "function" || typeof e.registerMemoryCapability != "function" || typeof e.registerTool != "function") && (e.registerMemoryEmbeddingProvider(_()), e.registerMemoryCapability({
67
- promptBuilder: l,
68
- runtime: d({
62
+ o.parse?.(e.pluginConfig ?? {}), y(e), !(e.registrationMode === "cli-metadata" || typeof e.registerMemoryEmbeddingProvider != "function" || typeof e.registerMemoryCapability != "function" || typeof e.registerTool != "function") && (e.registerMemoryEmbeddingProvider(v()), e.registerMemoryCapability({
63
+ promptBuilder: u,
64
+ runtime: f({
69
65
  pluginConfig: e.pluginConfig,
70
66
  resolvePath: e.resolvePath
71
67
  }),
72
- publicArtifacts: u(e.pluginConfig, e.resolvePath)
73
- }), e.registerTool((t) => m(e.pluginConfig, t), { names: ["cloudflare_memory_search"] }), e.registerTool((t) => p(e.pluginConfig, t), { names: ["cloudflare_memory_get"] }), e.registerTool((t) => h(e.pluginConfig, t), { names: ["cloudflare_memory_upsert"] }), e.registerTool((t) => f(e.pluginConfig, t), { names: ["cloudflare_memory_delete"] }), o({
68
+ publicArtifacts: d(e.pluginConfig, e.resolvePath)
69
+ }), e.registerTool((t) => h(e.pluginConfig, t), { names: ["cloudflare_memory_search"] }), e.registerTool((t) => m(e.pluginConfig, t), { names: ["cloudflare_memory_get"] }), e.registerTool((t) => g(e.pluginConfig, t), { names: ["cloudflare_memory_upsert"] }), e.registerTool((t) => p(e.pluginConfig, t), { names: ["cloudflare_memory_delete"] }), s({
74
70
  pluginConfig: e.pluginConfig,
75
71
  openClawConfig: e.config,
76
72
  env: process.env,
77
73
  resolvePath: e.resolvePath
78
74
  }).then((t) => {
79
- e.logger.info(`${n}: registered for index ${t.indexName} using model ${t.model}.`);
75
+ e.logger.info(`${r}: registered for index ${t.indexName} using model ${t.model}.`);
80
76
  }).catch((t) => {
81
- let r = t instanceof Error ? t.message : "Unknown configuration error.";
82
- e.logger.warn(`${n}: deferred config validation reported: ${r}`);
77
+ let n = t instanceof Error ? t.message : "Unknown configuration error.";
78
+ e.logger.warn(`${r}: deferred config validation reported: ${n}`);
83
79
  }));
84
80
  }
85
81
  });
86
82
  //#endregion
87
- export { y as default };
83
+ export { b as default };
88
84
 
89
85
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { MemoryEmbeddingProviderAdapter } from \"openclaw/plugin-sdk/memory-core-host-engine-embeddings\";\nimport { definePluginEntry, type OpenClawPluginApi } from \"openclaw/plugin-sdk/plugin-entry\";\nimport { registerCloudflareMemoryCli } from \"./cli.js\";\nimport { getPluginConfigFromOpenClawConfig, pluginConfigSchema, resolvePluginConfig } from \"./config.js\";\nimport { DEFAULT_EMBEDDING_MODEL, PLUGIN_DESCRIPTION, PLUGIN_ID, PLUGIN_NAME } from \"./constants.js\";\nimport { buildPromptSection } from \"./prompt.js\";\nimport { createPublicArtifactsProvider } from \"./public-artifacts.js\";\nimport { createMemoryRuntime } from \"./runtime.js\";\nimport { CloudflareMemoryService } from \"./service.js\";\nimport { createDeleteTool, createGetTool, createSearchTool, createUpsertTool } from \"./tools.js\";\n\nfunction createMemoryEmbeddingProviderAdapter(): MemoryEmbeddingProviderAdapter {\n\treturn {\n\t\tid: \"cloudflare-workers-ai\",\n\t\tdefaultModel: DEFAULT_EMBEDDING_MODEL,\n\t\ttransport: \"remote\",\n\t\tallowExplicitWhenConfiguredAuto: true,\n\t\tasync create(options) {\n\t\t\tconst pluginConfig = getPluginConfigFromOpenClawConfig(options.config);\n\t\t\tconst resolved = await resolvePluginConfig({\n\t\t\t\tpluginConfig,\n\t\t\t\topenClawConfig: options.config,\n\t\t\t\tenv: process.env,\n\t\t\t});\n\t\t\tconst service = new CloudflareMemoryService(\n\t\t\t\t{\n\t\t\t\t\t...resolved,\n\t\t\t\t\tmodel: options.model || resolved.model,\n\t\t\t\t\tworkersAiBaseUrl: options.remote?.baseUrl && options.remote.baseUrl.trim().length > 0 ? options.remote.baseUrl : resolved.workersAiBaseUrl,\n\t\t\t\t\tapiToken: typeof options.remote?.apiKey === \"string\" && options.remote.apiKey.trim().length > 0 ? options.remote.apiKey : resolved.apiToken,\n\t\t\t\t},\n\t\t\t\toptions.config,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tprovider: {\n\t\t\t\t\tid: \"cloudflare-workers-ai\",\n\t\t\t\t\tmodel: options.model || resolved.model,\n\t\t\t\t\tembedQuery: (text) => service.embeddings.embedQuery(text),\n\t\t\t\t\tembedBatch: (texts) => service.embeddings.embedBatch(texts),\n\t\t\t\t},\n\t\t\t\truntime: {\n\t\t\t\t\tid: \"cloudflare-workers-ai\",\n\t\t\t\t\tcacheKeyData: {\n\t\t\t\t\t\taccountId: resolved.accountId,\n\t\t\t\t\t\tmodel: options.model || resolved.model,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n\nfunction registerCloudflareMemoryCliEntry(api: Pick<OpenClawPluginApi, \"registerCli\" | \"pluginConfig\" | \"config\" | \"resolvePath\">): void {\n\tapi.registerCli(\n\t\t({ program }) => {\n\t\t\tregisterCloudflareMemoryCli(program, {\n\t\t\t\tpluginConfig: api.pluginConfig,\n\t\t\t\topenClawConfig: api.config,\n\t\t\t\tresolvePath: api.resolvePath,\n\t\t\t});\n\t\t},\n\t\t{\n\t\t\tdescriptors: [\n\t\t\t\t{\n\t\t\t\t\tname: \"cf-memory\",\n\t\t\t\t\tdescription: \"Manage Cloudflare Vectorize memory\",\n\t\t\t\t\thasSubcommands: true,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t);\n}\n\nexport default definePluginEntry({\n\tid: PLUGIN_ID,\n\tname: PLUGIN_NAME,\n\tdescription: PLUGIN_DESCRIPTION,\n\tkind: \"memory\",\n\tconfigSchema: pluginConfigSchema,\n\tregister(api: OpenClawPluginApi) {\n\t\tpluginConfigSchema.parse?.(api.pluginConfig ?? {});\n\n\t\tregisterCloudflareMemoryCliEntry(api);\n\n\t\tif (\n\t\t\tapi.registrationMode === \"cli-metadata\" ||\n\t\t\ttypeof api.registerMemoryEmbeddingProvider !== \"function\" ||\n\t\t\ttypeof api.registerMemoryCapability !== \"function\" ||\n\t\t\ttypeof api.registerTool !== \"function\"\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tapi.registerMemoryEmbeddingProvider(createMemoryEmbeddingProviderAdapter());\n\t\tapi.registerMemoryCapability({\n\t\t\tpromptBuilder: buildPromptSection,\n\t\t\truntime: createMemoryRuntime({\n\t\t\t\tpluginConfig: api.pluginConfig,\n\t\t\t\tresolvePath: api.resolvePath,\n\t\t\t}),\n\t\t\tpublicArtifacts: createPublicArtifactsProvider(api.pluginConfig, api.resolvePath),\n\t\t});\n\n\t\tapi.registerTool((ctx) => createSearchTool(api.pluginConfig, ctx), {\n\t\t\tnames: [\"cloudflare_memory_search\"],\n\t\t});\n\t\tapi.registerTool((ctx) => createGetTool(api.pluginConfig, ctx), {\n\t\t\tnames: [\"cloudflare_memory_get\"],\n\t\t});\n\t\tapi.registerTool((ctx) => createUpsertTool(api.pluginConfig, ctx), {\n\t\t\tnames: [\"cloudflare_memory_upsert\"],\n\t\t});\n\t\tapi.registerTool((ctx) => createDeleteTool(api.pluginConfig, ctx), {\n\t\t\tnames: [\"cloudflare_memory_delete\"],\n\t\t});\n\n\t\tvoid resolvePluginConfig({\n\t\t\tpluginConfig: api.pluginConfig,\n\t\t\topenClawConfig: api.config,\n\t\t\tenv: process.env,\n\t\t\tresolvePath: api.resolvePath,\n\t\t})\n\t\t\t.then((resolved) => {\n\t\t\t\tapi.logger.info(`${PLUGIN_ID}: registered for index ${resolved.indexName} using model ${resolved.model}.`);\n\t\t\t})\n\t\t\t.catch((error: unknown) => {\n\t\t\t\tconst message = error instanceof Error ? error.message : \"Unknown configuration error.\";\n\t\t\t\tapi.logger.warn(`${PLUGIN_ID}: deferred config validation reported: ${message}`);\n\t\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;AAWA,SAAS,IAAuE;AAC/E,QAAO;EACN,IAAI;EACJ,cAAc;EACd,WAAW;EACX,iCAAiC;EACjC,MAAM,OAAO,GAAS;GAErB,IAAM,IAAW,MAAM,EAAoB;IAC1C,cAFoB,EAAkC,EAAQ,OAAO;IAGrE,gBAAgB,EAAQ;IACxB,KAAK,QAAQ;IACb,CAAC,EACI,IAAU,IAAI,EACnB;IACC,GAAG;IACH,OAAO,EAAQ,SAAS,EAAS;IACjC,kBAAkB,EAAQ,QAAQ,WAAW,EAAQ,OAAO,QAAQ,MAAM,CAAC,SAAS,IAAI,EAAQ,OAAO,UAAU,EAAS;IAC1H,UAAU,OAAO,EAAQ,QAAQ,UAAW,YAAY,EAAQ,OAAO,OAAO,MAAM,CAAC,SAAS,IAAI,EAAQ,OAAO,SAAS,EAAS;IACnI,EACD,EAAQ,OACR;AACD,UAAO;IACN,UAAU;KACT,IAAI;KACJ,OAAO,EAAQ,SAAS,EAAS;KACjC,aAAa,MAAS,EAAQ,WAAW,WAAW,EAAK;KACzD,aAAa,MAAU,EAAQ,WAAW,WAAW,EAAM;KAC3D;IACD,SAAS;KACR,IAAI;KACJ,cAAc;MACb,WAAW,EAAS;MACpB,OAAO,EAAQ,SAAS,EAAS;MACjC;KACD;IACD;;EAEF;;AAGF,SAAS,EAAiC,GAA+F;AACxI,GAAI,aACF,EAAE,iBAAc;AAChB,IAA4B,GAAS;GACpC,cAAc,EAAI;GAClB,gBAAgB,EAAI;GACpB,aAAa,EAAI;GACjB,CAAC;IAEH,EACC,aAAa,CACZ;EACC,MAAM;EACN,aAAa;EACb,gBAAgB;EA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":["../src/index.ts"],"sourcesContent":["import type { MemoryEmbeddingProviderAdapter } from \"openclaw/plugin-sdk/memory-core-host-engine-embeddings\";\nimport { definePluginEntry, type OpenClawPluginApi } from \"openclaw/plugin-sdk/plugin-entry\";\nimport { registerCloudflareMemoryCli } from \"./cli.js\";\nimport { getPluginConfigFromOpenClawConfig, pluginConfigSchema, resolvePluginConfig } from \"./config.js\";\nimport { CLI_ROOT_COMMAND, DEFAULT_EMBEDDING_MODEL, PLUGIN_DESCRIPTION, PLUGIN_ID, PLUGIN_NAME } from \"./constants.js\";\nimport { buildPromptSection } from \"./prompt.js\";\nimport { createPublicArtifactsProvider } from \"./public-artifacts.js\";\nimport { createMemoryRuntime } from \"./runtime.js\";\nimport { CloudflareMemoryService } from \"./service.js\";\nimport { createDeleteTool, createGetTool, createSearchTool, createUpsertTool } from \"./tools.js\";\n\nfunction createMemoryEmbeddingProviderAdapter(): MemoryEmbeddingProviderAdapter {\n\treturn {\n\t\tid: \"cloudflare-workers-ai\",\n\t\tdefaultModel: DEFAULT_EMBEDDING_MODEL,\n\t\ttransport: \"remote\",\n\t\tallowExplicitWhenConfiguredAuto: true,\n\t\tasync create(options) {\n\t\t\tconst pluginConfig = getPluginConfigFromOpenClawConfig(options.config);\n\t\t\tconst resolved = await resolvePluginConfig({\n\t\t\t\tpluginConfig,\n\t\t\t\topenClawConfig: options.config,\n\t\t\t\tenv: process.env,\n\t\t\t});\n\t\t\tconst service = new CloudflareMemoryService(\n\t\t\t\t{\n\t\t\t\t\t...resolved,\n\t\t\t\t\tmodel: options.model || resolved.model,\n\t\t\t\t\tworkersAiBaseUrl: options.remote?.baseUrl && options.remote.baseUrl.trim().length > 0 ? options.remote.baseUrl : resolved.workersAiBaseUrl,\n\t\t\t\t\tapiToken: typeof options.remote?.apiKey === \"string\" && options.remote.apiKey.trim().length > 0 ? options.remote.apiKey : resolved.apiToken,\n\t\t\t\t},\n\t\t\t\toptions.config,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tprovider: {\n\t\t\t\t\tid: \"cloudflare-workers-ai\",\n\t\t\t\t\tmodel: options.model || resolved.model,\n\t\t\t\t\tembedQuery: (text) => service.embeddings.embedQuery(text),\n\t\t\t\t\tembedBatch: (texts) => service.embeddings.embedBatch(texts),\n\t\t\t\t},\n\t\t\t\truntime: {\n\t\t\t\t\tid: \"cloudflare-workers-ai\",\n\t\t\t\t\tcacheKeyData: {\n\t\t\t\t\t\taccountId: resolved.accountId,\n\t\t\t\t\t\tmodel: options.model || resolved.model,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n\nfunction registerCloudflareMemoryCliEntry(api: Pick<OpenClawPluginApi, \"registerCli\" | \"pluginConfig\" | \"config\" | \"resolvePath\">): void {\n\tapi.registerCli(\n\t\t({ program }) => {\n\t\t\tregisterCloudflareMemoryCli(program, {\n\t\t\t\tpluginConfig: api.pluginConfig,\n\t\t\t\topenClawConfig: api.config,\n\t\t\t\tresolvePath: api.resolvePath,\n\t\t\t});\n\t\t},\n\t\t{\n\t\t\tcommands: [CLI_ROOT_COMMAND],\n\t\t},\n\t);\n}\n\nexport default definePluginEntry({\n\tid: PLUGIN_ID,\n\tname: PLUGIN_NAME,\n\tdescription: PLUGIN_DESCRIPTION,\n\tkind: \"memory\",\n\tconfigSchema: pluginConfigSchema,\n\tregister(api: OpenClawPluginApi) {\n\t\tpluginConfigSchema.parse?.(api.pluginConfig ?? {});\n\n\t\tregisterCloudflareMemoryCliEntry(api);\n\n\t\tif (\n\t\t\tapi.registrationMode === \"cli-metadata\" ||\n\t\t\ttypeof api.registerMemoryEmbeddingProvider !== \"function\" ||\n\t\t\ttypeof api.registerMemoryCapability !== \"function\" ||\n\t\t\ttypeof api.registerTool !== \"function\"\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tapi.registerMemoryEmbeddingProvider(createMemoryEmbeddingProviderAdapter());\n\t\tapi.registerMemoryCapability({\n\t\t\tpromptBuilder: buildPromptSection,\n\t\t\truntime: createMemoryRuntime({\n\t\t\t\tpluginConfig: api.pluginConfig,\n\t\t\t\tresolvePath: api.resolvePath,\n\t\t\t}),\n\t\t\tpublicArtifacts: createPublicArtifactsProvider(api.pluginConfig, api.resolvePath),\n\t\t});\n\n\t\tapi.registerTool((ctx) => createSearchTool(api.pluginConfig, ctx), {\n\t\t\tnames: [\"cloudflare_memory_search\"],\n\t\t});\n\t\tapi.registerTool((ctx) => createGetTool(api.pluginConfig, ctx), {\n\t\t\tnames: [\"cloudflare_memory_get\"],\n\t\t});\n\t\tapi.registerTool((ctx) => createUpsertTool(api.pluginConfig, ctx), {\n\t\t\tnames: [\"cloudflare_memory_upsert\"],\n\t\t});\n\t\tapi.registerTool((ctx) => createDeleteTool(api.pluginConfig, ctx), {\n\t\t\tnames: [\"cloudflare_memory_delete\"],\n\t\t});\n\n\t\tvoid resolvePluginConfig({\n\t\t\tpluginConfig: api.pluginConfig,\n\t\t\topenClawConfig: api.config,\n\t\t\tenv: process.env,\n\t\t\tresolvePath: api.resolvePath,\n\t\t})\n\t\t\t.then((resolved) => {\n\t\t\t\tapi.logger.info(`${PLUGIN_ID}: registered for index ${resolved.indexName} using model ${resolved.model}.`);\n\t\t\t})\n\t\t\t.catch((error: unknown) => {\n\t\t\t\tconst message = error instanceof Error ? error.message : \"Unknown configuration error.\";\n\t\t\t\tapi.logger.warn(`${PLUGIN_ID}: deferred config validation reported: ${message}`);\n\t\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;AAWA,SAAS,IAAuE;AAC/E,QAAO;EACN,IAAI;EACJ,cAAc;EACd,WAAW;EACX,iCAAiC;EACjC,MAAM,OAAO,GAAS;GAErB,IAAM,IAAW,MAAM,EAAoB;IAC1C,cAFoB,EAAkC,EAAQ,OAAO;IAGrE,gBAAgB,EAAQ;IACxB,KAAK,QAAQ;IACb,CAAC,EACI,IAAU,IAAI,EACnB;IACC,GAAG;IACH,OAAO,EAAQ,SAAS,EAAS;IACjC,kBAAkB,EAAQ,Q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F,EAAI,cAAc,MAAQ,EAAc,EAAI,cAAc,EAAI,EAAE,EAC/D,OAAO,CAAC,wBAAwB,EAChC,CAAC,EACF,EAAI,cAAc,MAAQ,EAAiB,EAAI,cAAc,EAAI,EAAE,EAClE,OAAO,CAAC,2BAA2B,EACnC,CAAC,EACF,EAAI,cAAc,MAAQ,EAAiB,EAAI,cAAc,EAAI,EAAE,EAClE,OAAO,CAAC,2BAA2B,EACnC,CAAC,EAEG,EAAoB;GACxB,cAAc,EAAI;GAClB,gBAAgB,EAAI;GACpB,KAAK,QAAQ;GACb,aAAa,EAAI;GACjB,CAAC,CACA,MAAM,MAAa;AACnB,KAAI,OAAO,KAAK,GAAG,EAAU,yBAAyB,EAAS,UAAU,eAAe,EAAS,MAAM,GAAG;IACzG,CACD,OAAO,MAAmB;GAC1B,IAAM,IAAU,aAAiB,QAAQ,EAAM,UAAU;AACzD,KAAI,OAAO,KAAK,GAAG,EAAU,yCAAyC,IAAU;IAC/E;;CAEJ,CAAC"}
@@ -2,6 +2,7 @@ import type { StorageMode, VectorizeMetric } from "./types.js";
2
2
  export declare const PLUGIN_ID = "memory-cloudflare-vectorize";
3
3
  export declare const PLUGIN_NAME = "Cloudflare Vectorize Memory";
4
4
  export declare const PLUGIN_DESCRIPTION = "OpenClaw memory plugin backed by Cloudflare Vectorize and Workers AI embeddings.";
5
+ export declare const CLI_ROOT_COMMAND = "cf-memory";
5
6
  export declare const CLOUDFLARE_ACCOUNT_ID_ENV = "CLOUDFLARE_ACCOUNT_ID";
6
7
  export declare const CLOUDFLARE_API_TOKEN_ENV = "CLOUDFLARE_API_TOKEN";
7
8
  export declare const VECTORIZE_INDEX_ENV = "CLOUDFLARE_VECTORIZE_INDEX_NAME";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-cloudflare-vectorize-memory",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "OpenClaw memory plugin for Cloudflare Vectorize and Workers AI embeddings.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",