@next-bricks/ai-portal 0.55.0 → 0.56.0

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 (82) hide show
  1. package/dist/bricks.json +36 -28
  2. package/dist/chunks/1510.d022a470.js +2 -0
  3. package/dist/chunks/1510.d022a470.js.map +1 -0
  4. package/dist/chunks/{2084.0e9751e7.js → 2084.778e8126.js} +3 -3
  5. package/dist/chunks/2084.778e8126.js.map +1 -0
  6. package/dist/chunks/6995.cb0a8137.js +2 -0
  7. package/dist/chunks/6995.cb0a8137.js.map +1 -0
  8. package/dist/chunks/7517.b5ed4e8e.js +2 -0
  9. package/dist/chunks/7517.b5ed4e8e.js.map +1 -0
  10. package/dist/chunks/9324.e514b672.js +2 -0
  11. package/dist/chunks/9324.e514b672.js.map +1 -0
  12. package/dist/chunks/{chat-stream.11c6ade7.js → chat-stream.24066a8e.js} +2 -2
  13. package/dist/chunks/{chat-stream.11c6ade7.js.map → chat-stream.24066a8e.js.map} +1 -1
  14. package/dist/chunks/{cruise-canvas.c494563b.js → cruise-canvas.eca7469a.js} +2 -2
  15. package/dist/chunks/{cruise-canvas.c494563b.js.map → cruise-canvas.eca7469a.js.map} +1 -1
  16. package/dist/chunks/{elevo-sidebar.bfad7500.js → elevo-sidebar.08aad53b.js} +3 -3
  17. package/dist/chunks/{elevo-sidebar.bfad7500.js.map → elevo-sidebar.08aad53b.js.map} +1 -1
  18. package/dist/chunks/{main.6b7402db.js → main.0653045c.js} +2 -2
  19. package/dist/chunks/{main.6b7402db.js.map → main.0653045c.js.map} +1 -1
  20. package/dist/chunks/running-flow.4b117f11.js +3 -0
  21. package/dist/chunks/running-flow.4b117f11.js.LICENSE.txt +5 -0
  22. package/dist/chunks/running-flow.4b117f11.js.map +1 -0
  23. package/dist/examples.json +20 -17
  24. package/dist/index.e11d54e9.js +2 -0
  25. package/dist/index.e11d54e9.js.map +1 -0
  26. package/dist/manifest.json +242 -216
  27. package/dist/types.json +1106 -824
  28. package/dist-types/bootstrap.d.ts +1 -0
  29. package/dist-types/chat-stream/Aside/Aside.d.ts +3 -3
  30. package/dist-types/chat-stream/Aside/FlowApp/FlowApp.d.ts +7 -0
  31. package/dist-types/chat-stream/Aside/FlowApp/i18n.d.ts +20 -0
  32. package/dist-types/chat-stream/AssistantMessage/AssistantMessage.d.ts +3 -5
  33. package/dist-types/chat-stream/NodeChunk/NodeChunk.d.ts +6 -0
  34. package/dist-types/chat-stream/NodeChunk/NodeJob.d.ts +6 -0
  35. package/dist-types/chat-stream/NodeChunk/getStateDisplay.d.ts +6 -0
  36. package/dist-types/chat-stream/StreamContext.d.ts +2 -1
  37. package/dist-types/chat-stream/UserMessage/UserMessage.d.ts +3 -1
  38. package/dist-types/chat-stream/i18n.d.ts +5 -1
  39. package/dist-types/chat-stream/interfaces.d.ts +26 -3
  40. package/dist-types/chat-stream/useConversationStream.d.ts +5 -5
  41. package/dist-types/cruise-canvas/NodeChunk/NodeChunk.d.ts +9 -0
  42. package/dist-types/cruise-canvas/NodeRequirement/NodeRequirement.d.ts +3 -1
  43. package/dist-types/cruise-canvas/i18n.d.ts +3 -1
  44. package/dist-types/cruise-canvas/interfaces.d.ts +14 -2
  45. package/dist-types/cruise-canvas/reducers/interfaces.d.ts +2 -1
  46. package/dist-types/cruise-canvas/reducers/serviceFlows.d.ts +4 -0
  47. package/dist-types/cruise-canvas/useConversationDetail.d.ts +1 -0
  48. package/dist-types/cruise-canvas/useConversationGraph.d.ts +3 -3
  49. package/dist-types/running-flow/formatDuration.d.ts +6 -0
  50. package/dist-types/running-flow/index.d.ts +34 -0
  51. package/dist-types/running-flow/index.spec.d.ts +1 -0
  52. package/dist-types/shared/ReadableCommand/ReadableCommand.d.ts +7 -0
  53. package/dist-types/shared/RequestHumanAction/RequestHumanAction.d.ts +2 -1
  54. package/dist-types/shared/TaskContext.d.ts +6 -3
  55. package/dist-types/shared/bricks.d.ts +4 -0
  56. package/dist-types/shared/constants.d.ts +1 -0
  57. package/dist-types/shared/getFlatChunks.d.ts +3 -0
  58. package/dist-types/shared/getFlowOrActivityIcon.d.ts +3 -0
  59. package/dist-types/{cruise-canvas → shared}/getOrderedNodes.d.ts +2 -6
  60. package/dist-types/shared/getTaskTree.d.ts +10 -0
  61. package/dist-types/shared/interfaces.d.ts +64 -3
  62. package/dist-types/shared/useFlowAndActivityMap.d.ts +5 -0
  63. package/dist-types/shared/useFulfilledActiveDetail.d.ts +2 -0
  64. package/docs/running-flow.md +22 -0
  65. package/package.json +2 -2
  66. package/dist/chunks/2084.0e9751e7.js.map +0 -1
  67. package/dist/chunks/2761.561a580a.js +0 -2
  68. package/dist/chunks/2761.561a580a.js.map +0 -1
  69. package/dist/chunks/3227.689d8678.js +0 -2
  70. package/dist/chunks/3227.689d8678.js.map +0 -1
  71. package/dist/chunks/6201.fa3b6e24.js +0 -2
  72. package/dist/chunks/6201.fa3b6e24.js.map +0 -1
  73. package/dist/chunks/8717.1e5ad2b1.js +0 -2
  74. package/dist/chunks/8717.1e5ad2b1.js.map +0 -1
  75. package/dist/index.14c08956.js +0 -2
  76. package/dist/index.14c08956.js.map +0 -1
  77. package/dist-types/chat-stream/NodeJob/NodeJob.d.ts +0 -7
  78. package/dist-types/cruise-canvas/getFlatOrderedJobs.d.ts +0 -11
  79. package/dist-types/cruise-canvas/getFlatOrderedJobs.spec.d.ts +0 -1
  80. /package/dist/chunks/{2084.0e9751e7.js.LICENSE.txt → 2084.778e8126.js.LICENSE.txt} +0 -0
  81. /package/dist/chunks/{elevo-sidebar.bfad7500.js.LICENSE.txt → elevo-sidebar.08aad53b.js.LICENSE.txt} +0 -0
  82. /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,6 @@
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
5
  }
