reflex-agent 0.10.0 → 0.13.2

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 (192) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +161 -134
  3. package/.next/app-path-routes-manifest.json +10 -9
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +7 -7
  6. package/.next/react-loadable-manifest.json +1 -1
  7. package/.next/routes-manifest.json +8 -0
  8. package/.next/server/app/_not-found/page.js +2 -2
  9. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  10. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/agents/[agentId]/page.js +2 -2
  12. package/.next/server/app/agents/[agentId]/page.js.nft.json +1 -1
  13. package/.next/server/app/agents/[agentId]/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/agents/[agentId]/respond/route.js +1 -1
  15. package/.next/server/app/api/agents/[agentId]/respond/route.js.nft.json +1 -1
  16. package/.next/server/app/api/agents/[agentId]/respond/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/images/[rootId]/[file]/route_client-reference-manifest.js +1 -1
  18. package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/oauth/start/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/roots/[id]/attachments/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js +1 -1
  22. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js.nft.json +1 -1
  23. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js +1 -1
  25. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js.nft.json +1 -1
  26. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js +2 -2
  28. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js.nft.json +1 -1
  29. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/roots/[id]/dashboard/route.js +1 -1
  31. package/.next/server/app/api/roots/[id]/dashboard/route.js.nft.json +1 -1
  32. package/.next/server/app/api/roots/[id]/dashboard/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/roots/[id]/suggestions/route.js +1 -1
  34. package/.next/server/app/api/roots/[id]/suggestions/route.js.nft.json +1 -1
  35. package/.next/server/app/api/roots/[id]/suggestions/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/utilities/[scope]/[id]/bundle.js/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/utilities/[scope]/[id]/host/route.js +1 -1
  38. package/.next/server/app/api/utilities/[scope]/[id]/host/route.js.nft.json +1 -1
  39. package/.next/server/app/api/utilities/[scope]/[id]/host/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/utilities/[scope]/[id]/host-api.mjs/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/utilities/[scope]/[id]/host-ui.mjs/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/utilities/[scope]/[id]/iframe/route.js +4 -4
  43. package/.next/server/app/api/utilities/[scope]/[id]/iframe/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/utilities/[scope]/[id]/style.css/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/audit/page.js +2 -2
  46. package/.next/server/app/audit/page.js.nft.json +1 -1
  47. package/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  48. package/.next/server/app/onboarding/page.js +3 -3
  49. package/.next/server/app/onboarding/page.js.nft.json +1 -1
  50. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  51. package/.next/server/app/page.js +2 -2
  52. package/.next/server/app/page.js.nft.json +1 -1
  53. package/.next/server/app/page_client-reference-manifest.js +1 -1
  54. package/.next/server/app/roots/[id]/chat/[topicId]/page.js +2 -2
  55. package/.next/server/app/roots/[id]/chat/[topicId]/page.js.nft.json +1 -1
  56. package/.next/server/app/roots/[id]/chat/[topicId]/page_client-reference-manifest.js +1 -1
  57. package/.next/server/app/roots/[id]/kb/[...slug]/page.js +2 -2
  58. package/.next/server/app/roots/[id]/kb/[...slug]/page.js.nft.json +1 -1
  59. package/.next/server/app/roots/[id]/kb/[...slug]/page_client-reference-manifest.js +1 -1
  60. package/.next/server/app/roots/[id]/memory/page.js +2 -0
  61. package/.next/server/app/roots/[id]/memory/page.js.nft.json +1 -0
  62. package/.next/server/app/roots/[id]/memory/page_client-reference-manifest.js +1 -0
  63. package/.next/server/app/roots/[id]/page.js +4 -4
  64. package/.next/server/app/roots/[id]/page.js.nft.json +1 -1
  65. package/.next/server/app/roots/[id]/page_client-reference-manifest.js +1 -1
  66. package/.next/server/app/roots/[id]/workflows/[wfId]/page.js +2 -2
  67. package/.next/server/app/roots/[id]/workflows/[wfId]/page.js.nft.json +1 -1
  68. package/.next/server/app/roots/[id]/workflows/[wfId]/page_client-reference-manifest.js +1 -1
  69. package/.next/server/app/roots/[id]/workflows/page.js +2 -2
  70. package/.next/server/app/roots/[id]/workflows/page.js.nft.json +1 -1
  71. package/.next/server/app/roots/[id]/workflows/page_client-reference-manifest.js +1 -1
  72. package/.next/server/app/roots/new/page.js +3 -3
  73. package/.next/server/app/roots/new/page.js.nft.json +1 -1
  74. package/.next/server/app/roots/new/page_client-reference-manifest.js +1 -1
  75. package/.next/server/app/settings/page.js +5 -5
  76. package/.next/server/app/settings/page.js.nft.json +1 -1
  77. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  78. package/.next/server/app/share/[id]/file/page.js +2 -2
  79. package/.next/server/app/share/[id]/file/page.js.nft.json +1 -1
  80. package/.next/server/app/share/[id]/file/page_client-reference-manifest.js +1 -1
  81. package/.next/server/app/share/[id]/page.js +2 -2
  82. package/.next/server/app/share/[id]/page.js.nft.json +1 -1
  83. package/.next/server/app/share/[id]/page_client-reference-manifest.js +1 -1
  84. package/.next/server/app/utilities/[scope]/[id]/page.js +2 -2
  85. package/.next/server/app/utilities/[scope]/[id]/page.js.nft.json +1 -1
  86. package/.next/server/app/utilities/[scope]/[id]/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app/utilities/page.js +2 -2
  88. package/.next/server/app/utilities/page.js.nft.json +1 -1
  89. package/.next/server/app/utilities/page_client-reference-manifest.js +1 -1
  90. package/.next/server/app-paths-manifest.json +10 -9
  91. package/.next/server/chunks/1105.js +1 -1
  92. package/.next/server/chunks/1116.js +1 -0
  93. package/.next/server/chunks/1244.js +1 -1
  94. package/.next/server/chunks/1358.js +1 -1
  95. package/.next/server/chunks/2455.js +4 -0
  96. package/.next/server/chunks/2485.js +51 -2
  97. package/.next/server/chunks/2552.js +1 -1
  98. package/.next/server/chunks/269.js +1 -0
  99. package/.next/server/chunks/285.js +67 -16
  100. package/.next/server/chunks/3240.js +1 -1
  101. package/.next/server/chunks/3332.js +1 -1
  102. package/.next/server/chunks/4031.js +46 -2
  103. package/.next/server/chunks/{5470.js → 4460.js} +3 -3
  104. package/.next/server/chunks/4812.js +2 -2
  105. package/.next/server/chunks/4925.js +1 -1
  106. package/.next/server/chunks/5082.js +1 -0
  107. package/.next/server/chunks/5172.js +1 -0
  108. package/.next/server/chunks/569.js +1 -1
  109. package/.next/server/chunks/6880.js +3 -0
  110. package/.next/server/chunks/7188.js +1 -1
  111. package/.next/server/chunks/7220.js +1 -1
  112. package/.next/server/chunks/7358.js +13 -12
  113. package/.next/server/chunks/9098.js +1 -1
  114. package/.next/server/chunks/9157.js +1 -0
  115. package/.next/server/chunks/9809.js +1 -1
  116. package/.next/server/middleware-build-manifest.js +1 -1
  117. package/.next/server/middleware-manifest.json +5 -5
  118. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  119. package/.next/server/pages/500.html +1 -1
  120. package/.next/server/server-reference-manifest.js +1 -1
  121. package/.next/server/server-reference-manifest.json +1 -1
  122. package/.next/static/chunks/124-15fc36c432df3dbf.js +1 -0
  123. package/.next/static/chunks/{3954-fe27ff41d9bf012d.js → 2038-0849f9c03cc8d6ab.js} +1 -1
  124. package/.next/static/chunks/2084-7233d5537043daca.js +1 -0
  125. package/.next/static/chunks/4108.dc018213e45cb33d.js +1 -0
  126. package/.next/static/chunks/4678-15402b9832b27389.js +1 -0
  127. package/.next/static/chunks/4728-bc5cf7af49fca773.js +1 -0
  128. package/.next/static/chunks/{5235-990ba9c4c8446446.js → 6231-d572db56a0a44f92.js} +2 -2
  129. package/.next/static/chunks/6785-9a72b10489bc9c60.js +1 -0
  130. package/.next/static/chunks/951-5ff2aaad965fedb7.js +1 -0
  131. package/.next/static/chunks/{5097-f07f6aeee3f60a33.js → 9776-e3882c1c63293e0a.js} +1 -1
  132. package/.next/static/chunks/9813-b766d258f203cf47.js +1 -0
  133. package/.next/static/chunks/9819-9c9fce1bc9bfd112.js +1 -0
  134. package/.next/static/chunks/app/agents/[agentId]/{page-5d6f4cb16b42d02b.js → page-2ee5d78dc94253c5.js} +1 -1
  135. package/.next/static/chunks/app/audit/page-9bac9e3674f0fae9.js +1 -0
  136. package/.next/static/chunks/app/layout-2a915770c355308f.js +1 -0
  137. package/.next/static/chunks/app/onboarding/page-863f1b600bf234e0.js +1 -0
  138. package/.next/static/chunks/app/page-13508f16cf38f321.js +1 -0
  139. package/.next/static/chunks/app/roots/[id]/chat/[topicId]/page-3be786d8da8f76d5.js +1 -0
  140. package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-46920cb7c416ea8a.js +1 -0
  141. package/.next/static/chunks/app/roots/[id]/memory/page-8391c646562e05f2.js +1 -0
  142. package/.next/static/chunks/app/roots/[id]/page-22fd50b40a9d7da1.js +1 -0
  143. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-7efe470b18d48df2.js +1 -0
  144. package/.next/static/chunks/app/roots/[id]/workflows/page-8783e266b597fb1a.js +1 -0
  145. package/.next/static/chunks/app/roots/new/page-f3fc15595bc31190.js +1 -0
  146. package/.next/static/chunks/app/settings/page-ef1f77cbd60deaa7.js +1 -0
  147. package/.next/static/chunks/app/share/[id]/page-517af2077ca1619b.js +1 -0
  148. package/.next/static/chunks/app/utilities/[scope]/[id]/page-cd2a7884a45d7e3d.js +1 -0
  149. package/.next/static/chunks/app/utilities/page-d6d31ca1ba920ef9.js +1 -0
  150. package/.next/static/chunks/{webpack-ab6092bb760ab431.js → webpack-96a46ed6f170dc97.js} +1 -1
  151. package/.next/static/css/6144318015aa8092.css +1 -0
  152. package/.next/trace +90 -89
  153. package/.next/types/app/roots/[id]/memory/page.ts +84 -0
  154. package/.next/types/routes.d.ts +2 -1
  155. package/.next/types/validator.ts +9 -0
  156. package/README.md +147 -32
  157. package/dist/lib/reflex/agents/prompts.js +25 -0
  158. package/dist/lib/reflex/agents/prompts.js.map +1 -1
  159. package/dist/lib/reflex/prompts/defaults.js +2 -1
  160. package/dist/lib/reflex/prompts/defaults.js.map +1 -1
  161. package/package.json +1 -1
  162. package/.next/server/chunks/1198.js +0 -1
  163. package/.next/server/chunks/2722.js +0 -1
  164. package/.next/server/chunks/5090.js +0 -1
  165. package/.next/server/chunks/5934.js +0 -1
  166. package/.next/server/chunks/6622.js +0 -3
  167. package/.next/server/chunks/9333.js +0 -4
  168. package/.next/static/chunks/1166-5f91e07573aba5c2.js +0 -1
  169. package/.next/static/chunks/1217-407174d9b164a499.js +0 -1
  170. package/.next/static/chunks/1316-fbbc7e5231784e28.js +0 -1
  171. package/.next/static/chunks/1520-eeab8b7f39ffea7b.js +0 -1
  172. package/.next/static/chunks/4108.5478f85adbbd1337.js +0 -1
  173. package/.next/static/chunks/5779-5be906c67d9d3c80.js +0 -1
  174. package/.next/static/chunks/6445-99824866a51b582a.js +0 -1
  175. package/.next/static/chunks/6594-fcdf71ca82322736.js +0 -1
  176. package/.next/static/chunks/app/audit/page-e3445076d462aa80.js +0 -1
  177. package/.next/static/chunks/app/layout-5e299e9b79abfedf.js +0 -1
  178. package/.next/static/chunks/app/onboarding/page-1cde2db95ed14b64.js +0 -1
  179. package/.next/static/chunks/app/page-1ea9bd7d8a2c7e0d.js +0 -1
  180. package/.next/static/chunks/app/roots/[id]/chat/[topicId]/page-5e805f15e4b1cdf6.js +0 -1
  181. package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-9424547b67be2a76.js +0 -1
  182. package/.next/static/chunks/app/roots/[id]/page-c3140c542b7fc06d.js +0 -1
  183. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-4da7b5a46cbaf70c.js +0 -1
  184. package/.next/static/chunks/app/roots/[id]/workflows/page-e3445076d462aa80.js +0 -1
  185. package/.next/static/chunks/app/roots/new/page-ed360b415bf7fe38.js +0 -1
  186. package/.next/static/chunks/app/settings/page-27ef527431277f6b.js +0 -1
  187. package/.next/static/chunks/app/share/[id]/page-70b32c2d1c5819a4.js +0 -1
  188. package/.next/static/chunks/app/utilities/[scope]/[id]/page-3f219cbd957603ef.js +0 -1
  189. package/.next/static/chunks/app/utilities/page-5f8903782a48ebac.js +0 -1
  190. package/.next/static/css/2bc00775af31f40f.css +0 -1
  191. /package/.next/static/{l_M5u154jKhXKvK6-kjlW → 14BmONHeyoAOMNd2xJOGC}/_buildManifest.js +0 -0
  192. /package/.next/static/{l_M5u154jKhXKvK6-kjlW → 14BmONHeyoAOMNd2xJOGC}/_ssgManifest.js +0 -0
