@crossworks/client-types 0.239.97 → 0.239.99

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossworks/client-types",
3
- "version": "0.239.97",
3
+ "version": "0.239.99",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/dto/views.ts CHANGED
@@ -760,6 +760,65 @@ export type AgentTelegramChat = {
760
760
  label: string;
761
761
  status: 'pending' | 'allowed' | 'denied';
762
762
  lastMessageAt: string | null;
763
+ /** The user the chat is paired to (workspaces W7d), null when none
764
+ * (pending, blocked, or its login is gone). */
765
+ loginId: string | null;
766
+ /** That user's name, else email, for the list; null with no login. */
767
+ pairedTo: string | null;
768
+ };
769
+
770
+ /** One of the signed-in user's own paired Telegram chats (workspaces W7d,
771
+ * GET /api/telegram/my-chats). */
772
+ export type MyTelegramChat = {
773
+ id: string;
774
+ telegramChatId: string;
775
+ label: string;
776
+ /** The bot the chat is on, and its assistant. */
777
+ botUsername: string;
778
+ agentName: string | null;
779
+ agentSlug: string | null;
780
+ lastMessageAt: string | null;
781
+ };
782
+
783
+ /** A chat on a bot the signed-in user moderates (workspaces W7d, GET
784
+ * /api/telegram/moderated-chats): a Moderator of the bot's assistant's
785
+ * workspace, or an Admin user with the users area, blocks or unpairs it. */
786
+ export type ModeratedTelegramChat = AgentTelegramChat & {
787
+ botUsername: string;
788
+ agentName: string | null;
789
+ agentSlug: string | null;
790
+ };
791
+
792
+ /** What POST /api/telegram/pair answers WITHOUT `confirm` (W7d fix round 1,
793
+ * M3): what the code would pair, so the user sees whose chat it is before it
794
+ * becomes theirs. Nothing is paired. Confirm with the same code,
795
+ * `confirm: true` and this `previewToken` (a confirm without it is 400). */
796
+ export type TelegramPairPreview = {
797
+ ok: true;
798
+ /** Always false here: a preview pairs nothing. */
799
+ paired: false;
800
+ /** True when the chat is already paired to this user. */
801
+ already: boolean;
802
+ /** The Telegram chat: `label` is its checked @username, else "chat <id>"
803
+ * (W7d+e: never the free title); `title` is its free title, at most 64
804
+ * characters, or null: show it as plain text only, never as markup or a
805
+ * link; and its id. */
806
+ chat: { label: string; title: string | null; telegramChatId: string };
807
+ /** The bot the chat is on (its @username). */
808
+ bot: { name: string };
809
+ agentName: string | null;
810
+ /** Send back with the confirm (required since W7d+e): it then pairs this
811
+ * chat and no other, for this code, within ten minutes of the preview. */
812
+ previewToken: string;
813
+ };
814
+
815
+ /** What POST /api/telegram/pair answers with `confirm: true` (workspaces
816
+ * W7d): the chat is paired to this user. */
817
+ export type TelegramPairResult = {
818
+ ok: true;
819
+ /** True when the chat was already paired to this user (no change). */
820
+ already: boolean;
821
+ chat: { id: string; telegramChatId: string; label: string; agentName: string | null };
763
822
  };
764
823
 
765
824
  export type DiffStatus =
@@ -158,6 +158,28 @@ export type ShellWorkspace = {
158
158
  };
159
159
  export type ShellWorkspaces = { workspaces: ShellWorkspace[]; areas: WorkspaceArea[] };
160
160
 
161
+ /**
162
+ * GET /api/auth/whoami (the phone app's first call with a bearer, workspaces
163
+ * W7e): who the credential is, and the same workspaces, areas and owner
164
+ * flag GET /api/shell gives (its builder). `areas` is empty for a login
165
+ * outside the Admin workspace; `isOwner` is the brain's anchor login.
166
+ * `brainId` is left out only while the database is behind the code.
167
+ */
168
+ export type AuthWhoami = {
169
+ role: 'admin' | 'member' | 'client';
170
+ loginId: string;
171
+ email: string;
172
+ displayName: string | null;
173
+ /** Every role's shell route: '/api/shell'. */
174
+ shell: string;
175
+ /** The push routes' base path for this role. */
176
+ pushBase: string;
177
+ brainId?: string;
178
+ workspaces: ShellWorkspace[];
179
+ areas: WorkspaceArea[];
180
+ isOwner: boolean;
181
+ };
182
+
161
183
  /** Every `code` a /api/workspaces refusal carries. */
162
184
  export type WorkspaceErrorCode =
163
185
  | 'invalid'
package/src/index.ts CHANGED
@@ -181,6 +181,7 @@ export type {
181
181
  } from './tree';
182
182
  // Types only; WORKSPACE_AREAS (runtime) is the `@mantle/client-types/dto/workspaces` subpath.
183
183
  export type {
184
+ AuthWhoami,
184
185
  ShellWorkspace,
185
186
  ShellWorkspaces,
186
187
  Workspace,