6
- export declare function Aside({ job }: AsideProps): React.JSX.Element;
6
+ export declare function Aside({ detail }: 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,7 @@
1
1
  import React from "react";
2
- import type { ConversationState, Job, TaskState } from "../../shared/interfaces.js";
2
+ import type { MessageChunk } from "../interfaces";
3
3
  export interface AssistantMessageProps {
4
- jobs: Job[];
5
- taskState: TaskState | ConversationState | undefined;
6
- error?: string | null;
4
+ chunks: MessageChunk[];
7
5
  isLatest?: boolean;
8
6
  }
9
- export declare function AssistantMessage({ jobs, taskState, error, isLatest, }: AssistantMessageProps): React.JSX.Element;
7
+ export declare function AssistantMessage({ chunks, isLatest }: AssistantMessageProps): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import type { MessageChunk } from "../interfaces.js";
3
+ export interface NodeChunkProps {
4
+ chunk: MessageChunk;
5
+ }
6
+ export declare function NodeChunk({ chunk }: NodeChunkProps): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import type { Job } from "../../shared/interfaces.js";
3
+ export interface NodeJobProps {
4
+ job: Job;
5
+ }
6
+ export declare function NodeJob({ job }: 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,7 @@
1
1
  import React from "react";
2
+ import type { CommandPayload } from "../../shared/interfaces";
2
3
  export interface UserMessageProps {
3
4
  content: string;
5
+ cmd?: CommandPayload;
4
6
  }
5
- export declare function UserMessage({ content }: UserMessageProps): React.JSX.Element;
7
+ export declare function UserMessage({ content, cmd }: UserMessageProps): React.JSX.Element;
@@ -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,11 +1,34 @@
1
- import type { 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
+ cmd?: CommandPayload;
7
+ fromSkippedSubTask?: boolean;
6
8
  }
7
9
  export interface MessageFromAssistant {
8
10
  role: "assistant";
9
- jobs: Job[];
10
- 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;
11
34
  }
@@ -1,13 +1,13 @@
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, Job, 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
5
  }): {
6
6
  messages: never[];
7
- lastToolCallJobId: null;
7
+ lastDetail: null;
8
8
  jobMap?: undefined;
9
9
  } | {
10
10
  messages: ChatMessage[];
11
- jobMap: Map<string, import("../shared/interfaces.js").Job>;
12
- lastToolCallJobId: string | null;
11
+ jobMap: Map<string, Job>;
12
+ lastDetail: ActiveDetail | null;
13
13
  };
