@next-bricks/ai-portal 0.55.1 → 0.56.1

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 (87) hide show
  1. package/dist/bricks.json +46 -38
  2. package/dist/chunks/1510.42780c0d.js +2 -0
  3. package/dist/chunks/1510.42780c0d.js.map +1 -0
  4. package/dist/chunks/1864.7e31d8fe.js +2 -0
  5. package/dist/chunks/1864.7e31d8fe.js.map +1 -0
  6. package/dist/chunks/5269.13671bc0.js +2 -0
  7. package/dist/chunks/5269.13671bc0.js.map +1 -0
  8. package/dist/chunks/6995.4d172ef6.js +2 -0
  9. package/dist/chunks/6995.4d172ef6.js.map +1 -0
  10. package/dist/chunks/7517.cf7a9f90.js +2 -0
  11. package/dist/chunks/7517.cf7a9f90.js.map +1 -0
  12. package/dist/chunks/chat-box.4d1d4fd9.js +2 -0
  13. package/dist/chunks/chat-box.4d1d4fd9.js.map +1 -0
  14. package/dist/chunks/{chat-stream.11c6ade7.js → chat-stream.e0d13969.js} +2 -2
  15. package/dist/chunks/{chat-stream.11c6ade7.js.map → chat-stream.e0d13969.js.map} +1 -1
  16. package/dist/chunks/{cruise-canvas.c494563b.js → cruise-canvas.eca7469a.js} +2 -2
  17. package/dist/chunks/{cruise-canvas.c494563b.js.map → cruise-canvas.eca7469a.js.map} +1 -1
  18. package/dist/chunks/{elevo-sidebar.bfad7500.js → elevo-sidebar.08aad53b.js} +3 -3
  19. package/dist/chunks/{elevo-sidebar.bfad7500.js.map → elevo-sidebar.08aad53b.js.map} +1 -1
  20. package/dist/chunks/{main.9f2b6ec7.js → main.14d3a485.js} +2 -2
  21. package/dist/chunks/{main.9f2b6ec7.js.map → main.14d3a485.js.map} +1 -1
  22. package/dist/chunks/running-flow.4b117f11.js +3 -0
  23. package/dist/chunks/running-flow.4b117f11.js.LICENSE.txt +5 -0
  24. package/dist/chunks/running-flow.4b117f11.js.map +1 -0
  25. package/dist/examples.json +22 -19
  26. package/dist/index.8d87387c.js +2 -0
  27. package/dist/index.8d87387c.js.map +1 -0
  28. package/dist/manifest.json +373 -344
  29. package/dist/types.json +721 -336
  30. package/dist-types/bootstrap.d.ts +1 -0
  31. package/dist-types/chat-box/UploadButton.d.ts +1 -0
  32. package/dist-types/chat-box/index.d.ts +13 -5
  33. package/dist-types/chat-box/interfaces.d.ts +2 -1
  34. package/dist-types/chat-stream/Aside/Aside.d.ts +5 -3
  35. package/dist-types/chat-stream/Aside/FlowApp/FlowApp.d.ts +7 -0
  36. package/dist-types/chat-stream/Aside/FlowApp/i18n.d.ts +20 -0
  37. package/dist-types/chat-stream/AssistantMessage/AssistantMessage.d.ts +6 -5
  38. package/dist-types/chat-stream/NodeChunk/NodeChunk.d.ts +7 -0
  39. package/dist-types/chat-stream/NodeChunk/NodeJob.d.ts +7 -0
  40. package/dist-types/chat-stream/NodeChunk/getStateDisplay.d.ts +6 -0
  41. package/dist-types/chat-stream/StreamContext.d.ts +2 -1
  42. package/dist-types/chat-stream/i18n.d.ts +5 -1
  43. package/dist-types/chat-stream/interfaces.d.ts +25 -3
  44. package/dist-types/chat-stream/useAutoScroll.d.ts +5 -0
  45. package/dist-types/chat-stream/useConversationStream.d.ts +5 -4
  46. package/dist-types/cruise-canvas/NodeChunk/NodeChunk.d.ts +9 -0
  47. package/dist-types/cruise-canvas/i18n.d.ts +3 -1
  48. package/dist-types/cruise-canvas/interfaces.d.ts +13 -2
  49. package/dist-types/cruise-canvas/reducers/interfaces.d.ts +2 -1
  50. package/dist-types/cruise-canvas/reducers/serviceFlows.d.ts +4 -0
  51. package/dist-types/cruise-canvas/useConversationDetail.d.ts +1 -0
  52. package/dist-types/cruise-canvas/useConversationGraph.d.ts +2 -2
  53. package/dist-types/running-flow/formatDuration.d.ts +6 -0
  54. package/dist-types/running-flow/index.d.ts +34 -0
  55. package/dist-types/running-flow/index.spec.d.ts +1 -0
  56. package/dist-types/shared/RequestHumanAction/RequestHumanAction.d.ts +2 -1
  57. package/dist-types/shared/TaskContext.d.ts +8 -3
  58. package/dist-types/shared/bricks.d.ts +4 -0
  59. package/dist-types/shared/constants.d.ts +1 -0
  60. package/dist-types/shared/getFlatChunks.d.ts +6 -0
  61. package/dist-types/shared/getFlowOrActivityIcon.d.ts +3 -0
  62. package/dist-types/{cruise-canvas → shared}/getOrderedNodes.d.ts +2 -6
  63. package/dist-types/shared/getTaskTree.d.ts +10 -0
  64. package/dist-types/shared/interfaces.d.ts +65 -3
  65. package/dist-types/shared/useFlowAndActivityMap.d.ts +5 -0
  66. package/dist-types/shared/useFulfilledActiveDetail.d.ts +2 -0
  67. package/docs/running-flow.md +22 -0
  68. package/package.json +2 -2
  69. package/dist/chunks/1080.c0cb398b.js +0 -2
  70. package/dist/chunks/1080.c0cb398b.js.map +0 -1
  71. package/dist/chunks/1864.4bd403fd.js +0 -2
  72. package/dist/chunks/1864.4bd403fd.js.map +0 -1
  73. package/dist/chunks/2761.561a580a.js +0 -2
  74. package/dist/chunks/2761.561a580a.js.map +0 -1
  75. package/dist/chunks/3227.77ba4968.js +0 -2
  76. package/dist/chunks/3227.77ba4968.js.map +0 -1
  77. package/dist/chunks/8717.462ca5c9.js +0 -2
  78. package/dist/chunks/8717.462ca5c9.js.map +0 -1
  79. package/dist/chunks/chat-box.8e064684.js +0 -2
  80. package/dist/chunks/chat-box.8e064684.js.map +0 -1
  81. package/dist/index.fe56261d.js +0 -2
  82. package/dist/index.fe56261d.js.map +0 -1
  83. package/dist-types/chat-stream/NodeJob/NodeJob.d.ts +0 -7
  84. package/dist-types/cruise-canvas/getFlatOrderedJobs.d.ts +0 -11
  85. package/dist-types/cruise-canvas/getFlatOrderedJobs.spec.d.ts +0 -1
  86. /package/dist/chunks/{elevo-sidebar.bfad7500.js.LICENSE.txt → elevo-sidebar.08aad53b.js.LICENSE.txt} +0 -0
  87. /package/dist-types/{cruise-canvas → shared}/getOrderedNodes.spec.d.ts +0 -0
