@ezychat/web 0.1.83 → 0.1.85

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 (47) hide show
  1. package/dist-lib/assets/font-9f04f14429bb.woff2 +0 -0
  2. package/dist-lib/chunks/{admin-D4nMrYTV.js → admin-BDciacjd.js} +78 -59
  3. package/dist-lib/chunks/{admin-SGy97Cay.js → admin-Bcel7ZqO.js} +78 -59
  4. package/dist-lib/chunks/{common-CBTam36M.js → common-BAoxGts5.js} +36 -3
  5. package/dist-lib/chunks/{common-BE996sRJ.js → common-C3KIPASu.js} +36 -3
  6. package/dist-lib/chunks/{inbox-iKAC249b.js → inbox-HnJhomm8.js} +115 -61
  7. package/dist-lib/chunks/{inbox-DB-xoUgi.js → inbox-wUMY4TKD.js} +115 -61
  8. package/dist-lib/ezychat-web.css +1 -1
  9. package/dist-lib/index.js +10703 -7953
  10. package/dist-lib/types/admin/AdminLayout.d.ts +21 -5
  11. package/dist-lib/types/admin/AgentDreamCard.d.ts +9 -0
  12. package/dist-lib/types/admin/AgentResolutionCard.d.ts +1 -1
  13. package/dist-lib/types/admin/AskEzySettingsSection.d.ts +5 -0
  14. package/dist-lib/types/admin/DreamChangeDialog.d.ts +14 -0
  15. package/dist-lib/types/admin/HiddenChats.d.ts +16 -0
  16. package/dist-lib/types/admin/ReportsPage.d.ts +6 -0
  17. package/dist-lib/types/admin/connectors/ConnectorDetailPage.d.ts +1 -1
  18. package/dist-lib/types/admin/connectors/GitHubAccountCard.d.ts +8 -0
  19. package/dist-lib/types/admin/connectors/GitHubSettingsCard.d.ts +4 -0
  20. package/dist-lib/types/admin/connectors/catalog.d.ts +6 -6
  21. package/dist-lib/types/api/ai.d.ts +3 -0
  22. package/dist-lib/types/api/chat-delete.d.ts +16 -0
  23. package/dist-lib/types/api/chat-hide.d.ts +21 -0
  24. package/dist-lib/types/api/connectors.d.ts +128 -0
  25. package/dist-lib/types/api/dream.d.ts +91 -0
  26. package/dist-lib/types/api/queries.d.ts +16 -1
  27. package/dist-lib/types/api/scheduled-tasks.d.ts +6 -6
  28. package/dist-lib/types/askezy/AskEzyBlocks.d.ts +15 -0
  29. package/dist-lib/types/askezy/AskEzySetupBlocks.d.ts +31 -0
  30. package/dist-lib/types/askezy/api.d.ts +13 -1
  31. package/dist-lib/types/auth/LoginPage.d.ts +1 -0
  32. package/dist-lib/types/auth/UserMenu.d.ts +2 -0
  33. package/dist-lib/types/extensions/index.d.ts +1 -1
  34. package/dist-lib/types/extensions/routes.d.ts +3 -1
  35. package/dist-lib/types/i18n/resources.d.ts +350 -8
  36. package/dist-lib/types/inbox/ConversationHeader.d.ts +3 -1
  37. package/dist-lib/types/inbox/DeleteChatDialog.d.ts +12 -0
  38. package/dist-lib/types/lib/random-id.d.ts +8 -0
  39. package/dist-lib/types/lib/tips.d.ts +1 -1
  40. package/dist-lib/types/lib/version.d.ts +4 -0
  41. package/dist-lib/types/lite-import/steps.d.ts +7 -2
  42. package/dist-lib/types/nav/AccountPage.d.ts +2 -0
  43. package/dist-lib/types/nav/AppNav.d.ts +10 -0
  44. package/dist-lib/types/nav/PhoneBar.d.ts +14 -0
  45. package/dist-lib/types/nav/attention.d.ts +4 -0
  46. package/package.json +11 -10
  47. package/dist-lib/types/askezy/AskEzyButton.d.ts +0 -8
@@ -1,5 +1,4 @@
1
1
  import { type LucideIcon } from 'lucide-react';
2
- import { type WebExtension, type WebExtensionAdminSection } from '../extensions';
3
2
  /**
4
3
  * Every core admin section. `labelKey` is a translation key in the `admin` namespace. WhatsApp and
5
4
  * Inboxes never show together: see `visibleAdminNav`.
@@ -51,11 +50,28 @@ export type AdminNavItem = (typeof ADMIN_NAV)[number];
51
50
  * one WhatsApp number (Lite allows one, so it keeps WhatsApp).
52
51
  */
