nolo-cli 0.12.0-alpha.3 → 0.12.0-alpha.4

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 (37) hide show
  1. package/{_executeModel-DYX65HE6.js → _executeModel-L4JM5R23.js} +10 -10
  2. package/{agentEmailCommands-4EWEJIW3.js → agentEmailCommands-32ZZ4VSU.js} +9 -9
  3. package/{agentMachineCommands-23GPUVUG.js → agentMachineCommands-EHFBWQ2U.js} +3 -3
  4. package/{agentRecordCommands-5MST6OCG.js → agentRecordCommands-DSMDSFMJ.js} +9 -9
  5. package/{agentRunCommand-ZZCK5KS5.js → agentRunCommand-MEVHCOMH.js} +9 -9
  6. package/{agentSlice-5M6DF3VW.js → agentSlice-Y3NABOKT.js} +1 -1
  7. package/{chunk-SG4IHGHL.js → chunk-324SDMXK.js} +1 -1
  8. package/{chunk-3Q64BA2C.js → chunk-74D2NYOA.js} +3 -3
  9. package/{chunk-APQE7WBO.js → chunk-A4QALINN.js} +1 -1
  10. package/{chunk-OPHV7MFH.js → chunk-B54KNGXI.js} +2 -2
  11. package/{chunk-2VKA626C.js → chunk-DFGCBRIA.js} +11 -6
  12. package/{chunk-S4G3EZ3V.js → chunk-FMT767NK.js} +8 -8
  13. package/{chunk-Q37VOO7A.js → chunk-G5S6HMHH.js} +5 -5
  14. package/{chunk-OQIFEHJ3.js → chunk-MCXQFHBX.js} +11 -7
  15. package/{chunk-RSEUHW6T.js → chunk-MQRZ5QUH.js} +1 -1
  16. package/{chunk-7NGAIE2Y.js → chunk-QY4QCWDL.js} +2 -2
  17. package/{chunk-YDCZVUFP.js → chunk-RQSOAMPJ.js} +16 -0
  18. package/{chunk-XIOEEGEC.js → chunk-TNQJQ6HM.js} +13 -7
  19. package/{chunk-MHB7ECF2.js → chunk-TVQEB7RV.js} +1 -1
  20. package/{chunk-QZOLL5LS.js → chunk-TZS6YZTS.js} +13 -9
  21. package/{chunk-JK757FQM.js → chunk-YC2MRILU.js} +1 -1
  22. package/{createAgentAutomationAction-2Y6J7DVC.js → createAgentAutomationAction-YWC4P6JX.js} +2 -2
  23. package/{createDialogAction-HZR3DAFH.js → createDialogAction-IQP745JA.js} +3 -3
  24. package/{createPageAction-WIKKXHEK.js → createPageAction-T4RZCJKF.js} +2 -2
  25. package/{dialogSlice-FFRARUSK.js → dialogSlice-QR7SDOEV.js} +2 -2
  26. package/{docStore-7JP3KJMP.js → docStore-Y43RC35L.js} +3 -3
  27. package/{handleSendMessageAction-RTW7SKG4.js → handleSendMessageAction-L7L463O4.js} +2 -2
  28. package/index.js +15 -15
  29. package/{machineCommands-YA4W37PB.js → machineCommands-KJZXH2FO.js} +10 -10
  30. package/{machineWsRunDispatch-WEL6YC2V.js → machineWsRunDispatch-V4HBAZY6.js} +9 -9
  31. package/package.json +1 -1
  32. package/{readlineWorkspace-4L25GLAW.js → readlineWorkspace-LRPVHBM3.js} +18 -9
  33. package/{runAgentClientLoop-OJWWFGUK.js → runAgentClientLoop-DXNOTYXP.js} +8 -8
  34. package/{spaceSlice-2IORSGIG.js → spaceSlice-PSAREO5S.js} +2 -2
  35. package/{streamAgentChatTurn-EZ2HPJK6.js → streamAgentChatTurn-54CNCH2V.js} +205 -11
  36. package/{tools-QZNJVUVP.js → tools-SIU3JFHL.js} +6 -6
  37. package/{updateDialogTitleAction-HRVW3WRJ.js → updateDialogTitleAction-3VT7R3GN.js} +2 -2