@@ -29,3 +29,4 @@ import "./elevo-card/index.js";
29
29
  import "./flow-tabs/index.js";
30
30
  import "./stage-flow/index.js";
31
31
  import "./data-providers/set-chat-command.js";
32
+ import "./running-flow/index.js";
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import type { FileItem } from "./interfaces";
3
3
  export interface UploadButtonProps {
4
+ accept?: string;
4
5
  onChange?: (files: FileItem[] | undefined) => void;
5
6
  }
6
7
  export interface UploadButtonRef {
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { ReactNextElement } from "@next-core/react-element";
3
3
  import "@next-core/theme";
4
- import type { CommandPayload } from "../shared/interfaces.js";
4
+ import type { CommandPayload, UploadFileInfo } from "../shared/interfaces.js";
5
5
  export declare const ChatBoxComponent: React.ForwardRefExoticComponent<Omit<ChatBoxComponentProps, "ref"> & React.RefAttributes<ChatBoxRef>>;
6
6
  export interface ChatBoxProps {
7
7
  disabled?: boolean;
@@ -9,7 +9,7 @@ export interface ChatBoxProps {
9
9
  autoFocus?: boolean;
10
10
  aiEmployees?: AIEmployee[];
11
11
  commands?: Command[];
12
- uploadBucket?: string;
12
+ uploadFiles?: UploadFileOptions;
13
13
  }
14
14
  export interface AIEmployee {
15
15
  employeeId: string;
@@ -26,6 +26,14 @@ export interface Command {
26
26
  options?: Command[];
27
27
  payload?: CommandPayload;
28
28
  }
29
+ export interface UploadFileOptions {
30
+ enabled?: boolean;
31
+ accept?: string;
32
+ }
33
+ export interface ChatPayload {
34
+ content: string;
35
+ files?: UploadFileInfo[];
36
+ }
29
37
  /**
30
38
  * 构件 `ai-portal.chat-box`
31
39
  */
@@ -37,17 +45,17 @@ export declare class ChatBox extends ReactNextElement implements ChatBoxProps {
37
45
  accessor autoFocus: boolean | undefined;
38
46
  accessor aiEmployees: AIEmployee[] | undefined;
39
47
  accessor commands: Command[] | undefined;
40
- accessor uploadBucket: string | undefined;
48
+ accessor uploadFiles: UploadFileOptions | undefined;
41
49
  setValue(value: string): void;
42
50
  getValue(): string | undefined;
43
51
  focusOnInput(): void | undefined;
44
52
  render(): React.JSX.Element;
45
53
  }
46
54
  interface ChatBoxComponentProps extends ChatBoxProps {
47
- onSubmit: (value: string) => void;
55
+ onMessageSubmit: (value: string) => void;
56
+ onChatSubmit: (payload: ChatPayload) => void;
48
57
  onEmployeeMention: (employee: AIEmployee | null) => void;
49
58
  onCommandSelect: (command: CommandPayload | null) => void;
50
- onFilesChange: (files: string[] | null | undefined) => void;
51
59
  ref?: React.Ref<ChatBoxRef>;
52
60
  }
53
61
  export {};
@@ -1,8 +1,9 @@
1
+ import type { UploadFileInfo } from "../shared/interfaces";
1
2
  export interface FileItem {
2
3
  uid: number;
3
4
  file: File;
4
5
  status: FileStatus;
5
- uploadedName?: string;
6
+ fileInfo?: UploadFileInfo;
6
7
  abortController?: AbortController;
7
8
  }
8
9
  export type FileStatus = "ready" | "uploading" | "done" | "failed";
@@ -1,6 +1,8 @@
1
1
  import React from "react";
2
- import type { Job } from "../../shared/interfaces";
2
+ import type { FulfilledActiveDetail } from "../../shared/interfaces";
3
3
  export interface AsideProps {
4
- job: Job;
4
+ detail: FulfilledActiveDetail;
5
+ isSubTask?: boolean;
6
+ faded?: boolean;
5
7
  }
6
- export declare function Aside({ job }: AsideProps): React.JSX.Element;
8
+ export declare function Aside({ detail, isSubTask, faded }: AsideProps): React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { ActivityRun, ServiceFlowRun } from "../../../shared/interfaces";
3
+ export interface FlowAppProps {
4
+ flow: ServiceFlowRun;
5
+ activity?: ActivityRun;
6
+ }
7
+ export declare function FlowApp({ flow, activity }: FlowAppProps): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ export declare enum K {
2
+ WAITING = "WAITING",
3
+ EXECUTING = "EXECUTING",
4
+ PAUSED = "PAUSED",
5
+ SUCCEEDED = "SUCCEEDED",
6
+ FAILED = "FAILED",
7
+ TERMINATED = "TERMINATED"
8
+ }
9
+ export declare const NS = "bricks/ai-portal/FlowApp";
10
+ export declare const locales: {
11
+ en: Locale;
12
+ zh: Locale;
13
+ };
14
+ export declare const t: any;
15
+ type Locale = {
16
+ [k in K]: string;
17
+ } & {
18
+ [k in K as `${k}_plural`]?: string;
19
+ };
20
+ export {};
@@ -1,9 +1,10 @@
1
1
  import React from "react";
2
- import type { ConversationState, Job, TaskState } from "../../shared/interfaces.js";
2
+ import type { ConversationState, JobState, TaskState } from "../../shared/interfaces.js";
3
+ import type { MessageChunk } from "../interfaces";
3
4
  export interface AssistantMessageProps {
4
- jobs: Job[];
5
- taskState: TaskState | ConversationState | undefined;
6
- error?: string | null;
5
+ chunks: MessageChunk[];
6
+ scopeState: ConversationState | TaskState | JobState | undefined;
7
7
  isLatest?: boolean;
8
+ isSubTask?: boolean;
8
9
  }
9
- export declare function AssistantMessage({ jobs, taskState, error, isLatest, }: AssistantMessageProps): React.JSX.Element;
10
+ export declare function AssistantMessage({ chunks, scopeState, isLatest, isSubTask, }: AssistantMessageProps): React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { MessageChunk } from "../interfaces.js";
3
+ export interface NodeChunkProps {
4
+ chunk: MessageChunk;
5
+ isSubTask?: boolean;
6
+ }
7
+ export declare function NodeChunk({ chunk, isSubTask }: NodeChunkProps): React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { Job } from "../../shared/interfaces.js";
3
+ export interface NodeJobProps {
4
+ job: Job;
5
+ isSubTask?: boolean;
6
+ }
7
+ export declare function NodeJob({ job, isSubTask }: NodeJobProps): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { GeneralIconProps } from "@next-bricks/icons/general-icon";
2
+ import type { ConversationState, JobState, TaskState } from "../../shared/interfaces";
3
+ export declare function getStateDisplay(state: JobState | TaskState | undefined, conversationState: ConversationState | undefined): {
4
+ className?: string;
5
+ icon: GeneralIconProps;
6
+ };
@@ -1,6 +1,7 @@
1
1
  import { type Dispatch } from "react";
2
+ import type { ActiveDetail } from "../shared/interfaces";
2
3
  export interface StreamContextValue {
3
- lastToolCallJobId: string | null;
4
+ lastDetail: ActiveDetail | null;
4
5
  setUserClosedAside: Dispatch<React.SetStateAction<boolean>>;
5
6
  }
6
7
  export declare const StreamContext: React.Context<StreamContextValue>;
@@ -1,5 +1,9 @@
1
1
  export declare enum K {
2
- SWITCH_TO_CANVAS = "SWITCH_TO_CANVAS"
2
+ SWITCH_TO_CANVAS = "SWITCH_TO_CANVAS",
3
+ START_SERVICE_FLOW = "START_SERVICE_FLOW",
4
+ START_SERVICE_FLOW_ACTIVITY = "START_SERVICE_FLOW_ACTIVITY",
5
+ SERVICE_FLOW = "SERVICE_FLOW",
6
+ SERVICE_FLOW_ACTIVITY = "SERVICE_FLOW_ACTIVITY"
3
7
  }
4
8
  export declare const NS = "bricks/ai-portal/chat-stream";
5
9
  export declare const locales: {
@@ -1,12 +1,34 @@
1
- import type { CommandPayload, Job } from "../shared/interfaces.js";
1
+ import type { ActivityRun, CommandPayload, Job, ServiceFlowRun, Task } from "../shared/interfaces.js";
2
2
  export type ChatMessage = MessageFromUser | MessageFromAssistant;
3
3
  export interface MessageFromUser {
4
4
  role: "user";
5
5
  content: string;
6
6
  cmd?: CommandPayload;
7
+ fromSkippedSubTask?: boolean;
7
8
  }
8
9
  export interface MessageFromAssistant {
9
10
  role: "assistant";
10
- jobs: Job[];
11
- error?: string | null;
11
+ chunks: MessageChunk[];
12
+ }
13
+ export type MessageChunk = MessageChunkOfJob | MessageChunkOfFlow | MessageChunkOfActivity | MessageChunkOfError;
14
+ export interface MessageChunkOfJob {
15
+ type: "job";
16
+ job: Job;
17
+ level: number;
18
+ fromSkippedSubTask?: boolean;
19
+ }
20
+ export interface MessageChunkOfFlow {
21
+ type: "flow";
22
+ flow: ServiceFlowRun;
23
+ task: Task;
24
+ }
25
+ export interface MessageChunkOfActivity {
26
+ type: "activity";
27
+ activity: ActivityRun;
28
+ flow: ServiceFlowRun;
29
+ task: Task;
30
+ }
31
+ export interface MessageChunkOfError {
32
+ type: "error";
33
+ error: string;
12
34
  }
@@ -0,0 +1,5 @@
1
+ import { type RefObject } from "react";
2
+ export declare function useAutoScroll(conversationAvailable: boolean, scrollContainerRef: RefObject<HTMLDivElement>, scrollContentRef: RefObject<HTMLDivElement>): {
3
+ scrollable: boolean;
4
+ scrollToBottom: () => void;
5
+ };
@@ -1,13 +1,14 @@
1
1
  import type { ChatMessage } from "./interfaces.js";
2
- import type { ConversationBaseDetail, ConversationError, Task } from "../shared/interfaces.js";
3
- export declare function useConversationStream(conversation: ConversationBaseDetail | null | undefined, tasks: Task[], errors: ConversationError[], options?: {
2
+ import type { ActiveDetail, ActivityWithFlow, ConversationError, ServiceFlowRun, Task } from "../shared/interfaces.js";
3
+ export declare function useConversationStream(conversationAvailable: boolean, tasks: Task[], errors: ConversationError[], flowMap?: Map<string, ServiceFlowRun>, activityMap?: Map<string, ActivityWithFlow>, options?: {
4
4
  showHumanActions?: boolean;
5
+ skipActivitySubTasks?: boolean;
5
6
  }): {
6
7
  messages: never[];
7
- lastToolCallJobId: null;
8
+ lastDetail: null;
8
9
  jobMap?: undefined;
9
10
  } | {
10
11
  messages: ChatMessage[];
11
12
  jobMap: Map<string, import("../shared/interfaces.js").Job>;
12
- lastToolCallJobId: string | null;
13
+ lastDetail: ActiveDetail | null;
13
14
  };
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { ActivityRun, ServiceFlowRun } from "../../shared/interfaces";
3
+ export interface NodeChunkProps {
4
+ type: "flow" | "activity";
5
+ active?: boolean;
6
+ flow: ServiceFlowRun;
7
+ activity?: ActivityRun;
8
+ }
9
+ export declare function NodeChunk({ type, active, flow, activity }: NodeChunkProps): React.JSX.Element;
@@ -16,7 +16,9 @@ export declare enum K {
16
16
  UNTITLED = "UNTITLED",
17
17
  FILE_PREVIEW_UNPREVIEWABLE_TIP_PREFIX = "FILE_PREVIEW_UNPREVIEWABLE_TIP_PREFIX",
18
18
  FILE_PREVIEW_UNPREVIEWABLE_TIP_SUFFIX = "FILE_PREVIEW_UNPREVIEWABLE_TIP_SUFFIX",
19
- DOWNLOAD = "DOWNLOAD"
19
+ DOWNLOAD = "DOWNLOAD",
20
+ START_SERVICE_FLOW = "START_SERVICE_FLOW",
21
+ START_SERVICE_FLOW_ACTIVITY = "START_SERVICE_FLOW_ACTIVITY"
20
22
  }
21
23
  export declare const NS = "bricks/ai-portal/cruise-canvas";
22
24
  export declare const locales: {
@@ -1,5 +1,5 @@
1
1
  import type { JSONSchema } from "./json-schema";
2
- import type { CommandPayload, GeneratedView, Job, JobState } from "../shared/interfaces";
2
+ import type { ActivityRun, CommandPayload, GeneratedView, Job, JobState, ServiceFlowRun } from "../shared/interfaces";
3
3
  export type RangeTuple = [min: number, max: number];
4
4
  export type SizeTuple = [width: number, height: number];
5
5
  export interface NodePosition {
@@ -11,7 +11,7 @@ export interface TransformLiteral {
11
11
  x: number;
12
12
  y: number;
13
13
  }
14
- export type GraphNode = RequirementGraphNode | LoadingGraphNode | InstructionGraphNode | JobGraphNode | StartGraphNode | EndGraphNode | ErrorGraphNode | FeedbackGraphNode | ReplayGraphNode;
14
+ export type GraphNode = RequirementGraphNode | LoadingGraphNode | InstructionGraphNode | JobGraphNode | StartGraphNode | EndGraphNode | ErrorGraphNode | FeedbackGraphNode | ReplayGraphNode | FlowGraphNode | ActivityGraphNode;
15
15
  export interface RequirementGraphNode extends BaseGraphNode {
16
16
  type: "requirement";
17
17
  content: string;
@@ -45,6 +45,17 @@ export interface FeedbackGraphNode extends BaseGraphNode {
45
45
  export interface ReplayGraphNode extends BaseGraphNode {
46
46
  type: "replay";
47
47
  }
48
+ export interface FlowGraphNode extends BaseGraphNode {
49
+ type: "flow";
50
+ flow: ServiceFlowRun;
51
+ taskId: string;
52
+ }
53
+ export interface ActivityGraphNode extends BaseGraphNode {
54
+ type: "activity";
55
+ activity: ActivityRun;
56
+ flow: ServiceFlowRun;
57
+ taskId: string;
58
+ }
48
59
  export interface BaseGraphNode {
49
60
  id: string;
50
61
  type: string;
@@ -1,7 +1,8 @@
1
- import type { ConversationBaseDetail, ConversationPatch, ConversationError, Task } from "../../shared/interfaces";
1
+ import type { ConversationBaseDetail, ConversationPatch, ConversationError, Task, ServiceFlowRun } from "../../shared/interfaces";
2
2
  export interface CruiseCanvasState {
3
3
  conversation: ConversationBaseDetail | null;
4
4
  tasks: Task[];
5
+ serviceFlows: ServiceFlowRun[];
5
6
  errors: ConversationError[];
6
7
  }
7
8
  export type CruiseCanvasAction = ConversationSSEAction | ConversationResetAction | ConversationFinishedAction;
@@ -0,0 +1,4 @@
1
+ import type { Reducer } from "react";
2
+ import type { ServiceFlowRun } from "../../shared/interfaces";
3
+ import type { CruiseCanvasAction } from "./interfaces";
4
+ export declare const serviceFlows: Reducer<ServiceFlowRun[], CruiseCanvasAction>;
@@ -2,6 +2,7 @@ import type { RequestStore } from "../shared/interfaces";
2
2
  export declare function useConversationDetail(conversationId: string, initialRequest?: RequestStore | null, replay?: boolean, replayDelay?: number): {
3
3
  conversation: import("../shared/interfaces").ConversationBaseDetail | null;
4
4
  tasks: import("../shared/interfaces").Task[];
5
+ serviceFlows: import("../shared/interfaces").ServiceFlowRun[];
5
6
  errors: import("../shared/interfaces").ConversationError[];
6
7
  humanInputRef: React.MutableRefObject<((jobId: string, input: string | null, action?: string) => void) | undefined>;
7
8
  skipToResults: () => void;
@@ -1,6 +1,6 @@
1
1
  import type { GraphEdge, GraphNode, GraphNavItem, GraphGeneratedView } from "./interfaces";
2
- import type { ConversationBaseDetail, ConversationError, Task } from "../shared/interfaces";
3
- export declare function useConversationGraph(conversation: ConversationBaseDetail | null | undefined, tasks: Task[], errors: ConversationError[], options?: {
2
+ import type { ActivityWithFlow, ConversationBaseDetail, ConversationError, ServiceFlowRun, Task } from "../shared/interfaces";
3
+ export declare function useConversationGraph(conversation: ConversationBaseDetail | null | undefined, tasks: Task[], errors: ConversationError[], flowMap?: Map<string, ServiceFlowRun>, activityMap?: Map<string, ActivityWithFlow>, options?: {
4
4
  showHiddenJobs?: boolean;
5
5
  showHumanActions?: boolean;
6
6
  separateInstructions?: boolean;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Format duration as "00:12"
3
+ *
4
+ * @param duration in seconds
5
+ */
6
+ export declare function formatDuration(duration: number): string;
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import { ReactNextElement } from "@next-core/react-element";
3
+ import "@next-core/theme";
4
+ import type { JobState, TaskState } from "../shared/interfaces.js";
5
+ export interface RunningFlowProps {
6
+ spec?: FlowStage[];
7
+ activeActivityId?: string | null;
8
+ }
9
+ export interface FlowStage {
10
+ name: string;
11
+ serviceFlowActivities?: FlowActivity[];
12
+ }
13
+ export interface FlowActivity {
14
+ name: string;
15
+ taskId?: string;
16
+ state?: TaskState | JobState;
17
+ startTime?: number;
18
+ endTime?: number;
19
+ }
20
+ export interface RunningFlowEvents {
21
+ "active.change": CustomEvent<string | null>;
22
+ }
23
+ export interface RunningFlowMapEvents {
24
+ onActiveChange: "active.change";
25
+ }
26
+ /**
27
+ * 构件 `ai-portal.running-flow`
28
+ */
29
+ export declare class RunningFlow extends ReactNextElement implements RunningFlowProps {
30
+ #private;
31
+ accessor spec: FlowStage[] | undefined;
32
+ accessor activeActivityId: string | null | undefined;
33
+ render(): React.JSX.Element;
34
+ }
@@ -0,0 +1 @@
1
+ import "./";
@@ -1,4 +1,5 @@
1
1
  import type { HumanAction } from "../interfaces";
2
- export declare function RequestHumanAction({ action, }: {
2
+ export declare function RequestHumanAction({ action, ui, }: {
3
3
  action: HumanAction;
4
+ ui?: "canvas" | "chat";
4
5
  }): JSX.Element | null;
@@ -1,8 +1,11 @@
1
1
  import { type Dispatch } from "react";
2
2
  import type { FeedbackDetail } from "../cruise-canvas/interfaces";
3
- import type { ExampleProject, GeneratedView, Job, ShowCaseType } from "./interfaces";
3
+ import type { ActiveDetail, ConversationError, ConversationState, ExampleProject, GeneratedView, Job, ShowCaseType, Task } from "./interfaces";
4
4
  export interface TaskContextValue {
5
5
  conversationId?: string;
6
+ conversationState?: ConversationState;
7
+ tasks: Task[];
8
+ errors: ConversationError[];
6
9
  workspace?: string;
7
10
  previewUrlTemplate?: string;
8
11
  replay?: boolean;
@@ -14,8 +17,10 @@ export interface TaskContextValue {
14
17
  supports?: Record<string, boolean>;
15
18
  activeExpandedViewJobId: string | null;
16
19
  setActiveExpandedViewJobId: Dispatch<React.SetStateAction<string | null>>;
17
- activeToolCallJobId: string | null;
18
- setActiveToolCallJobId: Dispatch<React.SetStateAction<string | null>>;
20
+ activeDetail: ActiveDetail | null;
21
+ setActiveDetail: Dispatch<React.SetStateAction<ActiveDetail | null>>;
22
+ subActiveDetail: ActiveDetail | null;
23
+ setSubActiveDetail: Dispatch<React.SetStateAction<ActiveDetail | null>>;
19
24
  submittingFeedback: boolean;
20
25
  submittedFeedback: boolean;
21
26
  onSubmitFeedback: (detail: FeedbackDetail) => void;
@@ -10,6 +10,8 @@ import { CodeBlock, CodeBlockProps } from "@next-bricks/presentational/code-bloc
10
10
  import type { IconButton, IconButtonProps } from "../icon-button";
11
11
  import type { ChatInput, ChatInputEvents, ChatInputMapEvents, ChatInputProps } from "../chat-input";
12
12
  import type { ShowCase, ShowCaseProps } from "../show-case";
13
+ import type { RunningFlow, RunningFlowEvents, RunningFlowMapEvents, RunningFlowProps } from "../running-flow";
14
+ import type { BlankState, BlankStateProps } from "../blank-state";
13
15
  export declare const WrappedIcon: import("@next-core/react-element").WrappedBrick<GeneralIcon, GeneralIconProps>;
14
16
  export declare const WrappedButton: import("@next-core/react-element").WrappedBrick<Button, ButtonProps>;
15
17
  export declare const WrappedLink: import("@next-core/react-element").WrappedBrick<Link, LinkProps>;
@@ -22,6 +24,8 @@ export declare const WrappedIconButton: import("@next-core/react-element").Wrapp
22
24
  export declare const WrappedChatInput: import("@next-core/react-element").WrappedBrickWithEventsMap<ChatInput, ChatInputProps, ChatInputEvents, ChatInputMapEvents>;
23
25
  export declare const WrappedShowCase: import("@next-core/react-element").WrappedBrick<ShowCase, ShowCaseProps>;
24
26
  export declare const WrappedCodeBlock: import("@next-core/react-element").WrappedBrick<CodeBlock, CodeBlockProps>;
27
+ export declare const WrappedBlankState: import("@next-core/react-element").WrappedBrick<BlankState, BlankStateProps>;
28
+ export declare const WrappedRunningFlow: import("@next-core/react-element").WrappedBrickWithEventsMap<RunningFlow, RunningFlowProps, RunningFlowEvents, RunningFlowMapEvents>;
25
29
  export declare const showDialog: (options: import("@next-bricks/basic/data-providers/show-dialog/show-dialog").DialogOptions) => Promise<void>;
26
30
  export declare const copyToClipboard: (text: string) => Promise<void>;
27
31
  export declare const AsyncWrappedTable: React.LazyExoticComponent<import("@next-core/react-element").WrappedBrick<EoNextTable, NextTableProps>>;
@@ -9,3 +9,4 @@ export declare const ICON_CANVAS: GeneralIconProps;
9
9
  export declare const ICON_CHAT: GeneralIconProps;
10
10
  export declare const ICON_FEEDBACK: GeneralIconProps;
11
11
  export declare const ICON_EXTERNAL_LINK: GeneralIconProps;
12
+ export declare const ICON_UP: GeneralIconProps;
@@ -0,0 +1,6 @@
1
+ import type { MessageChunk } from "../chat-stream/interfaces";
2
+ import type { Task, ServiceFlowRun, ActivityWithFlow, ConversationError, Job } from "../shared/interfaces";
3
+ export declare function getFlatChunks(tasks: Task[], errors: ConversationError[], flowMap?: Map<string, ServiceFlowRun>, activityMap?: Map<string, ActivityWithFlow>, skipActivitySubTasks?: boolean): {
4
+ chunks: MessageChunk[];
5
+ jobMap: Map<string, Job>;
6
+ };
@@ -0,0 +1,3 @@
1
+ import type { GeneralIconProps } from "@next-bricks/icons/general-icon";
2
+ import type { ConversationState, JobState, TaskState } from "./interfaces";
3
+ export declare function getFlowOrActivityIcon(state: TaskState | JobState | ConversationState | undefined): GeneralIconProps;
@@ -4,15 +4,11 @@ export interface GeneralNode {
4
4
  parent?: string;
5
5
  hidden?: boolean;
6
6
  }
7
- export interface GetOrderedNodesOptions {
8
- showHiddenNodes?: boolean;
9
- }
10
- export declare function getOrderedNodes<T extends GeneralNode>(nodes: T[] | null | undefined, options?: GetOrderedNodesOptions): {
7
+ export declare function getOrderedNodes<T extends GeneralNode>(nodes: T[]): {
11
8
  list: string[];
12
9
  map: Map<string, T>;
13
- levels: Map<string, number>;
14
10
  roots: string[];
15
11
  leaves: string[];
12
+ childMap: Map<string, string>;
16
13
  downstreamMap: Map<string, string[]>;
17
- fullDownstreamMap: Map<string, string[]> | undefined;
18
14
  };
@@ -0,0 +1,10 @@
1
+ import type { Task, Job } from "../shared/interfaces";
2
+ export interface TaskTreeNode {
3
+ task: Task;
4
+ children: JobTreeNode[];
5
+ }
6
+ export interface JobTreeNode {
7
+ job: Job;
8
+ subTask?: TaskTreeNode;
9
+ }
10
+ export declare function getTaskTree(tasks: Task[]): TaskTreeNode[];
@@ -5,6 +5,7 @@ export interface Conversation {
5
5
  projectId?: string;
6
6
  state: ConversationState;
7
7
  tasks: Task[];
8
+ serviceFlows: ServiceFlowRun[];
8
9
  startTime: number;
9
10
  endTime?: number;
10
11
  finished?: boolean;
@@ -21,10 +22,11 @@ export interface Task {
21
22
  aiEmployeeId?: string;
22
23
  }
23
24
  export type ConversationState = "working" | "completed" | "failed" | "input-required" | "terminated";
24
- export type TaskState = "free" | "confirming" | "executing" | "completed" | "failed";
25
+ export type TaskState = "free" | "confirming" | "executing" | "input-required" | "completed" | "failed";
25
26
  export type JobState = "submitted" | "working" | "input-required" | "completed" | "canceled" | "failed" | "skipped" | "unknown";
26
27
  export interface Job {
27
28
  id: string;
29
+ type?: "default" | "subTask" | "serviceFlow";
28
30
  upstream?: string[];
29
31
  parent?: string;
30
32
  instruction?: string;
@@ -38,6 +40,10 @@ export interface Job {
38
40
  generatedView?: GeneratedView;
39
41
  requestHumanAction?: HumanAction;
40
42
  humanAction?: string;
43
+ hil?: {
44
+ userInstanceId: string;
45
+ username: string;
46
+ };
41
47
  aiEmployeeId?: string;
42
48
  username?: string;
43
49
  cmd?: CommandPayload;
@@ -90,10 +96,11 @@ export interface ToolCall {
90
96
  };
91
97
  }
92
98
  export type ConversationBaseDetail = Omit<Conversation, "tasks">;
93
- export interface ConversationPatch extends Omit<Partial<Conversation>, "tasks"> {
99
+ export interface ConversationPatch extends Omit<Partial<Conversation>, "tasks" | "serviceFlows"> {
94
100
  tasks?: TaskPatch[];
95
101
  error?: string;
96
102
  time?: number;
103
+ serviceFlows?: ServiceFlowPatch[];
97
104
  }
98
105
  export interface TaskPatch extends Omit<Partial<Task>, "jobs"> {
99
106
  id: string;
@@ -106,6 +113,10 @@ export interface RequestStore {
106
113
  conversationId: string;
107
114
  content: string;
108
115
  cmd?: CommandPayload;
116
+ files?: UploadFileInfo[];
117
+ }
118
+ export interface UploadFileInfo {
119
+ fileId: string;
109
120
  }
110
121
  export interface GeneratedView {
111
122
  viewId: string;
@@ -132,7 +143,7 @@ export interface ExampleProject {
132
143
  url?: string;
133
144
  }
134
145
  export interface ConversationError {
135
- jobs: string[];
146
+ taskId?: string;
136
147
  error?: string;
137
148
  }
138
149
  export type CommandPayload = CommandPayloadServiceFlowStarting;
@@ -145,3 +156,54 @@ export interface CommandPayloadServiceFlowStarting {
145
156
  flowName?: string;
146
157
  };
147
158
  }
159
+ export interface ServiceFlowRun {
160
+ taskId: string;
161
+ flowInstanceId: string;
162
+ name: string;
163
+ spec: StageRun[];
164
+ space: CollaborationSpace;
165
+ }
166
+ export interface StageRun {
167
+ name: string;
168
+ serviceFlowActivities: ActivityRun[];
169
+ }
170
+ export interface ActivityRun {
171
+ taskId?: string;
172
+ name: string;
173
+ }
174
+ export interface CollaborationSpace {
175
+ instanceId: string;
176
+ name: string;
177
+ }
178
+ export interface ServiceFlowPatch extends Partial<Omit<ServiceFlowRun, "spec">> {
179
+ taskId: string;
180
+ spec?: StagePatch[];
181
+ fullSpec?: StageRun[];
182
+ space?: CollaborationSpace;
183
+ }
184
+ export interface StagePatch {
185
+ name: string;
186
+ serviceFlowActivities?: ActivityRun[];
187
+ }
188
+ export interface ActivityWithFlow {
189
+ flow: ServiceFlowRun;
190
+ activity: ActivityRun;
191
+ }
192
+ export interface ActiveDetail {
193
+ type: "job" | "flow" | "activity";
194
+ id: string;
195
+ }
196
+ export type FulfilledActiveDetail = ActiveDetailOfJob | ActiveDetailOfFlow | ActiveDetailOfActivity;
197
+ export interface ActiveDetailOfJob {
198
+ type: "job";
199
+ job: Job;
200
+ }
201
+ export interface ActiveDetailOfFlow {
202
+ type: "flow";
203
+ flow: ServiceFlowRun;
204
+ }
205
+ export interface ActiveDetailOfActivity {
206
+ type: "activity";
207
+ activity: ActivityRun;
208
+ flow: ServiceFlowRun;
209
+ }
@@ -0,0 +1,5 @@
1
+ import type { ActivityWithFlow, ServiceFlowRun } from "./interfaces";
2
+ export declare function useFlowAndActivityMap(serviceFlows: ServiceFlowRun[]): {
3
+ flowMap: Map<string, ServiceFlowRun>;
4
+ activityMap: Map<string, ActivityWithFlow>;
5
+ };
@@ -0,0 +1,2 @@
1
+ import type { ActiveDetail, ActivityWithFlow, FulfilledActiveDetail, Job, ServiceFlowRun } from "./interfaces";
2
+ export declare function useFulfilledActiveDetail(activeDetail: ActiveDetail | null, jobMap: Map<string, Job> | undefined, flowMap: Map<string, ServiceFlowRun>, activityMap: Map<string, ActivityWithFlow>): FulfilledActiveDetail | null;