@tangle-network/agent-app 4.0.26 → 4.0.28

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 (39) hide show
  1. package/dist/assistant/index.js +2 -1
  2. package/dist/assistant/index.js.map +1 -1
  3. package/dist/chat-routes/draft-persistence.d.ts +1 -4
  4. package/dist/chat-routes/index.js +7 -5
  5. package/dist/chat-routes/index.js.map +1 -1
  6. package/dist/chat-routes/producer-trace.d.ts +12 -0
  7. package/dist/{chunk-U4HKZV5U.js → chunk-7TZX2KSH.js} +8 -9
  8. package/dist/chunk-7TZX2KSH.js.map +1 -0
  9. package/dist/chunk-IMSNXL2S.js +1 -0
  10. package/dist/{chunk-BQH5HAKO.js → chunk-O6MFZVNS.js} +1 -5
  11. package/dist/chunk-O6MFZVNS.js.map +1 -0
  12. package/dist/chunk-QM5TPZQY.js +18 -0
  13. package/dist/chunk-QM5TPZQY.js.map +1 -0
  14. package/dist/{chunk-M4LA7JMU.js → chunk-R57ZNKJB.js} +976 -784
  15. package/dist/chunk-R57ZNKJB.js.map +1 -0
  16. package/dist/{chunk-75DKKZQ3.js → chunk-UFR4BXCC.js} +2 -2
  17. package/dist/{chunk-4YRRHORE.js → chunk-WXK2AKRZ.js} +31 -6
  18. package/dist/chunk-WXK2AKRZ.js.map +1 -0
  19. package/dist/preset-cloudflare/index.js +6 -4
  20. package/dist/preset-cloudflare/index.js.map +1 -1
  21. package/dist/public-consultation/index.js +4 -3
  22. package/dist/public-consultation/index.js.map +1 -1
  23. package/dist/sandbox/index.js +1 -1
  24. package/dist/stories/fixtures/turn-trace.d.ts +1799 -0
  25. package/dist/turn-trace/index.d.ts +1 -0
  26. package/dist/turn-trace/index.js +8 -2
  27. package/dist/turn-trace/url.d.ts +12 -0
  28. package/dist/web-react/index.d.ts +2 -0
  29. package/dist/web-react/index.js +10 -1
  30. package/dist/web-react/turn-trace-drawer.d.ts +26 -0
  31. package/dist/web-react/turn-trace-flow.d.ts +20 -0
  32. package/package.json +1 -1
  33. package/dist/chunk-4YRRHORE.js.map +0 -1
  34. package/dist/chunk-BQH5HAKO.js.map +0 -1
  35. package/dist/chunk-KG2Y44XT.js +0 -1
  36. package/dist/chunk-M4LA7JMU.js.map +0 -1
  37. package/dist/chunk-U4HKZV5U.js.map +0 -1
  38. /package/dist/{chunk-KG2Y44XT.js.map → chunk-IMSNXL2S.js.map} +0 -0
  39. /package/dist/{chunk-75DKKZQ3.js.map → chunk-UFR4BXCC.js.map} +0 -0
@@ -9,4 +9,5 @@ export * from './recorder.js';
9
9
  export * from './server-timing.js';
10
10
  export * from './traced-fetch.js';
11
11
  export * from './otel.js';
12
+ export { executionIdOfAssistantRow, turnTraceUrl } from './url.js';
12
13
  export type { TurnPhaseTiming, TurnPhaseTimingOptions } from './phase-timing.js';
