@arcgis/ai-components 5.2.0-next.4 → 5.2.0-next.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-utils/FunctionAgent.d.ts +2 -2
- package/dist/agent-utils/LLMAgent.d.ts +2 -2
- package/dist/agent-utils/LLMAgent.js +23 -22
- package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
- package/dist/agent-utils/index.d.ts +177 -0
- package/dist/agent-utils/index.js +167 -0
- package/dist/agent-utils/middlewares/trace.d.ts +2 -0
- package/dist/agent-utils/middlewares/trace.js +25 -33
- package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
- package/dist/agent-utils/types.d.ts +36 -7
- package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
- package/dist/cdn/37Q23IS4.js +2 -0
- package/dist/cdn/3OH4DXSY.js +2 -0
- package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
- package/dist/cdn/3Y5INO72.js +3 -0
- package/dist/cdn/434TAA3J.js +2 -0
- package/dist/cdn/4G5XCUE5.js +2 -0
- package/dist/cdn/5SW5CPQT.js +3 -0
- package/dist/cdn/5VTVHDQ5.js +2 -0
- package/dist/cdn/6G5DYYYU.js +2 -0
- package/dist/cdn/6JX2ACRF.js +2 -0
- package/dist/cdn/7YIRK2E3.js +2 -0
- package/dist/cdn/A4JLOAOH.js +2 -0
- package/dist/cdn/AFKLWPPM.js +2 -0
- package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
- package/dist/cdn/APFZY4PI.js +2 -0
- package/dist/cdn/B7YAMTIH.js +3 -0
- package/dist/cdn/BF2IYMM6.js +2 -0
- package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
- package/dist/cdn/BMGQJYTE.js +2 -0
- package/dist/cdn/BNJFXDJV.js +2 -0
- package/dist/cdn/BST5ZU46.js +2 -0
- package/dist/cdn/C7DSVDSP.js +6 -0
- package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
- package/dist/cdn/D664PQPF.js +2 -0
- package/dist/cdn/DMLRWHBA.js +2 -0
- package/dist/cdn/E54QF5FR.js +2 -0
- package/dist/cdn/EIPHHMWX.js +180 -0
- package/dist/cdn/F3VYFN2Q.js +2 -0
- package/dist/cdn/F5SUU35Z.js +2 -0
- package/dist/cdn/FNBXR5WD.js +2 -0
- package/dist/cdn/FQ5XLE4I.js +2 -0
- package/dist/cdn/FY7YTXS4.js +2 -0
- package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
- package/dist/cdn/GPVY5GM6.js +14 -0
- package/dist/cdn/{H7422XUG.js → GYVSHAUI.js} +1 -1
- package/dist/cdn/HBUW4KGU.js +36 -0
- package/dist/cdn/HJG7QM2R.js +9 -0
- package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
- package/dist/cdn/IHP25JWI.js +99 -0
- package/dist/cdn/J6A4AS7E.js +22 -0
- package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
- package/dist/cdn/JEL5M7FA.js +2 -0
- package/dist/cdn/JMODFBN6.js +48 -0
- package/dist/cdn/JVYPIWEU.js +2 -0
- package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
- package/dist/cdn/LUY6V4TP.js +181 -0
- package/dist/cdn/M2DEBF5S.js +2 -0
- package/dist/cdn/M3MRIGDZ.js +2 -0
- package/dist/cdn/MHMBHWYX.js +2 -0
- package/dist/cdn/MMRRNKWJ.js +2 -0
- package/dist/cdn/MS5EA2KY.js +2 -0
- package/dist/cdn/MWYBF3F3.js +66 -0
- package/dist/cdn/NAKAZDJ7.js +4 -0
- package/dist/cdn/NEV6OZN3.js +71 -0
- package/dist/cdn/OGMMYFHR.js +2 -0
- package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
- package/dist/cdn/OYNIFMCJ.js +2 -0
- package/dist/cdn/PBTINZTK.js +65 -0
- package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
- package/dist/cdn/PRN4OPLW.js +2 -0
- package/dist/cdn/R74ZHFA6.js +2 -0
- package/dist/cdn/RLEHNAIA.js +2 -0
- package/dist/cdn/SBP6WNDY.js +2 -0
- package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
- package/dist/cdn/SJR4IR57.js +2 -0
- package/dist/cdn/SKXDXIQO.js +22 -0
- package/dist/cdn/SPVOBZAL.js +2 -0
- package/dist/cdn/SYEI4BB2.js +56 -0
- package/dist/cdn/TI7K3I3K.js +18 -0
- package/dist/cdn/TPULIO6I.js +34 -0
- package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
- package/dist/cdn/UK7PR2FE.js +2 -0
- package/dist/cdn/UZLQALHY.js +2 -0
- package/dist/cdn/V6HOUZPZ.js +2 -0
- package/dist/cdn/VAXH6RUQ.js +134 -0
- package/dist/cdn/VXFQANGJ.js +2 -0
- package/dist/cdn/WSGWTIAV.js +9 -0
- package/dist/cdn/{4HU7735A.js → XFL2VQFM.js} +6 -4
- package/dist/cdn/XNWCRFTJ.js +2 -0
- package/dist/cdn/YYSMCB4A.js +2 -0
- package/dist/cdn/ZB57WYHC.js +2 -0
- package/dist/cdn/ZQ7PGNWB.js +208 -0
- package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
- package/dist/cdn/agent-utils/index.js +2 -0
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
- package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
- package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/adapter.js +1794 -1597
- package/dist/chunks/arcgisKnowledgeGraph.js +126 -71
- package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
- package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
- package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
- package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
- package/dist/chunks/converterUtils.js +39 -32
- package/dist/chunks/dataExplorationGraph.js +139 -113
- package/dist/chunks/data_explore_query_prompt.js +9 -4
- package/dist/chunks/generateLayerDescriptions.js +231 -191
- package/dist/chunks/helpGraph.js +17 -13
- package/dist/chunks/help_prompt.js +34 -17
- package/dist/chunks/index.js +11 -0
- package/dist/chunks/intent_prompt.js +16 -0
- package/dist/chunks/layerStylingGraph.js +24 -20
- package/dist/chunks/navigationGraph.js +33 -28
- package/dist/chunks/navigation_intent_prompt.js +8 -2
- package/dist/chunks/orchestrator.js +267 -226
- package/dist/chunks/slottableRequestUtils.js +3 -7
- package/dist/chunks/state.js +1 -1
- package/dist/chunks/summarize_query_response_prompt.js +9 -7
- package/dist/chunks/toolCallResponse.js +12 -9
- package/dist/chunks/utils2.js +8 -8
- package/dist/components/arcgis-assistant/customElement.d.ts +27 -0
- package/dist/components/arcgis-assistant/customElement.js +385 -152
- package/dist/components/arcgis-assistant/index.js +2 -3
- package/dist/components/arcgis-assistant/types.d.ts +14 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +5 -1
- package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
- package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
- package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +11 -5
- package/dist/components/arcgis-assistant-help-agent/customElement.js +8 -2
- package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-interrupt/customElement.js +12 -8
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
- package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +17 -11
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +10 -4
- package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
- package/dist/components/arcgis-assistant-message/customElement.js +28 -26
- package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
- package/dist/components/arcgis-assistant-message/index.js +2 -0
- package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
- package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
- package/dist/components/arcgis-assistant-message-block/index.js +1 -0
- package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
- package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
- package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
- package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-text/customElement.d.ts +5 -1
- package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +11 -5
- package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
- package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-user-message/customElement.js +10 -8
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/loader.js +7 -6
- package/dist/types/lumina.d.ts +11 -5
- package/dist/types/preact.d.ts +12 -5
- package/dist/types/react.d.ts +13 -5
- package/dist/types/stencil.d.ts +11 -5
- package/dist/utils/index.d.ts +85 -42
- package/dist/utils/index.js +54 -49
- package/package.json +13 -12
- package/dist/cdn/2AXF774U.js +0 -2
- package/dist/cdn/3PKJWIC3.js +0 -2
- package/dist/cdn/462JBSEV.js +0 -422
- package/dist/cdn/5QAHYX7Y.js +0 -5
- package/dist/cdn/7BCR6TUO.js +0 -2
- package/dist/cdn/7GH7VSB2.js +0 -2
- package/dist/cdn/7PLV4QH6.js +0 -2
- package/dist/cdn/AO7BQHKC.js +0 -2
- package/dist/cdn/AXDZBBNL.js +0 -45
- package/dist/cdn/DDLZOMUY.js +0 -2
- package/dist/cdn/DHOVCT6R.js +0 -2
- package/dist/cdn/F2AHA4GB.js +0 -54
- package/dist/cdn/FHVXO2WG.js +0 -166
- package/dist/cdn/FX5JFRDL.js +0 -2
- package/dist/cdn/GSEPHN3A.js +0 -106
- package/dist/cdn/HB5A5R2E.js +0 -2
- package/dist/cdn/JY6LLOUJ.js +0 -22
- package/dist/cdn/KMQ3SP4I.js +0 -5
- package/dist/cdn/MDVYQQUG.js +0 -14
- package/dist/cdn/MH5RPXHM.js +0 -2
- package/dist/cdn/NAUXSHIE.js +0 -72
- package/dist/cdn/NVI3I46B.js +0 -2
- package/dist/cdn/OAVEHGB6.js +0 -2
- package/dist/cdn/OH64RMOR.js +0 -4
- package/dist/cdn/ON2V5XI2.js +0 -3
- package/dist/cdn/P6OPJQMC.js +0 -3
- package/dist/cdn/QR54T33D.js +0 -2
- package/dist/cdn/RVOAPUBN.js +0 -2
- package/dist/cdn/S6W6HV4T.js +0 -36
- package/dist/cdn/SXDLXCIM.js +0 -2
- package/dist/cdn/USMDJUFS.js +0 -2
- package/dist/cdn/V2P4AIGG.js +0 -2
- package/dist/cdn/V5YEZSRY.js +0 -16
- package/dist/cdn/Y333DGV6.js +0 -2
- package/dist/cdn/YIMNOUTF.js +0 -2
- package/dist/cdn/YY2SBO3V.js +0 -2
|
@@ -3,13 +3,43 @@ import type { BaseChannel, BinaryOperatorAggregate } from "@langchain/langgraph/
|
|
|
3
3
|
import type { AnnotationRoot, StateDefinitionInit, StateGraph } from "@langchain/langgraph/web";
|
|
4
4
|
import type { AgentExecutionContext, AgentRegistration, AgentStatus } from "../utils/index.js";
|
|
5
5
|
|
|
6
|
-
/** @internal */
|
|
7
6
|
export type AgentData = Record<string, unknown>;
|
|
8
7
|
|
|
9
|
-
/** @internal */
|
|
10
8
|
export type EmptyAgentData = Record<never, never>;
|
|
11
9
|
|
|
12
|
-
/** @
|
|
10
|
+
/** @internal */
|
|
11
|
+
export type ZodModule = {
|
|
12
|
+
z: typeof z;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type SchemaPrimitiveFieldType = "boolean" | "number" | "string";
|
|
16
|
+
|
|
17
|
+
export type SchemaArrayItemDefinition = SchemaFieldDefinition | SchemaPrimitiveFieldType;
|
|
18
|
+
|
|
19
|
+
export type SchemaFieldDefinition = ({
|
|
20
|
+
type: "array";
|
|
21
|
+
itemType: SchemaArrayItemDefinition;
|
|
22
|
+
} | { type: "boolean" | "number"; } | {
|
|
23
|
+
type: "object";
|
|
24
|
+
fields: SchemaDefinition;
|
|
25
|
+
} | {
|
|
26
|
+
type: "string";
|
|
27
|
+
enum?: readonly string[];
|
|
28
|
+
}) & {
|
|
29
|
+
description?: string;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type SchemaDefinition = Record<string, SchemaFieldDefinition>;
|
|
34
|
+
|
|
35
|
+
export type SchemaDefinitionData<TDefinition extends SchemaDefinition> = {
|
|
36
|
+
[K in keyof TDefinition as TDefinition[K] extends { required: true; } ? K : never]: SchemaFieldData<TDefinition[K]>;
|
|
37
|
+
} &
|
|
38
|
+
{
|
|
39
|
+
[K in keyof TDefinition as TDefinition[K] extends { required: true; } ? never : K]?: SchemaFieldData<TDefinition[K]>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** @privateRemark All agents are orchestrator-driven, so these channels exist for every agent graph. */
|
|
13
43
|
export type AgentRuntimeState = {
|
|
14
44
|
agentExecutionContext: AgentExecutionContext;
|
|
15
45
|
/** The outputMessage is a string representing the output of an agent execution. */
|
|
@@ -101,7 +131,6 @@ export type AgentNodeUpdate<TInput extends AgentData, TOutput extends AgentData>
|
|
|
101
131
|
* AgentStateAnnotation defines the shape of the agent state used in LangGraph nodes, including both the built-in runtime channels
|
|
102
132
|
* and any custom fields defined by the agent.
|
|
103
133
|
*
|
|
104
|
-
* @internal
|
|
105
134
|
* @since 5.1
|
|
106
135
|
*/
|
|
107
136
|
export type AgentStateAnnotation<TState extends AgentData> = AnnotationRoot<{
|
|
@@ -123,7 +152,6 @@ export type RunnableUpdate<TState extends AgentData> = Partial<TState> extends o
|
|
|
123
152
|
/**
|
|
124
153
|
* Internal type representing the compiled graph used for agent execution.
|
|
125
154
|
*
|
|
126
|
-
* @internal
|
|
127
155
|
* @since 5.1
|
|
128
156
|
*/
|
|
129
157
|
export type TypedStateGraph<TState extends AgentData> = StateGraph<StateDefinitionInit, AgentGraphState<TState>, RunnableUpdate<AgentGraphState<TState>>, string>;
|
|
@@ -132,7 +160,6 @@ export type TypedStateGraph<TState extends AgentData> = StateGraph<StateDefiniti
|
|
|
132
160
|
* The shape of the `createGraph` function used by agents to generate their internal graph representation.
|
|
133
161
|
* This function is responsible for defining the nodes and edges of the graph, as well as any associated state and middleware.
|
|
134
162
|
*
|
|
135
|
-
* @internal
|
|
136
163
|
* @since 5.1
|
|
137
164
|
*/
|
|
138
165
|
export type AgentCreateGraph<TState extends AgentData> = () => TypedStateGraph<TState>;
|
|
@@ -149,4 +176,6 @@ export type GraphEdge<S extends AgentData> = {
|
|
|
149
176
|
} | {
|
|
150
177
|
from: string;
|
|
151
178
|
to: string;
|
|
152
|
-
};
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export type SchemaFieldData<TField extends SchemaFieldDefinition> = TField extends { type: "string"; } ? TField["enum"] extends readonly (infer TValue extends string)[] ? TValue : string : TField extends { type: "array"; } ? (TField["itemType"] extends "string" ? string : TField["itemType"] extends "number" ? number : TField["itemType"] extends "boolean" ? boolean : TField["itemType"] extends SchemaFieldDefinition ? SchemaFieldData<TField["itemType"]> : never)[] : TField extends { type: "object"; } ? SchemaDefinitionData<TField["fields"]> : TField extends { type: "number"; } ? number : boolean;
|
|
@@ -26,7 +26,7 @@ export type ConditionDecider<TState extends AgentData = AgentData> = (state: Age
|
|
|
26
26
|
* @since 5.1
|
|
27
27
|
*/
|
|
28
28
|
export class ConditionalWorkflow<TState extends AgentData = AgentData> extends BaseWorkflow<TState> {
|
|
29
|
-
constructor(properties:
|
|
29
|
+
constructor(properties: ConditionalWorkflowConstructProperties<TState>);
|
|
30
30
|
/**
|
|
31
31
|
* Must contain exactly two agents: `[trueAgent, falseAgent]`. The first agent is executed when
|
|
32
32
|
* the condition is true, the second when the condition is false.
|
|
@@ -69,4 +69,4 @@ export class ConditionalWorkflow<TState extends AgentData = AgentData> extends B
|
|
|
69
69
|
protected validateAgents(agents: BaseAgentLike<TState>[]): void;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export type
|
|
72
|
+
export type ConditionalWorkflowConstructProperties<TState extends AgentData> = Pick<ConditionalWorkflow<TState>, "agents" | "condition">;
|
|
@@ -26,7 +26,7 @@ export type LoopDecider<TState extends AgentData = AgentData> = (state: AgentGra
|
|
|
26
26
|
* @since 5.1
|
|
27
27
|
*/
|
|
28
28
|
export class LoopWorkflow<TState extends AgentData = AgentData> extends BaseWorkflow<TState> {
|
|
29
|
-
constructor(properties:
|
|
29
|
+
constructor(properties: LoopWorkflowConstructProperties<TState>);
|
|
30
30
|
/**
|
|
31
31
|
* Function that decides whether the loop should continue.
|
|
32
32
|
*
|
|
@@ -55,4 +55,4 @@ export class LoopWorkflow<TState extends AgentData = AgentData> extends BaseWork
|
|
|
55
55
|
protected isTerminalAgent(): boolean;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export type
|
|
58
|
+
export type LoopWorkflowConstructProperties<TState extends AgentData> = Pick<LoopWorkflow<TState>, "decideContinue" | "workflow">;
|
|
@@ -20,7 +20,7 @@ import type { BaseWorkflow, WorkflowGenerateResult } from "./BaseWorkflow.js";
|
|
|
20
20
|
* @since 5.1
|
|
21
21
|
*/
|
|
22
22
|
export class ParallelWorkflow<TState extends AgentData = AgentData> extends BaseWorkflow<TState> {
|
|
23
|
-
constructor(properties:
|
|
23
|
+
constructor(properties: ParallelWorkflowConstructProperties<TState>);
|
|
24
24
|
/**
|
|
25
25
|
* Agents to run in parallel from the same input snapshot.
|
|
26
26
|
*
|
|
@@ -65,4 +65,4 @@ export class ParallelWorkflow<TState extends AgentData = AgentData> extends Base
|
|
|
65
65
|
protected isTerminalAgent(_agents: BaseAgentLike<TState>[], _index: number): boolean;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export type
|
|
68
|
+
export type ParallelWorkflowConstructProperties<TState extends AgentData> = Pick<ParallelWorkflow<TState>, "agents">;
|
|
@@ -16,7 +16,7 @@ import type { BaseWorkflow } from "./BaseWorkflow.js";
|
|
|
16
16
|
* @since 5.1
|
|
17
17
|
*/
|
|
18
18
|
export class RouterWorkflow<TState extends AgentData = AgentData> extends BaseWorkflow<TState> {
|
|
19
|
-
constructor(properties:
|
|
19
|
+
constructor(properties: RouterWorkflowConstructProperties<TState>);
|
|
20
20
|
/**
|
|
21
21
|
* Mapping of route keys to destination agents.
|
|
22
22
|
*
|
|
@@ -60,4 +60,4 @@ export class RouterWorkflow<TState extends AgentData = AgentData> extends BaseWo
|
|
|
60
60
|
protected validateAgents(agents: BaseAgentLike<TState>[]): void;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export type
|
|
63
|
+
export type RouterWorkflowConstructProperties<TState extends AgentData> = Pick<RouterWorkflow<TState>, "agentsMap" | "routerAgent" | "routerOutputKey">;
|
|
@@ -17,7 +17,7 @@ import type { AgentData, AgentGraphState, BaseAgentLike, GraphEdge } from "../ty
|
|
|
17
17
|
* @since 5.1
|
|
18
18
|
*/
|
|
19
19
|
export class SequentialWorkflow<TState extends AgentData = AgentData> extends BaseWorkflow<TState> {
|
|
20
|
-
constructor(properties:
|
|
20
|
+
constructor(properties: SequentialWorkflowConstructProperties<TState>);
|
|
21
21
|
/**
|
|
22
22
|
* A list of agents to execute in the specified order.
|
|
23
23
|
*
|
|
@@ -53,4 +53,4 @@ export class SequentialWorkflow<TState extends AgentData = AgentData> extends Ba
|
|
|
53
53
|
protected validateAgents(agents: BaseAgentLike<TState>[]): void;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export type
|
|
56
|
+
export type SequentialWorkflowConstructProperties<TState extends AgentData> = Pick<SequentialWorkflow<TState>, "agents">;
|
|
@@ -26,7 +26,7 @@ export type SwitchDecider<TState extends AgentData = AgentData> = (state: AgentG
|
|
|
26
26
|
* @since 5.1
|
|
27
27
|
*/
|
|
28
28
|
export class SwitchWorkflow<TState extends AgentData = AgentData> extends BaseWorkflow<TState> {
|
|
29
|
-
constructor(properties:
|
|
29
|
+
constructor(properties: SwitchWorkflowConstructProperties<TState>);
|
|
30
30
|
/**
|
|
31
31
|
* Mapping of keys to destination agents.
|
|
32
32
|
*
|
|
@@ -70,5 +70,5 @@ export class SwitchWorkflow<TState extends AgentData = AgentData> extends BaseWo
|
|
|
70
70
|
protected validateAgents(agents: BaseAgentLike<TState>[]): void;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export type
|
|
73
|
+
export type SwitchWorkflowConstructProperties<TState extends AgentData> = Partial<Pick<SwitchWorkflow<TState>, "defaultAgent">>
|
|
74
74
|
& Pick<SwitchWorkflow<TState>, "agentsMap" | "resolver">;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import k from"./TI7K3I3K.js";import j from"./SKXDXIQO.js";import i from"./XFL2VQFM.js";import f from"./GPVY5GM6.js";import e from"./UK7PR2FE.js";import d from"./HBUW4KGU.js";import c from"./EIPHHMWX.js";import b from"./5SW5CPQT.js";import a from"./JMODFBN6.js";import"./R74ZHFA6.js";import{a as g,b as h}from"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([C,I,{b:u,c:y,f:w,i:v,j:A,k:S,l:b,m:d,n:p,o:M,p:E,q:P,r:T,s:W,t:x},{a:f,b:V},,O,,L,D,k,R])=>{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 W(t),r=await x(t,n);o.set(t.id,{layerItem:r,fieldRegistry:n})})();s.push(i)}return await Promise.all(s),o},j=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:s}=await q(a),o={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:S,model:b,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},q=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]??""),z=(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))},_=E,ee=P,ae=T,te=g,se=f,re=z,oe=O,ie=L,ne=R,me=k,ce=D,le=j,de=()=>u(),pe=()=>y(),fe=async(e,a)=>await h(e,a),ge=async({modelTier:e="default",temperature:a=0,config:s}={})=>await w({modelTier:e,temperature:a,config:s});return{ArcgisKnowledgeAgent:ce,DataExplorationAgent:ne,HelpAgent:me,LayerStylingAgent:ie,NavigationAgent:oe,Orchestrator:V,cosineSimilarity:re,createAgentRuntimeState:de,createAgentRuntimeStateWithSharedState:pe,createChatModel:ge,createWebmapEmbeddings:le,getEmbeddings:se,invokeStructuredPrompt:ee,invokeTextPrompt:_,invokeToolPrompt:ae,sendTraceMessage:te,sendUXSuggestion:fe}},"layers/FeatureLayer","core/reactiveUtils",a,b,c,d,e,f,i,j,k)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as i,c}from"./SBP6WNDY.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,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{c as r}from"./RLEHNAIA.js";function s(e,n){return n?typeof n=="string"?l(e,n)??null:n:r(e,"arcgis-map")??null}function c(e,n){return n?typeof n=="string"?l(e,n)??null:n:r(e,"arcgis-link-chart")??r(e,"arcgis-map")??null}function l(e,n){let i=n.includes("#")||n.includes(".")||n.includes("["),t=e.getRootNode();return(i?void 0:t.querySelector(`#${n}`))??t.querySelector(n)??void 0}export{s as a,c as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as E}from"./PBTINZTK.js";import b from"./5SW5CPQT.js";import{a as I}from"./434TAA3J.js";import{a as D}from"./GYVSHAUI.js";import"./F5SUU35Z.js";import a from"./JMODFBN6.js";import{a as R}from"./3UEKINYC.js";import"./RLEHNAIA.js";import{g as $,h as c,k as C,l as P,n as d,t as _,u as y,v as T,x as k,z as A}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([N,{whenOnce:U,watch:B,when:V},j,q,,,H,{property:m,subclass:F},,{b:L}])=>{var G=$`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;function S(o){return o.trim()?E.lexer(o).filter(t=>t.type!=="space").map(t=>E.parser([t])):[]}var f=class{constructor(){this._stableParts=[],this._stableText="",this._rawText=""}push(t){return this._rawText+=t,this._advanceStableBoundary(),this.getParts()}finalize(){let t=this._rawText.slice(this._stableText.length);return t.trim()&&(this._stableParts.push(...S(t)),this._stableText=this._rawText),this._stableParts}getParts(){let t=this._trimIncompleteTail(this._rawText.slice(this._stableText.length)),s=t.trim()?S(t):[];return[...this._stableParts,...s]}reset(){this._stableParts=[],this._stableText="",this._rawText=""}_advanceStableBoundary(){let t=this._rawText.slice(this._stableText.length),s=this._lastSafeBoundary(t);if(s<=0)return;let i=t.slice(0,s);this._stableParts.push(...S(i)),this._stableText+=i}_lastSafeBoundary(t){let s=t.split(`
|
|
3
|
+
`),i=!1,e=0,n=0;for(let r of s)/^\s*(```|~~~)/u.test(r)&&(i=!i),n+=r.length+1,r.trim()===""&&!i&&(e=n);return e<t.length?e:0}_trimIncompleteTail(t){let s=t.lastIndexOf("<");if(s!==-1&&!t.includes(">",s))return t.slice(0,s);let i=this._earliestUnclosedTag(t);if(i!==-1)return t.slice(0,i);let e=t.lastIndexOf("[");if(e!==-1){let n=t.slice(e);if(!/\[[^\]]*\]\([^)]*\)/u.test(n))return t.slice(0,e)}return t}_earliestUnclosedTag(t){let s=new Set(["br","img","hr","input","meta","link","area","base","col","embed","source","track","wbr"]),i=/<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu,e=[];for(let n=i.exec(t);n;n=i.exec(t)){let[,r,a,l]=n,h=a.toLowerCase();if(!(s.has(h)||l==="/"))if(r==="/"){for(let g=e.length-1;g>=0;g--)if(e[g].name===h){e.splice(g);break}}else e.push({name:h,index:n.index})}return e.length?e[0].index:-1}};function W(o){let t=new f;return t.push(o),t.finalize()}var Y=async o=>await new Promise(t=>setTimeout(t,o));async function*Z(o,{chunkSize:t=15,delay:s=50}={}){let i=new f;for(let e=0;e<o.length;e+=t)yield i.push(o.slice(e,e+t)),await Y(s);yield i.finalize()}var J=Object.defineProperty,K=Object.getOwnPropertyDescriptor,u=(o,t,s,i)=>{for(var e=i>1?void 0:i?K(t,s):t,n=o.length-1,r;n>=0;n--)(r=o[n])&&(e=(i?r(t,s,e):r(e))||e);return i&&e&&J(t,s,e),e},O=o=>!o||typeof o!="object"?!1:o.name==="AbortError";async function*z(o,t,s,i,e=!1){if(e){if(i?.aborted){yield{type:"cancelled",log:s,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:W(o)},runId:t};return}for await(let n of Z(o)){if(i?.aborted){yield{type:"cancelled",log:s,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:n},runId:t}}}var p=class extends H{constructor(o){super(o),this.view=null,this.streamingDisabled=!1,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await U(()=>!this.view.updating),this._set("orchestrator",await L.init({agents:[...this.agents],view:this.view??void 0})),this.addHandles([B(()=>[this.view,this.agents],()=>{this._initialize()})])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(o,t){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let s=[],i,e="pending";try{let n=this.orchestrator.ask(o);for await(let r of n)switch(e=r.runId,r.type){case"trace":{this._set("processingStep",r.data.text),s.push(r.data.text);break}case"completed":{this._set("processing",!1),this._set("processingStep","");let a=r.result,l=!!a.content.length,h=!!i?.length;if(!l&&!h){yield{type:"completed",error:"No response received.",log:s,runId:e};return}let g=a.content;if(yield{type:"block-start",blockType:"text",runId:e},yield*z(g,e,s,t,this.streamingDisabled),yield{type:"block-end",blockType:"text",runId:e},h)for(let v of i){if(t?.aborted){yield{type:"cancelled",log:s,runId:e};return}let{type:b,data:w}=v;if(yield{type:"block-start",blockType:b,runId:e},b==="text"){let M=typeof w?.content=="string"?w.content:"";yield*z(M,e,s,t,this.streamingDisabled)}else yield{type:"block-data",blockType:b,data:w,runId:e};yield{type:"block-end",blockType:b,runId:e}}yield{type:"completed",response:g,blocks:i,log:s,runId:e};return}case"ux-suggestion":{let a=r.suggestion;i=i?[...i,a]:[a];break}case"interrupt":{let{kind:a,message:l,metadata:h}=r.interrupt,g=Array.isArray(h)?h.filter(b=>typeof b=="string"):[],v=(()=>{switch(a){case"booleanChoice":return{type:"boolean-choice",message:l,options:g};case"singleSelection":return{type:"single-select",message:l,options:g};case"multipleSelection":return{type:"multi-select",message:l,options:g};case"textInput":return{type:"text-input",message:l};default:return{type:a,message:l,options:g}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:v,runId:e};break}case"cancelled":{yield{type:"cancelled",log:s,runId:e};return}case"error":{if(t?.aborted||O(r.error)){yield{type:"cancelled",log:s,runId:e};return}yield{type:"completed",error:r.error.message,log:s,runId:e};return}default:{console.warn("Unknown event type:",r);break}}}catch(n){if(t?.aborted||O(n)){yield{type:"cancelled",log:s,runId:e};return}console.warn("Error during message processing:",n),yield{type:"completed",error:"An error occurred during message processing.",log:s,runId:"error"};return}finally{this._set("processing",!1)}}cancel(){this.orchestrator?.cancel()}};u([m({readOnly:!0})],p.prototype,"orchestrator",2);u([m()],p.prototype,"agents",2);u([m()],p.prototype,"portal",2);u([m()],p.prototype,"view",2);u([m()],p.prototype,"streamingDisabled",2);u([m({readOnly:!0})],p.prototype,"loading",2);u([m({readOnly:!0})],p.prototype,"processing",2);u([m({readOnly:!0})],p.prototype,"processingStep",2);p=u([F("OrchestratorController")],p);var Q="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",X="Embeddings not found for this web map.",tt="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",x=class extends T{constructor(){super(...arguments),this._messages=D({blocking:!0}),this.#t=_(),this.#l=_(),this.#s=_(),this.#e=null,this.#r=new Map,this.#i=j.getDefault(),this.#a=t=>{t.stopPropagation(),this.cancelInterrupt()},this.#n=t=>{t.stopPropagation();let s=t.detail;this.submitInterrupt(s)},this.#c=t=>{t.stopPropagation(),this.keepSuggestedPrompts||(this.suggestedPrompts=[]);let s=t.detail;this._inputValue="",this.arcgisSubmit.emit(s),this.submitMessage(s)},this.#h=t=>{if(this._canceling=!0,t.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this._orchestratorController?.cancel(),this.#e?.abort(),this.#e=null},this.#g=t=>{t.stopPropagation();let s=t.detail;this.arcgisFeedback.emit(s)},this.#d=t=>{t.stopPropagation();let s=t.detail;this._inputValue=s.prompt,this.arcgisPromptSelect.emit(s)},this.#p=t=>{this.arcgisSlottableRequest.emit(t.detail)},this._orchestratorController=null,this._interrupt=null,this._interruptDetails=[],this._error=null,this._inputValue="",this._isAnswering=!1,this._canceling=!1,this.messages=new N([]),this.referenceElement=null,this.suggestedPrompts=[],this.feedbackEnabled=!1,this.keepSuggestedPrompts=!1,this.streamingDisabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.voiceInputEnabled=!1,this.readAloudEnabled=!1,this.assistantAvatarEnabled=!1,this.arcgisCancel=d(),this.arcgisError=d(),this.arcgisFeedback=d(),this.arcgisInterrupt=d(),this.arcgisInterruptCancel=d(),this.arcgisInterruptSubmit=d(),this.arcgisPromptSelect=d(),this.arcgisReady=d(),this.arcgisSubmit=d(),this.arcgisSlottableRequest=d({bubbles:!1,composed:!1}),this.arcgisResponse=d()}static{this.properties={_orchestratorController:16,_interrupt:16,_interruptDetails:16,_error:16,_inputValue:16,_isAnswering:16,_signedInUserId:16,_canceling:16,_isSignedIn:16,_user:16,awaitingResponse:32,awaitingResponseStep:32,interrupt:32,messages:0,orchestrator:32,entryMessage:1,heading:1,description:1,referenceElement:1,suggestedPrompts:0,feedbackEnabled:5,keepSuggestedPrompts:5,streamingDisabled:5,logEnabled:5,copyEnabled:5,voiceInputEnabled:5,readAloudEnabled:5,assistantAvatarEnabled:5}}static{this.styles=G}#t;#l;#s;#e;#r;#i;#a;#n;#c;#h;#g;#d;#p;async#o(){try{let t=R(this.el,this.referenceElement);await t?.componentOnReady();let s=[...this.#r.values()];return s.length?(this._orchestratorController?.destroy(),this._orchestratorController=new p({agents:s,portal:this.#i,streamingDisabled:this.streamingDisabled,view:t?.view}),await this._orchestratorController.load(),!0):(this._error="No agents found.",!1)}catch(t){return this._error=t?.message??"Error initializing orchestrator.",P(this)(t),!1}}get _isSignedIn(){return!!this.#i?.user||!!this._signedInUserId}get _user(){return this.#i?.user?.fullName||this.#i?.user?.username}get awaitingResponse(){return this._orchestratorController?.processing??!1}get awaitingResponseStep(){return this._orchestratorController?.processingStep??""}get interrupt(){return this._interrupt}get orchestrator(){return this._orchestratorController?.orchestrator}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}cancelInterrupt(){this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null}register(t){this.#r.set(t.agent.id,t),this._orchestratorController&&this.#o()}unregister(t){this.#r.delete(t),this._orchestratorController&&this.#o()}async submitMessage(t){let s=t.trim();if(!s||(this.messages.push({id:Date.now().toString(),role:"user",content:s}),!this._orchestratorController))return;this.#e=new AbortController,this._orchestratorController.streamingDisabled=this.streamingDisabled;let i=this._orchestratorController.ask(s,this.#e?.signal);for await(let e of i){let n=e.runId,r=this.messages.at(-1);switch(e.type){case"block-start":{this._isAnswering=!0;let a={type:e.blockType,isPending:!0};if(r?.role==="assistant"&&r.id===n){let l=[...r.blocks??[],a];this.messages.splice(-1,1,{...r,blocks:l})}else this.messages.push({role:"assistant",blocks:[a],id:n,isStreaming:!0,interrupts:this._interruptDetails}),this._interruptDetails=[];break}case"block-data":{if(r?.role!=="assistant"||r?.id!==n)break;let a=[...r.blocks??[]],l=a[a.length-1],{blockType:h,data:g}=e;if(l?.type!==h||!l.isPending)break;h==="text"?a[a.length-1]={...l,data:{...l.data,parts:g?.parts}}:a[a.length-1]={...l,data:{...l.data,...g??{}}},this.messages.splice(-1,1,{...r,blocks:a});break}case"block-end":{if(r?.role!=="assistant"||r?.id!==n)break;let a=[...r.blocks??[]],l=a[a.length-1];if(l?.type!==e.blockType||!l.isPending)break;let h=l;a[a.length-1]={...h,data:{...h.data},isPending:!1},this.messages.splice(-1,1,{...r,blocks:a});break}case"completed":e.error?(this.messages.push({role:"assistant",log:e.log,error:e.error,id:n,interrupts:this._interruptDetails}),this._interruptDetails=[]):r?.role==="assistant"&&r.id===n&&this.messages.splice(-1,1,{...r,content:e.response,blocks:r.blocks?.map(a=>({...a,data:{...a.data},isPending:!1}))??[],isStreaming:!1,log:e.log}),this._isAnswering=!1,this.#e=null,this._canceling=!1;break;case"interrupt":this._interrupt={...e.payload,id:n},this.arcgisInterrupt.emit(this._interrupt);break;case"cancelled":r?.role==="assistant"&&r.id===n?this.messages.splice(-1,1,{...r,blocks:r.blocks?.filter(a=>a.type==="text"||!a.isPending)??[],isStreaming:!1,log:e.log,error:"(Stopped by user)"}):(this.messages.push({role:"assistant",log:e.log,error:"(Stopped by user)",id:n,interrupts:this._interruptDetails}),this._interruptDetails=[]),this._isAnswering=!1,this.#e=null,this._canceling=!1;break}}}submitInterrupt(t){this.arcgisInterruptSubmit.emit(t),this._interrupt&&(this._interruptDetails=[...this._interruptDetails,{interrupt:this._interrupt,response:t}]),this.orchestrator?.resumeInterrupt(t),this._interrupt=null}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#t.value?.addEventListener("arcgisPromptSelect",this.#d),this.#t.value?.addEventListener("arcgisSubmit",this.#c),this.#t.value?.addEventListener("arcgisCancel",this.#h),this.#t.value?.addEventListener("arcgisFeedback",this.#g);let t=V(()=>!!this._interrupt&&!!this.#s.value,()=>{let i=this.#s.value;i.removeEventListener("arcgisSubmit",this.#n),i.removeEventListener("arcgisCancel",this.#a),i.addEventListener("arcgisSubmit",this.#n,{once:!0}),i.addEventListener("arcgisCancel",this.#a,{once:!0})}),s=this.messages.on("after-add",i=>{let e=i.item;e.role==="assistant"&&(e.error||e.content)&&this.arcgisResponse.emit(e)});return queueMicrotask(()=>{this.#o().then(i=>{i?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))})}),()=>{t.remove(),s.remove(),this.#t.value?.removeEventListener("arcgisPromptSelect",this.#d),this.#s.value?.removeEventListener("arcgisSubmit",this.#n),this.#s.value?.removeEventListener("arcgisCancel",this.#a),this.#t.value?.removeEventListener("arcgisSubmit",this.#c),this.#t.value?.removeEventListener("arcgisCancel",this.#h),this.#t.value?.removeEventListener("arcgisFeedback",this.#g),this._orchestratorController?.destroy(),this._orchestratorController=null}})}_reset(){this._orchestratorController?.cancel(),this.#e?.abort(),this._interrupt=null,this.messages.removeAll(),this._error=null,this._inputValue="",this._signedInUserId=void 0}_renderEntryMessage(){return this._isSignedIn?this._error?this._renderErrorNotice():this.entryMessage?this.messages.length>0?null:c`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>`:c`<slot name=entry-message></slot>`:this._renderSignInNotice()}_renderSignInNotice(){let t=this.#i;return c`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>You need to sign in to use the assistant chat.</div>${t?c`<calcite-link slot=link @click=${async()=>{try{let s=await q.getCredential(`${t.url}/sharing`);this._signedInUserId=s.userId,this._error=null,this.requestUpdate(),await this.#o()?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))}catch(s){this._error=s?.message??"Error signing in.",this.arcgisError.emit(new Error(this._error)),C("error",this,"Error signing in:",{detail:{error:s}})}}} target=_blank title="Sign in to ArcGIS Online">Sign in</calcite-link>`:c`<div slot=link>No portal information available</div>`}</calcite-notice>`}_renderErrorNotice(){return this._error?c`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error===Q?c`<div slot=message>${X}</div><calcite-link slot=link .href=${tt} target=_blank title="Learn about web map embeddings">Read more</calcite-link>`:c`<div slot=message>${this._error}</div>`}</calcite-notice>`:null}render(){return c`<calcite-panel .loading=${!this._orchestratorController&&!this._error||this._orchestratorController?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} ${y(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map(t=>t.role==="assistant"?c`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#p} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((s,i)=>c`<slot name=${I(t.id,i)??k} slot=${I(t.id,i)??k}><arcgis-assistant-message-block .block=${s}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>`:c`<arcgis-assistant-user-message .message=${t} .user=${this._user}></arcgis-assistant-user-message>`)}</slot>${this._interrupt?c`<div slot=message-loading><div class="interrupt-waiting-message">waiting for user input...</div></div>`:c`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt?c`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${y(this.#s)}></arcgis-assistant-interrupt></slot>`:this.suggestedPrompts?.length?c`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>`:null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse||this._isAnswering} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling||!this._isSignedIn||!!this._interrupt} ${y(this.#l)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse||this._isAnswering?"circle-stop":"send"} @click=${()=>{this.#l.value?.submitMessage()}} round>${this.awaitingResponse||this._isAnswering?this._messages.stopButtonLabel:this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`}};A("arcgis-assistant",x);return x},"core/Collection","core/reactiveUtils","portal/Portal","identity/IdentityManager","config","layers/FeatureLayer","core/Accessor","core/accessorSupport/decorators",a,b)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as l}from"./GYVSHAUI.js";import"./F5SUU35Z.js";import"./RLEHNAIA.js";import{g as a,h as e,k as o,t as i,u as n,v as r,z as c}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([{watch:d}])=>{var g=a`.container{display:flex;align-items:center;width:100%;justify-content:space-between;gap:var(--calcite-spacing-xs)}.start,.end{display:flex;align-items:center;gap:var(--calcite-spacing-xs)}`,t=class extends r{constructor(){super(...arguments),this._messages=l({blocking:!0}),this._endRef=i(),this._showLog=!1,this.feedbackEnabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.readAloudEnabled=!1}static{this.properties={_showLog:16,feedbackEnabled:5,logEnabled:5,copyEnabled:5,readAloudEnabled:5,message:0}}static{this.styles=g}loaded(){this.manager.onLifecycle(()=>[d(()=>this._showLog,()=>this._scrollToEnd())])}_scrollToEnd(){requestAnimationFrame(()=>{this._endRef.value?.scrollIntoView({behavior:"smooth",block:"end"})})}_renderCopyButton(){return!this.message?.error&&this.copyEnabled?e`<calcite-action id=action-copy icon=copy-to-clipboard scale=s @click=${async()=>{try{let s=this.message?.content?.trim();s&&await navigator.clipboard.writeText(s)}catch(s){o("warn","assistant-message-footer","Failed to copy text to clipboard",{once:!0,detail:{error:s}})}}} text></calcite-action><calcite-tooltip reference-element=action-copy overlay-positioning=fixed placement=bottom><span>${this._messages.copyButtonLabel}</span></calcite-tooltip>`:null}_renderLogButton(){return this.message?.log?.length&&this.logEnabled?e`<calcite-action id=action-log icon=access-string-results scale=s @click=${()=>this._showLog=!this._showLog} .text=${this._messages.logButtonLabel} .active=${this._showLog}></calcite-action><calcite-tooltip reference-element=action-log overlay-positioning=fixed placement=bottom><span>${this._messages.logButtonLabel}</span></calcite-tooltip>`:null}_renderReadAloudButton(){return e`<arcgis-assistant-message-read-aloud .message=${this.message} .readAloudEnabled=${this.readAloudEnabled}></arcgis-assistant-message-read-aloud>`}_renderLog(){return e`<arcgis-assistant-message-log .log=${this.message?.log} .showLog=${this._showLog} .logEnabled=${this.logEnabled}></arcgis-assistant-message-log>`}_renderFeedback(){return e`<arcgis-assistant-message-feedback .message=${this.message} .feedbackEnabled=${this.feedbackEnabled}></arcgis-assistant-message-feedback>`}render(){return e`${this._renderLog()}<div class="container"><div class="start">${this._renderCopyButton()}${this._renderLogButton()}${this._renderReadAloudButton()}<slot name=footer-actions-start></slot></div><div class="end"><slot name=footer-actions-end></slot>${this._renderFeedback()}</div></div><div ${n(this._endRef)}></div>`}};c("arcgis-assistant-message-footer",t);return t},"core/reactiveUtils")
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import a from"./JMODFBN6.js";import{b as f}from"./R74ZHFA6.js";import{a as l}from"./HJG7QM2R.js";import{Va as S,a as v,b as x,ba as R,y as E}from"./ZQ7PGNWB.js";import{ca as I,oa as b}from"./LUY6V4TP.js";export default $arcgis.t(([O,P,q,N,T,{a:C,d:k,e:p,g:A,h:$,o:M}])=>{var U=async t=>{let e=await _(),r=await C("default"),s=P.getDefault(),n=(await O.getCredential(`${s.url}/sharing`)).token,a={type:"generateEmbeddings",webmapEmbeddings:t,auth:{apiUrl:r,token:n}};return e.postMessage(a),await new Promise((i,o)=>{let d=u=>{u.data==="completed"&&(e.removeEventListener("message",d),i())},c=u=>{e.removeEventListener("message",d),o(u instanceof Error?u:new Error("Embeddings worker error"))};e.addEventListener("message",d),e.addEventListener("error",c,{once:!0})}),e},_=async()=>{{let t=(await import("./OKVLGJAG.js")).default;return new t}},G=t=>{t.currentIntent="none"},z=async(t,e)=>{let r=p(e);if(t.agentExecutionContext.userRequest){let n=new b(t.agentExecutionContext.userRequest.trim());t.agentExecutionContext.messages=[...t.agentExecutionContext.messages,n],G(t)}let s=r?.services.agentRegistry.list().map(n=>n.agent.id)??[];return await l({text:`Available agents: ${[...s].join(", ")}`},e),await l({text:"Analyzing user input"},e),t},Q=async(t,e)=>(await l({text:"Exiting..."},e),t),D=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),B=(t,e)=>{if(!D(t)){t!==void 0&&console.warn(`Agent "${e}" returned invalid sharedStatePatch. Ignoring it.`);return}let r={};for(let[s,n]of Object.entries(t)){if(!D(n)||!("value"in n)){console.warn(`Agent "${e}" returned invalid sharedStatePatch entry for key "${s}". Ignoring that entry.`);continue}r[s]={value:n.value}}return r},J=t=>{let{previousSharedState:e,patch:r,agentId:s}=t;if(!r)return e;let n=Date.now(),a={...e};for(let[i,o]of Object.entries(r))o?.value!==void 0&&(a[i]={value:o.value,meta:{updatedByAgentId:s,updatedAt:n}});return a},W=t=>typeof t!="string"?void 0:t.trim()||void 0,K=t=>{switch(t){case"failed":return"Agent failed without a summary.";case"unknown":return"Agent returned with unknown status.";case"success":return"Agent completed without a summary.";default:return"Agent completed without a summary."}},V=(t,e)=>{let r=W(e?.outputMessage),s=W(e?.summary),n=e?.status,a=n==="success"||n==="failed"?n:"unknown";a==="unknown"&&console.warn(`Agent "${t}" returned missing/invalid status. Defaulting to "unknown".`);let i=B(e?.sharedStatePatch,t);return{outputMessage:r,summary:s??r??K(a),status:a,sharedStatePatch:i}},F=4e3,X=async(t,e)=>{let r=p(e);if(e?.signal?.aborted)return await l({text:"Run cancelled; skipping agent execution"},e),{...t,currentIntent:"none",requiresFollowUp:!1};let{agentRegistry:s}=r?.services??{},n=s?.get(t.currentIntent);if(!n)return console.warn(`No agent found for intent: ${t.currentIntent}`),t;await l({text:`Executing registered agent: ${n.agent.name}`},e);let a={...e??{},configurable:{...r??{},agentId:n.agent.id,context:n.getContext?await n.getContext():void 0}},i;try{let c=await n.agent.createGraph().compile().invoke({agentExecutionContext:{...t.agentExecutionContext,messages:[...t.agentExecutionContext.messages],priorSteps:structuredClone(t.agentExecutionContext.priorSteps??[]),sharedState:structuredClone(t.agentExecutionContext.sharedState??{})}},a);i=V(n.agent.name,c),await l({text:`Finished executing registered agent: ${n.agent.name}`},e)}catch(c){if(E(c)||e?.signal?.aborted||c instanceof Error&&c.name==="AbortError")throw c;let u=c instanceof Error?c.message:String(c);console.error(`Agent "${n.agent.name}" failed:`,c),await l({text:`Registered agent failed: ${n.agent.name}. ${u}`},e),i={status:"failed",outputMessage:`Agent execution failed: ${u}`,summary:`Agent execution failed: ${u}`}}let o=i.outputMessage,d=[...t.agentExecutionContext.messages];if(o){let c=o.length>F?`${o.slice(0,F-14)}
|
|
3
|
+
[truncated]`:o;d.push(new I(c))}return{...t,stepCount:t.stepCount+1,lastExecutedAgent:n.agent.id,requiresFollowUp:i.status==="failed"?!0:t.requiresFollowUp,finalOutputMessage:o??"",agentExecutionContext:{...t.agentExecutionContext,messages:d,priorSteps:[...t.agentExecutionContext.priorSteps??[],{agentId:n.agent.id,assignedTask:t.agentExecutionContext.assignedTask,summary:i?.summary||"No summary provided.",status:i?.status||"unknown"}],sharedState:J({previousSharedState:t.agentExecutionContext.sharedState,patch:i.sharedStatePatch,agentId:n.agent.id})}}},Y=3,Z=()=>new S(k).addNode("ingestInput",z).addNode("intentLLM",$).addNode("executeRegisteredAgent",X).addNode("exit",Q).addEdge(v,"ingestInput").addEdge("ingestInput","intentLLM").addConditionalEdges("intentLLM",t=>t.currentIntent==="none"||t.currentIntent===t.lastExecutedAgent?"exit":"executeRegisteredAgent").addConditionalEdges("executeRegisteredAgent",t=>t.stepCount>=Y||!t.requiresFollowUp?"exit":"intentLLM").addEdge("exit",x),w=class{constructor(){this.agentRegistry=new Map}register(e){let{agent:r}=e;if(this.agentRegistry.has(r.id))throw new Error(`Duplicate agent id: ${r.id}`);this.agentRegistry.set(r.id,e)}get(e){return this.agentRegistry.get(e)}list(){return[...this.agentRegistry.values()]}},y=class{constructor(e,r){this.graph=e,this.config={...r}}async waitForUser(){return await new Promise((e,r)=>{this.resolveWait=e,this.rejectWait=r})}handle(e,r){try{let s={agentId:e.agentId,id:e.id,payload:r},n=this.graph.streamEvents(null,{...this.config,configurable:{...this.config.configurable,hitlResponse:s},subgraphs:!0,version:"v2"});this.resolveWait?.(n)}catch(s){this.rejectWait?.(s)}finally{this.resolveWait=void 0,this.rejectWait=void 0}}cancel(){this.rejectWait&&(this.rejectWait(new Error("Request cancelled by user.")),this.resolveWait=void 0,this.rejectWait=void 0)}},ee=async t=>{try{return await(await A()).embedDocuments(t)}catch(e){throw console.error("Failed to generate embeddings:",e),e}},j=async(t,e)=>{let r=e.get(t);if(r)return r;let s=await ee([t]);return e.set(t,s[0]),s[0]};async function te(t,e,r,s){let n=`req-${Date.now()}`,a={type:"layerSearch",precomputedEmbedding:s?await j(t,s):void 0,requestId:n,minScore:r};return await new Promise(i=>{let o=d=>{d.data.requestId===n&&i(d.data.results)};e.addEventListener("message",o,{once:!0}),e.postMessage(a)})}function re(t){let{worker:e}=t;return{async searchLayers({text:r,minScore:s,embeddingCache:n}){return await te(r,e,s,n)}}}var ne=async({combinedQuery:t,layerIds:e,embeddingsWorker:r,minScore:s,topResults:n,embeddingCache:a})=>{let i=`req-${Date.now()}`,o=a?await j(t,a):void 0,d={type:"fieldSearch",layerIdForFieldsSearch:e,precomputedEmbedding:o,requestId:i,minScore:s,topResults:n};return await new Promise(c=>{let u=h=>{if(h.data.requestId!==i)return;let g=h.data.results.map(({layerId:m,results:H})=>({layerId:m,results:H}));c(g)};r.addEventListener("message",u,{once:!0}),r.postMessage(d)})};function se(t){let{worker:e}=t;return{async searchFields({text:r,layerIds:s,minScore:n,topResults:a,embeddingCache:i}){return await ne({combinedQuery:r,layerIds:s,embeddingsWorker:e,minScore:n,topResults:a,embeddingCache:i})}}}var ae=t=>{let e=M.safeParse(t);if(!e.success)throw new Error("Embeddings response validation failed. Regenerate embeddings.");return e.data},ie=(t,e)=>{let r=new Map,s=new Map;if(e.allLayers.forEach(n=>{n instanceof N&&s.set(n.id,n)}),t.length!==s.size)throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");for(let n of t){let a=s.get(n.id);if(!a)throw new Error(`Layer with ID ${n.id} not found in the original map during registry restoration. Regenerate embeddings.`);if(n.fields.length!==a.fields.length)throw new Error(`Field count mismatch for layer ID ${n.id} during registry restoration. Regenerate embeddings.`);let i={name:n.name,title:n.title,description:n.description},o=new Map;for(let d of n.fields){let c=a.fieldsIndex.get(d.name);if(!c)throw new Error(`Field with name ${d.name} not found in the original layer ${n.id} during registry restoration. Regenerate embeddings.`);o.set(d.name,{name:d.name,alias:a.getFieldAlias(d.name)??d.alias,description:d.description,type:c.type||"unknown",valueType:c.valueType||"unknown",domain:a.getFieldDomain(d.name)??void 0})}r.set(n.id,{layerItem:i,fieldRegistry:o})}return r},oe=async t=>{try{return(await T(t,{responseType:"json"})).data}catch(e){throw new Error(`Failed to fetch data from ${t}: ${String(e)}`)}},de=async t=>{let e=t.map;if(!e?.portalItem)throw new Error("WebMap portal item is missing.");let{resources:r}=await e.portalItem.fetchResources(),s=r.find(a=>a.resource.path==="embeddings-v01.json");if(!s?.resource.url)throw new Error("Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.");let n=await oe(s.resource.url);return ae(n)},L=class t{constructor(){this.orchestratorReady=!1,this.chatHistory=[],this.priorSteps=[],this.sharedState={},this.agentRegistry=new w,this.activeRunId="",this.cancelledRunIds=new Set,this.streamEpoch=0}static async init(e){let r=new t;try{if(e.view?.map){await q.whenOnce(()=>e.view.ready);let s=await de(e.view),n=ie(s.layers,e.view.map);r.layersAndFieldsRegistry=n,r.embeddingsWorker=await U(s)}return e.agents?.forEach(s=>{r.agentRegistry.register(s)}),r.orchestratorReady=!0,r}catch(s){throw console.error("Orchestrator initialization failed:",s),s}}async*ask(e){if(!this.orchestratorReady)throw new Error("Orchestrator is not ready yet.");if(!this.agentRegistry.list().length)throw new Error("Orchestrator has no registered agents.");if(++this.streamEpoch,!e.trim())return;let r=f();this.activeRunId=r,this.activeAbortController=new AbortController,this.graph||(this.graph=Z().compile({checkpointer:new R}));let s=this.embeddingsWorker?re({worker:this.embeddingsWorker}):void 0,n=this.embeddingsWorker?se({worker:this.embeddingsWorker}):void 0,a=new Map,i={thread_id:r,hitlResponse:null,services:{layerSearch:s,fieldSearch:n,layersAndFieldsRegistry:this.layersAndFieldsRegistry,agentRegistry:this.agentRegistry,embeddingCache:a}},o={version:"v2",streamMode:"custom",signal:this.activeAbortController.signal,configurable:i,subgraphs:!0},d=this.graph?.streamEvents({agentExecutionContext:{userRequest:e,messages:this.chatHistory,priorSteps:this.priorSteps,sharedState:this.sharedState}},o),c=++this.streamEpoch;if(yield*this.pipeStream(d,c,r),this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}for(;;){if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}let h=(await this.graph.getState(o,{subgraphs:!0})).tasks.find(g=>g.interrupts.length>0)?.interrupts[0]?.value;if(!h)break;this.currentInterrupt=h,this.interruptHandler=new y(this.graph,o),yield{runId:r,timestamp:Date.now(),type:"interrupt",interrupt:h};try{let g=await this.interruptHandler.waitForUser(),m=++this.streamEpoch;yield*this.pipeStream(g,m,r)}catch(g){if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}if(g){yield{runId:r,timestamp:Date.now(),type:"error",error:{message:g?.message}};return}}}if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}let u=(await this.graph.getState(o,{subgraphs:!0})).values;if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}this.chatHistory=u.agentExecutionContext.messages.length?u.agentExecutionContext.messages:this.chatHistory,this.priorSteps=u.agentExecutionContext.priorSteps?.slice(-5)??[],this.sharedState=u.agentExecutionContext.sharedState??{},yield{runId:r,timestamp:Date.now(),type:"completed",result:{content:u.finalOutputMessage}}}newConversation(){this.chatHistory=[],this.priorSteps=[],this.sharedState={}}resumeInterrupt(e){if(!this.currentInterrupt||!this.interruptHandler)throw new Error("No pending interrupt to resume.");this.interruptHandler.handle(this.currentInterrupt,e)}cancelInterrupt(){this.interruptHandler&&this.interruptHandler.cancel()}cancel(){this.activeRunId&&(this.cancelledRunIds.add(this.activeRunId),this.activeAbortController?.abort(),++this.streamEpoch,this.interruptHandler?.cancel())}async*pipeStream(e,r,s){for await(let n of e){if(this.isRunCancelled(s)||r!==this.streamEpoch)break;n.event==="on_custom_event"&&n.name==="trace_message"?yield{runId:s,timestamp:Date.now(),type:"trace",data:n.data}:n.name==="graph_ux_suggestion"&&(yield{runId:s,timestamp:Date.now(),type:"ux-suggestion",suggestion:n.data})}}isRunCancelled(e){return this.cancelledRunIds.has(e)}dispose(){this.embeddingsWorker&&(this.embeddingsWorker.terminate(),this.embeddingsWorker=void 0),this.orchestratorReady=!1}};return{a:ee,b:L}},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request",a)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import d from"./GPVY5GM6.js";import c from"./UK7PR2FE.js";import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as s,c as e}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,o])=>{var t=class extends i{constructor(){super(...arguments),this.agent=o}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-layer-styling-agent"),this.#i=e(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-layer-styling-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","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 s,b as c}from"./WSGWTIAV.js";import"./PBTINZTK.js";import{g as a,h as e,v as r,z as i}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var o=a`:host{overflow:auto}.container{display:flex;align-items:center;gap:var(--calcite-spacing-md);background:color-mix(in srgb,var(--calcite-color-brand) 15%,var(--calcite-color-foreground-1));color:var(--calcite-color-text-1);padding:var(--calcite-spacing-md);border-radius:var(--calcite-border-radius);width:fit-content;margin-left:auto;justify-content:flex-end}.avatar{display:flex;align-items:center;justify-content:center}.content{>*{margin:0}>*+*{margin-block-start:var(--calcite-spacing-sm)}:is(ol,ul){padding-inline-start:var(--calcite-spacing-lg)}>calcite-table{display:block;max-width:100%}pre{background-color:var(--calcite-color-foreground-1);padding:var(--calcite-spacing-sm);border-radius:var(--calcite-border-radius);color:var(--calcite-color-text-1);direction:ltr;max-width:100%;overflow:auto}pre code{display:block;white-space:pre;font-family:var(--calcite-code-family)}}@container (min-width: 480px){.container{max-width:80%}}`,t=class extends r{static{this.properties={content:1,user:1,message:0}}static{this.styles=o}_getContent(){return this.message?.role==="user"?this.message.content:this.content}render(){return e`<div class="container"><div><slot name=content><div class="content">${s(c(this._getContent()))}</div></slot></div><slot name=icon><div class="avatar"><calcite-avatar .fullName=${this.user} scale=s></calcite-avatar></div></slot></div>`}};i("arcgis-assistant-user-message",t);export{t as ArcgisAssistantUserMessage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import c from"./HBUW4KGU.js";import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as s,c as o}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.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","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{g as t,h as e,t as i,u as a,v as n,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([l,{when:o,watch:c}])=>{var h=t`.messages-container{display:flex;flex:1;flex-direction:column;line-height:var(--calcite-font-line-height-relative-snug)}.messages-list{padding:var(--calcite-spacing-lg);display:flex;flex-direction:column;gap:var(--calcite-spacing-xxl);flex:1 1 auto;min-height:0;justify-content:flex-end;overflow:auto}.end-ref{margin-top:var(--calcite-spacing-lg)}`,s=class extends n{constructor(){super(...arguments),this.#t=i(),this.#s=!1,this.loading=!1,this.messages=new l([]),this.interrupt=null}static{this.properties={loading:5,messages:0,interrupt:0}}static{this.styles=h}#t;#s;firstUpdated(){this.#e()}loaded(){this.manager.onLifecycle(()=>[this.messages.on("change",()=>{this.#e()}),o(()=>!this.loading,()=>{this.#s=!1}),c(()=>[this.loading,this.interrupt],()=>this.#e())])}#e(){requestAnimationFrame(()=>{this.#s||this.#t.value?.scrollIntoView({behavior:"smooth",block:"end"})})}#i(){this.#s=!0}render(){return e`<div class="messages-container" @wheel=${this.#i}><div class="messages-list"><slot name=message-starter></slot><slot name=messages></slot><slot name=message-loading></slot></div><div class="end-ref" ${a(this.#t)}></div></div>`}};r("arcgis-assistant-chat",s);return s},"core/Collection","core/reactiveUtils")
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as r}from"./434TAA3J.js";import{a as m}from"./F5SUU35Z.js";import"./RLEHNAIA.js";import{g as l,h as e,v as c,x as d,z as g}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var b=l`:host{display:block;container-type:inline-size}.container{display:flex;flex-direction:column;align-items:flex-start;gap:var(--calcite-spacing-sm);width:100%;text-align:left}.icon{padding:var(--calcite-spacing-sm);border-radius:var(--calcite-spacing-xl);background:var(--calcite-color-brand);color:var(--calcite-color-foreground-1)}.content-container{display:flex;flex:1;flex-direction:column;width:100%;gap:var(--calcite-spacing-md)}.content,.blocks{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm)}.block-pending{display:flex;justify-content:center;align-items:center;padding:var(--calcite-spacing-sm);background:linear-gradient(90deg,color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent),color-mix(in srgb,var(--calcite-color-foreground-3) 85%,transparent),color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent));background-size:200% 100%;animation:assistant-message-loading-shimmer 2s ease-in-out infinite;border-radius:var(--calcite-border-radius);min-height:100px}.message-error{font-style:italic}@container (min-width: 480px){.container{max-width:80%}}@keyframes assistant-message-loading-shimmer{0%{background-position:-150% 0}to{background-position:150% 0}}@media(prefers-reduced-motion){.block-pending{animation:none}}`;function p({message:a}){let s=new Map;return a&&a.blocks?.forEach((t,i)=>{if(!t.isPending){let n=r(a.id,i);s.set(n,{data:{block:t,index:i,message:a},name:"block",slotName:n})}}),s}var o=class extends c{constructor(){super(...arguments),this.arcgisSlottableRequest=m(this,["message"],p),this.feedbackEnabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.readAloudEnabled=!1,this.footerDisabled=!1,this.assistantAvatarEnabled=!1}static{this.properties={_isStreaming:16,feedbackEnabled:5,logEnabled:5,copyEnabled:5,readAloudEnabled:5,footerDisabled:5,message:0,assistantAvatarEnabled:5}}static{this.styles=b}get _isStreaming(){return!!this.message?.isStreaming}_renderContent(){let s=this.message,t=s?.id;if(t)return e`<div class="content"><arcgis-assistant-interrupt-preview .interrupts=${this.message?.interrupts}></arcgis-assistant-interrupt-preview>${s.blocks?.length?e`<div class="blocks">${s.blocks.map((i,n)=>i.isPending&&i.type!=="text"?e`<div class="block-pending"></div>`:e`<slot name=${r(t,n)??d}></slot>`)}</div>`:null}</div>`}_renderFooter(){return e`<arcgis-assistant-message-footer .message=${this.message} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled}></arcgis-assistant-message-footer>`}render(){return e`<div class="container">${this.assistantAvatarEnabled?e`<slot name=icon><calcite-icon icon=effects class="icon" scale=s></calcite-icon></slot>`:null}<div class="content-container"><slot name=content>${this._renderContent()}</slot>${this.message?.error?e`<div class="message-error">${this.message.error}</div>`:null}${this._isStreaming?e`<div class="streaming-indicator"><calcite-loader label=loading inline></calcite-loader></div>`:null}${!this.footerDisabled&&!this._isStreaming?e`<slot name=footer>${this._renderFooter()}</slot>`:null}</div></div>`}};g("arcgis-assistant-message",o);export{o as ArcgisAssistantMessage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as u,b as S,c as v}from"./M3MRIGDZ.js";import b from"./MMRRNKWJ.js";import{b as f,c as y}from"./SBP6WNDY.js";import a from"./JMODFBN6.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import{c as d}from"./FQ5XLE4I.js";import{b as c}from"./SYEI4BB2.js";import{X as g,y as l}from"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,{watch:T},,,{property:m,subclass:_},{f: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 u({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:d(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:d(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 u({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","core/reactiveUtils","layers/FeatureLayer","request","core/accessorSupport/decorators",a,b)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"./
|
|
2
|
+
import"./UZLQALHY.js";var e=`# ArcgisKnowledge Tool Instructions
|
|
3
3
|
|
|
4
4
|
You are an assistant that helps users answer questions and perform operations on their knowledge graph, map or link chart. You have been assigned the task below, which must be achieved by calling a single tool.
|
|
5
5
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as wd}from"./VXFQANGJ.js";import{$ as T,$a as Ta,$b as Tb,$c as Tc,A as s,Aa as sa,Ab as sb,Ac as sc,Ad as sd,B as t,Ba as ta,Bb as tb,Bc as tc,Bd as td,C as u,Ca as ua,Cb as ub,Cc as uc,Cd as ud,D as v,Da as va,Db as vb,Dc as vc,Dd as vd,E as w,Ea as wa,Eb as wb,Ec as wc,F as x,Fa as xa,Fb as xb,Fc as xc,G as y,Ga as ya,Gb as yb,Gc as yc,H as z,Ha as za,Hb as zb,Hc as zc,I as A,Ia as Aa,Ib as Ab,Ic as Ac,J as B,Ja as Ba,Jb as Bb,Jc as Bc,K as C,Ka as Ca,Kb as Cb,Kc as Cc,L as D,La as Da,Lb as Db,Lc as Dc,M as E,Ma as Ea,Mb as Eb,Mc as Ec,N as F,Na as Fa,Nb as Fb,Nc as Fc,O as G,Oa as Ga,Ob as Gb,Oc as Gc,P as H,Pa as Ha,Pb as Hb,Pc as Hc,Q as I,Qa as Ia,Qb as Ib,Qc as Ic,R as J,Ra as Ja,Rb as Jb,Rc as Jc,S as K,Sa as Ka,Sb as Kb,Sc as Kc,T as L,Ta as La,Tb as Lb,Tc as Lc,U as M,Ua as Ma,Ub as Mb,Uc as Mc,V as N,Va as Na,Vb as Nb,Vc as Nc,W as O,Wa as Oa,Wb as Ob,Wc as Oc,X as P,Xa as Pa,Xb as Pb,Xc as Pc,Y as Q,Ya as Qa,Yb as Qb,Yc as Qc,Z as R,Za as Ra,Zb as Rb,Zc as Rc,_ as S,_a as Sa,_b as Sb,_c as Sc,a,aa as U,ab as Ua,ac as Ub,ad as Uc,b,ba as V,bb as Va,bc as Vb,bd as Vc,c,ca as W,cb as Wa,cc as Wb,cd as Wc,d,da as X,db as Xa,dc as Xb,dd as Xc,e,ea as Y,eb as Ya,ec as Yb,ed as Yc,f,fa as Z,fb as Za,fc as Zb,fd as Zc,g,ga as _,gb as _a,gc as _b,gd as _c,h,ha as $,hb as $a,hc as $b,hd as $c,i,ia as aa,ib as ab,ic as ac,id as ad,ja as ba,jb as bb,jc as bc,jd as bd,ka as ca,kb as cb,kc as cc,kd as cd,l as j,la as da,lb as db,lc as dc,ld as dd,ma as ea,mb as eb,mc as ec,md as ed,na as fa,nb as fb,nc as fc,nd as fd,oa as ga,ob as gb,oc as gc,od as gd,p as k,pa as ha,pb as hb,pc as hc,pd as hd,q as l,qa as ia,qb as ib,qc as ic,qd as id,r as m,ra as ja,rb as jb,rc as jc,rd as jd,sa as ka,sb as kb,sc as kc,sd as kd,t as n,ta as la,tb as lb,tc as lc,td as ld,u as o,ua as ma,ub as mb,uc as mc,ud as md,v as p,va as na,vb as nb,vc as nc,vd as nd,wa as oa,wb as ob,wc as oc,wd as od,xa as pa,xb as pb,xc as pc,xd as pd,y as q,ya as qa,yb as qb,yc as qc,yd as qd,z as r,za as ra,zb as rb,zc as rc,zd as rd}from"./MWYBF3F3.js";import"./UZLQALHY.js";export{b as $brand,m as $input,l as $output,a as NEVER,p as TimePrecision,Hb as ZodAny,Rb as ZodArray,$a as ZodBase64,bb as ZodBase64URL,wb as ZodBigInt,yb as ZodBigIntFormat,ub as ZodBoolean,Xa as ZodCIDRv4,Za as ZodCIDRv6,Ha as ZodCUID,Ja as ZodCUID2,Mc as ZodCatch,Sc as ZodCodec,ed as ZodCustom,hb as ZodCustomStringFormat,Pb as ZodDate,Ec as ZodDefault,ac as ZodDiscriminatedUnion,db as ZodE164,ra as ZodEmail,Da as ZodEmoji,oc as ZodEnum,_ as ZodError,zc as ZodExactOptional,tc as ZodFile,sd as ZodFirstPartyTypeKind,cd as ZodFunction,ta as ZodGUID,Ra as ZodIPv4,Va as ZodIPv6,W as ZodISODate,V as ZodISODateTime,Y as ZodISODuration,X as ZodISOTime,cc as ZodIntersection,pd as ZodIssueCode,fb as ZodJWT,Pa as ZodKSUID,_c as ZodLazy,rc as ZodLiteral,Ta as ZodMAC,kc as ZodMap,Oc as ZodNaN,Fa as ZodNanoID,Lb as ZodNever,Ic as ZodNonOptional,Fb as ZodNull,Bc as ZodNullable,mb as ZodNumber,ob as ZodNumberFormat,Ub as ZodObject,xc as ZodOptional,Qc as ZodPipe,Gc as ZodPrefault,Vc as ZodPreprocess,ad as ZodPromise,Wc as ZodReadonly,$ as ZodRealError,gc as ZodRecord,mc as ZodSet,oa as ZodString,qa as ZodStringFormat,Kc as ZodSuccess,Bb as ZodSymbol,Yc as ZodTemplateLiteral,vc as ZodTransform,ec as ZodTuple,ma as ZodType,La as ZodULID,Aa as ZodURL,va as ZodUUID,Db as ZodUndefined,Yb as ZodUnion,Jb as ZodUnknown,Nb as ZodVoid,Na as ZodXID,_b as ZodXor,na as _ZodString,Fc as _default,dd as _function,Ib as any,Sb as array,ab as base64,cb as base64url,xb as bigint,vb as boolean,Nc as catch,fd as check,Ya as cidrv4,_a as cidrv6,d as clone,Tc as codec,ud as coerce,c as config,U as core,Ia as cuid,Ka as cuid2,gd as custom,Qb as date,fa as decode,ha as decodeAsync,wd as default,jd as describe,bc as discriminatedUnion,eb as e164,sa as email,Ea as emoji,ea as encode,ga as encodeAsync,K as endsWith,pc as enum,Ac as exactOptional,uc as file,f as flattenError,qb as float32,rb as float64,g as formatError,td as fromJSONSchema,dd as function,rd as getErrorMap,o as globalRegistry,s as gt,t as gte,ua as guid,lb as hash,kb as hex,jb as hostname,Ca as httpUrl,I as includes,ld as instanceof,pb as int,sb as int32,zb as int64,dc as intersection,Uc as invertCodec,Sa as ipv4,Wa as ipv6,Z as iso,nd as json,gb as jwt,Tb as keyof,Qa as ksuid,$c as lazy,E as length,sc as literal,k as locales,Xb as looseObject,jc as looseRecord,G as lowercase,q as lt,r as lte,Ua as mac,lc as map,C as maxLength,z as maxSize,kd as meta,M as mime,D as minLength,A as minSize,y as multipleOf,Pc as nan,Ga as nanoid,qc as nativeEnum,v as negative,Mb as never,x as nonnegative,Jc as nonoptional,w as nonpositive,O as normalize,Gb as null,Cc as nullable,Dc as nullish,nb as number,Vb as object,yc as optional,N as overwrite,aa as parse,ba as parseAsync,ic as partialRecord,Rc as pipe,u as positive,Hc as prefault,od as preprocess,i as prettifyError,bd as promise,L as property,Xc as readonly,hc as record,hd as refine,F as regex,j as regexes,n as registry,ja as safeDecode,la as safeDecodeAsync,ia as safeEncode,ka as safeEncodeAsync,ca as safeParse,da as safeParseAsync,nc as set,qd as setErrorMap,B as size,S as slugify,J as startsWith,Wb as strictObject,pa as string,ib as stringFormat,md as stringbool,Lc as success,id as superRefine,Cb as symbol,Zc as templateLiteral,T as toJSONSchema,Q as toLowerCase,R as toUpperCase,wc as transform,h as treeifyError,P as trim,fc as tuple,tb as uint32,Ab as uint64,Ma as ulid,Eb as undefined,Zb as union,Kb as unknown,H as uppercase,Ba as url,e as util,wa as uuid,xa as uuidv4,ya as uuidv6,za as uuidv7,Ob as void,Oa as xid,$b as xor,vd as z};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as e,b as n}from"./WSGWTIAV.js";import"./PBTINZTK.js";import{g as r,h as i,v as s,z as c}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var l=r`.container{border-radius:var(--calcite-border-radius);margin-bottom:var(--calcite-spacing-md)}.block{margin:0;background-color:var(--calcite-color-foreground-1);width:100%;max-height:300px;overflow:auto}.entry{margin-left:var(--calcite-spacing-sm);padding:var(--calcite-spacing-xxs) var(--calcite-spacing-lg);border-left:1px solid var(--calcite-color-border-1)}`,o=class extends s{constructor(){super(...arguments),this.logEnabled=!1,this.showLog=!1}static{this.properties={logEnabled:5,showLog:5,log:0}}static{this.styles=l}render(){return this.log?.length&&this.showLog&&this.logEnabled?i`<div class="container"><div class="block"><calcite-accordion appearance=transparent icon-position=start icon-type=chevron scale=s>${this.log.map(a=>{let t=a.includes(`
|
|
3
|
+
`)||a.length>70;return i`<calcite-accordion-item .heading=${t?`${a.substring(0,70)}...`:a} .expanded=${t}><div class="entry">${t?e(n(a)):null}</div></calcite-accordion-item>`})}</calcite-accordion></div></div>`:null}};c("arcgis-assistant-message-log",o);export{o as ArcgisAssistantMessageLog};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import e from"./TI7K3I3K.js";import d from"./UK7PR2FE.js";import c from"./EIPHHMWX.js";import b from"./JMODFBN6.js";import{a,c as s}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,o])=>{var t=class extends i{constructor(){super(...arguments),this.agent=o}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=a(this,"arcgis-assistant-data-exploration-agent"),this.#i=s(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-data-exploration-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","views/LinkChartView","rest/knowledgeGraphService",b,c,d,e)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"./
|
|
2
|
+
import"./UZLQALHY.js";var e=`## GIS Agent Orchestrator
|
|
3
3
|
|
|
4
4
|
You are an orchestrator for an ArcGIS Maps SDK for JavaScript system.
|
|
5
5
|
|
|
@@ -97,6 +97,20 @@ Do not reinterpret the request into a different form.
|
|
|
97
97
|
|
|
98
98
|
---
|
|
99
99
|
|
|
100
|
+
## Follow-up Reference Resolution
|
|
101
|
+
|
|
102
|
+
If the latest user request refers to prior results or prior context using a referential phrase such as "these", "those", "them", "that set", "the previous results", "this", "it", "that one", "this parcel", "this location", or "that feature", then the request depends on earlier context.
|
|
103
|
+
|
|
104
|
+
This also applies to equivalent referential wording in other languages.
|
|
105
|
+
|
|
106
|
+
Resolve the reference using the most recent relevant chat history or successful prior step.
|
|
107
|
+
|
|
108
|
+
In this case, the \`assignedTask\` should be standalone and should preserve the referenced prior constraints while adding only the new constraint or question from the latest user request.
|
|
109
|
+
|
|
110
|
+
Do not leave ambiguous references like "these", "those", "them", "this", or "it" in \`assignedTask\` when they can be resolved from context.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
100
114
|
## Assigned Task Guidelines (IMPORTANT)
|
|
101
115
|
|
|
102
116
|
- The \`assignedTask\` must match the user\u2019s request exactly in meaning
|
|
@@ -106,6 +120,8 @@ Do not reinterpret the request into a different form.
|
|
|
106
120
|
|
|
107
121
|
- Keep the task short, specific, and directly executable
|
|
108
122
|
- Keep wording close to the user\u2019s request with minimal transformation
|
|
123
|
+
- When resolving follow-up references, only replace the ambiguous reference with the resolved prior context; keep the rest of the user\u2019s wording as close as possible.
|
|
124
|
+
|
|
109
125
|
- Use only information explicitly present in the user request or provided context
|
|
110
126
|
|
|
111
127
|
- The \`assignedTask\` may represent only part of the user\u2019s request when multiple steps are necessary
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as g}from"./GYVSHAUI.js";import"./F5SUU35Z.js";import"./RLEHNAIA.js";import{h as u,v as c,z as h}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([{watch:_},y,{property:m,subclass:f}])=>{var A=Object.defineProperty,S=Object.getOwnPropertyDescriptor,p=(e,s,i,a)=>{for(var r=a>1?void 0:a?S(s,i):s,t=e.length-1,n;t>=0;t--)(n=e[t])&&(r=(a?n(s,i,r):n(r))||r);return a&&r&&A(s,i,r),r};function l(){return typeof window>"u"?null:window}var o=class extends y{constructor(){super(...arguments),this._utterance=null,this.state="idle",this.supported=o.isSupported()}destroy(){this.stop(),super.destroy()}start(e){let s=e.trim(),i=l(),a=i?.SpeechSynthesisUtterance,r=i?.speechSynthesis;if(this._set("supported",o.isSupported(i)),!s||!a||!r)return;this.stop();let t=new a(s);t.rate=.9,t.pitch=1.1,t.volume=1,t.onend=()=>{this._utterance===t&&this._reset()},t.onerror=()=>{this._utterance===t&&this._reset()};try{r.speak(t),this._utterance=t,this._set("state","playing")}catch{t.onend=null,t.onerror=null,this._reset()}}stop(){let e=l(),s=e?.speechSynthesis;if(this._set("supported",o.isSupported(e)),s)try{(s.speaking||s.pending)&&s.cancel()}catch{}this._reset()}toggle(e){if(this.state==="playing"){this.stop();return}this.start(e)}static isSupported(e=l()){return!!e?.speechSynthesis&&typeof e.SpeechSynthesisUtterance=="function"}_reset(){this._utterance&&(this._utterance.onend=null,this._utterance.onerror=null),this._utterance=null,this._set("state","idle")}};p([m({readOnly:!0})],o.prototype,"state",2);p([m({readOnly:!0})],o.prototype,"supported",2);o=p([f("ReadAloudController")],o);var d=class extends c{constructor(){super(...arguments),this._messages=g({blocking:!0}),this._readAloudController=new o,this.readAloudEnabled=!1}static{this.properties={readAloudEnabled:5,message:0}}loaded(){this.manager.onLifecycle(()=>[_(()=>this._readAloudController.state,()=>this.requestUpdate(),{initial:!0}),{remove:()=>{this._readAloudController.stop()}}])}_toggleReadAloud(){this._readAloudController.toggle(this.message?.content??"")}render(){return this.readAloudEnabled&&!this.message?.error&&this.message?.content?.trim()&&this._readAloudController.supported?u`<calcite-action id=action-read-aloud .icon=${this._readAloudController.state==="playing"?"sound-off":"sound"} scale=s .active=${this._readAloudController.state==="playing"} @click=${()=>this._toggleReadAloud()} text></calcite-action><calcite-tooltip reference-element=action-read-aloud overlay-positioning=fixed placement=bottom><span>${this._readAloudController.state==="playing"?this._messages.stopReadingButtonLabel:this._messages.readAloudButtonLabel}</span></calcite-tooltip>`:null}};h("arcgis-assistant-message-read-aloud",d);return d},"core/reactiveUtils","core/Accessor","core/accessorSupport/decorators")
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import a from"./3OH4DXSY.js";import"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:p},{c:d,d:u}])=>{var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,r,n,o)=>{for(var t=o>1?void 0:o?w(r,n):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,n,t):a(t))||t);return o&&t&&f(r,n,t),t},s=class extends u{constructor(e){super(e)}getAgents(){return this.agents}buildNodes(e){let r=super.buildNodes(e);return r[l]=()=>({}),r}buildEdges(e){let r=this.condition;if(!r)throw new Error("ConditionalWorkflow requires a condition.");let n=d(e[0],0),o=d(e[1],1);return[{from:l,decide:async(t,i)=>await Promise.resolve(r(t,i))?n:o}]}getEntryNode(){return l}isTerminalAgent(){return!0}validateAgents(e){if(super.validateAgents(e),e.length!==2)throw new Error(`ConditionalWorkflow requires exactly 2 agents; received ${e.length}.`)}};c([g()],s.prototype,"condition",2);c([g()],s.prototype,"agents",2);s=c([p("ConditionalWorkflow")],s);var l="__conditional_decide";return s},"core/accessorSupport/decorators",a)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import a from"./3OH4DXSY.js";import"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:y},{c:p,d:w}])=>{var b=Object.defineProperty,k=Object.getOwnPropertyDescriptor,v=e=>{throw TypeError(e)},h=(e,t,r,s)=>{for(var n=s>1?void 0:s?k(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(n=(s?a(t,r,n):a(n))||n);return s&&n&&b(t,r,n),n},A=(e,t,r)=>t.has(e)||v("Cannot "+r),M=(e,t,r)=>t.has(e)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),m=(e,t,r)=>(A(e,t,"access private method"),r),c,u,i=class extends w{constructor(e){super(e),M(this,c)}getAgents(){let e=Object.values(this.agentsMap);return this.defaultAgent?e.concat(this.defaultAgent):e}buildNodes(e){let t=super.buildNodes(e);return t[d]=()=>({}),t}buildEdges(e){m(this,c,u).call(this);let t=this.resolver,r=new Map;for(let[o,[a]]of Object.entries(this.agentsMap).entries())r.set(a,p(e[o],o));let{defaultAgent:s}=this,n=s?p(s,e.length-1):void 0;return[{from:d,decide:async(o,a)=>{let l=await Promise.resolve(t(o,a));if(!l)return;let f=r.get(l);if(f)return f;if(s)return n;throw new Error(`SwitchWorkflow resolver returned unknown case: ${l}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`)}}]}getEntryNode(){return d}isTerminalAgent(){return!0}validateAgents(e){m(this,c,u).call(this),super.validateAgents(e)}};c=new WeakSet;u=function(){if(!Object.keys(this.agentsMap).length)throw new Error("SwitchWorkflow requires a non-empty agentsMap.")};h([g()],i.prototype,"agentsMap",2);h([g()],i.prototype,"resolver",2);h([g()],i.prototype,"defaultAgent",2);i=h([y("SwitchWorkflow")],i);var d="__switch_decide";return i},"core/accessorSupport/decorators",a)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import a from"./3OH4DXSY.js";import{a as C,c as N}from"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:B,subclass:D},{a:h,b:S,c:p,d:A}])=>{var G=Object.defineProperty,z=Object.getOwnPropertyDescriptor,P=(t,e,s,n)=>{for(var r=n>1?void 0:n?z(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(n?a(e,s,r):a(r))||r);return n&&r&&G(e,s,r),r},x=class extends A{constructor(t){super(t)}getAgents(){return this.agents}generate(){let t=this.getAgents();this.validateAgents(t);for(let o of t)o.generate();let e=S(t.flatMap(o=>o.getSchemas()));for(let[o]of t.entries())e[_(o)]=void 0;let s=C(e),n=this.buildNodes(t),r=this.buildEdges(t);return{workspace:s,createGraph:()=>N(n,r,s,{entryNode:this.getEntryNode(t)})}}getEntryNode(t){return y}isTerminalAgent(t,e){return!1}buildNodes(t){let e={};for(let[s,n]of t.entries()){let r=_(s),o=p(n,s);e[o]=async(a,u)=>{let l=await n.run(F(a,n),u),i={},m=i;return m[r]=l,i}}return e[y]=()=>({}),e[k]=s=>R(s,t),e}buildEdges(t){return[...t.map((e,s)=>({from:y,to:p(e,s)})),...t.map((e,s)=>({from:p(e,s),to:k}))]}};P([B()],x.prototype,"agents",2);x=P([D("ParallelWorkflow")],x);var y="__parallel_fanOut",k="__parallel_join";function _(t){return`__parallel_update_${t}`}function W(t,e){return Object.fromEntries(e.filter(s=>Object.hasOwn(t,s)).map(s=>[s,t[s]]))}function F(t,e){let s=e.inputSchema;return s?{...W(t,h(s)),agentExecutionContext:t.agentExecutionContext,outputMessage:t.outputMessage,status:void 0,summary:""}:{...t,status:void 0,summary:""}}function I(t,e){return t.outputSchema?W(e,h(t.outputSchema)):{}}function K(t,e){let s=t.agentExecutionContext?.messages??[],n=e.agentExecutionContext?.messages??[];return n.length>s.length?n.slice(s.length):void 0}function R(t,e){let s=[],n=[],r=[],o={},a={},u=new Set;for(let[m,J]of e.entries()){let E=_(m),d=t[E];if(a[E]=void 0,!d||typeof d!="object")continue;let c=d,b=c.outputMessage,O=K(t,c),v=c.summary,$=I(J,c),w=b.trim();typeof b=="string"&&w&&s.push(w);let j=v.trim();typeof v=="string"&&j&&n.push(j),Array.isArray(O)&&r.push(...O),c.status&&u.add(c.status);for(let[f,g]of Object.entries($))if(!(g===void 0||f.startsWith("__parallel_update_"))&&!M(t[f],g)){if(!Object.hasOwn(o,f)){o[f]=g;continue}if(!M(o[f],g))throw new Error(`ParallelWorkflow detected conflicting updates for state key "${f}".`)}}let l={...a,...o},i=l;return r.length>0&&(i.agentExecutionContext={...t.agentExecutionContext,messages:[...t.agentExecutionContext.messages,...r]}),s.length&&(i.outputMessage=s.join(`
|
|
3
|
+
|
|
4
|
+
`)),n.length&&(i.summary=n.join(`
|
|
5
|
+
|
|
6
|
+
`)),u.size&&(i.status=u.has("failed")?"failed":u.has("success")?"success":void 0),l}function M(t,e){return t===e?!0:t&&e?JSON.stringify(t)===JSON.stringify(e):!1}return x},"core/accessorSupport/decorators",a)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"./
|
|
2
|
+
import"./UZLQALHY.js";var e=`## ArcgisKnowledge Agent - Lucene Generation for Graph Search
|
|
3
3
|
|
|
4
4
|
You are an assistant that generates a lucene query for graph query searching.
|
|
5
5
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import a from"./3OH4DXSY.js";import"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:l,subclass:w},{c:p,d:d}])=>{var y=Object.defineProperty,m=Object.getOwnPropertyDescriptor,f=e=>{throw TypeError(e)},h=(e,t,o,n)=>{for(var r=n>1?void 0:n?m(t,o):t,s=e.length-1,g;s>=0;s--)(g=e[s])&&(r=(n?g(t,o,r):g(r))||r);return n&&r&&y(t,o,r),r},k=(e,t,o)=>t.has(e)||f("Cannot "+o),b=(e,t,o)=>t.has(e)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),c=(e,t,o)=>(k(e,t,"access private method"),o),a,i,u=class extends d{constructor(e){super(e),b(this,a)}getAgents(){return c(this,a,i).call(this),[this.routerAgent,...Object.values(this.agentsMap)]}buildEdges(e){c(this,a,i).call(this);let t=p(this.routerAgent,0),o=new Map;for(let[n,[r]]of Object.entries(this.agentsMap).entries())o.set(r,p(e[n+1],n+1));return[{from:t,decide:n=>{let r=n[this.routerOutputKey];if(typeof r!="string"||!r)throw new Error("RouterWorkflow decideRoute could not determine next agent from state.");let s=o.get(r);if(!s)throw new Error(`RouterWorkflow decideRoute returned unknown agent: ${r}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`);return s}}]}getEntryNode(){return c(this,a,i).call(this),p(this.routerAgent,0)}isTerminalAgent(e,t){return t>0}validateAgents(e){c(this,a,i).call(this),super.validateAgents(e)}};a=new WeakSet;i=function(){if(!Object.keys(this.agentsMap).length)throw new Error("RouterWorkflow requires a non-empty agentsMap.")};h([l()],u.prototype,"agentsMap",2);h([l()],u.prototype,"routerAgent",2);h([l()],u.prototype,"routerOutputKey",2);u=h([w("RouterWorkflow")],u);return u},"core/accessorSupport/decorators",a)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{g as e,h as t,v as r,z as a}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var p=e`.interrupt-details ul{margin-block:var(--calcite-spacing-xxs) 0;padding-inline-start:var(--calcite-spacing-xxl)}.interrupt-details li{margin-block:0}.interrupts-container{display:flex;flex-direction:column;gap:var(--calcite-spacing-lg)}`,s=class extends r{static{this.properties={interrupts:0}}static{this.styles=p}render(){return this.interrupts?.length?t`<calcite-block collapsible expanded heading="Assistant Questions"><div class="interrupts-container">${this.interrupts?.map(({interrupt:l,response:i})=>t`<div class="interrupt-details"><div>Q: ${l.message}</div><ul>${Array.isArray(i)?i.length?i.map(n=>t`<li>${n}</li>`):t`<li>(Question skipped)</li>`:t`<li>${i!=null?String(i):"(Question skipped)"}</li>`}</ul></div>`)}</div></calcite-block>`:null}};a("arcgis-assistant-interrupt-preview",s);export{s as ArcgisAssistantInterruptPreview};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import c from"./SKXDXIQO.js";import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as s,c as e}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,o])=>{var t=class extends i{constructor(){super(...arguments),this.agent=o}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-help-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-help-agent"),this.#i=e(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-help-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c)
|