openclaw-penfield 1.1.1 → 1.1.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/src/hooks.d.ts.map +1 -1
- package/dist/src/hooks.js +16 -2
- package/package.json +1 -1
package/dist/src/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EAGlB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EAGlB,MAAM,YAAY,CAAC;AA8BpB,uFAAuF;AACvF,wBAAgB,eAAe,IAAI,IAAI,CAGtC;AAMD,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,iBAAiB,CAAC;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,aAAa,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9C,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAQvE"}
|
package/dist/src/hooks.js
CHANGED
|
@@ -24,6 +24,16 @@ const AWAKEN_MAX_CHARS = 30_000; // 30K char safety limit
|
|
|
24
24
|
const REFLECT_MAX_CHARS = 30_000; // 30K char safety limit
|
|
25
25
|
const REFLECT_CACHE_TTL_MS = 10 * 60 * 1000; // 10 minutes
|
|
26
26
|
const REFLECT_RECENT_LIMIT = 20;
|
|
27
|
+
const AUTH_WARNING_CONTEXT = [
|
|
28
|
+
"<penfield-action-required>",
|
|
29
|
+
"ACTION REQUIRED: The Penfield memory plugin is installed but NOT authenticated.",
|
|
30
|
+
"All Penfield tools are UNAVAILABLE until authenticated.",
|
|
31
|
+
"Immediately tell the user:",
|
|
32
|
+
" 1. Run: openclaw penfield login",
|
|
33
|
+
" 2. Restart the OpenClaw gateway",
|
|
34
|
+
"Do not wait for the user to ask. Inform them NOW at the start of this conversation.",
|
|
35
|
+
"</penfield-action-required>",
|
|
36
|
+
].join("\n");
|
|
27
37
|
// ---------------------------------------------------------------------------
|
|
28
38
|
// Module-level state
|
|
29
39
|
// ---------------------------------------------------------------------------
|
|
@@ -52,8 +62,8 @@ function registerBeforeAgentStartHook(api, config, ensureRuntime, logger) {
|
|
|
52
62
|
runtime = await ensureRuntime();
|
|
53
63
|
}
|
|
54
64
|
catch {
|
|
55
|
-
logger.debug?.("[penfield] runtime not ready,
|
|
56
|
-
return
|
|
65
|
+
logger.debug?.("[penfield] runtime not ready, injecting auth warning");
|
|
66
|
+
return { prependContext: AUTH_WARNING_CONTEXT };
|
|
57
67
|
}
|
|
58
68
|
// Fire awaken and reflect in parallel (both cached after first call)
|
|
59
69
|
const [briefing, recentContext] = await Promise.all([
|
|
@@ -68,6 +78,10 @@ function registerBeforeAgentStartHook(api, config, ensureRuntime, logger) {
|
|
|
68
78
|
parts.push(`<penfield-recent>\nRecent work context from Penfield:\n${recentContext}\n</penfield-recent>`);
|
|
69
79
|
}
|
|
70
80
|
if (parts.length === 0) {
|
|
81
|
+
// Both fetches returned null — if not authenticated, tell the agent
|
|
82
|
+
if (!runtime.authService.isAuthenticated()) {
|
|
83
|
+
return { prependContext: AUTH_WARNING_CONTEXT };
|
|
84
|
+
}
|
|
71
85
|
return undefined;
|
|
72
86
|
}
|
|
73
87
|
return { prependContext: parts.join("\n\n") };
|