@@ -1,4 +1,8 @@
1
- import "../chunk-KG2Y44XT.js";
1
+ import "../chunk-IMSNXL2S.js";
2
+ import {
3
+ executionIdOfAssistantRow,
4
+ turnTraceUrl
5
+ } from "../chunk-QM5TPZQY.js";
2
6
  import {
3
7
  TURN_SPAN_KINDS,
4
8
  buildTurnTraceOtelSpans,
@@ -21,6 +25,7 @@ export {
21
25
  createIntelligenceTurnTraceReader,
22
26
  createIntelligenceTurnTraceSink,
23
27
  createTurnTrace,
28
+ executionIdOfAssistantRow,
24
29
  formatServerTiming,
25
30
  nextCallIndex,
26
31
  otlpTraceId,
@@ -29,6 +34,7 @@ export {
29
34
  serverTimingAttrs,
30
35
  summarizeTurnSpans,
31
36
  tracedModelFetch,
32
- turnTraceId
37
+ turnTraceId,
38
+ turnTraceUrl
33
39
  };
34
40
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Where a turn's owner reads its trace. The server names it on the turn receipt (`traceUrl`); a client builds the same
3
+ * URL for a turn in its history from the path it posts turns to and the turn's execution id, which an assistant row's
4
+ * id carries. Browser-safe: no fetch, no environment.
5
+ */
6
+ /** `routes.trace` for one turn: the turn's path plus `/turns/<execution id>/trace`. */
7
+ export declare function turnTraceUrl(turnPath: string, executionId: string): string;
8
+ /** The deterministic assistant-row id for a turn: readable on purpose (an operator grepping a transcript row id finds the
9
+ * run), and stable across re-entries because every input already is. */
10
+ export declare function assistantRowIdForTurn(turnKey: string): string;
11
+ /** The execution id an assistant row written by the chat route is keyed by, or null for a row it did not key. */
12
+ export declare function executionIdOfAssistantRow(messageId: string): string | null;
@@ -63,6 +63,8 @@ export * from './provider-logo.js';
63
63
  export * from './harness-glyphs.js';
64
64
  export * from './smooth-text.js';
65
65
  export * from './mission-activity.js';
66
+ export * from './turn-trace-drawer.js';
67
+ export * from './turn-trace-flow.js';
66
68
  export * from './work-product.js';
67
69
  export * from './provenance.js';
68
70
  export * from './sandbox-terminal.js';
@@ -46,6 +46,8 @@ import {
46
46
  SessionHistoryPanel,
47
47
  Sparkline,
48
48
  TurnProgress,
49
+ TurnTraceButton,
50
+ TurnTraceDrawer,
49
51
  __resetAttachmentFileCacheForTests,
50
52
  activityTone,
51
53
  buildAnswerData,
@@ -131,6 +133,8 @@ import {
131
133
  toolCallsFromParts,
132
134
  trackChatReasoning,
133
135
  triggerAttachmentDownload,
136
+ turnTraceFlow,
137
+ turnTraceUrlForMessage,
134
138
  upsertChatInteraction,
135
139
  useChatInteractions,
136
140
  useChatScroll,
@@ -152,7 +156,7 @@ import {
152
156
  withoutRecordGridCreated,
153
157
  withoutRecordGridRemoved,
154
158
  withoutRecordGridUpdate
155
- } from "../chunk-M4LA7JMU.js";
159
+ } from "../chunk-R57ZNKJB.js";
156
160
  import {
157
161
  useInfiniteScroll
158
162
  } from "../chunk-UHSUY6H6.js";
@@ -261,6 +265,7 @@ import "../chunk-B7CL7ENS.js";
261
265
  import {
262
266
  getChatFundingRecovery
263
267
  } from "../chunk-QUV5M7SZ.js";
268
+ import "../chunk-QM5TPZQY.js";
264
269
  import {
265
270
  attachmentInputToPart,
266
271
  attachmentKindForMime,
@@ -423,6 +428,8 @@ export {
423
428
  TURN_ROUTE_PHASE_MESSAGES,
424
429
  TURN_STREAM_LOST_CODE,
425
430
  TurnProgress,
431
+ TurnTraceButton,
432
+ TurnTraceDrawer,
426
433
  WorkProductCard,
427
434
  WorkProductStatusPill,
428
435
  WorkspaceInitial,
@@ -571,6 +578,8 @@ export {
571
578
  toolCallsFromParts,
572
579
  trackChatReasoning,
573
580
  triggerAttachmentDownload,
581
+ turnTraceFlow,
582
+ turnTraceUrlForMessage,
574
583
  upsertChatInteraction,
575
584
  useChatInteractions,
576
585
  useChatScroll,
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A turn's own trace, for the member who owns it: the waterfall of the spans `routes.trace` serves (the turn receipt's
3
+ * `traceUrl`) and the OTLP JSON to download, so a member can see where a turn's time went and hill-climb their own use.
4
+ * The drawer reads the trace when it opens; a turn whose trace is not stored yet says so and reads again on request.
5
+ */
6
+ import { type FlowWaterfallProps } from '@tangle-network/charts/react';
7
+ import { type ReactElement } from 'react';
8
+ export interface TurnTraceDrawerProps {
9
+ /** The turn receipt's `traceUrl`, or `turnTraceUrlForMessage` for a turn in history. */
10
+ traceUrl: string;
11
+ open: boolean;
12
+ onOpenChange(open: boolean): void;
13
+ /** The control that opens it; focus returns there when the drawer closes. */
14
+ trigger?: ReactElement;
15
+ /** Marks for span rows, e.g. sandbox-ui's `traceSpanMark`; the inspector draws a kind glyph without one. */
16
+ renderIcon?: FlowWaterfallProps['renderIcon'];
17
+ /** Test seam; default `fetch` with the page's own session. */
18
+ fetchImpl?: typeof fetch;
19
+ }
20
+ /** The turn's trace in a side sheet: its summary, the span waterfall, and its OTLP JSON to download. */
21
+ export declare function TurnTraceDrawer({ traceUrl, open, onOpenChange, trigger, renderIcon, fetchImpl }: TurnTraceDrawerProps): import("react").JSX.Element;
22
+ export interface TurnTraceButtonProps extends Omit<TurnTraceDrawerProps, 'open' | 'onOpenChange' | 'trigger'> {
23
+ label?: string;
24
+ }
25
+ /** A message action that opens the turn's trace: put it in `ChatMessages`' `renderExtras` or a product's message row. */
26
+ export declare function TurnTraceButton({ label, ...drawer }: TurnTraceButtonProps): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The OTLP JSON `routes.trace` answers, projected onto the trace inspector (charts `FlowTrace`) on the turn's own
3
+ * clock, and the trace URL of a turn in history. No React: the drawer renders it, and a test reads the route's answer
4
+ * through it.
5
+ */
6
+ import type { FlowTrace } from '@tangle-network/charts';
7
+ /** The trace URL of the turn an assistant row answered, from the path the client posts turns to; null for a row the
8
+ * chat route did not key by its execution id. */
9
+ export declare function turnTraceUrlForMessage(turnPath: string, messageId: string): string | null;
10
+ export interface TurnTraceFlow {
11
+ flow: FlowTrace;
12
+ traceId: string;
13
+ wallMs?: number;
14
+ coveragePct?: number;
15
+ firstVisibleMs?: number;
16
+ firstTextMs?: number;
17
+ }
18
+ /** The OTLP JSON `routes.trace` answers, projected onto the inspector's trace on the turn's own clock. A re-entered
19
+ * execution holds one root per attempt; this draws the latest attempt. Null when it holds no turn root. */
20
+ export declare function turnTraceFlow(exported: unknown): TurnTraceFlow | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "4.0.26",
3
+ "version": "4.0.28",
4
4
  "packageManager": "pnpm@11.28.8",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [