@openclawbrain/openclaw 0.3.4 → 0.3.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.
|
@@ -35,13 +35,16 @@ export function normalizePromptBuildEvent(event) {
|
|
|
35
35
|
const warnings = [];
|
|
36
36
|
const sessionId = normalizeOptionalScalarField(event.sessionId, "sessionId", warnings);
|
|
37
37
|
const channel = normalizeOptionalScalarField(event.channel, "channel", warnings);
|
|
38
|
-
|
|
38
|
+
const promptFallback = extractTextContent(event.prompt);
|
|
39
|
+
let extractedMessage = promptFallback ?? "";
|
|
39
40
|
if (messages.length === 0) {
|
|
40
|
-
|
|
41
|
+
if (extractedMessage.length === 0) {
|
|
42
|
+
warnings.push(failOpenDiagnostic("runtime-messages-empty", "before_prompt_build event.messages is empty", `event=${describeValue(event)}`));
|
|
43
|
+
}
|
|
41
44
|
}
|
|
42
45
|
else {
|
|
43
46
|
const lastMessage = messages.at(-1);
|
|
44
|
-
extractedMessage = extractPromptMessage(lastMessage) ?? "";
|
|
47
|
+
extractedMessage = extractPromptMessage(lastMessage) ?? promptFallback ?? "";
|
|
45
48
|
if (extractedMessage.length === 0) {
|
|
46
49
|
warnings.push(failOpenDiagnostic("runtime-last-message-invalid", "before_prompt_build last message has no usable text content", `lastMessage=${describeValue(lastMessage)}`));
|
|
47
50
|
}
|
package/dist/src/index.js
CHANGED
|
@@ -1398,13 +1398,30 @@ export function loadWatchTeacherSnapshotState(snapshotPath) {
|
|
|
1398
1398
|
export function persistWatchTeacherSnapshot(snapshotPath, input) {
|
|
1399
1399
|
const persistedAt = new Date().toISOString();
|
|
1400
1400
|
const canonicalSnapshot = loadAsyncTeacherLiveLoopSnapshotFromValue(input.snapshot);
|
|
1401
|
+
const resolvedScanRoot = path.resolve(input.scanRoot);
|
|
1402
|
+
const canonicalRuntime = canonicalSnapshot.runtime ?? {
|
|
1403
|
+
startedAt: input.lastRunAt,
|
|
1404
|
+
lastHeartbeatAt: input.lastRunAt,
|
|
1405
|
+
lastScanAt: input.lastRunAt,
|
|
1406
|
+
scanRoot: resolvedScanRoot,
|
|
1407
|
+
lastAppliedMaterializationJobId: null
|
|
1408
|
+
};
|
|
1409
|
+
canonicalSnapshot.runtime = {
|
|
1410
|
+
...canonicalRuntime,
|
|
1411
|
+
startedAt: canonicalRuntime.startedAt ?? input.lastRunAt,
|
|
1412
|
+
lastHeartbeatAt: input.lastRunAt,
|
|
1413
|
+
lastScanAt: input.lastRunAt,
|
|
1414
|
+
scanRoot: typeof canonicalRuntime.scanRoot === "string" && canonicalRuntime.scanRoot.trim().length > 0
|
|
1415
|
+
? canonicalRuntime.scanRoot
|
|
1416
|
+
: resolvedScanRoot
|
|
1417
|
+
};
|
|
1401
1418
|
const payload = {
|
|
1402
1419
|
contract: "openclaw_watch_teacher_snapshot.v1",
|
|
1403
1420
|
runtimeOwner: "openclaw",
|
|
1404
1421
|
updatedAt: persistedAt,
|
|
1405
1422
|
lastRunAt: input.lastRunAt,
|
|
1406
1423
|
pollIntervalSeconds: input.pollIntervalSeconds,
|
|
1407
|
-
scanRoot:
|
|
1424
|
+
scanRoot: resolvedScanRoot,
|
|
1408
1425
|
sessionTailCursorPath: path.resolve(input.sessionTailCursorPath),
|
|
1409
1426
|
sessionTailCursorUpdatedAt: input.sessionTailCursorUpdatedAt,
|
|
1410
1427
|
sessionTailSessionsTracked: input.sessionTailSessionsTracked,
|
|
@@ -94,19 +94,22 @@ export function normalizePromptBuildEvent(event: unknown): { ok: true; event: No
|
|
|
94
94
|
const warnings: ExtensionDiagnostic[] = [];
|
|
95
95
|
const sessionId = normalizeOptionalScalarField(event.sessionId, "sessionId", warnings);
|
|
96
96
|
const channel = normalizeOptionalScalarField(event.channel, "channel", warnings);
|
|
97
|
-
|
|
97
|
+
const promptFallback = extractTextContent(event.prompt);
|
|
98
|
+
let extractedMessage = promptFallback ?? "";
|
|
98
99
|
|
|
99
100
|
if (messages.length === 0) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
if (extractedMessage.length === 0) {
|
|
102
|
+
warnings.push(
|
|
103
|
+
failOpenDiagnostic(
|
|
104
|
+
"runtime-messages-empty",
|
|
105
|
+
"before_prompt_build event.messages is empty",
|
|
106
|
+
`event=${describeValue(event)}`
|
|
107
|
+
)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
107
110
|
} else {
|
|
108
111
|
const lastMessage = messages.at(-1);
|
|
109
|
-
extractedMessage = extractPromptMessage(lastMessage) ?? "";
|
|
112
|
+
extractedMessage = extractPromptMessage(lastMessage) ?? promptFallback ?? "";
|
|
110
113
|
if (extractedMessage.length === 0) {
|
|
111
114
|
warnings.push(
|
|
112
115
|
failOpenDiagnostic(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclawbrain/openclaw",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Primary OpenClawBrain front door for OpenClaw attach, compile, event export, status, and rollback.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/src/index.js",
|
|
@@ -61,4 +61,4 @@
|
|
|
61
61
|
"clean": "rm -rf dist && tsc -b --clean",
|
|
62
62
|
"test": "node --test dist/test/*.test.js"
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
}
|