@aaac/runtime 0.1.8 → 0.1.9

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,10 +1,67 @@
1
- import { 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, O as ObserverEmitFn, l as ResolvedToolchain, m as LibraryToolDefinition } from './task-runner-Dw8oWJD6.js';
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-Dw8oWJD6.js';
2
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, r as GateStep, s as GuardrailCheckFunctions, t as GuardrailCheckResult, u as GuardrailRule, v as HookContext, w as HookResponse, I as InMemoryStore, x as ModelAwareSdkAdapterFactory, y as ModelClass, z as ModelMappingConfig, F as ModelResolver, J as ModelResolverOptions, K as ReceiveSpec, N as ResolvedModel, Q as RetryDecision, U as SdkAdapterFactory, V as SplitPrompt, X as TaskRunOptions, Y as WorkflowContractLike, Z as WorkflowInvocation, _ as WorkflowRunOptions, $ as WorkflowStep, a0 as buildCandidateAgents, a1 as buildGateEvaluationPrompt, a2 as buildPerAgentGuardrails, a3 as buildRetryFollowUp, a4 as buildSplitTaskPrompt, a5 as buildTaskPrompt, a6 as createExecutionEnvelope, a7 as createGuardrailHooks, a8 as createGuardrailHooksForAgent, a9 as createGuardrailHooksFromRules, aa as createLibraryToolRegistry, ab as createModelResolver, ac as deriveToolchainsForAgents, ad as emitSessionClose, ae as emitSessionOpen, af as emitSubagentClose, ag as emitSubagentOpen, ah as emitToolchainClose, ai as emitToolchainOpen, aj as extractStructuredResult, ak as getBlockingViolations, al as getEffectiveGuardrailIds, am as getGuardrailRulesForAgent, an as getWarnings, ao as guardrailContextToRuleData, ap as hasBlockingViolation, aq as parseGateEvaluationResponse, ar as renderAgentSystemPrompt, as as runTask, at as runWorkflow, au as zodSchemaToPromptDescription, av as zodSchemaToYamlExample } from './task-runner-Dw8oWJD6.js';
3
3
  import { z } from 'zod';
4
4
  import { OperationIR, ComponentIR } from '@aaac/contracts';
5
5
  export { ExecutionEnvelope } from '@aaac/observability';
6
6
  import './context-B_bekYiE.js';
7
7
 
8
+ /**
9
+ * Process axis emit helpers for runtime integration.
10
+ * These wrap @aaac/observability's EventCollector for structured process axis events.
11
+ */
12
+
13
+ interface ProcessWorkflowOptions {
14
+ workflowId: string;
15
+ sessionId: string;
16
+ parentSpanId?: string;
17
+ /** Optional observer — no-op when undefined. */
18
+ observer?: ObserverEmitFn;
19
+ }
20
+ interface ProcessTaskOptions {
21
+ taskId: string;
22
+ targetAgent: string;
23
+ sessionId: string;
24
+ parentSpanId?: string;
25
+ /** Optional observer — no-op when undefined. */
26
+ observer?: ObserverEmitFn;
27
+ }
28
+ interface ProcessEditOptions {
29
+ filePath: string;
30
+ artifactId?: string;
31
+ sessionId: string;
32
+ parentSpanId?: string;
33
+ /** Optional observer — no-op when undefined. */
34
+ observer?: ObserverEmitFn;
35
+ }
36
+ /**
37
+ * Emit process.workflow open span.
38
+ */
39
+ declare function emitProcessWorkflowOpen(options: ProcessWorkflowOptions): string | undefined;
40
+ /**
41
+ * Emit process.workflow close span.
42
+ */
43
+ declare function emitProcessWorkflowClose(spanId: string, options: {
44
+ status: string;
45
+ durationMs?: number;
46
+ observer?: ObserverEmitFn;
47
+ }): void;
48
+ /**
49
+ * Emit process.task open span.
50
+ */
51
+ declare function emitProcessTaskOpen(options: ProcessTaskOptions): string | undefined;
52
+ /**
53
+ * Emit process.task close span.
54
+ */
55
+ declare function emitProcessTaskClose(spanId: string, options: {
56
+ status: string;
57
+ durationMs?: number;
58
+ observer?: ObserverEmitFn;
59
+ }): void;
60
+ /**
61
+ * Emit process.edit instant span.
62
+ */
63
+ declare function emitProcessEdit(options: ProcessEditOptions): string | undefined;
64
+
8
65
  /**
9
66
  * Plugin Interface — extension points for user code injection
10
67
  */
