@ezychat/web 0.1.87 → 0.1.89

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.
@@ -1,9 +1,12 @@
1
+ import type { Picture } from './AskEzyPictures';
1
2
  /** What a button asks Ezy when it opens the panel (e.g. "Summarise this chat" from a conversation). */
2
3
  export interface AskEzyRequest {
3
4
  question: string;
4
5
  chatJid?: string | null;
5
6
  /** Shown above the box while the question is about one chat. */
6
7
  chatName?: string | null;
8
+ /** Pictures for this question only; kept in the panel's memory for Ask again / Try again. */
9
+ pictures?: Picture[];
7
10
  }
8
11
  interface AskEzyState {
9
12
  open: boolean;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Pictures attached to an Ask Ezy question (design docs/features/ask-ezy-image/design.md). They live only in the open
3
+ * panel's memory (object URLs for the thumbnails, base64 for the request) and go to the server once, with their
4
+ * question; later turns carry only a text note.
5
+ */
6
+ export declare const MAX_PICTURES = 2;
7
+ /** What is sent, after scaling: the server's limit. */
8
+ export declare const MAX_PICTURE_BYTES = 3750000;
9
+ /** A picked file larger than this is refused before it is read (keeps the phone's memory safe). */
10
+ export declare const MAX_PICKED_BYTES: number;
11
+ /** Longest side after scaling: enough to read a chat screenshot, small enough to keep the cost low. */
12
+ export declare const MAX_SIDE = 2000;
13
+ export declare const PICTURE_ACCEPT = "image/jpeg,image/png,image/webp";
14
+ export interface Picture {
15
+ id: string;
16
+ name: string;
17
+ url: string;
18
+ base64: string;
19
+ }
20
+ export type PictureProblem = 'type' | 'size' | 'count';
21
+ /** Reads picked, pasted or dropped files: refuses wrong types, files that are too large, and a 3rd picture. */
22
+ export declare function readPictures(files: File[], already: number): Promise<{
23
+ pictures: Picture[];
24
+ problem: PictureProblem | null;
25
+ }>;
26
+ /** Frees the memory of thumbnails that are no longer shown. */
27
+ export declare function releasePictures(pictures: readonly Picture[]): void;
28
+ /** Thumbnails above the question box, each with a remove button (44 px touch area on phones). */
29
+ export declare function PictureTray({ pictures, problem, onRemove, }: {
30
+ pictures: Picture[];
31
+ problem: PictureProblem | null;
32
+ onRemove: (id: string) => void;
33
+ }): import("react").JSX.Element | null;
34
+ /** The pictures of a sent question, inside its bubble; a tap opens one large. */
35
+ export declare function QuestionPictures({ pictures }: {
36
+ pictures: Picture[];
37
+ }): import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
- import { type AskEzyAnswer, type AskEzyStep, type AskEzyTurn } from '@ezychat/shared';
1
+ import { type AskEzyAnswer, type AskEzyPicture, type AskEzyStep, type AskEzyTurn } from '@ezychat/shared';
2
2
  export declare const getAskEzyStatus: () => Promise<{
3
3
  connected: boolean;
4
+ pictures: boolean;
4
5
  }>;
5
6
  export type AskEzyChangeAction = 'apply' | 'discard' | 'undo';
6
7
  export declare const askEzyChange: (id: string, action: AskEzyChangeAction) => Promise<{
@@ -22,10 +23,12 @@ export declare const askEzyChange: (id: string, action: AskEzyChangeAction) => P
22
23
  /**
23
24
  * Asks one question. The answer streams as NDJSON: `onStep` gets each tool Ezy used while it works; resolves
24
25
  * with the answer, or throws an ApiError (`ai_not_connected`, `ai_unavailable`, `ai_timeout`, `ai_expired`,
25
- * `rate_limited`, …) or an AbortError.
26
+ * `rate_limited`, `pictures_unavailable`, `picture_too_large`, `picture_type`, …) or an AbortError.
26
27
  */
27
28
  export declare function askEzy(input: {
28
29
  question: string;
29
30
  history: AskEzyTurn[];
30
31
  chatJid: string | null;
32
+ /** 0–2 pictures for this question only (base64; the server reads the type from the bytes). */
33
+ pictures?: AskEzyPicture[];
31
34
  }, onStep: (step: AskEzyStep) => void, signal: AbortSignal): Promise<AskEzyAnswer>;
@@ -1550,6 +1550,8 @@ export declare const enResources: {
1550
1550
  propose_agent: string;
1551
1551
  propose_scheduled_task: string;
1552
1552
  propose_scheduled_task_edit: string;
1553
+ pictures_one: string;
1554
+ pictures_other: string;
1553
1555
  };
1554
1556
  summariseButton: string;
1555
1557
  readyWith: string;
@@ -1588,6 +1590,38 @@ export declare const enResources: {
1588
1590
  agentNeedsTask: string;
1589
1591
  previewNotReady: string;
1590
1592
  };
1593
+ pictures: {
1594
+ add: string;
1595
+ addHint: string;
1596
+ emptyHint: string;
1597
+ placeholder: string;
1598
+ tray: string;
1599
+ alt: string;
1600
+ remove: string;
1601
+ count: string;
1602
+ open: string;
1603
+ viewer: string;
1604
+ added_one: string;
1605
+ added_other: string;
1606
+ removed: string;
1607
+ drop: string;
1608
+ problem: {
1609
+ type: string;
1610
+ size: string;
1611
+ count: string;
1612
+ };
1613
+ errorSize: string;
1614
+ errorSizeBody: string;
1615
+ errorType: string;
1616
+ errorTypeBody: string;
1617
+ unavailable: string;
1618
+ unavailableAdmin: string;
1619
+ unavailableMember: string;
1620
+ askWithout: string;
1621
+ openModels: string;
1622
+ gotIt: string;
1623
+ defaultQuestion: string;
1624
+ };
1591
1625
  };
1592
1626
  safety: {
1593
1627
  title: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezychat/web",
3
- "version": "0.1.87",
3
+ "version": "0.1.89",
4
4
  "type": "module",
5
5
  "description": "EzyChat core: the team inbox web app (React) as a library, with createInboxApp and its extension API.",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  "build:lib": "node ../../scripts/build-web-lib.mjs"
41
41
  },
42
42
  "dependencies": {
43
- "@ezychat/shared": "0.1.87",
43
+ "@ezychat/shared": "0.1.89",
44
44
  "@fontsource-variable/inter": "^5.3.0",
45
45
  "@tanstack/react-query": "^5.107.1",
46
46
  "@types/react": "^19.3.0",