@minded-ai/mindedjs 1.0.53-patch6 → 1.0.53
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.d.ts +9 -17
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +5 -76
- package/dist/agent.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/nodes/addPromptNode.d.ts.map +1 -1
- package/dist/nodes/addPromptNode.js +0 -1
- package/dist/nodes/addPromptNode.js.map +1 -1
- package/dist/platform/config.d.ts +0 -3
- package/dist/platform/config.d.ts.map +1 -1
- package/dist/platform/config.js +1 -18
- package/dist/platform/config.js.map +1 -1
- package/dist/platform/mindedConnection.d.ts +4 -4
- package/dist/platform/mindedConnection.d.ts.map +1 -1
- package/dist/platform/mindedConnection.js +5 -8
- package/dist/platform/mindedConnection.js.map +1 -1
- package/dist/platform/mindedConnectionTypes.d.ts +2 -55
- package/dist/platform/mindedConnectionTypes.d.ts.map +1 -1
- package/dist/platform/mindedConnectionTypes.js +2 -11
- package/dist/platform/mindedConnectionTypes.js.map +1 -1
- package/dist/types/Agent.types.d.ts +0 -13
- package/dist/types/Agent.types.d.ts.map +1 -1
- package/dist/types/Agent.types.js.map +1 -1
- package/dist/types/Flows.types.d.ts +2 -15
- package/dist/types/Flows.types.d.ts.map +1 -1
- package/dist/types/Flows.types.js +0 -1
- package/dist/types/Flows.types.js.map +1 -1
- package/package.json +1 -4
- package/src/agent.ts +16 -93
- package/src/index.ts +0 -4
- package/src/nodes/addPromptNode.ts +0 -1
- package/src/platform/config.ts +1 -21
- package/src/platform/mindedConnection.ts +9 -15
- package/src/platform/mindedConnectionTypes.ts +2 -66
- package/src/types/Agent.types.ts +0 -14
- package/src/types/Flows.types.ts +1 -15
- package/dist/types/Voice.types.d.ts +0 -5
- package/dist/types/Voice.types.d.ts.map +0 -1
- package/dist/types/Voice.types.js +0 -3
- package/dist/types/Voice.types.js.map +0 -1
- package/dist/voice/elevenLabsUtils.d.ts +0 -70
- package/dist/voice/elevenLabsUtils.d.ts.map +0 -1
- package/dist/voice/elevenLabsUtils.js +0 -20
- package/dist/voice/elevenLabsUtils.js.map +0 -1
- package/dist/voice/voiceSession.d.ts +0 -47
- package/dist/voice/voiceSession.d.ts.map +0 -1
- package/dist/voice/voiceSession.js +0 -214
- package/dist/voice/voiceSession.js.map +0 -1
- package/src/types/Voice.types.ts +0 -4
- package/src/voice/elevenLabsUtils.ts +0 -101
- package/src/voice/voiceSession.ts +0 -257
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mindedConnectionTypes.js","sourceRoot":"","sources":["../../src/platform/mindedConnectionTypes.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"mindedConnectionTypes.js","sourceRoot":"","sources":["../../src/platform/mindedConnectionTypes.ts"],"names":[],"mappings":";;;AAUA,IAAY,iCASX;AATD,WAAY,iCAAiC;IAC3C,oEAA+B,CAAA;IAC/B,kEAA6B,CAAA;IAC7B,kFAA6C,CAAA;IAC7C,sEAAiC,CAAA;IACjC,wEAAmC,CAAA;IACnC,oFAA+C,CAAA;IAC/C,gEAA2B,CAAA;IAC3B,4DAAuB,CAAA;AACzB,CAAC,EATW,iCAAiC,iDAAjC,iCAAiC,QAS5C"}
|
|
@@ -6,19 +6,6 @@ export type MindedSDKConfig = {
|
|
|
6
6
|
llm: LLMConfig;
|
|
7
7
|
tools: string[];
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
10
|
-
* Parameters for the Agent invoke method
|
|
11
|
-
*/
|
|
12
|
-
export interface AgentInvokeParams {
|
|
13
|
-
/** The payload/data associated with the trigger */
|
|
14
|
-
triggerBody: any;
|
|
15
|
-
/** The name/type of the trigger being invoked */
|
|
16
|
-
triggerName: string;
|
|
17
|
-
/** Optional session identifier for conversation continuity */
|
|
18
|
-
sessionId?: string;
|
|
19
|
-
/** Optional name of the application triggering the agent in case of an app trigger */
|
|
20
|
-
appName?: string;
|
|
21
|
-
}
|
|
22
9
|
export declare enum FlowHistoryType {
|
|
23
10
|
TRIGGER_INVOCATION = "triggerInvocation",
|
|
24
11
|
APP_ACTION_INVOCATION = "appActionInvocation"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agent.types.d.ts","sourceRoot":"","sources":["../../src/types/Agent.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,CAAC,SAAS,MAAM,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAEvM,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"Agent.types.d.ts","sourceRoot":"","sources":["../../src/types/Agent.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,CAAC,SAAS,MAAM,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAEvM,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAA;AAED,oBAAY,eAAe;IACzB,kBAAkB,sBAAsB;IACxC,qBAAqB,wBAAwB;CAC9C;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,IAAI,EAAE,eAAe,CAAC,kBAAkB,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,GAAG,CAAC;CAClB;AAED,MAAM,WAAW,0BAA2B,SAAQ,WAAW;IAC7D,IAAI,EAAE,eAAe,CAAC,qBAAqB,CAAC;IAC5C,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agent.types.js","sourceRoot":"","sources":["../../src/types/Agent.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Agent.types.js","sourceRoot":"","sources":["../../src/types/Agent.types.ts"],"names":[],"mappings":";;;AAWA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,2DAAwC,CAAA;IACxC,gEAA6C,CAAA;AAC/C,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAWA,CAAC;AAKD,CAAC"}
|
|
@@ -25,12 +25,10 @@ export interface BaseNode {
|
|
|
25
25
|
export declare enum TriggerType {
|
|
26
26
|
APP = "app",
|
|
27
27
|
WEBHOOK = "webhook",
|
|
28
|
-
MANUAL = "manual"
|
|
29
|
-
VOICE = "voice"
|
|
28
|
+
MANUAL = "manual"
|
|
30
29
|
}
|
|
31
30
|
export interface BaseTriggerNode extends BaseNode {
|
|
32
31
|
type: NodeType.TRIGGER;
|
|
33
|
-
triggerType: TriggerType;
|
|
34
32
|
}
|
|
35
33
|
export interface BaseAppNode {
|
|
36
34
|
appName: string;
|
|
@@ -49,17 +47,6 @@ export interface AppTriggerNode extends BaseTriggerNode, BaseAppNode {
|
|
|
49
47
|
export interface WebhookTriggerNode extends BaseTriggerNode {
|
|
50
48
|
triggerType: TriggerType.WEBHOOK;
|
|
51
49
|
}
|
|
52
|
-
export interface VoiceTriggerNode extends BaseTriggerNode {
|
|
53
|
-
triggerType: TriggerType.VOICE;
|
|
54
|
-
/**
|
|
55
|
-
* Text that will be spoken as the very first message in a voice interaction.
|
|
56
|
-
*/
|
|
57
|
-
firstMessage: string;
|
|
58
|
-
/**
|
|
59
|
-
* Optional ElevenLabs voice ID to be used for TTS.
|
|
60
|
-
*/
|
|
61
|
-
voiceId?: string;
|
|
62
|
-
}
|
|
63
50
|
export interface ManualTriggerNode extends BaseTriggerNode {
|
|
64
51
|
triggerType: TriggerType.MANUAL;
|
|
65
52
|
}
|
|
@@ -68,7 +55,7 @@ export interface PromptNode extends BaseNode {
|
|
|
68
55
|
prompt: string;
|
|
69
56
|
llmConfig?: LLMConfig;
|
|
70
57
|
}
|
|
71
|
-
export type TriggerNode = AppTriggerNode | WebhookTriggerNode | ManualTriggerNode
|
|
58
|
+
export type TriggerNode = AppTriggerNode | WebhookTriggerNode | ManualTriggerNode;
|
|
72
59
|
export interface JunctionNode extends BaseNode {
|
|
73
60
|
type: NodeType.JUNCTION;
|
|
74
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flows.types.d.ts","sourceRoot":"","sources":["../../src/types/Flows.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,QAAQ,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AAC,EAAE;QACN,IAAI,EAAE,oBAAoB,CAAC;QAC3B,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;KACjC,CAAC;CACH,CAAC;AAEF,oBAAY,oBAAoB;IAC9B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,iBAAiB,sBAAsB;IACvC,aAAa,kBAAkB;CAChC"}
|
|
@@ -20,7 +20,6 @@ var TriggerType;
|
|
|
20
20
|
TriggerType["APP"] = "app";
|
|
21
21
|
TriggerType["WEBHOOK"] = "webhook";
|
|
22
22
|
TriggerType["MANUAL"] = "manual";
|
|
23
|
-
TriggerType["VOICE"] = "voice";
|
|
24
23
|
})(TriggerType || (exports.TriggerType = TriggerType = {}));
|
|
25
24
|
var AppNodeMetadataType;
|
|
26
25
|
(function (AppNodeMetadataType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flows.types.js","sourceRoot":"","sources":["../../src/types/Flows.types.ts"],"names":[],"mappings":";;;AAMA,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,yBAAa,CAAA;IACb,gCAAoB,CAAA;IACpB,sCAA0B,CAAA;AAC5B,CAAC,EANW,QAAQ,wBAAR,QAAQ,QAMnB;AAED,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,kDAAsC,CAAA;IACtC,gDAAoC,CAAA;IACpC,wCAA4B,CAAA;AAC9B,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB;AAUD,IAAY,
|
|
1
|
+
{"version":3,"file":"Flows.types.js","sourceRoot":"","sources":["../../src/types/Flows.types.ts"],"names":[],"mappings":";;;AAMA,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,yBAAa,CAAA;IACb,gCAAoB,CAAA;IACpB,sCAA0B,CAAA;AAC5B,CAAC,EANW,QAAQ,wBAAR,QAAQ,QAMnB;AAED,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,kDAAsC,CAAA;IACtC,gDAAoC,CAAA;IACpC,wCAA4B,CAAA;AAC9B,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB;AAUD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,0BAAW,CAAA;IACX,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAiFD,IAAY,mBAEX;AAFD,WAAY,mBAAmB;IAC7B,2CAAoB,CAAA;AACtB,CAAC,EAFW,mBAAmB,mCAAnB,mBAAmB,QAE9B;AAsBD,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,yCAAiB,CAAA;IACjB,2CAAmB,CAAA;IACnB,uCAAe,CAAA;IACf,yCAAiB,CAAA;IACjB,mCAAW,CAAA;AACb,CAAC,EAPW,oBAAoB,oCAApB,oBAAoB,QAO/B;AAQD,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,4DAAuC,CAAA;IACvC,oDAA+B,CAAA;AACjC,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minded-ai/mindedjs",
|
|
3
|
-
"version": "1.0.53
|
|
3
|
+
"version": "1.0.53",
|
|
4
4
|
"description": "MindedJS is a TypeScript library for building agents.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"test": "NODE_ENV=test mocha --parallel --jobs auto --retries 1 -r ts-node/register -r ./test/setup.ts \"test/**/*.test.ts\"",
|
|
18
18
|
"testFile": "NODE_ENV=test mocha -r ts-node/register -r ./test/setup.ts",
|
|
19
19
|
"order-refund": "cd examples/orderRefundAgent && nodemon --watch '**/*.ts' --exec 'ts-node' orderRefundAgent.ts",
|
|
20
|
-
"example-voice": "cd examples/voice && nodemon --watch '**/*.ts' --exec 'ts-node' voiceAgent.ts",
|
|
21
20
|
"lint": "eslint .",
|
|
22
21
|
"lintFix": "eslint --fix .",
|
|
23
22
|
"generateApiDocs": "typedoc src --out docs/api-reference ./src"
|
|
@@ -30,7 +29,6 @@
|
|
|
30
29
|
"@types/mocha": "^10.0.6",
|
|
31
30
|
"@types/node": "^20.11.19",
|
|
32
31
|
"@types/sinon": "^17.0.4",
|
|
33
|
-
"@types/ws": "^8.18.1",
|
|
34
32
|
"chai": "^4.3.10",
|
|
35
33
|
"dotenv": "^16.4.5",
|
|
36
34
|
"eslint": "^9.27.0",
|
|
@@ -53,7 +51,6 @@
|
|
|
53
51
|
"langchain": "^0.3.25",
|
|
54
52
|
"socket.io-client": "^4.8.1",
|
|
55
53
|
"uuid": "^11.1.0",
|
|
56
|
-
"ws": "^8.15.1",
|
|
57
54
|
"zod": "^3.24.4"
|
|
58
55
|
}
|
|
59
56
|
}
|
package/src/agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Flow, NodeType, Node, EdgeType, KnownTriggerNames
|
|
1
|
+
import { Flow, NodeType, Node, EdgeType, KnownTriggerNames } from './types/Flows.types';
|
|
2
2
|
|
|
3
3
|
import { Tool } from './types/Tools.types';
|
|
4
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
@@ -11,11 +11,11 @@ import { edgeFactory } from './edges/edgeFactory';
|
|
|
11
11
|
import { AgentEventRequestPayloads, AgentEventResponsePayloads, AgentEvents } from './events/AgentEvents';
|
|
12
12
|
import { z } from 'zod';
|
|
13
13
|
import { MindedConnection } from './platform/mindedConnection';
|
|
14
|
-
import { BaseMindedConnectionSocketMessage,
|
|
14
|
+
import { BaseMindedConnectionSocketMessage, MindedConnectionSocketMessageType, OnAppTrigger } from './platform/mindedConnectionTypes';
|
|
15
15
|
import * as fs from 'fs';
|
|
16
16
|
import * as path from 'path';
|
|
17
17
|
import * as yaml from 'js-yaml';
|
|
18
|
-
import {
|
|
18
|
+
import { FlowHistoryType, MindedSDKConfig, TriggerInvocationHistory } from './types/Agent.types';
|
|
19
19
|
import { createLlmInstance } from './llm/createLlmInstance';
|
|
20
20
|
import { createCheckpointSaver } from './checkpointer/checkpointSaverFactory';
|
|
21
21
|
import { getConfig } from './platform/config';
|
|
@@ -23,8 +23,6 @@ import { BaseMessage, HumanMessage } from '@langchain/core/messages';
|
|
|
23
23
|
import triggerTypeToDefaultMessage from './triggers/triggerTypeToDefaultMessage';
|
|
24
24
|
import appActionRunnerToolCreator from './internalTools/appActionRunnerTool';
|
|
25
25
|
import { wait } from './utils/wait';
|
|
26
|
-
import { VoiceSession } from './voice/voiceSession';
|
|
27
|
-
import { BaseVoiceMessage, OnVoiceAudioOut } from './platform/mindedConnectionTypes';
|
|
28
26
|
|
|
29
27
|
type CreateAgentParams<Memory> = {
|
|
30
28
|
memorySchema: z.ZodSchema;
|
|
@@ -57,14 +55,13 @@ export class Agent {
|
|
|
57
55
|
private flows!: Flow[];
|
|
58
56
|
public tools!: Tool<any, any>[];
|
|
59
57
|
private llm!: BaseLanguageModel;
|
|
60
|
-
|
|
58
|
+
private mindedConnection: MindedConnection | null = null;
|
|
61
59
|
// Langgraph memory saver. In memory for local development, Custom for Platform
|
|
62
60
|
private checkpointer!: BaseCheckpointSaver;
|
|
63
61
|
// Langgraph compiled graph
|
|
64
|
-
|
|
62
|
+
private compiledGraph!: CompiledGraph;
|
|
65
63
|
// Cache for secrets to avoid repeated API calls
|
|
66
64
|
private secretsCache: Record<string, string> | null = null;
|
|
67
|
-
public config: MindedSDKConfig;
|
|
68
65
|
|
|
69
66
|
// Event handlers storage keyed by event name. Handlers can optionally return a value.
|
|
70
67
|
private eventHandlers: {
|
|
@@ -76,9 +73,6 @@ export class Agent {
|
|
|
76
73
|
private initialized = false;
|
|
77
74
|
private initPromise: Promise<void> | null = null;
|
|
78
75
|
|
|
79
|
-
// Add the voiceSessions property to the Agent class (place near other class fields)
|
|
80
|
-
public voiceSessions: Map<string, VoiceSession> = new Map();
|
|
81
|
-
|
|
82
76
|
/**
|
|
83
77
|
* Create a new Agent instance.
|
|
84
78
|
*
|
|
@@ -114,7 +108,6 @@ export class Agent {
|
|
|
114
108
|
const { memorySchema } = params;
|
|
115
109
|
this.memorySchema = memorySchema;
|
|
116
110
|
this.initPromise = this.init(params);
|
|
117
|
-
this.config = params.config;
|
|
118
111
|
}
|
|
119
112
|
|
|
120
113
|
private async init(params: CreateAgentParams<z.infer<typeof this.memorySchema>>): Promise<void> {
|
|
@@ -134,17 +127,6 @@ export class Agent {
|
|
|
134
127
|
sessionId: trigger.sessionId,
|
|
135
128
|
});
|
|
136
129
|
});
|
|
137
|
-
|
|
138
|
-
this.mindedConnection.on(MindedConnectionSocketMessageType.INVOKE, async (message, callback) => {
|
|
139
|
-
const invokeMessage = message as InvokeMessage;
|
|
140
|
-
const result = await this.invoke({
|
|
141
|
-
triggerBody: invokeMessage.triggerBody,
|
|
142
|
-
triggerName: invokeMessage.triggerName,
|
|
143
|
-
appName: invokeMessage.appName,
|
|
144
|
-
sessionId: invokeMessage.sessionId,
|
|
145
|
-
});
|
|
146
|
-
callback(result);
|
|
147
|
-
});
|
|
148
130
|
}
|
|
149
131
|
const [, flows] = (await Promise.all([this.loadSecrets(), this.loadFlows(config.flows)])) as [Record<string, string>, Flow[]];
|
|
150
132
|
this.flows = flows;
|
|
@@ -157,11 +139,6 @@ export class Agent {
|
|
|
157
139
|
this.llm = createLlmInstance(config.llm);
|
|
158
140
|
this.compiledGraph = this.initializeGraph();
|
|
159
141
|
this.initialized = true;
|
|
160
|
-
|
|
161
|
-
const flowHasVoiceTrigger = this.flows.some((flow) => flow.nodes.some((node) => node.type === NodeType.TRIGGER && node.triggerType === TriggerType.VOICE));
|
|
162
|
-
if (flowHasVoiceTrigger) {
|
|
163
|
-
this.setupVoice();
|
|
164
|
-
}
|
|
165
142
|
} catch (error) {
|
|
166
143
|
this.initialized = false;
|
|
167
144
|
throw error;
|
|
@@ -341,11 +318,16 @@ export class Agent {
|
|
|
341
318
|
triggerName,
|
|
342
319
|
sessionId,
|
|
343
320
|
appName,
|
|
344
|
-
}:
|
|
321
|
+
}: {
|
|
322
|
+
triggerBody: any;
|
|
323
|
+
triggerName: string;
|
|
324
|
+
sessionId?: string;
|
|
325
|
+
appName?: string;
|
|
326
|
+
}) {
|
|
345
327
|
await this.waitForInitialization();
|
|
346
328
|
let messages: Array<BaseMessage> = [];
|
|
347
329
|
let memoryUpdate = {};
|
|
348
|
-
if (triggerName === KnownTriggerNames.DASHBOARD_MESSAGE
|
|
330
|
+
if (triggerName === KnownTriggerNames.DASHBOARD_MESSAGE) {
|
|
349
331
|
messages.push(new HumanMessage(triggerBody.content));
|
|
350
332
|
} else {
|
|
351
333
|
const results = await this.emit(AgentEvents.TRIGGER_EVENT, {
|
|
@@ -380,8 +362,8 @@ export class Agent {
|
|
|
380
362
|
},
|
|
381
363
|
];
|
|
382
364
|
console.log(`Invoking trigger ${triggerName} with session ${sessionId}`);
|
|
383
|
-
const
|
|
384
|
-
const state = await this.compiledGraph.getState(
|
|
365
|
+
const config = { configurable: { thread_id: sessionId || uuidv4(), recursionLimit: 3 } };
|
|
366
|
+
const state = await this.compiledGraph.getState(config);
|
|
385
367
|
// Resume interruption
|
|
386
368
|
if (state.tasks?.[0]?.interrupts?.length > 0) {
|
|
387
369
|
console.log('Resuming interruption');
|
|
@@ -389,13 +371,13 @@ export class Agent {
|
|
|
389
371
|
new Command({
|
|
390
372
|
resume: { memory: memoryUpdate, messages, history, triggerInvocations: [triggerInvocation] },
|
|
391
373
|
}),
|
|
392
|
-
|
|
374
|
+
config,
|
|
393
375
|
);
|
|
394
376
|
return res;
|
|
395
377
|
} else {
|
|
396
378
|
const res = await this.compiledGraph.invoke(
|
|
397
379
|
{ messages, memory: memoryUpdate, history, triggerInvocations: [triggerInvocation] },
|
|
398
|
-
|
|
380
|
+
config,
|
|
399
381
|
);
|
|
400
382
|
return res;
|
|
401
383
|
}
|
|
@@ -615,63 +597,4 @@ export class Agent {
|
|
|
615
597
|
throw new Error(`Failed to fetch secrets: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
616
598
|
}
|
|
617
599
|
}
|
|
618
|
-
|
|
619
|
-
public getLangraphConfig(sessionId: string): { configurable: { thread_id: string; recursionLimit: number } } {
|
|
620
|
-
return { configurable: { thread_id: sessionId, recursionLimit: 3 } };
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
private setupVoice(): void {
|
|
624
|
-
if (!this.mindedConnection) {
|
|
625
|
-
throw new Error('Minded connection is required');
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
const connection = this.mindedConnection;
|
|
629
|
-
const { dashboardConnected } = getConfig();
|
|
630
|
-
|
|
631
|
-
if (dashboardConnected) {
|
|
632
|
-
// Listen for voice session start
|
|
633
|
-
connection.on(MindedConnectionSocketMessageType.DASHBOARD_VOICE_SESSION_START, async (message) => {
|
|
634
|
-
const sessionStart = message as BaseVoiceMessage;
|
|
635
|
-
await this.startVoiceSession({ sessionId: sessionStart.sessionId });
|
|
636
|
-
});
|
|
637
|
-
|
|
638
|
-
// Listen for incoming audio from the platform
|
|
639
|
-
connection.on(MindedConnectionSocketMessageType.DASHBOARD_VOICE_USER_AUDIO, (message) => {
|
|
640
|
-
const audioMessage = message as OnVoiceAudioOut;
|
|
641
|
-
const voiceSession = this.voiceSessions.get(audioMessage.sessionId);
|
|
642
|
-
if (voiceSession) {
|
|
643
|
-
voiceSession.sendAudio(audioMessage.audioData);
|
|
644
|
-
} else {
|
|
645
|
-
console.warn({ message: 'Voice session not found for sessionId', sessionId: audioMessage.sessionId });
|
|
646
|
-
}
|
|
647
|
-
});
|
|
648
|
-
|
|
649
|
-
// Hangup / end session handler
|
|
650
|
-
connection.on(MindedConnectionSocketMessageType.DASHBOARD_VOICE_SESSION_END, (message) => {
|
|
651
|
-
const hangup = message as BaseVoiceMessage;
|
|
652
|
-
const voiceSession = this.voiceSessions.get(hangup.sessionId);
|
|
653
|
-
if (voiceSession) {
|
|
654
|
-
voiceSession.hangup();
|
|
655
|
-
} else {
|
|
656
|
-
console.warn({ message: 'Voice session not found for sessionId', sessionId: hangup.sessionId });
|
|
657
|
-
}
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
private async startVoiceSession(params: { sessionId: string }): Promise<VoiceSession> {
|
|
664
|
-
const voiceTrigger = this.flows.flatMap((flow) => flow.nodes).find((node) => node.type === NodeType.TRIGGER && node.triggerType === TriggerType.VOICE) as VoiceTriggerNode;
|
|
665
|
-
if (!voiceTrigger) {
|
|
666
|
-
throw new Error('Voice trigger not found in flows');
|
|
667
|
-
}
|
|
668
|
-
const voiceSession = new VoiceSession({
|
|
669
|
-
agent: this,
|
|
670
|
-
sessionId: params.sessionId,
|
|
671
|
-
firstMessage: voiceTrigger.firstMessage,
|
|
672
|
-
});
|
|
673
|
-
await voiceSession.init();
|
|
674
|
-
this.voiceSessions.set(params.sessionId, voiceSession);
|
|
675
|
-
return voiceSession;
|
|
676
|
-
}
|
|
677
600
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Agent } from './agent';
|
|
2
2
|
import events from './events';
|
|
3
3
|
|
|
4
|
-
export type { ElevenLabsContext } from './types/Voice.types';
|
|
5
4
|
export { Agent, events };
|
|
6
5
|
|
|
7
6
|
export type {
|
|
@@ -18,11 +17,8 @@ export type {
|
|
|
18
17
|
JunctionNode,
|
|
19
18
|
ToolNode,
|
|
20
19
|
AppToolNode,
|
|
21
|
-
VoiceTriggerNode,
|
|
22
|
-
WebhookTriggerNode,
|
|
23
20
|
} from './types/Flows.types';
|
|
24
21
|
export { NodeType, TriggerType, EdgeType, AppNodeMetadata, AppNodeMetadataType, NodeMetadata, KnownTriggerNames } from './types/Flows.types';
|
|
25
22
|
export type { Tool } from './types/Tools.types';
|
|
26
23
|
export { FlowHistoryType, FlowHistory, TriggerInvocationHistory, AppActionInvocationHistory } from './types/Agent.types';
|
|
27
|
-
export type { AgentInvokeParams } from './types/Agent.types';
|
|
28
24
|
export type { Environment } from './types/Platform.types';
|
package/src/platform/config.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { config } from 'dotenv';
|
|
3
3
|
import { Environment } from '../types/Platform.types';
|
|
4
|
-
|
|
5
|
-
console.log(`Loading config from ${path}`);
|
|
6
|
-
config({ path });
|
|
4
|
+
config({ path: resolve(__dirname, '../../.env') });
|
|
7
5
|
|
|
8
6
|
type MindedConfig = {
|
|
9
7
|
baseUrl: string;
|
|
@@ -11,9 +9,6 @@ type MindedConfig = {
|
|
|
11
9
|
token: string | null;
|
|
12
10
|
runLocally: boolean;
|
|
13
11
|
isDeployed: boolean;
|
|
14
|
-
dashboardConnected: boolean;
|
|
15
|
-
elevenLabsKey: string | null;
|
|
16
|
-
elevenLabsAgentId: string | null;
|
|
17
12
|
};
|
|
18
13
|
|
|
19
14
|
export const getConfig = (): MindedConfig => {
|
|
@@ -26,9 +21,6 @@ export const getConfig = (): MindedConfig => {
|
|
|
26
21
|
token: process.env.MINDED_CONNECTION_TOKEN || '',
|
|
27
22
|
runLocally: process.env.RUN_LOCALLY !== 'false',
|
|
28
23
|
isDeployed: process.env.IS_DEPLOYED_AGENT === 'true',
|
|
29
|
-
dashboardConnected: false,
|
|
30
|
-
elevenLabsKey: process.env.ELEVEN_LABS_API_KEY || null,
|
|
31
|
-
elevenLabsAgentId: process.env.ELEVEN_LABS_AGENT_ID || null,
|
|
32
24
|
};
|
|
33
25
|
case 'development':
|
|
34
26
|
return {
|
|
@@ -37,9 +29,6 @@ export const getConfig = (): MindedConfig => {
|
|
|
37
29
|
token: process.env.MINDED_CONNECTION_TOKEN || '',
|
|
38
30
|
runLocally: process.env.RUN_LOCALLY === 'true',
|
|
39
31
|
isDeployed: process.env.IS_DEPLOYED_AGENT === 'true',
|
|
40
|
-
dashboardConnected: true,
|
|
41
|
-
elevenLabsKey: process.env.ELEVEN_LABS_API_KEY || null,
|
|
42
|
-
elevenLabsAgentId: process.env.ELEVEN_LABS_AGENT_ID || 'Iyr6DCOj80AdvVEVHSGt',
|
|
43
32
|
};
|
|
44
33
|
case 'sandbox-staging':
|
|
45
34
|
return {
|
|
@@ -48,9 +37,6 @@ export const getConfig = (): MindedConfig => {
|
|
|
48
37
|
token: process.env.MINDED_CONNECTION_TOKEN || '',
|
|
49
38
|
runLocally: false,
|
|
50
39
|
isDeployed: process.env.IS_DEPLOYED_AGENT === 'true',
|
|
51
|
-
elevenLabsKey: process.env.ELEVEN_LABS_API_KEY || null,
|
|
52
|
-
dashboardConnected: true,
|
|
53
|
-
elevenLabsAgentId: process.env.ELEVEN_LABS_AGENT_ID || 'agent_01jye194psezr909nwec27m2t9',
|
|
54
40
|
};
|
|
55
41
|
case 'sandbox':
|
|
56
42
|
return {
|
|
@@ -59,9 +45,6 @@ export const getConfig = (): MindedConfig => {
|
|
|
59
45
|
token: process.env.MINDED_CONNECTION_TOKEN || '',
|
|
60
46
|
runLocally: false,
|
|
61
47
|
isDeployed: process.env.IS_DEPLOYED_AGENT === 'true',
|
|
62
|
-
elevenLabsKey: process.env.ELEVEN_LABS_API_KEY || null,
|
|
63
|
-
dashboardConnected: true,
|
|
64
|
-
elevenLabsAgentId: process.env.ELEVEN_LABS_AGENT_ID || 'agent_01jye194psezr909nwec27m2t9',
|
|
65
48
|
};
|
|
66
49
|
case 'production':
|
|
67
50
|
return {
|
|
@@ -70,9 +53,6 @@ export const getConfig = (): MindedConfig => {
|
|
|
70
53
|
token: process.env.MINDED_CONNECTION_TOKEN || '',
|
|
71
54
|
runLocally: false,
|
|
72
55
|
isDeployed: process.env.IS_DEPLOYED_AGENT === 'true',
|
|
73
|
-
elevenLabsKey: process.env.ELEVEN_LABS_API_KEY || null,
|
|
74
|
-
dashboardConnected: false,
|
|
75
|
-
elevenLabsAgentId: process.env.ELEVEN_LABS_AGENT_ID || 'agent_01jye1ajkaf17axpcxg220qwcm',
|
|
76
56
|
};
|
|
77
57
|
}
|
|
78
58
|
};
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import { io, Socket } from 'socket.io-client';
|
|
2
|
-
import { BaseMindedConnectionSocketMessage, MindedConnectionSocketMessageType
|
|
2
|
+
import { BaseMindedConnectionSocketMessage, MindedConnectionSocketMessageType } from './mindedConnectionTypes';
|
|
3
3
|
import { stringify } from 'flatted';
|
|
4
4
|
import { getConfig } from './config';
|
|
5
5
|
|
|
6
6
|
export class MindedConnection {
|
|
7
7
|
private socket: Socket | null = null;
|
|
8
8
|
listeners: {
|
|
9
|
-
[key: string]: ((message: BaseMindedConnectionSocketMessage
|
|
9
|
+
[key: string]: ((message: BaseMindedConnectionSocketMessage) => void)[];
|
|
10
10
|
} = {};
|
|
11
11
|
|
|
12
12
|
public get isConnected(): boolean {
|
|
13
13
|
return this.socket?.connected ?? false;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
public on = (event: MindedConnectionSocketMessageType, callback: (message: BaseMindedConnectionSocketMessage
|
|
16
|
+
public on = (event: MindedConnectionSocketMessageType, callback: (message: BaseMindedConnectionSocketMessage) => void) => {
|
|
17
17
|
if (!this.listeners[event]) {
|
|
18
18
|
this.listeners[event] = [];
|
|
19
19
|
}
|
|
20
20
|
this.listeners[event].push(callback);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
public emit =
|
|
24
|
-
event: E,
|
|
25
|
-
message: MindedConnectionSocketMessageTypeMap[E]
|
|
26
|
-
) => {
|
|
23
|
+
public emit = (event: MindedConnectionSocketMessageType, message: BaseMindedConnectionSocketMessage) => {
|
|
27
24
|
if (this.socket) {
|
|
28
25
|
this.socket.emit(event, message);
|
|
29
26
|
}
|
|
@@ -37,7 +34,7 @@ export class MindedConnection {
|
|
|
37
34
|
return new Promise((resolve, reject) => {
|
|
38
35
|
// Set up timeout
|
|
39
36
|
const timeout = setTimeout(() => {
|
|
40
|
-
reject(new Error(`Acknowledgement timeout after ${timeoutMs}ms
|
|
37
|
+
reject(new Error(`Acknowledgement timeout after ${timeoutMs}ms`));
|
|
41
38
|
}, timeoutMs);
|
|
42
39
|
|
|
43
40
|
// Emit with acknowledgement callback
|
|
@@ -73,8 +70,8 @@ export class MindedConnection {
|
|
|
73
70
|
});
|
|
74
71
|
|
|
75
72
|
this.socket.on('connect_error', () => {
|
|
76
|
-
console.error('
|
|
77
|
-
reject(new Error('
|
|
73
|
+
console.error('Failed to connect to minded platform');
|
|
74
|
+
reject(new Error('Failed to connect to minded platform'));
|
|
78
75
|
});
|
|
79
76
|
|
|
80
77
|
this.socket.on('disconnect', () => {
|
|
@@ -99,15 +96,12 @@ export class MindedConnection {
|
|
|
99
96
|
});
|
|
100
97
|
|
|
101
98
|
// Listen for specific message types
|
|
102
|
-
this.socket.onAny((event, message
|
|
99
|
+
this.socket.onAny((event, message) => {
|
|
103
100
|
if (this.listeners[event]) {
|
|
104
101
|
this.listeners[event].forEach((listener) => {
|
|
105
|
-
listener(message
|
|
102
|
+
listener(message);
|
|
106
103
|
});
|
|
107
104
|
}
|
|
108
|
-
else {
|
|
109
|
-
console.warn({ message: 'No listeners found for event', event });
|
|
110
|
-
}
|
|
111
105
|
});
|
|
112
106
|
|
|
113
107
|
// Handle process termination
|
|
@@ -7,43 +7,16 @@ import type {
|
|
|
7
7
|
CheckpointTuple,
|
|
8
8
|
} from '@langchain/langgraph-checkpoint';
|
|
9
9
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
10
|
-
import { AgentInvokeParams } from '../types/Agent.types';
|
|
11
10
|
|
|
12
11
|
export enum MindedConnectionSocketMessageType {
|
|
13
12
|
OnAppTrigger = 'on-app-trigger',
|
|
14
13
|
OnAppAction = 'on-app-action',
|
|
15
|
-
GET_SECRETS = 'get-secrets',
|
|
16
|
-
GET_FLOWS = 'get-flows',
|
|
17
|
-
INVOKE = 'invoke',
|
|
18
|
-
// Checkpoints
|
|
19
14
|
CHECKPOINT_GET_TUPLE = 'checkpoint-get-tuple',
|
|
20
15
|
CHECKPOINT_PUT = 'checkpoint-put',
|
|
21
16
|
CHECKPOINT_LIST = 'checkpoint-list',
|
|
22
17
|
CHECKPOINT_PUT_WRITES = 'checkpoint-put-writes',
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
DASHBOARD_VOICE_AGENT_AUDIO = 'dashboard-voice-agent-audio',
|
|
26
|
-
DASHBOARD_VOICE_SESSION_START = 'dashboard-voice-session-start',
|
|
27
|
-
DASHBOARD_VOICE_SESSION_END = 'dashboard-voice-session-end',
|
|
28
|
-
DASHBOARD_VOICE_INTERRUPTION = 'dashboard-voice-interruption',
|
|
29
|
-
DASHBOARD_VOICE_AGENT_RESPONSE_CORRECTION = 'dashboard-voice-agent-response-correction',
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export type MindedConnectionSocketMessageTypeMap = {
|
|
33
|
-
[MindedConnectionSocketMessageType.OnAppTrigger]: OnAppTrigger;
|
|
34
|
-
[MindedConnectionSocketMessageType.OnAppAction]: BaseMindedConnectionSocketMessage;
|
|
35
|
-
[MindedConnectionSocketMessageType.GET_SECRETS]: BaseMindedConnectionSocketMessage;
|
|
36
|
-
[MindedConnectionSocketMessageType.GET_FLOWS]: BaseMindedConnectionSocketMessage;
|
|
37
|
-
[MindedConnectionSocketMessageType.INVOKE]: InvokeMessage;
|
|
38
|
-
[MindedConnectionSocketMessageType.CHECKPOINT_GET_TUPLE]: OnCheckpointGetTuple;
|
|
39
|
-
[MindedConnectionSocketMessageType.CHECKPOINT_PUT]: OnCheckpointPut;
|
|
40
|
-
[MindedConnectionSocketMessageType.CHECKPOINT_LIST]: OnCheckpointList;
|
|
41
|
-
[MindedConnectionSocketMessageType.CHECKPOINT_PUT_WRITES]: OnCheckpointPutWrites;
|
|
42
|
-
[MindedConnectionSocketMessageType.DASHBOARD_VOICE_USER_AUDIO]: OnVoiceAudioIn;
|
|
43
|
-
[MindedConnectionSocketMessageType.DASHBOARD_VOICE_AGENT_AUDIO]: OnVoiceAudioOut;
|
|
44
|
-
[MindedConnectionSocketMessageType.DASHBOARD_VOICE_SESSION_START]: BaseVoiceMessage;
|
|
45
|
-
[MindedConnectionSocketMessageType.DASHBOARD_VOICE_SESSION_END]: OnVoiceSessionEnd;
|
|
46
|
-
[MindedConnectionSocketMessageType.DASHBOARD_VOICE_INTERRUPTION]: OnVoiceInterruption;
|
|
18
|
+
GET_SECRETS = 'get-secrets',
|
|
19
|
+
GET_FLOWS = 'get-flows',
|
|
47
20
|
}
|
|
48
21
|
|
|
49
22
|
export interface BaseMindedConnectionSocketMessage {
|
|
@@ -93,40 +66,3 @@ export interface OnCheckpointList extends BaseMindedConnectionSocketMessage {
|
|
|
93
66
|
export interface OnCheckpointListResponse extends BaseSdkConnectionSocketMessageResponseCallbackAck {
|
|
94
67
|
checkpoints?: CheckpointTuple[];
|
|
95
68
|
}
|
|
96
|
-
|
|
97
|
-
export interface BaseVoiceMessage extends BaseMindedConnectionSocketMessage {
|
|
98
|
-
sessionId: string;
|
|
99
|
-
timestamp: number;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Voice/Audio event interfaces
|
|
103
|
-
export interface OnVoiceAudioIn extends BaseVoiceMessage {
|
|
104
|
-
audioData: string; // base64 encoded audio data
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface OnVoiceAudioOut extends BaseVoiceMessage {
|
|
108
|
-
audioData: string; // base64 encoded audio data
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface OnVoiceMessageIn extends BaseVoiceMessage {
|
|
112
|
-
text: string;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface OnVoiceMessageOut extends BaseMindedConnectionSocketMessage {
|
|
116
|
-
sessionId: string;
|
|
117
|
-
text: string;
|
|
118
|
-
timestamp: number;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface OnVoiceInterruption extends BaseMindedConnectionSocketMessage {
|
|
122
|
-
sessionId: string;
|
|
123
|
-
timestamp: number;
|
|
124
|
-
}
|
|
125
|
-
export interface OnVoiceSessionEnd extends BaseMindedConnectionSocketMessage {
|
|
126
|
-
sessionId: string;
|
|
127
|
-
timestamp: number;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface InvokeMessage extends BaseMindedConnectionSocketMessage, AgentInvokeParams {
|
|
131
|
-
type: MindedConnectionSocketMessageType.INVOKE;
|
|
132
|
-
}
|
package/src/types/Agent.types.ts
CHANGED
|
@@ -9,20 +9,6 @@ export type MindedSDKConfig = {
|
|
|
9
9
|
tools: string[];
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Parameters for the Agent invoke method
|
|
14
|
-
*/
|
|
15
|
-
export interface AgentInvokeParams {
|
|
16
|
-
/** The payload/data associated with the trigger */
|
|
17
|
-
triggerBody: any;
|
|
18
|
-
/** The name/type of the trigger being invoked */
|
|
19
|
-
triggerName: string;
|
|
20
|
-
/** Optional session identifier for conversation continuity */
|
|
21
|
-
sessionId?: string;
|
|
22
|
-
/** Optional name of the application triggering the agent in case of an app trigger */
|
|
23
|
-
appName?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
12
|
export enum FlowHistoryType {
|
|
27
13
|
TRIGGER_INVOCATION = 'triggerInvocation',
|
|
28
14
|
APP_ACTION_INVOCATION = 'appActionInvocation',
|