@agimon-ai/po-team 0.0.0-alpha.73 → 0.0.0-alpha.75
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/extensions/native.mjs +1029 -115
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +5 -2
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +5 -2
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +113 -33
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/teamSnapshot.d.mts.map +1 -1
- package/package.json +10 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createApiClient, defineActivityGroup, defineApiRoutes, defineChannelFile, defineFill, defineNativePlugin, defineSessionStore, defineSlot, nativeApiTransport, sessionApiAddress } from "@agimon-ai/po-core/native";
|
|
2
|
-
import { AgentAvatar, ArrowRightIcon, Badge, Button, ChevronDownIcon, Dot, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, Input, KebabIcon, ListRow, LiveDuration, Panel, STATUS_EDGE, SegmentedControl, SendIcon, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, StatusBadge, Textarea, UsersIcon, fontOf } from "@agimon-ai/po-native-components";
|
|
1
|
+
import { createApiClient, defineActivityGroup, defineApiRoutes, defineChannelFile, defineFill, defineNativePlugin, defineSessionStore, defineSlot, defineToolRenderer, nativeApiTransport, sessionApiAddress } from "@agimon-ai/po-core/native";
|
|
2
|
+
import { AgentAvatar, ArrowRightIcon, Badge, Button, ChevronDownIcon, Dot, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, Input, KebabIcon, ListRow, LiveDuration, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, Panel, STATUS_EDGE, SegmentedControl, SendIcon, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, StatusBadge, Textarea, UsersIcon, fontOf, toolTone } from "@agimon-ai/po-native-components";
|
|
3
3
|
import { createElement, useCallback, useEffect, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { View } from "react-native-unistyles/components/native/View";
|
|
5
5
|
import { Text } from "react-native-unistyles/components/native/Text";
|
|
@@ -41,14 +41,14 @@ const api = createApiClient(routes, {
|
|
|
41
41
|
transport: nativeApiTransport,
|
|
42
42
|
sessionAddress: sessionApiAddress
|
|
43
43
|
});
|
|
44
|
-
function isRecord$
|
|
44
|
+
function isRecord$3(value) {
|
|
45
45
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
46
46
|
}
|
|
47
47
|
function isStrings(value) {
|
|
48
48
|
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
49
49
|
}
|
|
50
50
|
function isAgent(value) {
|
|
51
|
-
return isRecord$
|
|
51
|
+
return isRecord$3(value) && typeof value.name === "string" && typeof value.description === "string" && typeof value.filePath === "string" && [
|
|
52
52
|
"project",
|
|
53
53
|
"user",
|
|
54
54
|
"plugin"
|
|
@@ -58,8 +58,8 @@ function isAgent(value) {
|
|
|
58
58
|
async function fetchCatalog(sessionId, signal) {
|
|
59
59
|
const response = await api.session(sessionId).catalog({ signal });
|
|
60
60
|
const body = response.data;
|
|
61
|
-
if (!response.ok) throw new Error(isRecord$
|
|
62
|
-
if (!isRecord$
|
|
61
|
+
if (!response.ok) throw new Error(isRecord$3(body) && typeof body.error === "string" ? body.error : `Agent catalog could not be loaded (${response.status}).`);
|
|
62
|
+
if (!isRecord$3(body) || typeof body.cwd !== "string" || !Array.isArray(body.agents) || !body.agents.every(isAgent) || !isStrings(body.models)) throw new Error("The server returned an invalid agent catalog.");
|
|
63
63
|
return {
|
|
64
64
|
cwd: body.cwd,
|
|
65
65
|
agents: body.agents,
|
|
@@ -70,8 +70,8 @@ async function fetchCatalog(sessionId, signal) {
|
|
|
70
70
|
async function launchAgent(sessionId, request) {
|
|
71
71
|
const response = await api.session(sessionId).run({ body: request });
|
|
72
72
|
const body = response.data;
|
|
73
|
-
if (!response.ok) throw new Error(isRecord$
|
|
74
|
-
if (!isRecord$
|
|
73
|
+
if (!response.ok) throw new Error(isRecord$3(body) && typeof body.error === "string" ? body.error : `Agent could not be launched (${response.status}).`);
|
|
74
|
+
if (!isRecord$3(body) || typeof body.runId !== "string" || body.runId === "") throw new Error("The server returned an invalid run ID.");
|
|
75
75
|
return body.runId;
|
|
76
76
|
}
|
|
77
77
|
function isSteerState(value) {
|
|
@@ -84,8 +84,8 @@ async function steerRun(sessionId, runId, message) {
|
|
|
84
84
|
message
|
|
85
85
|
} });
|
|
86
86
|
const body = response.data;
|
|
87
|
-
if (!response.ok) throw new Error(isRecord$
|
|
88
|
-
if (!isRecord$
|
|
87
|
+
if (!response.ok) throw new Error(isRecord$3(body) && typeof body.error === "string" ? body.error : `Guidance could not be sent (${response.status}).`);
|
|
88
|
+
if (!isRecord$3(body) || !isSteerState(body.state) || typeof body.message !== "string") throw new Error("The server returned an invalid steer result.");
|
|
89
89
|
return {
|
|
90
90
|
state: body.state,
|
|
91
91
|
message: body.message
|
|
@@ -95,7 +95,7 @@ async function steerRun(sessionId, runId, message) {
|
|
|
95
95
|
async function stopRun(sessionId, runId) {
|
|
96
96
|
const response = await api.session(sessionId).stop({ body: { runId } });
|
|
97
97
|
const body = response.data;
|
|
98
|
-
if (!response.ok) throw new Error(isRecord$
|
|
98
|
+
if (!response.ok) throw new Error(isRecord$3(body) && typeof body.error === "string" ? body.error : `The run could not be stopped (${response.status}).`);
|
|
99
99
|
}
|
|
100
100
|
//#endregion
|
|
101
101
|
//#region src/types/webSubagents.ts
|
|
@@ -117,7 +117,7 @@ const catalog = defineSessionStore({
|
|
|
117
117
|
inspected: void 0,
|
|
118
118
|
launch: void 0
|
|
119
119
|
});
|
|
120
|
-
function isRecord$
|
|
120
|
+
function isRecord$2(value) {
|
|
121
121
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
122
122
|
}
|
|
123
123
|
function openCatalog(sessionId, task = "") {
|
|
@@ -171,11 +171,11 @@ function loadCatalog(sessionId) {
|
|
|
171
171
|
const subagentCatalogChannel = catalog.channel({
|
|
172
172
|
channel: SUBAGENT_CATALOG_TYPE,
|
|
173
173
|
parse(input) {
|
|
174
|
-
if (!isRecord$
|
|
174
|
+
if (!isRecord$2(input) || typeof input.cwd !== "string" || !Array.isArray(input.agents)) return null;
|
|
175
175
|
const models = Array.isArray(input.models) ? input.models.filter((m) => typeof m === "string") : [];
|
|
176
176
|
return {
|
|
177
177
|
cwd: input.cwd,
|
|
178
|
-
agents: input.agents.filter(isRecord$
|
|
178
|
+
agents: input.agents.filter(isRecord$2),
|
|
179
179
|
models,
|
|
180
180
|
...typeof input.warning === "string" ? { warning: input.warning } : {}
|
|
181
181
|
};
|
|
@@ -292,7 +292,7 @@ const subagents = defineSessionStore({
|
|
|
292
292
|
pendingLaunch: void 0,
|
|
293
293
|
autoOpenRunId: void 0
|
|
294
294
|
});
|
|
295
|
-
function isRecord(value) {
|
|
295
|
+
function isRecord$1(value) {
|
|
296
296
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
297
297
|
}
|
|
298
298
|
function without(list, runId) {
|
|
@@ -368,8 +368,8 @@ function openRun(sessionId, runId) {
|
|
|
368
368
|
const subagentRunsChannel = subagents.channel({
|
|
369
369
|
channel: SUBAGENT_RUNS_TYPE,
|
|
370
370
|
parse(input) {
|
|
371
|
-
if (!isRecord(input) || !Array.isArray(input.runs)) return null;
|
|
372
|
-
return { runs: input.runs.filter(isRecord) };
|
|
371
|
+
if (!isRecord$1(input) || !Array.isArray(input.runs)) return null;
|
|
372
|
+
return { runs: input.runs.filter(isRecord$1) };
|
|
373
373
|
},
|
|
374
374
|
reduce(current, { runs }) {
|
|
375
375
|
const present = new Map(runs.map((run) => [run.runId, run]));
|
|
@@ -448,7 +448,7 @@ function RunActions({ item, stopping, initiallyOpen, onAction }) {
|
|
|
448
448
|
children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
449
449
|
variant: "ghost",
|
|
450
450
|
size: "icon",
|
|
451
|
-
style: styles$
|
|
451
|
+
style: styles$4.menu,
|
|
452
452
|
testID: `compact-run-menu-${item.runId}`,
|
|
453
453
|
accessibilityLabel: `Actions for ${agentRunLabel(item)}`,
|
|
454
454
|
children: /* @__PURE__ */ jsx(KebabIcon, { size: 14 })
|
|
@@ -480,16 +480,16 @@ function CompactRun({ now, item, stopping, menuRunId, stopError, onAction }) {
|
|
|
480
480
|
const summary = item.promptWithheld ? "Prompt withheld: this task was marked sensitive." : firstLine(item.error ?? item.summary ?? item.task) || "No prompt recorded";
|
|
481
481
|
return /* @__PURE__ */ jsxs(Panel, {
|
|
482
482
|
testID: `compact-run-${item.runId}`,
|
|
483
|
-
style: styles$
|
|
483
|
+
style: styles$4.card(STATUS_EDGE[badge.tone]),
|
|
484
484
|
children: [/* @__PURE__ */ jsxs(Pressable, {
|
|
485
485
|
accessibilityRole: "button",
|
|
486
486
|
accessibilityLabel: `Open ${who.name}'s conversation`,
|
|
487
487
|
testID: `compact-run-open-${item.runId}`,
|
|
488
488
|
onPress: () => onAction("thread", item),
|
|
489
|
-
style: styles$
|
|
489
|
+
style: styles$4.open,
|
|
490
490
|
children: [
|
|
491
491
|
/* @__PURE__ */ jsxs(View, {
|
|
492
|
-
style: styles$
|
|
492
|
+
style: styles$4.rowHead,
|
|
493
493
|
children: [
|
|
494
494
|
/* @__PURE__ */ jsx(AgentAvatar, {
|
|
495
495
|
name: who.name,
|
|
@@ -497,16 +497,16 @@ function CompactRun({ now, item, stopping, menuRunId, stopError, onAction }) {
|
|
|
497
497
|
size: "sm"
|
|
498
498
|
}),
|
|
499
499
|
/* @__PURE__ */ jsxs(View, {
|
|
500
|
-
style: styles$
|
|
500
|
+
style: styles$4.nameBlock,
|
|
501
501
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
502
502
|
numberOfLines: 2,
|
|
503
|
-
style: styles$
|
|
503
|
+
style: styles$4.name,
|
|
504
504
|
children: who.name
|
|
505
505
|
}), who.role ? /* @__PURE__ */ jsxs(View, {
|
|
506
|
-
style: styles$
|
|
506
|
+
style: styles$4.elapsed,
|
|
507
507
|
children: [/* @__PURE__ */ jsxs(Text, {
|
|
508
508
|
numberOfLines: 1,
|
|
509
|
-
style: styles$
|
|
509
|
+
style: styles$4.dim,
|
|
510
510
|
children: [
|
|
511
511
|
who.role,
|
|
512
512
|
" ·",
|
|
@@ -515,7 +515,7 @@ function CompactRun({ now, item, stopping, menuRunId, stopError, onAction }) {
|
|
|
515
515
|
}), /* @__PURE__ */ jsx(RunElapsed, {
|
|
516
516
|
item,
|
|
517
517
|
now,
|
|
518
|
-
style: styles$
|
|
518
|
+
style: styles$4.dim
|
|
519
519
|
})]
|
|
520
520
|
}) : null]
|
|
521
521
|
}),
|
|
@@ -527,12 +527,12 @@ function CompactRun({ now, item, stopping, menuRunId, stopError, onAction }) {
|
|
|
527
527
|
}),
|
|
528
528
|
/* @__PURE__ */ jsx(Text, {
|
|
529
529
|
numberOfLines: 2,
|
|
530
|
-
style: item.error ? styles$
|
|
530
|
+
style: item.error ? styles$4.error : styles$4.workText,
|
|
531
531
|
children: summary
|
|
532
532
|
}),
|
|
533
533
|
stopError ? /* @__PURE__ */ jsx(Text, {
|
|
534
534
|
accessibilityRole: "alert",
|
|
535
|
-
style: styles$
|
|
535
|
+
style: styles$4.error,
|
|
536
536
|
children: stopError
|
|
537
537
|
}) : null
|
|
538
538
|
]
|
|
@@ -567,55 +567,55 @@ function CompactRunDetails({ now, actions, stopError, item, stopping, onClose, o
|
|
|
567
567
|
actions,
|
|
568
568
|
stopError ? /* @__PURE__ */ jsx(Text, {
|
|
569
569
|
accessibilityRole: "alert",
|
|
570
|
-
style: styles$
|
|
570
|
+
style: styles$4.error,
|
|
571
571
|
children: stopError
|
|
572
572
|
}) : null,
|
|
573
573
|
/* @__PURE__ */ jsx(RunElapsed, {
|
|
574
574
|
item,
|
|
575
575
|
now,
|
|
576
|
-
style: styles$
|
|
576
|
+
style: styles$4.dim
|
|
577
577
|
}),
|
|
578
578
|
facts.map(([label, value]) => /* @__PURE__ */ jsxs(View, {
|
|
579
|
-
style: styles$
|
|
579
|
+
style: styles$4.fact,
|
|
580
580
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
581
|
-
style: styles$
|
|
581
|
+
style: styles$4.factLabel,
|
|
582
582
|
children: label
|
|
583
583
|
}), /* @__PURE__ */ jsx(Text, {
|
|
584
584
|
selectable: true,
|
|
585
|
-
style: styles$
|
|
585
|
+
style: styles$4.factValue,
|
|
586
586
|
children: value
|
|
587
587
|
})]
|
|
588
588
|
}, label)),
|
|
589
589
|
/* @__PURE__ */ jsxs(View, {
|
|
590
|
-
style: styles$
|
|
590
|
+
style: styles$4.detailBlock,
|
|
591
591
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
592
|
-
style: styles$
|
|
592
|
+
style: styles$4.name,
|
|
593
593
|
children: "Prompt from the main agent"
|
|
594
594
|
}), /* @__PURE__ */ jsx(Text, {
|
|
595
595
|
selectable: true,
|
|
596
|
-
style: styles$
|
|
596
|
+
style: styles$4.body,
|
|
597
597
|
children: item.promptWithheld ? "Withheld: this task was marked sensitive." : item.task || "(no prompt recorded)"
|
|
598
598
|
})]
|
|
599
599
|
}),
|
|
600
600
|
item.summary ? /* @__PURE__ */ jsxs(View, {
|
|
601
|
-
style: styles$
|
|
601
|
+
style: styles$4.detailBlock,
|
|
602
602
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
603
|
-
style: styles$
|
|
603
|
+
style: styles$4.name,
|
|
604
604
|
children: "Report"
|
|
605
605
|
}), /* @__PURE__ */ jsx(Text, {
|
|
606
606
|
selectable: true,
|
|
607
|
-
style: styles$
|
|
607
|
+
style: styles$4.body,
|
|
608
608
|
children: item.summary
|
|
609
609
|
})]
|
|
610
610
|
}) : null,
|
|
611
611
|
item.error ? /* @__PURE__ */ jsxs(View, {
|
|
612
|
-
style: styles$
|
|
612
|
+
style: styles$4.detailBlock,
|
|
613
613
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
614
|
-
style: styles$
|
|
614
|
+
style: styles$4.name,
|
|
615
615
|
children: "Failure"
|
|
616
616
|
}), /* @__PURE__ */ jsx(Text, {
|
|
617
617
|
selectable: true,
|
|
618
|
-
style: styles$
|
|
618
|
+
style: styles$4.error,
|
|
619
619
|
children: item.error
|
|
620
620
|
})]
|
|
621
621
|
}) : null,
|
|
@@ -631,23 +631,23 @@ function CompactRunDetails({ now, actions, stopError, item, stopping, onClose, o
|
|
|
631
631
|
function CompactAgents({ now, items, stoppingRunId, stoppingRunIds = [], menuRunId, stopError, stopErrorRunId, onAction }) {
|
|
632
632
|
const tally = Object.keys(BADGES).map((state) => `${items.filter((item) => item.state === state).length} ${state}`).join(" · ");
|
|
633
633
|
return /* @__PURE__ */ jsx(View, {
|
|
634
|
-
style: styles$
|
|
634
|
+
style: styles$4.screen,
|
|
635
635
|
children: /* @__PURE__ */ jsx(FlatList, {
|
|
636
636
|
accessibilityLabel: "Agent runs",
|
|
637
637
|
data: items,
|
|
638
638
|
keyExtractor: (item) => item.runId,
|
|
639
|
-
style: styles$
|
|
640
|
-
contentContainerStyle: styles$
|
|
639
|
+
style: styles$4.list,
|
|
640
|
+
contentContainerStyle: styles$4.listContent,
|
|
641
641
|
initialNumToRender: 8,
|
|
642
642
|
maxToRenderPerBatch: 8,
|
|
643
643
|
windowSize: 5,
|
|
644
644
|
ListHeaderComponent: /* @__PURE__ */ jsxs(View, {
|
|
645
|
-
style: styles$
|
|
645
|
+
style: styles$4.headingBlock,
|
|
646
646
|
children: [/* @__PURE__ */ jsxs(View, {
|
|
647
|
-
style: styles$
|
|
647
|
+
style: styles$4.headingRow,
|
|
648
648
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
649
649
|
accessibilityRole: "header",
|
|
650
|
-
style: styles$
|
|
650
|
+
style: styles$4.heading,
|
|
651
651
|
children: "Agents · this session"
|
|
652
652
|
}), /* @__PURE__ */ jsx(Button, {
|
|
653
653
|
variant: "primary",
|
|
@@ -657,17 +657,17 @@ function CompactAgents({ now, items, stoppingRunId, stoppingRunIds = [], menuRun
|
|
|
657
657
|
})]
|
|
658
658
|
}), /* @__PURE__ */ jsx(Text, {
|
|
659
659
|
testID: "compact-agent-tally",
|
|
660
|
-
style: styles$
|
|
660
|
+
style: styles$4.dim,
|
|
661
661
|
children: items.length === 0 ? "No runs yet" : tally
|
|
662
662
|
})]
|
|
663
663
|
}),
|
|
664
664
|
ListEmptyComponent: /* @__PURE__ */ jsxs(View, {
|
|
665
|
-
style: styles$
|
|
665
|
+
style: styles$4.empty,
|
|
666
666
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
667
|
-
style: styles$
|
|
667
|
+
style: styles$4.body,
|
|
668
668
|
children: "No runs yet"
|
|
669
669
|
}), /* @__PURE__ */ jsx(Text, {
|
|
670
|
-
style: styles$
|
|
670
|
+
style: styles$4.dim,
|
|
671
671
|
children: "Start an agent run to get help with your work."
|
|
672
672
|
})]
|
|
673
673
|
}),
|
|
@@ -680,13 +680,13 @@ function CompactAgents({ now, items, stoppingRunId, stoppingRunIds = [], menuRun
|
|
|
680
680
|
onAction
|
|
681
681
|
}),
|
|
682
682
|
ListFooterComponent: items.length === 0 ? void 0 : /* @__PURE__ */ jsx(Text, {
|
|
683
|
-
style: styles$
|
|
683
|
+
style: styles$4.dim,
|
|
684
684
|
children: "Tap a run to open its thread. Run actions holds details, stop and clear. Finished runs leave the list after 10m."
|
|
685
685
|
})
|
|
686
686
|
})
|
|
687
687
|
});
|
|
688
688
|
}
|
|
689
|
-
const styles$
|
|
689
|
+
const styles$4 = StyleSheet.create((theme) => {
|
|
690
690
|
const sans = fontOf(theme.fontFamily.sans);
|
|
691
691
|
const small = {
|
|
692
692
|
fontFamily: sans,
|
|
@@ -925,7 +925,7 @@ function SubagentsPanel(props) {
|
|
|
925
925
|
};
|
|
926
926
|
return /* @__PURE__ */ jsxs(View, {
|
|
927
927
|
testID: "subagents-panel",
|
|
928
|
-
style: styles$
|
|
928
|
+
style: styles$3.screen,
|
|
929
929
|
children: [
|
|
930
930
|
/* @__PURE__ */ jsx(CompactAgents, {
|
|
931
931
|
items: runs,
|
|
@@ -976,7 +976,7 @@ function AgentCatalog({ sessionId }) {
|
|
|
976
976
|
setAgent(void 0);
|
|
977
977
|
}
|
|
978
978
|
}, agent.name) : /* @__PURE__ */ jsxs(View, {
|
|
979
|
-
style: styles$
|
|
979
|
+
style: styles$3.body,
|
|
980
980
|
children: [
|
|
981
981
|
/* @__PURE__ */ jsx(Input, {
|
|
982
982
|
accessibilityLabel: "Filter agents",
|
|
@@ -985,11 +985,11 @@ function AgentCatalog({ sessionId }) {
|
|
|
985
985
|
onChangeText: setFilter
|
|
986
986
|
}),
|
|
987
987
|
state.loading ? /* @__PURE__ */ jsx(Text, {
|
|
988
|
-
style: styles$
|
|
988
|
+
style: styles$3.meta,
|
|
989
989
|
children: "Loading agents…"
|
|
990
990
|
}) : null,
|
|
991
991
|
state.warning ? /* @__PURE__ */ jsx(Text, {
|
|
992
|
-
style: styles$
|
|
992
|
+
style: styles$3.error,
|
|
993
993
|
children: state.warning
|
|
994
994
|
}) : null,
|
|
995
995
|
filterCatalog(state.agents, filter).map((item) => /* @__PURE__ */ jsx(ListRow, {
|
|
@@ -1028,10 +1028,10 @@ function AgentLaunch({ sessionId, agent, models, initialTask, onClose }) {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
};
|
|
1030
1030
|
return /* @__PURE__ */ jsxs(View, {
|
|
1031
|
-
style: styles$
|
|
1031
|
+
style: styles$3.body,
|
|
1032
1032
|
children: [
|
|
1033
1033
|
/* @__PURE__ */ jsx(Text, {
|
|
1034
|
-
style: styles$
|
|
1034
|
+
style: styles$3.meta,
|
|
1035
1035
|
children: agent.description
|
|
1036
1036
|
}),
|
|
1037
1037
|
/* @__PURE__ */ jsx(Textarea, {
|
|
@@ -1052,7 +1052,7 @@ function AgentLaunch({ sessionId, agent, models, initialTask, onClose }) {
|
|
|
1052
1052
|
}]
|
|
1053
1053
|
}),
|
|
1054
1054
|
/* @__PURE__ */ jsx(Text, {
|
|
1055
|
-
style: styles$
|
|
1055
|
+
style: styles$3.meta,
|
|
1056
1056
|
children: "Model"
|
|
1057
1057
|
}),
|
|
1058
1058
|
/* @__PURE__ */ jsxs(Button, {
|
|
@@ -1067,7 +1067,7 @@ function AgentLaunch({ sessionId, agent, models, initialTask, onClose }) {
|
|
|
1067
1067
|
children: choice
|
|
1068
1068
|
}, choice)),
|
|
1069
1069
|
error ? /* @__PURE__ */ jsx(Text, {
|
|
1070
|
-
style: styles$
|
|
1070
|
+
style: styles$3.error,
|
|
1071
1071
|
children: error
|
|
1072
1072
|
}) : null,
|
|
1073
1073
|
/* @__PURE__ */ jsx(Button, {
|
|
@@ -1097,7 +1097,7 @@ function RunControl({ sessionId, run, stopping }) {
|
|
|
1097
1097
|
accessibilityRole: "alert",
|
|
1098
1098
|
testID: `run-stop-error-${run.runId}`,
|
|
1099
1099
|
numberOfLines: 1,
|
|
1100
|
-
style: styles$
|
|
1100
|
+
style: styles$3.error,
|
|
1101
1101
|
children: error
|
|
1102
1102
|
}) : null, /* @__PURE__ */ jsx(Button, {
|
|
1103
1103
|
variant: stopping ? "outline" : "danger-outline",
|
|
@@ -1113,12 +1113,12 @@ function RunControl({ sessionId, run, stopping }) {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
function InfoRow({ label, children }) {
|
|
1115
1115
|
return /* @__PURE__ */ jsxs(View, {
|
|
1116
|
-
style: styles$
|
|
1116
|
+
style: styles$3.infoRow,
|
|
1117
1117
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
1118
|
-
style: [styles$
|
|
1118
|
+
style: [styles$3.dim, styles$3.infoLabel],
|
|
1119
1119
|
children: label
|
|
1120
1120
|
}), /* @__PURE__ */ jsx(View, {
|
|
1121
|
-
style: styles$
|
|
1121
|
+
style: styles$3.infoValue,
|
|
1122
1122
|
children
|
|
1123
1123
|
})]
|
|
1124
1124
|
});
|
|
@@ -1131,15 +1131,15 @@ function RunInfo({ run }) {
|
|
|
1131
1131
|
label: "Agent",
|
|
1132
1132
|
children: [
|
|
1133
1133
|
/* @__PURE__ */ jsx(Text, {
|
|
1134
|
-
style: styles$
|
|
1134
|
+
style: styles$3.name,
|
|
1135
1135
|
children: run?.agent ?? NOT_REPORTED
|
|
1136
1136
|
}),
|
|
1137
1137
|
run?.agentDescription ? /* @__PURE__ */ jsx(Text, {
|
|
1138
|
-
style: styles$
|
|
1138
|
+
style: styles$3.bodyDim,
|
|
1139
1139
|
children: run.agentDescription
|
|
1140
1140
|
}) : null,
|
|
1141
1141
|
run?.agentFilePath ? /* @__PURE__ */ jsx(Text, {
|
|
1142
|
-
style: styles$
|
|
1142
|
+
style: styles$3.monoDim,
|
|
1143
1143
|
children: run.agentFilePath
|
|
1144
1144
|
}) : null
|
|
1145
1145
|
]
|
|
@@ -1147,9 +1147,9 @@ function RunInfo({ run }) {
|
|
|
1147
1147
|
/* @__PURE__ */ jsx(InfoRow, {
|
|
1148
1148
|
label: "Model",
|
|
1149
1149
|
children: /* @__PURE__ */ jsxs(Text, {
|
|
1150
|
-
style: styles$
|
|
1150
|
+
style: styles$3.bodyText,
|
|
1151
1151
|
children: [run?.model ?? NOT_REPORTED, run?.model && run.modelSource === "configured" ? /* @__PURE__ */ jsx(Text, {
|
|
1152
|
-
style: styles$
|
|
1152
|
+
style: styles$3.bodyDim,
|
|
1153
1153
|
children: " · configured, not confirmed by the runtime"
|
|
1154
1154
|
}) : null]
|
|
1155
1155
|
})
|
|
@@ -1157,20 +1157,20 @@ function RunInfo({ run }) {
|
|
|
1157
1157
|
/* @__PURE__ */ jsx(InfoRow, {
|
|
1158
1158
|
label: "Thinking",
|
|
1159
1159
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1160
|
-
style: [styles$
|
|
1160
|
+
style: [styles$3.bodyText, styles$3.capitalize],
|
|
1161
1161
|
children: run?.thinking ?? NOT_REPORTED
|
|
1162
1162
|
})
|
|
1163
1163
|
}),
|
|
1164
1164
|
/* @__PURE__ */ jsx(InfoRow, {
|
|
1165
1165
|
label: "Prompt",
|
|
1166
1166
|
children: run?.promptWithheld ? /* @__PURE__ */ jsx(Text, {
|
|
1167
|
-
style: styles$
|
|
1167
|
+
style: styles$3.bodyDim,
|
|
1168
1168
|
children: "Withheld: this task was marked sensitive."
|
|
1169
1169
|
}) : /* @__PURE__ */ jsx(ScrollView, {
|
|
1170
|
-
style: styles$
|
|
1170
|
+
style: styles$3.prompt,
|
|
1171
1171
|
nestedScrollEnabled: true,
|
|
1172
1172
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1173
|
-
style: styles$
|
|
1173
|
+
style: styles$3.bodyText,
|
|
1174
1174
|
children: run?.task || NOT_REPORTED
|
|
1175
1175
|
})
|
|
1176
1176
|
})
|
|
@@ -1186,14 +1186,14 @@ function RunInfo({ run }) {
|
|
|
1186
1186
|
/* @__PURE__ */ jsx(InfoRow, {
|
|
1187
1187
|
label: "Folder",
|
|
1188
1188
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1189
|
-
style: styles$
|
|
1189
|
+
style: styles$3.mono,
|
|
1190
1190
|
children: run?.cwd ? abbreviateCwd(run.cwd) : NOT_REPORTED
|
|
1191
1191
|
})
|
|
1192
1192
|
}),
|
|
1193
1193
|
/* @__PURE__ */ jsx(InfoRow, {
|
|
1194
1194
|
label: "Usage",
|
|
1195
1195
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1196
|
-
style: styles$
|
|
1196
|
+
style: styles$3.bodyDim,
|
|
1197
1197
|
children: usage || NOT_REPORTED
|
|
1198
1198
|
})
|
|
1199
1199
|
})
|
|
@@ -1205,7 +1205,7 @@ function RunChip({ dot, open, onPress, children }) {
|
|
|
1205
1205
|
size: "md",
|
|
1206
1206
|
accessibilityState: { expanded: open },
|
|
1207
1207
|
onPress,
|
|
1208
|
-
style: styles$
|
|
1208
|
+
style: styles$3.chip,
|
|
1209
1209
|
children: [
|
|
1210
1210
|
/* @__PURE__ */ jsx(Dot, {
|
|
1211
1211
|
tone: dot,
|
|
@@ -1262,11 +1262,11 @@ function AgentThreadPanel({ sessionId, runId, renderThread }) {
|
|
|
1262
1262
|
const toggleInfo = () => setInfoOpen((current) => !current);
|
|
1263
1263
|
return /* @__PURE__ */ jsxs(View, {
|
|
1264
1264
|
testID: "agent-thread-panel",
|
|
1265
|
-
style: styles$
|
|
1265
|
+
style: styles$3.screen,
|
|
1266
1266
|
children: [
|
|
1267
1267
|
/* @__PURE__ */ jsxs(View, {
|
|
1268
1268
|
testID: "agent-thread-header",
|
|
1269
|
-
style: styles$
|
|
1269
|
+
style: styles$3.threadHead,
|
|
1270
1270
|
children: [
|
|
1271
1271
|
run && who ? /* @__PURE__ */ jsx(AgentAvatar, {
|
|
1272
1272
|
name: who.name,
|
|
@@ -1276,29 +1276,29 @@ function AgentThreadPanel({ sessionId, runId, renderThread }) {
|
|
|
1276
1276
|
/* @__PURE__ */ jsx(Text, {
|
|
1277
1277
|
testID: "agent-thread-agent",
|
|
1278
1278
|
numberOfLines: 1,
|
|
1279
|
-
style: styles$
|
|
1279
|
+
style: styles$3.name,
|
|
1280
1280
|
children: run ? agentRunLabel(run) : "Agent run"
|
|
1281
1281
|
}),
|
|
1282
1282
|
who?.role ? /* @__PURE__ */ jsx(Text, {
|
|
1283
1283
|
numberOfLines: 1,
|
|
1284
|
-
style: styles$
|
|
1284
|
+
style: styles$3.dim,
|
|
1285
1285
|
children: who.role
|
|
1286
1286
|
}) : null,
|
|
1287
1287
|
badge && run ? /* @__PURE__ */ jsx(StatusBadge, {
|
|
1288
1288
|
tone: badge.tone,
|
|
1289
1289
|
testID: "agent-thread-state",
|
|
1290
|
-
style: styles$
|
|
1290
|
+
style: styles$3.centered,
|
|
1291
1291
|
children: stopping && !isTerminalRun(run) ? "STOPPING…" : badge.label
|
|
1292
1292
|
}) : null,
|
|
1293
1293
|
/* @__PURE__ */ jsx(View, {
|
|
1294
|
-
style: styles$
|
|
1294
|
+
style: styles$3.grow,
|
|
1295
1295
|
children: run ? /* @__PURE__ */ jsx(RunElapsed, {
|
|
1296
1296
|
item: gone ? {
|
|
1297
1297
|
...run,
|
|
1298
1298
|
endedAt: run.endedAt ?? run.lastUpdate
|
|
1299
1299
|
} : run,
|
|
1300
1300
|
active: !gone,
|
|
1301
|
-
style: styles$
|
|
1301
|
+
style: styles$3.dim
|
|
1302
1302
|
}) : null
|
|
1303
1303
|
}),
|
|
1304
1304
|
live ? /* @__PURE__ */ jsx(RunControl, {
|
|
@@ -1310,25 +1310,25 @@ function AgentThreadPanel({ sessionId, runId, renderThread }) {
|
|
|
1310
1310
|
}),
|
|
1311
1311
|
gone ? /* @__PURE__ */ jsx(Text, {
|
|
1312
1312
|
testID: "agent-thread-gone",
|
|
1313
|
-
style: [styles$
|
|
1313
|
+
style: [styles$3.dim, styles$3.gone],
|
|
1314
1314
|
children: "This run is no longer listed. Its thread stays readable."
|
|
1315
1315
|
}) : null,
|
|
1316
1316
|
/* @__PURE__ */ jsx(View, {
|
|
1317
|
-
style: styles$
|
|
1317
|
+
style: styles$3.transcript,
|
|
1318
1318
|
children: renderThread(runId)
|
|
1319
1319
|
}),
|
|
1320
1320
|
infoOpen ? /* @__PURE__ */ jsx(ScrollView, {
|
|
1321
1321
|
accessibilityLabel: "Run info",
|
|
1322
1322
|
testID: "run-info",
|
|
1323
|
-
style: styles$
|
|
1324
|
-
contentContainerStyle: styles$
|
|
1323
|
+
style: styles$3.info,
|
|
1324
|
+
contentContainerStyle: styles$3.infoBody,
|
|
1325
1325
|
children: /* @__PURE__ */ jsx(RunInfo, { run })
|
|
1326
1326
|
}) : null,
|
|
1327
1327
|
canSteer ? /* @__PURE__ */ jsx(View, {
|
|
1328
1328
|
testID: "agent-steer-composer",
|
|
1329
|
-
style: styles$
|
|
1329
|
+
style: styles$3.composerWrap,
|
|
1330
1330
|
children: /* @__PURE__ */ jsxs(View, {
|
|
1331
|
-
style: styles$
|
|
1331
|
+
style: styles$3.composer,
|
|
1332
1332
|
children: [
|
|
1333
1333
|
/* @__PURE__ */ jsx(Textarea, {
|
|
1334
1334
|
variant: "bare",
|
|
@@ -1339,21 +1339,21 @@ function AgentThreadPanel({ sessionId, runId, renderThread }) {
|
|
|
1339
1339
|
readOnly: sending,
|
|
1340
1340
|
disabled: stopping,
|
|
1341
1341
|
placeholder: stopping ? "Stopping, guidance paused" : "Guide this agent · it reads this at its next step",
|
|
1342
|
-
style: styles$
|
|
1342
|
+
style: styles$3.composerInput,
|
|
1343
1343
|
onChangeText: setGuidance
|
|
1344
1344
|
}),
|
|
1345
1345
|
error ? /* @__PURE__ */ jsx(Text, {
|
|
1346
1346
|
accessibilityRole: "alert",
|
|
1347
1347
|
testID: "agent-steer-error",
|
|
1348
|
-
style: [styles$
|
|
1348
|
+
style: [styles$3.error, styles$3.composerPad],
|
|
1349
1349
|
children: error
|
|
1350
1350
|
}) : null,
|
|
1351
1351
|
/* @__PURE__ */ jsxs(View, {
|
|
1352
|
-
style: styles$
|
|
1352
|
+
style: styles$3.composerFoot,
|
|
1353
1353
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
1354
1354
|
testID: "agent-steer-hint",
|
|
1355
1355
|
numberOfLines: 1,
|
|
1356
|
-
style: [styles$
|
|
1356
|
+
style: [styles$3.dim, styles$3.grow],
|
|
1357
1357
|
children: notice
|
|
1358
1358
|
}), /* @__PURE__ */ jsxs(Button, {
|
|
1359
1359
|
testID: "agent-steer-submit",
|
|
@@ -1368,11 +1368,11 @@ function AgentThreadPanel({ sessionId, runId, renderThread }) {
|
|
|
1368
1368
|
})
|
|
1369
1369
|
}) : /* @__PURE__ */ jsx(Text, {
|
|
1370
1370
|
testID: "agent-thread-end",
|
|
1371
|
-
style: [styles$
|
|
1371
|
+
style: [styles$3.dim, styles$3.end],
|
|
1372
1372
|
children: endNote
|
|
1373
1373
|
}),
|
|
1374
1374
|
/* @__PURE__ */ jsxs(View, {
|
|
1375
|
-
style: styles$
|
|
1375
|
+
style: styles$3.chips,
|
|
1376
1376
|
children: [
|
|
1377
1377
|
/* @__PURE__ */ jsx(RunChip, {
|
|
1378
1378
|
dot: "magenta",
|
|
@@ -1385,7 +1385,7 @@ function AgentThreadPanel({ sessionId, runId, renderThread }) {
|
|
|
1385
1385
|
open: infoOpen,
|
|
1386
1386
|
onPress: toggleInfo,
|
|
1387
1387
|
children: [run?.model ? run.model.split("/").pop() ?? run.model : "Model not reported", run?.thinking ? /* @__PURE__ */ jsxs(Text, {
|
|
1388
|
-
style: styles$
|
|
1388
|
+
style: styles$3.dim,
|
|
1389
1389
|
children: [" ", run.thinking]
|
|
1390
1390
|
}) : null]
|
|
1391
1391
|
}),
|
|
@@ -1402,7 +1402,7 @@ function AgentThreadPanel({ sessionId, runId, renderThread }) {
|
|
|
1402
1402
|
}
|
|
1403
1403
|
/** `px-[26px]`: the cockpit's gutter. */
|
|
1404
1404
|
const GUTTER = 26;
|
|
1405
|
-
const styles$
|
|
1405
|
+
const styles$3 = StyleSheet.create((theme) => {
|
|
1406
1406
|
const sans = fontOf(theme.fontFamily.sans);
|
|
1407
1407
|
const mono = fontOf(theme.fontFamily.mono);
|
|
1408
1408
|
const sm = {
|
|
@@ -1655,10 +1655,10 @@ function detail(run) {
|
|
|
1655
1655
|
function AgentsActivitySection({ sessionId, openTransientTab }) {
|
|
1656
1656
|
const runs = activityRuns(useSubagents(sessionId));
|
|
1657
1657
|
if (runs.length === 0) return /* @__PURE__ */ jsxs(View, {
|
|
1658
|
-
style: styles.idle,
|
|
1658
|
+
style: styles$2.idle,
|
|
1659
1659
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
1660
1660
|
testID: "activity-summary-agents",
|
|
1661
|
-
style: styles.status,
|
|
1661
|
+
style: styles$2.status,
|
|
1662
1662
|
children: "Idle"
|
|
1663
1663
|
}), /* @__PURE__ */ jsxs(Pressable, {
|
|
1664
1664
|
accessibilityRole: "button",
|
|
@@ -1672,9 +1672,9 @@ function AgentsActivitySection({ sessionId, openTransientTab }) {
|
|
|
1672
1672
|
openTransientTab(subagentsTab());
|
|
1673
1673
|
}
|
|
1674
1674
|
},
|
|
1675
|
-
style: styles.action,
|
|
1675
|
+
style: styles$2.action,
|
|
1676
1676
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
1677
|
-
style: styles.actionText(sessionId === null),
|
|
1677
|
+
style: styles$2.actionText(sessionId === null),
|
|
1678
1678
|
children: "Launch an agent"
|
|
1679
1679
|
}), /* @__PURE__ */ jsx(ArrowRightIcon, {
|
|
1680
1680
|
size: 14,
|
|
@@ -1684,7 +1684,7 @@ function AgentsActivitySection({ sessionId, openTransientTab }) {
|
|
|
1684
1684
|
});
|
|
1685
1685
|
return /* @__PURE__ */ jsx(View, {
|
|
1686
1686
|
testID: "activity-agent-runs",
|
|
1687
|
-
style: styles.runs,
|
|
1687
|
+
style: styles$2.runs,
|
|
1688
1688
|
children: runs.map((run) => {
|
|
1689
1689
|
const who = agentDisplay(run);
|
|
1690
1690
|
const description = detail(run);
|
|
@@ -1696,9 +1696,9 @@ function AgentsActivitySection({ sessionId, openTransientTab }) {
|
|
|
1696
1696
|
onPress: () => {
|
|
1697
1697
|
if (sessionId !== null) openTransientTab(agentThreadTab(run));
|
|
1698
1698
|
},
|
|
1699
|
-
style: styles.run,
|
|
1699
|
+
style: styles$2.run,
|
|
1700
1700
|
children: /* @__PURE__ */ jsxs(View, {
|
|
1701
|
-
style: styles.line,
|
|
1701
|
+
style: styles$2.line,
|
|
1702
1702
|
children: [
|
|
1703
1703
|
/* @__PURE__ */ jsx(AgentAvatar, {
|
|
1704
1704
|
name: who.name,
|
|
@@ -1707,31 +1707,31 @@ function AgentsActivitySection({ sessionId, openTransientTab }) {
|
|
|
1707
1707
|
size: "sm"
|
|
1708
1708
|
}),
|
|
1709
1709
|
/* @__PURE__ */ jsxs(View, {
|
|
1710
|
-
style: styles.text,
|
|
1710
|
+
style: styles$2.text,
|
|
1711
1711
|
children: [/* @__PURE__ */ jsxs(View, {
|
|
1712
|
-
style: styles.who,
|
|
1712
|
+
style: styles$2.who,
|
|
1713
1713
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
1714
1714
|
numberOfLines: 1,
|
|
1715
|
-
style: styles.name,
|
|
1715
|
+
style: styles$2.name,
|
|
1716
1716
|
children: who.name
|
|
1717
1717
|
}), who.role ? /* @__PURE__ */ jsx(Text, {
|
|
1718
1718
|
numberOfLines: 1,
|
|
1719
|
-
style: styles.dim,
|
|
1719
|
+
style: styles$2.dim,
|
|
1720
1720
|
children: who.role
|
|
1721
1721
|
}) : null]
|
|
1722
1722
|
}), description ? /* @__PURE__ */ jsx(Text, {
|
|
1723
1723
|
numberOfLines: 1,
|
|
1724
|
-
style: run.state === "failed" ? styles.failed : styles.dim,
|
|
1724
|
+
style: run.state === "failed" ? styles$2.failed : styles$2.dim,
|
|
1725
1725
|
children: description
|
|
1726
1726
|
}) : null]
|
|
1727
1727
|
}),
|
|
1728
1728
|
/* @__PURE__ */ jsxs(View, {
|
|
1729
|
-
style: styles.elapsed,
|
|
1729
|
+
style: styles$2.elapsed,
|
|
1730
1730
|
children: [/* @__PURE__ */ jsx(RunElapsed, {
|
|
1731
1731
|
item: run,
|
|
1732
|
-
style: styles.dim
|
|
1732
|
+
style: styles$2.dim
|
|
1733
1733
|
}), run.toolCount !== void 0 ? /* @__PURE__ */ jsx(Text, {
|
|
1734
|
-
style: styles.dim,
|
|
1734
|
+
style: styles$2.dim,
|
|
1735
1735
|
children: ` · ${run.toolCount} tools`
|
|
1736
1736
|
}) : null]
|
|
1737
1737
|
})
|
|
@@ -1741,7 +1741,7 @@ function AgentsActivitySection({ sessionId, openTransientTab }) {
|
|
|
1741
1741
|
})
|
|
1742
1742
|
});
|
|
1743
1743
|
}
|
|
1744
|
-
const styles = StyleSheet.create((theme) => {
|
|
1744
|
+
const styles$2 = StyleSheet.create((theme) => {
|
|
1745
1745
|
const small = {
|
|
1746
1746
|
fontFamily: fontOf(theme.fontFamily.sans),
|
|
1747
1747
|
fontSize: theme.fontSize.sm,
|
|
@@ -1827,6 +1827,917 @@ const styles = StyleSheet.create((theme) => {
|
|
|
1827
1827
|
//#endregion
|
|
1828
1828
|
//#region src/extensions/workspaces/sessions/(frontend)/fill/Agents.activity.agents.native.tsx
|
|
1829
1829
|
var Agents_activity_agents_native_default = defineFill({ component: AgentsActivitySection });
|
|
1830
|
+
const MESSAGE_PREVIEW_CHARS = 72;
|
|
1831
|
+
const ELLIPSIS = "…";
|
|
1832
|
+
function isRecord(value) {
|
|
1833
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1834
|
+
}
|
|
1835
|
+
function asString(value) {
|
|
1836
|
+
return typeof value === "string" ? value : "";
|
|
1837
|
+
}
|
|
1838
|
+
/** The detail beside the subagent action, as the TUI's callDetails words it. */
|
|
1839
|
+
function subagentCallDetail(args) {
|
|
1840
|
+
switch (args.action) {
|
|
1841
|
+
case "agents": return asString(args.name);
|
|
1842
|
+
case "run": {
|
|
1843
|
+
const requests = Array.isArray(args.requests) ? args.requests : [];
|
|
1844
|
+
const agents = requests.map((request) => isRecord(request) ? asString(request.agent) : "").filter(Boolean);
|
|
1845
|
+
const count = `${requests.length} agent${requests.length === 1 ? "" : "s"}`;
|
|
1846
|
+
return agents.length > 0 ? `${count} · ${agents.join(", ")}` : count;
|
|
1847
|
+
}
|
|
1848
|
+
case "status": return args.id ? "run" : "fleet";
|
|
1849
|
+
default: return "";
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
/** Result text as lines, trailing blank lines dropped the way the TUI does. */
|
|
1853
|
+
function resultLines(output) {
|
|
1854
|
+
const lines = output.split("\n");
|
|
1855
|
+
while (lines.length > 0 && lines.at(-1)?.trim() === "") lines.pop();
|
|
1856
|
+
return lines.length === 1 && lines[0] === "" ? [] : lines;
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* The subagent result body: a tail while running, then the head collapsed to
|
|
1860
|
+
* the TUI budget, with the closing glyph line the TUI appends.
|
|
1861
|
+
*/
|
|
1862
|
+
function shapeResult(output, options) {
|
|
1863
|
+
const all = resultLines(output);
|
|
1864
|
+
if (options.isPartial) return {
|
|
1865
|
+
lines: all.slice(-12),
|
|
1866
|
+
glyph: "running",
|
|
1867
|
+
hidden: 0
|
|
1868
|
+
};
|
|
1869
|
+
const lines = options.expanded ? all : all.slice(0, 12);
|
|
1870
|
+
const hidden = all.length - lines.length;
|
|
1871
|
+
if (options.isError) return {
|
|
1872
|
+
lines,
|
|
1873
|
+
glyph: "failed",
|
|
1874
|
+
hidden
|
|
1875
|
+
};
|
|
1876
|
+
if (hidden > 0) return {
|
|
1877
|
+
lines,
|
|
1878
|
+
glyph: "more",
|
|
1879
|
+
hidden
|
|
1880
|
+
};
|
|
1881
|
+
if (lines.length === 0) return {
|
|
1882
|
+
lines,
|
|
1883
|
+
glyph: "done",
|
|
1884
|
+
hidden: 0
|
|
1885
|
+
};
|
|
1886
|
+
return {
|
|
1887
|
+
lines,
|
|
1888
|
+
glyph: "none",
|
|
1889
|
+
hidden: 0
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
function preview(message) {
|
|
1893
|
+
const flat = message.replace(/\s+/g, " ").trim();
|
|
1894
|
+
return flat.length > MESSAGE_PREVIEW_CHARS ? `${flat.slice(0, 71)}${ELLIPSIS}` : flat;
|
|
1895
|
+
}
|
|
1896
|
+
function records(value) {
|
|
1897
|
+
return Array.isArray(value) ? value.filter(isRecord) : [];
|
|
1898
|
+
}
|
|
1899
|
+
function parts(values) {
|
|
1900
|
+
return values.filter((value) => typeof value === "string" && value.trim() !== "").join(" · ");
|
|
1901
|
+
}
|
|
1902
|
+
function stateAvatar(state) {
|
|
1903
|
+
if (state === "failed" || state === "error") return "failed";
|
|
1904
|
+
if (state === "running" || state === "starting") return "running";
|
|
1905
|
+
if (state === "queued") return "waiting";
|
|
1906
|
+
if (state === "complete" || state === "completed" || state === "stopped") return "done";
|
|
1907
|
+
}
|
|
1908
|
+
function stateTone(state) {
|
|
1909
|
+
if (state === "failed" || state === "error") return "error";
|
|
1910
|
+
if (state === "complete" || state === "completed") return "ok";
|
|
1911
|
+
if (state === "running" || state === "starting") return "running";
|
|
1912
|
+
return "idle";
|
|
1913
|
+
}
|
|
1914
|
+
function countSummary(count, noun) {
|
|
1915
|
+
return count === 0 ? `no ${noun}s` : `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
1916
|
+
}
|
|
1917
|
+
function agentsView(value) {
|
|
1918
|
+
const rows = records(value).map((agent, index) => ({
|
|
1919
|
+
key: `${asString(agent.name)}-${index}`,
|
|
1920
|
+
label: asString(agent.name),
|
|
1921
|
+
seed: asString(agent.name),
|
|
1922
|
+
detail: preview(asString(agent.description)),
|
|
1923
|
+
state: asString(agent.source),
|
|
1924
|
+
tone: "idle"
|
|
1925
|
+
}));
|
|
1926
|
+
return {
|
|
1927
|
+
kind: "agents",
|
|
1928
|
+
rows,
|
|
1929
|
+
summary: countSummary(rows.length, "agent"),
|
|
1930
|
+
tone: "idle"
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
function runView(value) {
|
|
1934
|
+
const rows = records(value).map((outcome, index) => {
|
|
1935
|
+
const runId = asString(outcome.runId);
|
|
1936
|
+
return {
|
|
1937
|
+
key: runId || `${asString(outcome.agent)}-${index}`,
|
|
1938
|
+
label: asString(outcome.agent),
|
|
1939
|
+
seed: asString(outcome.agent),
|
|
1940
|
+
avatar: runId ? "running" : "failed",
|
|
1941
|
+
detail: preview(runId ? asString(outcome.task) : asString(outcome.error)) || (runId ? "" : "unknown error"),
|
|
1942
|
+
state: runId ? "started" : "failed",
|
|
1943
|
+
tone: runId ? "ok" : "error"
|
|
1944
|
+
};
|
|
1945
|
+
});
|
|
1946
|
+
const started = rows.filter((row) => row.state === "started").length;
|
|
1947
|
+
const failed = rows.length - started;
|
|
1948
|
+
return {
|
|
1949
|
+
kind: "run",
|
|
1950
|
+
rows,
|
|
1951
|
+
summary: failed === 0 ? `${started} started` : `${started} started · ${failed} failed`,
|
|
1952
|
+
tone: failed === 0 ? "ok" : "error"
|
|
1953
|
+
};
|
|
1954
|
+
}
|
|
1955
|
+
function fleetView(value) {
|
|
1956
|
+
const rows = records(value).map((job, index) => {
|
|
1957
|
+
const state = asString(job.status) || "starting";
|
|
1958
|
+
const who = agentDisplay({
|
|
1959
|
+
agent: asString(job.agent),
|
|
1960
|
+
identity: asString(job.identity) || void 0
|
|
1961
|
+
});
|
|
1962
|
+
return {
|
|
1963
|
+
key: asString(job.runId) || `run-${index}`,
|
|
1964
|
+
label: who.name,
|
|
1965
|
+
seed: who.seed,
|
|
1966
|
+
avatar: stateAvatar(state),
|
|
1967
|
+
detail: preview(parts([
|
|
1968
|
+
who.role,
|
|
1969
|
+
job.currentTool,
|
|
1970
|
+
job.activityState,
|
|
1971
|
+
job.attentionReason,
|
|
1972
|
+
job.error
|
|
1973
|
+
])),
|
|
1974
|
+
state,
|
|
1975
|
+
tone: stateTone(state)
|
|
1976
|
+
};
|
|
1977
|
+
});
|
|
1978
|
+
return {
|
|
1979
|
+
kind: "fleet",
|
|
1980
|
+
rows,
|
|
1981
|
+
summary: countSummary(rows.length, "run"),
|
|
1982
|
+
tone: "idle"
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
function statusView(details) {
|
|
1986
|
+
const runId = asString(details.runId);
|
|
1987
|
+
const status = isRecord(details.status) ? details.status : void 0;
|
|
1988
|
+
const state = status ? asString(status.state) : "";
|
|
1989
|
+
if (!state) return {
|
|
1990
|
+
kind: "status",
|
|
1991
|
+
rows: [],
|
|
1992
|
+
summary: "no status yet",
|
|
1993
|
+
tone: "idle"
|
|
1994
|
+
};
|
|
1995
|
+
const who = agentDisplay({
|
|
1996
|
+
agent: asString(status?.agent),
|
|
1997
|
+
identity: asString(status?.identity) || void 0
|
|
1998
|
+
});
|
|
1999
|
+
return {
|
|
2000
|
+
kind: "status",
|
|
2001
|
+
rows: [{
|
|
2002
|
+
key: runId,
|
|
2003
|
+
label: who.name,
|
|
2004
|
+
seed: who.seed,
|
|
2005
|
+
avatar: stateAvatar(state),
|
|
2006
|
+
detail: preview(parts([
|
|
2007
|
+
who.role,
|
|
2008
|
+
status?.activityState,
|
|
2009
|
+
status?.summary,
|
|
2010
|
+
status?.error
|
|
2011
|
+
])),
|
|
2012
|
+
state,
|
|
2013
|
+
tone: stateTone(state)
|
|
2014
|
+
}],
|
|
2015
|
+
summary: "",
|
|
2016
|
+
tone: stateTone(state)
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
function controlView(summary, tone) {
|
|
2020
|
+
return {
|
|
2021
|
+
kind: "control",
|
|
2022
|
+
rows: [],
|
|
2023
|
+
summary,
|
|
2024
|
+
tone
|
|
2025
|
+
};
|
|
2026
|
+
}
|
|
2027
|
+
/**
|
|
2028
|
+
* Narrows the wire `details` of a subagent result to the rows the card draws.
|
|
2029
|
+
* Null when they are not a finished subagent result at all, which is what a
|
|
2030
|
+
* partial update or an error message is: the card then falls back to the text.
|
|
2031
|
+
*/
|
|
2032
|
+
function subagentResultView(details) {
|
|
2033
|
+
if (!isRecord(details) || details.partial === true) return null;
|
|
2034
|
+
if (Array.isArray(details.agents)) return agentsView(details.agents);
|
|
2035
|
+
if (Array.isArray(details.outcomes)) return runView(details.outcomes);
|
|
2036
|
+
if (isRecord(details.spawn) && Array.isArray(details.spawn.outcomes)) return runView(details.spawn.outcomes);
|
|
2037
|
+
if (Array.isArray(details.runs)) return fleetView(details.runs);
|
|
2038
|
+
if (Array.isArray(details.fleet)) return fleetView(details.fleet);
|
|
2039
|
+
if (isRecord(details.control)) return controlView("stop requested", "ok");
|
|
2040
|
+
if (isRecord(details.steer)) {
|
|
2041
|
+
const state = asString(details.steer.state);
|
|
2042
|
+
return controlView(`steer ${state}${details.steer.message ? `: ${preview(asString(details.steer.message))}` : ""}`, state === "failed" ? "error" : "ok");
|
|
2043
|
+
}
|
|
2044
|
+
if (typeof details.runId === "string") return statusView(details);
|
|
2045
|
+
return null;
|
|
2046
|
+
}
|
|
2047
|
+
/** The intercom call header: action, its resolved target name, and what is being said. */
|
|
2048
|
+
function intercomCallSummary(args, details) {
|
|
2049
|
+
const action = asString(args.action);
|
|
2050
|
+
const toName = isRecord(details) ? asString(details.toName).trim() : "";
|
|
2051
|
+
switch (action) {
|
|
2052
|
+
case "send":
|
|
2053
|
+
case "ask": return {
|
|
2054
|
+
action,
|
|
2055
|
+
target: toName || asString(args.to),
|
|
2056
|
+
message: preview(asString(args.message))
|
|
2057
|
+
};
|
|
2058
|
+
case "reply": return {
|
|
2059
|
+
action,
|
|
2060
|
+
target: asString(args.requestId),
|
|
2061
|
+
message: preview(asString(args.message))
|
|
2062
|
+
};
|
|
2063
|
+
default: return {
|
|
2064
|
+
action,
|
|
2065
|
+
target: "",
|
|
2066
|
+
message: ""
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* The outcome line for a finished intercom call, read from the details the
|
|
2072
|
+
* tool attaches: a send is delivered or only queued, a reply confirms its
|
|
2073
|
+
* request, an ask carries the answer's sender.
|
|
2074
|
+
*/
|
|
2075
|
+
function intercomOutcome(details) {
|
|
2076
|
+
if (!isRecord(details)) return {
|
|
2077
|
+
outcome: "none",
|
|
2078
|
+
who: "",
|
|
2079
|
+
reply: ""
|
|
2080
|
+
};
|
|
2081
|
+
if (details.delivered === true) return {
|
|
2082
|
+
outcome: "delivered",
|
|
2083
|
+
who: asString(details.to),
|
|
2084
|
+
reply: ""
|
|
2085
|
+
};
|
|
2086
|
+
if (details.state === "queued") return {
|
|
2087
|
+
outcome: "queued",
|
|
2088
|
+
who: asString(details.to),
|
|
2089
|
+
reply: ""
|
|
2090
|
+
};
|
|
2091
|
+
if (typeof details.reply === "string") return {
|
|
2092
|
+
outcome: "answered",
|
|
2093
|
+
who: asString(details.from),
|
|
2094
|
+
reply: details.reply
|
|
2095
|
+
};
|
|
2096
|
+
if (typeof details.requestId === "string" && typeof details.to === "string") return {
|
|
2097
|
+
outcome: "replied",
|
|
2098
|
+
who: details.to,
|
|
2099
|
+
reply: ""
|
|
2100
|
+
};
|
|
2101
|
+
return {
|
|
2102
|
+
outcome: "none",
|
|
2103
|
+
who: "",
|
|
2104
|
+
reply: ""
|
|
2105
|
+
};
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* The agent that sent an intercom message, from the tool's `sender` detail; empty
|
|
2109
|
+
* while the call runs or for a result recorded before the tool named its sender.
|
|
2110
|
+
*/
|
|
2111
|
+
function intercomSender(details) {
|
|
2112
|
+
return isRecord(details) ? asString(details.sender) : "";
|
|
2113
|
+
}
|
|
2114
|
+
//#endregion
|
|
2115
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/IntercomToolMessage.native.tsx
|
|
2116
|
+
/** How the outgoing bubble settled, as a quiet line beneath it. An answer is its own bubble instead. */
|
|
2117
|
+
const OUTCOME_LINE = {
|
|
2118
|
+
delivered: {
|
|
2119
|
+
tone: "neutral",
|
|
2120
|
+
glyph: "✓",
|
|
2121
|
+
text: "Delivered"
|
|
2122
|
+
},
|
|
2123
|
+
queued: {
|
|
2124
|
+
tone: "running",
|
|
2125
|
+
glyph: void 0,
|
|
2126
|
+
text: "Queued, not yet confirmed"
|
|
2127
|
+
},
|
|
2128
|
+
replied: {
|
|
2129
|
+
tone: "neutral",
|
|
2130
|
+
glyph: "✓",
|
|
2131
|
+
text: "Replied"
|
|
2132
|
+
}
|
|
2133
|
+
};
|
|
2134
|
+
/** The chip beside the sender: what kind of message this session's agent sent. */
|
|
2135
|
+
const ACTION_CHIP = {
|
|
2136
|
+
ask: "Asked",
|
|
2137
|
+
send: "Message",
|
|
2138
|
+
reply: "Reply"
|
|
2139
|
+
};
|
|
2140
|
+
/** An agent's side of the thread: avatar, name, role when known, an optional chip, then the bubble. */
|
|
2141
|
+
function AgentTurn({ name, role, chip, state, testID, children }) {
|
|
2142
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
2143
|
+
testID,
|
|
2144
|
+
style: styles$1.agentTurn,
|
|
2145
|
+
children: [/* @__PURE__ */ jsx(AgentAvatar, {
|
|
2146
|
+
name,
|
|
2147
|
+
size: "sm",
|
|
2148
|
+
state
|
|
2149
|
+
}), /* @__PURE__ */ jsxs(View, {
|
|
2150
|
+
style: styles$1.agentColumn,
|
|
2151
|
+
children: [/* @__PURE__ */ jsxs(View, {
|
|
2152
|
+
style: styles$1.speakerRow,
|
|
2153
|
+
children: [
|
|
2154
|
+
/* @__PURE__ */ jsx(Text, {
|
|
2155
|
+
numberOfLines: 1,
|
|
2156
|
+
style: [
|
|
2157
|
+
styles$1.small,
|
|
2158
|
+
styles$1.speaker,
|
|
2159
|
+
styles$1.agentName
|
|
2160
|
+
],
|
|
2161
|
+
children: name
|
|
2162
|
+
}),
|
|
2163
|
+
role ? /* @__PURE__ */ jsx(Text, {
|
|
2164
|
+
numberOfLines: 1,
|
|
2165
|
+
style: [
|
|
2166
|
+
styles$1.small,
|
|
2167
|
+
styles$1.dim,
|
|
2168
|
+
styles$1.role
|
|
2169
|
+
],
|
|
2170
|
+
children: role
|
|
2171
|
+
}) : null,
|
|
2172
|
+
chip
|
|
2173
|
+
]
|
|
2174
|
+
}), children]
|
|
2175
|
+
})]
|
|
2176
|
+
});
|
|
2177
|
+
}
|
|
2178
|
+
/**
|
|
2179
|
+
* The intercom tool's timeline item on native, drawn as a chat thread between
|
|
2180
|
+
* agents: this session's agent sends on the right, named with its avatar once the
|
|
2181
|
+
* tool reports it, with a quiet delivery tick; the recipient sits on the left with
|
|
2182
|
+
* its avatar and name, replying while the ask waits and answering in a rail bubble
|
|
2183
|
+
* once it has. Actions with no message (members, pending) show the result text. A
|
|
2184
|
+
* failure shows only its reason, in red.
|
|
2185
|
+
*/
|
|
2186
|
+
function IntercomToolMessage({ args, result, output, running, isError }) {
|
|
2187
|
+
const summary = intercomCallSummary(args, result?.details);
|
|
2188
|
+
const collapsed = shapeResult(output, {
|
|
2189
|
+
expanded: false,
|
|
2190
|
+
isPartial: running,
|
|
2191
|
+
isError
|
|
2192
|
+
});
|
|
2193
|
+
const outcome = running || isError ? {
|
|
2194
|
+
outcome: "none",
|
|
2195
|
+
who: "",
|
|
2196
|
+
reply: ""
|
|
2197
|
+
} : intercomOutcome(result?.details);
|
|
2198
|
+
const line = outcome.outcome === "none" || outcome.outcome === "answered" ? null : OUTCOME_LINE[outcome.outcome];
|
|
2199
|
+
const message = typeof args.message === "string" ? args.message.trim() : "";
|
|
2200
|
+
const recipient = summary.action === "reply" ? outcome.who : summary.target;
|
|
2201
|
+
const sender = intercomSender(result?.details);
|
|
2202
|
+
const chip = ACTION_CHIP[summary.action];
|
|
2203
|
+
return /* @__PURE__ */ jsx(MessageItem, {
|
|
2204
|
+
tone: toolTone({
|
|
2205
|
+
running,
|
|
2206
|
+
isError
|
|
2207
|
+
}),
|
|
2208
|
+
expandable: collapsed.glyph === "more",
|
|
2209
|
+
children: ({ expanded }) => {
|
|
2210
|
+
const shaped = expanded ? shapeResult(output, {
|
|
2211
|
+
expanded: true,
|
|
2212
|
+
isPartial: running,
|
|
2213
|
+
isError
|
|
2214
|
+
}) : collapsed;
|
|
2215
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
2216
|
+
title: "intercom",
|
|
2217
|
+
children: /* @__PURE__ */ jsxs(View, {
|
|
2218
|
+
testID: "tool-call-intercom",
|
|
2219
|
+
style: styles$1.summary,
|
|
2220
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
2221
|
+
numberOfLines: 1,
|
|
2222
|
+
style: [styles$1.sans, styles$1.action],
|
|
2223
|
+
children: summary.action
|
|
2224
|
+
}), recipient ? /* @__PURE__ */ jsxs(Text, {
|
|
2225
|
+
numberOfLines: 1,
|
|
2226
|
+
style: [styles$1.sans, styles$1.recipient],
|
|
2227
|
+
children: ["→ ", recipient]
|
|
2228
|
+
}) : null]
|
|
2229
|
+
})
|
|
2230
|
+
}), /* @__PURE__ */ jsxs(MessageItemBody, {
|
|
2231
|
+
testID: "tool-result-intercom",
|
|
2232
|
+
style: styles$1.body,
|
|
2233
|
+
children: [isError ? /* @__PURE__ */ jsx(Text, {
|
|
2234
|
+
selectable: true,
|
|
2235
|
+
accessibilityRole: "alert",
|
|
2236
|
+
style: [styles$1.sans, styles$1.error],
|
|
2237
|
+
children: shaped.lines.join("\n")
|
|
2238
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2239
|
+
message ? /* @__PURE__ */ jsxs(View, {
|
|
2240
|
+
testID: "intercom-outgoing",
|
|
2241
|
+
style: styles$1.outgoing,
|
|
2242
|
+
children: [
|
|
2243
|
+
/* @__PURE__ */ jsxs(View, {
|
|
2244
|
+
style: styles$1.speakerRow,
|
|
2245
|
+
children: [chip ? /* @__PURE__ */ jsx(Text, {
|
|
2246
|
+
style: [
|
|
2247
|
+
styles$1.small,
|
|
2248
|
+
styles$1.chip,
|
|
2249
|
+
styles$1.neutralChip
|
|
2250
|
+
],
|
|
2251
|
+
children: chip
|
|
2252
|
+
}) : null, sender ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(AgentAvatar, {
|
|
2253
|
+
name: sender,
|
|
2254
|
+
size: "sm"
|
|
2255
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
2256
|
+
numberOfLines: 1,
|
|
2257
|
+
style: [styles$1.small, styles$1.speaker],
|
|
2258
|
+
children: sender
|
|
2259
|
+
})] }) : null]
|
|
2260
|
+
}),
|
|
2261
|
+
/* @__PURE__ */ jsx(Text, {
|
|
2262
|
+
selectable: true,
|
|
2263
|
+
style: [
|
|
2264
|
+
styles$1.sans,
|
|
2265
|
+
styles$1.bubble,
|
|
2266
|
+
styles$1.outgoingBubble
|
|
2267
|
+
],
|
|
2268
|
+
children: message
|
|
2269
|
+
}),
|
|
2270
|
+
line ? /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
2271
|
+
tone: line.tone,
|
|
2272
|
+
glyph: line.glyph,
|
|
2273
|
+
children: line.text
|
|
2274
|
+
}) : null,
|
|
2275
|
+
running && summary.action !== "ask" ? /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
2276
|
+
tone: "running",
|
|
2277
|
+
children: "Sending"
|
|
2278
|
+
}) : null
|
|
2279
|
+
]
|
|
2280
|
+
}) : null,
|
|
2281
|
+
running && message && summary.action === "ask" ? /* @__PURE__ */ jsx(AgentTurn, {
|
|
2282
|
+
testID: "intercom-replying",
|
|
2283
|
+
name: recipient || "reply",
|
|
2284
|
+
state: "running",
|
|
2285
|
+
chip: /* @__PURE__ */ jsx(Text, {
|
|
2286
|
+
style: [styles$1.small, styles$1.dim],
|
|
2287
|
+
children: "is replying"
|
|
2288
|
+
}),
|
|
2289
|
+
children: /* @__PURE__ */ jsxs(View, {
|
|
2290
|
+
accessibilityLabel: `${recipient || "The recipient"} is replying`,
|
|
2291
|
+
style: [
|
|
2292
|
+
styles$1.bubble,
|
|
2293
|
+
styles$1.incomingBubble,
|
|
2294
|
+
styles$1.typing
|
|
2295
|
+
],
|
|
2296
|
+
children: [
|
|
2297
|
+
/* @__PURE__ */ jsx(Dot, {
|
|
2298
|
+
tone: "muted",
|
|
2299
|
+
size: "md",
|
|
2300
|
+
pulse: true
|
|
2301
|
+
}),
|
|
2302
|
+
/* @__PURE__ */ jsx(Dot, {
|
|
2303
|
+
tone: "muted",
|
|
2304
|
+
size: "md",
|
|
2305
|
+
pulse: true
|
|
2306
|
+
}),
|
|
2307
|
+
/* @__PURE__ */ jsx(Dot, {
|
|
2308
|
+
tone: "muted",
|
|
2309
|
+
size: "md",
|
|
2310
|
+
pulse: true
|
|
2311
|
+
})
|
|
2312
|
+
]
|
|
2313
|
+
})
|
|
2314
|
+
}) : null,
|
|
2315
|
+
outcome.outcome === "answered" ? /* @__PURE__ */ jsx(AgentTurn, {
|
|
2316
|
+
testID: "intercom-incoming",
|
|
2317
|
+
name: outcome.who,
|
|
2318
|
+
chip: /* @__PURE__ */ jsx(Text, {
|
|
2319
|
+
style: [
|
|
2320
|
+
styles$1.small,
|
|
2321
|
+
styles$1.chip,
|
|
2322
|
+
styles$1.repliedChip
|
|
2323
|
+
],
|
|
2324
|
+
children: "Replied"
|
|
2325
|
+
}),
|
|
2326
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
2327
|
+
selectable: true,
|
|
2328
|
+
style: [
|
|
2329
|
+
styles$1.sans,
|
|
2330
|
+
styles$1.bubble,
|
|
2331
|
+
styles$1.incomingBubble
|
|
2332
|
+
],
|
|
2333
|
+
children: outcome.reply
|
|
2334
|
+
})
|
|
2335
|
+
}) : null,
|
|
2336
|
+
!message && shaped.lines.length > 0 ? /* @__PURE__ */ jsx(Text, {
|
|
2337
|
+
selectable: true,
|
|
2338
|
+
numberOfLines: expanded ? void 0 : 1,
|
|
2339
|
+
style: [styles$1.sans, styles$1.dim],
|
|
2340
|
+
children: shaped.lines.join("\n")
|
|
2341
|
+
}) : null
|
|
2342
|
+
] }), shaped.glyph === "more" ? /* @__PURE__ */ jsxs(MessageItemStatus, {
|
|
2343
|
+
expands: true,
|
|
2344
|
+
children: [shaped.hidden, " more line(s)"]
|
|
2345
|
+
}) : null]
|
|
2346
|
+
})] });
|
|
2347
|
+
}
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2350
|
+
const styles$1 = StyleSheet.create((theme) => ({
|
|
2351
|
+
summary: {
|
|
2352
|
+
flex: 1,
|
|
2353
|
+
flexDirection: "row",
|
|
2354
|
+
alignItems: "center",
|
|
2355
|
+
gap: theme.spacing(2),
|
|
2356
|
+
minWidth: 0,
|
|
2357
|
+
uni__dependencies: [0]
|
|
2358
|
+
},
|
|
2359
|
+
sans: {
|
|
2360
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
2361
|
+
fontSize: theme.fontSize.base,
|
|
2362
|
+
lineHeight: theme.lineHeight.base,
|
|
2363
|
+
uni__dependencies: [0]
|
|
2364
|
+
},
|
|
2365
|
+
small: {
|
|
2366
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
2367
|
+
fontSize: theme.fontSize.sm,
|
|
2368
|
+
lineHeight: theme.lineHeight.sm,
|
|
2369
|
+
uni__dependencies: [0]
|
|
2370
|
+
},
|
|
2371
|
+
action: {
|
|
2372
|
+
flexShrink: 0,
|
|
2373
|
+
color: theme.colors.hi,
|
|
2374
|
+
uni__dependencies: [0]
|
|
2375
|
+
},
|
|
2376
|
+
recipient: {
|
|
2377
|
+
flexShrink: 1,
|
|
2378
|
+
color: theme.colors.cyan,
|
|
2379
|
+
uni__dependencies: [0]
|
|
2380
|
+
},
|
|
2381
|
+
body: {
|
|
2382
|
+
gap: theme.spacing(4),
|
|
2383
|
+
uni__dependencies: [0]
|
|
2384
|
+
},
|
|
2385
|
+
speakerRow: {
|
|
2386
|
+
flexDirection: "row",
|
|
2387
|
+
flexWrap: "wrap",
|
|
2388
|
+
alignItems: "center",
|
|
2389
|
+
columnGap: theme.spacing(2),
|
|
2390
|
+
rowGap: 1,
|
|
2391
|
+
uni__dependencies: [0]
|
|
2392
|
+
},
|
|
2393
|
+
speaker: {
|
|
2394
|
+
color: theme.colors.hi,
|
|
2395
|
+
fontWeight: theme.fontWeight.semibold,
|
|
2396
|
+
uni__dependencies: [0]
|
|
2397
|
+
},
|
|
2398
|
+
agentName: {
|
|
2399
|
+
flexShrink: 0,
|
|
2400
|
+
maxWidth: "70%"
|
|
2401
|
+
},
|
|
2402
|
+
role: { flexShrink: 1 },
|
|
2403
|
+
chip: {
|
|
2404
|
+
overflow: "hidden",
|
|
2405
|
+
borderRadius: theme.borderRadius.full,
|
|
2406
|
+
paddingHorizontal: theme.spacing(2),
|
|
2407
|
+
paddingVertical: 1,
|
|
2408
|
+
uni__dependencies: [0]
|
|
2409
|
+
},
|
|
2410
|
+
neutralChip: {
|
|
2411
|
+
backgroundColor: theme.colors.deep,
|
|
2412
|
+
color: theme.colors.dim,
|
|
2413
|
+
uni__dependencies: [0]
|
|
2414
|
+
},
|
|
2415
|
+
repliedChip: {
|
|
2416
|
+
backgroundColor: theme.colors["tint-green"],
|
|
2417
|
+
color: theme.colors.green,
|
|
2418
|
+
uni__dependencies: [0]
|
|
2419
|
+
},
|
|
2420
|
+
outgoing: {
|
|
2421
|
+
alignItems: "flex-end",
|
|
2422
|
+
gap: theme.spacing(1),
|
|
2423
|
+
uni__dependencies: [0]
|
|
2424
|
+
},
|
|
2425
|
+
agentTurn: {
|
|
2426
|
+
flexDirection: "row",
|
|
2427
|
+
alignItems: "flex-start",
|
|
2428
|
+
gap: theme.spacing(2),
|
|
2429
|
+
uni__dependencies: [0]
|
|
2430
|
+
},
|
|
2431
|
+
agentColumn: {
|
|
2432
|
+
flexShrink: 1,
|
|
2433
|
+
minWidth: 0,
|
|
2434
|
+
alignItems: "flex-start",
|
|
2435
|
+
gap: theme.spacing(1),
|
|
2436
|
+
uni__dependencies: [0]
|
|
2437
|
+
},
|
|
2438
|
+
bubble: {
|
|
2439
|
+
maxWidth: "90%",
|
|
2440
|
+
borderRadius: theme.borderRadius.lg,
|
|
2441
|
+
paddingHorizontal: theme.spacing(3),
|
|
2442
|
+
paddingVertical: theme.spacing(2),
|
|
2443
|
+
color: theme.colors.hi,
|
|
2444
|
+
uni__dependencies: [0]
|
|
2445
|
+
},
|
|
2446
|
+
outgoingBubble: {
|
|
2447
|
+
backgroundColor: theme.colors["tint-green"],
|
|
2448
|
+
uni__dependencies: [0]
|
|
2449
|
+
},
|
|
2450
|
+
incomingBubble: {
|
|
2451
|
+
maxWidth: "100%",
|
|
2452
|
+
backgroundColor: theme.colors.rail,
|
|
2453
|
+
uni__dependencies: [0]
|
|
2454
|
+
},
|
|
2455
|
+
typing: {
|
|
2456
|
+
flexDirection: "row",
|
|
2457
|
+
alignItems: "center",
|
|
2458
|
+
gap: theme.spacing(1.5),
|
|
2459
|
+
paddingVertical: theme.spacing(3),
|
|
2460
|
+
uni__dependencies: [0]
|
|
2461
|
+
},
|
|
2462
|
+
dim: {
|
|
2463
|
+
color: theme.colors.dim,
|
|
2464
|
+
uni__dependencies: [0]
|
|
2465
|
+
},
|
|
2466
|
+
error: {
|
|
2467
|
+
color: theme.colors.red,
|
|
2468
|
+
uni__dependencies: [0]
|
|
2469
|
+
}
|
|
2470
|
+
}));
|
|
2471
|
+
//#endregion
|
|
2472
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/intercom.native.tsx
|
|
2473
|
+
/** The intercom tool's timeline card on the phone. The filename names the tool it renders. */
|
|
2474
|
+
var intercom_native_default = defineToolRenderer({ message: IntercomToolMessage });
|
|
2475
|
+
//#endregion
|
|
2476
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/SubagentToolMessage.native.tsx
|
|
2477
|
+
const CLOSING = {
|
|
2478
|
+
running: {
|
|
2479
|
+
tone: "running",
|
|
2480
|
+
text: "Running"
|
|
2481
|
+
},
|
|
2482
|
+
done: {
|
|
2483
|
+
tone: "ok",
|
|
2484
|
+
text: "Done"
|
|
2485
|
+
}
|
|
2486
|
+
};
|
|
2487
|
+
const ROW_BADGE = {
|
|
2488
|
+
ok: "ok",
|
|
2489
|
+
error: "error",
|
|
2490
|
+
running: "running",
|
|
2491
|
+
idle: "neutral"
|
|
2492
|
+
};
|
|
2493
|
+
const STATUS_TONE = {
|
|
2494
|
+
ok: "ok",
|
|
2495
|
+
error: "error",
|
|
2496
|
+
running: "running",
|
|
2497
|
+
idle: "ok"
|
|
2498
|
+
};
|
|
2499
|
+
/** One structured row: the run or agent, what it is doing, and its state flushed right. */
|
|
2500
|
+
function SubagentRowLine({ row }) {
|
|
2501
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
2502
|
+
testID: "tool-result-subagent-row",
|
|
2503
|
+
style: styles.row,
|
|
2504
|
+
children: [
|
|
2505
|
+
/* @__PURE__ */ jsx(AgentAvatar, {
|
|
2506
|
+
name: row.label,
|
|
2507
|
+
seed: row.seed,
|
|
2508
|
+
state: row.avatar
|
|
2509
|
+
}),
|
|
2510
|
+
/* @__PURE__ */ jsxs(View, {
|
|
2511
|
+
style: styles.rowText,
|
|
2512
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
2513
|
+
numberOfLines: 1,
|
|
2514
|
+
style: [styles.sans, styles.label],
|
|
2515
|
+
children: row.label
|
|
2516
|
+
}), row.detail ? /* @__PURE__ */ jsx(Text, {
|
|
2517
|
+
numberOfLines: 1,
|
|
2518
|
+
style: [styles.small, styles.dim],
|
|
2519
|
+
children: row.detail
|
|
2520
|
+
}) : null]
|
|
2521
|
+
}),
|
|
2522
|
+
row.state ? /* @__PURE__ */ jsx(StatusBadge, {
|
|
2523
|
+
tone: ROW_BADGE[row.tone],
|
|
2524
|
+
size: "md",
|
|
2525
|
+
style: ROW_BADGE[row.tone] === "neutral" ? styles.neutralBadge : void 0,
|
|
2526
|
+
children: row.state
|
|
2527
|
+
}) : null
|
|
2528
|
+
]
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
/**
|
|
2532
|
+
* The subagent tool's timeline item on native, as the web's: the action and
|
|
2533
|
+
* its per-action detail in the header, the rows the result reported in the
|
|
2534
|
+
* body, and the subagents tab one tap away. A result the narrower does not
|
|
2535
|
+
* recognise, a partial one included, falls back to the text the model was
|
|
2536
|
+
* given. A failure shows only its reason, in red.
|
|
2537
|
+
*/
|
|
2538
|
+
function SubagentToolMessage({ args, result, output, running, isError, openTransientTab }) {
|
|
2539
|
+
const action = typeof args.action === "string" ? args.action : "";
|
|
2540
|
+
const detail = subagentCallDetail(args);
|
|
2541
|
+
const view = running || isError ? null : subagentResultView(result?.details);
|
|
2542
|
+
const hiddenRows = view ? Math.max(0, view.rows.length - 8) : 0;
|
|
2543
|
+
const collapsedText = view ? null : shapeResult(output, {
|
|
2544
|
+
expanded: false,
|
|
2545
|
+
isPartial: running,
|
|
2546
|
+
isError
|
|
2547
|
+
});
|
|
2548
|
+
return /* @__PURE__ */ jsx(MessageItem, {
|
|
2549
|
+
tone: toolTone({
|
|
2550
|
+
running,
|
|
2551
|
+
isError
|
|
2552
|
+
}),
|
|
2553
|
+
expandable: view ? hiddenRows > 0 : collapsedText?.glyph === "more",
|
|
2554
|
+
children: ({ expanded }) => {
|
|
2555
|
+
const shaped = view || !collapsedText ? null : expanded ? shapeResult(output, {
|
|
2556
|
+
expanded: true,
|
|
2557
|
+
isPartial: running,
|
|
2558
|
+
isError
|
|
2559
|
+
}) : collapsedText;
|
|
2560
|
+
const closing = shaped && (shaped.glyph === "running" || shaped.glyph === "done") ? CLOSING[shaped.glyph] : null;
|
|
2561
|
+
const rows = view ? expanded ? view.rows : view.rows.slice(0, 8) : [];
|
|
2562
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
2563
|
+
title: "subagent",
|
|
2564
|
+
children: /* @__PURE__ */ jsxs(View, {
|
|
2565
|
+
testID: "tool-call-subagent",
|
|
2566
|
+
style: styles.summary,
|
|
2567
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
2568
|
+
numberOfLines: 1,
|
|
2569
|
+
style: [styles.sans, styles.action],
|
|
2570
|
+
children: action
|
|
2571
|
+
}), detail ? /* @__PURE__ */ jsx(Text, {
|
|
2572
|
+
numberOfLines: 1,
|
|
2573
|
+
style: [styles.sans, styles.detail],
|
|
2574
|
+
children: detail
|
|
2575
|
+
}) : null]
|
|
2576
|
+
})
|
|
2577
|
+
}), /* @__PURE__ */ jsxs(MessageItemBody, {
|
|
2578
|
+
testID: "tool-result-subagent",
|
|
2579
|
+
style: styles.body,
|
|
2580
|
+
children: [
|
|
2581
|
+
isError ? /* @__PURE__ */ jsx(Text, {
|
|
2582
|
+
selectable: true,
|
|
2583
|
+
accessibilityRole: "alert",
|
|
2584
|
+
style: [styles.sans, styles.error],
|
|
2585
|
+
children: shaped?.lines.join("\n")
|
|
2586
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2587
|
+
rows.length > 0 ? /* @__PURE__ */ jsx(View, {
|
|
2588
|
+
style: styles.rows,
|
|
2589
|
+
children: rows.map((row) => /* @__PURE__ */ jsx(SubagentRowLine, { row }, row.key))
|
|
2590
|
+
}) : null,
|
|
2591
|
+
shaped && shaped.lines.length > 0 ? /* @__PURE__ */ jsx(Text, {
|
|
2592
|
+
selectable: true,
|
|
2593
|
+
numberOfLines: expanded ? void 0 : 1,
|
|
2594
|
+
style: [styles.mono, styles.dim],
|
|
2595
|
+
children: shaped.lines.join("\n")
|
|
2596
|
+
}) : null,
|
|
2597
|
+
!expanded && hiddenRows > 0 ? /* @__PURE__ */ jsxs(MessageItemStatus, {
|
|
2598
|
+
expands: true,
|
|
2599
|
+
children: [hiddenRows, " more"]
|
|
2600
|
+
}) : null,
|
|
2601
|
+
closing ? /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
2602
|
+
tone: closing.tone,
|
|
2603
|
+
children: closing.text
|
|
2604
|
+
}) : null
|
|
2605
|
+
] }),
|
|
2606
|
+
shaped?.glyph === "more" ? /* @__PURE__ */ jsxs(MessageItemStatus, {
|
|
2607
|
+
expands: true,
|
|
2608
|
+
children: [shaped.hidden, " more line(s)"]
|
|
2609
|
+
}) : null,
|
|
2610
|
+
isError ? null : /* @__PURE__ */ jsxs(View, {
|
|
2611
|
+
style: [styles.footer, rows.length > 0 ? styles.footerRule : null],
|
|
2612
|
+
children: [view && view.summary ? /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
2613
|
+
testID: "tool-result-subagent-summary",
|
|
2614
|
+
tone: STATUS_TONE[view.tone],
|
|
2615
|
+
children: view.summary
|
|
2616
|
+
}) : null, /* @__PURE__ */ jsxs(Pressable, {
|
|
2617
|
+
accessibilityRole: "button",
|
|
2618
|
+
testID: "tool-result-subagent-open",
|
|
2619
|
+
hitSlop: 10,
|
|
2620
|
+
onPress: () => openTransientTab(subagentsTab()),
|
|
2621
|
+
style: styles.open,
|
|
2622
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
2623
|
+
style: [styles.small, styles.openText],
|
|
2624
|
+
children: "Open subagents"
|
|
2625
|
+
}), /* @__PURE__ */ jsx(ArrowRightIcon, {
|
|
2626
|
+
size: 14,
|
|
2627
|
+
color: "green"
|
|
2628
|
+
})]
|
|
2629
|
+
})]
|
|
2630
|
+
})
|
|
2631
|
+
]
|
|
2632
|
+
})] });
|
|
2633
|
+
}
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
const styles = StyleSheet.create((theme) => ({
|
|
2637
|
+
summary: {
|
|
2638
|
+
flex: 1,
|
|
2639
|
+
flexDirection: "row",
|
|
2640
|
+
alignItems: "center",
|
|
2641
|
+
gap: theme.spacing(2),
|
|
2642
|
+
minWidth: 0,
|
|
2643
|
+
uni__dependencies: [0]
|
|
2644
|
+
},
|
|
2645
|
+
sans: {
|
|
2646
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
2647
|
+
fontSize: theme.fontSize.base,
|
|
2648
|
+
lineHeight: theme.lineHeight.base,
|
|
2649
|
+
uni__dependencies: [0]
|
|
2650
|
+
},
|
|
2651
|
+
small: {
|
|
2652
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
2653
|
+
fontSize: theme.fontSize.sm,
|
|
2654
|
+
lineHeight: theme.lineHeight.sm,
|
|
2655
|
+
uni__dependencies: [0]
|
|
2656
|
+
},
|
|
2657
|
+
mono: {
|
|
2658
|
+
fontFamily: fontOf(theme.fontFamily.mono),
|
|
2659
|
+
fontSize: theme.fontSize.sm,
|
|
2660
|
+
lineHeight: theme.lineHeightRelaxed.sm,
|
|
2661
|
+
uni__dependencies: [0]
|
|
2662
|
+
},
|
|
2663
|
+
action: {
|
|
2664
|
+
flexShrink: 0,
|
|
2665
|
+
color: theme.colors.dim,
|
|
2666
|
+
uni__dependencies: [0]
|
|
2667
|
+
},
|
|
2668
|
+
detail: {
|
|
2669
|
+
flexShrink: 1,
|
|
2670
|
+
color: theme.colors.dim,
|
|
2671
|
+
uni__dependencies: [0]
|
|
2672
|
+
},
|
|
2673
|
+
body: {
|
|
2674
|
+
gap: theme.spacing(1),
|
|
2675
|
+
uni__dependencies: [0]
|
|
2676
|
+
},
|
|
2677
|
+
rows: {
|
|
2678
|
+
marginHorizontal: -theme.spacing(2),
|
|
2679
|
+
uni__dependencies: [0]
|
|
2680
|
+
},
|
|
2681
|
+
row: {
|
|
2682
|
+
flexDirection: "row",
|
|
2683
|
+
alignItems: "center",
|
|
2684
|
+
gap: theme.spacing(3),
|
|
2685
|
+
paddingHorizontal: theme.spacing(2),
|
|
2686
|
+
paddingVertical: theme.spacing(1.5),
|
|
2687
|
+
uni__dependencies: [0]
|
|
2688
|
+
},
|
|
2689
|
+
rowText: {
|
|
2690
|
+
flex: 1,
|
|
2691
|
+
minWidth: 0
|
|
2692
|
+
},
|
|
2693
|
+
label: {
|
|
2694
|
+
fontWeight: theme.fontWeight.semibold,
|
|
2695
|
+
color: theme.colors.hi,
|
|
2696
|
+
uni__dependencies: [0]
|
|
2697
|
+
},
|
|
2698
|
+
neutralBadge: {
|
|
2699
|
+
backgroundColor: theme.colors.rail,
|
|
2700
|
+
uni__dependencies: [0]
|
|
2701
|
+
},
|
|
2702
|
+
footer: {
|
|
2703
|
+
flexDirection: "row",
|
|
2704
|
+
flexWrap: "wrap",
|
|
2705
|
+
alignItems: "center",
|
|
2706
|
+
columnGap: theme.spacing(4),
|
|
2707
|
+
rowGap: theme.spacing(1),
|
|
2708
|
+
uni__dependencies: [0]
|
|
2709
|
+
},
|
|
2710
|
+
footerRule: {
|
|
2711
|
+
marginTop: theme.spacing(1),
|
|
2712
|
+
paddingTop: theme.spacing(2.5),
|
|
2713
|
+
borderTopWidth: 1,
|
|
2714
|
+
borderTopColor: theme.colors["border-soft"],
|
|
2715
|
+
uni__dependencies: [0]
|
|
2716
|
+
},
|
|
2717
|
+
open: {
|
|
2718
|
+
flexDirection: "row",
|
|
2719
|
+
alignItems: "center",
|
|
2720
|
+
gap: theme.spacing(1),
|
|
2721
|
+
uni__dependencies: [0]
|
|
2722
|
+
},
|
|
2723
|
+
openText: {
|
|
2724
|
+
fontWeight: theme.fontWeight.medium,
|
|
2725
|
+
color: theme.colors.green,
|
|
2726
|
+
uni__dependencies: [0]
|
|
2727
|
+
},
|
|
2728
|
+
dim: {
|
|
2729
|
+
color: theme.colors.dim,
|
|
2730
|
+
uni__dependencies: [0]
|
|
2731
|
+
},
|
|
2732
|
+
error: {
|
|
2733
|
+
color: theme.colors.red,
|
|
2734
|
+
uni__dependencies: [0]
|
|
2735
|
+
}
|
|
2736
|
+
}));
|
|
2737
|
+
//#endregion
|
|
2738
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/subagent.native.tsx
|
|
2739
|
+
/** The subagent tool's timeline card on the phone. The filename names the tool it renders. */
|
|
2740
|
+
var subagent_native_default = defineToolRenderer({ message: SubagentToolMessage });
|
|
1830
2741
|
//#endregion
|
|
1831
2742
|
//#region generated/native.ts
|
|
1832
2743
|
const via = (identity, value) => value === void 0 ? void 0 : {
|
|
@@ -1853,6 +2764,9 @@ const nativePlugin = defineNativePlugin({
|
|
|
1853
2764
|
slot: "activity.agents",
|
|
1854
2765
|
id: "agents"
|
|
1855
2766
|
}, Agents_activity_agents_native_default)];
|
|
2767
|
+
},
|
|
2768
|
+
get toolRenderers() {
|
|
2769
|
+
return [via({ tools: ["intercom"] }, intercom_native_default), via({ tools: ["subagent"] }, subagent_native_default)];
|
|
1856
2770
|
}
|
|
1857
2771
|
}
|
|
1858
2772
|
});
|