openclawdreams 3.0.3 → 3.0.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/CHANGELOG.md +26 -0
- package/openclaw.plugin.json +6 -1
- package/package.json +1 -1
- package/dist/bin/electricsheep.d.ts +0 -3
- package/dist/bin/electricsheep.d.ts.map +0 -1
- package/dist/bin/electricsheep.js +0 -4
- package/dist/bin/electricsheep.js.map +0 -1
- package/dist/bin/openclawdreams.d.ts +0 -3
- package/dist/bin/openclawdreams.d.ts.map +0 -1
- package/dist/bin/openclawdreams.js +0 -4
- package/dist/bin/openclawdreams.js.map +0 -1
- package/dist/src/backfill.d.ts +0 -2
- package/dist/src/backfill.d.ts.map +0 -1
- package/dist/src/backfill.js +0 -63
- package/dist/src/backfill.js.map +0 -1
- package/dist/src/budget.d.ts +0 -28
- package/dist/src/budget.d.ts.map +0 -1
- package/dist/src/budget.js +0 -87
- package/dist/src/budget.js.map +0 -1
- package/dist/src/cli.d.ts +0 -19
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/cli.js +0 -584
- package/dist/src/cli.js.map +0 -1
- package/dist/src/config.d.ts +0 -74
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/config.js +0 -169
- package/dist/src/config.js.map +0 -1
- package/dist/src/crypto.d.ts +0 -19
- package/dist/src/crypto.d.ts.map +0 -1
- package/dist/src/crypto.js +0 -70
- package/dist/src/crypto.js.map +0 -1
- package/dist/src/dreamer.d.ts +0 -68
- package/dist/src/dreamer.d.ts.map +0 -1
- package/dist/src/dreamer.js +0 -555
- package/dist/src/dreamer.js.map +0 -1
- package/dist/src/entropy.d.ts +0 -23
- package/dist/src/entropy.d.ts.map +0 -1
- package/dist/src/entropy.js +0 -188
- package/dist/src/entropy.js.map +0 -1
- package/dist/src/filter.d.ts +0 -30
- package/dist/src/filter.d.ts.map +0 -1
- package/dist/src/filter.js +0 -124
- package/dist/src/filter.js.map +0 -1
- package/dist/src/identity.d.ts +0 -29
- package/dist/src/identity.d.ts.map +0 -1
- package/dist/src/identity.js +0 -83
- package/dist/src/identity.js.map +0 -1
- package/dist/src/index.d.ts +0 -14
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -540
- package/dist/src/index.js.map +0 -1
- package/dist/src/ingestion.d.ts +0 -22
- package/dist/src/ingestion.d.ts.map +0 -1
- package/dist/src/ingestion.js +0 -101
- package/dist/src/ingestion.js.map +0 -1
- package/dist/src/llm.d.ts +0 -26
- package/dist/src/llm.d.ts.map +0 -1
- package/dist/src/llm.js +0 -40
- package/dist/src/llm.js.map +0 -1
- package/dist/src/logger.d.ts +0 -6
- package/dist/src/logger.d.ts.map +0 -1
- package/dist/src/logger.js +0 -32
- package/dist/src/logger.js.map +0 -1
- package/dist/src/memory.d.ts +0 -96
- package/dist/src/memory.d.ts.map +0 -1
- package/dist/src/memory.js +0 -467
- package/dist/src/memory.js.map +0 -1
- package/dist/src/meta-loop.d.ts +0 -23
- package/dist/src/meta-loop.d.ts.map +0 -1
- package/dist/src/meta-loop.js +0 -72
- package/dist/src/meta-loop.js.map +0 -1
- package/dist/src/moltbook-search.d.ts +0 -23
- package/dist/src/moltbook-search.d.ts.map +0 -1
- package/dist/src/moltbook-search.js +0 -85
- package/dist/src/moltbook-search.js.map +0 -1
- package/dist/src/moltbook.d.ts +0 -34
- package/dist/src/moltbook.d.ts.map +0 -1
- package/dist/src/moltbook.js +0 -192
- package/dist/src/moltbook.js.map +0 -1
- package/dist/src/nightmare.d.ts +0 -11
- package/dist/src/nightmare.d.ts.map +0 -1
- package/dist/src/nightmare.js +0 -126
- package/dist/src/nightmare.js.map +0 -1
- package/dist/src/notify.d.ts +0 -20
- package/dist/src/notify.d.ts.map +0 -1
- package/dist/src/notify.js +0 -95
- package/dist/src/notify.js.map +0 -1
- package/dist/src/persona.d.ts +0 -30
- package/dist/src/persona.d.ts.map +0 -1
- package/dist/src/persona.js +0 -292
- package/dist/src/persona.js.map +0 -1
- package/dist/src/reflection.d.ts +0 -26
- package/dist/src/reflection.d.ts.map +0 -1
- package/dist/src/reflection.js +0 -127
- package/dist/src/reflection.js.map +0 -1
- package/dist/src/rhythm.d.ts +0 -19
- package/dist/src/rhythm.d.ts.map +0 -1
- package/dist/src/rhythm.js +0 -130
- package/dist/src/rhythm.js.map +0 -1
- package/dist/src/state.d.ts +0 -7
- package/dist/src/state.d.ts.map +0 -1
- package/dist/src/state.js +0 -40
- package/dist/src/state.js.map +0 -1
- package/dist/src/synthesis.d.ts +0 -29
- package/dist/src/synthesis.d.ts.map +0 -1
- package/dist/src/synthesis.js +0 -144
- package/dist/src/synthesis.js.map +0 -1
- package/dist/src/topics.d.ts +0 -19
- package/dist/src/topics.d.ts.map +0 -1
- package/dist/src/topics.js +0 -84
- package/dist/src/topics.js.map +0 -1
- package/dist/src/types.d.ts +0 -253
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -5
- package/dist/src/types.js.map +0 -1
- package/dist/src/vocabulary.d.ts +0 -18
- package/dist/src/vocabulary.d.ts.map +0 -1
- package/dist/src/vocabulary.js +0 -121
- package/dist/src/vocabulary.js.map +0 -1
- package/dist/src/waking.d.ts +0 -27
- package/dist/src/waking.d.ts.map +0 -1
- package/dist/src/waking.js +0 -188
- package/dist/src/waking.js.map +0 -1
- package/dist/src/web-search.d.ts +0 -23
- package/dist/src/web-search.d.ts.map +0 -1
- package/dist/src/web-search.js +0 -64
- package/dist/src/web-search.js.map +0 -1
package/dist/src/ingestion.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Community ingestion module.
|
|
3
|
-
*
|
|
4
|
-
* Fetches recent posts from configured Moltbook submolts to inject
|
|
5
|
-
* external perspectives into the reflection context window.
|
|
6
|
-
*/
|
|
7
|
-
import { MoltbookClient } from "./moltbook.js";
|
|
8
|
-
import { AGENT_NAME, CONTENT_PREVIEW_LENGTH, getCommunityIngestionEnabled, getCommunityIngestionSubmolts, getCommunityIngestionLimit, } from "./config.js";
|
|
9
|
-
import logger from "./logger.js";
|
|
10
|
-
/**
|
|
11
|
-
* Fetch recent community posts from configured submolts.
|
|
12
|
-
*
|
|
13
|
-
* - Filters out posts by the agent's own identity
|
|
14
|
-
* - Deduplicates by post id
|
|
15
|
-
* - Returns sorted by created_at descending
|
|
16
|
-
* - Never throws — returns empty array on error
|
|
17
|
-
*/
|
|
18
|
-
export async function fetchCommunityPosts(submolts, limit) {
|
|
19
|
-
if (!getCommunityIngestionEnabled()) {
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
const targetSubmolts = submolts ?? getCommunityIngestionSubmolts();
|
|
23
|
-
const perSubmoltLimit = limit ?? getCommunityIngestionLimit();
|
|
24
|
-
const client = new MoltbookClient();
|
|
25
|
-
const seen = new Set();
|
|
26
|
-
const posts = [];
|
|
27
|
-
for (const submolt of targetSubmolts) {
|
|
28
|
-
try {
|
|
29
|
-
const controller = new AbortController();
|
|
30
|
-
const timeout = setTimeout(() => controller.abort(), 5000);
|
|
31
|
-
let response;
|
|
32
|
-
try {
|
|
33
|
-
response = await client.getFeed("new", perSubmoltLimit);
|
|
34
|
-
}
|
|
35
|
-
finally {
|
|
36
|
-
clearTimeout(timeout);
|
|
37
|
-
}
|
|
38
|
-
const rawPosts = extractPosts(response, submolt);
|
|
39
|
-
for (const post of rawPosts) {
|
|
40
|
-
// Filter out own posts
|
|
41
|
-
if (post.author.toLowerCase() === AGENT_NAME.toLowerCase()) {
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
// Deduplicate
|
|
45
|
-
if (seen.has(post.id)) {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
seen.add(post.id);
|
|
49
|
-
posts.push(post);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
logger.warn(`Community ingestion failed for submolt "${submolt}": ${error}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// Sort by created_at descending
|
|
57
|
-
posts.sort((a, b) => b.created_at.localeCompare(a.created_at));
|
|
58
|
-
return posts;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Extract CommunityPost[] from a Moltbook feed response.
|
|
62
|
-
*/
|
|
63
|
-
function extractPosts(response, submolt) {
|
|
64
|
-
const rawPosts = response.posts ??
|
|
65
|
-
response.results ??
|
|
66
|
-
response.data ??
|
|
67
|
-
[];
|
|
68
|
-
if (!Array.isArray(rawPosts)) {
|
|
69
|
-
return [];
|
|
70
|
-
}
|
|
71
|
-
return rawPosts
|
|
72
|
-
.filter((p) => typeof p === "object" && p !== null && typeof p.id === "string")
|
|
73
|
-
.map((p) => ({
|
|
74
|
-
id: p.id,
|
|
75
|
-
submolt: p.submolt || submolt,
|
|
76
|
-
author: p.author || "unknown",
|
|
77
|
-
content: typeof p.content === "string" ? p.content : "",
|
|
78
|
-
created_at: typeof p.created_at === "string"
|
|
79
|
-
? p.created_at
|
|
80
|
-
: new Date().toISOString(),
|
|
81
|
-
}));
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Format community posts into a context block for injection into the reflection prompt.
|
|
85
|
-
* Returns empty string if no posts.
|
|
86
|
-
*/
|
|
87
|
-
export function formatCommunityContext(posts) {
|
|
88
|
-
if (posts.length === 0) {
|
|
89
|
-
return "";
|
|
90
|
-
}
|
|
91
|
-
const lines = posts.map((p) => {
|
|
92
|
-
const excerpt = p.content.length > CONTENT_PREVIEW_LENGTH
|
|
93
|
-
? p.content.slice(0, CONTENT_PREVIEW_LENGTH) + "..."
|
|
94
|
-
: p.content;
|
|
95
|
-
return `[submolt: ${p.submolt}] @${p.author} — "${excerpt}"`;
|
|
96
|
-
});
|
|
97
|
-
return (`COMMUNITY CONTEXT: Recent posts from the broader community (external perspectives to enrich your reflection):\n\n` +
|
|
98
|
-
lines.join("\n") +
|
|
99
|
-
`\n\nDraw on these external perspectives where relevant. You are not obligated to reference them directly.`);
|
|
100
|
-
}
|
|
101
|
-
//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king and dreamer modules. The actual LLM client is
|
|
6
|
-
* provided by the OpenClaw gateway (see index.ts).
|
|
7
|
-
*/
|
|
8
|
-
import { type Options as RetryOptions } from "p-retry";
|
|
9
|
-
import type { LLMClient, LLMResponse } from "./types.js";
|
|
10
|
-
/** Standard retry options for waking-state LLM calls. */
|
|
11
|
-
export declare const WAKING_RETRY_OPTS: RetryOptions;
|
|
12
|
-
/** Retry options for dream-cycle LLM calls (longer timeouts). */
|
|
13
|
-
export declare const DREAM_RETRY_OPTS: RetryOptions;
|
|
14
|
-
/**
|
|
15
|
-
* Helper: call LLM with retry and return the response.
|
|
16
|
-
*/
|
|
17
|
-
export declare function callWithRetry(client: LLMClient, params: {
|
|
18
|
-
model?: string;
|
|
19
|
-
maxTokens: number;
|
|
20
|
-
system: string;
|
|
21
|
-
messages: Array<{
|
|
22
|
-
role: string;
|
|
23
|
-
content: string;
|
|
24
|
-
}>;
|
|
25
|
-
}, retryOpts?: RetryOptions): Promise<LLMResponse>;
|
|
26
|
-
//# sourceMappingURL=llm.d.ts.map
|
package/dist/src/llm.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/llm.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAe,EAAE,KAAK,OAAO,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAG/D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzD,yDAAyD;AACzD,eAAO,MAAM,iBAAiB,EAAE,YAS/B,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,EAAE,YAS9B,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE;IACN,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpD,EACD,SAAS,GAAE,YAAgC,GAC1C,OAAO,CAAC,WAAW,CAAC,CAWtB"}
|
package/dist/src/llm.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared LLM client utilities.
|
|
3
|
-
*
|
|
4
|
-
* Provides retry configuration and call helpers used by both
|
|
5
|
-
* the waking and dreamer modules. The actual LLM client is
|
|
6
|
-
* provided by the OpenClaw gateway (see index.ts).
|
|
7
|
-
*/
|
|
8
|
-
import pRetry from "p-retry";
|
|
9
|
-
import { AGENT_MODEL } from "./config.js";
|
|
10
|
-
import logger from "./logger.js";
|
|
11
|
-
/** Standard retry options for waking-state LLM calls. */
|
|
12
|
-
export const WAKING_RETRY_OPTS = {
|
|
13
|
-
retries: 3,
|
|
14
|
-
minTimeout: 1000,
|
|
15
|
-
maxTimeout: 10000,
|
|
16
|
-
onFailedAttempt: (error) => {
|
|
17
|
-
logger.warn(`LLM attempt failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
/** Retry options for dream-cycle LLM calls (longer timeouts). */
|
|
21
|
-
export const DREAM_RETRY_OPTS = {
|
|
22
|
-
retries: 3,
|
|
23
|
-
minTimeout: 2000,
|
|
24
|
-
maxTimeout: 20000,
|
|
25
|
-
onFailedAttempt: (error) => {
|
|
26
|
-
logger.warn(`Dream generation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Helper: call LLM with retry and return the response.
|
|
31
|
-
*/
|
|
32
|
-
export function callWithRetry(client, params, retryOpts = WAKING_RETRY_OPTS) {
|
|
33
|
-
return pRetry(() => client.createMessage({
|
|
34
|
-
model: params.model ?? AGENT_MODEL,
|
|
35
|
-
maxTokens: params.maxTokens,
|
|
36
|
-
system: params.system,
|
|
37
|
-
messages: params.messages,
|
|
38
|
-
}), retryOpts);
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=llm.js.map
|
package/dist/src/llm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm.js","sourceRoot":"","sources":["../../src/llm.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,MAAwC,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,MAAM,MAAM,aAAa,CAAC;AAGjC,yDAAyD;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAiB;IAC7C,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,KAAK;IACjB,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;QACzB,MAAM,CAAC,IAAI,CACT,uBAAuB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAChF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC5C,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,KAAK;IACjB,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;QACzB,MAAM,CAAC,IAAI,CACT,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACrF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAiB,EACjB,MAKC,EACD,YAA0B,iBAAiB;IAE3C,OAAO,MAAM,CACX,GAAG,EAAE,CACH,MAAM,CAAC,aAAa,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,WAAW;QAClC,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,CAAC,EACJ,SAAS,CACV,CAAC;AACJ,CAAC"}
|
package/dist/src/logger.d.ts
DELETED
package/dist/src/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAC;AAGnC,QAAA,MAAM,MAAM,0BA4BV,CAAC;AAEH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEjD;AAED,wBAAgB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAK3C;AAED,eAAe,MAAM,CAAC"}
|
package/dist/src/logger.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createLogger, format, transports } from "winston";
|
|
2
|
-
import "winston-daily-rotate-file";
|
|
3
|
-
import { getDataDir } from "./config.js";
|
|
4
|
-
const logger = createLogger({
|
|
5
|
-
level: "info",
|
|
6
|
-
format: format.combine(format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), format.printf(({ timestamp, level, message }) => `${timestamp} [${level.toUpperCase()}]: ${message}`)),
|
|
7
|
-
transports: [
|
|
8
|
-
new transports.DailyRotateFile({
|
|
9
|
-
dirname: getDataDir(),
|
|
10
|
-
filename: "openclawdreams-%DATE%.log",
|
|
11
|
-
datePattern: "YYYY-MM-DD",
|
|
12
|
-
zippedArchive: true,
|
|
13
|
-
maxSize: "20m",
|
|
14
|
-
maxFiles: "14d",
|
|
15
|
-
level: "debug",
|
|
16
|
-
}),
|
|
17
|
-
new transports.Console({
|
|
18
|
-
format: format.combine(format.colorize(), format.printf(({ timestamp, level, message }) => `${timestamp} [${level}]: ${message}`)),
|
|
19
|
-
}),
|
|
20
|
-
],
|
|
21
|
-
});
|
|
22
|
-
export function setVerbose(verbose) {
|
|
23
|
-
logger.level = verbose ? "debug" : "info";
|
|
24
|
-
}
|
|
25
|
-
export function closeLogger() {
|
|
26
|
-
return new Promise((resolve) => {
|
|
27
|
-
logger.on("finish", resolve);
|
|
28
|
-
logger.end();
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
export default logger;
|
|
32
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/src/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,GAAG,YAAY,CAAC;IAC1B,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM,CAAC,OAAO,CACpB,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,EACnD,MAAM,CAAC,MAAM,CACX,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAChC,GAAG,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,MAAM,OAAO,EAAE,CACtD,CACF;IACD,UAAU,EAAE;QACV,IAAI,UAAU,CAAC,eAAe,CAAC;YAC7B,OAAO,EAAE,UAAU,EAAE;YACrB,QAAQ,EAAE,2BAA2B;YACrC,WAAW,EAAE,YAAY;YACzB,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,OAAO;SACf,CAAC;QACF,IAAI,UAAU,CAAC,OAAO,CAAC;YACrB,MAAM,EAAE,MAAM,CAAC,OAAO,CACpB,MAAM,CAAC,QAAQ,EAAE,EACjB,MAAM,CAAC,MAAM,CACX,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,SAAS,KAAK,KAAK,MAAM,OAAO,EAAE,CACzE,CACF;SACF,CAAC;KACH;CACF,CAAC,CAAC;AAEH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7B,MAAM,CAAC,GAAG,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AAED,eAAe,MAAM,CAAC"}
|
package/dist/src/memory.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encrypted deep memory system.
|
|
3
|
-
*
|
|
4
|
-
* All memories are encrypted with AES-256-GCM in a SQLite database.
|
|
5
|
-
* The waking agent writes to deep memory but cannot read it — only
|
|
6
|
-
* the dream process can decrypt. Context for LLM prompts is formatted
|
|
7
|
-
* via `formatDeepMemoryContext()`.
|
|
8
|
-
*/
|
|
9
|
-
import type { DecryptedMemory, DeepMemoryStats, MemoryEntry } from "./types.js";
|
|
10
|
-
/**
|
|
11
|
-
* Parse `git diff --stat` output into structured FileDiff[].
|
|
12
|
-
*/
|
|
13
|
-
export declare function parseDiffStat(diffStat: string): import("./types.js").FileDiff[];
|
|
14
|
-
/**
|
|
15
|
-
* Close the shared SQLite connection. Safe to call multiple times.
|
|
16
|
-
* After closing, the next getDb() call will reopen.
|
|
17
|
-
*/
|
|
18
|
-
export declare function closeDb(): void;
|
|
19
|
-
export declare function storeDeepMemory(content: Record<string, unknown>, category?: string): number | bigint;
|
|
20
|
-
export declare function getDeepMemoryById(id: number | bigint): DecryptedMemory | null;
|
|
21
|
-
export declare function retrieveUndreamedMemories(): DecryptedMemory[];
|
|
22
|
-
export declare function markAsDreamed(memoryIds: number[]): void;
|
|
23
|
-
export declare function deepMemoryStats(): DeepMemoryStats;
|
|
24
|
-
export interface DeepMemoryQueryOptions {
|
|
25
|
-
limit?: number;
|
|
26
|
-
categories?: string[];
|
|
27
|
-
undreamedOnly?: boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Query deep memory with optional filters. Decrypts results, handles
|
|
31
|
-
* corruption gracefully, returns in chronological order.
|
|
32
|
-
*/
|
|
33
|
-
export declare function getRecentDeepMemories(options?: DeepMemoryQueryOptions): DecryptedMemory[];
|
|
34
|
-
/**
|
|
35
|
-
* Format decrypted memories as a text block for LLM prompts.
|
|
36
|
-
*
|
|
37
|
-
* Extracts `content.summary` when available, falls back to truncated JSON.
|
|
38
|
-
* Respects an approximate token budget (1 token ≈ 4 chars).
|
|
39
|
-
*/
|
|
40
|
-
export declare function formatDeepMemoryContext(memories?: DecryptedMemory[], maxTokensApprox?: number): string;
|
|
41
|
-
/** Register a new dream. INSERT OR IGNORE (idempotent). */
|
|
42
|
-
export declare function registerDream(filename: string, title: string, dreamDate: string, options?: {
|
|
43
|
-
isNightmare?: boolean;
|
|
44
|
-
isMetaSynthesis?: boolean;
|
|
45
|
-
sourceFilenames?: string[];
|
|
46
|
-
deepMemoryId?: number | bigint;
|
|
47
|
-
}): void;
|
|
48
|
-
/** Increment remember_count for a dream that was selected. */
|
|
49
|
-
export declare function incrementRememberCount(filename: string): void;
|
|
50
|
-
/**
|
|
51
|
-
* Weighted random selection: score = 1/(count+1) * max(1, age_days).
|
|
52
|
-
* Fetch all rows from SQLite, compute scores in JS, do weighted pick.
|
|
53
|
-
* Returns filename and deep_memory_id, or null if table is empty.
|
|
54
|
-
*/
|
|
55
|
-
export declare function selectDreamToRemember(today: string): {
|
|
56
|
-
filename: string;
|
|
57
|
-
deep_memory_id: number | null;
|
|
58
|
-
} | null;
|
|
59
|
-
/** For inspection/testing. */
|
|
60
|
-
export declare function getDreamRemembrances(): Array<{
|
|
61
|
-
filename: string;
|
|
62
|
-
title: string;
|
|
63
|
-
dream_date: string;
|
|
64
|
-
remember_count: number;
|
|
65
|
-
is_nightmare: number;
|
|
66
|
-
is_meta_synthesis: number;
|
|
67
|
-
source_filenames: string | null;
|
|
68
|
-
deep_memory_id: number | null;
|
|
69
|
-
}>;
|
|
70
|
-
export interface DreamLineageRow {
|
|
71
|
-
id: number;
|
|
72
|
-
dream_filename: string;
|
|
73
|
-
parent_memory_ids: string | null;
|
|
74
|
-
thematic_kin: string | null;
|
|
75
|
-
dominant_concepts: string | null;
|
|
76
|
-
created_at: string;
|
|
77
|
-
}
|
|
78
|
-
export declare function insertDreamLineage(dreamFilename: string, parentMemoryIds: number[], thematicKin: string[], dominantConcepts: string[]): void;
|
|
79
|
-
export declare function getAllDreamLineage(): DreamLineageRow[];
|
|
80
|
-
export declare function getDreamLineageByFilename(filename: string): DreamLineageRow | null;
|
|
81
|
-
/**
|
|
82
|
-
* Find thematic kin for a dream by computing concept overlap with all prior dreams.
|
|
83
|
-
* Returns filenames of dreams with overlap >= threshold (default 0.3).
|
|
84
|
-
*/
|
|
85
|
-
export declare function findThematicKin(currentConcepts: string[], currentFilename: string, threshold?: number): Array<{
|
|
86
|
-
filename: string;
|
|
87
|
-
overlap: number;
|
|
88
|
-
}>;
|
|
89
|
-
/**
|
|
90
|
-
* Store a structured MemoryEntry in encrypted deep memory.
|
|
91
|
-
*
|
|
92
|
-
* Accepts either a MemoryEntry directly, or a legacy (summary, fullContext)
|
|
93
|
-
* pair for backward compatibility.
|
|
94
|
-
*/
|
|
95
|
-
export declare function remember(summaryOrEntry: string | MemoryEntry, fullContextOrCategory?: Record<string, unknown> | string, category?: string): void;
|
|
96
|
-
//# sourceMappingURL=memory.d.ts.map
|
package/dist/src/memory.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":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