@arcgis/ai-components 5.2.0-next.10 → 5.2.0-next.11
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/WorkflowAgent.d.ts +2 -2
- package/dist/agent-utils/index.d.ts +99 -0
- package/dist/agent-utils/index.js +148 -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 +30 -1
- 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/{VMXLYWUK.js → 24QNMEFG.js} +1 -1
- package/dist/cdn/{D2N2NSRQ.js → 34SG44C3.js} +1 -1
- package/dist/cdn/3JGWGKT6.js +2 -0
- package/dist/cdn/{CCY4TSBO.js → 3NBDVZ2I.js} +1 -1
- package/dist/cdn/3VOQD2MR.js +2 -0
- package/dist/cdn/{BIV2IPHH.js → 53NTYC4I.js} +1 -1
- package/dist/cdn/{MODWHY3R.js → 5CV7R5IS.js} +6 -4
- package/dist/cdn/{FL4W4VYN.js → 6ZW7Z36F.js} +16 -0
- package/dist/cdn/7CYGX4F4.js +2 -0
- package/dist/cdn/{2SJAOYZT.js → AZGGTNA3.js} +1 -1
- package/dist/cdn/{EGHBXLNG.js → B7WJFBOZ.js} +1 -1
- package/dist/cdn/BX7FSMUU.js +56 -0
- package/dist/cdn/CHPQM77M.js +181 -0
- package/dist/cdn/DHKUXLU3.js +179 -0
- package/dist/cdn/DQSEBKOX.js +2 -0
- package/dist/cdn/DXVU45KM.js +2 -0
- package/dist/cdn/{XER22VYQ.js → DZ2QWNUA.js} +1 -1
- package/dist/cdn/EBISDZ5H.js +2 -0
- package/dist/cdn/{VNQN5ZQO.js → ERL2CB2Y.js} +5 -5
- package/dist/cdn/{SWOXSJ62.js → F6QHMKF5.js} +1 -1
- package/dist/cdn/FUIGPHBH.js +2 -0
- package/dist/cdn/{CTSALWEP.js → H2CHHGGH.js} +1 -1
- package/dist/cdn/{6AWNQHCO.js → HWKDNS4K.js} +1 -1
- package/dist/cdn/IMQ4TVHF.js +16 -0
- package/dist/cdn/IOD3GDA7.js +2 -0
- package/dist/cdn/IR7PTESF.js +2 -0
- package/dist/cdn/{EEUCKMU7.js → IRZDTYO2.js} +1 -1
- package/dist/cdn/JIWK6QK6.js +2 -0
- package/dist/cdn/{EWI4V3GQ.js → JLKGS6Y5.js} +11 -11
- package/dist/cdn/K3JCH4XW.js +2 -0
- package/dist/cdn/{WIDTPVSU.js → KHXUWZHB.js} +1 -1
- package/dist/cdn/LIFK3QSD.js +2 -0
- package/dist/cdn/{JOFUPKIB.js → O3EN27N5.js} +1 -1
- package/dist/cdn/O3RFFPU3.js +6 -0
- package/dist/cdn/P7DG5T3Z.js +9 -0
- package/dist/cdn/{OIVRK7HT.js → PBO6FZN6.js} +1 -1
- package/dist/cdn/Q3ZW4FYA.js +3 -0
- package/dist/cdn/Q6LRANX6.js +2 -0
- package/dist/cdn/Q7TL5Q5N.js +2 -0
- package/dist/cdn/{KUEOKIQR.js → QCSN44H4.js} +1 -1
- package/dist/cdn/R56X6ZKR.js +161 -0
- package/dist/cdn/T43LEBBE.js +47 -0
- package/dist/cdn/TR4GFL7X.js +2 -0
- package/dist/cdn/{D3TNNRP4.js → UPEEHMSY.js} +1 -1
- package/dist/cdn/{GTLS44GI.js → WAIFKDR3.js} +1 -1
- package/dist/cdn/WNS5ZUF5.js +2 -0
- package/dist/cdn/X4XY5HIE.js +2 -0
- package/dist/cdn/XOH56EQ2.js +2 -0
- package/dist/cdn/{64PJB5NU.js → XON27U6U.js} +1 -1
- package/dist/cdn/{DOV5ZJ7M.js → YLN2BZ5J.js} +1 -1
- package/dist/cdn/{OBUZ7HBN.js → YUKR4AZW.js} +1 -1
- package/dist/cdn/{TSZPHE7L.js → Z2G7MP5L.js} +3 -3
- package/dist/cdn/ZEYIBYSF.js +66 -0
- 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/chunks/adapter.js +1379 -1307
- package/dist/chunks/arcgisKnowledgeGraph.js +109 -72
- package/dist/chunks/dataExplorationGraph.js +8 -3
- package/dist/chunks/generateLayerDescriptions.js +228 -217
- package/dist/chunks/helpGraph.js +14 -11
- package/dist/chunks/index.js +11 -0
- package/dist/chunks/intent_prompt.js +16 -0
- package/dist/chunks/layerStylingGraph.js +25 -22
- package/dist/chunks/navigationGraph.js +7 -3
- package/dist/chunks/orchestrator.js +9 -8
- package/dist/chunks/toolCallResponse.js +5 -3
- package/dist/components/arcgis-assistant/customElement.js +1 -0
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/orchestrator/registry/agentRegistry.d.ts +33 -0
- package/dist/utils/index.d.ts +5 -4
- package/dist/utils/index.js +48 -47
- package/package.json +5 -4
- package/dist/cdn/462JBSEV.js +0 -422
- package/dist/cdn/ETRWZ3MS.js +0 -108
- package/dist/cdn/I6HNBTWY.js +0 -2
- package/dist/cdn/JBHNHHWO.js +0 -3
- package/dist/cdn/LKRAPK4A.js +0 -165
- package/dist/cdn/RVOAPUBN.js +0 -2
- package/dist/cdn/VAZNJSKA.js +0 -16
|
@@ -18,7 +18,7 @@ export type FunctionAgentExecute<TInput extends AgentData, TOutput extends Agent
|
|
|
18
18
|
* @since 5.1
|
|
19
19
|
*/
|
|
20
20
|
export class FunctionAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData> extends BaseAgent<AgentCustomState<TInput, TOutput>> {
|
|
21
|
-
constructor(properties?:
|
|
21
|
+
constructor(properties?: FunctionAgentConstructProperties<TInput, TOutput>);
|
|
22
22
|
/**
|
|
23
23
|
* The execute function contains the core logic of the FunctionAgent.
|
|
24
24
|
* It receives the current agent state and an optional execution configuration,
|
|
@@ -60,5 +60,5 @@ export class FunctionAgent<TInput extends AgentData = AgentData, TOutput extends
|
|
|
60
60
|
initialize(): void;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export type
|
|
63
|
+
export type FunctionAgentConstructProperties<TInput extends AgentData, TOutput extends AgentData> = Partial<Pick<FunctionAgent<TInput, TOutput>, "description" | "inputSchema" | "middlewares" | "outputSchema">>
|
|
64
64
|
& Pick<FunctionAgent<TInput, TOutput>, "execute" | "name">;
|
|
@@ -9,7 +9,7 @@ import type { AgentCustomState, AgentData, ZodObjectSchema } from "./types.js";
|
|
|
9
9
|
* @since 5.1
|
|
10
10
|
*/
|
|
11
11
|
export class LLMAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData> extends BaseAgent<AgentCustomState<TInput, TOutput>> {
|
|
12
|
-
constructor(properties?:
|
|
12
|
+
constructor(properties?: LLMAgentConstructProperties<TInput, TOutput>);
|
|
13
13
|
/**
|
|
14
14
|
* The inputSchema property is an optional Zod schema describing the expected structured input for the agent.
|
|
15
15
|
* This can be used for validation of the input state before execution and also to extract variables from the input
|
|
@@ -61,5 +61,5 @@ export class LLMAgent<TInput extends AgentData = AgentData, TOutput extends Agen
|
|
|
61
61
|
initialize(): void;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export type
|
|
64
|
+
export type LLMAgentConstructProperties<TInput extends AgentData, TOutput extends AgentData> = Partial<Pick<LLMAgent<TInput, TOutput>, "description" | "inputSchema" | "middlewares" | "modelTier" | "outputSchema" | "tools">>
|
|
65
65
|
& Pick<LLMAgent<TInput, TOutput>, "name" | "prompt">;
|
|
@@ -9,7 +9,7 @@ import type { AgentData, ZodObjectSchema } from "./types.js";
|
|
|
9
9
|
* @since 5.1
|
|
10
10
|
*/
|
|
11
11
|
export class WorkflowAgent<TState extends AgentData = AgentData> extends BaseAgent<TState> {
|
|
12
|
-
constructor(properties:
|
|
12
|
+
constructor(properties: WorkflowAgentConstructProperties<TState>);
|
|
13
13
|
/** Optional structured input schema for the workflow wrapper. */
|
|
14
14
|
accessor inputSchema: ZodObjectSchema<object> | undefined;
|
|
15
15
|
/** Optional structured output schema for the workflow wrapper. */
|
|
@@ -40,5 +40,5 @@ export class WorkflowAgent<TState extends AgentData = AgentData> extends BaseAge
|
|
|
40
40
|
initialize(): void;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export type
|
|
43
|
+
export type WorkflowAgentConstructProperties<TState extends AgentData = AgentData> = Partial<Pick<WorkflowAgent<TState>, "description" | "inputSchema" | "middlewares" | "outputSchema">>
|
|
44
44
|
& Pick<WorkflowAgent<TState>, "name" | "workflow">;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { FunctionAgent, FunctionAgentConstructProperties } from "./FunctionAgent.js";
|
|
2
|
+
import type { LLMAgent, LLMAgentConstructProperties } from "./LLMAgent.js";
|
|
3
|
+
import type { WorkflowAgent, WorkflowAgentConstructProperties } from "./WorkflowAgent.js";
|
|
4
|
+
import type { AgentData, SchemaDefinition, SchemaDefinitionData, ZodObjectSchema } from "./types.js";
|
|
5
|
+
import type { FunctionTool, FunctionToolConstructProperties } from "./tools/FunctionTool.js";
|
|
6
|
+
import type { ConditionalWorkflow, ConditionalWorkflowConstructProperties } from "./workflows/ConditionalWorkflow.js";
|
|
7
|
+
import type { LoopWorkflow, LoopWorkflowConstructProperties } from "./workflows/LoopWorkflow.js";
|
|
8
|
+
import type { ParallelWorkflow, ParallelWorkflowConstructProperties } from "./workflows/ParallelWorkflow.js";
|
|
9
|
+
import type { RouterWorkflow, RouterWorkflowConstructProperties } from "./workflows/RouterWorkflow.js";
|
|
10
|
+
import type { SequentialWorkflow, SequentialWorkflowConstructProperties } from "./workflows/SequentialWorkflow.js";
|
|
11
|
+
import type { SwitchWorkflow, SwitchWorkflowConstructProperties } from "./workflows/SwitchWorkflow.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a Zod schema from a plain object schema definition.
|
|
15
|
+
*
|
|
16
|
+
* @param definition
|
|
17
|
+
* @since 5.1
|
|
18
|
+
*/
|
|
19
|
+
export function createSchema<const TDefinition extends SchemaDefinition>(definition: TDefinition): Promise<ZodObjectSchema<SchemaDefinitionData<TDefinition>>>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates a FunctionAgent instance from the existing agent implementation.
|
|
23
|
+
*
|
|
24
|
+
* @param properties
|
|
25
|
+
* @since 5.1
|
|
26
|
+
*/
|
|
27
|
+
export function createFunctionAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>(properties: FunctionAgentConstructProperties<TInput, TOutput>): Promise<FunctionAgent<TInput, TOutput>>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates a FunctionTool instance from the existing tool implementation.
|
|
31
|
+
*
|
|
32
|
+
* @param properties
|
|
33
|
+
* @since 5.1
|
|
34
|
+
*/
|
|
35
|
+
export function createFunctionTool<TInput extends AgentData, TOutput = unknown>(properties: FunctionToolConstructProperties<TInput, TOutput>): Promise<FunctionTool<TInput, TOutput>>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Creates an LLMAgent instance from the existing agent implementation.
|
|
39
|
+
*
|
|
40
|
+
* @param properties
|
|
41
|
+
* @since 5.1
|
|
42
|
+
*/
|
|
43
|
+
export function createLLMAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>(properties: LLMAgentConstructProperties<TInput, TOutput>): Promise<LLMAgent<TInput, TOutput>>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Creates a WorkflowAgent instance from the existing workflow agent implementation.
|
|
47
|
+
*
|
|
48
|
+
* @param properties
|
|
49
|
+
* @since 5.1
|
|
50
|
+
*/
|
|
51
|
+
export function createWorkflowAgent<TState extends AgentData = AgentData>(properties: WorkflowAgentConstructProperties<TState>): Promise<WorkflowAgent<TState>>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Creates a ConditionalWorkflow instance from the existing workflow implementation.
|
|
55
|
+
*
|
|
56
|
+
* @param properties
|
|
57
|
+
* @since 5.1
|
|
58
|
+
*/
|
|
59
|
+
export function createConditionalWorkflow<TState extends AgentData = AgentData>(properties: ConditionalWorkflowConstructProperties<TState>): Promise<ConditionalWorkflow<TState>>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Creates a LoopWorkflow instance from the existing workflow implementation.
|
|
63
|
+
*
|
|
64
|
+
* @param properties
|
|
65
|
+
* @since 5.1
|
|
66
|
+
*/
|
|
67
|
+
export function createLoopWorkflow<TState extends AgentData = AgentData>(properties: LoopWorkflowConstructProperties<TState>): Promise<LoopWorkflow<TState>>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Creates a ParallelWorkflow instance from the existing workflow implementation.
|
|
71
|
+
*
|
|
72
|
+
* @param properties
|
|
73
|
+
* @since 5.1
|
|
74
|
+
*/
|
|
75
|
+
export function createParallelWorkflow<TState extends AgentData = AgentData>(properties: ParallelWorkflowConstructProperties<TState>): Promise<ParallelWorkflow<TState>>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Creates a RouterWorkflow instance from the existing workflow implementation.
|
|
79
|
+
*
|
|
80
|
+
* @param properties
|
|
81
|
+
* @since 5.1
|
|
82
|
+
*/
|
|
83
|
+
export function createRouterWorkflow<TState extends AgentData = AgentData>(properties: RouterWorkflowConstructProperties<TState>): Promise<RouterWorkflow<TState>>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Creates a SequentialWorkflow instance from the existing workflow implementation.
|
|
87
|
+
*
|
|
88
|
+
* @param properties
|
|
89
|
+
* @since 5.1
|
|
90
|
+
*/
|
|
91
|
+
export function createSequentialWorkflow<TState extends AgentData = AgentData>(properties: SequentialWorkflowConstructProperties<TState>): Promise<SequentialWorkflow<TState>>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Creates a SwitchWorkflow instance from the existing workflow implementation.
|
|
95
|
+
*
|
|
96
|
+
* @param properties
|
|
97
|
+
* @since 5.1
|
|
98
|
+
*/
|
|
99
|
+
export function createSwitchWorkflow<TState extends AgentData = AgentData>(properties: SwitchWorkflowConstructProperties<TState>): Promise<SwitchWorkflow<TState>>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
let r, a, i, c, u, l, s, w, f, m, p;
|
|
3
|
+
async function n(o, e) {
|
|
4
|
+
if (e in o)
|
|
5
|
+
return o[e];
|
|
6
|
+
if ("default" in o) {
|
|
7
|
+
const t = await o.default;
|
|
8
|
+
return typeof t == "object" && t !== null && e in t ? t[e] : t;
|
|
9
|
+
}
|
|
10
|
+
throw new Error(`Unable to resolve ${String(e)} from module.`);
|
|
11
|
+
}
|
|
12
|
+
function k(o, e) {
|
|
13
|
+
const t = {};
|
|
14
|
+
for (const [d, W] of Object.entries(e))
|
|
15
|
+
t[d] = g(o, W);
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
18
|
+
function h(o, e) {
|
|
19
|
+
return o.object(k(o, e));
|
|
20
|
+
}
|
|
21
|
+
function g(o, e) {
|
|
22
|
+
const t = y(o, e);
|
|
23
|
+
return e.required === !0 ? t : t.optional();
|
|
24
|
+
}
|
|
25
|
+
function y(o, e) {
|
|
26
|
+
let t = P(o, e);
|
|
27
|
+
return e.description !== void 0 && (t = t.describe(e.description)), t;
|
|
28
|
+
}
|
|
29
|
+
function M(o, e) {
|
|
30
|
+
switch (e) {
|
|
31
|
+
case "string":
|
|
32
|
+
return o.string();
|
|
33
|
+
case "number":
|
|
34
|
+
return o.number();
|
|
35
|
+
case "boolean":
|
|
36
|
+
return o.boolean();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function P(o, e) {
|
|
40
|
+
switch (e.type) {
|
|
41
|
+
case "string": {
|
|
42
|
+
if (e.enum !== void 0) {
|
|
43
|
+
if (e.enum.length === 0)
|
|
44
|
+
throw new Error("String schema field enum must include at least one value.");
|
|
45
|
+
return o.enum(e.enum);
|
|
46
|
+
}
|
|
47
|
+
return o.string();
|
|
48
|
+
}
|
|
49
|
+
case "number":
|
|
50
|
+
return o.number();
|
|
51
|
+
case "boolean":
|
|
52
|
+
return o.boolean();
|
|
53
|
+
case "array": {
|
|
54
|
+
if (e.itemType === void 0)
|
|
55
|
+
throw new Error("Array schema field requires an itemType definition.");
|
|
56
|
+
return o.array(M(o, e.itemType));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function S(o) {
|
|
61
|
+
p ??= import("zod");
|
|
62
|
+
const e = await p;
|
|
63
|
+
return h(e.z, o);
|
|
64
|
+
}
|
|
65
|
+
async function b(o) {
|
|
66
|
+
r ??= import("./FunctionAgent.js");
|
|
67
|
+
const e = await r, t = await n(
|
|
68
|
+
e,
|
|
69
|
+
"FunctionAgent"
|
|
70
|
+
);
|
|
71
|
+
return new t(o);
|
|
72
|
+
}
|
|
73
|
+
async function A(o) {
|
|
74
|
+
a ??= import("./tools/FunctionTool.js");
|
|
75
|
+
const e = await a, t = await n(
|
|
76
|
+
e,
|
|
77
|
+
"FunctionTool"
|
|
78
|
+
);
|
|
79
|
+
return new t(o);
|
|
80
|
+
}
|
|
81
|
+
async function L(o) {
|
|
82
|
+
i ??= import("./LLMAgent.js");
|
|
83
|
+
const e = await i, t = await n(e, "LLMAgent");
|
|
84
|
+
return new t(o);
|
|
85
|
+
}
|
|
86
|
+
async function q(o) {
|
|
87
|
+
c ??= import("./WorkflowAgent.js");
|
|
88
|
+
const e = await c, t = await n(
|
|
89
|
+
e,
|
|
90
|
+
"WorkflowAgent"
|
|
91
|
+
);
|
|
92
|
+
return new t(o);
|
|
93
|
+
}
|
|
94
|
+
async function F(o) {
|
|
95
|
+
u ??= import("./workflows/ConditionalWorkflow.js");
|
|
96
|
+
const e = await u, t = await n(e, "ConditionalWorkflow");
|
|
97
|
+
return new t(o);
|
|
98
|
+
}
|
|
99
|
+
async function T(o) {
|
|
100
|
+
l ??= import("./workflows/LoopWorkflow.js");
|
|
101
|
+
const e = await l, t = await n(
|
|
102
|
+
e,
|
|
103
|
+
"LoopWorkflow"
|
|
104
|
+
);
|
|
105
|
+
return new t(o);
|
|
106
|
+
}
|
|
107
|
+
async function v(o) {
|
|
108
|
+
s ??= import("./workflows/ParallelWorkflow.js");
|
|
109
|
+
const e = await s, t = await n(
|
|
110
|
+
e,
|
|
111
|
+
"ParallelWorkflow"
|
|
112
|
+
);
|
|
113
|
+
return new t(o);
|
|
114
|
+
}
|
|
115
|
+
async function E(o) {
|
|
116
|
+
w ??= import("./workflows/RouterWorkflow.js");
|
|
117
|
+
const e = await w, t = await n(
|
|
118
|
+
e,
|
|
119
|
+
"RouterWorkflow"
|
|
120
|
+
);
|
|
121
|
+
return new t(o);
|
|
122
|
+
}
|
|
123
|
+
async function j(o) {
|
|
124
|
+
f ??= import("./workflows/SequentialWorkflow.js");
|
|
125
|
+
const e = await f, t = await n(e, "SequentialWorkflow");
|
|
126
|
+
return new t(o);
|
|
127
|
+
}
|
|
128
|
+
async function R(o) {
|
|
129
|
+
m ??= import("./workflows/SwitchWorkflow.js");
|
|
130
|
+
const e = await m, t = await n(
|
|
131
|
+
e,
|
|
132
|
+
"SwitchWorkflow"
|
|
133
|
+
);
|
|
134
|
+
return new t(o);
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
F as createConditionalWorkflow,
|
|
138
|
+
b as createFunctionAgent,
|
|
139
|
+
A as createFunctionTool,
|
|
140
|
+
L as createLLMAgent,
|
|
141
|
+
T as createLoopWorkflow,
|
|
142
|
+
v as createParallelWorkflow,
|
|
143
|
+
E as createRouterWorkflow,
|
|
144
|
+
S as createSchema,
|
|
145
|
+
j as createSequentialWorkflow,
|
|
146
|
+
R as createSwitchWorkflow,
|
|
147
|
+
q as createWorkflowAgent
|
|
148
|
+
};
|
|
@@ -1,50 +1,42 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import "
|
|
3
|
-
import "@
|
|
4
|
-
import "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import "@arcgis/core/request.js";
|
|
11
|
-
import "@langchain/core/prompts";
|
|
12
|
-
import { createAgentMiddleware as c, createToolMiddleware as m } from "./middleware.js";
|
|
13
|
-
const d = "agent-trace", g = "tool-trace";
|
|
14
|
-
function $() {
|
|
15
|
-
return c(d, {
|
|
16
|
-
wrapModelCall: async (t, o) => {
|
|
17
|
-
const e = await o(t), a = t.runtime, i = p(e);
|
|
2
|
+
import { s as r } from "../../chunks/index.js";
|
|
3
|
+
import { AIMessage as i, ToolMessage as s } from "@langchain/core/messages";
|
|
4
|
+
import { createAgentMiddleware as c, createToolMiddleware as d } from "./middleware.js";
|
|
5
|
+
const g = "agent-trace", f = "tool-trace";
|
|
6
|
+
function p() {
|
|
7
|
+
return c(g, {
|
|
8
|
+
wrapModelCall: async (e, a) => {
|
|
9
|
+
const t = await a(e), o = e.runtime, l = m(t);
|
|
18
10
|
return await Promise.all(
|
|
19
|
-
|
|
20
|
-
async (
|
|
11
|
+
l.map(
|
|
12
|
+
async (n) => await r(
|
|
21
13
|
{
|
|
22
|
-
text: `LLM requested tool call "${
|
|
14
|
+
text: `LLM requested tool call "${n.name}" with arguments: ${JSON.stringify(n.args, null, 2)}`
|
|
23
15
|
},
|
|
24
|
-
|
|
16
|
+
o
|
|
25
17
|
)
|
|
26
18
|
)
|
|
27
|
-
),
|
|
19
|
+
), t;
|
|
28
20
|
}
|
|
29
21
|
});
|
|
30
22
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
33
|
-
wrapToolCall: async (
|
|
34
|
-
const
|
|
35
|
-
return await
|
|
23
|
+
function T() {
|
|
24
|
+
return d(f, {
|
|
25
|
+
wrapToolCall: async (e, a) => {
|
|
26
|
+
const t = await a(e), o = e.config;
|
|
27
|
+
return await r(
|
|
36
28
|
{
|
|
37
|
-
text: `Finished executing tool: ${s.isInstance(
|
|
29
|
+
text: `Finished executing tool: ${s.isInstance(t) ? t.content.toString() : typeof t == "string" ? t : e.tool.name}`
|
|
38
30
|
},
|
|
39
|
-
|
|
40
|
-
),
|
|
31
|
+
o
|
|
32
|
+
), t;
|
|
41
33
|
}
|
|
42
34
|
});
|
|
43
35
|
}
|
|
44
|
-
function
|
|
45
|
-
return !
|
|
36
|
+
function m(e) {
|
|
37
|
+
return !i.isInstance(e) || !Array.isArray(e.tool_calls) ? [] : e.tool_calls.filter((a) => typeof a?.name == "string");
|
|
46
38
|
}
|
|
47
39
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
p as createAgentTraceMiddleware,
|
|
41
|
+
T as createToolTraceMiddleware
|
|
50
42
|
};
|
|
@@ -59,7 +59,7 @@ export interface FunctionToolLike {
|
|
|
59
59
|
* @since 5.1
|
|
60
60
|
*/
|
|
61
61
|
export class FunctionTool<TInput extends AgentData, TOutput = unknown> extends Accessor {
|
|
62
|
-
constructor(properties?:
|
|
62
|
+
constructor(properties?: FunctionToolConstructProperties<TInput, TOutput>);
|
|
63
63
|
/**
|
|
64
64
|
* A concise, but clear description of the tool's functionality.
|
|
65
65
|
* This should provide enough information for the agent to understand when and why to use the tool.
|
|
@@ -123,5 +123,5 @@ export interface FunctionToolMiddlewareTool {
|
|
|
123
123
|
resultMode: ToolResultMode;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
export type
|
|
126
|
+
export type FunctionToolConstructProperties<TInput extends AgentData, TOutput> = Partial<Pick<FunctionTool<TInput, TOutput>, "inputSchema" | "middlewares" | "outputSchema" | "resultMode">>
|
|
127
127
|
& Pick<FunctionTool<TInput, TOutput>, "description" | "execute" | "name">;
|
|
@@ -9,6 +9,33 @@ export type AgentData = Record<string, unknown>;
|
|
|
9
9
|
/** @internal */
|
|
10
10
|
export type EmptyAgentData = Record<never, never>;
|
|
11
11
|
|
|
12
|
+
/** @internal */
|
|
13
|
+
export type ZodModule = {
|
|
14
|
+
z: typeof z;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type SchemaPrimitiveFieldType = "boolean" | "number" | "string";
|
|
18
|
+
|
|
19
|
+
export type SchemaFieldDefinition = ({
|
|
20
|
+
enum?: readonly string[];
|
|
21
|
+
type: "string";
|
|
22
|
+
} | {
|
|
23
|
+
itemType: SchemaPrimitiveFieldType;
|
|
24
|
+
type: "array";
|
|
25
|
+
} | { type: "boolean" | "number"; }) & {
|
|
26
|
+
description?: string;
|
|
27
|
+
required?: boolean;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type SchemaDefinition = Record<string, SchemaFieldDefinition>;
|
|
31
|
+
|
|
32
|
+
export type SchemaDefinitionData<TDefinition extends SchemaDefinition> = {
|
|
33
|
+
[K in keyof TDefinition as TDefinition[K] extends { required: true; } ? K : never]: SchemaFieldData<TDefinition[K]>;
|
|
34
|
+
} &
|
|
35
|
+
{
|
|
36
|
+
[K in keyof TDefinition as TDefinition[K] extends { required: true; } ? never : K]?: SchemaFieldData<TDefinition[K]>;
|
|
37
|
+
};
|
|
38
|
+
|
|
12
39
|
/** @privateRemark All ADK agents are orchestrator-driven, so these channels exist for every agent graph. */
|
|
13
40
|
export type AgentRuntimeState = {
|
|
14
41
|
agentExecutionContext: AgentExecutionContext;
|
|
@@ -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 : boolean)[] : 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">;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as o}from"./
|
|
2
|
+
import{a as o}from"./YLN2BZ5J.js";import"./QCSN44H4.js";import"./NXKKG5TK.js";import{g as a,h as e,n as i,v as c,z as n}from"./HWKDNS4K.js";import"./YIMNOUTF.js";var r=a`.actions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs)}`,t=class extends c{constructor(){super(...arguments),this._messages=o({blocking:!0}),this.feedbackEnabled=!1,this.arcgisFeedback=i()}static{this.properties={feedbackEnabled:5,message:0}}static{this.styles=r}_handleFeedback(s){this.message&&(this.message.feedback=this.message.feedback?.positive===s?void 0:{positive:s},this.arcgisFeedback.emit(this.message),this.requestUpdate())}_getFeedback(){return this.message?.feedback?.positive}_renderThumbsUpButton(){return e`<calcite-action id=action-thumbs-up icon=thumbs-up scale=s .active=${this._getFeedback()===!0} @click=${()=>this._handleFeedback(!0)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-up overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsUpLabel}</span></calcite-tooltip>`}_renderThumbsDownButton(){return e`<calcite-action id=action-thumbs-down icon=thumbs-down scale=s .active=${this._getFeedback()===!1} @click=${()=>this._handleFeedback(!1)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-down overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsDownLabel}</span></calcite-tooltip>`}render(){return this.feedbackEnabled&&!this.message?.error?e`<div class="actions">${this._renderThumbsUpButton()}${this._renderThumbsDownButton()}</div>`:null}};n("arcgis-assistant-message-feedback",t);export{t as ArcgisAssistantMessageFeedback};
|