@datalayer/agent-runtimes 1.5.12 → 1.5.14
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/chunks/ChatView-nnI1-MOR.js +32 -0
- package/dist-embed/datalayer-app-main.js +5 -5
- package/lib/apps/apps/records.d.ts +10 -0
- package/lib/apps/apps/records.js +24 -5
- package/lib/apps/plugins/app-activity/AppActivity.js +2 -2
- package/lib/apps/plugins/chat/ChatView.js +3 -2
- package/lib/apps/plugins/pap-sign-in/PapSignInCard.js +5 -1
- package/lib/apps/plugins/pap-sign-in/signIn.d.ts +6 -0
- package/lib/apps/plugins/pap-sign-in/signIn.js +8 -0
- package/lib/components/teams/sceneTranscript.js +3 -2
- package/lib/specs/apps.js +24 -18
- package/package.json +1 -1
- package/dist-embed/chunks/ChatView-DIdw1rtZ.js +0 -32
|
@@ -38,6 +38,16 @@ export type RecordsContext = {
|
|
|
38
38
|
export declare const RECORD_KIND_WORDS: Record<RecordKind, string>;
|
|
39
39
|
/** An entry as ai-agents answers with it. */
|
|
40
40
|
export declare function entryOf(raw: Record<string, unknown>): RecordEntry;
|
|
41
|
+
/**
|
|
42
|
+
* How a run ended, in the `output` entry every run ends with, kept whatever
|
|
43
|
+
* the application's `record.include` says (PAP_DATALAYER R-01): its words
|
|
44
|
+
* only when it keeps `outputs`.
|
|
45
|
+
*/
|
|
46
|
+
export declare const RUN_END_WORDS: Record<string, string>;
|
|
47
|
+
/** How the run an entry ends ended: `answered`, `stopped`, `gone`; `''` for any other entry. */
|
|
48
|
+
export declare function runEndOf(entry: RecordEntry): string;
|
|
49
|
+
/** An entry in words: its summary, or how its run ended when its words are not kept. */
|
|
50
|
+
export declare function entrySaid(entry: RecordEntry): string;
|
|
41
51
|
/** A session in a sentence: how many calls, what stopped it, how it ended. */
|
|
42
52
|
export declare function sessionSentence(entries: readonly RecordEntry[]): string;
|
|
43
53
|
/**
|
package/lib/apps/apps/records.js
CHANGED
|
@@ -30,12 +30,31 @@ export function entryOf(raw) {
|
|
|
30
30
|
createdAt: String(raw.created_at ?? ''),
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* How a run ended, in the `output` entry every run ends with, kept whatever
|
|
35
|
+
* the application's `record.include` says (PAP_DATALAYER R-01): its words
|
|
36
|
+
* only when it keeps `outputs`.
|
|
37
|
+
*/
|
|
38
|
+
export const RUN_END_WORDS = {
|
|
39
|
+
answered: 'Answered',
|
|
40
|
+
stopped: 'Stopped',
|
|
41
|
+
gone: 'Its client went before the answer',
|
|
42
|
+
};
|
|
43
|
+
/** How the run an entry ends ended: `answered`, `stopped`, `gone`; `''` for any other entry. */
|
|
44
|
+
export function runEndOf(entry) {
|
|
45
|
+
const status = entry.kind === 'output' ? entry.payload.status : undefined;
|
|
46
|
+
return typeof status === 'string' && status in RUN_END_WORDS ? status : '';
|
|
47
|
+
}
|
|
48
|
+
/** An entry in words: its summary, or how its run ended when its words are not kept. */
|
|
49
|
+
export function entrySaid(entry) {
|
|
50
|
+
return entry.summary || RUN_END_WORDS[runEndOf(entry)] || '';
|
|
51
|
+
}
|
|
33
52
|
/** A session in a sentence: how many calls, what stopped it, how it ended. */
|
|
34
53
|
export function sessionSentence(entries) {
|
|
35
54
|
const calls = entries.filter(entry => entry.kind === 'tool_call').length;
|
|
36
55
|
const checks = entries.filter(entry => entry.kind === 'check');
|
|
37
|
-
const
|
|
38
|
-
const
|
|
56
|
+
const ends = entries.map(runEndOf).filter(Boolean);
|
|
57
|
+
const answers = ends.filter(end => end === 'answered').length;
|
|
39
58
|
const parts = [
|
|
40
59
|
calls === 0
|
|
41
60
|
? 'No tool called'
|
|
@@ -44,11 +63,11 @@ export function sessionSentence(entries) {
|
|
|
44
63
|
if (checks.length) {
|
|
45
64
|
parts.push(`${checks.length} step${checks.length === 1 ? '' : 's'} a check did not let pass`);
|
|
46
65
|
}
|
|
47
|
-
if (
|
|
66
|
+
if (ends[ends.length - 1] === 'stopped') {
|
|
48
67
|
parts.push('stopped');
|
|
49
68
|
}
|
|
50
|
-
else if (
|
|
51
|
-
parts.push(`${
|
|
69
|
+
else if (answers) {
|
|
70
|
+
parts.push(`${answers} answer${answers === 1 ? '' : 's'}`);
|
|
52
71
|
}
|
|
53
72
|
return `${parts.join(', ')}.`;
|
|
54
73
|
}
|
|
@@ -7,7 +7,7 @@ import { useContributions, useSignalValue } from '@datalayer/reactor/react';
|
|
|
7
7
|
import { useCoreStore } from '@datalayer/core/lib/state';
|
|
8
8
|
import { useIAMStore } from '@datalayer/core/lib/state/substates/IAMState';
|
|
9
9
|
import { LoopChatTurn } from '../../core';
|
|
10
|
-
import { RECORD_KIND_WORDS, listSessions, readSession, sessionSentence, } from '../../apps/records';
|
|
10
|
+
import { RECORD_KIND_WORDS, entrySaid, listSessions, readSession, sessionSentence, } from '../../apps/records';
|
|
11
11
|
/** What the feed says. */
|
|
12
12
|
export const APP_ACTIVITY_WORDS = {
|
|
13
13
|
title: 'Activity',
|
|
@@ -40,7 +40,7 @@ function useRead(load, key, when = true) {
|
|
|
40
40
|
function Session({ context, session, }) {
|
|
41
41
|
const [open, setOpen] = useState(false);
|
|
42
42
|
const entries = useRead(() => readSession(context, session.sessionUid), `${session.sessionUid}:${context.token}`, open);
|
|
43
|
-
return (_jsxs(Box, { as: "details", onToggle: (event) => setOpen(event.currentTarget.open), borderTop: "1px solid", borderColor: "border.muted", py: 2, children: [_jsxs(Box, { as: "summary", cursor: "pointer", fontSize: 1, children: [session.createdAt ? (_jsx(RelativeTime, { datetime: session.createdAt })) : ('A session'), session.version ? ` · version ${session.version}` : '', entries.value ? ` · ${sessionSentence(entries.value)}` : ''] }), !open ? null : entries.loading ? (_jsx(Spinner, { size: "small" })) : entries.error ? (_jsx(Text, { role: "alert", sx: { fontSize: 1 }, children: entries.error })) : (_jsx(Box, { as: "ol", pl: 3, mt: 2, mb: 0, fontSize: 1, children: (entries.value ?? []).map(entry => (_jsxs(Box, { as: "li", mb: 1, children: [_jsx(Label, { sx: { mr: 2 }, children: RECORD_KIND_WORDS[entry.kind] ?? entry.kind }), entry
|
|
43
|
+
return (_jsxs(Box, { as: "details", onToggle: (event) => setOpen(event.currentTarget.open), borderTop: "1px solid", borderColor: "border.muted", py: 2, children: [_jsxs(Box, { as: "summary", cursor: "pointer", fontSize: 1, children: [session.createdAt ? (_jsx(RelativeTime, { datetime: session.createdAt })) : ('A session'), session.version ? ` · version ${session.version}` : '', entries.value ? ` · ${sessionSentence(entries.value)}` : ''] }), !open ? null : entries.loading ? (_jsx(Spinner, { size: "small" })) : entries.error ? (_jsx(Text, { role: "alert", sx: { fontSize: 1 }, children: entries.error })) : (_jsx(Box, { as: "ol", pl: 3, mt: 2, mb: 0, fontSize: 1, children: (entries.value ?? []).map(entry => (_jsxs(Box, { as: "li", mb: 1, children: [_jsx(Label, { sx: { mr: 2 }, children: RECORD_KIND_WORDS[entry.kind] ?? entry.kind }), entrySaid(entry)] }, entry.uid))) }))] }));
|
|
44
44
|
}
|
|
45
45
|
export function AppActivity({ appUid }) {
|
|
46
46
|
const token = useIAMStore(state => state.token) ?? '';
|
|
@@ -1684,6 +1684,7 @@ export default function ChatView({ workspace }) {
|
|
|
1684
1684
|
};
|
|
1685
1685
|
const ComposerComponent = composerEntries[0]?.value.Component;
|
|
1686
1686
|
const HeaderComponent = headerEntries[0]?.value.Component;
|
|
1687
|
+
const headerShown = !config?.hideHeader && !!HeaderComponent;
|
|
1687
1688
|
const prompt = ComposerComponent ? (_jsx(ComposerComponent, { workspace: workspace, composer: composerProps })) : null;
|
|
1688
1689
|
/*
|
|
1689
1690
|
* The parts, named, so a layout can arrange them.
|
|
@@ -1855,7 +1856,7 @@ export default function ChatView({ workspace }) {
|
|
|
1855
1856
|
props through `renderHeader`. No contribution — or a host
|
|
1856
1857
|
that set `hideHeader` — means no bar.
|
|
1857
1858
|
*/
|
|
1858
|
-
showHeader:
|
|
1859
|
+
showHeader: headerShown,
|
|
1859
1860
|
// The `+` and the bin in the title bar, when the host asked for
|
|
1860
1861
|
// them; the header draws whatever `ChatBase` assembles here.
|
|
1861
1862
|
headerButtons: {
|
|
@@ -1978,7 +1979,7 @@ export default function ChatView({ workspace }) {
|
|
|
1978
1979
|
tool did. With an editor open the change is visible where it
|
|
1979
1980
|
happened, and the default tool row is enough.
|
|
1980
1981
|
*/
|
|
1981
|
-
notebookToolSurfacesId: active ? undefined : workspace.surfaceId, showTurnFooter: chatExtras.showTokenUsage ?? config?.showTokenUsage ?? true, onContextSnapshot: handleContextSnapshot, onLoadingChange: handleLoadingChange, onItemsChange: handleMessagesChange, onDisplayItemsChange: handleDisplayItemsChange, enableStreaming: true }, chatThread?.id)) }), besideChat && !promptHidden ? prompt : null] }) }));
|
|
1982
|
+
notebookToolSurfacesId: active ? undefined : workspace.surfaceId, showTurnFooter: chatExtras.showTokenUsage ?? config?.showTokenUsage ?? true, onContextSnapshot: handleContextSnapshot, onLoadingChange: handleLoadingChange, onItemsChange: handleMessagesChange, onDisplayItemsChange: handleDisplayItemsChange, enableStreaming: true }, chatThread?.id)) }), !headerShown && chatHeaderItems.length > 0 ? (_jsx(Box, { hidden: true, children: _jsx(ReactorSlot, { slot: LoopSlots.chatHeader, props: { workspace } }) })) : null, besideChat && !promptHidden ? prompt : null] }) }));
|
|
1982
1983
|
// Off when the host asked for the menu alone: the composer's suggestions
|
|
1983
1984
|
// control carries the same openers (`suggestions` above).
|
|
1984
1985
|
const chipsEl = config?.suggestionLabels !== false && chatSuggestions.length > 0 ? (_jsx(Box, { "aria-label": chatText.suggestedPrompts, display: "flex", flexWrap: "wrap", gap: 2, px: 2, pb: "6px", children: chatSuggestions.map(item => (_jsx(Box, { as: "button", type: "button",
|
|
@@ -24,6 +24,10 @@ export function PapSignInCard({ context, send, }) {
|
|
|
24
24
|
const outcome = signInReturnOf(event.data, company);
|
|
25
25
|
if (outcome) {
|
|
26
26
|
setReturned(outcome);
|
|
27
|
+
// One return per card: a card that heard its sign-in come back (a denial
|
|
28
|
+
// too) leaves the next one at that company to the card that started it,
|
|
29
|
+
// never sending twice into a run under way (found on :3063, 13 October 2026).
|
|
30
|
+
channel.close();
|
|
27
31
|
}
|
|
28
32
|
};
|
|
29
33
|
return () => channel.close();
|
|
@@ -58,7 +62,7 @@ export function PapSignInCard({ context, send, }) {
|
|
|
58
62
|
? PAP_SIGN_IN_WORDS.device
|
|
59
63
|
: read.mode === 'mediated'
|
|
60
64
|
? PAP_SIGN_IN_WORDS.mediated
|
|
61
|
-
: PAP_SIGN_IN_WORDS.direct }), read.sentTo ? (_jsx(Text, { as: "p", sx: { mt: 0, mb: 2, fontSize: 1 }, children: PAP_SIGN_IN_WORDS.sentTo(read.sentTo) })) : null, read.code ? (_jsxs(Box, { display: "flex", gap: 3, alignItems: "center", flexWrap: "wrap", mb: 2, children: [_jsxs(Box, { children: [_jsx(Text, { as: "div", sx: { fontSize: 0, color: 'fg.muted' }, children: PAP_SIGN_IN_WORDS.code }), _jsx(Text, { as: "div", "aria-live": "polite", sx: {
|
|
65
|
+
: PAP_SIGN_IN_WORDS.direct }), read.needs ? (_jsx(Text, { as: "p", sx: { mt: 0, mb: 2, fontSize: 1 }, children: PAP_SIGN_IN_WORDS.needs(read.needs) })) : null, read.sentTo ? (_jsx(Text, { as: "p", sx: { mt: 0, mb: 2, fontSize: 1 }, children: PAP_SIGN_IN_WORDS.sentTo(read.sentTo) })) : null, read.code ? (_jsxs(Box, { display: "flex", gap: 3, alignItems: "center", flexWrap: "wrap", mb: 2, children: [_jsxs(Box, { children: [_jsx(Text, { as: "div", sx: { fontSize: 0, color: 'fg.muted' }, children: PAP_SIGN_IN_WORDS.code }), _jsx(Text, { as: "div", "aria-live": "polite", sx: {
|
|
62
66
|
fontFamily: 'mono',
|
|
63
67
|
fontSize: 5,
|
|
64
68
|
fontWeight: 'bold',
|
|
@@ -31,6 +31,11 @@ export type PapSignInWaiting = {
|
|
|
31
31
|
sentTo?: string;
|
|
32
32
|
/** Until when, ISO 8601. */
|
|
33
33
|
expiresAt?: string;
|
|
34
|
+
/**
|
|
35
|
+
* What the company said it needs (its `authorization` event's scope,
|
|
36
|
+
* PAP_DATALAYER P-02): what the person is asked to allow there.
|
|
37
|
+
*/
|
|
38
|
+
needs?: string[];
|
|
34
39
|
};
|
|
35
40
|
/** What the card says. */
|
|
36
41
|
export declare const PAP_SIGN_IN_WORDS: {
|
|
@@ -41,6 +46,7 @@ export declare const PAP_SIGN_IN_WORDS: {
|
|
|
41
46
|
readonly mediatedTitle: (host: string) => string;
|
|
42
47
|
readonly mediated: "Open this page: it names the company and asks what the company needs. Type it there, never in this conversation.";
|
|
43
48
|
readonly sentTo: (to: string) => string;
|
|
49
|
+
readonly needs: (scopes: string[]) => string;
|
|
44
50
|
readonly open: (host: string) => string;
|
|
45
51
|
readonly code: "Your code";
|
|
46
52
|
readonly copy: "Copy the code";
|
|
@@ -11,6 +11,7 @@ export const PAP_SIGN_IN_WORDS = {
|
|
|
11
11
|
mediatedTitle: (host) => `Sign in through ${host}`,
|
|
12
12
|
mediated: 'Open this page: it names the company and asks what the company needs. Type it there, never in this conversation.',
|
|
13
13
|
sentTo: (to) => `The company sent a code to ${to}.`,
|
|
14
|
+
needs: (scopes) => `It needs: ${scopes.join(', ')}.`,
|
|
14
15
|
open: (host) => `Open ${host}`,
|
|
15
16
|
code: 'Your code',
|
|
16
17
|
copy: 'Copy the code',
|
|
@@ -34,6 +35,8 @@ export const PAP_SIGN_IN_WORDS = {
|
|
|
34
35
|
* person's tab, so the conversation goes on there.
|
|
35
36
|
*/
|
|
36
37
|
export const PAP_SIGN_IN_CHANNEL = 'datalayer-pap-sign-in';
|
|
38
|
+
/** One OAuth scope token (RFC 6749 §3.3). */
|
|
39
|
+
const SCOPE = /^[\x21\x23-\x5B\x5D-\x7E]{1,128}$/;
|
|
37
40
|
const DOMAIN = /^(?=.{1,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/;
|
|
38
41
|
/** What a message on the channel says of this company's sign-in, or `null`: another company's, or not one. */
|
|
39
42
|
export function signInReturnOf(message, company) {
|
|
@@ -122,6 +125,10 @@ export function readPapSignIn(result) {
|
|
|
122
125
|
const company = typeof data.company === 'string' && DOMAIN.test(data.company)
|
|
123
126
|
? data.company
|
|
124
127
|
: '';
|
|
128
|
+
// What the company said it needs: scope tokens only, anything else not shown.
|
|
129
|
+
const needs = Array.isArray(data.needs)
|
|
130
|
+
? data.needs.filter((scope) => typeof scope === 'string' && SCOPE.test(scope))
|
|
131
|
+
: [];
|
|
125
132
|
return {
|
|
126
133
|
mode: data.mode,
|
|
127
134
|
open: url.toString(),
|
|
@@ -136,5 +143,6 @@ export function readPapSignIn(result) {
|
|
|
136
143
|
...(typeof data.expires_at === 'string' && data.expires_at
|
|
137
144
|
? { expiresAt: data.expires_at }
|
|
138
145
|
: {}),
|
|
146
|
+
...(needs.length > 0 ? { needs } : {}),
|
|
139
147
|
};
|
|
140
148
|
}
|
|
@@ -255,8 +255,9 @@ export function transcriptOfRecord(entries, member) {
|
|
|
255
255
|
}
|
|
256
256
|
answered = true;
|
|
257
257
|
}
|
|
258
|
-
else if (entry.kind === 'output' && !answered) {
|
|
259
|
-
// A record kept without its conversations: the answer's summary
|
|
258
|
+
else if (entry.kind === 'output' && !answered && entry.summary) {
|
|
259
|
+
// A record kept without its conversations: the answer's summary —
|
|
260
|
+
// none when it keeps no outputs either, only how the run ended.
|
|
260
261
|
pending.push({
|
|
261
262
|
key: `${entry.uid}:said`,
|
|
262
263
|
at,
|
package/lib/specs/apps.js
CHANGED
|
@@ -1784,7 +1784,7 @@ export const EXCHANGE_DESK_APP_0_0_2 = {
|
|
|
1784
1784
|
"Its exchange_order runs in process in Datalayer's own tests against a stand-in for Manzanita's back office: one exchange per confirmed operation, a retry answered as already done.",
|
|
1785
1785
|
],
|
|
1786
1786
|
unverified: [
|
|
1787
|
-
|
|
1787
|
+
"Drilled on r1 on 13 October 2026, twice: shipped at its own domain, it answered a personal agent signed out, and a person signed in through Datalayer granted orders:read and orders:write. The second time it knew who had signed in, but asked to exchange, it looked for the order first and proposed nothing; it now proposes the exchange at once, and Manzanita checks the order when it is done. Drilled a third time the same evening: signed in, asked to exchange, it said it could not — asked by a person's own agent, it was not given its exchange_order (fixed). Drilled a fourth time the same night, given it: proposing the exchange ended its answer, and the personal agent was told it could not answer just now (fixed, not yet released).",
|
|
1788
1788
|
],
|
|
1789
1789
|
},
|
|
1790
1790
|
},
|
|
@@ -1815,7 +1815,7 @@ export const EXCHANGE_DESK_APP_0_0_2 = {
|
|
|
1815
1815
|
alternatives: [],
|
|
1816
1816
|
},
|
|
1817
1817
|
enabled: false,
|
|
1818
|
-
unavailable_because: '
|
|
1818
|
+
unavailable_because: "Asked by a person's own agent, proposing an exchange ends its answer until a fix is released.",
|
|
1819
1819
|
tags: ['example', 'companies', 'python'],
|
|
1820
1820
|
icon: 'apps',
|
|
1821
1821
|
emoji: '🏪',
|
|
@@ -4048,12 +4048,14 @@ export const RETURNS_DESK_APP_0_0_1 = {
|
|
|
4048
4048
|
},
|
|
4049
4049
|
],
|
|
4050
4050
|
verified: {
|
|
4051
|
-
live: [
|
|
4051
|
+
live: [
|
|
4052
|
+
"Drilled on r1 on 13 October 2026 against the hosted Manzanita, as its Preview reaches the gateway's pap toolset (gateway 0.0.81): signed in by Device Sign-In with orders:read and orders:write; a return asked through the shop's API with pap_propose came back as the shop's operation (Return the Ridge Jacket (M) from order ord_7Hk2 for a refund of USD 180.00), approved by the person on Waiting for you, done once — the test shop's return fails as written, its label emailed and no money moved, which it said — and already confirmed the second time; a repair proposed the same way (a zip repair, free).",
|
|
4053
|
+
],
|
|
4052
4054
|
recorded: [
|
|
4053
4055
|
"The journey is the Personal Agent Protocol SDK's recorded journey operations (Datalayer's protocol examples, personal-agent-protocol 0.16.0), shown as recorded data, not live.",
|
|
4054
4056
|
],
|
|
4055
4057
|
unverified: [
|
|
4056
|
-
'
|
|
4058
|
+
"A model's turns in the Studio's Preview were not watched in that drill.",
|
|
4057
4059
|
],
|
|
4058
4060
|
},
|
|
4059
4061
|
},
|
|
@@ -4083,8 +4085,8 @@ export const RETURNS_DESK_APP_0_0_1 = {
|
|
|
4083
4085
|
documents: [],
|
|
4084
4086
|
alternatives: [],
|
|
4085
4087
|
},
|
|
4086
|
-
enabled:
|
|
4087
|
-
unavailable_because:
|
|
4088
|
+
enabled: true,
|
|
4089
|
+
unavailable_because: '',
|
|
4088
4090
|
tags: ['example', 'companies'],
|
|
4089
4091
|
icon: 'apps',
|
|
4090
4092
|
emoji: '↩️',
|
|
@@ -4564,12 +4566,14 @@ export const SHOP_CONCIERGE_APP_0_0_1 = {
|
|
|
4564
4566
|
},
|
|
4565
4567
|
],
|
|
4566
4568
|
verified: {
|
|
4567
|
-
live: [
|
|
4569
|
+
live: [
|
|
4570
|
+
"Drilled on r1 on 13 October 2026 against the hosted Manzanita (counterparts 0.0.6), as its Preview reaches the gateway's pap toolset: asked signed out, signed in by Device Sign-In with orders:read, the person's latest order answered; asked for one of the shop's people, the conversation went to Marta, of Manzanita's staff (responder human), who answered in it.",
|
|
4571
|
+
],
|
|
4568
4572
|
recorded: [
|
|
4569
4573
|
"The journey is the Personal Agent Protocol SDK's recorded journey conversation-control (Datalayer's protocol examples, personal-agent-protocol 0.16.0), shown as recorded data, not live.",
|
|
4570
4574
|
],
|
|
4571
4575
|
unverified: [
|
|
4572
|
-
"
|
|
4576
|
+
"A model's turns in the Studio's Preview were not watched in that drill; Marta is a scripted member of the test shop's staff.",
|
|
4573
4577
|
],
|
|
4574
4578
|
},
|
|
4575
4579
|
},
|
|
@@ -4599,8 +4603,8 @@ export const SHOP_CONCIERGE_APP_0_0_1 = {
|
|
|
4599
4603
|
documents: [],
|
|
4600
4604
|
alternatives: [],
|
|
4601
4605
|
},
|
|
4602
|
-
enabled:
|
|
4603
|
-
unavailable_because:
|
|
4606
|
+
enabled: true,
|
|
4607
|
+
unavailable_because: '',
|
|
4604
4608
|
tags: ['example', 'companies'],
|
|
4605
4609
|
icon: 'apps',
|
|
4606
4610
|
emoji: '🛎️',
|
|
@@ -7029,7 +7033,7 @@ export const APP_SOURCES = {
|
|
|
7029
7033
|
"Its exchange_order runs in process in Datalayer's own tests against a stand-in for Manzanita's back office: one exchange per confirmed operation, a retry answered as already done.",
|
|
7030
7034
|
],
|
|
7031
7035
|
unverified: [
|
|
7032
|
-
|
|
7036
|
+
"Drilled on r1 on 13 October 2026, twice: shipped at its own domain, it answered a personal agent signed out, and a person signed in through Datalayer granted orders:read and orders:write. The second time it knew who had signed in, but asked to exchange, it looked for the order first and proposed nothing; it now proposes the exchange at once, and Manzanita checks the order when it is done. Drilled a third time the same evening: signed in, asked to exchange, it said it could not — asked by a person's own agent, it was not given its exchange_order (fixed). Drilled a fourth time the same night, given it: proposing the exchange ended its answer, and the personal agent was told it could not answer just now (fixed, not yet released).",
|
|
7033
7037
|
],
|
|
7034
7038
|
},
|
|
7035
7039
|
},
|
|
@@ -7041,7 +7045,7 @@ export const APP_SOURCES = {
|
|
|
7041
7045
|
hosted: {},
|
|
7042
7046
|
},
|
|
7043
7047
|
enabled: false,
|
|
7044
|
-
unavailable_because: '
|
|
7048
|
+
unavailable_because: "Asked by a person's own agent, proposing an exchange ends its answer until a fix is released.",
|
|
7045
7049
|
tags: ['example', 'companies', 'python'],
|
|
7046
7050
|
emoji: '🏪',
|
|
7047
7051
|
},
|
|
@@ -8535,11 +8539,14 @@ export const APP_SOURCES = {
|
|
|
8535
8539
|
},
|
|
8536
8540
|
],
|
|
8537
8541
|
verified: {
|
|
8542
|
+
live: [
|
|
8543
|
+
"Drilled on r1 on 13 October 2026 against the hosted Manzanita, as its Preview reaches the gateway's pap toolset (gateway 0.0.81): signed in by Device Sign-In with orders:read and orders:write; a return asked through the shop's API with pap_propose came back as the shop's operation (Return the Ridge Jacket (M) from order ord_7Hk2 for a refund of USD 180.00), approved by the person on Waiting for you, done once — the test shop's return fails as written, its label emailed and no money moved, which it said — and already confirmed the second time; a repair proposed the same way (a zip repair, free).",
|
|
8544
|
+
],
|
|
8538
8545
|
recorded: [
|
|
8539
8546
|
"The journey is the Personal Agent Protocol SDK's recorded journey operations (Datalayer's protocol examples, personal-agent-protocol 0.16.0), shown as recorded data, not live.",
|
|
8540
8547
|
],
|
|
8541
8548
|
unverified: [
|
|
8542
|
-
'
|
|
8549
|
+
"A model's turns in the Studio's Preview were not watched in that drill.",
|
|
8543
8550
|
],
|
|
8544
8551
|
},
|
|
8545
8552
|
},
|
|
@@ -8550,8 +8557,6 @@ export const APP_SOURCES = {
|
|
|
8550
8557
|
deployment: {
|
|
8551
8558
|
hosted: {},
|
|
8552
8559
|
},
|
|
8553
|
-
enabled: false,
|
|
8554
|
-
unavailable_because: "It asks the test company Manzanita for returns and repairs through its API, which Datalayer's gateway does not reach yet, so neither can be shown live yet.",
|
|
8555
8560
|
tags: ['example', 'companies'],
|
|
8556
8561
|
emoji: '↩️',
|
|
8557
8562
|
},
|
|
@@ -8832,11 +8837,14 @@ export const APP_SOURCES = {
|
|
|
8832
8837
|
},
|
|
8833
8838
|
],
|
|
8834
8839
|
verified: {
|
|
8840
|
+
live: [
|
|
8841
|
+
"Drilled on r1 on 13 October 2026 against the hosted Manzanita (counterparts 0.0.6), as its Preview reaches the gateway's pap toolset: asked signed out, signed in by Device Sign-In with orders:read, the person's latest order answered; asked for one of the shop's people, the conversation went to Marta, of Manzanita's staff (responder human), who answered in it.",
|
|
8842
|
+
],
|
|
8835
8843
|
recorded: [
|
|
8836
8844
|
"The journey is the Personal Agent Protocol SDK's recorded journey conversation-control (Datalayer's protocol examples, personal-agent-protocol 0.16.0), shown as recorded data, not live.",
|
|
8837
8845
|
],
|
|
8838
8846
|
unverified: [
|
|
8839
|
-
"
|
|
8847
|
+
"A model's turns in the Studio's Preview were not watched in that drill; Marta is a scripted member of the test shop's staff.",
|
|
8840
8848
|
],
|
|
8841
8849
|
},
|
|
8842
8850
|
},
|
|
@@ -8847,8 +8855,6 @@ export const APP_SOURCES = {
|
|
|
8847
8855
|
deployment: {
|
|
8848
8856
|
hosted: {},
|
|
8849
8857
|
},
|
|
8850
|
-
enabled: false,
|
|
8851
|
-
unavailable_because: "The test company Manzanita's staff, who take a conversation handed to them, are not on duty at the hosted shop yet, so asking for one of its people cannot be shown live yet.",
|
|
8852
8858
|
tags: ['example', 'companies'],
|
|
8853
8859
|
emoji: '🛎️',
|
|
8854
8860
|
},
|
package/package.json
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import{E as N,eN as ao,r as o,j as t,eO as io,eP as ro,b_ as bn,B as f,H as ct,T as H,c as G,cu as At,eu as Lt,eQ as ae,co as dt,e as lo,eR as co,eS as uo,e3 as fo,eT as po,aH as mo,dX as Tn,dV as go,dY as zt,eU as ho,eV as bo,eW as xo,eX as So,eY as xn,eZ as vo,e_ as yo,e$ as Co,d3 as wo,a_ as ko,f0 as jo,f1 as Eo,f2 as Io,f3 as To,f4 as Ro,f5 as Ao,x as Pt,f6 as Po,f7 as Mo,f8 as $o,f9 as Uo,fa as Oo,fb as Fo,fc as Lo,fd as zo,fe as _o,ff as No,fg as Bo,fh as Vo,fi as Ho,fj as Wo,fk as Do,fl as Go,fm as Ko,fn as Yo,fo as qo,fp as Jo,fq as De,fr as Qo,fs as Xo,ft as Zo,fu as es,fv as Sn,fw as ts,fx as Re,fy as ns,fz as os,a$ as ut,fA as ss,fB as as,fC as vn,fD as is,fE as rs,eC as ls,fF as Mt,fG as Ae,fH as cs,fI as ds,fJ as us,fK as fs,fL as ps,fM as ms,fN as gs,fO as hs,fP as bs,fQ as xs,fR as Ss,fS as vs,fT as $t,fU as ys,fV as Cs,I as ws,fW as ks,fX as js,fY as yn,fZ as Es,f_ as Is,f$ as Ts,g0 as _t,g1 as Rs,g2 as As,ek as Ut,g3 as Ps,g4 as Ms}from"../datalayer-app-main.js";import{S as $s,E as Us,a as Os}from"./SignInIcon-4HkE48mS.js";import{F as Fs,a as Ls,b as zs}from"./LinkedInGreyIcon-BoWXE-HS.js";function Rn(){const n=N(ao);return o.useMemo(()=>n.map(s=>s.value),[n])}const Ot={github:{name:"github",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/github/callback"},google:{name:"google",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/google/callback"},linkedin:{name:"linkedin",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/linkedin/callback"}},Cn=()=>{if(typeof document>"u")return"";const n=document.getElementById("datalayer-config-data");if(!n?.textContent)return"";try{const s=JSON.parse(n.textContent);return String(s?.iamUrl||"").replace(/\/$/,"")}catch{return""}},_s=(n,s="Unable to start social sign-in.")=>{if(n instanceof Error&&n.message)return n.message;if(typeof n=="string"&&n.trim())return n;if(n&&typeof n=="object"&&"message"in n){const c=n.message;if(typeof c=="string"&&c.trim())return c}return s},Ns=po`
|
|
2
|
-
.signin-input-theme-scope input:-webkit-autofill,
|
|
3
|
-
.signin-input-theme-scope input:-webkit-autofill:hover,
|
|
4
|
-
.signin-input-theme-scope input:-webkit-autofill:focus,
|
|
5
|
-
.signin-input-theme-scope input:-webkit-autofill:active,
|
|
6
|
-
.signin-input-theme-scope input:-webkit-autofill:disabled,
|
|
7
|
-
.signin-input-theme-scope textarea:-webkit-autofill,
|
|
8
|
-
.signin-input-theme-scope textarea:-webkit-autofill:hover,
|
|
9
|
-
.signin-input-theme-scope textarea:-webkit-autofill:focus,
|
|
10
|
-
.signin-input-theme-scope textarea:-webkit-autofill:active,
|
|
11
|
-
.signin-input-theme-scope textarea:-webkit-autofill:disabled {
|
|
12
|
-
-webkit-text-fill-color: var(--fgColor-default) !important;
|
|
13
|
-
caret-color: var(--fgColor-default) !important;
|
|
14
|
-
-webkit-box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
15
|
-
box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
16
|
-
background-color: var(--bgColor-default) !important;
|
|
17
|
-
transition: background-color 9999s ease-in-out 0s !important;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.signin-input-theme-scope input:disabled,
|
|
21
|
-
.signin-input-theme-scope textarea:disabled {
|
|
22
|
-
-webkit-text-fill-color: var(--fgColor-muted) !important;
|
|
23
|
-
-webkit-box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
24
|
-
box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
25
|
-
background-color: var(--bgColor-default) !important;
|
|
26
|
-
opacity: 1 !important;
|
|
27
|
-
}
|
|
28
|
-
`,Bs=({onSignIn:n,onApiKeySignIn:s,loginUrl:c,name:a,title:d="Datalayer OTEL",description:b="Sign in to access the observability dashboard.",icon:S,leadingIcon:C=t.jsx(fo,{size:24}),github:p=!1,google:K=!1,linkedin:B=!1,apiKey:Ge=!1,signUp:F=!0,socialSignInNavigationTarget:Z,asDoc:v=!1,fillHeight:I=!0,hideHero:ee=!1,calloutTitle:Pe,calloutDescription:Ke,passwordToggleLabel:ie="Sign in with a password",signUpTitle:Nt="Don't have an account?",signUpDescription:Y="Create a free Datalayer account with your email address.",signUpLabel:ft="Sign up with email",signUpHref:Me="https://datalayer.ai/signup",onSignUp:V,forgotPasswordHref:q="/password",forgotPasswordLabel:$e="Forgot password?",showForgotPassword:pt=!0,socialButtonMarginTop:x=3,actionButtonMaxWidth:J=320})=>{const te=v&&!ee,Ye=a??(v&&d==="Datalayer OTEL"?"Datalayer Sign In":d),mt=S??(v?t.jsx($s,{size:24}):C),L=o.useMemo(()=>{if(c)return c;const i=Cn();return i?`${i}/api/iam/v1/login`:"/api/iam/v1/login"},[c]),[W,Se]=o.useState(""),[re,gt]=o.useState(""),[qe,le]=o.useState(!1),[ce,Je]=o.useState(!1),[k,ve]=o.useState(!1),[de,ye]=o.useState(!1),[Ue,Qe]=o.useState(null),[z,Ce]=o.useState(null),[ne,Xe]=o.useState(""),[ue,Ze]=o.useState(null),[Oe,M]=o.useState(null),{enqueueToast:fe}=io(),[pe,E]=o.useState(!1),[Q,oe]=o.useState(""),D=o.useRef(null),Fe=o.useCallback(i=>ro()?bn.URLExt.join(bn.PageConfig.getBaseUrl(),i.oauth2CallbackServerRoute):`${window.location.protocol}//${window.location.hostname}${window.location.port?`:${window.location.port}`:""}${i.oauth2CallbackUIRoute}`,[]),me=o.useMemo(()=>{if(typeof window>"u")return"/";const i=`${window.location.pathname}${window.location.search}${window.location.hash}`;return i.startsWith("/")?i:"/"},[]),we=o.useCallback(async i=>{if(!de){M(null),Qe(i.name),ye(!0);try{const g=Cn(),m=new URLSearchParams({provider:i.name,callback_uri:Fe(i)}),R=Z===void 0?void 0:String(Z||"").trim(),y=R===void 0?me&&me!=="/"?me:void 0:R&&R.startsWith("/")&&!R.startsWith("//")?R:void 0;y&&m.set("post_auth_redirect",y);const ze=`${g||""}/api/iam/v1/oauth2/authz/url?${m.toString()}`,j=await fetch(ze),se=await j.json(),_e=se?.autorization_url;if(!j.ok||!_e)throw new Error(se?.message||"Unable to start social sign-in.");window.location.assign(_e)}catch(g){const m=_s(g);M(m),fe(m,{variant:"error"}),Qe(null),ye(!1)}}},[Fe,me,fe,de,Z]);o.useEffect(()=>{pe&&D.current?.focus()},[pe]);const $=o.useCallback(()=>{E(!1),oe("")},[]),ht=o.useCallback(()=>{!Q.trim()||!s||(s(Q.trim()),$())},[Q,s,$]),bt=o.useCallback(()=>{if(V){V();return}window.location.assign(Me)},[V,Me]),xt=o.useCallback(()=>{if(q){if(q.startsWith("http://")||q.startsWith("https://")){window.open(q,"_blank","noopener,noreferrer");return}window.location.assign(q)}},[q]),Le=o.useCallback(async()=>{if(!(v||!W||!re||k)){ve(!0),M(null);try{const i=await fetch(L,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({handle:W,password:re})});if(!i.ok)throw new Error(`HTTP ${i.status}`);const g=await i.json();if(g.success&&g.token){const m=String(g?.user?.id||g?.user?.uid||"").trim();if(!!g?.user?.mfaUrl&&m){Ce(m),Ze(g.token),M(null);return}n&&n(g.token,W)}else M(g.message||"Invalid username or password.")}catch(i){M(i instanceof Error?i.message:String(i))}finally{ve(!1)}}},[v,W,re,k,L,n]),ge=o.useCallback(async()=>{if(!(v||k||!z||!ne.trim()||!ue)){ve(!0),M(null);try{const i=new URL(L,window.location.origin),g=i.pathname.endsWith("/api/iam/v1/login")?i.href.replace(/\/api\/iam\/v1\/login$/,""):`${i.origin}`,m=await fetch(`${g}/api/iam/v1/users/${z}/mfa/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userUid:z,code:ne.trim()})}),R=await m.json();if(!m.ok||!R?.success)throw new Error(R?.message||"Failed to validate your MFA code.");n&&n(ue,W)}catch(i){const g=i instanceof Error?i.message:String(i);M(g),fe(g,{variant:"error"})}finally{ve(!1)}}},[v,fe,W,k,L,ne,ue,z,n]),ke=o.useCallback(i=>{i.key==="Enter"&&(z?ge():Le())},[z,Le,ge]),he=de||k||v;return t.jsxs(f,{className:"signin-input-theme-scope",display:"flex",alignItems:ee||te||!I?"flex-start":"center",justifyContent:"center",minHeight:ee||te||!I?"auto":"100vh",bg:ee?"transparent":"canvas.default",color:"fg.default",py:ee?0:te?2:4,children:[t.jsx(Ns,{}),t.jsxs(f,{width:"100%",maxWidth:440,p:0,children:[!ee&&t.jsxs(t.Fragment,{children:[t.jsxs(f,{display:"flex",alignItems:"center",gap:2,mb:te?2:3,justifyContent:"center",children:[mt,t.jsx(ct,{sx:{fontSize:3},children:Ye})]}),t.jsx(H,{as:"p",sx:{fontSize:1,color:"fg.muted",mb:te?2:3,textAlign:"center"},children:b})]}),(Pe||Ke)&&t.jsxs(f,{mb:3,textAlign:"center",children:[Pe&&t.jsx(ct,{as:"h3",sx:{fontSize:2,mb:1},children:Pe}),Ke&&t.jsx(H,{sx:{color:"fg.muted",fontSize:1},children:Ke})]}),!z&&(p||K||B)&&t.jsxs(t.Fragment,{children:[p&&t.jsx(G,{block:!0,size:"large",leadingVisual:Ue==="github"?()=>t.jsx(At,{size:"small"}):Fs,disabled:he,onClick:()=>we(Ot.github),sx:{mt:x,maxWidth:J,mx:"auto"},children:"Sign in with GitHub"}),K&&t.jsx(G,{block:!0,size:"large",leadingVisual:Ue==="google"?()=>t.jsx(At,{size:"small"}):Ls,disabled:he,onClick:()=>we(Ot.google),sx:{mt:x,maxWidth:J,mx:"auto"},children:"Sign in with Google"}),B&&t.jsx(G,{block:!0,size:"large",leadingVisual:Ue==="linkedin"?()=>t.jsx(At,{size:"small"}):zs,disabled:he,onClick:()=>we(Ot.linkedin),sx:{mt:x,maxWidth:J,mx:"auto"},children:"Sign in with LinkedIn"})]}),!z&&!qe&&t.jsx(f,{mt:3,display:"flex",justifyContent:"center",children:t.jsx(G,{leadingVisual:Lt,size:"large",block:!0,disabled:v||k||de,onClick:()=>le(!0),sx:{maxWidth:J,mx:"auto"},children:ie})}),!z&&qe&&t.jsxs(f,{mt:4,children:[t.jsxs(ae,{required:!0,sx:{mb:3},children:[t.jsx(ae.Label,{children:"Username"}),t.jsx(dt,{autoFocus:!0,block:!0,placeholder:"Your username",value:W,disabled:k||v,onChange:i=>Se(i.target.value),onKeyDown:ke})]}),t.jsxs(ae,{required:!0,sx:{mb:3},children:[t.jsx(ae.Label,{children:"Password"}),t.jsx(dt,{block:!0,placeholder:"Your password",type:ce?"text":"password",value:re,disabled:k||v,onChange:i=>gt(i.target.value),onKeyDown:ke,trailingAction:t.jsx(dt.Action,{onClick:()=>Je(!ce),disabled:k||v,icon:ce?Us:Os,"aria-label":ce?"Hide password":"Show password",sx:{color:"var(--fgColor-muted)"}})})]}),t.jsxs(f,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:3,children:[t.jsx(G,{variant:"primary",disabled:k||v||!W||!re,onClick:Le,children:k?"Signing in…":"Sign In"}),pt&&t.jsx(lo,{as:"button",sx:{fontSize:1,cursor:v?"not-allowed":"pointer",background:"none",border:"none",opacity:v?.6:1},onClick:()=>{v||k||xt()},children:$e})]})]}),z&&t.jsxs(t.Fragment,{children:[t.jsxs(ae,{required:!0,sx:{mb:3,mt:2},children:[t.jsx(ae.Label,{children:"MFA Code"}),t.jsx(dt,{autoFocus:!0,block:!0,placeholder:"Your MFA code",value:ne,disabled:k||v,onChange:i=>Xe(i.target.value),onKeyDown:ke})]}),t.jsx(G,{variant:"primary",block:!0,disabled:k||v||!ne.trim(),onClick:ge,sx:{maxWidth:J,mx:"auto"},children:k?"Validating…":"Validate MFA Code"})]}),Oe&&t.jsx(H,{sx:{color:"danger.fg",fontSize:1,mt:3,display:"block"},children:Oe}),F&&t.jsxs(f,{mt:4,pt:4,textAlign:"center",borderTop:"1px solid",borderColor:"border.muted",children:[t.jsx(ct,{as:"h3",sx:{fontSize:2,mb:2},children:Nt}),t.jsx(H,{as:"p",sx:{color:"fg.muted",fontSize:1,mb:3},children:Y}),t.jsx(f,{display:"flex",justifyContent:"center",children:t.jsx(G,{variant:"primary",size:"large",leadingVisual:co,disabled:v||k,onClick:bt,children:ft})})]}),Ge&&s&&t.jsxs(t.Fragment,{children:[t.jsxs(f,{display:"flex",alignItems:"center",gap:2,my:3,children:[t.jsx(f,{flex:1,height:"1px",bg:"border.default"}),t.jsx(H,{sx:{fontSize:0,color:"fg.muted"},children:"or"}),t.jsx(f,{flex:1,height:"1px",bg:"border.default"})]}),t.jsx(G,{block:!0,leadingVisual:Lt,disabled:v||k||de,onClick:()=>E(!0),sx:{maxWidth:J,mx:"auto"},children:"Sign in with an API Key"}),pe&&t.jsx(f,{role:"dialog","aria-modal":"true","aria-labelledby":"signin-api-key-title",onKeyDown:i=>{i.key==="Escape"&&$()},onClick:$,position:"fixed",inset:0,zIndex:200,p:3,bg:"canvas.backdrop",display:"flex",alignItems:"center",justifyContent:"center",children:t.jsxs(f,{as:"form",onClick:i=>i.stopPropagation(),onSubmit:i=>{i.preventDefault(),ht()},width:"min(560px, 100%)",p:3,borderRadius:2,border:"1px solid",borderColor:"border.default",bg:"canvas.overlay",color:"fg.default",boxShadow:"shadow.large",children:[t.jsx(ct,{id:"signin-api-key-title",sx:{fontSize:2,mb:2},children:"Enter your API Key"}),t.jsxs(ae,{required:!0,children:[t.jsx(ae.Label,{children:"API Key"}),t.jsx(uo,{block:!0,required:!0,autoFocus:!0,placeholder:"Paste your API key here",value:Q,onInput:i=>oe(i.currentTarget.value),ref:D})]}),t.jsxs(f,{mt:3,display:"flex",justifyContent:"flex-end",gap:2,children:[t.jsx(G,{type:"button",onClick:$,children:"Cancel"}),t.jsx(G,{type:"submit",variant:"primary",disabled:!Q.trim(),children:"Authenticate"})]})]})})]})]})]})};function Vs(n){const{agentId:s,instructions:c,model:a,frontendTools:d,inference:b,subagents:S,sharing:C,onSubagentEvent:p,modeEffect:K}=n;return{type:"browser-vercel-ai",endpoint:"",agentId:s,enableConfigQuery:!1,options:{instructions:c,model:a,frontendTools:d,inference:b,subagents:S,sharing:C,onSubagentEvent:p,modeEffect:K}}}const wn=mo((n,s)=>({pending:void 0,suggest:(c,a)=>{const d=c.trim();d&&n({pending:{text:d,submit:a?.submit??!1,nonce:(s().pending?.nonce??0)+1}})},consume:()=>n({pending:void 0})}));function Hs({agentName:n,sandboxStillRuns:s=!1,temporary:c=!0,onSignedIn:a,onSignUp:d}){const{configuration:b}=Tn(),S=o.useCallback(C=>{go.getState().checkIAMToken(C),a?.()},[a]);return t.jsx(f,{height:"100%",minHeight:0,overflowY:"auto",bg:"canvas.default",px:4,py:4,children:t.jsxs(f,{maxWidth:440,mx:"auto",children:[t.jsxs(f,{display:"flex",alignItems:"center",justifyContent:"center",gap:2,color:"attention.fg",mb:2,children:[t.jsx(Lt,{size:20}),t.jsx(H,{sx:{fontSize:2,fontWeight:"semibold",color:"fg.default"},children:c?"This demo runs on a shared key":"Your key has expired"})]}),t.jsxs(H,{as:"p",sx:{fontSize:1,color:"fg.muted",textAlign:"center",mb:3},children:[c?`${n??"The agent"} has used the time this key allows. Sign in to point your own agent at it, use your own data, and drop the time limit.`:`${n??"The agent"} stopped because your session ran out.`,s?" Your notebook is still running in this page.":""]}),t.jsx(Bs,{hideHero:!0,fillHeight:!1,calloutTitle:"Sign in to keep going",github:!0,google:!0,linkedin:!0,socialSignInNavigationTarget:typeof window>"u"?void 0:`${window.location.pathname}${window.location.search}`,loginUrl:b?.iamUrl?`${b.iamUrl}/api/iam/v1/login`:void 0,onSignIn:S,onSignUp:d})]})})}const Ws="https://r1.datalayer.run";function Ds(n=!0){const{configuration:s}=Tn(),c=zt(C=>C.token),a=s?.aiInferenceUrl||Ws,d=ho(a,n&&!c),b=c||d.token,S=o.useMemo(()=>({inferenceUrl:a,token:b||void 0}),[a,b]);return{inference:S,needsSignIn:bo(S),anonymous:d,inferenceUrl:a}}const Gs={name:"general-purpose",description:"A capable generalist for a task none of the specialists covers: research, reasoning, drafting, checking.",instructions:"You are a capable general-purpose assistant. Carry out the task you are given completely and report the result plainly, saying what you could not do."};function kn(n){const s=n?.subagents;if(!s)return[];const c=(s.subagents??[]).map(a=>{const d=a.ref?xo(a.ref):void 0;return{name:a.name,description:a.description||d?.description||a.name,instructions:a.instructions??d?.systemPrompt,model:a.model??d?.model??s.defaultModel,icon:d?.icon}});return s.includeGeneralPurpose?[...c,Gs]:c}function Ks(n){return n.replace(/^datalayer_/,"").replace(/_lexical$/,"")}function Ys(n){const s=Ks(n);return/^executeCodeIn(Notebook|Document)$/.test(s)||/^(read|list)[A-Z]/.test(s)}function qs(n,s){return n.filter(c=>s?.has(c.name)||Ys(c.name))}function Js(n,s){const c=a=>s&&a.value.id===`${s}-tools`?0:a.value.id==="notebook-tools"?1:2;return n.map((a,d)=>({entry:a,index:d,rank:c(a)})).sort((a,d)=>a.rank-d.rank||a.index-d.index).map(a=>a.entry)}function Qs(n,s,c){if(!c||!n.endsWith("-tools"))return!1;const a=n.slice(0,-6);return s.has(a)&&a!==c}const Xs={type:"object",properties:{}};function Zs(n,s){const c=new Set(n.toolset);return n.commands.filter(a=>c.has(a.name)).map(a=>({name:a.name,description:a.description,parameters:a.parameters??Xs,location:"frontend",handler:async d=>{if(!s)throw new Error(`${a.name}: the ${n.plugin??n.id} plugin is not mounted on this page.`);const b=Object.keys(d??{}).length>0?d:void 0,S=await s.executeCommand(a.command,b);return S===void 0?{ok:!0,command:a.command,argument:b}:S}}))}function An(n,s){return n.flatMap(c=>Zs(c,s))}function ea(){const n=So(),s=Rn();return o.useMemo(()=>An(s,n),[s,n])}const jn={opening:"Opening your conversation…",notOpened:n=>`Your conversation could not be opened, so this is a new one: ${n}`};function ta(n){let s;for(const c of n.split(/\r?\n\r?\n/)){const a=c.split(/\r?\n/).filter(d=>d.startsWith("data:")).map(d=>d.slice(5).trim()).join("");if(a)try{const d=JSON.parse(a);d.type==="MESSAGES_SNAPSHOT"&&Array.isArray(d.messages)&&(s=d.messages)}catch{}}return s}async function En(n){try{const s=await n.json();if(typeof s.detail=="string"&&s.detail)return s.detail}catch{}return`${n.status}`}async function na({agentBaseUrl:n,agentId:s,uid:c,token:a,fetcher:d=fetch}){const b=`${n.replace(/\/+$/,"")}/api/v1/apps/sessions/${encodeURIComponent(c)}`,S=a?{Authorization:`Bearer ${a}`}:{},C=await d(`${b}/messages`,{headers:S});if(C.ok){const B=await C.json();return xn(B.messages)}if(C.status!==404)throw new Error(await En(C));const p=await d(`${b}/resume`,{method:"POST",headers:{"Content-Type":"application/json",...S},body:JSON.stringify({agent:s})});if(!p.ok)throw new Error(await En(p));const K=ta(await p.text());if(!K)throw new Error(`The runtime said nothing of session ${c}.`);return xn(K)}const oa="var(--theme-accent)";function Pn({face:n,size:s}){return typeof n=="string"?t.jsx(vo,{emoji:n,size:s,label:""}):t.jsx(t.Fragment,{children:n})}function sa({face:n,size:s,state:c}){const a=c==="thinking"||c==="working",d=c==="paused";return t.jsxs(f,{as:"span","aria-hidden":!0,"data-presence":c,position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:s+8,height:s+8,flexShrink:0,fontSize:s,lineHeight:1,children:[t.jsx(f,{as:"span",position:"absolute",inset:0,borderRadius:"50%",boxShadow:d?"none":`0 0 0 2px ${oa}`,border:d?"2px dashed":"none",borderColor:"border.default",opacity:a||c==="waiting"||d?.9:0,transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",animation:a?"loopPresenceBreath 1.8s ease-in-out infinite":"none",reducedMotion:{animation:"none"},sx:{"@keyframes loopPresenceBreath":{"0%, 100%":{transform:"scale(0.92)",opacity:.35},"50%":{transform:"scale(1.06)",opacity:.9}}}}),t.jsx(f,{as:"span",display:"inline-flex",opacity:d?.55:1,filter:d?"grayscale(0.6)":"none",transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",children:t.jsx(Pn,{face:n,size:s})})]})}function aa({state:n}){return t.jsx(H,{role:"status","aria-live":"polite","data-presence-line":n,sx:{fontSize:0,color:n==="waiting"?"fg.default":"fg.muted",fontWeight:n==="waiting"?"semibold":"normal",whiteSpace:"nowrap",flexShrink:0},children:yo[n]})}const ia=_t(void 0),ra=_t(""),la=_t({}),X="",ca=1400,In=parseInt(Ps["--loop-face-large"],10);function ma({workspace:n}){const s=Co(),c=wo(),a=o.useRef(null),{setViewControls:d}=n,[b,S]=o.useState(null),C=ko(),p=C.getConfig(jo),K=p?.placeholder||s.placeholder,B=p?.defaultSurface??"notebook",Ge=C.getConfig(Eo),[F,Z]=o.useState(X),v=o.useRef(!1),I=N(Io),ee=N(To),Pe=N(Ro),ie=N(Ao)[0]?.value,Y=Pt(ie?.promptStance??ia)??ie?.prompt,ft=N(Po),Me=Mo(ft[0]?.value),V=o.useRef(Me);V.current=Me;const q=o.useRef(""),$e=N($o),pt=o.useMemo(()=>Uo(()=>$e.reduce((e,r)=>({...e,...r.value.extras.value}),{})),[$e]),x=Pt($e.length>0?pt:la),J=o.useRef(new Set),te=Oo(Rs,n),Ye=!te.allowed,mt=Ye?te.reason??"Chat is unavailable for this sandbox":void 0,[L,W]=o.useState(!1),[Se,re]=o.useState(!1),[gt,qe]=o.useState({open:!1,pendingApproval:!1}),le=Fo(L,gt,p?.presence?.paused===!0),ce=p?.presence?.onPresence;o.useEffect(()=>{ce?.(le),V.current?.setPresence(le)},[ce,le]);const Je=o.useRef(p?.presence?.onSaying);Je.current=p?.presence?.onSaying;const k=o.useRef({answering:!1}),ve=o.useCallback(e=>{a.current=e,re(!!e)},[]),de=o.useCallback(e=>{const{open:r,pendingApproval:l}=Lo(e);qe(xe=>xe.open===r&&xe.pendingApproval===l?xe:{open:r,pendingApproval:l});const h={saying:_o(e),answering:zo(e)},u=k.current;(u.saying?.id!==h.saying?.id||u.saying?.text!==h.saying?.text||u.answering!==h.answering)&&(k.current=h,Je.current?.(h));const O=V.current;if(!O)return;O.items(e);const P=new Set(["complete","completed","done","error","failed","cancelled","canceled","rejected","denied","stopped"]),A={insertcell:"adding a cell",updatecell:"editing a cell",runcell:"running a cell",deletecells:"removing cells",readallcells:"reading the notebook",readcell:"reading a cell",executecode:"running code",insertblock:"adding a block",updateblock:"editing a block",runblock:"running a block",readdocument:"reading the document"};let w;for(let xe=e.length-1;xe>=0;xe-=1){const lt=e[xe];if(typeof lt.toolName=="string"&<.toolCallId){P.has(String(lt.status).toLowerCase())||(w=lt);break}}if(!w){O.activity(void 0);return}const Rt=w.toolName.toLowerCase().replace(/^datalayer_/,"").replace(/_lexical$/,"").replace(/[^a-z]/g,""),so=A[Rt]??`using ${w.toolName}`;O.activity(`${q.current||"The agent"} is ${so}…`)},[]),ye=o.useRef(x);ye.current=x;const Ue=o.useCallback(e=>{Bn(e),V.current?.usage(e),ye.current.onUsage?.(e)},[]),Qe=o.useCallback(e=>{W(e),e||V.current?.end("done")},[]),z=o.useCallback(e=>{const r=V.current;if(!r)return;let l=-1;for(let u=e.length-1;u>=0;u-=1)if(e[u].role==="user"){l=u;break}const h=e.slice(l+1).filter(u=>u.role==="assistant").map(No).filter(u=>u.trim().length>0).join(`
|
|
29
|
-
|
|
30
|
-
`);r.assistant(h)},[]),Ce=o.useRef([]),ne=o.useRef(!1),Xe=o.useRef(void 0),ue=o.useRef(void 0),Ze=N(Bo),Oe=o.useRef(Ze);Oe.current=Ze;const M=o.useCallback((e,r)=>{if(ue.current)return ue.current;const l=Vo(Oe.current.map(O=>O.value),r),h=l?.loop;if(ne.current&&h?.files&&h.files.length>0){const O=Xe.current;if(!O)return"A file is given to an application running on a runtime: run it on Datalayer or on your machine to give it one.";let P;try{P=h.files.map(A=>({file:Wo(String(A.name??"")),base64:Ho(String(A.data_url??""))}))}catch(A){return A instanceof Error?A.message:String(A)}O.execute(Do(P)).then(A=>{if(!A.success){S(`The files could not be put in the sandbox: ${A.error??"it failed"}.`);return}M(`${e}
|
|
31
|
-
|
|
32
|
-
${Go(P.map(w=>w.file))}`,{...l,loop:Object.fromEntries(Object.entries(h).filter(([w])=>w!=="files"))})});return}V.current?.begin(e,a.current?.thread());const u=a.current?.send;if(!u){Ce.current.push([e,l]);return}u(e,l)},[]);o.useEffect(()=>{d(Se?{busy:L,stop:a.current?.stop,newChat:a.current?.newChat,send:M}:null)},[L,Se,d,M]),o.useEffect(()=>()=>d(null),[d]),o.useEffect(()=>n.prompts.subscribe(M),[n.prompts,M]),o.useEffect(()=>{if(!Se||Ce.current.length===0)return;const e=Ce.current.splice(0,Ce.current.length);for(const[r,l]of e)a.current?.send(r,l)},[Se]);const fe=o.useRef(!1),pe=o.useCallback(async e=>{S(null);const r=await Ko(ye.current,e);if(r){r.sent?ot(""):S(r.refused);return}fe.current||(fe.current=!0,Ge?.firstPromptHook?.());const l=await n.submit(e);if(!l.handled){S(l.reason??null);return}ot(""),l.result?.content&&S(l.result.content)},[n,Ge?.firstPromptHook]),E=o.useMemo(()=>I.find(e=>e.value.surfaceId===F)?.value,[I,F]),Q=o.useCallback(e=>{v.current=!0,Z(e)},[]);o.useEffect(()=>Yo(Q),[Q]),o.useEffect(()=>{qo(I.map(e=>e.value.surfaceId))},[I]),o.useEffect(()=>{Jo(F&&F!==X?F:Ms)},[F]);const oe=o.useMemo(()=>B===X||B==="none"?void 0:I.find(e=>e.value.surfaceId===B),[I,B]);o.useEffect(()=>{v.current||!oe||De(oe.value,n)&&Z(B)},[oe,n,B]);const[D,Fe]=o.useState(null),me=o.useRef(null),we=p?.fullScreenTopOffset??0,{fullScreen:$,usingApi:ht,toggle:bt,topOffsetPx:xt}=Qo(me,{forceOverlay:!!we,topOffset:we}),[Le,ge]=o.useState(!1),ke=o.useRef(!1);o.useEffect(()=>{!L||ke.current||$||(ke.current=!0,ge(!0))},[L,$]),o.useEffect(()=>{$&&ge(!1)},[$]),o.useEffect(()=>{E&&!De(E,n)&&(Fe(E.surfaceId),Z(X))},[E,n]);const he=o.useMemo(()=>{if(D)return I.find(e=>e.value.surfaceId===D)?.value;if(!v.current&&F===X)return oe?.value},[I,D,F,oe]);o.useEffect(()=>{if(!D||F!==X)return;const e=I.find(r=>r.value.surfaceId===D);e&&De(e.value,n)&&(Fe(null),Z(D))},[I,F,D,n]);const i=n.agentId?.trim()||"default",g=Xo(n.sandbox.target??"local");ne.current=g;const m=Zo(),R=Pt(m?.selected??ra),y=m?.members.find(e=>e.id===R),St=N(es)[0]?.value,ze=St?.specId,j=Sn(y?.specId??i)??(ze?Sn(ze):void 0),se=y?void 0:St,_e=g&&!y?Ts(ze,j):void 0;q.current=y?.name??j?.name??i;const Bt=N(ts),Vt=x.hiddenOpeners,Ht=x.hideOpeners,vt=x.openers,yt=o.useMemo(()=>{if(Ht)return[];const e=new Set(Vt??[]),r=w=>e.size===0?w:w.filter(Rt=>!e.has(Rt.text));if(vt)return r(vt);const l=Bt.flatMap(w=>w.value.suggestions);if(l.length>0)return r(l);const h=r(j?.suggestions??[]),u=r(m?.team.suggestions??[]);if(u.length===0)return h;const O=new Set(u.map(w=>w.text)),P=m?.team.name??"Team",A=y?.name??j?.name??i;return[...u.map(w=>({...w,group:P})),...h.filter(w=>!O.has(w.text)).map(w=>({...w,group:A}))]},[Bt,m,j,y,i,Vt,Ht,vt]),et=o.useMemo(()=>yt.map(e=>({title:e.summary??e.text,message:e.message??e.text,group:e.group})),[yt]),Ct=Re(j?.icon),_=p?.presence,Mn=Re(m?.team.icon),Wt=N(ns),tt=o.useMemo(()=>{const e=[],r=new Map,l=new Set,h=new Set(I.map(u=>u.value.surfaceId));for(const u of Js(Wt,E?.surfaceId)){if(Qs(u.value.id,h,E?.surfaceId))continue;let O;try{O=u.value.tools(n)}catch(P){console.warn(`[loop] frontend tools from '${u.plugin}' failed:`,P);continue}for(const P of O){const A=r.get(P.name);if(A){console.warn(`[loop] frontend tool '${P.name}' from '${u.plugin}' is shadowed by the one from '${A}'.`);continue}r.set(P.name,u.plugin),e.push(P),u.value.chatView&&l.add(P.name)}}for(const u of x.frontendTools??[])r.has(u.name)||(r.set(u.name,"chat-extras"),e.push(u),l.add(u.name));return E?e:qs(e,l)},[Wt,n.surfaceId,n.agentId,x.frontendTools,E?.surfaceId,I]),wt=ea(),Ne=o.useMemo(()=>{if(wt.length===0)return tt;const e=new Set(tt.map(r=>r.name));return[...tt,...wt.filter(r=>!e.has(r.name))]},[tt,wt]),Dt=Rn(),kt=x.agentToolBundles,$n=o.useMemo(()=>{const e=x.frontendTools??[];if(!kt?.length)return x.frontendTools;const r=An(Dt.filter(h=>kt.includes(h.id)),C),l=new Set(e.map(h=>h.name));return[...e,...r.filter(h=>!l.has(h.name))]},[x.frontendTools,kt,Dt,C]);Xe.current=g&&Ne.some(e=>e.name===os)?C.getOutput(ut)?.sandbox:void 0;const T=ss(n.sandbox,n.serverUrl),Gt=N(as),Un=o.useMemo(()=>Gt.filter(e=>e.value.composer).map(e=>({name:e.value.name,description:e.value.description})),[Gt]),On=o.useMemo(()=>{if(!m||!y)return kn(j).map(l=>({name:l.name,description:l.description,icon:Re(l.icon)}));const e=m.members.map(l=>({name:l.name,description:l.description,emoji:l.emoji,icon:Re(l.icon),disabled:l.id===y.id,disabledReason:l.id===y.id?`You are already talking to ${l.name}`:void 0})),r=vn(m.team,y.id).filter(l=>!m.members.some(h=>h.name===l.name)).map(l=>({name:l.name,description:l.description,icon:Re(l.icon)}));return[...e,...r]},[m,y,j]),{inference:Kt,anonymous:Fn}=Ds(g),Ln=zt(e=>e.user),jt=g&&Fn.status==="expired",Yt=!Ln,Be=is();ue.current=Be.disabled?Be.disableReason||"This conversation is closed here.":void 0;const Et=T===void 0?rs(n.sandbox,s):void 0,nt=Ye||jt||!!_e||!!Et||Be.disabled,qt=jt?Yt?s.demoKeyExpired:s.keyExpired:_e??Et??mt??(Be.disabled?Be.disableReason:void 0),[Jt,ot]=o.useState(""),[zn,Qt]=o.useState(),st=zn??se?.model??j?.model??n.model??"",je=ls(),Xt=o.useRef(je),Zt=o.useRef(R),en=o.useRef(je);en.current=je,o.useEffect(()=>{Zt.current!==R&&(Zt.current=R,Xt.current=en.current,Qt(void 0))},[R]);const _n=je&&je!==Xt.current?je:null,[Nn,Bn]=o.useState(),Vn=_n??Nn??null,Hn=Mt(Ae.inpromptMenu),Wn=Mt(Ae.promptAction),Dn=Mt(Ae.chatHeader),Gn=o.useMemo(()=>m?.members.map(e=>({id:e.id,name:e.name,description:e.description,icon:Re(e.icon)}))??[],[m]),be=wn(e=>e.pending),[tn,Kn]=o.useState(0);o.useEffect(()=>cs(()=>Kn(e=>e+1)),[]),o.useEffect(()=>{be&&(ot(be.text),wn.getState().consume(),be.submit&&pe(be.text))},[be]);const Ee=!!(se?.createPayload?.app_spec||C.getConfig(ut)?.datalayerCreatePayload?.app_spec),Yn=zt(e=>e.token),nn=C.getConfig(ut)?.datalayerVisitors,qn=ds(nn),Jn=C.getConfig(ut)?.embedToken,Ve=nn?qn.token:Jn||Yn,U=p?.thread,[Ie,on]=o.useState(null),Qn=!!(U?.fromRuntime&&Ie?.given!==U.id);o.useEffect(()=>{if(!U?.fromRuntime||!Ee||!T)return;let e=!0;return(async()=>{let r="";for(let l=0;l<4&&e;l+=1)try{const h=await na({agentBaseUrl:T,agentId:i,uid:U.id,token:Ve});e&&on({given:U.id,thread:{...U,fromRuntime:!1,messages:h}});return}catch(h){r=h instanceof Error?h.message:String(h),await new Promise(u=>setTimeout(u,1500))}e&&on({given:U.id,thread:{id:us(),messages:[],onStarted:U.onStarted},said:jn.notOpened(r)})})(),()=>{e=!1}},[U?.id,U?.fromRuntime,Ee,T,i,Ve]);const sn=U?.fromRuntime?Ie?.given===U.id?Ie.thread:void 0:U,It=o.useMemo(()=>g?Vs({agentId:y?.specId??i,instructions:fs(j,se?.instructions),model:st||void 0,inference:Kt,frontendTools:Ne,subagents:m&&y?vn(m.team,y.id):kn(j),sharing:m?.sharing,onSubagentEvent:e=>As.getState().appendSubagentEvent(e),modeEffect:se?.modeEffect}):T!==void 0?{type:"ag-ui",endpoint:Ee?`${T}/api/v1/apps/agents/${encodeURIComponent(i)}/ag-ui/`:`${T}/api/v1/ag-ui/${i}/`,...Ee&&Ve?{authToken:Ve}:{},...Ee?{uiSocket:`${T.replace(/^http/,"ws")}/api/v1/apps/ui`,uiFiles:`${T}/api/v1/apps/agents/${encodeURIComponent(i)}/files`}:{},agentId:i,configEndpoint:`${T}/api/v1/configure`,enableConfigQuery:!0}:void 0,[i,g,Kt,y,Ne,m,j,se,st,T,Ee,Ve]),at=ps(!g,It?.type==="ag-ui"?It.configEndpoint:void 0,void 0,i),He=ms(),it=gs(i),[an,rn]=o.useState(void 0),[Xn,Zn]=o.useState(void 0);o.useEffect(()=>{if(g||T===void 0)return;let e=!1;return fetch(`${T}/api/v1/configure/models?agent_id=${encodeURIComponent(i)}`).then(r=>r.ok?r.json():null).then(r=>{e||(rn(r?hs(r):[]),Zn(r?bs(r):void 0))}).catch(()=>{e||rn([])}),()=>{e=!0}},[T,i,g]);const eo=o.useMemo(()=>xs(an,()=>Object.values(Ss).filter(e=>e.available&&vs(e)).map(e=>({id:e.id,name:e.name,provider:e.provider}))),[an]),ln=o.useMemo(()=>{const e=at.data?.builtinTools??[],r=new Set(e.map(l=>l.name));return{runtime:e,frontend:Ne.filter(l=>!r.has(l.name)).map(l=>({id:l.name,name:l.name}))}},[at.data?.builtinTools,Ne]),cn=o.useMemo(()=>new Set((He.data?.skills??[]).filter(e=>e.status==="enabled"||e.status==="loaded").map(e=>e.id)),[He.data]),to=o.useCallback(async e=>{Qt(e),!(g||T===void 0)&&await fetch(`${T}/api/v1/configure/inference/provider`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({model:e})}).catch(()=>{})},[T,g]),dn=p?.promptPlacement==="bottom-chat",no=p?.promptPlacement==="floating",Te=p?.promptPlacement==="top",We=p?.hidePrompt===!0||x.hidePrompt===!0,oo={onSend:()=>{pe(Jt)},input:Jt,setInput:ot,focusTrigger:be||tn?(be?.nonce??0)+tn:void 0,placement:no||Y==="floating"||Y==="floating-top"||Y==="floating-bottom"?"floating":"docked",floatingAnchor:Y==="floating-top"?"top":"bottom",isLoading:L,onStop:()=>n.viewControls.stop?.(),placeholder:qt??x.sendInstead?.says??K,typingSuggestions:yt.map(e=>e.text),suggestions:et,disableInputPrompt:nt,connectionConfirmed:!nt,padding:Te||Y==="floating-top"||Y==="floating-bottom"||Y==="docked-top"?2:3,promptVariant:"lexical",autoFocus:p?.autoFocusPrompt??!0,mentionableAgents:On,promptCommands:Un,headerContent:Hn.length>0?t.jsx($t,{slot:Ae.inpromptMenu,props:{workspace:n}}):void 0,footerExtras:Wn.length>0?t.jsx($t,{slot:Ae.promptAction,props:{workspace:n}}):void 0,showAgentsMenu:!_,showInlineAgentsMenu:!1,agents:Gn,selectedAgentId:R,onSelectAgent:e=>m?.select(e),showTokenUsage:x.showTokenUsage??p?.showTokenUsage??!0,showContextRing:!0,agentUsage:Vn??void 0,showModelSelector:!_,models:eo,decisions:Xn,selectedModel:st,onModelSelect:e=>{to(e)},showToolsMenu:!_,availableTools:ln.runtime,availableFrontendTools:ln.frontend,mcpServers:at.data?.mcpServers??[],mcpStatusData:x.mcpStatusData??void 0,showSkillsMenu:!_,skills:He.data?.skills??[],skillsLoading:He.isLoading,enabledSkills:cn,onToggleSkill:e=>cn.has(e)?it.disableSkill(e):it.enableSkill(e),onToggleAllSkills:(e,r)=>e.forEach(l=>r?it.enableSkill(l):it.disableSkill(l)),codemodeEnabled:x.codemodeEnabled??!1,onToggleCodemode:x.onToggleCodemode,isA2AProtocol:!1,hasConfigData:!!at.data,hasSkillsData:!!He.data},un=ee[0]?.value.Component,Tt=Pe[0]?.value.Component,rt=un?t.jsx(un,{workspace:n,composer:oo}):null,fn=I.length>0&&p?.showSurfaceSelector!==!1?t.jsx(da,{surfaces:I.map(e=>e.value),active:E?.surfaceId??he?.surfaceId??X,onChange:Q,workspace:n}):null,pn=t.jsxs(t.Fragment,{children:[I.map(e=>{const r=e.value,l=E?.surfaceId===r.surfaceId;return l||J.current.has(r.surfaceId)||De(r,n)?(J.current.add(r.surfaceId),t.jsx(f,{sx:l?{flex:"1 1 0",minWidth:0,minHeight:0}:{position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",zIndex:-1},children:t.jsx(ys,{load:r.load,props:{surfaceId:r.surfaceId,workspace:n},fallback:t.jsxs(Ft,{children:["Loading ",r.title,"…"]}),errorFallback:u=>t.jsxs(Ft,{children:[r.title," failed to load: ",u.message]})})},r.surfaceId)):null}),!E&&he?t.jsx(f,{flex:"1 1 0",minWidth:0,minHeight:0,children:t.jsxs(Ft,{children:["Starting ",he.title,"…"]})}):null]}),mn=t.jsx(t.Fragment,{children:t.jsxs(f,{flex:Te&&E?"0 0 34%":"1 1 0",maxWidth:Te&&E?460:void 0,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",borderLeft:E?"1px solid":void 0,borderColor:"border.default",position:"relative",children:[x.errorBanner?t.jsx(f,{flexShrink:0,px:3,py:2,fontSize:1,borderBottom:"1px solid",bg:x.errorBanner.variant==="warning"?"attention.subtle":"danger.subtle",color:x.errorBanner.variant==="warning"?"attention.fg":"danger.fg",borderColor:x.errorBanner.variant==="warning"?"attention.muted":"danger.muted",children:x.errorBanner.message}):null,Ie?.said&&Ie.given===U?.id?t.jsx(H,{as:"p",role:"status",sx:{m:0,px:3,py:2,fontSize:1,color:"fg.muted"},children:Ie.said}):null,t.jsx(f,{flex:"1 1 auto",minHeight:0,display:"flex",children:Qn?t.jsx(H,{as:"p",role:"status",sx:{m:0,p:3,fontSize:1,color:"fg.muted"},children:jn.opening}):t.jsx(Cs,{themeVariant:p?.themeVariant,themeOverrides:p?.themeOverrides,colorMode:p?.colorMode,thread:sn,disabled:nt,disableReason:qt,protocol:It,frontendTools:g?void 0:$n,initialModel:st||void 0,title:_?.name??y?.name??j?.name??i,description:_?.welcome??j?.description,brandIcon:_?.face?t.jsx(sa,{face:_.face,size:20,state:le}):t.jsx(Ct,{size:20}),headerContent:_&&!Et?t.jsx(aa,{state:le}):void 0,emptyState:{icon:_?.face?t.jsx("span",{"aria-hidden":!0,style:{fontSize:In,lineHeight:1},children:t.jsx(Pn,{face:_.face,size:In})}):t.jsx(Ct,{size:48}),title:_?.name??y?.name??j?.name??i,...m&&y?{sections:[{group:m.team.name,icon:t.jsx(Mn,{size:48}),title:m.team.name,subtitle:m.team.description},{group:y.name,icon:t.jsx(Ct,{size:32}),title:y.name,subtitle:j?.description}]}:null},suggestions:Te||ie||p?.suggestionLabels===!1?[]:et,showHeader:!p?.hideHeader&&!!Tt,headerButtons:{showNewChat:p?.headerButtons?.newChat??!1,showClear:p?.headerButtons?.clear??!1},renderHeader:Tt?e=>t.jsx(Tt,{workspace:n,header:n.chatViewModes?{...e,chatViewMode:n.chatViewModes.value,onChatViewModeChange:n.chatViewModes.onChange,offeredViewModes:n.chatViewModes.offered}:e}):void 0,showInformation:!0,headerActions:t.jsxs(f,{display:"inline-flex",alignItems:"center",gap:2,children:[n.chatHeaderActions,Dn.length>0?t.jsx($t,{slot:Ae.chatHeader,props:{workspace:n}}):null,t.jsx(ws,{icon:$?ks:js,"aria-label":$?"Exit full screen":"Enter full screen",variant:"invisible",size:"small",onClick:()=>{ge(!1),bt()},sx:Le?{"@keyframes dla-fullscreen-hint":{"0%, 100%":{opacity:1},"50%":{opacity:.4}},"&&":{bg:`color-mix(in srgb, ${c.primary} 16%, transparent)`,boxShadow:`inset 0 0 0 1.5px ${c.primary}`,animation:`dla-fullscreen-hint ${ca}ms ease-in-out infinite`},"@media (prefers-reduced-motion: reduce)":{"&&":{animation:"none"}}}:void 0})]}),showInput:!1,onSendReady:ve,notebookToolSurfacesId:E?void 0:n.surfaceId,showTurnFooter:x.showTokenUsage??p?.showTokenUsage??!0,onContextSnapshot:Ue,onLoadingChange:Qe,onItemsChange:z,onDisplayItemsChange:de,enableStreaming:!0},sn?.id)}),dn&&!We?rt:null]})}),gn=p?.suggestionLabels!==!1&&et.length>0?t.jsx(f,{"aria-label":s.suggestedPrompts,display:"flex",flexWrap:"wrap",gap:2,px:2,pb:"6px",children:et.map(e=>t.jsx(f,{as:"button",type:"button",title:e.message,disabled:L||nt,onClick:()=>{pe(e.message)},appearance:"none",font:"inherit",fontSize:0,fontWeight:"semibold",lineHeight:1.25,px:"10px",py:"5px",width:yn,flex:`0 0 ${yn}px`,borderRadius:"999px",border:"1px solid",bg:"canvas.subtle",whiteSpace:"nowrap",sx:{borderColor:"border.default",color:"fg.default",cursor:"pointer","&:hover:not(:disabled)":{borderColor:"accent.fg",color:"accent.fg"},"&:disabled":{opacity:.5,cursor:"default"}},children:t.jsx(Es,{title:e.title,maxWidth:"100%",sx:{minWidth:0},children:e.title})},e.title))}):null,hn=b?t.jsx(f,{flex:"0 0 auto",px:3,py:2,borderTop:"1px solid",borderColor:"border.default",bg:"canvas.subtle",fontSize:1,maxHeight:"40%",overflowY:"auto",children:b}):null;return t.jsxs(f,{ref:me,sx:{height:"100%",minHeight:0,display:"flex",flexDirection:"column",position:"relative",...$?{bg:"canvas.default"}:null,...$&&!ht.current?{position:"fixed",top:xt,right:0,bottom:0,left:0,height:"auto",zIndex:1e3}:null},children:[ie?t.jsx(ie.Component,{workspace:n,editors:pn,hasEditor:!!E,transcript:mn,prompt:We?null:rt,chips:We?null:gn,picker:fn,transient:hn}):t.jsxs(t.Fragment,{children:[Te&&!We?t.jsxs(f,{flex:"0 0 auto",borderBottom:"1px solid",borderColor:"border.default",children:[rt,gn]}):null,fn,t.jsxs(f,{flex:"1 1 auto",minHeight:0,display:"flex",position:"relative",children:[pn,mn]}),hn,dn||We||Te?null:rt]}),jt?t.jsx(f,{position:"absolute",inset:0,zIndex:5,bg:"canvas.default",display:"flex",flexDirection:"column",minHeight:0,children:t.jsx(Hs,{agentName:y?.name??j?.name,sandboxStillRuns:g,temporary:Yt,onSignedIn:()=>Is.getState().clear()})}):null]})}function da({surfaces:n,active:s,onChange:c,workspace:a}){const d=[...n].sort((b,S)=>(b.order??100)-(S.order??100));return t.jsxs(f,{flex:"0 0 auto",display:"flex",alignItems:"center",gap:2,px:3,py:2,borderBottom:"1px solid",borderColor:"border.default",children:[t.jsx(H,{sx:{fontSize:0,color:"fg.muted"},children:"Beside the chat"}),t.jsxs(Ut,{"aria-label":"Editor beside the chat",size:"small",children:[t.jsx(Ut.Button,{selected:s===X,onClick:()=>c(X),children:"Chat"}),d.map(b=>{const S=De(b,a),C=S?void 0:b.unavailableReason?.(a)??"Not available right now";return t.jsx(Ut.Button,{selected:s===b.surfaceId,"aria-disabled":!S,title:C??b.title,leadingIcon:b.icon,onClick:()=>{S&&c(b.surfaceId)},children:b.title},b.surfaceId)})]})]})}function Ft({children:n}){return t.jsx(f,{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"fg.muted",fontSize:1,px:3,textAlign:"center",children:n})}export{ma as default};
|