@illuma-ai/agents 1.1.19 → 1.1.21
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/cjs/common/enum.cjs +2 -0
- package/dist/cjs/common/enum.cjs.map +1 -1
- package/dist/cjs/graphs/MultiAgentGraph.cjs +87 -1
- package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/index.cjs +14 -0
- package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
- package/dist/cjs/main.cjs +3 -0
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/nodes/ApprovalGateNode.cjs +75 -0
- package/dist/cjs/nodes/ApprovalGateNode.cjs.map +1 -0
- package/dist/cjs/run.cjs +45 -0
- package/dist/cjs/run.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +21 -18
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/types/graph.cjs.map +1 -1
- package/dist/cjs/utils/run.cjs +6 -1
- package/dist/cjs/utils/run.cjs.map +1 -1
- package/dist/esm/common/enum.mjs +2 -0
- package/dist/esm/common/enum.mjs.map +1 -1
- package/dist/esm/graphs/MultiAgentGraph.mjs +87 -1
- package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
- package/dist/esm/llm/bedrock/index.mjs +14 -0
- package/dist/esm/llm/bedrock/index.mjs.map +1 -1
- package/dist/esm/main.mjs +1 -0
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/nodes/ApprovalGateNode.mjs +72 -0
- package/dist/esm/nodes/ApprovalGateNode.mjs.map +1 -0
- package/dist/esm/run.mjs +45 -0
- package/dist/esm/run.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +22 -19
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/types/graph.mjs.map +1 -1
- package/dist/esm/utils/run.mjs +6 -1
- package/dist/esm/utils/run.mjs.map +1 -1
- package/dist/types/common/enum.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/nodes/ApprovalGateNode.d.ts +49 -0
- package/dist/types/nodes/index.d.ts +2 -0
- package/dist/types/run.d.ts +25 -1
- package/dist/types/tools/ToolNode.d.ts +7 -5
- package/dist/types/types/graph.d.ts +31 -0
- package/dist/types/types/tools.d.ts +7 -9
- package/package.json +1 -1
- package/src/common/enum.ts +2 -0
- package/src/graphs/MultiAgentGraph.ts +108 -1
- package/src/index.ts +3 -0
- package/src/llm/bedrock/index.ts +17 -0
- package/src/nodes/ApprovalGateNode.ts +117 -0
- package/src/nodes/__tests__/ApprovalGateNode.test.ts +206 -0
- package/src/nodes/index.ts +5 -0
- package/src/run.ts +55 -1
- package/src/specs/agent-handoffs-bedrock.integration.test.ts +2 -2
- package/src/specs/agent-handoffs.test.ts +153 -6
- package/src/tools/ToolNode.ts +28 -23
- package/src/tools/__tests__/ToolApproval.test.ts +162 -325
- package/src/types/graph.ts +32 -0
- package/src/types/tools.ts +7 -9
- package/src/utils/run.ts +9 -1
package/src/types/graph.ts
CHANGED
|
@@ -342,6 +342,32 @@ export type StandardGraphInput = {
|
|
|
342
342
|
indexTokenCountMap?: Record<string, number>;
|
|
343
343
|
};
|
|
344
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Configuration for an approval gate placed on a sequence edge.
|
|
347
|
+
* When present, the graph inserts an approval gate node between the source
|
|
348
|
+
* and destination agents. The gate ALWAYS fires (regardless of ExecutionContext)
|
|
349
|
+
* and calls interrupt() to pause the graph for human approval.
|
|
350
|
+
*/
|
|
351
|
+
export type ApprovalGateConfig = {
|
|
352
|
+
/** Unique identifier for this gate (used as node ID suffix) */
|
|
353
|
+
gateId: string;
|
|
354
|
+
/**
|
|
355
|
+
* Approval channel — where the approval UI is rendered.
|
|
356
|
+
* - 'chat': SSE-based chat UI (default)
|
|
357
|
+
* - 'outlook': MS Graph Actionable Messages
|
|
358
|
+
* - 'telegram': Telegram Bot inline keyboard
|
|
359
|
+
*/
|
|
360
|
+
channel?: 'chat' | 'outlook' | 'telegram';
|
|
361
|
+
/** Optional human-readable prompt shown to the approver */
|
|
362
|
+
prompt?: string;
|
|
363
|
+
/** Optional approver identifier (e.g., email, user ID) */
|
|
364
|
+
approver?: string;
|
|
365
|
+
/** Timeout in ms before the gate auto-expires (default: 5 minutes) */
|
|
366
|
+
timeoutMs?: number;
|
|
367
|
+
/** What to do on denial: 'stop' ends the graph, 'skip' skips the destination agent */
|
|
368
|
+
onDeny?: 'stop' | 'skip';
|
|
369
|
+
};
|
|
370
|
+
|
|
345
371
|
export type GraphEdge = {
|
|
346
372
|
/** Agent ID, use a list for multiple sources */
|
|
347
373
|
from: string | string[];
|
|
@@ -389,6 +415,12 @@ export type GraphEdge = {
|
|
|
389
415
|
* Defaults to DEFAULT_HANDOFF_MAX_RESULT_CHARS (32768 chars, ~8192 tokens).
|
|
390
416
|
*/
|
|
391
417
|
maxResultChars?: number;
|
|
418
|
+
/**
|
|
419
|
+
* Approval gate configuration for sequence edges.
|
|
420
|
+
* When set, inserts an approval gate node between source and destination.
|
|
421
|
+
* The gate ALWAYS fires regardless of ExecutionContext (unlike tool approval).
|
|
422
|
+
*/
|
|
423
|
+
approvalGate?: ApprovalGateConfig;
|
|
392
424
|
};
|
|
393
425
|
|
|
394
426
|
export type MultiAgentGraphInput = StandardGraphInput & {
|
package/src/types/tools.ts
CHANGED
|
@@ -316,16 +316,14 @@ export type ToolApprovalResponse = {
|
|
|
316
316
|
};
|
|
317
317
|
|
|
318
318
|
/**
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
319
|
+
* Notification payload dispatched via ON_TOOL_APPROVAL_REQUIRED.
|
|
320
|
+
* Data-only — no resolve/reject callbacks. The approval mechanism is handled
|
|
321
|
+
* by LangGraph's native interrupt()/Command({ resume }) pattern.
|
|
322
|
+
*
|
|
323
|
+
* The host persists this data (e.g., in MongoDB) and sends UI events.
|
|
324
|
+
* The actual approval response comes back via Command({ resume: ToolApprovalResponse }).
|
|
322
325
|
*/
|
|
323
|
-
export type
|
|
324
|
-
/** Promise resolver - host calls this with the approval response */
|
|
325
|
-
resolve: (response: ToolApprovalResponse) => void;
|
|
326
|
-
/** Promise rejector - host calls this on fatal error */
|
|
327
|
-
reject: (error: Error) => void;
|
|
328
|
-
};
|
|
326
|
+
export type ToolApprovalNotification = ToolApprovalRequest;
|
|
329
327
|
|
|
330
328
|
/** Search mode: code_interpreter uses external sandbox, local uses safe substring matching */
|
|
331
329
|
export type ToolSearchMode = 'code_interpreter' | 'local';
|
package/src/utils/run.ts
CHANGED
|
@@ -96,7 +96,15 @@ export class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {
|
|
|
96
96
|
mergeConfigs(this.config, options)
|
|
97
97
|
);
|
|
98
98
|
} else {
|
|
99
|
-
|
|
99
|
+
const mergedConfig = mergeConfigs(this.config, options);
|
|
100
|
+
// Set up AsyncLocalStorage context so LangGraph's interrupt() can find
|
|
101
|
+
// the graph config via getRunnableConfig(). Without this, interrupt()
|
|
102
|
+
// throws "Called interrupt() outside the context of a graph" because
|
|
103
|
+
// RunnableCallable (unlike RunnableLambda) doesn't use _callWithConfig.
|
|
104
|
+
returnValue = await AsyncLocalStorageProviderSingleton.runWithConfig(
|
|
105
|
+
mergedConfig,
|
|
106
|
+
() => this.func(input, mergedConfig)
|
|
107
|
+
);
|
|
100
108
|
}
|
|
101
109
|
|
|
102
110
|
if (Runnable.isRunnable(returnValue) && this.recurse) {
|