@datalayer/agent-runtimes 1.5.96 → 1.5.97

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 (92) hide show
  1. package/dist-embed/chunks/{index.esm-zOy6kFPv.js → index.esm-BLDeC6q1.js} +1 -1
  2. package/dist-embed/datalayer-app-main.js +80 -80
  3. package/lib/apps/apps/appspec.d.ts +11 -12
  4. package/lib/apps/apps/appspec.js +45 -87
  5. package/lib/components/cards/ToolApprovalCard.js +4 -2
  6. package/lib/components/teams/HarnessIcon.d.ts +11 -0
  7. package/lib/components/teams/HarnessIcon.js +17 -0
  8. package/lib/components/teams/SceneTranscript.d.ts +1 -1
  9. package/lib/components/teams/SceneTranscript.js +12 -7
  10. package/lib/components/teams/SceneView.d.ts +7 -1
  11. package/lib/components/teams/SceneView.js +2 -2
  12. package/lib/components/teams/backdrops/hero.js +1 -1
  13. package/lib/components/teams/backdrops/minimal.js +1 -1
  14. package/lib/components/teams/backdrops/nodes.js +4 -3
  15. package/lib/components/teams/backdrops/space.js +1 -1
  16. package/lib/components/teams/backdrops/types.d.ts +9 -0
  17. package/lib/components/teams/index.d.ts +2 -0
  18. package/lib/components/teams/index.js +2 -0
  19. package/lib/components/teams/memberHarness.d.ts +16 -0
  20. package/lib/components/teams/memberHarness.js +42 -0
  21. package/lib/components/teams/sceneTranscriptRules.js +6 -1
  22. package/lib/components/teams/transcript/LineSelect.d.ts +20 -0
  23. package/lib/components/teams/transcript/LineSelect.js +20 -0
  24. package/lib/components/teams/transcript/TranscriptTable.d.ts +11 -5
  25. package/lib/components/teams/transcript/TranscriptTable.js +24 -7
  26. package/lib/components/teams/transcript/TranscriptViews.js +1 -1
  27. package/lib/components/teams/transcript/recordingPlayback.d.ts +13 -0
  28. package/lib/components/teams/transcript/recordingPlayback.js +32 -0
  29. package/lib/components/teams/transcript/useSceneRecording.d.ts +1 -1
  30. package/lib/components/teams/transcript/useSceneRecording.js +19 -11
  31. package/lib/examples/PapAccountTokensExample.d.ts +1 -1
  32. package/lib/examples/PapAccountTokensExample.js +3 -3
  33. package/lib/examples/PapSessionJwtExample.d.ts +4 -0
  34. package/lib/examples/{PapDpopProofExample.js → PapSessionJwtExample.js} +9 -9
  35. package/lib/examples/PapSessionLifecycleExample.d.ts +1 -1
  36. package/lib/examples/PapSessionLifecycleExample.js +2 -2
  37. package/lib/examples/ScenesExample.js +15 -13
  38. package/lib/examples/example-selector.js +3 -3
  39. package/lib/examples/index.d.ts +1 -1
  40. package/lib/examples/index.js +1 -1
  41. package/lib/examples/main.js +1 -1
  42. package/lib/examples/pap/PapAccountTokensView.d.ts +1 -1
  43. package/lib/examples/pap/PapAuthorizationBoundaryView.js +15 -22
  44. package/lib/examples/pap/PapGuidedJourneyView.js +61 -60
  45. package/lib/examples/pap/PapSessionJwtView.d.ts +4 -0
  46. package/lib/examples/pap/PapSessionJwtView.js +69 -0
  47. package/lib/examples/pap/PapSessionLifecycleView.js +36 -58
  48. package/lib/examples/pap/PapSignInDisplayView.d.ts +1 -1
  49. package/lib/examples/pap/PapSignInDisplayView.js +1 -1
  50. package/lib/examples/pap/PapTraceView.d.ts +1 -1
  51. package/lib/examples/pap/PapTraceView.js +1 -1
  52. package/lib/examples/pap/traces/account-tokens.json +145 -173
  53. package/lib/examples/pap/traces/conversation-control.json +118 -140
  54. package/lib/examples/pap/traces/conversation-streaming.json +114 -134
  55. package/lib/examples/pap/traces/mediated-sign-in.json +151 -166
  56. package/lib/examples/pap/traces/operations.json +613 -391
  57. package/lib/examples/pap/traces/two-companies.json +380 -990
  58. package/lib/examples/pap/traces/user-with-a-company.json +319 -207
  59. package/lib/models/environments.generated.d.ts +2 -2
  60. package/lib/models/environments.generated.js +1 -1
  61. package/lib/pap/index.d.ts +1 -1
  62. package/lib/pap/index.js +3 -3
  63. package/lib/portable/displays.d.ts +13 -22
  64. package/lib/portable/displays.js +17 -65
  65. package/lib/portable/hosts/approvalRenderers.d.ts +4 -4
  66. package/lib/portable/hosts/approvalRenderers.js +26 -13
  67. package/lib/portable/hosts/contracts.json +5 -2
  68. package/lib/portable/index.d.ts +1 -1
  69. package/lib/portable/index.js +1 -1
  70. package/lib/protocols/decks/index.d.ts +37 -0
  71. package/lib/protocols/decks/index.js +48 -0
  72. package/lib/protocols/decks/pact-a-personal-agent-at-a-business.d.ts +2 -0
  73. package/lib/protocols/decks/pact-a-personal-agent-at-a-business.js +148 -0
  74. package/lib/protocols/decks/ucp-a-purchase-approved.d.ts +2 -0
  75. package/lib/protocols/decks/ucp-a-purchase-approved.js +154 -0
  76. package/lib/specs/actions.d.ts +1 -1
  77. package/lib/specs/actions.js +2 -2
  78. package/lib/specs/agents/agents.js +3 -3
  79. package/lib/specs/apps.d.ts +1 -1
  80. package/lib/specs/apps.js +10 -11
  81. package/lib/specs/appspecSchema.js +4 -112
  82. package/lib/specs/envvars.js +2 -2
  83. package/lib/specs/harnesses.js +9 -9
  84. package/lib/specs/scenes.js +10 -33
  85. package/lib/specs/teams/teams.js +2 -2
  86. package/lib/types/agentspecs.d.ts +91 -127
  87. package/package.json +409 -409
  88. package/scripts/codegen/generate_apps.py +6 -7
  89. package/scripts/validate_pap_examples.py +1 -1
  90. package/lib/examples/PapDpopProofExample.d.ts +0 -4
  91. package/lib/examples/pap/PapDpopProofView.d.ts +0 -4
  92. package/lib/examples/pap/PapDpopProofView.js +0 -61
