deepclause-sdk 0.0.20 → 0.0.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.
|
@@ -1009,7 +1009,9 @@ mi_call(task(Desc), StateIn, StateOut) :-
|
|
|
1009
1009
|
get_memory(StateAfterAgent, OldMemory),
|
|
1010
1010
|
include(is_system_memory_message, OldMemory, SystemMessages),
|
|
1011
1011
|
append(SystemMessages, Messages, NewMemory),
|
|
1012
|
-
set_memory(StateAfterAgent, NewMemory, StateOut)
|
|
1012
|
+
set_memory(StateAfterAgent, NewMemory, StateOut),
|
|
1013
|
+
% Add exit trace for task/1
|
|
1014
|
+
add_trace_entry(SessionId, exit, task, [InterpDesc], Depth)
|
|
1013
1015
|
; % Fallback: just add task description and response (old behavior)
|
|
1014
1016
|
add_memory(StateAfterAgent, user, InterpDesc, State1),
|
|
1015
1017
|
( get_dict(response, Result, Response), Response \= ""
|
|
@@ -1038,6 +1040,8 @@ mi_call(prompt(Desc), StateIn, StateOut) :-
|
|
|
1038
1040
|
get_params(StateIn, Params),
|
|
1039
1041
|
interpolate_desc(Desc, Params, InterpDesc),
|
|
1040
1042
|
get_session_id(SessionId),
|
|
1043
|
+
get_depth(StateIn, Depth),
|
|
1044
|
+
add_trace_entry(SessionId, llm_call, prompt, [InterpDesc], Depth),
|
|
1041
1045
|
% prompt/N is a simple LLM call - no tools, no tool scope
|
|
1042
1046
|
engine_yield(request_agent_loop(InterpDesc, [], [], [], none)),
|
|
1043
1047
|
% Wait for agent_done (no tool calls expected since no tools provided)
|
|
@@ -1046,11 +1050,12 @@ mi_call(prompt(Desc), StateIn, StateOut) :-
|
|
|
1046
1050
|
retract(session_agent_result(SessionId, _)),
|
|
1047
1051
|
% Check success and warn on failure
|
|
1048
1052
|
( Result.success == true
|
|
1049
|
-
->
|
|
1053
|
+
-> add_trace_entry(SessionId, exit, prompt, [InterpDesc], Depth)
|
|
1050
1054
|
; ( get_dict(error, Result, ErrorMsg), ErrorMsg \= ""
|
|
1051
1055
|
-> format(atom(WarnMsg), 'Warning: prompt/1 failed: ~w', [ErrorMsg])
|
|
1052
1056
|
; format(atom(WarnMsg), 'Warning: prompt/1 failed (success=false)', [])
|
|
1053
1057
|
),
|
|
1058
|
+
add_trace_entry(SessionId, fail, prompt, [InterpDesc], Depth),
|
|
1054
1059
|
engine_yield(output(WarnMsg)),
|
|
1055
1060
|
fail
|
|
1056
1061
|
).
|
|
@@ -1070,6 +1075,8 @@ mi_call_prompt_n(Desc, Vars, VarNames, StateIn, StateOut) :-
|
|
|
1070
1075
|
get_params(StateIn, Params),
|
|
1071
1076
|
interpolate_desc(Desc, Params, InterpDesc),
|
|
1072
1077
|
get_session_id(SessionId),
|
|
1078
|
+
get_depth(StateIn, Depth),
|
|
1079
|
+
add_trace_entry(SessionId, llm_call, prompt, [InterpDesc], Depth),
|
|
1073
1080
|
% prompt/N is a simple LLM call - no tools, no tool scope
|
|
1074
1081
|
engine_yield(request_agent_loop(InterpDesc, VarNames, [], [], none)),
|
|
1075
1082
|
% Wait for agent_done (no tool calls expected since no tools provided)
|
|
@@ -1078,13 +1085,14 @@ mi_call_prompt_n(Desc, Vars, VarNames, StateIn, StateOut) :-
|
|
|
1078
1085
|
retract(session_agent_result(SessionId, _)),
|
|
1079
1086
|
% Check success and warn on failure
|
|
1080
1087
|
( Result.success == true
|
|
1081
|
-
->
|
|
1088
|
+
-> add_trace_entry(SessionId, exit, prompt, [InterpDesc], Depth)
|
|
1082
1089
|
; length(VarNames, Arity),
|
|
1083
1090
|
ActualArity is Arity + 1,
|
|
1084
1091
|
( get_dict(error, Result, ErrorMsg), ErrorMsg \= ""
|
|
1085
1092
|
-> format(atom(WarnMsg), 'Warning: prompt/~w failed: ~w', [ActualArity, ErrorMsg])
|
|
1086
1093
|
; format(atom(WarnMsg), 'Warning: prompt/~w failed (success=false)', [ActualArity])
|
|
1087
1094
|
),
|
|
1095
|
+
add_trace_entry(SessionId, fail, prompt, [InterpDesc], Depth),
|
|
1088
1096
|
engine_yield(output(WarnMsg)),
|
|
1089
1097
|
fail
|
|
1090
1098
|
),
|
|
@@ -1097,6 +1105,8 @@ mi_call_task_n(Desc, Vars, VarNames, StateIn, StateOut) :-
|
|
|
1097
1105
|
get_params(StateIn, Params),
|
|
1098
1106
|
interpolate_desc(Desc, Params, InterpDesc),
|
|
1099
1107
|
get_session_id(SessionId),
|
|
1108
|
+
get_depth(StateIn, Depth),
|
|
1109
|
+
add_trace_entry(SessionId, llm_call, task, [InterpDesc], Depth),
|
|
1100
1110
|
collect_user_tools(SessionId, UserTools),
|
|
1101
1111
|
get_memory(StateIn, Memory),
|
|
1102
1112
|
get_tool_scope(StateIn, ToolScope),
|
|
@@ -1124,7 +1134,9 @@ mi_call_task_n(Desc, Vars, VarNames, StateIn, StateOut) :-
|
|
|
1124
1134
|
get_memory(StateAfterAgent, OldMemory),
|
|
1125
1135
|
include(is_system_memory_message, OldMemory, SystemMessages),
|
|
1126
1136
|
append(SystemMessages, Messages, NewMemory),
|
|
1127
|
-
set_memory(StateAfterAgent, NewMemory, StateOut)
|
|
1137
|
+
set_memory(StateAfterAgent, NewMemory, StateOut),
|
|
1138
|
+
% Add exit trace for task_n
|
|
1139
|
+
add_trace_entry(SessionId, exit, task, [InterpDesc], Depth)
|
|
1128
1140
|
; % Fallback: just add task description and response (old behavior)
|
|
1129
1141
|
add_memory(StateAfterAgent, user, InterpDesc, State1),
|
|
1130
1142
|
( get_dict(response, Result, Response), Response \= ""
|
package/package.json
CHANGED
|
@@ -1009,7 +1009,9 @@ mi_call(task(Desc), StateIn, StateOut) :-
|
|
|
1009
1009
|
get_memory(StateAfterAgent, OldMemory),
|
|
1010
1010
|
include(is_system_memory_message, OldMemory, SystemMessages),
|
|
1011
1011
|
append(SystemMessages, Messages, NewMemory),
|
|
1012
|
-
set_memory(StateAfterAgent, NewMemory, StateOut)
|
|
1012
|
+
set_memory(StateAfterAgent, NewMemory, StateOut),
|
|
1013
|
+
% Add exit trace for task/1
|
|
1014
|
+
add_trace_entry(SessionId, exit, task, [InterpDesc], Depth)
|
|
1013
1015
|
; % Fallback: just add task description and response (old behavior)
|
|
1014
1016
|
add_memory(StateAfterAgent, user, InterpDesc, State1),
|
|
1015
1017
|
( get_dict(response, Result, Response), Response \= ""
|
|
@@ -1038,6 +1040,8 @@ mi_call(prompt(Desc), StateIn, StateOut) :-
|
|
|
1038
1040
|
get_params(StateIn, Params),
|
|
1039
1041
|
interpolate_desc(Desc, Params, InterpDesc),
|
|
1040
1042
|
get_session_id(SessionId),
|
|
1043
|
+
get_depth(StateIn, Depth),
|
|
1044
|
+
add_trace_entry(SessionId, llm_call, prompt, [InterpDesc], Depth),
|
|
1041
1045
|
% prompt/N is a simple LLM call - no tools, no tool scope
|
|
1042
1046
|
engine_yield(request_agent_loop(InterpDesc, [], [], [], none)),
|
|
1043
1047
|
% Wait for agent_done (no tool calls expected since no tools provided)
|
|
@@ -1046,11 +1050,12 @@ mi_call(prompt(Desc), StateIn, StateOut) :-
|
|
|
1046
1050
|
retract(session_agent_result(SessionId, _)),
|
|
1047
1051
|
% Check success and warn on failure
|
|
1048
1052
|
( Result.success == true
|
|
1049
|
-
->
|
|
1053
|
+
-> add_trace_entry(SessionId, exit, prompt, [InterpDesc], Depth)
|
|
1050
1054
|
; ( get_dict(error, Result, ErrorMsg), ErrorMsg \= ""
|
|
1051
1055
|
-> format(atom(WarnMsg), 'Warning: prompt/1 failed: ~w', [ErrorMsg])
|
|
1052
1056
|
; format(atom(WarnMsg), 'Warning: prompt/1 failed (success=false)', [])
|
|
1053
1057
|
),
|
|
1058
|
+
add_trace_entry(SessionId, fail, prompt, [InterpDesc], Depth),
|
|
1054
1059
|
engine_yield(output(WarnMsg)),
|
|
1055
1060
|
fail
|
|
1056
1061
|
).
|
|
@@ -1070,6 +1075,8 @@ mi_call_prompt_n(Desc, Vars, VarNames, StateIn, StateOut) :-
|
|
|
1070
1075
|
get_params(StateIn, Params),
|
|
1071
1076
|
interpolate_desc(Desc, Params, InterpDesc),
|
|
1072
1077
|
get_session_id(SessionId),
|
|
1078
|
+
get_depth(StateIn, Depth),
|
|
1079
|
+
add_trace_entry(SessionId, llm_call, prompt, [InterpDesc], Depth),
|
|
1073
1080
|
% prompt/N is a simple LLM call - no tools, no tool scope
|
|
1074
1081
|
engine_yield(request_agent_loop(InterpDesc, VarNames, [], [], none)),
|
|
1075
1082
|
% Wait for agent_done (no tool calls expected since no tools provided)
|
|
@@ -1078,13 +1085,14 @@ mi_call_prompt_n(Desc, Vars, VarNames, StateIn, StateOut) :-
|
|
|
1078
1085
|
retract(session_agent_result(SessionId, _)),
|
|
1079
1086
|
% Check success and warn on failure
|
|
1080
1087
|
( Result.success == true
|
|
1081
|
-
->
|
|
1088
|
+
-> add_trace_entry(SessionId, exit, prompt, [InterpDesc], Depth)
|
|
1082
1089
|
; length(VarNames, Arity),
|
|
1083
1090
|
ActualArity is Arity + 1,
|
|
1084
1091
|
( get_dict(error, Result, ErrorMsg), ErrorMsg \= ""
|
|
1085
1092
|
-> format(atom(WarnMsg), 'Warning: prompt/~w failed: ~w', [ActualArity, ErrorMsg])
|
|
1086
1093
|
; format(atom(WarnMsg), 'Warning: prompt/~w failed (success=false)', [ActualArity])
|
|
1087
1094
|
),
|
|
1095
|
+
add_trace_entry(SessionId, fail, prompt, [InterpDesc], Depth),
|
|
1088
1096
|
engine_yield(output(WarnMsg)),
|
|
1089
1097
|
fail
|
|
1090
1098
|
),
|
|
@@ -1097,6 +1105,8 @@ mi_call_task_n(Desc, Vars, VarNames, StateIn, StateOut) :-
|
|
|
1097
1105
|
get_params(StateIn, Params),
|
|
1098
1106
|
interpolate_desc(Desc, Params, InterpDesc),
|
|
1099
1107
|
get_session_id(SessionId),
|
|
1108
|
+
get_depth(StateIn, Depth),
|
|
1109
|
+
add_trace_entry(SessionId, llm_call, task, [InterpDesc], Depth),
|
|
1100
1110
|
collect_user_tools(SessionId, UserTools),
|
|
1101
1111
|
get_memory(StateIn, Memory),
|
|
1102
1112
|
get_tool_scope(StateIn, ToolScope),
|
|
@@ -1124,7 +1134,9 @@ mi_call_task_n(Desc, Vars, VarNames, StateIn, StateOut) :-
|
|
|
1124
1134
|
get_memory(StateAfterAgent, OldMemory),
|
|
1125
1135
|
include(is_system_memory_message, OldMemory, SystemMessages),
|
|
1126
1136
|
append(SystemMessages, Messages, NewMemory),
|
|
1127
|
-
set_memory(StateAfterAgent, NewMemory, StateOut)
|
|
1137
|
+
set_memory(StateAfterAgent, NewMemory, StateOut),
|
|
1138
|
+
% Add exit trace for task_n
|
|
1139
|
+
add_trace_entry(SessionId, exit, task, [InterpDesc], Depth)
|
|
1128
1140
|
; % Fallback: just add task description and response (old behavior)
|
|
1129
1141
|
add_memory(StateAfterAgent, user, InterpDesc, State1),
|
|
1130
1142
|
( get_dict(response, Result, Response), Response \= ""
|