memorylake-openclaw 1.0.2-beta.7 → 1.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.
- package/lib/hooks/auto-capture.ts +12 -0
- package/lib/hooks/auto-recall.ts +6 -4
- package/package.json +1 -1
- package/scripts/install.ps1 +11 -4
- package/scripts/install.sh +17 -5
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { PluginContext } from "../plugin-context";
|
|
2
2
|
import { getProvider } from "../provider";
|
|
3
3
|
import { buildAddOptions } from "../utils/builders";
|
|
4
|
+
import { MEMORYLAKE_REMINDER } from "./auto-recall";
|
|
5
|
+
|
|
6
|
+
function stripReminder(content: string): string {
|
|
7
|
+
if (content.includes(MEMORYLAKE_REMINDER)) {
|
|
8
|
+
return content.replace(MEMORYLAKE_REMINDER, "").trim();
|
|
9
|
+
}
|
|
10
|
+
return content;
|
|
11
|
+
}
|
|
4
12
|
|
|
5
13
|
export function registerAutoCapture(pctx: PluginContext): void {
|
|
6
14
|
const { api, resolveConfig } = pctx;
|
|
@@ -56,6 +64,10 @@ export function registerAutoCapture(pctx: PluginContext): void {
|
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
|
|
67
|
+
if (role === "user") {
|
|
68
|
+
textContent = stripReminder(textContent);
|
|
69
|
+
}
|
|
70
|
+
|
|
59
71
|
if (!textContent) continue;
|
|
60
72
|
|
|
61
73
|
formattedMessages.push({
|
package/lib/hooks/auto-recall.ts
CHANGED
|
@@ -4,6 +4,11 @@ import { getProvider } from "../provider";
|
|
|
4
4
|
|
|
5
5
|
const sessionIndustriesCache = new Map<string, OpenDataIndustry[]>();
|
|
6
6
|
|
|
7
|
+
export const MEMORYLAKE_REMINDER = [
|
|
8
|
+
`[MEMORYLAKE REMINDER] Before responding to this message, call \`retrieve_context\` first`,
|
|
9
|
+
`to fetch relevant memories and documents. Do not skip this step.`,
|
|
10
|
+
].join(" ");
|
|
11
|
+
|
|
7
12
|
export function registerAutoRecall(pctx: PluginContext): void {
|
|
8
13
|
const { api, resolveConfig } = pctx;
|
|
9
14
|
|
|
@@ -39,10 +44,7 @@ export function registerAutoRecall(pctx: PluginContext): void {
|
|
|
39
44
|
|
|
40
45
|
// Per-turn reminder injected right before the user's message.
|
|
41
46
|
// Survives long conversations because it is not buried in the system prompt.
|
|
42
|
-
result.prependContext =
|
|
43
|
-
`[MEMORYLAKE REMINDER] Before responding to this message, call \`retrieve_context\` first`,
|
|
44
|
-
`to fetch relevant memories and documents. Do not skip this step.`,
|
|
45
|
-
].join(" ");
|
|
47
|
+
result.prependContext = MEMORYLAKE_REMINDER;
|
|
46
48
|
|
|
47
49
|
const memoryDirectiveParts: string[] = [
|
|
48
50
|
`<memory-instructions>`,
|
package/package.json
CHANGED
package/scripts/install.ps1
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
param(
|
|
6
6
|
[string]$ApiKey = $env:MEMORYLAKE_API_KEY,
|
|
7
7
|
[string]$ProjectId = $env:MEMORYLAKE_PROJECT_ID,
|
|
8
|
+
[string]$MLHost = $env:MEMORYLAKE_HOST,
|
|
8
9
|
[switch]$Help
|
|
9
10
|
)
|
|
10
11
|
|
|
@@ -54,11 +55,13 @@ Usage:
|
|
|
54
55
|
Parameters:
|
|
55
56
|
-ApiKey <key> MemoryLake API key (required)
|
|
56
57
|
-ProjectId <id> MemoryLake project ID (required)
|
|
58
|
+
-MLHost <url> MemoryLake host URL (optional, defaults to https://app.memorylake.ai)
|
|
57
59
|
-Help Show this help
|
|
58
60
|
|
|
59
61
|
Environment variables:
|
|
60
62
|
MEMORYLAKE_API_KEY API key (alternative to -ApiKey)
|
|
61
63
|
MEMORYLAKE_PROJECT_ID Project ID (alternative to -ProjectId)
|
|
64
|
+
MEMORYLAKE_HOST Host URL (alternative to -MLHost)
|
|
62
65
|
NPM_REGISTRY Override npm registry (e.g. https://registry.npmmirror.com for China)
|
|
63
66
|
|
|
64
67
|
Get apiKey and projectId from https://app.memorylake.ai
|
|
@@ -346,12 +349,16 @@ function Write-Config {
|
|
|
346
349
|
$config.plugins | Add-Member -NotePropertyName "entries" -NotePropertyValue ([PSCustomObject]@{}) -Force
|
|
347
350
|
}
|
|
348
351
|
|
|
352
|
+
$pluginConfig = [PSCustomObject]@{
|
|
353
|
+
apiKey = $ApiKey
|
|
354
|
+
projectId = $ProjectId
|
|
355
|
+
}
|
|
356
|
+
if (-not [string]::IsNullOrWhiteSpace($MLHost)) {
|
|
357
|
+
$pluginConfig | Add-Member -NotePropertyName "host" -NotePropertyValue $MLHost -Force
|
|
358
|
+
}
|
|
349
359
|
$pluginEntry = [PSCustomObject]@{
|
|
350
360
|
enabled = $true
|
|
351
|
-
config =
|
|
352
|
-
apiKey = $ApiKey
|
|
353
|
-
projectId = $ProjectId
|
|
354
|
-
}
|
|
361
|
+
config = $pluginConfig
|
|
355
362
|
}
|
|
356
363
|
$config.plugins.entries | Add-Member -NotePropertyName "memorylake-openclaw" -NotePropertyValue $pluginEntry -Force
|
|
357
364
|
|
package/scripts/install.sh
CHANGED
|
@@ -46,11 +46,13 @@ Usage:
|
|
|
46
46
|
Options:
|
|
47
47
|
--api-key, -a <key> MemoryLake API key (required)
|
|
48
48
|
--project-id, -p <id> MemoryLake project ID (required)
|
|
49
|
+
--host <url> MemoryLake host URL (optional, defaults to https://app.memorylake.ai)
|
|
49
50
|
--help, -h Show this help
|
|
50
51
|
|
|
51
52
|
Environment variables:
|
|
52
53
|
MEMORYLAKE_API_KEY API key (alternative to --api-key)
|
|
53
54
|
MEMORYLAKE_PROJECT_ID Project ID (alternative to --project-id)
|
|
55
|
+
MEMORYLAKE_HOST Host URL (alternative to --host)
|
|
54
56
|
NPM_REGISTRY Override npm registry (e.g. https://registry.npmmirror.com for China)
|
|
55
57
|
|
|
56
58
|
Get apiKey and projectId from https://app.memorylake.ai
|
|
@@ -60,6 +62,7 @@ EOF
|
|
|
60
62
|
parse_args() {
|
|
61
63
|
API_KEY="${MEMORYLAKE_API_KEY:-}"
|
|
62
64
|
PROJECT_ID="${MEMORYLAKE_PROJECT_ID:-}"
|
|
65
|
+
HOST="${MEMORYLAKE_HOST:-}"
|
|
63
66
|
HELP=0
|
|
64
67
|
|
|
65
68
|
while [[ $# -gt 0 ]]; do
|
|
@@ -72,6 +75,10 @@ parse_args() {
|
|
|
72
75
|
PROJECT_ID="${2:-}"
|
|
73
76
|
shift 2
|
|
74
77
|
;;
|
|
78
|
+
--host)
|
|
79
|
+
HOST="${2:-}"
|
|
80
|
+
shift 2
|
|
81
|
+
;;
|
|
75
82
|
--help|-h)
|
|
76
83
|
HELP=1
|
|
77
84
|
shift
|
|
@@ -278,13 +285,14 @@ write_config() {
|
|
|
278
285
|
|
|
279
286
|
check_tools_profile "$config_path"
|
|
280
287
|
|
|
281
|
-
CONFIG_PATH="$config_path" API_KEY="$API_KEY" PROJECT_ID="$PROJECT_ID" CLAW_MODE="$CLAW_MODE" SET_TOOLS_PROFILE="$SET_TOOLS_PROFILE" python3 -c '
|
|
288
|
+
CONFIG_PATH="$config_path" API_KEY="$API_KEY" PROJECT_ID="$PROJECT_ID" HOST="$HOST" CLAW_MODE="$CLAW_MODE" SET_TOOLS_PROFILE="$SET_TOOLS_PROFILE" python3 -c '
|
|
282
289
|
import json
|
|
283
290
|
import os
|
|
284
291
|
|
|
285
292
|
path = os.environ["CONFIG_PATH"]
|
|
286
293
|
api_key = os.environ["API_KEY"]
|
|
287
294
|
project_id = os.environ["PROJECT_ID"]
|
|
295
|
+
host = os.environ.get("HOST", "")
|
|
288
296
|
claw_mode = os.environ.get("CLAW_MODE", "")
|
|
289
297
|
set_tools_profile = os.environ.get("SET_TOOLS_PROFILE", "")
|
|
290
298
|
|
|
@@ -298,12 +306,16 @@ if "plugins" not in config:
|
|
|
298
306
|
if "entries" not in config["plugins"]:
|
|
299
307
|
config["plugins"]["entries"] = {}
|
|
300
308
|
|
|
309
|
+
plugin_config = {
|
|
310
|
+
"apiKey": api_key,
|
|
311
|
+
"projectId": project_id
|
|
312
|
+
}
|
|
313
|
+
if host:
|
|
314
|
+
plugin_config["host"] = host
|
|
315
|
+
|
|
301
316
|
config["plugins"]["entries"]["memorylake-openclaw"] = {
|
|
302
317
|
"enabled": True,
|
|
303
|
-
"config":
|
|
304
|
-
"apiKey": api_key,
|
|
305
|
-
"projectId": project_id
|
|
306
|
-
}
|
|
318
|
+
"config": plugin_config
|
|
307
319
|
}
|
|
308
320
|
|
|
309
321
|
# Set tools profile if user approved (or no prior value existed)
|