@agimon-ai/po-native-dashboard 0.0.0-alpha.7 → 0.0.0-alpha.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +21 -149
  2. package/README.md +9 -3
  3. package/dist/components/CaptureTray.d.mts.map +1 -1
  4. package/dist/components/CaptureTray.mjs +5 -3
  5. package/dist/components/CaptureTray.mjs.map +1 -1
  6. package/dist/components/CompletionSheet.d.mts +5 -0
  7. package/dist/components/CompletionSheet.d.mts.map +1 -1
  8. package/dist/components/CompletionSheet.mjs +45 -36
  9. package/dist/components/CompletionSheet.mjs.map +1 -1
  10. package/dist/components/Composer.d.mts +7 -3
  11. package/dist/components/Composer.d.mts.map +1 -1
  12. package/dist/components/Composer.mjs +36 -31
  13. package/dist/components/Composer.mjs.map +1 -1
  14. package/dist/components/DialogSheet.d.mts.map +1 -1
  15. package/dist/components/DialogSheet.mjs +4 -2
  16. package/dist/components/DialogSheet.mjs.map +1 -1
  17. package/dist/components/MessageActionsSheet.d.mts.map +1 -1
  18. package/dist/components/MessageActionsSheet.mjs +4 -2
  19. package/dist/components/MessageActionsSheet.mjs.map +1 -1
  20. package/dist/components/MoveSessionSheet.d.mts.map +1 -1
  21. package/dist/components/MoveSessionSheet.mjs +23 -29
  22. package/dist/components/MoveSessionSheet.mjs.map +1 -1
  23. package/dist/components/SessionMenus.d.mts +1 -1
  24. package/dist/components/SessionMenus.d.mts.map +1 -1
  25. package/dist/components/SessionMenus.mjs +131 -141
  26. package/dist/components/SessionMenus.mjs.map +1 -1
  27. package/dist/components/TimelineItem.d.mts +11 -4
  28. package/dist/components/TimelineItem.d.mts.map +1 -1
  29. package/dist/components/TimelineItem.mjs +104 -36
  30. package/dist/components/TimelineItem.mjs.map +1 -1
  31. package/dist/components/richText.mjs +18 -0
  32. package/dist/components/richText.mjs.map +1 -0
  33. package/dist/components/sessionGroups.mjs +5 -3
  34. package/dist/components/sessionGroups.mjs.map +1 -1
  35. package/dist/components/sessionTimeline.mjs +9 -5
  36. package/dist/components/sessionTimeline.mjs.map +1 -1
  37. package/dist/components/slotProps.d.mts +6 -3
  38. package/dist/components/slotProps.d.mts.map +1 -1
  39. package/dist/components/slotProps.mjs +11 -7
  40. package/dist/components/slotProps.mjs.map +1 -1
  41. package/dist/index.d.mts +2 -2
  42. package/dist/index.mjs +2 -2
  43. package/dist/screens/SessionScreen.d.mts +19 -5
  44. package/dist/screens/SessionScreen.d.mts.map +1 -1
  45. package/dist/screens/SessionScreen.mjs +190 -56
  46. package/dist/screens/SessionScreen.mjs.map +1 -1
  47. package/dist/screens/SessionsScreen.d.mts +7 -1
  48. package/dist/screens/SessionsScreen.d.mts.map +1 -1
  49. package/dist/screens/SessionsScreen.mjs +438 -104
  50. package/dist/screens/SessionsScreen.mjs.map +1 -1
  51. package/package.json +8 -8
package/LICENSE CHANGED
@@ -1,149 +1,21 @@
1
- License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
2
- "Business Source License" is a trademark of MariaDB Corporation Ab.
3
-
4
- Parameters
5
-
6
- Licensor: Agimon Pty Ltd
7
- Licensed Work: Po, the software in the Po source repository and the
8
- packages released from it, in each version released by
9
- the Licensor.
10
- The Licensed Work is (c) 2026 Agimon Pty Ltd.
11
- Material identified as third-party in the "Third-party
12
- components" section at the end of this file or in a
13
- NOTICE file, and any package or directory whose own
14
- license file grants a different license, is not part of
15
- the Licensed Work and remains under its own license.
16
- Additional Use Grant: You may make production use of the Licensed Work if
17
- your use is Eligible Use. "Eligible Use" is production use that falls
18
- within at least one of the following:
19
-
20
- (a) Personal Use. Use by an individual for their own personal purposes,
21
- and not on behalf of, or for the benefit of, an employer, client, or
22
- other Organization. Use by an individual in the course of employment
23
- or engagement by an Organization is use by that Organization.
24
-
25
- (b) Small Organization Use. Use by or on behalf of an Organization whose
26
- Annual Revenue is less than USD 1,000,000.
27
-
28
- (c) Non-profit, Education and Research Use. Use, regardless of Annual
29
- Revenue, by (i) an Organization registered or recognized as a
30
- non-profit or charitable organization under the laws of its
31
- jurisdiction, for its non-profit purposes; (ii) an accredited school,
32
- college, or university, for teaching, learning, or academic research;
33
- or (iii) a publicly funded research institution, for its research.
34
-
35
- (d) Service Provider Use. Use by a consultant, contractor, agency, or other
36
- service provider, regardless of its own Annual Revenue, solely to
37
- build, deploy, host, operate, or support the Licensed Work for a client
38
- whose own use would be Eligible Use under (a), (b), or (c). A service
39
- provider's use for its own purposes is Eligible Use only if the service
40
- provider itself qualifies under (b) or (c).
41
-
42
-
43
- Hosted services. Offering the Licensed Work to third parties as a hosted
44
- or managed service whose primary value is the Licensed Work is Eligible
45
- Use only if each such third party's own use would be Eligible Use.
46
-
47
- Definitions. "Organization" means any company, partnership, sole
48
- proprietorship, trust, association, government body, or other entity, and
49
- includes an individual acting in a business or professional capacity.
50
- "Affiliate" means any entity that directly or indirectly controls, is
51
- controlled by, or is under common control with an Organization, where
52
- "control" means ownership of more than 50% of the voting interests of an
53
- entity or the power to direct its management and policies by contract or
54
- otherwise. "Annual Revenue" means the total gross revenue of an
55
- Organization and all of its Affiliates combined, from all sources and
56
- whether or not related to the Licensed Work, for its most recently
57
- completed fiscal year, or, if it has not completed a fiscal year, for the
58
- twelve months before the use (or since its formation, if shorter),
59
- converted into US dollars at the average exchange rate for that period.
60
- Proceeds of equity or debt financing are not revenue.
61
-
62
- Threshold. If an Organization stops qualifying under (b), its existing
63
- production use remains Eligible Use for 90 days after it stops
64
- qualifying, after which it must obtain a commercial license or stop
65
- production use. Use that was Eligible Use when it occurred never requires
66
- a commercial license after the fact.
67
- Change Date: Four years from the date a version of the Licensed Work
68
- is first publicly released by the Licensor.
69
- Change License: Apache License, Version 2.0
70
-
71
- For information about alternative licensing arrangements for the Licensed
72
- Work, please visit: https://agimon.ai/licensing
73
-
74
- Notice
75
-
76
- The Business Source License (this document, or the "License") is not an Open
77
- Source license. However, the Licensed Work will eventually be made available
78
- under an Open Source License, as stated in this License.
79
-
80
- -----------------------------------------------------------------------------
81
-
82
- Business Source License 1.1
83
-
84
- Terms
85
-
86
- The Licensor hereby grants you the right to copy, modify, create derivative
87
- works, redistribute, and make non-production use of the Licensed Work. The
88
- Licensor may make an Additional Use Grant, above, permitting limited
89
- production use.
90
-
91
- Effective on the Change Date, or the fourth anniversary of the first publicly
92
- available distribution of a specific version of the Licensed Work under this
93
- License, whichever comes first, the Licensor hereby grants you rights under
94
- the terms of the Change License, and the rights granted in the paragraph
95
- above terminate.
96
-
97
- If your use of the Licensed Work does not comply with the requirements
98
- currently in effect as described in this License, you must purchase a
99
- commercial license from the Licensor, its affiliated entities, or authorized
100
- resellers, or you must refrain from using the Licensed Work.
101
-
102
- All copies of the original and modified Licensed Work, and derivative works
103
- of the Licensed Work, are subject to this License. This License applies
104
- separately for each version of the Licensed Work and the Change Date may vary
105
- for each version of the Licensed Work released by Licensor.
106
-
107
- You must conspicuously display this License on each original or modified copy
108
- of the Licensed Work. If you receive the Licensed Work in original or
109
- modified form from a third party, the terms and conditions set forth in this
110
- License apply to your use of that work.
111
-
112
- Any use of the Licensed Work in violation of this License will automatically
113
- terminate your rights under this License for the current and all other
114
- versions of the Licensed Work.
115
-
116
- This License does not grant you any right in any trademark or logo of
117
- Licensor or its affiliates (provided that you may use a trademark or logo of
118
- Licensor as expressly required by this License).
119
-
120
- TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
121
- AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
122
- EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
123
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
124
- TITLE.
125
-
126
- MariaDB hereby grants you permission to use this License’s text to license
127
- your works, and to refer to it using the trademark “Business Source License”,
128
- as long as you comply with the Covenants of Licensor below.
129
-
130
- Covenants of Licensor
131
-
132
- In consideration of the right to use this License’s text and the “Business
133
- Source License” name and trademark, Licensor covenants to MariaDB, and to all
134
- other recipients of the licensed work to be provided by Licensor:
135
-
136
- 1. To specify as the Change License the GPL Version 2.0 or any later version,
137
- or a license that is compatible with GPL Version 2.0 or a later version,
138
- where “compatible” means that software provided under the Change License can
139
- be included in a program with software provided under GPL Version 2.0 or a
140
- later version. Licensor may specify additional Change Licenses without
141
- limitation.
142
-
143
- 2. To either: (a) specify an additional grant of rights to use that does not
144
- impose any additional restriction on the right granted in this License, as
145
- the Additional Use Grant; or (b) insert the text “None”.
146
-
147
- 3. To specify a Change Date.
148
-
149
- 4. Not to modify this License in any other way.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Agimon Pty Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,11 @@
1
- # po-native-dashboard
1
+ # Po native dashboard
2
2
 