@@ -73,7 +73,7 @@ const MEMBER_LOOK = {
73
73
  textAlign: 'left',
74
74
  whiteSpace: 'normal',
75
75
  minWidth: 160,
76
- maxWidth: 240,
76
+ maxWidth: 280,
77
77
  },
78
78
  };
79
79
  const CONNECTION_LOOK = {
@@ -75,7 +75,7 @@ const MEMBER_LOOK = {
75
75
  textAlign: 'left',
76
76
  whiteSpace: 'normal',
77
77
  minWidth: 160,
78
- maxWidth: 240,
78
+ maxWidth: 280,
79
79
  },
80
80
  };
81
81
  const CONNECTION_LOOK = {
@@ -5,6 +5,7 @@ import { Button, Text } from '@primer/react';
5
5
  import { Box, usePaletteColor } from '@datalayer/primer-addons';
6
6
  import { AssistantStage, } from '../../../chat/assistant/AssistantStage.js';
7
7
  import { SpecMark } from '../../../chat/marks/SpecMark.js';
8
+ import { HarnessIcon } from '../HarnessIcon.js';
8
9
  import { NotebookPreview } from '../NotebookPreview.js';
9
10
  import { notebookBalloonVisual } from '../TeamNotebook.js';
10
11
  import { toolLineText } from '../../../chat/assistant/toolLine.js';
@@ -97,8 +98,8 @@ export const MEMBER_CARD = {
97
98
  color: 'fg.default',
98
99
  textAlign: 'left',
99
100
  whiteSpace: 'normal',
100
- minWidth: 160,
101
- maxWidth: 240,
101
+ minWidth: 200,
102
+ maxWidth: 280,
102
103
  };
103
104
  /**
104
105
  * A node's details, shown on hover or focus and kept by a click: whether
@@ -350,7 +351,7 @@ export function MemberNodeBase({ data, look, }) {
350
351
  ? { left: '50%', transform: 'translateX(-50%)' }
351
352
  : side === 'right'
352
353
  ? { left: 0 }
353
- : { right: 0 }), sx: look.details ?? MEMBER_CARD, children: [look.name === false && (_jsx(Box, { fontWeight: "bold", "data-member-details-name": "", children: member.name })), memberDetails(member, persona.state).map(line => (_jsx(Box, { children: line }, line)))] })] }), _jsx(Handle, { id: MEMBER_HANDLES.outRight, type: "source", position: Position.Right, style: HANDLE(size), isConnectable: false }), _jsx(Handle, { id: MEMBER_HANDLES.outLeft, type: "source", position: Position.Left, style: HANDLE(size), isConnectable: false }), _jsx(Handle, { id: MEMBER_HANDLES.outBottom, type: "source", position: Position.Bottom, style: { ...HANDLE(size), top: size }, isConnectable: false }), _jsx(Handle, { id: MEMBER_HANDLES.outTop, type: "source", position: Position.Top, style: { ...HANDLE(size), top: 0 }, isConnectable: false }), member.connections?.length ? (_jsx(Handle, { id: MEMBER_HANDLES.connections, type: "source", position: Position.Right, style: { ...HANDLE(size), left: 'auto', right: 0 }, isConnectable: false })) : null] }));
354
+ : { right: 0 }), sx: look.details ?? MEMBER_CARD, children: [look.name === false && (_jsx(Box, { fontWeight: "bold", "data-member-details-name": "", children: member.name })), member.description && (_jsx(Box, { mb: 1, "data-member-description": "", children: member.description })), member.harness && (_jsxs(Box, { display: "flex", alignItems: "center", gap: 1, "data-member-harness": member.harness.id, children: [_jsx(HarnessIcon, { id: member.harness.id }), member.harness.name] })), member.model && _jsx(Box, { "data-member-model": "", children: member.model }), memberDetails(member, persona.state).map(line => (_jsx(Box, { children: line }, line)))] })] }), _jsx(Handle, { id: MEMBER_HANDLES.outRight, type: "source", position: Position.Right, style: HANDLE(size), isConnectable: false }), _jsx(Handle, { id: MEMBER_HANDLES.outLeft, type: "source", position: Position.Left, style: HANDLE(size), isConnectable: false }), _jsx(Handle, { id: MEMBER_HANDLES.outBottom, type: "source", position: Position.Bottom, style: { ...HANDLE(size), top: size }, isConnectable: false }), _jsx(Handle, { id: MEMBER_HANDLES.outTop, type: "source", position: Position.Top, style: { ...HANDLE(size), top: 0 }, isConnectable: false }), member.connections?.length ? (_jsx(Handle, { id: MEMBER_HANDLES.connections, type: "source", position: Position.Right, style: { ...HANDLE(size), left: 'auto', right: 0 }, isConnectable: false })) : null] }));
354
355
  }
355
356
  /** A connection of a member's: the server's mark, what it reaches, and how. */
356
357
  export function ConnectionNodeBase({ id, data, look, }) {
@@ -83,7 +83,7 @@ const card = (color) => ({
83
83
  textAlign: 'left',
84
84
  whiteSpace: 'normal',
85
85
  minWidth: 160,
86
- maxWidth: 240,
86
+ maxWidth: 280,
87
87
  '&[data-member-details="kept"], &[data-connection-details="kept"]': {
88
88
  borderColor: tone(color),
89
89
  },
@@ -51,6 +51,15 @@ export type A2ATeamGraphMember = {
51
51
  */
52
52
  color?: string;
53
53
  persona: A2ATeamPersona;
54
+ /** What its application does, in its details. */
55
+ description?: string;
56
+ /** The harness it runs on, in its details with its mark (`memberAppDetails`). */
57
+ harness?: {
58
+ id: string;
59
+ name: string;
60
+ };
61
+ /** The model it answers with, in its details. */
62
+ model?: string;
54
63
  /** A click on the character. */
55
64
  onToggle?: () => void;
56
65
  /** It was sent away, or called back. */
@@ -19,5 +19,7 @@ export * from './SceneTranscript';
19
19
  export * from './SceneView';
20
20
  export * from './transcript';
21
21
  export * from './useBalloonRoom';
22
+ export * from './HarnessIcon';
23
+ export * from './memberHarness';
22
24
  export * from './sceneStage';
23
25
  export * from './AnswerSurfaces';
@@ -23,5 +23,7 @@ export * from './SceneTranscript.js';
23
23
  export * from './SceneView.js';
24
24
  export * from './transcript/index.js';
25
25
  export * from './useBalloonRoom.js';
26
+ export * from './HarnessIcon.js';
27
+ export * from './memberHarness.js';
26
28
  export * from './sceneStage.js';
27
29
  export * from './AnswerSurfaces.js';
@@ -0,0 +1,16 @@
1
+ import type { AppSpec } from '../../types/agentspecs';
2
+ /** The harness a member runs on. */
3
+ export type MemberHarness = {
4
+ id: string;
5
+ name: string;
6
+ };
7
+ /** The agent loop in the page: a member in the browser, whatever its spec names. */
8
+ export declare const BROWSER_HARNESS: MemberHarness;
9
+ /** The harness an application runs on, read from its agent's spec. */
10
+ export declare function memberHarnessOf(app: Pick<AppSpec, 'agent'>, runsIn: 'browser' | 'runtime'): MemberHarness;
11
+ /** What a member's details say of its application. */
12
+ export declare function memberAppDetails(app: Pick<AppSpec, 'agent' | 'description' | 'model'>, runsIn: 'browser' | 'runtime'): {
13
+ description: string;
14
+ harness: MemberHarness;
15
+ model?: string;
16
+ };
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * What a member of a team runs on, as its details say it: its harness, its
7
+ * model, and what its application does.
8
+ *
9
+ * @module components/teams/memberHarness
10
+ */
11
+ import { getAgentspecs } from '../../specs/agents/index.js';
12
+ import { getHarness } from '../../specs/harnesses.js';
13
+ /** The agent loop in the page: a member in the browser, whatever its spec names. */
14
+ export const BROWSER_HARNESS = {
15
+ id: 'browser',
16
+ name: 'Datalayer Loop',
17
+ };
18
+ /** What an agent spec runs on when it names no harness. */
19
+ const DEFAULT_HARNESS = {
20
+ id: 'pydantic-ai',
21
+ name: 'Pydantic AI',
22
+ };
23
+ /** The harness an application runs on, read from its agent's spec. */
24
+ export function memberHarnessOf(app, runsIn) {
25
+ if (runsIn === 'browser') {
26
+ return BROWSER_HARNESS;
27
+ }
28
+ const id = getAgentspecs(app.agent)?.harness;
29
+ if (!id || id === DEFAULT_HARNESS.id) {
30
+ return DEFAULT_HARNESS;
31
+ }
32
+ return { id, name: getHarness(id)?.name ?? id };
33
+ }
34
+ /** What a member's details say of its application. */
35
+ export function memberAppDetails(app, runsIn) {
36
+ const model = app.model || getAgentspecs(app.agent)?.model;
37
+ return {
38
+ description: app.description,
39
+ harness: memberHarnessOf(app, runsIn),
40
+ ...(model ? { model } : {}),
41
+ };
42
+ }
@@ -70,11 +70,16 @@ function inOrder(lines) {
70
70
  /**
71
71
  * The same thing said twice is said once: a member's answer comes back as
72
72
  * the A2A request's events and, on a runtime whose own spans are read, as
73
- * its `invoke_agent` span too. The first one stands.
73
+ * its `invoke_agent` span too. The first one stands. A harness's step is no
74
+ * words said twice: each is a call of its own (`<span>/<call>:called`), and
75
+ * two that read the same are two, one of which the Shield may have refused.
74
76
  */
75
77
  function onceEach(lines) {
76
78
  const seen = new Set();
77
79
  return lines.filter(line => {
80
+ if (line.key.includes('/')) {
81
+ return true;
82
+ }
78
83
  // Words said are the same words whoever they were said to.
79
84
  const said = `${line.kind}\u0000${line.from}\u0000${line.kind === 'said' ? '' : (line.to ?? '')}\u0000${line.text}`;
80
85
  if (seen.has(said)) {
@@ -0,0 +1,20 @@
1
+ /**
2
+ * What selects a line from the keyboard: a native button around the line's
3
+ * time, in the Lines view and in the Table. It has no handler of its own: its
4
+ * click, by a pointer, Enter or Space, bubbles to the line's or the row's
5
+ * own, which a click anywhere on it reaches too.
6
+ *
7
+ * @module components/teams/transcript/LineSelect
8
+ */
9
+ import type { JSX, ReactNode } from 'react';
10
+ export type LineSelectProps = {
11
+ /** What a screen reader says of it: the line it selects. */
12
+ label: string;
13
+ /** The line is the selected one. */
14
+ selected: boolean;
15
+ /** The line's time, as the view draws it. */
16
+ children: ReactNode;
17
+ };
18
+ /** The line's time, as a button that selects it. */
19
+ export declare function LineSelect({ label, selected, children, }: LineSelectProps): JSX.Element;
20
+ export default LineSelect;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from '@datalayer/primer-addons';
3
+ /** The line's time, as a button that selects it. */
4
+ export function LineSelect({ label, selected, children, }) {
5
+ return (_jsx(Box, { as: "button", type: "button", "data-transcript-select": "", "aria-label": label, "aria-pressed": selected, sx: {
6
+ alignSelf: 'start',
7
+ appearance: 'none',
8
+ background: 'none',
9
+ border: 0,
10
+ color: 'inherit',
11
+ cursor: 'pointer',
12
+ font: 'inherit',
13
+ p: 0,
14
+ '&:focus-visible': {
15
+ outline: '2px solid',
16
+ outlineColor: 'accent.fg',
17
+ },
18
+ }, children: children }));
19
+ }
20
+ export default LineSelect;
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * The transcript as a table (SCENES S2-01), Primer's `DataTable`: time,
3
3
  * from → to, over A2A or MCP, kind, text, how long, state. Sortable by time
4
- * (an open call last among its ties), a failed row marked, a click on a row
5
- * selects its line.
4
+ * (an open call last among its ties) unless *Failed first* orders it, a
5
+ * failed row marked, a click on a row
6
+ * or the button on its time selects its line.
6
7
  *
7
8
  * @module components/teams/transcript/TranscriptTable
8
9
  */
@@ -11,13 +12,18 @@ import type { TranscriptRowsLines } from './TranscriptViewsTypes';
11
12
  export type TranscriptTableProps = TranscriptRowsLines & {
12
13
  /** The selected line's key. */
13
14
  selected?: string | null;
14
- /** A row was clicked: its line's key. */
15
+ /** A row was clicked, or its time's button pressed: its line's key. */
15
16
  onSelect?: (key: string) => void;
16
17
  /** What is said while there is no line. */
17
18
  emptyText?: string;
18
19
  /** How tall it grows before it scrolls, in pixels. */
19
20
  maxHeight?: number;
21
+ /**
22
+ * The lines come with what failed first ({@link filterLines}): the table
23
+ * keeps their order, and offers no sort by time until the option is off.
24
+ */
25
+ failedFirst?: boolean;
20
26
  };
21
- /** The transcript as a table, with a click on a row selecting its line. */
22
- export declare function TranscriptTable({ lines, selected, onSelect, emptyText, maxHeight, }: TranscriptTableProps): JSX.Element;
27
+ /** The transcript as a table, with a click on a row or its button selecting its line. */
28
+ export declare function TranscriptTable({ lines, selected, onSelect, emptyText, maxHeight, failedFirst, }: TranscriptTableProps): JSX.Element;
23
29
  export default TranscriptTable;
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId, useMemo } from 'react';
2
+ import { createContext, useContext, useId, useMemo } from 'react';
3
3
  import { Label, Text } from '@primer/react';
4
4
  import { DataTable, Table } from '@primer/react/experimental';
5
5
  import { Box } from '@datalayer/primer-addons';
6
- import { timeText } from '../sceneTranscriptRules.js';
6
+ import { lineHeading, timeText } from '../sceneTranscriptRules.js';
7
+ import { LineSelect } from './LineSelect.js';
7
8
  import { compareByTime, durationText, OVER_WORDS, STATE_WORDS, transcriptRows, } from './transcriptRows.js';
8
9
  /** The state, as a label: failed in red, running in the accent, done quiet. */
9
10
  function StateLabel({ row }) {
@@ -18,14 +19,22 @@ function StateLabel({ row }) {
18
19
  ? 'exchange failed'
19
20
  : STATE_WORDS[row.state] }));
20
21
  }
21
- const COLUMNS = [
22
+ /** What a row's cells read of the selection: a column is fixed, the selection changes. */
23
+ const RowSelection = createContext({ selectable: false });
24
+ /** A row's time, with what selects the row from the keyboard when it can be selected. */
25
+ function RowTime({ row }) {
26
+ const { selectable, selected } = useContext(RowSelection);
27
+ const time = (_jsx(Text, { as: "time", sx: { fontFamily: 'mono', fontSize: 0, whiteSpace: 'nowrap' }, dateTime: new Date(row.at).toISOString(), children: timeText(row.at) }));
28
+ return selectable ? (_jsx(LineSelect, { label: `Select ${lineHeading(row)} at ${timeText(row.at)}`, selected: selected === row.id, children: time })) : (time);
29
+ }
30
+ const SORTED_COLUMNS = [
22
31
  {
23
32
  id: 'at',
24
33
  header: 'Time',
25
34
  field: 'at',
26
35
  sortBy: compareByTime,
27
36
  width: 'auto',
28
- renderCell: row => (_jsx(Text, { as: "time", sx: { fontFamily: 'mono', fontSize: 0, whiteSpace: 'nowrap' }, dateTime: new Date(row.at).toISOString(), children: timeText(row.at) })),
37
+ renderCell: row => _jsx(RowTime, { row: row }),
29
38
  },
30
39
  {
31
40
  id: 'who',
@@ -77,10 +86,13 @@ const COLUMNS = [
77
86
  renderCell: row => _jsx(StateLabel, { row: row }),
78
87
  },
79
88
  ];
80
- /** The transcript as a table, with a click on a row selecting its line. */
81
- export function TranscriptTable({ lines, selected, onSelect, emptyText = 'What the scene says and does shows here, row by row.', maxHeight, }) {
89
+ /** The columns while the rows keep the order they came in: no sort for the table to redo. */
90
+ const GIVEN_ORDER_COLUMNS = SORTED_COLUMNS.map(({ sortBy: _sortBy, ...column }) => column);
91
+ /** The transcript as a table, with a click on a row or its button selecting its line. */
92
+ export function TranscriptTable({ lines, selected, onSelect, emptyText = 'What the scene says and does shows here, row by row.', maxHeight, failedFirst = false, }) {
82
93
  const title = useId();
83
94
  const rows = useMemo(() => transcriptRows(lines), [lines]);
95
+ const selection = useMemo(() => ({ selectable: Boolean(onSelect), selected }), [onSelect, selected]);
84
96
  // A click anywhere on a row: the row's line, found from the text cell's mark.
85
97
  const onClick = (event) => {
86
98
  if (!onSelect) {
@@ -107,6 +119,11 @@ export function TranscriptTable({ lines, selected, onSelect, emptyText = 'What t
107
119
  },
108
120
  }
109
121
  : {}),
110
- }, children: _jsxs(Table.Container, { children: [_jsx(Table.Title, { as: "h3", id: title, children: "Transcript" }), _jsx(DataTable, { "aria-labelledby": title, data: rows, columns: COLUMNS, cellPadding: "condensed", initialSortColumn: "at", initialSortDirection: "ASC" })] }) }));
122
+ }, children: _jsxs(Table.Container, { children: [_jsx(Table.Title, { as: "h3", id: title, children: "Transcript" }), _jsx(RowSelection.Provider, { value: selection, children: _jsx(DataTable, { "aria-labelledby": title, data: rows, columns: failedFirst ? GIVEN_ORDER_COLUMNS : SORTED_COLUMNS, cellPadding: "condensed", ...(failedFirst
123
+ ? {}
124
+ : {
125
+ initialSortColumn: 'at',
126
+ initialSortDirection: 'ASC',
127
+ }) }, failedFirst ? 'given-order' : 'by-time') })] }) }));
111
128
  }
112
129
  export default TranscriptTable;
@@ -128,7 +128,7 @@ export function TranscriptViews({ lines, members = NO_MEMBERS, spans, tracer, re
128
128
  ? 'No line matches the filter.'
129
129
  : emptyText, maxHeight: maxHeight, copy: false, selected: selectedKey, onSelect: select })), shown === 'table' && (_jsx(TranscriptTable, { lines: kept, emptyText: narrowed && lines.length
130
130
  ? 'No row matches the filter.'
131
- : emptyText, maxHeight: maxHeight, selected: selectedKey, onSelect: select })), shown === 'sequence' && (_jsx(SequenceDiagram, { lines: kept, cast: cast, emptyText: narrowed && lines.length
131
+ : emptyText, maxHeight: maxHeight, selected: selectedKey, onSelect: select, failedFirst: Boolean(filter.failedFirst) })), shown === 'sequence' && (_jsx(SequenceDiagram, { lines: kept, cast: cast, emptyText: narrowed && lines.length
132
132
  ? 'No arrow matches the filter.'
133
133
  : emptyText, maxHeight: maxHeight, selected: selectedKey, onSelect: select, ...(loadMermaid ? { load: loadMermaid } : {}) }))] }), selectedLine && (_jsx(TranscriptDetail, { line: selectedLine, span: selectedSpan, inspectorHref: inspectorHref, onOpenInspector: onOpenInspector, onClose: () => select(null) }))] })] }));
