@arcgis/ai-orchestrator 5.0.0-next.133

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.
Files changed (42) hide show
  1. package/LICENSE.md +17 -0
  2. package/README.md +11 -0
  3. package/dist/commonFunctions/vectorSearchFields.d.ts +2 -0
  4. package/dist/commonFunctions/vectorSearchLayers.d.ts +4 -0
  5. package/dist/dispatcherAgent/dispatcherGraph.d.ts +3 -0
  6. package/dist/dispatcherAgent/nodes/executeRegisteredAgent.d.ts +3 -0
  7. package/dist/dispatcherAgent/nodes/exit.d.ts +3 -0
  8. package/dist/dispatcherAgent/nodes/ingestInput.d.ts +3 -0
  9. package/dist/dispatcherAgent/nodes/intentDispatcher.d.ts +2 -0
  10. package/dist/dispatcherAgent/nodes/intentLLM.d.ts +3 -0
  11. package/dist/dispatcherAgent/reducers/commonReducers.d.ts +1 -0
  12. package/dist/dispatcherAgent/state/dispatcherGraphState.d.ts +8 -0
  13. package/dist/embeddings.worker-19IRaTB4.js +23 -0
  14. package/dist/field_descriptions_prompt-haMV_aoG.js +111 -0
  15. package/dist/hitl/InterruptHandler.d.ts +30 -0
  16. package/dist/hitl/types.d.ts +24 -0
  17. package/dist/index.d.ts +6 -0
  18. package/dist/index.js +8328 -0
  19. package/dist/intent_prompt-BjOozjFv.js +20 -0
  20. package/dist/layer_descriptions_prompt-NAaKWdJi.js +58 -0
  21. package/dist/llm/generateFieldDescriptions.d.ts +8 -0
  22. package/dist/llm/generateLayerAndFieldDescription.d.ts +7 -0
  23. package/dist/llm/generateLayerDescriptions.d.ts +22 -0
  24. package/dist/models/modelConfig.d.ts +28 -0
  25. package/dist/models/types.d.ts +2 -0
  26. package/dist/orchestrator/orchestrator.d.ts +70 -0
  27. package/dist/orchestrator/orchestratorEvents.d.ts +60 -0
  28. package/dist/prompts/getPrompt.d.ts +6 -0
  29. package/dist/providers/arcgis/aiUtilityService.d.ts +3 -0
  30. package/dist/providers/azure/azureChat.d.ts +6 -0
  31. package/dist/providers/azure/promptChain.d.ts +32 -0
  32. package/dist/providers/azure/sanitizedFetch.d.ts +5 -0
  33. package/dist/registry/agentRegistry.d.ts +26 -0
  34. package/dist/services/fieldSearch.d.ts +20 -0
  35. package/dist/services/layerSearch.d.ts +20 -0
  36. package/dist/signals/index.d.ts +24 -0
  37. package/dist/types/types.d.ts +55 -0
  38. package/dist/utils/cleanHistory.d.ts +2 -0
  39. package/dist/utils/contextSelectors.d.ts +10 -0
  40. package/dist/workers/embeddings.worker.d.ts +1 -0
  41. package/dist/workers/embeddingsWorkerSetup.d.ts +6 -0
  42. package/package.json +27 -0
