@opengeni/react-native 1.4.5-canary.37615713321001

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 (132) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +74 -0
  3. package/dist/adapters.d.ts +53 -0
  4. package/dist/adapters.js +3 -0
  5. package/dist/adapters.js.map +1 -0
  6. package/dist/attachments.d.ts +75 -0
  7. package/dist/chunk-3VSZAQ7G.js +391 -0
  8. package/dist/chunk-3VSZAQ7G.js.map +1 -0
  9. package/dist/chunk-5ZVK7WKA.js +88 -0
  10. package/dist/chunk-5ZVK7WKA.js.map +1 -0
  11. package/dist/chunk-EEDIMY3L.js +240 -0
  12. package/dist/chunk-EEDIMY3L.js.map +1 -0
  13. package/dist/chunk-M23SDI4R.js +83 -0
  14. package/dist/chunk-M23SDI4R.js.map +1 -0
  15. package/dist/chunk-PHJBSAR3.js +2006 -0
  16. package/dist/chunk-PHJBSAR3.js.map +1 -0
  17. package/dist/environment.d.ts +19 -0
  18. package/dist/expo.d.ts +25 -0
  19. package/dist/expo.js +267 -0
  20. package/dist/expo.js.map +1 -0
  21. package/dist/index.d.ts +13 -0
  22. package/dist/index.js +3345 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/presentation.d.ts +262 -0
  25. package/dist/read-acknowledgement.d.ts +39 -0
  26. package/dist/realtime/call-events.d.ts +11 -0
  27. package/dist/realtime/call-view.d.ts +26 -0
  28. package/dist/realtime/expo-call.d.ts +11 -0
  29. package/dist/realtime/native-call.d.ts +104 -0
  30. package/dist/realtime/native-realtime.d.ts +35 -0
  31. package/dist/realtime/use-native-session-realtime.d.ts +25 -0
  32. package/dist/session-view.d.ts +87 -0
  33. package/dist/timeline/activity.d.ts +34 -0
  34. package/dist/timeline/composer.d.ts +86 -0
  35. package/dist/timeline/controls.d.ts +27 -0
  36. package/dist/timeline/decisions.d.ts +29 -0
  37. package/dist/timeline/feedback.d.ts +26 -0
  38. package/dist/timeline/icon-nodes.generated.d.ts +738 -0
  39. package/dist/timeline/icon.d.ts +11 -0
  40. package/dist/timeline/index.d.ts +32 -0
  41. package/dist/timeline/index.js +5419 -0
  42. package/dist/timeline/index.js.map +1 -0
  43. package/dist/timeline/markdown.d.ts +11 -0
  44. package/dist/timeline/markdown.js +415 -0
  45. package/dist/timeline/markdown.js.map +1 -0
  46. package/dist/timeline/message-attachments.d.ts +13 -0
  47. package/dist/timeline/message-timeline.d.ts +36 -0
  48. package/dist/timeline/model-picker.d.ts +17 -0
  49. package/dist/timeline/primitives.d.ts +85 -0
  50. package/dist/timeline/queue-dock.d.ts +19 -0
  51. package/dist/timeline/session-actions.d.ts +34 -0
  52. package/dist/timeline/session-list.d.ts +50 -0
  53. package/dist/timeline/session-screen.d.ts +35 -0
  54. package/dist/timeline/session-signals.d.ts +37 -0
  55. package/dist/timeline/sheet.d.ts +14 -0
  56. package/dist/timeline/theme.d.ts +58 -0
  57. package/dist/timeline/thinking-orb.d.ts +13 -0
  58. package/dist/timeline/turn.d.ts +80 -0
  59. package/dist/ui/attention.d.ts +14 -0
  60. package/dist/ui/cards.d.ts +21 -0
  61. package/dist/ui/composer.d.ts +21 -0
  62. package/dist/ui/format.d.ts +13 -0
  63. package/dist/ui/icons.d.ts +9 -0
  64. package/dist/ui/index.d.ts +12 -0
  65. package/dist/ui/index.js +1757 -0
  66. package/dist/ui/index.js.map +1 -0
  67. package/dist/ui/steps-sheet.d.ts +10 -0
  68. package/dist/ui/theme.d.ts +63 -0
  69. package/dist/ui/timeline.d.ts +48 -0
  70. package/dist/ui/web-tokens.gen.d.ts +90 -0
  71. package/dist/use-native-session.d.ts +40 -0
  72. package/dist/view-model.d.ts +52 -0
  73. package/dist/voice-input.d.ts +102 -0
  74. package/dist/webrtc.d.ts +9 -0
  75. package/dist/webrtc.js +19 -0
  76. package/dist/webrtc.js.map +1 -0
  77. package/expo-module.config.json +7 -0
  78. package/ios/OpenGeniCall.podspec +22 -0
  79. package/ios/OpenGeniCallAppDelegateSubscriber.swift +29 -0
  80. package/ios/OpenGeniCallCenter.swift +189 -0
  81. package/ios/OpenGeniCallModule.swift +64 -0
  82. package/package.json +93 -0
  83. package/src/adapters.ts +150 -0
  84. package/src/attachments.ts +396 -0
  85. package/src/environment.tsx +214 -0
  86. package/src/expo.ts +295 -0
  87. package/src/index.ts +98 -0
  88. package/src/presentation.ts +285 -0
  89. package/src/read-acknowledgement.ts +72 -0
  90. package/src/realtime/call-events.ts +41 -0
  91. package/src/realtime/call-view.tsx +220 -0
  92. package/src/realtime/expo-call.ts +49 -0
  93. package/src/realtime/native-call.ts +266 -0
  94. package/src/realtime/native-realtime.ts +115 -0
  95. package/src/realtime/use-native-session-realtime.ts +29 -0
  96. package/src/session-view.tsx +2251 -0
  97. package/src/timeline/activity.tsx +736 -0
  98. package/src/timeline/composer.tsx +686 -0
  99. package/src/timeline/controls.tsx +151 -0
  100. package/src/timeline/decisions.tsx +651 -0
  101. package/src/timeline/feedback.tsx +251 -0
  102. package/src/timeline/icon-nodes.generated.ts +1830 -0
  103. package/src/timeline/icon.tsx +44 -0
  104. package/src/timeline/index.ts +67 -0
  105. package/src/timeline/markdown.tsx +510 -0
  106. package/src/timeline/message-attachments.tsx +155 -0
  107. package/src/timeline/message-timeline.tsx +1042 -0
  108. package/src/timeline/model-picker.tsx +450 -0
  109. package/src/timeline/primitives.tsx +561 -0
  110. package/src/timeline/queue-dock.tsx +331 -0
  111. package/src/timeline/session-actions.tsx +379 -0
  112. package/src/timeline/session-list.tsx +338 -0
  113. package/src/timeline/session-screen.tsx +488 -0
  114. package/src/timeline/session-signals.tsx +312 -0
  115. package/src/timeline/sheet.tsx +153 -0
  116. package/src/timeline/theme.tsx +128 -0
  117. package/src/timeline/thinking-orb.tsx +93 -0
  118. package/src/timeline/turn.tsx +569 -0
  119. package/src/ui/attention.tsx +220 -0
  120. package/src/ui/cards.tsx +267 -0
  121. package/src/ui/composer.tsx +296 -0
  122. package/src/ui/format.ts +86 -0
  123. package/src/ui/icons.tsx +131 -0
  124. package/src/ui/index.ts +18 -0
  125. package/src/ui/steps-sheet.tsx +71 -0
  126. package/src/ui/theme.ts +261 -0
  127. package/src/ui/timeline.tsx +837 -0
  128. package/src/ui/web-tokens.gen.ts +94 -0
  129. package/src/use-native-session.ts +219 -0
  130. package/src/view-model.ts +485 -0
  131. package/src/voice-input.ts +382 -0
  132. package/src/webrtc.ts +30 -0
