@agimon-ai/po-session 0.0.0-alpha.195 → 0.0.0-alpha.197
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 +19 -12
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +14 -9
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +14 -9
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +15 -12
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/package.json +9 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineFill, defineHostStore, defineNativePlugin, defineToolRenderer, defineWebLifecycle } from "@agimon-ai/po-core/native";
|
|
1
|
+
import { defineFill, defineHostStore, defineNativePlugin, defineToolRenderer, defineWebLifecycle, useT } from "@agimon-ai/po-core/native";
|
|
2
2
|
import { View } from "react-native-unistyles/components/native/View";
|
|
3
3
|
import { Text } from "react-native-unistyles/components/native/Text";
|
|
4
4
|
import { Button, Dot, EmptyState, Input, ListRow, MessageIcon, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, SearchIcon, SheetBody, SheetDescription, SheetFooter, fontOf, resultTextLines, toolTone } from "@agimon-ai/po-native-components";
|
|
@@ -97,6 +97,7 @@ const TONE = {
|
|
|
97
97
|
};
|
|
98
98
|
/** The Insert sheet page: lists the computer's live sessions and steers the composer's text into one. */
|
|
99
99
|
function SendToSessionPanel({ sessionId, listSessions, takeComposerDraft, appendComposerDraft }) {
|
|
100
|
+
const t = useT();
|
|
100
101
|
const [sessions] = useState(() => listSessions?.() ?? []);
|
|
101
102
|
const [to, setTo] = useState();
|
|
102
103
|
const [busy, setBusy] = useState(false);
|
|
@@ -122,7 +123,7 @@ function SendToSessionPanel({ sessionId, listSessions, takeComposerDraft, append
|
|
|
122
123
|
const state = held.current;
|
|
123
124
|
const text = state.text ?? takeComposerDraft?.() ?? "";
|
|
124
125
|
if (text.trim() === "") {
|
|
125
|
-
setError("Write something to send.");
|
|
126
|
+
setError(t("session.ui.writeSomethingToSend", "Write something to send."));
|
|
126
127
|
return;
|
|
127
128
|
}
|
|
128
129
|
state.text = text;
|
|
@@ -157,6 +158,7 @@ function SendToSessionPanel({ sessionId, listSessions, takeComposerDraft, append
|
|
|
157
158
|
});
|
|
158
159
|
}
|
|
159
160
|
function SendToSessionView({ sessions, to, busy, error, onPick, onSend }) {
|
|
161
|
+
const t = useT();
|
|
160
162
|
const [filter, setFilter] = useState("");
|
|
161
163
|
const shown = useMemo(() => {
|
|
162
164
|
const query = filter.trim().toLowerCase();
|
|
@@ -164,7 +166,7 @@ function SendToSessionView({ sessions, to, busy, error, onPick, onSend }) {
|
|
|
164
166
|
}, [filter, sessions]);
|
|
165
167
|
const target = sessions.find((session) => session.id === to);
|
|
166
168
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(SheetBody, { children: [
|
|
167
|
-
/* @__PURE__ */ jsx(SheetDescription, { children: "Send what you typed to another session. It arrives there from you." }),
|
|
169
|
+
/* @__PURE__ */ jsx(SheetDescription, { children: t("session.ui.sendDraftDescription", "Send what you typed to another session. It arrives there from you.") }),
|
|
168
170
|
error === "" ? null : /* @__PURE__ */ jsx(Text, {
|
|
169
171
|
accessibilityRole: "alert",
|
|
170
172
|
style: styles$1.alert,
|
|
@@ -173,19 +175,19 @@ function SendToSessionView({ sessions, to, busy, error, onPick, onSend }) {
|
|
|
173
175
|
sessions.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
174
176
|
size: "compact",
|
|
175
177
|
icon: /* @__PURE__ */ jsx(MessageIcon, { size: 16 }),
|
|
176
|
-
title: "No other session is running",
|
|
177
|
-
description: "Open one, then send."
|
|
178
|
+
title: t("session.ui.noOtherSessionRunning", "No other session is running"),
|
|
179
|
+
description: t("session.ui.openThenSend", "Open one, then send.")
|
|
178
180
|
}) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Input, {
|
|
179
|
-
accessibilityLabel: "Filter sessions",
|
|
180
|
-
placeholder: "Filter sessions",
|
|
181
|
+
accessibilityLabel: t("session.ui.filterSessions", "Filter sessions"),
|
|
182
|
+
placeholder: t("session.ui.filterSessions", "Filter sessions"),
|
|
181
183
|
value: filter,
|
|
182
184
|
onChangeText: setFilter
|
|
183
185
|
}), shown.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
184
186
|
size: "compact",
|
|
185
187
|
icon: /* @__PURE__ */ jsx(SearchIcon, { size: 16 }),
|
|
186
|
-
title: "Nothing matches that filter",
|
|
188
|
+
title: t("session.ui.noFilterMatches", "Nothing matches that filter"),
|
|
187
189
|
secondaryAction: {
|
|
188
|
-
label: "Clear filter",
|
|
190
|
+
label: t("session.ui.clearFilter", "Clear filter"),
|
|
189
191
|
onAction: () => setFilter("")
|
|
190
192
|
}
|
|
191
193
|
}) : /* @__PURE__ */ jsx(View, {
|
|
@@ -213,7 +215,7 @@ function SendToSessionView({ sessions, to, busy, error, onPick, onSend }) {
|
|
|
213
215
|
variant: "primary",
|
|
214
216
|
disabled: busy || target === void 0,
|
|
215
217
|
onPress: onSend,
|
|
216
|
-
children: busy ? "Sending…" : target === void 0 ? "Pick a session" :
|
|
218
|
+
children: busy ? t("session.ui.sending", "Sending…") : target === void 0 ? t("session.ui.pickSession", "Pick a session") : t("session.ui.sendToName", "Send to {name}", { name: target.name })
|
|
217
219
|
}) })] });
|
|
218
220
|
}
|
|
219
221
|
const styles$1 = StyleSheet.create((theme) => {
|
|
@@ -256,7 +258,11 @@ const styles$1 = StyleSheet.create((theme) => {
|
|
|
256
258
|
var SendToSession_composer_menu_native_default = defineFill({
|
|
257
259
|
data: {
|
|
258
260
|
title: "Send to session…",
|
|
259
|
-
hint: "Steer another session with what you typed"
|
|
261
|
+
hint: "Steer another session with what you typed",
|
|
262
|
+
translateCopy: (t) => ({
|
|
263
|
+
title: t("session.insert.title", "Send to session…"),
|
|
264
|
+
hint: t("session.insert.hint", "Steer another session with what you typed")
|
|
265
|
+
})
|
|
260
266
|
},
|
|
261
267
|
component: SendToSessionPanel
|
|
262
268
|
});
|
|
@@ -289,6 +295,7 @@ function networkActivity({ toolName, args, isError }) {
|
|
|
289
295
|
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/NetworkToolMessage.native.tsx
|
|
290
296
|
/** A network.send, network.ask or network.reply recorded inside an exec. Collapsed to its summary; the body is the result text. */
|
|
291
297
|
function NetworkToolMessage({ args, result, output, running, isError, toolName }) {
|
|
298
|
+
const t = useT();
|
|
292
299
|
const lines = resultTextLines(result, output);
|
|
293
300
|
return /* @__PURE__ */ jsx(MessageItem, {
|
|
294
301
|
tone: toolTone({
|
|
@@ -312,7 +319,7 @@ function NetworkToolMessage({ args, result, output, running, isError, toolName }
|
|
|
312
319
|
style: styles.body,
|
|
313
320
|
children: [running ? /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
314
321
|
tone: "running",
|
|
315
|
-
children: "working"
|
|
322
|
+
children: t("session.ui.working", "working")
|
|
316
323
|
}) : null, lines.map((line, index) => /* @__PURE__ */ jsx(Text, {
|
|
317
324
|
selectable: true,
|
|
318
325
|
style: isError ? styles.error : styles.dim,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.mjs","names":["WebPluginSessionOption","WebPluginSlotProps","Button","Dot","EmptyState","fontOf","Input","ListRow","MessageIcon","SearchIcon","SheetBody","SheetDescription","SheetFooter","useEffect","useMemo","useRef","useState","StyleSheet","sendToSession","TONE","running","waiting","idle","const","SendToSessionPanel","sessionId","listSessions","takeComposerDraft","appendComposerDraft","sessions","to","setTo","busy","setBusy","error","setError","held","text","inFlight","live","giveBack","current","state","undefined","send","Promise","trim","refusal","from","SendToSessionViewProps","onPick","id","onSend","SendToSessionView","filter","setFilter","shown","query","toLowerCase","session","name","detail","includes","target","find","styles","alert","length","label","onAction","rows","map","index","separator","row","create","theme","small","fontFamily","sans","fontSize","sm","lineHeight","borderTopWidth","hairlineWidth","borderBottomWidth","borderColor","colors","uni__dependencies","paddingHorizontal","spacing","height","backgroundColor","color","dim","red","styles","ToolMessageRenderProps","fontOf","MessageItem","MessageItemBody","MessageItemHeader","MessageItemStatus","resultTextLines","toolTone","PoNativeTheme","StyleSheet","networkSummary","NetworkToolMessage","args","result","output","running","isError","toolName","lines","length","expanded","styles","summary","primary","body","map","line","index","String","error","dim","create","theme","flex","flexDirection","alignItems","minWidth","flexShrink","color","colors","text","fontFamily","sans","fontSize","base","uni__dependencies","gap","spacing","red","fillSendToSession","lifecycleStart","toolNetwork"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/_lib/sendToSessionDelivery.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/sendToSessionRequest.native.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/_components/SendToSessionPanel.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/SendToSession.composer-menu.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/lifecycle/start.native.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/networkActivity.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/NetworkToolMessage.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/network.native.tsx","../../generated/native.ts"],"sourcesContent":["import type { WebPluginRuntime } from '@agimon-ai/po-core/web';\n\n/**\n * Delivers one send through the started runtime that owns the sending session.\n *\n * DESIGN PATTERNS:\n * - Host-neutral and stateless: the web and native request files each keep\n * their own runtime list (from their own po-core entry) and pass it in.\n * The phone starts one runtime per computer; a send goes through the one\n * that owns the sending session, with that computer's local ids.\n *\n * AVOID:\n * - Value imports from a po-core entry here. Native plugins may not import\n * `po-core/web`, and web plugins may not import `po-core/native`.\n */\n\n/** The runtime that owns `from`, with both ids as its computer knows them; undefined when none does. */\nfunction route(runtimes: readonly WebPluginRuntime[], input: { from: string; to: string }) {\n const owners = runtimes.flatMap((runtime) => {\n try {\n const from = runtime.localSessionId?.(input.from) ?? input.from;\n const to = runtime.localSessionId?.(input.to) ?? input.to;\n // An unqualified id belongs to the computer that would leave it unqualified (the local hub).\n const owns = from !== input.from || (runtime.qualifySessionId?.(input.from) ?? input.from) === input.from;\n return owns ? [{ runtime, from, to }] : [];\n } catch {\n // localSessionId refuses an id of another computer: this runtime does not own the send.\n return [];\n }\n });\n return owners.at(-1);\n}\n\n/** Steers `text` into session `to`. Resolves to the reason shown when it was refused, or undefined once delivered. */\nexport async function deliverToSession(\n runtimes: readonly WebPluginRuntime[],\n input: { from: string; to: string; text: string },\n): Promise<string | undefined> {\n const owner = route(runtimes, input);\n if (!owner) return 'Po is not connected. Your text is kept; try again.';\n try {\n await owner.runtime.invokeServerMethod({\n mount: { scope: 'host' },\n service: 'sessions',\n method: 'sendToSession',\n input: { from: owner.from, to: owner.to, text: input.text },\n });\n return undefined;\n } catch (error) {\n return error instanceof Error && error.message !== '' ? error.message : 'The message was not delivered.';\n }\n}\n","import { defineHostStore, type WebPluginRuntime } from '@agimon-ai/po-core/native';\n\nimport { deliverToSession } from './sendToSessionDelivery';\n\n/**\n * The phone's started runtimes, one per computer, for the send-to-session panel.\n *\n * DESIGN PATTERNS:\n * - The native twin of sendToSessionRequest.ts: a native plugin may import\n * po-core/native only. The phone has no menu-to-overlay handoff, so only the\n * runtime list and the send live here.\n */\n\nconst runtimes = defineHostStore<readonly WebPluginRuntime[]>([]);\n\nexport function startSendToSessionRuntime(runtime: WebPluginRuntime): () => void {\n runtimes.update((current) => [...current, runtime]);\n return () => runtimes.update((current) => current.filter((entry) => entry !== runtime));\n}\n\n/** Steers `text` into session `to`. Resolves to the reason shown when it was refused, or undefined once delivered. */\nexport function sendToSession(input: { from: string; to: string; text: string }): Promise<string | undefined> {\n return deliverToSession(runtimes.store.state, input);\n}\n","import type { WebPluginSessionOption, WebPluginSlotProps } from '@agimon-ai/po-core/native';\nimport {\n Button,\n Dot,\n EmptyState,\n fontOf,\n Input,\n ListRow,\n MessageIcon,\n SearchIcon,\n SheetBody,\n SheetDescription,\n SheetFooter,\n} from '@agimon-ai/po-native-components';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { sendToSession } from '../../_lib/sendToSessionRequest.native';\n\n/**\n * The phone's \"Send to session…\" page of the composer's Insert sheet: pick a\n * live session, then Send steers what the person typed into it.\n *\n * DESIGN PATTERNS:\n * - The draft is taken only at Send, so opening and leaving the page never\n * touches it. A refused send keeps the taken text for a retry and hands it\n * back to the composer when the page goes away.\n * - The sheet closes when the page appends to the draft; an empty append\n * closes it and leaves the draft alone.\n *\n * AVOID:\n * - Sending on a row tap. On a phone a mis-tap would send; Send is its own button.\n */\n\nconst TONE = { running: 'green', waiting: 'magenta', idle: 'neutral' } as const;\n\n/** The Insert sheet page: lists the computer's live sessions and steers the composer's text into one. */\nexport function SendToSessionPanel({\n sessionId,\n listSessions,\n takeComposerDraft,\n appendComposerDraft,\n}: WebPluginSlotProps) {\n const [sessions] = useState(() => listSessions?.() ?? []);\n const [to, setTo] = useState<string>();\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState('');\n // Text taken from the composer and not yet delivered; `live` is false once the page is gone.\n const held = useRef<{ text?: string; inFlight: boolean; live: boolean }>({ inFlight: false, live: true });\n const giveBack = useRef(appendComposerDraft);\n useEffect(() => {\n giveBack.current = appendComposerDraft;\n }, [appendComposerDraft]);\n useEffect(() => {\n const state = held.current;\n state.live = true;\n return () => {\n state.live = false;\n if (state.text !== undefined && !state.inFlight) giveBack.current(state.text);\n };\n }, []);\n\n const send = async (): Promise<void> => {\n if (to === undefined || sessionId === null) return;\n const state = held.current;\n const text = state.text ?? takeComposerDraft?.() ?? '';\n if (text.trim() === '') {\n setError('Write something to send.');\n return;\n }\n state.text = text;\n state.inFlight = true;\n setBusy(true);\n setError('');\n const refusal = await sendToSession({ from: sessionId, to, text: text.trim() });\n state.inFlight = false;\n if (refusal === undefined) state.text = undefined;\n if (!state.live) {\n if (state.text !== undefined) giveBack.current(state.text);\n return;\n }\n if (refusal === undefined) {\n giveBack.current('');\n return;\n }\n setBusy(false);\n setError(refusal);\n };\n\n return (\n <SendToSessionView\n sessions={sessions}\n to={to}\n busy={busy}\n error={error}\n onPick={setTo}\n onSend={() => void send()}\n />\n );\n}\n\nexport interface SendToSessionViewProps {\n sessions: readonly WebPluginSessionOption[];\n to: string | undefined;\n busy: boolean;\n /** The server's refusal, shown above the list; empty when there is none. */\n error: string;\n onPick: (id: string) => void;\n onSend: () => void;\n}\n\nexport function SendToSessionView({ sessions, to, busy, error, onPick, onSend }: SendToSessionViewProps) {\n const [filter, setFilter] = useState('');\n const shown = useMemo(() => {\n const query = filter.trim().toLowerCase();\n return query === ''\n ? sessions\n : sessions.filter((session) => `${session.name} ${session.detail}`.toLowerCase().includes(query));\n }, [filter, sessions]);\n const target = sessions.find((session) => session.id === to);\n\n return (\n <>\n <SheetBody>\n <SheetDescription>Send what you typed to another session. It arrives there from you.</SheetDescription>\n {error === '' ? null : (\n <Text accessibilityRole=\"alert\" style={styles.alert}>\n {error}\n </Text>\n )}\n {sessions.length === 0 ? (\n <EmptyState\n size=\"compact\"\n icon={<MessageIcon size={16} />}\n title=\"No other session is running\"\n description=\"Open one, then send.\"\n />\n ) : (\n <>\n <Input\n accessibilityLabel=\"Filter sessions\"\n placeholder=\"Filter sessions\"\n value={filter}\n onChangeText={setFilter}\n />\n {shown.length === 0 ? (\n <EmptyState\n size=\"compact\"\n icon={<SearchIcon size={16} />}\n title=\"Nothing matches that filter\"\n secondaryAction={{ label: 'Clear filter', onAction: () => setFilter('') }}\n />\n ) : (\n <View style={styles.rows}>\n {shown.map((session, index) => (\n <View key={session.id}>\n {index > 0 ? <View style={styles.separator} /> : null}\n <ListRow\n accessibilityLabel={`${session.name}, ${session.detail}`}\n selected={session.id === to}\n disabled={busy}\n onPress={() => onPick(session.id)}\n disclosure={false}\n style={styles.row}\n leading={<Dot tone={TONE[session.state]} size=\"md\" />}\n title={session.name}\n description={\n <Text numberOfLines={1} style={styles.detail}>\n {session.detail}\n </Text>\n }\n />\n </View>\n ))}\n </View>\n )}\n </>\n )}\n </SheetBody>\n <SheetFooter>\n <Button variant=\"primary\" disabled={busy || target === undefined} onPress={onSend}>\n {busy ? 'Sending…' : target === undefined ? 'Pick a session' : `Send to ${target.name}`}\n </Button>\n </SheetFooter>\n </>\n );\n}\n\nconst styles = StyleSheet.create((theme) => {\n const small = {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n };\n return {\n rows: {\n borderTopWidth: StyleSheet.hairlineWidth,\n borderBottomWidth: StyleSheet.hairlineWidth,\n borderColor: theme.colors['border-soft'],\n },\n row: { paddingHorizontal: theme.spacing(1) },\n separator: { height: StyleSheet.hairlineWidth, backgroundColor: theme.colors['border-soft'] },\n detail: { ...small, color: theme.colors.dim },\n alert: { ...small, color: theme.colors.red },\n };\n});\n","import { defineFill } from '@agimon-ai/po-core/native';\n\nimport { SendToSessionPanel } from './_components/SendToSessionPanel.native';\n\n/** The phone's Insert sheet draws `data` as the row and `component` as the page it opens. */\nexport default defineFill({\n data: { title: 'Send to session…', hint: 'Steer another session with what you typed' },\n component: SendToSessionPanel,\n});\n","import { defineWebLifecycle } from '@agimon-ai/po-core/native';\n\nimport { startSendToSessionRuntime } from '../_lib/sendToSessionRequest.native';\n\nexport default defineWebLifecycle(startSendToSessionRuntime);\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\n\nconst ACTIVITY_CHARS = 72;\n\nfunction asString(value: unknown): string {\n return typeof value === 'string' ? value : '';\n}\n\nfunction clip(text: string): string {\n const flat = text.replace(/\\s+/g, ' ').trim();\n return flat.length > ACTIVITY_CHARS ? `${flat.slice(0, ACTIVITY_CHARS - 1)}…` : flat;\n}\n\n/** Who a message is for, or what it answers. */\nexport function networkSummary(toolName: string, args: Record<string, unknown>): string {\n const verb = toolName.split('.').at(-1) ?? toolName;\n return toolName === 'network.reply' ? 'reply' : `${verb} ${asString(args.to)}`.trim();\n}\n\n/** One line per outgoing session message: who it went to and what it said. */\nexport function networkActivity({\n toolName,\n args,\n isError,\n}: Pick<ToolMessageRenderProps, 'toolName' | 'args' | 'isError'>): string[] {\n const text = clip(asString(args.text));\n if (isError || !text) return [];\n if (toolName === 'network.reply') return [`Replied \"${text}\"`];\n const to = asString(args.to) || 'session';\n return [`→ ${to}${toolName === 'network.ask' ? ' asks' : ''} \"${text}\"`];\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/native';\nimport {\n fontOf,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n resultTextLines,\n toolTone,\n} from '@agimon-ai/po-native-components';\nimport type { PoNativeTheme } from '@agimon-ai/po-web-components/nativeTheme';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { networkSummary } from '../_lib/networkActivity';\n\n/** A network.send, network.ask or network.reply recorded inside an exec. Collapsed to its summary; the body is the result text. */\nexport function NetworkToolMessage({ args, result, output, running, isError, toolName }: ToolMessageRenderProps) {\n const lines = resultTextLines(result, output);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable={lines.length > 0}>\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"network\">\n <View testID=\"tool-call-network\" style={styles.summary}>\n <Text numberOfLines={1} style={styles.primary}>\n {networkSummary(toolName, args)}\n </Text>\n </View>\n </MessageItemHeader>\n {expanded ? (\n <MessageItemBody testID=\"tool-result-network\" style={styles.body}>\n {running ? <MessageItemStatus tone=\"running\">working</MessageItemStatus> : null}\n {lines.map((line, index) => (\n <Text key={`${String(index)}-${line}`} selectable style={isError ? styles.error : styles.dim}>\n {line}\n </Text>\n ))}\n </MessageItemBody>\n ) : null}\n </>\n )}\n </MessageItem>\n );\n}\n\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n summary: { flex: 1, flexDirection: 'row', alignItems: 'center', minWidth: 0 },\n primary: {\n flexShrink: 1,\n minWidth: 0,\n color: theme.colors.text,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n },\n body: { gap: theme.spacing(1) },\n dim: { color: theme.colors.dim, fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.base },\n error: { color: theme.colors.red, fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.base },\n}));\n","import { defineToolRenderer } from '@agimon-ai/po-core/native';\n\nimport { NetworkToolMessage } from './_components/NetworkToolMessage.native';\nimport { networkActivity } from './_lib/networkActivity';\n\n/** The network namespace's recorded calls. Named by hand: the dotted tool names are not a filename. */\nexport default defineToolRenderer({\n tools: ['network.send', 'network.ask', 'network.reply'],\n message: NetworkToolMessage,\n activity: networkActivity,\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineNativePlugin, type WebPluginContributions } from '@agimon-ai/po-core/native';\n\nimport fillSendToSession from '../src/extensions/workspaces/sessions/(frontend)/fill/SendToSession.composer-menu.native';\nimport lifecycleStart from '../src/extensions/workspaces/sessions/(frontend)/lifecycle/start.native';\nimport toolNetwork from '../src/extensions/workspaces/sessions/(frontend)/tool/network.native';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const nativePlugin = defineNativePlugin({\n id: 'sessions',\n packageName: '@agimon-ai/po-session',\n session: {\n get fills(): WebPluginContributions['fills'] { return [via({ slot: 'composer-menu', id: 'send-to-session' }, fillSendToSession)]; },\n get start(): WebPluginContributions['start'] { return lifecycleStart; },\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['network'] }, toolNetwork)]; },\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiBA,SAAS,MAAM,UAAuC,OAAqC;CAazF,OAZe,SAAS,SAAS,YAAY;EAC3C,IAAI;GACF,MAAM,OAAO,QAAQ,iBAAiB,MAAM,IAAI,KAAK,MA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CAAA,CAAA;CAAC;CACzGhB,OAAO;EAAES,OAAON,MAAMO,OAAOS;EAAKP,YAAYxC,OAAO+B,MAAMS,WAAWC,IAAI;EAAGC,UAAUX,MAAMW,SAASC;EAAIC,mBAAA,CAAA,CAAA;CAAC;AAC7G,EAAE;;;;ACpDF,IAAA,yBAAe,mBAAmB;CAChC,OAAO;EAAC;EAAgB;EAAe;CAAe;CACtD,SAAS;CACT,UAAU;AACZ,CAAC;;;ACHD,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,eAAe,mBAAmB;CAC7C,IAAI;CACJ,aAAa;CACb,SAAS;EACP,IAAI,QAAyC;GAAE,OAAO,CAAC,IAAI;IAAE,MAAM;IAAiB,IAAI;GAAkB,GAAGI,0CAAiB,CAAC;EAAG;EAClI,IAAI,QAAyC;GAAE,OAAOC;EAAgB;EACtE,IAAI,gBAAyD;GAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,GAAGC,sBAAW,CAAC;EAAG;CACpH;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"native.mjs","names":["useT","WebPluginSessionOption","WebPluginSlotProps","Button","Dot","EmptyState","fontOf","Input","ListRow","MessageIcon","SearchIcon","SheetBody","SheetDescription","SheetFooter","useEffect","useMemo","useRef","useState","StyleSheet","sendToSession","TONE","running","waiting","idle","const","SendToSessionPanel","sessionId","listSessions","takeComposerDraft","appendComposerDraft","t","sessions","to","setTo","busy","setBusy","error","setError","held","text","inFlight","live","giveBack","current","state","undefined","send","Promise","trim","refusal","from","SendToSessionViewProps","onPick","id","onSend","SendToSessionView","filter","setFilter","shown","query","toLowerCase","session","name","detail","includes","target","find","styles","alert","length","label","onAction","rows","map","index","separator","row","create","theme","small","fontFamily","sans","fontSize","sm","lineHeight","borderTopWidth","hairlineWidth","borderBottomWidth","borderColor","colors","uni__dependencies","paddingHorizontal","spacing","height","backgroundColor","color","dim","red","styles","useT","ToolMessageRenderProps","fontOf","MessageItem","MessageItemBody","MessageItemHeader","MessageItemStatus","resultTextLines","toolTone","PoNativeTheme","StyleSheet","networkSummary","NetworkToolMessage","args","result","output","running","isError","toolName","t","lines","length","expanded","styles","summary","primary","body","map","line","index","String","error","dim","create","theme","flex","flexDirection","alignItems","minWidth","flexShrink","color","colors","text","fontFamily","sans","fontSize","base","uni__dependencies","gap","spacing","red","fillSendToSession","lifecycleStart","toolNetwork"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/_lib/sendToSessionDelivery.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/sendToSessionRequest.native.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/_components/SendToSessionPanel.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/SendToSession.composer-menu.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/lifecycle/start.native.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/networkActivity.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/NetworkToolMessage.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/network.native.tsx","../../generated/native.ts"],"sourcesContent":["import type { WebPluginRuntime } from '@agimon-ai/po-core/web';\n\n/**\n * Delivers one send through the started runtime that owns the sending session.\n *\n * DESIGN PATTERNS:\n * - Host-neutral and stateless: the web and native request files each keep\n * their own runtime list (from their own po-core entry) and pass it in.\n * The phone starts one runtime per computer; a send goes through the one\n * that owns the sending session, with that computer's local ids.\n *\n * AVOID:\n * - Value imports from a po-core entry here. Native plugins may not import\n * `po-core/web`, and web plugins may not import `po-core/native`.\n */\n\n/** The runtime that owns `from`, with both ids as its computer knows them; undefined when none does. */\nfunction route(runtimes: readonly WebPluginRuntime[], input: { from: string; to: string }) {\n const owners = runtimes.flatMap((runtime) => {\n try {\n const from = runtime.localSessionId?.(input.from) ?? input.from;\n const to = runtime.localSessionId?.(input.to) ?? input.to;\n // An unqualified id belongs to the computer that would leave it unqualified (the local hub).\n const owns = from !== input.from || (runtime.qualifySessionId?.(input.from) ?? input.from) === input.from;\n return owns ? [{ runtime, from, to }] : [];\n } catch {\n // localSessionId refuses an id of another computer: this runtime does not own the send.\n return [];\n }\n });\n return owners.at(-1);\n}\n\n/** Steers `text` into session `to`. Resolves to the reason shown when it was refused, or undefined once delivered. */\nexport async function deliverToSession(\n runtimes: readonly WebPluginRuntime[],\n input: { from: string; to: string; text: string },\n): Promise<string | undefined> {\n const owner = route(runtimes, input);\n if (!owner) return 'Po is not connected. Your text is kept; try again.';\n try {\n await owner.runtime.invokeServerMethod({\n mount: { scope: 'host' },\n service: 'sessions',\n method: 'sendToSession',\n input: { from: owner.from, to: owner.to, text: input.text },\n });\n return undefined;\n } catch (error) {\n return error instanceof Error && error.message !== '' ? error.message : 'The message was not delivered.';\n }\n}\n","import { defineHostStore, type WebPluginRuntime } from '@agimon-ai/po-core/native';\n\nimport { deliverToSession } from './sendToSessionDelivery';\n\n/**\n * The phone's started runtimes, one per computer, for the send-to-session panel.\n *\n * DESIGN PATTERNS:\n * - The native twin of sendToSessionRequest.ts: a native plugin may import\n * po-core/native only. The phone has no menu-to-overlay handoff, so only the\n * runtime list and the send live here.\n */\n\nconst runtimes = defineHostStore<readonly WebPluginRuntime[]>([]);\n\nexport function startSendToSessionRuntime(runtime: WebPluginRuntime): () => void {\n runtimes.update((current) => [...current, runtime]);\n return () => runtimes.update((current) => current.filter((entry) => entry !== runtime));\n}\n\n/** Steers `text` into session `to`. Resolves to the reason shown when it was refused, or undefined once delivered. */\nexport function sendToSession(input: { from: string; to: string; text: string }): Promise<string | undefined> {\n return deliverToSession(runtimes.store.state, input);\n}\n","import { useT } from '@agimon-ai/po-core/native';\nimport type { WebPluginSessionOption, WebPluginSlotProps } from '@agimon-ai/po-core/native';\nimport {\n Button,\n Dot,\n EmptyState,\n fontOf,\n Input,\n ListRow,\n MessageIcon,\n SearchIcon,\n SheetBody,\n SheetDescription,\n SheetFooter,\n} from '@agimon-ai/po-native-components';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { sendToSession } from '../../_lib/sendToSessionRequest.native';\n\n/**\n * The phone's \"Send to session…\" page of the composer's Insert sheet: pick a\n * live session, then Send steers what the person typed into it.\n *\n * DESIGN PATTERNS:\n * - The draft is taken only at Send, so opening and leaving the page never\n * touches it. A refused send keeps the taken text for a retry and hands it\n * back to the composer when the page goes away.\n * - The sheet closes when the page appends to the draft; an empty append\n * closes it and leaves the draft alone.\n *\n * AVOID:\n * - Sending on a row tap. On a phone a mis-tap would send; Send is its own button.\n */\n\nconst TONE = { running: 'green', waiting: 'magenta', idle: 'neutral' } as const;\n\n/** The Insert sheet page: lists the computer's live sessions and steers the composer's text into one. */\nexport function SendToSessionPanel({\n sessionId,\n listSessions,\n takeComposerDraft,\n appendComposerDraft,\n}: WebPluginSlotProps) {\n const t = useT();\n const [sessions] = useState(() => listSessions?.() ?? []);\n const [to, setTo] = useState<string>();\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState('');\n // Text taken from the composer and not yet delivered; `live` is false once the page is gone.\n const held = useRef<{ text?: string; inFlight: boolean; live: boolean }>({ inFlight: false, live: true });\n const giveBack = useRef(appendComposerDraft);\n useEffect(() => {\n giveBack.current = appendComposerDraft;\n }, [appendComposerDraft]);\n useEffect(() => {\n const state = held.current;\n state.live = true;\n return () => {\n state.live = false;\n if (state.text !== undefined && !state.inFlight) giveBack.current(state.text);\n };\n }, []);\n\n const send = async (): Promise<void> => {\n if (to === undefined || sessionId === null) return;\n const state = held.current;\n const text = state.text ?? takeComposerDraft?.() ?? '';\n if (text.trim() === '') {\n setError(t('session.ui.writeSomethingToSend', 'Write something to send.'));\n return;\n }\n state.text = text;\n state.inFlight = true;\n setBusy(true);\n setError('');\n const refusal = await sendToSession({ from: sessionId, to, text: text.trim() });\n state.inFlight = false;\n if (refusal === undefined) state.text = undefined;\n if (!state.live) {\n if (state.text !== undefined) giveBack.current(state.text);\n return;\n }\n if (refusal === undefined) {\n giveBack.current('');\n return;\n }\n setBusy(false);\n setError(refusal);\n };\n\n return (\n <SendToSessionView\n sessions={sessions}\n to={to}\n busy={busy}\n error={error}\n onPick={setTo}\n onSend={() => void send()}\n />\n );\n}\n\nexport interface SendToSessionViewProps {\n sessions: readonly WebPluginSessionOption[];\n to: string | undefined;\n busy: boolean;\n /** The server's refusal, shown above the list; empty when there is none. */\n error: string;\n onPick: (id: string) => void;\n onSend: () => void;\n}\n\nexport function SendToSessionView({ sessions, to, busy, error, onPick, onSend }: SendToSessionViewProps) {\n const t = useT();\n const [filter, setFilter] = useState('');\n const shown = useMemo(() => {\n const query = filter.trim().toLowerCase();\n return query === ''\n ? sessions\n : sessions.filter((session) => `${session.name} ${session.detail}`.toLowerCase().includes(query));\n }, [filter, sessions]);\n const target = sessions.find((session) => session.id === to);\n\n return (\n <>\n <SheetBody>\n <SheetDescription>\n {t('session.ui.sendDraftDescription', 'Send what you typed to another session. It arrives there from you.')}\n </SheetDescription>\n {error === '' ? null : (\n <Text accessibilityRole=\"alert\" style={styles.alert}>\n {error}\n </Text>\n )}\n {sessions.length === 0 ? (\n <EmptyState\n size=\"compact\"\n icon={<MessageIcon size={16} />}\n title={t('session.ui.noOtherSessionRunning', 'No other session is running')}\n description={t('session.ui.openThenSend', 'Open one, then send.')}\n />\n ) : (\n <>\n <Input\n accessibilityLabel={t('session.ui.filterSessions', 'Filter sessions')}\n placeholder={t('session.ui.filterSessions', 'Filter sessions')}\n value={filter}\n onChangeText={setFilter}\n />\n {shown.length === 0 ? (\n <EmptyState\n size=\"compact\"\n icon={<SearchIcon size={16} />}\n title={t('session.ui.noFilterMatches', 'Nothing matches that filter')}\n secondaryAction={{ label: t('session.ui.clearFilter', 'Clear filter'), onAction: () => setFilter('') }}\n />\n ) : (\n <View style={styles.rows}>\n {shown.map((session, index) => (\n <View key={session.id}>\n {index > 0 ? <View style={styles.separator} /> : null}\n <ListRow\n accessibilityLabel={`${session.name}, ${session.detail}`}\n selected={session.id === to}\n disabled={busy}\n onPress={() => onPick(session.id)}\n disclosure={false}\n style={styles.row}\n leading={<Dot tone={TONE[session.state]} size=\"md\" />}\n title={session.name}\n description={\n <Text numberOfLines={1} style={styles.detail}>\n {session.detail}\n </Text>\n }\n />\n </View>\n ))}\n </View>\n )}\n </>\n )}\n </SheetBody>\n <SheetFooter>\n <Button variant=\"primary\" disabled={busy || target === undefined} onPress={onSend}>\n {busy\n ? t('session.ui.sending', 'Sending…')\n : target === undefined\n ? t('session.ui.pickSession', 'Pick a session')\n : t('session.ui.sendToName', 'Send to {name}', { name: target.name })}\n </Button>\n </SheetFooter>\n </>\n );\n}\n\nconst styles = StyleSheet.create((theme) => {\n const small = {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n };\n return {\n rows: {\n borderTopWidth: StyleSheet.hairlineWidth,\n borderBottomWidth: StyleSheet.hairlineWidth,\n borderColor: theme.colors['border-soft'],\n },\n row: { paddingHorizontal: theme.spacing(1) },\n separator: { height: StyleSheet.hairlineWidth, backgroundColor: theme.colors['border-soft'] },\n detail: { ...small, color: theme.colors.dim },\n alert: { ...small, color: theme.colors.red },\n };\n});\n","import { defineFill } from '@agimon-ai/po-core/native';\n\nimport { SendToSessionPanel } from './_components/SendToSessionPanel.native';\n\n/** The phone's Insert sheet draws `data` as the row and `component` as the page it opens. */\nexport default defineFill({\n data: {\n title: 'Send to session…',\n hint: 'Steer another session with what you typed',\n translateCopy: (t: (key: string, fallback: string) => string) => ({\n title: t('session.insert.title', 'Send to session…'),\n hint: t('session.insert.hint', 'Steer another session with what you typed'),\n }),\n },\n component: SendToSessionPanel,\n});\n","import { defineWebLifecycle } from '@agimon-ai/po-core/native';\n\nimport { startSendToSessionRuntime } from '../_lib/sendToSessionRequest.native';\n\nexport default defineWebLifecycle(startSendToSessionRuntime);\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\n\nconst ACTIVITY_CHARS = 72;\n\nfunction asString(value: unknown): string {\n return typeof value === 'string' ? value : '';\n}\n\nfunction clip(text: string): string {\n const flat = text.replace(/\\s+/g, ' ').trim();\n return flat.length > ACTIVITY_CHARS ? `${flat.slice(0, ACTIVITY_CHARS - 1)}…` : flat;\n}\n\n/** Who a message is for, or what it answers. */\nexport function networkSummary(toolName: string, args: Record<string, unknown>): string {\n const verb = toolName.split('.').at(-1) ?? toolName;\n return toolName === 'network.reply' ? 'reply' : `${verb} ${asString(args.to)}`.trim();\n}\n\n/** One line per outgoing session message: who it went to and what it said. */\nexport function networkActivity({\n toolName,\n args,\n isError,\n}: Pick<ToolMessageRenderProps, 'toolName' | 'args' | 'isError'>): string[] {\n const text = clip(asString(args.text));\n if (isError || !text) return [];\n if (toolName === 'network.reply') return [`Replied \"${text}\"`];\n const to = asString(args.to) || 'session';\n return [`→ ${to}${toolName === 'network.ask' ? ' asks' : ''} \"${text}\"`];\n}\n","import { useT } from '@agimon-ai/po-core/native';\nimport type { ToolMessageRenderProps } from '@agimon-ai/po-core/native';\nimport {\n fontOf,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n resultTextLines,\n toolTone,\n} from '@agimon-ai/po-native-components';\nimport type { PoNativeTheme } from '@agimon-ai/po-web-components/nativeTheme';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { networkSummary } from '../_lib/networkActivity';\n\n/** A network.send, network.ask or network.reply recorded inside an exec. Collapsed to its summary; the body is the result text. */\nexport function NetworkToolMessage({ args, result, output, running, isError, toolName }: ToolMessageRenderProps) {\n const t = useT();\n const lines = resultTextLines(result, output);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable={lines.length > 0}>\n {({ expanded }) => (\n <>\n {/* no-untranslated-jsx: ignore - Preserve the technical tool identifier. */}\n <MessageItemHeader title=\"network\">\n <View testID=\"tool-call-network\" style={styles.summary}>\n <Text numberOfLines={1} style={styles.primary}>\n {networkSummary(toolName, args)}\n </Text>\n </View>\n </MessageItemHeader>\n {expanded ? (\n <MessageItemBody testID=\"tool-result-network\" style={styles.body}>\n {running ? (\n <MessageItemStatus tone=\"running\">{t('session.ui.working', 'working')}</MessageItemStatus>\n ) : null}\n {lines.map((line, index) => (\n <Text key={`${String(index)}-${line}`} selectable style={isError ? styles.error : styles.dim}>\n {line}\n </Text>\n ))}\n </MessageItemBody>\n ) : null}\n </>\n )}\n </MessageItem>\n );\n}\n\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n summary: { flex: 1, flexDirection: 'row', alignItems: 'center', minWidth: 0 },\n primary: {\n flexShrink: 1,\n minWidth: 0,\n color: theme.colors.text,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n },\n body: { gap: theme.spacing(1) },\n dim: { color: theme.colors.dim, fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.base },\n error: { color: theme.colors.red, fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.base },\n}));\n","import { defineToolRenderer } from '@agimon-ai/po-core/native';\n\nimport { NetworkToolMessage } from './_components/NetworkToolMessage.native';\nimport { networkActivity } from './_lib/networkActivity';\n\n/** The network namespace's recorded calls. Named by hand: the dotted tool names are not a filename. */\nexport default defineToolRenderer({\n tools: ['network.send', 'network.ask', 'network.reply'],\n message: NetworkToolMessage,\n activity: networkActivity,\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineNativePlugin, type WebPluginContributions } from '@agimon-ai/po-core/native';\n\nimport fillSendToSession from '../src/extensions/workspaces/sessions/(frontend)/fill/SendToSession.composer-menu.native';\nimport lifecycleStart from '../src/extensions/workspaces/sessions/(frontend)/lifecycle/start.native';\nimport toolNetwork from '../src/extensions/workspaces/sessions/(frontend)/tool/network.native';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const nativePlugin = defineNativePlugin({\n id: 'sessions',\n packageName: '@agimon-ai/po-session',\n session: {\n get fills(): WebPluginContributions['fills'] { return [via({ slot: 'composer-menu', id: 'send-to-session' }, fillSendToSession)]; },\n get start(): WebPluginContributions['start'] { return lifecycleStart; },\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['network'] }, toolNetwork)]; },\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiBA,SAAS,MAAM,UAAuC,OAAqC;CAazF,OAZe,SAAS,SAAS,YAAY;EAC3C,IAAI;GACF,MAAM,OAAO,QAAQ,iBAAiB,MAAM,IAAI,KAAK,MAAM;GAC3D,MAAM,KAAK,QAAQ,iBAAiB,MAAM,EAAE,KAAK,MAAM;GAGvD,OADa,SAAS,MAAM,SAAS,QAAQ,mBAAmB,MAAM,IAAI,KAAK,MAAM,UAAU,MAAM,OACvF,CAAC;IAAE;IAAS;IAAM;GAAG,CAAC,IAAI,CAAC;EAC3C,QAAQ;GAEN,OAAO,CAAC;EACV;CACF,CACY,CAAC,CAAC,GAAG,EAAE;AACrB;;AAGA,eAAsB,iBACpB,UACA,OAC6B;CAC7B,MAAM,QAAQ,MAAM,UAAU,KAAK;CACnC,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI;EACF,MAAM,MAAM,QAAQ,mBAAmB;GACrC,OAAO,EAAE,OAAO,OAAO;GACvB,SAAS;GACT,QAAQ;GACR,OAAO;IAAE,MAAM,MAAM;IAAM,IAAI,MAAM;IAAI,MAAM,MAAM;GAAK;EAC5D,CAAC;EACD;CACF,SAAS,OAAO;EACd,OAAO,iBAAiB,SAAS,MAAM,YAAY,KAAK,MAAM,UAAU;CAC1E;AACF;;;;;;;;;;;ACtCA,MAAM,WAAW,gBAA6C,CAAC,CAAC;AAEhE,SAAgB,0BAA0B,SAAuC;CAC/E,SAAS,QAAQ,YAAY,CAAC,GAAG,SAAS,OAAO,CAAC;CAClD,aAAa,SAAS,QAAQ,YAAY,QAAQ,QAAQ,UAAU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I;AAAiB;AAEzE,MAAa,eAAe,mBAAmB;CAC7C,IAAI;CACJ,aAAa;CACb,SAAS;EACP,IAAI,QAAyC;GAAE,OAAO,CAAC,IAAI;IAAE,MAAM;IAAiB,IAAI;GAAkB,GAAGI,0CAAiB,CAAC;EAAG;EAClI,IAAI,QAAyC;GAAE,OAAOC;EAAgB;EACtE,IAAI,gBAAyD;GAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,GAAGC,sBAAW,CAAC;EAAG;CACpH;AACF,CAAC"}
|
|
@@ -15,6 +15,7 @@ let _agimon_ai_po_core_piSettings = require("@agimon-ai/po-core/piSettings");
|
|
|
15
15
|
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
16
16
|
let _agimon_ai_po_approval = require("@agimon-ai/po-approval");
|
|
17
17
|
let _agimon_ai_po_core_contextContributions = require("@agimon-ai/po-core/contextContributions");
|
|
18
|
+
let _agimon_ai_po_core_locale = require("@agimon-ai/po-core/locale");
|
|
18
19
|
let _agimon_ai_po_core_remoteOrigin = require("@agimon-ai/po-core/remoteOrigin");
|
|
19
20
|
let _agimon_ai_po_core_packageApi = require("@agimon-ai/po-core/packageApi");
|
|
20
21
|
let _agimon_ai_po_core_pluginProtocol = require("@agimon-ai/po-core/pluginProtocol");
|
|
@@ -767,7 +768,7 @@ const TERMINAL_FIELDS = `; terminal?: boolean; outcome?: ${CHILD_OUTCOMES.map((o
|
|
|
767
768
|
* Asks the person before messaging a live session whose `@session:` mention expired when this session compacted.
|
|
768
769
|
* Every other target runs without asking: a live mention or a shared group passes, and anything else is refused.
|
|
769
770
|
*/
|
|
770
|
-
function expiredMentionApproval(operations, verb, parse) {
|
|
771
|
+
function expiredMentionApproval(operations, verb, parse, t) {
|
|
771
772
|
return {
|
|
772
773
|
requirement: "human",
|
|
773
774
|
applies: (raw) => {
|
|
@@ -788,14 +789,14 @@ function expiredMentionApproval(operations, verb, parse) {
|
|
|
788
789
|
const { to, text } = parse(raw);
|
|
789
790
|
const name = operations.mentionApprovalTarget?.(to)?.name ?? to;
|
|
790
791
|
return {
|
|
791
|
-
source: "Sessions",
|
|
792
|
-
title:
|
|
793
|
-
summary: "The earlier @session: mention expired when this session compacted. Approving restores access until the next compaction and delivers this message.",
|
|
792
|
+
source: t("session.approval.source", "Sessions"),
|
|
793
|
+
title: verb === "ask" ? t("session.approval.askAgain", "Let this session ask {name} again", { name: name.slice(0, TITLE_NAME_MAX) }) : t("session.approval.messageAgain", "Let this session message {name} again", { name: name.slice(0, TITLE_NAME_MAX) }),
|
|
794
|
+
summary: t("session.approval.restoreMention", "The earlier @session: mention expired when this session compacted. Approving restores access until the next compaction and delivers this message."),
|
|
794
795
|
details: [{
|
|
795
|
-
label: "Session",
|
|
796
|
+
label: t("session.approval.session", "Session"),
|
|
796
797
|
value: name
|
|
797
798
|
}, {
|
|
798
|
-
label: "Message",
|
|
799
|
+
label: t("session.approval.message", "Message"),
|
|
799
800
|
value: text.slice(0, MESSAGE_PREVIEW_MAX)
|
|
800
801
|
}]
|
|
801
802
|
};
|
|
@@ -806,6 +807,7 @@ function expiredMentionApproval(operations, verb, parse) {
|
|
|
806
807
|
function createNetworkNamespace(options) {
|
|
807
808
|
(0, _agimon_ai_po_core_codemode.assertCodemodeNamespaceName)("network");
|
|
808
809
|
const { operations, terminal } = options;
|
|
810
|
+
const t = options.translate ?? ((_key, fallback, vars) => (0, _agimon_ai_po_core_locale.formatMessage)(fallback, vars));
|
|
809
811
|
const parse = (raw) => parseSend(raw, operations.lanes === true, terminal !== void 0);
|
|
810
812
|
const parseAsk = (raw) => {
|
|
811
813
|
const { to, text } = require_type.fields(raw, ["to", "text"]);
|
|
@@ -819,8 +821,8 @@ function createNetworkNamespace(options) {
|
|
|
819
821
|
summary: "Message sessions on this host and linked hosts: send, ask with a tracked reply, answer questions, and keep a coordinator logbook.",
|
|
820
822
|
portable: true,
|
|
821
823
|
...operations.mentionApprovalTarget === void 0 ? {} : { approval: {
|
|
822
|
-
send: expiredMentionApproval(operations, "message", parse),
|
|
823
|
-
...operations.ask ? { ask: expiredMentionApproval(operations, "ask", parseAsk) } : {}
|
|
824
|
+
send: expiredMentionApproval(operations, "message", parse, t),
|
|
825
|
+
...operations.ask ? { ask: expiredMentionApproval(operations, "ask", parseAsk, t) } : {}
|
|
824
826
|
} },
|
|
825
827
|
declarations: `declare const network: {
|
|
826
828
|
list(): Promise<unknown>;
|
|
@@ -1094,7 +1096,10 @@ var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)((plug
|
|
|
1094
1096
|
const injection = owner.inject([_agimon_ai_po_core_codemode.PO_CODEMODE_SERVICE], (context) => {
|
|
1095
1097
|
const codemode = (0, _agimon_ai_po_core_codemode.readPoCodemode)(context);
|
|
1096
1098
|
const registration = codemode?.register("@agimon-ai/po-session", require_type.createSessionsNamespace(options));
|
|
1097
|
-
const network = codemode?.register("@agimon-ai/po-session", createNetworkNamespace(
|
|
1099
|
+
const network = codemode?.register("@agimon-ai/po-session", createNetworkNamespace({
|
|
1100
|
+
...networkOptions,
|
|
1101
|
+
translate: (key, fallback, vars) => (0, _agimon_ai_po_core_locale.readPoLang)(context)?.t((0, _agimon_ai_po_core_locale.readPoPersonLocale)(context)?.read(), key, fallback, vars) ?? (0, _agimon_ai_po_core_locale.formatMessage)(fallback, vars)
|
|
1102
|
+
}));
|
|
1098
1103
|
const restriction = registration ? agent.registerToolRestriction({ excludedTools: [require_type.START_SESSION_TOOL_NAME, ...options.operations.fallbackToolName ? [options.operations.fallbackToolName] : []] }) : void 0;
|
|
1099
1104
|
return () => {
|
|
1100
1105
|
restriction?.dispose();
|