@openclawbrain/openclaw 0.1.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 +43 -0
- package/dist/src/index.d.ts +148 -0
- package/dist/src/index.js +495 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @openclawbrain/openclaw
|
|
2
|
+
|
|
3
|
+
OpenClaw-facing runtime integration helpers for the TypeScript-first OpenClawBrain stack.
|
|
4
|
+
|
|
5
|
+
Use this package when OpenClaw needs a narrow, typed bridge over promoted packs without giving up runtime ownership:
|
|
6
|
+
|
|
7
|
+
- resolve the active promoted pack from activation pointers
|
|
8
|
+
- consume `runtime_compile.v1` through a strict fail-open helper
|
|
9
|
+
- emit normalized interaction and feedback events for learner handoff
|
|
10
|
+
- optionally write learner-facing event-export bundles on disk
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { compileRuntimeContext, runRuntimeTurn } from "@openclawbrain/openclaw";
|
|
14
|
+
|
|
15
|
+
const compileResult = compileRuntimeContext({
|
|
16
|
+
activationRoot: "/var/openclawbrain/activation",
|
|
17
|
+
message: "feedback scanner route gating",
|
|
18
|
+
runtimeHints: ["feedback scanner"]
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const turnResult = runRuntimeTurn(
|
|
22
|
+
{
|
|
23
|
+
sessionId: "session-123",
|
|
24
|
+
channel: "whatsapp",
|
|
25
|
+
userMessage: "feedback scanner route gating",
|
|
26
|
+
compile: {
|
|
27
|
+
createdAt: "2026-03-07T17:01:00.000Z"
|
|
28
|
+
},
|
|
29
|
+
delivery: {
|
|
30
|
+
createdAt: "2026-03-07T17:02:00.000Z",
|
|
31
|
+
messageId: "msg-123"
|
|
32
|
+
},
|
|
33
|
+
export: {
|
|
34
|
+
rootDir: "/var/openclawbrain/exports/session-123"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
activationRoot: "/var/openclawbrain/activation"
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This package stays fail-open by default: compile failures fall back to standard OpenClaw context injection, and event-export write failures do not erase successful compile output.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { type ActivationPointerRecordV1, type FeedbackEventKind, type NormalizedEventExportV1, type RouteMode, type RuntimeCompileResponseV1 } from "@openclawbrain/contracts";
|
|
2
|
+
import { type ActivationSlotInspection } from "@openclawbrain/pack-format";
|
|
3
|
+
declare const RUNTIME_EVENT_EXPORT_BUNDLE_CONTRACT: "normalized_event_export_bundle.v1";
|
|
4
|
+
export declare const RUNTIME_EVENT_EXPORT_BUNDLE_LAYOUT: {
|
|
5
|
+
readonly manifest: "manifest.json";
|
|
6
|
+
readonly payload: "normalized-event-export.json";
|
|
7
|
+
};
|
|
8
|
+
export interface RuntimeEventExportBundleSummaryV1 {
|
|
9
|
+
runtimeOwner: "openclaw";
|
|
10
|
+
sessionId: string | null;
|
|
11
|
+
channel: string | null;
|
|
12
|
+
eventRange: Pick<NormalizedEventExportV1["range"], "start" | "end" | "count">;
|
|
13
|
+
interactionCount: number;
|
|
14
|
+
feedbackCount: number;
|
|
15
|
+
sourceStreams: string[];
|
|
16
|
+
contracts: NormalizedEventExportV1["provenance"]["contracts"];
|
|
17
|
+
}
|
|
18
|
+
export interface RuntimeEventExportBundleManifestV1 {
|
|
19
|
+
contract: typeof RUNTIME_EVENT_EXPORT_BUNDLE_CONTRACT;
|
|
20
|
+
exportName: string;
|
|
21
|
+
exportedAt: string;
|
|
22
|
+
payloadPath: string;
|
|
23
|
+
payloadDigest: string;
|
|
24
|
+
summary: RuntimeEventExportBundleSummaryV1;
|
|
25
|
+
}
|
|
26
|
+
export interface RuntimeEventExportBundleDescriptor {
|
|
27
|
+
rootDir: string;
|
|
28
|
+
manifestPath: string;
|
|
29
|
+
payloadPath: string;
|
|
30
|
+
manifest: RuntimeEventExportBundleManifestV1;
|
|
31
|
+
normalizedEventExport: NormalizedEventExportV1;
|
|
32
|
+
}
|
|
33
|
+
export interface CompileRuntimeContextInput {
|
|
34
|
+
activationRoot: string;
|
|
35
|
+
message: string;
|
|
36
|
+
agentId?: string;
|
|
37
|
+
maxContextBlocks?: number;
|
|
38
|
+
mode?: RouteMode;
|
|
39
|
+
runtimeHints?: readonly string[];
|
|
40
|
+
}
|
|
41
|
+
export interface ActiveCompileTarget {
|
|
42
|
+
activationRoot: string;
|
|
43
|
+
activePointer: ActivationPointerRecordV1;
|
|
44
|
+
inspection: ActivationSlotInspection;
|
|
45
|
+
}
|
|
46
|
+
export interface RuntimeCompileSuccess {
|
|
47
|
+
ok: true;
|
|
48
|
+
fallbackToStaticContext: false;
|
|
49
|
+
activationRoot: string;
|
|
50
|
+
activePackId: string;
|
|
51
|
+
packRootDir: string;
|
|
52
|
+
compileResponse: RuntimeCompileResponseV1;
|
|
53
|
+
brainContext: string;
|
|
54
|
+
}
|
|
55
|
+
export interface RuntimeCompileFailure {
|
|
56
|
+
ok: false;
|
|
57
|
+
fallbackToStaticContext: true;
|
|
58
|
+
activationRoot: string;
|
|
59
|
+
error: string;
|
|
60
|
+
brainContext: string;
|
|
61
|
+
}
|
|
62
|
+
export type RuntimeCompileResult = RuntimeCompileSuccess | RuntimeCompileFailure;
|
|
63
|
+
export interface RuntimeTurnCompileInput {
|
|
64
|
+
createdAt?: string | null;
|
|
65
|
+
sequence?: number | null;
|
|
66
|
+
eventId?: string | null;
|
|
67
|
+
}
|
|
68
|
+
export interface RuntimeTurnDeliveryInput {
|
|
69
|
+
createdAt?: string | null;
|
|
70
|
+
sequence?: number | null;
|
|
71
|
+
eventId?: string | null;
|
|
72
|
+
messageId?: string | null;
|
|
73
|
+
}
|
|
74
|
+
export interface RuntimeTurnFeedbackInput {
|
|
75
|
+
content: string;
|
|
76
|
+
createdAt?: string | null;
|
|
77
|
+
sequence?: number | null;
|
|
78
|
+
eventId?: string | null;
|
|
79
|
+
kind?: FeedbackEventKind | null;
|
|
80
|
+
messageId?: string | null;
|
|
81
|
+
relatedInteractionId?: string | null;
|
|
82
|
+
}
|
|
83
|
+
export interface RuntimeTurnExportInput {
|
|
84
|
+
rootDir: string;
|
|
85
|
+
exportName?: string | null;
|
|
86
|
+
exportedAt?: string | null;
|
|
87
|
+
}
|
|
88
|
+
export interface OpenClawRuntimeTurnInput {
|
|
89
|
+
activationRoot?: string | null;
|
|
90
|
+
agentId?: string | null;
|
|
91
|
+
sessionId: string;
|
|
92
|
+
channel: string;
|
|
93
|
+
sourceStream?: string | null;
|
|
94
|
+
userMessage: string;
|
|
95
|
+
createdAt?: string | null;
|
|
96
|
+
sequenceStart?: number | null;
|
|
97
|
+
maxContextBlocks?: number;
|
|
98
|
+
mode?: RouteMode;
|
|
99
|
+
runtimeHints?: readonly string[];
|
|
100
|
+
compile?: RuntimeTurnCompileInput | null;
|
|
101
|
+
delivery?: boolean | RuntimeTurnDeliveryInput | null;
|
|
102
|
+
feedback?: readonly (RuntimeTurnFeedbackInput | null)[] | null;
|
|
103
|
+
export?: RuntimeTurnExportInput | null;
|
|
104
|
+
}
|
|
105
|
+
export interface RuntimeEventExportNoWrite {
|
|
106
|
+
ok: true;
|
|
107
|
+
wroteBundle: false;
|
|
108
|
+
normalizedEventExport: NormalizedEventExportV1;
|
|
109
|
+
}
|
|
110
|
+
export interface RuntimeEventExportWriteSuccess {
|
|
111
|
+
ok: true;
|
|
112
|
+
wroteBundle: true;
|
|
113
|
+
normalizedEventExport: NormalizedEventExportV1;
|
|
114
|
+
rootDir: string;
|
|
115
|
+
manifestPath: string;
|
|
116
|
+
payloadPath: string;
|
|
117
|
+
manifest: RuntimeEventExportBundleManifestV1;
|
|
118
|
+
}
|
|
119
|
+
export interface RuntimeEventExportFailure {
|
|
120
|
+
ok: false;
|
|
121
|
+
wroteBundle: false;
|
|
122
|
+
error: string;
|
|
123
|
+
}
|
|
124
|
+
export type RuntimeEventExportResult = RuntimeEventExportNoWrite | RuntimeEventExportWriteSuccess | RuntimeEventExportFailure;
|
|
125
|
+
export interface RunRuntimeTurnOptions {
|
|
126
|
+
activationRoot?: string;
|
|
127
|
+
failOpen?: boolean;
|
|
128
|
+
}
|
|
129
|
+
export type RuntimeTurnResult = RuntimeCompileResult & {
|
|
130
|
+
eventExport: RuntimeEventExportResult;
|
|
131
|
+
warnings: string[];
|
|
132
|
+
};
|
|
133
|
+
export declare function buildRuntimeEventExportBundleManifest(input: {
|
|
134
|
+
exportName: string;
|
|
135
|
+
exportedAt: string;
|
|
136
|
+
payloadPath: string;
|
|
137
|
+
normalizedEventExport: NormalizedEventExportV1;
|
|
138
|
+
}): RuntimeEventExportBundleManifestV1;
|
|
139
|
+
export declare function validateRuntimeEventExportBundleManifest(value: RuntimeEventExportBundleManifestV1, normalizedEventExport?: NormalizedEventExportV1): string[];
|
|
140
|
+
export declare function loadRuntimeEventExportBundle(rootDir: string): RuntimeEventExportBundleDescriptor;
|
|
141
|
+
export declare function classifyFeedbackKind(content: string): FeedbackEventKind;
|
|
142
|
+
export declare function formatPromptContext(compileResponse: RuntimeCompileResponseV1): string;
|
|
143
|
+
export declare function resolveActivePackForCompile(activationRoot: string): ActiveCompileTarget;
|
|
144
|
+
export declare function compileRuntimeContext(input: CompileRuntimeContextInput): RuntimeCompileResult;
|
|
145
|
+
export declare function buildNormalizedRuntimeEventExport(turn: OpenClawRuntimeTurnInput, compileResult: RuntimeCompileResult): NormalizedEventExportV1;
|
|
146
|
+
export declare function writeRuntimeEventExportBundle(turn: OpenClawRuntimeTurnInput, normalizedEventExport: NormalizedEventExportV1): RuntimeEventExportNoWrite | RuntimeEventExportWriteSuccess;
|
|
147
|
+
export declare function runRuntimeTurn(turn: OpenClawRuntimeTurnInput, options?: RunRuntimeTurnOptions): RuntimeTurnResult;
|
|
148
|
+
export {};
|
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { compileRuntime } from "@openclawbrain/compiler";
|
|
6
|
+
import { CONTRACT_IDS, buildNormalizedEventExport, canonicalJson, checksumJsonPayload, createFeedbackEvent, createInteractionEvent, validateNormalizedEventExport } from "@openclawbrain/contracts";
|
|
7
|
+
import { inspectActivationState } from "@openclawbrain/pack-format";
|
|
8
|
+
const DEFAULT_AGENT_ID = "openclaw-runtime";
|
|
9
|
+
const FEEDBACK_KINDS = new Set(["correction", "teaching", "approval", "suppression"]);
|
|
10
|
+
const RUNTIME_EVENT_EXPORT_BUNDLE_CONTRACT = "normalized_event_export_bundle.v1";
|
|
11
|
+
export const RUNTIME_EVENT_EXPORT_BUNDLE_LAYOUT = {
|
|
12
|
+
manifest: "manifest.json",
|
|
13
|
+
payload: "normalized-event-export.json"
|
|
14
|
+
};
|
|
15
|
+
function toErrorMessage(error) {
|
|
16
|
+
return error instanceof Error ? error.message : String(error);
|
|
17
|
+
}
|
|
18
|
+
function readJsonFile(filePath) {
|
|
19
|
+
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
20
|
+
}
|
|
21
|
+
function resolveBundlePayloadPath(rootDir, payloadPath) {
|
|
22
|
+
const resolved = path.resolve(rootDir, payloadPath);
|
|
23
|
+
const relative = path.relative(rootDir, resolved);
|
|
24
|
+
if (path.isAbsolute(payloadPath) || relative.startsWith("..") || relative === "") {
|
|
25
|
+
throw new Error("event export bundle payloadPath must stay within the bundle root");
|
|
26
|
+
}
|
|
27
|
+
return resolved;
|
|
28
|
+
}
|
|
29
|
+
export function buildRuntimeEventExportBundleManifest(input) {
|
|
30
|
+
return {
|
|
31
|
+
contract: RUNTIME_EVENT_EXPORT_BUNDLE_CONTRACT,
|
|
32
|
+
exportName: input.exportName,
|
|
33
|
+
exportedAt: input.exportedAt,
|
|
34
|
+
payloadPath: input.payloadPath,
|
|
35
|
+
payloadDigest: checksumJsonPayload(input.normalizedEventExport),
|
|
36
|
+
summary: {
|
|
37
|
+
runtimeOwner: input.normalizedEventExport.provenance.runtimeOwner,
|
|
38
|
+
sessionId: input.normalizedEventExport.provenance.sessionId,
|
|
39
|
+
channel: input.normalizedEventExport.provenance.channel,
|
|
40
|
+
eventRange: {
|
|
41
|
+
start: input.normalizedEventExport.range.start,
|
|
42
|
+
end: input.normalizedEventExport.range.end,
|
|
43
|
+
count: input.normalizedEventExport.range.count
|
|
44
|
+
},
|
|
45
|
+
interactionCount: input.normalizedEventExport.provenance.interactionCount,
|
|
46
|
+
feedbackCount: input.normalizedEventExport.provenance.feedbackCount,
|
|
47
|
+
sourceStreams: [...input.normalizedEventExport.provenance.sourceStreams],
|
|
48
|
+
contracts: [...input.normalizedEventExport.provenance.contracts]
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export function validateRuntimeEventExportBundleManifest(value, normalizedEventExport) {
|
|
53
|
+
const errors = [];
|
|
54
|
+
if (value.contract !== RUNTIME_EVENT_EXPORT_BUNDLE_CONTRACT) {
|
|
55
|
+
errors.push("normalized_event_export_bundle.v1 contract is required");
|
|
56
|
+
}
|
|
57
|
+
if (value.exportName.length === 0) {
|
|
58
|
+
errors.push("exportName is required");
|
|
59
|
+
}
|
|
60
|
+
if (Number.isNaN(Date.parse(value.exportedAt))) {
|
|
61
|
+
errors.push("exportedAt must be an ISO timestamp");
|
|
62
|
+
}
|
|
63
|
+
if (value.payloadPath.length === 0) {
|
|
64
|
+
errors.push("payloadPath is required");
|
|
65
|
+
}
|
|
66
|
+
if (value.payloadDigest.length === 0) {
|
|
67
|
+
errors.push("payloadDigest is required");
|
|
68
|
+
}
|
|
69
|
+
if (normalizedEventExport !== undefined) {
|
|
70
|
+
const exportErrors = validateNormalizedEventExport(normalizedEventExport);
|
|
71
|
+
if (exportErrors.length > 0) {
|
|
72
|
+
errors.push(...exportErrors);
|
|
73
|
+
}
|
|
74
|
+
const rebuilt = buildRuntimeEventExportBundleManifest({
|
|
75
|
+
exportName: value.exportName,
|
|
76
|
+
exportedAt: value.exportedAt,
|
|
77
|
+
payloadPath: value.payloadPath,
|
|
78
|
+
normalizedEventExport
|
|
79
|
+
});
|
|
80
|
+
if (rebuilt.payloadDigest !== value.payloadDigest) {
|
|
81
|
+
errors.push("event export bundle payloadDigest does not match the supplied normalized event export");
|
|
82
|
+
}
|
|
83
|
+
if (canonicalJson(rebuilt.summary) !== canonicalJson(value.summary)) {
|
|
84
|
+
errors.push("event export bundle summary does not match the supplied normalized event export");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return errors;
|
|
88
|
+
}
|
|
89
|
+
export function loadRuntimeEventExportBundle(rootDir) {
|
|
90
|
+
const resolvedRoot = path.resolve(rootDir);
|
|
91
|
+
const manifestPath = path.join(resolvedRoot, RUNTIME_EVENT_EXPORT_BUNDLE_LAYOUT.manifest);
|
|
92
|
+
const manifest = readJsonFile(manifestPath);
|
|
93
|
+
const payloadPath = resolveBundlePayloadPath(resolvedRoot, manifest.payloadPath);
|
|
94
|
+
const normalizedEventExport = readJsonFile(payloadPath);
|
|
95
|
+
const validationErrors = validateRuntimeEventExportBundleManifest(manifest, normalizedEventExport);
|
|
96
|
+
if (validationErrors.length > 0) {
|
|
97
|
+
throw new Error(`event export bundle is invalid: ${validationErrors.join("; ")}`);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
rootDir: resolvedRoot,
|
|
101
|
+
manifestPath,
|
|
102
|
+
payloadPath,
|
|
103
|
+
manifest,
|
|
104
|
+
normalizedEventExport
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function normalizeNonEmptyString(value, fieldName) {
|
|
108
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
109
|
+
throw new Error(`${fieldName} is required`);
|
|
110
|
+
}
|
|
111
|
+
return value.trim();
|
|
112
|
+
}
|
|
113
|
+
function normalizeOptionalString(value) {
|
|
114
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
|
|
115
|
+
}
|
|
116
|
+
function normalizeNonNegativeInteger(value, fieldName, fallbackValue) {
|
|
117
|
+
if (value === undefined || value === null) {
|
|
118
|
+
return fallbackValue;
|
|
119
|
+
}
|
|
120
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
121
|
+
throw new Error(`${fieldName} must be a non-negative integer`);
|
|
122
|
+
}
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
125
|
+
function normalizeIsoTimestamp(value, fieldName, fallbackValue) {
|
|
126
|
+
const candidate = value ?? fallbackValue;
|
|
127
|
+
if (candidate === undefined || candidate === null || candidate === "") {
|
|
128
|
+
throw new Error(`${fieldName} is required`);
|
|
129
|
+
}
|
|
130
|
+
if (typeof candidate !== "string" || Number.isNaN(Date.parse(candidate))) {
|
|
131
|
+
throw new Error(`${fieldName} must be an ISO timestamp`);
|
|
132
|
+
}
|
|
133
|
+
return new Date(candidate).toISOString();
|
|
134
|
+
}
|
|
135
|
+
function normalizeMode(value) {
|
|
136
|
+
return value ?? "heuristic";
|
|
137
|
+
}
|
|
138
|
+
function normalizeRuntimeHints(value) {
|
|
139
|
+
if (value === undefined) {
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
if (value.some((item) => typeof item !== "string" || item.trim().length === 0)) {
|
|
143
|
+
throw new Error("runtimeHints must be an array of non-empty strings");
|
|
144
|
+
}
|
|
145
|
+
return value.map((item) => item.trim());
|
|
146
|
+
}
|
|
147
|
+
function deterministicEventId(value) {
|
|
148
|
+
const digest = createHash("sha256").update(JSON.stringify(value)).digest("hex");
|
|
149
|
+
return `evt-${digest.slice(0, 16)}`;
|
|
150
|
+
}
|
|
151
|
+
function nextSequenceFactory(startValue = 1) {
|
|
152
|
+
let cursor = normalizeNonNegativeInteger(startValue, "sequenceStart", 1);
|
|
153
|
+
return (explicitValue) => {
|
|
154
|
+
if (explicitValue !== undefined && explicitValue !== null) {
|
|
155
|
+
const normalized = normalizeNonNegativeInteger(explicitValue, "sequence", explicitValue);
|
|
156
|
+
cursor = Math.max(cursor, normalized + 1);
|
|
157
|
+
return normalized;
|
|
158
|
+
}
|
|
159
|
+
const current = cursor;
|
|
160
|
+
cursor += 1;
|
|
161
|
+
return current;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function isFeedbackKind(value) {
|
|
165
|
+
return FEEDBACK_KINDS.has(value);
|
|
166
|
+
}
|
|
167
|
+
function isPresent(value) {
|
|
168
|
+
return value !== null;
|
|
169
|
+
}
|
|
170
|
+
export function classifyFeedbackKind(content) {
|
|
171
|
+
const normalized = content.trim().toLowerCase();
|
|
172
|
+
if (normalized.length === 0) {
|
|
173
|
+
return "teaching";
|
|
174
|
+
}
|
|
175
|
+
if (/\b(stop|suppress|mute|silence|pause|don't send|do not send)\b/u.test(normalized)) {
|
|
176
|
+
return "suppression";
|
|
177
|
+
}
|
|
178
|
+
if (/\b(approved|approve|looks good|ship it|exactly right|that works)\b/u.test(normalized)) {
|
|
179
|
+
return "approval";
|
|
180
|
+
}
|
|
181
|
+
if (/\b(wrong|incorrect|correction|not right|do this instead|not x[, ]+y)\b/u.test(normalized) ||
|
|
182
|
+
normalized.startsWith("no") ||
|
|
183
|
+
normalized.startsWith("wrong")) {
|
|
184
|
+
return "correction";
|
|
185
|
+
}
|
|
186
|
+
return "teaching";
|
|
187
|
+
}
|
|
188
|
+
export function formatPromptContext(compileResponse) {
|
|
189
|
+
const lines = [
|
|
190
|
+
"[BRAIN_CONTEXT v1]",
|
|
191
|
+
`PACK_ID: ${compileResponse.packId}`,
|
|
192
|
+
`MODE: ${compileResponse.diagnostics.modeEffective}`
|
|
193
|
+
];
|
|
194
|
+
if (compileResponse.diagnostics.routerIdentity !== null) {
|
|
195
|
+
lines.push(`ROUTER: ${compileResponse.diagnostics.routerIdentity}`);
|
|
196
|
+
}
|
|
197
|
+
if (compileResponse.selectedContext.length > 0) {
|
|
198
|
+
lines.push("");
|
|
199
|
+
}
|
|
200
|
+
for (const block of compileResponse.selectedContext) {
|
|
201
|
+
lines.push(`SOURCE: ${block.source}`);
|
|
202
|
+
lines.push(`BLOCK_ID: ${block.id}`);
|
|
203
|
+
lines.push(block.text.trim());
|
|
204
|
+
lines.push("");
|
|
205
|
+
}
|
|
206
|
+
if (lines[lines.length - 1] === "") {
|
|
207
|
+
lines.pop();
|
|
208
|
+
}
|
|
209
|
+
lines.push("[/BRAIN_CONTEXT]");
|
|
210
|
+
return `${lines.join("\n")}\n`;
|
|
211
|
+
}
|
|
212
|
+
function fallbackCompileResult(error, activationRoot) {
|
|
213
|
+
return {
|
|
214
|
+
ok: false,
|
|
215
|
+
fallbackToStaticContext: true,
|
|
216
|
+
activationRoot: path.resolve(activationRoot),
|
|
217
|
+
error: toErrorMessage(error),
|
|
218
|
+
brainContext: ""
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
export function resolveActivePackForCompile(activationRoot) {
|
|
222
|
+
const resolvedActivationRoot = path.resolve(normalizeNonEmptyString(activationRoot, "activationRoot"));
|
|
223
|
+
const inspection = inspectActivationState(resolvedActivationRoot);
|
|
224
|
+
const activePointer = inspection.pointers.active;
|
|
225
|
+
if (inspection.active === null || activePointer === null) {
|
|
226
|
+
throw new Error(`No active pack pointer found in ${resolvedActivationRoot}`);
|
|
227
|
+
}
|
|
228
|
+
if (!inspection.active.activationReady) {
|
|
229
|
+
throw new Error(`Active pack is not activation-ready: ${inspection.active.findings.join("; ")}`);
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
activationRoot: resolvedActivationRoot,
|
|
233
|
+
activePointer,
|
|
234
|
+
inspection: inspection.active
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
export function compileRuntimeContext(input) {
|
|
238
|
+
const activationRoot = path.resolve(normalizeNonEmptyString(input.activationRoot, "activationRoot"));
|
|
239
|
+
const agentId = normalizeOptionalString(input.agentId) ?? process.env.OPENCLAWBRAIN_AGENT_ID ?? DEFAULT_AGENT_ID;
|
|
240
|
+
const runtimeHints = normalizeRuntimeHints(input.runtimeHints);
|
|
241
|
+
try {
|
|
242
|
+
const target = resolveActivePackForCompile(activationRoot);
|
|
243
|
+
const compileResponse = compileRuntime(target.activePointer.packRootDir, {
|
|
244
|
+
contract: CONTRACT_IDS.runtimeCompile,
|
|
245
|
+
agentId,
|
|
246
|
+
userMessage: normalizeNonEmptyString(input.message, "message"),
|
|
247
|
+
maxContextBlocks: normalizeNonNegativeInteger(input.maxContextBlocks, "maxContextBlocks", 4),
|
|
248
|
+
modeRequested: normalizeMode(input.mode),
|
|
249
|
+
activePackId: target.activePointer.packId,
|
|
250
|
+
...(runtimeHints.length > 0 ? { runtimeHints } : {})
|
|
251
|
+
});
|
|
252
|
+
return {
|
|
253
|
+
ok: true,
|
|
254
|
+
fallbackToStaticContext: false,
|
|
255
|
+
activationRoot,
|
|
256
|
+
activePackId: target.activePointer.packId,
|
|
257
|
+
packRootDir: path.resolve(target.activePointer.packRootDir),
|
|
258
|
+
compileResponse,
|
|
259
|
+
brainContext: formatPromptContext(compileResponse)
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
return fallbackCompileResult(error, activationRoot);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function buildCompileInteractionEvent(input) {
|
|
267
|
+
if (!input.compileResult.ok) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
const sequence = input.nextSequence(input.turn.compile?.sequence);
|
|
271
|
+
const eventId = normalizeOptionalString(input.turn.compile?.eventId) ?? deterministicEventId({
|
|
272
|
+
channel: input.turn.channel,
|
|
273
|
+
createdAt: input.createdAt,
|
|
274
|
+
kind: "memory_compiled",
|
|
275
|
+
packId: input.compileResult.compileResponse.packId,
|
|
276
|
+
sequence,
|
|
277
|
+
sessionId: input.turn.sessionId,
|
|
278
|
+
source: input.sourceStream
|
|
279
|
+
});
|
|
280
|
+
return createInteractionEvent({
|
|
281
|
+
eventId,
|
|
282
|
+
agentId: input.agentId,
|
|
283
|
+
sessionId: input.turn.sessionId,
|
|
284
|
+
channel: input.turn.channel,
|
|
285
|
+
sequence,
|
|
286
|
+
kind: "memory_compiled",
|
|
287
|
+
createdAt: input.createdAt,
|
|
288
|
+
source: {
|
|
289
|
+
runtimeOwner: "openclaw",
|
|
290
|
+
stream: input.sourceStream
|
|
291
|
+
},
|
|
292
|
+
packId: input.compileResult.compileResponse.packId
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function buildDeliveryInteractionEvent(input) {
|
|
296
|
+
if (input.turn.delivery === undefined || input.turn.delivery === null || input.turn.delivery === false) {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
const delivery = typeof input.turn.delivery === "object" ? input.turn.delivery : {};
|
|
300
|
+
const createdAt = normalizeIsoTimestamp(delivery.createdAt, "delivery.createdAt", input.defaultCreatedAt);
|
|
301
|
+
const sequence = input.nextSequence(delivery.sequence);
|
|
302
|
+
const messageId = normalizeOptionalString(delivery.messageId);
|
|
303
|
+
const eventId = normalizeOptionalString(delivery.eventId) ?? deterministicEventId({
|
|
304
|
+
channel: input.turn.channel,
|
|
305
|
+
createdAt,
|
|
306
|
+
kind: "message_delivered",
|
|
307
|
+
messageId: messageId ?? null,
|
|
308
|
+
packId: input.compileResult.ok ? input.compileResult.compileResponse.packId : null,
|
|
309
|
+
sequence,
|
|
310
|
+
sessionId: input.turn.sessionId,
|
|
311
|
+
source: input.sourceStream
|
|
312
|
+
});
|
|
313
|
+
return createInteractionEvent({
|
|
314
|
+
eventId,
|
|
315
|
+
agentId: input.agentId,
|
|
316
|
+
sessionId: input.turn.sessionId,
|
|
317
|
+
channel: input.turn.channel,
|
|
318
|
+
sequence,
|
|
319
|
+
kind: "message_delivered",
|
|
320
|
+
createdAt,
|
|
321
|
+
source: {
|
|
322
|
+
runtimeOwner: "openclaw",
|
|
323
|
+
stream: input.sourceStream
|
|
324
|
+
},
|
|
325
|
+
...(input.compileResult.ok ? { packId: input.compileResult.compileResponse.packId } : {}),
|
|
326
|
+
...(messageId !== undefined ? { messageId } : {})
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function buildFeedbackEvents(input) {
|
|
330
|
+
const feedbackItems = input.turn.feedback ?? [];
|
|
331
|
+
return feedbackItems.map((item, index) => {
|
|
332
|
+
if (item === null) {
|
|
333
|
+
throw new Error(`feedback[${index}] must be an object`);
|
|
334
|
+
}
|
|
335
|
+
const content = normalizeNonEmptyString(item.content, `feedback[${index}].content`);
|
|
336
|
+
const createdAt = normalizeIsoTimestamp(item.createdAt, `feedback[${index}].createdAt`, input.defaultCreatedAt);
|
|
337
|
+
const sequence = input.nextSequence(item.sequence);
|
|
338
|
+
const kind = item.kind === undefined || item.kind === null ? classifyFeedbackKind(content) : item.kind;
|
|
339
|
+
if (!isFeedbackKind(kind)) {
|
|
340
|
+
throw new Error(`feedback[${index}].kind must be correction, teaching, approval, or suppression`);
|
|
341
|
+
}
|
|
342
|
+
const messageId = normalizeOptionalString(item.messageId);
|
|
343
|
+
const eventId = normalizeOptionalString(item.eventId) ?? deterministicEventId({
|
|
344
|
+
channel: input.turn.channel,
|
|
345
|
+
content,
|
|
346
|
+
createdAt,
|
|
347
|
+
kind,
|
|
348
|
+
messageId: messageId ?? null,
|
|
349
|
+
sequence,
|
|
350
|
+
sessionId: input.turn.sessionId,
|
|
351
|
+
source: input.sourceStream
|
|
352
|
+
});
|
|
353
|
+
const relatedInteractionId = normalizeOptionalString(item.relatedInteractionId) ?? input.compileInteraction?.eventId;
|
|
354
|
+
return createFeedbackEvent({
|
|
355
|
+
eventId,
|
|
356
|
+
agentId: input.agentId,
|
|
357
|
+
sessionId: input.turn.sessionId,
|
|
358
|
+
channel: input.turn.channel,
|
|
359
|
+
sequence,
|
|
360
|
+
kind,
|
|
361
|
+
createdAt,
|
|
362
|
+
source: {
|
|
363
|
+
runtimeOwner: "openclaw",
|
|
364
|
+
stream: input.sourceStream
|
|
365
|
+
},
|
|
366
|
+
content,
|
|
367
|
+
...(messageId !== undefined ? { messageId } : {}),
|
|
368
|
+
...(relatedInteractionId !== undefined ? { relatedInteractionId } : {})
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
export function buildNormalizedRuntimeEventExport(turn, compileResult) {
|
|
373
|
+
const agentId = normalizeOptionalString(turn.agentId) ?? process.env.OPENCLAWBRAIN_AGENT_ID ?? DEFAULT_AGENT_ID;
|
|
374
|
+
const sessionId = normalizeNonEmptyString(turn.sessionId, "sessionId");
|
|
375
|
+
const channel = normalizeNonEmptyString(turn.channel, "channel");
|
|
376
|
+
const sourceStream = normalizeOptionalString(turn.sourceStream) ?? `openclaw/runtime/${channel}`;
|
|
377
|
+
const compileCreatedAt = normalizeIsoTimestamp(turn.compile?.createdAt, "compile.createdAt", turn.createdAt);
|
|
378
|
+
const nextSequence = nextSequenceFactory(turn.sequenceStart ?? 1);
|
|
379
|
+
const normalizedTurn = {
|
|
380
|
+
...turn,
|
|
381
|
+
agentId,
|
|
382
|
+
channel,
|
|
383
|
+
sessionId
|
|
384
|
+
};
|
|
385
|
+
const compileInteraction = buildCompileInteractionEvent({
|
|
386
|
+
turn: normalizedTurn,
|
|
387
|
+
compileResult,
|
|
388
|
+
sourceStream,
|
|
389
|
+
nextSequence,
|
|
390
|
+
createdAt: compileCreatedAt,
|
|
391
|
+
agentId
|
|
392
|
+
});
|
|
393
|
+
const feedbackEvents = buildFeedbackEvents({
|
|
394
|
+
turn: normalizedTurn,
|
|
395
|
+
sourceStream,
|
|
396
|
+
nextSequence,
|
|
397
|
+
defaultCreatedAt: compileCreatedAt,
|
|
398
|
+
compileInteraction,
|
|
399
|
+
agentId
|
|
400
|
+
});
|
|
401
|
+
const deliveryInteraction = buildDeliveryInteractionEvent({
|
|
402
|
+
turn: normalizedTurn,
|
|
403
|
+
compileResult,
|
|
404
|
+
sourceStream,
|
|
405
|
+
nextSequence,
|
|
406
|
+
defaultCreatedAt: compileCreatedAt,
|
|
407
|
+
agentId
|
|
408
|
+
});
|
|
409
|
+
const interactionEvents = [compileInteraction, deliveryInteraction].filter(isPresent);
|
|
410
|
+
if (interactionEvents.length === 0 && feedbackEvents.length === 0) {
|
|
411
|
+
throw new Error("runtime turn did not produce any normalized events");
|
|
412
|
+
}
|
|
413
|
+
const normalizedEventExport = buildNormalizedEventExport({
|
|
414
|
+
interactionEvents,
|
|
415
|
+
feedbackEvents
|
|
416
|
+
});
|
|
417
|
+
const validationErrors = validateNormalizedEventExport(normalizedEventExport);
|
|
418
|
+
if (validationErrors.length > 0) {
|
|
419
|
+
throw new Error(`normalized event export is invalid: ${validationErrors.join("; ")}`);
|
|
420
|
+
}
|
|
421
|
+
return normalizedEventExport;
|
|
422
|
+
}
|
|
423
|
+
export function writeRuntimeEventExportBundle(turn, normalizedEventExport) {
|
|
424
|
+
if (turn.export === undefined || turn.export === null) {
|
|
425
|
+
return {
|
|
426
|
+
ok: true,
|
|
427
|
+
wroteBundle: false,
|
|
428
|
+
normalizedEventExport
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
const rootDir = normalizeNonEmptyString(turn.export.rootDir, "export.rootDir");
|
|
432
|
+
const exportName = normalizeOptionalString(turn.export.exportName) ??
|
|
433
|
+
`${turn.sessionId}-${normalizedEventExport.range.start}-${normalizedEventExport.range.end}`;
|
|
434
|
+
const exportedAt = normalizeIsoTimestamp(turn.export.exportedAt, "export.exportedAt", normalizedEventExport.range.lastCreatedAt ?? normalizedEventExport.range.firstCreatedAt ?? new Date().toISOString());
|
|
435
|
+
const resolvedRoot = path.resolve(rootDir);
|
|
436
|
+
const manifest = buildRuntimeEventExportBundleManifest({
|
|
437
|
+
exportName,
|
|
438
|
+
exportedAt,
|
|
439
|
+
payloadPath: RUNTIME_EVENT_EXPORT_BUNDLE_LAYOUT.payload,
|
|
440
|
+
normalizedEventExport
|
|
441
|
+
});
|
|
442
|
+
const manifestPath = path.join(resolvedRoot, RUNTIME_EVENT_EXPORT_BUNDLE_LAYOUT.manifest);
|
|
443
|
+
const payloadPath = path.join(resolvedRoot, manifest.payloadPath);
|
|
444
|
+
mkdirSync(path.dirname(payloadPath), { recursive: true });
|
|
445
|
+
writeFileSync(payloadPath, canonicalJson(normalizedEventExport), "utf8");
|
|
446
|
+
writeFileSync(manifestPath, canonicalJson(manifest), "utf8");
|
|
447
|
+
const descriptor = loadRuntimeEventExportBundle(resolvedRoot);
|
|
448
|
+
return {
|
|
449
|
+
ok: true,
|
|
450
|
+
wroteBundle: true,
|
|
451
|
+
normalizedEventExport,
|
|
452
|
+
rootDir: descriptor.rootDir,
|
|
453
|
+
manifestPath: descriptor.manifestPath,
|
|
454
|
+
payloadPath: descriptor.payloadPath,
|
|
455
|
+
manifest: descriptor.manifest
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
export function runRuntimeTurn(turn, options = {}) {
|
|
459
|
+
const agentId = normalizeOptionalString(turn.agentId);
|
|
460
|
+
const compileInput = {
|
|
461
|
+
activationRoot: options.activationRoot ?? normalizeNonEmptyString(turn.activationRoot ?? undefined, "activationRoot"),
|
|
462
|
+
message: normalizeNonEmptyString(turn.userMessage, "userMessage"),
|
|
463
|
+
...(agentId !== undefined ? { agentId } : {}),
|
|
464
|
+
...(turn.maxContextBlocks !== undefined ? { maxContextBlocks: turn.maxContextBlocks } : {}),
|
|
465
|
+
...(turn.mode !== undefined ? { mode: turn.mode } : {}),
|
|
466
|
+
...(turn.runtimeHints !== undefined ? { runtimeHints: turn.runtimeHints } : {})
|
|
467
|
+
};
|
|
468
|
+
const compileResult = compileRuntimeContext(compileInput);
|
|
469
|
+
const warnings = [];
|
|
470
|
+
try {
|
|
471
|
+
const normalizedEventExport = buildNormalizedRuntimeEventExport(turn, compileResult);
|
|
472
|
+
const eventExport = writeRuntimeEventExportBundle(turn, normalizedEventExport);
|
|
473
|
+
return {
|
|
474
|
+
...compileResult,
|
|
475
|
+
eventExport,
|
|
476
|
+
warnings
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
catch (error) {
|
|
480
|
+
if (options.failOpen === false) {
|
|
481
|
+
throw error;
|
|
482
|
+
}
|
|
483
|
+
warnings.push(toErrorMessage(error));
|
|
484
|
+
return {
|
|
485
|
+
...compileResult,
|
|
486
|
+
eventExport: {
|
|
487
|
+
ok: false,
|
|
488
|
+
wroteBundle: false,
|
|
489
|
+
error: toErrorMessage(error)
|
|
490
|
+
},
|
|
491
|
+
warnings
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EAQtB,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAiC,MAAM,4BAA4B,CAAC;AAEnG,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAC5C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAoB,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC;AAGzG,MAAM,oCAAoC,GAAG,mCAA4C,CAAC;AAE1F,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,QAAQ,EAAE,eAAe;IACzB,OAAO,EAAE,8BAA8B;CAC/B,CAAC;AAqJX,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OA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AY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChF,CAAC;IACF,MAAM,aAAa,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,CAAC;QACH,MAAM,qBAAqB,GAAG,iCAAiC,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QACrF,MAAM,WAAW,GAAG,6BAA6B,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QAC/E,OAAO;YACL,GAAG,aAAa;YAChB,WAAW;YACX,QAAQ;SACT,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YAC/B,MAAM,KAAK,CAAC;QACd,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;QACrC,OAAO;YACL,GAAG,aAAa;YAChB,WAAW,EAAE;gBACX,EAAE,EAAE,KAAK;gBACT,WAAW,EAAE,KAAK;gBAClB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC;aAC7B;YACD,QAAQ;SACT,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openclawbrain/openclaw",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OpenClaw-facing runtime integration helpers for active-pack compile consumption and normalized event emission.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/src/index.js",
|
|
7
|
+
"types": "./dist/src/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"author": "Jonathan Gu <jonathangu@gmail.com>",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"openclawbrain",
|
|
13
|
+
"openclaw",
|
|
14
|
+
"runtime",
|
|
15
|
+
"typescript"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/jonathangu/openclawbrain.git",
|
|
20
|
+
"directory": "packages/openclaw"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/jonathangu/openclawbrain/tree/main/packages/openclaw#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/jonathangu/openclawbrain/issues"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=20"
|
|
28
|
+
},
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/src/index.d.ts",
|
|
32
|
+
"import": "./dist/src/index.js",
|
|
33
|
+
"default": "./dist/src/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist/src"
|
|
39
|
+
],
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -b",
|
|
45
|
+
"clean": "tsc -b --clean",
|
|
46
|
+
"prepack": "pnpm run build",
|
|
47
|
+
"test": "node --test dist/test/*.test.js"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@openclawbrain/compiler": "workspace:^",
|
|
51
|
+
"@openclawbrain/contracts": "workspace:^",
|
|
52
|
+
"@openclawbrain/learner": "workspace:^",
|
|
53
|
+
"@openclawbrain/pack-format": "workspace:^"
|
|
54
|
+
}
|
|
55
|
+
}
|