@@ -0,0 +1,84 @@
1
+ // File: /home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/memory/page.tsx
2
+ import * as entry from '../../../../../../app/roots/[id]/memory/page.js'
3
+ import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'
4
+
5
+ type TEntry = typeof import('../../../../../../app/roots/[id]/memory/page.js')
6
+
7
+ type SegmentParams<T extends Object = any> = T extends Record<string, any>
8
+ ? { [K in keyof T]: T[K] extends string ? string | string[] | undefined : never }
9
+ : T
10
+
11
+ // Check that the entry is a valid entry
12
+ checkFields<Diff<{
13
+ default: Function
14
+ config?: {}
15
+ generateStaticParams?: Function
16
+ revalidate?: RevalidateRange<TEntry> | false
17
+ dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
18
+ dynamicParams?: boolean
19
+ fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache'
20
+ preferredRegion?: 'auto' | 'global' | 'home' | string | string[]
21
+ runtime?: 'nodejs' | 'experimental-edge' | 'edge'
22
+ maxDuration?: number
23
+
24
+ metadata?: any
25
+ generateMetadata?: Function
26
+ viewport?: any
27
+ generateViewport?: Function
28
+ experimental_ppr?: boolean
29
+
30
+ }, TEntry, ''>>()
31
+
32
+
33
+ // Check the prop type of the entry function
34
+ checkFields<Diff<PageProps, FirstArg<TEntry['default']>, 'default'>>()
35
+
36
+ // Check the arguments and return type of the generateMetadata function
37
+ if ('generateMetadata' in entry) {
38
+ checkFields<Diff<PageProps, FirstArg<MaybeField<TEntry, 'generateMetadata'>>, 'generateMetadata'>>()
39
+ checkFields<Diff<ResolvingMetadata, SecondArg<MaybeField<TEntry, 'generateMetadata'>>, 'generateMetadata'>>()
40
+ }
41
+
42
+ // Check the arguments and return type of the generateViewport function
43
+ if ('generateViewport' in entry) {
44
+ checkFields<Diff<PageProps, FirstArg<MaybeField<TEntry, 'generateViewport'>>, 'generateViewport'>>()
45
+ checkFields<Diff<ResolvingViewport, SecondArg<MaybeField<TEntry, 'generateViewport'>>, 'generateViewport'>>()
46
+ }
47
+
48
+ // Check the arguments and return type of the generateStaticParams function
49
+ if ('generateStaticParams' in entry) {
50
+ checkFields<Diff<{ params: SegmentParams }, FirstArg<MaybeField<TEntry, 'generateStaticParams'>>, 'generateStaticParams'>>()
51
+ checkFields<Diff<{ __tag__: 'generateStaticParams', __return_type__: any[] | Promise<any[]> }, { __tag__: 'generateStaticParams', __return_type__: ReturnType<MaybeField<TEntry, 'generateStaticParams'>> }>>()
52
+ }
53
+
54
+ export interface PageProps {
55
+ params?: Promise<SegmentParams>
56
+ searchParams?: Promise<any>
57
+ }
58
+ export interface LayoutProps {
59
+ children?: React.ReactNode
60
+
61
+ params?: Promise<SegmentParams>
62
+ }
63
+
64
+ // =============
65
+ // Utility types
66
+ type RevalidateRange<T> = T extends { revalidate: any } ? NonNegative<T['revalidate']> : never
67
+
68
+ // If T is unknown or any, it will be an empty {} type. Otherwise, it will be the same as Omit<T, keyof Base>.
69
+ type OmitWithTag<T, K extends keyof any, _M> = Omit<T, K>
70
+ type Diff<Base, T extends Base, Message extends string = ''> = 0 extends (1 & T) ? {} : OmitWithTag<T, keyof Base, Message>
71
+
72
+ type FirstArg<T extends Function> = T extends (...args: [infer T, any]) => any ? unknown extends T ? any : T : never
73
+ type SecondArg<T extends Function> = T extends (...args: [any, infer T]) => any ? unknown extends T ? any : T : never
74
+ type MaybeField<T, K extends string> = T extends { [k in K]: infer G } ? G extends Function ? G : never : never
75
+
76
+
77
+
78
+ function checkFields<_ extends { [k in keyof any]: never }>() {}
79
+
80
+ // https://github.com/sindresorhus/type-fest
81
+ type Numeric = number | bigint
82
+ type Zero = 0 | 0n
83
+ type Negative<T extends Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never
84
+ type NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : '__invalid_negative_number__'
@@ -1,7 +1,7 @@
1
1
  // This file is generated automatically by Next.js
2
2
  // Do not edit this file manually
3
3
 
4
- type AppRoutes = "/" | "/agents/[agentId]" | "/audit" | "/onboarding" | "/roots/[id]" | "/roots/[id]/chat/[topicId]" | "/roots/[id]/kb/[...slug]" | "/roots/[id]/workflows" | "/roots/[id]/workflows/[wfId]" | "/roots/new" | "/settings" | "/share/[id]" | "/share/[id]/file" | "/utilities" | "/utilities/[scope]/[id]"
4
+ type AppRoutes = "/" | "/agents/[agentId]" | "/audit" | "/onboarding" | "/roots/[id]" | "/roots/[id]/chat/[topicId]" | "/roots/[id]/kb/[...slug]" | "/roots/[id]/memory" | "/roots/[id]/workflows" | "/roots/[id]/workflows/[wfId]" | "/roots/new" | "/settings" | "/share/[id]" | "/share/[id]/file" | "/utilities" | "/utilities/[scope]/[id]"
5
5
  type AppRouteHandlerRoutes = "/api/agents/[agentId]/respond" | "/api/images/[rootId]/[file]" | "/api/oauth/callback" | "/api/oauth/start" | "/api/roots/[id]/attachments" | "/api/roots/[id]/chat/[topicId]/send" | "/api/roots/[id]/chat/[topicId]/stop" | "/api/roots/[id]/chat/[topicId]/stream" | "/api/roots/[id]/dashboard" | "/api/roots/[id]/suggestions" | "/api/utilities/[scope]/[id]/bundle.js" | "/api/utilities/[scope]/[id]/host" | "/api/utilities/[scope]/[id]/host-api.mjs" | "/api/utilities/[scope]/[id]/host-ui.mjs" | "/api/utilities/[scope]/[id]/iframe" | "/api/utilities/[scope]/[id]/style.css"
6
6
  type PageRoutes = never
7
7
  type LayoutRoutes = "/" | "/roots/[id]"
@@ -34,6 +34,7 @@ interface ParamMap {
34
34
  "/roots/[id]": { "id": string; }
35
35
  "/roots/[id]/chat/[topicId]": { "id": string; "topicId": string; }
36
36
  "/roots/[id]/kb/[...slug]": { "id": string; "slug": string[]; }
37
+ "/roots/[id]/memory": { "id": string; }
37
38
  "/roots/[id]/workflows": { "id": string; }
38
39
  "/roots/[id]/workflows/[wfId]": { "id": string; "wfId": string; }
39
40
  "/roots/new": {}
@@ -101,6 +101,15 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
101
101
  type __Unused = __Check
102
102
  }
103
103
 
104
+ // Validate ../../app/roots/[id]/memory/page.tsx
105
+ {
106
+ type __IsExpected<Specific extends AppPageConfig<"/roots/[id]/memory">> = Specific
107
+ const handler = {} as typeof import("../../app/roots/[id]/memory/page.js")
108
+ type __Check = __IsExpected<typeof handler>
109
+ // @ts-ignore
110
+ type __Unused = __Check
111
+ }
112
+
104
113
  // Validate ../../app/roots/[id]/page.tsx
