@aaac/runtime 0.1.11 → 0.1.13
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/mock.js +4 -1
- package/dist/adapters/mock.js.map +1 -1
- package/dist/adapters/openai-agents-sdk.d.ts +1 -1
- package/dist/{chunk-5FL4NAC5.js → chunk-E2UR4TNM.js} +3 -26
- package/dist/chunk-E2UR4TNM.js.map +1 -0
- package/dist/generator/index.d.ts +2 -3
- package/dist/generator/index.js +1 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +123 -5
- package/dist/index.js.map +1 -1
- package/dist/{task-runner-CZScv9Yb.d.ts → task-runner-3MPh_dn7.d.ts} +33 -4
- package/package.json +2 -2
- package/dist/chunk-5FL4NAC5.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SdkAdapter, G as GuardrailHooks, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef } from '../task-runner-
|
|
1
|
+
import { S as SdkAdapter, G as GuardrailHooks, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef } from '../task-runner-3MPh_dn7.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../context-DKkamYX_.js';
|
|
4
4
|
import '@aaac/observability';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SdkAdapter, G as GuardrailHooks, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef } from '../task-runner-
|
|
1
|
+
import { S as SdkAdapter, G as GuardrailHooks, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef } from '../task-runner-3MPh_dn7.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../context-DKkamYX_.js';
|
|
4
4
|
import '@aaac/observability';
|
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-3MPh_dn7.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../context-DKkamYX_.js';
|
|
4
4
|
import '@aaac/observability';
|
package/dist/adapters/mock.js
CHANGED
|
@@ -9,7 +9,10 @@ var MockAdapter = class {
|
|
|
9
9
|
}
|
|
10
10
|
async send(prompt, _options) {
|
|
11
11
|
const match = prompt.match(/## Task: (\S+)/);
|
|
12
|
-
|
|
12
|
+
if (!match) {
|
|
13
|
+
throw new Error(`MockAdapter: no "## Task: <id>" marker found in prompt`);
|
|
14
|
+
}
|
|
15
|
+
const taskId = match[1];
|
|
13
16
|
const reqMatch = prompt.match(/## User Request\n\n([\s\S]*?)(?:\n\n---|$)/);
|
|
14
17
|
const userRequest = reqMatch?.[1]?.trim() ?? "";
|
|
15
18
|
if (this.defaultLatencyMs > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/adapters/mock.ts"],"sourcesContent":["/**\n * Mock SDK Adapter — for testing and demo purposes\n */\n\nimport type { SdkAdapter } from \"../lib/task-runner.js\";\nimport type { MemoryRef } from \"../lib/memory-store.js\";\n\nexport class MockAdapter implements SdkAdapter {\n private responses: Record<string, (userRequest: string) => string>;\n private defaultLatencyMs: number;\n private lastMemoryRef: MemoryRef | null = null;\n\n constructor(options?: {\n responses?: Record<string, (userRequest: string) => string>;\n defaultLatencyMs?: number;\n }) {\n this.responses = options?.responses ?? {};\n this.defaultLatencyMs = options?.defaultLatencyMs ?? 0;\n }\n\n async send(prompt: string, _options: import(\"../lib/task-runner.js\").AdapterSendOptions): Promise<string> {\n const match = prompt.match(/## Task: (\\S+)/);\n const taskId = match
|
|
1
|
+
{"version":3,"sources":["../../src/adapters/mock.ts"],"sourcesContent":["/**\n * Mock SDK Adapter — for testing and demo purposes\n */\n\nimport type { SdkAdapter } from \"../lib/task-runner.js\";\nimport type { MemoryRef } from \"../lib/memory-store.js\";\n\nexport class MockAdapter implements SdkAdapter {\n private responses: Record<string, (userRequest: string) => string>;\n private defaultLatencyMs: number;\n private lastMemoryRef: MemoryRef | null = null;\n\n constructor(options?: {\n responses?: Record<string, (userRequest: string) => string>;\n defaultLatencyMs?: number;\n }) {\n this.responses = options?.responses ?? {};\n this.defaultLatencyMs = options?.defaultLatencyMs ?? 0;\n }\n\n async send(prompt: string, _options: import(\"../lib/task-runner.js\").AdapterSendOptions): Promise<string> {\n const match = prompt.match(/## Task: (\\S+)/);\n if (!match) {\n throw new Error(`MockAdapter: no \"## Task: <id>\" marker found in prompt`);\n }\n const taskId = match[1];\n\n const reqMatch = prompt.match(/## User Request\\n\\n([\\s\\S]*?)(?:\\n\\n---|$)/);\n const userRequest = reqMatch?.[1]?.trim() ?? \"\";\n\n if (this.defaultLatencyMs > 0) {\n await new Promise((r) => setTimeout(r, this.defaultLatencyMs));\n }\n\n const responseFn = this.responses[taskId];\n if (!responseFn) {\n return `Task \"${taskId}\" completed but no structured output available.`;\n }\n\n const result = responseFn(userRequest);\n this.lastMemoryRef = {\n id: `mock-ref-${Date.now()}`,\n provider: \"mock\",\n compat: \"mock@1\",\n created_at: new Date().toISOString(),\n };\n return result;\n }\n\n getLastMemoryRef(): MemoryRef | null {\n return this.lastMemoryRef;\n }\n\n isCompatible(compat: string): boolean {\n return compat.startsWith(\"mock@\");\n }\n}\n"],"mappings":";AAOO,IAAM,cAAN,MAAwC;AAAA,EACrC;AAAA,EACA;AAAA,EACA,gBAAkC;AAAA,EAE1C,YAAY,SAGT;AACD,SAAK,YAAY,SAAS,aAAa,CAAC;AACxC,SAAK,mBAAmB,SAAS,oBAAoB;AAAA,EACvD;AAAA,EAEA,MAAM,KAAK,QAAgB,UAA+E;AACxG,UAAM,QAAQ,OAAO,MAAM,gBAAgB;AAC3C,QAAI,CAAC,OAAO;AACV,YAAM,IAAI,MAAM,wDAAwD;AAAA,IAC1E;AACA,UAAM,SAAS,MAAM,CAAC;AAEtB,UAAM,WAAW,OAAO,MAAM,4CAA4C;AAC1E,UAAM,cAAc,WAAW,CAAC,GAAG,KAAK,KAAK;AAE7C,QAAI,KAAK,mBAAmB,GAAG;AAC7B,YAAM,IAAI,QAAQ,CAAC,MAAM,WAAW,GAAG,KAAK,gBAAgB,CAAC;AAAA,IAC/D;AAEA,UAAM,aAAa,KAAK,UAAU,MAAM;AACxC,QAAI,CAAC,YAAY;AACf,aAAO,SAAS,MAAM;AAAA,IACxB;AAEA,UAAM,SAAS,WAAW,WAAW;AACrC,SAAK,gBAAgB;AAAA,MACnB,IAAI,YAAY,KAAK,IAAI,CAAC;AAAA,MAC1B,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,IACrC;AACA,WAAO;AAAA,EACT;AAAA,EAEA,mBAAqC;AACnC,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,aAAa,QAAyB;AACpC,WAAO,OAAO,WAAW,OAAO;AAAA,EAClC;AACF;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SdkAdapter, G as GuardrailHooks, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef } from '../task-runner-
|
|
1
|
+
import { S as SdkAdapter, G as GuardrailHooks, C as CacheConfig, A as AdapterSendOptions, a as AgentExecutionRequest, M as MemoryRef } from '../task-runner-3MPh_dn7.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../context-DKkamYX_.js';
|
|
4
4
|
import '@aaac/observability';
|
|
@@ -48,13 +48,11 @@ function buildGuardrailContext(dsl, binding, policyName) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// src/generator/config.ts
|
|
51
|
-
import { existsSync } from "fs";
|
|
52
51
|
import { readFile } from "fs/promises";
|
|
53
|
-
import { resolve, dirname
|
|
52
|
+
import { resolve, dirname } from "path";
|
|
54
53
|
import { z } from "zod";
|
|
55
54
|
import YAML from "yaml";
|
|
56
55
|
var DEFAULT_CONFIG_PATH = "./agents.conf.yaml";
|
|
57
|
-
var LEGACY_CONFIG_FILENAME = "agent-runtime.config.yaml";
|
|
58
56
|
var RecoverySchema = z.object({
|
|
59
57
|
max_follow_ups: z.number().int().min(0).default(2),
|
|
60
58
|
max_retries: z.number().int().min(0).default(0)
|
|
@@ -149,19 +147,7 @@ var ProjectConfigSchema = z.object({
|
|
|
149
147
|
cli: z.record(z.string(), CliSectionSchema).optional()
|
|
150
148
|
});
|
|
151
149
|
function resolveConfigFilePath(configPath) {
|
|
152
|
-
|
|
153
|
-
if (existsSync(absPath)) {
|
|
154
|
-
return absPath;
|
|
155
|
-
}
|
|
156
|
-
const dir = dirname(absPath);
|
|
157
|
-
const base = basename(absPath);
|
|
158
|
-
if (base === "agents.conf.yaml") {
|
|
159
|
-
const legacyPath = join(dir, LEGACY_CONFIG_FILENAME);
|
|
160
|
-
if (existsSync(legacyPath)) {
|
|
161
|
-
return legacyPath;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return absPath;
|
|
150
|
+
return resolve(configPath);
|
|
165
151
|
}
|
|
166
152
|
function mergeBindingsUnion(root, override) {
|
|
167
153
|
const base = root ?? [];
|
|
@@ -271,14 +257,6 @@ function resolveOverride(projectConfig, target) {
|
|
|
271
257
|
}
|
|
272
258
|
return void 0;
|
|
273
259
|
}
|
|
274
|
-
async function loadConfig(configPath) {
|
|
275
|
-
const absPath = resolveConfigFilePath(configPath);
|
|
276
|
-
const raw = await readFile(absPath, "utf8");
|
|
277
|
-
const parsed = YAML.parse(raw);
|
|
278
|
-
const config = RuntimeConfigSchema.parse(parsed);
|
|
279
|
-
const configDir = dirname(absPath);
|
|
280
|
-
return buildResolvedConfig(config, configDir);
|
|
281
|
-
}
|
|
282
260
|
async function loadProjectConfig(configPath, target) {
|
|
283
261
|
const absPath = resolveConfigFilePath(configPath);
|
|
284
262
|
const raw = await readFile(absPath, "utf8");
|
|
@@ -306,7 +284,6 @@ export {
|
|
|
306
284
|
DEFAULT_CONFIG_PATH,
|
|
307
285
|
ComponentOverrideSchema,
|
|
308
286
|
ProjectConfigSchema,
|
|
309
|
-
loadConfig,
|
|
310
287
|
loadProjectConfig
|
|
311
288
|
};
|
|
312
|
-
//# sourceMappingURL=chunk-
|
|
289
|
+
//# sourceMappingURL=chunk-E2UR4TNM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generator/context.ts","../src/generator/config.ts"],"sourcesContent":["/**\n * Build the guardrail context from resolved DSL + binding data.\n *\n * (The DSL→TypeScript codegen context builder, `buildContractContext`, was\n * removed alongside the runtime `generate()` codegen path.)\n */\n\nexport interface GuardrailCheckEntry {\n guardrail_id: string;\n description: string;\n severity: string;\n action: string;\n matcher_type: string;\n pattern: string;\n message: string;\n file_glob?: string;\n exclude_glob?: string;\n}\n\nexport interface GuardrailContext {\n commandChecks: GuardrailCheckEntry[];\n fileChecks: GuardrailCheckEntry[];\n contentChecks: GuardrailCheckEntry[];\n allChecks: GuardrailCheckEntry[];\n hasGuardrails: boolean;\n}\n\n/**\n * Build guardrail context from DSL guardrails, binding guardrail_impl, and active policy.\n * Mirrors the agent-contracts resolveChecks pattern.\n */\nexport function buildGuardrailContext(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n dsl: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n binding: any,\n policyName?: string,\n): GuardrailContext {\n const empty: GuardrailContext = {\n commandChecks: [],\n fileChecks: [],\n contentChecks: [],\n allChecks: [],\n hasGuardrails: false,\n };\n\n if (!binding?.guardrail_impl) return empty;\n\n const guardrails = dsl.guardrails ?? {};\n const policies = dsl.guardrail_policies ?? {};\n const policy = policyName ? policies[policyName] : undefined;\n\n const allChecks: GuardrailCheckEntry[] = [];\n\n for (const [guardrailId, impl] of Object.entries(\n binding.guardrail_impl as Record<string, { checks: Array<Record<string, unknown>> }>,\n )) {\n const guardrail = guardrails[guardrailId] as Record<string, unknown> | undefined;\n const description = (guardrail?.description as string) ?? guardrailId;\n\n const policyRule = policy?.rules?.find(\n (r: Record<string, unknown>) => r.guardrail === guardrailId,\n );\n const severity = (policyRule?.severity as string) ?? \"warning\";\n const action = (policyRule?.action as string) ?? \"warn\";\n\n for (const check of impl.checks) {\n const matcher = check.matcher as Record<string, unknown> | undefined;\n if (!matcher) continue;\n\n allChecks.push({\n guardrail_id: guardrailId,\n description,\n severity,\n action,\n matcher_type: matcher.type as string,\n pattern: matcher.pattern as string,\n message: (check.message as string) ?? description,\n file_glob: matcher.file_glob as string | undefined,\n exclude_glob: matcher.exclude_glob as string | undefined,\n });\n }\n }\n\n return {\n commandChecks: allChecks.filter((c) => c.matcher_type === \"command_regex\"),\n fileChecks: allChecks.filter((c) => c.matcher_type === \"file_glob\"),\n contentChecks: allChecks.filter((c) => c.matcher_type === \"content_regex\"),\n allChecks,\n hasGuardrails: allChecks.length > 0,\n };\n}\n","/**\n * Generator configuration — loads and validates agents.conf.yaml\n */\n\nimport { readFile } from \"node:fs/promises\";\nimport { resolve, dirname } from \"node:path\";\nimport { z } from \"zod\";\nimport YAML from \"yaml\";\n\nexport const DEFAULT_CONFIG_PATH = \"./agents.conf.yaml\";\n\nconst RecoverySchema = z.object({\n max_follow_ups: z.number().int().min(0).default(2),\n max_retries: z.number().int().min(0).default(0),\n}).default(() => ({ max_follow_ups: 2, max_retries: 0 }));\n\nconst ModelClassEntrySchema = z.object({\n adapter: z.string(),\n model: z.string().optional(),\n});\n\nconst ModelMappingSchema = z.object({\n fast: ModelClassEntrySchema.optional(),\n standard: ModelClassEntrySchema.optional(),\n thinking: ModelClassEntrySchema.optional(),\n}).default({});\n\nconst ProgressLogSchema = z.object({\n destination: z.enum([\"stderr\", \"file\", \"both\", \"none\"]).default(\"stderr\"),\n file: z.string().optional(),\n naming: z.enum([\"single\", \"per-invocation\", \"daily\"]).default(\"single\"),\n}).default(() => ({ destination: \"stderr\" as const, naming: \"single\" as const }))\n .refine(\n (val) => {\n if ((val.destination === \"file\" || val.destination === \"both\") && !val.file) return false;\n return true;\n },\n { message: \"logging.progress_log.file is required when destination is 'file' or 'both'\" },\n );\n\nconst LoggingSchema = z.object({\n progress_log: ProgressLogSchema,\n}).default(() => ({ progress_log: { destination: \"stderr\" as const, naming: \"single\" as const } }));\n\nexport const RuntimeConfigSchema = z.object({\n dsl: z.string().default(\"./agent-contracts.yaml\"),\n generated_dir: z.string().default(\"./agent/generated\"),\n bindings: z.array(z.string()).default([]),\n active_guardrail_policy: z.string().optional(),\n templates_dir: z.string().optional(),\n plugins: z.array(z.string()).default([]),\n recovery: RecoverySchema,\n model_mapping: ModelMappingSchema,\n logging: LoggingSchema,\n});\n\nexport type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;\n\n/**\n * Unified project bindings object.\n * - guardrail: guardrail_impl matcher files → machine enforcement (BoundResolver)\n * - hooks: git hook bindings → governance materialize (#68; declarative for now)\n * - observability: event-mapping file + external recorder CLI\n */\nconst BindingsSchema = z.object({\n guardrail: z.array(z.string()).optional(),\n hooks: z.array(z.string()).optional(),\n observability: z.object({\n event_mapping: z.string().optional(),\n recorder: z.string().optional(),\n }).optional(),\n}).optional();\n\nconst CliSectionSchema = z.object({\n agents: z.string().optional(),\n dsl: z.string().optional(),\n generated_dir: z.string().optional(),\n plugins: z.array(z.string()).optional(),\n bindings: BindingsSchema,\n}).strict();\n\nexport const ComponentOverrideSchema = z.object({\n agents: z.string().optional(),\n dsl: z.string().optional(),\n component_contract: z.string().optional(),\n generated_dir: z.string().optional(),\n bindings: BindingsSchema,\n plugins: z.array(z.string()).optional(),\n model_mapping: ModelMappingSchema.optional(),\n recovery: RecoverySchema.optional(),\n templates_dir: z.string().optional(),\n}).strict();\n\nexport type ComponentOverride = z.infer<typeof ComponentOverrideSchema>;\n\nconst EnvironmentsSchema = z.object({\n git: z.object({\n hooks: z.array(z.string()).optional(),\n }).optional(),\n cursor: z.object({\n hooks_json: z.string().optional(),\n }).optional(),\n ci: z.object({\n provider: z.string().optional(),\n }).optional(),\n}).optional();\n\nexport const ProjectConfigSchema = z.object({\n schema: z.string().optional(),\n agents: z.string().optional(),\n dsl: z.string().optional(),\n generated_dir: z.string().optional(),\n bindings: BindingsSchema,\n active_guardrail_policy: z.string().optional(),\n templates_dir: z.string().optional(),\n plugins: z.array(z.string()).optional(),\n recovery: RecoverySchema,\n model_mapping: ModelMappingSchema,\n logging: LoggingSchema,\n artifacts: z.string().optional(),\n toolchains: z.string().optional(),\n components: z.record(z.string(), ComponentOverrideSchema).optional(),\n environments: EnvironmentsSchema,\n cli: z.record(z.string(), CliSectionSchema).optional(),\n});\n\nexport type ProjectConfig = z.infer<typeof ProjectConfigSchema>;\n\nexport interface ResolvedProgressLog {\n destination: \"stderr\" | \"file\" | \"both\" | \"none\";\n file: string | undefined;\n naming: \"single\" | \"per-invocation\" | \"daily\";\n}\n\nexport interface ResolvedEnvironments {\n git?: { hooks: string[] };\n cursor?: { hooks_json: string };\n ci?: { provider: string };\n}\n\nexport interface ResolvedObservability {\n eventMappingPath?: string;\n recorder?: string;\n}\n\nexport interface ResolvedConfig extends RuntimeConfig {\n configDir: string;\n dslPath: string;\n generatedDir: string;\n /** Resolved guardrail_impl matcher files (machine enforcement). */\n bindingPaths: string[];\n /** Resolved git-hook binding files (governance materialize, #68). */\n hookBindingPaths: string[];\n /** Observability event mapping + recorder, if configured. */\n observability?: ResolvedObservability;\n templatesDir: string | undefined;\n pluginPaths: string[];\n resolvedLogging: { progressLog: ResolvedProgressLog };\n artifactsPath?: string;\n toolchainsPath?: string;\n environments?: ResolvedEnvironments;\n componentOverrides?: Record<string, ComponentOverride>;\n}\n\ninterface GovernanceFields {\n artifacts?: string;\n toolchains?: string;\n environments?: z.infer<typeof EnvironmentsSchema>;\n componentOverrides?: Record<string, ComponentOverride>;\n hookBindings?: string[];\n observability?: { event_mapping?: string; recorder?: string };\n}\n\n/** Internal runtime base assembled from a project manifest before RuntimeConfigSchema validation. */\ninterface RuntimeConfigInput {\n dsl?: string;\n generated_dir?: string;\n bindings: string[];\n active_guardrail_policy?: string;\n templates_dir?: string;\n plugins?: string[];\n recovery: z.infer<typeof RecoverySchema>;\n model_mapping: z.infer<typeof ModelMappingSchema>;\n logging: z.infer<typeof LoggingSchema>;\n}\n\ntype ConfigOverride = ComponentOverride | z.infer<typeof CliSectionSchema>;\n\nfunction resolveConfigFilePath(configPath: string): string {\n return resolve(configPath);\n}\n\nfunction mergeBindingsUnion(root: string[] | undefined, override: string[] | undefined): string[] {\n const base = root ?? [];\n const extra = override ?? [];\n const seen = new Set(base);\n const result = [...base];\n for (const binding of extra) {\n if (!seen.has(binding)) {\n result.push(binding);\n seen.add(binding);\n }\n }\n return result;\n}\n\nfunction mergeConfigWithOverride(\n base: RuntimeConfigInput,\n override: ConfigOverride,\n): RuntimeConfigInput {\n const merged: RuntimeConfigInput = { ...base };\n\n const overrideDsl = override.agents ?? override.dsl;\n if (overrideDsl !== undefined) merged.dsl = overrideDsl;\n if (override.generated_dir !== undefined) merged.generated_dir = override.generated_dir;\n if (override.bindings?.guardrail !== undefined) {\n merged.bindings = mergeBindingsUnion(base.bindings, override.bindings.guardrail);\n }\n if (override.plugins !== undefined) merged.plugins = override.plugins;\n\n if (\"templates_dir\" in override && override.templates_dir !== undefined) {\n merged.templates_dir = override.templates_dir;\n }\n\n if (\"model_mapping\" in override && override.model_mapping) {\n merged.model_mapping = {\n ...base.model_mapping,\n ...(override.model_mapping.fast ? { fast: override.model_mapping.fast } : {}),\n ...(override.model_mapping.standard ? { standard: override.model_mapping.standard } : {}),\n ...(override.model_mapping.thinking ? { thinking: override.model_mapping.thinking } : {}),\n };\n }\n\n if (\"recovery\" in override && override.recovery) {\n merged.recovery = {\n ...base.recovery,\n ...override.recovery,\n };\n }\n\n return merged;\n}\n\nfunction resolveEnvironments(\n environments: z.infer<typeof EnvironmentsSchema>,\n configDir: string,\n): ResolvedEnvironments | undefined {\n if (!environments) return undefined;\n\n const resolved: ResolvedEnvironments = {};\n\n if (environments.git?.hooks) {\n resolved.git = { hooks: environments.git.hooks };\n }\n\n if (environments.cursor?.hooks_json) {\n resolved.cursor = {\n hooks_json: resolve(configDir, environments.cursor.hooks_json),\n };\n }\n\n if (environments.ci?.provider) {\n resolved.ci = { provider: environments.ci.provider };\n }\n\n return Object.keys(resolved).length > 0 ? resolved : undefined;\n}\n\nfunction buildResolvedConfig(\n config: RuntimeConfig,\n configDir: string,\n governance?: GovernanceFields,\n): ResolvedConfig {\n const pl = config.logging.progress_log;\n\n return {\n ...config,\n configDir,\n dslPath: resolve(configDir, config.dsl),\n generatedDir: resolve(configDir, config.generated_dir),\n bindingPaths: config.bindings.map((b) => resolve(configDir, b)),\n hookBindingPaths: (governance?.hookBindings ?? []).map((b) => resolve(configDir, b)),\n observability: governance?.observability\n ? {\n eventMappingPath: governance.observability.event_mapping\n ? resolve(configDir, governance.observability.event_mapping)\n : undefined,\n recorder: governance.observability.recorder,\n }\n : undefined,\n templatesDir: config.templates_dir\n ? resolve(configDir, config.templates_dir)\n : undefined,\n pluginPaths: config.plugins,\n resolvedLogging: {\n progressLog: {\n destination: pl.destination,\n file: pl.file ? resolve(configDir, pl.file) : undefined,\n naming: pl.naming,\n },\n },\n artifactsPath: governance?.artifacts\n ? resolve(configDir, governance.artifacts)\n : undefined,\n toolchainsPath: governance?.toolchains\n ? resolve(configDir, governance.toolchains)\n : undefined,\n environments: resolveEnvironments(governance?.environments, configDir),\n componentOverrides: governance?.componentOverrides,\n };\n}\n\n/** Assemble the internal runtime base from a parsed project manifest (agents wins over dsl alias). */\nfunction projectToRuntimeBase(projectConfig: ProjectConfig): RuntimeConfigInput {\n return {\n dsl: projectConfig.agents ?? projectConfig.dsl,\n generated_dir: projectConfig.generated_dir,\n bindings: projectConfig.bindings?.guardrail ?? [],\n active_guardrail_policy: projectConfig.active_guardrail_policy,\n templates_dir: projectConfig.templates_dir,\n plugins: projectConfig.plugins,\n recovery: projectConfig.recovery,\n model_mapping: projectConfig.model_mapping,\n logging: projectConfig.logging,\n };\n}\n\nfunction resolveOverride(\n projectConfig: ProjectConfig,\n target?: string,\n): ConfigOverride | undefined {\n if (!target) return undefined;\n\n if (projectConfig.components?.[target]) {\n return projectConfig.components[target];\n }\n\n if (projectConfig.cli?.[target]) {\n return projectConfig.cli[target];\n }\n\n return undefined;\n}\n\nexport async function loadProjectConfig(\n configPath: string,\n target?: string,\n): Promise<ResolvedConfig> {\n const absPath = resolveConfigFilePath(configPath);\n const raw = await readFile(absPath, \"utf8\");\n const parsed = YAML.parse(raw);\n const projectConfig = ProjectConfigSchema.parse(parsed);\n\n let base = projectToRuntimeBase(projectConfig);\n const override = resolveOverride(projectConfig, target);\n\n if (override) {\n base = mergeConfigWithOverride(base, override);\n }\n\n const config = RuntimeConfigSchema.parse(base);\n const configDir = dirname(absPath);\n\n return buildResolvedConfig(config, configDir, {\n artifacts: projectConfig.artifacts,\n toolchains: projectConfig.toolchains,\n environments: projectConfig.environments,\n componentOverrides: projectConfig.components,\n hookBindings: projectConfig.bindings?.hooks,\n observability: projectConfig.bindings?.observability,\n });\n}\n"],"mappings":";AA+BO,SAAS,sBAEd,KAEA,SACA,YACkB;AAClB,QAAM,QAA0B;AAAA,IAC9B,eAAe,CAAC;AAAA,IAChB,YAAY,CAAC;AAAA,IACb,eAAe,CAAC;AAAA,IAChB,WAAW,CAAC;AAAA,IACZ,eAAe;AAAA,EACjB;AAEA,MAAI,CAAC,SAAS,eAAgB,QAAO;AAErC,QAAM,aAAa,IAAI,cAAc,CAAC;AACtC,QAAM,WAAW,IAAI,sBAAsB,CAAC;AAC5C,QAAM,SAAS,aAAa,SAAS,UAAU,IAAI;AAEnD,QAAM,YAAmC,CAAC;AAE1C,aAAW,CAAC,aAAa,IAAI,KAAK,OAAO;AAAA,IACvC,QAAQ;AAAA,EACV,GAAG;AACD,UAAM,YAAY,WAA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,UAAU,aAAa,CAAC;AAAA,IAChD,yBAAyB,cAAc;AAAA,IACvC,eAAe,cAAc;AAAA,IAC7B,SAAS,cAAc;AAAA,IACvB,UAAU,cAAc;AAAA,IACxB,eAAe,cAAc;AAAA,IAC7B,SAAS,cAAc;AAAA,EACzB;AACF;AAEA,SAAS,gBACP,eACA,QAC4B;AAC5B,MAAI,CAAC,OAAQ,QAAO;AAEpB,MAAI,cAAc,aAAa,MAAM,GAAG;AACtC,WAAO,cAAc,WAAW,MAAM;AAAA,EACxC;AAEA,MAAI,cAAc,MAAM,MAAM,GAAG;AAC/B,WAAO,cAAc,IAAI,MAAM;AAAA,EACjC;AAEA,SAAO;AACT;AAEA,eAAsB,kBACpB,YACA,QACyB;AACzB,QAAM,UAAU,sBAAsB,UAAU;AAChD,QAAM,MAAM,MAAM,SAAS,SAAS,MAAM;AAC1C,QAAM,SAAS,KAAK,MAAM,GAAG;AAC7B,QAAM,gBAAgB,oBAAoB,MAAM,MAAM;AAEtD,MAAI,OAAO,qBAAqB,aAAa;AAC7C,QAAM,WAAW,gBAAgB,eAAe,MAAM;AAEtD,MAAI,UAAU;AACZ,WAAO,wBAAwB,MAAM,QAAQ;AAAA,EAC/C;AAEA,QAAM,SAAS,oBAAoB,MAAM,IAAI;AAC7C,QAAM,YAAY,QAAQ,OAAO;AAEjC,SAAO,oBAAoB,QAAQ,WAAW;AAAA,IAC5C,WAAW,cAAc;AAAA,IACzB,YAAY,cAAc;AAAA,IAC1B,cAAc,cAAc;AAAA,IAC5B,oBAAoB,cAAc;AAAA,IAClC,cAAc,cAAc,UAAU;AAAA,IACtC,eAAe,cAAc,UAAU;AAAA,EACzC,CAAC;AACH;","names":[]}
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
export { b as buildGuardrailContext } from '../context-DKkamYX_.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Generator configuration — loads and validates agents.conf.yaml
|
|
5
|
+
* Generator configuration — loads and validates agents.conf.yaml
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
declare const DEFAULT_CONFIG_PATH = "./agents.conf.yaml";
|
|
@@ -237,7 +237,6 @@ interface ResolvedConfig extends RuntimeConfig {
|
|
|
237
237
|
environments?: ResolvedEnvironments;
|
|
238
238
|
componentOverrides?: Record<string, ComponentOverride>;
|
|
239
239
|
}
|
|
240
|
-
declare function loadConfig(configPath: string): Promise<ResolvedConfig>;
|
|
241
240
|
declare function loadProjectConfig(configPath: string, target?: string): Promise<ResolvedConfig>;
|
|
242
241
|
|
|
243
|
-
export { type ComponentOverride, ComponentOverrideSchema, DEFAULT_CONFIG_PATH, type ProjectConfig, ProjectConfigSchema, type ResolvedConfig, type ResolvedEnvironments,
|
|
242
|
+
export { type ComponentOverride, ComponentOverrideSchema, DEFAULT_CONFIG_PATH, type ProjectConfig, ProjectConfigSchema, type ResolvedConfig, type ResolvedEnvironments, loadProjectConfig };
|
package/dist/generator/index.js
CHANGED
|
@@ -3,15 +3,13 @@ import {
|
|
|
3
3
|
DEFAULT_CONFIG_PATH,
|
|
4
4
|
ProjectConfigSchema,
|
|
5
5
|
buildGuardrailContext,
|
|
6
|
-
loadConfig,
|
|
7
6
|
loadProjectConfig
|
|
8
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-E2UR4TNM.js";
|
|
9
8
|
export {
|
|
10
9
|
ComponentOverrideSchema,
|
|
11
10
|
DEFAULT_CONFIG_PATH,
|
|
12
11
|
ProjectConfigSchema,
|
|
13
12
|
buildGuardrailContext,
|
|
14
|
-
loadConfig,
|
|
15
13
|
loadProjectConfig
|
|
16
14
|
};
|
|
17
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as ObserverEmitFn, T as TaskContext, b as TaskOutcome, c as AgentContractLike, d as TaskContractLike, P as PromptBuilderOptions, W as WorkflowResult, S as SdkAdapter, e as WorkflowRegistries, H as HandoffInput, f as StepCompleteEvent, g as StepResult, D as DelegateStep, h as GuardrailRuleData, i as MemoryStore, M as MemoryRef, L as LibraryToolRegistry, G as GuardrailHooks, R as ResolvedComponent, j as ArtifactBindingConfig, k as TaskRunResult, l as ResolvedToolchain, m as LibraryToolDefinition } from './task-runner-
|
|
2
|
-
export { n as AdapterOrFactory, A as AdapterSendOptions, a as AgentExecutionRequest, o as AgentProgressEvent, B as BoundResolveOptions, p as BoundResolver, C as CacheConfig, q as CandidateAgent, E as EnvelopeParams,
|
|
1
|
+
import { O as ObserverEmitFn, T as TaskContext, b as TaskOutcome, c as AgentContractLike, d as TaskContractLike, P as PromptBuilderOptions, W as WorkflowResult, S as SdkAdapter, e as WorkflowRegistries, H as HandoffInput, f as StepCompleteEvent, g as StepResult, D as DelegateStep, h as GuardrailRuleData, i as MemoryStore, M as MemoryRef, L as LibraryToolRegistry, G as GuardrailHooks, R as ResolvedComponent, j as ArtifactBindingConfig, k as TaskRunResult, l as ResolvedToolchain, m as LibraryToolDefinition } from './task-runner-3MPh_dn7.js';
|
|
2
|
+
export { n as AdapterOrFactory, A as AdapterSendOptions, a as AgentExecutionRequest, o as AgentProgressEvent, B as BoundResolveOptions, p as BoundResolver, C as CacheConfig, q as CandidateAgent, r as ConvergenceEnvelope, s as ConvergenceEnvelopePayload, E as EnvelopeParams, t as EvaluateStep, u as GateStep, v as GuardrailCheckFunctions, w as GuardrailCheckResult, x as GuardrailRule, y as HookContext, z as HookResponse, I as InMemoryStore, F as ModelAwareSdkAdapterFactory, J as ModelClass, K as ModelMappingConfig, N as ModelResolver, Q as ModelResolverOptions, U as ReceiveSpec, V as ResolvedModel, X as RetryDecision, Y as SdkAdapterFactory, Z as SplitPrompt, _ as TaskRunOptions, $ as WorkflowContractLike, a0 as WorkflowInvocation, a1 as WorkflowRunOptions, a2 as WorkflowStep, a3 as buildCandidateAgents, a4 as buildGateEvaluationPrompt, a5 as buildPerAgentGuardrails, a6 as buildRetryFollowUp, a7 as buildSplitTaskPrompt, a8 as buildTaskPrompt, a9 as createExecutionEnvelope, aa as createGuardrailHooks, ab as createGuardrailHooksForAgent, ac as createGuardrailHooksFromRules, ad as createLibraryToolRegistry, ae as createModelResolver, af as deriveToolchainsForAgents, ag as emitSessionClose, ah as emitSessionOpen, ai as emitSubagentClose, aj as emitSubagentOpen, ak as emitToolchainClose, al as emitToolchainOpen, am as extractStructuredResult, an as getBlockingViolations, ao as getEffectiveGuardrailIds, ap as getGuardrailRulesForAgent, aq as getWarnings, ar as guardrailContextToRuleData, as as hasBlockingViolation, at as parseGateEvaluationResponse, au as renderAgentSystemPrompt, av as runTask, aw as runWorkflow, ax as zodSchemaToPromptDescription, ay as zodSchemaToYamlExample } from './task-runner-3MPh_dn7.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { OperationIR, ComponentIR } from '@aaac/contracts';
|
|
5
5
|
import { ResolvedConfig } from './generator/index.js';
|
|
@@ -177,7 +177,7 @@ declare class WorkflowBuilder {
|
|
|
177
177
|
* Plugin Loader — auto-discovers and registers user plugin files
|
|
178
178
|
*
|
|
179
179
|
* Discovery strategies (in priority order):
|
|
180
|
-
* 1. Config-based: `plugins` array in
|
|
180
|
+
* 1. Config-based: `plugins` array in agents.conf.yaml
|
|
181
181
|
* 2. Convention-based: scan `src/plugins/` for files exporting AgentPlugin
|
|
182
182
|
*
|
|
183
183
|
* Each discovered module is dynamically import()'d. Exports that satisfy the
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
buildGuardrailContext,
|
|
16
16
|
loadProjectConfig
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-E2UR4TNM.js";
|
|
18
18
|
import {
|
|
19
19
|
jsonSchemaToZod
|
|
20
20
|
} from "./chunk-ET6TGQRT.js";
|
|
@@ -524,6 +524,12 @@ ${context.relevant_paths.map((p) => `- ${p}`).join("\n")}`
|
|
|
524
524
|
${context.acceptance_criteria.map((c) => `- ${c}`).join("\n")}`
|
|
525
525
|
);
|
|
526
526
|
}
|
|
527
|
+
if (context.variables && Object.keys(context.variables).length > 0) {
|
|
528
|
+
const varLines = Object.entries(context.variables).map(([k, v]) => `- ${k}: ${typeof v === "string" ? v : JSON.stringify(v)}`).join("\n");
|
|
529
|
+
userSections.push(`## Context Variables
|
|
530
|
+
|
|
531
|
+
${varLines}`);
|
|
532
|
+
}
|
|
527
533
|
return {
|
|
528
534
|
system,
|
|
529
535
|
user: userSections.join("\n\n---\n\n")
|
|
@@ -948,7 +954,8 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
948
954
|
const workflowStart = Date.now();
|
|
949
955
|
const stepId = (i) => {
|
|
950
956
|
const s = workflow.steps[i];
|
|
951
|
-
|
|
957
|
+
if (s.type === "delegate" || s.type === "evaluate") return s.task;
|
|
958
|
+
return `gate:${s.gate_kind}`;
|
|
952
959
|
};
|
|
953
960
|
const depsByIndex = workflow.steps.map((step, i) => {
|
|
954
961
|
if (step.depends_on !== void 0) {
|
|
@@ -967,6 +974,8 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
967
974
|
const stepContexts = new Array(workflow.steps.length).fill("");
|
|
968
975
|
const stepOutputs = new Array(workflow.steps.length).fill(void 0);
|
|
969
976
|
let abortResult;
|
|
977
|
+
const evaluateExecCount = /* @__PURE__ */ new Map();
|
|
978
|
+
const loopInjectedVars = {};
|
|
970
979
|
function extractPath(obj, path) {
|
|
971
980
|
const cleanPath = path.startsWith("$.") ? path.slice(2) : path;
|
|
972
981
|
const segments = cleanPath.split(".");
|
|
@@ -1005,10 +1014,43 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
1005
1014
|
if (step.type === "gate") {
|
|
1006
1015
|
return handleGateStep(step, Object.values(stepResults).filter(Boolean), options, i, stepAdapter);
|
|
1007
1016
|
}
|
|
1017
|
+
if (step.type === "evaluate") {
|
|
1018
|
+
const evaluateStep = step;
|
|
1019
|
+
const effectiveVariables = mergeVariables(options.variables, loopInjectedVars);
|
|
1020
|
+
const context2 = {
|
|
1021
|
+
user_request: evaluateStep.description ?? options.user_request,
|
|
1022
|
+
prior_context: contextFor(i),
|
|
1023
|
+
...effectiveVariables ? { variables: effectiveVariables } : {}
|
|
1024
|
+
};
|
|
1025
|
+
const taskResult2 = await runTask(stepAdapter, evaluateStep.task, context2, {
|
|
1026
|
+
maxFollowUps: options.maxFollowUps ?? 2,
|
|
1027
|
+
maxRetries: 0,
|
|
1028
|
+
// evaluate steps do not retry
|
|
1029
|
+
taskRegistry: registries?.taskRegistry,
|
|
1030
|
+
agentRegistry: registries?.agentRegistry,
|
|
1031
|
+
handoffSchemas: registries?.handoffSchemas,
|
|
1032
|
+
progressOutput: options.progressOutput,
|
|
1033
|
+
observer: options.observer,
|
|
1034
|
+
parentSpanId: sessionSpanId
|
|
1035
|
+
});
|
|
1036
|
+
return {
|
|
1037
|
+
step_index: i,
|
|
1038
|
+
task_id: evaluateStep.task,
|
|
1039
|
+
outcome: taskResult2.outcome,
|
|
1040
|
+
follow_ups_used: taskResult2.follow_ups_used,
|
|
1041
|
+
retries_used: taskResult2.retries_used,
|
|
1042
|
+
elapsed_ms: Date.now() - stepStart
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1008
1045
|
const delegateStep = step;
|
|
1009
1046
|
if (step.optional) {
|
|
1010
1047
|
const stepUserRequest2 = delegateStep.instruction ?? options.user_request;
|
|
1011
|
-
const
|
|
1048
|
+
const ctxVars = mergeVariables(options.variables, loopInjectedVars);
|
|
1049
|
+
const ctx = {
|
|
1050
|
+
user_request: stepUserRequest2,
|
|
1051
|
+
prior_context: contextFor(i),
|
|
1052
|
+
...ctxVars ? { variables: ctxVars } : {}
|
|
1053
|
+
};
|
|
1012
1054
|
const shouldRun = options.onOptionalStep ? await options.onOptionalStep(step, ctx) : false;
|
|
1013
1055
|
if (!shouldRun) {
|
|
1014
1056
|
return {
|
|
@@ -1033,10 +1075,11 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
1033
1075
|
handoffInput = invocationHandoff;
|
|
1034
1076
|
}
|
|
1035
1077
|
const useLegacyContext = !delegateStep.receives;
|
|
1078
|
+
const delegateVars = mergeVariables(options.variables, loopInjectedVars);
|
|
1036
1079
|
const context = {
|
|
1037
1080
|
user_request: stepUserRequest,
|
|
1038
1081
|
...useLegacyContext ? { prior_context: contextFor(i) } : {},
|
|
1039
|
-
variables:
|
|
1082
|
+
...delegateVars ? { variables: delegateVars } : {},
|
|
1040
1083
|
...handoffInput ? { handoff_input: handoffInput } : {}
|
|
1041
1084
|
};
|
|
1042
1085
|
const taskResult = await runTask(stepAdapter, step.task, context, {
|
|
@@ -1082,7 +1125,7 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
1082
1125
|
}
|
|
1083
1126
|
const batchResults = await Promise.all(ready.map(async (i) => {
|
|
1084
1127
|
const step = workflow.steps[i];
|
|
1085
|
-
const modelClass = step.type === "delegate" ? registries?.taskRegistry?.[step.task]?.model_class : void 0;
|
|
1128
|
+
const modelClass = step.type === "delegate" || step.type === "evaluate" ? registries?.taskRegistry?.[step.task]?.model_class : void 0;
|
|
1086
1129
|
let stepAdapter;
|
|
1087
1130
|
if (ready.length > 1 && adapterFactory) {
|
|
1088
1131
|
const result = adapterFactory(modelClass);
|
|
@@ -1099,6 +1142,77 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
1099
1142
|
const i = ready[b];
|
|
1100
1143
|
const result = batchResults[b];
|
|
1101
1144
|
const step = workflow.steps[i];
|
|
1145
|
+
if (step.type === "evaluate") {
|
|
1146
|
+
const evaluateStep = step;
|
|
1147
|
+
const data = result.outcome.status === "success" ? result.outcome.data : void 0;
|
|
1148
|
+
const verdict = typeof data?.verdict === "string" ? data.verdict : "fail";
|
|
1149
|
+
const execCount = (evaluateExecCount.get(i) ?? 0) + 1;
|
|
1150
|
+
if (verdict === "pass") {
|
|
1151
|
+
stepResults[i] = result;
|
|
1152
|
+
completed.add(i);
|
|
1153
|
+
emitStepEvent(options, workflow.id, i, step, result);
|
|
1154
|
+
if (data !== void 0) {
|
|
1155
|
+
stepOutputs[i] = data;
|
|
1156
|
+
stepContexts[i] = `
|
|
1157
|
+
|
|
1158
|
+
--- Step ${i + 1}: ${stepId(i)} ---
|
|
1159
|
+
${JSON.stringify(data, null, 2)}`;
|
|
1160
|
+
}
|
|
1161
|
+
} else if (execCount < evaluateStep.max_iterations) {
|
|
1162
|
+
evaluateExecCount.set(i, execCount);
|
|
1163
|
+
if (evaluateStep.inject_as) {
|
|
1164
|
+
const feedback = typeof data?.feedback === "string" ? data.feedback : data !== void 0 ? JSON.stringify(data) : "Evaluate step returned no feedback";
|
|
1165
|
+
loopInjectedVars[evaluateStep.inject_as] = feedback;
|
|
1166
|
+
}
|
|
1167
|
+
const loopToIdx = workflow.steps.findIndex((s, j) => j < i && stepId(j) === evaluateStep.loop_to);
|
|
1168
|
+
if (loopToIdx === -1) {
|
|
1169
|
+
stepResults[i] = result;
|
|
1170
|
+
completed.add(i);
|
|
1171
|
+
abortResult = {
|
|
1172
|
+
workflow_id: workflow.id,
|
|
1173
|
+
status: "error",
|
|
1174
|
+
steps: stepResults.filter(Boolean),
|
|
1175
|
+
total_elapsed_ms: Date.now() - workflowStart,
|
|
1176
|
+
error_message: `Evaluate step "${evaluateStep.task}" references unknown loop_to "${evaluateStep.loop_to}"`
|
|
1177
|
+
};
|
|
1178
|
+
} else {
|
|
1179
|
+
for (let k = loopToIdx; k <= i; k++) {
|
|
1180
|
+
completed.delete(k);
|
|
1181
|
+
stepOutputs[k] = void 0;
|
|
1182
|
+
stepContexts[k] = "";
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
} else {
|
|
1186
|
+
evaluateExecCount.set(i, execCount);
|
|
1187
|
+
stepResults[i] = result;
|
|
1188
|
+
completed.add(i);
|
|
1189
|
+
switch (evaluateStep.on_exhausted ?? "escalate") {
|
|
1190
|
+
case "abort":
|
|
1191
|
+
abortResult = {
|
|
1192
|
+
workflow_id: workflow.id,
|
|
1193
|
+
status: "error",
|
|
1194
|
+
steps: stepResults.filter(Boolean),
|
|
1195
|
+
total_elapsed_ms: Date.now() - workflowStart,
|
|
1196
|
+
error_message: `Evaluate step "${evaluateStep.task}" exhausted ${evaluateStep.max_iterations} iterations without passing`
|
|
1197
|
+
};
|
|
1198
|
+
break;
|
|
1199
|
+
case "fail_partial":
|
|
1200
|
+
emitStepEvent(options, workflow.id, i, step, result);
|
|
1201
|
+
break;
|
|
1202
|
+
case "escalate":
|
|
1203
|
+
default:
|
|
1204
|
+
abortResult = {
|
|
1205
|
+
workflow_id: workflow.id,
|
|
1206
|
+
status: "escalated",
|
|
1207
|
+
steps: stepResults.filter(Boolean),
|
|
1208
|
+
total_elapsed_ms: Date.now() - workflowStart,
|
|
1209
|
+
escalation_reason: `Evaluate step "${evaluateStep.task}" exhausted ${evaluateStep.max_iterations} iterations without passing`
|
|
1210
|
+
};
|
|
1211
|
+
break;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
continue;
|
|
1215
|
+
}
|
|
1102
1216
|
stepResults[i] = result;
|
|
1103
1217
|
completed.add(i);
|
|
1104
1218
|
emitStepEvent(options, workflow.id, i, step, result);
|
|
@@ -1157,6 +1271,10 @@ async function runWorkflow(adapterOrFactory, workflowIdOrInvocation, optionsOrRe
|
|
|
1157
1271
|
}
|
|
1158
1272
|
return wfResult;
|
|
1159
1273
|
}
|
|
1274
|
+
function mergeVariables(base, injected) {
|
|
1275
|
+
const merged = { ...base, ...injected };
|
|
1276
|
+
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
1277
|
+
}
|
|
1160
1278
|
async function handleGateStep(step, priorResults, options, stepIndex, adapter) {
|
|
1161
1279
|
const start = Date.now();
|
|
1162
1280
|
if (options.onGate) {
|