@circuitwall/jarela 2.5.0 → 2.5.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 (188) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +5 -5
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/react-loadable-manifest.json +2 -2
  6. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  14. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  15. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  17. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  19. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +8 -1
  20. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +8 -1
  22. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +8 -1
  24. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +8 -1
  26. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +8 -1
  28. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +7 -0
  30. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +7 -0
  32. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/v1/credentials/route.js +7 -0
  34. package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +8 -1
  36. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +7 -0
  38. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +7 -0
  40. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +8 -1
  42. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +8 -1
  44. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/v1/events/route.js +8 -1
  46. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +8 -1
  48. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +8 -1
  50. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +8 -1
  52. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +8 -1
  54. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/api/v1/extensions/route.js +8 -1
  56. package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +8 -1
  58. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +8 -1
  60. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +8 -1
  62. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +7 -0
  64. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
  65. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +7 -0
  66. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
  67. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +22 -1
  68. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +22 -1
  69. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +22 -1
  70. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +19 -2
  71. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +19 -2
  72. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +19 -2
  73. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +12 -2
  74. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
  75. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +7 -0
  76. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +7 -0
  78. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +7 -0
  80. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +7 -0
  82. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +7 -0
  84. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
  85. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +12 -2
  86. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
  87. package/.next/standalone/.next/server/app/api/v1/packages/route.js +12 -2
  88. package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
  89. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +8 -1
  90. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
  91. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +7 -0
  92. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +7 -0
  94. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +7 -0
  96. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +8 -1
  98. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +7 -0
  100. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +52 -45
  102. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/v1/tools/route.js +8 -1
  104. package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  106. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +8 -1
  107. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
  108. package/.next/standalone/.next/server/app/api/v1/watchers/route.js +8 -1
  109. package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/page.js +73385 -73375
  111. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  112. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  113. package/.next/standalone/.next/server/app-paths-manifest.json +5 -5
  114. package/.next/standalone/.next/server/chunks/1433.js +1 -1
  115. package/.next/standalone/.next/server/chunks/210.js +6 -6
  116. package/.next/standalone/.next/server/chunks/3524.js +31 -15
  117. package/.next/standalone/.next/server/chunks/3566.js +1 -1
  118. package/.next/standalone/.next/server/chunks/4189.js +1 -1
  119. package/.next/standalone/.next/server/chunks/{9590.js → 423.js} +10 -3
  120. package/.next/standalone/.next/server/chunks/4596.js +5 -2
  121. package/.next/standalone/.next/server/chunks/46.js +7 -0
  122. package/.next/standalone/.next/server/chunks/540.js +29 -5
  123. package/.next/standalone/.next/server/chunks/5585.js +41 -3
  124. package/.next/standalone/.next/server/chunks/5908.js +10 -10
  125. package/.next/standalone/.next/server/chunks/{3399.js → 6058.js} +485 -3
  126. package/.next/standalone/.next/server/chunks/{9164.js → 6190.js} +13828 -13581
  127. package/.next/standalone/.next/server/chunks/{1388.js → 8842.js} +5961 -5793
  128. package/.next/standalone/.next/server/chunks/9032.js +5 -5
  129. package/.next/standalone/.next/server/chunks/{7547.js → 9217.js} +485 -3
  130. package/.next/standalone/.next/server/instrumentation.js +7 -0
  131. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  132. package/.next/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  133. package/.next/standalone/.next/server/middleware.js +7 -0
  134. package/.next/standalone/.next/server/pages/404.html +2 -2
  135. package/.next/standalone/.next/server/pages/500.html +1 -1
  136. package/.next/standalone/.next/server/preview-props.json +3 -3
  137. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  138. package/.next/standalone/.next/static/chunks/app/{page-2ef8d75d40eb4311.js → page-4112e14360a9909e.js} +1291 -1281
  139. package/.next/standalone/.next/static/css/{c160ea862133acd2.css → 5b30046ba49144c5.css} +2 -2
  140. package/.next/standalone/docs/adoption/changesets.json +151 -0
  141. package/.next/standalone/package.json +2 -1
  142. package/CHANGELOG.md +46 -0
  143. package/browser-extension/background.js +5 -539
  144. package/browser-extension/lib/form-editing.mjs +541 -0
  145. package/components/chat/MessageBubble.tsx +4 -736
  146. package/components/chat/MessageContent.tsx +749 -0
  147. package/components/dashboard/DashboardPanel.test.tsx +34 -0
  148. package/components/dashboard/DashboardPanel.tsx +1 -1
  149. package/components/layout/MenuPanel.tsx +1 -1
  150. package/components/ui/BootScreen.test.tsx +1 -0
  151. package/components/ui/BootScreen.tsx +1 -0
  152. package/components/ui/ServerStatus.test.tsx +50 -0
  153. package/components/ui/ServerStatus.tsx +10 -8
  154. package/hooks/useSSE.test.ts +46 -0
  155. package/lib/agents/llm.ts +1 -1
  156. package/lib/agents/output-validator/validator.test.ts +4 -0
  157. package/lib/agents/output-validator/validator.ts +1 -1
  158. package/lib/agents/prompt-registry.test.ts +11 -0
  159. package/lib/agents/prompt-registry.ts +13 -0
  160. package/lib/agents/retry-prompts.ts +17 -0
  161. package/lib/agents/run-retry.ts +671 -0
  162. package/lib/agents/run-thread.retry.test.ts +176 -2
  163. package/lib/agents/run-thread.test.ts +6 -6
  164. package/lib/agents/run-thread.ts +9 -717
  165. package/lib/agents/stream-collector.test.ts +28 -4
  166. package/lib/agents/stream-collector.ts +5 -28
  167. package/lib/agents/tool-outcomes.ts +61 -0
  168. package/lib/documents/remote/confluence.test.ts +65 -0
  169. package/lib/documents/remote/confluence.ts +35 -9
  170. package/lib/documents/remote/jira.ts +1 -1
  171. package/lib/health/probes.test.ts +32 -0
  172. package/lib/health/probes.ts +29 -14
  173. package/lib/integrations/atlassian/manifest.ts +5 -3
  174. package/lib/integrations/github/manifest.ts +7 -4
  175. package/lib/integrations/gmail-oauth.ts +16 -1
  176. package/lib/integrations/microsoft-oauth.ts +17 -2
  177. package/lib/integrations/outlook/manifest.ts +10 -8
  178. package/lib/stores/integrations.ts +1 -0
  179. package/lib/tools/communications/calendar-aliases.test.ts +77 -1
  180. package/lib/tools/communications/gmail.test.ts +13 -0
  181. package/lib/tools/communications/ms-graph.test.ts +26 -3
  182. package/lib/tools/communications/ms-graph.ts +9 -11
  183. package/lib/tools/communications/outlook-calendar.ts +94 -17
  184. package/lib/tools/packages/default-packages/atlassian.ts +8 -2
  185. package/package.json +2 -1
  186. package/scripts/standalone-footprint.mjs +1 -1
  187. /package/.next/standalone/.next/static/{544OFJV-q0RC6Gjgje4LT → VZXMorlOmSmi3dUr7K5UX}/_buildManifest.js +0 -0
  188. /package/.next/standalone/.next/static/{544OFJV-q0RC6Gjgje4LT → VZXMorlOmSmi3dUr7K5UX}/_ssgManifest.js +0 -0
