@openclawbrain/openclaw 0.3.5 → 0.4.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.
Files changed (60) hide show
  1. package/README.md +23 -175
  2. package/dist/extension/index.js +3 -2
  3. package/dist/extension/index.js.map +1 -1
  4. package/dist/extension/runtime-guard.js +1 -1
  5. package/dist/extension/runtime-guard.js.map +1 -1
  6. package/dist/src/attachment-truth.d.ts +32 -22
  7. package/dist/src/attachment-truth.js +338 -181
  8. package/dist/src/index.d.ts +75 -1712
  9. package/dist/src/index.js +7 -6875
  10. package/dist/src/runtime-core.js +574 -0
  11. package/extension/index.ts +3 -2
  12. package/extension/runtime-guard.ts +1 -1
  13. package/openclaw.plugin.json +11 -0
  14. package/package.json +24 -15
  15. package/dist/src/attachment-truth.js.map +0 -1
  16. package/dist/src/cli.d.ts +0 -170
  17. package/dist/src/cli.js +0 -5523
  18. package/dist/src/cli.js.map +0 -1
  19. package/dist/src/daemon.d.ts +0 -70
  20. package/dist/src/daemon.js +0 -955
  21. package/dist/src/daemon.js.map +0 -1
  22. package/dist/src/import-export.d.ts +0 -36
  23. package/dist/src/import-export.js +0 -171
  24. package/dist/src/import-export.js.map +0 -1
  25. package/dist/src/index.js.map +0 -1
  26. package/dist/src/learning-spine.d.ts +0 -50
  27. package/dist/src/learning-spine.js.map +0 -1
  28. package/dist/src/local-session-passive-learning.d.ts +0 -61
  29. package/dist/src/local-session-passive-learning.js +0 -454
  30. package/dist/src/local-session-passive-learning.js.map +0 -1
  31. package/dist/src/ollama-client.d.ts +0 -46
  32. package/dist/src/ollama-client.js +0 -231
  33. package/dist/src/ollama-client.js.map +0 -1
  34. package/dist/src/openclaw-home-layout.d.ts +0 -17
  35. package/dist/src/openclaw-home-layout.js +0 -182
  36. package/dist/src/openclaw-home-layout.js.map +0 -1
  37. package/dist/src/openclaw-hook-truth.d.ts +0 -25
  38. package/dist/src/openclaw-hook-truth.js +0 -154
  39. package/dist/src/openclaw-hook-truth.js.map +0 -1
  40. package/dist/src/provider-config.d.ts +0 -64
  41. package/dist/src/provider-config.js +0 -306
  42. package/dist/src/provider-config.js.map +0 -1
  43. package/dist/src/resolve-activation-root.d.ts +0 -27
  44. package/dist/src/resolve-activation-root.js +0 -185
  45. package/dist/src/resolve-activation-root.js.map +0 -1
  46. package/dist/src/semantic-metadata.d.ts +0 -5
  47. package/dist/src/semantic-metadata.js +0 -70
  48. package/dist/src/semantic-metadata.js.map +0 -1
  49. package/dist/src/session-store.d.ts +0 -168
  50. package/dist/src/session-store.js +0 -250
  51. package/dist/src/session-store.js.map +0 -1
  52. package/dist/src/session-tail.d.ts +0 -73
  53. package/dist/src/session-tail.js +0 -602
  54. package/dist/src/session-tail.js.map +0 -1
  55. package/dist/src/shadow-extension-proof.d.ts +0 -40
  56. package/dist/src/shadow-extension-proof.js +0 -218
  57. package/dist/src/shadow-extension-proof.js.map +0 -1
  58. package/dist/src/teacher-labeler.d.ts +0 -50
  59. package/dist/src/teacher-labeler.js +0 -424
  60. package/dist/src/teacher-labeler.js.map +0 -1
