@aaac/runtime 0.1.8 → 0.1.10
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/adapters/adk-sdk.d.ts +2 -2
- package/dist/adapters/claude-agent-sdk.d.ts +2 -2
- package/dist/adapters/mock.d.ts +2 -2
- package/dist/adapters/openai-agents-sdk.d.ts +2 -2
- package/dist/chunk-5FL4NAC5.js +312 -0
- package/dist/chunk-5FL4NAC5.js.map +1 -0
- package/dist/context-DKkamYX_.d.ts +31 -0
- package/dist/generator/index.d.ts +47 -33
- package/dist/generator/index.js +6 -420
- package/dist/generator/index.js.map +1 -1
- package/dist/index.d.ts +127 -4
- package/dist/index.js +197 -5
- package/dist/index.js.map +1 -1
- package/dist/{task-runner-Dw8oWJD6.d.ts → task-runner-CZScv9Yb.d.ts} +1 -1
- package/package.json +1 -2
- package/dist/chunk-LTZA6QWC.js +0 -296
- package/dist/chunk-LTZA6QWC.js.map +0 -1
- package/dist/context-B_bekYiE.d.ts +0 -106
package/dist/index.js
CHANGED
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
buildSdkFunctionTools
|
|
13
13
|
} from "./chunk-LONLL3K2.js";
|
|
14
14
|
import {
|
|
15
|
-
buildGuardrailContext
|
|
16
|
-
|
|
15
|
+
buildGuardrailContext,
|
|
16
|
+
loadProjectConfig
|
|
17
|
+
} from "./chunk-5FL4NAC5.js";
|
|
17
18
|
import {
|
|
18
19
|
jsonSchemaToZod
|
|
19
20
|
} from "./chunk-ET6TGQRT.js";
|
|
@@ -1255,6 +1256,98 @@ function emitStepEvent(options, workflowId, stepIndex, step, result) {
|
|
|
1255
1256
|
});
|
|
1256
1257
|
}
|
|
1257
1258
|
|
|
1259
|
+
// src/lib/process-axis-bridge.ts
|
|
1260
|
+
import { generateId as generateId2 } from "@aaac/observability";
|
|
1261
|
+
function attrs2(base) {
|
|
1262
|
+
const out = {};
|
|
1263
|
+
for (const [k, v] of Object.entries(base)) {
|
|
1264
|
+
if (v !== void 0 && v !== "") out[k] = v;
|
|
1265
|
+
}
|
|
1266
|
+
return out;
|
|
1267
|
+
}
|
|
1268
|
+
function emitProcessWorkflowOpen(options) {
|
|
1269
|
+
if (!options.observer) return void 0;
|
|
1270
|
+
const spanId = generateId2();
|
|
1271
|
+
options.observer({
|
|
1272
|
+
source: "aaac-runtime",
|
|
1273
|
+
eventType: "process.workflow",
|
|
1274
|
+
lifecycle: "open",
|
|
1275
|
+
spanId,
|
|
1276
|
+
parentSpanId: options.parentSpanId,
|
|
1277
|
+
attributes: attrs2({
|
|
1278
|
+
axis: "process",
|
|
1279
|
+
"agent.session_id": options.sessionId,
|
|
1280
|
+
"workflow.id": options.workflowId
|
|
1281
|
+
})
|
|
1282
|
+
});
|
|
1283
|
+
return spanId;
|
|
1284
|
+
}
|
|
1285
|
+
function emitProcessWorkflowClose(spanId, options) {
|
|
1286
|
+
if (!options.observer) return;
|
|
1287
|
+
options.observer({
|
|
1288
|
+
source: "aaac-runtime",
|
|
1289
|
+
eventType: "process.workflow",
|
|
1290
|
+
lifecycle: "close",
|
|
1291
|
+
spanId,
|
|
1292
|
+
attributes: attrs2({
|
|
1293
|
+
axis: "process",
|
|
1294
|
+
"workflow.status": options.status,
|
|
1295
|
+
...options.durationMs !== void 0 ? { "workflow.duration_ms": options.durationMs } : {}
|
|
1296
|
+
})
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
function emitProcessTaskOpen(options) {
|
|
1300
|
+
if (!options.observer) return void 0;
|
|
1301
|
+
const spanId = generateId2();
|
|
1302
|
+
options.observer({
|
|
1303
|
+
source: "aaac-runtime",
|
|
1304
|
+
eventType: "process.task",
|
|
1305
|
+
lifecycle: "open",
|
|
1306
|
+
spanId,
|
|
1307
|
+
parentSpanId: options.parentSpanId,
|
|
1308
|
+
attributes: attrs2({
|
|
1309
|
+
axis: "process",
|
|
1310
|
+
"agent.session_id": options.sessionId,
|
|
1311
|
+
"task.id": options.taskId,
|
|
1312
|
+
"task.type": "implement",
|
|
1313
|
+
"task.target_agent": options.targetAgent
|
|
1314
|
+
})
|
|
1315
|
+
});
|
|
1316
|
+
return spanId;
|
|
1317
|
+
}
|
|
1318
|
+
function emitProcessTaskClose(spanId, options) {
|
|
1319
|
+
if (!options.observer) return;
|
|
1320
|
+
options.observer({
|
|
1321
|
+
source: "aaac-runtime",
|
|
1322
|
+
eventType: "process.task",
|
|
1323
|
+
lifecycle: "close",
|
|
1324
|
+
spanId,
|
|
1325
|
+
attributes: attrs2({
|
|
1326
|
+
axis: "process",
|
|
1327
|
+
"task.status": options.status,
|
|
1328
|
+
...options.durationMs !== void 0 ? { "task.duration_ms": options.durationMs } : {}
|
|
1329
|
+
})
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
function emitProcessEdit(options) {
|
|
1333
|
+
if (!options.observer) return void 0;
|
|
1334
|
+
const spanId = generateId2();
|
|
1335
|
+
options.observer({
|
|
1336
|
+
source: "aaac-runtime",
|
|
1337
|
+
eventType: "process.edit",
|
|
1338
|
+
lifecycle: "instant",
|
|
1339
|
+
spanId,
|
|
1340
|
+
parentSpanId: options.parentSpanId,
|
|
1341
|
+
attributes: attrs2({
|
|
1342
|
+
axis: "process",
|
|
1343
|
+
"agent.session_id": options.sessionId,
|
|
1344
|
+
"edit.path": options.filePath,
|
|
1345
|
+
"edit.artifact_id": options.artifactId
|
|
1346
|
+
})
|
|
1347
|
+
});
|
|
1348
|
+
return spanId;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1258
1351
|
// src/lib/bound-resolver.ts
|
|
1259
1352
|
import { readFile as readFile2 } from "fs/promises";
|
|
1260
1353
|
import YAML2 from "yaml";
|
|
@@ -2201,9 +2294,17 @@ import { resolve as resolve2 } from "path";
|
|
|
2201
2294
|
async function resolveExecutionContext(options, requiredEntities) {
|
|
2202
2295
|
const useBoundResolver = options.resolvedComponent || options.bindingPaths && options.bindingPaths.length > 0 || options.artifactBinding;
|
|
2203
2296
|
if (useBoundResolver) {
|
|
2297
|
+
let baseDsl = options.dsl;
|
|
2298
|
+
if (!options.resolvedComponent && options.projectDslPath) {
|
|
2299
|
+
const merged = await loadDslContext({
|
|
2300
|
+
embeddedDsl: options.dsl,
|
|
2301
|
+
projectDslPath: options.projectDslPath
|
|
2302
|
+
});
|
|
2303
|
+
baseDsl = merged.dsl;
|
|
2304
|
+
}
|
|
2204
2305
|
const component = options.resolvedComponent ?? await new BoundResolver().resolve({
|
|
2205
2306
|
id: options.componentId ?? "default",
|
|
2206
|
-
embeddedDsl:
|
|
2307
|
+
embeddedDsl: baseDsl,
|
|
2207
2308
|
bindingPaths: options.bindingPaths,
|
|
2208
2309
|
activeGuardrailPolicy: options.activeGuardrailPolicy,
|
|
2209
2310
|
artifactBinding: options.artifactBinding,
|
|
@@ -2442,6 +2543,89 @@ async function dispatchOperation(operationName, op, options, input, ctx, handler
|
|
|
2442
2543
|
throw new Error(`Operation "${operationName}" has no dispatch target`);
|
|
2443
2544
|
}
|
|
2444
2545
|
|
|
2546
|
+
// src/lib/project-runtime.ts
|
|
2547
|
+
import { existsSync as existsSync2 } from "fs";
|
|
2548
|
+
import { resolve as resolve3, dirname as dirname2 } from "path";
|
|
2549
|
+
var PROJECT_CONFIG_FILENAME = "project.yaml";
|
|
2550
|
+
var DEFAULT_ADAPTER = "claude";
|
|
2551
|
+
function findProjectConfig(startDir, filename = PROJECT_CONFIG_FILENAME) {
|
|
2552
|
+
let dir = resolve3(startDir);
|
|
2553
|
+
for (; ; ) {
|
|
2554
|
+
const candidate = resolve3(dir, filename);
|
|
2555
|
+
if (existsSync2(candidate)) return candidate;
|
|
2556
|
+
const parent = dirname2(dir);
|
|
2557
|
+
if (parent === dir) return void 0;
|
|
2558
|
+
dir = parent;
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
function serializeRequest(input) {
|
|
2562
|
+
if (typeof input === "string") return input;
|
|
2563
|
+
return JSON.stringify(input ?? {});
|
|
2564
|
+
}
|
|
2565
|
+
async function createProjectRuntime(options) {
|
|
2566
|
+
const cwd = options.cwd ?? process.cwd();
|
|
2567
|
+
const configPath = options.configPath ? resolve3(cwd, options.configPath) : findProjectConfig(cwd);
|
|
2568
|
+
if (!configPath || !existsSync2(configPath)) {
|
|
2569
|
+
const where = options.configPath ? `config path "${options.configPath}"` : `${PROJECT_CONFIG_FILENAME} from ${cwd} upward`;
|
|
2570
|
+
throw new Error(
|
|
2571
|
+
`No ${PROJECT_CONFIG_FILENAME} found (${where}). Pass --config <path> to a project manifest.`
|
|
2572
|
+
);
|
|
2573
|
+
}
|
|
2574
|
+
const config = await loadProjectConfig(configPath);
|
|
2575
|
+
const env = options.env ?? process.env;
|
|
2576
|
+
function resolveAdapter2() {
|
|
2577
|
+
const explicit = options.adapter ?? env.AGENT_RUNTIME_ADAPTER;
|
|
2578
|
+
if (explicit) {
|
|
2579
|
+
return { adapter: explicit, model: options.model };
|
|
2580
|
+
}
|
|
2581
|
+
const resolver = createModelResolver({
|
|
2582
|
+
modelMapping: config.model_mapping,
|
|
2583
|
+
fallbackAdapter: DEFAULT_ADAPTER,
|
|
2584
|
+
fallbackModel: options.model,
|
|
2585
|
+
env
|
|
2586
|
+
});
|
|
2587
|
+
const resolved = resolver.resolve("standard");
|
|
2588
|
+
return { adapter: resolved.adapter, model: options.model ?? resolved.model };
|
|
2589
|
+
}
|
|
2590
|
+
function sharedExecuteOptions() {
|
|
2591
|
+
const { adapter, model } = resolveAdapter2();
|
|
2592
|
+
return {
|
|
2593
|
+
adapter,
|
|
2594
|
+
model,
|
|
2595
|
+
dsl: options.embeddedDsl,
|
|
2596
|
+
projectDslPath: config.dslPath,
|
|
2597
|
+
bindingPaths: config.bindingPaths,
|
|
2598
|
+
activeGuardrailPolicy: config.active_guardrail_policy,
|
|
2599
|
+
artifactBinding: config.artifactsPath ? { source: config.artifactsPath } : void 0,
|
|
2600
|
+
maxFollowUps: config.recovery.max_follow_ups,
|
|
2601
|
+
maxRetries: config.recovery.max_retries
|
|
2602
|
+
};
|
|
2603
|
+
}
|
|
2604
|
+
const runtime = {
|
|
2605
|
+
async runWorkflow(workflowId, _options, input, _ctx) {
|
|
2606
|
+
return executeWorkflow(workflowId, {
|
|
2607
|
+
...sharedExecuteOptions(),
|
|
2608
|
+
request: serializeRequest(input),
|
|
2609
|
+
autoApproveGates: options.autoApproveGates ?? true
|
|
2610
|
+
});
|
|
2611
|
+
},
|
|
2612
|
+
async runTask(taskId, _options, input, _ctx) {
|
|
2613
|
+
return executeTask(taskId, {
|
|
2614
|
+
...sharedExecuteOptions(),
|
|
2615
|
+
request: serializeRequest(input)
|
|
2616
|
+
});
|
|
2617
|
+
}
|
|
2618
|
+
};
|
|
2619
|
+
return {
|
|
2620
|
+
runtime,
|
|
2621
|
+
context: { runtime },
|
|
2622
|
+
config,
|
|
2623
|
+
configPath,
|
|
2624
|
+
dslSource: config.dslPath,
|
|
2625
|
+
resolveAdapter: resolveAdapter2
|
|
2626
|
+
};
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2445
2629
|
// src/component-scope.ts
|
|
2446
2630
|
function buildToolsByAgent(componentIR, resolved) {
|
|
2447
2631
|
const operationNames = new Set(Object.keys(componentIR.operations));
|
|
@@ -2538,8 +2722,8 @@ async function buildNavigationContext(options) {
|
|
|
2538
2722
|
dsl = options.embeddedDsl;
|
|
2539
2723
|
}
|
|
2540
2724
|
} else if (options.projectDslPath) {
|
|
2541
|
-
const { resolve:
|
|
2542
|
-
const result = await
|
|
2725
|
+
const { resolve: resolve4 } = await import("agent-contracts");
|
|
2726
|
+
const result = await resolve4(options.projectDslPath);
|
|
2543
2727
|
dsl = result.data;
|
|
2544
2728
|
} else {
|
|
2545
2729
|
throw new Error("buildNavigationContext requires embeddedDsl or projectDslPath");
|
|
@@ -2604,6 +2788,7 @@ export {
|
|
|
2604
2788
|
DslValidationError,
|
|
2605
2789
|
FileMemoryStore,
|
|
2606
2790
|
InMemoryStore,
|
|
2791
|
+
PROJECT_CONFIG_FILENAME,
|
|
2607
2792
|
PluginRegistry,
|
|
2608
2793
|
WorkflowBuilder,
|
|
2609
2794
|
buildCandidateAgents,
|
|
@@ -2625,9 +2810,15 @@ export {
|
|
|
2625
2810
|
createLibraryToolRegistry,
|
|
2626
2811
|
createModelResolver,
|
|
2627
2812
|
createProgressSink,
|
|
2813
|
+
createProjectRuntime,
|
|
2628
2814
|
createRuntime,
|
|
2629
2815
|
createRuntimeBinding,
|
|
2630
2816
|
deriveToolchainsForAgents,
|
|
2817
|
+
emitProcessEdit,
|
|
2818
|
+
emitProcessTaskClose,
|
|
2819
|
+
emitProcessTaskOpen,
|
|
2820
|
+
emitProcessWorkflowClose,
|
|
2821
|
+
emitProcessWorkflowOpen,
|
|
2631
2822
|
emitSessionClose,
|
|
2632
2823
|
emitSessionOpen,
|
|
2633
2824
|
emitSubagentClose,
|
|
@@ -2637,6 +2828,7 @@ export {
|
|
|
2637
2828
|
executeTask,
|
|
2638
2829
|
executeWorkflow,
|
|
2639
2830
|
extractStructuredResult,
|
|
2831
|
+
findProjectConfig,
|
|
2640
2832
|
getBlockingViolations,
|
|
2641
2833
|
getEffectiveGuardrailIds,
|
|
2642
2834
|
getGuardrailRulesForAgent,
|