@minded-ai/mindedjs 2.0.19 → 2.0.21-beta-analytics-1
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 +32 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +93 -1
- package/dist/agent.js.map +1 -1
- package/dist/browserTask/CookieStore.d.ts +18 -0
- package/dist/browserTask/CookieStore.d.ts.map +1 -0
- package/dist/browserTask/CookieStore.js +43 -0
- package/dist/browserTask/CookieStore.js.map +1 -0
- package/dist/browserTask/README.md +419 -0
- package/dist/browserTask/browserAgent.py +632 -0
- package/dist/browserTask/captcha_isolated.png +0 -0
- package/dist/browserTask/executeBrowserTask.d.ts.map +1 -1
- package/dist/browserTask/executeBrowserTask.js +17 -0
- package/dist/browserTask/executeBrowserTask.js.map +1 -1
- package/dist/browserTask/executeBrowserTask.py +5 -5
- package/dist/browserTask/executeBrowserTask.ts +79 -0
- package/dist/browserTask/requirements.txt +8 -0
- package/dist/browserTask/setup.sh +144 -0
- package/dist/cli/index.js +0 -0
- package/dist/events/AgentEvents.d.ts +8 -1
- package/dist/events/AgentEvents.d.ts.map +1 -1
- package/dist/events/AgentEvents.js +1 -0
- package/dist/events/AgentEvents.js.map +1 -1
- package/dist/internalTools/retell.d.ts +12 -0
- package/dist/internalTools/retell.d.ts.map +1 -0
- package/dist/internalTools/retell.js +54 -0
- package/dist/internalTools/retell.js.map +1 -0
- package/dist/internalTools/sendPlaceholderMessage.d.ts +14 -0
- package/dist/internalTools/sendPlaceholderMessage.d.ts.map +1 -0
- package/dist/internalTools/sendPlaceholderMessage.js +61 -0
- package/dist/internalTools/sendPlaceholderMessage.js.map +1 -0
- package/dist/nodes/addAppToolNode.d.ts.map +1 -1
- package/dist/nodes/addAppToolNode.js +19 -4
- package/dist/nodes/addAppToolNode.js.map +1 -1
- package/dist/nodes/addBrowserTaskRunNode.d.ts.map +1 -1
- package/dist/nodes/addBrowserTaskRunNode.js +7 -3
- package/dist/nodes/addBrowserTaskRunNode.js.map +1 -1
- package/dist/platform/mindedConnectionTypes.d.ts +13 -1
- package/dist/platform/mindedConnectionTypes.d.ts.map +1 -1
- package/dist/platform/mindedConnectionTypes.js +2 -0
- package/dist/platform/mindedConnectionTypes.js.map +1 -1
- package/dist/types/Agent.types.d.ts +4 -0
- package/dist/types/Agent.types.d.ts.map +1 -1
- package/dist/types/Agent.types.js.map +1 -1
- package/dist/types/Analytics.types.d.ts +18 -0
- package/dist/types/Analytics.types.d.ts.map +1 -0
- package/dist/types/Analytics.types.js +19 -0
- package/dist/types/Analytics.types.js.map +1 -0
- package/dist/utils/extractStateMemoryResponse.d.ts +5 -0
- package/dist/utils/extractStateMemoryResponse.d.ts.map +1 -0
- package/dist/utils/extractStateMemoryResponse.js +91 -0
- package/dist/utils/extractStateMemoryResponse.js.map +1 -0
- package/package.json +1 -1
- package/src/agent.ts +105 -1
- package/src/browserTask/executeBrowserTask.py +5 -5
- package/src/browserTask/executeBrowserTask.ts +22 -4
- package/src/browserTask/profile/Default/Extension Rules/000003.log +0 -0
- package/src/browserTask/profile/Default/Extension Scripts/000003.log +0 -0
- package/src/browserTask/profile/Default/Extension State/000003.log +0 -0
- package/src/browserTask/profile/Default/GCM Store/000003.log +0 -0
- package/src/browserTask/profile/Default/Local Storage/leveldb/000004.log +0 -0
- package/src/browserTask/profile/Default/Session Storage/000003.log +0 -0
- package/src/browserTask/profile/Default/Site Characteristics Database/000003.log +0 -0
- package/src/browserTask/profile/Default/Sync Data/LevelDB/000003.log +0 -0
- package/src/browserTask/profile/Default/shared_proto_db/000003.log +0 -0
- package/src/browserTask/profile/Default/shared_proto_db/metadata/000003.log +0 -0
- package/src/events/AgentEvents.ts +7 -0
- package/src/nodes/addAppToolNode.ts +21 -5
- package/src/nodes/addBrowserTaskRunNode.ts +4 -0
- package/src/platform/mindedConnectionTypes.ts +15 -0
- package/src/types/Agent.types.ts +4 -0
- package/src/types/Analytics.types.ts +26 -0
|
Binary file
|
|
Binary file
|
|
@@ -9,6 +9,7 @@ export enum AgentEvents {
|
|
|
9
9
|
ERROR = 'ERROR',
|
|
10
10
|
ON_LOGICAL_CONDITION = 'ON_LOGICAL_CONDITION',
|
|
11
11
|
ON_LOGICAL_CONDITION_RESULT = 'ON_LOGICAL_CONDITION_RESULT',
|
|
12
|
+
ANALYTICS_EVENT = 'ANALYTICS_EVENT',
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export type AgentEventRequestPayloads<Memory> = {
|
|
@@ -40,6 +41,11 @@ export type AgentEventRequestPayloads<Memory> = {
|
|
|
40
41
|
executionTimeMs: number;
|
|
41
42
|
error?: Error;
|
|
42
43
|
};
|
|
44
|
+
[AgentEvents.ANALYTICS_EVENT]: {
|
|
45
|
+
eventName: string;
|
|
46
|
+
payload: Record<string, any>;
|
|
47
|
+
sessionId: string;
|
|
48
|
+
};
|
|
43
49
|
};
|
|
44
50
|
|
|
45
51
|
export type AgentEventResponsePayloads = {
|
|
@@ -55,4 +61,5 @@ export type AgentEventResponsePayloads = {
|
|
|
55
61
|
[AgentEvents.ON_LOGICAL_CONDITION_RESULT]: {
|
|
56
62
|
throwError: boolean;
|
|
57
63
|
};
|
|
64
|
+
[AgentEvents.ANALYTICS_EVENT]: void;
|
|
58
65
|
};
|
|
@@ -27,8 +27,6 @@ export const addAppToolNode = async ({
|
|
|
27
27
|
agent: Agent;
|
|
28
28
|
tools: Tool<any, any>[];
|
|
29
29
|
}) => {
|
|
30
|
-
const cleanedParameters = Object.fromEntries(Object.entries(node.parameters || {}).filter(([, value]) => value !== ''));
|
|
31
|
-
|
|
32
30
|
// Find the tool from the tools array by name
|
|
33
31
|
const appRunnerTool = tools.find((tool) => tool.name === node.displayName);
|
|
34
32
|
|
|
@@ -39,6 +37,21 @@ export const addAppToolNode = async ({
|
|
|
39
37
|
const callback: RunnableLike = async (state: typeof stateAnnotation.State) => {
|
|
40
38
|
logger.debug({ msg: `[Node] Executing tool node`, node: appRunnerTool.name });
|
|
41
39
|
|
|
40
|
+
// Compile parameters with variable injection support
|
|
41
|
+
const compiledParameters: Record<string, any> = {};
|
|
42
|
+
const compileContext = { state, memory: state.memory, env: process.env };
|
|
43
|
+
|
|
44
|
+
for (const [key, value] of Object.entries(node.parameters || {})) {
|
|
45
|
+
if (value !== '') {
|
|
46
|
+
// If the value is a string, compile it to allow variable injection
|
|
47
|
+
if (typeof value === 'string') {
|
|
48
|
+
compiledParameters[key] = compilePrompt(value, compileContext);
|
|
49
|
+
} else {
|
|
50
|
+
compiledParameters[key] = value;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
const executeWrapper = async (input: z.infer<typeof appRunnerTool.input>) => {
|
|
43
56
|
try {
|
|
44
57
|
const response = await appRunnerTool.execute({ input, state, agent });
|
|
@@ -56,6 +69,9 @@ export const addAppToolNode = async ({
|
|
|
56
69
|
|
|
57
70
|
const combinedPlaybooks = combinePlaybooks(agent.playbooks) || '';
|
|
58
71
|
|
|
72
|
+
// Compile the prompt if it exists to allow variable injection
|
|
73
|
+
const compiledNodePrompt = node.prompt ? compilePrompt(node.prompt, compileContext) : null;
|
|
74
|
+
|
|
59
75
|
const message = `${combinedPlaybooks ? combinedPlaybooks + '\n\n' : ''}
|
|
60
76
|
Additional context:
|
|
61
77
|
previous messages are available for context.
|
|
@@ -66,9 +82,9 @@ export const addAppToolNode = async ({
|
|
|
66
82
|
- User instructions for choosing tool parameters that are not set by the user (if any)
|
|
67
83
|
- Workflow memory
|
|
68
84
|
Parameters manually configured by the user are:
|
|
69
|
-
${JSON.stringify(
|
|
85
|
+
${JSON.stringify(compiledParameters)}
|
|
70
86
|
User instructions for choosing tool parameters are:
|
|
71
|
-
${
|
|
87
|
+
${compiledNodePrompt ? compiledNodePrompt : 'no instructions set by the user'}`;
|
|
72
88
|
|
|
73
89
|
const compiledPrompt = compilePrompt(message, { state: state, memory: state.memory, env: process.env });
|
|
74
90
|
const systemMessage = new SystemMessage(compiledPrompt);
|
|
@@ -81,7 +97,7 @@ export const addAppToolNode = async ({
|
|
|
81
97
|
const AIToolCallMessage = await llm.bindTools([tool], { tool_choice: tool.name }).invoke(state.messages);
|
|
82
98
|
AIToolCallMessage.tool_calls[0].args = {
|
|
83
99
|
...AIToolCallMessage.tool_calls[0].args,
|
|
84
|
-
...
|
|
100
|
+
...compiledParameters, //user set parameters have priority over ai generated parameters
|
|
85
101
|
};
|
|
86
102
|
const toolCallMessage = await tool.invoke(AIToolCallMessage.tool_calls[0]);
|
|
87
103
|
AIToolCallMessage.additional_kwargs = {
|
|
@@ -73,6 +73,7 @@ export const addBrowserTaskRunNode = async ({ graph, browserTaskNode, attachedTo
|
|
|
73
73
|
hasResult: !!result.result,
|
|
74
74
|
stepCount: result.steps?.length || 0,
|
|
75
75
|
recordingCount: result.recordings?.length || 0,
|
|
76
|
+
downloadedFilesCount: result.downloadedFiles?.length || 0,
|
|
76
77
|
});
|
|
77
78
|
|
|
78
79
|
// Create tool message with the result
|
|
@@ -83,6 +84,7 @@ export const addBrowserTaskRunNode = async ({ graph, browserTaskNode, attachedTo
|
|
|
83
84
|
steps: result.steps || [],
|
|
84
85
|
recordings: result.recordings || [],
|
|
85
86
|
inputParams: inputParams,
|
|
87
|
+
downloadedFiles: result.downloadedFiles || [],
|
|
86
88
|
}),
|
|
87
89
|
name: 'browser-task',
|
|
88
90
|
tool_call_id: toolCall.id,
|
|
@@ -95,6 +97,7 @@ export const addBrowserTaskRunNode = async ({ graph, browserTaskNode, attachedTo
|
|
|
95
97
|
steps: result.steps,
|
|
96
98
|
recordings: result.recordings,
|
|
97
99
|
inputParams: inputParams,
|
|
100
|
+
downloadedFiles: result.downloadedFiles || [],
|
|
98
101
|
},
|
|
99
102
|
},
|
|
100
103
|
});
|
|
@@ -111,6 +114,7 @@ export const addBrowserTaskRunNode = async ({ graph, browserTaskNode, attachedTo
|
|
|
111
114
|
nodeDisplayName: browserTaskNode.displayName,
|
|
112
115
|
steps: result.steps,
|
|
113
116
|
recordings: result.recordings,
|
|
117
|
+
downloadedFiles: result.downloadedFiles || [],
|
|
114
118
|
status: 'completed',
|
|
115
119
|
},
|
|
116
120
|
update: true, // This triggers the message reducer to update the existing message
|
|
@@ -56,6 +56,8 @@ export enum mindedConnectionSocketMessageType {
|
|
|
56
56
|
// Tool execution
|
|
57
57
|
EXECUTE_TOOL = 'execute-tool',
|
|
58
58
|
VECTORSTORE_QUERY = 'vectorstore-query',
|
|
59
|
+
// Analytics
|
|
60
|
+
ANALYTICS_EVENT = 'analytics-event',
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
export type mindedConnectionSocketMessageTypeMap = {
|
|
@@ -100,6 +102,7 @@ export type mindedConnectionSocketMessageTypeMap = {
|
|
|
100
102
|
[mindedConnectionSocketMessageType.INTERRUPT_SESSION_GET_MESSAGES]: InterruptSessionGetMessagesRequest;
|
|
101
103
|
[mindedConnectionSocketMessageType.EXECUTE_TOOL]: ExecuteToolRequest;
|
|
102
104
|
[mindedConnectionSocketMessageType.VECTORSTORE_QUERY]: VectorStoreQueryRequest;
|
|
105
|
+
[mindedConnectionSocketMessageType.ANALYTICS_EVENT]: AnalyticsEventRequest;
|
|
103
106
|
};
|
|
104
107
|
|
|
105
108
|
export interface BasemindedConnectionSocketMessage {
|
|
@@ -471,6 +474,7 @@ export interface InvokeBrowserTaskResponse extends BaseSdkConnectionSocketMessag
|
|
|
471
474
|
result?: any;
|
|
472
475
|
steps?: any[];
|
|
473
476
|
recordings?: any[];
|
|
477
|
+
downloadedFiles?: string[];
|
|
474
478
|
}
|
|
475
479
|
|
|
476
480
|
export interface ExecuteToolRequest extends BasemindedConnectionSocketMessage {
|
|
@@ -504,3 +508,14 @@ export interface VectorStoreQueryResponse extends BaseSdkConnectionSocketMessage
|
|
|
504
508
|
metadata: Record<string, any>;
|
|
505
509
|
}>;
|
|
506
510
|
}
|
|
511
|
+
|
|
512
|
+
export interface AnalyticsEventRequest extends BasemindedConnectionSocketMessage {
|
|
513
|
+
type: mindedConnectionSocketMessageType.ANALYTICS_EVENT;
|
|
514
|
+
eventName: string;
|
|
515
|
+
payload: Record<string, any>;
|
|
516
|
+
sessionId: string;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export interface AnalyticsEventResponse extends BaseSdkConnectionSocketMessageResponseCallbackAck {
|
|
520
|
+
success?: boolean;
|
|
521
|
+
}
|
package/src/types/Agent.types.ts
CHANGED
|
@@ -15,6 +15,10 @@ export type MindedSDKConfig = {
|
|
|
15
15
|
* Optional directories containing playbook definition files. If omitted, no playbooks will be loaded.
|
|
16
16
|
*/
|
|
17
17
|
playbooks?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Optional recursion limit for LangGraph execution. Defaults to 25 if not specified.
|
|
20
|
+
*/
|
|
21
|
+
recursionLimit?: number;
|
|
18
22
|
};
|
|
19
23
|
|
|
20
24
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum of default analytics event names emitted by the SDK
|
|
3
|
+
*/
|
|
4
|
+
export enum AnalyticsEventName {
|
|
5
|
+
INVOCATION_START = 'invocation_start',
|
|
6
|
+
// Future events can be added here:
|
|
7
|
+
// INVOCATION_END = 'invocation_end',
|
|
8
|
+
// INVOCATION_ERROR = 'invocation_error',
|
|
9
|
+
// TOOL_EXECUTION_START = 'tool_execution_start',
|
|
10
|
+
// TOOL_EXECUTION_END = 'tool_execution_end',
|
|
11
|
+
// NODE_TRANSITION = 'node_transition',
|
|
12
|
+
// VOICE_SESSION_START = 'voice_session_start',
|
|
13
|
+
// VOICE_SESSION_END = 'voice_session_end',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Interface for analytics events
|
|
18
|
+
*/
|
|
19
|
+
export interface AnalyticsEvent {
|
|
20
|
+
/** The name of the event being tracked */
|
|
21
|
+
eventName: string;
|
|
22
|
+
/** The data payload associated with the event */
|
|
23
|
+
payload: Record<string, any>;
|
|
24
|
+
/** Session ID associated with the event (required) */
|
|
25
|
+
sessionId: string;
|
|
26
|
+
}
|