@aaac/runtime 0.1.19 → 0.1.21

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.js CHANGED
@@ -1,7 +1,3 @@
1
- import {
2
- buildGuardrailContext,
3
- loadProjectConfig
4
- } from "./chunk-RL4TCIDU.js";
5
1
  import {
6
2
  PluginRegistry,
7
3
  createGuardrailHooks,
@@ -12,9 +8,29 @@ import {
12
8
  hasBlockingViolation,
13
9
  pluginRegistry
14
10
  } from "./chunk-GZCEEIXQ.js";
11
+ import {
12
+ createExecutionEnvelope,
13
+ emitIterationClose,
14
+ emitIterationMetric,
15
+ emitIterationOpen,
16
+ emitLlmTurnClose,
17
+ emitLlmTurnOpen,
18
+ emitSessionClose,
19
+ emitSessionOpen,
20
+ emitSubagentClose,
21
+ emitSubagentOpen,
22
+ emitToolExecClose,
23
+ emitToolExecOpen,
24
+ emitToolchainClose,
25
+ emitToolchainOpen
26
+ } from "./chunk-FNB3PE74.js";
15
27
  import {
16
28
  buildSdkFunctionTools
17
29
  } from "./chunk-LONLL3K2.js";
30
+ import {
31
+ buildGuardrailContext,
32
+ loadProjectConfig
33
+ } from "./chunk-RL4TCIDU.js";
18
34
  import {
19
35
  jsonSchemaToZod
20
36
  } from "./chunk-ET6TGQRT.js";
@@ -91,219 +107,288 @@ function buildCandidateAgents(agentRegistry, opts) {
91
107
  return candidates;
92
108
  }
93
109
 
94
- // src/lib/observability-bridge.ts
95
- import { generateId } from "@aaac/observability";
96
- function createExecutionEnvelope(params = {}) {
97
- const envelope = {
98
- run_id: generateId(),
99
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
100
- };
101
- if (params.parentRunId !== void 0) envelope.parent_run_id = params.parentRunId;
102
- if (params.componentId !== void 0) envelope.component_id = params.componentId;
103
- if (params.fromAgent !== void 0) envelope.from_agent = params.fromAgent;
104
- if (params.toAgent !== void 0) envelope.to_agent = params.toAgent;
105
- if (params.contractVersion !== void 0) envelope.contract_version = params.contractVersion;
106
- if (params.adapter !== void 0) envelope.adapter = params.adapter;
107
- if (params.model !== void 0) envelope.model = params.model;
108
- if (params.taskInstanceId !== void 0) envelope.task_instance_id = params.taskInstanceId;
109
- return envelope;
110
- }
111
- function attrs(base) {
112
- const out = {};
113
- for (const [k, v] of Object.entries(base)) {
114
- if (v !== void 0 && v !== "") out[k] = v;
110
+ // src/lib/analyzer-bridge.ts
111
+ var ANALYZER_PKG = "artifact-contracts-analyzer";
112
+ async function loadAnalyzerModule() {
113
+ const mod = await import(
114
+ /* webpackIgnore: true */
115
+ ANALYZER_PKG
116
+ );
117
+ return mod;
118
+ }
119
+ function createAnalyzerBridge(options) {
120
+ const { projectRoot, navigationIndex, artifactPatterns, manifests } = options;
121
+ let cachedGraph = null;
122
+ let cachedFileContents = null;
123
+ let graphBuildPromise = null;
124
+ async function ensureGraph() {
125
+ if (cachedGraph) return cachedGraph;
126
+ if (graphBuildPromise) {
127
+ await graphBuildPromise;
128
+ return cachedGraph;
129
+ }
130
+ graphBuildPromise = doBuildGraph();
131
+ await graphBuildPromise;
132
+ return cachedGraph;
133
+ }
134
+ async function doBuildGraph() {
135
+ let mod;
136
+ try {
137
+ mod = await loadAnalyzerModule();
138
+ } catch (error) {
139
+ const msg = error instanceof Error ? error.message : String(error);
140
+ throw new Error(
141
+ `artifact-contracts-analyzer is not available. Install it to use analyzer features: ${msg}`
142
+ );
143
+ }
144
+ const patterns = artifactPatterns ?? /* @__PURE__ */ new Map();
145
+ const registry = mod.createDefaultRegistry();
146
+ const astResult = await mod.buildAstGraph({
147
+ projectRoot,
148
+ artifactPatterns: patterns,
149
+ registry
150
+ });
151
+ cachedFileContents = astResult.fileContents;
152
+ cachedGraph = await mod.buildDependencyGraph({
153
+ ast: astResult.graph,
154
+ projectRoot,
155
+ artifactPatterns: patterns,
156
+ manifests: manifests ?? []
157
+ });
115
158
  }
116
- return out;
117
- }
118
- function tokenAttrs(meta) {
119
- const out = {};
120
- const tu = meta.token_usage;
121
- if (tu && typeof tu === "object") {
122
- const t = tu;
123
- if (typeof t.input_tokens === "number") out["token_usage.input"] = t.input_tokens;
124
- if (typeof t.output_tokens === "number") out["token_usage.output"] = t.output_tokens;
125
- if (typeof t.total_tokens === "number") out["token_usage.total"] = t.total_tokens;
126
- if (typeof t.cache_read_input_tokens === "number") out["token_usage.cache_read"] = t.cache_read_input_tokens;
127
- if (typeof t.cache_creation_input_tokens === "number") out["token_usage.cache_creation"] = t.cache_creation_input_tokens;
128
- }
129
- if (typeof meta.cost_usd === "number") out["cost_usd"] = meta.cost_usd;
130
- return out;
131
- }
132
- function emitSessionOpen(observer, envelope, workflowId) {
133
- if (!observer) return void 0;
134
- const spanId = envelope.run_id;
135
- observer({
136
- source: "aaac-runtime",
137
- eventType: "agent.session",
138
- lifecycle: "open",
139
- spanId,
140
- parentSpanId: envelope.parent_run_id,
141
- attributes: attrs({
142
- axis: "agent",
143
- "agent.session_id": envelope.run_id,
144
- "agent.run_id": envelope.run_id,
145
- "workflow.id": workflowId,
146
- "agent.component_id": envelope.component_id,
147
- "agent.model": envelope.model,
148
- adapter: envelope.adapter,
149
- contract_version: envelope.contract_version
150
- })
151
- });
152
- return spanId;
153
- }
154
- function emitSessionClose(observer, spanId, envelope, durationMs, status, errorMessage) {
155
- if (!observer) return;
156
- const metaAttrs = envelope.execution_metadata ? tokenAttrs(envelope.execution_metadata) : {};
157
- observer({
158
- source: "aaac-runtime",
159
- eventType: "agent.session",
160
- lifecycle: "close",
161
- spanId,
162
- attributes: {
163
- ...attrs({
164
- axis: "agent",
165
- "agent.session_id": envelope.run_id,
166
- "agent.session.duration_ms": durationMs,
167
- "agent.status": status,
168
- "agent.error": errorMessage
169
- }),
170
- ...metaAttrs
159
+ const bridge = {
160
+ async buildGraph() {
161
+ await ensureGraph();
162
+ },
163
+ async getGraph() {
164
+ return ensureGraph();
165
+ },
166
+ async analyzeImpact(changed, opts) {
167
+ let mod;
168
+ try {
169
+ mod = await loadAnalyzerModule();
170
+ } catch {
171
+ return {
172
+ error: "artifact-contracts-analyzer is not installed. Install it as a peer dependency to use impact analysis.",
173
+ changed
174
+ };
175
+ }
176
+ const graph = await ensureGraph();
177
+ return mod.analyzeImpact({
178
+ graph,
179
+ changed,
180
+ direction: opts?.direction ?? "downstream",
181
+ ...opts?.maxDepth !== void 0 ? { maxDepth: opts.maxDepth } : {},
182
+ ...opts?.limit !== void 0 ? { limit: opts.limit } : {},
183
+ ...navigationIndex ? { navigationIndex } : {}
184
+ });
185
+ },
186
+ async generateContextPack(changed, opts) {
187
+ let mod;
188
+ try {
189
+ mod = await loadAnalyzerModule();
190
+ } catch {
191
+ return {
192
+ entries: [],
193
+ metadata: {
194
+ totalTokens: 0,
195
+ budgetTokens: opts?.budgetTokens ?? 5e4,
196
+ filesIncluded: 0,
197
+ filesExcluded: 0,
198
+ filesReferenced: 0,
199
+ artifactsCovered: [],
200
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString()
201
+ }
202
+ };
203
+ }
204
+ const graph = await ensureGraph();
205
+ return mod.generateContextPack({
206
+ graph,
207
+ changed,
208
+ projectRoot,
209
+ ...opts?.budgetTokens !== void 0 ? { budgetTokens: opts.budgetTokens } : {},
210
+ ...opts?.granularity ? { granularity: opts.granularity } : {},
211
+ ...navigationIndex ? { navigationIndex } : {},
212
+ ...cachedFileContents ? { fileContents: cachedFileContents } : {}
213
+ });
214
+ },
215
+ async buildCallGraph(entry, opts) {
216
+ let mod;
217
+ try {
218
+ mod = await loadAnalyzerModule();
219
+ } catch {
220
+ return {
221
+ error: "artifact-contracts-analyzer is not installed. Install it as a peer dependency to use call graph analysis.",
222
+ entry
223
+ };
224
+ }
225
+ const graph = await ensureGraph();
226
+ return mod.buildCallGraph({
227
+ graph,
228
+ entry,
229
+ ...opts?.maxDepth !== void 0 ? { maxDepth: opts.maxDepth } : {},
230
+ ...opts?.direction ? { direction: opts.direction } : {}
231
+ });
232
+ },
233
+ invalidateCache() {
234
+ cachedGraph = null;
235
+ cachedFileContents = null;
236
+ graphBuildPromise = null;
237
+ },
238
+ buildAnalyzerTools() {
239
+ return [
240
+ {
241
+ name: "analyzer.analyzeImpact",
242
+ description: "Analyze the impact of changed files across the dependency graph",
243
+ inputSchema: {
244
+ type: "object",
245
+ properties: {
246
+ changed: {
247
+ type: "array",
248
+ items: { type: "string" },
249
+ description: "File paths that changed"
250
+ },
251
+ direction: {
252
+ type: "string",
253
+ enum: ["downstream", "upstream"],
254
+ description: "Traversal direction. downstream = what breaks if this changes"
255
+ },
256
+ maxDepth: {
257
+ type: "number",
258
+ description: "Maximum BFS depth to explore"
259
+ },
260
+ limit: {
261
+ type: "number",
262
+ description: "Cap the number of affected entries returned"
263
+ }
264
+ },
265
+ required: ["changed"]
266
+ },
267
+ handler: async (args) => {
268
+ const changed = args.changed;
269
+ const result = await bridge.analyzeImpact(changed, {
270
+ direction: args.direction,
271
+ maxDepth: args.maxDepth,
272
+ limit: args.limit
273
+ });
274
+ return JSON.stringify(result);
275
+ }
276
+ },
277
+ {
278
+ name: "analyzer.generateContextPack",
279
+ description: "Generate a token-budget-constrained context pack for changed files",
280
+ inputSchema: {
281
+ type: "object",
282
+ properties: {
283
+ changed: {
284
+ type: "array",
285
+ items: { type: "string" },
286
+ description: "File paths that changed"
287
+ },
288
+ budgetTokens: {
289
+ type: "number",
290
+ description: "Token budget for the context pack"
291
+ },
292
+ granularity: {
293
+ type: "string",
294
+ enum: ["file", "symbol"],
295
+ description: "Context granularity level"
296
+ }
297
+ },
298
+ required: ["changed"]
299
+ },
300
+ handler: async (args) => {
301
+ const changed = args.changed;
302
+ const result = await bridge.generateContextPack(changed, {
303
+ budgetTokens: args.budgetTokens,
304
+ granularity: args.granularity
305
+ });
306
+ return JSON.stringify(result);
307
+ }
308
+ },
309
+ {
310
+ name: "analyzer.buildCallGraph",
311
+ description: "Build a call graph rooted at a symbol",
312
+ inputSchema: {
313
+ type: "object",
314
+ properties: {
315
+ entry: {
316
+ type: "string",
317
+ description: "Entry symbolId (filePath#name) to root the call graph at"
318
+ },
319
+ maxDepth: {
320
+ type: "number",
321
+ description: "Maximum traversal depth"
322
+ },
323
+ direction: {
324
+ type: "string",
325
+ enum: ["forward", "reverse"],
326
+ description: "Traversal direction: forward (callees) or reverse (callers)"
327
+ }
328
+ },
329
+ required: ["entry"]
330
+ },
331
+ handler: async (args) => {
332
+ const entry = args.entry;
333
+ const result = await bridge.buildCallGraph(entry, {
334
+ maxDepth: args.maxDepth,
335
+ direction: args.direction
336
+ });
337
+ return JSON.stringify(result);
338
+ }
339
+ }
340
+ ];
171
341
  }
172
- });
173
- }
174
- function emitSubagentOpen(observer, envelope, parentSpanId, taskId, agentRole) {
175
- if (!observer) return void 0;
176
- const spanId = envelope.run_id;
177
- observer({
178
- source: "aaac-runtime",
179
- eventType: "agent.subagent",
180
- lifecycle: "open",
181
- spanId,
182
- parentSpanId,
183
- attributes: attrs({
184
- axis: "agent",
185
- "agent.role": agentRole,
186
- "agent.kind": "task",
187
- "task.id": taskId,
188
- "agent.run_id": envelope.run_id,
189
- "agent.parent_run_id": envelope.parent_run_id,
190
- "agent.model": envelope.model,
191
- adapter: envelope.adapter,
192
- "agent.component_id": envelope.component_id,
193
- "agent.from_agent": envelope.from_agent,
194
- "agent.to_agent": envelope.to_agent
195
- })
196
- });
197
- return spanId;
198
- }
199
- function emitSubagentClose(observer, spanId, envelope, durationMs, status, agentRole, errorMessage) {
200
- if (!observer) return;
201
- const metaAttrs = envelope.execution_metadata ? tokenAttrs(envelope.execution_metadata) : {};
202
- observer({
203
- source: "aaac-runtime",
204
- eventType: "agent.subagent",
205
- lifecycle: "close",
206
- spanId,
207
- attributes: {
208
- ...attrs({
209
- axis: "agent",
210
- "agent.role": agentRole,
211
- "agent.status": status,
212
- "agent.duration_ms": durationMs,
213
- "agent.error": errorMessage
214
- }),
215
- ...metaAttrs
342
+ };
343
+ return bridge;
344
+ }
345
+ function isContextPack(value) {
346
+ if (typeof value !== "object" || value === null) return false;
347
+ const obj = value;
348
+ if (!Array.isArray(obj.entries)) return false;
349
+ if (typeof obj.metadata !== "object" || obj.metadata === null) return false;
350
+ const meta = obj.metadata;
351
+ return typeof meta.totalTokens === "number" && typeof meta.budgetTokens === "number";
352
+ }
353
+ function renderContextPackPrompt(pack) {
354
+ const m = pack.metadata;
355
+ const sections = [];
356
+ sections.push("## Source Code Context");
357
+ sections.push(
358
+ `### Budget
359
+ - Tokens used: ${m.totalTokens} / ${m.budgetTokens}
360
+ - Files included: ${m.filesIncluded}, excluded: ${m.filesExcluded}, referenced: ${m.filesReferenced}`
361
+ );
362
+ if (m.artifactsCovered.length > 0) {
363
+ sections.push(
364
+ `### Affected Artifacts
365
+ ${m.artifactsCovered.map((a) => `- ${a}`).join("\n")}`
366
+ );
367
+ }
368
+ if (pack.entries.length > 0) {
369
+ const fileBlocks = [];
370
+ for (const entry of pack.entries) {
371
+ const ext = entry.path.split(".").pop() ?? "";
372
+ const header = `#### ${entry.path} (relevance: ${entry.relevanceScore}, mode: ${entry.contentMode})`;
373
+ const reason = `> ${entry.reason}`;
374
+ if (entry.content) {
375
+ fileBlocks.push(
376
+ `${header}
377
+ ${reason}
378
+
379
+ \`\`\`${ext}
380
+ ${entry.content}
381
+ \`\`\``
382
+ );
383
+ } else {
384
+ fileBlocks.push(`${header}
385
+ ${reason}`);
386
+ }
216
387
  }
217
- });
218
- }
219
- function emitIterationOpen(observer, parentSpanId, evaluateTaskId, loopTo, iterationNumber, maxIterations) {
220
- if (!observer) return void 0;
221
- const spanId = generateId();
222
- observer({
223
- source: "aaac-runtime",
224
- eventType: "evaluate.iteration",
225
- lifecycle: "open",
226
- spanId,
227
- parentSpanId,
228
- attributes: attrs({
229
- axis: "agent",
230
- "evaluate.task": evaluateTaskId,
231
- "evaluate.loop_to": loopTo,
232
- "evaluate.iteration": iterationNumber,
233
- "evaluate.max_iterations": maxIterations
234
- })
235
- });
236
- return spanId;
237
- }
238
- function emitIterationClose(observer, spanId, evaluateTaskId, iterationNumber, verdict, durationMs, feedbackInjected) {
239
- if (!observer) return;
240
- observer({
241
- source: "aaac-runtime",
242
- eventType: "evaluate.iteration",
243
- lifecycle: "close",
244
- spanId,
245
- attributes: attrs({
246
- axis: "agent",
247
- "evaluate.task": evaluateTaskId,
248
- "evaluate.iteration": iterationNumber,
249
- "evaluate.verdict": verdict,
250
- "evaluate.duration_ms": durationMs,
251
- "evaluate.feedback_injected": feedbackInjected
252
- })
253
- });
254
- }
255
- function emitIterationMetric(observer, parentSpanId, evaluateTaskId, totalIterations, terminalOutcome) {
256
- if (!observer) return;
257
- const spanId = generateId();
258
- observer({
259
- source: "aaac-runtime",
260
- eventType: "evaluate.metric",
261
- lifecycle: "instant",
262
- spanId,
263
- parentSpanId,
264
- attributes: attrs({
265
- axis: "agent",
266
- "evaluate.task": evaluateTaskId,
267
- "evaluate.total_iterations": totalIterations,
268
- "evaluate.terminal_outcome": terminalOutcome
269
- })
270
- });
271
- }
272
- function emitToolchainOpen(observer, parentSpanId, toolchainId, operation, artifactIds, componentId) {
273
- if (!observer) return void 0;
274
- const spanId = generateId();
275
- observer({
276
- source: "aaac-runtime",
277
- eventType: "toolchain.execution",
278
- lifecycle: "open",
279
- spanId,
280
- parentSpanId,
281
- attributes: attrs({
282
- axis: "toolchain",
283
- "toolchain.id": toolchainId,
284
- "toolchain.operation": operation,
285
- "toolchain.artifact_ids": artifactIds.join(","),
286
- "agent.component_id": componentId
287
- })
288
- });
289
- return spanId;
290
- }
291
- function emitToolchainClose(observer, spanId, toolchainId, operation, durationMs, status, errorMessage) {
292
- if (!observer) return;
293
- observer({
294
- source: "aaac-runtime",
295
- eventType: "toolchain.execution",
296
- lifecycle: "close",
297
- spanId,
298
- attributes: attrs({
299
- axis: "toolchain",
300
- "toolchain.id": toolchainId,
301
- "toolchain.operation": operation,
302
- "toolchain.status": status,
303
- "toolchain.duration_ms": durationMs,
304
- ...errorMessage ? { "toolchain.error": errorMessage } : {}
305
- })
306
- });
388
+ sections.push(`### Files
389
+ ${fileBlocks.join("\n\n")}`);
390
+ }
391
+ return sections.join("\n\n");
307
392
  }
308
393
 
309
394
  // src/lib/task-runner.ts
@@ -580,10 +665,19 @@ ${context.acceptance_criteria.map((c) => `- ${c}`).join("\n")}`
580
665
  );
581
666
  }
582
667
  if (context.variables && Object.keys(context.variables).length > 0) {
583
- const varLines = Object.entries(context.variables).map(([k, v]) => `- ${k}: ${typeof v === "string" ? v : JSON.stringify(v)}`).join("\n");
584
- userSections.push(`## Context Variables
668
+ const contextPack = context.variables.analyzerContextPack;
669
+ if (isContextPack(contextPack)) {
670
+ userSections.push(renderContextPackPrompt(contextPack));
671
+ }
672
+ const otherVars = Object.entries(context.variables).filter(
673
+ ([k]) => k !== "analyzerContextPack"
674
+ );
675
+ if (otherVars.length > 0) {
676
+ const varLines = otherVars.map(([k, v]) => `- ${k}: ${typeof v === "string" ? v : JSON.stringify(v)}`).join("\n");
677
+ userSections.push(`## Context Variables
585
678
 
586
679
  ${varLines}`);
680
+ }
587
681
  }
588
682
  return {
589
683
  system,
@@ -850,10 +944,10 @@ async function runTask(adapter, taskId, context, options) {
850
944
  memoryRef,
851
945
  splitPrompt,
852
946
  agents,
853
- options: { readonly: isReadonly, onProgress, splitPrompt, agents, allowDynamicWorkflow, libraryTools: options?.libraryTools, maxFollowUps, attempt: 0 }
947
+ options: { readonly: isReadonly, onProgress, splitPrompt, agents, allowDynamicWorkflow, libraryTools: options?.libraryTools, observer: options?.observer, parentSpanId: subagentSpanId, maxFollowUps, attempt: 0 }
854
948
  });
855
949
  } else {
856
- fullOutput = await adapter.send(prompt, { readonly: isReadonly, onProgress, splitPrompt, agents, allowDynamicWorkflow, libraryTools: options?.libraryTools });
950
+ fullOutput = await adapter.send(prompt, { readonly: isReadonly, onProgress, splitPrompt, agents, allowDynamicWorkflow, libraryTools: options?.libraryTools, observer: options?.observer, parentSpanId: subagentSpanId });
857
951
  }
858
952
  } catch (err) {
859
953
  closeStatus = "error";
@@ -1646,8 +1740,8 @@ function emitStepEvent(options, workflowId, stepIndex, step, result) {
1646
1740
  }
1647
1741
 
1648
1742
  // src/lib/process-axis-bridge.ts
1649
- import { generateId as generateId2 } from "@aaac/observability";
1650
- function attrs2(base) {
1743
+ import { generateId } from "@aaac/observability";
1744
+ function attrs(base) {
1651
1745
  const out = {};
1652
1746
  for (const [k, v] of Object.entries(base)) {
1653
1747
  if (v !== void 0 && v !== "") out[k] = v;
@@ -1656,14 +1750,14 @@ function attrs2(base) {
1656
1750
  }
1657
1751
  function emitProcessWorkflowOpen(options) {
1658
1752
  if (!options.observer) return void 0;
1659
- const spanId = generateId2();
1753
+ const spanId = generateId();
1660
1754
  options.observer({
1661
1755
  source: "aaac-runtime",
1662
1756
  eventType: "process.workflow",
1663
1757
  lifecycle: "open",
1664
1758
  spanId,
1665
1759
  parentSpanId: options.parentSpanId,
1666
- attributes: attrs2({
1760
+ attributes: attrs({
1667
1761
  axis: "process",
1668
1762
  "agent.session_id": options.sessionId,
1669
1763
  "workflow.id": options.workflowId
@@ -1678,7 +1772,7 @@ function emitProcessWorkflowClose(spanId, options) {
1678
1772
  eventType: "process.workflow",
1679
1773
  lifecycle: "close",
1680
1774
  spanId,
1681
- attributes: attrs2({
1775
+ attributes: attrs({
1682
1776
  axis: "process",
1683
1777
  "workflow.status": options.status,
1684
1778
  ...options.durationMs !== void 0 ? { "workflow.duration_ms": options.durationMs } : {}
@@ -1687,14 +1781,14 @@ function emitProcessWorkflowClose(spanId, options) {
1687
1781
  }
1688
1782
  function emitProcessTaskOpen(options) {
1689
1783
  if (!options.observer) return void 0;
1690
- const spanId = generateId2();
1784
+ const spanId = generateId();
1691
1785
  options.observer({
1692
1786
  source: "aaac-runtime",
1693
1787
  eventType: "process.task",
1694
1788
  lifecycle: "open",
1695
1789
  spanId,
1696
1790
  parentSpanId: options.parentSpanId,
1697
- attributes: attrs2({
1791
+ attributes: attrs({
1698
1792
  axis: "process",
1699
1793
  "agent.session_id": options.sessionId,
1700
1794
  "task.id": options.taskId,
@@ -1711,7 +1805,7 @@ function emitProcessTaskClose(spanId, options) {
1711
1805
  eventType: "process.task",
1712
1806
  lifecycle: "close",
1713
1807
  spanId,
1714
- attributes: attrs2({
1808
+ attributes: attrs({
1715
1809
  axis: "process",
1716
1810
  "task.status": options.status,
1717
1811
  ...options.durationMs !== void 0 ? { "task.duration_ms": options.durationMs } : {}
@@ -1720,14 +1814,14 @@ function emitProcessTaskClose(spanId, options) {
1720
1814
  }
1721
1815
  function emitProcessEdit(options) {
1722
1816
  if (!options.observer) return void 0;
1723
- const spanId = generateId2();
1817
+ const spanId = generateId();
1724
1818
  options.observer({
1725
1819
  source: "aaac-runtime",
1726
1820
  eventType: "process.edit",
1727
1821
  lifecycle: "instant",
1728
1822
  spanId,
1729
1823
  parentSpanId: options.parentSpanId,
1730
- attributes: attrs2({
1824
+ attributes: attrs({
1731
1825
  axis: "process",
1732
1826
  "agent.session_id": options.sessionId,
1733
1827
  "edit.path": options.filePath,
@@ -3519,6 +3613,7 @@ export {
3519
3613
  buildSplitTaskPrompt,
3520
3614
  buildTaskPrompt,
3521
3615
  createAdapter,
3616
+ createAnalyzerBridge,
3522
3617
  createComponentScope,
3523
3618
  createExecutionEnvelope,
3524
3619
  createGuardrailHooks,
@@ -3534,6 +3629,8 @@ export {
3534
3629
  emitIterationClose,
3535
3630
  emitIterationMetric,
3536
3631
  emitIterationOpen,
3632
+ emitLlmTurnClose,
3633
+ emitLlmTurnOpen,
3537
3634
  emitProcessEdit,
3538
3635
  emitProcessTaskClose,
3539
3636
  emitProcessTaskOpen,
@@ -3543,6 +3640,8 @@ export {
3543
3640
  emitSessionOpen,
3544
3641
  emitSubagentClose,
3545
3642
  emitSubagentOpen,
3643
+ emitToolExecClose,
3644
+ emitToolExecOpen,
3546
3645
  emitToolchainClose,
3547
3646
  emitToolchainOpen,
3548
3647
  evaluateGuardrail,
@@ -3558,6 +3657,7 @@ export {
3558
3657
  guardStatus,
3559
3658
  guardrailContextToRuleData,
3560
3659
  hasBlockingViolation,
3660
+ isContextPack,
3561
3661
  jsonSchemaToZod,
3562
3662
  listGuardrails,
3563
3663
  loadDslContext,
@@ -3569,6 +3669,7 @@ export {
3569
3669
  parseRouterResponse,
3570
3670
  pluginRegistry,
3571
3671
  renderAgentSystemPrompt,
3672
+ renderContextPackPrompt,
3572
3673
  resolveArtifacts,
3573
3674
  runTask,
3574
3675
  runToolchainChecks,