@openclawbrain/openclaw 0.3.3 → 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.
- package/dist/extension/runtime-guard.js +6 -3
- package/dist/src/index.js +21 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/local-session-passive-learning.js +1 -1
- package/dist/src/local-session-passive-learning.js.map +1 -1
- package/dist/src/semantic-metadata.d.ts +2 -1
- package/dist/src/semantic-metadata.js +31 -2
- package/dist/src/semantic-metadata.js.map +1 -1
- package/extension/runtime-guard.ts +12 -9
- package/package.json +8 -8
|
@@ -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,
|
|
@@ -1667,7 +1684,7 @@ export function buildNormalizedEventExportFromScannedEvents(input) {
|
|
|
1667
1684
|
})),
|
|
1668
1685
|
feedbackEvents: input.feedbackEvents.map((event) => ({
|
|
1669
1686
|
...event,
|
|
1670
|
-
semantic: event.semantic ?? buildFeedbackSemanticMetadata("scanner_export", event.kind)
|
|
1687
|
+
semantic: event.semantic ?? buildFeedbackSemanticMetadata("scanner_export", event.kind, event.content)
|
|
1671
1688
|
}))
|
|
1672
1689
|
});
|
|
1673
1690
|
const exportErrors = validateNormalizedEventExport(normalizedEventExport);
|
|
@@ -3733,7 +3750,7 @@ function buildFeedbackEvents(input) {
|
|
|
3733
3750
|
stream: input.sourceStream
|
|
3734
3751
|
},
|
|
3735
3752
|
content,
|
|
3736
|
-
semantic: buildFeedbackSemanticMetadata("runtime_turn", kind),
|
|
3753
|
+
semantic: buildFeedbackSemanticMetadata("runtime_turn", kind, content),
|
|
3737
3754
|
attribution: input.attribution,
|
|
3738
3755
|
...(messageId !== undefined ? { messageId } : {}),
|
|
3739
3756
|
...(principal === undefined ? {} : { principal }),
|
|
@@ -4200,7 +4217,7 @@ function buildRecordedSessionSeedExport(trace) {
|
|
|
4200
4217
|
stream: sourceStream
|
|
4201
4218
|
},
|
|
4202
4219
|
content: cue.content,
|
|
4203
|
-
semantic: buildFeedbackSemanticMetadata("recorded_session_seed", cue.kind ?? "teaching"),
|
|
4220
|
+
semantic: buildFeedbackSemanticMetadata("recorded_session_seed", cue.kind ?? "teaching", cue.content),
|
|
4204
4221
|
relatedInteractionId: interaction.eventId
|
|
4205
4222
|
});
|
|
4206
4223
|
sequence += 1;
|