@@ -0,0 +1,34 @@
1
+ // @vitest-environment jsdom
2
+ import { render, screen } from "@testing-library/react";
3
+ import { expect, it, vi } from "vitest";
4
+ import { DashboardPanel } from "./DashboardPanel";
5
+
6
+ vi.mock("./useDashboardData", () => ({
7
+ useDashboardData: () => ({ days: 30, loading: true, data: null }),
8
+ }));
9
+ vi.mock("./useCurrencyPreference", () => ({
10
+ useCurrencyPreference: () => ({
11
+ currencyInfo: { currency: "USD", source: "default" },
12
+ currencyMode: "auto",
13
+ manualCurrency: "USD",
14
+ }),
15
+ }));
16
+
17
+ it("provides dashboard colors from the current application theme", () => {
18
+ const { container } = render(<DashboardPanel />);
19
+ const dashboard = container.firstElementChild!;
20
+ const tokens = {
21
+ "bg-primary": "surface",
22
+ "bg-secondary": "surface-2",
23
+ "text-primary": "fg",
24
+ "text-secondary": "fg-muted",
25
+ border: "border",
26
+ accent: "accent",
27
+ };
28
+
29
+ for (const [name, token] of Object.entries(tokens)) {
30
+ expect(dashboard.classList.contains(`[--${name}:var(--color-${token})]`)).toBe(true);
31
+ }
32
+ expect(dashboard.contains(screen.getByRole("heading", { name: "Usage dashboard" }))).toBe(true);
33
+ expect(dashboard.contains(screen.getByText("Loading dashboard metrics..."))).toBe(true);
34
+ });
@@ -52,7 +52,7 @@ export function DashboardPanel() {
52
52
  const toggleDay = (day: string) => setSelectedDay((prev) => (prev === day ? null : day));
53
53
 
54
54
  return (
55
- <div className="relative h-full overflow-y-auto p-4 md:p-6 space-y-4">
55
+ <div className="relative h-full overflow-y-auto p-4 md:p-6 space-y-4 [--bg-primary:var(--color-surface)] [--bg-secondary:var(--color-surface-2)] [--text-primary:var(--color-fg)] [--text-secondary:var(--color-fg-muted)] [--border:var(--color-border)] [--accent:var(--color-accent)]">
56
56
  <div className="mx-auto max-w-7xl space-y-4">
57
57
  <div className="dashboard-atmosphere pointer-events-none absolute inset-0 overflow-hidden">
58
58
  <div className="absolute -top-20 -right-20 w-72 h-72 rounded-full bg-cyan-500/10 blur-3xl" />
@@ -289,7 +289,7 @@ export function MenuPanel({
289
289
 
290
290
  return (
291
291
  <div
292
- className="glass-elevated fixed right-0 bottom-0 w-full sm:w-[26rem] max-w-full border-l border-border/60 z-40 flex flex-col pb-safe"
292
+ className="glass-elevated fixed right-0 bottom-0 w-full sm:w-[26rem] max-w-full border-l border-border/60 z-[60] flex flex-col pb-safe"
293
293
  style={{ top: "calc(3rem + var(--app-safe-top))" }}
294
294
  >
295
295
  {/* Common navigation — the day-to-day surface. */}
@@ -33,6 +33,7 @@ it("does not restart boot prefetch after dismissal when the agent changes", asyn
33
33
  const { rerender, container } = render(
34
34
  <BootScreen agents={[]} agentsLoaded activeAgentId="first" onPickAgent={onPickAgent} />,
35
35
  );
36
+ expect(container.querySelector('[data-testid="boot-screen"]')?.getAttribute("role")).toBe("status");
36
37
  await act(async () => {});
37
38
  await act(async () => { await vi.advanceTimersByTimeAsync(750); });
38
39
  expect(container.innerHTML).toBe("");
@@ -403,6 +403,7 @@ export function BootScreen({ agents, agentsLoaded, activeAgentId, preferredThrea
403
403
 
404
404
  return (
405
405
  <div
406
+ data-testid="boot-screen"
406
407
  role="status"
407
408
  aria-live="polite"
408
409
  aria-hidden={dismissing}
@@ -0,0 +1,50 @@
1
+ // @vitest-environment jsdom
2
+ import { act, render, screen } from "@testing-library/react";
3
+ import { afterEach, expect, it, vi } from "vitest";
4
+ import { ServerStatus } from "./ServerStatus";
5
+
6
+ vi.mock("@/api/runtime-config", () => ({
7
+ runtimeConfig: () => ({ healthCheckTimeoutMs: 5_000 }),
8
+ }));
9
+
10
+ afterEach(() => {
11
+ vi.useRealTimers();
12
+ vi.unstubAllGlobals();
13
+ });
14
+
15
+ it("shows launch progress until the server responds", async () => {
16
+ let respond!: (response: Response) => void;
17
+ vi.stubGlobal("fetch", vi.fn(() => new Promise<Response>((resolve) => { respond = resolve; })));
18
+ const { container } = render(<ServerStatus />);
19
+ expect(screen.getByRole("status").textContent).toContain("Launching Jarela");
20
+ expect(screen.queryByRole("button", { name: "Reload now" })).toBeNull();
21
+ await act(async () => { respond(new Response(null, { status: 200 })); });
22
+ expect(container.innerHTML).toBe("");
23
+ });
24
+
25
+ it("keeps launch progress during retries, then reports a persistent failure", async () => {
26
+ vi.useFakeTimers();
27
+ const fetch = vi.fn().mockRejectedValue(new TypeError("Failed to fetch"));
28
+ vi.stubGlobal("fetch", fetch);
29
+ render(<ServerStatus />);
30
+ await act(async () => {});
31
+ expect(screen.getByRole("status").textContent).toContain("Launching Jarela");
32
+ await act(async () => { await vi.advanceTimersByTimeAsync(3_000); });
33
+ expect(screen.getByRole("status").textContent).toContain("Launching Jarela");
34
+ await act(async () => { await vi.advanceTimersByTimeAsync(3_000); });
35
+ expect(fetch).toHaveBeenCalledTimes(3);
36
+ expect(screen.getByRole("status").textContent).toContain("Server unavailable");
37
+ expect(screen.getByRole("button", { name: "Reload now" })).toBeTruthy();
38
+ expect(screen.queryByText("Failed to fetch")).toBeNull();
39
+ });
40
+
41
+ it("does not show launch progress for a transient failure after startup", async () => {
42
+ vi.useFakeTimers();
43
+ vi.stubGlobal("fetch", vi.fn()
44
+ .mockResolvedValueOnce(new Response(null, { status: 200 }))
45
+ .mockRejectedValueOnce(new TypeError("Failed to fetch")));
46
+ const { container } = render(<ServerStatus />);
47
+ await act(async () => {});
48
+ await act(async () => { await vi.advanceTimersByTimeAsync(20_000); });
49
+ expect(container.innerHTML).toBe("");
50
+ });
@@ -36,6 +36,7 @@ async function ping(): Promise<boolean> {
36
36
  }
37
37
 
38
38
  export function ServerStatus() {
39
+ const [launching, setLaunching] = useState(true);
39
40
  const [down, setDown] = useState(false);
40
41
  const wasDownRef = useRef(false);
41
42
  const failureCountRef = useRef(0);
@@ -61,6 +62,7 @@ export function ServerStatus() {
61
62
  return;
62
63
  }
63
64
  failureCountRef.current = 0;
65
+ setLaunching(false);
64
66
  if (wasDownRef.current) {
65
67
  // Server recovered after the overlay actually showed — full reload
66
68
  // to drop any stale in-memory state (EventSource queues, agent
@@ -89,27 +91,27 @@ export function ServerStatus() {
89
91
  };
90
92
  }, []);
91
93
 
92
- if (!down) return null;
94
+ if (!launching && !down) return null;
93
95
 
94
96
  return (
95
- <div className="fixed inset-0 z-[100] flex items-center justify-center bg-black/50 backdrop-blur-sm">
97
+ <div role="status" aria-live="polite" className="fixed inset-0 z-[100] flex items-center justify-center bg-black/50 backdrop-blur-sm">
96
98
  <div className="mx-4 max-w-sm w-full flex flex-col items-center gap-3 rounded-xl border border-border bg-surface text-fg px-6 py-5 text-center shadow-lg">
97
- <CloudOff size={28} className="text-amber-500" />
98
- <div className="text-sm font-medium">Server unavailable</div>
99
+ {down ? <CloudOff size={28} className="text-amber-500" /> : <Loader2 size={28} className="animate-spin text-fg-muted" />}
100
+ <div className="text-sm font-medium">{down ? "Server unavailable" : "Launching Jarela"}</div>
99
101
  <div className="text-xs text-fg-muted">
100
- Lost connection to Jarela. Retrying…
102
+ {down ? "Cannot connect to Jarela. Retrying..." : "Waiting for the local server..."}
101
103
  </div>
102
104
  <div className="flex items-center gap-2 text-xs text-fg-subtle">
103
105
  <Loader2 size={14} className="animate-spin" />
104
- <span>Reconnecting</span>
106
+ <span>{down ? "Reconnecting" : "Starting up"}</span>
105
107
  </div>
106
- <button
108
+ {down && <button
107
109
  type="button"
108
110
  onClick={() => window.location.reload()}
109
111
  className="mt-1 text-xs underline text-fg-subtle hover:text-fg"
110
112
  >
111
113
  Reload now
112
- </button>
114
+ </button>}
113
115
  </div>
114
116
  </div>
115
117
  );
@@ -110,6 +110,52 @@ describe("useSSE contract", () => {
110
110
  expect(result.current.streamingContent).not.toContain("flagged reply");
111
111
  });
112
112
 
113
+ it.each(["success", "failure"])("keeps the comparison visible while correction is pending (%s)", async (outcome) => {
114
+ const table = "| Option | Cost |\n| --- | --- |\n| A | 10 |\n| B | 20 |\n| C | 30 |\n| D | 40 |\n| E | 50 |";
115
+ const draft = `${table}\nI saved the comparison.`;
116
+ const corrected = `${table}\nThe comparison has not been saved.`;
117
+ let release!: () => void;
118
+ const gate = new Promise<void>((resolve) => { release = resolve; });
119
+ subscribeRunMock.mockReturnValue({
120
+ async *[Symbol.asyncIterator]() {
121
+ yield JSON.stringify({ type: "text_delta", delta: draft });
122
+ yield JSON.stringify({ type: "tool_call", id: "read-1", name: "memory_read", arguments: {} });
123
+ yield JSON.stringify({ type: "tool_result", id: "read-1", name: "memory_read", result: null });
124
+ yield JSON.stringify({ type: "status", label: "Checking answer..." });
125
+ await gate;
126
+ if (outcome === "failure") {
127
+ yield JSON.stringify({ type: "error", code: "correction_failed", message: "Correction failed; draft remains unverified." });
128
+ return;
129
+ }
130
+ yield JSON.stringify({ type: "reset_text" });
131
+ yield JSON.stringify({ type: "text_delta", delta: corrected });
132
+ yield JSON.stringify({ type: "done" });
133
+ },
134
+ });
135
+ submitRunMock.mockResolvedValue({ accepted: true });
136
+ const onDone = vi.fn();
137
+ const { result } = renderHook(() => useSSE(onDone));
138
+ let run!: Promise<{ accepted: boolean }>;
139
+ try {
140
+ act(() => { run = result.current.start("comparison-thread", "Compare five options."); });
141
+ await waitFor(() => expect(result.current.streamingContent).toBe(draft));
142
+ expect(result.current.streaming).toBe(true);
143
+ expect(onDone).not.toHaveBeenCalled();
144
+ expect(result.current.toolEvents).toHaveLength(2);
145
+
146
+ await act(async () => { release(); await run; });
147
+ expect(result.current.streaming).toBe(false);
148
+ expect(result.current.streamingContent).toBe(outcome === "success" ? corrected : draft);
149
+ expect(result.current.streamingContent).toContain(table);
150
+ expect(onDone).toHaveBeenCalledTimes(1);
151
+ expect(result.current.toolEvents).toHaveLength(2);
152
+ expect(result.current.error).toBe(outcome === "failure" ? "Correction failed; draft remains unverified." : null);
153
+ } finally {
154
+ release();
155
+ await act(async () => { await run; });
156
+ }
157
+ });
158
+
113
159
  it("records tool_progress events alongside tool_call/tool_result (ADR-0073)", async () => {
114
160
  submitRunMock.mockResolvedValue({ accepted: true });
115
161
  subscribeRunMock.mockReturnValue(streamWithProgress());
package/lib/agents/llm.ts CHANGED
@@ -450,7 +450,7 @@ async function* streamWithConfigImpl(
450
450
  }
451
451
  yield {
452
452
  type: "tool_result",
453
- data: { id: chunk.tool_call_id, name: chunk.name ?? "", result },
453
+ data: { id: chunk.tool_call_id, name: chunk.name ?? "", result, status: chunk.status },
454
454
  };
455
455
  // Next AI text should be visually separated from the pre-tool prose.
456
456
  needsParagraphBreak = true;
@@ -206,6 +206,10 @@ describe("validateAssistantOutput", () => {
206
206
  });
207
207
 
208
208
  describe("summary_without_action", () => {
209
+ it("allows an ordinary summary that makes no action claim", () => {
210
+ expect(validateAssistantOutput("## Summary\nOption A costs 10 units; option B costs 20 units.", [], [])).toEqual({ ok: true });
211
+ });
212
+
209
213
  it("flags 'Summary of changes' in zero-tool turn", () => {
210
214
  const r = validateAssistantOutput(
211
215
  "## Summary of changes\nI made the following edits...",
@@ -4,7 +4,7 @@ import type { ValidationResult } from "./types";
4
4
  import { isWriteToolNameSegment } from "@/lib/agents/action-vocabulary";
5
5
 
6
6
  const SUMMARY_PATTERNS: RegExp[] = [
7
- /^#{1,6}\s*Summary(?:\s+of\s+changes)?\b/im,
7
+ /^#{1,6}\s*Summary\s+of\s+changes\b/im,
8
8
  /\bI(?:'ve|\s+have)\s+completed\b/i,
9
9
  /\bWhat\s+I\s+did\b/i,
10
10
  ];
@@ -137,6 +137,7 @@ describe("prompt registry coverage", () => {
137
137
  "lib/agents/prepare/system-prompt.ts",
138
138
  "lib/agents/harness/presets.ts",
139
139
  "lib/lifecycle/system-signals.ts",
140
+ "lib/agents/retry-prompts.ts",
140
141
  ];
141
142
  for (const source of declaring) {
142
143
  expect(registered, `${source} declares a prompt but is not in prompt-registry.ts`).toContain(source);
@@ -159,6 +160,16 @@ describe("prompt registry coverage", () => {
159
160
  }
160
161
  });
161
162
 
163
+ it("requires correction retries to preserve the complete answer", () => {
164
+ for (const id of ["agent.retry-fabrication", "agent.retry-citation"]) {
165
+ const prompt = staticPrompts.find((entry) => entry.id === id)?.text ?? "";
166
+ expect(prompt).toContain("complete corrected answer to the original user request");
167
+ expect(prompt).toContain("Preserve all valid explanations, calculations, tables, and conclusions");
168
+ expect(prompt).toContain("Do not return only a correction or a tool confirmation");
169
+ expect(prompt).not.toContain("Do NOT restate");
170
+ }
171
+ });
172
+
162
173
  it("keeps prompt ids unique", () => {
163
174
  const ids = staticPrompts.map((p) => p.id);
164
175
  expect(new Set(ids).size).toBe(ids.length);
@@ -19,6 +19,7 @@ import { SYSTEM_SIGNAL_WAKE_PROMPT } from "@/lib/lifecycle/system-signals";
19
19
  import { buildConversationSummaryMessages, type SummaryTopicSegment } from "@/lib/agents/conversation-summary";
20
20
  import { buildTopicGroupingMessages, buildTopicRecapMessages } from "@/lib/agents/compaction-pipeline";
21
21
  import type { ProviderMessage } from "@/lib/providers/types";
22
+ import { buildFabricationNudge, buildCitationRetryNudge } from "./retry-prompts";
22
23
 
23
24
  export interface StaticPrompt {
24
25
  id: string;
@@ -57,6 +58,18 @@ export function listStaticPrompts(): StaticPrompt[] {
57
58
  const channelGroup = renderMessages(buildTopicGroupingMessages(sampleNewMessages, [sampleTopic], "scheduled_task"));
58
59
  const channelRecap = renderMessages(buildTopicRecapMessages({ title: sampleTopic.title, continues: "t1", seqs: [50, 51] }, sampleTopic, sampleNewMessages, "scheduled_task"));
59
60
  const prompts: StaticPrompt[] = [
61
+ {
62
+ id: "agent.retry-fabrication",
63
+ source: "lib/agents/retry-prompts.ts",
64
+ purpose: "Repairs an unsupported action claim while retaining the complete substantive answer.",
65
+ text: buildFabricationNudge("Example action claim has no confirmed tool result"),
66
+ },
67
+ {
68
+ id: "agent.retry-citation",
69
+ source: "lib/agents/retry-prompts.ts",
70
+ purpose: "Repairs unsupported citations while retaining the complete substantive answer.",
71
+ text: buildCitationRetryNudge([{ text: "Example claim", reason: "No verified source" }]),
72
+ },
60
73
  {
61
74
  id: "agent.system-signal-wakeup",
62
75
  source: "lib/lifecycle/system-signals.ts",
@@ -0,0 +1,17 @@
1
+ export interface CitationRepairClaim {
2
+ text: string;
3
+ reason: string;
4
+ }
5
+
6
+ const COMPLETE_ANSWER_REPAIR = "Return a complete corrected answer to the original user request. Preserve all valid explanations, calculations, tables, and conclusions. Correct unsupported action claims: call the missing tool if the user authorized that action, or state honestly that it was not performed. Do not return only a correction or a tool confirmation. Your completed answer will replace the draft; the user must not lose the substantive answer.";
7
+
8
+ export function buildFabricationNudge(reason: string): string {
9
+ return `\u21bb Auto-retry: output validator flagged your reply${reason ? ` \u2014 ${reason}` : ""}. ${COMPLETE_ANSWER_REPAIR}`;
10
+ }
11
+
12
+ export function buildCitationRetryNudge(claims: readonly CitationRepairClaim[]): string {
13
+ const details = claims.slice(0, 5).map((claim, index) =>
14
+ ` ${index + 1}. ${claim.text}${claim.reason ? ` \u2014 ${claim.reason}` : ""}`,
15
+ ).join("\n");
16
+ return `\u21bb Auto-retry: the citation audit flagged ${claims.length} high-impact claim${claims.length === 1 ? "" : "s"} without a verified source:\n${details}\n\nFix each claim in exactly ONE of these three ways:\n (a) cite an existing source from the manifest by appending the marker \`[N]\` to the claim,\n (b) call a tool now (file_read, web_search, fetch_webpage, memory_read) to actually ground the claim before stating it,\n (c) rephrase plainly: drop the specific number/fact, or say "I don't have a source for this" so the claim is no longer load-bearing.\n\n${COMPLETE_ANSWER_REPAIR} Do NOT invent a marker number that isn't in the manifest.`;
17
+ }