@@ -536,4 +593,4 @@ declare function resolveArtifacts(options: ArtifactResolveOptions): Promise<Arti
536
593
  /** Package version string. */
537
594
  declare const version: string;
538
595
 
539
- export { type AaacInvocationContext, type AaacObserver, type AaacPolicy, type AaacRuntime, AgentContractLike, AgentLogWriter, type AgentLogWriterOptions, type AgentPlugin, ArtifactBindingConfig, type ArtifactResolveOptions, type ArtifactResolveResult, type ComponentScope, type CreateAdapterOptions, type CreateComponentScopeOptions, DelegateStep, type DslContext, DslValidationError, type ExecuteOptions, type ExecuteTaskOptions, type ExecuteWorkflowOptions, FileMemoryStore, GuardrailHooks, type GuardrailResult, GuardrailRuleData, HandoffInput, LibraryToolDefinition, LibraryToolRegistry, type LoadDslOptions, MemoryRef, MemoryStore, type MemoryStoreEntry, type NavigationContext, type NavigationContextOptions, ObserverEmitFn, type OperationHandler, type OperationMemoryRefConfig, type PermissionMode, type PluginLoadResult, PluginRegistry, type ProgressSink, type ProgressSinkOptions, type PromptBuilderArgs, PromptBuilderOptions, type RequiredEntities, ResolvedComponent, ResolvedToolchain, type RunLogEvent, type Runtime, type RuntimeBinding, type RuntimeConfig, SdkAdapter, type SdkFunctionTool, StepCompleteEvent, StepResult, TaskContext, TaskContractLike, type TaskHookContext, TaskOutcome, TaskRunResult, WorkflowBuilder, type WorkflowHookContext, WorkflowRegistries, WorkflowResult, buildGuardrailRulesFromDsl, buildNavigationContext, buildRegistriesFromDsl, buildSdkFunctionTools, createAdapter, createComponentScope, createProgressSink, createRuntime, createRuntimeBinding, executeTask, executeWorkflow, jsonSchemaToZod, loadDslContext, loadPlugins, loadPluginsFromDirectory, loadPluginsFromPaths, pluginRegistry, resolveArtifacts, version };
596
+ export { type AaacInvocationContext, type AaacObserver, type AaacPolicy, type AaacRuntime, AgentContractLike, AgentLogWriter, type AgentLogWriterOptions, type AgentPlugin, ArtifactBindingConfig, type ArtifactResolveOptions, type ArtifactResolveResult, type ComponentScope, type CreateAdapterOptions, type CreateComponentScopeOptions, DelegateStep, type DslContext, DslValidationError, type ExecuteOptions, type ExecuteTaskOptions, type ExecuteWorkflowOptions, FileMemoryStore, GuardrailHooks, type GuardrailResult, GuardrailRuleData, HandoffInput, LibraryToolDefinition, LibraryToolRegistry, type LoadDslOptions, MemoryRef, MemoryStore, type MemoryStoreEntry, type NavigationContext, type NavigationContextOptions, ObserverEmitFn, type OperationHandler, type OperationMemoryRefConfig, type PermissionMode, type PluginLoadResult, PluginRegistry, type ProcessEditOptions, type ProcessTaskOptions, type ProcessWorkflowOptions, type ProgressSink, type ProgressSinkOptions, type PromptBuilderArgs, PromptBuilderOptions, type RequiredEntities, ResolvedComponent, ResolvedToolchain, type RunLogEvent, type Runtime, type RuntimeBinding, type RuntimeConfig, SdkAdapter, type SdkFunctionTool, StepCompleteEvent, StepResult, TaskContext, TaskContractLike, type TaskHookContext, TaskOutcome, TaskRunResult, WorkflowBuilder, type WorkflowHookContext, WorkflowRegistries, WorkflowResult, buildGuardrailRulesFromDsl, buildNavigationContext, buildRegistriesFromDsl, buildSdkFunctionTools, createAdapter, createComponentScope, createProgressSink, createRuntime, createRuntimeBinding, emitProcessEdit, emitProcessTaskClose, emitProcessTaskOpen, emitProcessWorkflowClose, emitProcessWorkflowOpen, executeTask, executeWorkflow, jsonSchemaToZod, loadDslContext, loadPlugins, loadPluginsFromDirectory, loadPluginsFromPaths, pluginRegistry, resolveArtifacts, version };
package/dist/index.js CHANGED
@@ -1255,6 +1255,98 @@ function emitStepEvent(options, workflowId, stepIndex, step, result) {
1255
1255
  });