53
52
  export declare function visibleAdminNav(multiInbox: boolean): AdminNavItem[];
54
- /** The core section an extension admin route declares for this path (e.g. `members`). */
55
- export declare function extensionSectionOf(extensions: readonly WebExtension[], pathname: string): WebExtensionAdminSection | undefined;
56
53
  /**
57
- * Admin shell. Side nav on >= md; on phones a top bar with a Sheet menu.
58
- * Mounted by App.tsx at `/admin/*`; non-admins are redirected to `/`.
54
+ * The groups of the phone Settings list. A section in no group (a new `ADMIN_NAV` entry) is returned as
55
+ * `ungrouped` and shows under More: phones have no other menu. Reports is left out (it has its own tab).
56
+ */
57
+ export declare function settingsHomeGroups<T extends {
58
+ to: string;
59
+ }>(nav: readonly T[]): {
60
+ groups: readonly [{
61
+ readonly titleKey: "common:appNav.team";
62
+ readonly items: T[];
63
+ }, {
64
+ readonly titleKey: "common:appNav.business";
65
+ readonly items: T[];
66
+ }, {
67
+ readonly titleKey: "common:appNav.app";
68
+ readonly items: T[];
69
+ }];
70
+ ungrouped: T[];
71
+ };
72
+ /**
73
+ * Admin area inside the app shell (rail on desktop, bottom tabs on phones). Reports and Members are full-width rail
74
+ * places; every other admin page keeps the Settings side menu on desktop. Non-admins are redirected to `/`.
59
75
  */
60
76
  export declare function AdminLayout(): import("react").JSX.Element;
61
77
  export default AdminLayout;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Agent page → Dream mode (design docs/superpowers/specs/2026-11-14-dream-mode-design.md, confirmed quick mock
3
+ * docs/features/dream-mode/mock): the switch, the nightly time, Apply by itself, and the history of nights with each
4
+ * change's state and actions. Settings save at once, like the other agent switches.
5
+ */
6
+ export declare function AgentDreamCard({ agentId, name }: Readonly<{
7
+ agentId: number;
8
+ name: string;
9
+ }>): import("react").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Agent page → "Ask if the question is answered": on, the agent ends an answer with a resolution
3
3
  * question and may close the chat on a clear "yes"; off (sales default), it adds no check-in line
4
- * and never closes a chat. Saves at once, like the Groups switch.
4
+ * and closes a chat only on a plain "thanks" (with a 👍). Saves at once, like the Groups switch.
5
5
  */
