@aaac/runtime 0.1.30 → 0.1.32

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/index.d.ts CHANGED
@@ -1,11 +1,92 @@
1
- import { O as ObserverEmitFn, b as TaskContext, c as TaskOutcome, d as AgentContractLike, e as TaskContractLike, P as PromptBuilderOptions, W as WorkflowResult, S as SdkAdapter, f as WorkflowRegistries, H as HandoffInput, g as StepCompleteEvent, h as StepResult, D as DelegateStep, i as GuardrailRuleData, j as MemoryStore, M as MemoryRef, k as SdkFunctionTool, G as GuardrailHooks, R as ResolvedComponent, l as ArtifactBindingConfig, m as RunToolchainChecksOptions, n as ModelMappingConfig, o as TaskRunResult, L as LibraryToolRegistry, p as ResolvedToolchain, q as LibraryToolDefinition, r as HookResponse, s as GuardrailCheckResult } from './task-runner-CeM6vETd.js';
2
- export { t as AdapterOrFactory, A as AdapterSendOptions, a as AgentExecutionRequest, u as AgentProgressEvent, B as BoundResolveOptions, v as BoundResolver, C as CacheConfig, w as CandidateAgent, x as ConvergenceEnvelope, y as ConvergenceEnvelopePayload, E as EnvelopeParams, z as EvaluateStep, F as GateStep, I as GuardrailCheckFunctions, J as GuardrailRule, K as HookContext, N as InMemoryStore, Q as InnerSpanOptions, U as ModelAwareSdkAdapterFactory, V as ModelClass, X as ModelResolver, Y as ModelResolverOptions, Z as OBSERVABILITY_ENV_VARS, _ as ObservabilityIds, $ as ReceiveSpec, a0 as ResolvedModel, a1 as RetryDecision, a2 as SdkAdapterFactory, a3 as SplitPrompt, a4 as TaskRunOptions, T as TokenUsage, a5 as ToolchainCheckResult, a6 as ToolchainManifest, a7 as ToolchainManifestSchema, a8 as WorkflowContractLike, a9 as WorkflowInvocation, aa as WorkflowRunOptions, ab as WorkflowStep, ac as buildCandidateAgents, ad as buildGateEvaluationPrompt, ae as buildObservabilityEnv, af as buildPerAgentGuardrails, ag as buildRetryFollowUp, ah as buildSdkFunctionTools, ai as buildSplitTaskPrompt, aj as buildTaskPrompt, ak as collectAnalyzerToolIds, al as createExecutionEnvelope, am as createGuardrailHooks, an as createGuardrailHooksForAgent, ao as createGuardrailHooksFromRules, ap as createLibraryToolRegistry, aq as createModelResolver, ar as createRegistryFromSdkTools, as as deriveToolchainsForAgents, at as emitIterationClose, au as emitIterationMetric, av as emitIterationOpen, aw as emitLlmTurnClose, ax as emitLlmTurnOpen, ay as emitSessionClose, az as emitSessionOpen, aA as emitSubagentClose, aB as emitSubagentOpen, aC as emitToolExecClose, aD as emitToolExecOpen, aE as emitToolchainClose, aF as emitToolchainOpen, aG as extractStructuredResult, aH as getBlockingViolations, aI as getEffectiveGuardrailIds, aJ as getGuardrailRulesForAgent, aK as getWarnings, aL as guardrailContextToRuleData, aM as hasBlockingViolation, aN as isNavigationIndex, aO as parseGateEvaluationResponse, aP as renderAgentSystemPrompt, aQ as renderAnalyzerExplorationMandatePrompt, aR as renderNavigationIndexPrompt, aS as runTask, aT as runToolchainChecks, aU as runWorkflow, aV as shouldInjectAnalyzerExplorationMandate, aW as zodSchemaToPromptDescription, aX as zodSchemaToYamlExample } from './task-runner-CeM6vETd.js';
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 GuardrailRuleData, k as MemoryStore, M as MemoryRef, G as GuardrailHooks, R as ResolvedComponent, l as ArtifactBindingConfig, m as RunToolchainChecksOptions, n as ModelMappingConfig, o as TaskRunResult, L as LibraryToolRegistry, p as ResolvedToolchain, q as LibraryToolDefinition, r as HookResponse, s as GuardrailCheckResult } from './task-runner-CczDOkdu.js';
2
+ export { t as AdapterOrFactory, A as AdapterSendOptions, a as AgentExecutionRequest, u as AgentProgressEvent, B as BoundResolveOptions, v as BoundResolver, C as CacheConfig, w as CandidateAgent, x as ConvergenceEnvelope, y as ConvergenceEnvelopePayload, E as EnvelopeParams, z as EvaluateStep, F as GateStep, I as GuardrailCheckFunctions, J as GuardrailRule, K as HookContext, N as InMemoryStore, Q as InnerSpanOptions, U as ModelAwareSdkAdapterFactory, V as ModelClass, X as ModelResolver, Y as ModelResolverOptions, Z as OBSERVABILITY_ENV_VARS, _ as ObservabilityIds, $ as ReceiveSpec, a0 as ResolvedModel, a1 as RetryDecision, a2 as SdkAdapterFactory, a3 as SplitPrompt, a4 as TaskRunOptions, T as TokenUsage, a5 as ToolchainCheckResult, a6 as ToolchainManifest, a7 as ToolchainManifestSchema, a8 as WorkflowContractLike, a9 as WorkflowInvocation, aa as WorkflowRunOptions, ab as WorkflowStep, ac as buildCandidateAgents, ad as buildGateEvaluationPrompt, ae as buildObservabilityEnv, af as buildPerAgentGuardrails, ag as buildRetryFollowUp, ah as buildSdkFunctionTools, ai as buildSplitTaskPrompt, aj as buildTaskPrompt, ak as collectAnalyzerToolIds, al as createExecutionEnvelope, am as createGuardrailHooks, an as createGuardrailHooksForAgent, ao as createGuardrailHooksFromRules, ap as createLibraryToolRegistry, aq as createModelResolver, ar as createRegistryFromSdkTools, as as deriveToolchainsForAgents, at as emitIterationClose, au as emitIterationMetric, av as emitIterationOpen, aw as emitLlmTurnClose, ax as emitLlmTurnOpen, ay as emitSessionClose, az as emitSessionOpen, aA as emitSubagentClose, aB as emitSubagentOpen, aC as emitToolExecClose, aD as emitToolExecOpen, aE as emitToolchainClose, aF as emitToolchainOpen, aG as extractStructuredResult, aH as getBlockingViolations, aI as getEffectiveGuardrailIds, aJ as getGuardrailRulesForAgent, aK as getWarnings, aL as guardrailContextToRuleData, aM as hasBlockingViolation, aN as isNavigationIndex, aO as parseGateEvaluationResponse, aP as renderAgentSystemPrompt, aQ as renderAnalyzerExplorationMandatePrompt, aR as renderNavigationIndexPrompt, aS as runTask, aT as runToolchainChecks, aU as runWorkflow, aV as shouldInjectAnalyzerExplorationMandate, aW as zodSchemaToPromptDescription, aX as zodSchemaToYamlExample } from './task-runner-CczDOkdu.js';
3
3
  import { z } from 'zod';
