@datalayer/agent-runtimes 1.6.42 → 1.6.45
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-embed/datalayer-app-main.js +85 -85
- package/lib/apps/plugins/assistant/index.d.ts +2 -1
- package/lib/apps/plugins/assistant/index.js +61 -78
- package/lib/chat/assistant/AssistantStage.d.ts +10 -2
- package/lib/chat/assistant/AssistantStage.js +36 -5
- package/lib/chat/assistant/SpeechBalloon.d.ts +23 -1
- package/lib/chat/assistant/SpeechBalloon.js +37 -5
- package/lib/examples/pap/PapCompanyDiscoveryView.js +4 -4
- package/lib/examples/pap/PapGuidedJourneyView.js +9 -9
- package/lib/examples/pap/PapSessionLifecycleView.js +4 -1
- package/lib/examples/pap/traces/account-tokens.json +9 -3
- package/lib/examples/pap/traces/conversation-control.json +19 -13
- package/lib/examples/pap/traces/conversation-streaming.json +13 -7
- package/lib/examples/pap/traces/mediated-sign-in.json +9 -3
- package/lib/examples/pap/traces/operations.json +31 -25
- package/lib/examples/pap/traces/two-companies.json +25 -25
- package/lib/examples/pap/traces/user-with-a-company.json +22 -16
- package/lib/pap/index.d.ts +12 -0
- package/lib/pap/index.js +19 -2
- package/lib/specs/mcpServers.js +1 -1
- package/lib/specs/protocols.js +1 -1
- package/lib/specs/scenes.js +5 -5
- package/package.json +3 -2
|
@@ -94,7 +94,8 @@ export declare function ownComposer(from?: HTMLElement | null): HTMLElement | nu
|
|
|
94
94
|
* view, when one is seen there (`focused`); `not-ready` while it cannot be
|
|
95
95
|
* typed in yet (its runtime is still being assigned); `none` when there is
|
|
96
96
|
* none it can reach — none on the page, or one out of sight in a frame or a
|
|
97
|
-
* closed panel
|
|
97
|
+
* closed panel. Used when there is no workspace to send to: with one, a click
|
|
98
|
+
* opens the balloon's own prompt.
|
|
98
99
|
*/
|
|
99
100
|
export declare function focusComposer(from?: HTMLElement | null): ComposerReach;
|
|
100
101
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { definePlugin, signal } from '@datalayer/reactor';
|
|
4
4
|
import { useContributions, useSignalValue } from '@datalayer/reactor/react';
|
|
5
|
-
import {
|
|
5
|
+
import { Text } from '@primer/react';
|
|
6
6
|
import { Box } from '@datalayer/primer-addons';
|
|
7
7
|
import { useIAMStore } from '@datalayer/core/lib/state/substates/IAMState.js';
|
|
8
8
|
import { pageLayoutPanelOpen, togglePagePanel, } from '@datalayer/primer-addons/lib/reactor/index.js';
|
|
@@ -18,6 +18,7 @@ import { assistantCharacterFor } from '../assistant-characters/index.js';
|
|
|
18
18
|
import { useOptionalSandboxService } from '../agents/useSandboxService.js';
|
|
19
19
|
import { TARGET_SPECS } from '../agents/switchable.js';
|
|
20
20
|
import { useChatWords } from '../../../chat/ChatLanguage.js';
|
|
21
|
+
import { useChatAvailability } from '../../../chat/base/ChatAvailability.js';
|
|
21
22
|
export const LOOP_ASSISTANT_PLUGIN_NAME = '@datalayer/loop-plugin-assistant';
|
|
22
23
|
/** The character's size, in pixels, as the chat's own assistant. */
|
|
23
24
|
const SIZE = 88;
|
|
@@ -128,7 +129,8 @@ function seen(element) {
|
|
|
128
129
|
* view, when one is seen there (`focused`); `not-ready` while it cannot be
|
|
129
130
|
* typed in yet (its runtime is still being assigned); `none` when there is
|
|
130
131
|
* none it can reach — none on the page, or one out of sight in a frame or a
|
|
131
|
-
* closed panel
|
|
132
|
+
* closed panel. Used when there is no workspace to send to: with one, a click
|
|
133
|
+
* opens the balloon's own prompt.
|
|
132
134
|
*/
|
|
133
135
|
export function focusComposer(from) {
|
|
134
136
|
const editable = ownComposer(from);
|
|
@@ -198,40 +200,29 @@ function useCornerBottom(enabled, size) {
|
|
|
198
200
|
}, [enabled, size]);
|
|
199
201
|
return bottom;
|
|
200
202
|
}
|
|
201
|
-
/**
|
|
202
|
-
const
|
|
203
|
+
/** How often its composer is read for whether it takes words yet. */
|
|
204
|
+
const READY_CHECK_MS = 500;
|
|
203
205
|
/**
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
* so
|
|
207
|
-
* workspace
|
|
206
|
+
* Whether its workspace's composer is there and cannot be typed in yet (its
|
|
207
|
+
* runtime still being assigned): the balloon's prompt is then disabled, said
|
|
208
|
+
* so. No composer at all is not that: the prompt sends through the
|
|
209
|
+
* workspace, which holds a message until the chat is ready.
|
|
208
210
|
*/
|
|
209
|
-
function
|
|
210
|
-
const [
|
|
211
|
-
const ref = useRef(null);
|
|
211
|
+
function useComposerNotReady(stageRef) {
|
|
212
|
+
const [notReady, setNotReady] = useState(false);
|
|
212
213
|
useEffect(() => {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
else if (event.key === 'Enter' && !event.shiftKey) {
|
|
226
|
-
event.preventDefault();
|
|
227
|
-
if (message) {
|
|
228
|
-
onSend(message);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
} }), _jsx(Box, { display: "flex", justifyContent: "flex-end", mt: 2, children: _jsx(Button, { type: "submit", size: "small", variant: "primary", disabled: !message, children: send }) })] }));
|
|
214
|
+
const check = () => {
|
|
215
|
+
const editable = ownComposer(stageRef.current);
|
|
216
|
+
setNotReady(!!editable &&
|
|
217
|
+
((editable instanceof HTMLTextAreaElement && editable.disabled) ||
|
|
218
|
+
editable.getAttribute('contenteditable') === 'false'));
|
|
219
|
+
};
|
|
220
|
+
check();
|
|
221
|
+
const timer = window.setInterval(check, READY_CHECK_MS);
|
|
222
|
+
return () => window.clearInterval(timer);
|
|
223
|
+
}, [stageRef]);
|
|
224
|
+
return notReady;
|
|
232
225
|
}
|
|
233
|
-
/** How long *You can write to me as soon as I am ready* stays, in ms. */
|
|
234
|
-
const NOT_READY_MS = 6000;
|
|
235
226
|
export function LoopAssistant({ app, person, appId, decisions, balloon: displayGiven = 'history', workspace, }) {
|
|
236
227
|
const chatText = useChatWords();
|
|
237
228
|
// The balloon's display, as its menu chose it; the Appspec's until then.
|
|
@@ -332,17 +323,11 @@ export function LoopAssistant({ app, person, appId, decisions, balloon: displayG
|
|
|
332
323
|
// In its corner, above its own conversation's composer when that reaches
|
|
333
324
|
// the corner (the conversation on the page, not in a panel).
|
|
334
325
|
const cornerBottom = useCornerBottom(!onPageLayout && !drag.position, SIZE);
|
|
335
|
-
//
|
|
336
|
-
const
|
|
337
|
-
// Its
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
if (!notReady) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
const timer = setTimeout(() => setNotReady(false), NOT_READY_MS);
|
|
344
|
-
return () => clearTimeout(timer);
|
|
345
|
-
}, [notReady]);
|
|
326
|
+
// Its composer cannot take words yet: the balloon's prompt says so.
|
|
327
|
+
const notReady = useComposerNotReady(stageRef);
|
|
328
|
+
// Its host switched its conversation off (an application paused, a model
|
|
329
|
+
// not served): the balloon's prompt is off too, with the host's reason.
|
|
330
|
+
const availability = useChatAvailability();
|
|
346
331
|
// Offered only when the agent decides: the runtime says it.
|
|
347
332
|
const decide = useDecisionAsker(decisions?.serverUrl
|
|
348
333
|
? {
|
|
@@ -402,23 +387,20 @@ export function LoopAssistant({ app, person, appId, decisions, balloon: displayG
|
|
|
402
387
|
setFresh(false);
|
|
403
388
|
},
|
|
404
389
|
})
|
|
405
|
-
:
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
: chatText.clickToWrite,
|
|
414
|
-
});
|
|
390
|
+
: withHistory({
|
|
391
|
+
// A click opens its balloon with the caret in its
|
|
392
|
+
// prompt; without a workspace to send to, it opens the
|
|
393
|
+
// conversation (its panel on a page layout).
|
|
394
|
+
text: workspace?.submit || !onPageLayout
|
|
395
|
+
? chatText.clickToWrite
|
|
396
|
+
: chatText.clickToOpen,
|
|
397
|
+
});
|
|
415
398
|
const insist = state === 'greeting' ||
|
|
416
399
|
presence === 'waiting' ||
|
|
417
400
|
(!!approval && state !== 'paused') ||
|
|
418
401
|
!!tool ||
|
|
419
402
|
(current && atWork) ||
|
|
420
|
-
(unheard && (state === 'speaking' || fresh))
|
|
421
|
-
notReady;
|
|
403
|
+
(unheard && (state === 'speaking' || fresh));
|
|
422
404
|
const onToggle = () => {
|
|
423
405
|
if (onPageLayout) {
|
|
424
406
|
togglePagePanel();
|
|
@@ -428,15 +410,27 @@ export function LoopAssistant({ app, person, appId, decisions, balloon: displayG
|
|
|
428
410
|
if (saying) {
|
|
429
411
|
setHeardId(saying.id);
|
|
430
412
|
}
|
|
431
|
-
|
|
432
|
-
setAsking(false);
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
const reach = focusComposer(stageRef.current);
|
|
436
|
-
setNotReady(reach === 'not-ready');
|
|
437
|
-
// No composer of its own in sight: its own prompt, beside it.
|
|
438
|
-
setAsking(reach === 'none' && Boolean(workspace?.submit));
|
|
413
|
+
focusComposer(stageRef.current);
|
|
439
414
|
};
|
|
415
|
+
// Its balloon's own prompt, sent as its composer sends (13 November 2026).
|
|
416
|
+
const submit = workspace?.submit;
|
|
417
|
+
const prompt = submit
|
|
418
|
+
? {
|
|
419
|
+
label: chatText.writeToMe,
|
|
420
|
+
send: chatText.send,
|
|
421
|
+
notReady: availability.disabled
|
|
422
|
+
? (availability.disableReason ?? chatText.notReadyToWrite)
|
|
423
|
+
: notReady
|
|
424
|
+
? chatText.notReadyToWrite
|
|
425
|
+
: undefined,
|
|
426
|
+
onSend: (message) => {
|
|
427
|
+
if (saying) {
|
|
428
|
+
setHeardId(saying.id);
|
|
429
|
+
}
|
|
430
|
+
void submit(message);
|
|
431
|
+
},
|
|
432
|
+
}
|
|
433
|
+
: undefined;
|
|
440
434
|
const onDismiss = (next) => {
|
|
441
435
|
keepAway(next);
|
|
442
436
|
setLeaving(true);
|
|
@@ -445,23 +439,12 @@ export function LoopAssistant({ app, person, appId, decisions, balloon: displayG
|
|
|
445
439
|
setAway(next);
|
|
446
440
|
}, 600);
|
|
447
441
|
};
|
|
448
|
-
return (_jsxs(_Fragment, { children: [appId && signedIn ? (_jsx(WaitingApprovals, { appId: appId, onWaiting: setApproval })) : null,
|
|
449
|
-
? {
|
|
450
|
-
left: `${drag.position.left}px`,
|
|
451
|
-
top: `${Math.max(8, drag.position.top - PROMPT_HEIGHT - 8)}px`,
|
|
452
|
-
}
|
|
453
|
-
: {
|
|
454
|
-
right: `${CORNER}px`,
|
|
455
|
-
bottom: `${cornerBottom + SIZE + 8}px`,
|
|
456
|
-
}, label: chatText.writeToMe, send: chatText.send, onSend: message => {
|
|
457
|
-
setAsking(false);
|
|
458
|
-
void workspace.submit(message);
|
|
459
|
-
}, onClose: () => setAsking(false) })) : null, _jsx(AssistantStage, { character: chosen.character, state: state, size: SIZE, place: drag.position
|
|
442
|
+
return (_jsxs(_Fragment, { children: [appId && signedIn ? (_jsx(WaitingApprovals, { appId: appId, onWaiting: setApproval })) : null, _jsx(AssistantStage, { character: chosen.character, state: state, size: SIZE, place: drag.position
|
|
460
443
|
? { left: `${drag.position.left}px`, top: `${drag.position.top}px` }
|
|
461
|
-
: { right: `${CORNER}px`, bottom: `${cornerBottom}px` }, stageRef: stageRef, onDragStart: drag.onHandlePointerDown, open: open
|
|
444
|
+
: { right: `${CORNER}px`, bottom: `${cornerBottom}px` }, stageRef: stageRef, onDragStart: drag.onHandlePointerDown, open: open, onToggle: onToggle, balloon: balloon, balloonDisplay: display, insist: insist, onDismiss: onDismiss,
|
|
462
445
|
// Its × hides the balloon; sending it away is in its menu, so the
|
|
463
446
|
// way back to the conversation is never taken by a click on the ×.
|
|
464
|
-
dismissHidesBalloon: true, decide: decide, onResetPosition: drag.position ? drag.reset : undefined, onBalloonDisplayChange: setChosenDisplay, about: agentAbout, sandbox: agentSandbox, contextMenu: menuContributions })] }));
|
|
447
|
+
dismissHidesBalloon: true, prompt: prompt, decide: decide, onResetPosition: drag.position ? drag.reset : undefined, onBalloonDisplayChange: setChosenDisplay, about: agentAbout, sandbox: agentSandbox, contextMenu: menuContributions })] }));
|
|
465
448
|
}
|
|
466
449
|
export const LoopAssistantPlugin = definePlugin({
|
|
467
450
|
name: LOOP_ASSISTANT_PLUGIN_NAME,
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import type { JSX, ReactNode, RefObject } from 'react';
|
|
30
30
|
import type { AssistantCharacter } from './characters';
|
|
31
|
-
import { type BalloonSuggestion } from './SpeechBalloon';
|
|
31
|
+
import { type BalloonPromptConfig, type BalloonSuggestion } from './SpeechBalloon';
|
|
32
32
|
import { type AssistantMenuItem } from './AssistantContextMenu';
|
|
33
33
|
import type { OtelLiveTracer } from '@datalayer/core/lib/otel/live';
|
|
34
34
|
import type { AssistantSandbox } from './assistantDetails';
|
|
@@ -296,6 +296,14 @@ export interface AssistantStageProps {
|
|
|
296
296
|
* pointer comes back to the character; sending it away stays in its menu.
|
|
297
297
|
*/
|
|
298
298
|
dismissHidesBalloon?: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Its balloon's own prompt line (13 November 2026): a click on the
|
|
301
|
+
* character opens the balloon with the caret in it, and the balloon stays
|
|
302
|
+
* until Escape, the ×, or another click; what is sent goes to `onSend`.
|
|
303
|
+
* The page's composer, when it has one, is still there: this is the way
|
|
304
|
+
* to write to it from where it stands.
|
|
305
|
+
*/
|
|
306
|
+
prompt?: Omit<BalloonPromptConfig, 'onClose' | 'focusKey'>;
|
|
299
307
|
/**
|
|
300
308
|
* The agent's own name, used in place of the character's by its menu and
|
|
301
309
|
* its *Send … away*: `Sales`, where the character is a paper clip.
|
|
@@ -314,5 +322,5 @@ export { mouthOpening };
|
|
|
314
322
|
* `data-assistant-mouth`, each frame, without drawing the character again.
|
|
315
323
|
*/
|
|
316
324
|
export declare function useMouth(stageRef: RefObject<HTMLElement | null>, mouthLevel: (() => number) | undefined, speaking: boolean): void;
|
|
317
|
-
export declare function AssistantStage({ character, state, size, replay, place, stageRef, onDragStart, open, onToggle, onCharacterClick, onCharacterKeyDown, balloon, insist, onDismiss, ownRef, decide, mouthLevel, stayPut, dismissHidesBalloon, balloonDisplay, expandTarget, expandOnArrival, suggestions, onSuggestion, inspector, inspectAgent, conversationLabel, onBalloonDisplayChange, onStop, onNewChat, onClear, onChangeCharacter, speech, onResetPosition, about, sandbox, contextMenu, agentName, label, }: AssistantStageProps): JSX.Element;
|
|
325
|
+
export declare function AssistantStage({ character, state, size, replay, place, stageRef, onDragStart, open, onToggle, onCharacterClick, onCharacterKeyDown, balloon, insist, onDismiss, ownRef, decide, mouthLevel, stayPut, dismissHidesBalloon, prompt, balloonDisplay, expandTarget, expandOnArrival, suggestions, onSuggestion, inspector, inspectAgent, conversationLabel, onBalloonDisplayChange, onStop, onNewChat, onClear, onChangeCharacter, speech, onResetPosition, about, sandbox, contextMenu, agentName, label, }: AssistantStageProps): JSX.Element;
|
|
318
326
|
export default AssistantStage;
|
|
@@ -371,7 +371,7 @@ export function useMouth(stageRef, mouthLevel, speaking) {
|
|
|
371
371
|
};
|
|
372
372
|
}, [stageRef, mouthLevel, speaking]);
|
|
373
373
|
}
|
|
374
|
-
export function AssistantStage({ character, state, size = 88, replay, place, stageRef, onDragStart, open, onToggle, onCharacterClick, onCharacterKeyDown, balloon, insist = false, onDismiss, ownRef, decide, mouthLevel, stayPut = false, dismissHidesBalloon = false, balloonDisplay = 'history', expandTarget, expandOnArrival = false, suggestions, onSuggestion, inspector, inspectAgent, conversationLabel, onBalloonDisplayChange, onStop, onNewChat, onClear, onChangeCharacter, speech, onResetPosition, about, sandbox, contextMenu, agentName, label, }) {
|
|
374
|
+
export function AssistantStage({ character, state, size = 88, replay, place, stageRef, onDragStart, open, onToggle, onCharacterClick, onCharacterKeyDown, balloon, insist = false, onDismiss, ownRef, decide, mouthLevel, stayPut = false, dismissHidesBalloon = false, prompt, balloonDisplay = 'history', expandTarget, expandOnArrival = false, suggestions, onSuggestion, inspector, inspectAgent, conversationLabel, onBalloonDisplayChange, onStop, onNewChat, onClear, onChangeCharacter, speech, onResetPosition, about, sandbox, contextMenu, agentName, label, }) {
|
|
375
375
|
const chatText = useChatWords();
|
|
376
376
|
// A shipped one by id, a drawing contributed by a plugin (T-24), a
|
|
377
377
|
// character read from a file (T-26), or a 3D model.
|
|
@@ -473,11 +473,15 @@ export function AssistantStage({ character, state, size = 88, replay, place, sta
|
|
|
473
473
|
}
|
|
474
474
|
wasHovered.current = hovered;
|
|
475
475
|
}, [hovered]);
|
|
476
|
+
// Opened by a click, with its prompt: it stays until closed.
|
|
477
|
+
const [pinned, setPinned] = useState(false);
|
|
478
|
+
const [promptFocus, setPromptFocus] = useState(0);
|
|
476
479
|
const showBalloon = !aside &&
|
|
477
480
|
!open &&
|
|
478
481
|
!!balloon &&
|
|
479
|
-
|
|
480
|
-
|
|
482
|
+
(pinned ||
|
|
483
|
+
(!(hushed !== null && balloon.text === hushed && !deciding) &&
|
|
484
|
+
(hovered || insist || deciding)));
|
|
481
485
|
// Suggestions while it waits for a question.
|
|
482
486
|
const waitsForQuestion = (state === 'idle' || state === 'greeting') &&
|
|
483
487
|
!balloon?.tool &&
|
|
@@ -664,7 +668,18 @@ export function AssistantStage({ character, state, size = 88, replay, place, sta
|
|
|
664
668
|
if (event.key === 'Escape' && hovered) {
|
|
665
669
|
dispatchHover('escape');
|
|
666
670
|
}
|
|
667
|
-
}, children: [shown && (_jsx(ExpandedVisual, { visual: shown, target: expandTarget, onClose: () => setExpanded(null) })), showBalloon && balloon && (_jsx(BalloonExpandContext.Provider, { value: expand, children: _jsx(SpeechBalloon, { text: balloon.text, more: balloon.more, approval: balloon.approval, onDismissPeek: balloon.onDismiss, display: balloonDisplay, tool: balloon.tool, speaking: balloon.speaking, busy: balloon.busy, attachment: balloon.attachment, history: balloon.history, onExpand: expand ?? undefined, expandTitle: visual?.title,
|
|
671
|
+
}, children: [shown && (_jsx(ExpandedVisual, { visual: shown, target: expandTarget, onClose: () => setExpanded(null) })), showBalloon && balloon && (_jsx(BalloonExpandContext.Provider, { value: expand, children: _jsx(SpeechBalloon, { text: balloon.text, more: balloon.more, approval: balloon.approval, onDismissPeek: balloon.onDismiss, display: balloonDisplay, tool: balloon.tool, speaking: balloon.speaking, busy: balloon.busy, attachment: balloon.attachment, history: balloon.history, onExpand: expand ?? undefined, expandTitle: visual?.title, prompt: prompt
|
|
672
|
+
? {
|
|
673
|
+
...prompt,
|
|
674
|
+
focusKey: promptFocus,
|
|
675
|
+
onClose: () => {
|
|
676
|
+
// Closed as the × closes it: until new words.
|
|
677
|
+
setPinned(false);
|
|
678
|
+
setHushed(balloon.text);
|
|
679
|
+
characterRef.current?.focus();
|
|
680
|
+
},
|
|
681
|
+
}
|
|
682
|
+
: undefined, onExpandHistory: historyVisual
|
|
668
683
|
? () => {
|
|
669
684
|
setExpanded(historyVisual);
|
|
670
685
|
if (expandTarget) {
|
|
@@ -712,6 +727,19 @@ export function AssistantStage({ character, state, size = 88, replay, place, sta
|
|
|
712
727
|
Math.hypot(event.clientX - from.x, event.clientY - from.y) > 4) {
|
|
713
728
|
return;
|
|
714
729
|
}
|
|
730
|
+
if (prompt) {
|
|
731
|
+
// Its balloon, the caret in its prompt; clicked again, put away.
|
|
732
|
+
if (pinned && showBalloon) {
|
|
733
|
+
setPinned(false);
|
|
734
|
+
setHushed(balloon?.text ?? null);
|
|
735
|
+
}
|
|
736
|
+
else {
|
|
737
|
+
setHushed(null);
|
|
738
|
+
setPinned(true);
|
|
739
|
+
setPromptFocus(n => n + 1);
|
|
740
|
+
}
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
715
743
|
(onCharacterClick ?? onToggle)();
|
|
716
744
|
}, display: "block", width: size, height: size, p: 0, border: 0, bg: "transparent", cursor: "grab", filter: "drop-shadow(0 6px 10px rgba(0, 0, 0, 0.18))", active: { cursor: 'grabbing' }, focusVisible: {
|
|
717
745
|
outline: '2px solid',
|
|
@@ -722,7 +750,10 @@ export function AssistantStage({ character, state, size = 88, replay, place, sta
|
|
|
722
750
|
showBalloon &&
|
|
723
751
|
!menuOpen &&
|
|
724
752
|
balloon &&
|
|
725
|
-
state !== 'goodbye' ? (_jsx(Box, { position: "absolute", top: "-6px", right: "-6px", children: _jsx(IconButton, { icon: XIcon, "aria-label": chatText.hideBalloon, size: "small", variant: "invisible", "data-assistant-hide-balloon": "", onClick: () =>
|
|
753
|
+
state !== 'goodbye' ? (_jsx(Box, { position: "absolute", top: "-6px", right: "-6px", children: _jsx(IconButton, { icon: XIcon, "aria-label": chatText.hideBalloon, size: "small", variant: "invisible", "data-assistant-hide-balloon": "", onClick: () => {
|
|
754
|
+
setHushed(balloon.text);
|
|
755
|
+
setPinned(false);
|
|
756
|
+
}, sx: {
|
|
726
757
|
bg: 'canvas.default',
|
|
727
758
|
borderRadius: '50%',
|
|
728
759
|
boxShadow: 'shadow.small',
|
|
@@ -41,7 +41,29 @@ export declare function BalloonSuggestions({ suggestions, onSuggestion, }: {
|
|
|
41
41
|
suggestions: readonly BalloonSuggestion[];
|
|
42
42
|
onSuggestion: (suggestion: BalloonSuggestion) => void;
|
|
43
43
|
}): JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* The balloon's own prompt (13 November 2026): a line to type in, *Send*
|
|
46
|
+
* beside it, Enter sends and Escape closes, whatever the page around it.
|
|
47
|
+
* Disabled with `notReady` as its words while the conversation cannot take
|
|
48
|
+
* a message yet.
|
|
49
|
+
*/
|
|
50
|
+
export type BalloonPromptConfig = {
|
|
51
|
+
/** Its words while empty, and its accessible name. */
|
|
52
|
+
label: string;
|
|
53
|
+
/** The button's word. */
|
|
54
|
+
send: string;
|
|
55
|
+
/** Said in it, disabled, while it cannot take a message yet. */
|
|
56
|
+
notReady?: string;
|
|
57
|
+
onSend: (message: string) => void;
|
|
58
|
+
onClose: () => void;
|
|
59
|
+
/** Changed to put the caret in it: each click on the character. */
|
|
60
|
+
focusKey?: number;
|
|
61
|
+
};
|
|
62
|
+
/** The balloon's own prompt line. */
|
|
63
|
+
export declare function BalloonPrompt({ label, send, notReady, onSend, onClose, focusKey, }: BalloonPromptConfig): JSX.Element;
|
|
44
64
|
export interface SpeechBalloonProps {
|
|
65
|
+
/** Its own prompt line, under everything else. */
|
|
66
|
+
prompt?: BalloonPromptConfig;
|
|
45
67
|
text: string;
|
|
46
68
|
/** There is more than the balloon holds. */
|
|
47
69
|
more?: boolean;
|
|
@@ -131,5 +153,5 @@ export declare function BalloonHistoryLarge({ history, tool, attachment, }: {
|
|
|
131
153
|
tool?: BalloonToolLine;
|
|
132
154
|
attachment?: ReactNode;
|
|
133
155
|
}): JSX.Element;
|
|
134
|
-
export declare function SpeechBalloon({ text, more, onOpen, above, side, align, tailAt, approval, decide, onDecisionActive, wide, onDismissPeek, display, tool, speaking, busy, attachment, history, onExpand, expandTitle, suggestions, onSuggestion, waiting, fullText, onExpandHistory, }: SpeechBalloonProps): JSX.Element;
|
|
156
|
+
export declare function SpeechBalloon({ text, more, onOpen, above, side, align, tailAt, approval, decide, onDecisionActive, wide, onDismissPeek, display, tool, speaking, busy, attachment, history, onExpand, expandTitle, suggestions, onSuggestion, waiting, fullText, onExpandHistory, prompt, }: SpeechBalloonProps): JSX.Element;
|
|
135
157
|
export default SpeechBalloon;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { Button, IconButton, Text } from '@primer/react';
|
|
3
|
+
import { Button, IconButton, Text, TextInput } from '@primer/react';
|
|
4
4
|
import { Box } from '@datalayer/primer-addons';
|
|
5
5
|
import { CheckIcon, CopyIcon, XIcon } from '@primer/octicons-react';
|
|
6
6
|
import { DecisionAsk } from './DecisionAsk.js';
|
|
@@ -14,6 +14,33 @@ export function BalloonSuggestions({ suggestions, onSuggestion, }) {
|
|
|
14
14
|
const chatText = useChatWords();
|
|
15
15
|
return (_jsx(Box, { role: "group", "aria-label": chatText.suggestions, "data-balloon-suggestions": "", display: "flex", flexWrap: "wrap", gap: 1, mt: 2, children: suggestions.map(suggestion => (_jsx(Button, { size: "small", "data-balloon-suggestion": suggestion.label, "aria-label": `Ask: ${suggestion.prompt}`, title: suggestion.prompt, onClick: () => onSuggestion(suggestion), sx: { borderRadius: 999 }, children: suggestion.label }, suggestion.label))) }));
|
|
16
16
|
}
|
|
17
|
+
/** The balloon's own prompt line. */
|
|
18
|
+
export function BalloonPrompt({ label, send, notReady, onSend, onClose, focusKey = 0, }) {
|
|
19
|
+
const [text, setText] = useState('');
|
|
20
|
+
const ref = useRef(null);
|
|
21
|
+
const disabled = Boolean(notReady);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (focusKey > 0 && !disabled) {
|
|
24
|
+
ref.current?.focus();
|
|
25
|
+
}
|
|
26
|
+
}, [focusKey, disabled]);
|
|
27
|
+
const message = text.trim();
|
|
28
|
+
const sendIt = () => {
|
|
29
|
+
if (message && !disabled) {
|
|
30
|
+
onSend(message);
|
|
31
|
+
setText('');
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return (_jsxs(Box, { as: "form", "data-balloon-prompt": "", display: "flex", gap: 1, mt: 2, onSubmit: (event) => {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
sendIt();
|
|
37
|
+
}, onClick: (event) => event.stopPropagation(), children: [_jsx(TextInput, { ref: ref, size: "small", block: true, "aria-label": notReady ?? label, placeholder: notReady ?? label, disabled: disabled, value: text, onChange: event => setText(event.target.value), onKeyDown: (event) => {
|
|
38
|
+
if (event.key === 'Escape') {
|
|
39
|
+
event.stopPropagation();
|
|
40
|
+
onClose();
|
|
41
|
+
}
|
|
42
|
+
}, sx: { flex: 1, minWidth: 0 } }), _jsx(Button, { type: "submit", size: "small", variant: "primary", disabled: disabled || !message, children: send })] }));
|
|
43
|
+
}
|
|
17
44
|
/** How tall the listed conversation grows before it scrolls, in pixels. */
|
|
18
45
|
export const BALLOON_HISTORY_MAX_HEIGHT = 220;
|
|
19
46
|
/** How long the copy icon shows its check, in milliseconds. */
|
|
@@ -60,7 +87,7 @@ function BalloonHistory({ history, onOpen, maxHeight = BALLOON_HISTORY_MAX_HEIGH
|
|
|
60
87
|
}, []);
|
|
61
88
|
return (_jsxs(Box, { "data-balloon-history": "", flex: 1, minWidth: 0, display: "flex", flexDirection: "column", children: [_jsx(Box, { as: "button", type: "button", "data-balloon-peek": "", "data-balloon-header": "", onClick: onOpen, m: 0, p: 0, pb: 1, border: 0, bg: "transparent", font: "inherit", textAlign: "left", cursor: "pointer", fontSize: 0, fontWeight: "semibold", color: "fg.muted", hover: { textDecoration: 'underline' }, children: conversationHeaderText(conversationCount(history), chatText) }), onExpand ? (_jsx(IconButton, { icon: ScreenFullIcon, size: "small", variant: "invisible", "aria-label": chatText.expandConversation, "data-balloon-history-expand": "", onClick: onExpand, sx: { position: 'absolute', top: '4px', right: '28px' } })) : null, _jsx(Box, { ref: listRef, role: "log", "aria-label": chatText.conversation, "data-balloon-history-list": "", maxHeight: maxHeight, overflowY: "auto", display: "flex", flexDirection: "column", pr: 1, children: _jsx(BalloonChatItems, { items: withToolCall(history, tool), waiting: waiting }) })] }));
|
|
62
89
|
}
|
|
63
|
-
export function SpeechBalloon({ text, more = false, onOpen, above, side = 'above', align, tailAt, approval, decide, onDecisionActive, wide = false, onDismissPeek, display = 'history', tool, speaking = false, busy = false, attachment, history, onExpand, expandTitle, suggestions, onSuggestion, waiting = false, fullText, onExpandHistory, }) {
|
|
90
|
+
export function SpeechBalloon({ text, more = false, onOpen, above, side = 'above', align, tailAt, approval, decide, onDecisionActive, wide = false, onDismissPeek, display = 'history', tool, speaking = false, busy = false, attachment, history, onExpand, expandTitle, suggestions, onSuggestion, waiting = false, fullText, onExpandHistory, prompt, }) {
|
|
64
91
|
const chatText = useChatWords();
|
|
65
92
|
// *more*: the words whole, when they were cut or overflow their lines.
|
|
66
93
|
const [whole, setWhole] = useState(false);
|
|
@@ -89,7 +116,7 @@ export function SpeechBalloon({ text, more = false, onOpen, above, side = 'above
|
|
|
89
116
|
const current = display === 'current';
|
|
90
117
|
// History with messages to list: all of them, not the newest line alone.
|
|
91
118
|
const listed = !current && history && history.length > 0 ? history : null;
|
|
92
|
-
return (_jsxs(Box, { "data-speech-balloon": "", "data-balloon-display": display, maxWidth: wide || listed || offered || whole || (current && attachment)
|
|
119
|
+
return (_jsxs(Box, { "data-speech-balloon": "", "data-balloon-display": display, maxWidth: wide || listed || offered || whole || prompt || (current && attachment)
|
|
93
120
|
? 300
|
|
94
121
|
: current
|
|
95
122
|
? 260
|
|
@@ -99,7 +126,12 @@ export function SpeechBalloon({ text, more = false, onOpen, above, side = 'above
|
|
|
99
126
|
bottom: side === 'above' ? `${above}px` : undefined, top: side === 'above' ? undefined : `${above}px`, sx: {
|
|
100
127
|
position: 'absolute',
|
|
101
128
|
[align]: 0,
|
|
102
|
-
width: wide ||
|
|
129
|
+
width: wide ||
|
|
130
|
+
listed ||
|
|
131
|
+
offered ||
|
|
132
|
+
whole ||
|
|
133
|
+
prompt ||
|
|
134
|
+
(current && attachment)
|
|
103
135
|
? 300
|
|
104
136
|
: 'max-content',
|
|
105
137
|
bg: 'canvas.overlay',
|
|
@@ -142,6 +174,6 @@ export function SpeechBalloon({ text, more = false, onOpen, above, side = 'above
|
|
|
142
174
|
_jsx(Box, { flex: 1, minWidth: 0, children: _jsx(BalloonToolCall, { line: tool }) })) : (_jsx(Box, { as: "button", type: "button", "data-balloon-peek": "", "data-balloon-more": more ? '' : undefined, onClick: onOpen, flex: 1, minWidth: 0, m: 0, p: 0, border: 0, bg: "transparent", color: "inherit", font: "inherit", textAlign: "left", cursor: "pointer", hover: { textDecoration: 'underline' }, children: _jsx(Box, { as: "span", role: "status", "aria-live": "polite", children: text }) })), onDismissPeek && !approval ? (_jsx(IconButton, { icon: XIcon, size: "small", variant: "invisible", "aria-label": chatText.dismiss, "data-balloon-dismiss": "", onClick: onDismissPeek, sx: { mt: '-4px', mr: '-8px', flexShrink: 0 } })) : null] }), !approval && !tool && !listed && wholeText.trim() ? (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, mt: 1, "data-balloon-under": "", children: [current && (cut || overflowing || whole) ? (_jsx(Box, { as: "button", type: "button", "aria-expanded": whole, "data-balloon-whole": whole ? 'less' : 'more', onClick: () => setWhole(!whole), m: 0, p: 0, border: 0, bg: "transparent", color: "accent.fg", font: "inherit", fontSize: 0, cursor: "pointer", hover: { textDecoration: 'underline' }, children: whole ? chatText.showLess : chatText.showMore })) : (_jsx("span", {})), _jsx(IconButton, { icon: copied ? CheckIcon : CopyIcon, size: "small", variant: "invisible", "aria-label": chatText.copyWords, "data-balloon-copy": copied ? 'copied' : '', onClick: event => {
|
|
143
175
|
event.stopPropagation();
|
|
144
176
|
void copyWords();
|
|
145
|
-
}, sx: { color: 'fg.muted', mr: '-6px', mb: '-4px' } })] })) : null, !current && !listed && waiting ? (_jsx(Box, { "data-balloon-waiting": "", mt: 1, children: _jsx(BalloonChatItems, { items: [], waiting: true }) })) : null, approval && (_jsxs(Box, { "data-balloon-approval": approval.id, mt: 1, children: [_jsx(Text, { as: "p", sx: { m: 0, fontWeight: 'semibold' }, children: approval.asks }), approval.why ? (_jsx(Text, { as: "p", sx: { m: 0, color: 'fg.muted', fontSize: 0 }, children: approval.why })) : null, _jsxs(Box, { display: "flex", gap: 2, mt: 2, children: [_jsx(Button, { size: "small", variant: "primary", disabled: approval.deciding, onClick: approval.onApprove, children: chatText.approve }), _jsx(Button, { size: "small", disabled: approval.deciding, onClick: approval.onDeny, children: chatText.deny })] }), approval.others > 0 ? (_jsx(Text, { as: "p", sx: { m: 0, mt: 1, color: 'fg.muted', fontSize: 0 }, children: chatText.moreWaiting(approval.others) })) : null] })), offered && onSuggestion ? (_jsx(BalloonSuggestions, { suggestions: offered, onSuggestion: onSuggestion })) : null, attachment ? (_jsxs(Box, { "data-balloon-attachment": "", mt: 2, display: "flex", flexDirection: "column", gap: 1, children: [attachment, onExpand ? (_jsx(BalloonExpandButton, { title: expandTitle ?? chatText.theVisual, onExpand: onExpand })) : null] })) : null, !current ? _jsx(ToolLineAnnouncer, { line: tool }) : null, decide && _jsx(DecisionAsk, { ask: decide, onActiveChange: onDecisionActive })] }));
|
|
177
|
+
}, sx: { color: 'fg.muted', mr: '-6px', mb: '-4px' } })] })) : null, !current && !listed && waiting ? (_jsx(Box, { "data-balloon-waiting": "", mt: 1, children: _jsx(BalloonChatItems, { items: [], waiting: true }) })) : null, approval && (_jsxs(Box, { "data-balloon-approval": approval.id, mt: 1, children: [_jsx(Text, { as: "p", sx: { m: 0, fontWeight: 'semibold' }, children: approval.asks }), approval.why ? (_jsx(Text, { as: "p", sx: { m: 0, color: 'fg.muted', fontSize: 0 }, children: approval.why })) : null, _jsxs(Box, { display: "flex", gap: 2, mt: 2, children: [_jsx(Button, { size: "small", variant: "primary", disabled: approval.deciding, onClick: approval.onApprove, children: chatText.approve }), _jsx(Button, { size: "small", disabled: approval.deciding, onClick: approval.onDeny, children: chatText.deny })] }), approval.others > 0 ? (_jsx(Text, { as: "p", sx: { m: 0, mt: 1, color: 'fg.muted', fontSize: 0 }, children: chatText.moreWaiting(approval.others) })) : null] })), offered && onSuggestion ? (_jsx(BalloonSuggestions, { suggestions: offered, onSuggestion: onSuggestion })) : null, attachment ? (_jsxs(Box, { "data-balloon-attachment": "", mt: 2, display: "flex", flexDirection: "column", gap: 1, children: [attachment, onExpand ? (_jsx(BalloonExpandButton, { title: expandTitle ?? chatText.theVisual, onExpand: onExpand })) : null] })) : null, !current ? _jsx(ToolLineAnnouncer, { line: tool }) : null, decide && _jsx(DecisionAsk, { ask: decide, onActiveChange: onDecisionActive }), prompt ? _jsx(BalloonPrompt, { ...prompt }) : null] }));
|
|
146
178
|
}
|
|
147
179
|
export default SpeechBalloon;
|
|
@@ -13,7 +13,7 @@ const SAMPLE_DOMAIN = 'shop.example';
|
|
|
13
13
|
const sampleCompany = (domain) => ({
|
|
14
14
|
discoveryUrl: `https://${domain}/.well-known/poppy.json`,
|
|
15
15
|
document: parseDiscoveryDocument({
|
|
16
|
-
protocol_version: '0
|
|
16
|
+
protocol_version: '1.0',
|
|
17
17
|
organization: { name: 'Example Shop', domain },
|
|
18
18
|
auth: {
|
|
19
19
|
issuer: `https://auth.${domain}`,
|
|
@@ -37,10 +37,10 @@ const sampleCompany = (domain) => ({
|
|
|
37
37
|
description: 'Read the catalogue',
|
|
38
38
|
},
|
|
39
39
|
],
|
|
40
|
-
// Draft 0
|
|
40
|
+
// Draft 1.0 §3.3: an entry per version it supports; a Session declares the one it implements.
|
|
41
41
|
extensions: { operations: [{ version: '1' }, { version: '2' }] },
|
|
42
42
|
}),
|
|
43
|
-
// Direct and Device are what the issuer's grants say (draft 0
|
|
43
|
+
// Direct and Device are what the issuer's grants say (draft 1.0 §3.2).
|
|
44
44
|
oauthMetadata: parseOAuthServerMetadata({
|
|
45
45
|
issuer: `https://auth.${domain}`,
|
|
46
46
|
token_endpoint: `https://auth.${domain}/token`,
|
|
@@ -81,6 +81,6 @@ const PapCompanyDiscoveryView = () => {
|
|
|
81
81
|
setError(cause instanceof Error ? cause.message : String(cause));
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
return (_jsxs(PapExamplePage, { eyebrow: "PAP \u00B7 Company discovery", title: "Discover capabilities, not credentials", description: "The PAP parser validates the discovery document and the issuer's metadata (draft 0
|
|
84
|
+
return (_jsxs(PapExamplePage, { eyebrow: "PAP \u00B7 Company discovery", title: "Discover capabilities, not credentials", description: "The PAP parser validates the discovery document and the issuer's metadata (draft 1.0); Agent Runtimes then projects them into a model-safe summary: the sign-ins the issuer's grants offer, the company's own scopes with their hints, and the domains its issuer protects. Change the sample domain to see issuer and discovery binding move together.", children: [_jsxs(Box, { display: "flex", flexDirection: "column", gap: 3, p: 3, border: "1px solid", borderColor: "border.default", borderRadius: 2, bg: "canvas.default", children: [_jsx(Text, { as: "label", sx: { fontWeight: 600 }, children: "Company DNS domain" }), _jsxs(Box, { display: "flex", gap: 2, children: [_jsx(TextInput, { block: true, value: domain, "aria-label": "Company DNS domain", onChange: event => setDomain(event.target.value) }), _jsx(Button, { variant: "primary", onClick: () => void inspect(), children: "Validate sample" })] }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "The sample uses an injected Reactor-compatible transport. Production replaces it with DNS-pinned HTTPS discovery." }), error ? _jsx(Text, { sx: { color: 'danger.fg' }, children: error }) : null] }), summary ? (_jsx(PapResult, { title: "Safe company summary", value: summary })) : null] }));
|
|
85
85
|
};
|
|
86
86
|
export default PapCompanyDiscoveryView;
|
|
@@ -28,7 +28,7 @@ const STEPS = [
|
|
|
28
28
|
channel: 'Discovery',
|
|
29
29
|
messages: conversationStart,
|
|
30
30
|
facts: [
|
|
31
|
-
{ label: 'Publishes', value: 'poppy.json · draft 0
|
|
31
|
+
{ label: 'Publishes', value: 'poppy.json · draft 1.0' },
|
|
32
32
|
{ label: 'Returns', value: 'Company conversation agent' },
|
|
33
33
|
{ label: 'Sign-in', value: "Northstar's own page" },
|
|
34
34
|
],
|
|
@@ -38,7 +38,7 @@ const STEPS = [
|
|
|
38
38
|
request: 'Accept: application/json',
|
|
39
39
|
response: `200 OK
|
|
40
40
|
{
|
|
41
|
-
"protocol_version": "0
|
|
41
|
+
"protocol_version": "1.0",
|
|
42
42
|
"organization": { "name": "Northstar Outfitters" },
|
|
43
43
|
"auth": {
|
|
44
44
|
"issuer": "https://auth.northstar.example",
|
|
@@ -70,7 +70,7 @@ const STEPS = [
|
|
|
70
70
|
target: 'https://api.northstar.example/poppy/conversations',
|
|
71
71
|
detailLabel: 'Atlas → company agent',
|
|
72
72
|
request: `Poppy-Session: [fresh JWT, naming the sid, signed with a delegated key]
|
|
73
|
-
Poppy-Version: 0
|
|
73
|
+
Poppy-Version: 1.0
|
|
74
74
|
Content-Type: application/json
|
|
75
75
|
|
|
76
76
|
{
|
|
@@ -143,7 +143,7 @@ Location: https://atlas.example/oauth/callback
|
|
|
143
143
|
detailLabel: 'Atlas ↔ company agent',
|
|
144
144
|
request: `Authorization: Bearer [host-only access token]
|
|
145
145
|
Poppy-Session: [fresh JWT]
|
|
146
|
-
Poppy-Version: 0
|
|
146
|
+
Poppy-Version: 1.0
|
|
147
147
|
Content-Type: application/json
|
|
148
148
|
|
|
149
149
|
{
|
|
@@ -197,7 +197,7 @@ Content-Type: application/json
|
|
|
197
197
|
detailLabel: 'Atlas ↔ company agent',
|
|
198
198
|
request: `Authorization: Bearer [host-only access token]
|
|
199
199
|
Poppy-Session: [fresh JWT]
|
|
200
|
-
Poppy-Version: 0
|
|
200
|
+
Poppy-Version: 1.0
|
|
201
201
|
Content-Type: application/json
|
|
202
202
|
|
|
203
203
|
{
|
|
@@ -248,7 +248,7 @@ const companyReply = (response) => {
|
|
|
248
248
|
*/
|
|
249
249
|
const runJourney = async () => {
|
|
250
250
|
parseDiscoveryDocument({
|
|
251
|
-
protocol_version: '0
|
|
251
|
+
protocol_version: '1.0',
|
|
252
252
|
organization: { name: 'Northstar Outfitters', domain: 'northstar.example' },
|
|
253
253
|
auth: {
|
|
254
254
|
issuer: 'https://auth.northstar.example',
|
|
@@ -266,7 +266,7 @@ const runJourney = async () => {
|
|
|
266
266
|
],
|
|
267
267
|
},
|
|
268
268
|
});
|
|
269
|
-
// Direct Sign-In is what the issuer's grants offer (draft 0
|
|
269
|
+
// Direct Sign-In is what the issuer's grants offer (draft 1.0 §3.2).
|
|
270
270
|
parseOAuthServerMetadata({
|
|
271
271
|
issuer: 'https://auth.northstar.example',
|
|
272
272
|
token_endpoint: 'https://auth.northstar.example/oauth/token',
|
|
@@ -298,7 +298,7 @@ const runJourney = async () => {
|
|
|
298
298
|
headers: { 'content-type': 'application/json' },
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
// The request's id is top-level, the message's own (draft 0
|
|
301
|
+
// The request's id is top-level, the message's own (draft 1.0 §8.3).
|
|
302
302
|
const incoming = JSON.parse(String(init?.body ?? '{}'));
|
|
303
303
|
return new Response(JSON.stringify({
|
|
304
304
|
conversation_id: 'cnv_return',
|
|
@@ -318,7 +318,7 @@ const runJourney = async () => {
|
|
|
318
318
|
],
|
|
319
319
|
cursor: `cursor_${index + 1}`,
|
|
320
320
|
has_more: false,
|
|
321
|
-
// Draft 0
|
|
321
|
+
// Draft 1.0 §8.7: the four state fields.
|
|
322
322
|
working: false,
|
|
323
323
|
handoff: 'none',
|
|
324
324
|
responder: 'agent',
|
|
@@ -8,6 +8,7 @@ import { Box } from '@datalayer/primer-addons';
|
|
|
8
8
|
import { contribution, definePlugin } from '@datalayer/reactor';
|
|
9
9
|
import { Button, Text } from '@primer/react';
|
|
10
10
|
import { DelegatedSessionSigner, InMemoryDelegatedKeys, SecretValue, SessionClient, SessionFetchClient, SessionSigners, buildPapReactor, } from '@datalayer/personal-agent-protocol';
|
|
11
|
+
import { PAP_PROTOCOL_VERSION } from '../../pap/index.js';
|
|
11
12
|
import { PapExamplePage, PapResult } from './PapExamplePage.js';
|
|
12
13
|
/** Exercise the real Session client and retain only safe lifecycle evidence. */
|
|
13
14
|
const PapSessionLifecycleView = () => {
|
|
@@ -54,6 +55,8 @@ const PapSessionLifecycleView = () => {
|
|
|
54
55
|
pairwiseUserId: 'usr_host_only_example',
|
|
55
56
|
issuer: 'https://company.example',
|
|
56
57
|
tenantId: 'example-tenant',
|
|
58
|
+
// The one PAP version Agent Runtimes speaks, named in Poppy-Version.
|
|
59
|
+
protocolVersion: PAP_PROTOCOL_VERSION,
|
|
57
60
|
});
|
|
58
61
|
const requestsToStartASession = calls;
|
|
59
62
|
const sid = session.sid;
|
|
@@ -81,6 +84,6 @@ const PapSessionLifecycleView = () => {
|
|
|
81
84
|
reactor.stop();
|
|
82
85
|
}
|
|
83
86
|
};
|
|
84
|
-
return (_jsxs(PapExamplePage, { eyebrow: "PAP \u00B7 Session", title: "Start and restart a Session without giving credentials to the agent", description: "This Reactor view drives the real PAP SessionClient and SessionFetchClient (draft 0
|
|
87
|
+
return (_jsxs(PapExamplePage, { eyebrow: "PAP \u00B7 Session", title: "Start and restart a Session without giving credentials to the agent", description: "This Reactor view drives the real PAP SessionClient and SessionFetchClient (draft 1.0) against a deterministic company transport. A Session is local: a random sid, and no request. Every request carries a fresh Poppy-Session JWT signed with a delegated key and names its protocol version in Poppy-Version. Answered session_ended, it starts again once, with a new sid and the same User ID. Only lifecycle evidence enters React state.", children: [_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 3, p: 3, border: "1px solid", borderColor: "border.default", borderRadius: 2, bg: "canvas.default", children: [_jsx(Text, { sx: { color: 'fg.muted' }, children: "Exercise start, the Session header and a restart entirely inside this host." }), _jsx(Button, { variant: "primary", onClick: () => void runLifecycle(), children: "Run lifecycle" })] }), error ? _jsx(Text, { sx: { color: 'danger.fg' }, children: error }) : null, summary ? (_jsx(PapResult, { title: "Safe Session evidence", value: summary })) : null] }));
|
|
85
88
|
};
|
|
86
89
|
export default PapSessionLifecycleView;
|