@arcgis/ai-components 5.2.0-next.71 → 5.2.0-next.73
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/LLMAgent.d.ts +5 -2
- package/dist/agent-utils/LLMAgent.js +1 -1
- 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 +193 -0
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -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/nodes/tools/ArcgisTool.d.ts +21 -0
- package/dist/agentic-workflow/types.d.ts +29 -0
- package/dist/cdn/2EJROB32.js +2 -0
- package/dist/cdn/34O57OGV.js +2 -0
- package/dist/cdn/3LXXSMA5.js +2 -0
- package/dist/cdn/3MJQA533.js +2 -0
- package/dist/cdn/3U476GCP.js +5 -0
- package/dist/cdn/3XXZUQMQ.js +2 -0
- package/dist/cdn/4YDXYW4J.js +2 -0
- package/dist/cdn/4ZUUS4DH.js +2 -0
- package/dist/cdn/527C4GD2.js +36 -0
- package/dist/cdn/5RZGG4F2.js +2 -0
- package/dist/cdn/5SF6DEMO.js +2 -0
- package/dist/cdn/5Y6TQAJN.js +2 -0
- package/dist/cdn/65IWA2PM.js +2 -0
- package/dist/cdn/{MW5S2XCB.js → 67YCNNCN.js} +2 -2
- package/dist/cdn/6FKLWNGA.js +2 -0
- package/dist/cdn/6QJFOL6M.js +2 -0
- package/dist/cdn/6RDKDLSX.js +2 -0
- package/dist/cdn/6SGNSDLY.js +2 -0
- package/dist/cdn/7747YL7V.js +2 -0
- package/dist/cdn/7TO56JHS.js +2 -0
- package/dist/cdn/ABXLPDEK.js +2 -0
- package/dist/cdn/BBJDW6GC.js +2 -0
- package/dist/cdn/{PUFTYLJ2.js → C4FKFOU4.js} +4 -4
- package/dist/cdn/CCC6LBMY.js +2 -0
- package/dist/cdn/CGVVL52C.js +2 -0
- package/dist/cdn/DBHLKLKM.js +2 -0
- package/dist/cdn/DKLK4EUE.js +2 -0
- package/dist/cdn/E25RINU2.js +2 -0
- package/dist/cdn/E62P76TP.js +2 -0
- package/dist/cdn/E7JLG2A2.js +2 -0
- package/dist/cdn/{TFT6HK3O.js → E7KEOJZG.js} +1 -1
- package/dist/cdn/FDOMMK2M.js +2 -0
- package/dist/cdn/FSMHR7GK.js +2 -0
- package/dist/cdn/GG3AESSV.js +2 -0
- package/dist/cdn/H6JSNAT4.js +2 -0
- package/dist/cdn/HNMFFLSY.js +2 -0
- package/dist/cdn/HO2YDJI2.js +6 -0
- package/dist/cdn/{KQHLOYKL.js → I4L45WQS.js} +1 -1
- package/dist/cdn/ITBQGOMF.js +11 -0
- package/dist/cdn/JH6EAWB2.js +2 -0
- package/dist/cdn/JON2JHS2.js +2 -0
- package/dist/cdn/JWPB3XZM.js +2 -0
- package/dist/cdn/JXB4TNSG.js +2 -0
- package/dist/cdn/JYVBCHR6.js +6 -0
- package/dist/cdn/KRN6AFNB.js +18 -0
- package/dist/cdn/KZACIY2W.js +2 -0
- package/dist/cdn/MKJS7QYQ.js +2 -0
- package/dist/cdn/N735LT4S.js +2 -0
- package/dist/cdn/NP7DG7LQ.js +2 -0
- package/dist/cdn/NTZAOJH5.js +2 -0
- package/dist/cdn/{CXW5URTF.js → OHMNQ3RU.js} +5 -5
- package/dist/cdn/ONQ6JSBJ.js +2 -0
- package/dist/cdn/PAUIFUMO.js +2 -0
- package/dist/cdn/QNNGPA3Q.js +2 -0
- package/dist/cdn/RATZTLNX.js +2 -0
- package/dist/cdn/RU5DVLYG.js +156 -0
- package/dist/cdn/{YHQJ66WJ.js → S3XUYAUX.js} +1 -1
- package/dist/cdn/S6ZAQRC6.js +2 -0
- package/dist/cdn/SABZC4D4.js +2 -0
- package/dist/cdn/TYL5G7KR.js +2 -0
- package/dist/cdn/{XETNZW4D.js → UAZLKUFN.js} +1 -1
- package/dist/cdn/UZL6UVE4.js +2 -0
- package/dist/cdn/VBZ5XGAM.js +2 -0
- package/dist/cdn/VXBUMZYR.js +2 -0
- package/dist/cdn/W5FLNFSN.js +2 -0
- package/dist/cdn/W5J4Q3RO.js +14 -0
- package/dist/cdn/WQKNV6KK.js +2 -0
- package/dist/cdn/{ICYUPLZM.js → WZFC5HUX.js} +1 -1
- package/dist/cdn/XGBEHER5.js +2 -0
- package/dist/cdn/XPTCV6YV.js +2 -0
- package/dist/cdn/Y5UFOH54.js +2 -0
- package/dist/cdn/YGCTAIBS.js +2 -0
- 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 +939 -1950
- package/dist/chunks/adapter10.js +21 -0
- package/dist/chunks/adapter11.js +30 -0
- package/dist/chunks/adapter12.js +22 -0
- package/dist/chunks/adapter13.js +22 -0
- package/dist/chunks/adapter14.js +109 -0
- package/dist/chunks/adapter15.js +40 -0
- package/dist/chunks/adapter16.js +154 -0
- package/dist/chunks/adapter17.js +141 -0
- package/dist/chunks/adapter18.js +127 -0
- package/dist/chunks/adapter2.js +52 -0
- package/dist/chunks/adapter3.js +30 -0
- package/dist/chunks/adapter4.js +50 -0
- package/dist/chunks/adapter5.js +27 -0
- package/dist/chunks/adapter6.js +24 -0
- package/dist/chunks/adapter7.js +26 -0
- package/dist/chunks/adapter8.js +21 -0
- package/dist/chunks/adapter9.js +42 -0
- package/dist/chunks/arcgisKnowledgeGraph.js +5 -5
- package/dist/chunks/baseAgentState.js +56 -0
- package/dist/chunks/dataExplorationGraph.js +34 -31
- package/dist/chunks/fetchAgentContext.js +13 -0
- package/dist/chunks/fetchService.js +10 -0
- package/dist/chunks/formatFeatureAttributes.js +132 -0
- package/dist/chunks/generateLayerDescriptions.js +189 -235
- package/dist/chunks/helpGraph.js +11 -9
- package/dist/chunks/layerStylingGraph.js +22 -21
- package/dist/chunks/mergeWhereClauses.js +15 -0
- package/dist/chunks/navigationGraph.js +81 -70
- package/dist/chunks/orchestrator.js +1 -1
- package/dist/chunks/state.js +20 -26
- package/dist/chunks/types.js +59 -0
- 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 +636 -10
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +15 -5
- package/dist/components/arcgis-assistant-help-agent/customElement.js +21 -5
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +39 -22
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +22 -5
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +13 -5
- 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/E5ZKBC24.js +0 -36
- package/dist/cdn/GP6NDTUE.js +0 -18
- 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
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
1
2
|
import type { BaseAgent } from "./BaseAgent.js";
|
|
2
3
|
import type { FunctionToolLike } from "./tools/FunctionTool.js";
|
|
3
4
|
import type { AgentCustomState, AgentData, ZodObjectSchema } from "./types.js";
|
|
4
5
|
|
|
6
|
+
export type LLMAgentTool = FunctionToolLike | StructuredToolInterface;
|
|
7
|
+
|
|
5
8
|
/**
|
|
6
9
|
* LLMAgent uses a language model to generate its output based on a provided prompt template and optional tools.
|
|
7
10
|
* It supports structured input and output through Zod schemas, allowing for validation and type safety. The agent's logic is defined by the prompt and the tools it has access to, making it a flexible option for a wide range of use cases.
|
|
@@ -39,8 +42,8 @@ export class LLMAgent<TInput extends AgentData = AgentData, TOutput extends Agen
|
|
|
39
42
|
* @required
|
|
40
43
|
*/
|
|
41
44
|
accessor prompt: string;
|
|
42
|
-
/** The tools property is an optional array of
|
|
43
|
-
accessor tools:
|
|
45
|
+
/** The tools property is an optional array of tools that the agent can use during execution. */
|
|
46
|
+
accessor tools: LLMAgentTool[] | undefined;
|
|
44
47
|
/**
|
|
45
48
|
* Rebuilds internal workspace and createGraph wiring. This is automatically called during initialization and whenever
|
|
46
49
|
* the name or description properties change, but can also be called manually if needed to refresh the agent's graph definition.
|
|
@@ -113,7 +113,7 @@ let a = class extends v {
|
|
|
113
113
|
return await S.fromTemplate(this.prompt).format(r);
|
|
114
114
|
}
|
|
115
115
|
_getTools() {
|
|
116
|
-
return this.tools?.map((t) => t.getTool()) ?? [];
|
|
116
|
+
return this.tools?.map((t) => "getTool" in t ? t.getTool() : t) ?? [];
|
|
117
117
|
}
|
|
118
118
|
//#endregion
|
|
119
119
|
};
|
|
@@ -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,193 @@
|
|
|
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 AgenticWorkflowArcgisToolJson = AgenticWorkflowJsonObject
|
|
49
|
+
& {
|
|
50
|
+
readonly type: "arcgis_tool";
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly require_approval: AgenticWorkflowApprovalRequirementJson;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type AgenticWorkflowJsonObject = { readonly [key: string]: AgenticWorkflowJsonValue | undefined; };
|
|
56
|
+
|
|
57
|
+
export type AgenticWorkflowJsonValue = AgenticWorkflowJsonObject | AgenticWorkflowJsonPrimitive | AgenticWorkflowJsonValue[] | undefined;
|
|
58
|
+
|
|
59
|
+
export type AgenticWorkflowVariableJson = AgenticWorkflowJsonObject
|
|
60
|
+
& {
|
|
61
|
+
readonly data_type?: "array" | "boolean" | "number" | "object" | "string";
|
|
62
|
+
readonly description?: string;
|
|
63
|
+
readonly key: string;
|
|
64
|
+
readonly persisted: boolean;
|
|
65
|
+
readonly private: boolean;
|
|
66
|
+
readonly type: "value";
|
|
67
|
+
readonly value: AgenticWorkflowJsonValue;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type AgenticWorkflowGraphJson = AgenticWorkflowJsonObject
|
|
71
|
+
& {
|
|
72
|
+
readonly edges: AgenticWorkflowEdgeJson[];
|
|
73
|
+
readonly nodes: AgenticWorkflowNodeJson[];
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export type AgenticWorkflowNodeIdJson = `${string}_node_${number}`;
|
|
77
|
+
|
|
78
|
+
export type AgenticWorkflowSourceAnchorIdJson = `source_anchor_${string}`;
|
|
79
|
+
|
|
80
|
+
export type AgenticWorkflowPromptIdJson = `prompt_${string}`;
|
|
81
|
+
|
|
82
|
+
export type AgenticWorkflowNodeJson = AgenticWorkflowAgentNodeJson | AgenticWorkflowEndMessageNodeJson | AgenticWorkflowGuardrailsNodeJson | AgenticWorkflowHumanInTheLoopNodeJson | AgenticWorkflowLoopNodeJson | AgenticWorkflowStartNodeJson;
|
|
83
|
+
|
|
84
|
+
export type AgenticWorkflowGuardrailsNodeJson = AgenticWorkflowBaseNodeJson<"guardrails_node">
|
|
85
|
+
& {
|
|
86
|
+
readonly conditions: AgenticWorkflowConditionJson[];
|
|
87
|
+
readonly confidence_threshold: number;
|
|
88
|
+
readonly prompt?: AgenticWorkflowPromptJson;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export type AgenticWorkflowHumanInTheLoopNodeJson = AgenticWorkflowBaseNodeJson<"hitl_node">
|
|
92
|
+
& {
|
|
93
|
+
readonly conditions?: AgenticWorkflowConditionJson[];
|
|
94
|
+
readonly enable_feedback: boolean;
|
|
95
|
+
readonly human_input_description: string;
|
|
96
|
+
readonly human_input_description_type?: "dynamic" | "fixed";
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export type AgenticWorkflowLoopNodeJson = AgenticWorkflowBaseNodeJson<"loop_node">
|
|
100
|
+
& {
|
|
101
|
+
readonly loop_back_node_id: AgenticWorkflowNodeIdJson;
|
|
102
|
+
readonly max_loop_count: number;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export type AgenticWorkflowConditionJson = AgenticWorkflowJsonObject
|
|
106
|
+
& {
|
|
107
|
+
readonly preset?: "process" | "reject";
|
|
108
|
+
readonly source_anchor_id: AgenticWorkflowSourceAnchorIdJson;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export type AgenticWorkflowPromptMessageJson = AgenticWorkflowJsonObject
|
|
112
|
+
& {
|
|
113
|
+
readonly content?: string;
|
|
114
|
+
readonly role?: "assistant" | "system" | "user";
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type AgenticWorkflowStructuredJsonSchemaJson = AgenticWorkflowJsonObject
|
|
118
|
+
& {
|
|
119
|
+
readonly properties: Record<string, AgenticWorkflowStructuredJsonPropertyJson>;
|
|
120
|
+
readonly required?: string[];
|
|
121
|
+
readonly type: "object";
|
|
122
|
+
readonly additionalProperties: boolean;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export type AgenticWorkflowStructuredJsonPropertyJson = AgenticWorkflowJsonObject
|
|
126
|
+
& {
|
|
127
|
+
readonly description?: string;
|
|
128
|
+
readonly enum?: string[];
|
|
129
|
+
readonly items?: AgenticWorkflowStructuredJsonPropertyJson;
|
|
130
|
+
readonly properties?: Record<string, AgenticWorkflowStructuredJsonPropertyJson>;
|
|
131
|
+
readonly required?: string[];
|
|
132
|
+
readonly type: "array" | "boolean" | "number" | "object" | "string";
|
|
133
|
+
readonly additionalProperties?: boolean;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export type AgenticWorkflowToolJson = AgenticWorkflowArcgisToolJson | AgenticWorkflowMcpToolJson;
|
|
137
|
+
|
|
138
|
+
export type AgenticWorkflowMcpToolJson = AgenticWorkflowJsonObject
|
|
139
|
+
& {
|
|
140
|
+
readonly allowed_tools?: string[];
|
|
141
|
+
readonly args?: string[];
|
|
142
|
+
readonly auth?: AgenticWorkflowMcpToolAuthAPIKeyJson | AgenticWorkflowMcpToolAuthBearerJson | AgenticWorkflowMcpToolAuthOAuth2Json;
|
|
143
|
+
readonly command?: string;
|
|
144
|
+
readonly env?: Record<string, string>;
|
|
145
|
+
readonly label?: string;
|
|
146
|
+
readonly override_params?: AgenticWorkflowUpdateVariableJson[];
|
|
147
|
+
readonly require_approval: AgenticWorkflowApprovalRequirementJson;
|
|
148
|
+
readonly return_direct?: boolean;
|
|
149
|
+
readonly server_description?: string;
|
|
150
|
+
readonly server_label?: string;
|
|
151
|
+
readonly server_url?: string;
|
|
152
|
+
readonly type: "mcp";
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type AgenticWorkflowApprovalRequirementJson = "always" | "never";
|
|
156
|
+
|
|
157
|
+
export type AgenticWorkflowUpdateVariableJson = AgenticWorkflowJsonObject
|
|
158
|
+
& {
|
|
159
|
+
readonly key: string;
|
|
160
|
+
readonly value: AgenticWorkflowExpressionValueJson;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type AgenticWorkflowExpressionValueJson = AgenticWorkflowJsonObject
|
|
164
|
+
& {
|
|
165
|
+
readonly return_type?: "array" | "boolean" | "number" | "object" | "string" | "unknown";
|
|
166
|
+
readonly type: "constant" | "variable";
|
|
167
|
+
readonly value: boolean | number | string;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export type AgenticWorkflowMcpToolAuthBearerJson = {
|
|
171
|
+
mode: string;
|
|
172
|
+
header_name?: string;
|
|
173
|
+
scheme?: string;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export type AgenticWorkflowMcpToolAuthAPIKeyJson = {
|
|
177
|
+
mode: string;
|
|
178
|
+
header_name?: string;
|
|
179
|
+
prefix?: string;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export type AgenticWorkflowMcpToolAuthOAuth2Json = {
|
|
183
|
+
mode: string;
|
|
184
|
+
discovery?: string;
|
|
185
|
+
client_id?: string;
|
|
186
|
+
authorization_url?: string;
|
|
187
|
+
token_url?: string;
|
|
188
|
+
refresh_url?: string;
|
|
189
|
+
redirect_url?: string;
|
|
190
|
+
scope?: string;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export type AgenticWorkflowJsonPrimitive = boolean | number | string | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
import type { ArcgisTool } from "./tools/ArcgisTool.js";
|
|
7
|
+
|
|
8
|
+
/** @internal */
|
|
9
|
+
export class AgentNode extends BaseNode {
|
|
10
|
+
/** @param json */
|
|
11
|
+
static fromJSON(json: AgenticWorkflowAgentNodeJson): AgentNode;
|
|
12
|
+
constructor(properties?: AgentNodeConstructProperties);
|
|
13
|
+
accessor outputSchema: ZodObjectSchema<AgentData> | undefined;
|
|
14
|
+
accessor prompt: Prompt | undefined;
|
|
15
|
+
accessor tools: ArcgisTool[] | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The type of this node, which identifies it as an agent node within the workflow.
|
|
18
|
+
*
|
|
19
|
+
* @default "agent-node"
|
|
20
|
+
* @required
|
|
21
|
+
*/
|
|
22
|
+
accessor type: "agent-node";
|
|
23
|
+
/** @param context */
|
|
24
|
+
compile<TCustomState extends AgentData>(context: NodeCompilationContext): NodeCompilation<TCustomState>;
|
|
25
|
+
createRuntimeNode<TCustomState extends AgentData>(): RuntimeNode<TCustomState>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
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,21 @@
|
|
|
1
|
+
import type Accessor from "@arcgis/core/core/Accessor.js";
|
|
2
|
+
import type { AgenticWorkflowArcgisToolJson } from "../../jsonTypes.js";
|
|
3
|
+
import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Portal configuration for ArcGIS tools.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export class ArcgisTool extends Accessor {
|
|
11
|
+
/** @param json */
|
|
12
|
+
static fromJSON(json: AgenticWorkflowArcgisToolJson): ArcgisTool;
|
|
13
|
+
constructor(properties?: ArcgisToolConstructProperties);
|
|
14
|
+
accessor name: string | undefined;
|
|
15
|
+
accessor requireApproval: "always" | "never" | undefined;
|
|
16
|
+
/** @default "arcgis-tool" */
|
|
17
|
+
accessor type: "arcgis-tool";
|
|
18
|
+
createRuntimeTools(): Promise<StructuredToolInterface[]>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type ArcgisToolConstructProperties = Pick<ArcgisTool, "name" | "requireApproval">;
|
|
@@ -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
|
+
};
|
|
@@ -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"./3LXXSMA5.js";import"./M3MRIGDZ.js";import b from"./6QJFOL6M.js";import{a as R,b as F,e as W}from"./UZL6UVE4.js";import a from"./ZJEWP2ND.js";import{e as q}from"./HO2YDJI2.js";import{v as P,z as I}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./S3XUYAUX.js";import"./WZFC5HUX.js";import{W as C,ia as v}from"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import{Dd as c}from"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([z,U,{property:n,subclass:l},O,N,,,,,,,L,$])=>{var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,y=(t,e,o,s)=>{for(var r=s>1?void 0:s?Y(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&X(e,o,r),r},p=class extends N{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})}};y([n()],p.prototype,"id",2);y([n()],p.prototype,"sourceAnchorId",2);y([n()],p.prototype,"sourceNodeId",2);y([n()],p.prototype,"targetAnchorId",2);y([n()],p.prototype,"targetNodeId",2);p=y([l("Edge")],p);var tt=Object.defineProperty,et=Object.getOwnPropertyDescriptor,S=(t,e,o,s)=>{for(var r=s>1?void 0:s?et(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&tt(e,o,r),r},m=class extends N{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.")}};S([n()],m.prototype,"id",2);S([n()],m.prototype,"label",2);S([n()],m.prototype,"type",2);m=S([l("BaseNode")],m);var rt=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,E=(t,e,o,s)=>{for(var r=s>1?void 0:s?ot(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&rt(e,o,r),r},d=class extends N{constructor(t){super(t),this.messages=[]}static fromJSON(t){let e=d._normalizeMessages(t.messages);return new d({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"})):[]}};E([n()],d.prototype,"id",2);E([n()],d.prototype,"messages",2);d=E([l("Prompt")],d);function G(t){let e=new Set(t.required),o=Object.fromEntries(Object.entries(t.properties).map(([s,r])=>{let a=B(r);return[s,e.has(s)?a:a.optional()]}));return c.object(o)}function B(t){let e;switch(t.type){case"array":e=c.array(t.items?B(t.items):c.unknown());break;case"boolean":e=c.boolean();break;case"number":e=c.number();break;case"object":e=G({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 st=new Map([["clear_filters",async()=>(await import("./DKLK4EUE.js")).clearFiltersTool],["reset_map",async()=>(await import("./N735LT4S.js")).resetMapTool],["set_feature_effect",async()=>(await import("./E7JLG2A2.js").then(m=>m.default.then(e=>({setFeatureEffectTool:e})))).setFeatureEffectTool],["list_layer_fields",async()=>(await import("./6FKLWNGA.js")).listLayerFieldsTool],["go_to_address",async()=>(await import("./3XXZUQMQ.js").then(m=>m.default.then(e=>({goToAddressTool:e})))).goToAddressTool],["go_to_bookmark",async()=>(await import("./6SGNSDLY.js")).goToBookmarkTool],["go_to_features",async()=>(await import("./6RDKDLSX.js")).goToFeaturesTool],["go_to_full_extent",async()=>(await import("./7747YL7V.js").then(m=>m.default.then(e=>({goToFullExtentTool:e})))).goToFullExtentTool],["go_to_home_extent",async()=>(await import("./E62P76TP.js")).goToHomeExtentTool],["go_to_layer",async()=>(await import("./5Y6TQAJN.js")).goToLayerTool],["go_to_scale",async()=>(await import("./VXBUMZYR.js")).goToScaleTool],["go_to_viewpoint",async()=>(await import("./JH6EAWB2.js").then(m=>m.default.then(e=>({goToViewpointTool:e})))).goToViewpointTool],["go_to_zoom",async()=>(await import("./JXB4TNSG.js")).goToZoomTool],["get_attribute",async()=>(await import("./VBZ5XGAM.js").then(m=>m.default.then(e=>({getAttributeTool:e})))).getAttributeTool],["get_statistics",async()=>(await import("./H6JSNAT4.js").then(m=>m.default.then(e=>({getStatisticsTool:e})))).getStatisticsTool],["get_top_features",async()=>(await import("./NTZAOJH5.js").then(m=>m.default.then(e=>({getTopFeaturesTool:e})))).getTopFeaturesTool],["query_features",async()=>(await import("./NP7DG7LQ.js").then(m=>m.default.then(e=>({queryFeaturesTool:e})))).queryFeaturesTool]]);async function at(t){let e=st.get(t);if(!e)throw new Error(`ArcGIS tool is not supported in the browser runtime: ${t}`);return await e()}var it=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,T=(t,e,o,s)=>{for(var r=s>1?void 0:s?nt(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&it(e,o,r),r},g=class extends N{constructor(t){super(t),this.type="arcgis-tool"}async createRuntimeTools(){if(!this.name)throw new Error("ArcgisTool name is required");return[await at(this.name)]}static fromJSON(t){return new g({name:t.name,requireApproval:t.require_approval})}};T([n()],g.prototype,"name",2);T([n()],g.prototype,"requireApproval",2);T([n()],g.prototype,"type",2);g=T([l("ArcgisTool")],g);var ct=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,H=t=>{throw TypeError(t)},b=(t,e,o,s)=>{for(var r=s>1?void 0:s?pt(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&ct(e,o,r),r},mt=(t,e,o)=>e.has(t)||H("Cannot "+o),dt=(t,e,o)=>e.has(t)?H("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,o),ut=(t,e,o)=>(mt(t,e,"access private method"),o),j,V,u=class extends m{constructor(t){super(t),dt(this,j),this.type="agent-node"}createRuntimeNode(){let t;return async(e,o)=>{t??=ut(this,j,V).call(this);let s=await(await t).run(e,o),r=this.outputSchema?.safeParse(s);if(r&&!r.success)throw r.error;let a=r?.data,i=a??s.outputMessage;return{agentExecutionContext:s.agentExecutionContext,...a?{}:{outputMessage:s.outputMessage},status:s.status,summary:s.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=d.fromJSON({id:`prompt_${t.id}`,type:"plain_text",messages:[{content:t.prompt,role:"system"}]}):e.prompt=d.fromJSON(t.prompt)),t.structured_output&&(e.outputSchema=G(t.structured_output)),e.tools=t.tools?.filter(o=>o.type==="arcgis_tool").map(o=>g.fromJSON(o)),e}};j=new WeakSet;V=async function(){let t=this.prompt?.messages?.[0].content;if(!t?.trim())throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);let e=[];if(this.tools)for(let o of this.tools){let s=await o.createRuntimeTools();e.push(...s)}return new $({name:this.id,outputSchema:this.outputSchema,prompt:t,tools:e})};b([n()],u.prototype,"type",2);b([n()],u.prototype,"prompt",2);b([n()],u.prototype,"outputSchema",2);b([n()],u.prototype,"tools",2);u=b([l("AgentNode")],u);var lt=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,k=(t,e,o,s)=>{for(var r=s>1?void 0:s?gt(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&<(e,o,r),r},h=class extends m{constructor(t){super(t),this.type="end-message-node"}createRuntimeNode(){return async t=>{let e=await C.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 h({id:t.id,label:t.label,type:"end-message-node"});return e.message=t.message,e}};k([n()],h.prototype,"type",2);k([n()],h.prototype,"message",2);h=k([l("EndMessageNode")],h);var ht=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,Z=(t,e,o,s)=>{for(var r=s>1?void 0:s?ft(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&ht(e,o,r),r},w=class extends m{constructor(t){super(t),this.type="start-node"}createRuntimeNode(){return t=>({question:t.agentExecutionContext.userRequest})}static fromJSON(t){return new w({id:t.id,label:t.label,type:"start-node"})}};Z([n()],w.prototype,"type",2);w=Z([l("StartNode")],w);function yt(t){switch(t.type){case"agent_node":return u.fromJSON(t);case"end_message_node":return h.fromJSON(t);case"start_node":return w.fromJSON(t);default:throw new Error(`WebAgent node "${t.id}" uses unsupported type "${t.type}".`)}}function wt(t={}){let e=Object.keys(t);if(R(e),e.includes("nodes"))throw new Error("node state cannot define reserved field: nodes.");let o=F(t);return v.Root({...o,nodes:v({reducer:(s,r)=>({...s,...r}),default:()=>({})}),...q()})}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 wt(o)}var A=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=>yt(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(a=>[r.id,a])??[]}));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(i=>i.type==="start-node")?.id,r={},a=[];for(let[i,Q]of this.nodes.entries()){let _=e[i];_&&(_.runtimeNode&&(r[Q.id]=_.runtimeNode),a.push(..._.edges))}return{createGraph:()=>W(r,a,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)}))}},bt=Object.defineProperty,_t=Object.getOwnPropertyDescriptor,x=(t,e,o,s)=>{for(var r=s>1?void 0:s?_t(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&bt(e,o,r),r},Ot=()=>{throw new Error("WebAgent must be loaded before it can run.")},f=class extends L{constructor(t){super(t)}async load(){if(this.portalItem){try{await this.portalItem.load()}catch(o){throw new O("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 O("web-agent:missing-title","The portal item is missing a title")}if(!this.sourceJSON)throw new O("web-agent:missing-source-json","The source JSON is missing");if(!this.sourceJSON.description)throw new O("web-agent:missing-description","The source JSON is missing a description");let t=A.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",Ot);return}let{createGraph:t,workspace:e}=this._runtime.generate();this._set("workspace",e),this._set("createGraph",t)}};x([n({type:z})],f.prototype,"portalItem",2);x([n()],f.prototype,"sourceJSON",2);f=x([l("WebAgent")],f);var J=class extends P{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 f({portalItem:new z({id:this.itemId,portal:o})})}else this.workflow&&(e=new f({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()}};I("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
|
+
var n=(r,e,a)=>{if(!(a?r.hasAllFeaturesInView:r.hasAllFeatures))return!1;let l=new Set((r.availableFields??[]).map(t=>t.toLowerCase()));return l.has("*")?!0:e.every(t=>l.has(t.toLowerCase()))};function s(r,e){let a=r??"";return e!=null&&e&&(a=a?`(${a}) AND (${e})`:e),a||null}export{n as a,s as b};
|
|
@@ -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=(t,s,e,r)=>{for(var o=r>1?void 0:r?x(s,e):s,n=t.length-1,p;n>=0;n--)(p=t[n])&&(o=(r?p(s,e,o):p(o))||o);return r&&o&&k(s,e,o),o},i=class extends w{constructor(t){super(t),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 t=f(this.getSchemas());this._set("workspace",t);let s=this.id,e={[s]:this._invoke.bind(this)},r=[{from:s,decide:()=>{}}];this._set("createGraph",()=>y(e,r,t,{agent:this,entryNode:s,middlewares:this.middlewares}))}async _invoke(t,s){try{return this.outputSchema?await this._invokeStructured(t,s):await this._invokeUnstructured(t,s)}catch(e){if(l(e))throw e;let r=e instanceof Error?e.message:String(e);return d({outputMessage:r},"failed",r)}}async _invokeStructured(t,s){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let e=await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:t.agentExecutionContext.messages},s);if(!("structuredResponse"in e)||e.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(e.structuredResponse,this.outputSchema,e.messages)}async _invokeUnstructured(t,s){let e=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares)}).invoke({messages:t.agentExecutionContext.messages},s)).messages,r=e.at(-1)?.content??"",o=typeof r=="string"?r:JSON.stringify(r),n=o.trim()||"LLMAgent completed.";return d({agentExecutionContext:{...t.agentExecutionContext,messages:e},outputMessage:o},"success",n)}async _getPromptWithInputVariables(t){let s=v(t,this.inputSchema);for(let{outputKey:e}of this.middlewares)e&&(s[String(e)]=t[e]);return await g.fromTemplate(this.prompt).format(s)}_getTools(){return this.tools?.map(t=>"getTool"in t?t.getTool():t)??[]}};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{a as c}from"./ONQ6JSBJ.js";import{Bc as i}from"./LUY6V4TP.js";import{a as r}from"./VXFQANGJ.js";export default $arcgis.t(([a,p,u,{addressToLocations:w},S])=>{async function v(e,t){let s=u.getDefault().helperServices,n=s.geocode.find(g=>g.name==="ArcGIS World Geocoding Service")??s.geocode[0];if(!n)throw new Error("No geocoding service found in helperServices.");let d=n.url,l=`${a.assetsPath?.endsWith("/")?a.assetsPath:`${a.assetsPath}/`}esri/images/search/search-symbol-32.png`,o=(await w(d,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!o?.extent||!o.location)throw new Error(`Could not find location for: ${e}`);let m=new S({url:l,width:24,height:24}),h=new p({geometry:o.location,symbol:m});t.graphics.removeAll(),t.graphics.add(h),await t.goTo(o.extent);let f={address:o.address??"",location:o.location?o.location.toJSON():null,extent:o.extent?o.extent.toJSON():null};return{text:`Successfully zoomed to ${e}.`,sharedStatePatch:{lastResolvedLocation:{value:f}}}}async function x({address:e},t){let{mapView:s}=c(t,["mapView"]);return await v(e,s)}var y=r.object({address:r.string().describe("The full address or place name to locate.")}),N=i(x,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:y});return N},"config","Graphic","portal/Portal","rest/locator","symbols/PictureMarkerSymbol")
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as o}from"./FDOMMK2M.js";import{Bc as a}from"./LUY6V4TP.js";import{a as r}from"./VXFQANGJ.js";var f=(l,i)=>{let t=Array.from(l.values()).find(({layerItem:e})=>e.title?.toLowerCase().includes(i.toLowerCase()));if(!t){let e=Array.from(l.values()).map(y=>y.layerItem.title).join(", ");return`Could not find a layer matching "${i}". Available layers: ${e}`}let s=Array.from(t.fieldRegistry.values()),n=s.map(e=>`- **${e.alias||e.name}** (\`${e.name}\`, ${e.type})${e.description?`: ${e.description}`:""}`).join(`
|
|
3
|
+
`);return`**${t.layerItem.title}** has ${s.length} field(s):
|
|
4
|
+
|
|
5
|
+
${n}`},m=({layerTitle:l},i)=>{let t=o(i,"layersAndFieldsRegistry");return f(t,l)},u=a(m,{name:"listLayerFields",description:"Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",schema:r.object({layerTitle:r.string().describe("The title or partial title of the layer to list fields for.")})});export{u as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as s}from"./ONQ6JSBJ.js";import{Bc as o}from"./LUY6V4TP.js";import{a as i}from"./VXFQANGJ.js";var n=async t=>{t.map?.allLayers.filter(e=>e.type==="feature")?.forEach(e=>{let r=e;r.featureEffect&&(r.featureEffect=null)});let a=t.map.initialViewProperties?.viewpoint?.targetGeometry;return a?(await t.goTo(a),"Cleared all filters and returned to home extent."):"Cleared all filters. Could not determine home extent."},l=async(t,a)=>{let{mapView:e}=s(a,["mapView"]);return await n(e)},c=o(l,{name:"resetMap",description:"Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",schema:i.object({})});export{c as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import v from"./527C4GD2.js";import t from"./KRN6AFNB.js";import s from"./C4FKFOU4.js";import r from"./67YCNNCN.js";import q from"./OHMNQ3RU.js";import p from"./3ZPPYCNL.js";import o from"./RU5DVLYG.js";import n from"./HNMFFLSY.js";import"./RATZTLNX.js";import m from"./W5FLNFSN.js";import l from"./W5J4Q3RO.js";import k from"./MKJS7QYQ.js";import j from"./ITBQGOMF.js";import i from"./CCC6LBMY.js";import"./34O57OGV.js";import"./3U476GCP.js";import"./FDOMMK2M.js";import f from"./3MJQA533.js";import"./E25RINU2.js";import"./SABZC4D4.js";import e from"./GG3AESSV.js";import"./KZACIY2W.js";import"./XGBEHER5.js";import"./JWPB3XZM.js";import d from"./I4L45WQS.js";import c from"./ZJEWP2ND.js";import{e as g,f as h}from"./HO2YDJI2.js";import"./7TO56JHS.js";import"./4YDXYW4J.js";import b from"./YGCTAIBS.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./R74ZHFA6.js";import{a as u,b as y}from"./HJG7QM2R.js";import"./WZFC5HUX.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([C,I,,,{d:w,g:v,h:A,i:b,j:S,k:d,l:p,m:M,n:E,o:P,p:T,q:x,r:D},{a:f,b:V},,,,,,,,,,,L,k,W,R,O])=>{var U=async e=>{let a=e.allLayers.toArray(),s=[],o=new Map;for(let t of a)if(t instanceof C){let i=(async()=>{let n=await x(t),r=await D(t,n);o.set(t.id,{layerItem:r,fieldRegistry:n})})();s.push(i)}return await Promise.all(s),o},q=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:s}=await z(a),o={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:b,model:S,dimensions:A,templates:{layer:d,field:p}},layers:s},t=M.safeParse(o);if(!t.success)throw console.error("Schema Mismatch:",t.error.format()),new Error("Webmap embedding generation failed validation.");return t.data},z=async e=>{let a=[],s=[];for(let[i,{fieldRegistry:n,layerItem:r}]of e.entries()){let l=H(d,{name:r.name,title:r.title,description:r.description});a.push(l);let m={id:i,name:r.name??"",title:r.title,description:r.description,vector:[],fields:[]};for(let[,c]of n.entries()){let N=H(p,{name:c.name,alias:c.alias,description:c.description});a.push(N),m.fields.push({name:c.name,alias:c.alias,description:c.description,vector:[]})}s.push(m)}let o=await f(a),t=0;return{layers:s.map(i=>(i.vector=o[t++],i.fields.forEach(n=>{n.vector=o[t++]}),i))}},H=(e,a)=>e.replace(/\{(\w+)\}/gu,(s,o)=>a[o]??""),F=(e,a)=>{if(e.length!==a.length)throw new Error("Vectors must be the same length");let s=0,o=0,t=0;for(let r=0;r<e.length;++r){let l=e[r],m=a[r];s+=l*m,o+=l*l,t+=m*m}let i=Math.sqrt(o*t);if(i===0)return 0;let n=s/i;return Math.max(-1,Math.min(1,n))},ee=E,ae=P,te=T,se=u,re=f,oe=F,ie=O,ne=L,me=R,ce=W,le=k,de=q,pe=()=>g(),fe=()=>h(),ge=async(e,a)=>await y(e,a),he=async({modelTier:e="default",temperature:a=0,config:s}={})=>await w({modelTier:e,temperature:a,config:s});return{ArcgisKnowledgeAgent:le,DataExplorationAgent:me,HelpAgent:ce,LayerStylingAgent:ne,NavigationAgent:ie,Orchestrator:V,cosineSimilarity:oe,createAgentRuntimeState:pe,createAgentRuntimeStateWithSharedState:fe,createChatModel:he,createWebmapEmbeddings:de,getEmbeddings:re,invokeStructuredPrompt:ae,invokeTextPrompt:ee,invokeToolPrompt:te,sendTraceMessage:se,sendUXSuggestion:ge}},"layers/FeatureLayer","core/reactiveUtils",a,b,c,d,e,f,i,j,k,l,m,n,o,p,q,r,s,t,v)
|