4
4
  import { OperationIR, ComponentIR } from '@aaac/contracts';
5
- import { ResolvedConfig } from './generator/index.js';
5
+ import { OtelEmitter } from '@aaac/observability';
6
6
  export { ExecutionEnvelope } from '@aaac/observability';
7
+ import { ResolvedConfig } from './generator/index.js';
7
8
  import './context-DKkamYX_.js';
8
9
 
10
+ /**
11
+ * Analyzer Bridge — integrates artifact-contracts-analyzer as a standard
12
+ * runtime tool provider.
13
+ *
14
+ * Wraps analyzeImpact, generateContextPack, and buildCallGraph behind a
15
+ * lazily-initialised DependencyGraph, and exposes them as SdkFunctionTool[]
16
+ * for adapter consumption.
17
+ *
18
+ * `artifact-contracts-analyzer` is a peerDependency (optional) loaded via
19
+ * dynamic import; when absent, every method returns a descriptive error
20
+ * rather than crashing.
21
+ */
22
+
23
+ /** Subset of DependencyGraph that the bridge caches and exposes. */
24
+ type DependencyGraph = Record<string, unknown>;
25
+ /** Subset of ImpactReport returned by analyzeImpact. */
26
+ type ImpactReport = Record<string, unknown>;
27
+ /** Subset of ContextPack returned by generateContextPack. */
28
+ type ContextPack = {
29
+ entries: Array<{
30
+ path: string;
31
+ artifactId?: string;
32
+ relevanceScore: number;
33
+ contentMode: string;
34
+ content: string;
35
+ reason: string;
36
+ }>;
37
+ metadata: {
38
+ totalTokens: number;
39
+ budgetTokens: number;
40
+ filesIncluded: number;
41
+ filesExcluded: number;
42
+ filesReferenced: number;
43
+ artifactsCovered: string[];
44
+ generatedAt: string;
45
+ };
46
+ taskId?: string;
47
+ };
48
+ /** Subset of CallGraph returned by buildCallGraph. */
49
+ type CallGraph = Record<string, unknown>;
50
+ interface AnalyzerBridgeOptions {
51
+ projectRoot: string;
52
+ navigationIndex?: Record<string, unknown>;
53
+ artifactPatterns?: Map<string, string[]>;
54
+ manifests?: string[];
55
+ }
56
+ interface AnalyzeImpactInput {
57
+ direction: "downstream" | "upstream";
58
+ maxDepth: number;
59
+ limit: number;
60
+ }
61
+ interface GenerateContextPackInput {
62
+ budgetTokens: number;
63
+ granularity: "file" | "symbol";
64
+ }
65
+ interface BuildCallGraphInput {
66
+ maxDepth: number;
67
+ direction: "forward" | "reverse";
68
+ }
69
+ interface AnalyzerBridge {
70
+ buildGraph(): Promise<void>;
71
+ getGraph(): Promise<DependencyGraph>;
72
+ analyzeImpact(changed: string[], options?: Partial<AnalyzeImpactInput>): Promise<ImpactReport>;
73
+ generateContextPack(changed: string[], options?: Partial<GenerateContextPackInput>): Promise<ContextPack>;
74
+ buildCallGraph(entry: string, options?: Partial<BuildCallGraphInput>): Promise<CallGraph>;
75
+ invalidateCache(): void;
76
+ buildAnalyzerTools(): SdkFunctionTool[];
77
+ }
78
+ declare function createAnalyzerBridge(options: AnalyzerBridgeOptions): AnalyzerBridge;
79
+ /**
80
+ * Duck-type check: does `value` look like a ContextPack?
81
+ * Checks for the `entries` array and `metadata` object with expected fields.
82
+ */
83
+ declare function isContextPack(value: unknown): value is ContextPack;
84
+ /**
85
+ * Render a ContextPack as a structured prompt section.
86
+ * Used by task-runner when `variables.analyzerContextPack` is present.
87
+ */
88
+ declare function renderContextPackPrompt(pack: ContextPack): string;
89
+
9
90
  /**
10
91
  * Process axis emit helpers for runtime integration.
11
92
  * These wrap @aaac/observability's EventCollector for structured process axis events.
@@ -355,86 +436,6 @@ declare class AgentLogWriter {
355
436
  }>;
356
437
  }
357
438
 
358
- /**
359
- * Analyzer Bridge — integrates artifact-contracts-analyzer as a standard
360
- * runtime tool provider.
361
- *
362
- * Wraps analyzeImpact, generateContextPack, and buildCallGraph behind a
363
- * lazily-initialised DependencyGraph, and exposes them as SdkFunctionTool[]
364
- * for adapter consumption.
365
- *
366
- * `artifact-contracts-analyzer` is a peerDependency (optional) loaded via
367
- * dynamic import; when absent, every method returns a descriptive error
368
- * rather than crashing.
369
- */
370
-
371
- /** Subset of DependencyGraph that the bridge caches and exposes. */
372
- type DependencyGraph = Record<string, unknown>;
373
- /** Subset of ImpactReport returned by analyzeImpact. */
374
- type ImpactReport = Record<string, unknown>;
375
- /** Subset of ContextPack returned by generateContextPack. */
376
- type ContextPack = {
377
- entries: Array<{
378
- path: string;
379
- artifactId?: string;
380
- relevanceScore: number;
381
- contentMode: string;
382
- content: string;
383
- reason: string;
384
- }>;
385
- metadata: {
386
- totalTokens: number;
387
- budgetTokens: number;
388
- filesIncluded: number;
389
- filesExcluded: number;
390
- filesReferenced: number;
391
- artifactsCovered: string[];
392
- generatedAt: string;
393
- };
394
- taskId?: string;
395
- };
396
- /** Subset of CallGraph returned by buildCallGraph. */
397
- type CallGraph = Record<string, unknown>;
398
- interface AnalyzerBridgeOptions {
399
- projectRoot: string;
400
- navigationIndex?: Record<string, unknown>;
401
- artifactPatterns?: Map<string, string[]>;
402
- manifests?: string[];
403
- }
404
- interface AnalyzeImpactInput {
405
- direction: "downstream" | "upstream";
406
- maxDepth: number;
407
- limit: number;
408
- }
409
- interface GenerateContextPackInput {
410
- budgetTokens: number;
411
- granularity: "file" | "symbol";
412
- }
413
- interface BuildCallGraphInput {
414
- maxDepth: number;
415
- direction: "forward" | "reverse";
416
- }
417
- interface AnalyzerBridge {
418
- buildGraph(): Promise<void>;
419
- getGraph(): Promise<DependencyGraph>;
420
- analyzeImpact(changed: string[], options?: Partial<AnalyzeImpactInput>): Promise<ImpactReport>;
421
- generateContextPack(changed: string[], options?: Partial<GenerateContextPackInput>): Promise<ContextPack>;
422
- buildCallGraph(entry: string, options?: Partial<BuildCallGraphInput>): Promise<CallGraph>;
423
- invalidateCache(): void;
424
- buildAnalyzerTools(): SdkFunctionTool[];
425
- }
426
- declare function createAnalyzerBridge(options: AnalyzerBridgeOptions): AnalyzerBridge;
427
- /**
428
- * Duck-type check: does `value` look like a ContextPack?
429
- * Checks for the `entries` array and `metadata` object with expected fields.
430
- */
431
- declare function isContextPack(value: unknown): value is ContextPack;
432
- /**
433
- * Render a ContextPack as a structured prompt section.
434
- * Used by task-runner when `variables.analyzerContextPack` is present.
435
- */
436
- declare function renderContextPackPrompt(pack: ContextPack): string;
437
-
438
439
  /**
439
440
  * Adapter Factory — public API for creating SDK adapters by name.
440
441
  *
@@ -660,6 +661,13 @@ interface ProjectRuntime {
660
661
  dslSource: string;
661
662
  /** Resolve the effective adapter + model (for --dry-run reporting). */