134
134
  }
@@ -42,6 +42,19 @@ export type RecordedStage = {
42
42
  /** The tool calls to the members' connections (`A2ATeamGraph`'s `calls`). */
43
43
  calls: A2ATeamCall[];
44
44
  };
45
+ /**
46
+ * How long the stage still moves after the last line, in playback
47
+ * milliseconds: until the last answer and the last result have been shown.
48
+ */
49
+ export declare function settleMs(lines: readonly SceneTranscriptLine[], { speed }?: {
50
+ speed?: number;
51
+ }): number;
52
+ /**
53
+ * The stage once a recording is over: no link carries a message and no call
54
+ * runs, whatever the lines left open (a call recorded with no end is over
55
+ * when the recording is).
56
+ */
57
+ export declare function settledStage(stage: RecordedStage): RecordedStage;
45
58
  /**
46
59
  * The stage at a moment of the recording (`at`, recorded milliseconds), from
47
60
  * the lines said by then: a link from the entry to a peer is `asking` while
@@ -76,6 +76,38 @@ export function recordedMomentAt(lines, offsets, elapsed, speed = 1) {
76
76
  const moment = lines[last].at + since;
77
77
  return next === undefined ? moment : Math.min(moment, next);
78
78
  }
79
+ /**
80
+ * How long the stage still moves after the last line, in playback
81
+ * milliseconds: until the last answer and the last result have been shown.
82
+ */
83
+ export function settleMs(lines, { speed = 1 } = {}) {
84
+ const last = lines[lines.length - 1];
85
+ if (!last) {
86
+ return 0;
87
+ }
88
+ const settled = Math.max(...lines.map(line => {
89
+ if (line.kind === 'said') {
90
+ return line.at + ANSWER_SHOWN_MS;
91
+ }
92
+ if (line.ended === undefined) {
93
+ return line.at;
94
+ }
95
+ return (line.ended +
96
+ (line.kind === 'called' ? RESULT_SHOWN_MS : ANSWER_SHOWN_MS));
97
+ }));
98
+ return Math.round(Math.max(0, settled - last.at) / (speed > 0 ? speed : 1));
99
+ }
100
+ /**
101
+ * The stage once a recording is over: no link carries a message and no call
102
+ * runs, whatever the lines left open (a call recorded with no end is over
103
+ * when the recording is).
104
+ */
105
+ export function settledStage(stage) {
106
+ return {
107
+ flows: Object.fromEntries(Object.keys(stage.flows).map(peer => [peer, 'still'])),
108
+ calls: [],
109
+ };
110
+ }
79
111
  function memberIdOf(name, members) {
80
112
  if (!name) {
81
113
  return undefined;
@@ -35,7 +35,7 @@ export type SceneRecordingPlayback = RecordedStage & {
35
35
  /** What the audience is told of it, when the recording says. */
36
36
  note?: string;
37
37
  playing: boolean;
38
- /** Every line was shown. */
38
+ /** Every line was shown and the stage has played them out: it rests (`settledStage`). */
39
39
  done: boolean;
40
40
  play: () => void;
41
41
  pause: () => void;
@@ -22,7 +22,7 @@
22
22
  * @module components/teams/transcript/useSceneRecording
23
23
  */
24
24
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
25
- import { playbackOffsets, recordedLinesOf, recordedMomentAt, recordedStageAt, recordingLabel, } from './recordingPlayback.js';
25
+ import { playbackOffsets, recordedLinesOf, recordedMomentAt, recordedStageAt, recordingLabel, settledStage, settleMs, } from './recordingPlayback.js';
26
26
  const now = () => typeof performance !== 'undefined' ? performance.now() : Date.now();
27
27
  /** Plays a scene's recording at its recorded pace; nothing to play when there is none. */
28
28
  export function useSceneRecording(recording, { members, entry, beat, speed = 1, maxGapMs, autoPlay = true, loop = false, loopAfterMs = 8000, tickMs = 250, }) {
@@ -33,6 +33,9 @@ export function useSceneRecording(recording, { members, entry, beat, speed = 1,
33
33
  // Where the clock started, minus what was played before a pause.
34
34
  const started = useRef(now());
35
35
  const total = offsets.length ? offsets[offsets.length - 1] : 0;
36
+ // Played once, the clock runs on until the stage has played its last answer
37
+ // out; a loop's hold, `loopAfterMs`, does that.
38
+ const end = loop ? total : total + settleMs(all, { speed });
36
39
  useEffect(() => {
37
40
  setElapsed(0);
38
41
  started.current = now();
@@ -44,30 +47,30 @@ export function useSceneRecording(recording, { members, entry, beat, speed = 1,
44
47
  }
45
48
  const timer = setInterval(() => {
46
49
  const at = now() - started.current;
47
- if (at >= total + (loop ? loopAfterMs : 0)) {
50
+ if (at >= end + (loop ? loopAfterMs : 0)) {
48
51
  if (loop) {
49
52
  started.current = now();
50
53
  setElapsed(0);
51
54
  return;
52
55
  }
53
- setElapsed(total);
56
+ setElapsed(end);
54
57
  setPlaying(false);
55
58
  return;
56
59
  }
57
60
  setElapsed(at);
58
61
  }, tickMs);
59
62
  return () => clearInterval(timer);
60
- }, [playing, total, loop, loopAfterMs, tickMs]);
63
+ }, [playing, end, loop, loopAfterMs, tickMs]);
61
64
  const play = useCallback(() => {
62
65
  if (all.length === 0) {
63
66
  return;
64
67
  }
65
- started.current = now() - (elapsed >= total ? 0 : elapsed);
66
- if (elapsed >= total) {
68
+ started.current = now() - (elapsed >= end ? 0 : elapsed);
69
+ if (elapsed >= end) {
67
70
  setElapsed(0);
68
71
  }
69
72
  setPlaying(true);
70
- }, [all.length, elapsed, total]);
73
+ }, [all.length, elapsed, end]);
71
74
  const pause = useCallback(() => setPlaying(false), []);
72
75
  const restart = useCallback(() => {
73
76
  started.current = now();
@@ -76,9 +79,14 @@ export function useSceneRecording(recording, { members, entry, beat, speed = 1,
76
79
  }, [all.length]);
77
80
  const shown = offsets.filter(offset => offset <= elapsed).length;
78
81
  const lines = useMemo(() => all.slice(0, shown), [all, shown]);
79
- const stage = useMemo(() => all.length
80
- ? recordedStageAt(all, recordedMomentAt(all, offsets, elapsed, speed), members, entry)
81
- : { flows: {}, calls: [] }, [all, offsets, elapsed, speed, members, entry]);
82
+ const done = all.length > 0 && elapsed >= end && !playing;
83
+ const stage = useMemo(() => {
84
+ if (!all.length) {
85
+ return { flows: {}, calls: [] };
86
+ }
87
+ const moment = recordedStageAt(all, recordedMomentAt(all, offsets, elapsed, speed), members, entry);
88
+ return done ? settledStage(moment) : moment;
89
+ }, [all, offsets, elapsed, speed, members, entry, done]);
82
90
  const taken = recording?.taken ?? '';
83
91
  return {
84
92
  ...stage,
@@ -88,7 +96,7 @@ export function useSceneRecording(recording, { members, entry, beat, speed = 1,
88
96
  taken,
89
97
  ...(recording?.note ? { note: recording.note } : {}),
90
98
  playing,
91
- done: all.length > 0 && shown === all.length && !playing,
99
+ done,
92
100
  play,
93
101
  pause,
94
102
  restart,
@@ -1,4 +1,4 @@
1
- /** PAP Account Tokens, replayed from a PAP demo-world trace, as a Reactor workspace plugin. */
1
+ /** PAP Refresh Tokens, replayed from a PAP demo-world trace, as a Reactor workspace plugin. */
2
2
  import React from 'react';
3
3
  declare const PapAccountTokensExample: React.FC;
4
4
  export default PapAccountTokensExample;
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  * Copyright (c) 2025-2026 Datalayer, Inc.
4
4
  * Distributed under the terms of the Modified BSD License.
5
5
  */
6
- /** PAP Account Tokens, replayed from a PAP demo-world trace, as a Reactor workspace plugin. */
6
+ /** PAP Refresh Tokens, replayed from a PAP demo-world trace, as a Reactor workspace plugin. */
7
7
  import { useMemo } from 'react';
8
8
  import { Box, setupPrimerPortals } from '@datalayer/primer-addons';
9
9
  import { LoopEmbed } from '../apps/index.js';
@@ -12,8 +12,8 @@ import { ThemedProvider } from './utils/themedProvider.js';
12
12
  setupPrimerPortals();
13
13
  const PapAccountTokensPlugin = definePapExamplePlugin({
14
14
  key: 'account-tokens',
15
- title: 'PAP Account Tokens',
16
- description: 'Refresh, rotate, narrow, and revoke an Account Token the host keeps by reference.',
15
+ title: 'PAP Refresh Tokens',
16
+ description: 'Refresh, rotate, narrow, and revoke a refresh token the host keeps by reference.',
17
17
  load: () => import('./pap/PapAccountTokensView.js'),
18
18
  });
19
19
  const PapAccountTokensExample = () => {
@@ -0,0 +1,4 @@
1
+ /** PAP Session JWT creation mounted as a Reactor workspace plugin. */
2
+ import React from 'react';
3
+ declare const PapSessionJwtExample: React.FC;
4
+ export default PapSessionJwtExample;
@@ -3,21 +3,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  * Copyright (c) 2025-2026 Datalayer, Inc.
4
4
  * Distributed under the terms of the Modified BSD License.
5
5
  */
6
- /** PAP DPoP proof creation mounted as a Reactor workspace plugin. */
6
+ /** PAP Session JWT creation mounted as a Reactor workspace plugin. */
7
7
  import { useMemo } from 'react';
8
8
  import { Box, setupPrimerPortals } from '@datalayer/primer-addons';
9
9
  import { LoopEmbed } from '../apps/index.js';
10
10
  import { definePapExamplePlugin } from '../apps/plugins/pap-example/index.js';
11
11
  import { ThemedProvider } from './utils/themedProvider.js';
12
12
  setupPrimerPortals();
13
- const PapDpopPlugin = definePapExamplePlugin({
14
- key: 'dpop-proof',
15
- title: 'PAP DPoP Proof',
16
- description: 'Fresh request-bound proofs kept outside model and UI state.',
17
- load: () => import('./pap/PapDpopProofView.js'),
13
+ const PapSessionJwtPlugin = definePapExamplePlugin({
14
+ key: 'session-jwt',
15
+ title: 'PAP Session JWT',
16
+ description: 'Fresh request-bound Session JWTs kept outside model and UI state.',
17
+ load: () => import('./pap/PapSessionJwtView.js'),
18
18
  });
19
- const PapDpopProofExample = () => {
20
- const plugins = useMemo(() => [PapDpopPlugin], []);
19
+ const PapSessionJwtExample = () => {
20
+ const plugins = useMemo(() => [PapSessionJwtPlugin], []);
21
21
  return (_jsx(ThemedProvider, { children: _jsx(Box, { height: "100vh", minHeight: 0, children: _jsx(LoopEmbed, { target: "browser", agentId: "loop-shell", defaultEditor: "none", showHeader: true, plugins: plugins }) }) }));
22
22
  };
23
- export default PapDpopProofExample;
23
+ export default PapSessionJwtExample;
@@ -1,4 +1,4 @@
1
- /** PAP signed-out Session lifecycle mounted as a Reactor workspace plugin. */
1
+ /** PAP Session lifecycle mounted as a Reactor workspace plugin. */
2
2
  import React from 'react';
3
3
  declare const PapSessionLifecycleExample: React.FC;
4
4
  export default PapSessionLifecycleExample;
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  * Copyright (c) 2025-2026 Datalayer, Inc.
4
4
  * Distributed under the terms of the Modified BSD License.
5
5
  */
6
- /** PAP signed-out Session lifecycle mounted as a Reactor workspace plugin. */
6
+ /** PAP Session lifecycle mounted as a Reactor workspace plugin. */
7
7
  import { useMemo } from 'react';
8
8
  import { Box, setupPrimerPortals } from '@datalayer/primer-addons';
9
9
  import { LoopEmbed } from '../apps/index.js';
@@ -13,7 +13,7 @@ setupPrimerPortals();
13
13
  const PapSessionPlugin = definePapExamplePlugin({
14
14
  key: 'session-lifecycle',
15
15
  title: 'PAP Session Lifecycle',
16
- description: 'Start, nonce retry, and renewal with credentials host-owned.',
16
+ description: 'A random sid, invalid_session and one restart, credentials host-owned.',
17
17
  load: () => import('./pap/PapSessionLifecycleView.js'),
18
18
  });
19
19
  const PapSessionLifecycleExample = () => {