agentfootprint 6.0.0 → 6.2.0

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 (42) hide show
  1. package/dist/core/agent/buildAgentChart.js +11 -1
  2. package/dist/core/agent/buildAgentChart.js.map +1 -1
  3. package/dist/core/agent/buildDynamicAgentChart.js +10 -1
  4. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  5. package/dist/esm/core/agent/buildAgentChart.js +11 -1
  6. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  7. package/dist/esm/core/agent/buildDynamicAgentChart.js +10 -1
  8. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  9. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js +131 -13
  10. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  11. package/dist/esm/observe.js +6 -0
  12. package/dist/esm/observe.js.map +1 -1
  13. package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js +190 -0
  14. package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -0
  15. package/dist/esm/recorders/observability/ToolLineageRecorder.js +0 -0
  16. package/dist/esm/recorders/observability/ToolLineageRecorder.js.map +1 -0
  17. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +8 -0
  18. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  19. package/dist/lib/injection-engine/buildInjectionEngineSubflow.js +134 -14
  20. package/dist/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  21. package/dist/observe.js +9 -1
  22. package/dist/observe.js.map +1 -1
  23. package/dist/recorders/observability/AgentThinkingTraceRecorder.js +194 -0
  24. package/dist/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -0
  25. package/dist/recorders/observability/ToolLineageRecorder.js +0 -0
  26. package/dist/recorders/observability/ToolLineageRecorder.js.map +1 -0
  27. package/dist/recorders/observability/commentary/commentaryTemplates.js +8 -0
  28. package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  29. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  30. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
  31. package/dist/types/events/payloads.d.ts +11 -0
  32. package/dist/types/events/payloads.d.ts.map +1 -1
  33. package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts +65 -7
  34. package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts.map +1 -1
  35. package/dist/types/observe.d.ts +2 -0
  36. package/dist/types/observe.d.ts.map +1 -1
  37. package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts +101 -0
  38. package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts.map +1 -0
  39. package/dist/types/recorders/observability/ToolLineageRecorder.d.ts +72 -0
  40. package/dist/types/recorders/observability/ToolLineageRecorder.d.ts.map +1 -0
  41. package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
  42. package/package.json +3 -3