3
- Shared React Native session views for Po native templates: transcript, composer and session sheets.
3
+ Shared React Native session views for the Po app and native templates: session lists, transcript, composer, activity panels, and session sheets.
4
4
 
5
- Runtime systems belong in `src/systems/main` and `src/systems/child`. Put reusable services in `src/services`, plugin definitions in `src/extensions`, and integrations in `src/pi`, `src/server`, and `src/web`. A core package's `src/web` is the browser contract it publishes to other packages, not a place for its own presentation: an extension package colocates browser code beside the routed file that renders it, in `_components` or `_lib`. Feature packages own their policies.
5
+ Use the package root for views and `@agimon-ai/po-native-dashboard/slotProps` for plugin-slot integration without importing the native views. The maintained exports are in [`src/exports`](src/exports). Mount the component library's `PoNativeProvider` at the app root before rendering sheets.
6
+
7
+ The shell supplies session state, navigation, transport, and action callbacks. These shared views do not create a second connection or own host authentication. Keep feature-specific policies in their feature packages.
8
+
9
+ ```sh
10
+ pnpm nx run-many -t lint typecheck build test -p @agimon-ai/po-native-dashboard
11
+ ```
@@ -1 +1 @@
1
- {"version":3,"file":"CaptureTray.d.mts","names":[],"sources":["../../src/components/CaptureTray.tsx"],"mappings":";;iBAQiB;EACf,mBAAmB;;EAEnB;EACA,WAAW,SAAS;;;wBAIN,cAAc,UAAU,SAAS,YAAY,mCAAgB,IAAA"}
1
+ {"version":3,"file":"CaptureTray.d.mts","names":[],"sources":["../../src/components/CaptureTray.tsx"],"mappings":";;iBASiB;EACf,mBAAmB;;EAEnB;EACA,WAAW,SAAS;;;wBAIN,cAAc,UAAU,SAAS,YAAY,mCAAgB,IAAA"}
@@ -6,12 +6,14 @@ import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
7
7
  import { Pressable } from "react-native-unistyles/components/native/Pressable";
8
8
  import { Image } from "react-native-unistyles/components/native/Image";
9
+ import { useT } from "@agimon-ai/po-core/native";
9
10
 
10
11
  //#region src/components/CaptureTray.tsx
11
12
  const TILE = 64;
12
13
  const REMOVE = 22;
13
14
  /** The images staged for the next message as thumbnails, led by a Paste tile while the clipboard holds one. */
