@arcgis/ai-components 5.2.0-next.71 → 5.2.0-next.72
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/LICENSE.md +4 -2
- package/dist/agent-utils/types.d.ts +1 -1
- package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
- package/dist/agentic-workflow/Edge.d.ts +16 -0
- package/dist/agentic-workflow/WebAgent.d.ts +39 -0
- package/dist/agentic-workflow/jsonTypes.d.ts +186 -0
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +26 -0
- package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
- package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
- package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
- package/dist/agentic-workflow/nodes/support/Prompt.d.ts +20 -0
- package/dist/agentic-workflow/types.d.ts +29 -0
- package/dist/cdn/{PUFTYLJ2.js → 33BF35AO.js} +1 -1
- package/dist/cdn/55M2HE4U.js +2 -0
- package/dist/cdn/5RZGG4F2.js +2 -0
- package/dist/cdn/5SF6DEMO.js +2 -0
- package/dist/cdn/{MW5S2XCB.js → 5SFZS2RD.js} +1 -1
- package/dist/cdn/6QJFOL6M.js +2 -0
- package/dist/cdn/BAB3MK4Y.js +2 -0
- package/dist/cdn/BMBV6Y2A.js +2 -0
- package/dist/cdn/D3RKQSWS.js +2 -0
- package/dist/cdn/DBHLKLKM.js +2 -0
- package/dist/cdn/{CXW5URTF.js → DWYODVWW.js} +1 -1
- package/dist/cdn/{TFT6HK3O.js → E7KEOJZG.js} +1 -1
- package/dist/cdn/FSMHR7GK.js +2 -0
- package/dist/cdn/HO2YDJI2.js +6 -0
- package/dist/cdn/{KQHLOYKL.js → I4L45WQS.js} +1 -1
- package/dist/cdn/IGQFAL3H.js +2 -0
- package/dist/cdn/JYVBCHR6.js +6 -0
- package/dist/cdn/{XETNZW4D.js → NJJYZP3R.js} +1 -1
- package/dist/cdn/NSXX2KYS.js +2 -0
- package/dist/cdn/OFRFP4BX.js +2 -0
- package/dist/cdn/OUFGJV3R.js +2 -0
- package/dist/cdn/PAUIFUMO.js +2 -0
- package/dist/cdn/RWM5T4XB.js +180 -0
- package/dist/cdn/{YHQJ66WJ.js → S3XUYAUX.js} +1 -1
- package/dist/cdn/S6ZAQRC6.js +2 -0
- package/dist/cdn/SRFLL6ET.js +2 -0
- package/dist/cdn/UZL6UVE4.js +2 -0
- package/dist/cdn/{GP6NDTUE.js → WDOM6Z5O.js} +2 -2
- package/dist/cdn/WQKNV6KK.js +2 -0
- package/dist/cdn/{ICYUPLZM.js → WZFC5HUX.js} +1 -1
- package/dist/cdn/XPTCV6YV.js +2 -0
- package/dist/cdn/Y5UFOH54.js +2 -0
- package/dist/cdn/{E5ZKBC24.js → Z4XUJQ2I.js} +2 -2
- package/dist/cdn/{SXHH575T.js → ZJEWP2ND.js} +20 -24
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
- package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
- package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +668 -679
- package/dist/chunks/baseAgentState.js +56 -0
- package/dist/chunks/dataExplorationGraph.js +13 -13
- package/dist/chunks/generateLayerDescriptions.js +189 -235
- package/dist/chunks/navigationGraph.js +28 -28
- package/dist/chunks/orchestrator.js +1 -1
- package/dist/chunks/state.js +20 -26
- package/dist/chunks/utils2.js +3 -3
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +513 -12
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
- 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/loader.js +1 -1
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/dist/utils/index.js +26 -25
- package/package.json +4 -4
- package/dist/cdn/3DJDRAGV.js +0 -2
- package/dist/cdn/4CEMUECT.js +0 -2
- package/dist/cdn/4PCAK3ET.js +0 -2
- package/dist/cdn/57OMVTIU.js +0 -2
- package/dist/cdn/6U7TEAAJ.js +0 -2
- package/dist/cdn/BE7ZN5FZ.js +0 -2
- package/dist/cdn/BNSJO6X2.js +0 -2
- package/dist/cdn/CMDRED5H.js +0 -2
- package/dist/cdn/DTIVDIDY.js +0 -2
- package/dist/cdn/HBLRVXEB.js +0 -2
- package/dist/cdn/HQXPPYMD.js +0 -2
- package/dist/cdn/IEHPNCTL.js +0 -2
- package/dist/cdn/LHLO6PTD.js +0 -2
- package/dist/cdn/OWXCOUIQ.js +0 -2
- package/dist/cdn/PVE7Q43N.js +0 -2
- package/dist/cdn/ST5FQYT7.js +0 -180
- package/dist/cdn/WUNCZOGU.js +0 -2
- package/dist/cdn/WVPU4QOO.js +0 -2
- package/dist/cdn/WXWO5D3W.js +0 -2
- package/dist/cdn/XCRR2EEG.js +0 -6
- package/dist/cdn/ZS6SXJP2.js +0 -2
package/LICENSE.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# Licensing
|
|
2
2
|
|
|
3
|
-
COPYRIGHT
|
|
3
|
+
COPYRIGHT Esri
|
|
4
4
|
|
|
5
5
|
All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.
|
|
6
6
|
|
|
7
|
-
This material is licensed for use under the
|
|
7
|
+
This material is licensed for use under the Esri Master License Agreement (MLA), and is bound by the terms of that agreement.
|
|
8
8
|
You may redistribute and use this code without modification, provided you adhere to the terms of the MLA and include this copyright notice.
|
|
9
9
|
|
|
10
|
+
See use restrictions at https://www.esri.com/content/dam/esrisites/en-us/media/legal/ma-full/ma-full.pdf.
|
|
11
|
+
|
|
10
12
|
For additional information, contact:
|
|
11
13
|
Environmental Systems Research Institute, Inc.
|
|
12
14
|
Attn: Contracts and Legal Services Department
|
|
@@ -168,7 +168,7 @@ export type AgentCreateGraph<TState extends AgentData> = () => TypedStateGraph<T
|
|
|
168
168
|
export type ZodObjectSchema<T extends object = AgentData> = Pick<z.ZodType<T>, "safeParse">
|
|
169
169
|
& z.ZodObject;
|
|
170
170
|
|
|
171
|
-
export type GraphNodes<S extends AgentData
|
|
171
|
+
export type GraphNodes<S extends AgentData, TUpdate = Partial<S>> = Record<string, (state: S, config?: AgentExecutionConfig) => Promise<S | TUpdate> | S | TUpdate>;
|
|
172
172
|
|
|
173
173
|
export type GraphEdge<S extends AgentData> = {
|
|
174
174
|
from: string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentCreateGraph, AgentCustomState, AgentData, AgentStateAnnotation, ZodObjectSchema } from "../agent-utils/types.js";
|
|
2
|
+
import type { AgenticWorkflowJson } from "./jsonTypes.js";
|
|
3
|
+
import type { GraphNodeResultsState } from "./types.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Loads and compiles an ArcGIS Agentic Workflow definition into an executable graph.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export class AgenticWorkflowRuntime<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData> {
|
|
11
|
+
/** @param sourceJSON */
|
|
12
|
+
static fromJSON<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>(sourceJSON: AgenticWorkflowJson): AgenticWorkflowRuntime<TInput, TOutput>;
|
|
13
|
+
generate(): AgenticWorkflowGenerateResult<TInput, TOutput>;
|
|
14
|
+
getSchemas(): ZodObjectSchema<object>[];
|
|
15
|
+
load(): Promise<this>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type AgenticWorkflowGenerateResult<TInput extends AgentData, TOutput extends AgentData> = {
|
|
19
|
+
createGraph: AgentCreateGraph<AgenticWorkflowState<TInput, TOutput>>;
|
|
20
|
+
workspace: AgentStateAnnotation<AgenticWorkflowState<TInput, TOutput>>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type AgenticWorkflowState<TInput extends AgentData, TOutput extends AgentData> = GraphNodeResultsState
|
|
24
|
+
& Omit<AgentCustomState<TInput, TOutput>, "nodes">;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type Accessor from "@arcgis/core/core/Accessor.js";
|
|
2
|
+
import type { AgenticWorkflowEdgeJson } from "./jsonTypes.js";
|
|
3
|
+
|
|
4
|
+
/** @internal */
|
|
5
|
+
export class Edge extends Accessor {
|
|
6
|
+
/** @param json */
|
|
7
|
+
static fromJSON(json: AgenticWorkflowEdgeJson): Edge;
|
|
8
|
+
constructor(properties?: EdgeConstructProperties);
|
|
9
|
+
accessor id: string;
|
|
10
|
+
accessor sourceAnchorId: string;
|
|
11
|
+
accessor sourceNodeId: string;
|
|
12
|
+
accessor targetAnchorId: string | undefined;
|
|
13
|
+
accessor targetNodeId: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type EdgeConstructProperties = Pick<Edge, "id" | "sourceAnchorId" | "sourceNodeId" | "targetAnchorId" | "targetNodeId">;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type PortalItem from "@arcgis/core/portal/PortalItem.js";
|
|
2
|
+
import type { BaseAgent } from "../agent-utils/BaseAgent.js";
|
|
3
|
+
import type { AgentData, ZodObjectSchema } from "../agent-utils/types.js";
|
|
4
|
+
import type { AgenticWorkflowJson } from "./jsonTypes.js";
|
|
5
|
+
import type { AgenticWorkflowState } from "./AgenticWorkflowRuntime.js";
|
|
6
|
+
|
|
7
|
+
/** @internal */
|
|
8
|
+
export class WebAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData> extends BaseAgent<WebAgentState<TInput, TOutput>> {
|
|
9
|
+
constructor(properties?: WebAgentConstructProperties<TInput, TOutput>);
|
|
10
|
+
/**
|
|
11
|
+
* The portal item associated with this web agent
|
|
12
|
+
*
|
|
13
|
+
* @required
|
|
14
|
+
*/
|
|
15
|
+
accessor portalItem: PortalItem | undefined;
|
|
16
|
+
accessor sourceJSON: AgenticWorkflowJson | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Rebuilds internal workspace and createGraph wiring. This is automatically called during initialization and whenever
|
|
19
|
+
* the name or description properties change, but can also be called manually if needed to refresh the agent's graph definition.
|
|
20
|
+
*
|
|
21
|
+
* The agent implementation is responsible for defining the createGraph function and workspace structure in this method, which are then used during execution.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
generate(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Returns all schemas required by this agent implementation.
|
|
28
|
+
*
|
|
29
|
+
* @returns An array of Zod object schemas that define the structure of the agent's expected input and output data.
|
|
30
|
+
* These schemas are used for validation and type inference during graph execution.
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
getSchemas(): ZodObjectSchema<object>[];
|
|
34
|
+
load(): Promise<this>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type WebAgentState<TInput extends AgentData, TOutput extends AgentData> = AgenticWorkflowState<TInput, TOutput>;
|
|
38
|
+
|
|
39
|
+
export type WebAgentConstructProperties<TInput extends AgentData, TOutput extends AgentData> = Partial<Pick<WebAgent<TInput, TOutput>, "portalItem" | "sourceJSON">>;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
export type AgenticWorkflowJson = AgenticWorkflowJsonObject
|
|
2
|
+
& {
|
|
3
|
+
readonly description?: string;
|
|
4
|
+
readonly graph: AgenticWorkflowGraphJson;
|
|
5
|
+
readonly variables: AgenticWorkflowVariableJson[];
|
|
6
|
+
readonly version: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type AgenticWorkflowEdgeJson = AgenticWorkflowJsonObject
|
|
10
|
+
& {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly source_anchor_id: AgenticWorkflowSourceAnchorIdJson;
|
|
13
|
+
readonly source_node_id: AgenticWorkflowNodeIdJson;
|
|
14
|
+
readonly target_anchor_id?: AgenticWorkflowNodeIdJson;
|
|
15
|
+
readonly target_node_id: AgenticWorkflowNodeIdJson;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type AgenticWorkflowNodeTypeJson = "agent_node" | "end_message_node" | "guardrails_node" | "hitl_node" | "loop_node" | "start_node";
|
|
19
|
+
|
|
20
|
+
export type AgenticWorkflowBaseNodeJson<TType extends AgenticWorkflowNodeTypeJson> = AgenticWorkflowJsonObject
|
|
21
|
+
& {
|
|
22
|
+
readonly id: AgenticWorkflowNodeIdJson;
|
|
23
|
+
readonly label: string;
|
|
24
|
+
readonly type: TType;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type AgenticWorkflowStartNodeJson = AgenticWorkflowBaseNodeJson<"start_node">;
|
|
28
|
+
|
|
29
|
+
export type AgenticWorkflowEndMessageNodeJson = AgenticWorkflowBaseNodeJson<"end_message_node">
|
|
30
|
+
& {
|
|
31
|
+
readonly message: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type AgenticWorkflowAgentNodeJson = AgenticWorkflowBaseNodeJson<"agent_node">
|
|
35
|
+
& {
|
|
36
|
+
readonly prompt?: AgenticWorkflowPromptJson | string;
|
|
37
|
+
readonly structured_output?: AgenticWorkflowStructuredJsonSchemaJson;
|
|
38
|
+
readonly tools?: AgenticWorkflowToolJson[];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type AgenticWorkflowPromptJson = AgenticWorkflowJsonObject
|
|
42
|
+
& {
|
|
43
|
+
readonly id: AgenticWorkflowPromptIdJson;
|
|
44
|
+
readonly messages?: AgenticWorkflowPromptMessageJson[];
|
|
45
|
+
readonly type: "plain_text";
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type AgenticWorkflowJsonObject = { readonly [key: string]: AgenticWorkflowJsonValue | undefined; };
|
|
49
|
+
|
|
50
|
+
export type AgenticWorkflowJsonValue = AgenticWorkflowJsonObject | AgenticWorkflowJsonPrimitive | AgenticWorkflowJsonValue[] | undefined;
|
|
51
|
+
|
|
52
|
+
export type AgenticWorkflowVariableJson = AgenticWorkflowJsonObject
|
|
53
|
+
& {
|
|
54
|
+
readonly data_type?: "array" | "boolean" | "number" | "object" | "string";
|
|
55
|
+
readonly description?: string;
|
|
56
|
+
readonly key: string;
|
|
57
|
+
readonly persisted: boolean;
|
|
58
|
+
readonly private: boolean;
|
|
59
|
+
readonly type: "value";
|
|
60
|
+
readonly value: AgenticWorkflowJsonValue;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type AgenticWorkflowGraphJson = AgenticWorkflowJsonObject
|
|
64
|
+
& {
|
|
65
|
+
readonly edges: AgenticWorkflowEdgeJson[];
|
|
66
|
+
readonly nodes: AgenticWorkflowNodeJson[];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type AgenticWorkflowNodeIdJson = `${string}_node_${number}`;
|
|
70
|
+
|
|
71
|
+
export type AgenticWorkflowSourceAnchorIdJson = `source_anchor_${string}`;
|
|
72
|
+
|
|
73
|
+
export type AgenticWorkflowPromptIdJson = `prompt_${string}`;
|
|
74
|
+
|
|
75
|
+
export type AgenticWorkflowNodeJson = AgenticWorkflowAgentNodeJson | AgenticWorkflowEndMessageNodeJson | AgenticWorkflowGuardrailsNodeJson | AgenticWorkflowHumanInTheLoopNodeJson | AgenticWorkflowLoopNodeJson | AgenticWorkflowStartNodeJson;
|
|
76
|
+
|
|
77
|
+
export type AgenticWorkflowGuardrailsNodeJson = AgenticWorkflowBaseNodeJson<"guardrails_node">
|
|
78
|
+
& {
|
|
79
|
+
readonly conditions: AgenticWorkflowConditionJson[];
|
|
80
|
+
readonly confidence_threshold: number;
|
|
81
|
+
readonly prompt?: AgenticWorkflowPromptJson;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export type AgenticWorkflowHumanInTheLoopNodeJson = AgenticWorkflowBaseNodeJson<"hitl_node">
|
|
85
|
+
& {
|
|
86
|
+
readonly conditions?: AgenticWorkflowConditionJson[];
|
|
87
|
+
readonly enable_feedback: boolean;
|
|
88
|
+
readonly human_input_description: string;
|
|
89
|
+
readonly human_input_description_type?: "dynamic" | "fixed";
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export type AgenticWorkflowLoopNodeJson = AgenticWorkflowBaseNodeJson<"loop_node">
|
|
93
|
+
& {
|
|
94
|
+
readonly loop_back_node_id: AgenticWorkflowNodeIdJson;
|
|
95
|
+
readonly max_loop_count: number;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export type AgenticWorkflowConditionJson = AgenticWorkflowJsonObject
|
|
99
|
+
& {
|
|
100
|
+
readonly preset?: "process" | "reject";
|
|
101
|
+
readonly source_anchor_id: AgenticWorkflowSourceAnchorIdJson;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export type AgenticWorkflowPromptMessageJson = AgenticWorkflowJsonObject
|
|
105
|
+
& {
|
|
106
|
+
readonly content?: string;
|
|
107
|
+
readonly role?: "assistant" | "system" | "user";
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type AgenticWorkflowStructuredJsonSchemaJson = AgenticWorkflowJsonObject
|
|
111
|
+
& {
|
|
112
|
+
readonly properties: Record<string, AgenticWorkflowStructuredJsonPropertyJson>;
|
|
113
|
+
readonly required?: string[];
|
|
114
|
+
readonly type: "object";
|
|
115
|
+
readonly additionalProperties: boolean;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type AgenticWorkflowStructuredJsonPropertyJson = AgenticWorkflowJsonObject
|
|
119
|
+
& {
|
|
120
|
+
readonly description?: string;
|
|
121
|
+
readonly enum?: string[];
|
|
122
|
+
readonly items?: AgenticWorkflowStructuredJsonPropertyJson;
|
|
123
|
+
readonly properties?: Record<string, AgenticWorkflowStructuredJsonPropertyJson>;
|
|
124
|
+
readonly required?: string[];
|
|
125
|
+
readonly type: "array" | "boolean" | "number" | "object" | "string";
|
|
126
|
+
readonly additionalProperties?: boolean;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export type AgenticWorkflowToolJson = AgenticWorkflowMcpToolJson;
|
|
130
|
+
|
|
131
|
+
export type AgenticWorkflowMcpToolJson = AgenticWorkflowJsonObject
|
|
132
|
+
& {
|
|
133
|
+
readonly allowed_tools?: string[];
|
|
134
|
+
readonly args?: string[];
|
|
135
|
+
readonly auth?: AgenticWorkflowMcpToolAuthAPIKeyJson | AgenticWorkflowMcpToolAuthBearerJson | AgenticWorkflowMcpToolAuthOAuth2Json;
|
|
136
|
+
readonly command?: string;
|
|
137
|
+
readonly env?: Record<string, string>;
|
|
138
|
+
readonly label?: string;
|
|
139
|
+
readonly override_params?: AgenticWorkflowUpdateVariableJson[];
|
|
140
|
+
readonly require_approval: AgenticWorkflowApprovalRequirementJson;
|
|
141
|
+
readonly return_direct?: boolean;
|
|
142
|
+
readonly server_description?: string;
|
|
143
|
+
readonly server_label?: string;
|
|
144
|
+
readonly server_url?: string;
|
|
145
|
+
readonly type: "mcp";
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export type AgenticWorkflowApprovalRequirementJson = "always" | "never";
|
|
149
|
+
|
|
150
|
+
export type AgenticWorkflowUpdateVariableJson = AgenticWorkflowJsonObject
|
|
151
|
+
& {
|
|
152
|
+
readonly key: string;
|
|
153
|
+
readonly value: AgenticWorkflowExpressionValueJson;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export type AgenticWorkflowExpressionValueJson = AgenticWorkflowJsonObject
|
|
157
|
+
& {
|
|
158
|
+
readonly return_type?: "array" | "boolean" | "number" | "object" | "string" | "unknown";
|
|
159
|
+
readonly type: "constant" | "variable";
|
|
160
|
+
readonly value: boolean | number | string;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type AgenticWorkflowMcpToolAuthBearerJson = {
|
|
164
|
+
mode: string;
|
|
165
|
+
header_name?: string;
|
|
166
|
+
scheme?: string;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export type AgenticWorkflowMcpToolAuthAPIKeyJson = {
|
|
170
|
+
mode: string;
|
|
171
|
+
header_name?: string;
|
|
172
|
+
prefix?: string;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export type AgenticWorkflowMcpToolAuthOAuth2Json = {
|
|
176
|
+
mode: string;
|
|
177
|
+
discovery?: string;
|
|
178
|
+
client_id?: string;
|
|
179
|
+
authorization_url?: string;
|
|
180
|
+
token_url?: string;
|
|
181
|
+
refresh_url?: string;
|
|
182
|
+
redirect_url?: string;
|
|
183
|
+
scope?: string;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export type AgenticWorkflowJsonPrimitive = boolean | number | string | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BaseNode } from "./BaseNode.js";
|
|
2
|
+
import type { AgenticWorkflowAgentNodeJson } from "../jsonTypes.js";
|
|
3
|
+
import type { Prompt } from "./support/Prompt.js";
|
|
4
|
+
import type { AgentData, ZodObjectSchema } from "../../agent-utils/types.js";
|
|
5
|
+
import type { RuntimeNode, NodeCompilation, NodeCompilationContext } from "../types.js";
|
|
6
|
+
|
|
7
|
+
/** @internal */
|
|
8
|
+
export class AgentNode extends BaseNode {
|
|
9
|
+
/** @param json */
|
|
10
|
+
static fromJSON(json: AgenticWorkflowAgentNodeJson): AgentNode;
|
|
11
|
+
constructor(properties?: AgentNodeConstructProperties);
|
|
12
|
+
accessor outputSchema: ZodObjectSchema<AgentData> | undefined;
|
|
13
|
+
accessor prompt: Prompt | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* The type of this node, which identifies it as an agent node within the workflow.
|
|
16
|
+
*
|
|
17
|
+
* @default "agent-node"
|
|
18
|
+
* @required
|
|
19
|
+
*/
|
|
20
|
+
accessor type: "agent-node";
|
|
21
|
+
/** @param context */
|
|
22
|
+
compile<TCustomState extends AgentData>(context: NodeCompilationContext): NodeCompilation<TCustomState>;
|
|
23
|
+
createRuntimeNode<TCustomState extends AgentData>(): RuntimeNode<TCustomState>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type AgentNodeConstructProperties = Pick<AgentNode, "id" | "label" | "type">;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type Accessor from "@arcgis/core/core/Accessor.js";
|
|
2
|
+
import type { AgenticWorkflowBaseNodeJson, AgenticWorkflowNodeTypeJson } from "../jsonTypes.js";
|
|
3
|
+
import type { AgentData } from "../../agent-utils/types.js";
|
|
4
|
+
import type { NodeCompilation, NodeCompilationContext, RuntimeNode } from "../types.js";
|
|
5
|
+
|
|
6
|
+
/** @internal */
|
|
7
|
+
export abstract class BaseNode extends Accessor {
|
|
8
|
+
/** @param _json */
|
|
9
|
+
static fromJSON(_json: AgenticWorkflowBaseNodeJson<AgenticWorkflowNodeTypeJson>): BaseNode;
|
|
10
|
+
constructor(properties?: BaseNodeConstructProperties);
|
|
11
|
+
/**
|
|
12
|
+
* The unique identifier for this node.
|
|
13
|
+
*
|
|
14
|
+
* @required
|
|
15
|
+
*/
|
|
16
|
+
accessor id: string;
|
|
17
|
+
/**
|
|
18
|
+
* The label for this node, which is used for display purposes.
|
|
19
|
+
*
|
|
20
|
+
* @required
|
|
21
|
+
*/
|
|
22
|
+
accessor label: string;
|
|
23
|
+
/**
|
|
24
|
+
* The type of this node, which can be used to categorize or differentiate nodes within the agent's workflow.
|
|
25
|
+
*
|
|
26
|
+
* @required
|
|
27
|
+
*/
|
|
28
|
+
accessor type: string;
|
|
29
|
+
/** @param context */
|
|
30
|
+
compile<TCustomState extends AgentData>(context: NodeCompilationContext): NodeCompilation<TCustomState>;
|
|
31
|
+
abstract createRuntimeNode<TCustomState extends AgentData>(): RuntimeNode<TCustomState>;
|
|
32
|
+
load(): Promise<this>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type BaseNodeConstructProperties = Pick<BaseNode, "id" | "label" | "type">;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BaseNode } from "./BaseNode.js";
|
|
2
|
+
import type { AgenticWorkflowEndMessageNodeJson } from "../jsonTypes.js";
|
|
3
|
+
import type { AgentData } from "../../agent-utils/types.js";
|
|
4
|
+
import type { NodeCompilation, NodeCompilationContext, RuntimeNode } from "../types.js";
|
|
5
|
+
|
|
6
|
+
/** @internal */
|
|
7
|
+
export class EndMessageNode extends BaseNode {
|
|
8
|
+
/** @param json */
|
|
9
|
+
static fromJSON(json: AgenticWorkflowEndMessageNodeJson): EndMessageNode;
|
|
10
|
+
constructor(properties?: EndMessageNodeConstructProperties);
|
|
11
|
+
/** The message associated with this end message node, which is displayed when the node is reached in the workflow. */
|
|
12
|
+
accessor message: string;
|
|
13
|
+
/**
|
|
14
|
+
* The type of this node, which identifies it as an end message node within the workflow.
|
|
15
|
+
*
|
|
16
|
+
* @default "end-message-node"
|
|
17
|
+
* @required
|
|
18
|
+
*/
|
|
19
|
+
accessor type: "end-message-node";
|
|
20
|
+
/** @param _context */
|
|
21
|
+
compile<TCustomState extends AgentData>(_context: NodeCompilationContext): NodeCompilation<TCustomState>;
|
|
22
|
+
createRuntimeNode<TCustomState extends AgentData>(): RuntimeNode<TCustomState>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type EndMessageNodeConstructProperties = Pick<EndMessageNode, "id" | "label" | "type">;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BaseNode } from "./BaseNode.js";
|
|
2
|
+
import type { AgenticWorkflowStartNodeJson } from "../jsonTypes.js";
|
|
3
|
+
import type { RuntimeNode } from "../types.js";
|
|
4
|
+
import type { AgentData } from "../../agent-utils/types.js";
|
|
5
|
+
|
|
6
|
+
/** @internal */
|
|
7
|
+
export class StartNode extends BaseNode {
|
|
8
|
+
/** @param json */
|
|
9
|
+
static fromJSON(json: AgenticWorkflowStartNodeJson): StartNode;
|
|
10
|
+
constructor(properties?: StartNodeConstructProperties);
|
|
11
|
+
/**
|
|
12
|
+
* The type of this node, which can be used to categorize or differentiate nodes within the agent's workflow.
|
|
13
|
+
*
|
|
14
|
+
* @default "start-node"
|
|
15
|
+
* @required
|
|
16
|
+
*/
|
|
17
|
+
accessor type: "start-node";
|
|
18
|
+
createRuntimeNode<TCustomState extends AgentData>(): RuntimeNode<TCustomState>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type StartNodeConstructProperties = Pick<StartNode, "id" | "label" | "type">;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type Accessor from "@arcgis/core/core/Accessor.js";
|
|
2
|
+
import type { AgenticWorkflowPromptJson } from "../../jsonTypes.js";
|
|
3
|
+
|
|
4
|
+
/** @internal */
|
|
5
|
+
export class Prompt extends Accessor {
|
|
6
|
+
/** @param json */
|
|
7
|
+
static fromJSON(json: AgenticWorkflowPromptJson): Prompt;
|
|
8
|
+
constructor(properties?: PromptConstructProperties);
|
|
9
|
+
/** @required */
|
|
10
|
+
accessor id: string;
|
|
11
|
+
/** @required */
|
|
12
|
+
accessor messages: LLMAgentPromptMessage[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type LLMAgentPromptMessage = {
|
|
16
|
+
content: string;
|
|
17
|
+
role: "assistant" | "system" | "user";
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type PromptConstructProperties = Pick<Prompt, "id" | "messages">;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AgentData, AgentGraphState, AgentRuntimeState, GraphEdge, GraphNodes, ZodObjectSchema } from "../agent-utils/types.js";
|
|
2
|
+
import type { Edge } from "./Edge.js";
|
|
3
|
+
|
|
4
|
+
export type GraphNodeResultsState = {
|
|
5
|
+
nodes: GraphNodeResults;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type RuntimeNode<TCustomState extends AgentData> = GraphNodes<AgentGraphState<GraphNodeResultsState & Omit<TCustomState, "nodes">>, AgentNodeGraphUpdate>[string];
|
|
9
|
+
|
|
10
|
+
export type NodeCompilationContext = {
|
|
11
|
+
outgoingEdges: Edge[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type NodeCompilation<TCustomState extends AgentData> = {
|
|
15
|
+
runtimeNode?: RuntimeNode<TCustomState>;
|
|
16
|
+
edges: GraphEdge<WebAgentRuntimeState<TCustomState>>[];
|
|
17
|
+
schemas?: ZodObjectSchema<object>[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type GraphNodeResults = Record<string, GraphNodeResult>;
|
|
21
|
+
|
|
22
|
+
export type AgentNodeGraphUpdate = Partial<AgentRuntimeState & GraphNodeResultsState>
|
|
23
|
+
& Record<string, unknown>;
|
|
24
|
+
|
|
25
|
+
export type WebAgentRuntimeState<TCustomState extends AgentData> = AgentGraphState<GraphNodeResultsState & Omit<TCustomState, "nodes">>;
|
|
26
|
+
|
|
27
|
+
export type GraphNodeResult<TOutput extends AgentData = AgentData> = {
|
|
28
|
+
output: Omit<TOutput, keyof AgentRuntimeState | "output"> | string;
|
|
29
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import d from"./3ZPPYCNL.js";import b from"./
|
|
2
|
+
import d from"./3ZPPYCNL.js";import b from"./RWM5T4XB.js";import a from"./ZJEWP2ND.js";import{a as p}from"./HJG7QM2R.js";import{Wa as c,a as u,b as i}from"./E7KEOJZG.js";export default $arcgis.t(([,,,,,,{p:g},{H:d,I:E,a:h,m:f,n:y,o:m,p:x},S])=>{var _=[E],v=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:r,fieldRegistry:s},o)=>{let a=Array.from(s.values()).map(n=>n.name).slice(0,10).join(", "),l=s.size>10?` (and ${s.size-10} more)`:"";return`${o+1}. "${r.title}". Description: ${r.description}
|
|
3
3
|
Fields: ${a}${l}`}).join(`
|
|
4
4
|
|
|
5
5
|
`);return`This map contains ${e.size} layer(s):
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import c from"./BMBV6Y2A.js";import"./M3MRIGDZ.js";import b from"./6QJFOL6M.js";import"./UZL6UVE4.js";import a from"./ZJEWP2ND.js";import"./HO2YDJI2.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./S3XUYAUX.js";import"./WZFC5HUX.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{$ as J,$a as Ga,A as z,Aa as ia,B as A,Ba as ja,C as B,Ca as ka,D as C,E as D,Ea as la,F as E,Fa as ma,G as F,Ga as na,H as G,Ha as oa,I as H,Ia as pa,Ja as qa,Ka as ra,La as sa,Ma as ta,Na as ua,Oa as va,Pa as wa,Qa as xa,Ra as ya,S as I,Sa as za,Ta as Aa,Wa as Ba,Xa as Ca,Ya as Da,Za as Ea,_a as Fa,a,aa as K,ab as Ha,b,ba as L,bb as Ia,c,ca as M,cb as Ja,d,da as N,db as Ka,e,ea as O,eb as La,f,fa as P,ga as Q,h as g,ha as R,i as h,ia as S,j as i,ja as T,k as j,ka as U,l as k,la as V,m as l,ma as W,n as m,na as X,o as n,oa as Y,p as o,pa as Z,q as p,qa as _,r as q,ra as $,s as r,sa as aa,t as s,ta as ba,u as t,ua as ca,v as u,va as da,w as v,wa as ea,x as w,xa as fa,y as x,ya as ga,z as y,za as ha}from"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{S as Annotation,O as AsyncBatchedStore,Q as BaseChannel,L as BaseCheckpointSaver,k as BaseLangGraphError,N as BaseStore,R as BinaryOperatorAggregate,d as COMMAND_SYMBOL,I as ChatModelStreamImpl,i as Command,e as CommandInstance,Ca as CompiledStateGraph,qa as DeltaChannel,ua as DeltaValue,b as END,B as EmptyChannelError,A as EmptyInputError,$ as EventLog,la as Graph,l as GraphBubbleUp,o as GraphDrained,q as GraphInterrupt,m as GraphRecursionError,ha as GraphRunStream,n as GraphValueError,c as INTERRUPT,P as InMemoryStore,C as InvalidUpdateError,M as MemorySaver,Da as MessageGraph,Ia as MessagesAnnotation,Aa as MessagesDeltaValue,za as MessagesValue,Ja as MessagesZodMeta,Ka as MessagesZodState,D as MultipleSubgraphsError,s as NodeError,r as NodeInterrupt,y as NodeTimeoutError,g as Overwrite,u as ParentCommand,wa as REMOVE_ALL_MESSAGES,sa as ReducedValue,F as RemoteException,X as RunControl,a as START,Y as STREAM_EVENTS_V3_MODES,f as Send,Ba as StateGraph,G as StateGraphInputError,va as StateSchema,$ as StreamChannel,ia as SubgraphRunStream,E as UnreachableNodeError,ta as UntrackedValue,ra as UntrackedValueChannel,xa as addMessages,_ as convertToProtocolEvent,K as copyCheckpoint,ja as createGraphRunStream,ba as createLifecycleTransformer,ca as createMessagesTransformer,ea as createSubgraphDiscoveryTransformer,fa as createValuesTransformer,J as emptyCheckpoint,Ga as entrypoint,aa as filterLifecycleEntries,da as filterSubgraphHandles,V as getConfig,W as getCurrentTaskInput,oa as getJsonSchemaFromSchema,Ha as getPreviousState,pa as getSchemaDefaultGetter,T as getStore,H as getSubgraphsSeenSet,U as getWriter,ka as interrupt,Z as isCheckpointEnvelope,j as isCommand,w as isGraphBubbleUp,p as isGraphDrained,x as isGraphInterrupt,h as isInterrupted,ga as isNativeTransformer,t as isNodeError,z as isNodeTimeoutError,v as isParentCommand,na as isSerializableSchema,ma as isStandardSchema,ya as messagesDeltaReducer,xa as messagesStateReducer,Ea as pushMessage,Fa as task,La as writer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{c as i,e as c}from"./UZL6UVE4.js";export default $arcgis.t(([m,{subclass:p}])=>{function a(t){return t?Object.keys(t.shape??{}):[]}function d(t){let e={};for(let n of t)for(let s of a(n))e[s]=void 0;return e}function g(t,e){return Object.fromEntries(e.filter(n=>Object.hasOwn(t,n)).map(n=>[n,t[n]]))}function l(t,e){return`${t.id}_${e}`}function h(t,e){let n=e.inputSchema;return n?{...g(t,a(n)),agentExecutionContext:t.agentExecutionContext,outputMessage:t.outputMessage,status:void 0,summary:""}:{...t,status:void 0,summary:""}}function x(t,e){return t.outputSchema?g(e,a(t.outputSchema)):{}}function y(t){let e={outputMessage:t.outputMessage,status:t.status,summary:t.summary};return t.agentExecutionContext&&(e.agentExecutionContext=t.agentExecutionContext),e}function v(t,e){return async(n,s)=>{let o=await t.run(h(n,t),s),r=x(t,o);return e||o.status==="failed"?{...r,...y(o)}:{...r,outputMessage:o.outputMessage}}}var w=Object.getOwnPropertyDescriptor,E=(t,e,n,s)=>{for(var o=s>1?void 0:s?w(e,n):e,r=t.length-1,u;r>=0;r--)(u=t[r])&&(o=u(o)||o);return o},f=class extends m{generate(){let t=this.getAgents();this.validateAgents(t);for(let r of t)r.generate();let e=d(t.flatMap(r=>r.getSchemas())),n=i(e),s=this.buildNodes(t),o=this.buildEdges(t);return{workspace:n,createGraph:()=>c(s,o,n,{entryNode:this.getEntryNode(t)})}}buildNodes(t){let e={};for(let[n,s]of t.entries())e[l(s,n)]=v(s,this.isTerminalAgent(t,n));return e}validateAgents(t){if(!t.length)throw new Error("Workflow requires at least one agent.")}};f=E([p("BaseWorkflow")],f);return{a:a,b:d,c:l,d:f}},"core/Accessor","core/accessorSupport/decorators")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./RWM5T4XB.js";import a from"./ZJEWP2ND.js";import{a as c,b as k}from"./HJG7QM2R.js";import{Wa as x,a as w,b as d,j as f}from"./E7KEOJZG.js";import{ca as u}from"./LUY6V4TP.js";export default $arcgis.t(([,,,,,,{n:_,p:b},{J:y,K:K,L:q,M:S,N:M,O:T,P:E,Q:C,R:G,S:N,T:R,a:v,m:m,n:h,p:A}])=>{var z=[T,E,N,C,M,R,G];async function $(e,a){let o=await m("arcgis_knowledge_tool_prompt"),s=K(a),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:s},r=await b({promptText:o,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:z,config:a}),i=(r.tool_calls?.length??0)>0,t=typeof r.text=="string"?r.text.trim():"",l=t.length>0,p=r.content.toString();return!i&&(s==="map"||s==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:s==="map"?"No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries.":"No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",status:"success"}:{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:i?p:t,status:i?e.status:l?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var L={generateCypher:"generated-cypher-query",queryGraphData:"graph-query-result",searchGraphData:"graph-search-result",addRecords:"added-records",applyLayout:"applied-layout",changeNonspatialVisibility:"changed-nonspatial-visibility",createLinkChart:"created-link-chart"};function I(e){return!!e&&e.status==="success"&&!!L[e.toolName]}function D(e){return{type:L[e.toolName],data:e.details}}async function F(e,a){let o=new v(z,{handleToolErrors:!1});try{let s=await o.invoke({messages:e.arcgisKnowledgeMessages},a),n=[];for(let t of s.messages){let l;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{l=JSON.parse(t.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name??"unknown"}.
|
|
3
3
|
|
|
4
4
|
Original Content: ${t.content}`)}if(!l||typeof l!="object"||!("toolName"in l))throw new Error(`Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(l)}`);n.push(l)}await c({text:`Finished executing ArcGIS Knowledge Agent tools: ${s.messages.filter(t=>t.name).map(t=>t.name).join(", ")}`},a);let r=n.filter(t=>typeof t!="string").map(t=>`- Called Tool: ${t.toolName}, Status: ${t.status}`),i=n[0];return i&&I(i)&&await k(D(i),a),{...e,outputMessage:r.join(`
|
|
5
5
|
`),summary:r.length?h(r.join(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{c}from"./UZL6UVE4.js";export default $arcgis.t(([l,{property:i,subclass:y},{watch:d}])=>{var w=Object.defineProperty,g=Object.getOwnPropertyDescriptor,t=(s,a,p,o)=>{for(var r=o>1?void 0:o?g(a,p):a,h=s.length-1,n;h>=0;h--)(n=s[h])&&(r=(o?n(a,p,r):n(r))||r);return o&&r&&w(a,p,r),r},m=()=>{throw new Error("createGraph method not implemented.")},e=class extends l{constructor(){super(...arguments),this.description="",this.middlewares=[],this.createGraph=m,this.workspace=c()}initialize(){this.addHandles([d(()=>[this.name,this.description],()=>this.generate(),{initial:!0,sync:!0}),d(()=>this.createGraph,()=>this._compiledGraph=void 0)])}get id(){return this.name.replace(/\s+/gu,"-").toLowerCase()}get registration(){return{id:this.id,name:this.name,description:this.description,createGraph:this.createGraph,workspace:this.workspace}}async run(s={},a){return this.createGraph===m&&this.generate(),this._compiledGraph=this._compiledGraph??this.createGraph().compile(),await this._compiledGraph.invoke(s,a)}};t([i({readOnly:!0})],e.prototype,"id",1);t([i()],e.prototype,"name",2);t([i()],e.prototype,"description",2);t([i()],e.prototype,"middlewares",2);t([i({readOnly:!0})],e.prototype,"createGraph",2);t([i({readOnly:!0})],e.prototype,"workspace",2);t([i({readOnly:!0})],e.prototype,"registration",1);e=t([y("BaseAgent")],e);return e},"core/Accessor","core/accessorSupport/decorators","core/reactiveUtils")
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import d from"./Z4XUJQ2I.js";import c from"./3ZPPYCNL.js";import b from"./RWM5T4XB.js";import{a as s,c as o}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import a from"./ZJEWP2ND.js";import"./HO2YDJI2.js";import{v as i,z as r}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./WZFC5HUX.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,a])=>{var t=class extends i{constructor(){super(...arguments),this.agent=a}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-navigation-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-navigation-agent"),this.#i=o(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-navigation-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c,d)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as d,b as S,c as v}from"./M3MRIGDZ.js";import b from"./6QJFOL6M.js";import{d as f,e as y}from"./UZL6UVE4.js";import a from"./ZJEWP2ND.js";import{c as u}from"./S3XUYAUX.js";import{b as c}from"./WZFC5HUX.js";import{Y as g,y as l}from"./E7KEOJZG.js";export default $arcgis.t(([,,,{watch:T},,{property:m,subclass:_},{d:h},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(e,s,t,r)=>{for(var o=r>1?void 0:r?x(s,t):s,n=e.length-1,p;n>=0;n--)(p=e[n])&&(o=(r?p(s,t,o):p(o))||o);return r&&o&&k(s,t,o),o},i=class extends w{constructor(e){super(e),this.modelTier="default"}initialize(){this.addHandles(T(()=>[this.description,this.inputSchema,this.modelTier,this.name,this.outputSchema,this.prompt,this.tools],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let e=f(this.getSchemas());this._set("workspace",e);let s=this.id,t={[s]:this._invoke.bind(this)},r=[{from:s,decide:()=>{}}];this._set("createGraph",()=>y(t,r,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}async _invoke(e,s){try{return this.outputSchema?await this._invokeStructured(e,s):await this._invokeUnstructured(e,s)}catch(t){if(l(t))throw t;let r=t instanceof Error?t.message:String(t);return d({outputMessage:r},"failed",r)}}async _invokeStructured(e,s){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let t=await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:e.agentExecutionContext.messages},s);if(!("structuredResponse"in t)||t.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(t.structuredResponse,this.outputSchema,t.messages)}async _invokeUnstructured(e,s){let t=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares)}).invoke({messages:e.agentExecutionContext.messages},s)).messages,r=t.at(-1)?.content??"",o=typeof r=="string"?r:JSON.stringify(r),n=o.trim()||"LLMAgent completed.";return d({agentExecutionContext:{...e.agentExecutionContext,messages:t},outputMessage:o},"success",n)}async _getPromptWithInputVariables(e){let s=v(e,this.inputSchema);for(let{outputKey:t}of this.middlewares)t&&(s[String(t)]=e[t]);return await g.fromTemplate(this.prompt).format(s)}_getTools(){return this.tools?.map(e=>e.getTool())??[]}};a([m()],i.prototype,"prompt",2);a([m()],i.prototype,"tools",2);a([m()],i.prototype,"inputSchema",2);a([m()],i.prototype,"outputSchema",2);a([m()],i.prototype,"modelTier",2);i=a([_("LLMAgent")],i);return i},"identity/IdentityManager","portal/Portal","request","core/reactiveUtils","layers/FeatureLayer","core/accessorSupport/decorators",a,b)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{b as D,c as M}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import d from"./BMBV6Y2A.js";import"./M3MRIGDZ.js";import b from"./6QJFOL6M.js";import{a as R,b as q,e as L}from"./UZL6UVE4.js";import a from"./ZJEWP2ND.js";import{e as C}from"./HO2YDJI2.js";import{v as k,z as E}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./S3XUYAUX.js";import"./WZFC5HUX.js";import{W as A,ia as S}from"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import{Dd as c}from"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([$,U,{property:a,subclass:h},b,J,,,,,,,W,T])=>{var V=Object.defineProperty,X=Object.getOwnPropertyDescriptor,f=(t,e,o,s)=>{for(var r=s>1?void 0:s?X(e,o):e,i=t.length-1,n;i>=0;i--)(n=t[i])&&(r=(s?n(e,o,r):n(r))||r);return s&&r&&V(e,o,r),r},p=class extends J{constructor(t){super(t)}static fromJSON(t){return new p({id:t.id,sourceAnchorId:t.source_anchor_id,sourceNodeId:t.source_node_id,targetAnchorId:t.target_anchor_id,targetNodeId:t.target_node_id})}};f([a()],p.prototype,"id",2);f([a()],p.prototype,"sourceAnchorId",2);f([a()],p.prototype,"sourceNodeId",2);f([a()],p.prototype,"targetAnchorId",2);f([a()],p.prototype,"targetNodeId",2);p=f([h("Edge")],p);var Y=Object.defineProperty,Z=Object.getOwnPropertyDescriptor,N=(t,e,o,s)=>{for(var r=s>1?void 0:s?Z(e,o):e,i=t.length-1,n;i>=0;i--)(n=t[i])&&(r=(s?n(e,o,r):n(r))||r);return s&&r&&Y(e,o,r),r},d=class extends J{constructor(t){super(t)}async load(){return await Promise.resolve(this)}compile(t){return{runtimeNode:this.createRuntimeNode(),edges:t.outgoingEdges.map(e=>({from:this.id,to:e.targetNodeId}))}}static fromJSON(t){throw new Error("BaseNode is abstract and cannot be instantiated directly.")}};N([a()],d.prototype,"id",2);N([a()],d.prototype,"label",2);N([a()],d.prototype,"type",2);d=N([h("BaseNode")],d);var tt=Object.defineProperty,et=Object.getOwnPropertyDescriptor,x=(t,e,o,s)=>{for(var r=s>1?void 0:s?et(e,o):e,i=t.length-1,n;i>=0;i--)(n=t[i])&&(r=(s?n(e,o,r):n(r))||r);return s&&r&&tt(e,o,r),r},m=class extends J{constructor(t){super(t),this.messages=[]}static fromJSON(t){let e=m._normalizeMessages(t.messages);return new m({id:t.id,messages:e})}static _normalizeMessages(t){return Array.isArray(t)?t.filter(e=>typeof e.content=="string").map(e=>({content:e.content,role:e.role??"system"})):[]}};x([a()],m.prototype,"id",2);x([a()],m.prototype,"messages",2);m=x([h("Prompt")],m);function z(t){let e=new Set(t.required),o=Object.fromEntries(Object.entries(t.properties).map(([s,r])=>{let i=G(r);return[s,e.has(s)?i:i.optional()]}));return c.object(o)}function G(t){let e;switch(t.type){case"array":e=c.array(t.items?G(t.items):c.unknown());break;case"boolean":e=c.boolean();break;case"number":e=c.number();break;case"object":e=z({properties:t.properties??{},required:t.required});break;case"string":e=t.enum?.length?c.enum(t.enum):c.string();break}return t.description?e.describe(t.description):e}var rt=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,B=t=>{throw TypeError(t)},O=(t,e,o,s)=>{for(var r=s>1?void 0:s?ot(e,o):e,i=t.length-1,n;i>=0;i--)(n=t[i])&&(r=(s?n(e,o,r):n(r))||r);return s&&r&&rt(e,o,r),r},st=(t,e,o)=>e.has(t)||B("Cannot "+o),it=(t,e,o)=>e.has(t)?B("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,o),nt=(t,e,o)=>(st(t,e,"access private method"),o),_,F,u=class extends d{constructor(t){super(t),it(this,_),this.type="agent-node"}createRuntimeNode(){return async(t,e)=>{let o=await nt(this,_,F).call(this).run(t,e),s=this.outputSchema?.safeParse(o);if(s&&!s.success)throw s.error;let r=s?.data,i=r??o.outputMessage;return{agentExecutionContext:o.agentExecutionContext,...r?{}:{outputMessage:o.outputMessage},status:o.status,summary:o.summary,nodes:{[this.id]:{output:i}}}}}compile(t){let e=t.outgoingEdges[0]?.targetNodeId;return{runtimeNode:this.createRuntimeNode(),edges:[{from:this.id,decide:o=>o.status==="failed"?void 0:e}],schemas:[c.object({output:this.outputSchema??c.string()})]}}static fromJSON(t){let e=new u({id:t.id,label:t.label,type:"agent-node"});return t.prompt&&(typeof t.prompt=="string"?e.prompt=m.fromJSON({id:`prompt_${t.id}`,type:"plain_text",messages:[{content:t.prompt,role:"system"}]}):e.prompt=m.fromJSON(t.prompt)),t.structured_output&&(e.outputSchema=z(t.structured_output)),e}};_=new WeakSet;F=function(){let t=this.prompt?.messages?.[0].content;if(!t?.trim())throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);return new T({name:this.id,outputSchema:this.outputSchema,prompt:t})};O([a()],u.prototype,"type",2);O([a()],u.prototype,"prompt",2);O([a()],u.prototype,"outputSchema",2);u=O([h("AgentNode")],u);var at=Object.defineProperty,ct=Object.getOwnPropertyDescriptor,I=(t,e,o,s)=>{for(var r=s>1?void 0:s?ct(e,o):e,i=t.length-1,n;i>=0;i--)(n=t[i])&&(r=(s?n(e,o,r):n(r))||r);return s&&r&&at(e,o,r),r},l=class extends d{constructor(t){super(t),this.type="end-message-node"}createRuntimeNode(){return async t=>{let e=await A.fromTemplate(this.message,{templateFormat:"mustache"}).format(t);return{outputMessage:e,status:"success",summary:e}}}compile(t){return{runtimeNode:this.createRuntimeNode(),edges:[]}}static fromJSON(t){let e=new l({id:t.id,label:t.label,type:"end-message-node"});return e.message=t.message,e}};I([a()],l.prototype,"type",2);I([a()],l.prototype,"message",2);l=I([h("EndMessageNode")],l);var pt=Object.defineProperty,dt=Object.getOwnPropertyDescriptor,H=(t,e,o,s)=>{for(var r=s>1?void 0:s?dt(e,o):e,i=t.length-1,n;i>=0;i--)(n=t[i])&&(r=(s?n(e,o,r):n(r))||r);return s&&r&&pt(e,o,r),r},y=class extends d{constructor(t){super(t),this.type="start-node"}createRuntimeNode(){return t=>({question:t.agentExecutionContext.userRequest})}static fromJSON(t){return new y({id:t.id,label:t.label,type:"start-node"})}};H([a()],y.prototype,"type",2);y=H([h("StartNode")],y);function mt(t){switch(t.type){case"agent_node":return u.fromJSON(t);case"end_message_node":return l.fromJSON(t);case"start_node":return y.fromJSON(t);default:throw new Error(`WebAgent node "${t.id}" uses unsupported type "${t.type}".`)}}function ut(t={}){let e=Object.keys(t);if(R(e),e.includes("nodes"))throw new Error("node state cannot define reserved field: nodes.");let o=q(t);return S.Root({...o,nodes:S({reducer:(s,r)=>({...s,...r}),default:()=>({})}),...C()})}function K(t){let e=new Set;for(let s of t)for(let r of Object.keys(s.shape??{}))r!=="nodes"&&e.add(r);let o=Object.fromEntries([...e].map(s=>[s,void 0]));return ut(o)}var v=class t{constructor(e,o,s){this.sourceJSON=e,this.edges=o,this.nodes=s,this._loaded=!1}static fromJSON(e){return new t(e,e.graph.edges.map(o=>p.fromJSON(o)),e.graph.nodes.map(o=>mt(o)))}async load(){return this._loadPromise??=Promise.all(this.nodes.map(async e=>await e.load())).then(()=>{this._loaded=!0}),await this._loadPromise,this}getSchemas(){let e=Object.fromEntries(this._getNodeCompilations().flatMap((o,s)=>{let r=this.nodes[s];return o.schemas?.map(i=>[r.id,i])??[]}));return[c.object({loopCounts:c.record(c.string(),c.number()).optional(),nodes:c.object(e).partial().optional(),question:c.string().optional()})]}generate(){this._assertLoaded(),this._nodeCompilations=void 0;let e=this._getNodeCompilations(),o=K(this.getSchemas()),s=this.nodes.find(n=>n.type==="start-node")?.id,r={},i=[];for(let[n,Q]of this.nodes.entries()){let w=e[n];w&&(w.runtimeNode&&(r[Q.id]=w.runtimeNode),i.push(...w.edges))}return{createGraph:()=>L(r,i,o,{entryNode:s}),workspace:o}}_assertLoaded(){if(!this._loaded)throw new Error("AgenticWorkflowRuntime must be loaded before it can generate a graph.")}_getNodeCompilations(){return this._assertLoaded(),this._nodeCompilations??=this.nodes.map(e=>e.compile({outgoingEdges:this.edges.filter(o=>o.sourceNodeId===e.id)}))}},ht=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,P=(t,e,o,s)=>{for(var r=s>1?void 0:s?lt(e,o):e,i=t.length-1,n;i>=0;i--)(n=t[i])&&(r=(s?n(e,o,r):n(r))||r);return s&&r&&ht(e,o,r),r},gt=()=>{throw new Error("WebAgent must be loaded before it can run.")},g=class extends W{constructor(t){super(t)}async load(){if(this.portalItem){try{await this.portalItem.load()}catch(o){throw new b("web-agent:load-portal-item","Failed to load portal item",{error:o})}let e=await this.portalItem.fetchData();if(this.sourceJSON=e,!this.portalItem.title)throw new b("web-agent:missing-title","The portal item is missing a title")}if(!this.sourceJSON)throw new b("web-agent:missing-source-json","The source JSON is missing");if(!this.sourceJSON.description)throw new b("web-agent:missing-description","The source JSON is missing a description");let t=v.fromJSON(this.sourceJSON);return await t.load(),this._runtime=t,this.description=this.sourceJSON.description,this.name=this.portalItem?.title??`web-agent-${Date.now()}`,this.generate(),this}getSchemas(){return this._runtime?.getSchemas()??[]}generate(){if(!this._runtime){this._set("workspace",K([])),this._set("createGraph",gt);return}let{createGraph:t,workspace:e}=this._runtime.generate();this._set("workspace",e),this._set("createGraph",t)}};P([a({type:$})],g.prototype,"portalItem",2);P([a()],g.prototype,"sourceJSON",2);g=P([h("WebAgent")],g);var j=class extends k{static{this.properties={agent:0,context:0,itemId:1,workflow:0}}#t;async getContext(){return D(this.context)?await this.context():this.context}async load(){let e;if(this.itemId){let o=U.getDefault();e=new g({portalItem:new $({id:this.itemId,portal:o})})}else this.workflow&&(e=new g({sourceJSON:this.workflow}));if(e&&(await e.load(),this.agent=e.registration),!this.agent)throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");this.#t=M(this)}disconnectedCallback(){this.#t?.unregister(this.agent.id),super.disconnectedCallback()}};E("arcgis-assistant-agent",j);return j},"portal/PortalItem","portal/Portal","core/accessorSupport/decorators","core/Error","core/Accessor","identity/IdentityManager","request","config","core/reactiveUtils","layers/FeatureLayer",a,b,d)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import b from"./5SF6DEMO.js";import a from"./6QJFOL6M.js";import{e as m}from"./UZL6UVE4.js";import"./HO2YDJI2.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:n,subclass:l},{watch:w},c])=>{var d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=(e,r,s,o)=>{for(var t=o>1?void 0:o?f(r,s):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,s,t):a(t))||t);return o&&t&&d(r,s,t),t},h=class extends c{constructor(e){super(e)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.workflow],()=>this.generate(),{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,...this.workflow.getAgents().flatMap(e=>e.getSchemas()),this.outputSchema].filter(Boolean)}generate(){let{workspace:e,createGraph:r}=this.workflow.generate();if(this._set("workspace",e),!this.middlewares?.length)this._set("createGraph",r);else{let s=this.id,o={[s]:async(i,a)=>await r().compile().invoke(i,a)},t=[{from:s,decide:()=>{}}];this._set("createGraph",()=>m(o,t,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}}};p([n()],h.prototype,"workflow",2);p([n()],h.prototype,"inputSchema",2);p([n()],h.prototype,"outputSchema",2);h=p([l("WorkflowAgent")],h);return h},"core/accessorSupport/decorators","core/reactiveUtils",a,b)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import c from"./3ZPPYCNL.js";import b from"./
|
|
2
|
+
import c from"./3ZPPYCNL.js";import b from"./RWM5T4XB.js";import a from"./ZJEWP2ND.js";import{a as i}from"./HJG7QM2R.js";import{Wa as S,a as u,b as p,s as f}from"./E7KEOJZG.js";export default $arcgis.t(([,,,,,,{p:x},{A:_,B:h,a:w,m:E,o:y,p:I,q:L,r:v,s:F,t:$,u:C,v:N,w:R,x:T,y:b,z:A},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await i({text:"Similarity search to find fields"},t);let e=y(t,"fieldSearch"),n=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),r=await e.searchFields({text:a.agentExecutionContext.assignedTask,layerIds:a.vectorSearchLayerIds,minScore:V,topResults:z,embeddingCache:o}),m=r.map(({layerId:d,results:c})=>{let g=c.map(s=>` - ${s.name} (${s.score.toFixed(2)})`).join(`
|
|
3
3
|
`);return`${n.get(d)?.layerItem.name??d}:
|
|
4
4
|
${g}`}).join(`
|
|
5
5
|
`),l;return r.length>0?l=`Vector search completed. Matching layers and fields with scores:
|