@almadar/agent 2.0.5 → 3.2.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/builder/builder-tools.d.ts +26 -0
- package/dist/builder/index.d.ts +10 -0
- package/dist/builder/index.js +424 -0
- package/dist/builder/index.js.map +1 -0
- package/dist/builder/types.d.ts +20 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +437 -8
- package/dist/index.js.map +1 -1
- package/dist/memory/local-memory-backend.d.ts +3 -3
- package/dist/neural/index.d.ts +12 -0
- package/dist/neural/index.js +86 -0
- package/dist/neural/index.js.map +1 -0
- package/dist/neural/masar-client.d.ts +42 -0
- package/dist/neural/types.d.ts +111 -0
- package/package.json +11 -2
package/dist/index.js
CHANGED
|
@@ -1299,6 +1299,98 @@ var init_orbital_batch_subagent = __esm({
|
|
|
1299
1299
|
});
|
|
1300
1300
|
}
|
|
1301
1301
|
});
|
|
1302
|
+
|
|
1303
|
+
// src/neural/masar-client.ts
|
|
1304
|
+
var masar_client_exports = {};
|
|
1305
|
+
__export(masar_client_exports, {
|
|
1306
|
+
MasarClient: () => MasarClient
|
|
1307
|
+
});
|
|
1308
|
+
function toNeuralPipelineResult(data) {
|
|
1309
|
+
return {
|
|
1310
|
+
success: data.success,
|
|
1311
|
+
validationPass: data.validation_pass,
|
|
1312
|
+
compilationPass: false,
|
|
1313
|
+
goalMatch: data.goal_match ?? 0,
|
|
1314
|
+
totalSteps: data.total_steps ?? 0,
|
|
1315
|
+
fixRounds: data.fix_rounds ?? 0,
|
|
1316
|
+
llmCalls: data.llm_calls ?? 0,
|
|
1317
|
+
durationMs: data.duration_ms ?? 0,
|
|
1318
|
+
schema: data.schema ?? null,
|
|
1319
|
+
schemaPath: null,
|
|
1320
|
+
actions: data.actions ?? [],
|
|
1321
|
+
validationErrors: data.validation_errors ?? [],
|
|
1322
|
+
compilationErrors: [],
|
|
1323
|
+
error: data.error ?? null
|
|
1324
|
+
};
|
|
1325
|
+
}
|
|
1326
|
+
function makeErrorResult(error) {
|
|
1327
|
+
return {
|
|
1328
|
+
success: false,
|
|
1329
|
+
validationPass: false,
|
|
1330
|
+
compilationPass: false,
|
|
1331
|
+
goalMatch: 0,
|
|
1332
|
+
totalSteps: 0,
|
|
1333
|
+
fixRounds: 0,
|
|
1334
|
+
llmCalls: 0,
|
|
1335
|
+
durationMs: 0,
|
|
1336
|
+
schema: null,
|
|
1337
|
+
schemaPath: null,
|
|
1338
|
+
actions: [],
|
|
1339
|
+
validationErrors: [],
|
|
1340
|
+
compilationErrors: [],
|
|
1341
|
+
error
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
var MasarClient;
|
|
1345
|
+
var init_masar_client = __esm({
|
|
1346
|
+
"src/neural/masar-client.ts"() {
|
|
1347
|
+
MasarClient = class {
|
|
1348
|
+
constructor(options) {
|
|
1349
|
+
this.baseUrl = (options?.baseUrl ?? process.env["MASAR_URL"] ?? "https://masar-345008351456.europe-west4.run.app").replace(/\/$/, "");
|
|
1350
|
+
this.timeoutMs = options?.timeoutMs ?? 12e4;
|
|
1351
|
+
this.onProgress = options?.onProgress ?? null;
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Generate an .orb schema from a natural language prompt.
|
|
1355
|
+
*
|
|
1356
|
+
* Sends the prompt to the Masar server which runs the full neural pipeline
|
|
1357
|
+
* (goal parsing, GFlowNet generation, validation, LLM fix loop) and returns
|
|
1358
|
+
* the result.
|
|
1359
|
+
*/
|
|
1360
|
+
async generate(prompt) {
|
|
1361
|
+
this.onProgress?.("request", `Sending prompt to Masar at ${this.baseUrl}`);
|
|
1362
|
+
const url = `${this.baseUrl}/generate`;
|
|
1363
|
+
const controller = new AbortController();
|
|
1364
|
+
const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
1365
|
+
try {
|
|
1366
|
+
const response = await fetch(url, {
|
|
1367
|
+
method: "POST",
|
|
1368
|
+
headers: { "Content-Type": "application/json" },
|
|
1369
|
+
body: JSON.stringify({ prompt }),
|
|
1370
|
+
signal: controller.signal
|
|
1371
|
+
});
|
|
1372
|
+
if (!response.ok) {
|
|
1373
|
+
const body = await response.text().catch(() => "");
|
|
1374
|
+
return makeErrorResult(
|
|
1375
|
+
`Masar server returned ${response.status} ${response.statusText}${body ? `: ${body}` : ""}`
|
|
1376
|
+
);
|
|
1377
|
+
}
|
|
1378
|
+
const data = await response.json();
|
|
1379
|
+
this.onProgress?.("response", data.success ? "Generation succeeded" : `Generation failed: ${data.error ?? "unknown"}`);
|
|
1380
|
+
return toNeuralPipelineResult(data);
|
|
1381
|
+
} catch (err) {
|
|
1382
|
+
if (err instanceof DOMException && err.name === "AbortError") {
|
|
1383
|
+
return makeErrorResult(`Masar request timed out after ${this.timeoutMs}ms`);
|
|
1384
|
+
}
|
|
1385
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1386
|
+
return makeErrorResult(`Masar request failed: ${message}`);
|
|
1387
|
+
} finally {
|
|
1388
|
+
clearTimeout(timeout);
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1302
1394
|
var ExtractedRequirementsSchema = z.object({
|
|
1303
1395
|
/** Entity names to create */
|
|
1304
1396
|
entities: z.array(z.string()).optional().default([]),
|
|
@@ -9254,16 +9346,31 @@ var LocalMemoryBackend = class {
|
|
|
9254
9346
|
async updateUserPreferences(_userId, _preferences) {
|
|
9255
9347
|
}
|
|
9256
9348
|
// =========================================================================
|
|
9257
|
-
// Generation Session History (
|
|
9349
|
+
// Generation Session History (ACTIVE)
|
|
9258
9350
|
// =========================================================================
|
|
9259
|
-
async recordGeneration(_userId,
|
|
9260
|
-
|
|
9351
|
+
async recordGeneration(_userId, session) {
|
|
9352
|
+
const instances = this.readInstances("sessions");
|
|
9353
|
+
const id = `gen_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
|
|
9354
|
+
instances.push({
|
|
9355
|
+
...session,
|
|
9356
|
+
id,
|
|
9357
|
+
userId: _userId,
|
|
9358
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
9359
|
+
});
|
|
9360
|
+
const trimmed = instances.slice(-50);
|
|
9361
|
+
this.writeInstances("sessions", trimmed);
|
|
9362
|
+
return id;
|
|
9261
9363
|
}
|
|
9262
|
-
async getGenerationSession(
|
|
9263
|
-
|
|
9364
|
+
async getGenerationSession(sessionId) {
|
|
9365
|
+
const instances = this.readInstances("sessions");
|
|
9366
|
+
return instances.find((s) => s.id === sessionId) ?? null;
|
|
9264
9367
|
}
|
|
9265
|
-
async getUserGenerationHistory(_userId,
|
|
9266
|
-
|
|
9368
|
+
async getUserGenerationHistory(_userId, limit) {
|
|
9369
|
+
const instances = this.readInstances("sessions");
|
|
9370
|
+
const sorted = instances.sort(
|
|
9371
|
+
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
9372
|
+
);
|
|
9373
|
+
return limit ? sorted.slice(0, limit) : sorted;
|
|
9267
9374
|
}
|
|
9268
9375
|
// =========================================================================
|
|
9269
9376
|
// Project Context (STUBBED)
|
|
@@ -10939,11 +11046,333 @@ async function executeSandboxedFallback(code, inputs, timeoutMs) {
|
|
|
10939
11046
|
return { success: false, error: message, timedOut };
|
|
10940
11047
|
}
|
|
10941
11048
|
}
|
|
11049
|
+
|
|
11050
|
+
// src/neural/index.ts
|
|
11051
|
+
init_masar_client();
|
|
11052
|
+
|
|
11053
|
+
// src/builder/builder-tools.ts
|
|
11054
|
+
function createBuilderTools(config) {
|
|
11055
|
+
const tools = [
|
|
11056
|
+
createValidateBuilderTool(config),
|
|
11057
|
+
createGenerateOrbitalBuilderTool(),
|
|
11058
|
+
createCombineOrbitalsBuilderTool(),
|
|
11059
|
+
createQueryStructureBuilderTool(),
|
|
11060
|
+
createAutoFixBuilderTool(config)
|
|
11061
|
+
];
|
|
11062
|
+
if (config.pythonExecutor) {
|
|
11063
|
+
tools.push(createNeuralGenerateBuilderTool());
|
|
11064
|
+
}
|
|
11065
|
+
return tools;
|
|
11066
|
+
}
|
|
11067
|
+
function createValidateBuilderTool(config) {
|
|
11068
|
+
return {
|
|
11069
|
+
name: "validate",
|
|
11070
|
+
description: "Validate an .orb schema. Returns errors and warnings.",
|
|
11071
|
+
parameters: {
|
|
11072
|
+
type: "object",
|
|
11073
|
+
properties: {
|
|
11074
|
+
schema: { type: "string", description: "The .orb schema JSON string to validate" }
|
|
11075
|
+
},
|
|
11076
|
+
required: ["schema"]
|
|
11077
|
+
},
|
|
11078
|
+
async execute(args) {
|
|
11079
|
+
const schema = args.schema;
|
|
11080
|
+
return config.executor.validateSchema(schema);
|
|
11081
|
+
}
|
|
11082
|
+
};
|
|
11083
|
+
}
|
|
11084
|
+
function createGenerateOrbitalBuilderTool() {
|
|
11085
|
+
return {
|
|
11086
|
+
name: "generate_orbital",
|
|
11087
|
+
description: "Generate a single orbital definition from a spec using an LLM subagent.",
|
|
11088
|
+
parameters: {
|
|
11089
|
+
type: "object",
|
|
11090
|
+
properties: {
|
|
11091
|
+
name: { type: "string", description: "Orbital name" },
|
|
11092
|
+
entityName: { type: "string", description: "Entity name (PascalCase)" },
|
|
11093
|
+
traitNames: { type: "array", description: "List of trait names" },
|
|
11094
|
+
fields: { type: "array", description: "Optional field definitions [{name, type, required?}]" },
|
|
11095
|
+
description: { type: "string", description: "Optional entity description" },
|
|
11096
|
+
provider: { type: "string", description: "LLM provider (deepseek, anthropic, openrouter)" },
|
|
11097
|
+
model: { type: "string", description: "LLM model name" }
|
|
11098
|
+
},
|
|
11099
|
+
required: ["name", "entityName", "traitNames"]
|
|
11100
|
+
},
|
|
11101
|
+
async execute(args) {
|
|
11102
|
+
const { getSubagentSystemPrompt: getSubagentSystemPrompt2 } = await import('@almadar/skills');
|
|
11103
|
+
const { LLMClient: LLMClient8 } = await import('@almadar/llm');
|
|
11104
|
+
const systemPrompt = getSubagentSystemPrompt2();
|
|
11105
|
+
const provider = args.provider ?? "deepseek";
|
|
11106
|
+
const model = args.model ?? "deepseek-chat";
|
|
11107
|
+
const fields = args.fields;
|
|
11108
|
+
const fieldsList = fields?.length ? fields.map((f) => ` - ${f.name}: ${f.type}${f.required ? " (required)" : ""}`).join("\n") : " (infer appropriate fields from the entity name and description)";
|
|
11109
|
+
const userPrompt = `Generate a complete FullOrbitalUnit for this orbital:
|
|
11110
|
+
|
|
11111
|
+
Name: ${args.name}
|
|
11112
|
+
Entity: ${args.entityName}
|
|
11113
|
+
Traits: ${args.traitNames.join(", ")}
|
|
11114
|
+
${args.description ? `Description: ${args.description}` : ""}
|
|
11115
|
+
|
|
11116
|
+
Fields:
|
|
11117
|
+
${fieldsList}
|
|
11118
|
+
|
|
11119
|
+
Return ONLY valid JSON matching the FullOrbitalUnit schema. No markdown fences, no explanation text.`;
|
|
11120
|
+
const client = new LLMClient8({
|
|
11121
|
+
provider,
|
|
11122
|
+
model
|
|
11123
|
+
});
|
|
11124
|
+
const text = await client.callRaw({
|
|
11125
|
+
systemPrompt,
|
|
11126
|
+
userPrompt,
|
|
11127
|
+
maxTokens: 8192
|
|
11128
|
+
});
|
|
11129
|
+
const orbital = extractJson(text);
|
|
11130
|
+
if (!orbital) {
|
|
11131
|
+
return { success: false, error: "Failed to parse orbital JSON from LLM response" };
|
|
11132
|
+
}
|
|
11133
|
+
const obj = orbital;
|
|
11134
|
+
if (!obj.name || !obj.entity || !obj.traits) {
|
|
11135
|
+
return { success: false, error: "Generated orbital missing required fields (name, entity, traits)" };
|
|
11136
|
+
}
|
|
11137
|
+
return { success: true, orbital };
|
|
11138
|
+
}
|
|
11139
|
+
};
|
|
11140
|
+
}
|
|
11141
|
+
function createCombineOrbitalsBuilderTool() {
|
|
11142
|
+
return {
|
|
11143
|
+
name: "combine_orbitals",
|
|
11144
|
+
description: "Combine multiple orbital definitions into a single .orb schema JSON string.",
|
|
11145
|
+
parameters: {
|
|
11146
|
+
type: "object",
|
|
11147
|
+
properties: {
|
|
11148
|
+
appName: { type: "string", description: "Application name" },
|
|
11149
|
+
orbitals: { type: "array", description: "Array of orbital definition objects" }
|
|
11150
|
+
},
|
|
11151
|
+
required: ["appName", "orbitals"]
|
|
11152
|
+
},
|
|
11153
|
+
async execute(args) {
|
|
11154
|
+
const orbitals = args.orbitals;
|
|
11155
|
+
const appName = args.appName;
|
|
11156
|
+
if (!orbitals.length) {
|
|
11157
|
+
return { success: false, error: "No orbitals provided" };
|
|
11158
|
+
}
|
|
11159
|
+
const schema = {
|
|
11160
|
+
name: appName,
|
|
11161
|
+
version: "1.0.0",
|
|
11162
|
+
orbitals
|
|
11163
|
+
};
|
|
11164
|
+
return {
|
|
11165
|
+
success: true,
|
|
11166
|
+
schema: JSON.stringify(schema, null, 2),
|
|
11167
|
+
orbitalCount: orbitals.length
|
|
11168
|
+
};
|
|
11169
|
+
}
|
|
11170
|
+
};
|
|
11171
|
+
}
|
|
11172
|
+
function createQueryStructureBuilderTool() {
|
|
11173
|
+
return {
|
|
11174
|
+
name: "query_structure",
|
|
11175
|
+
description: "Get a lightweight map of a schema (orbital names, entities, traits, field counts).",
|
|
11176
|
+
parameters: {
|
|
11177
|
+
type: "object",
|
|
11178
|
+
properties: {
|
|
11179
|
+
schema: { type: "string", description: "The .orb schema JSON string" }
|
|
11180
|
+
},
|
|
11181
|
+
required: ["schema"]
|
|
11182
|
+
},
|
|
11183
|
+
async execute(args) {
|
|
11184
|
+
try {
|
|
11185
|
+
const parsed = JSON.parse(args.schema);
|
|
11186
|
+
const orbitals = parsed.orbitals ?? [];
|
|
11187
|
+
return {
|
|
11188
|
+
name: parsed.name,
|
|
11189
|
+
orbitals: orbitals.map((o) => ({
|
|
11190
|
+
name: o.name,
|
|
11191
|
+
entityName: getEntityName5(o.entity),
|
|
11192
|
+
traits: getTraitNames2(o.traits ?? []),
|
|
11193
|
+
totalFields: countFields(o.entity),
|
|
11194
|
+
totalStates: countStates(o.traits ?? [])
|
|
11195
|
+
}))
|
|
11196
|
+
};
|
|
11197
|
+
} catch (err) {
|
|
11198
|
+
return { error: `Failed to parse schema: ${err instanceof Error ? err.message : String(err)}` };
|
|
11199
|
+
}
|
|
11200
|
+
}
|
|
11201
|
+
};
|
|
11202
|
+
}
|
|
11203
|
+
function createAutoFixBuilderTool(config) {
|
|
11204
|
+
return {
|
|
11205
|
+
name: "auto_fix",
|
|
11206
|
+
description: "Attempt to fix validation errors in a schema using LLM repair.",
|
|
11207
|
+
parameters: {
|
|
11208
|
+
type: "object",
|
|
11209
|
+
properties: {
|
|
11210
|
+
schema: { type: "string", description: "The .orb schema JSON string with errors" },
|
|
11211
|
+
errors: { type: "array", description: "Validation errors to fix [{code, message}]" },
|
|
11212
|
+
warnings: { type: "array", description: "Validation warnings to fix [{code, message}]" },
|
|
11213
|
+
provider: { type: "string", description: "LLM provider" },
|
|
11214
|
+
model: { type: "string", description: "LLM model" }
|
|
11215
|
+
},
|
|
11216
|
+
required: ["schema", "errors"]
|
|
11217
|
+
},
|
|
11218
|
+
async execute(args) {
|
|
11219
|
+
const { getSubagentSystemPrompt: getSubagentSystemPrompt2 } = await import('@almadar/skills');
|
|
11220
|
+
const { LLMClient: LLMClient8 } = await import('@almadar/llm');
|
|
11221
|
+
const orbitalKnowledge = getSubagentSystemPrompt2();
|
|
11222
|
+
const provider = args.provider ?? "deepseek";
|
|
11223
|
+
const model = args.model ?? "deepseek-chat";
|
|
11224
|
+
const errors = args.errors;
|
|
11225
|
+
const warnings = args.warnings ?? [];
|
|
11226
|
+
const issues = [
|
|
11227
|
+
...errors.map((e) => `ERROR [${e.code}]: ${e.message}`),
|
|
11228
|
+
...warnings.map((w) => `WARNING [${w.code}]: ${w.message}`)
|
|
11229
|
+
].join("\n");
|
|
11230
|
+
const client = new LLMClient8({
|
|
11231
|
+
provider,
|
|
11232
|
+
model
|
|
11233
|
+
});
|
|
11234
|
+
const text = await client.callRaw({
|
|
11235
|
+
systemPrompt: `You are a schema repair tool for .orb orbital schemas.
|
|
11236
|
+
|
|
11237
|
+
${orbitalKnowledge}
|
|
11238
|
+
|
|
11239
|
+
Return ONLY valid JSON.`,
|
|
11240
|
+
userPrompt: `Fix ALL validation errors and warnings in this schema.
|
|
11241
|
+
|
|
11242
|
+
ISSUES:
|
|
11243
|
+
${issues}
|
|
11244
|
+
|
|
11245
|
+
SCHEMA:
|
|
11246
|
+
${args.schema}
|
|
11247
|
+
|
|
11248
|
+
Return the COMPLETE corrected schema as valid JSON.`,
|
|
11249
|
+
maxTokens: 8192
|
|
11250
|
+
});
|
|
11251
|
+
const fixed = extractJson(text);
|
|
11252
|
+
if (!fixed) {
|
|
11253
|
+
return { success: false, error: "Failed to parse fixed schema from LLM response" };
|
|
11254
|
+
}
|
|
11255
|
+
const fixedStr = JSON.stringify(fixed, null, 2);
|
|
11256
|
+
const valResult = await config.executor.validateSchema(fixedStr);
|
|
11257
|
+
return {
|
|
11258
|
+
success: valResult.success,
|
|
11259
|
+
schema: fixedStr,
|
|
11260
|
+
remainingErrors: valResult.errors.length,
|
|
11261
|
+
remainingWarnings: valResult.warnings.length
|
|
11262
|
+
};
|
|
11263
|
+
}
|
|
11264
|
+
};
|
|
11265
|
+
}
|
|
11266
|
+
function createNeuralGenerateBuilderTool(config) {
|
|
11267
|
+
return {
|
|
11268
|
+
name: "neural_generate",
|
|
11269
|
+
description: "Generate a schema using the GFlowNet neural pipeline. Fast (2-10s) but best for simple apps (1-2 entities).",
|
|
11270
|
+
parameters: {
|
|
11271
|
+
type: "object",
|
|
11272
|
+
properties: {
|
|
11273
|
+
prompt: { type: "string", description: "Natural language description of the app to build" },
|
|
11274
|
+
provider: { type: "string", description: "LLM provider for goal parsing and auto-fix" },
|
|
11275
|
+
model: { type: "string", description: "LLM model" },
|
|
11276
|
+
samples: { type: "number", description: "Number of GFlowNet samples (default: 5)" },
|
|
11277
|
+
temperature: { type: "number", description: "Sampling temperature (default: 0.8)" }
|
|
11278
|
+
},
|
|
11279
|
+
required: ["prompt"]
|
|
11280
|
+
},
|
|
11281
|
+
async execute(args) {
|
|
11282
|
+
const { MasarClient: MasarClient2 } = await Promise.resolve().then(() => (init_masar_client(), masar_client_exports));
|
|
11283
|
+
const client = new MasarClient2({
|
|
11284
|
+
timeoutMs: 12e4
|
|
11285
|
+
});
|
|
11286
|
+
const result = await client.generate(args.prompt);
|
|
11287
|
+
return result;
|
|
11288
|
+
}
|
|
11289
|
+
};
|
|
11290
|
+
}
|
|
11291
|
+
function getEntityName5(entity) {
|
|
11292
|
+
if (!entity) return "Unknown";
|
|
11293
|
+
if (typeof entity === "string") return entity.replace(".entity", "");
|
|
11294
|
+
if (typeof entity === "object" && entity !== null && "name" in entity) {
|
|
11295
|
+
return entity.name;
|
|
11296
|
+
}
|
|
11297
|
+
return "Unknown";
|
|
11298
|
+
}
|
|
11299
|
+
function getTraitNames2(traits) {
|
|
11300
|
+
const names = [];
|
|
11301
|
+
for (const t of traits) {
|
|
11302
|
+
if (typeof t === "object" && t !== null) {
|
|
11303
|
+
if ("ref" in t) names.push(t.ref);
|
|
11304
|
+
else if ("name" in t) names.push(t.name);
|
|
11305
|
+
}
|
|
11306
|
+
}
|
|
11307
|
+
return names;
|
|
11308
|
+
}
|
|
11309
|
+
function countFields(entity) {
|
|
11310
|
+
if (!entity || typeof entity !== "object") return 0;
|
|
11311
|
+
const e = entity;
|
|
11312
|
+
return Array.isArray(e.fields) ? e.fields.length : 0;
|
|
11313
|
+
}
|
|
11314
|
+
function countStates(traits) {
|
|
11315
|
+
let total = 0;
|
|
11316
|
+
for (const t of traits) {
|
|
11317
|
+
if (typeof t === "object" && t !== null && "stateMachine" in t) {
|
|
11318
|
+
const sm = t.stateMachine;
|
|
11319
|
+
if (sm?.states) total += sm.states.length;
|
|
11320
|
+
}
|
|
11321
|
+
}
|
|
11322
|
+
return total;
|
|
11323
|
+
}
|
|
11324
|
+
function extractJson(text) {
|
|
11325
|
+
try {
|
|
11326
|
+
return JSON.parse(text.trim());
|
|
11327
|
+
} catch {
|
|
11328
|
+
}
|
|
11329
|
+
const fenceMatch = /```(?:json)?\s*\n?([\s\S]*?)\n?```/.exec(text);
|
|
11330
|
+
if (fenceMatch) {
|
|
11331
|
+
try {
|
|
11332
|
+
return JSON.parse(fenceMatch[1].trim());
|
|
11333
|
+
} catch {
|
|
11334
|
+
}
|
|
11335
|
+
}
|
|
11336
|
+
const braceStart = text.indexOf("{");
|
|
11337
|
+
if (braceStart >= 0) {
|
|
11338
|
+
let depth = 0;
|
|
11339
|
+
let inString = false;
|
|
11340
|
+
let escape = false;
|
|
11341
|
+
for (let i = braceStart; i < text.length; i++) {
|
|
11342
|
+
const ch = text[i];
|
|
11343
|
+
if (escape) {
|
|
11344
|
+
escape = false;
|
|
11345
|
+
continue;
|
|
11346
|
+
}
|
|
11347
|
+
if (ch === "\\" && inString) {
|
|
11348
|
+
escape = true;
|
|
11349
|
+
continue;
|
|
11350
|
+
}
|
|
11351
|
+
if (ch === '"') {
|
|
11352
|
+
inString = !inString;
|
|
11353
|
+
continue;
|
|
11354
|
+
}
|
|
11355
|
+
if (inString) continue;
|
|
11356
|
+
if (ch === "{") depth++;
|
|
11357
|
+
if (ch === "}") {
|
|
11358
|
+
depth--;
|
|
11359
|
+
if (depth === 0) {
|
|
11360
|
+
try {
|
|
11361
|
+
return JSON.parse(text.slice(braceStart, i + 1));
|
|
11362
|
+
} catch {
|
|
11363
|
+
}
|
|
11364
|
+
break;
|
|
11365
|
+
}
|
|
11366
|
+
}
|
|
11367
|
+
}
|
|
11368
|
+
}
|
|
11369
|
+
return null;
|
|
11370
|
+
}
|
|
10942
11371
|
var export_applySectionUpdate = domain_language_exports.applySectionUpdate;
|
|
10943
11372
|
var export_convertDomainToSchema = domain_language_exports.convertDomainToSchema;
|
|
10944
11373
|
var export_convertSchemaToDomain = domain_language_exports.convertSchemaToDomain;
|
|
10945
11374
|
var export_deleteSection = domain_language_exports.deleteSection;
|
|
10946
11375
|
|
|
10947
|
-
export { AgenticSearchEngine, AuditLog, CRITICAL_COMMAND_PATTERNS, CircuitBreaker, CircuitState, ContinueRequestSchema, DEFAULT_COMPACTION_CONFIG, EVENT_BUDGETS, ExtractedRequirementsSchema, FirestoreCheckpointer, FirestoreSessionStore, FirestoreSink, FirestoreStore, GenerateRequestSchema, GitClient, GitSink, LocalMemoryBackend, MemoryManager, MemoryOrbitalSchema, MemorySessionBackend, MetricsCollector, MultiUserManager, ObservabilityCollector, OnlineEvalSampler, PreferenceLearner, RateLimiter, ResumeRequestSchema, SessionManager, SinkManager, StateSyncManager, TOOL_GATES, ThresholdAuthorizer, WORKSPACE_LAYOUT, WorkflowBuilder, WorkflowEngine, WorkspaceManager, analyzeFailures, export_applySectionUpdate as applySectionUpdate, classifyCommand, classifyComplexity, combineOrbitals, combineOrbitalsToSchema, consumeToken, export_convertDomainToSchema as convertDomainToSchema, export_convertSchemaToDomain as convertSchemaToDomain, createAgentTools, createAgenticSearchEngine, createApplyChunkTool, createCombineSchemasTool, createConstructCombinedDomainTool, createDomainOrbitalTools, createErrorFixerSubagent, createEvalWorkflowWrapper, createExecuteTool, createExtractChunkTool, createFinishTaskTool, createGenerateOrbitalDomainTool, createGenerateSchemaTool, createOnlineEvalSampler, createOrbitalSubagentTool, createPreferenceLearner, createProjectOrbTemplate, createQuerySchemaStructureTool, createSSEEvent, createSchemaChunkingTools, createSchemaGenerationWorkflow, createSchemaGeneratorSubagent, createSchemaOrbTemplate, createSkillAgent, createSubagentConfigs, createSubagentEventWrapper, createSubagents, createSummaryPrompt, createTestAnalyzerSubagent, createTraitEventWrapper, createTraitSubagentTool, createUserContext, createUserOrbTemplate, createValidateSchemaTool, createWorkflowEngine, createWorkflowToolWrapper, debounceSync, export_deleteSection as deleteSection, endObservabilitySession, estimateCacheSavings, estimateCombineComplexity, estimateComplexity, estimateTokens, executeSandboxed, extractFileOperation, extractInterruptData, formatSSEEvent, formatSummary, generateFullOrbital, getBudgetWarningMessage, getEventBudget, getExecutionStrategy, getInterruptConfig, getMultiUserManager, getObservabilityCollector, getPerformanceSnapshot, getStateSyncManager, hasInterrupt, isAdmin, isCompleteEvent, isErrorEvent, isExecutionEvent, isFileOperation, isSSECompleteEvent, isSSEErrorEvent, isSSEGenerationLogEvent, isSSEInterruptEvent, isSSEMessageEvent, isSSEStartEvent, isSSESubagentEvent, isSSETodoDetailEvent, isSSETodoUpdateEvent, isSSEToolCallEvent, isSchemaEvent, isStartEvent, isTodoUpdate, isTokenValid, issueToken, needsCompaction, parseDeepAgentEvent, parseOrb, parseSSEEvent, quickComplexityCheck, readOrb, readOrbInstances, recordEvent, requireOwnership, resetMultiUserManager, resetObservabilityCollector, resetStateSyncManager, resumeSkillAgent, reviewSamples, revokeToken, routeGeneration, serializeOrb, startObservabilitySession, transformAgentEvent, transformAgentEventMulti, validateCommandPaths, verifyToken, withSync, writeOrb, writeOrbInstances };
|
|
11376
|
+
export { AgenticSearchEngine, AuditLog, CRITICAL_COMMAND_PATTERNS, CircuitBreaker, CircuitState, ContinueRequestSchema, DEFAULT_COMPACTION_CONFIG, EVENT_BUDGETS, ExtractedRequirementsSchema, FirestoreCheckpointer, FirestoreSessionStore, FirestoreSink, FirestoreStore, GenerateRequestSchema, GitClient, GitSink, LocalMemoryBackend, MasarClient, MemoryManager, MemoryOrbitalSchema, MemorySessionBackend, MetricsCollector, MultiUserManager, ObservabilityCollector, OnlineEvalSampler, PreferenceLearner, RateLimiter, ResumeRequestSchema, SessionManager, SinkManager, StateSyncManager, TOOL_GATES, ThresholdAuthorizer, WORKSPACE_LAYOUT, WorkflowBuilder, WorkflowEngine, WorkspaceManager, analyzeFailures, export_applySectionUpdate as applySectionUpdate, classifyCommand, classifyComplexity, combineOrbitals, combineOrbitalsToSchema, consumeToken, export_convertDomainToSchema as convertDomainToSchema, export_convertSchemaToDomain as convertSchemaToDomain, createAgentTools, createAgenticSearchEngine, createApplyChunkTool, createBuilderTools, createCombineSchemasTool, createConstructCombinedDomainTool, createDomainOrbitalTools, createErrorFixerSubagent, createEvalWorkflowWrapper, createExecuteTool, createExtractChunkTool, createFinishTaskTool, createGenerateOrbitalDomainTool, createGenerateSchemaTool, createOnlineEvalSampler, createOrbitalSubagentTool, createPreferenceLearner, createProjectOrbTemplate, createQuerySchemaStructureTool, createSSEEvent, createSchemaChunkingTools, createSchemaGenerationWorkflow, createSchemaGeneratorSubagent, createSchemaOrbTemplate, createSkillAgent, createSubagentConfigs, createSubagentEventWrapper, createSubagents, createSummaryPrompt, createTestAnalyzerSubagent, createTraitEventWrapper, createTraitSubagentTool, createUserContext, createUserOrbTemplate, createValidateSchemaTool, createWorkflowEngine, createWorkflowToolWrapper, debounceSync, export_deleteSection as deleteSection, endObservabilitySession, estimateCacheSavings, estimateCombineComplexity, estimateComplexity, estimateTokens, executeSandboxed, extractFileOperation, extractInterruptData, formatSSEEvent, formatSummary, generateFullOrbital, getBudgetWarningMessage, getEventBudget, getExecutionStrategy, getInterruptConfig, getMultiUserManager, getObservabilityCollector, getPerformanceSnapshot, getStateSyncManager, hasInterrupt, isAdmin, isCompleteEvent, isErrorEvent, isExecutionEvent, isFileOperation, isSSECompleteEvent, isSSEErrorEvent, isSSEGenerationLogEvent, isSSEInterruptEvent, isSSEMessageEvent, isSSEStartEvent, isSSESubagentEvent, isSSETodoDetailEvent, isSSETodoUpdateEvent, isSSEToolCallEvent, isSchemaEvent, isStartEvent, isTodoUpdate, isTokenValid, issueToken, needsCompaction, parseDeepAgentEvent, parseOrb, parseSSEEvent, quickComplexityCheck, readOrb, readOrbInstances, recordEvent, requireOwnership, resetMultiUserManager, resetObservabilityCollector, resetStateSyncManager, resumeSkillAgent, reviewSamples, revokeToken, routeGeneration, serializeOrb, startObservabilitySession, transformAgentEvent, transformAgentEventMulti, validateCommandPaths, verifyToken, withSync, writeOrb, writeOrbInstances };
|
|
10948
11377
|
//# sourceMappingURL=index.js.map
|
|
10949
11378
|
//# sourceMappingURL=index.js.map
|