@arcgis/ai-components 5.2.0-next.5 → 5.2.0-next.51
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/dist/agent-utils/FunctionAgent.d.ts +2 -2
- package/dist/agent-utils/LLMAgent.d.ts +2 -2
- package/dist/agent-utils/LLMAgent.js +1 -0
- package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
- package/dist/agent-utils/index.d.ts +177 -0
- package/dist/agent-utils/index.js +167 -0
- package/dist/agent-utils/middlewares/trace.d.ts +2 -0
- package/dist/agent-utils/middlewares/trace.js +25 -33
- package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
- package/dist/agent-utils/types.d.ts +36 -7
- package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
- package/dist/cdn/2ER3LN6U.js +2 -0
- package/dist/cdn/2W6XPTA6.js +9 -0
- package/dist/cdn/3DJDRAGV.js +2 -0
- package/dist/cdn/3LCF5HIE.js +3 -0
- package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
- package/dist/cdn/434TAA3J.js +2 -0
- package/dist/cdn/4CEMUECT.js +2 -0
- package/dist/cdn/4G5XCUE5.js +2 -0
- package/dist/cdn/57OMVTIU.js +2 -0
- package/dist/cdn/5I35MJXT.js +48 -0
- package/dist/cdn/6O6KMX3M.js +2 -0
- package/dist/cdn/6U7TEAAJ.js +2 -0
- package/dist/cdn/7FY4G4K2.js +2 -0
- package/dist/cdn/7YIRK2E3.js +2 -0
- package/dist/cdn/A4JLOAOH.js +2 -0
- package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
- package/dist/cdn/APFZY4PI.js +2 -0
- package/dist/cdn/BE7ZN5FZ.js +2 -0
- package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
- package/dist/cdn/BMGQJYTE.js +2 -0
- package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
- package/dist/cdn/CMG2NY3K.js +2 -0
- package/dist/cdn/DMLRWHBA.js +2 -0
- package/dist/cdn/EQLRFZVU.js +18 -0
- package/dist/cdn/EW6AYEUX.js +36 -0
- package/dist/cdn/F5SUU35Z.js +2 -0
- package/dist/cdn/FYW633VX.js +2 -0
- package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
- package/dist/cdn/{H7422XUG.js → GYVSHAUI.js} +1 -1
- package/dist/cdn/HBLRVXEB.js +2 -0
- package/dist/cdn/HJG7QM2R.js +9 -0
- package/dist/cdn/HQXPPYMD.js +2 -0
- package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
- package/dist/cdn/ICYUPLZM.js +56 -0
- package/dist/cdn/IEHPNCTL.js +2 -0
- package/dist/cdn/IHP25JWI.js +99 -0
- package/dist/cdn/J6A4AS7E.js +22 -0
- package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
- package/dist/cdn/JEL5M7FA.js +2 -0
- package/dist/cdn/{CXWBEDXN.js → JSIGEUX7.js} +6 -4
- package/dist/cdn/JSJ4RMOE.js +2 -0
- package/dist/cdn/JVYPIWEU.js +2 -0
- package/dist/cdn/KJJAXCP4.js +2 -0
- package/dist/cdn/LHLO6PTD.js +2 -0
- package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
- package/dist/cdn/LUY6V4TP.js +181 -0
- package/dist/cdn/M3MRIGDZ.js +2 -0
- package/dist/cdn/MS5EA2KY.js +2 -0
- package/dist/cdn/MWYBF3F3.js +66 -0
- package/dist/cdn/NAKAZDJ7.js +4 -0
- package/dist/cdn/NEV6OZN3.js +71 -0
- package/dist/cdn/O5TONDCH.js +2 -0
- package/dist/cdn/OC5GA5ZQ.js +3 -0
- package/dist/cdn/OGMMYFHR.js +2 -0
- package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
- package/dist/cdn/OYNIFMCJ.js +2 -0
- package/dist/cdn/PNFBQ6JV.js +180 -0
- package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
- package/dist/cdn/PVE7Q43N.js +2 -0
- package/dist/cdn/R74ZHFA6.js +2 -0
- package/dist/cdn/RLEHNAIA.js +2 -0
- package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
- package/dist/cdn/SJR4IR57.js +2 -0
- package/dist/cdn/SPVOBZAL.js +2 -0
- package/dist/cdn/SUA3YJTU.js +22 -0
- package/dist/cdn/T7DYMSJV.js +65 -0
- package/dist/cdn/TFT6HK3O.js +208 -0
- package/dist/cdn/THR22OXW.js +2 -0
- package/dist/cdn/TPULIO6I.js +34 -0
- package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
- package/dist/cdn/UK7PR2FE.js +2 -0
- package/dist/cdn/UZLQALHY.js +2 -0
- package/dist/cdn/V6HOUZPZ.js +2 -0
- package/dist/cdn/VAXH6RUQ.js +134 -0
- package/dist/cdn/VPFIUEKT.js +14 -0
- package/dist/cdn/VXFQANGJ.js +2 -0
- package/dist/cdn/XCRR2EEG.js +6 -0
- package/dist/cdn/YHQJ66WJ.js +2 -0
- package/dist/cdn/YYSMCB4A.js +2 -0
- package/dist/cdn/Z6I6JACX.js +3 -0
- package/dist/cdn/ZB57WYHC.js +2 -0
- package/dist/cdn/ZS6SXJP2.js +2 -0
- package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
- package/dist/cdn/agent-utils/index.js +2 -0
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
- package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
- package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/adapter.js +1794 -1597
- package/dist/chunks/arcgisKnowledgeGraph.js +126 -71
- package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
- package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
- package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
- package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
- package/dist/chunks/converterUtils.js +39 -32
- package/dist/chunks/dataExplorationGraph.js +139 -113
- package/dist/chunks/data_explore_query_prompt.js +9 -4
- package/dist/chunks/generateLayerDescriptions.js +248 -228
- package/dist/chunks/helpGraph.js +17 -13
- package/dist/chunks/help_prompt.js +34 -17
- package/dist/chunks/index.js +11 -0
- package/dist/chunks/intent_prompt.js +16 -0
- package/dist/chunks/layerStylingGraph.js +24 -20
- package/dist/chunks/navigationGraph.js +33 -28
- package/dist/chunks/navigation_intent_prompt.js +8 -2
- package/dist/chunks/orchestrator.js +110 -108
- package/dist/chunks/slottableRequestUtils.js +3 -7
- package/dist/chunks/state.js +1 -1
- package/dist/chunks/summarize_query_response_prompt.js +9 -7
- package/dist/chunks/toolCallResponse.js +12 -9
- package/dist/chunks/utils2.js +8 -8
- package/dist/components/arcgis-assistant/customElement.d.ts +27 -0
- package/dist/components/arcgis-assistant/customElement.js +385 -152
- package/dist/components/arcgis-assistant/index.js +2 -3
- package/dist/components/arcgis-assistant/types.d.ts +14 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +5 -1
- package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
- package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
- package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +11 -5
- package/dist/components/arcgis-assistant-help-agent/customElement.js +8 -2
- package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-interrupt/customElement.js +12 -8
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
- package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +17 -11
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +10 -4
- package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
- package/dist/components/arcgis-assistant-message/customElement.js +28 -26
- package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
- package/dist/components/arcgis-assistant-message/index.js +2 -0
- package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
- package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
- package/dist/components/arcgis-assistant-message-block/index.js +1 -0
- package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
- package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
- package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
- package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-text/customElement.d.ts +5 -1
- package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +11 -5
- package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
- package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-user-message/customElement.js +10 -8
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/loader.js +7 -6
- package/dist/oauth-callback.html +1 -1
- package/dist/types/lumina.d.ts +11 -5
- package/dist/types/preact.d.ts +12 -5
- package/dist/types/react.d.ts +13 -5
- package/dist/types/stencil.d.ts +11 -5
- package/dist/utils/index.d.ts +85 -47
- package/dist/utils/index.js +48 -47
- package/package.json +13 -12
- package/dist/cdn/2AXF774U.js +0 -2
- package/dist/cdn/3BKUCFKS.js +0 -36
- package/dist/cdn/3PKJWIC3.js +0 -2
- package/dist/cdn/3WINIQWY.js +0 -2
- package/dist/cdn/462JBSEV.js +0 -422
- package/dist/cdn/5QAHYX7Y.js +0 -5
- package/dist/cdn/7BCR6TUO.js +0 -2
- package/dist/cdn/7GH7VSB2.js +0 -2
- package/dist/cdn/7PLV4QH6.js +0 -2
- package/dist/cdn/AO7BQHKC.js +0 -2
- package/dist/cdn/AXDZBBNL.js +0 -45
- package/dist/cdn/DDLZOMUY.js +0 -2
- package/dist/cdn/DHOVCT6R.js +0 -2
- package/dist/cdn/DO2P3PWF.js +0 -106
- package/dist/cdn/ERBQSEPQ.js +0 -22
- package/dist/cdn/F2AHA4GB.js +0 -54
- package/dist/cdn/FX5JFRDL.js +0 -2
- package/dist/cdn/GBNUMN4J.js +0 -16
- package/dist/cdn/GJUXVEOF.js +0 -166
- package/dist/cdn/HB5A5R2E.js +0 -2
- package/dist/cdn/J5CMRCPS.js +0 -3
- package/dist/cdn/KMQ3SP4I.js +0 -5
- package/dist/cdn/M6F4MXDK.js +0 -14
- package/dist/cdn/MH5RPXHM.js +0 -2
- package/dist/cdn/NAUXSHIE.js +0 -72
- package/dist/cdn/NVI3I46B.js +0 -2
- package/dist/cdn/OAVEHGB6.js +0 -2
- package/dist/cdn/OH64RMOR.js +0 -4
- package/dist/cdn/P6OPJQMC.js +0 -3
- package/dist/cdn/QR54T33D.js +0 -2
- package/dist/cdn/RVOAPUBN.js +0 -2
- package/dist/cdn/SXDLXCIM.js +0 -2
- package/dist/cdn/USMDJUFS.js +0 -2
- package/dist/cdn/V2P4AIGG.js +0 -2
- package/dist/cdn/Y333DGV6.js +0 -2
- package/dist/cdn/YIMNOUTF.js +0 -2
|
@@ -18,7 +18,7 @@ export type FunctionAgentExecute<TInput extends AgentData, TOutput extends Agent
|
|
|
18
18
|
* @since 5.1
|
|
19
19
|
*/
|
|
20
20
|
export class FunctionAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData> extends BaseAgent<AgentCustomState<TInput, TOutput>> {
|
|
21
|
-
constructor(properties?:
|
|
21
|
+
constructor(properties?: FunctionAgentConstructProperties<TInput, TOutput>);
|
|
22
22
|
/**
|
|
23
23
|
* The execute function contains the core logic of the FunctionAgent.
|
|
24
24
|
* It receives the current agent state and an optional execution configuration,
|
|
@@ -60,5 +60,5 @@ export class FunctionAgent<TInput extends AgentData = AgentData, TOutput extends
|
|
|
60
60
|
initialize(): void;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export type
|
|
63
|
+
export type FunctionAgentConstructProperties<TInput extends AgentData, TOutput extends AgentData> = Partial<Pick<FunctionAgent<TInput, TOutput>, "description" | "inputSchema" | "middlewares" | "outputSchema">>
|
|
64
64
|
& Pick<FunctionAgent<TInput, TOutput>, "execute" | "name">;
|
|
@@ -9,7 +9,7 @@ import type { AgentCustomState, AgentData, ZodObjectSchema } from "./types.js";
|
|
|
9
9
|
* @since 5.1
|
|
10
10
|
*/
|
|
11
11
|
export class LLMAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData> extends BaseAgent<AgentCustomState<TInput, TOutput>> {
|
|
12
|
-
constructor(properties?:
|
|
12
|
+
constructor(properties?: LLMAgentConstructProperties<TInput, TOutput>);
|
|
13
13
|
/**
|
|
14
14
|
* The inputSchema property is an optional Zod schema describing the expected structured input for the agent.
|
|
15
15
|
* This can be used for validation of the input state before execution and also to extract variables from the input
|
|
@@ -61,5 +61,5 @@ export class LLMAgent<TInput extends AgentData = AgentData, TOutput extends Agen
|
|
|
61
61
|
initialize(): void;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export type
|
|
64
|
+
export type LLMAgentConstructProperties<TInput extends AgentData, TOutput extends AgentData> = Partial<Pick<LLMAgent<TInput, TOutput>, "description" | "inputSchema" | "middlewares" | "modelTier" | "outputSchema" | "tools">>
|
|
65
65
|
& Pick<LLMAgent<TInput, TOutput>, "name" | "prompt">;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import "@arcgis/core/identity/IdentityManager.js";
|
|
3
3
|
import "@arcgis/core/portal/Portal.js";
|
|
4
4
|
import { isGraphInterrupt as f } from "@langchain/langgraph/web";
|
|
5
|
+
import "@arcgis/toolkit/string";
|
|
5
6
|
import { c as u } from "../chunks/generateLayerDescriptions.js";
|
|
6
7
|
import "@langchain/core/messages";
|
|
7
8
|
import "@langchain/core/callbacks/dispatch/web";
|
|
@@ -9,7 +9,7 @@ import type { AgentData, ZodObjectSchema } from "./types.js";
|
|
|
9
9
|
* @since 5.1
|
|
10
10
|
*/
|
|
11
11
|
export class WorkflowAgent<TState extends AgentData = AgentData> extends BaseAgent<TState> {
|
|
12
|
-
constructor(properties:
|
|
12
|
+
constructor(properties: WorkflowAgentConstructProperties<TState>);
|
|
13
13
|
/** Optional structured input schema for the workflow wrapper. */
|
|
14
14
|
accessor inputSchema: ZodObjectSchema<object> | undefined;
|
|
15
15
|
/** Optional structured output schema for the workflow wrapper. */
|
|
@@ -40,5 +40,5 @@ export class WorkflowAgent<TState extends AgentData = AgentData> extends BaseAge
|
|
|
40
40
|
initialize(): void;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export type
|
|
43
|
+
export type WorkflowAgentConstructProperties<TState extends AgentData = AgentData> = Partial<Pick<WorkflowAgent<TState>, "description" | "inputSchema" | "middlewares" | "outputSchema">>
|
|
44
44
|
& Pick<WorkflowAgent<TState>, "name" | "workflow">;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { FunctionAgent, FunctionAgentConstructProperties } from "./FunctionAgent.js";
|
|
2
|
+
import type { LLMAgent, LLMAgentConstructProperties } from "./LLMAgent.js";
|
|
3
|
+
import type { WorkflowAgent, WorkflowAgentConstructProperties } from "./WorkflowAgent.js";
|
|
4
|
+
import type { AgentData, SchemaDefinition, SchemaDefinitionData, ZodObjectSchema } from "./types.js";
|
|
5
|
+
import type { FunctionTool, FunctionToolConstructProperties } from "./tools/FunctionTool.js";
|
|
6
|
+
import type { ConditionalWorkflow, ConditionalWorkflowConstructProperties } from "./workflows/ConditionalWorkflow.js";
|
|
7
|
+
import type { LoopWorkflow, LoopWorkflowConstructProperties } from "./workflows/LoopWorkflow.js";
|
|
8
|
+
import type { ParallelWorkflow, ParallelWorkflowConstructProperties } from "./workflows/ParallelWorkflow.js";
|
|
9
|
+
import type { RouterWorkflow, RouterWorkflowConstructProperties } from "./workflows/RouterWorkflow.js";
|
|
10
|
+
import type { SequentialWorkflow, SequentialWorkflowConstructProperties } from "./workflows/SequentialWorkflow.js";
|
|
11
|
+
import type { SwitchWorkflow, SwitchWorkflowConstructProperties } from "./workflows/SwitchWorkflow.js";
|
|
12
|
+
import type { RunnableConfig } from "@langchain/core/runnables";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creates a Zod schema from a plain object schema definition.
|
|
16
|
+
*
|
|
17
|
+
* Supports all schema field variants:
|
|
18
|
+
* - `string` (with optional `enum`)
|
|
19
|
+
* - `number`
|
|
20
|
+
* - `boolean`
|
|
21
|
+
* - `array` with primitive or nested item definitions
|
|
22
|
+
* - `object` with nested `fields`
|
|
23
|
+
*
|
|
24
|
+
* @param definition
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const primitiveSchema = await createSchema({
|
|
28
|
+
* name: { type: "string", description: "Search location name", required: true },
|
|
29
|
+
* radius: { type: "number", description: "Search radius in miles" },
|
|
30
|
+
* active: { type: "boolean", description: "Whether the search is enabled" },
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const nestedObjectSchema = await createSchema({
|
|
36
|
+
* query: { type: "string", description: "User search text", required: true },
|
|
37
|
+
* options: {
|
|
38
|
+
* type: "object",
|
|
39
|
+
* description: "Search options",
|
|
40
|
+
* required: true,
|
|
41
|
+
* fields: {
|
|
42
|
+
* center: {
|
|
43
|
+
* type: "object",
|
|
44
|
+
* description: "Map center point",
|
|
45
|
+
* fields: {
|
|
46
|
+
* latitude: { type: "number", description: "Center latitude", required: true },
|
|
47
|
+
* longitude: { type: "number", description: "Center longitude", required: true },
|
|
48
|
+
* },
|
|
49
|
+
* },
|
|
50
|
+
* categories: { type: "array", description: "Selected categories", itemType: "string" },
|
|
51
|
+
* },
|
|
52
|
+
* },
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const arrayOfObjectsSchema = await createSchema({
|
|
58
|
+
* constraints: {
|
|
59
|
+
* type: "array",
|
|
60
|
+
* description: "Constraint rules",
|
|
61
|
+
* itemType: {
|
|
62
|
+
* type: "object",
|
|
63
|
+
* description: "Single constraint rule",
|
|
64
|
+
* fields: {
|
|
65
|
+
* key: { type: "string", description: "Constraint key", required: true },
|
|
66
|
+
* enabled: { type: "boolean", description: "Whether this rule is active" },
|
|
67
|
+
* values: { type: "array", description: "Rule values", itemType: "string" },
|
|
68
|
+
* },
|
|
69
|
+
* },
|
|
70
|
+
* },
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
* @since 5.1
|
|
74
|
+
*/
|
|
75
|
+
export function createSchema<const TDefinition extends SchemaDefinition>(definition: TDefinition): Promise<ZodObjectSchema<SchemaDefinitionData<TDefinition>>>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The suggestions emitted by the agent to the user interface.
|
|
79
|
+
*
|
|
80
|
+
* @since 5.1
|
|
81
|
+
*/
|
|
82
|
+
export type UXSuggestion = {
|
|
83
|
+
/** The type of suggestion being made. */
|
|
84
|
+
type: string;
|
|
85
|
+
/** Optional additional data associated with the suggestion. */
|
|
86
|
+
data?: Record<string, unknown>;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Sends an optional UX suggestion from an agent run to the host application.
|
|
91
|
+
* Use this for non-blocking hints (for example, recommended next actions or UI prompts) that the app may choose to display.
|
|
92
|
+
*
|
|
93
|
+
* @param suggestion
|
|
94
|
+
* @param config
|
|
95
|
+
* @since 5.1
|
|
96
|
+
*/
|
|
97
|
+
export function sendUXSuggestion(suggestion: UXSuggestion, config?: RunnableConfig): Promise<void>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Creates a FunctionAgent instance from the existing agent implementation.
|
|
101
|
+
*
|
|
102
|
+
* @param properties
|
|
103
|
+
* @since 5.1
|
|
104
|
+
*/
|
|
105
|
+
export function createFunctionAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>(properties: FunctionAgentConstructProperties<TInput, TOutput>): Promise<FunctionAgent<TInput, TOutput>>;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Creates a FunctionTool instance from the existing tool implementation.
|
|
109
|
+
*
|
|
110
|
+
* @param properties
|
|
111
|
+
* @since 5.1
|
|
112
|
+
*/
|
|
113
|
+
export function createFunctionTool<TInput extends AgentData, TOutput = unknown>(properties: FunctionToolConstructProperties<TInput, TOutput>): Promise<FunctionTool<TInput, TOutput>>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Creates an LLMAgent instance from the existing agent implementation.
|
|
117
|
+
*
|
|
118
|
+
* @param properties
|
|
119
|
+
* @since 5.1
|
|
120
|
+
*/
|
|
121
|
+
export function createLLMAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>(properties: LLMAgentConstructProperties<TInput, TOutput>): Promise<LLMAgent<TInput, TOutput>>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Creates a WorkflowAgent instance from the existing workflow agent implementation.
|
|
125
|
+
*
|
|
126
|
+
* @param properties
|
|
127
|
+
* @since 5.1
|
|
128
|
+
*/
|
|
129
|
+
export function createWorkflowAgent<TState extends AgentData = AgentData>(properties: WorkflowAgentConstructProperties<TState>): Promise<WorkflowAgent<TState>>;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Creates a ConditionalWorkflow instance from the existing workflow implementation.
|
|
133
|
+
*
|
|
134
|
+
* @param properties
|
|
135
|
+
* @since 5.1
|
|
136
|
+
*/
|
|
137
|
+
export function createConditionalWorkflow<TState extends AgentData = AgentData>(properties: ConditionalWorkflowConstructProperties<TState>): Promise<ConditionalWorkflow<TState>>;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Creates a LoopWorkflow instance from the existing workflow implementation.
|
|
141
|
+
*
|
|
142
|
+
* @param properties
|
|
143
|
+
* @since 5.1
|
|
144
|
+
*/
|
|
145
|
+
export function createLoopWorkflow<TState extends AgentData = AgentData>(properties: LoopWorkflowConstructProperties<TState>): Promise<LoopWorkflow<TState>>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Creates a ParallelWorkflow instance from the existing workflow implementation.
|
|
149
|
+
*
|
|
150
|
+
* @param properties
|
|
151
|
+
* @since 5.1
|
|
152
|
+
*/
|
|
153
|
+
export function createParallelWorkflow<TState extends AgentData = AgentData>(properties: ParallelWorkflowConstructProperties<TState>): Promise<ParallelWorkflow<TState>>;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Creates a RouterWorkflow instance from the existing workflow implementation.
|
|
157
|
+
*
|
|
158
|
+
* @param properties
|
|
159
|
+
* @since 5.1
|
|
160
|
+
*/
|
|
161
|
+
export function createRouterWorkflow<TState extends AgentData = AgentData>(properties: RouterWorkflowConstructProperties<TState>): Promise<RouterWorkflow<TState>>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Creates a SequentialWorkflow instance from the existing workflow implementation.
|
|
165
|
+
*
|
|
166
|
+
* @param properties
|
|
167
|
+
* @since 5.1
|
|
168
|
+
*/
|
|
169
|
+
export function createSequentialWorkflow<TState extends AgentData = AgentData>(properties: SequentialWorkflowConstructProperties<TState>): Promise<SequentialWorkflow<TState>>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Creates a SwitchWorkflow instance from the existing workflow implementation.
|
|
173
|
+
*
|
|
174
|
+
* @param properties
|
|
175
|
+
* @since 5.1
|
|
176
|
+
*/
|
|
177
|
+
export function createSwitchWorkflow<TState extends AgentData = AgentData>(properties: SwitchWorkflowConstructProperties<TState>): Promise<SwitchWorkflow<TState>>;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
let i, a, c, u, l, s, w, m, f, p, d, g;
|
|
3
|
+
async function n(e, t) {
|
|
4
|
+
if (t in e)
|
|
5
|
+
return e[t];
|
|
6
|
+
if ("default" in e) {
|
|
7
|
+
const o = await e.default;
|
|
8
|
+
return typeof o == "object" && o !== null && t in o ? o[t] : o;
|
|
9
|
+
}
|
|
10
|
+
throw new Error(`Unable to resolve ${String(t)} from module.`);
|
|
11
|
+
}
|
|
12
|
+
function y(e, t) {
|
|
13
|
+
const o = {};
|
|
14
|
+
for (const [r, k] of Object.entries(t))
|
|
15
|
+
o[r] = S(e, k);
|
|
16
|
+
return o;
|
|
17
|
+
}
|
|
18
|
+
function W(e, t) {
|
|
19
|
+
return e.object(y(e, t));
|
|
20
|
+
}
|
|
21
|
+
function S(e, t) {
|
|
22
|
+
const o = h(e, t);
|
|
23
|
+
return t.required === !0 ? o : o.optional();
|
|
24
|
+
}
|
|
25
|
+
function h(e, t) {
|
|
26
|
+
let o = P(e, t);
|
|
27
|
+
return t.description !== void 0 && (o = o.describe(t.description)), o;
|
|
28
|
+
}
|
|
29
|
+
function b(e, t) {
|
|
30
|
+
switch (t) {
|
|
31
|
+
case "string":
|
|
32
|
+
return e.string();
|
|
33
|
+
case "number":
|
|
34
|
+
return e.number();
|
|
35
|
+
case "boolean":
|
|
36
|
+
return e.boolean();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function M(e) {
|
|
40
|
+
return e === "string" || e === "number" || e === "boolean";
|
|
41
|
+
}
|
|
42
|
+
function P(e, t) {
|
|
43
|
+
switch (t.type) {
|
|
44
|
+
case "string": {
|
|
45
|
+
if (t.enum != null) {
|
|
46
|
+
if (t.enum.length === 0)
|
|
47
|
+
throw new Error("String schema field enum must include at least one value.");
|
|
48
|
+
return e.enum(t.enum);
|
|
49
|
+
}
|
|
50
|
+
return e.string();
|
|
51
|
+
}
|
|
52
|
+
case "number":
|
|
53
|
+
return e.number();
|
|
54
|
+
case "boolean":
|
|
55
|
+
return e.boolean();
|
|
56
|
+
case "array": {
|
|
57
|
+
if (t.itemType == null)
|
|
58
|
+
throw new Error("Array schema field requires an itemType definition.");
|
|
59
|
+
return e.array(
|
|
60
|
+
M(t.itemType) ? b(e, t.itemType) : h(e, t.itemType)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
case "object": {
|
|
64
|
+
if (t.fields == null)
|
|
65
|
+
throw new Error("Object schema field requires a fields definition.");
|
|
66
|
+
return W(e, t.fields);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function A(e) {
|
|
71
|
+
d ??= import("zod");
|
|
72
|
+
const t = await d;
|
|
73
|
+
return W(t.z, e);
|
|
74
|
+
}
|
|
75
|
+
async function T(e, t) {
|
|
76
|
+
g ??= import("../utils/index.js");
|
|
77
|
+
const o = await g;
|
|
78
|
+
return await (await n(
|
|
79
|
+
o,
|
|
80
|
+
"sendUXSuggestion"
|
|
81
|
+
))(e, t);
|
|
82
|
+
}
|
|
83
|
+
async function L(e) {
|
|
84
|
+
i ??= import("./FunctionAgent.js");
|
|
85
|
+
const t = await i, o = await n(
|
|
86
|
+
t,
|
|
87
|
+
"FunctionAgent"
|
|
88
|
+
);
|
|
89
|
+
return new o(e);
|
|
90
|
+
}
|
|
91
|
+
async function q(e) {
|
|
92
|
+
a ??= import("./tools/FunctionTool.js");
|
|
93
|
+
const t = await a, o = await n(
|
|
94
|
+
t,
|
|
95
|
+
"FunctionTool"
|
|
96
|
+
);
|
|
97
|
+
return new o(e);
|
|
98
|
+
}
|
|
99
|
+
async function F(e) {
|
|
100
|
+
c ??= import("./LLMAgent.js");
|
|
101
|
+
const t = await c, o = await n(t, "LLMAgent");
|
|
102
|
+
return new o(e);
|
|
103
|
+
}
|
|
104
|
+
async function j(e) {
|
|
105
|
+
u ??= import("./WorkflowAgent.js");
|
|
106
|
+
const t = await u, o = await n(
|
|
107
|
+
t,
|
|
108
|
+
"WorkflowAgent"
|
|
109
|
+
);
|
|
110
|
+
return new o(e);
|
|
111
|
+
}
|
|
112
|
+
async function E(e) {
|
|
113
|
+
l ??= import("./workflows/ConditionalWorkflow.js");
|
|
114
|
+
const t = await l, o = await n(t, "ConditionalWorkflow");
|
|
115
|
+
return new o(e);
|
|
116
|
+
}
|
|
117
|
+
async function v(e) {
|
|
118
|
+
s ??= import("./workflows/LoopWorkflow.js");
|
|
119
|
+
const t = await s, o = await n(
|
|
120
|
+
t,
|
|
121
|
+
"LoopWorkflow"
|
|
122
|
+
);
|
|
123
|
+
return new o(e);
|
|
124
|
+
}
|
|
125
|
+
async function U(e) {
|
|
126
|
+
w ??= import("./workflows/ParallelWorkflow.js");
|
|
127
|
+
const t = await w, o = await n(
|
|
128
|
+
t,
|
|
129
|
+
"ParallelWorkflow"
|
|
130
|
+
);
|
|
131
|
+
return new o(e);
|
|
132
|
+
}
|
|
133
|
+
async function R(e) {
|
|
134
|
+
m ??= import("./workflows/RouterWorkflow.js");
|
|
135
|
+
const t = await m, o = await n(
|
|
136
|
+
t,
|
|
137
|
+
"RouterWorkflow"
|
|
138
|
+
);
|
|
139
|
+
return new o(e);
|
|
140
|
+
}
|
|
141
|
+
async function X(e) {
|
|
142
|
+
f ??= import("./workflows/SequentialWorkflow.js");
|
|
143
|
+
const t = await f, o = await n(t, "SequentialWorkflow");
|
|
144
|
+
return new o(e);
|
|
145
|
+
}
|
|
146
|
+
async function x(e) {
|
|
147
|
+
p ??= import("./workflows/SwitchWorkflow.js");
|
|
148
|
+
const t = await p, o = await n(
|
|
149
|
+
t,
|
|
150
|
+
"SwitchWorkflow"
|
|
151
|
+
);
|
|
152
|
+
return new o(e);
|
|
153
|
+
}
|
|
154
|
+
export {
|
|
155
|
+
E as createConditionalWorkflow,
|
|
156
|
+
L as createFunctionAgent,
|
|
157
|
+
q as createFunctionTool,
|
|
158
|
+
F as createLLMAgent,
|
|
159
|
+
v as createLoopWorkflow,
|
|
160
|
+
U as createParallelWorkflow,
|
|
161
|
+
R as createRouterWorkflow,
|
|
162
|
+
A as createSchema,
|
|
163
|
+
X as createSequentialWorkflow,
|
|
164
|
+
x as createSwitchWorkflow,
|
|
165
|
+
j as createWorkflowAgent,
|
|
166
|
+
T as sendUXSuggestion
|
|
167
|
+
};
|
|
@@ -10,6 +10,7 @@ import type { AgentData } from "../types.js";
|
|
|
10
10
|
* executions, which can be useful for debugging and monitoring the agent's behavior.
|
|
11
11
|
*
|
|
12
12
|
* @returns An agent middleware that wraps model calls and sends trace messages.
|
|
13
|
+
* @internal
|
|
13
14
|
* @since 5.1
|
|
14
15
|
*/
|
|
15
16
|
export function createAgentTraceMiddleware(): AgentMiddleware;
|
|
@@ -20,6 +21,7 @@ export function createAgentTraceMiddleware(): AgentMiddleware;
|
|
|
20
21
|
* debugging and monitoring the behavior of tools within the agent's execution.
|
|
21
22
|
*
|
|
22
23
|
* @returns A function tool middleware that wraps tool calls and sends trace messages.
|
|
24
|
+
* @internal
|
|
23
25
|
* @since 5.1
|
|
24
26
|
*/
|
|
25
27
|
export function createToolTraceMiddleware<TInput extends AgentData = AgentData, TOutput = unknown>(): FunctionToolMiddleware<TInput, TOutput>;
|
|
@@ -1,50 +1,42 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import "
|
|
3
|
-
import "@
|
|
4
|
-
import "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import "@arcgis/core/request.js";
|
|
11
|
-
import "@langchain/core/prompts";
|
|
12
|
-
import { createAgentMiddleware as c, createToolMiddleware as m } from "./middleware.js";
|
|
13
|
-
const d = "agent-trace", g = "tool-trace";
|
|
14
|
-
function $() {
|
|
15
|
-
return c(d, {
|
|
16
|
-
wrapModelCall: async (t, o) => {
|
|
17
|
-
const e = await o(t), a = t.runtime, i = p(e);
|
|
2
|
+
import { s as r } from "../../chunks/index.js";
|
|
3
|
+
import { AIMessage as i, ToolMessage as s } from "@langchain/core/messages";
|
|
4
|
+
import { createAgentMiddleware as c, createToolMiddleware as d } from "./middleware.js";
|
|
5
|
+
const g = "agent-trace", f = "tool-trace";
|
|
6
|
+
function p() {
|
|
7
|
+
return c(g, {
|
|
8
|
+
wrapModelCall: async (e, a) => {
|
|
9
|
+
const t = await a(e), o = e.runtime, l = m(t);
|
|
18
10
|
return await Promise.all(
|
|
19
|
-
|
|
20
|
-
async (
|
|
11
|
+
l.map(
|
|
12
|
+
async (n) => await r(
|
|
21
13
|
{
|
|
22
|
-
text: `LLM requested tool call "${
|
|
14
|
+
text: `LLM requested tool call "${n.name}" with arguments: ${JSON.stringify(n.args, null, 2)}`
|
|
23
15
|
},
|
|
24
|
-
|
|
16
|
+
o
|
|
25
17
|
)
|
|
26
18
|
)
|
|
27
|
-
),
|
|
19
|
+
), t;
|
|
28
20
|
}
|
|
29
21
|
});
|
|
30
22
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
33
|
-
wrapToolCall: async (
|
|
34
|
-
const
|
|
35
|
-
return await
|
|
23
|
+
function T() {
|
|
24
|
+
return d(f, {
|
|
25
|
+
wrapToolCall: async (e, a) => {
|
|
26
|
+
const t = await a(e), o = e.config;
|
|
27
|
+
return await r(
|
|
36
28
|
{
|
|
37
|
-
text: `Finished executing tool: ${s.isInstance(
|
|
29
|
+
text: `Finished executing tool: ${s.isInstance(t) ? t.content.toString() : typeof t == "string" ? t : e.tool.name}`
|
|
38
30
|
},
|
|
39
|
-
|
|
40
|
-
),
|
|
31
|
+
o
|
|
32
|
+
), t;
|
|
41
33
|
}
|
|
42
34
|
});
|
|
43
35
|
}
|
|
44
|
-
function
|
|
45
|
-
return !
|
|
36
|
+
function m(e) {
|
|
37
|
+
return !i.isInstance(e) || !Array.isArray(e.tool_calls) ? [] : e.tool_calls.filter((a) => typeof a?.name == "string");
|
|
46
38
|
}
|
|
47
39
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
p as createAgentTraceMiddleware,
|
|
41
|
+
T as createToolTraceMiddleware
|
|
50
42
|
};
|
|
@@ -59,7 +59,7 @@ export interface FunctionToolLike {
|
|
|
59
59
|
* @since 5.1
|
|
60
60
|
*/
|
|
61
61
|
export class FunctionTool<TInput extends AgentData, TOutput = unknown> extends Accessor {
|
|
62
|
-
constructor(properties?:
|
|
62
|
+
constructor(properties?: FunctionToolConstructProperties<TInput, TOutput>);
|
|
63
63
|
/**
|
|
64
64
|
* A concise, but clear description of the tool's functionality.
|
|
65
65
|
* This should provide enough information for the agent to understand when and why to use the tool.
|
|
@@ -123,5 +123,5 @@ export interface FunctionToolMiddlewareTool {
|
|
|
123
123
|
resultMode: ToolResultMode;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
export type
|
|
126
|
+
export type FunctionToolConstructProperties<TInput extends AgentData, TOutput> = Partial<Pick<FunctionTool<TInput, TOutput>, "inputSchema" | "middlewares" | "outputSchema" | "resultMode">>
|
|
127
127
|
& Pick<FunctionTool<TInput, TOutput>, "description" | "execute" | "name">;
|
|
@@ -3,13 +3,43 @@ import type { BaseChannel, BinaryOperatorAggregate } from "@langchain/langgraph/
|
|
|
3
3
|
import type { AnnotationRoot, StateDefinitionInit, StateGraph } from "@langchain/langgraph/web";
|
|
4
4
|
import type { AgentExecutionContext, AgentRegistration, AgentStatus } from "../utils/index.js";
|
|
5
5
|
|
|
6
|
-
/** @internal */
|
|
7
6
|
export type AgentData = Record<string, unknown>;
|
|
8
7
|
|
|
9
|
-
/** @internal */
|
|
10
8
|
export type EmptyAgentData = Record<never, never>;
|
|
11
9
|
|
|
12
|
-
/** @
|
|
10
|
+
/** @internal */
|
|
11
|
+
export type ZodModule = {
|
|
12
|
+
z: typeof z;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type SchemaPrimitiveFieldType = "boolean" | "number" | "string";
|
|
16
|
+
|
|
17
|
+
export type SchemaArrayItemDefinition = SchemaFieldDefinition | SchemaPrimitiveFieldType;
|
|
18
|
+
|
|
19
|
+
export type SchemaFieldDefinition = ({
|
|
20
|
+
type: "array";
|
|
21
|
+
itemType: SchemaArrayItemDefinition;
|
|
22
|
+
} | { type: "boolean" | "number"; } | {
|
|
23
|
+
type: "object";
|
|
24
|
+
fields: SchemaDefinition;
|
|
25
|
+
} | {
|
|
26
|
+
type: "string";
|
|
27
|
+
enum?: readonly string[];
|
|
28
|
+
}) & {
|
|
29
|
+
description?: string;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type SchemaDefinition = Record<string, SchemaFieldDefinition>;
|
|
34
|
+
|
|
35
|
+
export type SchemaDefinitionData<TDefinition extends SchemaDefinition> = {
|
|
36
|
+
[K in keyof TDefinition as TDefinition[K] extends { required: true; } ? K : never]: SchemaFieldData<TDefinition[K]>;
|
|
37
|
+
} &
|
|
38
|
+
{
|
|
39
|
+
[K in keyof TDefinition as TDefinition[K] extends { required: true; } ? never : K]?: SchemaFieldData<TDefinition[K]>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** @privateRemark All agents are orchestrator-driven, so these channels exist for every agent graph. */
|
|
13
43
|
export type AgentRuntimeState = {
|
|
14
44
|
agentExecutionContext: AgentExecutionContext;
|
|
15
45
|
/** The outputMessage is a string representing the output of an agent execution. */
|
|
@@ -101,7 +131,6 @@ export type AgentNodeUpdate<TInput extends AgentData, TOutput extends AgentData>
|
|
|
101
131
|
* AgentStateAnnotation defines the shape of the agent state used in LangGraph nodes, including both the built-in runtime channels
|
|
102
132
|
* and any custom fields defined by the agent.
|
|
103
133
|
*
|
|
104
|
-
* @internal
|
|
105
134
|
* @since 5.1
|
|
106
135
|
*/
|
|
107
136
|
export type AgentStateAnnotation<TState extends AgentData> = AnnotationRoot<{
|
|
@@ -123,7 +152,6 @@ export type RunnableUpdate<TState extends AgentData> = Partial<TState> extends o
|
|
|
123
152
|
/**
|
|
124
153
|
* Internal type representing the compiled graph used for agent execution.
|
|
125
154
|
*
|
|
126
|
-
* @internal
|
|
127
155
|
* @since 5.1
|
|
128
156
|
*/
|
|
129
157
|
export type TypedStateGraph<TState extends AgentData> = StateGraph<StateDefinitionInit, AgentGraphState<TState>, RunnableUpdate<AgentGraphState<TState>>, string>;
|
|
@@ -132,7 +160,6 @@ export type TypedStateGraph<TState extends AgentData> = StateGraph<StateDefiniti
|
|
|
132
160
|
* The shape of the `createGraph` function used by agents to generate their internal graph representation.
|
|
133
161
|
* This function is responsible for defining the nodes and edges of the graph, as well as any associated state and middleware.
|
|
134
162
|
*
|
|
135
|
-
* @internal
|
|
136
163
|
* @since 5.1
|
|
137
164
|
*/
|
|
138
165
|
export type AgentCreateGraph<TState extends AgentData> = () => TypedStateGraph<TState>;
|
|
@@ -149,4 +176,6 @@ export type GraphEdge<S extends AgentData> = {
|
|
|
149
176
|
} | {
|
|
150
177
|
from: string;
|
|
151
178
|
to: string;
|
|
152
|
-
};
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export type SchemaFieldData<TField extends SchemaFieldDefinition> = TField extends { type: "string"; } ? TField["enum"] extends readonly (infer TValue extends string)[] ? TValue : string : TField extends { type: "array"; } ? (TField["itemType"] extends "string" ? string : TField["itemType"] extends "number" ? number : TField["itemType"] extends "boolean" ? boolean : TField["itemType"] extends SchemaFieldDefinition ? SchemaFieldData<TField["itemType"]> : never)[] : TField extends { type: "object"; } ? SchemaDefinitionData<TField["fields"]> : TField extends { type: "number"; } ? number : boolean;
|
|
@@ -26,7 +26,7 @@ export type ConditionDecider<TState extends AgentData = AgentData> = (state: Age
|
|
|
26
26
|
* @since 5.1
|
|
27
27
|
*/
|
|
28
28
|
export class ConditionalWorkflow<TState extends AgentData = AgentData> extends BaseWorkflow<TState> {
|
|
29
|
-
constructor(properties:
|
|
29
|
+
constructor(properties: ConditionalWorkflowConstructProperties<TState>);
|
|
30
30
|
/**
|
|
31
31
|
* Must contain exactly two agents: `[trueAgent, falseAgent]`. The first agent is executed when
|
|
32
32
|
* the condition is true, the second when the condition is false.
|
|
@@ -69,4 +69,4 @@ export class ConditionalWorkflow<TState extends AgentData = AgentData> extends B
|
|
|
69
69
|
protected validateAgents(agents: BaseAgentLike<TState>[]): void;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export type
|
|
72
|
+
export type ConditionalWorkflowConstructProperties<TState extends AgentData> = Pick<ConditionalWorkflow<TState>, "agents" | "condition">;
|
|
@@ -26,7 +26,7 @@ export type LoopDecider<TState extends AgentData = AgentData> = (state: AgentGra
|
|
|
26
26
|
* @since 5.1
|
|
27
27
|
*/
|
|
28
28
|
export class LoopWorkflow<TState extends AgentData = AgentData> extends BaseWorkflow<TState> {
|
|
29
|
-
constructor(properties:
|
|
29
|
+
constructor(properties: LoopWorkflowConstructProperties<TState>);
|
|
30
30
|
/**
|
|
31
31
|
* Function that decides whether the loop should continue.
|
|
32
32
|
*
|
|
@@ -55,4 +55,4 @@ export class LoopWorkflow<TState extends AgentData = AgentData> extends BaseWork
|
|
|
55
55
|
protected isTerminalAgent(): boolean;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export type
|
|
58
|
+
export type LoopWorkflowConstructProperties<TState extends AgentData> = Pick<LoopWorkflow<TState>, "decideContinue" | "workflow">;
|
|
@@ -20,7 +20,7 @@ import type { BaseWorkflow, WorkflowGenerateResult } from "./BaseWorkflow.js";
|
|
|
20
20
|
* @since 5.1
|
|
21
21
|
*/
|
|
22
22
|
export class ParallelWorkflow<TState extends AgentData = AgentData> extends BaseWorkflow<TState> {
|
|
23
|
-
constructor(properties:
|
|
23
|
+
constructor(properties: ParallelWorkflowConstructProperties<TState>);
|
|
24
24
|
/**
|
|
25
25
|
* Agents to run in parallel from the same input snapshot.
|
|
26
26
|
*
|
|
@@ -65,4 +65,4 @@ export class ParallelWorkflow<TState extends AgentData = AgentData> extends Base
|
|
|
65
65
|
protected isTerminalAgent(_agents: BaseAgentLike<TState>[], _index: number): boolean;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export type
|
|
68
|
+
export type ParallelWorkflowConstructProperties<TState extends AgentData> = Pick<ParallelWorkflow<TState>, "agents">;
|
|
@@ -16,7 +16,7 @@ import type { BaseWorkflow } from "./BaseWorkflow.js";
|
|
|
16
16
|
* @since 5.1
|
|
17
17
|
*/
|
|
18
18
|
export class RouterWorkflow<TState extends AgentData = AgentData> extends BaseWorkflow<TState> {
|
|
19
|
-
constructor(properties:
|
|
19
|
+
constructor(properties: RouterWorkflowConstructProperties<TState>);
|
|
20
20
|
/**
|
|
21
21
|
* Mapping of route keys to destination agents.
|
|
22
22
|
*
|
|
@@ -60,4 +60,4 @@ export class RouterWorkflow<TState extends AgentData = AgentData> extends BaseWo
|
|
|
60
60
|
protected validateAgents(agents: BaseAgentLike<TState>[]): void;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export type
|
|
63
|
+
export type RouterWorkflowConstructProperties<TState extends AgentData> = Pick<RouterWorkflow<TState>, "agentsMap" | "routerAgent" | "routerOutputKey">;
|