@unblocklabs/unblock-memory 0.12.3 → 0.14.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/README.md +19 -18
- package/defaults.json +162 -0
- package/dist/src/analysis.js +1 -1
- package/dist/src/cluster-review.d.ts +2 -0
- package/dist/src/cluster-review.js +9 -8
- package/dist/src/config.d.ts +9 -6
- package/dist/src/config.js +59 -45
- package/dist/src/curation.d.ts +1 -1
- package/dist/src/decision-client.d.ts +45 -0
- package/dist/src/decision-client.js +87 -0
- package/dist/src/{typesafe.d.ts → decision-ranking.d.ts} +15 -18
- package/dist/src/decision-ranking.js +155 -0
- package/dist/src/{typesafe-review.d.ts → decision-review.d.ts} +13 -9
- package/dist/src/decision-review.js +193 -0
- package/dist/src/defaults.d.ts +8 -0
- package/dist/src/defaults.js +128 -0
- package/dist/src/diagnostics.d.ts +5 -5
- package/dist/src/emotion-baselines.d.ts +28 -3
- package/dist/src/emotion-baselines.js +312 -115
- package/dist/src/evidence-review.d.ts +22 -8
- package/dist/src/evidence-review.js +11 -8
- package/dist/src/extraction-chunk.d.ts +3 -0
- package/dist/src/extraction-chunk.js +25 -6
- package/dist/src/extraction-config.js +4 -2
- package/dist/src/extraction-model.d.ts +25 -17
- package/dist/src/extraction-model.js +232 -104
- package/dist/src/extraction-runtime.d.ts +3 -1
- package/dist/src/extraction-runtime.js +48 -20
- package/dist/src/extraction-source.d.ts +1 -1
- package/dist/src/extraction-source.js +21 -12
- package/dist/src/extraction-store.d.ts +29 -3
- package/dist/src/extraction-store.js +149 -25
- package/dist/src/extraction-worker.d.ts +3 -3
- package/dist/src/extraction-worker.js +250 -95
- package/dist/src/inside-out-runtime.js +43 -30
- package/dist/src/inside-out-sources.js +2 -1
- package/dist/src/inside-out-store.d.ts +2 -2
- package/dist/src/inside-out-store.js +111 -69
- package/dist/src/inside-out.d.ts +10 -9
- package/dist/src/inside-out.js +194 -106
- package/dist/src/manager.d.ts +22 -9
- package/dist/src/manager.js +279 -172
- package/dist/src/memory-database.js +3 -2
- package/dist/src/memory-passage.d.ts +2 -2
- package/dist/src/memory-passage.js +3 -2
- package/dist/src/memory-search.d.ts +4 -2
- package/dist/src/memory-search.js +5 -5
- package/dist/src/memory-whisperer.d.ts +1 -1
- package/dist/src/memory-whisperer.js +195 -129
- package/dist/src/my-turn.d.ts +1 -1
- package/dist/src/my-turn.js +90 -70
- package/dist/src/people-background.d.ts +5 -1
- package/dist/src/people-background.js +31 -7
- package/dist/src/people-dossier-review.d.ts +20 -8
- package/dist/src/people-dossier-review.js +15 -11
- package/dist/src/people-hooks.js +127 -22
- package/dist/src/people-learning-cron.d.ts +1 -1
- package/dist/src/people-learning-cron.js +107 -57
- package/dist/src/people-learning-inventory.d.ts +1 -0
- package/dist/src/people-learning-inventory.js +283 -172
- package/dist/src/people-learning-prompt.js +1 -1
- package/dist/src/people-learning-runtime.d.ts +1 -1
- package/dist/src/people-learning-runtime.js +360 -203
- package/dist/src/people-learning-store.d.ts +27 -4
- package/dist/src/people-learning-store.js +312 -96
- package/dist/src/people-primer-tool.js +13 -10
- package/dist/src/people-primer.d.ts +3 -1
- package/dist/src/people-primer.js +66 -48
- package/dist/src/people-store.d.ts +18 -21
- package/dist/src/people-store.js +188 -64
- package/dist/src/people-tools.js +138 -93
- package/dist/src/plugin.js +19 -18
- package/dist/src/quality-audit.d.ts +2 -0
- package/dist/src/quality-audit.js +11 -9
- package/dist/src/quality-triage.js +4 -3
- package/dist/src/query-generator.js +5 -2
- package/dist/src/response-audit.d.ts +1 -1
- package/dist/src/response-audit.js +78 -44
- package/dist/src/response-config.js +3 -1
- package/dist/src/response-episodes.d.ts +1 -1
- package/dist/src/response-episodes.js +15 -19
- package/dist/src/response-identity.js +2 -1
- package/dist/src/response-judge.d.ts +151 -145
- package/dist/src/response-judge.js +535 -204
- package/dist/src/response-memory.js +2 -1
- package/dist/src/response-outcome.js +9 -8
- package/dist/src/response-reviews.d.ts +29 -1
- package/dist/src/response-reviews.js +113 -15
- package/dist/src/response-runtime.js +10 -9
- package/dist/src/response-stages.d.ts +50 -53
- package/dist/src/response-stages.js +10 -4
- package/dist/src/response-store.d.ts +7 -6
- package/dist/src/response-store.js +335 -212
- package/dist/src/review-tools.d.ts +8 -2
- package/dist/src/review-tools.js +22 -21
- package/dist/src/runtime.d.ts +7 -4
- package/dist/src/runtime.js +625 -98
- package/dist/src/safety-config.js +3 -2
- package/dist/src/safety-whisperer.d.ts +2 -2
- package/dist/src/safety-whisperer.js +90 -73
- package/dist/src/session-sync.d.ts +3 -1
- package/dist/src/session-sync.js +202 -96
- package/dist/src/skill-whisperer.d.ts +2 -2
- package/dist/src/skill-whisperer.js +55 -32
- package/dist/src/slack-directory.js +3 -2
- package/dist/src/training-gate.d.ts +9 -22
- package/dist/src/training-gate.js +34 -36
- package/dist/src/training-input.js +4 -3
- package/dist/src/training-judge.d.ts +9 -16
- package/dist/src/training-judge.js +6 -5
- package/dist/src/training-models.d.ts +1 -1
- package/dist/src/training-models.js +9 -7
- package/dist/src/training-queries.d.ts +14 -9
- package/dist/src/training-queries.js +374 -231
- package/dist/src/training-retrieval.d.ts +17 -27
- package/dist/src/training-retrieval.js +186 -139
- package/dist/src/training-runtime.d.ts +3 -0
- package/dist/src/training-runtime.js +76 -18
- package/dist/src/training-store.d.ts +18 -3
- package/dist/src/training-store.js +141 -52
- package/dist/src/training.js +9 -11
- package/dist/src/whisperer-context.d.ts +13 -0
- package/dist/src/whisperer-context.js +22 -1
- package/docs/configuration.md +83 -64
- package/docs/extraction.md +26 -35
- package/docs/memory-training.md +7 -6
- package/docs/people-learning.md +2 -2
- package/docs/peoplesql.md +6 -6
- package/docs/response-audit.md +10 -8
- package/docs/retrieval.md +43 -47
- package/openclaw.plugin.json +76 -75
- package/package.json +5 -2
- package/skills/memory-curator/SKILL.md +1 -1
- package/skills/people-whisperer/SKILL.md +1 -1
- package/dist/src/typesafe-client.d.ts +0 -30
- package/dist/src/typesafe-client.js +0 -92
- package/dist/src/typesafe-review.js +0 -154
- package/dist/src/typesafe.js +0 -147
|
@@ -4,11 +4,13 @@ import type { QmdMemoryRuntime } from "./runtime.js";
|
|
|
4
4
|
import type { WhispererDiagnostics } from "./diagnostics.js";
|
|
5
5
|
import { getContext } from "./tool-context.js";
|
|
6
6
|
/** Bound initialization as well as inference, without cancelling shared managers. */
|
|
7
|
-
export declare function reviewRequestContext(runtime: QmdMemoryRuntime, active: NonNullable<ReturnType<typeof getContext>>,
|
|
7
|
+
export declare function reviewRequestContext(runtime: QmdMemoryRuntime, active: NonNullable<ReturnType<typeof getContext>>, decisionModel: UnblockMemoryConfig["decisionModel"], signal?: AbortSignal): Promise<{
|
|
8
8
|
readonly status: "unavailable";
|
|
9
|
-
readonly reason: "
|
|
9
|
+
readonly reason: "Decision model API key not configured";
|
|
10
10
|
readonly manager?: undefined;
|
|
11
11
|
readonly apiKey?: undefined;
|
|
12
|
+
readonly endpoint?: undefined;
|
|
13
|
+
readonly model?: undefined;
|
|
12
14
|
readonly signal?: undefined;
|
|
13
15
|
readonly timeoutMs?: undefined;
|
|
14
16
|
} | {
|
|
@@ -16,12 +18,16 @@ export declare function reviewRequestContext(runtime: QmdMemoryRuntime, active:
|
|
|
16
18
|
readonly reason: "Memory manager unavailable";
|
|
17
19
|
readonly manager?: undefined;
|
|
18
20
|
readonly apiKey?: undefined;
|
|
21
|
+
readonly endpoint?: undefined;
|
|
22
|
+
readonly model?: undefined;
|
|
19
23
|
readonly signal?: undefined;
|
|
20
24
|
readonly timeoutMs?: undefined;
|
|
21
25
|
} | {
|
|
22
26
|
readonly status: "ready";
|
|
23
27
|
readonly manager: import("./manager.js").QmdMemoryManager;
|
|
24
28
|
readonly apiKey: string;
|
|
29
|
+
readonly endpoint: string;
|
|
30
|
+
readonly model: string;
|
|
25
31
|
readonly signal: AbortSignal;
|
|
26
32
|
readonly timeoutMs: number;
|
|
27
33
|
reason?: undefined;
|
package/dist/src/review-tools.js
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
+
import { DEFAULTS } from "./defaults.js";
|
|
1
2
|
import { Type } from "typebox";
|
|
2
3
|
import { Value } from "typebox/value";
|
|
3
4
|
import { jsonResult } from "openclaw/plugin-sdk/agent-runtime";
|
|
4
5
|
import { getContext } from "./tool-context.js";
|
|
5
|
-
import {
|
|
6
|
+
import { resolveDecisionCredential } from "./decision-client.js";
|
|
6
7
|
import { safetyStatus } from "./safety-whisperer.js";
|
|
7
8
|
import { abortable } from "./abortable.js";
|
|
8
9
|
const claimParameters = Type.Object({
|
|
9
|
-
claim: Type.String({ pattern: "\\S", maxLength:
|
|
10
|
+
claim: Type.String({ pattern: "\\S", maxLength: DEFAULTS.review.maxClaimChars }),
|
|
10
11
|
citations: Type.Array(Type.Object({
|
|
11
12
|
path: Type.String({ pattern: "^qmd://", maxLength: 2000 }),
|
|
12
|
-
from: Type.Integer({ minimum: 1 }), lines: Type.Integer({ minimum: 1, maximum:
|
|
13
|
+
from: Type.Integer({ minimum: 1 }), lines: Type.Integer({ minimum: 1, maximum: DEFAULTS.review.maxCitationLines }),
|
|
13
14
|
}, { additionalProperties: false }), { minItems: 1, maxItems: 3 }),
|
|
14
15
|
}, { additionalProperties: false });
|
|
15
16
|
const clusterParameters = Type.Object({ clusterId: Type.String({ pattern: "^[0-9a-f]{10}$" }) }, { additionalProperties: false });
|
|
16
17
|
const noParameters = Type.Object({}, { additionalProperties: false });
|
|
17
18
|
/** Bound initialization as well as inference, without cancelling shared managers. */
|
|
18
|
-
export async function reviewRequestContext(runtime, active,
|
|
19
|
-
const deadline = AbortSignal.timeout(
|
|
19
|
+
export async function reviewRequestContext(runtime, active, decisionModel, signal) {
|
|
20
|
+
const deadline = AbortSignal.timeout(DEFAULTS.review.toolTimeoutMs);
|
|
20
21
|
const combined = signal ? AbortSignal.any([signal, deadline]) : deadline;
|
|
21
|
-
const apiKey = await abortable(
|
|
22
|
+
const apiKey = await abortable(resolveDecisionCredential(decisionModel), combined);
|
|
22
23
|
if (!apiKey)
|
|
23
|
-
return { status: "unavailable", reason: "
|
|
24
|
+
return { status: "unavailable", reason: "Decision model API key not configured" };
|
|
24
25
|
const { manager } = await abortable(runtime.getMemorySearchManager(active), combined);
|
|
25
26
|
if (!manager)
|
|
26
27
|
return { status: "unavailable", reason: "Memory manager unavailable" };
|
|
27
|
-
return { status: "ready", manager, apiKey, signal: combined, timeoutMs:
|
|
28
|
+
return { status: "ready", manager, apiKey, endpoint: decisionModel.endpoint, model: decisionModel.model, signal: combined, timeoutMs: decisionModel.timeoutMs };
|
|
28
29
|
}
|
|
29
30
|
export function registerReviewTools(api, runtime, config, diagnostics) {
|
|
30
31
|
api.registerTool(ctx => {
|
|
@@ -33,23 +34,23 @@ export function registerReviewTools(api, runtime, config, diagnostics) {
|
|
|
33
34
|
return null;
|
|
34
35
|
return {
|
|
35
36
|
name: "memory_diagnostics", label: "Memory Diagnostics",
|
|
36
|
-
description: "Read content-free manual-search and whisperer telemetry, configuration state, projection version and index readiness. Does not call
|
|
37
|
+
description: "Read content-free manual-search and whisperer telemetry, configuration state, projection version and index readiness. Does not call decision model.",
|
|
37
38
|
parameters: noParameters,
|
|
38
39
|
async execute(_id, params) {
|
|
39
40
|
Value.Parse(noParameters, params);
|
|
40
41
|
let credential = "disabled";
|
|
41
|
-
if (config.
|
|
42
|
+
if (config.decisionModel.enabled) {
|
|
42
43
|
try {
|
|
43
|
-
credential = await
|
|
44
|
+
credential = await resolveDecisionCredential(config.decisionModel) ? "available" : "missing";
|
|
44
45
|
}
|
|
45
46
|
catch {
|
|
46
47
|
credential = "unreadable";
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
const result = { status: "ok", credential,
|
|
50
|
-
enabled: { skill: config.skillWhisperer.enabled, memory: config.memoryWhisperer.enabled && config.
|
|
51
|
+
enabled: { skill: config.skillWhisperer.enabled, memory: config.memoryWhisperer.enabled && config.decisionModel.enabled,
|
|
51
52
|
complementaryHints: config.memoryWhisperer.complementaryHints, qualityAudit: config.qualityAudit.enabled, evidenceReview: config.evidenceReview.enabled,
|
|
52
|
-
safety: config.safetyWhisperer.enabled, myTurn: config.myTurn.enabled && config.
|
|
53
|
+
safety: config.safetyWhisperer.enabled, myTurn: config.myTurn.enabled && config.decisionModel.enabled },
|
|
53
54
|
safety: safetyStatus(api.config, config),
|
|
54
55
|
whisperers: diagnostics.snapshot(active.agentId) };
|
|
55
56
|
try {
|
|
@@ -68,18 +69,18 @@ export function registerReviewTools(api, runtime, config, diagnostics) {
|
|
|
68
69
|
return null;
|
|
69
70
|
return {
|
|
70
71
|
name: "memory_review_claim", label: "Review Memory Claim",
|
|
71
|
-
description: "Before a knowledge or dossier write, check one proposed atomic claim against cited indexed source lines.
|
|
72
|
+
description: "Before a knowledge or dossier write, check one proposed atomic claim against cited indexed source lines. decision model advisory only; does not write, authorize writes, or establish current truth. Requires evidenceReview approval for every cited corpus.",
|
|
72
73
|
parameters: claimParameters,
|
|
73
74
|
async execute(_id, params, signal) {
|
|
74
75
|
const parsed = Value.Parse(claimParameters, params);
|
|
75
|
-
if (!config.evidenceReview.enabled || !config.
|
|
76
|
+
if (!config.evidenceReview.enabled || !config.decisionModel.enabled)
|
|
76
77
|
return jsonResult({ status: "disabled" });
|
|
77
78
|
try {
|
|
78
|
-
const context = await reviewRequestContext(runtime, active, config.
|
|
79
|
+
const context = await reviewRequestContext(runtime, active, config.decisionModel, signal);
|
|
79
80
|
if (context.status !== "ready")
|
|
80
81
|
return jsonResult(context);
|
|
81
82
|
return jsonResult(await context.manager.reviewClaim({ ...parsed, corpora: config.evidenceReview.corpora,
|
|
82
|
-
apiKey: context.apiKey, timeoutMs: context.timeoutMs, signal: context.signal }));
|
|
83
|
+
apiKey: context.apiKey, endpoint: context.endpoint, model: context.model, timeoutMs: context.timeoutMs, signal: context.signal }));
|
|
83
84
|
}
|
|
84
85
|
catch {
|
|
85
86
|
return jsonResult({ status: "unavailable", needsReview: true, reason: "Claim review failed or was cancelled; no claim verified" });
|
|
@@ -93,18 +94,18 @@ export function registerReviewTools(api, runtime, config, diagnostics) {
|
|
|
93
94
|
return null;
|
|
94
95
|
return {
|
|
95
96
|
name: "memory_review_cluster", label: "Review Cluster Ingestion",
|
|
96
|
-
description: "Inspect up to six complete center/edge cluster members for recurring ingestion defects. Uses qualityAudit approved corpora and
|
|
97
|
+
description: "Inspect up to six complete center/edge cluster members for recurring ingestion defects. Uses qualityAudit approved corpora and decision model. Does not modify tasks, sources or clusters; findings apply only to sampled members.",
|
|
97
98
|
parameters: clusterParameters,
|
|
98
99
|
async execute(_id, params, signal) {
|
|
99
100
|
const parsed = Value.Parse(clusterParameters, params);
|
|
100
|
-
if (!config.qualityAudit.enabled || !config.
|
|
101
|
+
if (!config.qualityAudit.enabled || !config.decisionModel.enabled)
|
|
101
102
|
return jsonResult({ status: "disabled" });
|
|
102
103
|
try {
|
|
103
|
-
const context = await reviewRequestContext(runtime, active, config.
|
|
104
|
+
const context = await reviewRequestContext(runtime, active, config.decisionModel, signal);
|
|
104
105
|
if (context.status !== "ready")
|
|
105
106
|
return jsonResult(context);
|
|
106
107
|
return jsonResult(await context.manager.reviewCluster({ ...parsed, corpora: config.qualityAudit.corpora,
|
|
107
|
-
apiKey: context.apiKey, timeoutMs: context.timeoutMs, signal: context.signal }));
|
|
108
|
+
apiKey: context.apiKey, endpoint: context.endpoint, model: context.model, timeoutMs: context.timeoutMs, signal: context.signal }));
|
|
108
109
|
}
|
|
109
110
|
catch {
|
|
110
111
|
return jsonResult({ status: "unavailable", reason: "Cluster review failed or was cancelled; no cluster judgment made" });
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ type StoredRunningSessionSync = Extract<StoredSessionSyncStatus, {
|
|
|
38
38
|
}> & {
|
|
39
39
|
pid: number;
|
|
40
40
|
};
|
|
41
|
-
export declare function recoverInterruptedSessionSync(directory: string, statusPath: string, stale: StoredRunningSessionSync): Promise<SessionSyncStatus>;
|
|
41
|
+
export declare function recoverInterruptedSessionSync(directory: string, statusPath: string, stale: StoredRunningSessionSync, onError?: (error: unknown) => void): Promise<SessionSyncStatus>;
|
|
42
42
|
export declare class QmdMemoryRuntime implements MemoryPluginRuntimeContract {
|
|
43
43
|
#private;
|
|
44
44
|
startSessionSyncSchedule(cfg: OpenClawConfig, onError: (error: unknown) => void): void;
|
|
@@ -48,16 +48,17 @@ export declare class QmdMemoryRuntime implements MemoryPluginRuntimeContract {
|
|
|
48
48
|
keepEmbeddingModelWarm?: boolean;
|
|
49
49
|
stateRoot?: string;
|
|
50
50
|
extraction?: ExtractionConfig;
|
|
51
|
+
onError?: (error: unknown) => void;
|
|
51
52
|
});
|
|
52
53
|
getMemorySearchManager(params: {
|
|
53
54
|
cfg: OpenClawConfig;
|
|
54
55
|
agentId: string;
|
|
55
56
|
}): Promise<{
|
|
56
|
-
manager: QmdMemoryManager;
|
|
57
|
-
error?: undefined;
|
|
58
|
-
} | {
|
|
59
57
|
manager: null;
|
|
60
58
|
error: string;
|
|
59
|
+
} | {
|
|
60
|
+
manager: QmdMemoryManager;
|
|
61
|
+
error?: undefined;
|
|
61
62
|
}>;
|
|
62
63
|
resolveMemoryBackendConfig(): {
|
|
63
64
|
backend: "builtin";
|
|
@@ -68,10 +69,12 @@ export declare class QmdMemoryRuntime implements MemoryPluginRuntimeContract {
|
|
|
68
69
|
agentId: string;
|
|
69
70
|
}, force?: boolean): Promise<SessionSyncStartResult>;
|
|
70
71
|
sessionSyncStatus(agentId: string): Promise<SessionSyncStatus>;
|
|
72
|
+
prepareReload(change: Parameters<NonNullable<MemoryPluginRuntimeContract["prepareReload"]>>[0]): ReturnType<NonNullable<MemoryPluginRuntimeContract["prepareReload"]>>;
|
|
71
73
|
closeMemorySearchManager(params: {
|
|
72
74
|
agentId: string;
|
|
73
75
|
}): Promise<void>;
|
|
74
76
|
closeAllMemorySearchManagers(): Promise<void>;
|
|
77
|
+
close(): Promise<void>;
|
|
75
78
|
searchSkills(params: {
|
|
76
79
|
cfg: OpenClawConfig;
|
|
77
80
|
agentId: string;
|