14
15
  function CaptureTray({ captures, onPaste, onRemove }) {
16
+ const t = useT();
15
17
  if (!onPaste && captures.length === 0) return null;
16
18
  return /* @__PURE__ */ jsxs(ScrollView, {
17
19
  horizontal: true,
@@ -19,7 +21,7 @@ function CaptureTray({ captures, onPaste, onRemove }) {
19
21
  contentContainerStyle: styles.tray,
20
22
  children: [onPaste ? /* @__PURE__ */ jsxs(Pressable, {
21
23
  accessibilityRole: "button",
22
- accessibilityLabel: "Paste image",
24
+ accessibilityLabel: t("nativeDashboard.captureTray.pasteImage", "Paste image"),
23
25
  onPress: onPaste,
24
26
  style: ({ pressed }) => [
25
27
  styles.tile,
@@ -31,7 +33,7 @@ function CaptureTray({ captures, onPaste, onRemove }) {
31
33
  color: "magenta"
32
34
  }), /* @__PURE__ */ jsx(Text, {
33
35
  style: styles.pasteText,
34
- children: "Paste"
36
+ children: t("nativeDashboard.captureTray.paste", "Paste")
35
37
  })]
36
38
  }) : null, captures.map((capture) => /* @__PURE__ */ jsxs(View, {
37
39
  style: styles.tile,
@@ -41,7 +43,7 @@ function CaptureTray({ captures, onPaste, onRemove }) {
41
43
  accessibilityLabel: capture.context.label
42
44
  }), /* @__PURE__ */ jsx(Pressable, {
43
45
  accessibilityRole: "button",
44
- accessibilityLabel: `Remove ${capture.context.label}`,
46
+ accessibilityLabel: t("nativeDashboard.captureTray.remove", "Remove {label}", { label: capture.context.label }),
45
47
  onPress: () => onRemove(capture),
46
48
  hitSlop: 11,
47
49
  style: styles.remove,
@@ -1 +1 @@
1
- {"version":3,"file":"CaptureTray.mjs","names":["ComposerCapture","CloseIcon","fontOf","ImageIcon","StyleSheet","TILE","REMOVE","CaptureTrayProps","captures","onPaste","onRemove","capture","CaptureTray","length","styles","tray","pressed","tile","paste","pasteText","map","context","source","id","uri","mimeType","data","image","label","remove","create","theme","gap","spacing","paddingTop","paddingRight","uni__dependencies","width","height","borderRadius","lg","borderWidth","borderColor","colors","border","backgroundColor","panel","alignItems","justifyContent","borderStyle","opacity","fontFamily","sans","fontSize","xs","lineHeight","fontWeight","semibold","color","magenta","position","top","right","hi"],"sources":["../../src/components/CaptureTray.tsx"],"sourcesContent":["import type { ComposerCapture } from '@agimon-ai/po-core/web';\nimport { CloseIcon, fontOf, ImageIcon } from '@agimon-ai/po-native-components';\nimport { Image, Pressable, ScrollView, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nconst TILE = 64;\nconst REMOVE = 22;\n\nexport interface CaptureTrayProps {\n captures: readonly ComposerCapture[];\n /** Shows the Paste tile first; omit it when there is nothing to paste or no room left. */\n onPaste?: () => void;\n onRemove: (capture: ComposerCapture) => void;\n}\n\n/** The images staged for the next message as thumbnails, led by a Paste tile while the clipboard holds one. */\nexport function CaptureTray({ captures, onPaste, onRemove }: CaptureTrayProps) {\n if (!onPaste && captures.length === 0) return null;\n return (\n <ScrollView horizontal keyboardShouldPersistTaps=\"handled\" contentContainerStyle={styles.tray}>\n {onPaste ? (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel=\"Paste image\"\n onPress={onPaste}\n style={({ pressed }) => [styles.tile, styles.paste, pressed && styles.pressed]}\n >\n <ImageIcon size={20} color=\"magenta\" />\n <Text style={styles.pasteText}>Paste</Text>\n </Pressable>\n ) : null}\n {captures.map((capture) => (\n <View key={`${capture.context.source}:${capture.context.id}`} style={styles.tile}>\n <Image\n source={{ uri: `data:${capture.mimeType};base64,${capture.data}` }}\n style={styles.image}\n accessibilityLabel={capture.context.label}\n />\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={`Remove ${capture.context.label}`}\n onPress={() => onRemove(capture)}\n // The visible dot is small; the slop keeps a 44pt target.\n hitSlop={(44 - REMOVE) / 2}\n style={styles.remove}\n >\n <CloseIcon size={12} color=\"bg\" />\n </Pressable>\n </View>\n ))}\n </ScrollView>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n tray: { gap: theme.spacing(2), paddingTop: theme.spacing(1.5), paddingRight: theme.spacing(1.5) },\n tile: {\n width: TILE,\n height: TILE,\n borderRadius: theme.borderRadius.lg,\n borderWidth: 1,\n borderColor: theme.colors.border,\n backgroundColor: theme.colors.panel,\n },\n paste: {\n alignItems: 'center',\n justifyContent: 'center',\n gap: theme.spacing(1),\n borderStyle: 'dashed',\n borderColor: theme.colors['edge-magenta'],\n backgroundColor: theme.colors['tint-magenta'],\n },\n pressed: { opacity: 0.7 },\n pasteText: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.xs,\n lineHeight: theme.lineHeight.xs,\n fontWeight: theme.fontWeight.semibold,\n color: theme.colors.magenta,\n },\n image: { width: '100%', height: '100%', borderRadius: theme.borderRadius.lg - 1 },\n remove: {\n position: 'absolute',\n top: -theme.spacing(1.5),\n right: -theme.spacing(1.5),\n width: REMOVE,\n height: REMOVE,\n borderRadius: REMOVE / 2,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.colors.hi,\n },\n}));\n"],"mappings":";;;;;;;;;;AAKA,MAAMK,OAAO;AACb,MAAMC,SAAS;;AAUf,SAAgBM,YAAY,EAAEJ,UAAUC,SAASC,YAA8B;CAC7E,IAAI,CAACD,WAAWD,SAASK,WAAW,GAAG,OAAO;CAC9C,OACE,qBAAC,YAAD;EAAY;EAAW,2BAA0B;EAAU,uBAAuBC,OAAOC;YAAzF,CACGN,UACC,qBAAC,WAAD;GACE,mBAAkB;GAClB,oBAAmB;GACnB,SAASA;GACT,QAAQ,EAAEO,cAAc;IAACF,OAAOG;IAAMH,OAAOI;IAAOF,WAAWF,OAAOE;GAAO;aAJ/E,CAME,oBAAC,WAAD;IAAW,MAAM;IAAI,OAAM;GAAS,IACpC,oBAAC,MAAD;IAAM,OAAOF,OAAOK;cAAW;GAAW,EACjC;OACT,MACHX,SAASY,KAAKT,YACb,qBAAC,MAAD;GAA8D,OAAOG,OAAOG;aAA5E,CACE,oBAAC,OAAD;IACE,QAAQ,EAAEO,KAAK,QAAQb,QAAQc,SAAQ,UAAWd,QAAQe,OAAO;IACjE,OAAOZ,OAAOa;IACd,oBAAoBhB,QAAQU,QAAQO;GA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K,CAAC9B,MAAME,QAAQ,GAAG;EACvB6B,OAAO,CAAC/B,MAAME,QAAQ,GAAG;EACzBI,OAAO/B;EACPgC,QAAQhC;EACRiC,cAAcjC,SAAS;EACvByC,YAAY;EACZC,gBAAgB;EAChBH,iBAAiBd,MAAMY,OAAOoB;EAAE3B,mBAAA,CAAA,CAAA;CAClC;AACF,EAAE"}
1
+ {"version":3,"file":"CaptureTray.mjs","names":["useT","ComposerCapture","CloseIcon","fontOf","ImageIcon","StyleSheet","TILE","REMOVE","CaptureTrayProps","captures","onPaste","onRemove","capture","CaptureTray","t","length","styles","tray","pressed","tile","paste","pasteText","map","context","source","id","uri","mimeType","data","image","label","remove","create","theme","gap","spacing","paddingTop","paddingRight","uni__dependencies","width","height","borderRadius","lg","borderWidth","borderColor","colors","border","backgroundColor","panel","alignItems","justifyContent","borderStyle","opacity","fontFamily","sans","fontSize","xs","lineHeight","fontWeight","semibold","color","magenta","position","top","right","hi"],"sources":["../../src/components/CaptureTray.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport type { ComposerCapture } from '@agimon-ai/po-core/web';\nimport { CloseIcon, fontOf, ImageIcon } from '@agimon-ai/po-native-components';\nimport { Image, Pressable, ScrollView, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nconst TILE = 64;\nconst REMOVE = 22;\n\nexport interface CaptureTrayProps {\n captures: readonly ComposerCapture[];\n /** Shows the Paste tile first; omit it when there is nothing to paste or no room left. */\n onPaste?: () => void;\n onRemove: (capture: ComposerCapture) => void;\n}\n\n/** The images staged for the next message as thumbnails, led by a Paste tile while the clipboard holds one. */\nexport function CaptureTray({ captures, onPaste, onRemove }: CaptureTrayProps) {\n const t = useT();\n if (!onPaste && captures.length === 0) return null;\n return (\n <ScrollView horizontal keyboardShouldPersistTaps=\"handled\" contentContainerStyle={styles.tray}>\n {onPaste ? (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={t('nativeDashboard.captureTray.pasteImage', 'Paste image')}\n onPress={onPaste}\n style={({ pressed }) => [styles.tile, styles.paste, pressed && styles.pressed]}\n >\n <ImageIcon size={20} color=\"magenta\" />\n <Text style={styles.pasteText}>{t('nativeDashboard.captureTray.paste', 'Paste')}</Text>\n </Pressable>\n ) : null}\n {captures.map((capture) => (\n <View key={`${capture.context.source}:${capture.context.id}`} style={styles.tile}>\n <Image\n source={{ uri: `data:${capture.mimeType};base64,${capture.data}` }}\n style={styles.image}\n accessibilityLabel={capture.context.label}\n />\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={t('nativeDashboard.captureTray.remove', 'Remove {label}', {\n label: capture.context.label,\n })}\n onPress={() => onRemove(capture)}\n // The visible dot is small; the slop keeps a 44pt target.\n hitSlop={(44 - REMOVE) / 2}\n style={styles.remove}\n >\n <CloseIcon size={12} color=\"bg\" />\n </Pressable>\n </View>\n ))}\n </ScrollView>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n tray: { gap: theme.spacing(2), paddingTop: theme.spacing(1.5), paddingRight: theme.spacing(1.5) },\n tile: {\n width: TILE,\n height: TILE,\n borderRadius: theme.borderRadius.lg,\n borderWidth: 1,\n borderColor: theme.colors.border,\n backgroundColor: theme.colors.panel,\n },\n paste: {\n alignItems: 'center',\n justifyContent: 'center',\n gap: theme.spacing(1),\n borderStyle: 'dashed',\n borderColor: theme.colors['edge-magenta'],\n backgroundColor: theme.colors['tint-magenta'],\n },\n pressed: { opacity: 0.7 },\n pasteText: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.xs,\n lineHeight: theme.lineHeight.xs,\n fontWeight: theme.fontWeight.semibold,\n color: theme.colors.magenta,\n },\n image: { width: '100%', height: '100%', borderRadius: theme.borderRadius.lg - 1 },\n remove: {\n position: 'absolute',\n top: -theme.spacing(1.5),\n right: -theme.spacing(1.5),\n width: REMOVE,\n height: REMOVE,\n borderRadius: REMOVE / 2,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.colors.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AQ,GAAG;EAAGE,cAAcJ,MAAME,QAAQ,GAAG;EAACG,mBAAA,CAAA,CAAA;CAAC;CAChGnB,MAAM;EACJoB,OAAOjC;EACPkC,QAAQlC;EACRmC,cAAcR,MAAMQ,aAAaC;EACjCC,aAAa;EACbC,aAAaX,MAAMY,OAAOC;EAC1BC,iBAAiBd,MAAMY,OAAOG;EAAKV,mBAAA,CAAA,CAAA;CACrC;CACAlB,OAAO;EACL6B,YAAY;EACZC,gBAAgB;EAChBhB,KAAKD,MAAME,QAAQ,CAAC;EACpBgB,aAAa;EACbP,aAAaX,MAAMY,OAAO;EAC1BE,iBAAiBd,MAAMY,OAAO;EAAeP,mBAAA,CAAA,CAAA;CAC/C;CACApB,SAAS,EAAEkC,SAAS,GAAI;CACxB/B,WAAW;EACTgC,YAAYlD,OAAO8B,MAAMoB,WAAWC,IAAI;EACxCC,UAAUtB,MAAMsB,SAASC;EACzBC,YAAYxB,MAAMwB,WAAWD;EAC7BE,YAAYzB,MAAMyB,WAAWC;EAC7BC,OAAO3B,MAAMY,OAAOgB;EAAOvB,mBAAA,CAAA,CAAA;CAC7B;CACAT,OAAO;EAAEU,OAAO;EAAQC,QAAQ;EAAQC,cAAcR,MAAMQ,aAAaC,KAAK;EAACJ,mBAAA,CAAA,CAAA;CAAC;CAChFP,QAAQ;EACN+B,UAAU;EACVC,KAAK,CAAC9B,MAAME,QAAQ,GAAG;EACvB6B,OAAO,CAAC/B,MAAME,QAAQ,GAAG;EACzBI,OAAOhC;EACPiC,QAAQjC;EACRkC,cAAclC,SAAS;EACvB0C,YAAY;EACZC,gBAAgB;EAChBH,iBAAiBd,MAAMY,OAAOoB;EAAE3B,mBAAA,CAAA,CAAA;CAClC;AACF,EAAE"}
@@ -4,6 +4,11 @@ import { WebPluginSlotProps } from "@agimon-ai/po-core/web";
4
4
  export interface CompletionSource {
5
5
  commands: readonly CommandInfo[];
6
6
  searchFiles: (query: string) => Promise<string[]>;
7
+ /** References plugins offer before workspace files. */
8
+ references?: (query: string) => readonly {
9
+ path: string;
10
+ detail?: string;
11
+ }[];
7
12
  /** Sessions `@` may name, offered before files. */
8
13
  sessions?: () => readonly MentionableSession[];
9
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CompletionSheet.d.mts","names":[],"sources":["../../src/components/CompletionSheet.tsx"],"mappings":";;;iBA+CiB;EACf,mBAAmB;EACnB,cAAc,kBAAkB;;EAEhC,0BAA0B;;;wBAiCZ,mBACd,QAAQ,8BACR,MAAM,uBACN,gBACC;;wBA2Ba,iBACd,OACA;EAEA,gBAAgB;EAChB,SAAS,MAAM;oBAChB,IAAA;iBA2BgB;EACf;EACA,eAAe;EACf,QAAQ;EACR,SAAS,MAAM,gBAAgB,MAAM;;EAErC,cAAc;EACd;;EAEA;;EAEA,YAAY;;EAEZ,mBAAmB;;iBAGJ;EACf;EACA;EACA;EACA;EACA;;;wBAIc,kBACd,MACA,cACA,QACA,QACA,aACA,cACA,aACA,WACA,WACC,uCAAoB,IAAA;;wBA2HP,mBAAmB;EAAa;oBAAqB,IAAA"}
1
+ {"version":3,"file":"CompletionSheet.d.mts","names":[],"sources":["../../src/components/CompletionSheet.tsx"],"mappings":";;;iBA4DiB;EACf,mBAAmB;EACnB,cAAc,kBAAkB;;EAEhC,cAAc;IAA6B;IAAc;;;EAEzD,0BAA0B;;;wBAoCZ,mBACd,QAAQ,8BACR,MAAM,uBACN,gBACC;;wBA4Ba,iBACd,OACA;EAEA,gBAAgB;EAChB,SAAS,MAAM;oBAChB,IAAA;iBA2BgB;EACf;EACA,eAAe;EACf,QAAQ;EACR,SAAS,MAAM,gBAAgB,MAAM;;EAErC,cAAc;EACd;;EAEA;;EAEA,YAAY;;EAEZ,mBAAmB;;iBAGJ;EACf;EACA;EACA;EACA;EACA;;;wBAIc,kBACd,MACA,cACA,QACA,QACA,aACA,cACA,aACA,WACA,WACC,uCAAoB,IAAA;;wBA6HP,mBAAmB;EAAa;oBAAqB,IAAA"}
@@ -4,34 +4,37 @@ import { ChevronRightIcon, Input, Sheet, SheetContent, SparklesIcon, Spinner, fo
4
4
  import { StyleSheet } from "react-native-unistyles";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Pressable } from "react-native-unistyles/components/native/Pressable";
7
+ import { useT } from "@agimon-ai/po-core/native";
7
8
  import { HOST_SLOTS, TRIGGER_CHARS, commandCompletions, fileCompletions, sessionCompletions, slotFills } from "@agimon-ai/po-web-dashboard/core";
8
9
  import { useEffect, useEffectEvent, useState } from "react";
9
10
 
10
11
  //#region src/components/CompletionSheet.tsx
11
12
  /** The phone's way into `@`, `$` and `/`: what each kind is called and what it is for. */
12
- const KINDS = [
13
- {
14
- kind: "file",
15
- title: "Files and sessions",
16
- hint: "Point Po at a file in this folder or another session",
17
- search: "Search files and sessions",
18
- none: "No files or sessions match"
19
- },
20
- {
21
- kind: "skill",
22
- title: "Skills",
23
- hint: "Use one of your skills",
24
- search: "Search skills",
25
- none: "No skills match"
26
- },
27
- {
28
- kind: "command",
29
- title: "Slash commands",
30
- hint: "Run a session command",
31
- search: "Search commands",
32
- none: "No commands match"
33
- }
34
- ];
13
+ function completionKinds(t) {
14
+ return [
15
+ {
16
+ kind: "file",
17
+ title: t("nativeDashboard.completion.filesTitle", "Files and sessions"),
18
+ hint: t("nativeDashboard.completion.filesHint", "Point Po at a file in this folder or another session"),
19
+ search: t("nativeDashboard.completion.filesSearch", "Search files and sessions"),
20
+ none: t("nativeDashboard.completion.filesNone", "No files or sessions match")
21
+ },
22
+ {
23
+ kind: "skill",
24
+ title: t("nativeDashboard.completion.skillsTitle", "Skills"),
25
+ hint: t("nativeDashboard.completion.skillsHint", "Use one of your skills"),
26
+ search: t("nativeDashboard.completion.skillsSearch", "Search skills"),
27
+ none: t("nativeDashboard.completion.skillsNone", "No skills match")
28
+ },
29
+ {
30
+ kind: "command",
31
+ title: t("nativeDashboard.completion.commandsTitle", "Slash commands"),
32
+ hint: t("nativeDashboard.completion.commandsHint", "Run a session command"),
33
+ search: t("nativeDashboard.completion.commandsSearch", "Search commands"),
34
+ none: t("nativeDashboard.completion.commandsNone", "No commands match")
35
+ }
36
+ ];
37
+ }
35
38
  /** The hub is a tunnel away, so wait for a pause in typing before asking it. */
36
39
  const FILE_SEARCH_DEBOUNCE_MS = 150;
37
40
  function textField(data, key) {
@@ -44,11 +47,13 @@ function textField(data, key) {
44
47
  * menu row itself; a sheet has room for a page, so here `data.title` (with
45
48
  * optional `hint` and `glyph`) is the row and the component is the page.
46
49
  */
47
- function insertPages(sessionId) {
50
+ function insertPages(sessionId, t) {
48
51
  return slotFills(HOST_SLOTS.composerMenu, sessionId).flatMap(({ pluginId, id, data, component }) => {
49
- const title = textField(data, "title");
52
+ const translateCopy = typeof data === "object" && data !== null ? Reflect.get(data, "translateCopy") : void 0;
53
+ const copy = typeof translateCopy === "function" ? translateCopy(t) : data;
54
+ const title = textField(copy, "title");
50
55
  if (!component || title === void 0) return [];
51
- const hint = textField(data, "hint") ?? "";
56
+ const hint = textField(copy, "hint") ?? "";
52
57
  const glyph = textField(data, "glyph") ?? title.charAt(0);
53
58
  return [{
54
59
  key: `${pluginId}:${id}`,
@@ -71,7 +76,7 @@ function useCompletionItems(source, kind, query) {
71
76
  searchFiles(query).then((found) => {
72
77
  if (current) setFiles({
73
78
  query,
74
- items: fileCompletions(found)
79
+ items: found
75
80
  });
76
81
  });
77
82
  }, FILE_SEARCH_DEBOUNCE_MS);
@@ -87,8 +92,9 @@ function useCompletionItems(source, kind, query) {
87
92
  if (source === void 0 || kind === null) return [];
88
93
  if (kind !== "file") return commandCompletions(source.commands, kind, query);
89
94
  const sessions = sessionCompletions(source.sessions?.() ?? [], query);
90
- if (files?.query === query) return [...sessions, ...files.items];
91
- return sessions.length > 0 ? sessions : void 0;
95
+ const references = source.references?.(query) ?? [];
96
+ const items = [...sessions, ...fileCompletions(files?.query === query ? files.items : [], references)];
97
+ return files?.query === query || items.length > 0 ? items : void 0;
92
98
  }
93
99
  /** Completion items as tappable rows: the name in mono, what it does beneath. */
94
100
  function CompletionRows({ items, onPick }) {
@@ -121,12 +127,14 @@ function CompletionRows({ items, onPick }) {
121
127
  }
122
128
  /** The magic button's sheet: choose Files, Skills, Slash commands, a plugin page or an attachment, then pick one. */
123
129
  function CompletionSheet({ open, onOpenChange, source, onPick, defaultKind, defaultQuery = "", defaultPage, slotProps, actions = [] }) {
130
+ const t = useT();
131
+ const kinds = completionKinds(t);
124
132
  const [kind, setKind] = useState(defaultKind ?? null);
125
133
  const [pageKey, setPageKey] = useState(defaultPage ?? null);
126
134
  const [query, setQuery] = useState(defaultQuery);
127
135
  const items = useCompletionItems(source, kind, query);
128
- const page = KINDS.find((entry) => entry.kind === kind);
129
- const pages = slotProps ? insertPages(slotProps.sessionId) : [];
136
+ const page = kinds.find((entry) => entry.kind === kind);
137
+ const pages = slotProps ? insertPages(slotProps.sessionId, t) : [];
130
138
  const plugin = pages.find((entry) => entry.key === pageKey);
131
139
  const choose = (next) => {
132
140
  setKind(next);
@@ -138,7 +146,7 @@ function CompletionSheet({ open, onOpenChange, source, onPick, defaultKind, defa
138
146
  onOpenChange(next);
139
147
  };
140
148
  const rows = [
141
- ...KINDS.map((entry) => ({
149
+ ...kinds.map((entry) => ({
142
150
  key: entry.kind,
143
151
  glyph: TRIGGER_CHARS[entry.kind],
144
152
  title: entry.title,
@@ -165,7 +173,7 @@ function CompletionSheet({ open, onOpenChange, source, onPick, defaultKind, defa
165
173
  children: [
166
174
  /* @__PURE__ */ jsx(Pressable, {
167
175
  accessibilityRole: "button",
168
- accessibilityLabel: "Back to insert",
176
+ accessibilityLabel: t("nativeDashboard.completion.back", "Back to insert"),
169
177
  onPress: () => choose(null),
170
178
  disabled: page === void 0 && plugin === void 0,
171
179
  style: [styles.back, page === void 0 && plugin === void 0 && styles.hidden],
@@ -180,7 +188,7 @@ function CompletionSheet({ open, onOpenChange, source, onPick, defaultKind, defa
180
188
  /* @__PURE__ */ jsx(Text, {
181
189
  style: styles.title,
182
190
  accessibilityRole: "header",
183
- children: page?.title ?? plugin?.title ?? "Insert"
191
+ children: page?.title ?? plugin?.title ?? t("nativeDashboard.completion.title", "Insert")
184
192
  }),
185
193
  /* @__PURE__ */ jsx(View, { style: [styles.back, styles.hidden] })
186
194
  ]
@@ -240,7 +248,7 @@ function CompletionSheet({ open, onOpenChange, source, onPick, defaultKind, defa
240
248
  children: /* @__PURE__ */ jsx(Spinner, {
241
249
  size: "small",
242
250
  color: "dim",
243
- label: "Searching"
251
+ label: t("nativeDashboard.completion.searching", "Searching")
244
252
  })
245
253
  }) : items.length === 0 ? /* @__PURE__ */ jsx(Text, {
246
254
  style: styles.none,
@@ -257,9 +265,10 @@ function CompletionSheet({ open, onOpenChange, source, onPick, defaultKind, defa
257
265
  }
258
266
  /** The composer's round button that opens the sheet. */
259
267
  function CompletionButton({ onPress }) {
268
+ const t = useT();
260
269
  return /* @__PURE__ */ jsx(Pressable, {
261
270
  accessibilityRole: "button",
262
- accessibilityLabel: "Insert or attach",
271
+ accessibilityLabel: t("nativeDashboard.completion.open", "Insert or attach"),
263
272
  onPress,
264
273
  hitSlop: 6,
265
274
  style: ({ pressed }) => [styles.magic, pressed && styles.magicPressed],
@@ -1 +1 @@
1
- {"version":3,"file":"CompletionSheet.mjs","names":["WebPluginSlotProps","ChevronRightIcon","fontOf","Input","Sheet","SheetContent","SparklesIcon","Spinner","CommandInfo","CompletionItem","CompletionKind","commandCompletions","fileCompletions","HOST_SLOTS","MentionableSession","sessionCompletions","slotFills","TRIGGER_CHARS","ComponentType","useEffect","useEffectEvent","useState","StyleSheet","KINDS","kind","title","hint","search","none","FILE_SEARCH_DEBOUNCE_MS","CompletionSource","commands","searchFiles","query","Promise","sessions","InsertPage","key","glyph","component","textField","data","undefined","value","Reflect","get","insertPages","sessionId","composerMenu","flatMap","pluginId","id","charAt","useCompletionItems","source","files","setFiles","items","searchable","text","resolve","current","timer","setTimeout","then","found","clearTimeout","length","CompletionRows","onPick","item","styles","list","map","index","insert","detail","label","pressed","divider","flex","itemLabel","meta","CompletionSheetProps","open","onOpenChange","defaultKind","defaultQuery","defaultPage","slotProps","actions","InsertAction","onPress","CompletionSheet","setKind","pageKey","setPageKey","setQuery","page","find","entry","pages","plugin","choose","next","close","rows","head","back","hidden","flip","appendComposerDraft","body","glyphText","kindLabel","waiting","CompletionButton","magic","magicPressed","create","theme","sans","fontFamily","mono","size","color","fontSize","lineHeight","minWidth","opacity","transform","rotate","flexDirection","alignItems","paddingHorizontal","spacing","paddingBottom","uni__dependencies","width","height","justifyContent","colors","hi","fontWeight","semibold","textAlign","gap","borderRadius","lg","borderWidth","borderColor","backgroundColor","bg","overflow","minHeight","paddingVertical","borderTopWidth","hairlineWidth","borderTopColor","green","medium","dim"],"sources":["../../src/components/CompletionSheet.tsx"],"sourcesContent":["import type { WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n ChevronRightIcon,\n fontOf,\n Input,\n Sheet,\n SheetContent,\n SparklesIcon,\n Spinner,\n} from '@agimon-ai/po-native-components';\nimport {\n type CommandInfo,\n type CompletionItem,\n type CompletionKind,\n commandCompletions,\n fileCompletions,\n HOST_SLOTS,\n type MentionableSession,\n sessionCompletions,\n slotFills,\n TRIGGER_CHARS,\n} from '@agimon-ai/po-web-dashboard/core';\nimport { type ComponentType, useEffect, useEffectEvent, useState } from 'react';\nimport { Pressable, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\n/** The phone's way into `@`, `$` and `/`: what each kind is called and what it is for. */\nconst KINDS: readonly { kind: CompletionKind; title: string; hint: string; search: string; none: string }[] = [\n {\n kind: 'file',\n title: 'Files and sessions',\n hint: 'Point Po at a file in this folder or another session',\n search: 'Search files and sessions',\n none: 'No files or sessions match',\n },\n { kind: 'skill', title: 'Skills', hint: 'Use one of your skills', search: 'Search skills', none: 'No skills match' },\n {\n kind: 'command',\n title: 'Slash commands',\n hint: 'Run a session command',\n search: 'Search commands',\n none: 'No commands match',\n },\n];\n/** The hub is a tunnel away, so wait for a pause in typing before asking it. */\nconst FILE_SEARCH_DEBOUNCE_MS = 150;\n\nexport interface CompletionSource {\n commands: readonly CommandInfo[];\n searchFiles: (query: string) => Promise<string[]>;\n /** Sessions `@` may name, offered before files. */\n sessions?: () => readonly MentionableSession[];\n}\n\n/** A row a plugin adds after the three kinds, and the page it opens in this sheet. */\ninterface InsertPage {\n key: string;\n title: string;\n hint: string;\n glyph: string;\n component: ComponentType<WebPluginSlotProps>;\n}\n\nfunction textField(data: unknown, key: string): string | undefined {\n if (typeof data !== 'object' || data === null) return undefined;\n const value: unknown = Reflect.get(data, key);\n return typeof value === 'string' ? value : undefined;\n}\n\n/**\n * The phone's `composer-menu` fills. The cockpit draws a fill's component as the\n * menu row itself; a sheet has room for a page, so here `data.title` (with\n * optional `hint` and `glyph`) is the row and the component is the page.\n */\nfunction insertPages(sessionId: string | null): InsertPage[] {\n return slotFills(HOST_SLOTS.composerMenu, sessionId).flatMap(({ pluginId, id, data, component }) => {\n const title = textField(data, 'title');\n if (!component || title === undefined) return [];\n const hint = textField(data, 'hint') ?? '';\n const glyph = textField(data, 'glyph') ?? title.charAt(0);\n return [{ key: `${pluginId}:${id}`, title, hint, glyph, component }];\n });\n}\n/** The items one kind offers for a query; files come from the hub, the rest from the session's commands. */\nexport function useCompletionItems(\n source: CompletionSource | undefined,\n kind: CompletionKind | null,\n query: string,\n): CompletionItem[] | undefined {\n const [files, setFiles] = useState<{ query: string; items: CompletionItem[] }>();\n const searchable = source?.searchFiles !== undefined;\n // Hosts rebuild searchFiles every render; an effect event keeps a streaming session from restarting the debounce forever.\n const searchFiles = useEffectEvent((text: string) => source?.searchFiles(text) ?? Promise.resolve([]));\n useEffect(() => {\n if (kind !== 'file' || !searchable) return;\n let current = true;\n const timer = setTimeout(() => {\n void searchFiles(query).then((found) => {\n if (current) setFiles({ query, items: fileCompletions(found) });\n });\n }, FILE_SEARCH_DEBOUNCE_MS);\n return () => {\n current = false;\n clearTimeout(timer);\n };\n }, [kind, query, searchable]);\n if (source === undefined || kind === null) return [];\n if (kind !== 'file') return commandCompletions(source.commands, kind, query);\n // Sessions come from memory, so they show at once; files join them when the hub answers.\n const sessions = sessionCompletions(source.sessions?.() ?? [], query);\n if (files?.query === query) return [...sessions, ...files.items];\n return sessions.length > 0 ? sessions : undefined;\n}\n\n/** Completion items as tappable rows: the name in mono, what it does beneath. */\nexport function CompletionRows({\n items,\n onPick,\n}: {\n items: readonly CompletionItem[];\n onPick: (item: CompletionItem) => void;\n}) {\n return (\n <View style={styles.list}>\n {items.map((item, index) => (\n <Pressable\n key={item.insert}\n accessibilityRole=\"button\"\n accessibilityLabel={item.detail ? `${item.label}, ${item.detail}` : item.label}\n onPress={() => onPick(item)}\n style={({ pressed }) => [styles.item, index > 0 && styles.divider, pressed && styles.pressed]}\n >\n <View style={styles.flex}>\n <Text style={styles.itemLabel} numberOfLines={1} ellipsizeMode=\"middle\">\n {item.label}\n </Text>\n {item.detail ? (\n <Text style={styles.meta} numberOfLines={1}>\n {item.detail}\n </Text>\n ) : null}\n </View>\n </Pressable>\n ))}\n </View>\n );\n}\n\nexport interface CompletionSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n source: CompletionSource;\n onPick: (kind: CompletionKind, item: CompletionItem) => void;\n /** Opens on one kind's search rather than the choice of kinds. */\n defaultKind?: CompletionKind;\n defaultQuery?: string;\n /** Opens on a plugin page, keyed `<pluginId>:<fillId>`. */\n defaultPage?: string;\n /** The session's plugin props; with them, its `composer-menu` fills join the list. */\n slotProps?: WebPluginSlotProps;\n /** Rows after the pages that close the sheet and run, such as attaching a photo or file. */\n actions?: readonly InsertAction[];\n}\n\nexport interface InsertAction {\n key: string;\n glyph: string;\n title: string;\n hint: string;\n onPress: () => void;\n}\n\n/** The magic button's sheet: choose Files, Skills, Slash commands, a plugin page or an attachment, then pick one. */\nexport function CompletionSheet({\n open,\n onOpenChange,\n source,\n onPick,\n defaultKind,\n defaultQuery = '',\n defaultPage,\n slotProps,\n actions = [],\n}: CompletionSheetProps) {\n const [kind, setKind] = useState<CompletionKind | null>(defaultKind ?? null);\n const [pageKey, setPageKey] = useState<string | null>(defaultPage ?? null);\n const [query, setQuery] = useState(defaultQuery);\n const items = useCompletionItems(source, kind, query);\n const page = KINDS.find((entry) => entry.kind === kind);\n const pages = slotProps ? insertPages(slotProps.sessionId) : [];\n const plugin = pages.find((entry) => entry.key === pageKey);\n\n const choose = (next: CompletionKind | null) => {\n setKind(next);\n setPageKey(null);\n setQuery('');\n };\n const close = (next: boolean) => {\n if (!next) choose(null);\n onOpenChange(next);\n };\n const rows = [\n ...KINDS.map((entry) => ({\n key: entry.kind,\n glyph: TRIGGER_CHARS[entry.kind],\n title: entry.title,\n hint: entry.hint,\n onPress: () => choose(entry.kind),\n })),\n ...pages.map((entry) => ({ ...entry, onPress: () => setPageKey(entry.key) })),\n ...actions.map((entry) => ({\n ...entry,\n onPress: () => {\n close(false);\n entry.onPress();\n },\n })),\n ];\n\n return (\n <Sheet open={open} onOpenChange={close}>\n <SheetContent>\n <View style={styles.head}>\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel=\"Back to insert\"\n onPress={() => choose(null)}\n disabled={page === undefined && plugin === undefined}\n style={[styles.back, page === undefined && plugin === undefined && styles.hidden]}\n >\n <View style={styles.flip}>\n <ChevronRightIcon size={18} color=\"hi\" />\n </View>\n </Pressable>\n <Text style={styles.title} accessibilityRole=\"header\">\n {page?.title ?? plugin?.title ?? 'Insert'}\n </Text>\n <View style={[styles.back, styles.hidden]} />\n </View>\n {plugin && slotProps ? (\n <plugin.component\n {...slotProps}\n appendComposerDraft={(text) => {\n slotProps.appendComposerDraft(text);\n close(false);\n }}\n />\n ) : (\n <View style={styles.body}>\n {page === undefined ? (\n <View style={styles.list}>\n {rows.map((entry, index) => (\n <Pressable\n key={entry.key}\n accessibilityRole=\"button\"\n accessibilityLabel={entry.hint ? `${entry.title}, ${entry.hint}` : entry.title}\n onPress={entry.onPress}\n style={({ pressed }) => [styles.item, index > 0 && styles.divider, pressed && styles.pressed]}\n >\n <View style={styles.glyph}>\n <Text style={styles.glyphText}>{entry.glyph}</Text>\n </View>\n <View style={styles.flex}>\n <Text style={styles.kindLabel}>{entry.title}</Text>\n {entry.hint ? <Text style={styles.meta}>{entry.hint}</Text> : null}\n </View>\n <ChevronRightIcon size={16} color=\"faint\" />\n </Pressable>\n ))}\n </View>\n ) : (\n <>\n <Input\n value={query}\n onChangeText={setQuery}\n placeholder={page.search}\n accessibilityLabel={page.search}\n autoFocus\n autoCapitalize=\"none\"\n autoCorrect={false}\n />\n {items === undefined ? (\n <View style={styles.waiting}>\n <Spinner size=\"small\" color=\"dim\" label=\"Searching\" />\n </View>\n ) : items.length === 0 ? (\n <Text style={styles.none}>{page.none}</Text>\n ) : (\n <CompletionRows\n items={items}\n onPick={(item) => {\n onPick(page.kind, item);\n close(false);\n }}\n />\n )}\n </>\n )}\n </View>\n )}\n </SheetContent>\n </Sheet>\n );\n}\n\n/** The composer's round button that opens the sheet. */\nexport function CompletionButton({ onPress }: { onPress: () => void }) {\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel=\"Insert or attach\"\n onPress={onPress}\n hitSlop={6}\n style={({ pressed }) => [styles.magic, pressed && styles.magicPressed]}\n >\n <SparklesIcon size={16} color=\"green\" />\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create((theme) => {\n const sans = fontOf(theme.fontFamily.sans);\n const mono = fontOf(theme.fontFamily.mono);\n const text = (size: 'sm' | 'base' | 'lg', color: string) => ({\n fontFamily: sans,\n fontSize: theme.fontSize[size],\n lineHeight: theme.lineHeight[size],\n color,\n });\n return {\n flex: { flex: 1, minWidth: 0 },\n hidden: { opacity: 0 },\n flip: { transform: [{ rotate: '180deg' }] },\n head: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: theme.spacing(3),\n paddingBottom: theme.spacing(2),\n },\n back: { width: 36, height: 36, alignItems: 'center', justifyContent: 'center' },\n title: { ...text('lg', theme.colors.hi), fontWeight: theme.fontWeight.semibold, flex: 1, textAlign: 'center' },\n body: { gap: theme.spacing(3), paddingHorizontal: theme.spacing(4), paddingBottom: theme.spacing(4) },\n list: {\n borderRadius: theme.borderRadius.lg,\n borderWidth: 1,\n borderColor: theme.colors['border-soft'],\n backgroundColor: theme.colors.bg,\n overflow: 'hidden',\n },\n item: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(3),\n minHeight: 48,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(2.5),\n },\n divider: { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: theme.colors['border-soft'] },\n pressed: { backgroundColor: theme.colors['tint-green'] },\n glyph: {\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.colors['tint-green'],\n },\n glyphText: { ...text('lg', theme.colors.green), fontFamily: mono, fontWeight: theme.fontWeight.semibold },\n kindLabel: { ...text('base', theme.colors.hi), fontWeight: theme.fontWeight.medium },\n itemLabel: { ...text('base', theme.colors.hi), fontFamily: mono },\n meta: text('sm', theme.colors.dim),\n none: { ...text('base', theme.colors.dim), textAlign: 'center', paddingVertical: theme.spacing(4) },\n waiting: { alignItems: 'center', paddingVertical: theme.spacing(6) },\n magic: {\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.colors['tint-green'],\n },\n magicPressed: { opacity: 0.7 },\n };\n});\n"],"mappings":";;;;;;;;;;;AA2BA,MAAMuB,QAAwG;CAC5G;EACEC,MAAM;EACNC,OAAO;EACPC,MAAM;EACNC,QAAQ;EACRC,MAAM;CACR;CACA;EAAEJ,MAAM;EAASC,OAAO;EAAUC,MAAM;EAA0BC,QAAQ;EAAiBC,MAAM;CAAkB;CACnH;EACEJ,MAAM;EACNC,OAAO;EACPC,MAAM;EACNC,QAAQ;EACRC,MAAM;CACR;AAAC;;AAGH,MAAMC,0BAA0B;AAkBhC,SAASW,UAAUC,MAAeJ,KAA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B,WAAW;GAAE,GAAGvD,KAAK,QAAQ6D,MAAMqB,OAAOC,EAAE;GAAGC,YAAYvB,MAAMuB,WAAWiB;GAAMvB,mBAAA,CAAA,CAAA;EAAC;EACnFxD,WAAW;GAAE,GAAGtB,KAAK,QAAQ6D,MAAMqB,OAAOC,EAAE;GAAGpB,YAAYC;GAAIc,mBAAA,CAAA,CAAA;EAAC;EAChEvD,MAAMvB,KAAK,MAAM6D,MAAMqB,OAAOoB,GAAG;EACjCrI,MAAM;GAAE,GAAG+B,KAAK,QAAQ6D,MAAMqB,OAAOoB,GAAG;GAAGhB,WAAW;GAAUU,iBAAiBnC,MAAMe,QAAQ,CAAC;GAACE,mBAAA,CAAA,CAAA;EAAC;EAClGtB,SAAS;GAAEkB,YAAY;GAAUsB,iBAAiBnC,MAAMe,QAAQ,CAAC;GAACE,mBAAA,CAAA,CAAA;EAAC;EACnEpB,OAAO;GACLqB,OAAO;GACPC,QAAQ;GACRQ,cAAc;GACdd,YAAY;GACZO,gBAAgB;GAChBW,iBAAiB/B,MAAMqB,OAAO;GAAaJ,mBAAA,CAAA,CAAA;EAC7C;EACAnB,cAAc,EAAEW,SAAS,GAAI;CAC/B;AACF,CAAC"}
1
+ {"version":3,"file":"CompletionSheet.mjs","names":["useT","WebPluginSlotProps","ChevronRightIcon","fontOf","Input","Sheet","SheetContent","SparklesIcon","Spinner","CommandInfo","CompletionItem","CompletionKind","commandCompletions","fileCompletions","HOST_SLOTS","MentionableSession","sessionCompletions","slotFills","TRIGGER_CHARS","ComponentType","useEffect","useEffectEvent","useState","StyleSheet","Translate","key","fallback","completionKinds","t","kind","title","hint","search","none","FILE_SEARCH_DEBOUNCE_MS","CompletionSource","commands","searchFiles","query","Promise","references","path","detail","sessions","InsertPage","glyph","component","textField","data","undefined","value","Reflect","get","insertPages","sessionId","ReturnType","composerMenu","flatMap","pluginId","id","translateCopy","copy","charAt","useCompletionItems","source","files","setFiles","items","searchable","text","resolve","current","timer","setTimeout","then","found","clearTimeout","length","CompletionRows","onPick","item","styles","list","map","index","insert","label","pressed","divider","flex","itemLabel","meta","CompletionSheetProps","open","onOpenChange","defaultKind","defaultQuery","defaultPage","slotProps","actions","InsertAction","onPress","CompletionSheet","kinds","setKind","pageKey","setPageKey","setQuery","page","find","entry","pages","plugin","choose","next","close","rows","head","back","hidden","flip","appendComposerDraft","body","glyphText","kindLabel","waiting","CompletionButton","magic","magicPressed","create","theme","sans","fontFamily","mono","size","color","fontSize","lineHeight","minWidth","opacity","transform","rotate","flexDirection","alignItems","paddingHorizontal","spacing","paddingBottom","uni__dependencies","width","height","justifyContent","colors","hi","fontWeight","semibold","textAlign","gap","borderRadius","lg","borderWidth","borderColor","backgroundColor","bg","overflow","minHeight","paddingVertical","borderTopWidth","hairlineWidth","borderTopColor","green","medium","dim"],"sources":["../../src/components/CompletionSheet.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport type { WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n ChevronRightIcon,\n fontOf,\n Input,\n Sheet,\n SheetContent,\n SparklesIcon,\n Spinner,\n} from '@agimon-ai/po-native-components';\nimport {\n type CommandInfo,\n type CompletionItem,\n type CompletionKind,\n commandCompletions,\n fileCompletions,\n HOST_SLOTS,\n type MentionableSession,\n sessionCompletions,\n slotFills,\n TRIGGER_CHARS,\n} from '@agimon-ai/po-web-dashboard/core';\nimport { type ComponentType, useEffect, useEffectEvent, useState } from 'react';\nimport { Pressable, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\ntype Translate = (key: string, fallback: string) => string;\n\n/** The phone's way into `@`, `$` and `/`: what each kind is called and what it is for. */\nfunction completionKinds(\n t: Translate,\n): readonly { kind: CompletionKind; title: string; hint: string; search: string; none: string }[] {\n return [\n {\n kind: 'file',\n title: t('nativeDashboard.completion.filesTitle', 'Files and sessions'),\n hint: t('nativeDashboard.completion.filesHint', 'Point Po at a file in this folder or another session'),\n search: t('nativeDashboard.completion.filesSearch', 'Search files and sessions'),\n none: t('nativeDashboard.completion.filesNone', 'No files or sessions match'),\n },\n {\n kind: 'skill',\n title: t('nativeDashboard.completion.skillsTitle', 'Skills'),\n hint: t('nativeDashboard.completion.skillsHint', 'Use one of your skills'),\n search: t('nativeDashboard.completion.skillsSearch', 'Search skills'),\n none: t('nativeDashboard.completion.skillsNone', 'No skills match'),\n },\n {\n kind: 'command',\n title: t('nativeDashboard.completion.commandsTitle', 'Slash commands'),\n hint: t('nativeDashboard.completion.commandsHint', 'Run a session command'),\n search: t('nativeDashboard.completion.commandsSearch', 'Search commands'),\n none: t('nativeDashboard.completion.commandsNone', 'No commands match'),\n },\n ];\n}\n/** The hub is a tunnel away, so wait for a pause in typing before asking it. */\nconst FILE_SEARCH_DEBOUNCE_MS = 150;\n\nexport interface CompletionSource {\n commands: readonly CommandInfo[];\n searchFiles: (query: string) => Promise<string[]>;\n /** References plugins offer before workspace files. */\n references?: (query: string) => readonly { path: string; detail?: string }[];\n /** Sessions `@` may name, offered before files. */\n sessions?: () => readonly MentionableSession[];\n}\n\n/** A row a plugin adds after the three kinds, and the page it opens in this sheet. */\ninterface InsertPage {\n key: string;\n title: string;\n hint: string;\n glyph: string;\n component: ComponentType<WebPluginSlotProps>;\n}\n\nfunction textField(data: unknown, key: string): string | undefined {\n if (typeof data !== 'object' || data === null) return undefined;\n const value: unknown = Reflect.get(data, key);\n return typeof value === 'string' ? value : undefined;\n}\n\n/**\n * The phone's `composer-menu` fills. The cockpit draws a fill's component as the\n * menu row itself; a sheet has room for a page, so here `data.title` (with\n * optional `hint` and `glyph`) is the row and the component is the page.\n */\nfunction insertPages(sessionId: string | null, t: ReturnType<typeof useT>): InsertPage[] {\n return slotFills(HOST_SLOTS.composerMenu, sessionId).flatMap(({ pluginId, id, data, component }) => {\n const translateCopy: unknown =\n typeof data === 'object' && data !== null ? Reflect.get(data, 'translateCopy') : undefined;\n const copy: unknown = typeof translateCopy === 'function' ? translateCopy(t) : data;\n const title = textField(copy, 'title');\n if (!component || title === undefined) return [];\n const hint = textField(copy, 'hint') ?? '';\n const glyph = textField(data, 'glyph') ?? title.charAt(0);\n return [{ key: `${pluginId}:${id}`, title, hint, glyph, component }];\n });\n}\n/** The items one kind offers for a query; files come from the hub, the rest from the session's commands. */\nexport function useCompletionItems(\n source: CompletionSource | undefined,\n kind: CompletionKind | null,\n query: string,\n): CompletionItem[] | undefined {\n const [files, setFiles] = useState<{ query: string; items: string[] }>();\n const searchable = source?.searchFiles !== undefined;\n // Hosts rebuild searchFiles every render; an effect event keeps a streaming session from restarting the debounce forever.\n const searchFiles = useEffectEvent((text: string) => source?.searchFiles(text) ?? Promise.resolve([]));\n useEffect(() => {\n if (kind !== 'file' || !searchable) return;\n let current = true;\n const timer = setTimeout(() => {\n void searchFiles(query).then((found) => {\n if (current) setFiles({ query, items: found });\n });\n }, FILE_SEARCH_DEBOUNCE_MS);\n return () => {\n current = false;\n clearTimeout(timer);\n };\n }, [kind, query, searchable]);\n if (source === undefined || kind === null) return [];\n if (kind !== 'file') return commandCompletions(source.commands, kind, query);\n // Sessions come from memory, so they show at once; files join them when the hub answers.\n const sessions = sessionCompletions(source.sessions?.() ?? [], query);\n const references = source.references?.(query) ?? [];\n const items = [...sessions, ...fileCompletions(files?.query === query ? files.items : [], references)];\n return files?.query === query || items.length > 0 ? items : undefined;\n}\n\n/** Completion items as tappable rows: the name in mono, what it does beneath. */\nexport function CompletionRows({\n items,\n onPick,\n}: {\n items: readonly CompletionItem[];\n onPick: (item: CompletionItem) => void;\n}) {\n return (\n <View style={styles.list}>\n {items.map((item, index) => (\n <Pressable\n key={item.insert}\n accessibilityRole=\"button\"\n accessibilityLabel={item.detail ? `${item.label}, ${item.detail}` : item.label}\n onPress={() => onPick(item)}\n style={({ pressed }) => [styles.item, index > 0 && styles.divider, pressed && styles.pressed]}\n >\n <View style={styles.flex}>\n <Text style={styles.itemLabel} numberOfLines={1} ellipsizeMode=\"middle\">\n {item.label}\n </Text>\n {item.detail ? (\n <Text style={styles.meta} numberOfLines={1}>\n {item.detail}\n </Text>\n ) : null}\n </View>\n </Pressable>\n ))}\n </View>\n );\n}\n\nexport interface CompletionSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n source: CompletionSource;\n onPick: (kind: CompletionKind, item: CompletionItem) => void;\n /** Opens on one kind's search rather than the choice of kinds. */\n defaultKind?: CompletionKind;\n defaultQuery?: string;\n /** Opens on a plugin page, keyed `<pluginId>:<fillId>`. */\n defaultPage?: string;\n /** The session's plugin props; with them, its `composer-menu` fills join the list. */\n slotProps?: WebPluginSlotProps;\n /** Rows after the pages that close the sheet and run, such as attaching a photo or file. */\n actions?: readonly InsertAction[];\n}\n\nexport interface InsertAction {\n key: string;\n glyph: string;\n title: string;\n hint: string;\n onPress: () => void;\n}\n\n/** The magic button's sheet: choose Files, Skills, Slash commands, a plugin page or an attachment, then pick one. */\nexport function CompletionSheet({\n open,\n onOpenChange,\n source,\n onPick,\n defaultKind,\n defaultQuery = '',\n defaultPage,\n slotProps,\n actions = [],\n}: CompletionSheetProps) {\n const t = useT();\n const kinds = completionKinds(t);\n const [kind, setKind] = useState<CompletionKind | null>(defaultKind ?? null);\n const [pageKey, setPageKey] = useState<string | null>(defaultPage ?? null);\n const [query, setQuery] = useState(defaultQuery);\n const items = useCompletionItems(source, kind, query);\n const page = kinds.find((entry) => entry.kind === kind);\n const pages = slotProps ? insertPages(slotProps.sessionId, t) : [];\n const plugin = pages.find((entry) => entry.key === pageKey);\n\n const choose = (next: CompletionKind | null) => {\n setKind(next);\n setPageKey(null);\n setQuery('');\n };\n const close = (next: boolean) => {\n if (!next) choose(null);\n onOpenChange(next);\n };\n const rows = [\n ...kinds.map((entry) => ({\n key: entry.kind,\n glyph: TRIGGER_CHARS[entry.kind],\n title: entry.title,\n hint: entry.hint,\n onPress: () => choose(entry.kind),\n })),\n ...pages.map((entry) => ({ ...entry, onPress: () => setPageKey(entry.key) })),\n ...actions.map((entry) => ({\n ...entry,\n onPress: () => {\n close(false);\n entry.onPress();\n },\n })),\n ];\n\n return (\n <Sheet open={open} onOpenChange={close}>\n <SheetContent>\n <View style={styles.head}>\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={t('nativeDashboard.completion.back', 'Back to insert')}\n onPress={() => choose(null)}\n disabled={page === undefined && plugin === undefined}\n style={[styles.back, page === undefined && plugin === undefined && styles.hidden]}\n >\n <View style={styles.flip}>\n <ChevronRightIcon size={18} color=\"hi\" />\n </View>\n </Pressable>\n <Text style={styles.title} accessibilityRole=\"header\">\n {page?.title ?? plugin?.title ?? t('nativeDashboard.completion.title', 'Insert')}\n </Text>\n <View style={[styles.back, styles.hidden]} />\n </View>\n {plugin && slotProps ? (\n <plugin.component\n {...slotProps}\n appendComposerDraft={(text) => {\n slotProps.appendComposerDraft(text);\n close(false);\n }}\n />\n ) : (\n <View style={styles.body}>\n {page === undefined ? (\n <View style={styles.list}>\n {rows.map((entry, index) => (\n <Pressable\n key={entry.key}\n accessibilityRole=\"button\"\n accessibilityLabel={entry.hint ? `${entry.title}, ${entry.hint}` : entry.title}\n onPress={entry.onPress}\n style={({ pressed }) => [styles.item, index > 0 && styles.divider, pressed && styles.pressed]}\n >\n <View style={styles.glyph}>\n <Text style={styles.glyphText}>{entry.glyph}</Text>\n </View>\n <View style={styles.flex}>\n <Text style={styles.kindLabel}>{entry.title}</Text>\n {entry.hint ? <Text style={styles.meta}>{entry.hint}</Text> : null}\n </View>\n <ChevronRightIcon size={16} color=\"faint\" />\n </Pressable>\n ))}\n </View>\n ) : (\n <>\n <Input\n value={query}\n onChangeText={setQuery}\n placeholder={page.search}\n accessibilityLabel={page.search}\n autoFocus\n autoCapitalize=\"none\"\n autoCorrect={false}\n />\n {items === undefined ? (\n <View style={styles.waiting}>\n <Spinner size=\"small\" color=\"dim\" label={t('nativeDashboard.completion.searching', 'Searching')} />\n </View>\n ) : items.length === 0 ? (\n <Text style={styles.none}>{page.none}</Text>\n ) : (\n <CompletionRows\n items={items}\n onPick={(item) => {\n onPick(page.kind, item);\n close(false);\n }}\n />\n )}\n </>\n )}\n </View>\n )}\n </SheetContent>\n </Sheet>\n );\n}\n\n/** The composer's round button that opens the sheet. */\nexport function CompletionButton({ onPress }: { onPress: () => void }) {\n const t = useT();\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={t('nativeDashboard.completion.open', 'Insert or attach')}\n onPress={onPress}\n hitSlop={6}\n style={({ pressed }) => [styles.magic, pressed && styles.magicPressed]}\n >\n <SparklesIcon size={16} color=\"green\" />\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create((theme) => {\n const sans = fontOf(theme.fontFamily.sans);\n const mono = fontOf(theme.fontFamily.mono);\n const text = (size: 'sm' | 'base' | 'lg', color: string) => ({\n fontFamily: sans,\n fontSize: theme.fontSize[size],\n lineHeight: theme.lineHeight[size],\n color,\n });\n return {\n flex: { flex: 1, minWidth: 0 },\n hidden: { opacity: 0 },\n flip: { transform: [{ rotate: '180deg' }] },\n head: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: theme.spacing(3),\n paddingBottom: theme.spacing(2),\n },\n back: { width: 36, height: 36, alignItems: 'center', justifyContent: 'center' },\n title: { ...text('lg', theme.colors.hi), fontWeight: theme.fontWeight.semibold, flex: 1, textAlign: 'center' },\n body: { gap: theme.spacing(3), paddingHorizontal: theme.spacing(4), paddingBottom: theme.spacing(4) },\n list: {\n borderRadius: theme.borderRadius.lg,\n borderWidth: 1,\n borderColor: theme.colors['border-soft'],\n backgroundColor: theme.colors.bg,\n overflow: 'hidden',\n },\n item: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(3),\n minHeight: 48,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(2.5),\n },\n divider: { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: theme.colors['border-soft'] },\n pressed: { backgroundColor: theme.colors['tint-green'] },\n glyph: {\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.colors['tint-green'],\n },\n glyphText: { ...text('lg', theme.colors.green), fontFamily: mono, fontWeight: theme.fontWeight.semibold },\n kindLabel: { ...text('base', theme.colors.hi), fontWeight: theme.fontWeight.medium },\n itemLabel: { ...text('base', theme.colors.hi), fontFamily: mono },\n meta: text('sm', theme.colors.dim),\n none: { ...text('base', theme.colors.dim), textAlign: 'center', paddingVertical: theme.spacing(4) },\n waiting: { alignItems: 'center', paddingVertical: theme.spacing(6) },\n magic: {\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.colors['tint-green'],\n },\n magicPressed: { opacity: 0.7 },\n };\n});\n"],"mappings":";;;;;;;;;;;;AA8BA,SAAS2B,gBACPC,GACgG;CAChG,OAAO;EACL;GACEC,MAAM;GACNC,OAAOF,EAAE,yCAAyC,oBAAoB;GACtEG,MAAMH,EAAE,wCAAwC,sDAAsD;GACtGI,QAAQJ,EAAE,0CAA0C,2BAA2B;GAC/EK,MAAML,EAAE,wCAAwC,4BAA4B;EAC9E;EACA;GACEC,MAAM;GACNC,OAAOF,EAAE,0CAA0C,QAAQ;GAC3DG,MAAMH,EAAE,yCAAyC,wBAAwB;GACzEI,QAAQJ,EAAE,2CAA2C,eAAe;GACpEK,MAAML,EAAE,yCAAyC,iBAAiB;EACpE;EACA;GACEC,MAAM;GACNC,OAAOF,EAAE,4CAA4C,gBAAgB;GACrEG,MAAMH,EAAE,2CAA2C,uBAAuB;GAC1EI,QAAQJ,EAAE,6CAA6C,iBAAiB;GACxEK,MAAML,EAAE,2CAA2C,mBAAmB;EACxE;CAAC;AAEL;;AAEA,MAAMM,0BAA0B;AAoBhC,SAASa,UAAUC,MAAevB,KAAiC;CACjE,IAAI,OAAOuB,SAAS,YAAYA,SAAS,MAAM,OAAOC;CACtD,MAAMC,QAAiBC,QAAQC,IAAIJ,MAAMvB,GAAG;CAC5C,OAAO,OAAOyB,UAAU,WAAWA,QAAQD;AAC7C;;;;;;AAOA,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AA,CAAA;EAAC;EACvDtG,OAAO;GACLuG,OAAO;GACPC,QAAQ;GACRQ,cAAc;GACdd,YAAY;GACZO,gBAAgB;GAChBW,iBAAiB/B,MAAMqB,OAAO;GAAaJ,mBAAA,CAAA,CAAA;EAC7C;EACAxB,WAAW;GAAE,GAAGtD,KAAK,MAAM6D,MAAMqB,OAAOkB,KAAK;GAAGrC,YAAYC;GAAMoB,YAAYvB,MAAMuB,WAAWC;GAAQP,mBAAA,CAAA,CAAA;EAAC;EACxGvB,WAAW;GAAE,GAAGvD,KAAK,QAAQ6D,MAAMqB,OAAOC,EAAE;GAAGC,YAAYvB,MAAMuB,WAAWiB;GAAMvB,mBAAA,CAAA,CAAA;EAAC;EACnFzD,WAAW;GAAE,GAAGrB,KAAK,QAAQ6D,MAAMqB,OAAOC,EAAE;GAAGpB,YAAYC;GAAIc,mBAAA,CAAA,CAAA;EAAC;EAChExD,MAAMtB,KAAK,MAAM6D,MAAMqB,OAAOoB,GAAG;EACjC1I,MAAM;GAAE,GAAGoC,KAAK,QAAQ6D,MAAMqB,OAAOoB,GAAG;GAAGhB,WAAW;GAAUU,iBAAiBnC,MAAMe,QAAQ,CAAC;GAACE,mBAAA,CAAA,CAAA;EAAC;EAClGtB,SAAS;GAAEkB,YAAY;GAAUsB,iBAAiBnC,MAAMe,QAAQ,CAAC;GAACE,mBAAA,CAAA,CAAA;EAAC;EACnEpB,OAAO;GACLqB,OAAO;GACPC,QAAQ;GACRQ,cAAc;GACdd,YAAY;GACZO,gBAAgB;GAChBW,iBAAiB/B,MAAMqB,OAAO;GAAaJ,mBAAA,CAAA,CAAA;EAC7C;EACAnB,cAAc,EAAEW,SAAS,GAAI;CAC/B;AACF,CAAC"}
@@ -15,6 +15,8 @@ export interface ComposerProps {
15
15
  /** Runtime controls subscribe here, outside the navigator and transcript. */
16
16
  live?: boolean;
17
17
  searchFiles?: (query: string) => Promise<string[]>;
18
+ /** References plugins offer before workspace files. */
19
+ references?: CompletionSource['references'];
18
20
  /** Sessions `@` may name, offered before files. */
19
21
  mentionSessions?: CompletionSource['sessions'];
20
22
  /** Stores a picked file on the host and returns its path; without it the File option reports it is unavailable. */
@@ -30,8 +32,8 @@ export interface ComposerProps {
30
32
  /** A run is in progress: Send steers it and Abort stops it. */
31
33
  running?: boolean;
32
34
  onAbort?: () => void;
33
- /** The current major mode, shown on the options button. */
34
- mode?: string;
35
+ /** The current preset, shown on the options button. */
36
+ preset?: string;
35
37
  onOpenOptions?: () => void;
36
38
  /** Offers `@` files, `$` skills and `/` commands while typing and from the insert button. */
37
39
  completion?: CompletionSource;
@@ -42,8 +44,10 @@ export interface ComposerProps {
42
44
  onRemoveCapture?: (capture: ComposerCapture) => void;
43
45
  /** One outlined box holding the text and its controls, with an icon Send; absent keeps the default layout. */
44
46
  quiet?: boolean;
47
+ /** Focuses the text box on mount, such as when a conversation sheet opens to be typed in. */
48
+ autoFocus?: boolean;
45
49
  }
46
50
  /** The text box, then the options button and Send in one row outside it. Context and cost sit in the options sheet. */
47
- export declare function Composer({ onSend, disabled, initialText, value, onChangeText, running: suppliedRunning, onAbort, mode: suppliedMode, onOpenOptions, completion: suppliedCompletion, draftStore, sessionId, live, searchFiles, mentionSessions, uploadAttachment, slotProps, captures, onRemoveCapture, quiet }: ComposerProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null | undefined;
51
+ export declare function Composer({ onSend, disabled, initialText, value, onChangeText, running: suppliedRunning, onAbort, preset: suppliedPreset, onOpenOptions, completion: suppliedCompletion, draftStore, sessionId, live, searchFiles, mentionSessions, references, uploadAttachment, slotProps, captures, onRemoveCapture, quiet, autoFocus }: ComposerProps): string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
48
52
  //#endregion
49
53
  //# sourceMappingURL=Composer.d.mts.map