@@ -0,0 +1,94 @@
1
+ // GENERATED by scripts/generate-native-tokens.ts from the web stylesheet. Do not edit.
2
+ // Regenerate after changing packages/react/styles/tokens.css.
3
+ export const webColorsLight = {
4
+ "accent": "rgb(84, 84, 84)",
5
+ "accent-deep": "rgb(56, 56, 56)",
6
+ "accent-fg": "rgb(255, 255, 255)",
7
+ "accent-soft": "rgba(82, 82, 82, 0.110)",
8
+ "accent-strong": "rgb(56, 56, 56)",
9
+ "bg": "rgb(246, 246, 246)",
10
+ "border": "rgb(222, 222, 222)",
11
+ "border-strong": "rgb(189, 189, 189)",
12
+ "canvas": "rgb(255, 255, 255)",
13
+ "danger": "rgb(194, 21, 47)",
14
+ "danger-fg": "rgb(255, 255, 255)",
15
+ "danger-fill": "rgb(183, 22, 45)",
16
+ "diff-add-bg": "rgba(33, 115, 90, 0.122)",
17
+ "diff-del-bg": "rgba(181, 25, 41, 0.122)",
18
+ "fg": "rgb(36, 36, 36)",
19
+ "fg-label": "rgb(58, 58, 58)",
20
+ "fg-muted": "rgb(95, 95, 95)",
21
+ "fg-subtle": "rgb(105, 105, 105)",
22
+ "hover": "rgba(34, 34, 34, 0.059)",
23
+ "primary": "rgb(235, 242, 240)",
24
+ "primary-border": "rgb(196, 213, 208)",
25
+ "primary-fg": "rgb(41, 41, 41)",
26
+ "primary-hover": "rgb(206, 212, 210)",
27
+ "selection": "rgb(226, 226, 226)",
28
+ "status-cancelled": "rgb(105, 105, 105)",
29
+ "status-failed": "rgb(183, 22, 45)",
30
+ "status-idle": "rgb(35, 112, 88)",
31
+ "status-queued": "rgb(105, 105, 105)",
32
+ "status-running": "rgb(113, 97, 34)",
33
+ "status-waiting": "rgb(140, 85, 36)",
34
+ "surface-1": "rgb(255, 255, 255)",
35
+ "surface-2": "rgb(238, 238, 238)",
36
+ "surface-3": "rgb(229, 229, 229)",
37
+ "switch-thumb": "rgb(255, 255, 255)",
38
+ "switch-track": "rgb(189, 189, 189)"
39
+ } as const;
40
+
41
+ export const webColorsDark = {
42
+ "accent": "rgb(196, 196, 196)",
43
+ "accent-deep": "rgb(213, 213, 213)",
44
+ "accent-fg": "rgb(36, 36, 36)",
45
+ "accent-soft": "rgba(199, 199, 199, 0.161)",
46
+ "accent-strong": "rgb(220, 220, 220)",
47
+ "bg": "rgb(48, 48, 48)",
48
+ "border": "rgb(69, 69, 69)",
49
+ "border-strong": "rgb(85, 85, 85)",
50
+ "canvas": "rgb(32, 32, 32)",
51
+ "danger": "rgb(249, 142, 139)",
52
+ "danger-fg": "rgb(255, 255, 255)",
53
+ "danger-fill": "rgb(179, 54, 61)",
54
+ "diff-add-bg": "rgba(128, 205, 177, 0.141)",
55
+ "diff-del-bg": "rgba(248, 149, 142, 0.141)",
56
+ "fg": "rgb(230, 230, 230)",
57
+ "fg-label": "rgb(212, 212, 212)",
58
+ "fg-muted": "rgb(184, 184, 184)",
59
+ "fg-subtle": "rgb(163, 163, 163)",
60
+ "hover": "rgba(230, 230, 230, 0.078)",
61
+ "primary": "rgb(43, 52, 50)",
62
+ "primary-border": "rgb(78, 94, 89)",
63
+ "primary-fg": "rgb(238, 238, 238)",
64
+ "primary-hover": "rgb(72, 80, 78)",
65
+ "selection": "rgb(72, 72, 72)",
66
+ "status-cancelled": "rgb(163, 163, 163)",
67
+ "status-failed": "rgb(247, 148, 145)",
68
+ "status-idle": "rgb(131, 203, 176)",
69
+ "status-queued": "rgb(163, 163, 163)",
70
+ "status-running": "rgb(213, 189, 114)",
71
+ "status-waiting": "rgb(233, 171, 119)",
72
+ "surface-1": "rgb(51, 51, 51)",
73
+ "surface-2": "rgb(56, 56, 56)",
74
+ "surface-3": "rgb(64, 64, 64)",
75
+ "switch-thumb": "rgb(163, 163, 163)",
76
+ "switch-track": "rgb(69, 69, 69)"
77
+ } as const;
78
+
79
+ export const webLengths = {
80
+ "font-size-base": 13,
81
+ "font-size-composer": 16,
82
+ "font-size-composer-wide": 15,
83
+ "font-size-control": 12,
84
+ "font-size-md": 15,
85
+ "font-size-menu": 14,
86
+ "font-size-sm": 12,
87
+ "font-size-xs": 11,
88
+ "radius-full": 9999,
89
+ "radius-lg": 14,
90
+ "radius-md": 10,
91
+ "radius-sm": 6,
92
+ "radius-xl": 20,
93
+ "radius-xs": 4
94
+ } as const;
@@ -0,0 +1,219 @@
1
+ import { useCallback, useMemo } from "react";
2
+ import type { SessionEvent, SessionStatus } from "@opengeni/sdk";
3
+ import {
4
+ groupTimeline,
5
+ projectPendingApprovals,
6
+ useComposer,
7
+ useGoal,
8
+ useHumanInputRequests,
9
+ useSession,
10
+ useSessionControl,
11
+ useSessionEvents,
12
+ useSessionLineage,
13
+ useSessionMcpApprovalPolicy,
14
+ useTurnQueue,
15
+ type FileAttachmentClientLike,
16
+ type GoalClientLike,
17
+ type HumanInputSessionClientLike,
18
+ type PendingApproval,
19
+ type SessionClientLike,
20
+ type SessionMcpApprovalPolicyClientLike,
21
+ type SessionLineageClientLike,
22
+ type SessionReadClientLike,
23
+ type TimelineGroup,
24
+ type TimelineItem,
25
+ } from "@opengeni/react/session";
26
+ import { useNativeFileAttachments, type NativeFileAttachmentsResult } from "./attachments";
27
+ import { useOpenGeniReactNativeEnvironment } from "./environment";
28
+ import {
29
+ useNativeReadAcknowledgement,
30
+ type SessionAttentionClientLike,
31
+ } from "./read-acknowledgement";
32
+
33
+ export type OpenGeniNativeSessionClient = SessionClientLike &
34
+ SessionReadClientLike &
35
+ HumanInputSessionClientLike &
36
+ SessionMcpApprovalPolicyClientLike &
37
+ FileAttachmentClientLike &
38
+ SessionAttentionClientLike &
39
+ GoalClientLike &
40
+ SessionLineageClientLike;
41
+
42
+ export interface OpenGeniNativeSessionController {
43
+ sessionId: string;
44
+ workspaceId: string;
45
+ session: ReturnType<typeof useSession>;
46
+ events: SessionEvent[];
47
+ timeline: TimelineItem[];
48
+ timelineGroups: TimelineGroup[];
49
+ connectionState: ReturnType<typeof useSessionEvents>["connectionState"];
50
+ sessionStatus: SessionStatus | null;
51
+ initialLoading: boolean;
52
+ hasOlder: boolean;
53
+ loadingOlder: boolean;
54
+ loadOlder(): Promise<boolean>;
55
+ queue: ReturnType<typeof useTurnQueue>;
56
+ composer: ReturnType<typeof useComposer>;
57
+ attachments: NativeFileAttachmentsResult;
58
+ approvals: PendingApproval[];
59
+ control: ReturnType<typeof useSessionControl>;
60
+ humanInput: ReturnType<typeof useHumanInputRequests>;
61
+ mcpApprovalPolicy: ReturnType<typeof useSessionMcpApprovalPolicy>;
62
+ /** The session goal and its pause/resume control (web session chrome). */
63
+ goal: ReturnType<typeof useGoal>;
64
+ /** Spawned sub-agent sessions, refreshed by spawn and completion events. */
65
+ lineage: ReturnType<typeof useSessionLineage>;
66
+ active: boolean;
67
+ runActive: boolean;
68
+ error: Error | null;
69
+ refresh(): Promise<void>;
70
+ }
71
+
72
+ function sessionRunActive(status: SessionStatus | null): boolean {
73
+ return (
74
+ status === "queued" ||
75
+ status === "running" ||
76
+ status === "recovering" ||
77
+ status === "waiting_capacity" ||
78
+ status === "requires_action"
79
+ );
80
+ }
81
+
82
+ export function useOpenGeniNativeSession(input: {
83
+ client: OpenGeniNativeSessionClient;
84
+ workspaceId: string;
85
+ sessionId: string;
86
+ mcpApprovalPolicyServerId?: string;
87
+ }): OpenGeniNativeSessionController {
88
+ const environment = useOpenGeniReactNativeEnvironment();
89
+ const events = useSessionEvents(input.sessionId, {
90
+ client: input.client,
91
+ workspaceId: input.workspaceId,
92
+ enabled: environment.active,
93
+ });
94
+ const session = useSession(input.sessionId, {
95
+ client: input.client,
96
+ workspaceId: input.workspaceId,
97
+ enabled: environment.active,
98
+ events: events.events,
99
+ });
100
+ const queue = useTurnQueue(input.sessionId, {
101
+ client: input.client,
102
+ workspaceId: input.workspaceId,
103
+ enabled: environment.active,
104
+ events: events.events,
105
+ });
106
+ const attachments = useNativeFileAttachments({
107
+ client: input.client,
108
+ workspaceId: input.workspaceId,
109
+ sessionId: input.sessionId,
110
+ files: environment.adapters.files,
111
+ crypto: environment.adapters.crypto,
112
+ });
113
+ const composer = useComposer(input.sessionId, {
114
+ client: input.client,
115
+ workspaceId: input.workspaceId,
116
+ events: events.events,
117
+ effectiveControl: queue.effectiveControl,
118
+ // As on web: while a turn runs or prompts wait, a Send shows in the queue
119
+ // at once instead of flashing as a chat bubble before it is queued.
120
+ sendDestination: () =>
121
+ (session.session?.activeTurnId ?? null) !== null || queue.queue.length > 0 ? "queue" : "chat",
122
+ sendExtras: () => ({ resources: attachments.readyResources }),
123
+ sendBlocked: () => attachments.hasUnresolved,
124
+ onSent: () => attachments.clear(),
125
+ });
126
+ const control = useSessionControl(input.sessionId, {
127
+ client: input.client,
128
+ workspaceId: input.workspaceId,
129
+ });
130
+ const humanInput = useHumanInputRequests(input.sessionId, {
131
+ client: input.client,
132
+ workspaceId: input.workspaceId,
133
+ enabled: environment.active,
134
+ events: events.events,
135
+ });
136
+ const goal = useGoal(input.sessionId, {
137
+ client: input.client,
138
+ workspaceId: input.workspaceId,
139
+ enabled: environment.active,
140
+ events: events.events,
141
+ });
142
+ // As on web: events refresh on spawn and completion; the poll catches a
143
+ // child's own status changes, which emit nothing on this feed.
144
+ const lineage = useSessionLineage(input.sessionId, {
145
+ client: input.client,
146
+ workspaceId: input.workspaceId,
147
+ enabled: environment.active,
148
+ events: events.events,
149
+ pollIntervalMs: 30_000,
150
+ });
151
+ const approvals = useMemo(() => projectPendingApprovals(events.events), [events.events]);
152
+ const timelineGroups = useMemo(() => groupTimeline(events.timeline), [events.timeline]);
153
+ useNativeReadAcknowledgement({
154
+ client: input.client,
155
+ workspaceId: input.workspaceId,
156
+ sessionId: input.sessionId,
157
+ session: session.session ?? null,
158
+ events: events.events,
159
+ active: environment.active,
160
+ });
161
+ const mcpApprovalPolicy = useSessionMcpApprovalPolicy(
162
+ input.sessionId,
163
+ input.mcpApprovalPolicyServerId,
164
+ {
165
+ client: input.client,
166
+ workspaceId: input.workspaceId,
167
+ events: events.events,
168
+ enabled: environment.active && Boolean(input.mcpApprovalPolicyServerId),
169
+ },
170
+ );
171
+
172
+ const refresh = useCallback(async () => {
173
+ await Promise.all([
174
+ session.refresh(),
175
+ queue.refresh(),
176
+ humanInput.refresh(),
177
+ events.jumpToLatest(),
178
+ mcpApprovalPolicy.refresh(),
179
+ ]);
180
+ }, [events, humanInput, mcpApprovalPolicy, queue, session]);
181
+
182
+ return {
183
+ sessionId: input.sessionId,
184
+ workspaceId: input.workspaceId,
185
+ session,
186
+ events: events.events,
187
+ timeline: events.timeline,
188
+ timelineGroups,
189
+ connectionState: events.connectionState,
190
+ sessionStatus: events.sessionStatus ?? session.session?.status ?? null,
191
+ initialLoading: events.initialLoading || session.loading,
192
+ hasOlder: events.hasOlder,
193
+ loadingOlder: events.loadingOlder,
194
+ loadOlder: events.loadOlder,
195
+ queue,
196
+ composer,
197
+ attachments,
198
+ approvals,
199
+ control,
200
+ humanInput,
201
+ mcpApprovalPolicy,
202
+ goal,
203
+ lineage,
204
+ active: environment.active,
205
+ runActive: sessionRunActive(events.sessionStatus ?? session.session?.status ?? null),
206
+ error:
207
+ events.error ??
208
+ session.error ??
209
+ queue.error ??
210
+ queue.mutationError ??
211
+ composer.error ??
212
+ composer.draftConflict ??
213
+ control.error ??
214
+ humanInput.error ??
215
+ humanInput.mutationError ??
216
+ mcpApprovalPolicy.error,
217
+ refresh,
218
+ };
219
+ }