@codemation/host 1.0.1 → 1.0.2

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/{AppConfigFactory-BPp02HMv.js → AppConfigFactory-C4OXGOs2.js} +16 -7
  3. package/dist/{AppConfigFactory-BPp02HMv.js.map → AppConfigFactory-C4OXGOs2.js.map} +1 -1
  4. package/dist/{AppConfigFactory-PFmDg5Sg.d.ts → AppConfigFactory-D3k-R3Ch.d.ts} +338 -6
  5. package/dist/{AppContainerFactory-Cr3JeVmg.js → AppContainerFactory-CKRDz8kQ.js} +409 -92
  6. package/dist/AppContainerFactory-CKRDz8kQ.js.map +1 -0
  7. package/dist/{CodemationAppContext-DP_-56c6.d.ts → CodemationAppContext-YgJRUHWF.d.ts} +2 -2
  8. package/dist/{CodemationAuthoring.types-Cr2QZsUX.d.ts → CodemationAuthoring.types-lUdxXYq-.d.ts} +3 -3
  9. package/dist/{CodemationConfigNormalizer-B8RGUwAe.d.ts → CodemationConfigNormalizer-BWBp7mFB.d.ts} +2 -2
  10. package/dist/{CodemationConsumerConfigLoader-C_QVwcI3.d.ts → CodemationConsumerConfigLoader-Bka3v6lh.d.ts} +2 -2
  11. package/dist/{CodemationPluginListMerger-Bgn1CIX9.d.ts → CodemationPluginListMerger-Oz-GAkxz.d.ts} +17 -5
  12. package/dist/{CredentialServices-95DPogx-.d.ts → CredentialServices-CKXPg5xu.d.ts} +3 -3
  13. package/dist/{PublicFrontendBootstrapFactory-C_iLgPV-.d.ts → PublicFrontendBootstrapFactory-DkQoSYDo.d.ts} +2 -2
  14. package/dist/authoring.d.ts +3 -3
  15. package/dist/consumer.d.ts +4 -4
  16. package/dist/credentials.d.ts +3 -3
  17. package/dist/devServerSidecar.d.ts +1 -1
  18. package/dist/{index-W4eSjdCM.d.ts → index-BxIc_L4D.d.ts} +233 -151
  19. package/dist/index.d.ts +11 -11
  20. package/dist/index.js +4 -4
  21. package/dist/nextServer.d.ts +7 -7
  22. package/dist/nextServer.js +2 -2
  23. package/dist/{persistenceServer-_pqP_0nw.d.ts → persistenceServer-BLG7_6B5.d.ts} +2 -2
  24. package/dist/{persistenceServer-CA0_q0D7.js → persistenceServer-KyHL0u01.js} +2 -2
  25. package/dist/{persistenceServer-CA0_q0D7.js.map → persistenceServer-KyHL0u01.js.map} +1 -1
  26. package/dist/persistenceServer.d.ts +5 -5
  27. package/dist/persistenceServer.js +2 -2
  28. package/dist/{server-Q5uwa6iR.d.ts → server-B0SD6Nvk.d.ts} +5 -5
  29. package/dist/{server-BE4PLhcb.js → server-CMUVhYIc.js} +3 -3
  30. package/dist/{server-BE4PLhcb.js.map → server-CMUVhYIc.js.map} +1 -1
  31. package/dist/server.d.ts +8 -8
  32. package/dist/server.js +4 -4
  33. package/package.json +5 -5
  34. package/prisma/migrations/20260430120000_telemetry_iteration_identity/migration.sql +17 -0
  35. package/prisma/migrations/20260430130000_execution_instance_iteration_identity/migration.sql +11 -0
  36. package/prisma/migrations.sqlite/20260430120000_telemetry_iteration_identity/migration.sql +14 -0
  37. package/prisma/migrations.sqlite/20260430130000_execution_instance_iteration_identity/migration.sql +10 -0
  38. package/prisma/schema.postgresql.prisma +12 -0
  39. package/prisma/schema.sqlite.prisma +12 -0
  40. package/src/application/contracts/IterationCostContracts.ts +11 -0
  41. package/src/application/queries/GetIterationCostQuery.ts +14 -0
  42. package/src/application/queries/GetIterationCostQueryHandler.ts +92 -0
  43. package/src/application/queries/GetWorkflowRunDetailQueryHandler.ts +44 -2
  44. package/src/application/queries/RunIterationProjectionFactory.ts +123 -0
  45. package/src/application/queries/WorkflowQueryHandlers.ts +1 -0
  46. package/src/application/telemetry/OtelExecutionTelemetry.types.ts +3 -0
  47. package/src/application/telemetry/RunEventBusTelemetryReporter.ts +7 -0
  48. package/src/application/telemetry/StoredNodeExecutionTelemetry.ts +14 -0
  49. package/src/application/telemetry/StoredTelemetrySpanScope.ts +90 -1
  50. package/src/bootstrap/AppContainerFactory.ts +5 -0
  51. package/src/domain/telemetry/TelemetryContracts.ts +12 -0
  52. package/src/infrastructure/persistence/InMemoryTelemetryMetricPointStore.ts +3 -0
  53. package/src/infrastructure/persistence/InMemoryTelemetrySpanStore.ts +3 -0
  54. package/src/infrastructure/persistence/InMemoryWorkflowRunRepository.ts +23 -0
  55. package/src/infrastructure/persistence/PrismaTelemetryMetricPointStore.ts +9 -0
  56. package/src/infrastructure/persistence/PrismaTelemetrySpanStore.ts +6 -0
  57. package/src/infrastructure/persistence/PrismaWorkflowRunRepository.ts +12 -0
  58. package/src/infrastructure/persistence/generated/prisma-postgresql-client/edge.js +15 -6
  59. package/src/infrastructure/persistence/generated/prisma-postgresql-client/index-browser.js +11 -2
  60. package/src/infrastructure/persistence/generated/prisma-postgresql-client/index.d.ts +343 -5
  61. package/src/infrastructure/persistence/generated/prisma-postgresql-client/index.js +15 -6
  62. package/src/infrastructure/persistence/generated/prisma-postgresql-client/package.json +1 -1
  63. package/src/infrastructure/persistence/generated/prisma-postgresql-client/schema.prisma +12 -0
  64. package/src/infrastructure/persistence/generated/prisma-sqlite-client/edge.js +15 -6
  65. package/src/infrastructure/persistence/generated/prisma-sqlite-client/index-browser.js +11 -2
  66. package/src/infrastructure/persistence/generated/prisma-sqlite-client/index.d.ts +343 -5
  67. package/src/infrastructure/persistence/generated/prisma-sqlite-client/index.js +15 -6
  68. package/src/infrastructure/persistence/generated/prisma-sqlite-client/package.json +1 -1
  69. package/src/infrastructure/persistence/generated/prisma-sqlite-client/schema.prisma +12 -0
  70. package/dist/AppContainerFactory-Cr3JeVmg.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @codemation/host
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ed75183`](https://github.com/MadeRelevant/codemation/commit/ed75183f51ae71b06aa2e57ae4fc48ce9db2e4ce) - Establish "per Item per Call" identity end-to-end so the workflow run inspector reports, visualizes, and dashboards multi-item AI agents correctly.
8
+
9
+ Previously, an orchestrator agent that processed N items emitted one flat list of LLM rounds and tool calls — the bottom execution tree, the right-panel agent timeline, cost dashboards, and the realtime event stream all collapsed iterations into one bucket, making sub-agent fan-outs (and parallel item processing in general) unreadable.
10
+
11
+ **What changed**
12
+ - **Engine** (`@codemation/core`): `NodeExecutor` mints a `NodeIterationId` per item inside per-item runnable activations and stamps it (with `itemIndex`) onto `NodeExecutionContext`. Connection invocations, telemetry spans (`gen_ai.chat.completion`, `agent.tool.call`), metric points (`codemation.cost.estimated`, `codemation.agent.turns`, `codemation.agent.tool_calls`), and run events all carry the per-item identity. New `ChildExecutionScopeFactory` re-roots `NodeExecutionContext` for sub-agents so credentials and iteration ids resolve correctly across the orchestrator → tool → sub-agent boundary.
13
+ - **Sub-agent credentials** (`@codemation/core-nodes`): `NodeBackedToolRuntime.resolveNodeCtx` no longer re-wraps `args.ctx.nodeId` with `ConnectionNodeIdFactory.toolConnectionNodeId` — the caller already pre-wraps it. The previous double-nesting produced exponentially deep node ids (`AIAgentNode:2__conn__tool__conn__searchInMail__conn__tool__conn__searchInMail__conn__llm`) that didn't match user-bound credential slots. Sub-agent OpenAI / API-key slots resolve again.
14
+ - **Realtime events**: new `connectionInvocationStarted` / `connectionInvocationCompleted` / `connectionInvocationFailed` events carry the full `ConnectionInvocationRecord` (incl. `iterationId`, `itemIndex`, `parentInvocationId`) and surgical reducers update the run cache without waiting for a coarse `runSaved` snapshot. Run-query polling dropped from 250 ms → 5 s now that WebSocket events drive most updates.
15
+ - **Persistence** (`@codemation/host`): Prisma `ExecutionInstance` model gains `iteration_id`, `item_index`, `parent_invocation_id` columns + index (sqlite + postgres migrations); `PrismaWorkflowRunRepository` round-trips them on read/save and via `ExecutionInstanceDto`. Without this the cold reload of a finished run silently flattens the per-item tree because `runSaved` events stream through Prisma. Telemetry tables already carried these columns from Phase 4; both sides now agree.
16
+ - **Iteration projection / cost queries** (`@codemation/host`): new `RunIterationProjectionFactory` projects `RunIterationRecord`s from connection invocations + iteration cost metrics and `GetIterationCostQueryHandler` serves per-iteration cost rollups for dashboards.
17
+ - **Inspector view model** (`@codemation/next-host`): `NodeInspectorTelemetryPresenter` groups LLM and tool spans by `iterationId` into "Item N" accordion entries (single-item agents fall back to flat layout). New `FocusedInvocationModelFactory` powers item-level prev/next navigation when a specific invocation is selected — the breadcrumb shows "Item X of Y" and nav targets the first invocation of adjacent items. Tool spans now interleave chronologically with LLM rounds (request → tools → response) instead of LLM rounds first then orphan tools at the bottom.
18
+ - **Bottom execution tree** (`@codemation/next-host`): new `ExecutionTreeItemGroupInjector` injects synthetic "Item N" parent rows between an agent and its connection invocations when the agent processed 2+ items. Single-item activations are left untouched; sub-agent invocations whose `parentInvocationId` already points at a tool-call row stay nested under the orchestrator's specific tool call.
19
+ - **Sub-agent credential boundary**: `ChildExecutionScopeFactory.forSubAgent` ensures sub-agent `NodeExecutionContext` keeps the parent invocation id and span context intact so trace nesting and credential resolution agree on the connection-node id.
20
+ - **Tests**: new unit + UI suites for each layer (sub-agent scope, item-group injector, focused invocation model, agent timeline per-item grouping, chronological ordering, Prisma iterationId round trip, item-aware properties panel, connection-invocation event publisher) and a runnable `apps/test-dev` sample (`agentSubAgentToolFanout`) that exercises the orchestrator → sub-agent fan-out across 2 items end-to-end.
21
+
22
+ - Updated dependencies [[`ed75183`](https://github.com/MadeRelevant/codemation/commit/ed75183f51ae71b06aa2e57ae4fc48ce9db2e4ce)]:
23
+ - @codemation/core@1.0.1
24
+ - @codemation/core-nodes@1.0.2
25
+ - @codemation/eventbus-redis@0.0.33
26
+
3
27
  ## 1.0.1
4
28
 
5
29
  ### Patch Changes