reflex-agent 0.3.0 → 0.3.3

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 (151) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +83 -83
  3. package/.next/app-path-routes-manifest.json +6 -6
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/react-loadable-manifest.json +1 -1
  7. package/.next/server/app/_not-found/page.js +2 -2
  8. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  9. package/.next/server/app/agents/[agentId]/page.js +2 -2
  10. package/.next/server/app/agents/[agentId]/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/agents/[agentId]/respond/route.js +1 -1
  12. package/.next/server/app/api/agents/[agentId]/respond/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/images/[rootId]/[file]/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/oauth/start/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/roots/[id]/attachments/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js +1 -1
  18. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js +1 -1
  20. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js +2 -2
  22. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/roots/[id]/dashboard/route.js +1 -1
  24. package/.next/server/app/api/roots/[id]/dashboard/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/roots/[id]/suggestions/route.js +1 -1
  26. package/.next/server/app/api/roots/[id]/suggestions/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/utilities/[scope]/[id]/bundle.js/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/utilities/[scope]/[id]/host/route.js +1 -1
  29. package/.next/server/app/api/utilities/[scope]/[id]/host/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/utilities/[scope]/[id]/host-api.mjs/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/utilities/[scope]/[id]/host-ui.mjs/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/utilities/[scope]/[id]/iframe/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/utilities/[scope]/[id]/style.css/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/audit/page.js +1 -1
  35. package/.next/server/app/audit/page.js.nft.json +1 -1
  36. package/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  37. package/.next/server/app/onboarding/page.js +3 -3
  38. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  39. package/.next/server/app/page.js +2 -2
  40. package/.next/server/app/page.js.nft.json +1 -1
  41. package/.next/server/app/page_client-reference-manifest.js +1 -1
  42. package/.next/server/app/roots/[id]/chat/[topicId]/page.js +2 -2
  43. package/.next/server/app/roots/[id]/chat/[topicId]/page.js.nft.json +1 -1
  44. package/.next/server/app/roots/[id]/chat/[topicId]/page_client-reference-manifest.js +1 -1
  45. package/.next/server/app/roots/[id]/kb/[...slug]/page.js +2 -2
  46. package/.next/server/app/roots/[id]/kb/[...slug]/page.js.nft.json +1 -1
  47. package/.next/server/app/roots/[id]/kb/[...slug]/page_client-reference-manifest.js +1 -1
  48. package/.next/server/app/roots/[id]/page.js +3 -3
  49. package/.next/server/app/roots/[id]/page.js.nft.json +1 -1
  50. package/.next/server/app/roots/[id]/page_client-reference-manifest.js +1 -1
  51. package/.next/server/app/roots/[id]/workflows/[wfId]/page.js +2 -2
  52. package/.next/server/app/roots/[id]/workflows/[wfId]/page_client-reference-manifest.js +1 -1
  53. package/.next/server/app/roots/[id]/workflows/page.js +1 -1
  54. package/.next/server/app/roots/[id]/workflows/page.js.nft.json +1 -1
  55. package/.next/server/app/roots/[id]/workflows/page_client-reference-manifest.js +1 -1
  56. package/.next/server/app/roots/new/page.js +4 -4
  57. package/.next/server/app/roots/new/page_client-reference-manifest.js +1 -1
  58. package/.next/server/app/settings/page.js +4 -4
  59. package/.next/server/app/settings/page.js.nft.json +1 -1
  60. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  61. package/.next/server/app/share/[id]/file/page.js +2 -2
  62. package/.next/server/app/share/[id]/file/page_client-reference-manifest.js +1 -1
  63. package/.next/server/app/share/[id]/page.js +2 -2
  64. package/.next/server/app/share/[id]/page.js.nft.json +1 -1
  65. package/.next/server/app/share/[id]/page_client-reference-manifest.js +1 -1
  66. package/.next/server/app/utilities/[scope]/[id]/page.js +2 -2
  67. package/.next/server/app/utilities/[scope]/[id]/page.js.nft.json +1 -1
  68. package/.next/server/app/utilities/[scope]/[id]/page_client-reference-manifest.js +1 -1
  69. package/.next/server/app/utilities/page.js +2 -2
  70. package/.next/server/app/utilities/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app-paths-manifest.json +6 -6
  72. package/.next/server/chunks/157.js +1 -0
  73. package/.next/server/chunks/285.js +2 -2
  74. package/.next/server/chunks/2995.js +1 -1
  75. package/.next/server/chunks/3332.js +1 -1
  76. package/.next/server/chunks/4812.js +1 -1
  77. package/.next/server/chunks/4925.js +1 -1
  78. package/.next/server/chunks/503.js +1 -0
  79. package/.next/server/chunks/5992.js +1 -0
  80. package/.next/server/chunks/6307.js +1 -0
  81. package/.next/server/chunks/{3512.js → 7908.js} +2 -2
  82. package/.next/server/chunks/8587.js +3 -0
  83. package/.next/server/chunks/9098.js +1 -1
  84. package/.next/server/functions-config-manifest.json +4 -4
  85. package/.next/server/middleware-build-manifest.js +1 -1
  86. package/.next/server/middleware-manifest.json +5 -5
  87. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  88. package/.next/server/pages/500.html +1 -1
  89. package/.next/server/server-reference-manifest.js +1 -1
  90. package/.next/server/server-reference-manifest.json +1 -1
  91. package/.next/static/chunks/1117-6fde4a3e0fe0443a.js +1 -0
  92. package/.next/static/chunks/1479-1d103a2aa91aa824.js +1 -0
  93. package/.next/static/chunks/1592-67762f29bd458262.js +1 -0
  94. package/.next/static/chunks/2052-31a610cee521cd24.js +1 -0
  95. package/.next/static/chunks/4108.e6f31641845cd071.js +1 -0
  96. package/.next/static/chunks/8322-71eceae9d2259389.js +1 -0
  97. package/.next/static/chunks/app/layout-b254fa87e3c3025e.js +1 -0
  98. package/.next/static/chunks/app/onboarding/page-a540d2a334e61279.js +1 -0
  99. package/.next/static/chunks/app/page-6127cec5577bbdea.js +1 -0
  100. package/.next/static/chunks/app/roots/[id]/chat/[topicId]/page-ce22f38ff1971ce7.js +1 -0
  101. package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-520df769ed074d58.js +1 -0
  102. package/.next/static/chunks/app/roots/[id]/page-667fac103c710695.js +1 -0
  103. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-520200e8c167cb0f.js +1 -0
  104. package/.next/static/chunks/app/roots/new/page-72b4e06184ec3712.js +1 -0
  105. package/.next/static/chunks/app/settings/page-6a441614d14c707d.js +1 -0
  106. package/.next/static/chunks/app/share/[id]/page-10997d1668345672.js +1 -0
  107. package/.next/static/chunks/app/utilities/[scope]/[id]/page-4a33cee7cb9a7bf7.js +1 -0
  108. package/.next/static/chunks/app/utilities/page-df07d2ec05d7743a.js +1 -0
  109. package/.next/static/chunks/{webpack-2b0eab4ccdf44f63.js → webpack-ff7ea73bc08ce1d7.js} +1 -1
  110. package/.next/static/css/60e9b6cdf1283e83.css +1 -0
  111. package/.next/trace +47 -47
  112. package/package.json +1 -2
  113. package/.next/server/chunks/1.js +0 -3
  114. package/.next/server/chunks/2192.js +0 -1
  115. package/.next/server/chunks/6734.js +0 -1
  116. package/.next/server/chunks/7215.js +0 -1
  117. package/.next/server/chunks/9944.js +0 -1
  118. package/.next/static/chunks/1082-326e649fb24d4945.js +0 -1
  119. package/.next/static/chunks/3736-f4e42d6d38be50b0.js +0 -1
  120. package/.next/static/chunks/4108.ca0bdf3cbf3c56cc.js +0 -1
  121. package/.next/static/chunks/7482-7ef26030a10ce14f.js +0 -1
  122. package/.next/static/chunks/8944-c4f2406ecd61094f.js +0 -1
  123. package/.next/static/chunks/9415-eb6b5d4c2de3a7c0.js +0 -1
  124. package/.next/static/chunks/app/layout-85eb1fd21dab0895.js +0 -1
  125. package/.next/static/chunks/app/onboarding/page-2013bd8124b9162e.js +0 -1
  126. package/.next/static/chunks/app/page-558a224e13ffb52c.js +0 -1
  127. package/.next/static/chunks/app/roots/[id]/chat/[topicId]/page-b42f03fd58669d12.js +0 -1
  128. package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-7d17b4e6a5231f56.js +0 -1
  129. package/.next/static/chunks/app/roots/[id]/page-4aab5266f432e37e.js +0 -1
  130. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-1ee3320bf5744efc.js +0 -1
  131. package/.next/static/chunks/app/roots/new/page-df8d2c1f0c64c37a.js +0 -1
  132. package/.next/static/chunks/app/settings/page-fdba798d9e243ad3.js +0 -1
  133. package/.next/static/chunks/app/share/[id]/page-818a451d05e08d26.js +0 -1
  134. package/.next/static/chunks/app/utilities/[scope]/[id]/page-2cee09cc2ab9b5e8.js +0 -1
  135. package/.next/static/chunks/app/utilities/page-44a51522b347f13e.js +0 -1
  136. package/.next/static/css/4b367c1d0fa99b78.css +0 -1
  137. package/packages/utilities/learn-anything/README.md +0 -41
  138. package/packages/utilities/learn-anything/actions/_json.ts +0 -191
  139. package/packages/utilities/learn-anything/actions/_store.ts +0 -248
  140. package/packages/utilities/learn-anything/actions/buildModule.ts +0 -488
  141. package/packages/utilities/learn-anything/actions/explainSelection.ts +0 -65
  142. package/packages/utilities/learn-anything/actions/generateOutline.ts +0 -170
  143. package/packages/utilities/learn-anything/actions/generateQuiz.ts +0 -72
  144. package/packages/utilities/learn-anything/actions/generateTrainer.ts +0 -106
  145. package/packages/utilities/learn-anything/actions/refreshCourseCard.ts +0 -76
  146. package/packages/utilities/learn-anything/actions/tutorAsk.ts +0 -93
  147. package/packages/utilities/learn-anything/article-view.tsx +0 -464
  148. package/packages/utilities/learn-anything/manifest.json +0 -42
  149. package/packages/utilities/learn-anything/ui.tsx +0 -1589
  150. /package/.next/static/{fhVNqfmJl5Mdfhyhg6orp → z5pbSy6TRHko5NGqhD4cn}/_buildManifest.js +0 -0
  151. /package/.next/static/{fhVNqfmJl5Mdfhyhg6orp → z5pbSy6TRHko5NGqhD4cn}/_ssgManifest.js +0 -0