@@ -20,11 +20,11 @@ import {
20
20
  sanitizeOutboundResponsesInput,
21
21
  sendOpenAICompletionsRequest,
22
22
  updateTotalUsage
23
- } from "./chunk-Q37VOO7A.js";
23
+ } from "./chunk-G5S6HMHH.js";
24
24
  import "./chunk-JEXVIMYZ.js";
25
25
  import {
26
26
  prepareTools
27
- } from "./chunk-JK757FQM.js";
27
+ } from "./chunk-YC2MRILU.js";
28
28
  import {
29
29
  fetchReferenceContents,
30
30
  generateRequestBody,
@@ -38,7 +38,7 @@ import {
38
38
  resolveToolsFromKeys,
39
39
  selectResponsesConversationState,
40
40
  updateResponsesConversationState
41
- } from "./chunk-2VKA626C.js";
41
+ } from "./chunk-DFGCBRIA.js";
42
42
  import "./chunk-4GBNEA5B.js";
43
43
  import {
44
44
  TOOL_PACKS,
@@ -50,8 +50,8 @@ import {
50
50
  getAllToolRuns,
51
51
  shouldBlockForGptPro,
52
52
  waitForAbortableDelay
53
- } from "./chunk-QZOLL5LS.js";
54
- import "./chunk-YDCZVUFP.js";
53
+ } from "./chunk-TZS6YZTS.js";
54
+ import "./chunk-RQSOAMPJ.js";
55
55
  import "./chunk-OOIN7HSO.js";
56
56
  import "./chunk-KQHGZWSV.js";
57
57
  import {
@@ -73,8 +73,8 @@ import "./chunk-63W5N6P3.js";
73
73
  import "./chunk-VF4K2QE6.js";
74
74
  import {
75
75
  getDocState
76
- } from "./chunk-7NGAIE2Y.js";
77
- import "./chunk-SG4IHGHL.js";
76
+ } from "./chunk-QY4QCWDL.js";
77
+ import "./chunk-324SDMXK.js";
78
78
  import "./chunk-VC6OZXO5.js";
79
79
  import {
80
80
  PERSONALIZATION_DIALOG_CATEGORY,
@@ -97,12 +97,12 @@ import {
97
97
  selectTableRows,
98
98
  selectViewMode,
99
99
  updateTokens
100
- } from "./chunk-S4G3EZ3V.js";
100
+ } from "./chunk-FMT767NK.js";
101
101
  import "./chunk-V2J635L5.js";
102
102
  import "./chunk-MRC4Q34M.js";
103
103
  import "./chunk-MTU75CZ2.js";
104
104
  import "./chunk-CWMSB67P.js";