@@ -0,0 +1,72 @@
1
+ /**
2
+ * ToolLineageRecorder — derives the tool→tool DATA-FLOW graph of a run.
3
+ *
4
+ * Why this exists: in a ReAct agent a tool's output flows back to the LLM as
5
+ * text, and the LLM decides the NEXT tool's arguments — so the data dependency
6
+ * between tools (e.g. FLOGI's FCID reused as io_profile's `initiator_id`) never
7
+ * touches footprintjs's shared scope, and `causalChain` can't reconstruct it.
8
+ * This recorder rebuilds that graph from the tool emit stream by VALUE
9
+ * PROVENANCE: when a tool call's argument value equals a distinctive value
10
+ * produced by an EARLIER iteration's tool result, it records an edge
11
+ * (producer → consumer).
12
+ *
13
+ * It is a HEURISTIC, not ground truth — it matches by value, so it is accurate
14
+ * for distinctive identifiers (FCIDs, WWPNs, ids, NAAs, hostnames) and
15
+ * deliberately conservative:
16
+ * - short / common values (below `minValueLength`) are ignored,
17
+ * - numbers are ignored by default (coincidental matches are likely),
18
+ * - same-iteration (parallel) tool calls never link to each other — the LLM
19
+ * chose all their args from the same prior context, before any of them ran.
20
+ *
21
+ * No core changes: it consumes the existing `agentfootprint.stream.tool_start`
22
+ * (args) and `agentfootprint.stream.tool_end` (result) emits. Attach via
23
+ * `.recorder(toolLineageRecorder())` and read `getLineage()` after the run; the
24
+ * lens (or any consumer) can render the returned graph.
25
+ *
26
+ * Convention 1 — one purpose: it derives ONE artifact (the lineage graph) from
27
+ * the emit channel. Convention 4 — run-scoped: it resets when a new run starts
28
+ * (the `pipelineId` changes).
29
+ */
30
+ import type { EmitRecorder } from 'footprintjs';
31
+ /** A single tool invocation in the run. */
32
+ export interface ToolCallRef {
33
+ /** The execution-step id this tool call ran under. */
34
+ readonly runtimeStageId: string;
35
+ /** The provider tool-call id (stable per call). */
36
+ readonly toolCallId: string;
37
+ /** The tool's name. */
38
+ readonly toolName: string;
39
+ /** The ReAct iteration the call belongs to (0-based). */
40
+ readonly iteration: number;
41
+ }
42
+ /** A value-derived data dependency: `from`'s result value reappeared in `to`'s args. */
43
+ export interface ToolLineageEdge {
44
+ readonly from: ToolCallRef;
45
+ readonly to: ToolCallRef;
46
+ /** The distinctive value that links them. */
47
+ readonly value: string;
48
+ }
49
+ /** The tool→tool data-flow graph for one run. */
50
+ export interface ToolLineageGraph {
51
+ readonly nodes: readonly ToolCallRef[];
52
+ readonly edges: readonly ToolLineageEdge[];
53
+ }
54
+ export interface ToolLineageOptions {
55
+ /** Recorder id (idempotent-by-id when attached). Default `'tool-lineage'`. */
56
+ readonly id?: string;
57
+ /** Minimum string length for a value to be matchable. Default 4. */
58
+ readonly minValueLength?: number;
59
+ /** Also match numeric values. Default false (coincidental matches likely). */
60
+ readonly matchNumbers?: boolean;
61
+ /** Max recursion depth when flattening args/results. Default 6. */
62
+ readonly maxDepth?: number;
63
+ }
64
+ /** An EmitRecorder that also exposes the derived lineage graph. */
65
+ export interface ToolLineageRecorderHandle extends EmitRecorder {
66
+ /** The tool→tool data-flow graph derived so far. Safe to call during or after a run. */
67
+ getLineage(): ToolLineageGraph;
68
+ /** Reset all accumulated state. */
69
+ clear(): void;
70
+ }
71
+ export declare function toolLineageRecorder(options?: ToolLineageOptions): ToolLineageRecorderHandle;
72
+ //# sourceMappingURL=ToolLineageRecorder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolLineageRecorder.d.ts","sourceRoot":"","sources":["../../../../src/recorders/observability/ToolLineageRecorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAa,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3D,2CAA2C;AAC3C,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,mDAAmD;IACnD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,uBAAuB;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,wFAAwF;AACxF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC;IACzB,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,mEAAmE;AACnE,MAAM,WAAW,yBAA0B,SAAQ,YAAY;IAC7D,wFAAwF;IACxF,UAAU,IAAI,gBAAgB,CAAC;IAC/B,mCAAmC;IACnC,KAAK,IAAI,IAAI,CAAC;CACf;AAMD,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,kBAAuB,GAAG,yBAAyB,CAqG/F"}
@@ -1 +1 @@
1
- {"version":3,"file":"commentaryTemplates.d.ts","sourceRoot":"","sources":["../../../../../src/recorders/observability/commentary/commentaryTemplates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE;;;2EAG2E;AAC3E,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,mBA+ExC,CAAC;AAEF;;6CAE6C;AAC7C,MAAM,WAAW,iBAAiB;IAChC;6EACyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;2EAGuE;IACvE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CACxE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CA6FzF;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,mBAAmB,EAC1B,GAAG,EAAE,iBAAiB,EACtB,SAAS,GAAE,mBAAgD,GAC1D,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmDxB;AAgCD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,EAAE,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAS3F;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAEvF"}
1
+ {"version":3,"file":"commentaryTemplates.d.ts","sourceRoot":"","sources":["../../../../../src/recorders/observability/commentary/commentaryTemplates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE;;;2EAG2E;AAC3E,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,mBA+ExC,CAAC;AAEF;;6CAE6C;AAC7C,MAAM,WAAW,iBAAiB;IAChC;6EACyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;2EAGuE;IACvE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CACxE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CA6FzF;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,mBAAmB,EAC1B,GAAG,EAAE,iBAAiB,EACtB,SAAS,GAAE,mBAAgD,GAC1D,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA4DxB;AAgCD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,EAAE,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAS3F;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAEvF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentfootprint",
3
- "version": "6.0.0",
3
+ "version": "6.2.0",
4
4
  "description": "The explainable agent framework — build AI agents you can explain, audit, and trust. Built on footprintjs.",
5
5
  "license": "MIT",
6
6
  "author": "Sanjay Krishna Anbalagan",
@@ -178,7 +178,7 @@
178
178
  "@aws-sdk/client-xray": "*",
179
179
  "@modelcontextprotocol/sdk": "*",
180
180
  "@opentelemetry/api": "*",
181
- "footprintjs": "^7.0.0",
181
+ "footprintjs": "^7.0.0 || ^8.0.0",
182
182
  "ioredis": "*",
183
183
  "openai": "*",
184
184
  "zod": "*"
@@ -223,7 +223,7 @@
223
223
  "esbuild": "^0.28.0",
224
224
  "eslint": "^8.44.0",
225
225
  "eslint-config-prettier": "^6.15.0",
226
- "footprintjs": "^7.0.0",
226
+ "footprintjs": "^7.0.0 || ^8.0.0",
227
227
  "prettier": "^2.8.1",
228
228
  "typedoc": "^0.28.19",
229
229
  "typedoc-plugin-markdown": "^4.11.0",