@@ -1,248 +0,0 @@
1
- import { reflex } from "@host/api";
2
-
3
- /**
4
- * Shared course state store. Lives in the utility's `data/` sandbox
5
- * (one JSON file per course at `courses/<courseId>.json`) — bypasses
6
- * the frontmatter round-tripping problem (long JSON strings → multi-line
7
- * YAML → our naive client-side parser drops them). The companion KB
8
- * entry of `kind:"course"` stays for human visibility / provenance
9
- * badges, but it's NOT the source of truth.
10
- *
11
- * The body markdown rendered into the KB entry is regenerated from the
12
- * full state on every write — so editing in a KB viewer would be
13
- * overwritten next save (matches "agent-managed" data model).
14
- */
15
-
16
- export interface CourseState {
17
- courseId: string;
18
- topic: string;
19
- modules: Array<{
20
- id: string;
21
- title: string;
22
- objective: string;
23
- estMinutes: number;
24
- }>;
25
- progress: Record<string, { completed?: boolean; quizScore?: number }>;
26
- wizardAnswers: Array<{ question: string; answer: string }>;
27
- createdAt: string;
28
- /** Bumped on every write to drive list-view re-renders. */
29
- updatedAt: string;
30
- }
31
-
32
- const DIR = "courses";
33
-
34
- export async function writeCourse(state: CourseState): Promise<void> {
35
- const path = `${DIR}/${state.courseId}.json`;
36
- await reflex.fs.write({
37
- path,
38
- content: JSON.stringify(state, null, 2),
39
- });
40
- }
41
-
42
- export async function readCourse(courseId: string): Promise<CourseState | null> {
43
- try {
44
- const { content } = await reflex.fs.read({
45
- path: `${DIR}/${courseId}.json`,
46
- });
47
- return JSON.parse(content) as CourseState;
48
- } catch {
49
- return null;
50
- }
51
- }
52
-
53
- export async function listCourses(): Promise<CourseState[]> {
54
- const out: CourseState[] = [];
55
- try {
56
- const { entries } = await reflex.fs.list({ path: DIR });
57
- for (const e of entries) {
58
- if (e.isDir) continue;
59
- if (!e.name.endsWith(".json")) continue;
60
- const id = e.name.slice(0, -5);
61
- const c = await readCourse(id);
62
- if (c) out.push(c);
63
- }
64
- } catch {
65
- /* dir not created yet → empty list */
66
- }
67
- // Migration fallback: pre-0.2 versions stored course state in KB
68
- // frontmatter (which broke on long multi-line YAML). Pick up anything
69
- // KB has that fs doesn't, hydrate from there, and persist to fs so
70
- // the next open is fast and complete.
71
- try {
72
- const seen = new Set(out.map((c) => c.courseId));
73
- const kb = (await reflex.kb.list({ kind: "course" })) ?? [];
74
- for (const k of kb) {
75
- try {
76
- const { content } = await reflex.kb.read({ relPath: k.relPath });
77
- const fm = parseFrontmatter(content);
78
- const courseId = stringField(fm, "courseId") || baseSlug(k.relPath);
79
- if (!courseId || seen.has(courseId)) continue;
80
- const topic =
81
- stringField(fm, "topic") || k.title || courseId;
82
- const modulesFm = fm?.modules;
83
- // Best-effort: parse JSON-string frontmatter OR rebuild a stub
84
- // outline from the body's "1. **Title** — objective" lines.
85
- const modules =
86
- parseModulesField(modulesFm) ?? parseModulesFromBody(content);
87
- if (modules.length === 0) continue;
88
- const progress =
89
- parseProgressField(fm?.progress) ?? {};
90
- const wizardAnswers =
91
- parseWizardField(fm?.wizardAnswers) ?? [];
92
- const createdAt =
93
- stringField(fm, "createdAt") || k.modifiedAt || new Date().toISOString();
94
- const migrated: CourseState = {
95
- courseId,
96
- topic,
97
- modules,
98
- progress,
99
- wizardAnswers,
100
- createdAt,
101
- updatedAt: new Date().toISOString(),
102
- };
103
- out.push(migrated);
104
- seen.add(courseId);
105
- // Persist so we don't pay the KB scan next time.
106
- await writeCourse(migrated);
107
- } catch {
108
- /* skip malformed entry */
109
- }
110
- }
111
- } catch {
112
- /* kb.list unavailable — fine, just no migration */
113
- }
114
- return out;
115
- }
116
-
117
- // ---------------------------------------------------------------------------
118
- // KB migration helpers — only used by the fallback above.
119
-
120
- function parseFrontmatter(raw: string): Record<string, unknown> | null {
121
- const m = /^---\n([\s\S]*?)\n---/.exec(raw);
122
- if (!m) return null;
123
- const out: Record<string, unknown> = {};
124
- // Crude but tolerant: collect multi-line values when indented or
125
- // explicitly quoted with single quotes. Sufficient for old courses
126
- // that wrapped a long JSON string under a single key.
127
- const lines = m[1]!.split("\n");
128
- let curKey: string | null = null;
129
- let curBuf = "";
130
- const flush = () => {
131
- if (curKey == null) return;
132
- let v = curBuf.trim();
133
- // Strip outer quotes if present.
134
- v = v.replace(/^['"]|['"]$/g, "");
135
- out[curKey] = v;
136
- curKey = null;
137
- curBuf = "";
138
- };
139
- for (const line of lines) {
140
- if (/^\S/.test(line) && line.includes(":")) {
141
- flush();
142
- const i = line.indexOf(":");
143
- curKey = line.slice(0, i).trim();
144
- curBuf = line.slice(i + 1);
145
- } else if (curKey != null) {
146
- curBuf += "\n" + line;
147
- }
148
- }
149
- flush();
150
- return out;
151
- }
152
-
153
- function stringField(fm: Record<string, unknown> | null, key: string): string {
154
- return fm && typeof fm[key] === "string" ? (fm[key] as string) : "";
155
- }
156
-
157
- function parseModulesField(v: unknown): CourseState["modules"] | null {
158
- if (typeof v !== "string") return null;
159
- try {
160
- const parsed = JSON.parse(v);
161
- if (!Array.isArray(parsed)) return null;
162
- return parsed
163
- .filter(
164
- (x): x is { id: string; title: string; objective?: string } =>
165
- x &&
166
- typeof x === "object" &&
167
- typeof (x as { id?: unknown }).id === "string",
168
- )
169
- .map((x) => ({
170
- id: x.id,
171
- title:
172
- typeof (x as { title?: unknown }).title === "string"
173
- ? (x as { title: string }).title
174
- : x.id,
175
- objective:
176
- typeof (x as { objective?: unknown }).objective === "string"
177
- ? (x as { objective: string }).objective
178
- : "",
179
- estMinutes:
180
- typeof (x as { estMinutes?: unknown }).estMinutes === "number"
181
- ? (x as { estMinutes: number }).estMinutes
182
- : 30,
183
- }));
184
- } catch {
185
- return null;
186
- }
187
- }
188
-
189
- function parseProgressField(v: unknown): CourseState["progress"] | null {
190
- if (typeof v !== "string") return null;
191
- try {
192
- const p = JSON.parse(v);
193
- return p && typeof p === "object" ? (p as CourseState["progress"]) : null;
194
- } catch {
195
- return null;
196
- }
197
- }
198
-
199
- function parseWizardField(v: unknown): CourseState["wizardAnswers"] | null {
200
- if (typeof v !== "string") return null;
201
- try {
202
- const p = JSON.parse(v);
203
- return Array.isArray(p) ? (p as CourseState["wizardAnswers"]) : null;
204
- } catch {
205
- return null;
206
- }
207
- }
208
-
209
- function parseModulesFromBody(raw: string): CourseState["modules"] {
210
- // Body shape from old generateOutline: "1. **Title** — objective (~N min)"
211
- const out: CourseState["modules"] = [];
212
- const re = /^\s*(\d+)\.\s+\*\*(.+?)\*\*\s*[—-]\s*(.*?)(?:\s*\(~?(\d+)\s*min\))?$/gm;
213
- let m: RegExpExecArray | null;
214
- while ((m = re.exec(raw))) {
215
- out.push({
216
- id: slug(m[2]!) || `m${m[1]}`,
217
- title: m[2]!,
218
- objective: m[3] ?? "",
219
- estMinutes: m[4] ? Number(m[4]) : 30,
220
- });
221
- }
222
- return out;
223
- }
224
-
225
- function slug(s: string): string {
226
- return s
227
- .normalize("NFKD")
228
- .toLowerCase()
229
- .replace(/[^\p{L}\p{N}]+/gu, "-")
230
- .replace(/^-+|-+$/g, "")
231
- .slice(0, 60);
232
- }
233
-
234
- function baseSlug(rel: string): string {
235
- return (rel.split("/").pop() ?? rel)
236
- .replace(/\.md$/, "")
237
- .replace(/^\d{4}-\d{2}-\d{2}-/, "");
238
- }
239
-
240
- export async function deleteCourse(courseId: string): Promise<void> {
241
- // fs.delete isn't exposed yet; overwrite with empty marker for now.
242
- // Listing skips entries that fail to parse so this effectively hides
243
- // the course until a proper delete RPC ships.
244
- await reflex.fs.write({
245
- path: `${DIR}/${courseId}.json`,
246
- content: "// deleted",
247
- });
248
- }