105
- import "./chunk-3Q64BA2C.js";
105
+ import "./chunk-74D2NYOA.js";
106
106
  import {
107
107
  createCliChatTurnStream,
108
108
  getCliChatSession,
@@ -2887,6 +2887,122 @@ function hasInlineExecutedToolCalls(result) {
2887
2887
  const output = result?.output;
2888
2888
  return Array.isArray(output) && output.some((b) => b?.type === "toolCall" && b?.result != null);
2889
2889
  }
2890
+ function createRemoteToolEventHandlers(opts) {
2891
+ const { dialogId, dispatch, messageMetadata } = opts;
2892
+ const activeToolMessages = /* @__PURE__ */ new Map();
2893
+ const handleToolPayload = (payload) => {
2894
+ if (!payload || typeof payload !== "object") return;
2895
+ if (payload.type === "assistant_tool_calls") {
2896
+ const toolCalls = Array.isArray(payload.tool_calls) ? payload.tool_calls : [];
2897
+ for (const tc of toolCalls) {
2898
+ const callId = tc?.id;
2899
+ const toolName = tc?.function?.name;
2900
+ if (!callId || !toolName) continue;
2901
+ const { key: toolDbKey, messageId: toolMsgId } = createDialogMessageKeyAndId(dialogId);
2902
+ const argsStr = typeof tc.function?.arguments === "string" ? tc.function.arguments : "";
2903
+ const toolMsg = {
2904
+ id: toolMsgId,
2905
+ dialogId,
2906
+ dbKey: toolDbKey,
2907
+ role: "tool",
2908
+ content: "",
2909
+ isStreaming: true,
2910
+ toolName,
2911
+ toolCallId: callId,
2912
+ toolPayload: {
2913
+ toolName,
2914
+ status: "running",
2915
+ input: safeParseToolArgs(argsStr),
2916
+ rawToolCall: tc,
2917
+ summary: ""
2918
+ },
2919
+ ...messageMetadata
2920
+ };
2921
+ activeToolMessages.set(callId, toolMsg);
2922
+ dispatch(messageStreaming(toolMsg));
2923
+ }
2924
+ return;
2925
+ }
2926
+ if (payload.type === "tool_result") {
2927
+ const callId = payload.toolCallId;
2928
+ if (!callId) return;
2929
+ const existing = activeToolMessages.get(callId);
2930
+ const toolName = asOptionalTrimmedString(payload.toolName) || asOptionalTrimmedString(existing?.toolName) || "tool";
2931
+ const mergedMeta = isRecord(payload.metadata) ? payload.metadata : void 0;
2932
+ const isToolError = !!mergedMeta?.error;
2933
+ const projectedContent = projectDesktopToolUiContent({
2934
+ toolName,
2935
+ content: payload.content,
2936
+ metadata: mergedMeta ?? void 0
2937
+ });
2938
+ const resultStatus = isToolError ? "failed" : "succeeded";
2939
+ if (existing) {
2940
+ const updatedMsg = {
2941
+ ...existing,
2942
+ isStreaming: false,
2943
+ content: projectedContent,
2944
+ toolName,
2945
+ toolPayload: {
2946
+ ...existing.toolPayload ?? {},
2947
+ toolName,
2948
+ status: resultStatus
2949
+ }
2950
+ };
2951
+ activeToolMessages.set(callId, updatedMsg);
2952
+ dispatch(messageStreaming(updatedMsg));
2953
+ } else {
2954
+ const { key: toolDbKey, messageId: toolMsgId } = createDialogMessageKeyAndId(dialogId);
2955
+ const toolMsg = {
2956
+ id: toolMsgId,
2957
+ dialogId,
2958
+ dbKey: toolDbKey,
2959
+ role: "tool",
2960
+ content: projectedContent,
2961
+ isStreaming: false,
2962
+ toolName,
2963
+ toolCallId: callId,
2964
+ toolPayload: {
2965
+ toolName,
2966
+ status: resultStatus,
2967
+ input: {},
2968
+ summary: ""
2969
+ },
2970
+ ...messageMetadata
2971
+ };
2972
+ activeToolMessages.set(callId, toolMsg);
2973
+ dispatch(messageStreaming(toolMsg));
2974
+ }
2975
+ }
2976
+ };
2977
+ return { handleToolPayload, activeToolMessages };
2978
+ }
2979
+ async function persistRemoteToolMessagesAndCleanup(dispatch, activeToolMessages) {
2980
+ const durableTools = [];
2981
+ for (const toolMsg of activeToolMessages.values()) {
2982
+ const content = toolMsg?.content;
2983
+ const hasContent = typeof content === "string" ? content.trim().length > 0 : Array.isArray(content) && content.length > 0;
2984
+ if (!hasContent) {
2985
+ dispatch(removeTransientMessage(toolMsg.id));
2986
+ continue;
2987
+ }
2988
+ const stopped = { ...toolMsg, isStreaming: false };
2989
+ dispatch(messageStreaming(stopped));
2990
+ durableTools.push(stopped);
2991
+ }
2992
+ await persistToolMessages(dispatch, durableTools, {
2993
+ isStreaming: false,
2994
+ soft: true
2995
+ });
2996
+ activeToolMessages.clear();
2997
+ }
2998
+ function safeParseToolArgs(argsStr) {
2999
+ if (!argsStr) return {};
3000
+ try {
3001
+ return JSON.parse(argsStr);
3002
+ } catch {
3003
+ return { raw: argsStr };
3004
+ }
3005
+ }
2890
3006
  var streamAgentChatTurnHandler = async (args, thunkApi) => {
2891
3007
  const {
2892
3008
  agentKey,
@@ -3026,6 +3142,11 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3026
3142
  ...cliMessageMetadata,
3027
3143
  userId: selectIdentityUserId(getState())
3028
3144
  });
3145
+ const remoteToolHandlers = createRemoteToolEventHandlers({
3146
+ dialogId: dialogId2,
3147
+ dispatch,
3148
+ messageMetadata: cliMessageMetadata
3149
+ });
3029
3150
  dispatch(messageStreaming({
3030
3151
  id: messageId,
3031
3152
  dialogId: dialogId2,
@@ -3040,6 +3161,11 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3040
3161
  } else {
3041
3162
  dispatch(removeTransientMessage(messageId));
3042
3163
  }
3164
+ await persistRemoteToolMessagesAndCleanup(
3165
+ dispatch,
3166
+ remoteToolHandlers.activeToolMessages
3167
+ ).catch(() => {
3168
+ });
3043
3169
  setLoopStopReason("error");
3044
3170
  remoteTransientMessageFinalized = true;
3045
3171
  return rejectWithValue(message);
@@ -3082,8 +3208,20 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3082
3208
  const parseSSE = createSSEParser();
3083
3209
  const abortMachineStream = async () => {
3084
3210
  if (w2) w2.__LOOP_STOP_REASON__ = "aborted";
3085
- if (accumulated2.length <= 0) return;
3211
+ if (accumulated2.length <= 0) {
3212
+ await persistRemoteToolMessagesAndCleanup(
3213
+ dispatch,
3214
+ remoteToolHandlers.activeToolMessages
3215
+ ).catch(() => {
3216
+ });
3217
+ return;
3218
+ }
3086
3219
  await persistMessageWithFixedId(dispatch, buildMachineAssistantMessage());
3220
+ await persistRemoteToolMessagesAndCleanup(
3221
+ dispatch,
3222
+ remoteToolHandlers.activeToolMessages
3223
+ ).catch(() => {
3224
+ });
3087
3225
  };
3088
3226
  try {
3089
3227
  const result = await consumeAgentRunStream({
@@ -3098,6 +3236,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3098
3236
  if (payload.type === "error") {
3099
3237
  return { reject: payload.message || "\u7535\u8111\u7AEF Agent \u6267\u884C\u5931\u8D25" };
3100
3238
  }
3239
+ remoteToolHandlers.handleToolPayload(payload);
3101
3240
  if (payload.type === "text" && typeof payload.content === "string") {
3102
3241
  accumulated2 += payload.content;
3103
3242
  dispatch(messageStreaming({
@@ -3126,6 +3265,11 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3126
3265
  id: messageId,
3127
3266
  error: "\u7535\u8111\u7AEF Agent \u6D41\u5F0F\u54CD\u5E94\u88AB\u4E2D\u65AD,\u672A\u6536\u5230\u5B8C\u6210\u4FE1\u53F7"
3128
3267
  }));
3268
+ await persistRemoteToolMessagesAndCleanup(
3269
+ dispatch,
3270
+ remoteToolHandlers.activeToolMessages
3271
+ ).catch(() => {
3272
+ });
3129
3273
  remoteTransientMessageFinalized = true;
3130
3274
  setLoopStopReason("error");
3131
3275
  return rejectWithValue(
@@ -3133,6 +3277,10 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3133
3277
  );
3134
3278
  }
3135
3279
  await persistMessageWithFixedId(dispatch, buildMachineAssistantMessage());
3280
+ await persistRemoteToolMessagesAndCleanup(
3281
+ dispatch,
3282
+ remoteToolHandlers.activeToolMessages
3283
+ );
3136
3284
  remoteTransientMessageFinalized = true;
3137
3285
  }
3138
3286
  } finally {
@@ -3140,6 +3288,13 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3140
3288
  await reader2.cancel();
3141
3289
  } catch {
3142
3290
  }
3291
+ if (remoteToolHandlers.activeToolMessages.size > 0) {
3292
+ await persistRemoteToolMessagesAndCleanup(
3293
+ dispatch,
3294
+ remoteToolHandlers.activeToolMessages
3295
+ ).catch(() => {
3296
+ });
3297
+ }
3143
3298
  }
3144
3299
  return {
3145
3300
  usage: totalTurnUsage2 ?? void 0
@@ -3801,6 +3956,11 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3801
3956
  ...remoteMessageMetadata,
3802
3957
  userId: selectIdentityUserId(getState())
3803
3958
  });
3959
+ const remoteToolHandlers = createRemoteToolEventHandlers({
3960
+ dialogId,
3961
+ dispatch,
3962
+ messageMetadata: remoteMessageMetadata
3963
+ });
3804
3964
  loopKey = `loop:${dialogId}`;
3805
3965
  dispatch(addActiveController({ messageId: loopKey, controller: loopController, dialogKey }));
3806
3966
  dispatch(messageStreaming({
@@ -3817,6 +3977,11 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3817
3977
  } else {
3818
3978
  dispatch(removeTransientMessage(messageId));
3819
3979
  }
3980
+ await persistRemoteToolMessagesAndCleanup(
3981
+ dispatch,
3982
+ remoteToolHandlers.activeToolMessages
3983
+ ).catch(() => {
3984
+ });
3820
3985
  setLoopStopReason("error");
3821
3986
  remoteTransientMessageFinalized = true;
3822
3987
  return rejectWithValue(message);
@@ -3870,8 +4035,20 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3870
4035
  const decoder = new TextDecoder();
3871
4036
  const parseSSE = createSSEParser();
3872
4037
  const abortRemoteStream = async () => {
3873
- if (accumulated.length <= 0) return;
4038
+ if (accumulated.length <= 0) {
4039
+ await persistRemoteToolMessagesAndCleanup(
4040
+ dispatch,
4041
+ remoteToolHandlers.activeToolMessages
4042
+ ).catch(() => {
4043
+ });
4044
+ return;
4045
+ }
3874
4046
  await persistMessageWithFixedId(dispatch, buildRemoteAssistantMessage());
4047
+ await persistRemoteToolMessagesAndCleanup(
4048
+ dispatch,
4049
+ remoteToolHandlers.activeToolMessages
4050
+ ).catch(() => {
4051
+ });
3875
4052
  };
3876
4053
  try {
3877
4054
  const result = await consumeAgentRunStream({
@@ -3898,6 +4075,7 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3898
4075
  payload.agentKey
3899
4076
  );
3900
4077
  }
4078
+ remoteToolHandlers.handleToolPayload(payload);
3901
4079
  if (payload.type === "text" && typeof payload.content === "string") {
3902
4080
  accumulated += payload.content;
3903
4081
  dispatch(messageStreaming({
@@ -3926,6 +4104,11 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3926
4104
  id: messageId,
3927
4105
  error: "\u8FDC\u7AEF Agent \u6D41\u5F0F\u54CD\u5E94\u88AB\u4E2D\u65AD,\u672A\u6536\u5230\u5B8C\u6210\u4FE1\u53F7"
3928
4106
  }));
4107
+ await persistRemoteToolMessagesAndCleanup(
4108
+ dispatch,
4109
+ remoteToolHandlers.activeToolMessages
4110
+ ).catch(() => {
4111
+ });
3929
4112
  remoteTransientMessageFinalized = true;
3930
4113
  setLoopStopReason("error");
3931
4114
  return rejectWithValue(
@@ -3933,6 +4116,10 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3933
4116
  );
3934
4117
  }
3935
4118
  await persistMessageWithFixedId(dispatch, buildRemoteAssistantMessage());
4119
+ await persistRemoteToolMessagesAndCleanup(
4120
+ dispatch,
4121
+ remoteToolHandlers.activeToolMessages
4122
+ );
3936
4123
  remoteTransientMessageFinalized = true;
3937
4124
  }
3938
4125
  } finally {
@@ -3940,6 +4127,13 @@ var streamAgentChatTurnHandler = async (args, thunkApi) => {
3940
4127
  await reader.cancel();
3941
4128
  } catch {
3942
4129
  }
4130
+ if (remoteToolHandlers.activeToolMessages.size > 0) {
4131
+ await persistRemoteToolMessagesAndCleanup(
4132
+ dispatch,
4133
+ remoteToolHandlers.activeToolMessages
4134
+ ).catch(() => {
4135
+ });
4136
+ }
3943
4137
  }
3944
4138
  return {
3945
4139
  usage: totalTurnUsage2 ?? void 0
@@ -11,8 +11,8 @@ import {
11
11
  toolQueryFunc,
12
12
  toolQueryFunctionSchema,
13
13
  toolRegistry
14
- } from "./chunk-QZOLL5LS.js";
15
- import "./chunk-YDCZVUFP.js";
14
+ } from "./chunk-TZS6YZTS.js";
15
+ import "./chunk-RQSOAMPJ.js";
16
16
  import "./chunk-OOIN7HSO.js";
17
17
  import "./chunk-KQHGZWSV.js";
18
18
  import "./chunk-IVAOVLM7.js";
@@ -20,15 +20,15 @@ import "./chunk-3LY4F7SV.js";
20
20
  import "./chunk-VP4WJWKW.js";
21
21
  import "./chunk-63W5N6P3.js";
22
22
  import "./chunk-VF4K2QE6.js";
23
- import "./chunk-7NGAIE2Y.js";
24
- import "./chunk-SG4IHGHL.js";
23
+ import "./chunk-QY4QCWDL.js";
24
+ import "./chunk-324SDMXK.js";
25
25
  import "./chunk-VC6OZXO5.js";
26
- import "./chunk-S4G3EZ3V.js";
26
+ import "./chunk-FMT767NK.js";
27
27
  import "./chunk-V2J635L5.js";
28
28
  import "./chunk-MRC4Q34M.js";
29
29
  import "./chunk-MTU75CZ2.js";
30
30
  import "./chunk-CWMSB67P.js";
31
- import "./chunk-3Q64BA2C.js";
31
+ import "./chunk-74D2NYOA.js";
32
32
  import "./chunk-6LMFFG3K.js";
33
33
  import "./chunk-Z4NR32XR.js";
34
34
  import "./chunk-M76ECQRD.js";
@@ -6,7 +6,7 @@ import {
6
6
  isAssistantToolStub,
7
7
  selectAllMsgs,
8
8
  updateContentTitle
9
- } from "./chunk-S4G3EZ3V.js";
9
+ } from "./chunk-FMT767NK.js";
10
10
  import {
11
11
  BUILTIN_TITLE_LLM_CONFIG
12
12
  } from "./chunk-V2J635L5.js";
@@ -15,7 +15,7 @@ import "./chunk-MTU75CZ2.js";
15
15
  import "./chunk-CWMSB67P.js";
16
16
  import {
17
17
  runLlm
18
- } from "./chunk-3Q64BA2C.js";
18
+ } from "./chunk-74D2NYOA.js";
19
19
  import "./chunk-6LMFFG3K.js";
20
20
  import "./chunk-Z4NR32XR.js";
21
21
  import {