@aaac/runtime 0.1.9 → 0.1.11
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 +1 -1
- 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 +110 -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 +2 -3
- 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,99 @@ 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 { readFile as readFile5 } from "fs/promises";
|
|
2549
|
+
import { resolve as resolve3, dirname as dirname2 } from "path";
|
|
2550
|
+
import YAML3 from "yaml";
|
|
2551
|
+
var PROJECT_CONFIG_FILENAME = "project.yaml";
|
|
2552
|
+
var DEFAULT_ADAPTER = "claude";
|
|
2553
|
+
function findProjectConfig(startDir, filename = PROJECT_CONFIG_FILENAME) {
|
|
2554
|
+
let dir = resolve3(startDir);
|
|
2555
|
+
for (; ; ) {
|
|
2556
|
+
const candidate = resolve3(dir, filename);
|
|
2557
|
+
if (existsSync2(candidate)) return candidate;
|
|
2558
|
+
const parent = dirname2(dir);
|
|
2559
|
+
if (parent === dir) return void 0;
|
|
2560
|
+
dir = parent;
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
function serializeRequest(input) {
|
|
2564
|
+
if (typeof input === "string") return input;
|
|
2565
|
+
return JSON.stringify(input ?? {});
|
|
2566
|
+
}
|
|
2567
|
+
async function createProjectRuntime(options) {
|
|
2568
|
+
const cwd = options.cwd ?? process.cwd();
|
|
2569
|
+
const configPath = options.configPath ? resolve3(cwd, options.configPath) : findProjectConfig(cwd);
|
|
2570
|
+
if (!configPath || !existsSync2(configPath)) {
|
|
2571
|
+
const where = options.configPath ? `config path "${options.configPath}"` : `${PROJECT_CONFIG_FILENAME} from ${cwd} upward`;
|
|
2572
|
+
throw new Error(
|
|
2573
|
+
`No ${PROJECT_CONFIG_FILENAME} found (${where}). Pass --config <path> to a project manifest.`
|
|
2574
|
+
);
|
|
2575
|
+
}
|
|
2576
|
+
const config = await loadProjectConfig(configPath);
|
|
2577
|
+
const env = options.env ?? process.env;
|
|
2578
|
+
const rawManifest = YAML3.parse(await readFile5(configPath, "utf8"));
|
|
2579
|
+
const overlayExplicit = typeof rawManifest?.agents === "string" || typeof rawManifest?.dsl === "string";
|
|
2580
|
+
if (overlayExplicit && !existsSync2(config.dslPath)) {
|
|
2581
|
+
throw new Error(
|
|
2582
|
+
`Project agents DSL not found: ${config.dslPath} (referenced by ${configPath}).`
|
|
2583
|
+
);
|
|
2584
|
+
}
|
|
2585
|
+
const projectDslPath = overlayExplicit ? config.dslPath : void 0;
|
|
2586
|
+
function resolveAdapter2() {
|
|
2587
|
+
const explicit = options.adapter ?? env.AGENT_RUNTIME_ADAPTER;
|
|
2588
|
+
if (explicit) {
|
|
2589
|
+
return { adapter: explicit, model: options.model };
|
|
2590
|
+
}
|
|
2591
|
+
const resolver = createModelResolver({
|
|
2592
|
+
modelMapping: config.model_mapping,
|
|
2593
|
+
fallbackAdapter: DEFAULT_ADAPTER,
|
|
2594
|
+
fallbackModel: options.model,
|
|
2595
|
+
env
|
|
2596
|
+
});
|
|
2597
|
+
const resolved = resolver.resolve("standard");
|
|
2598
|
+
return { adapter: resolved.adapter, model: options.model ?? resolved.model };
|
|
2599
|
+
}
|
|
2600
|
+
function sharedExecuteOptions() {
|
|
2601
|
+
const { adapter, model } = resolveAdapter2();
|
|
2602
|
+
return {
|
|
2603
|
+
adapter,
|
|
2604
|
+
model,
|
|
2605
|
+
dsl: options.embeddedDsl,
|
|
2606
|
+
projectDslPath,
|
|
2607
|
+
bindingPaths: config.bindingPaths,
|
|
2608
|
+
activeGuardrailPolicy: config.active_guardrail_policy,
|
|
2609
|
+
artifactBinding: config.artifactsPath ? { source: config.artifactsPath } : void 0,
|
|
2610
|
+
maxFollowUps: config.recovery.max_follow_ups,
|
|
2611
|
+
maxRetries: config.recovery.max_retries
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2614
|
+
const runtime = {
|
|
2615
|
+
async runWorkflow(workflowId, _options, input, _ctx) {
|
|
2616
|
+
return executeWorkflow(workflowId, {
|
|
2617
|
+
...sharedExecuteOptions(),
|
|
2618
|
+
request: serializeRequest(input),
|
|
2619
|
+
autoApproveGates: options.autoApproveGates ?? true
|
|
2620
|
+
});
|
|
2621
|
+
},
|
|
2622
|
+
async runTask(taskId, _options, input, _ctx) {
|
|
2623
|
+
return executeTask(taskId, {
|
|
2624
|
+
...sharedExecuteOptions(),
|
|
2625
|
+
request: serializeRequest(input)
|
|
2626
|
+
});
|
|
2627
|
+
}
|
|
2628
|
+
};
|
|
2629
|
+
return {
|
|
2630
|
+
runtime,
|
|
2631
|
+
context: { runtime },
|
|
2632
|
+
config,
|
|
2633
|
+
configPath,
|
|
2634
|
+
dslSource: projectDslPath ?? "/$embedded/",
|
|
2635
|
+
resolveAdapter: resolveAdapter2
|
|
2636
|
+
};
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2537
2639
|
// src/component-scope.ts
|
|
2538
2640
|
function buildToolsByAgent(componentIR, resolved) {
|
|
2539
2641
|
const operationNames = new Set(Object.keys(componentIR.operations));
|
|
@@ -2630,8 +2732,8 @@ async function buildNavigationContext(options) {
|
|
|
2630
2732
|
dsl = options.embeddedDsl;
|
|
2631
2733
|
}
|
|
2632
2734
|
} else if (options.projectDslPath) {
|
|
2633
|
-
const { resolve:
|
|
2634
|
-
const result = await
|
|
2735
|
+
const { resolve: resolve4 } = await import("agent-contracts");
|
|
2736
|
+
const result = await resolve4(options.projectDslPath);
|
|
2635
2737
|
dsl = result.data;
|
|
2636
2738
|
} else {
|
|
2637
2739
|
throw new Error("buildNavigationContext requires embeddedDsl or projectDslPath");
|
|
@@ -2696,6 +2798,7 @@ export {
|
|
|
2696
2798
|
DslValidationError,
|
|
2697
2799
|
FileMemoryStore,
|
|
2698
2800
|
InMemoryStore,
|
|
2801
|
+
PROJECT_CONFIG_FILENAME,
|
|
2699
2802
|
PluginRegistry,
|
|
2700
2803
|
WorkflowBuilder,
|
|
2701
2804
|
buildCandidateAgents,
|
|
@@ -2717,6 +2820,7 @@ export {
|
|
|
2717
2820
|
createLibraryToolRegistry,
|
|
2718
2821
|
createModelResolver,
|
|
2719
2822
|
createProgressSink,
|
|
2823
|
+
createProjectRuntime,
|
|
2720
2824
|
createRuntime,
|
|
2721
2825
|
createRuntimeBinding,
|
|
2722
2826
|
deriveToolchainsForAgents,
|
|
@@ -2734,6 +2838,7 @@ export {
|
|
|
2734
2838
|
executeTask,
|
|
2735
2839
|
executeWorkflow,
|
|
2736
2840
|
extractStructuredResult,
|
|
2841
|
+
findProjectConfig,
|
|
2737
2842
|
getBlockingViolations,
|
|
2738
2843
|
getEffectiveGuardrailIds,
|
|
2739
2844
|
getGuardrailRulesForAgent,
|