662
663
  resolveAdapter(): ResolvedAdapterSelection;
664
+ /**
665
+ * The in-process OtelEmitter created by createPipeline, when observability
666
+ * is configured. Exposed for test verification that the otel config is
667
+ * actually wired through to the emitter (F-002 / issue #125).
668
+ * Undefined when bindings.observability is absent or disabled.
669
+ */
670
+ otelEmitter?: OtelEmitter;
663
671
  }
664
672
  /**
665
673
  * Build the standard component runtime from the bundled embedded DSL + the
package/dist/index.js CHANGED
@@ -26,11 +26,11 @@ import {
26
26
  emitToolExecOpen,
27
27
  emitToolchainClose,
28
28
  emitToolchainOpen
29
- } from "./chunk-BU6FB3JB.js";
29
+ } from "./chunk-E473D23Y.js";
30
30
  import {
31
31
  buildGuardrailContext,
32
32
  loadProjectConfig
33
- } from "./chunk-RL4TCIDU.js";
33
+ } from "./chunk-735UA5HV.js";
34
34
  import {
35
35
  jsonSchemaToZod
36
36
  } from "./chunk-ET6TGQRT.js";
@@ -3378,12 +3378,18 @@ async function createProjectRuntime(options) {
3378
3378
  let observer;
3379
3379
  let observerSink;
3380
3380
  let observerClosed = false;
3381
+ let observerOtelEmitter;
3381
3382
  if (config.observability && config.observability.enabled !== false) {
3382
- const pipeline = createPipeline(
3383
- config.observability.dbPath ? { dbPath: config.observability.dbPath } : {}
3384
- );
3383
+ const pipeline = createPipeline({
3384
+ ...config.observability.dbPath ? { dbPath: config.observability.dbPath } : {},
3385
+ // Wire OTel endpoint from project.yaml bindings.observability.otel.
3386
+ // Falls back to OTEL_EXPORTER_OTLP_ENDPOINT env var inside OtelEmitter when absent.
3387
+ // When neither is set, OtelEmitter is a no-op (fail-open, no regression).
3388
+ otel: config.observability.otel
3389
+ });
3385
3390
  observer = pipeline.collector.emit.bind(pipeline.collector);
3386
3391
  observerSink = pipeline.sink;
3392
+ observerOtelEmitter = pipeline.otelEmitter;
3387
3393
  }
3388
3394
  function closeObserver() {
3389
3395
  if (observerSink && !observerClosed) {
@@ -3459,7 +3465,8 @@ async function createProjectRuntime(options) {
3459
3465
  config,
3460
3466
  configPath,
3461
3467
  dslSource: projectDslPath ?? "/$embedded/",
3462
- resolveAdapter: resolveAdapter2
3468
+ resolveAdapter: resolveAdapter2,
3469
+ otelEmitter: observerOtelEmitter
3463
3470
  };
3464
3471
  }
3465
3472