1256
1256
  }
1257
1257
 
1258
+ // src/lib/process-axis-bridge.ts
1259
+ import { generateId as generateId2 } from "@aaac/observability";
1260
+ function attrs2(base) {
1261
+ const out = {};
1262
+ for (const [k, v] of Object.entries(base)) {
1263
+ if (v !== void 0 && v !== "") out[k] = v;
1264
+ }
1265
+ return out;
1266
+ }
1267
+ function emitProcessWorkflowOpen(options) {
1268
+ if (!options.observer) return void 0;
1269
+ const spanId = generateId2();
1270
+ options.observer({
1271
+ source: "aaac-runtime",
1272
+ eventType: "process.workflow",
1273
+ lifecycle: "open",
1274
+ spanId,
1275
+ parentSpanId: options.parentSpanId,
1276
+ attributes: attrs2({
1277
+ axis: "process",
1278
+ "agent.session_id": options.sessionId,
1279
+ "workflow.id": options.workflowId
1280
+ })
1281
+ });
1282
+ return spanId;
1283
+ }
1284
+ function emitProcessWorkflowClose(spanId, options) {
1285
+ if (!options.observer) return;
1286
+ options.observer({
1287
+ source: "aaac-runtime",
1288
+ eventType: "process.workflow",
1289
+ lifecycle: "close",
1290
+ spanId,
1291
+ attributes: attrs2({
1292
+ axis: "process",
1293
+ "workflow.status": options.status,
1294
+ ...options.durationMs !== void 0 ? { "workflow.duration_ms": options.durationMs } : {}
1295
+ })
1296
+ });
1297
+ }
1298
+ function emitProcessTaskOpen(options) {
1299
+ if (!options.observer) return void 0;
1300
+ const spanId = generateId2();
1301
+ options.observer({
1302
+ source: "aaac-runtime",
1303
+ eventType: "process.task",
1304
+ lifecycle: "open",
1305
+ spanId,
1306
+ parentSpanId: options.parentSpanId,
1307
+ attributes: attrs2({
1308
+ axis: "process",
1309
+ "agent.session_id": options.sessionId,
1310
+ "task.id": options.taskId,
1311
+ "task.type": "implement",
1312
+ "task.target_agent": options.targetAgent
1313
+ })
1314
+ });
1315
+ return spanId;
1316
+ }
1317
+ function emitProcessTaskClose(spanId, options) {
1318
+ if (!options.observer) return;
1319
+ options.observer({
1320
+ source: "aaac-runtime",
1321
+ eventType: "process.task",
1322
+ lifecycle: "close",
1323
+ spanId,
1324
+ attributes: attrs2({
1325
+ axis: "process",
1326
+ "task.status": options.status,
1327
+ ...options.durationMs !== void 0 ? { "task.duration_ms": options.durationMs } : {}
1328
+ })
1329
+ });
1330
+ }
1331
+ function emitProcessEdit(options) {
1332
+ if (!options.observer) return void 0;
1333
+ const spanId = generateId2();
1334
+ options.observer({
1335
+ source: "aaac-runtime",
1336
+ eventType: "process.edit",
1337
+ lifecycle: "instant",
1338
+ spanId,
1339
+ parentSpanId: options.parentSpanId,
1340
+ attributes: attrs2({
1341
+ axis: "process",
1342
+ "agent.session_id": options.sessionId,
1343
+ "edit.path": options.filePath,
1344
+ "edit.artifact_id": options.artifactId
1345
+ })
1346
+ });
1347
+ return spanId;
1348
+ }
1349
+
1258
1350
  // src/lib/bound-resolver.ts
1259
1351
  import { readFile as readFile2 } from "fs/promises";
1260
1352
  import YAML2 from "yaml";
@@ -2628,6 +2720,11 @@ export {
2628
2720
  createRuntime,
2629
2721
  createRuntimeBinding,
2630
2722
  deriveToolchainsForAgents,
2723
+ emitProcessEdit,
2724
+ emitProcessTaskClose,
2725
+ emitProcessTaskOpen,
2726
+ emitProcessWorkflowClose,
2727
+ emitProcessWorkflowOpen,
2631
2728
  emitSessionClose,
2632
2729
  emitSessionOpen,
2633
2730
  emitSubagentClose,