@@ -1,250 +0,0 @@
1
- import { existsSync, readFileSync, readdirSync } from "node:fs";
2
- import { homedir } from "node:os";
3
- import path from "node:path";
4
- import { discoverOpenClawHomes } from "./openclaw-home-layout.js";
5
- export function loadOpenClawSessionIndex(indexFilePath) {
6
- return parseJsonFile(indexFilePath);
7
- }
8
- export function readOpenClawSessionFile(sessionFilePath) {
9
- return readJsonlFile(sessionFilePath, parseOpenClawSessionRecord);
10
- }
11
- export function readOpenClawAcpStreamFile(streamFilePath) {
12
- return readJsonlFile(streamFilePath, parseOpenClawAcpStreamRecord);
13
- }
14
- export function discoverOpenClawMainSessionStores(options = {}) {
15
- const candidateRoots = options.profileRoots !== undefined
16
- ? [...new Set(options.profileRoots.map((root) => path.resolve(root)))]
17
- : discoverOpenClawProfileRoots(options.homeDir);
18
- return candidateRoots
19
- .map((profileRoot) => {
20
- const sessionsDir = path.join(profileRoot, "agents", "main", "sessions");
21
- const indexPath = path.join(sessionsDir, "sessions.json");
22
- if (!existsSync(indexPath)) {
23
- return null;
24
- }
25
- return {
26
- profileRoot,
27
- agentId: "main",
28
- sessionsDir,
29
- indexPath
30
- };
31
- })
32
- .filter((store) => store !== null)
33
- .sort((left, right) => left.indexPath.localeCompare(right.indexPath));
34
- }
35
- /**
36
- * Discover session stores for ALL agents under each profile root.
37
- * Scans every directory under `agents/` (not just `agents/main/`),
38
- * finding subagent, ACP, and any other agent session stores.
39
- */
40
- export function discoverOpenClawSessionStores(options = {}) {
41
- const candidateRoots = options.profileRoots !== undefined
42
- ? [...new Set(options.profileRoots.map((root) => path.resolve(root)))]
43
- : discoverOpenClawProfileRoots(options.homeDir);
44
- const stores = [];
45
- for (const profileRoot of candidateRoots) {
46
- const agentsDir = path.join(profileRoot, "agents");
47
- if (!existsSync(agentsDir)) {
48
- continue;
49
- }
50
- let agentDirs;
51
- try {
52
- agentDirs = readdirSync(agentsDir, { withFileTypes: true })
53
- .filter((entry) => entry.isDirectory())
54
- .map((entry) => entry.name);
55
- }
56
- catch {
57
- continue;
58
- }
59
- for (const agentName of agentDirs) {
60
- const sessionsDir = path.join(agentsDir, agentName, "sessions");
61
- const indexPath = path.join(sessionsDir, "sessions.json");
62
- if (!existsSync(indexPath)) {
63
- continue;
64
- }
65
- stores.push({
66
- profileRoot,
67
- agentId: agentName,
68
- sessionsDir,
69
- indexPath
70
- });
71
- }
72
- }
73
- return stores.sort((left, right) => left.indexPath.localeCompare(right.indexPath));
74
- }
75
- function discoverOpenClawProfileRoots(homeDir) {
76
- const rootDir = path.resolve(homeDir ?? process.env.HOME ?? process.env.USERPROFILE ?? homedir());
77
- if (!existsSync(rootDir)) {
78
- return [];
79
- }
80
- const configuredRoots = discoverOpenClawHomes(rootDir).map((inspection) => inspection.openclawHome);
81
- // Session-store discovery must still see legacy per-profile homes that have live
82
- // session data but do not yet carry an openclaw.json layout marker.
83
- let legacyRoots = [];
84
- try {
85
- legacyRoots = readdirSync(rootDir, { withFileTypes: true })
86
- .filter((entry) => entry.isDirectory() && entry.name.startsWith(".openclaw-"))
87
- .map((entry) => path.join(rootDir, entry.name))
88
- .filter((profileRoot) => existsSync(path.join(profileRoot, "agents")));
89
- }
90
- catch {
91
- legacyRoots = [];
92
- }
93
- return [...new Set([...configuredRoots, ...legacyRoots])].sort((left, right) => left.localeCompare(right));
94
- }
95
- function parseJsonFile(filePath) {
96
- return JSON.parse(readFileSync(filePath, "utf8"));
97
- }
98
- function readJsonlFile(filePath, parseRecord) {
99
- const text = readFileSync(filePath, "utf8");
100
- if (text.trim() === "") {
101
- return [];
102
- }
103
- return text
104
- .split(/\r?\n/)
105
- .filter((line) => line.trim().length > 0)
106
- .map((line, index) => {
107
- try {
108
- return parseRecord(JSON.parse(line), index + 1);
109
- }
110
- catch (error) {
111
- const message = error instanceof Error ? error.message : String(error);
112
- throw new Error(`Could not parse JSONL record at ${filePath}:${index + 1}: ${message}`);
113
- }
114
- });
115
- }
116
- function parseOpenClawSessionRecord(value, lineNumber) {
117
- const record = expectRecord(value, lineNumber);
118
- const type = expectString(record.type, `${lineNumber}.type`);
119
- switch (type) {
120
- case "session":
121
- return {
122
- type,
123
- version: expectNumber(record.version, `${lineNumber}.version`),
124
- id: expectString(record.id, `${lineNumber}.id`),
125
- timestamp: expectString(record.timestamp, `${lineNumber}.timestamp`),
126
- cwd: expectString(record.cwd, `${lineNumber}.cwd`)
127
- };
128
- case "model_change":
129
- return {
130
- type,
131
- id: expectString(record.id, `${lineNumber}.id`),
132
- parentId: expectNullableString(record.parentId, `${lineNumber}.parentId`),
133
- timestamp: expectString(record.timestamp, `${lineNumber}.timestamp`),
134
- provider: expectString(record.provider, `${lineNumber}.provider`),
135
- modelId: expectString(record.modelId, `${lineNumber}.modelId`)
136
- };
137
- case "thinking_level_change":
138
- return {
139
- type,
140
- id: expectString(record.id, `${lineNumber}.id`),
141
- parentId: expectNullableString(record.parentId, `${lineNumber}.parentId`),
142
- timestamp: expectString(record.timestamp, `${lineNumber}.timestamp`),
143
- thinkingLevel: expectString(record.thinkingLevel, `${lineNumber}.thinkingLevel`)
144
- };
145
- case "custom":
146
- return {
147
- type,
148
- customType: expectString(record.customType, `${lineNumber}.customType`),
149
- data: expectRecord(record.data, `${lineNumber}.data`),
150
- id: expectString(record.id, `${lineNumber}.id`),
151
- parentId: expectNullableString(record.parentId, `${lineNumber}.parentId`),
152
- timestamp: expectString(record.timestamp, `${lineNumber}.timestamp`)
153
- };
154
- case "message":
155
- return {
156
- type,
157
- id: expectString(record.id, `${lineNumber}.id`),
158
- parentId: expectNullableString(record.parentId, `${lineNumber}.parentId`),
159
- timestamp: expectString(record.timestamp, `${lineNumber}.timestamp`),
160
- message: parseMessagePayload(record.message, `${lineNumber}.message`)
161
- };
162
- default:
163
- throw new Error(`Unknown OpenClaw session record type: ${type}`);
164
- }
165
- }
166
- function parseMessagePayload(value, path) {
167
- const payload = expectRecord(value, path);
168
- const content = expectArray(payload.content, `${path}.content`).map((entry, index) => parseContentPart(entry, `${path}.content[${index}]`));
169
- return {
170
- ...payload,
171
- role: expectString(payload.role, `${path}.role`),
172
- content,
173
- timestamp: expectNumber(payload.timestamp, `${path}.timestamp`)
174
- };
175
- }
176
- function parseContentPart(value, path) {
177
- const content = expectRecord(value, path);
178
- const type = expectString(content.type, `${path}.type`);
179
- if (type === "text") {
180
- return {
181
- ...content,
182
- type,
183
- text: expectString(content.text, `${path}.text`)
184
- };
185
- }
186
- if (type === "thinking") {
187
- return {
188
- ...content,
189
- type,
190
- thinking: expectString(content.thinking, `${path}.thinking`)
191
- };
192
- }
193
- if (type === "toolCall") {
194
- return {
195
- ...content,
196
- type,
197
- id: expectString(content.id, `${path}.id`),
198
- name: expectString(content.name, `${path}.name`),
199
- arguments: expectRecord(content.arguments, `${path}.arguments`)
200
- };
201
- }
202
- return {
203
- ...content,
204
- type
205
- };
206
- }
207
- function parseOpenClawAcpStreamRecord(value, lineNumber) {
208
- const record = expectRecord(value, lineNumber);
209
- return {
210
- ...record,
211
- ts: expectString(record.ts, `${lineNumber}.ts`),
212
- epochMs: expectNumber(record.epochMs, `${lineNumber}.epochMs`),
213
- runId: expectString(record.runId, `${lineNumber}.runId`),
214
- parentSessionKey: expectString(record.parentSessionKey, `${lineNumber}.parentSessionKey`),
215
- childSessionKey: expectString(record.childSessionKey, `${lineNumber}.childSessionKey`),
216
- agentId: expectString(record.agentId, `${lineNumber}.agentId`),
217
- kind: expectString(record.kind, `${lineNumber}.kind`)
218
- };
219
- }
220
- function expectRecord(value, path) {
221
- if (value === null || typeof value !== "object" || Array.isArray(value)) {
222
- throw new Error(`${path} must be an object`);
223
- }
224
- return value;
225
- }
226
- function expectArray(value, path) {
227
- if (!Array.isArray(value)) {
228
- throw new Error(`${path} must be an array`);
229
- }
230
- return value;
231
- }
232
- function expectString(value, path) {
233
- if (typeof value !== "string") {
234
- throw new Error(`${path} must be a string`);
235
- }
236
- return value;
237
- }
238
- function expectNullableString(value, path) {
239
- if (value === null) {
240
- return null;
241
- }
242
- return expectString(value, path);
243
- }
244
- function expectNumber(value, path) {
245
- if (typeof value !== "number" || !Number.isFinite(value)) {
246
- throw new Error(`${path} must be a finite number`);
247
- }
248
- return value;
249
- }
250
- //# sourceMappingURL=session-store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-store.js","sourceRoot":"","sources":["../../src/session-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAuLlE,MAAM,UAAU,wBAAwB,CAAC,aAAqB;IAC5D,OAAO,aAAa,CAAuB,aAAa,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,eAAuB;IAC7D,OAAO,aAAa,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AAM,IAAI,KAAK,CAAC,GAAG,IAAI,mBAAmB,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,KAAc,EAAE,IAAY;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,mBAAmB,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAc,EAAE,IAAY;IACxD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,YAAY,CAAC,KAAc,EAAE,IAAY;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,0BAA0B,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,73 +0,0 @@
1
- import { type OpenClawSessionStoreV1 } from "./session-store.js";
2
- import type { ScannedEventExportInputV1 } from "./index.js";
3
- export type OpenClawLocalSessionTailNoopReasonV1 = "seeded_existing_sessions" | "no_local_session_stores" | "no_session_changes";
4
- export type OpenClawLocalSessionTailChangeKindV1 = "new_session" | "appended_records" | "metadata_only" | "session_reset" | "missing_session_path" | "missing_session_file";
5
- export interface OpenClawLocalSessionTailCursorV1 {
6
- sourceIndexPath: string;
7
- sessionKey: string;
8
- sessionId: string;
9
- sessionFile: string | null;
10
- updatedAt: number;
11
- rawRecordCount: number;
12
- bridgedEventCount: number;
13
- }
14
- export interface OpenClawLocalSessionTailChangeV1 {
15
- source: OpenClawSessionStoreV1;
16
- sessionKey: string;
17
- sessionId: string;
18
- sessionFile: string | null;
19
- changeKind: OpenClawLocalSessionTailChangeKindV1;
20
- rawRecordCount: number;
21
- bridgedEventCount: number;
22
- emittedEventCount: number;
23
- lastUserMessageAt: string | null;
24
- lastUserMessageText: string | null;
25
- warnings: string[];
26
- scannedEventExport: ScannedEventExportInputV1 | null;
27
- }
28
- export interface OpenClawLocalSessionTailPollResultV1 {
29
- runtimeOwner: "openclaw";
30
- lane: "local_session_tail";
31
- polledAt: string;
32
- sources: OpenClawSessionStoreV1[];
33
- changes: OpenClawLocalSessionTailChangeV1[];
34
- noopReason: OpenClawLocalSessionTailNoopReasonV1 | null;
35
- warnings: string[];
36
- cursor: OpenClawLocalSessionTailCursorV1[];
37
- }
38
- export interface OpenClawLocalSessionTailInput {
39
- homeDir?: string;
40
- profileRoots?: readonly string[];
41
- cursor?: readonly OpenClawLocalSessionTailCursorV1[];
42
- emitExistingOnFirstPoll?: boolean;
43
- }
44
- export interface OpenClawLocalSessionTailLoopOptionsV1 {
45
- pollIntervalMs?: number;
46
- maxPasses?: number;
47
- stopWhenIdle?: boolean;
48
- signal?: AbortSignal;
49
- onPass?: (result: OpenClawLocalSessionTailPollResultV1) => void | Promise<void>;
50
- }
51
- export interface OpenClawLocalSessionTailLoopResultV1 {
52
- runtimeOwner: "openclaw";
53
- passCount: number;
54
- changedSessionCount: number;
55
- emittedEventCount: number;
56
- stoppedReason: "idle" | "max_passes" | "aborted";
57
- lastPoll: OpenClawLocalSessionTailPollResultV1 | null;
58
- cursor: OpenClawLocalSessionTailCursorV1[];
59
- }
60
- export declare class OpenClawLocalSessionTail {
61
- readonly homeDir: string | undefined;
62
- readonly profileRoots: readonly string[] | undefined;
63
- private initialized;
64
- private readonly emitExistingOnFirstPoll;
65
- private readonly cursorBySession;
66
- constructor(input?: OpenClawLocalSessionTailInput);
67
- snapshot(): OpenClawLocalSessionTailCursorV1[];
68
- pollOnce(options?: {
69
- observedAt?: string;
70
- }): OpenClawLocalSessionTailPollResultV1;
71
- runLoop(options?: OpenClawLocalSessionTailLoopOptionsV1): Promise<OpenClawLocalSessionTailLoopResultV1>;
72
- }
73
- export declare function createOpenClawLocalSessionTail(input?: OpenClawLocalSessionTailInput): OpenClawLocalSessionTail;