moltblock 0.3.0 → 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.
- package/dist/agents.d.ts +0 -1
- package/dist/agents.js +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -1
- package/dist/config.d.ts +15 -95
- package/dist/config.js +172 -18
- package/dist/entity.d.ts +0 -1
- package/dist/entity.js +0 -1
- package/dist/gateway.d.ts +0 -1
- package/dist/gateway.js +0 -1
- package/dist/governance.d.ts +0 -1
- package/dist/governance.js +0 -1
- package/dist/graph-runner.d.ts +0 -1
- package/dist/graph-runner.js +0 -1
- package/dist/graph-schema.d.ts +5 -56
- package/dist/graph-schema.js +0 -1
- package/dist/handoff.d.ts +0 -1
- package/dist/handoff.js +0 -1
- package/dist/improvement.d.ts +0 -1
- package/dist/improvement.js +0 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/memory.d.ts +0 -1
- package/dist/memory.js +0 -1
- package/dist/persistence.d.ts +0 -1
- package/dist/persistence.js +13 -5
- package/dist/signing.d.ts +0 -1
- package/dist/signing.js +41 -10
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -1
- package/dist/validation.d.ts +0 -1
- package/dist/validation.js +0 -1
- package/dist/verifier.d.ts +0 -1
- package/dist/verifier.js +12 -6
- package/package.json +10 -10
- package/readme.md +83 -7
- package/dist/agents.d.ts.map +0 -1
- package/dist/agents.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/entity.d.ts.map +0 -1
- package/dist/entity.js.map +0 -1
- package/dist/gateway.d.ts.map +0 -1
- package/dist/gateway.js.map +0 -1
- package/dist/governance.d.ts.map +0 -1
- package/dist/governance.js.map +0 -1
- package/dist/graph-runner.d.ts.map +0 -1
- package/dist/graph-runner.js.map +0 -1
- package/dist/graph-schema.d.ts.map +0 -1
- package/dist/graph-schema.js.map +0 -1
- package/dist/handoff.d.ts.map +0 -1
- package/dist/handoff.js.map +0 -1
- package/dist/improvement.d.ts.map +0 -1
- package/dist/improvement.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/memory.d.ts.map +0 -1
- package/dist/memory.js.map +0 -1
- package/dist/persistence.d.ts.map +0 -1
- package/dist/persistence.js.map +0 -1
- package/dist/signing.d.ts.map +0 -1
- package/dist/signing.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/validation.d.ts.map +0 -1
- package/dist/validation.js.map +0 -1
- package/dist/verifier.d.ts.map +0 -1
- package/dist/verifier.js.map +0 -1
package/dist/agents.d.ts
CHANGED
|
@@ -21,4 +21,3 @@ export declare function runJudge(gateway: LLMGateway, memory: WorkingMemory, sto
|
|
|
21
21
|
* Returns the role's output string. Used by the graph runner.
|
|
22
22
|
*/
|
|
23
23
|
export declare function runRole(role: string, gateway: LLMGateway, task: string, inputs: Record<string, string>, longTermContext?: string, store?: Store | null): Promise<string>;
|
|
24
|
-
//# sourceMappingURL=agents.d.ts.map
|
package/dist/agents.js
CHANGED
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
package/dist/config.d.ts
CHANGED
|
@@ -8,17 +8,7 @@ export declare const BindingEntrySchema: z.ZodObject<{
|
|
|
8
8
|
base_url: z.ZodString;
|
|
9
9
|
model: z.ZodDefault<z.ZodString>;
|
|
10
10
|
api_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
-
},
|
|
12
|
-
model: string;
|
|
13
|
-
backend: string;
|
|
14
|
-
base_url: string;
|
|
15
|
-
api_key?: string | null | undefined;
|
|
16
|
-
}, {
|
|
17
|
-
backend: string;
|
|
18
|
-
base_url: string;
|
|
19
|
-
model?: string | undefined;
|
|
20
|
-
api_key?: string | null | undefined;
|
|
21
|
-
}>;
|
|
11
|
+
}, z.core.$strip>;
|
|
22
12
|
export type BindingEntry = z.infer<typeof BindingEntrySchema>;
|
|
23
13
|
export declare const AgentConfigSchema: z.ZodObject<{
|
|
24
14
|
bindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -26,32 +16,8 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
26
16
|
base_url: z.ZodString;
|
|
27
17
|
model: z.ZodDefault<z.ZodString>;
|
|
28
18
|
api_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
backend: string;
|
|
32
|
-
base_url: string;
|
|
33
|
-
api_key?: string | null | undefined;
|
|
34
|
-
}, {
|
|
35
|
-
backend: string;
|
|
36
|
-
base_url: string;
|
|
37
|
-
model?: string | undefined;
|
|
38
|
-
api_key?: string | null | undefined;
|
|
39
|
-
}>>>;
|
|
40
|
-
}, "strip", z.ZodTypeAny, {
|
|
41
|
-
bindings?: Record<string, {
|
|
42
|
-
model: string;
|
|
43
|
-
backend: string;
|
|
44
|
-
base_url: string;
|
|
45
|
-
api_key?: string | null | undefined;
|
|
46
|
-
}> | undefined;
|
|
47
|
-
}, {
|
|
48
|
-
bindings?: Record<string, {
|
|
49
|
-
backend: string;
|
|
50
|
-
base_url: string;
|
|
51
|
-
model?: string | undefined;
|
|
52
|
-
api_key?: string | null | undefined;
|
|
53
|
-
}> | undefined;
|
|
54
|
-
}>;
|
|
19
|
+
}, z.core.$strip>>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
55
21
|
export type AgentConfig = z.infer<typeof AgentConfigSchema>;
|
|
56
22
|
export declare const MoltblockConfigSchema: z.ZodObject<{
|
|
57
23
|
agent: z.ZodOptional<z.ZodObject<{
|
|
@@ -60,71 +26,26 @@ export declare const MoltblockConfigSchema: z.ZodObject<{
|
|
|
60
26
|
base_url: z.ZodString;
|
|
61
27
|
model: z.ZodDefault<z.ZodString>;
|
|
62
28
|
api_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
base_url: string;
|
|
67
|
-
api_key?: string | null | undefined;
|
|
68
|
-
}, {
|
|
69
|
-
backend: string;
|
|
70
|
-
base_url: string;
|
|
71
|
-
model?: string | undefined;
|
|
72
|
-
api_key?: string | null | undefined;
|
|
73
|
-
}>>>;
|
|
74
|
-
}, "strip", z.ZodTypeAny, {
|
|
75
|
-
bindings?: Record<string, {
|
|
76
|
-
model: string;
|
|
77
|
-
backend: string;
|
|
78
|
-
base_url: string;
|
|
79
|
-
api_key?: string | null | undefined;
|
|
80
|
-
}> | undefined;
|
|
81
|
-
}, {
|
|
82
|
-
bindings?: Record<string, {
|
|
83
|
-
backend: string;
|
|
84
|
-
base_url: string;
|
|
85
|
-
model?: string | undefined;
|
|
86
|
-
api_key?: string | null | undefined;
|
|
87
|
-
}> | undefined;
|
|
88
|
-
}>>;
|
|
89
|
-
}, "strip", z.ZodTypeAny, {
|
|
90
|
-
agent?: {
|
|
91
|
-
bindings?: Record<string, {
|
|
92
|
-
model: string;
|
|
93
|
-
backend: string;
|
|
94
|
-
base_url: string;
|
|
95
|
-
api_key?: string | null | undefined;
|
|
96
|
-
}> | undefined;
|
|
97
|
-
} | undefined;
|
|
98
|
-
}, {
|
|
99
|
-
agent?: {
|
|
100
|
-
bindings?: Record<string, {
|
|
101
|
-
backend: string;
|
|
102
|
-
base_url: string;
|
|
103
|
-
model?: string | undefined;
|
|
104
|
-
api_key?: string | null | undefined;
|
|
105
|
-
}> | undefined;
|
|
106
|
-
} | undefined;
|
|
107
|
-
}>;
|
|
29
|
+
}, z.core.$strip>>>;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
108
32
|
export type MoltblockConfig = z.infer<typeof MoltblockConfigSchema>;
|
|
109
33
|
export declare const ModelBindingSchema: z.ZodObject<{
|
|
110
34
|
backend: z.ZodString;
|
|
111
35
|
baseUrl: z.ZodString;
|
|
112
36
|
apiKey: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
113
37
|
model: z.ZodDefault<z.ZodString>;
|
|
114
|
-
},
|
|
115
|
-
model: string;
|
|
116
|
-
backend: string;
|
|
117
|
-
baseUrl: string;
|
|
118
|
-
apiKey: string | null;
|
|
119
|
-
}, {
|
|
120
|
-
backend: string;
|
|
121
|
-
baseUrl: string;
|
|
122
|
-
model?: string | undefined;
|
|
123
|
-
apiKey?: string | null | undefined;
|
|
124
|
-
}>;
|
|
38
|
+
}, z.core.$strip>;
|
|
125
39
|
export type ModelBinding = z.infer<typeof ModelBindingSchema>;
|
|
40
|
+
/** Track which config source was used */
|
|
41
|
+
export type ConfigSource = "moltblock" | "openclaw" | "env" | null;
|
|
126
42
|
/**
|
|
127
|
-
*
|
|
43
|
+
* Get the source of the last loaded config.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getConfigSource(): ConfigSource;
|
|
46
|
+
/**
|
|
47
|
+
* Load and parse moltblock.json if present, fallback to openclaw.json.
|
|
48
|
+
* Returns null if no file or parse error.
|
|
128
49
|
*/
|
|
129
50
|
export declare function loadMoltblockConfig(): MoltblockConfig | null;
|
|
130
51
|
/**
|
|
@@ -132,4 +53,3 @@ export declare function loadMoltblockConfig(): MoltblockConfig | null;
|
|
|
132
53
|
* If no JSON, uses env/.env only (backward compatible). API keys from env win over JSON.
|
|
133
54
|
*/
|
|
134
55
|
export declare function defaultCodeEntityBindings(): Record<string, ModelBinding>;
|
|
135
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.js
CHANGED
|
@@ -6,10 +6,19 @@ import fs from "node:fs";
|
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import os from "node:os";
|
|
8
8
|
import { z } from "zod";
|
|
9
|
+
/** JSON.parse reviver that strips prototype pollution keys */
|
|
10
|
+
function safeJsonParse(text) {
|
|
11
|
+
return JSON.parse(text, (key, value) => {
|
|
12
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
9
18
|
// Load .env so MOLTBLOCK_ZAI_API_KEY etc. can be set there
|
|
10
19
|
try {
|
|
11
20
|
const dotenv = await import("dotenv");
|
|
12
|
-
dotenv.config();
|
|
21
|
+
dotenv.config({ quiet: true });
|
|
13
22
|
}
|
|
14
23
|
catch {
|
|
15
24
|
// dotenv not required
|
|
@@ -22,7 +31,7 @@ export const BindingEntrySchema = z.object({
|
|
|
22
31
|
api_key: z.string().nullable().optional().describe("Bearer token; null for local. Prefer env."),
|
|
23
32
|
});
|
|
24
33
|
export const AgentConfigSchema = z.object({
|
|
25
|
-
bindings: z.record(BindingEntrySchema).optional().describe("Per-role model bindings"),
|
|
34
|
+
bindings: z.record(z.string(), BindingEntrySchema).optional().describe("Per-role model bindings"),
|
|
26
35
|
});
|
|
27
36
|
export const MoltblockConfigSchema = z.object({
|
|
28
37
|
agent: AgentConfigSchema.optional().describe("Agent defaults and bindings"),
|
|
@@ -33,12 +42,18 @@ export const ModelBindingSchema = z.object({
|
|
|
33
42
|
apiKey: z.string().nullable().default(null).describe("Bearer token; null for local"),
|
|
34
43
|
model: z.string().default("default").describe("Model name for chat completion"),
|
|
35
44
|
});
|
|
45
|
+
/** Validate that a config path is within allowed directories (cwd, homedir, or tmpdir). */
|
|
46
|
+
function isAllowedConfigPath(filePath) {
|
|
47
|
+
const resolved = path.resolve(filePath);
|
|
48
|
+
const allowed = [path.resolve(process.cwd()), path.resolve(os.homedir()), path.resolve(os.tmpdir())];
|
|
49
|
+
return allowed.some((dir) => resolved.startsWith(dir + path.sep) || resolved === dir);
|
|
50
|
+
}
|
|
36
51
|
/**
|
|
37
|
-
* Resolve config file: MOLTBLOCK_CONFIG env, then ./moltblock.json, ./.moltblock/moltblock.json, ~/.moltblock/moltblock.json.
|
|
52
|
+
* Resolve moltblock config file: MOLTBLOCK_CONFIG env, then ./moltblock.json, ./.moltblock/moltblock.json, ~/.moltblock/moltblock.json.
|
|
38
53
|
*/
|
|
39
|
-
function
|
|
54
|
+
function moltblockConfigPath() {
|
|
40
55
|
const envPath = (process.env["MOLTBLOCK_CONFIG"] ?? "").trim();
|
|
41
|
-
if (envPath && fs.existsSync(envPath)) {
|
|
56
|
+
if (envPath && isAllowedConfigPath(envPath) && fs.existsSync(envPath)) {
|
|
42
57
|
return envPath;
|
|
43
58
|
}
|
|
44
59
|
const cwd = process.cwd();
|
|
@@ -55,21 +70,159 @@ function configPath() {
|
|
|
55
70
|
return null;
|
|
56
71
|
}
|
|
57
72
|
/**
|
|
58
|
-
*
|
|
73
|
+
* Resolve OpenClaw config file: OPENCLAW_CONFIG env, then ./openclaw.json, ./.openclaw/openclaw.json, ~/.openclaw/openclaw.json.
|
|
74
|
+
*/
|
|
75
|
+
function openclawConfigPath() {
|
|
76
|
+
const envPath = (process.env["OPENCLAW_CONFIG"] ?? "").trim();
|
|
77
|
+
if (envPath && isAllowedConfigPath(envPath) && fs.existsSync(envPath)) {
|
|
78
|
+
return envPath;
|
|
79
|
+
}
|
|
80
|
+
const cwd = process.cwd();
|
|
81
|
+
const candidates = [
|
|
82
|
+
path.join(cwd, "openclaw.json"),
|
|
83
|
+
path.join(cwd, ".openclaw", "openclaw.json"),
|
|
84
|
+
path.join(os.homedir(), ".openclaw", "openclaw.json"),
|
|
85
|
+
];
|
|
86
|
+
for (const candidate of candidates) {
|
|
87
|
+
if (fs.existsSync(candidate)) {
|
|
88
|
+
return candidate;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
let lastConfigSource = null;
|
|
94
|
+
/**
|
|
95
|
+
* Get the source of the last loaded config.
|
|
96
|
+
*/
|
|
97
|
+
export function getConfigSource() {
|
|
98
|
+
return lastConfigSource;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Load and parse moltblock.json if present, fallback to openclaw.json.
|
|
102
|
+
* Returns null if no file or parse error.
|
|
59
103
|
*/
|
|
60
104
|
export function loadMoltblockConfig() {
|
|
61
|
-
|
|
62
|
-
|
|
105
|
+
// Try moltblock config first
|
|
106
|
+
const moltblockFile = moltblockConfigPath();
|
|
107
|
+
if (moltblockFile) {
|
|
108
|
+
try {
|
|
109
|
+
const raw = fs.readFileSync(moltblockFile, "utf-8");
|
|
110
|
+
const data = safeJsonParse(raw);
|
|
111
|
+
const config = MoltblockConfigSchema.parse(data);
|
|
112
|
+
lastConfigSource = "moltblock";
|
|
113
|
+
return config;
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// Parse error, try fallback
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Fallback to OpenClaw config
|
|
120
|
+
const openclawFile = openclawConfigPath();
|
|
121
|
+
if (openclawFile) {
|
|
122
|
+
try {
|
|
123
|
+
const raw = fs.readFileSync(openclawFile, "utf-8");
|
|
124
|
+
const data = safeJsonParse(raw);
|
|
125
|
+
const config = parseOpenClawConfig(data);
|
|
126
|
+
if (config) {
|
|
127
|
+
lastConfigSource = "openclaw";
|
|
128
|
+
console.log(`Using OpenClaw config from ${openclawFile}`);
|
|
129
|
+
return config;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
// Parse error
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
lastConfigSource = "env";
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Parse OpenClaw config and convert to MoltblockConfig format.
|
|
141
|
+
* OpenClaw uses a similar structure but may have different field names.
|
|
142
|
+
*/
|
|
143
|
+
function parseOpenClawConfig(data) {
|
|
144
|
+
if (!data || typeof data !== "object") {
|
|
63
145
|
return null;
|
|
64
146
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
147
|
+
const obj = data;
|
|
148
|
+
// OpenClaw may have agent.bindings or providers section
|
|
149
|
+
// Try to extract bindings from various possible locations
|
|
150
|
+
let bindings;
|
|
151
|
+
// Check for agent.bindings (same as moltblock)
|
|
152
|
+
if (obj["agent"] && typeof obj["agent"] === "object") {
|
|
153
|
+
const agent = obj["agent"];
|
|
154
|
+
if (agent["bindings"] && typeof agent["bindings"] === "object") {
|
|
155
|
+
bindings = extractBindings(agent["bindings"]);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Check for providers section (OpenClaw style)
|
|
159
|
+
if (!bindings && obj["providers"] && typeof obj["providers"] === "object") {
|
|
160
|
+
bindings = extractBindingsFromProviders(obj["providers"]);
|
|
161
|
+
}
|
|
162
|
+
// Check for models section
|
|
163
|
+
if (!bindings && obj["models"] && typeof obj["models"] === "object") {
|
|
164
|
+
bindings = extractBindings(obj["models"]);
|
|
69
165
|
}
|
|
70
|
-
|
|
166
|
+
if (!bindings) {
|
|
71
167
|
return null;
|
|
72
168
|
}
|
|
169
|
+
return {
|
|
170
|
+
agent: { bindings },
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Extract bindings from a bindings-like object.
|
|
175
|
+
*/
|
|
176
|
+
function extractBindings(obj) {
|
|
177
|
+
const result = {};
|
|
178
|
+
for (const [role, value] of Object.entries(obj)) {
|
|
179
|
+
if (value && typeof value === "object") {
|
|
180
|
+
const entry = value;
|
|
181
|
+
const rawApiKey = entry["api_key"] ?? entry["apiKey"];
|
|
182
|
+
const binding = {
|
|
183
|
+
backend: String(entry["backend"] ?? entry["provider"] ?? "openai"),
|
|
184
|
+
base_url: String(entry["base_url"] ?? entry["baseUrl"] ?? entry["url"] ?? ""),
|
|
185
|
+
model: String(entry["model"] ?? "default"),
|
|
186
|
+
api_key: typeof rawApiKey === "string" ? rawApiKey : null,
|
|
187
|
+
};
|
|
188
|
+
if (binding.base_url) {
|
|
189
|
+
result[role] = binding;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return result;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Extract bindings from OpenClaw providers section.
|
|
197
|
+
* Maps provider configs to role bindings.
|
|
198
|
+
*/
|
|
199
|
+
function extractBindingsFromProviders(providers) {
|
|
200
|
+
const result = {};
|
|
201
|
+
// Map first available provider to all roles
|
|
202
|
+
for (const [providerName, config] of Object.entries(providers)) {
|
|
203
|
+
if (config && typeof config === "object") {
|
|
204
|
+
const entry = config;
|
|
205
|
+
const rawApiKey = entry["api_key"] ?? entry["apiKey"];
|
|
206
|
+
const binding = {
|
|
207
|
+
backend: providerName,
|
|
208
|
+
base_url: String(entry["base_url"] ?? entry["baseUrl"] ?? entry["url"] ?? ""),
|
|
209
|
+
model: String(entry["model"] ?? entry["default_model"] ?? "default"),
|
|
210
|
+
api_key: typeof rawApiKey === "string" ? rawApiKey : null,
|
|
211
|
+
};
|
|
212
|
+
if (binding.base_url) {
|
|
213
|
+
// Use this provider for all roles unless specific ones are defined
|
|
214
|
+
if (!result["generator"])
|
|
215
|
+
result["generator"] = binding;
|
|
216
|
+
if (!result["critic"])
|
|
217
|
+
result["critic"] = binding;
|
|
218
|
+
if (!result["judge"])
|
|
219
|
+
result["judge"] = binding;
|
|
220
|
+
if (!result["verifier"])
|
|
221
|
+
result["verifier"] = binding;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return result;
|
|
73
226
|
}
|
|
74
227
|
function env(key, defaultValue = "") {
|
|
75
228
|
return (process.env[key] ?? defaultValue).trim();
|
|
@@ -110,10 +263,12 @@ export function defaultCodeEntityBindings() {
|
|
|
110
263
|
if (entry) {
|
|
111
264
|
const baseUrl = envUrl(`MOLTBLOCK_${role.toUpperCase()}_BASE_URL`, entry.base_url);
|
|
112
265
|
const model = envModel(`MOLTBLOCK_${role.toUpperCase()}_MODEL`, entry.model ?? "default");
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
266
|
+
const envApiKey = env(`MOLTBLOCK_${role.toUpperCase()}_API_KEY`);
|
|
267
|
+
if (!envApiKey && entry.api_key) {
|
|
268
|
+
console.warn(`Warning: API key for "${role}" loaded from config file. ` +
|
|
269
|
+
`Use environment variables instead for better security.`);
|
|
270
|
+
}
|
|
271
|
+
const apiKey = envApiKey || entry.api_key || getApiKeyForBackend(entry.backend) || null;
|
|
117
272
|
return { backend: entry.backend, baseUrl, apiKey, model };
|
|
118
273
|
}
|
|
119
274
|
// No JSON: legacy env-only behavior
|
|
@@ -155,4 +310,3 @@ export function defaultCodeEntityBindings() {
|
|
|
155
310
|
verifier: bindingFor("verifier", "local", localUrl, localModel, null),
|
|
156
311
|
};
|
|
157
312
|
}
|
|
158
|
-
//# sourceMappingURL=config.js.map
|
package/dist/entity.d.ts
CHANGED
|
@@ -28,4 +28,3 @@ export declare class CodeEntity {
|
|
|
28
28
|
* Load an Entity from a declarative graph (JSON/YAML). Returns a GraphRunner.
|
|
29
29
|
*/
|
|
30
30
|
export declare function loadEntityWithGraph(graphPath: string, bindings?: Record<string, ModelBinding>): GraphRunner;
|
|
31
|
-
//# sourceMappingURL=entity.d.ts.map
|
package/dist/entity.js
CHANGED
package/dist/gateway.d.ts
CHANGED
package/dist/gateway.js
CHANGED
package/dist/governance.d.ts
CHANGED
package/dist/governance.js
CHANGED
package/dist/graph-runner.d.ts
CHANGED
package/dist/graph-runner.js
CHANGED
package/dist/graph-schema.d.ts
CHANGED
|
@@ -6,75 +6,25 @@ export declare const GraphNodeSchema: z.ZodObject<{
|
|
|
6
6
|
id: z.ZodString;
|
|
7
7
|
role: z.ZodString;
|
|
8
8
|
binding: z.ZodString;
|
|
9
|
-
},
|
|
10
|
-
id: string;
|
|
11
|
-
role: string;
|
|
12
|
-
binding: string;
|
|
13
|
-
}, {
|
|
14
|
-
id: string;
|
|
15
|
-
role: string;
|
|
16
|
-
binding: string;
|
|
17
|
-
}>;
|
|
9
|
+
}, z.core.$strip>;
|
|
18
10
|
export type GraphNode = z.infer<typeof GraphNodeSchema>;
|
|
19
11
|
export declare const GraphEdgeSchema: z.ZodObject<{
|
|
20
12
|
from: z.ZodString;
|
|
21
13
|
to: z.ZodString;
|
|
22
|
-
},
|
|
23
|
-
from: string;
|
|
24
|
-
to: string;
|
|
25
|
-
}, {
|
|
26
|
-
from: string;
|
|
27
|
-
to: string;
|
|
28
|
-
}>;
|
|
14
|
+
}, z.core.$strip>;
|
|
29
15
|
export type GraphEdge = z.infer<typeof GraphEdgeSchema>;
|
|
30
16
|
export declare const AgentGraphSchema: z.ZodObject<{
|
|
31
17
|
nodes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
32
18
|
id: z.ZodString;
|
|
33
19
|
role: z.ZodString;
|
|
34
20
|
binding: z.ZodString;
|
|
35
|
-
},
|
|
36
|
-
id: string;
|
|
37
|
-
role: string;
|
|
38
|
-
binding: string;
|
|
39
|
-
}, {
|
|
40
|
-
id: string;
|
|
41
|
-
role: string;
|
|
42
|
-
binding: string;
|
|
43
|
-
}>, "many">>;
|
|
21
|
+
}, z.core.$strip>>>;
|
|
44
22
|
edges: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
45
23
|
from: z.ZodString;
|
|
46
24
|
to: z.ZodString;
|
|
47
|
-
},
|
|
48
|
-
from: string;
|
|
49
|
-
to: string;
|
|
50
|
-
}, {
|
|
51
|
-
from: string;
|
|
52
|
-
to: string;
|
|
53
|
-
}>, "many">>;
|
|
25
|
+
}, z.core.$strip>>>;
|
|
54
26
|
final_node: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
-
},
|
|
56
|
-
nodes: {
|
|
57
|
-
id: string;
|
|
58
|
-
role: string;
|
|
59
|
-
binding: string;
|
|
60
|
-
}[];
|
|
61
|
-
edges: {
|
|
62
|
-
from: string;
|
|
63
|
-
to: string;
|
|
64
|
-
}[];
|
|
65
|
-
final_node?: string | null | undefined;
|
|
66
|
-
}, {
|
|
67
|
-
nodes?: {
|
|
68
|
-
id: string;
|
|
69
|
-
role: string;
|
|
70
|
-
binding: string;
|
|
71
|
-
}[] | undefined;
|
|
72
|
-
edges?: {
|
|
73
|
-
from: string;
|
|
74
|
-
to: string;
|
|
75
|
-
}[] | undefined;
|
|
76
|
-
final_node?: string | null | undefined;
|
|
77
|
-
}>;
|
|
27
|
+
}, z.core.$strip>;
|
|
78
28
|
export type AgentGraphData = z.infer<typeof AgentGraphSchema>;
|
|
79
29
|
/**
|
|
80
30
|
* Declarative agent graph: nodes and edges. Verifier runs on final node(s) output.
|
|
@@ -113,4 +63,3 @@ export declare class AgentGraph {
|
|
|
113
63
|
*/
|
|
114
64
|
static fromData(data: AgentGraphData): AgentGraph;
|
|
115
65
|
}
|
|
116
|
-
//# sourceMappingURL=graph-schema.d.ts.map
|
package/dist/graph-schema.js
CHANGED
package/dist/handoff.d.ts
CHANGED
package/dist/handoff.js
CHANGED
package/dist/improvement.d.ts
CHANGED
package/dist/improvement.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const VERSION = "0.2.0";
|
|
|
5
5
|
export type { ModelBinding, BindingEntry, AgentConfig, MoltblockConfig, ChatMessage, VerifiedMemoryEntry, CheckpointEntry, OutcomeEntry, InboxEntry, StrategySuggestion, ReceivedArtifact, GovernanceConfig, } from "./types.js";
|
|
6
6
|
export { WorkingMemory } from "./memory.js";
|
|
7
7
|
export { signArtifact, verifyArtifact, artifactHash } from "./signing.js";
|
|
8
|
-
export { loadMoltblockConfig, defaultCodeEntityBindings, BindingEntrySchema, AgentConfigSchema, MoltblockConfigSchema, ModelBindingSchema, } from "./config.js";
|
|
8
|
+
export { loadMoltblockConfig, defaultCodeEntityBindings, getConfigSource, BindingEntrySchema, AgentConfigSchema, MoltblockConfigSchema, ModelBindingSchema, type ConfigSource, } from "./config.js";
|
|
9
9
|
export { Store, hashGraph, hashMemory, auditLog, getGovernanceValue, setGovernanceValue, putInbox, getInbox, recordOutcome, getRecentOutcomes, getStrategy, setStrategy, } from "./persistence.js";
|
|
10
10
|
export { LLMGateway } from "./gateway.js";
|
|
11
11
|
export { runGenerator, runCritic, runJudge, runRole, } from "./agents.js";
|
|
@@ -17,4 +17,3 @@ export { sendArtifact, receiveArtifacts } from "./handoff.js";
|
|
|
17
17
|
export { critiqueStrategies, applySuggestion, runEval, runImprovementCycle, } from "./improvement.js";
|
|
18
18
|
export { validateTask, validateTestCode, MAX_TASK_LENGTH, MIN_TASK_LENGTH, type ValidationResult, } from "./validation.js";
|
|
19
19
|
export { CodeEntity, loadEntityWithGraph } from "./entity.js";
|
|
20
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export { WorkingMemory } from "./memory.js";
|
|
|
7
7
|
// Signing
|
|
8
8
|
export { signArtifact, verifyArtifact, artifactHash } from "./signing.js";
|
|
9
9
|
// Config
|
|
10
|
-
export { loadMoltblockConfig, defaultCodeEntityBindings, BindingEntrySchema, AgentConfigSchema, MoltblockConfigSchema, ModelBindingSchema, } from "./config.js";
|
|
10
|
+
export { loadMoltblockConfig, defaultCodeEntityBindings, getConfigSource, BindingEntrySchema, AgentConfigSchema, MoltblockConfigSchema, ModelBindingSchema, } from "./config.js";
|
|
11
11
|
// Persistence
|
|
12
12
|
export { Store, hashGraph, hashMemory, auditLog, getGovernanceValue, setGovernanceValue, putInbox, getInbox, recordOutcome, getRecentOutcomes, getStrategy, setStrategy, } from "./persistence.js";
|
|
13
13
|
// Gateway
|
|
@@ -30,4 +30,3 @@ export { critiqueStrategies, applySuggestion, runEval, runImprovementCycle, } fr
|
|
|
30
30
|
export { validateTask, validateTestCode, MAX_TASK_LENGTH, MIN_TASK_LENGTH, } from "./validation.js";
|
|
31
31
|
// Entity
|
|
32
32
|
export { CodeEntity, loadEntityWithGraph } from "./entity.js";
|
|
33
|
-
//# sourceMappingURL=index.js.map
|
package/dist/memory.d.ts
CHANGED
package/dist/memory.js
CHANGED
package/dist/persistence.d.ts
CHANGED
|
@@ -80,4 +80,3 @@ export declare function getStrategy(store: Store, role: string): string | null;
|
|
|
80
80
|
* Set strategy (prompt) for role; inserts new version.
|
|
81
81
|
*/
|
|
82
82
|
export declare function setStrategy(store: Store, role: string, content: string): void;
|
|
83
|
-
//# sourceMappingURL=persistence.d.ts.map
|