@blocklet/pages-kit 0.2.312 → 0.2.313

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 (41) hide show
  1. package/lib/cjs/builtin/async/ai-runtime/api/session.js +10 -1
  2. package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +49 -0
  3. package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/index.js +68 -0
  4. package/lib/cjs/builtin/async/ai-runtime/locales/index.js +1 -1
  5. package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +21 -4
  6. package/lib/cjs/builtin/async/ai-runtime/runtime/Runtime/index.js +22 -33
  7. package/lib/cjs/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +2 -2
  8. package/lib/cjs/builtin/async/ai-runtime/runtime-components/MultiAgentsChat/index.js +6 -5
  9. package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +6 -5
  10. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +39 -14
  11. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +2 -2
  12. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Input.js +2 -2
  13. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +2 -3
  14. package/lib/cjs/builtin/async/ai-runtime/state/session.js +217 -79
  15. package/lib/cjs/builtin/page/header.js +45 -3
  16. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  17. package/lib/esm/builtin/async/ai-runtime/api/session.js +8 -0
  18. package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +46 -0
  19. package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/index.js +42 -0
  20. package/lib/esm/builtin/async/ai-runtime/locales/index.js +1 -1
  21. package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +23 -6
  22. package/lib/esm/builtin/async/ai-runtime/runtime/Runtime/index.js +23 -34
  23. package/lib/esm/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +3 -3
  24. package/lib/esm/builtin/async/ai-runtime/runtime-components/MultiAgentsChat/index.js +7 -6
  25. package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +7 -6
  26. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +35 -10
  27. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +3 -3
  28. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Input.js +3 -3
  29. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Page.js +3 -4
  30. package/lib/esm/builtin/async/ai-runtime/state/session.js +215 -79
  31. package/lib/esm/builtin/page/header.js +42 -1
  32. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  33. package/lib/types/builtin/async/ai-runtime/api/session.d.ts +3 -0
  34. package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.d.ts +5 -0
  35. package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/index.d.ts +6 -0
  36. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +2 -1
  37. package/lib/types/builtin/async/ai-runtime/state/runtime.d.ts +1 -0
  38. package/lib/types/builtin/async/ai-runtime/state/session.d.ts +27 -6
  39. package/lib/types/builtin/page/header.d.ts +13 -0
  40. package/lib/types/tsconfig.tsbuildinfo +1 -1
  41. package/package.json +4 -3