@@ -0,0 +1,20 @@
1
+ const e = `## GIS Feature Layer Intent Classifier
2
+
3
+ You are an assistant that classifies user intent in ArcGIS Online Map Viewer.
4
+
5
+ Return **up to {maxIntents} intents in the exact order they should be executed** for the user's request.
6
+ If none apply, return an **empty list** (no "none" label).
7
+
8
+ Choose only from registered agents. Input format will be: {{id: string, name: string, description: string}}[]
9
+ {registeredAgents}
10
+
11
+ Rules:
12
+
13
+ - Output 0–{maxIntents} items, ordered for execution.
14
+ - Do **not** include any labels outside the list above.
15
+ - Do **not** include "none"; return an empty list instead when unrelated questions like labels, popups, etc.
16
+ - If none apply, return an empty array [].
17
+ `;
18
+ export {
19
+ e as default
20
+ };
@@ -0,0 +1,58 @@
1
+ const e = `This Feature Layer is part of a Feature Service. The Feature Layer contains various fields, each with its own name, type, and description.
2
+ The Feature Layer is a collection of geographic features that represent real-world entities. Each feature in the layer has attributes that provide additional information about the feature. The layer may include point, line, or polygon geometries, depending on the type of data it represents.
3
+ The geometry type for this layer is {layerGeometryType}.
4
+
5
+ Here is the field information for each field in the Feature Layer. Each field has a name, alias, type, valueType and description. These should help you understand the data represented in the Feature Layer.
6
+
7
+ Field Descriptions:
8
+ {fieldInformation}
9
+
10
+ Your task is to :
11
+
12
+ - analyze the field descriptions to understand the data represented in the Feature Layer.
13
+ - Generate the following for the layer:
14
+ - a title: a concise title that accurately reflects the content and purpose of the feature service.
15
+ - a description: a detailed description of the feature layer
16
+
17
+ Consider the following aspects in your description:
18
+
19
+ - purpose of this feature layer
20
+ - types of data and geometric entities represented in the layer
21
+ - sources of the layer information and the geographic area covered
22
+ - potential applications and usefulness of the feature layer in the GIS world
23
+
24
+ If any of the above topics are not applicable, you can skip them. Don't include statements that indicate something this Feature Layer is not or does not have. Avoid listing field names, types, and other technical details.
25
+
26
+ Instructions while generating the title:
27
+
28
+ - Avoid using special characters in the title.
29
+ - Avoid using 'layer' in the title.
30
+ - Avoid using all uppercase letters in the title. Use title case instead.
31
+ - The title should not be too long.
32
+
33
+ You are given Feature Layer descriptions and title.
34
+
35
+ ## Existing layer details filled in by a human:
36
+
37
+ {existingLayerTitle}
38
+ {existingLayerSnippet}
39
+ {existingLayerDescription}
40
+
41
+ ## Instructions on how to use the information filled in by a human:
42
+
43
+ Remember humans may have more information about the item than just the field and layer descriptions.
44
+
45
+ - Use this information ONLY IF it helps you understand the item better.
46
+ - Use this information ONLY IF it helps you generate a better description and title.
47
+ - Use your knowledge from this information to compensate for any important information that is missing in the field and layer descriptions.
48
+
49
+ ## Instructions on what to avoid doing with the information filled in by a human:
50
+
51
+ - you must not use this information in your response as it is.
52
+ - you must not think of this information as the final version.
53
+ - you must not use this information to generate a response without analyzing it.
54
+ - you must not copy this information verbatim in your response.
55
+ `;
56
+ export {
57
+ e as default
58
+ };
@@ -0,0 +1,8 @@
1
+ import { default as FeatureLayer } from '@arcgis/core/layers/FeatureLayer';
2
+ import { FieldsRegistry } from '../types/types';
3
+ /**
4
+ * Enriches a FeatureLayer's fields (missing alias/description/valueType) using an LLM and
5
+ * returns a complete `FieldsRegistry`. Skips the model call if nothing needs enrichment.
6
+ * Throws if the LLM response fails schema validation.
7
+ */
8
+ export declare const generateFieldDescriptions: (featureLayer: FeatureLayer) => Promise<FieldsRegistry>;
@@ -0,0 +1,7 @@
1
+ import { LayersAndFieldsRegistry } from '../types/types';
2
+ /**
3
+ * Builds a combined registry of layer and field metadata for all FeatureLayers in a map.
4
+ * For each FeatureLayer: generates field descriptions, then layer descriptions, and stores
5
+ * the results keyed by layer id. Non-FeatureLayer entries are ignored.
6
+ */
7
+ export declare const layerAndFieldDescriptions: (arcgisMap: __esri.Map) => Promise<LayersAndFieldsRegistry>;
@@ -0,0 +1,22 @@
1
+ import { default as z } from 'zod';
2
+ import { FieldsRegistry } from '../types/types';
3
+ import { default as FeatureLayer } from '@arcgis/core/layers/FeatureLayer';
4
+ declare const layerDescriptionSchema: z.ZodObject<{
5
+ title: z.ZodString;
6
+ description: z.ZodString;
7
+ name: z.ZodNullable<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ title: string;
10
+ description: string;
11
+ name: string | null;
12
+ }, {
13
+ title: string;
14
+ description: string;
15
+ name: string | null;
16
+ }>;
17
+ export type LayerDescriptionWrapper = z.infer<typeof layerDescriptionSchema>;
18
+ /**
19
+ * Enriches a layer's title/description via LLM using existing metadata + field descriptions.
20
+ */
21
+ export declare const generateLayerDescriptions: (layer: FeatureLayer, fieldRegistry: FieldsRegistry) => Promise<LayerDescriptionWrapper>;
22
+ export {};
@@ -0,0 +1,28 @@
1
+ import { ChatModelTier, EmbeddingModelTier } from './types';
2
+ export declare const ModelConfig: {
3
+ readonly "gpt-4.1": {
4
+ readonly deploymentName: "gpt-4.1";
5
+ readonly apiVersion: "2024-10-21";
6
+ readonly pathSegment: "models/gpt-4.1/openai/deployments/gpt-4.1/chat/completions";
7
+ };
8
+ readonly "gpt-4.1-mini": {
9
+ readonly deploymentName: "gpt-4.1-mini";
10
+ readonly apiVersion: "2024-10-21";
11
+ readonly pathSegment: "models/gpt-4.1-mini/openai/deployments/gpt-4.1-mini/chat/completions";
12
+ };
13
+ readonly "text-embedding-ada-002": {
14
+ readonly deploymentName: "text-embedding-ada-002";
15
+ readonly apiVersion: "2024-10-21";
16
+ readonly pathSegment: "models/text-embedding-ada-002/openai/deployments/text-embedding-ada-002/embeddings";
17
+ };
18
+ };
19
+ export type AiModelKey = keyof typeof ModelConfig;
20
+ /**
21
+ * Public tiers → internal model keys
22
+ */
23
+ export declare const ChatModelTierMap: Record<ChatModelTier, AiModelKey>;
24
+ export declare const EmbeddingModelTierMap: Record<EmbeddingModelTier, AiModelKey>;
25
+ /**
26
+ * Build the full AI Utility Service URL for a model.
27
+ */
28
+ export declare const getModelUrl: (baseUrl: string, modelKey: AiModelKey) => string;
@@ -0,0 +1,2 @@
1
+ export type ChatModelTier = "default" | "fast";
2
+ export type EmbeddingModelTier = "default";
@@ -0,0 +1,70 @@
1
+ import { OrchestratorEvent } from './orchestratorEvents';
2
+ import { AgentWithContext } from '../registry/agentRegistry';
3
+ import { default as Portal } from '@arcgis/core/portal/Portal.js';
4
+ /** Orchestrator initialization dependencies. */
5
+ type Deps = {
6
+ portal: Portal;
7
+ /** Optional map view enabling map-dependent services. */
8
+ view?: __esri.View;
9
+ /** Optional agents to register at init. */
10
+ agents?: AgentWithContext[];
11
+ };
12
+ /**
13
+ * Orchestrator
14
+ *
15
+ * Coordinates chat-in / events-out workflows on top of LangGraph.
16
+ * - Accepts user input via `ask()`
17
+ * - Streams structured events (`trace`, `interrupt`, `completed`, `cancelled`)
18
+ * - Manages HITL (human-in-the-loop) flows and cancellation
19
+ *
20
+ * Intended as the main entrypoint for the UX layer.
21
+ */
22
+ export declare class Orchestrator {
23
+ private deps;
24
+ private orchestratorReady;
25
+ private embeddingsWorker?;
26
+ private graph?;
27
+ private chatHistory;
28
+ private threadId;
29
+ private agentRegistry;
30
+ private layersAndFieldsRegistry?;
31
+ private interruptHandler?;
32
+ private currentInterrupt?;
33
+ private streamEpoch;
34
+ private constructor();
35
+ /**
36
+ * Creates and returns an AI-ready Orchestrator instance.
37
+ * @param deps Core dependencies (layer/field registry plus optional map views).
38
+ * @returns Ready Orchestrator.
39
+ */
40
+ static init(deps: Deps): Promise<Orchestrator>;
41
+ /**
42
+ * Run a new chat turn through the graph.
43
+ * Yields structured events for the UI to consume:
44
+ * - `trace`: intermediate model output
45
+ * - `interrupt`: HITL required, wait for `resumeInterrupt()`
46
+ * - `completed`: final result with chat history + layer styling
47
+ * - `cancelled`: user aborted the run
48
+ */
49
+ ask(userInput: string): AsyncGenerator<OrchestratorEvent>;
50
+ /**
51
+ * Start a new conversation by clearing chat history.
52
+ */
53
+ newConversation(): void;
54
+ /**
55
+ * Generic resume for any HITL interrupt.
56
+ * The payload is whatever the UI collected (e.g. "yes", "no", layerId, etc).
57
+ */
58
+ resumeInterrupt(payload: unknown): void;
59
+ /**
60
+ * Optional: allow UI to cancel the current HITL.
61
+ */
62
+ cancelInterrupt(): void;
63
+ private pipeStream;
64
+ /**
65
+ * Disposes this instance by terminating the embeddings worker
66
+ * and cleaning up all related resources.
67
+ */
68
+ dispose(): void;
69
+ }
70
+ export {};
@@ -0,0 +1,60 @@
1
+ import { UiInterrupt } from '../hitl/types';
2
+ /**
3
+ * Events emitted by the Orchestrator during a chat run.
4
+ *
5
+ * - `"trace"`: intermediate model output to display.
6
+ * - `"interrupt"`: human-in-the-loop input required; UI should call `resumeInterrupt()`.
7
+ * - `"completed"`: run finished successfully; includes final chat history and optional smart-mapping result.
8
+ * - `"cancelled"`: run aborted by the user.
9
+ * - `"ux-suggestion"`: optional suggestion for the UX to display (e.g., show legend).
10
+ * - `"error"`: an error occurred during orchestration.
11
+ * Consumers should handle all cases when iterating the async generator from `ask()`.
12
+ */
13
+ export type OrchestratorEvent = (OrchestratorEventBase & {
14
+ type: "cancelled";
15
+ reason?: CancelReason;
16
+ }) | (OrchestratorEventBase & {
17
+ type: "completed";
18
+ result: CompletedEventResult;
19
+ }) | (OrchestratorEventBase & {
20
+ type: "error";
21
+ error: OrchestratorError;
22
+ }) | (OrchestratorEventBase & {
23
+ type: "interrupt";
24
+ interrupt: UiInterrupt;
25
+ }) | (OrchestratorEventBase & {
26
+ type: "trace";
27
+ data: TraceEventData;
28
+ }) | (OrchestratorEventBase & {
29
+ type: "ux-suggestion";
30
+ suggestion: UXSuggestion;
31
+ });
32
+ /** Base properties for all orchestrator events */
33
+ type OrchestratorEventBase = {
34
+ runId: string;
35
+ timestamp: number;
36
+ };
37
+ export interface CompletedEventResult {
38
+ content: string;
39
+ }
40
+ /** Data for a trace event emitted during graph execution */
41
+ export interface TraceEventData {
42
+ text: string;
43
+ agentName?: string;
44
+ toolName?: string;
45
+ }
46
+ /** Optional suggestion event the UX can choose to display or ignore */
47
+ export type UXSuggestion = {
48
+ id: string;
49
+ description?: string;
50
+ payload?: Record<string, unknown>;
51
+ };
52
+ /** Cancel reasons for orchestrator events:
53
+ * - "user": the user explicitly cancelled the run.
54
+ */
55
+ export type CancelReason = "user";
56
+ /** Error information for orchestrator events */
57
+ export type OrchestratorError = {
58
+ message: string;
59
+ };
60
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Loads a markdown prompt file dynamically.
3
+ * Note: Vite only supports variable imports one level deep — e.g. "foo" works, "foo/bar" fails.
4
+ * https://vite.dev/guide/features.html#dynamic-import
5
+ */
6
+ export declare const getPromptText: (promptName: string) => Promise<string>;
@@ -0,0 +1,3 @@
1
+ import { ChatModelTier, EmbeddingModelTier } from '../../models/types';
2
+ export declare function getChatAIUtilityServiceUrl(tier?: ChatModelTier): string;
3
+ export declare function getEmbeddingAIUtilityServiceUrl(tier?: EmbeddingModelTier): string;
@@ -0,0 +1,6 @@
1
+ import { AzureChatOpenAI } from '@langchain/openai';
2
+ import { ChatModelTier } from '../../models/types';
3
+ /**
4
+ * Creates an instance of AzureChatOpenAI.
5
+ */
6
+ export declare const createAzureChatModel: (tier?: ChatModelTier, temperature?: number) => Promise<AzureChatOpenAI>;
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ import { ChatHistory } from '../../types/types';
3
+ import { StructuredToolInterface } from '@langchain/core/tools';
4
+ import { AIMessage } from '@langchain/core/messages';
5
+ import { ChatModelTier } from '../../models/types';
6
+ type BaseOptions = {
7
+ promptText: string;
8
+ modelTier?: ChatModelTier;
9
+ temperature?: number;
10
+ messages?: ChatHistory;
11
+ inputVariables?: Record<string, unknown>;
12
+ };
13
+ /**
14
+ * Invokes a prompt and returns a plain text response.
15
+ * Use this when you just need free-form text from the model.
16
+ */
17
+ export declare const invokeTextPrompt: (opts: BaseOptions) => Promise<string>;
18
+ /**
19
+ * Invokes a prompt and returns structured data validated against a schema.
20
+ * Use this when you need a predictable, typed result.
21
+ */
22
+ export declare const invokeStructuredPrompt: <T>(opts: BaseOptions & {
23
+ schema: z.ZodType<T>;
24
+ }) => Promise<T>;
25
+ /**
26
+ * Invokes a prompt with tools enabled and returns the model’s tool call response.
27
+ * Use this when the model needs to decide whether to call a tool.
28
+ */
29
+ export declare const invokeToolPrompt: (opts: BaseOptions & {
30
+ tools: StructuredToolInterface[];
31
+ }) => Promise<AIMessage>;
32
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Creates a sanitized fetch function that removes unnecessary headers
3
+ * and adds the Esri authorization token.
4
+ */
5
+ export declare const createSanitizedFetch: (token?: string) => typeof fetch;
@@ -0,0 +1,26 @@
1
+ import { AnnotationRoot, StateGraph } from '@langchain/langgraph/web';
2
+ /**
3
+ * Describes a single agent that can be registered with the orchestrator.
4
+ */
5
+ export interface AgentRegistration {
6
+ id: string;
7
+ name: string;
8
+ description: string;
9
+ createGraph: () => StateGraph<unknown>;
10
+ workspace: AnnotationRoot<any>;
11
+ }
12
+ export type GetContext<TContext extends Record<string, unknown>> = () => Promise<TContext> | TContext;
13
+ export interface AgentWithContext<TContext extends Record<string, unknown> = Record<string, unknown>> {
14
+ agent: AgentRegistration;
15
+ /**
16
+ * Lazily resolves runtime context.
17
+ * Can be sync or async, and may perform lifecycle checks (e.g. await view.when()).
18
+ */
19
+ getContext?: GetContext<TContext>;
20
+ }
21
+ export declare class AgentRegistry {
22
+ private agentRegistry;
23
+ register<TContext extends Record<string, unknown>>(entry: AgentWithContext<TContext>): void;
24
+ get(id: string): AgentWithContext | undefined;
25
+ list(): AgentWithContext[];
26
+ }
@@ -0,0 +1,20 @@
1
+ import { VectorSearchFieldResults } from '../types/types';
2
+ /**
3
+ * Service for semantic field matching within one or more layers.
4
+ * Hides the embeddings worker from callers.
5
+ */
6
+ export interface FieldSearchService {
7
+ searchFields: (input: {
8
+ text: string;
9
+ layerIds: string[];
10
+ minScore: number;
11
+ topResults: number;
12
+ }) => Promise<VectorSearchFieldResults>;
13
+ }
14
+ /**
15
+ * Factory that binds a Worker to the FieldSearchService.
16
+ * The worker is captured privately and never exposed.
17
+ */
18
+ export declare function createFieldSearchService(deps: {
19
+ worker: Worker;
20
+ }): FieldSearchService;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Service for semantic layer matching.
3
+ * Hides the embeddings worker from callers.
4
+ */
5
+ export interface LayerSearchService {
6
+ searchLayers: (input: {
7
+ text: string;
8
+ minScore: number;
9
+ }) => Promise<{
10
+ id: string;
11
+ score: number;
12
+ }[]>;
13
+ }
14
+ /**
15
+ * Factory that binds a Worker to the LayerSearchService.
16
+ * The worker is captured privately and never exposed.
17
+ */
18
+ export declare function createLayerSearchService(deps: {
19
+ worker: Worker;
20
+ }): LayerSearchService;
@@ -0,0 +1,24 @@
1
+ import { RunnableConfig } from '@langchain/core/runnables';
2
+ import { TraceEventData, UXSuggestion } from '../orchestrator/orchestratorEvents';
3
+ /**
4
+ * Dispatch a graph trace message to the browser event bridge.
5
+ *
6
+ * Emits a CustomEvent named "trace_message" that UI/tooling can observe
7
+ * (e.g., devtools panels or Storybook add‑ons) to surface node-enter messages.
8
+ *
9
+ * @param data - Trace event data.
10
+ * @param config - Runnable LangChain config forwarded to the dispatcher.
11
+ * @returns A promise that resolves once the event has been dispatched.
12
+ */
13
+ export declare const sendTraceMessage: (data: TraceEventData, config?: RunnableConfig) => Promise<void>;
14
+ /**
15
+ * Send a UX suggestion produced by the graph to the host UI.
16
+ *
17
+ * Useful for surfacing non-blocking, contextual hints (e.g., recommended
18
+ * actions or next steps) during an agent run.
19
+ *
20
+ * @param suggestion - The UX suggestion payload.
21
+ * @param config - Runnable LangChain config to pass through to the dispatcher.
22
+ * @returns A promise that resolves once the suggestion has been dispatched.
23
+ */
24
+ export declare const sendUXSuggestion: (suggestion: UXSuggestion, config?: RunnableConfig) => Promise<void>;
@@ -0,0 +1,55 @@
1
+ import { BaseMessage } from '@langchain/core/messages';
2
+ import { LayerDescriptionWrapper } from '../llm/generateLayerDescriptions';
3
+ import { AgentRegistry } from '../registry/agentRegistry';
4
+ import { HITLResponse } from '../hitl/types';
5
+ import { FieldSearchService } from '../services/fieldSearch';
6
+ import { LayerSearchService } from '../services/layerSearch';
7
+ export type FieldStatistics = {
8
+ summaryStatistics: __esri.SummaryStatisticsResult | null;
9
+ uniqueValues: __esri.UniqueValuesResultUniqueValueInfos[] | null;
10
+ };
11
+ export type FieldInfo = {
12
+ name: string;
13
+ alias: string;
14
+ type: string;
15
+ description: string;
16
+ valueType: string;
17
+ statistics?: FieldStatistics;
18
+ };
19
+ export type FieldsRegistry = Map<string, FieldInfo>;
20
+ /** Registry mapping layer IDs to their description and associated field registry. */
21
+ export type LayersAndFieldsRegistry = Map<string, {
22
+ layerItem: LayerDescriptionWrapper;
23
+ fieldRegistry: FieldsRegistry;
24
+ }>;
25
+ export type FieldVectors = {
26
+ layerId: string;
27
+ results: {
28
+ name: string;
29
+ score: number;
30
+ }[];
31
+ };
32
+ export type VectorSearchFieldResults = FieldVectors[];
33
+ /** Sequence of AI and human messages that make up the chat history. */
34
+ export type ChatHistory = BaseMessage[];
35
+ export type Services = Readonly<{
36
+ /** Registry used to discover and invoke available agents. */
37
+ agentRegistry: AgentRegistry;
38
+ /** ArcGIS Portal instance for auth, user context, and content access. */
39
+ portal: __esri.Portal;
40
+ /** Finds candidate layers using semantic (vector) search. */
41
+ layerSearch?: LayerSearchService;
42
+ /** Finds relevant fields for given layers using semantic (vector) search. */
43
+ fieldSearch?: FieldSearchService;
44
+ /** Registry of available layers and their fields for query / search (optional). */
45
+ layersAndFieldsRegistry?: LayersAndFieldsRegistry;
46
+ }>;
47
+ export type CustomConfigurableType = Record<string, unknown> & {
48
+ thread_id: string;
49
+ /** Optional HITL response injected by the host application. */
50
+ hitlResponse: HITLResponse | null;
51
+ /** Runtime services provided to agents and nodes. */
52
+ services: Services;
53
+ agentId?: string;
54
+ context?: unknown;
55
+ };
@@ -0,0 +1,2 @@
1
+ import { BaseMessage } from '@langchain/core/messages';
2
+ export declare const cleanOrphanedToolMessages: (messages: BaseMessage[]) => BaseMessage[];
@@ -0,0 +1,10 @@
1
+ import { BaseMessage } from '@langchain/core/messages';
2
+ /**
3
+ * Return the last N HumanMessage instances.
4
+ */
5
+ export declare const getUserContext: (messages: BaseMessage[], userCount?: number) => BaseMessage[];
6
+ /**
7
+ * Returns the concatenated content of all AI messages
8
+ * that occur after the last HumanMessage.
9
+ */
10
+ export declare const finalAgentResponse: (messages: BaseMessage[]) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { LayersAndFieldsRegistry } from '../types/types';
2
+ /**
3
+ * Initializes the embeddings worker and waits for its initial embedding generation
4
+ * to complete. Returns the ready Worker instance.
5
+ */
6
+ export declare const initEmbeddingsWorker: (layersAndFieldsRegistry: LayersAndFieldsRegistry) => Promise<Worker>;
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@arcgis/ai-orchestrator",
3
+ "version": "5.0.0-next.133",
4
+ "description": "ArcGIS AI Orchestrator Package",
5
+ "homepage": "https://developers.arcgis.com/javascript/latest/",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": "./dist/index.js",
12
+ "./package.json": "./package.json"
13
+ },
14
+ "files": [
15
+ "dist/"
16
+ ],
17
+ "dependencies": {
18
+ "@langchain/core": "^0.3.80",
19
+ "@langchain/langgraph": "^0.4.9",
20
+ "langchain": "^0.3.37",
21
+ "tslib": "^2.8.1",
22
+ "zod": "^3.25.76"
23
+ },
24
+ "peerDependencies": {
25
+ "@arcgis/core": ">=5.0.0-next.62 <5.1"
26
+ }
27
+ }