@aaac/runtime 0.1.9 → 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 +70 -4
- package/dist/index.js +100 -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";
|
|
@@ -2293,9 +2294,17 @@ import { resolve as resolve2 } from "path";
|
|
|
2293
2294
|
async function resolveExecutionContext(options, requiredEntities) {
|
|
2294
2295
|
const useBoundResolver = options.resolvedComponent || options.bindingPaths && options.bindingPaths.length > 0 || options.artifactBinding;
|
|
2295
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
|
+
}
|
|
2296
2305
|
const component = options.resolvedComponent ?? await new BoundResolver().resolve({
|
|
2297
2306
|
id: options.componentId ?? "default",
|
|
2298
|
-
embeddedDsl:
|
|
2307
|
+
embeddedDsl: baseDsl,
|
|
2299
2308
|
bindingPaths: options.bindingPaths,
|
|
2300
2309
|
activeGuardrailPolicy: options.activeGuardrailPolicy,
|
|
2301
2310
|
artifactBinding: options.artifactBinding,
|
|
@@ -2534,6 +2543,89 @@ async function dispatchOperation(operationName, op, options, input, ctx, handler
|
|
|
2534
2543
|
throw new Error(`Operation "${operationName}" has no dispatch target`);
|
|
2535
2544
|
}
|
|
2536
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
|
+
|
|
2537
2629
|
// src/component-scope.ts
|
|
2538
2630
|
function buildToolsByAgent(componentIR, resolved) {
|
|
2539
2631
|
const operationNames = new Set(Object.keys(componentIR.operations));
|
|
@@ -2630,8 +2722,8 @@ async function buildNavigationContext(options) {
|
|
|
2630
2722
|
dsl = options.embeddedDsl;
|
|
2631
2723
|
}
|
|
2632
2724
|
} else if (options.projectDslPath) {
|
|
2633
|
-
const { resolve:
|
|
2634
|
-
const result = await
|
|
2725
|
+
const { resolve: resolve4 } = await import("agent-contracts");
|
|
2726
|
+
const result = await resolve4(options.projectDslPath);
|
|
2635
2727
|
dsl = result.data;
|
|
2636
2728
|
} else {
|
|
2637
2729
|
throw new Error("buildNavigationContext requires embeddedDsl or projectDslPath");
|
|
@@ -2696,6 +2788,7 @@ export {
|
|
|
2696
2788
|
DslValidationError,
|
|
2697
2789
|
FileMemoryStore,
|
|
2698
2790
|
InMemoryStore,
|
|
2791
|
+
PROJECT_CONFIG_FILENAME,
|
|
2699
2792
|
PluginRegistry,
|
|
2700
2793
|
WorkflowBuilder,
|
|
2701
2794
|
buildCandidateAgents,
|
|
@@ -2717,6 +2810,7 @@ export {
|
|
|
2717
2810
|
createLibraryToolRegistry,
|
|
2718
2811
|
createModelResolver,
|
|
2719
2812
|
createProgressSink,
|
|
2813
|
+
createProjectRuntime,
|
|
2720
2814
|
createRuntime,
|
|
2721
2815
|
createRuntimeBinding,
|
|
2722
2816
|
deriveToolchainsForAgents,
|
|
@@ -2734,6 +2828,7 @@ export {
|
|
|
2734
2828
|
executeTask,
|
|
2735
2829
|
executeWorkflow,
|
|
2736
2830
|
extractStructuredResult,
|
|
2831
|
+
findProjectConfig,
|
|
2737
2832
|
getBlockingViolations,
|
|
2738
2833
|
getEffectiveGuardrailIds,
|
|
2739
2834
|
getGuardrailRulesForAgent,
|