@@ -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;
@@ -1,7 +1,9 @@
1
+ import type { CommandPayload } from "../../shared/interfaces";
1
2
  export interface NodeRequirementProps {
2
3
  username?: string;
3
4
  content?: string;
4
5
  startTime?: number;
5
6
  active?: boolean;
7
+ cmd?: CommandPayload;
6
8
  }
7
- export declare function NodeRequirement({ username, content, startTime, active, }: NodeRequirementProps): JSX.Element;
9
+ export declare function NodeRequirement({ username, content, startTime, active, cmd, }: NodeRequirementProps): 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 { 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,11 +11,12 @@ 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;
18
18
  username?: string;
19
+ cmd?: CommandPayload;
19
20
  }
20
21
  export interface LoadingGraphNode extends BaseGraphNode {
21
22
  type: "loading";
@@ -44,6 +45,17 @@ export interface FeedbackGraphNode extends BaseGraphNode {
44
45
  export interface ReplayGraphNode extends BaseGraphNode {
45
46
  type: "replay";
46
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
+ }
47
59
  export interface BaseGraphNode {
48
60
  id: string;
49
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, Job, 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;
@@ -9,6 +9,6 @@ export declare function useConversationGraph(conversation: ConversationBaseDetai
9
9
  edges: GraphEdge[];
10
10
  nav: GraphNavItem[];
11
11
  views: GraphGeneratedView[];
12
- jobMap: Map<string, import("../shared/interfaces").Job>;
12
+ jobMap: Map<string, Job>;
13
13
  jobLevels: Map<string, number>;
14
14
  } | null;
@@ -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 "./";
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { CommandPayload } from "../interfaces";
3
+ export interface ReadableCommandProps {
4
+ cmd: CommandPayload;
5
+ size?: "medium" | "small";
6
+ }
7
+ export declare function ReadableCommand({ cmd, size }: ReadableCommandProps): React.JSX.Element;
@@ -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,8 @@ 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>>;
19
22
  submittingFeedback: boolean;
20
23
  submittedFeedback: boolean;
21
24
  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,3 @@
1
+ import type { MessageChunk } from "../chat-stream/interfaces";
2
+ import type { Task, ServiceFlowRun, ActivityWithFlow, ConversationError } from "../shared/interfaces";
3
+ export declare function getFlatChunks(tasks: Task[], errors: ConversationError[], flowMap?: Map<string, ServiceFlowRun>, activityMap?: Map<string, ActivityWithFlow>, skipActivitySubTasks?: boolean): MessageChunk[];
@@ -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,8 +40,13 @@ 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;
49
+ cmd?: CommandPayload;
43
50
  }
44
51
  export type HumanAction = HumanActionConfirm | HumanActionSelect;
45
52
  export interface HumanActionConfirm {
@@ -89,10 +96,11 @@ export interface ToolCall {
89
96
  };
90
97
  }
91
98
  export type ConversationBaseDetail = Omit<Conversation, "tasks">;
92
- export interface ConversationPatch extends Omit<Partial<Conversation>, "tasks"> {
99
+ export interface ConversationPatch extends Omit<Partial<Conversation>, "tasks" | "serviceFlows"> {
93
100
  tasks?: TaskPatch[];
94
101
  error?: string;
95
102
  time?: number;
103
+ serviceFlows?: ServiceFlowPatch[];
96
104
  }
97
105
  export interface TaskPatch extends Omit<Partial<Task>, "jobs"> {
98
106
  id: string;
@@ -131,7 +139,7 @@ export interface ExampleProject {
131
139
  url?: string;
132
140
  }
133
141
  export interface ConversationError {
134
- jobs: string[];
142
+ taskId?: string;
135
143
  error?: string;
136
144
  }
137
145
  export type CommandPayload = CommandPayloadServiceFlowStarting;
@@ -139,6 +147,59 @@ export interface CommandPayloadServiceFlowStarting {
139
147
  type: "serviceFlowStarting";
140
148
  serviceFlowStarting: {
141
149
  spaceInstanceId: string;
150
+ spaceName?: string;
142
151
  flowInstanceId?: string;
152
+ flowName?: string;
143
153
  };
144
154
  }
155
+ export interface ServiceFlowRun {
156
+ taskId: string;
157
+ flowInstanceId: string;
158
+ name: string;
159
+ spec: StageRun[];
160
+ space: CollaborationSpace;
161
+ }
162
+ export interface StageRun {
163
+ name: string;
164
+ serviceFlowActivities: ActivityRun[];
165
+ }
166
+ export interface ActivityRun {
167
+ taskId?: string;
168
+ name: string;
169
+ }
170
+ export interface CollaborationSpace {
171
+ instanceId: string;
172
+ name: string;
173
+ }
174
+ export interface ServiceFlowPatch extends Partial<Omit<ServiceFlowRun, "spec">> {
175
+ taskId: string;
176
+ spec?: StagePatch[];
177
+ fullSpec?: StageRun[];
178
+ space?: CollaborationSpace;
179
+ }
180
+ export interface StagePatch {
181
+ name: string;
182
+ serviceFlowActivities?: ActivityRun[];
183
+ }
184
+ export interface ActivityWithFlow {
185
+ flow: ServiceFlowRun;
186
+ activity: ActivityRun;
187
+ }
188
+ export interface ActiveDetail {
189
+ type: "job" | "flow" | "activity";
190
+ id: string;
191
+ }
192
+ export type FulfilledActiveDetail = ActiveDetailOfJob | ActiveDetailOfFlow | ActiveDetailOfActivity;
193
+ export interface ActiveDetailOfJob {
194
+ type: "job";
195
+ job: Job;
196
+ }
197
+ export interface ActiveDetailOfFlow {
198
+ type: "flow";
199
+ flow: ServiceFlowRun;
200
+ }
201
+ export interface ActiveDetailOfActivity {
202
+ type: "activity";
203
+ activity: ActivityRun;
204
+ flow: ServiceFlowRun;
205
+ }
@@ -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;
@@ -0,0 +1,22 @@
1
+ 构件 `ai-portal.running-flow`
2
+
3
+ ## Examples
4
+
5
+ ### Basic
6
+
7
+ ```yaml preview
8
+ brick: ai-portal.running-flow
9
+ properties:
10
+ spec:
11
+ - name: Requirement
12
+ serviceFlowActivities:
13
+ - name: Requirement collects
14
+ state: completed
15
+ - name: Requirement documents
16
+ state: input-required
17
+ - name: Sprint Planning
18
+ serviceFlowActivities:
19
+ - name: planning
20
+ state: working
21
+ - name: sprinting
22
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/ai-portal",
3
- "version": "0.55.0",
3
+ "version": "0.56.0",
4
4
  "homepage": "https://github.com/easyops-cn/next-advanced-bricks/tree/master/bricks/ai-portal",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,5 +47,5 @@
47
47
  "@next-bricks/presentational": "*",
48
48
  "@next-bricks/vs": "*"
49
49
  },
50
- "gitHead": "e7cda4d9f829a0395da2471e7d1058ea21394dd3"
50
+ "gitHead": "e59f8a4a682e49fc929d7afe12570d1131184668"
51
51
  }