@aaac/runtime 0.1.42 → 0.1.44
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 +1 -1
- package/dist/adapters/claude-agent-sdk.d.ts +1 -1
- package/dist/adapters/mock.d.ts +1 -1
- package/dist/adapters/openai-agents-sdk.d.ts +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +103 -25
- package/dist/index.js.map +1 -1
- package/dist/{task-runner-D7ZxILN4.d.ts → task-runner-Sez_CXcD.d.ts} +11 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SdkAdapter, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef, T as TokenUsage } from '../task-runner-
|
|
1
|
+
import { S as SdkAdapter, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef, T as TokenUsage } from '../task-runner-Sez_CXcD.js';
|
|
2
2
|
import { G as GuardrailHooks } from '../guardrail-hooks-slK-z0Dz.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '../context-DKkamYX_.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SdkAdapter, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef, T as TokenUsage } from '../task-runner-
|
|
1
|
+
import { S as SdkAdapter, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef, T as TokenUsage } from '../task-runner-Sez_CXcD.js';
|
|
2
2
|
import { G as GuardrailHooks } from '../guardrail-hooks-slK-z0Dz.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '../context-DKkamYX_.js';
|
package/dist/adapters/mock.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SdkAdapter, A as AdapterSendOptions, M as MemoryRef } from '../task-runner-
|
|
1
|
+
import { S as SdkAdapter, A as AdapterSendOptions, M as MemoryRef } from '../task-runner-Sez_CXcD.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../context-DKkamYX_.js';
|
|
4
4
|
import '../guardrail-hooks-slK-z0Dz.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SdkAdapter, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef, T as TokenUsage } from '../task-runner-
|
|
1
|
+
import { S as SdkAdapter, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef, T as TokenUsage } from '../task-runner-Sez_CXcD.js';
|
|
2
2
|
import { G as GuardrailHooks } from '../guardrail-hooks-slK-z0Dz.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '../context-DKkamYX_.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as SdkFunctionTool, O as ObserverEmitFn, c as TaskContext, d as TaskOutcome, e as AgentContractLike, f as TaskContractLike, P as PromptBuilderOptions, W as WorkflowResult, S as SdkAdapter, g as WorkflowRegistries, H as HandoffInput, h as StepCompleteEvent, i as StepResult, D as DelegateStep, j as MemoryStore, M as MemoryRef, R as ResolvedComponent, k as ArtifactBindingConfig, l as RunToolchainChecksOptions, m as ModelMappingConfig, n as TaskRunResult, L as LibraryToolRegistry, o as ResolvedToolchain, p as LibraryToolDefinition } from './task-runner-
|
|
2
|
-
export { q as AdapterOrFactory, A as AdapterSendOptions, a as AgentExecutionRequest, r as AgentProgressEvent, B as BoundResolveOptions, s as BoundResolver, C as CacheConfig, t as CandidateAgent, u as ConvergenceEnvelope, v as ConvergenceEnvelopePayload, E as EnvelopeParams, w as EvaluateStep, G as GateStep, I as InMemoryStore, x as InnerSpanOptions, y as ModelAwareSdkAdapterFactory, z as ModelClass, F as ModelResolver, J as ModelResolverOptions, K as OBSERVABILITY_ENV_VARS, N as ObservabilityIds, Q as ReceiveSpec, U as ResolvedModel, V as RetryDecision, X as SdkAdapterFactory, Y as SplitPrompt, Z as TaskRunOptions, T as TokenUsage, _ as ToolchainCheckResult, $ as ToolchainManifest, a0 as ToolchainManifestSchema, a1 as WorkflowContractLike, a2 as WorkflowInvocation, a3 as WorkflowRunOptions, a4 as WorkflowStep, a5 as buildCandidateAgents, a6 as buildGateEvaluationPrompt, a7 as buildObservabilityEnv, a8 as buildPerAgentGuardrails, a9 as buildRetryFollowUp, aa as buildSdkFunctionTools, ab as buildSplitTaskPrompt, ac as buildTaskPrompt, ad as collectAnalyzerToolIds, ae as createExecutionEnvelope, af as createLibraryToolRegistry, ag as createModelResolver, ah as createRegistryFromSdkTools, ai as deriveToolchainsForAgents, aj as emitIterationClose, ak as emitIterationMetric, al as emitIterationOpen, am as emitLlmTurnClose, an as emitLlmTurnOpen, ao as emitSessionClose, ap as emitSessionOpen, aq as emitSubagentClose, ar as emitSubagentOpen, as as emitToolExecClose, at as emitToolExecOpen, au as emitToolchainClose, av as emitToolchainOpen, aw as extractStructuredResult, ax as getEffectiveGuardrailIds, ay as getGuardrailRulesForAgent, az as guardrailContextToRuleData, aA as isNavigationIndex, aB as parseGateEvaluationResponse, aC as renderAgentSystemPrompt, aD as renderAnalyzerExplorationMandatePrompt, aE as renderNavigationIndexPrompt, aF as runTask, aG as runToolchainChecks, aH as runWorkflow, aI as serializeObserverEmit, aJ as shouldInjectAnalyzerExplorationMandate, aK as zodSchemaToPromptDescription, aL as zodSchemaToYamlExample } from './task-runner-
|
|
1
|
+
import { b as SdkFunctionTool, O as ObserverEmitFn, c as TaskContext, d as TaskOutcome, e as AgentContractLike, f as TaskContractLike, P as PromptBuilderOptions, W as WorkflowResult, S as SdkAdapter, g as WorkflowRegistries, H as HandoffInput, h as StepCompleteEvent, i as StepResult, D as DelegateStep, j as MemoryStore, M as MemoryRef, R as ResolvedComponent, k as ArtifactBindingConfig, l as RunToolchainChecksOptions, m as ModelMappingConfig, n as TaskRunResult, L as LibraryToolRegistry, o as ResolvedToolchain, p as LibraryToolDefinition } from './task-runner-Sez_CXcD.js';
|
|
2
|
+
export { q as AdapterOrFactory, A as AdapterSendOptions, a as AgentExecutionRequest, r as AgentProgressEvent, B as BoundResolveOptions, s as BoundResolver, C as CacheConfig, t as CandidateAgent, u as ConvergenceEnvelope, v as ConvergenceEnvelopePayload, E as EnvelopeParams, w as EvaluateStep, G as GateStep, I as InMemoryStore, x as InnerSpanOptions, y as ModelAwareSdkAdapterFactory, z as ModelClass, F as ModelResolver, J as ModelResolverOptions, K as OBSERVABILITY_ENV_VARS, N as ObservabilityIds, Q as ReceiveSpec, U as ResolvedModel, V as RetryDecision, X as SdkAdapterFactory, Y as SplitPrompt, Z as TaskRunOptions, T as TokenUsage, _ as ToolchainCheckResult, $ as ToolchainManifest, a0 as ToolchainManifestSchema, a1 as WorkflowContractLike, a2 as WorkflowInvocation, a3 as WorkflowRunOptions, a4 as WorkflowStep, a5 as buildCandidateAgents, a6 as buildGateEvaluationPrompt, a7 as buildObservabilityEnv, a8 as buildPerAgentGuardrails, a9 as buildRetryFollowUp, aa as buildSdkFunctionTools, ab as buildSplitTaskPrompt, ac as buildTaskPrompt, ad as collectAnalyzerToolIds, ae as createExecutionEnvelope, af as createLibraryToolRegistry, ag as createModelResolver, ah as createRegistryFromSdkTools, ai as deriveToolchainsForAgents, aj as emitIterationClose, ak as emitIterationMetric, al as emitIterationOpen, am as emitLlmTurnClose, an as emitLlmTurnOpen, ao as emitSessionClose, ap as emitSessionOpen, aq as emitSubagentClose, ar as emitSubagentOpen, as as emitToolExecClose, at as emitToolExecOpen, au as emitToolchainClose, av as emitToolchainOpen, aw as extractStructuredResult, ax as getEffectiveGuardrailIds, ay as getGuardrailRulesForAgent, az as guardrailContextToRuleData, aA as isNavigationIndex, aB as parseGateEvaluationResponse, aC as renderAgentSystemPrompt, aD as renderAnalyzerExplorationMandatePrompt, aE as renderNavigationIndexPrompt, aF as runTask, aG as runToolchainChecks, aH as runWorkflow, aI as serializeObserverEmit, aJ as shouldInjectAnalyzerExplorationMandate, aK as zodSchemaToPromptDescription, aL as zodSchemaToYamlExample } from './task-runner-Sez_CXcD.js';
|
|
3
3
|
import { a as GuardrailRuleData, G as GuardrailHooks, H as HookResponse, b as GuardrailCheckResult } from './guardrail-hooks-slK-z0Dz.js';
|
|
4
4
|
export { c as GuardrailCheckFunctions, d as GuardrailRule, e as HookContext, f as createGuardrailHooks, g as createGuardrailHooksForAgent, h as createGuardrailHooksFromRules, i as getBlockingViolations, j as getWarnings, k as hasBlockingViolation } from './guardrail-hooks-slK-z0Dz.js';
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -553,8 +553,13 @@ interface ExecuteOptions {
|
|
|
553
553
|
* Only consumed by executeWorkflow (toolchain checks are a run-level concern).
|
|
554
554
|
*/
|
|
555
555
|
toolchain?: RunToolchainChecksOptions;
|
|
556
|
-
/** Per-class adapter/model mapping from project.yaml (used by executeWorkflow). */
|
|
556
|
+
/** Per-class adapter/model mapping from project.yaml (used by executeWorkflow / executeTask). */
|
|
557
557
|
modelMapping?: ModelMappingConfig;
|
|
558
|
+
/**
|
|
559
|
+
* When true, `adapter` is used for all model classes; only the model name
|
|
560
|
+
* varies per class (CLI `--adapter mock` override).
|
|
561
|
+
*/
|
|
562
|
+
pinAdapter?: boolean;
|
|
558
563
|
}
|
|
559
564
|
interface TaskHookContext {
|
|
560
565
|
adapter: SdkAdapter;
|
package/dist/index.js
CHANGED
|
@@ -391,8 +391,15 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
391
391
|
);
|
|
392
392
|
}
|
|
393
393
|
return parts.join("");
|
|
394
|
+
}, stepModelFields2 = function(modelClass, envelopeMeta) {
|
|
395
|
+
if (!modelClass && !envelopeMeta) return {};
|
|
396
|
+
return {
|
|
397
|
+
...modelClass ? { model_class: modelClass } : {},
|
|
398
|
+
...envelopeMeta?.adapter ? { adapter: envelopeMeta.adapter } : {},
|
|
399
|
+
...envelopeMeta?.model ? { model: envelopeMeta.model } : {}
|
|
400
|
+
};
|
|
394
401
|
};
|
|
395
|
-
var extractPath = extractPath2, projectHandoffs = projectHandoffs2, contextFor = contextFor2;
|
|
402
|
+
var extractPath = extractPath2, projectHandoffs = projectHandoffs2, contextFor = contextFor2, stepModelFields = stepModelFields2;
|
|
396
403
|
const stepId = (i) => {
|
|
397
404
|
const s = workflow.steps[i];
|
|
398
405
|
if (s.type === "delegate" || s.type === "evaluate") return s.task;
|
|
@@ -422,7 +429,7 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
422
429
|
const evaluateExecCount = /* @__PURE__ */ new Map();
|
|
423
430
|
const iterationSpanIds = /* @__PURE__ */ new Map();
|
|
424
431
|
const loopInjectedVars = {};
|
|
425
|
-
async function executeStep(i, stepAdapter, envelopeMeta) {
|
|
432
|
+
async function executeStep(i, stepAdapter, envelopeMeta, modelClass) {
|
|
426
433
|
const step = workflow.steps[i];
|
|
427
434
|
const stepStart = Date.now();
|
|
428
435
|
if (step.type === "gate") {
|
|
@@ -470,7 +477,8 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
470
477
|
follow_ups_used: taskResult2.follow_ups_used,
|
|
471
478
|
retries_used: taskResult2.retries_used,
|
|
472
479
|
elapsed_ms: Date.now() - stepStart,
|
|
473
|
-
tokenUsage: taskResult2.tokenUsage
|
|
480
|
+
tokenUsage: taskResult2.tokenUsage,
|
|
481
|
+
...stepModelFields2(modelClass, envelopeMeta)
|
|
474
482
|
};
|
|
475
483
|
}
|
|
476
484
|
const delegateStep = step;
|
|
@@ -490,7 +498,8 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
490
498
|
outcome: { status: "skipped" },
|
|
491
499
|
follow_ups_used: 0,
|
|
492
500
|
retries_used: 0,
|
|
493
|
-
elapsed_ms: Date.now() - stepStart
|
|
501
|
+
elapsed_ms: Date.now() - stepStart,
|
|
502
|
+
...stepModelFields2(modelClass, envelopeMeta)
|
|
494
503
|
};
|
|
495
504
|
}
|
|
496
505
|
}
|
|
@@ -535,7 +544,8 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
535
544
|
follow_ups_used: taskResult.follow_ups_used,
|
|
536
545
|
retries_used: taskResult.retries_used,
|
|
537
546
|
elapsed_ms: Date.now() - stepStart,
|
|
538
|
-
tokenUsage: taskResult.tokenUsage
|
|
547
|
+
tokenUsage: taskResult.tokenUsage,
|
|
548
|
+
...stepModelFields2(modelClass, envelopeMeta)
|
|
539
549
|
};
|
|
540
550
|
}
|
|
541
551
|
while (completed.size < workflow.steps.length) {
|
|
@@ -570,7 +580,7 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
570
580
|
stepAdapter = primaryAdapter;
|
|
571
581
|
}
|
|
572
582
|
const envelopeMeta = options.resolveModelMeta?.(modelClass);
|
|
573
|
-
return executeStep(i, stepAdapter, envelopeMeta);
|
|
583
|
+
return executeStep(i, stepAdapter, envelopeMeta, modelClass);
|
|
574
584
|
}));
|
|
575
585
|
for (let b = 0; b < ready.length; b++) {
|
|
576
586
|
const i = ready[b];
|
|
@@ -1317,21 +1327,26 @@ function createModelResolver(options) {
|
|
|
1317
1327
|
return {
|
|
1318
1328
|
resolve(modelClass) {
|
|
1319
1329
|
const fallback = {
|
|
1320
|
-
adapter: options.fallbackAdapter,
|
|
1330
|
+
adapter: options.pinnedAdapter ?? options.fallbackAdapter,
|
|
1321
1331
|
model: options.fallbackModel
|
|
1322
1332
|
};
|
|
1323
1333
|
if (!modelClass) return fallback;
|
|
1324
1334
|
const classEnv = env[CLASS_ENV_KEYS[modelClass]];
|
|
1325
1335
|
if (classEnv) {
|
|
1326
|
-
|
|
1336
|
+
const parsed = parseEnvValue(classEnv, options.fallbackAdapter);
|
|
1337
|
+
return options.pinnedAdapter ? { adapter: options.pinnedAdapter, model: parsed.model } : parsed;
|
|
1327
1338
|
}
|
|
1328
1339
|
const catchAllEnv = env[ENV_PREFIX];
|
|
1329
1340
|
if (catchAllEnv) {
|
|
1330
|
-
|
|
1341
|
+
const parsed = parseEnvValue(catchAllEnv, options.fallbackAdapter);
|
|
1342
|
+
return options.pinnedAdapter ? { adapter: options.pinnedAdapter, model: parsed.model } : parsed;
|
|
1331
1343
|
}
|
|
1332
1344
|
const entry = options.modelMapping?.[modelClass];
|
|
1333
1345
|
if (entry) {
|
|
1334
|
-
return {
|
|
1346
|
+
return {
|
|
1347
|
+
adapter: options.pinnedAdapter ?? entry.adapter,
|
|
1348
|
+
model: entry.model
|
|
1349
|
+
};
|
|
1335
1350
|
}
|
|
1336
1351
|
return fallback;
|
|
1337
1352
|
}
|
|
@@ -1687,6 +1702,62 @@ Install it with: npm install ${pkg2}`
|
|
|
1687
1702
|
|
|
1688
1703
|
// src/lib/execute.ts
|
|
1689
1704
|
import { resolve as resolve3 } from "path";
|
|
1705
|
+
|
|
1706
|
+
// src/lib/model-aware-adapter.ts
|
|
1707
|
+
function cacheKey(resolved) {
|
|
1708
|
+
return `${resolved.adapter}:${resolved.model ?? ""}`;
|
|
1709
|
+
}
|
|
1710
|
+
async function createModelAwareAdapterSetup(options) {
|
|
1711
|
+
const modelResolver = createModelResolver({
|
|
1712
|
+
modelMapping: options.modelMapping,
|
|
1713
|
+
fallbackAdapter: options.fallbackAdapter,
|
|
1714
|
+
fallbackModel: options.fallbackModel,
|
|
1715
|
+
pinnedAdapter: options.pinAdapter ? options.fallbackAdapter : void 0
|
|
1716
|
+
});
|
|
1717
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1718
|
+
const inflight = /* @__PURE__ */ new Map();
|
|
1719
|
+
async function ensureAdapter(modelClass) {
|
|
1720
|
+
const resolved = modelResolver.resolve(modelClass);
|
|
1721
|
+
const key = cacheKey(resolved);
|
|
1722
|
+
const hit = cache.get(key);
|
|
1723
|
+
if (hit) return hit;
|
|
1724
|
+
let pending = inflight.get(key);
|
|
1725
|
+
if (!pending) {
|
|
1726
|
+
pending = createAdapter(resolved.adapter, {
|
|
1727
|
+
model: resolved.model,
|
|
1728
|
+
...options.adapterOptions
|
|
1729
|
+
});
|
|
1730
|
+
inflight.set(key, pending);
|
|
1731
|
+
}
|
|
1732
|
+
try {
|
|
1733
|
+
const adapter = await pending;
|
|
1734
|
+
cache.set(key, adapter);
|
|
1735
|
+
return adapter;
|
|
1736
|
+
} finally {
|
|
1737
|
+
inflight.delete(key);
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
const defaultAdapter = await ensureAdapter("standard");
|
|
1741
|
+
const factory = (modelClass) => {
|
|
1742
|
+
const effectiveClass = modelClass ?? "standard";
|
|
1743
|
+
const resolved = modelResolver.resolve(effectiveClass);
|
|
1744
|
+
const key = cacheKey(resolved);
|
|
1745
|
+
const hit = cache.get(key);
|
|
1746
|
+
if (hit) return hit;
|
|
1747
|
+
if (effectiveClass === "standard") {
|
|
1748
|
+
return defaultAdapter;
|
|
1749
|
+
}
|
|
1750
|
+
return ensureAdapter(effectiveClass);
|
|
1751
|
+
};
|
|
1752
|
+
return {
|
|
1753
|
+
factory,
|
|
1754
|
+
defaultAdapter,
|
|
1755
|
+
modelResolver,
|
|
1756
|
+
resolveAdapter: ensureAdapter
|
|
1757
|
+
};
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
// src/lib/execute.ts
|
|
1690
1761
|
async function resolveExecutionContext(options, requiredEntities) {
|
|
1691
1762
|
const useBoundResolver = options.resolvedComponent || options.bindingPaths && options.bindingPaths.length > 0 || options.artifactBinding;
|
|
1692
1763
|
if (useBoundResolver) {
|
|
@@ -1775,13 +1846,20 @@ async function buildNavigationContextSafely(execCtx) {
|
|
|
1775
1846
|
}
|
|
1776
1847
|
async function executeTask(taskId, options) {
|
|
1777
1848
|
const execCtx = await resolveExecutionContext(options, { tasks: [taskId] });
|
|
1778
|
-
const
|
|
1849
|
+
const taskDef = execCtx.registries.taskRegistry?.[taskId];
|
|
1850
|
+
const targetAgentId = taskDef?.target_agent;
|
|
1851
|
+
const modelClass = taskDef?.model_class;
|
|
1779
1852
|
const adapterOptions = { ...options.adapterOptions };
|
|
1780
1853
|
injectGuardrailHooks(adapterOptions, execCtx, targetAgentId);
|
|
1781
|
-
const
|
|
1782
|
-
|
|
1783
|
-
|
|
1854
|
+
const { resolveAdapter: resolveTaskAdapter, modelResolver } = await createModelAwareAdapterSetup({
|
|
1855
|
+
fallbackAdapter: options.adapter,
|
|
1856
|
+
fallbackModel: options.model,
|
|
1857
|
+
modelMapping: options.modelMapping,
|
|
1858
|
+
adapterOptions,
|
|
1859
|
+
pinAdapter: options.pinAdapter
|
|
1784
1860
|
});
|
|
1861
|
+
const resolved = modelResolver.resolve(modelClass);
|
|
1862
|
+
const adapter = await resolveTaskAdapter(modelClass);
|
|
1785
1863
|
const progressSink = createProgressSink(
|
|
1786
1864
|
options.logFile ? { stderr: true, file: resolve3(options.logFile), naming: "single" } : { stderr: true }
|
|
1787
1865
|
);
|
|
@@ -1804,8 +1882,8 @@ async function executeTask(taskId, options) {
|
|
|
1804
1882
|
progressOutput: progressSink,
|
|
1805
1883
|
observer: options.observer,
|
|
1806
1884
|
libraryTools: analyzerTools,
|
|
1807
|
-
envelopeAdapter:
|
|
1808
|
-
envelopeModel:
|
|
1885
|
+
envelopeAdapter: resolved.adapter,
|
|
1886
|
+
envelopeModel: resolved.model,
|
|
1809
1887
|
...execCtx.registries
|
|
1810
1888
|
});
|
|
1811
1889
|
if (options.hooks?.afterTask) {
|
|
@@ -1820,9 +1898,12 @@ async function executeWorkflow(workflowId, options) {
|
|
|
1820
1898
|
const execCtx = await resolveExecutionContext(options, { workflows: [workflowId] });
|
|
1821
1899
|
const adapterOptions = { ...options.adapterOptions };
|
|
1822
1900
|
injectGuardrailHooks(adapterOptions, execCtx);
|
|
1823
|
-
const adapter = await
|
|
1824
|
-
|
|
1825
|
-
|
|
1901
|
+
const { factory: adapterOrFactory, defaultAdapter: adapter, modelResolver } = await createModelAwareAdapterSetup({
|
|
1902
|
+
fallbackAdapter: options.adapter,
|
|
1903
|
+
fallbackModel: options.model,
|
|
1904
|
+
modelMapping: options.modelMapping,
|
|
1905
|
+
adapterOptions,
|
|
1906
|
+
pinAdapter: options.pinAdapter
|
|
1826
1907
|
});
|
|
1827
1908
|
const progressSink = createProgressSink(
|
|
1828
1909
|
options.logFile ? { stderr: true, file: resolve3(options.logFile), naming: "single" } : { stderr: true }
|
|
@@ -1843,11 +1924,6 @@ async function executeWorkflow(workflowId, options) {
|
|
|
1843
1924
|
if (options.hooks?.beforeWorkflow) {
|
|
1844
1925
|
await options.hooks.beforeWorkflow({ adapter, registries: execCtx.registries, workflowId });
|
|
1845
1926
|
}
|
|
1846
|
-
const modelResolver = createModelResolver({
|
|
1847
|
-
modelMapping: options.modelMapping,
|
|
1848
|
-
fallbackAdapter: options.adapter,
|
|
1849
|
-
fallbackModel: options.model
|
|
1850
|
-
});
|
|
1851
1927
|
const invocation = {
|
|
1852
1928
|
workflow: workflowId,
|
|
1853
1929
|
user_request: options.request,
|
|
@@ -1868,7 +1944,7 @@ async function executeWorkflow(workflowId, options) {
|
|
|
1868
1944
|
},
|
|
1869
1945
|
context: workflowContext
|
|
1870
1946
|
};
|
|
1871
|
-
const result = await runWorkflow(
|
|
1947
|
+
const result = await runWorkflow(adapterOrFactory, invocation, execCtx.registries);
|
|
1872
1948
|
if (options.hooks?.afterWorkflow) {
|
|
1873
1949
|
await options.hooks.afterWorkflow(result);
|
|
1874
1950
|
}
|
|
@@ -2081,9 +2157,11 @@ async function createProjectRuntime(options) {
|
|
|
2081
2157
|
}
|
|
2082
2158
|
function sharedExecuteOptions() {
|
|
2083
2159
|
const { adapter, model } = resolveAdapter2();
|
|
2160
|
+
const explicitAdapter = options.adapter ?? env.AGENT_RUNTIME_ADAPTER;
|
|
2084
2161
|
return {
|
|
2085
2162
|
adapter,
|
|
2086
2163
|
model,
|
|
2164
|
+
pinAdapter: Boolean(explicitAdapter),
|
|
2087
2165
|
dsl: options.embeddedDsl,
|
|
2088
2166
|
projectDslPath,
|
|
2089
2167
|
bindingPaths: config.bindingPaths,
|