105
114
  {
106
115
  type __IsExpected<Specific extends AppPageConfig<"/roots/[id]">> = Specific
package/README.md CHANGED
@@ -1,36 +1,156 @@
1
1
  # Reflex
2
2
 
3
- Local-first knowledge base. You point Reflex at a directory; an agent (Codex via agent-use or Claude Code in agent mode) walks it and materializes a hierarchical `.reflex/` of Markdown files describing what's there. Background watchers keep it fresh, with a debounce floor (≥ 30 min, configurable) so the agent never runs too often. Per-folder chats let you query the KB the same way you'd query ChatGPT/Codex, but scoped to that subdirectory.
3
+ Local-first AI knowledge base + agent platform. You point Reflex at a
4
+ directory ("a Space"), and an agent (Claude Code or Codex) becomes
5
+ your second brain for that directory: it keeps a knowledge tree, runs
6
+ scheduled workflows, recalls past conversations, and dispatches
7
+ sub-tasks in isolated git worktrees.
8
+
9
+ Everything is stored as plain markdown + JSON in your filesystem. No
10
+ external database, no cloud, no daemon. The only persistent process is
11
+ the Next.js server itself.
4
12
 
5
13
  ## Install
6
14
 
7
15
  Prerequisites:
8
16
 
9
- - **Node.js 20+** ([nodejs.org](https://nodejs.org/) or via `nvm`/`fnm`/`volta`)
10
- - **Codex CLI** authenticated — `npm i -g @openai/codex && codex login`
17
+ - **Node.js 22+** ([nodejs.org](https://nodejs.org/) or `nvm`/`fnm`).
18
+ Node 24 recommended (built-in SQLite powers session search).
19
+ - A coding-agent CLI authenticated:
20
+ - `npm i -g @openai/codex && codex login`, or
21
+ - `npm i -g @anthropic-ai/claude-code && claude login`
11
22
 
12
23
  Install Reflex globally:
13
24
 
14
25
  ```sh
15
26
  npm i -g reflex-agent
16
27
  # or: pnpm add -g reflex-agent
17
- # or: yarn global add reflex-agent
18
28
  ```
19
29
 
20
- Then launch the web UI:
30
+ Launch the web UI:
21
31
 
22
32
  ```sh
23
- reflex start # opens http://localhost:3210 in your browser
33
+ reflex start # opens http://localhost:3210 in your browser
24
34
  reflex start --port 4000 --no-open
25
35
  ```
26
36
 
27
37
  Dev runs on `:3211` by default so a `pnpm dev` and an installed
28
38
  `reflex start` can co-exist without a port collision.
29
39
 
30
- Home page lists registered "Reflex roots". Add a directory via the built-in
31
- file picker, then click **Run init** on the detail page to have the agent
32
- build the KB. The left sidebar shows the resulting MD tree under `.reflex/`;
33
- clicking a file renders it.
40
+ ## First run
41
+
42
+ 1. Click **Add a root** on the home screen and pick a directory.
43
+ 2. On the Space dashboard, the onboarding wizard asks a few short
44
+ questions to seed memory + suggest a first workflow.
45
+ 3. Open a chat — type in plain language. The agent reads / writes the
46
+ `.reflex/` tree, your memory files, and (with permission) shell +
47
+ web tools.
48
+
49
+ ## What Reflex actually does
50
+
51
+ ### A knowledge base per Space
52
+
53
+ The agent builds a tree of markdown notes under `<your-dir>/.reflex/`:
54
+
55
+ ```
56
+ <your-dir>/
57
+ ├── .reflexignore — gitignore-syntax — same rules
58
+ └── .reflex/
59
+ ├── INDEX.md — top-level summary
60
+ ├── kb/ — categorised entries (note, article, diagram, …)
61
+ ├── memory/ — eight files describing the user / project
62
+ ├── topics/ — chat transcripts
63
+ ├── journal/ — daily entries
64
+ ├── workflows/ — saved recipes
65
+ ├── utilities/ — locally-installed extensions
66
+ └── worktrees/ — task-bound git worktrees
67
+ ```
68
+
69
+ See [docs/kb.md](docs/kb.md) and [docs/architecture.md](docs/architecture.md).
70
+
71
+ ### Cross-session memory
72
+
73
+ Eight bounded markdown files capture who the user is and what the
74
+ project is about. Every chat starts with this loaded into the system
75
+ prompt — the agent never re-asks who you are.
76
+
77
+ A weekly system task rolls up journal entries into a `RECENT.md`
78
+ summary. A hygiene scanner refuses memory writes that look like
79
+ prompt injection, credentials, or invisible unicode.
80
+
81
+ See [docs/memory.md](docs/memory.md).
82
+
83
+ ### Searchable conversation history
84
+
85
+ Every journal entry + chat transcript across every Space is indexed
86
+ into a SQLite FTS5 database under `$REFLEX_HOME/sessions.db`. The
87
+ agent (or you, or a utility) can ask "what did we say about X?" with
88
+ ranked snippets returning in milliseconds.
89
+
90
+ See [docs/sessions.md](docs/sessions.md).
91
+
92
+ ### Linear workflows, scheduled
93
+
94
+ The user (or the agent) composes "recipes" from typed steps —
95
+ `web-fetch`, `ask-agent`, `kb-write`, `image-generate`, etc. The
96
+ background scheduler fires triggered ones hourly / daily / weekly.
97
+
98
+ See [docs/workflows.md](docs/workflows.md).
99
+
100
+ ### Installable utilities
101
+
102
+ Mini-apps that bring a UI iframe, server actions, slash commands,
103
+ skills, system-prompt addenda, and workflows. Shipped curated or
104
+ installed from GitHub. Two examples ship by default:
105
+
106
+ - **`learn-anything`** — chat-driven topic learning, materialised into
107
+ the KB.
108
+ - **`task-board`** — Kanban board with agent-dispatch, git worktrees,
109
+ pre/post hooks, auto-pickup.
110
+
111
+ See [docs/utilities.md](docs/utilities.md).
112
+
113
+ ### Agent dispatch via worktrees
114
+
115
+ Code tasks dispatched from the task-board get an isolated git worktree
116
+ on `task/<slug>`, so two parallel agents can work on the same repo
117
+ without stepping on each other. PR mode auto-detects `gh` CLI and
118
+ turns "Merge" into "Open PR".
119
+
120
+ See [docs/tasks.md](docs/tasks.md).
121
+
122
+ ## Architecture at a glance
123
+
124
+ One Node process. Inside it:
125
+
126
+ - Next.js App Router HTTP server (UI + server actions).
127
+ - A background workflow scheduler (in-process singleton).
128
+ - A worker pool for utility server actions.
129
+ - Subprocess agents (Claude Code / Codex) spawned per topic.
130
+ - MCP servers on demand.
131
+
132
+ Two filesystem homes: `REFLEX_HOME` (global state) and
133
+ `<root>/.reflex/` (per-Space).
134
+
135
+ For the full layer diagram and component map see
136
+ [docs/architecture.md](docs/architecture.md).
137
+
138
+ ## Documentation
139
+
140
+ | Doc | Topic |
141
+ |---|---|
142
+ | [docs/architecture.md](docs/architecture.md) | System map, process model, two-homes layout |
143
+ | [docs/memory.md](docs/memory.md) | 8-file taxonomy, caps, hygiene, weekly rollup |
144
+ | [docs/sessions.md](docs/sessions.md) | FTS5 recall over journal + topics |
145
+ | [docs/topics.md](docs/topics.md) | Chat transcripts, event log, `/goal` mode |
146
+ | [docs/kb.md](docs/kb.md) | Knowledge-base entries, kinds, slug rules |
147
+ | [docs/workflows.md](docs/workflows.md) | Step kinds, templates, scheduler, system tasks |
148
+ | [docs/utilities.md](docs/utilities.md) | Extension model, manifest, permissions, iframe + worker |
149
+ | [docs/host-api.md](docs/host-api.md) | Full `reflex.*` method reference |
150
+ | [docs/markers.md](docs/markers.md) | `<<reflex:*>>` protocol reference |
151
+ | [docs/skills.md](docs/skills.md) | Skill files, scopes, marker authoring |
152
+ | [docs/tasks.md](docs/tasks.md) | task-board utility, worktree mechanics, PR mode |
153
+ | [docs/agents.md](docs/agents.md) | Claude Code / Codex App Server integration, permissioning |
34
154
 
35
155
  ## CLI
36
156
 
@@ -41,38 +161,28 @@ reflex watch <dir> # watch dir and refresh KB on changes
41
161
  reflex chat <dir> # open a chat scoped to dir's KB
42
162
  ```
43
163
 
44
- ## Develop from source
45
-
46
- ```sh
47
- pnpm install
48
- pnpm dev # http://localhost:3211 (Next dev server with HMR)
49
- pnpm build # produce dist/ + .next/ for `reflex start`
50
- ```
51
-
52
164
  ## Data directory
53
165
 
54
166
  Reflex stores its global state (registered roots, settings, MCP config,
55
- API keys, skills, …) in a single directory:
167
+ secrets, skills, sessions index, …) in one directory:
56
168
 
57
169
  - **Dev (`pnpm dev`)** → `~/.reflex`
58
170
  - **Prod (`reflex start` via npm-installed CLI)** → `~/.reflex-agent`
59
171
 
60
- Override either by setting `REFLEX_HOME=/your/path` before launching. The
61
- two defaults keep prod and dev experiments isolated.
172
+ Override either by setting `REFLEX_HOME=/your/path` before launching.
62
173
 
63
- ## Layout produced
174
+ ## Develop from source
64
175
 
65
- ```
66
- <your-dir>/
67
- ├── .reflexignore # gitignore-syntax same rules
68
- └── .reflex/
69
- ├── config.json # debounce, agent backend, etc.
70
- ├── INDEX.md # description of the whole dir
71
- └── <subdir>/
72
- ├── INDEX.md # description of this subdir
73
- └── *.md # topic-structured notes
176
+ ```sh
177
+ pnpm install
178
+ pnpm dev # http://localhost:3211 (Next dev server with HMR)
179
+ pnpm build # produce dist/ + .next/ for `reflex start`
180
+ pnpm typecheck
74
181
  ```
75
182
 
183
+ PRs welcome. The codebase favours small, focused modules — when in
184
+ doubt, look at neighbouring files and match the style.
185
+
76
186
  ## Config (`.reflex/config.json`)
77
187
 
78
188
  ```json
@@ -83,4 +193,9 @@ two defaults keep prod and dev experiments isolated.
83
193
  }
84
194
  ```
85
195
 
86
- `watchDebounceMs` defaults to 30 minutes (`1800000`). You can lower it in `.reflex/config.json` if you want a tighter loop; the only enforced minimum is 1 second (anti-thrash).
196
+ `watchDebounceMs` defaults to 30 minutes (`1800000`). Lower it for
197
+ tighter loops; the enforced minimum is 1 second (anti-thrash).
198
+
199
+ ## License
200
+
201
+ MIT.
@@ -41,8 +41,33 @@ export async function chatSystemPrompt(scope) {
41
41
  memoryInstructions(),
42
42
  skillAuthoringInstructions(),
43
43
  taskAuthoringInstructions(),
44
+ appBuildRoutingInstructions(),
44
45
  ].join("\n\n");
45
46
  }
47
+ /**
48
+ * Disambiguation guard for "build me an app / tool / bot / integration"
49
+ * requests. Reflex's flagship output is a *utility* (a mini-app that
50
+ * runs INSIDE Reflex — iframe + Host API, TypeScript, no separate
51
+ * hosting), not a standalone service. The orchestrator otherwise treats
52
+ * such a request as a greenfield project and asks about language /
53
+ * deploy, which is wrong when the user means a utility. This is a
54
+ * runtime block (not the editable chat.md) so the routing stays correct
55
+ * regardless of local prompt edits.
56
+ */
57
+ function appBuildRoutingInstructions() {
58
+ return [
59
+ "## Building an app / tool / integration — utility first",
60
+ "",
61
+ "When the user asks to build, make, or release an app, tool, bot, integration, dashboard, form, or service, FIRST decide what KIND of thing it is — before asking about language, framework, or hosting:",
62
+ "",
63
+ "- **Reflex utility** (the default for anything that extends Reflex or lives in this ecosystem) — a mini-app that runs INSIDE Reflex: a React/TypeScript `ui.tsx` in an iframe, talking to the world only through the Host API (`reflex.*`) with manifest permissions. There is NO separate backend to host and NO deploy step — installing the utility IS the deploy. Utilities are ALWAYS TypeScript, so never ask \"which language?\".",
64
+ "- **Standalone project** — a normal codebase the user will run/host themselves (a server, a CLI, a website). Only here do language/framework/deploy questions make sense.",
65
+ "",
66
+ "Routing signals that mean **utility**: the project name starts with `rflx-`/`reflex-`, it lives under a `reflex-*` parent, the user says \"utility\"/\"mini-app\"/\"плагин\"/\"виджет\", or the thing is meant to surface inside Reflex (a panel, a card, a GitHub/Calendar/etc. integration the user will open in the Mini-apps screen).",
67
+ "",
68
+ "If those signals are present, proceed as a utility — gather the missing essentials (what it does, which data/permissions, any secrets) and emit `<<reflex:utility>>`. Do NOT ask about stack or deployment. If it's genuinely unclear which kind it is, ask THAT question first via `<<reflex:question>>` (\"Reflex utility that runs inside Reflex, or a standalone app you'll host yourself?\") — don't jump to language selection.",
69
+ ].join("\n");
70
+ }
46
71
  /**
47
72
  * Inline image generation via `<<reflex:image-gen>>`. Reflex calls
48
73
  * Gemini Nano Banana (or Codex `$imagegen`) post-turn, saves the bytes
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../lib/reflex/agents/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAEnC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAmB;IACrD,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC;IAC/D,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;IACpD,MAAM,QAAQ,GACZ,KAAK,CAAC,KA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gI;QAChI,sLAAsL;QACtL,gKAAgK;QAChK,+IAA+I;QAC/I,gFAAgF;QAChF,qFAAqF;QACrF,EAAE;QACF,aAAa;QACb,EAAE;QACF,gNAAgN;QAChN,EAAE;QACF,0lBAA0lB;QAC1lB,EAAE;QACF,sHAAsH;KACvH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,SAAS,yBAAyB;IAChC,OAAO;QACL,4CAA4C;QAC5C,EAAE;QACF,6ZAA6Z;QAC7Z,EAAE;QACF,KAAK;QACL,yBAAyB;QACzB,wCAAwC;QACxC,uGAAuG;QACvG,yGAAyG;QACzG,oFAAoF;QACpF,0CAA0C;QAC1C,+BAA+B;QAC/B,+CAA+C;QAC/C,0BAA0B;QAC1B,KAAK;QACL,EAAE;QACF,uSAAuS;QACvS,EAAE;QACF,KAAK;QACL,yBAAyB;QACzB,gBAAgB;QAChB,cAAc;QACd,uBAAuB;QACvB,sEAAsE;QACtE,KAAK;QACL,0BAA0B;QAC1B,KAAK;QACL,EAAE;QACF,QAAQ;QACR,4FAA4F;QAC5F,qJAAqJ;QACrJ,mIAAmI;QACnI,uEAAuE;QACvE,iFAAiF;KAClF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../lib/reflex/agents/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAEnC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAmB;IACrD,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,I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IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -220,7 +220,7 @@ To create a utility, emit a marker:
220
220
  - \`"@host/api"\` — gives the \`{ reflex }\` object (see below).
221
221
  - \`"@host/ui"\` — gives primitives: Button, Input, Textarea, Label, Card, CardContent, CardHeader, CardTitle, Badge, ScrollArea.
222
222
  - No other packages / node_modules / node:* modules. esbuild rejects any other import.
223
- 3. **No fetch/XHR/WebSocket/localStorage** inside the utility. Only \`reflex.web.fetch({url})\` with an explicitly whitelisted domain in the manifest.
223
+ 3. **No fetch/XHR/WebSocket/localStorage** inside the utility. Only \`reflex.web.fetch({url})\` with an explicitly whitelisted domain in the manifest. To DISPLAY external images via \`<img src>\`, list their hosts in \`permissions.images.domains\` — the CSP blocks any host not on that list.
224
224
  4. **State** is persisted via \`reflex.fs.write({path, content})\` (in \`<utility>/data/\`) or \`reflex.kb.add({...})\`.
225
225
  5. **Manifest** must list every required permission — the user sees this list at install time and can refuse.
226
226
 
@@ -238,6 +238,7 @@ To create a utility, emit a marker:
238
238
  "kb": {"read": true, "write": true, "kinds": ["3d-model"]},
239
239
  "fs": {"sandbox": true},
240
240
  "web": {"fetch": {"domains": ["api.example.com"]}, "search": false},
241
+ "images": {"domains": ["cdn.example.com"]},
241
242
  "audit": {"write": true},
242
243
  "workers": {"enabled": true}
243
244
  },
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../../lib/reflex/prompts/defaults.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,MAAM,CAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,eAAe,GAAiC;IAC3D,OAAO,EAAE,oBAAoB;IAC7B,IAAI,EAAE,eAAe;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAmC;IAChE,OAAO,EAAE;QACP,UAAU;QACV,MAAM;QACN,OAAO;QACP,UAAU;QACV,aAAa;QACb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;;;;;;;;;;;;;;;;;;;;;;CA8DV;IAEC,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkRP;CACA,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reflex-agent",
3
- "version": "0.10.0",
3
+ "version": "0.13.2",
4
4
  "private": false,
5
5
  "description": "Local-first knowledge base built by an agent over a chosen directory.",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- exports.id=1198,exports.ids=[1198],exports.modules={17596:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(19963).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},24185:(a,b,c)=>{"use strict";c.r(b),c.d(b,{"401e69b8df6365e8128341caa46872895b5d6d98c0":()=>d.O1,"4046c0c8f63f626207a09dd7d4e3c81548618c213d":()=>d.summarizeYoutubeAction,"40858eb3cc60067aa4b130db5c1196eaee13c1cfd4":()=>d.Gh,"40a761547f522853131aec61aa231c777a9fca1bb0":()=>d.rD,"40b33586d3d770655568006c0e59975787323b9d53":()=>d.AZ});var d=c(18746)},26290:(a,b,c)=>{"use strict";c.d(b,{cn:()=>f});var d=c(83243),e=c(86103);function f(...a){return(0,e.QP)((0,d.$)(a))}},34818:(a,b,c)=>{Promise.resolve().then(c.bind(c,60524)),Promise.resolve().then(c.bind(c,50155)),Promise.resolve().then(c.bind(c,26922)),Promise.resolve().then(c.bind(c,79008)),Promise.resolve().then(c.bind(c,68146)),Promise.resolve().then(c.bind(c,60936)),Promise.resolve().then(c.bind(c,65138)),Promise.resolve().then(c.bind(c,68902)),Promise.resolve().then(c.bind(c,69644)),Promise.resolve().then(c.bind(c,49186)),Promise.resolve().then(c.bind(c,93099)),Promise.resolve().then(c.bind(c,83594)),Promise.resolve().then(c.bind(c,24375)),Promise.resolve().then(c.bind(c,67135)),Promise.resolve().then(c.bind(c,85105)),Promise.resolve().then(c.bind(c,41886)),Promise.resolve().then(c.bind(c,33309)),Promise.resolve().then(c.bind(c,37550)),Promise.resolve().then(c.bind(c,96623)),Promise.resolve().then(c.bind(c,77372)),Promise.resolve().then(c.bind(c,65478)),Promise.resolve().then(c.bind(c,97230)),Promise.resolve().then(c.bind(c,73552)),Promise.resolve().then(c.bind(c,391)),Promise.resolve().then(c.bind(c,4235)),Promise.resolve().then(c.bind(c,41138)),Promise.resolve().then(c.bind(c,60877)),Promise.resolve().then(c.bind(c,7671)),Promise.resolve().then(c.bind(c,5637)),Promise.resolve().then(c.bind(c,36786)),Promise.resolve().then(c.t.bind(c,20594,23))},37488:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{"000cf40309520bd7044565deeda0fcbffc4a011b44":()=>g.i,"40027a901fbad31707cf806872129d272d73f98b3e":()=>h.MU,"401cc3960683ae150dc3a4290efaedd92c21bd2bea":()=>f.u,"4097438ffc7b7936d1a28d19eebd028e3ee2081053":()=>e.nC,"409e01c148412eca924d7c6b14000be39d70bea1a9":()=>f.z,"40b6f575e645078e5833ba3e9f92e994a49af33ef8":()=>e.nY,"40d274ab7bb970eb2b5b04753845d9be71cff99e18":()=>h.$z,"600713c908b08b7ed8537040a0f826bb450e4ec9dd":()=>e.OQ,"60953c0be377ebc7d86658020ce55be9ca07a38941":()=>e.L4,"60b4f6ad14a9b6269cbc3b64a35b111e2162a52df4":()=>e.T$,"60ea34908d6eae773b0ce6bfae3fa29e6307a8b4a5":()=>h.Tc,"70d832b2b293dcfd4d90e921c48bb3e66580f5f99d":()=>e.h$,"7889187bb0f915b7eca03da06e2185f398edf521a7":()=>e.g3});var e=c(13415),f=c(3890),g=c(50995),h=c(15754),i=a([e,h]);[e,h]=i.then?(await i)():i,d()}catch(a){d(a)}})},50895:(a,b,c)=>{"use strict";c.d(b,{A:()=>i});var d=c(34750),e=c(22708),f=c(1278),g=c(14851),h=(0,d.cache)(function(a,b){return function({_cache:a=(0,f.b)(),_formatters:b=(0,f.c)(a),getMessageFallback:c=g.d,messages:d,namespace:e,onError:h=g.b,...i}){return function({messages:a,namespace:b,...c},d){return a=a["!"],b=(0,g.r)(b,"!"),(0,g.a)({...c,messages:a,namespace:b})}({...i,onError:h,cache:a,formatters:b,getMessageFallback:c,messages:{"!":d},namespace:e?`!.${e}`:"!"},"!")}({...a,namespace:b})}),i=(0,d.cache)(async function(a){let b,c;return"string"==typeof a?b=a:a&&(c=a.locale,b=a.namespace),h(await (0,e.A)(c),b)})},52970:(a,b,c)=>{Promise.resolve().then(c.bind(c,46013)),Promise.resolve().then(c.bind(c,51189)),Promise.resolve().then(c.bind(c,66180)),Promise.resolve().then(c.bind(c,75266)),Promise.resolve().then(c.bind(c,14360)),Promise.resolve().then(c.bind(c,6786)),Promise.resolve().then(c.bind(c,44896)),Promise.resolve().then(c.bind(c,14848)),Promise.resolve().then(c.bind(c,53710)),Promise.resolve().then(c.bind(c,30544)),Promise.resolve().then(c.bind(c,13829)),Promise.resolve().then(c.bind(c,90044)),Promise.resolve().then(c.bind(c,57673)),Promise.resolve().then(c.bind(c,97053)),Promise.resolve().then(c.bind(c,43151)),Promise.resolve().then(c.bind(c,12156)),Promise.resolve().then(c.bind(c,71615)),Promise.resolve().then(c.bind(c,4080)),Promise.resolve().then(c.bind(c,87177)),Promise.resolve().then(c.bind(c,87634)),Promise.resolve().then(c.bind(c,6912)),Promise.resolve().then(c.bind(c,13976)),Promise.resolve().then(c.bind(c,18282)),Promise.resolve().then(c.bind(c,20633)),Promise.resolve().then(c.bind(c,61193)),Promise.resolve().then(c.bind(c,66188)),Promise.resolve().then(c.bind(c,66643)),Promise.resolve().then(c.bind(c,81669)),Promise.resolve().then(c.bind(c,39991)),Promise.resolve().then(c.bind(c,54972)),Promise.resolve().then(c.t.bind(c,1056,23))},60524:(a,b,c)=>{"use strict";c.d(b,{Separator:()=>d});let d=(0,c(54491).registerClientReference)(function(){throw Error("Attempted to call Separator() from the server but Separator is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/reflex-agent/reflex-agent/components/ui/separator.tsx","Separator")},67248:(a,b,c)=>{"use strict";c.d(b,{E:()=>i});var d=c(63003);c(34750);var e=c(86209),f=c(65715),g=c(26290);let h=(0,e.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function i({className:a,variant:b="default",asChild:c=!1,...e}){let i=c?f.bL:"span";return(0,d.jsx)(i,{"data-slot":"badge","data-variant":b,className:(0,g.cn)(h({variant:b}),a),...e})}},84913:(a,b,c)=>{"use strict";c.d(b,{$:()=>i});var d=c(63003);c(34750);var e=c(86209),f=c(65715),g=c(26290);let h=(0,e.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function i({className:a,variant:b="default",size:c="default",asChild:e=!1,...i}){let j=e?f.bL:"button";return(0,d.jsx)(j,{"data-slot":"button","data-variant":b,"data-size":c,className:(0,g.cn)(h({variant:b,size:c,className:a})),...i})}}};
@@ -1 +0,0 @@
1
- "use strict";exports.id=2722,exports.ids=[2722],exports.modules={879:(a,b,c)=>{c.d(b,{G:()=>k});var d=c(73024),e=c(76760),f=c.n(e),g=c(55136),h=c.n(g),i=c(54287);class j{constructor(a,b){this.root=a,this.layers=b}static async create(a){return new j(a,[]).enter(a)}async enter(a){let b,c=f().join(a,i.KZ);try{b=await d.promises.readFile(c,"utf8")}catch{return this}let e=h()().add(b);return new j(this.root,[...this.layers,{dir:a,ig:e}])}ignores(a){let b=f().basename(a);if(i.Lj.has(b))return!0;for(let{dir:b,ig:c}of this.layers){let d=f().relative(b,a);if(!(!d||d.startsWith(".."))&&c.ignores(d))return!0}return!1}}async function*k(a,b={}){let{maxDepth:c=1/0,followSymlinks:d=!1}=b,e=f().resolve(a),g=await j.create(e);yield{abs:e,rel:".",isDir:!0},yield*l(e,e,g,0,c,d)}async function*l(a,b,c,e,g,h){let i;if(!(e>=g)){try{i=await d.promises.readdir(b,{withFileTypes:!0})}catch{return}for(let d of(i.sort((a,b)=>a.name.localeCompare(b.name)),i)){var j,k;let i=f().join(b,d.name);if(c.ignores(i))continue;let n=d.isSymbolicLink();if(n&&!h)continue;let o=d.isDirectory()||n&&await m(i),p=(j=a,k=i,f().relative(j,k).split(f().sep).join("/"));if(yield{abs:i,rel:p,isDir:o},o){let b=await c.enter(i);yield*l(a,i,b,e+1,g,h)}}}}async function m(a){try{return(await d.promises.stat(a)).isDirectory()}catch{return!1}}},4168:(a,b,c)=>{c.d(b,{S:()=>j});var d=c(73745);c(66493);var e=c(76760),f=c.n(e),g=c(53905),h=c(54287),i=c(879);async function j(a,b){try{let d=await (0,g.Zn)(a);if(!d)return{ok:!1,error:"Root not found"};let e=(b??"").toLowerCase().trim(),j=[];try{let{listUtilities:b}=await Promise.resolve().then(c.bind(c,8118));for(let c of(await b({rootId:a})))j.push({kind:"utility",relPath:`util:${c.scope}/${c.manifest.id}`,absPath:"",label:`${c.manifest.name} (${c.scope})`,parent:"utilities"})}catch{}for await(let a of(0,i.G)((0,h.FF)(d.path))){if(a.isDir||!a.rel.toLowerCase().endsWith(".md")||a.rel.startsWith("topics/")||a.rel.startsWith("attachments/"))continue;let b=`${h.fW}/${a.rel}`;j.push({kind:"kb",relPath:b,absPath:a.abs,label:a.rel,parent:"."===f().dirname(a.rel)?h.fW:`${h.fW}/${f().dirname(a.rel)}`})}for await(let a of(0,i.G)(d.path))a.isDir||j.push({kind:"file",relPath:a.rel,absPath:a.abs,label:a.rel,parent:"."===f().dirname(a.rel)?"":f().dirname(a.rel)});let k=e?j.filter(a=>{let b=a.relPath.toLowerCase();return f().basename(a.relPath).toLowerCase().includes(e)||b.includes(e)}):j,l={utility:0,kb:1,file:2};return k.sort((a,b)=>{if(a.kind!==b.kind)return l[a.kind]-l[b.kind];if(e){let c=f().basename(a.label).toLowerCase(),d=f().basename(b.label).toLowerCase(),g=+!c.startsWith(e),h=+!d.startsWith(e);if(g!==h)return g-h}return a.relPath.localeCompare(b.relPath)}),{ok:!0,items:k.slice(0,30)}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}(0,c(63781).D)([j]),(0,d.A)(j,"601337ede9ba339e3c6fe333ea5e1f8b2a9595fba8",null)},8836:(a,b,c)=>{c.d(b,{E:()=>g});var d=c(64173),e=c(71813),f=c(69552);function g({label:a,headerRight:b,children:c}){let g=(0,e.c)("roots"),h=a??g("commandBarFrame.label");return(0,d.jsx)("div",{className:"border-t bg-background",children:(0,d.jsx)("div",{className:"mx-auto max-w-3xl px-6 py-5",children:(0,d.jsx)("div",{className:"reflex-gradient rounded-2xl p-[2px] shadow-[0_8px_40px_-12px_oklch(0.55_0.2_290/0.45)]",children:(0,d.jsxs)("div",{className:"rounded-[14px] bg-background/85 backdrop-blur-xl px-5 py-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,d.jsx)("span",{className:"reflex-gradient inline-flex h-6 w-6 items-center justify-center rounded-full text-white shadow-sm",children:(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)("span",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:h}),b&&(0,d.jsx)("span",{className:"ml-auto flex items-center gap-1",children:b})]}),c]})})})})}},26290:(a,b,c)=>{c.d(b,{cn:()=>f});var d=c(83243),e=c(86103);function f(...a){return(0,e.QP)((0,d.$)(a))}},45477:(a,b,c)=>{c.d(b,{T:()=>f});var d=c(64173);c(17240);var e=c(91344);function f({className:a,...b}){return(0,d.jsx)("textarea",{"data-slot":"textarea",className:(0,e.cn)("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",a),...b})}},63337:(a,b,c)=>{c.d(b,{x:()=>h});var d=c(73745);c(66493);var e=c(49410),f=c(8118),g=c(53905);async function h(a){try{let b=(a.query??"").trim().toLowerCase();switch(a.commandId){case"skill":{let c=a.rootId?await (0,g.Zn)(a.rootId):null,d=(await (0,e.bG)(c?.path,a.rootId)).map(a=>({value:a.id,label:a.title,description:`${"project"===a.scope?"[project] ":"global"===a.scope?"[global] ":""}${a.description}`})).filter(a=>i(a,b));return{ok:!0,supported:!0,items:d}}case"util":{let c=(await (0,f.listUtilities)(a.rootId?{rootId:a.rootId}:{})).map(a=>({value:a.manifest.id,label:a.manifest.name,description:a.manifest.description}));return{ok:!0,supported:!0,items:c.filter(a=>i(a,b))}}default:return{ok:!0,supported:!1}}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}function i(a,b){return!b||a.value.toLowerCase().includes(b)||a.label.toLowerCase().includes(b)||(a.description?.toLowerCase().includes(b)??!1)}(0,c(63781).D)([h]),(0,d.A)(h,"409d8e64e9d204d33d298a8fe77b1f56ecd54c28f6",null)},67248:(a,b,c)=>{c.d(b,{E:()=>i});var d=c(63003);c(34750);var e=c(86209),f=c(65715),g=c(26290);let h=(0,e.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function i({className:a,variant:b="default",asChild:c=!1,...e}){let i=c?f.bL:"span";return(0,d.jsx)(i,{"data-slot":"badge","data-variant":b,className:(0,g.cn)(h({variant:b}),a),...e})}},72901:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{LL:()=>v,Xt:()=>z,ZC:()=>A,b2:()=>u,qO:()=>t,wd:()=>y});var e=c(73745);c(66493);var f=c(73024),g=c(76760),h=c.n(g),i=c(65326),j=c(53905),k=c(54287),l=c(56942),m=c(5492),n=c(13415),o=c(93554),p=c(49410),q=c(96921),r=c(63781),s=a([n,o]);async function t(a,b){try{let c=b.trim();if(!c)return{ok:!1,error:"Empty — nothing to remember."};let d=await (0,j.Zn)(a);if(!d)return{ok:!1,error:"Root not found"};let e=c.split(/\r?\n/,1)[0].trim(),f=e.length>80?e.slice(0,77).trimEnd()+"…":e,g=await (0,l.j)({rootPath:d.path,directive:{kind:"note",title:f,body:c}});return(0,i.revalidatePath)(`/roots/${a}`),{ok:!0,message:`Saved to ${g.relPath}`}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function u(a,b){let c=await (0,n.L4)(a,b);return c.ok?{ok:!0,redirectTo:`/roots/${a}`,message:"Topic deleted"}:{ok:!1,error:c.error??"Failed"}}async function v(a){try{let b=await (0,j.Zn)(a);if(!b)return{ok:!1,error:"Root not found"};let c=(0,k.FF)(b.path);for(let a of(await (0,m.hk)(b.path)))await o.z.stopTopic(a.meta.id).catch(()=>void 0);return await w(h().join(c,"widgets")),await w(h().join(c,"dashboard-layout.json")),await w(h().join(c,"topics")),await x(c),(0,i.revalidatePath)(`/roots/${a}`),{ok:!0,redirectTo:`/roots/${a}`,message:"Project cleared. Starting fresh."}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function w(a){try{await f.promises.rm(a,{recursive:!0,force:!0})}catch{}}async function x(a){let b;try{b=await f.promises.readdir(a,{withFileTypes:!0})}catch{return}for(let c of b){let b=h().join(a,c.name);if(c.isDirectory()){await x(b);try{let a=await f.promises.readdir(b);0===a.length&&await f.promises.rmdir(b)}catch{}continue}c.name.toLowerCase().endsWith(".md")&&await f.promises.unlink(b).catch(()=>void 0)}}async function y(){let a=await (0,p.bG)();return{ok:!0,commands:q.Lo,skills:a}}async function z(a){let{collectExtensions:b}=await Promise.resolve().then(c.bind(c,35961)),d=(await b(a.rootId?{rootId:a.rootId}:{})).slashCommands.map(a=>({id:`${a.utility.utilityId}:${a.id}`,trigger:a.trigger,label:a.label,description:a.description,kind:a.kind,usage:a.usage,allowEmpty:a.allowEmpty,icon:a.icon})),e=new Set(q.Lo.map(a=>a.trigger)),f=[...q.Lo,...d.filter(a=>!e.has(a.trigger))];return{ok:!0,commands:f}}async function A(a,b){let{listUtilities:d}=await Promise.resolve().then(c.bind(c,8118)),e=await d({rootId:a}),f=b.trim().toLowerCase(),g=e.map(a=>({id:a.manifest.id,name:a.manifest.name,scope:a.scope,rootId:a.rootId})),h=a=>{let b=a.rootId?`?rootId=${encodeURIComponent(a.rootId)}`:"";return`/utilities/${a.scope}/${a.id}${b}`};if(!f)return 0===g.length?{ok:!1,error:"No mini-apps installed yet."}:{ok:!0,kind:"choices",items:g.map(a=>({url:h(a),id:a.id,name:a.name,scope:a.scope}))};let i=g.find(a=>a.id.toLowerCase()===f);if(i)return{ok:!0,kind:"redirect",url:h(i)};let j=g.filter(a=>a.id.toLowerCase().includes(f)||a.name.toLowerCase().includes(f));return 1===j.length?{ok:!0,kind:"redirect",url:h(j[0])}:0===j.length?{ok:!1,error:`Nothing found for "${b}". Installed: ${g.length}.`}:{ok:!0,kind:"choices",items:j.map(a=>({url:h(a),id:a.id,name:a.name,scope:a.scope}))}}[n,o]=s.then?(await s)():s,(0,r.D)([t,u,v,y,z,A]),(0,e.A)(t,"609fa9aecfc8bb773483068e3b83834801cfca38b7",null),(0,e.A)(u,"60752f54aa843c7ce216d49749ba23942dd0fc26df",null),(0,e.A)(v,"40233c199129b1551f29365f483d2548c97d32944f",null),(0,e.A)(y,"00e814e35b8e7d6b5daf09172517a1228b0783d79b",null),(0,e.A)(z,"404015859133c59d5508969d2c30fe3da6aafb5a0d",null),(0,e.A)(A,"6078f0e51d3c7ed1953847bc18343e472be4999d96",null),d()}catch(a){d(a)}})},80575:(a,b,c)=>{c.d(b,{L:()=>O});var d=c(64173),e=c(17240),f=c(71813),g=c(54249),h=c(75430),i=c(34719),j=c(56189),k=c(41856),l=c(33120),m=c(69552),n=c(97338),o=c(25299),p=c(63387),q=c(53834),r=c(97162),s=c(62261),t=c(77311),u=c(25436),v=c(24555),w=c(68669),x=c(79145),y=c(66979),z=c(87671),A=c(44052),B=c(20583),C=c(45477),D=c(91344),E=c(3265);let F=(0,E.createServerReference)("601337ede9ba339e3c6fe333ea5e1f8b2a9595fba8",E.callServer,void 0,E.findSourceMapURL,"searchMentionsAction"),G=[{id:"plan",trigger:"plan",label:"/plan",description:"Show the plan first — Reflex lays out the steps and waits for approval.",kind:"agent-mode",usage:"/plan <task>",icon:"ListChecks"},{id:"goal",trigger:"goal",label:"/goal",description:"Set a goal — Reflex will work toward it on its own, without reminders.",kind:"agent-mode",usage:"/goal <what to achieve>",icon:"Target"},{id:"research",trigger:"research",label:"/research",description:"Deep research on a topic — web search + summary with sources.",kind:"agent-mode",usage:"/research <topic>",icon:"Telescope"},{id:"widget",trigger:"widget",label:"/widget",description:"Create a card on the space dashboard.",kind:"agent-mode",usage:"/widget <what to show>",icon:"LayoutGrid"},{id:"workflow",trigger:"workflow",label:"/workflow",description:"Build a recipe — linear step-based automation for the task.",kind:"agent-mode",usage:"/workflow <what to automate>",icon:"Workflow"},{id:"distill",trigger:"distill",label:"/distill",description:"Pull a URL into the KB — extract key facts, action items, and links to related notes.",kind:"agent-mode",usage:"/distill <url> [focus]",icon:"BookOpenCheck"},{id:"practice",trigger:"practice",label:"/practice",description:"Roleplay a tough conversation — Reflex plays the counterpart and coaches you between turns.",kind:"agent-mode",usage:"/practice <scenario>",icon:"MessagesSquare"},{id:"reflect",trigger:"reflect",label:"/reflect",description:"Daily check-in — three questions adapted to your recent entries, saved as a journal note.",kind:"agent-mode",usage:"/reflect",allowEmpty:!0,icon:"Sunrise"},{id:"remember",trigger:"remember",label:"/remember",description:"Save a note — straight into memory, no AI involved.",kind:"direct",usage:"/remember <what to remember>",icon:"BookmarkPlus"},{id:"mcp",trigger:"mcp",label:"/mcp",description:"Connect an external service (setup wizard opens in chat).",kind:"agent-mode",usage:"/mcp <what you need>",icon:"PackagePlus"},{id:"skill",trigger:"skill",label:"/skill",description:"Attach a role — a ready-made instruction set for this conversation.",kind:"agent-mode",usage:"/skill <role-id> [prompt]",icon:"Sparkles"},{id:"delete-topic",trigger:"delete-topic",label:"/delete-topic",description:"Delete this conversation (with confirmation).",kind:"direct",usage:"/delete-topic",requiresConfirm:!0,allowEmpty:!0,icon:"Trash2"},{id:"clear-project",trigger:"clear-project",label:"/clear-project",description:"DANGER: clear the space — all conversations, cards, memory. Double confirmation.",kind:"direct",usage:"/clear-project",requiresConfirm:!0,allowEmpty:!0,icon:"AlertOctagon"},{id:"util",trigger:"util",label:"/util",description:"Open a mini-app (by partial name or from the list).",kind:"direct",usage:"/util <partial name or id>",allowEmpty:!0,icon:"Boxes"},{id:"help",trigger:"help",label:"/help",description:"List available commands.",kind:"direct",usage:"/help",allowEmpty:!0,icon:"HelpCircle"}],H=(0,E.createServerReference)("409d8e64e9d204d33d298a8fe77b1f56ecd54c28f6",E.callServer,void 0,E.findSourceMapURL,"listCommandArgsAction");E.callServer,E.findSourceMapURL;let I=(0,E.createServerReference)("609fa9aecfc8bb773483068e3b83834801cfca38b7",E.callServer,void 0,E.findSourceMapURL,"rememberAction"),J=(0,E.createServerReference)("60752f54aa843c7ce216d49749ba23942dd0fc26df",E.callServer,void 0,E.findSourceMapURL,"deleteCurrentTopicCommand"),K=(0,E.createServerReference)("6078f0e51d3c7ed1953847bc18343e472be4999d96",E.callServer,void 0,E.findSourceMapURL,"openUtilityAction"),L=(0,E.createServerReference)("40233c199129b1551f29365f483d2548c97d32944f",E.callServer,void 0,E.findSourceMapURL,"clearProjectAction");var M=c(88724);let N={ListChecks:g.A,Target:h.A,Telescope:i.A,LayoutGrid:j.A,BookmarkPlus:k.A,PackagePlus:l.A,Sparkles:m.A,Trash2:n.A,AlertOctagon:o.A,HelpCircle:p.A,Workflow:q.A,Boxes:r.A};function O({rootId:a,topicId:b,placeholder:c,submitLabel:g,pendingLabel:h,SubmitIcon:i,disabled:j,onSubmit:k,active:l,onStop:m,clarifyLabel:n,stopLabel:o}){let p=(0,f.c)("roots"),q=n??p("chatInputForm.clarifyLabel"),r=o??p("chatInputForm.stopLabel"),v=(0,z.useRouter)(),[w,x]=(0,e.useState)(""),[y,E]=(0,e.useState)([]),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)(!1),[O,U]=(0,e.useState)(G),V=(0,e.useRef)(null),W=(0,e.useRef)(null),[X,Y]=(0,e.useState)(null),[Z,$]=(0,e.useState)([]),[_,aa]=(0,e.useState)(0),[ab,ac]=(0,e.useState)(!1),ad=(0,e.useRef)(0),[ae,af]=(0,e.useState)(null),[ag,ah]=(0,e.useState)(null),ai=(0,e.useRef)(0);(0,e.useCallback)(()=>{let a=V.current;a&&(a.style.height="auto",a.style.height=Math.min(a.scrollHeight,240)+"px")},[]);let aj=(0,e.useCallback)((b,c)=>{let d=c;for(;d>0;){let a=b[d-1];if("@"===a){d-=1;break}if(/\s/.test(a)){d=-1;break}d-=1}if(d<0||"@"!==b[d]||d>0&&!/\s/.test(b[d-1])){Y(null),$([]);return}let e=b.slice(d+1,c);Y({start:d,end:c}),aa(0),ac(!0);let f=++ad.current;(async()=>{let b=await F(a,e);ad.current===f&&(ac(!1),$(b.ok?b.items:[]))})()},[a]),ak=(0,e.useCallback)(()=>{Y(null),$([]),ad.current++},[]),al=(0,e.useCallback)((b,c)=>{if(!b.startsWith("/")){af(null),ah(null);return}let d=b.indexOf(" ");if(d<0){ah(null);let a=b.slice(1).toLowerCase(),c=O.filter(b=>b.trigger.startsWith(a)||b.label.toLowerCase().includes(a)||b.description.toLowerCase().includes(a));af(c.length?{items:c,index:0}:null);return}af(null);let e=b.slice(1,d),f=O.find(a=>a.trigger===e);if(!f)return void ah(null);let g=d+1,h=c>=g?c:b.length;if(b.slice(h).indexOf(" ")>=0)return void ah(null);let i=b.slice(g,h),j=++ai.current;ah(a=>({cmd:f,items:a?.cmd.id===f.id?a.items:[],index:0,start:g,end:h,loading:!0})),(async()=>{let b=await H({commandId:f.id,query:i,rootId:a});if(ai.current===j){if(!b.ok||!b.supported||0===b.items.length)return ah(null);ah({cmd:f,items:b.items,index:0,start:g,end:h,loading:!1})}})()},[a,O]),am=(0,e.useCallback)(()=>{af(null),ah(null)},[]),an=(0,e.useCallback)(a=>{let b=V.current;ah(c=>{if(!c)return null;let d=w.slice(0,c.start),e=w.slice(c.end),f=`${a.value} `;x(d+f+e);let g=d.length+f.length;return requestAnimationFrame(()=>{b&&(b.focus(),b.setSelectionRange(g,g))}),null})},[w]),ao=(0,e.useCallback)(a=>{let b=V.current,c=`/${a.trigger}${a.allowEmpty&&"direct"===a.kind?"":" "}`;x(c),af(null),requestAnimationFrame(()=>{b&&(b.focus(),b.setSelectionRange(c.length,c.length))})},[]),ap=(0,e.useCallback)(a=>{let b=V.current;if(!b||!X)return;let c=w.slice(0,X.start),d=w.slice(X.end),e=`@${a.relPath} `;x(c+e+d),ak();let f=c.length+e.length;requestAnimationFrame(()=>{b.focus(),b.setSelectionRange(f,f)})},[w,X,ak]),aq=(0,e.useCallback)(async b=>{if(0!==b.length){J(!0);try{let c=new FormData;for(let a of b)c.append("files",a);let d=await fetch(`/api/roots/${a}/attachments`,{method:"POST",body:c});if(!d.ok){let a=await d.json().catch(()=>({}));A.oR.error(a.error??p("chatInputForm.uploadFailed",{status:d.status}));return}let e=await d.json();E(a=>[...a,...e.files])}catch(a){A.oR.error(a instanceof Error?a.message:String(a))}finally{J(!1)}}},[a]),ar=w.trim().length>0||y.length>0,as=l&&m?ar?"clarify":"stop":"send",at=(0,e.useCallback)(async()=>{if(K)return;if("stop"===as){if(!m)return;L(!0);try{await m()}finally{L(!1)}return}let c=w.trim();if(!c&&0===y.length||j&&"send"===as)return;let d=function(a,b=[]){let c=a.trim();if(!c.startsWith("/"))return null;let d=/^\/([a-z][a-z0-9-]*)(?:\s+([\s\S]*))?$/.exec(c);if(!d)return null;let e=d[1],f=G.find(a=>a.trigger===e)??null??b.find(a=>a.trigger===e);return f?{def:f,payload:(d[2]??"").trim()}:null}(c);if(d&&"direct"===d.def.kind){L(!0);try{await P({cmd:d.def,payload:d.payload,rootId:a,topicId:b,router:v,t:p}),x("")}finally{L(!1)}return}L(!0);try{"clarify"===as&&m&&await m(),await k({message:c,attachments:y})&&(x(""),E([]))}finally{L(!1)}},[w,y,K,j,as,m,k,a,b,v,p]),au=!K&&!I&&("stop"===as||ar&&(!j||"clarify"===as));return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),at()},onDragEnter:a=>{Array.from(a.dataTransfer.types).includes("Files")&&(a.preventDefault(),N(!0))},onDragOver:a=>{Array.from(a.dataTransfer.types).includes("Files")&&(a.preventDefault(),N(!0))},onDragLeave:a=>{a.currentTarget.contains(a.relatedTarget)||N(!1)},onDrop:a=>{a.preventDefault(),N(!1);let b=Array.from(a.dataTransfer.files);b.length>0&&aq(b)},className:(0,D.cn)("space-y-2 rounded-md transition-colors",M&&"ring-2 ring-ring/60 bg-accent/40"),children:[y.length>0&&(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:y.map((a,b)=>(0,d.jsx)(S,{attachment:a,onRemove:()=>E(b=>b.filter(b=>b!==a))},a.absPath+b))}),(0,d.jsxs)("div",{className:"flex items-end gap-2",children:[(0,d.jsxs)("div",{className:"relative flex-1",children:[(0,d.jsx)(C.T,{ref:V,value:w,onChange:a=>{x(a.target.value),aj(a.target.value,a.target.selectionStart),al(a.target.value,a.target.selectionStart)},onKeyUp:a=>{let b=a.currentTarget;aj(b.value,b.selectionStart),al(b.value,b.selectionStart)},onClick:a=>{let b=a.currentTarget;aj(b.value,b.selectionStart),al(b.value,b.selectionStart)},onBlur:()=>{setTimeout(()=>{ak(),am()},150)},onKeyDown:a=>{if(ae){if("ArrowDown"===a.key){a.preventDefault(),af(a=>a?{...a,index:Math.min(a.items.length-1,a.index+1)}:null);return}if("ArrowUp"===a.key){a.preventDefault(),af(a=>a?{...a,index:Math.max(0,a.index-1)}:null);return}if("Tab"===a.key){a.preventDefault();let b=ae.items[ae.index];b&&ao(b);return}if("Escape"===a.key){a.preventDefault(),am();return}}if(ag&&ag.items.length>0){if("ArrowDown"===a.key){a.preventDefault(),ah(a=>a?{...a,index:Math.min(a.items.length-1,a.index+1)}:null);return}if("ArrowUp"===a.key){a.preventDefault(),ah(a=>a?{...a,index:Math.max(0,a.index-1)}:null);return}if("Tab"===a.key){a.preventDefault();let b=ag.items[ag.index];b&&an(b);return}if("Escape"===a.key){a.preventDefault(),ah(null);return}}if(X&&Z.length>0){if("ArrowDown"===a.key){a.preventDefault(),aa(a=>Math.min(Z.length-1,a+1));return}if("ArrowUp"===a.key){a.preventDefault(),aa(a=>Math.max(0,a-1));return}if("Enter"===a.key||"Tab"===a.key){a.preventDefault();let b=Z[_];b&&ap(b);return}if("Escape"===a.key){a.preventDefault(),ak();return}}"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),at())},onPaste:a=>{let b=Array.from(a.clipboardData.files);b.length>0&&(a.preventDefault(),aq(b))},placeholder:c,rows:1,disabled:j||K,className:"resize-none min-h-[44px] max-h-60 text-base bg-background/70 border-transparent focus-visible:border-ring py-2.5 w-full"}),X&&(0,d.jsx)(R,{items:Z,index:_,loading:ab,onPick:ap,onHover:a=>aa(a)}),ae&&!X&&(0,d.jsx)(Q,{items:ae.items,index:ae.index,onPick:ao,onHover:a=>af(b=>b?{...b,index:a}:null),topicAvailable:!!b}),ag&&!X&&!ae&&(0,d.jsx)(T,{cmd:ag.cmd,items:ag.items,index:ag.index,onPick:an,onHover:a=>ah(b=>b?{...b,index:a}:null)})]}),(0,d.jsx)("input",{ref:W,type:"file",multiple:!0,className:"hidden",onChange:a=>{let b=Array.from(a.target.files??[]);b.length>0&&aq(b),a.target.value=""}}),(0,d.jsx)(B.$,{type:"button",size:"icon",variant:"ghost",onClick:()=>W.current?.click(),disabled:I||K||j,title:p("chatInputForm.attachTitle"),className:"h-11 w-11 shrink-0",children:I?(0,d.jsx)(s.A,{className:"h-4 w-4 animate-spin"}):(0,d.jsx)(t.A,{className:"h-4 w-4"})}),(0,d.jsx)(B.$,{type:"submit",size:"lg",disabled:!au,variant:"stop"===as?"destructive":"default",className:"h-11 px-6 shadow-md shrink-0",children:K?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.A,{className:"mr-2 h-4 w-4 animate-spin"}),h]}):"stop"===as?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(u.A,{className:"mr-2 h-4 w-4",fill:"currentColor"}),r]}):"clarify"===as?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i,{className:"mr-2 h-4 w-4"}),q]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i,{className:"mr-2 h-4 w-4"}),g]})})]}),(0,d.jsx)("div",{className:"text-[10px] text-muted-foreground",children:p("chatInputForm.helperRow")})]})}async function P({cmd:a,payload:b,rootId:c,topicId:d,router:e,t:f}){if("help"===a.id){let a=G.map(a=>`• ${a.label} — ${a.description}`);A.oR.info(f("chatInputForm.availableCommands",{list:a.join("\n")}),{duration:12e3});return}if("remember"===a.id){if(!b)return void A.oR.error(f("chatInputForm.rememberEmpty"));let a=await I(c,b);return void(a.ok?(A.oR.success(a.message??f("chatInputForm.savedToKb")),(0,M.$d)(M.Zi.kbChanged(c))):A.oR.error(a.error))}if("delete-topic"===a.id){if(!d)return void A.oR.error(f("chatInputForm.topicOnlyCommand"));if(!confirm(f("chatInputForm.deleteTopicConfirm")))return;let a=await J(c,d);return void(a.ok?(A.oR.success(a.message??f("chatInputForm.deleted")),(0,M.$d)(M.Zi.topicsChanged(c)),a.redirectTo&&e.push(a.redirectTo)):A.oR.error(a.error))}if("util"===a.id){let a=await K(c,b);if(!a.ok)return void A.oR.error(a.error);if("redirect"===a.kind)return void e.push(a.url);let d=a.items.slice(0,8).map(a=>`• ${a.name} (${a.scope}/${a.id})`).join("\n");return void A.oR.message(f("chatInputForm.multipleMatches",{list:d}),{duration:12e3})}if("clear-project"===a.id){if(!confirm(f("chatInputForm.clearProjectConfirm")))return;let a=prompt(f("chatInputForm.clearProjectPrompt"));if(a?.trim().toLowerCase()!==f("chatInputForm.clearProjectPhrase"))return void A.oR.message(f("chatInputForm.confirmFailed"));let b=await L(c);return void(b.ok?(A.oR.success(b.message??f("chatInputForm.projectCleared")),(0,M.$d)(M.Zi.topicsChanged(c)),(0,M.$d)(M.Zi.kbChanged(c)),b.redirectTo&&e.push(b.redirectTo)):A.oR.error(b.error))}A.oR.error(f("chatInputForm.unknownCommand",{label:a.label}))}function Q({items:a,index:b,onPick:c,onHover:e,topicAvailable:g}){let h=(0,f.c)("roots");return(0,d.jsxs)("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50 max-h-80 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-lg",children:[(0,d.jsx)("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-muted-foreground border-b",children:h("chatInputForm.commandsPaletteHeader")}),(0,d.jsx)("ul",{children:a.map((a,f)=>{let i=N[a.icon]??m.A,j="delete-topic"===a.id&&!g;return(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",onMouseDown:b=>{b.preventDefault(),j||c(a)},onMouseEnter:()=>e(f),disabled:j,className:(0,D.cn)("w-full flex items-start gap-2 px-3 py-2 text-left",f===b?"bg-accent":"hover:bg-accent/60",j&&"opacity-40 cursor-not-allowed"),children:[(0,d.jsx)(i,{className:(0,D.cn)("h-3.5 w-3.5 mt-0.5 shrink-0","direct"===a.kind?"text-amber-600":"text-violet-600")}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"font-mono text-xs font-medium",children:a.label}),"direct"===a.kind&&(0,d.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-amber-700",children:h("chatInputForm.directAction")}),a.requiresConfirm&&(0,d.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-destructive",children:h("chatInputForm.withConfirm")})]}),(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug mt-0.5",children:a.description}),(0,d.jsx)("p",{className:"text-[10px] text-muted-foreground/80 font-mono mt-0.5",children:a.usage})]})]})},a.id)})})]})}function R({items:a,index:b,loading:c,onPick:e,onHover:g}){let h=(0,f.c)("roots");return(0,d.jsx)("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50 max-h-72 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-lg",children:c&&0===a.length?(0,d.jsxs)("div",{className:"px-3 py-2 text-xs text-muted-foreground flex items-center gap-2",children:[(0,d.jsx)(s.A,{className:"h-3 w-3 animate-spin"})," ",h("chatInputForm.mentionSearching")]}):0===a.length?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground italic",children:h("chatInputForm.mentionNothing")}):(0,d.jsx)("ul",{children:a.map((a,c)=>{let f="kb"===a.kind?v.A:w.A;return(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",onMouseDown:b=>{b.preventDefault(),e(a)},onMouseEnter:()=>g(c),className:(0,D.cn)("w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left",c===b?"bg-accent":"hover:bg-accent/60"),children:[(0,d.jsx)(f,{className:(0,D.cn)("h-3.5 w-3.5 shrink-0","kb"===a.kind?"text-primary":"text-muted-foreground")}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"truncate font-mono text-xs",children:a.relPath}),a.parent&&(0,d.jsx)("div",{className:"truncate text-[10px] text-muted-foreground",children:a.parent})]}),(0,d.jsx)("span",{className:(0,D.cn)("text-[10px] uppercase tracking-wider shrink-0","kb"===a.kind?"text-primary":"text-muted-foreground"),children:a.kind})]})},a.absPath)})})})}function S({attachment:a,onRemove:b}){var c;let e=a.mime.startsWith("image/")?x.A:w.A;return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-1 text-[11px] max-w-[18rem]",children:[(0,d.jsx)(e,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,d.jsx)("span",{className:"truncate",title:a.name,children:a.name}),(0,d.jsx)("span",{className:"text-muted-foreground",children:(c=a.size)<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1048576).toFixed(1)} MB`}),(0,d.jsx)("button",{type:"button",onClick:b,className:"ml-0.5 text-muted-foreground hover:text-foreground",children:(0,d.jsx)(y.A,{className:"h-3 w-3"})})]})}function T({cmd:a,items:b,index:c,onPick:e,onHover:f}){let g=N[a.icon]??m.A;return(0,d.jsxs)("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50 max-h-80 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-lg",children:[(0,d.jsxs)("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-muted-foreground border-b flex items-center gap-2",children:[(0,d.jsx)(g,{className:"h-3 w-3"}),(0,d.jsxs)("span",{children:[a.label," \xb7 ",a.usage.replace(/^\/\S+\s*/,"")]})]}),(0,d.jsx)("ul",{children:b.map((a,b)=>(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",onMouseDown:b=>{b.preventDefault(),e(a)},onMouseEnter:()=>f(b),className:(0,D.cn)("w-full flex items-start gap-2 px-3 py-2 text-left",b===c?"bg-accent":"hover:bg-accent/60"),children:[(0,d.jsx)(m.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 text-violet-600"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"font-medium text-sm",children:a.label}),(0,d.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground",children:a.value})]}),a.description&&(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug mt-0.5 line-clamp-2",children:a.description})]})]})},a.value))})]})}},84913:(a,b,c)=>{c.d(b,{$:()=>i});var d=c(63003);c(34750);var e=c(86209),f=c(65715),g=c(26290);let h=(0,e.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function i({className:a,variant:b="default",size:c="default",asChild:e=!1,...i}){let j=e?f.bL:"button";return(0,d.jsx)(j,{"data-slot":"button","data-variant":b,"data-size":c,className:(0,g.cn)(h({variant:b,size:c,className:a})),...i})}}};
@@ -1 +0,0 @@
1
- "use strict";exports.id=5090,exports.ids=[5090],exports.modules={24185:(a,b,c)=>{c.r(b),c.d(b,{"401e69b8df6365e8128341caa46872895b5d6d98c0":()=>d.O1,"4046c0c8f63f626207a09dd7d4e3c81548618c213d":()=>d.summarizeYoutubeAction,"40858eb3cc60067aa4b130db5c1196eaee13c1cfd4":()=>d.Gh,"40a761547f522853131aec61aa231c777a9fca1bb0":()=>d.rD,"40b33586d3d770655568006c0e59975787323b9d53":()=>d.AZ});var d=c(18746)},48474:(a,b,c)=>{c.d(b,{UtilityIframe:()=>s});var d=c(64173),e=c(17240),f=c(53186),g=c(71813),h=c(65177),i=c(66979),j=c(69552),k=c(62261),l=c(73569),m=c(1056),n=c.n(m),o=c(44052),p=c(3265);function q({scope:a,utilityId:b,utilityName:c,rootId:m,requestSnapshot:p,onClose:q}){let s=(0,g.c)("app"),[t,u]=(0,e.useState)(null),[v,w]=(0,e.useState)([]),[x,y]=(0,e.useState)(""),[z,A]=(0,e.useState)(null),[B,C]=(0,e.useTransition)(),[D,E]=(0,e.useState)(!1),F=(0,e.useRef)(null);(0,e.useRef)(null),(0,e.useRef)("");let[G,H]=(0,e.useState)(""),I=()=>{let a=x.trim();a&&m&&t&&(y(""),w(b=>[...b,{role:"user",text:a,ts:new Date().toISOString()}]),C(async()=>{let b;try{b=await Promise.race([p(),new Promise(a=>setTimeout(()=>a(void 0),600))])}catch{}let c=void 0!==b?function(a,b){let c;try{c="string"==typeof b?b:JSON.stringify(b,null,2)}catch{c=String(b)}return c.length>4e3&&(c=c.slice(0,4e3)+"\n…[truncated]"),["[Mini-app context]",c,"[/context]\n",a].join("\n")}(a,b):a;try{let a=await fetch(`/api/roots/${m}/chat/${t}/send`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:c})});if(!a.ok){let b=await a.json().catch(()=>({}));o.oR.error(b.error??`HTTP ${a.status}`)}}catch(a){o.oR.error(String(a))}}))};return(0,d.jsxs)("aside",{className:"flex h-full flex-col border-l bg-card",children:[(0,d.jsxs)("header",{className:"border-b px-3 py-2 flex items-center gap-2",children:[(0,d.jsx)(f.A,{className:"h-3.5 w-3.5 text-violet-600"}),(0,d.jsx)("span",{className:"text-sm font-medium",children:s("utilities.helper.title")}),(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground ml-1",children:s("utilities.helper.hint")}),m&&t&&(0,d.jsx)(n(),{href:`/roots/${m}/chat/${t}`,className:"ml-auto p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",title:s("utilities.helper.openFull"),children:(0,d.jsx)(h.A,{className:"h-3.5 w-3.5"})}),q&&(0,d.jsx)("button",{type:"button",onClick:q,className:"p-1 rounded hover:bg-accent "+(m&&t?"":"ml-auto"),title:s("utilities.helper.hide"),children:(0,d.jsx)(i.A,{className:"h-3.5 w-3.5"})})]}),(0,d.jsxs)("div",{ref:F,className:"flex-1 overflow-y-auto px-3 py-2 space-y-2 text-sm",children:[z&&(0,d.jsx)("p",{className:"text-xs text-red-600",children:z}),!z&&0===v.length&&!G&&(0,d.jsxs)("div",{className:"text-xs text-muted-foreground flex items-start gap-2",children:[(0,d.jsx)(j.A,{className:"h-3 w-3 mt-0.5 text-violet-600 shrink-0"}),(0,d.jsx)("span",{children:s("utilities.helper.welcome")})]}),v.map((a,b)=>(0,d.jsx)(r,{role:a.role,text:a.text},b)),D&&G&&(0,d.jsx)(r,{role:"assistant",text:G,streaming:!0}),B&&!D&&(0,d.jsxs)("div",{className:"mr-6 rounded-md bg-muted/40 px-2 py-1.5 text-xs text-muted-foreground inline-flex items-center gap-2",children:[(0,d.jsx)(k.A,{className:"h-3 w-3 animate-spin"}),s("utilities.helper.thinking")]})]}),(0,d.jsxs)("div",{className:"border-t px-3 py-2 flex items-end gap-1.5",children:[(0,d.jsx)("textarea",{value:x,onChange:a=>y(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.metaKey||a.ctrlKey)&&(a.preventDefault(),I())},rows:1,placeholder:s("utilities.helper.placeholder"),disabled:B||!!z||!t,className:"flex-1 resize-none rounded border bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-violet-400 max-h-24"}),(0,d.jsx)("button",{type:"button",onClick:I,disabled:B||!x.trim()||!!z||!t,className:"inline-flex items-center justify-center rounded bg-violet-600 px-2 py-1 text-white hover:bg-violet-700 disabled:opacity-50",children:B?(0,d.jsx)(k.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(l.A,{className:"h-3 w-3"})})]})]})}function r({role:a,text:b,streaming:c}){let e=(0,g.c)("app"),f=b;return("user"===a&&(f=f.replace(/^\s*\[Mini-app context\][\s\S]*?\[\/context\]\s*/,"").trim()),f.trim())?(0,d.jsxs)("div",{className:"user"===a?"ml-6 rounded-md bg-violet-50 dark:bg-violet-950/30 px-2 py-1.5":"mr-6 rounded-md bg-muted/40 px-2 py-1.5 whitespace-pre-wrap",children:[(0,d.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-0.5",children:[e("user"===a?"utilities.helper.you":"assistant"===a?"utilities.helper.reflex":"utilities.helper.system"),c&&(0,d.jsx)("span",{className:"ml-1 text-violet-600",children:"●"})]}),f]}):null}function s({scope:a,id:b,rootId:c,className:h,title:i,agentChat:j,utilityName:k}){let l=(0,g.c)("app"),m=(0,e.useRef)(null),n=(0,e.useRef)(null),[o,p]=(0,e.useState)(!0),r=c?`?rootId=${encodeURIComponent(c)}`:"",s=`/api/utilities/${a}/${b}/iframe${r}`,t=(0,d.jsx)("iframe",{ref:m,src:s,sandbox:"allow-scripts allow-forms allow-same-origin",className:h??"h-full w-full border-0 bg-white",title:i??`utility-${b}`});return j?(0,d.jsxs)("div",{className:"flex h-full w-full",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0 relative",children:[t,!o&&(0,d.jsxs)("button",{type:"button",onClick:()=>p(!0),className:"absolute right-3 bottom-3 inline-flex items-center gap-1 rounded-full bg-violet-600 px-3 py-1.5 text-xs text-white shadow-lg hover:bg-violet-700",title:l("utilities.iframe.openHelper"),children:[(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"}),l("utilities.iframe.helper")]})]}),o&&(0,d.jsx)("div",{className:"w-80 shrink-0",children:(0,d.jsx)(q,{scope:a,utilityId:b,...k?{utilityName:k}:{},...c?{rootId:c}:{},requestSnapshot:()=>{let a=m.current?.contentWindow;return a?(n.current&&(clearTimeout(n.current.timer),n.current.resolve(void 0),n.current=null),new Promise(b=>{let c=setTimeout(()=>{n.current?.resolve===b&&(n.current=null,b(void 0))},500);n.current={resolve:b,timer:c};try{a.postMessage({type:"request-snapshot"},"*")}catch{clearTimeout(c),n.current=null,b(void 0)}})):Promise.resolve(void 0)},onClose:()=>p(!1)})})]}):t}p.callServer,p.findSourceMapURL,p.callServer,p.findSourceMapURL},65177:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(42557).A)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},66979:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(42557).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},73569:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(42557).A)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])}};