6
6
  export declare function AgentResolutionCard({ agentId, name, enabled, }: Readonly<{
7
7
  agentId: number;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Settings → AI: how long Ask Ezy may work on one question (5, 10, 15 or 30 minutes; default 15). Customer
3
+ * replies keep their own limit; the person can always press Stop in the panel.
4
+ */
5
+ export declare function AskEzySettingsSection(): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import type { DreamChange } from '@ezychat/shared';
2
+ import { type DreamAction } from '../api/dream';
3
+ /**
4
+ * Dream mode → See change: the old and the new text, the team replies (and the customer questions) it came from,
5
+ * read live from the chat, and the checks it passed. A waiting change can be applied or dismissed here.
6
+ */
7
+ export declare function DreamChangeDialog({ agentId, change, when, busy, onAction, onClose, }: Readonly<{
8
+ agentId: number;
9
+ change: DreamChange;
10
+ when: string;
11
+ busy: boolean;
12
+ onAction: (action: DreamAction) => void;
13
+ onClose: () => void;
14
+ }>): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import type { HiddenChatsInfo } from '@ezychat/shared';
2
+ /**
3
+ * Hide chats on Log out (docs/features/chat-hide-delete/design.md Part A): the texts Admin → WhatsApp
4
+ * and Admin → Inboxes show around a Log out.
5
+ */
6
+ /**
7
+ * The Log out (or Link again) confirmation's line: how many chats leave the inbox. Without counts yet
8
+ * it says so without a number; with no chat to hide it says nothing.
9
+ */
10
+ export declare function HidesLine({ info }: Readonly<{
11
+ info: HiddenChatsInfo | undefined;
12
+ }>): import("react").JSX.Element | null;
13
+ /** The logged-out note: the chats of the old number are hidden until that number links again. */
14
+ export declare function HiddenChatsNote({ info }: Readonly<{
15
+ info: HiddenChatsInfo | undefined;
16
+ }>): import("react").JSX.Element | null;
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ import type { ReportTotals } from '@ezychat/shared';
2
3
  /**
3
4
  * Admin → Reports (design: docs/features/reports/design.md): how busy the WhatsApp numbers are
4
5
  * (busy days, busy times, new customers) and how fast the team and the AI answer, for 7, 30 or 90
@@ -6,6 +7,11 @@ import type React from 'react';
6
7
  * WhatsApp numbers the admin sees them all together or picks one.
7
8
  */
8
9
  export declare function ReportsPage(): React.JSX.Element;
10
+ /**
11
+ * Whole percent of closed AI chats the AI completed; null when none closed. Never rounds to 100 % while the team
12
+ * helped in one, or to 0 % while the AI completed one, so the headline never contradicts the parts below it.
13
+ */
14
+ export declare function completionRate(totals: ReportTotals): number | null;
9
15
  /** The two hours in a row with the most messages from customers; null when there are none. */
10
16
  export declare function busiestBlock(hours: number[][]): {
11
17
  wd: number;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `/admin/connectors/:id`: one page per connector. The app's own connectors come first: Google
3
3
  * Calendar has Overview (what it does, the Google account, your data), Settings (per AI agent),
4
- * Activity and Bookings tabs (`?tab=`, `&agent=`); Google Sheets and Google Drive the same without Bookings;
4
+ * Activity and Bookings tabs (`?tab=`, `&agent=`); Google Sheets, Google Drive and GitHub (Lite only) the same without Bookings;
5
5
  * SQL Account has Overview, Connection, Settings, Customers and Activity; the custom connector needs Enterprise. Every
6
6
  * other page is built from the connector's entry in the connector list. A connector an extension
7
7
  * provides opens the extension's page.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The GitHub sign-in (one per install, design docs/features/github/design.md): Sign in with
3
+ * GitHub (Anchor Sprint's GitHub App, through GitHub's device flow) or a fine-grained token; the
4
+ * install step, the token expiry, problems and Disconnect. Repositories per agent are on Settings.
5
+ */
6
+ export declare function GitHubAccountCard({ onOpenSettings }: Readonly<{
7
+ onOpenSettings?: () => void;
8
+ }>): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /** GitHub Settings tab: sign in first (and install the App), then one AI agent at a time. */
2
+ export declare function GitHubSettingsTab({ onConnect }: Readonly<{
3
+ onConnect: () => void;
4
+ }>): import("react").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import { type LucideIcon } from 'lucide-react';
2
- import type { ConnectorEntry, GoogleCalendarState, SqlAccountState } from '@ezychat/shared';
2
+ import type { ConnectorEntry, GitHubState, GoogleCalendarState, SqlAccountState } from '@ezychat/shared';
3
3
  /**
4
4
  * Admin → Connectors: what the app itself provides next to the connector list (design
5
5
  * docs/features/connector-list/design.md). The list (server, `GET /api/connectors/list`) gives
6
6
  * every partner and coming-soon connector; the app keeps only its own features here: the built-in
7
- * Google Calendar, Google Sheets, Google Drive and SQL Account (their pages and tabs live in the app) and the custom MCP connector (Enterprise,
7
+ * Google Calendar, Google Sheets, Google Drive, SQL Account and GitHub (their pages and tabs live in the app) and the custom MCP connector (Enterprise,
8
8
  * linked by its web extension through `connectorLinks`). Texts are catalog keys under
9
9
  * `connectors.items.<id>` and `connectors.tools.<tool>` (admin namespace).
10
10
  */
@@ -14,9 +14,9 @@ export type ConnectorCategory = (typeof CONNECTOR_CATEGORIES)[number];
14
14
  export declare const LIST_CATEGORY: Record<ConnectorEntry['category'], ConnectorCategory>;
15
15
  /** The icon of a list entry without its own icon file. */
16
16
  export declare const CATEGORY_ICON: Record<ConnectorCategory, LucideIcon>;
17
- /** What the AI may do with the built-in Google Calendar, Google Sheets and Google Drive. */
18
- export type ConnectorTool = 'checkFree' | 'book' | 'readRows' | 'addLead' | 'save' | 'find' | 'read';
19
- export declare const CONNECTOR_IDS: readonly ["google-calendar", "google-sheets", "sql-account", "google-drive", "custom-mcp"];
17
+ /** What the AI may do with the built-in Google Calendar, Google Sheets, Google Drive and GitHub. */
18
+ export type ConnectorTool = 'checkFree' | 'book' | 'readRows' | 'addLead' | 'save' | 'find' | 'read' | 'searchIssues' | 'listIssues' | 'readIssue' | 'searchPulls';
19
+ export declare const CONNECTOR_IDS: readonly ["google-calendar", "google-sheets", "sql-account", "google-drive", "github", "custom-mcp"];
20
20
  export type ConnectorId = (typeof CONNECTOR_IDS)[number];
21
21
  export interface CatalogConnector {
22
22
  id: ConnectorId;
@@ -42,4 +42,4 @@ export type ConnectorStatus = 'connected' | 'attention' | 'notConnected' | 'comi
42
42
  * `state`: the connection state of this connector (Google Calendar's, Sheets' or Drive's sign-in, or
43
43
  * SQL Account's connection).
44
44
  */
45
- export declare function connectorStatus(c: CatalogConnector, state: GoogleCalendarState | SqlAccountState | undefined, extensionLink: string | undefined): ConnectorStatus;
45
+ export declare function connectorStatus(c: CatalogConnector, state: GoogleCalendarState | SqlAccountState | GitHubState | undefined, extensionLink: string | undefined): ConnectorStatus;
@@ -122,6 +122,9 @@ export declare function useAiTry(): import("@tanstack/react-query").UseMutationR
122
122
  drive?: {
123
123
  action: "saved";
124
124
  } | undefined;
125
+ silent?: {
126
+ kind: "no_reply" | "finished";
127
+ } | undefined;
125
128
  notRun?: boolean | undefined;
126
129
  }[] | undefined;
127
130
  }, Error, {
@@ -0,0 +1,16 @@
1
+ import { type QueryClient } from '@tanstack/react-query';
2
+ /**
3
+ * Delete chat (admins, docs/features/chat-hide-delete/design.md Part B): the chat, its messages,
4
+ * notes and files go for good in EzyChat; the WhatsApp phone keeps its copy.
5
+ */
6
+ /**
7
+ * Drops a deleted chat from every cache: the chat lists (the saved copy on this device follows on
8
+ * its next save), the chat, its messages, notes, profile and group members.
9
+ */
10
+ export declare function removeChatFromCache(qc: QueryClient, jid: string): void;
11
+ /** What a delete removes (messages and files), for the confirmation; admins only. */
12
+ export declare function useChatDeletePreview(jid: string, enabled: boolean): import("@tanstack/react-query").UseQueryResult<{
13
+ messages: number;
14
+ files: number;
15
+ }, Error>;
16
+ export declare function useDeleteChat(): import("@tanstack/react-query").UseMutationResult<undefined, Error, string, unknown>;
@@ -0,0 +1,21 @@
1
+ import { type QueryClient } from '@tanstack/react-query';
2
+ /**
3
+ * Hide chats on Log out (docs/features/chat-hide-delete/design.md Part A): when a linked phone logs
4
+ * out, every chat of its inbox is hidden (never deleted) until the same number links again.
5
+ */
6
+ /** Every read of one inbox's hidden-chat counts (any connection state). */
7
+ export declare const hiddenChatsKey: (inboxId: number) => readonly ["hidden-chats", number];
8
+ /**
9
+ * Admins: how many chats Log out hides (`visible`) and how many are hidden for the inbox's number.
10
+ * `state` (the connection state) is part of the key, so the counts are read again when it changes.
11
+ */
12
+ export declare function useHiddenChats(inboxId: number, state: string, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
13
+ visible: number;
14
+ hidden: number;
15
+ number: string | null;
16
+ }, Error>;
17
+ /**
18
+ * The inbox's phone logged out: its chats leave every cache (the chat lists, each chat and its
19
+ * messages; the saved copy on this device follows on its next save), and the lists load again.
20
+ */
21
+ export declare function removeInboxChatsFromCache(qc: QueryClient, inboxId: number): void;
@@ -341,3 +341,131 @@ export declare function useDrivePickerProgress(requestId: string | null): import
341
341
  kind: "text" | "pdf" | "other" | "sheet" | "word" | "doc";
342
342
  }[];
343
343
  }, Error>;
344
+ /** Admin → Connectors → GitHub (admins only, Lite). Tokens never reach the browser. */
345
+ export declare const githubKey: readonly ["connectors", "github"];
346
+ export declare const githubAgentKey: (agentId: number) => readonly ["connectors", "github", "agent", number];
347
+ export declare const githubReposKey: readonly ["connectors", "github", "repos"];
348
+ export declare const githubActivityKey: readonly ["connectors", "github", "activity"];
349
+ export declare function useGitHub(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
350
+ state: "unavailable" | "connected" | "expired" | "not_connected" | "no_installation" | "expiring";
351
+ method: "app" | "token" | null;
352
+ login: string | null;
353
+ connectedAt: number | null;
354
+ tokenExpiresAt: number | null;
355
+ problemSince: number | null;
356
+ manageUrl: string | null;
357
+ }, Error>;
358
+ /** Starts the GitHub App sign-in (device flow): the page shows `userCode` and polls the request. */
359
+ export declare function useGitHubDeviceStart(): import("@tanstack/react-query").UseMutationResult<{
360
+ requestId: string;
361
+ userCode: string;
362
+ verificationUri: string;
363
+ expiresAt: number;
364
+ }, Error, void, unknown>;
365
+ /** Polls a device sign-in every 3 s until the admin approved, cancelled or the code expired. */
366
+ export declare function useGitHubDeviceProgress(requestId: string | null): import("@tanstack/react-query").UseQueryResult<{
367
+ status: "expired" | "denied" | "pending" | "failed" | "done";
368
+ github: {
369
+ state: "unavailable" | "connected" | "expired" | "not_connected" | "no_installation" | "expiring";
370
+ method: "app" | "token" | null;
371
+ login: string | null;
372
+ connectedAt: number | null;
373
+ tokenExpiresAt: number | null;
374
+ problemSince: number | null;
375
+ manageUrl: string | null;
376
+ } | null;
377
+ }, Error>;
378
+ /** Stops the server polling GitHub for a code nobody waits for any more. */
379
+ export declare function cancelGitHubDevice(requestId: string): Promise<unknown>;
380
+ /** Signs in with a fine-grained token; 400 `classic` / `invalid` / `no_repos` when refused. */
381
+ export declare function useGitHubToken(): import("@tanstack/react-query").UseMutationResult<{
382
+ state: "unavailable" | "connected" | "expired" | "not_connected" | "no_installation" | "expiring";
383
+ method: "app" | "token" | null;
384
+ login: string | null;
385
+ connectedAt: number | null;
386
+ tokenExpiresAt: number | null;
387
+ problemSince: number | null;
388
+ manageUrl: string | null;
389
+ }, Error, string, unknown>;
390
+ /** "Check again" after installing the App on GitHub. */
391
+ export declare function useGitHubCheck(): import("@tanstack/react-query").UseMutationResult<{
392
+ state: "unavailable" | "connected" | "expired" | "not_connected" | "no_installation" | "expiring";
393
+ method: "app" | "token" | null;
394
+ login: string | null;
395
+ connectedAt: number | null;
396
+ tokenExpiresAt: number | null;
397
+ problemSince: number | null;
398
+ manageUrl: string | null;
399
+ }, Error, void, unknown>;
400
+ export declare function useGitHubDisconnect(): import("@tanstack/react-query").UseMutationResult<{
401
+ state: "unavailable" | "connected" | "expired" | "not_connected" | "no_installation" | "expiring";
402
+ method: "app" | "token" | null;
403
+ login: string | null;
404
+ connectedAt: number | null;
405
+ tokenExpiresAt: number | null;
406
+ problemSince: number | null;
407
+ manageUrl: string | null;
408
+ }, Error, void, unknown>;
409
+ /** The repositories GitHub lets EzyChat reach (the server caches them). */
410
+ export declare function useGitHubRepos(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
411
+ repos: {
412
+ id: number;
413
+ fullName: string;
414
+ private: boolean;
415
+ }[];
416
+ checkedAt: number;
417
+ }, Error>;
418
+ /** Reads the list again from GitHub ("Refresh"). */
419
+ export declare function useRefreshGitHubRepos(): import("@tanstack/react-query").UseMutationResult<{
420
+ repos: {
421
+ id: number;
422
+ fullName: string;
423
+ private: boolean;
424
+ }[];
425
+ checkedAt: number;
426
+ }, Error, void, unknown>;
427
+ /** One AI agent's GitHub settings and which of its repos GitHub no longer shares. */
428
+ export declare function useGitHubAgent(agentId: number | null, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
429
+ settings: {
430
+ repos: {
431
+ id: number;
432
+ fullName: string;
433
+ private: boolean;
434
+ }[];
435
+ issues: boolean;
436
+ pulls: boolean;
437
+ };
438
+ unavailableRepoIds: number[];
439
+ }, Error>;
440
+ export declare function useSaveGitHubAgent(agentId: number): import("@tanstack/react-query").UseMutationResult<{
441
+ settings: {
442
+ repos: {
443
+ id: number;
444
+ fullName: string;
445
+ private: boolean;
446
+ }[];
447
+ issues: boolean;
448
+ pulls: boolean;
449
+ };
450
+ unavailableRepoIds: number[];
451
+ }, Error, {
452
+ repos: {
453
+ id: number;
454
+ fullName: string;
455
+ private: boolean;
456
+ }[];
457
+ issues: boolean;
458
+ pulls: boolean;
459
+ }, unknown>;
460
+ export declare function useGitHubActivity(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
461
+ activity: {
462
+ id: number;
463
+ at: number;
464
+ kind: "failed" | "read" | "refused" | "searched";
465
+ agentId: number | null;
466
+ agentName: string;
467
+ chatJid: string | null;
468
+ customer: string;
469
+ group: string | null;
470
+ }[];
471
+ }, Error>;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Dream mode of one AI agent (design docs/superpowers/specs/2026-11-14-dream-mode-design.md, admins only): settings,
3
+ * the nightly history, one change and Apply / Dismiss / Undo. Every change reads the history (and the agent) again.
4
+ */
5
+ export declare const dreamKey: (agentId: number) => readonly ["dream", number];
6
+ export declare const dreamChangeKey: (agentId: number, id: number) => readonly ["dream", number, "change", number];
7
+ export declare function useDream(agentId: number): import("@tanstack/react-query").UseQueryResult<{
8
+ settings: {
9
+ enabled: boolean;
10
+ runTime: string;
11
+ autoApply: boolean;
12
+ };
13
+ runs: {
14
+ id: number;
15
+ slot: number;
16
+ status: "failed" | "skipped" | "running" | "done" | "missed";
17
+ reason: "ai_unavailable" | "agent_off" | "access_closed" | null;
18
+ chatsRead: number;
19
+ takeovers: number;
20
+ saved: number;
21
+ dropped: number;
22
+ changes: {
23
+ id: number;
24
+ runId: number;
25
+ target: "instructions" | "handoff_rules" | "context_text";
26
+ itemId: number | null;
27
+ itemName: string | null;
28
+ summary: string;
29
+ status: "expired" | "waiting" | "applied" | "dismissed" | "undone" | "stale";
30
+ auto: boolean;
31
+ sourceCount: number;
32
+ createdAt: number;
33
+ decidedAt: number | null;
34
+ }[];
35
+ }[];
36
+ nextBefore: number | null;
37
+ aiReady: boolean;
38
+ }, Error>;
39
+ export declare function useSaveDream(agentId: number): import("@tanstack/react-query").UseMutationResult<{
40
+ enabled: boolean;
41
+ runTime: string;
42
+ autoApply: boolean;
43
+ }, Error, {
44
+ enabled?: boolean | undefined;
45
+ runTime?: string | undefined;
46
+ autoApply?: boolean | undefined;
47
+ }, unknown>;
48
+ export declare function useDreamChange(agentId: number, id: number): import("@tanstack/react-query").UseQueryResult<{
49
+ id: number;
50
+ runId: number;
51
+ target: "instructions" | "handoff_rules" | "context_text";
52
+ itemId: number | null;
53
+ itemName: string | null;
54
+ summary: string;
55
+ status: "expired" | "waiting" | "applied" | "dismissed" | "undone" | "stale";
56
+ auto: boolean;
57
+ sourceCount: number;
58
+ createdAt: number;
59
+ decidedAt: number | null;
60
+ before: string;
61
+ after: string;
62
+ checks: {
63
+ name: "privacy" | "leak" | "grounding" | "replay" | "regression";
64
+ ok: boolean;
65
+ detail?: string | undefined;
66
+ }[];
67
+ sources: {
68
+ role: "team" | "customer";
69
+ name: string | null;
70
+ at: number;
71
+ text: string;
72
+ }[];
73
+ }, Error>;
74
+ export type DreamAction = 'apply' | 'dismiss' | 'undo';
75
+ /** Apply / Dismiss / Undo (409 `setup_changed`: the text changed since the night, the change is outdated). */
76
+ export declare function useDreamAction(agentId: number): import("@tanstack/react-query").UseMutationResult<{
77
+ id: number;
78
+ runId: number;
79
+ target: "instructions" | "handoff_rules" | "context_text";
80
+ itemId: number | null;
81
+ itemName: string | null;
82
+ summary: string;
83
+ status: "expired" | "waiting" | "applied" | "dismissed" | "undone" | "stale";
84
+ auto: boolean;
85
+ sourceCount: number;
86
+ createdAt: number;
87
+ decidedAt: number | null;
88
+ }, Error, {
89
+ id: number;
90
+ action: DreamAction;
91
+ }, unknown>;
@@ -15,6 +15,7 @@ export declare const qk: {
15
15
  chats: (f: ChatFilters) => readonly ["chats", ChatFilters];
16
16
  chatsAll: readonly ["chats"];
17
17
  openChatCount: readonly ["open-chat-count"];
18
+ unreadChatCount: readonly ["unread-chat-count"];
18
19
  report: (days: number, inbox?: number | null) => readonly ["report", number, number | null];
19
20
  chat: (jid: string) => readonly ["chat", string];
20
21
  messages: (jid: string) => readonly ["messages", string];
@@ -57,6 +58,7 @@ export declare function patchMessageInCache(qc: QueryClient, chatJid: string, ma
57
58
  export declare function removeMessageFromCache(qc: QueryClient, chatJid: string, clientId: string): void;
58
59
  /** Replace a chat in every cached chat list and in its detail entry. */
59
60
  export declare function upsertChatInCache(qc: QueryClient, chat: Chat): void;
61
+ /** A random UUID, also on a plain-http LAN page (see `randomUuid`). */
60
62
  export declare function newClientId(): string;
61
63
  /** Current user, or `null` when not logged in (401 is not an error here). */
62
64
  export declare function useMe(): import("@tanstack/react-query").UseQueryResult<{
@@ -207,6 +209,10 @@ export declare function useReport(days: ReportPeriod, inbox?: number | null): im
207
209
  aiAnswered: number;
208
210
  aiResolved: number;
209
211
  aiHandoffs: number;
212
+ aiClosed: number;
213
+ aiCompleted: number;
214
+ aiClosedAfterHandoff: number;
215
+ aiClosedAfterReply: number;
210
216
  };
211
217
  previous: {
212
218
  newCustomers: number;
@@ -218,11 +224,16 @@ export declare function useReport(days: ReportPeriod, inbox?: number | null): im
218
224
  aiAnswered: number;
219
225
  aiResolved: number;
220
226
  aiHandoffs: number;
227
+ aiClosed: number;
228
+ aiCompleted: number;
229
+ aiClosedAfterHandoff: number;
230
+ aiClosedAfterReply: number;
221
231
  } | null;
222
232
  waitingAfterHandoff: {
223
233
  count: number;
224
234
  oldestAt: number | null;
225
235
  };
236
+ aiOpen: number;
226
237
  daily: {
227
238
  date: string;
228
239
  inbound: number;
@@ -252,6 +263,10 @@ export declare function useReport(days: ReportPeriod, inbox?: number | null): im
252
263
  export declare function useOpenChatCount(): import("@tanstack/react-query").UseQueryResult<{
253
264
  openCount: number;
254
265
  }, Error>;
266
+ /** App navigation: open chats with unread messages the user may open (kept live by the chat socket events). */
267
+ export declare function useUnreadChatCount(): import("@tanstack/react-query").UseQueryResult<{
268
+ count: number;
269
+ }, Error>;
255
270
  export declare function useResolveAllChats(): import("@tanstack/react-query").UseMutationResult<{
256
271
  resolvedCount: number;
257
272
  }, Error, void, unknown>;
@@ -336,7 +351,7 @@ export interface SendTextInput {
336
351
  mentions?: string[];
337
352
  /** The text as the box showed it (`@Name`), for the pending bubble until the server answers. */
338
353
  shown?: string;
339
- /** Generate with `newClientId()` (crypto.randomUUID). */
354
+ /** Generate with `newClientId()` (a random UUID). */
340
355
  clientId: string;
341
356
  }
342
357
  /** Optimistic text send: inserts a pending bubble immediately, reconciled by clientId. */
@@ -22,7 +22,7 @@ export declare function useScheduledTasks(agentId: number): import("@tanstack/re
22
22
  trigger: "schedule" | "run_now";
23
23
  byUserName: string | null;
24
24
  result: "failed" | "sent" | "skipped" | null;
25
- reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
25
+ reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "chat_hidden" | "send_failed" | "interrupted" | null;
26
26
  messageId: string | null;
27
27
  } | null;
28
28
  name: string;
@@ -54,7 +54,7 @@ export declare function useCreateScheduledTask(agentId: number): import("@tansta
54
54
  trigger: "schedule" | "run_now";
55
55
  byUserName: string | null;
56
56
  result: "failed" | "sent" | "skipped" | null;
57
- reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
57
+ reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "chat_hidden" | "send_failed" | "interrupted" | null;
58
58
  messageId: string | null;
59
59
  } | null;
60
60
  name: string;
@@ -89,7 +89,7 @@ export declare function useUpdateScheduledTask(agentId: number): import("@tansta
89
89
  trigger: "schedule" | "run_now";
90
90
  byUserName: string | null;
91
91
  result: "failed" | "sent" | "skipped" | null;
92
- reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
92
+ reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "chat_hidden" | "send_failed" | "interrupted" | null;
93
93
  messageId: string | null;
94
94
  } | null;
95
95
  name: string;
@@ -114,7 +114,7 @@ export declare function useScheduledRuns(agentId: number, taskId: number): impor
114
114
  trigger: "schedule" | "run_now";
115
115
  byUserName: string | null;
116
116
  result: "failed" | "sent" | "skipped" | null;
117
- reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
117
+ reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "chat_hidden" | "send_failed" | "interrupted" | null;
118
118
  messageId: string | null;
119
119
  }[];
120
120
  }, Error>;
@@ -126,7 +126,7 @@ export declare function useRunScheduledTask(agentId: number): import("@tanstack/
126
126
  trigger: "schedule" | "run_now";
127
127
  byUserName: string | null;
128
128
  result: "failed" | "sent" | "skipped" | null;
129
- reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
129
+ reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "chat_hidden" | "send_failed" | "interrupted" | null;
130
130
  messageId: string | null;
131
131
  };
132
132
  }, Error, number, unknown>;
@@ -134,7 +134,7 @@ export declare function useRunScheduledTask(agentId: number): import("@tanstack/
134
134
  export declare function usePreviewScheduledTask(agentId: number): import("@tanstack/react-query").UseMutationResult<{
135
135
  result: "sent" | "skipped";
136
136
  text: string | null;
137
- reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "send_failed" | "interrupted" | null;
137
+ reason: "window_closed" | "confidential_leak" | "ai_unavailable" | "lookup_failed" | "agent_off" | "ai_disconnected" | "wa_disconnected" | "access_closed" | "nothing_to_say" | "needs_team" | "missed" | "chat_gone" | "chat_hidden" | "send_failed" | "interrupted" | null;
138
138
  lookups: {
139
139
  title: string;
140
140
  sourceLabel: string;
@@ -5,6 +5,11 @@ export interface ChangeState {
5
5
  version?: number;
6
6
  busy?: boolean;
7
7
  error?: string | null;
8
+ /** New agent and scheduled task cards: what Apply made. */
9
+ agentId?: number;
10
+ taskId?: number;
11
+ nextRunAt?: number | null;
12
+ agentOn?: boolean;
8
13
  }
9
14
  export interface BlockContext {
10
15
  /** The chat the panel is scoped to (its summary shows "Back to chat" instead of "Open chat"). */
@@ -17,6 +22,16 @@ export interface BlockContext {
17
22
  onAskAgain: () => void;
18
23
  /** Wide screen: tests in change cards start open (on a phone they start folded). */
19
24
  wide: boolean;
25
+ /** Sends a question choice as the person's next message. */
26
+ onAsk: (text: string) => void;
27
+ /** The person's next message after this answer (a question's chosen choice), null while unanswered. */
28
+ answered: string | null;
29
+ /** Ezy is answering: choices wait. */
30
+ busy: boolean;
31
+ /** Cards whose Apply and Discard are the "Apply both" buttons under them. */
32
+ paired: ReadonlySet<string>;
33
+ /** A new agent and its task shown together: the task card's Undo removes both. */
34
+ linked: ReadonlySet<string>;
20
35
  }
21
36
  export declare function AskEzyBlock({ block, ctx }: {
22
37
  block: AskBlock;
@@ -0,0 +1,31 @@
1
+ import type { AskEzyBlock as AskBlock } from '@ezychat/shared';
2
+ import type { BlockContext } from './AskEzyBlocks';
3
+ type Question = Extract<AskBlock, {
4
+ type: 'question';
5
+ }>;
6
+ type AgentCard = Extract<AskBlock, {
7
+ type: 'agent_proposal';
8
+ }>;
9
+ type TaskCard = Extract<AskBlock, {
10
+ type: 'task_proposal';
11
+ }>;
12
+ /**
13
+ * Ask Ezy sets up agents and scheduled tasks (design docs/features/ask-ezy-setup/design.md): the question
14
+ * with choices, the New agent card and the Scheduled task card. Nothing is saved until Apply.
15
+ */
16
+ /** A note the server adds: a new agent came without its scheduled task, so Ezy asks what it should send. */
17
+ export declare function SetupNoteBlock(): import("react").JSX.Element;
18
+ /** One question with tappable choices; a tap sends the choice as the person's next message. */
19
+ export declare function QuestionBlock({ block, ctx }: {
20
+ block: Question;
21
+ ctx: BlockContext;
22
+ }): import("react").JSX.Element;
23
+ export declare function AgentProposalBlock({ block, ctx }: {
24
+ block: AgentCard;
25
+ ctx: BlockContext;
26
+ }): import("react").JSX.Element;
27
+ export declare function TaskProposalBlock({ block, ctx }: {
28
+ block: TaskCard;
29
+ ctx: BlockContext;
30
+ }): import("react").JSX.Element;
31
+ export {};