@@ -28,6 +28,9 @@ export declare function createSession({ aid, name, }: {
28
28
  created: Session;
29
29
  sessions: Session[];
30
30
  }>;
31
+ export declare function clearSession({ sessionId }: {
32
+ sessionId: string;
33
+ }): Promise<{}>;
31
34
  export declare function updateSession({ sessionId, name, }: {
32
35
  sessionId: string;
33
36
  name?: string;
@@ -0,0 +1,5 @@
1
+ import { MenuItemProps } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
+ export default function LoadingMenuItem({ children, confirmation, ...props }: MenuItemProps & {
4
+ confirmation?: ReactNode;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { BoxProps, Button, PopperProps } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
+ export default function PopperMenuButton({ PopperProps, menus, ...props }: {
4
+ PopperProps: Omit<PopperProps, 'open'>;
5
+ menus?: ReactNode;
6
+ } & BoxProps<typeof Button>): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { ComponentProps } from 'react';
2
2
  import ScrollView from '../../components/ScrollView';
3
- export default function SimpleChat({ primaryColor, scrollViewProps, }: {
3
+ export default function SimpleChat({ primaryColor, scrollViewProps, hideHeaderMenuButton, }: {
4
4
  primaryColor?: string;
5
5
  scrollViewProps?: ComponentProps<typeof ScrollView>;
6
+ hideHeaderMenuButton?: boolean;
6
7
  }): import("react/jsx-runtime").JSX.Element;
@@ -4,6 +4,7 @@ export declare function useRuntimeState(): {
4
4
  agent: import("../api/agent").Agent;
5
5
  childAgentId: string;
6
6
  execute: (options: {
7
+ sessionId?: string | undefined;
7
8
  aid: string;
8
9
  working?: boolean | undefined;
9
10
  parameters: any;
@@ -4,19 +4,40 @@ export interface MessageItem extends Omit<Message, 'id'> {
4
4
  id?: string;
5
5
  loading?: boolean;
6
6
  }
7
- export interface SessionState {
7
+ export interface SessionItemState {
8
+ session: Session;
8
9
  loading?: boolean;
9
10
  loaded?: boolean;
10
11
  running?: boolean;
11
- session?: Session;
12
12
  messages?: MessageItem[];
13
13
  noMoreMessage?: boolean;
14
14
  messageLoading?: boolean;
15
15
  error?: Error;
16
+ }
17
+ export interface SessionState {
18
+ loading?: boolean;
19
+ loaded?: boolean;
20
+ sessions?: Session[];
21
+ sessionMap?: {
22
+ [sessionId: string]: SessionItemState;
23
+ };
24
+ currentSessionId?: string;
25
+ error?: Error;
16
26
  reset: () => void;
17
27
  load: () => Promise<void>;
18
- loadMoreMessages: () => Promise<void>;
28
+ setCurrentSessionId: (sessionId: string) => void;
29
+ createSession: () => Promise<Session>;
30
+ deleteSession: (args?: {
31
+ sessionId?: string;
32
+ }) => Promise<void>;
33
+ clearSession: (args?: {
34
+ sessionId?: string;
35
+ }) => Promise<void>;
36
+ loadMoreMessages: (args?: {
37
+ sessionId?: string;
38
+ }) => Promise<void>;
19
39
  execute: (options: {
40
+ sessionId?: string;
20
41
  aid: string;
21
42
  working?: boolean;
22
43
  parameters: any;
@@ -26,6 +47,6 @@ export interface SessionState {
26
47
  export declare const createSessionState: ({ aid }: {
27
48
  aid: string;
28
49
  }) => import("zustand").UseBoundStore<import("zustand").StoreApi<import("immer").WritableDraft<SessionState>>>;
29
- export declare function useSessionState({ autoLoad }?: {
30
- autoLoad?: boolean;
31
- }): import("zustand").UseBoundStore<import("zustand").StoreApi<import("immer").WritableDraft<SessionState>>>;
50
+ export declare function useAutoLoadSessionState(): void;
51
+ export declare function useSessionState<U>(selector: (s: SessionState) => U): U;
52
+ export declare function useCurrentSessionState<U>(selector: (s?: SessionItemState) => U): U;
@@ -1,9 +1,22 @@
1
+ import React from 'react';
2
+ export interface HeaderWidgets {
3
+ logo?: any;
4
+ brand?: any;
5
+ description?: any;
6
+ addons?: (...exists: any[]) => any[];
7
+ }
8
+ export type HeaderWidgetCreator = () => HeaderWidgets;
1
9
  export interface HeaderState {
2
10
  logo?: any;
3
11
  brand?: any;
4
12
  description?: any;
5
13
  addons?: (...exists: any[]) => any[];
14
+ stack: Set<HeaderWidgetCreator>;
15
+ add: (creator: HeaderWidgetCreator) => void;
16
+ delete: (creator: HeaderWidgetCreator) => void;
17
+ refresh: () => void;
6
18
  }
7
19
  export declare const useHeaderState: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<HeaderState>, "setState"> & {
8
20
  setState(nextStateOrUpdater: HeaderState | Partial<HeaderState> | ((state: import("immer").WritableDraft<HeaderState>) => void), shouldReplace?: boolean | undefined): void;
9
21
  }>;
22
+ export declare function useHeader(creator: HeaderWidgetCreator, deps: React.DependencyList): void;