@uipath/uipath-typescript 1.4.2 → 1.5.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/README.md +7 -1
- package/dist/agent-memory/index.d.ts +4 -1
- package/dist/agents/index.cjs +341 -6
- package/dist/agents/index.d.ts +717 -16
- package/dist/agents/index.mjs +342 -7
- package/dist/assets/index.cjs +132 -15
- package/dist/assets/index.d.ts +12 -1
- package/dist/assets/index.mjs +132 -15
- package/dist/attachments/index.cjs +120 -12
- package/dist/attachments/index.mjs +120 -12
- package/dist/buckets/index.cjs +136 -15
- package/dist/buckets/index.d.ts +12 -1
- package/dist/buckets/index.mjs +136 -15
- package/dist/cases/index.cjs +1203 -938
- package/dist/cases/index.d.ts +325 -45
- package/dist/cases/index.mjs +1203 -938
- package/dist/conversational-agent/index.cjs +48 -10
- package/dist/conversational-agent/index.d.ts +117 -6
- package/dist/conversational-agent/index.mjs +48 -10
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.mjs +1 -1
- package/dist/entities/index.cjs +448 -9
- package/dist/entities/index.d.ts +441 -1
- package/dist/entities/index.mjs +447 -10
- package/dist/feedback/index.cjs +25 -9
- package/dist/feedback/index.mjs +25 -9
- package/dist/index.cjs +1281 -330
- package/dist/index.d.ts +1988 -143
- package/dist/index.mjs +1282 -331
- package/dist/index.umd.js +1230 -279
- package/dist/jobs/index.cjs +141 -19
- package/dist/jobs/index.d.ts +22 -6
- package/dist/jobs/index.mjs +141 -19
- package/dist/maestro-processes/index.cjs +553 -354
- package/dist/maestro-processes/index.d.ts +376 -47
- package/dist/maestro-processes/index.mjs +553 -354
- package/dist/notifications/index.cjs +2012 -0
- package/dist/notifications/index.d.ts +615 -0
- package/dist/notifications/index.mjs +2010 -0
- package/dist/processes/index.cjs +118 -18
- package/dist/processes/index.d.ts +18 -2
- package/dist/processes/index.mjs +118 -18
- package/dist/queues/index.cjs +131 -14
- package/dist/queues/index.d.ts +12 -1
- package/dist/queues/index.mjs +131 -14
- package/dist/tasks/index.cjs +125 -13
- package/dist/tasks/index.d.ts +4 -1
- package/dist/tasks/index.mjs +125 -13
- package/dist/traces/index.cjs +220 -6
- package/dist/traces/index.d.ts +360 -25
- package/dist/traces/index.mjs +221 -7
- package/package.json +14 -4
|
@@ -1023,7 +1023,16 @@ const CONVERSATIONAL_TOKEN_PARAMS = {
|
|
|
1023
1023
|
* Returns the original value if parsing fails.
|
|
1024
1024
|
*/
|
|
1025
1025
|
/**
|
|
1026
|
-
* Transforms data by
|
|
1026
|
+
* Transforms data by renaming each key in `data` exactly once, using the
|
|
1027
|
+
* mapping (`sourceField → targetField`). Keys not present in the mapping
|
|
1028
|
+
* pass through unchanged. The original (pre-rename) key is dropped — the
|
|
1029
|
+
* result contains only the renamed key.
|
|
1030
|
+
*
|
|
1031
|
+
* Each rename is independent. If the mapping happens to contain chained
|
|
1032
|
+
* entries (`a → b` and `b → c`), they do NOT compose: a field named `a`
|
|
1033
|
+
* in `data` becomes `b` (not `c`), because the renames are applied based
|
|
1034
|
+
* on the original data's keys, not the running result.
|
|
1035
|
+
*
|
|
1027
1036
|
* @param data The source data to transform
|
|
1028
1037
|
* @param fieldMapping Object mapping source field names to target field names
|
|
1029
1038
|
* @returns Transformed data with mapped field names
|
|
@@ -1046,21 +1055,28 @@ const CONVERSATIONAL_TOKEN_PARAMS = {
|
|
|
1046
1055
|
* // { userId: '123', name: 'john' },
|
|
1047
1056
|
* // { userId: '456', name: 'jane' }
|
|
1048
1057
|
* // ]
|
|
1058
|
+
*
|
|
1059
|
+
* // No chaining — `a → b` does not become `a → c` even if the map has `b → c`.
|
|
1060
|
+
* transformData({ a: 1 }, { a: 'b', b: 'c' });
|
|
1061
|
+
* // result = { b: 1 }
|
|
1049
1062
|
* ```
|
|
1050
1063
|
*/
|
|
1051
1064
|
function transformData(data, fieldMapping) {
|
|
1065
|
+
// Pass null/undefined through unchanged — callers (e.g. AttachmentService.getById)
|
|
1066
|
+
// may invoke this on optional fields that an OData `select` excluded.
|
|
1067
|
+
if (data == null) {
|
|
1068
|
+
return data;
|
|
1069
|
+
}
|
|
1052
1070
|
// Handle array of objects
|
|
1053
1071
|
if (Array.isArray(data)) {
|
|
1054
1072
|
return data.map(item => transformData(item, fieldMapping));
|
|
1055
1073
|
}
|
|
1056
|
-
//
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
result[targetField] = value;
|
|
1063
|
-
}
|
|
1074
|
+
// Walk the ORIGINAL data's keys, look up each in the mapping. One rename
|
|
1075
|
+
// per data key — no mutation of an in-progress result, so chains can't form.
|
|
1076
|
+
const result = {};
|
|
1077
|
+
for (const [key, value] of Object.entries(data)) {
|
|
1078
|
+
const renamedKey = fieldMapping[key] ?? key;
|
|
1079
|
+
result[renamedKey] = value;
|
|
1064
1080
|
}
|
|
1065
1081
|
return result;
|
|
1066
1082
|
}
|
|
@@ -2821,6 +2837,7 @@ class ToolCallEventHelper extends ConversationEventHelperBase {
|
|
|
2821
2837
|
this.startEventMaybe = startEventMaybe;
|
|
2822
2838
|
this._endHandlers = new Array();
|
|
2823
2839
|
this._confirmHandlers = new Array();
|
|
2840
|
+
this._executingHandlers = new Array();
|
|
2824
2841
|
this.addStartEventTimestamp(startEventMaybe);
|
|
2825
2842
|
}
|
|
2826
2843
|
/**
|
|
@@ -2905,6 +2922,21 @@ class ToolCallEventHelper extends ConversationEventHelperBase {
|
|
|
2905
2922
|
this.assertNotEnded();
|
|
2906
2923
|
this.emit({ confirmToolCall });
|
|
2907
2924
|
}
|
|
2925
|
+
/**
|
|
2926
|
+
* Registers a handler for executingToolCall events.
|
|
2927
|
+
* Fired when the tool is about to be executed. For client-side tools,
|
|
2928
|
+
* the client should begin executing its handler upon receiving this.
|
|
2929
|
+
* @returns Cleanup function to remove the handler.
|
|
2930
|
+
* @internal
|
|
2931
|
+
*/
|
|
2932
|
+
onExecutingToolCall(cb) {
|
|
2933
|
+
this._executingHandlers.push(cb);
|
|
2934
|
+
return () => {
|
|
2935
|
+
const index = this._executingHandlers.indexOf(cb);
|
|
2936
|
+
if (index >= 0)
|
|
2937
|
+
this._executingHandlers.splice(index, 1);
|
|
2938
|
+
};
|
|
2939
|
+
}
|
|
2908
2940
|
/**
|
|
2909
2941
|
* Sends an error start event for this tool call.
|
|
2910
2942
|
*/
|
|
@@ -2984,6 +3016,10 @@ class ToolCallEventHelperImpl extends ToolCallEventHelper {
|
|
|
2984
3016
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2985
3017
|
this._confirmHandlers.forEach(cb => cb(toolCallEvent.confirmToolCall));
|
|
2986
3018
|
}
|
|
3019
|
+
if (toolCallEvent.executingToolCall) {
|
|
3020
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3021
|
+
this._executingHandlers.forEach(cb => cb(toolCallEvent.executingToolCall));
|
|
3022
|
+
}
|
|
2987
3023
|
if (toolCallEvent.endToolCall) {
|
|
2988
3024
|
this.setEnded();
|
|
2989
3025
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -3580,7 +3616,9 @@ class ExchangeEventHelper extends ConversationEventHelperBase {
|
|
|
3580
3616
|
this.emit({ metaEvent });
|
|
3581
3617
|
}
|
|
3582
3618
|
/**
|
|
3583
|
-
* Ends the exchange
|
|
3619
|
+
* Ends the exchange. Stops further events for that exchange from being received.
|
|
3620
|
+
* Can be called from either the client side (to stop an in-progress response) or
|
|
3621
|
+
* the server/agent side (to signal natural completion).
|
|
3584
3622
|
* @throws Error if exchange has already ended.
|
|
3585
3623
|
*/
|
|
3586
3624
|
sendExchangeEnd(endExchange = {}) {
|
|
@@ -887,6 +887,16 @@ interface SessionEndingEvent {
|
|
|
887
887
|
*/
|
|
888
888
|
timeToLiveMS: number;
|
|
889
889
|
}
|
|
890
|
+
/**
|
|
891
|
+
* A client-side tool that the client supports, declared during exchange start
|
|
892
|
+
* so the server knows which tools to route client-side.
|
|
893
|
+
* @internal
|
|
894
|
+
*/
|
|
895
|
+
interface ClientSideTool {
|
|
896
|
+
name: string;
|
|
897
|
+
inputSchema?: JSONValue;
|
|
898
|
+
outputSchema?: JSONValue;
|
|
899
|
+
}
|
|
890
900
|
/**
|
|
891
901
|
* Signals the start of an exchange of messages within a conversation.
|
|
892
902
|
*/
|
|
@@ -903,6 +913,12 @@ interface ExchangeStartEvent {
|
|
|
903
913
|
* The time the exchange started.
|
|
904
914
|
*/
|
|
905
915
|
timestamp?: string;
|
|
916
|
+
/**
|
|
917
|
+
* Optional list of client-side tools the client supports. The server validates these against the agent's
|
|
918
|
+
* design-time definitions and forwards them to the runtime so it knows which tools to route client-side.
|
|
919
|
+
* @internal
|
|
920
|
+
*/
|
|
921
|
+
clientSideTools?: ClientSideTool[];
|
|
906
922
|
}
|
|
907
923
|
/**
|
|
908
924
|
* Signals the end of an exchange of messages within a conversation.
|
|
@@ -1156,6 +1172,16 @@ interface ToolCallStartEvent {
|
|
|
1156
1172
|
* `requireConfirmation` is true so the client can render an editable form.
|
|
1157
1173
|
*/
|
|
1158
1174
|
inputSchema?: JSONValue;
|
|
1175
|
+
/**
|
|
1176
|
+
* Output schema — used by the client to render the result form for client-side tools.
|
|
1177
|
+
* @internal
|
|
1178
|
+
*/
|
|
1179
|
+
outputSchema?: JSONValue;
|
|
1180
|
+
/**
|
|
1181
|
+
* Indicates this tool call should be executed client-side rather than server-side.
|
|
1182
|
+
* @internal
|
|
1183
|
+
*/
|
|
1184
|
+
isClientSideTool?: boolean;
|
|
1159
1185
|
}
|
|
1160
1186
|
/**
|
|
1161
1187
|
* Sent by the client to approve or reject a tool call that was emitted with
|
|
@@ -1198,6 +1224,20 @@ interface ToolCallEndEvent {
|
|
|
1198
1224
|
*/
|
|
1199
1225
|
metaData?: MetaData;
|
|
1200
1226
|
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Signals to the client that the tool is about to be executed. Emitted in all scenarios
|
|
1229
|
+
* (server-side and client-side tools). For client-side tools, the client should begin
|
|
1230
|
+
* executing its registered handler upon receiving this event.
|
|
1231
|
+
* @internal
|
|
1232
|
+
*/
|
|
1233
|
+
interface ExecutingToolCallEvent {
|
|
1234
|
+
/**
|
|
1235
|
+
* The time the tool call began executing.
|
|
1236
|
+
*/
|
|
1237
|
+
timestamp?: string;
|
|
1238
|
+
/** The final tool input, reflecting any modifications made during tool-call confirmation. */
|
|
1239
|
+
input?: ToolCallInputValue;
|
|
1240
|
+
}
|
|
1201
1241
|
/**
|
|
1202
1242
|
* Allows additional events to be sent in the context of the enclosing event stream.
|
|
1203
1243
|
*/
|
|
@@ -1238,6 +1278,12 @@ interface ToolCallEvent {
|
|
|
1238
1278
|
* emitted with `requireConfirmation: true`.
|
|
1239
1279
|
*/
|
|
1240
1280
|
confirmToolCall?: ToolCallConfirmationEvent;
|
|
1281
|
+
/**
|
|
1282
|
+
* Signals that the tool is about to be executed. For client-side tools,
|
|
1283
|
+
* the client should begin executing its handler upon receiving this event.
|
|
1284
|
+
* @internal
|
|
1285
|
+
*/
|
|
1286
|
+
executingToolCall?: ExecutingToolCallEvent;
|
|
1241
1287
|
/**
|
|
1242
1288
|
* Allows additional events to be sent in the context of the enclosing event stream.
|
|
1243
1289
|
*/
|
|
@@ -1916,6 +1962,19 @@ type CompletedToolCall = ToolCallStartEvent & ToolCallEndEvent & {
|
|
|
1916
1962
|
* }
|
|
1917
1963
|
* });
|
|
1918
1964
|
* ```
|
|
1965
|
+
*
|
|
1966
|
+
* @example Handling client-side tool execution
|
|
1967
|
+
* ```typescript
|
|
1968
|
+
* message.onToolCallStart((toolCall) => {
|
|
1969
|
+
* const { isClientSideTool, toolName } = toolCall.startEvent;
|
|
1970
|
+
* if (!isClientSideTool) return;
|
|
1971
|
+
*
|
|
1972
|
+
* toolCall.onExecutingToolCall(async (event) => {
|
|
1973
|
+
* const result = await runLocalProcess(toolName, event.input);
|
|
1974
|
+
* toolCall.sendToolCallEnd({ output: result });
|
|
1975
|
+
* });
|
|
1976
|
+
* });
|
|
1977
|
+
* ```
|
|
1919
1978
|
*/
|
|
1920
1979
|
interface ToolCallStream {
|
|
1921
1980
|
/** Unique identifier for this tool call */
|
|
@@ -1987,6 +2046,24 @@ interface ToolCallStream {
|
|
|
1987
2046
|
* ```
|
|
1988
2047
|
*/
|
|
1989
2048
|
onToolCallConfirm(callback: (confirmToolCall: ToolCallConfirmationEvent) => void): () => void;
|
|
2049
|
+
/**
|
|
2050
|
+
* Registers a handler for executingToolCall events. Fired when the tool is about
|
|
2051
|
+
* to be executed. For client-side tools, the client should begin executing its
|
|
2052
|
+
* handler upon receiving this event.
|
|
2053
|
+
*
|
|
2054
|
+
* @param cb - Callback receiving the executing event
|
|
2055
|
+
* @returns Cleanup function to remove the handler
|
|
2056
|
+
*
|
|
2057
|
+
* @example Handling client-side tool execution
|
|
2058
|
+
* ```typescript
|
|
2059
|
+
* toolCall.onExecutingToolCall(async (event) => {
|
|
2060
|
+
* const result = await executeLocally(toolCall.startEvent.toolName, event.input);
|
|
2061
|
+
* toolCall.sendToolCallEnd({ output: result });
|
|
2062
|
+
* });
|
|
2063
|
+
* ```
|
|
2064
|
+
* @internal
|
|
2065
|
+
*/
|
|
2066
|
+
onExecutingToolCall(cb: (event: ExecutingToolCallEvent) => void): () => void;
|
|
1990
2067
|
/**
|
|
1991
2068
|
* Ends the tool call
|
|
1992
2069
|
*
|
|
@@ -3018,12 +3095,23 @@ interface ExchangeStream {
|
|
|
3018
3095
|
*/
|
|
3019
3096
|
getMessage(messageId: string): MessageStream | undefined;
|
|
3020
3097
|
/**
|
|
3021
|
-
* Ends the exchange
|
|
3098
|
+
* Ends the exchange. Stops further events for that exchange from being received.
|
|
3099
|
+
* Use this to stop an in-progress agent response from the client side.
|
|
3022
3100
|
*
|
|
3023
3101
|
* @param endExchange - Optional end event data
|
|
3024
3102
|
*
|
|
3025
|
-
* @example Manually ending an exchange
|
|
3103
|
+
* @example Manually ending an exchange and stopping a response mid-stream
|
|
3104
|
+
* ```typescript
|
|
3105
|
+
* session.onExchangeStart((exchange) => {
|
|
3106
|
+
* stopButton.addEventListener('click', () => exchange.sendExchangeEnd());
|
|
3107
|
+
* });
|
|
3108
|
+
* ```
|
|
3109
|
+
*
|
|
3110
|
+
* @example End an exchange after sending a message
|
|
3026
3111
|
* ```typescript
|
|
3112
|
+
* const exchange = session.startExchange();
|
|
3113
|
+
* exchange.sendMessageWithContentPart({ data: 'Hello!' });
|
|
3114
|
+
* // Later, stop the response
|
|
3027
3115
|
* exchange.sendExchangeEnd();
|
|
3028
3116
|
* ```
|
|
3029
3117
|
*/
|
|
@@ -4805,6 +4893,7 @@ type FeatureFlags = Record<string, unknown>;
|
|
|
4805
4893
|
* S -->|onExchangeStart| E["ExchangeStream"]
|
|
4806
4894
|
* S -->|onSessionEnd| SE(["session closed"])
|
|
4807
4895
|
* E -->|onMessageStart| M["MessageStream"]
|
|
4896
|
+
* E -->|sendExchangeEnd| STOP(["stop response"])
|
|
4808
4897
|
* E -->|onExchangeEnd| EE(["exchange complete"])
|
|
4809
4898
|
* M -->|onContentPartStart| CP["ContentPartStream"]
|
|
4810
4899
|
* M -->|onToolCallStart| TC["ToolCallStream"]
|
|
@@ -4848,10 +4937,20 @@ type FeatureFlags = Record<string, unknown>;
|
|
|
4848
4937
|
* exchange.sendMessageWithContentPart({ data: 'Hello!' });
|
|
4849
4938
|
* });
|
|
4850
4939
|
*
|
|
4851
|
-
* // 5.
|
|
4940
|
+
* // 5. Stop a response mid-stream
|
|
4941
|
+
* // Use sendExchangeEnd() on any active exchange to stop the agent
|
|
4942
|
+
* session.onSessionStarted(() => {
|
|
4943
|
+
* const exchange = session.startExchange();
|
|
4944
|
+
* exchange.sendMessageWithContentPart({ data: 'Tell me a long story' });
|
|
4945
|
+
*
|
|
4946
|
+
* // Stop after 5 seconds
|
|
4947
|
+
* setTimeout(() => exchange.sendExchangeEnd(), 5000);
|
|
4948
|
+
* });
|
|
4949
|
+
*
|
|
4950
|
+
* // 6. End session when done
|
|
4852
4951
|
* conversation.endSession();
|
|
4853
4952
|
*
|
|
4854
|
-
* //
|
|
4953
|
+
* // 7. Retrieve conversation history (offline)
|
|
4855
4954
|
* const exchanges = await conversation.exchanges.getAll();
|
|
4856
4955
|
* ```
|
|
4857
4956
|
*/
|
|
@@ -5184,6 +5283,7 @@ declare abstract class ToolCallEventHelper extends ConversationEventHelperBase<T
|
|
|
5184
5283
|
readonly startEventMaybe: ToolCallStartEvent | undefined;
|
|
5185
5284
|
protected readonly _endHandlers: ToolCallEndHandler[];
|
|
5186
5285
|
protected readonly _confirmHandlers: ToolCallConfirmationHandler[];
|
|
5286
|
+
protected readonly _executingHandlers: ExecutingToolCallHandler[];
|
|
5187
5287
|
constructor(message: MessageEventHelper, toolCallId: string,
|
|
5188
5288
|
/**
|
|
5189
5289
|
* ToolCallStartEvent used to initialize the ToolCallEventHelper. Will be undefined if some other sub-event was
|
|
@@ -5235,6 +5335,14 @@ declare abstract class ToolCallEventHelper extends ConversationEventHelperBase<T
|
|
|
5235
5335
|
* @throws Error if tool call has already ended.
|
|
5236
5336
|
*/
|
|
5237
5337
|
sendToolCallConfirm(confirmToolCall: ToolCallConfirmationEvent): void;
|
|
5338
|
+
/**
|
|
5339
|
+
* Registers a handler for executingToolCall events.
|
|
5340
|
+
* Fired when the tool is about to be executed. For client-side tools,
|
|
5341
|
+
* the client should begin executing its handler upon receiving this.
|
|
5342
|
+
* @returns Cleanup function to remove the handler.
|
|
5343
|
+
* @internal
|
|
5344
|
+
*/
|
|
5345
|
+
onExecutingToolCall(cb: ExecutingToolCallHandler): () => void;
|
|
5238
5346
|
/**
|
|
5239
5347
|
* Sends an error start event for this tool call.
|
|
5240
5348
|
*/
|
|
@@ -5519,7 +5627,9 @@ declare abstract class ExchangeEventHelper extends ConversationEventHelperBase<E
|
|
|
5519
5627
|
*/
|
|
5520
5628
|
sendMetaEvent(metaEvent: MetaEvent): void;
|
|
5521
5629
|
/**
|
|
5522
|
-
* Ends the exchange
|
|
5630
|
+
* Ends the exchange. Stops further events for that exchange from being received.
|
|
5631
|
+
* Can be called from either the client side (to stop an in-progress response) or
|
|
5632
|
+
* the server/agent side (to signal natural completion).
|
|
5523
5633
|
* @throws Error if exchange has already ended.
|
|
5524
5634
|
*/
|
|
5525
5635
|
sendExchangeEnd(endExchange?: ExchangeEndEvent): void;
|
|
@@ -6167,6 +6277,7 @@ type ToolCallEndHandler = (endToolCall: ToolCallEndEvent) => void;
|
|
|
6167
6277
|
type ToolCallStartHandler = (toolCall: ToolCallEventHelper) => void;
|
|
6168
6278
|
type ToolCallStartHandlerAsync = (toolCall: ToolCallEventHelper) => Promise<ToolCallEndEvent | void>;
|
|
6169
6279
|
type ToolCallConfirmationHandler = (confirmToolCall: ToolCallConfirmationEvent) => void;
|
|
6280
|
+
type ExecutingToolCallHandler = (event: ExecutingToolCallEvent) => void;
|
|
6170
6281
|
type ToolCallConfirmHandler = (args: ToolCallConfirmationHandlerArgs) => void;
|
|
6171
6282
|
type ToolCallCompletedHandler = (completedToolCall: CompletedToolCall) => void;
|
|
6172
6283
|
type ContentPartCompletedHandler = (completedContentPart: CompletedContentPart) => void;
|
|
@@ -7082,4 +7193,4 @@ declare class ConversationalAgentService extends BaseService implements Conversa
|
|
|
7082
7193
|
}
|
|
7083
7194
|
|
|
7084
7195
|
export { AgentMap, AsyncInputStreamEventHelper, AsyncInputStreamEventHelperImpl, AsyncToolCallEventHelper, AsyncToolCallEventHelperImpl, CitationErrorType, ContentPartEventHelper, ContentPartEventHelperImpl, ContentPartHelper, ConversationEventHelperBase, ConversationEventHelperManager, ConversationEventHelperManagerImpl, ConversationEventInvalidOperationError, ConversationEventValidationError, ConversationGetAllFilterMap, ConversationMap, ConversationalAgentService as ConversationalAgent, ConversationalAgentService, EventErrorId, ExchangeEventHelper, ExchangeEventHelperImpl, ExchangeMap, ExchangeService, ExchangeService as Exchanges, FeedbackRating, InputStreamSpeechSensitivity, InterruptType, MessageEventHelper, MessageEventHelperImpl, MessageMap, MessageRole, MessageService, MessageService as Messages, SessionEventHelper, SessionEventHelperImpl, SortOrder, ToolCallEventHelper, ToolCallEventHelperImpl, UserSettingsService as UserSettings, UserSettingsMap, UserSettingsService, assertCitationSourceMedia, assertCitationSourceUrl, assertExternalValue, assertInlineValue, createAgentWithMethods, createConversationWithMethods, isCitationSourceMedia, isCitationSourceUrl, isExternalValue, isInlineValue, transformExchange, transformExchanges, transformMessage };
|
|
7085
|
-
export type { AgentAppearance, AgentConversationServiceModel, AgentCreateConversationOptions, AgentGetByIdResponse, AgentGetResponse, AgentInput, AgentMethods, AgentStartingPrompt, AnyErrorEndHandler, AnyErrorEndHandlerArgs, AnyErrorStartHandler, AnyErrorStartHandlerArgs, AsyncInputStream, AsyncInputStreamChunkEvent, AsyncInputStreamChunkHandler, AsyncInputStreamEndEvent, AsyncInputStreamEndHandler, AsyncInputStreamEvent, AsyncInputStreamStartEvent, AsyncToolCallStartHandler, AsyncToolCallStartHandlerAsync, AsyncToolCallStream, ChunkHandler, Citation, CitationEndEvent, CitationError, CitationEvent, CitationOptions, CitationSource, CitationSourceBase, CitationSourceMedia, CitationSourceUrl, CitationStartEvent, CompletedContentPart, CompletedMessage, CompletedToolCall, ContentPart, ContentPartChunkEvent, ContentPartCompletedHandler, ContentPartData, ContentPartEndEvent, ContentPartEndHandler, ContentPartEvent, ContentPartGetResponse, ContentPartInterrupted, ContentPartStartEvent, ContentPartStartEventOptions, ContentPartStartEventWithData, ContentPartStartHandler, ContentPartStartHandlerAsync, ContentPartStartMetaData, ContentPartStream, ConversationAttachmentCreateResponse, ConversationAttachmentUploadResponse, ConversationCreateOptions, ConversationCreateResponse, ConversationDeleteResponse, ConversationEvent, ConversationEventEmitter, ConversationEventErrorSource, ConversationEventHandler, ConversationEventHelperManagerConfig, ConversationEventHelperProperties, ConversationExchangeServiceModel, ConversationGetAllOptions, ConversationGetResponse, ConversationJobStartOverrides, ConversationMethods, ConversationServiceModel, ConversationSessionMethods, ConversationSessionOptions, ConversationUpdateOptions, ConversationUpdateResponse, ConversationalAgentOptions, ConversationalAgentServiceModel, CreateFeedbackOptions, DeletedHandler, ErrorEndEvent, ErrorEndEventOptions, ErrorEndHandler, ErrorEndHandlerArgs, ErrorEvent, ErrorStartEvent, ErrorStartEventOptions, ErrorStartHandler, ErrorStartHandlerArgs, Exchange, ExchangeEndEvent, ExchangeEndHandler, ExchangeEvent, ExchangeGetAllOptions, ExchangeGetByIdOptions, ExchangeGetResponse, ExchangeServiceModel, ExchangeStartEvent, ExchangeStartEventOptions, ExchangeStartHandler, ExchangeStartHandlerAsync, ExchangeStream, ExternalValue, FeatureFlags, FeedbackCreateResponse, FileUploadAccess, GenericInterruptStartEvent, InlineOrExternalValue, InlineValue, InputStreamStartEventOptions, InputStreamStartHandler, Interrupt, InterruptCompletedHandler, InterruptCompletedHandlerArgs, InterruptEndEvent, InterruptEndHandler, InterruptEndHandlerArgs, InterruptEvent, InterruptStartEvent, InterruptStartHandler, InterruptStartHandlerArgs, JSONArray, JSONObject, JSONPrimitive, JSONValue, LabelUpdatedEvent, LabelUpdatedHandler, MakeOptional, MakeRequired, Message, MessageCompletedHandler, MessageEndEvent, MessageEndHandler, MessageEvent, MessageGetResponse, MessageServiceModel, MessageStartEvent, MessageStartEventOptions, MessageStartHandler, MessageStartHandlerAsync, MessageStream, MetaData, MetaEvent, MetaEventHandler, RawAgentGetByIdResponse, RawAgentGetResponse, RawConversationGetResponse, SendMessageWithContentPartOptions, SessionCapabilities, SessionEndEvent, SessionEndHandler, SessionEndingEvent, SessionEndingHandler, SessionStartEvent, SessionStartEventOptions, SessionStartHandler, SessionStartHandlerAsync, SessionStartedEvent, SessionStartedHandler, SessionStream, Simplify, ToolCall, ToolCallCompletedHandler, ToolCallConfirmHandler, ToolCallConfirmationEndValue, ToolCallConfirmationEvent, ToolCallConfirmationHandler, ToolCallConfirmationHandlerArgs, ToolCallConfirmationInterruptStartEvent, ToolCallConfirmationValue, ToolCallEndEvent, ToolCallEndHandler, ToolCallEvent, ToolCallInputValue, ToolCallOutputValue, ToolCallResult, ToolCallStartEvent, ToolCallStartEventWithId, ToolCallStartHandler, ToolCallStartHandlerAsync, ToolCallStream, UnhandledErrorEndHandler, UnhandledErrorEndHandlerArgs, UnhandledErrorStartHandler, UnhandledErrorStartHandlerArgs, UserSettingsGetResponse, UserSettingsServiceModel, UserSettingsUpdateOptions, UserSettingsUpdateResponse };
|
|
7196
|
+
export type { AgentAppearance, AgentConversationServiceModel, AgentCreateConversationOptions, AgentGetByIdResponse, AgentGetResponse, AgentInput, AgentMethods, AgentStartingPrompt, AnyErrorEndHandler, AnyErrorEndHandlerArgs, AnyErrorStartHandler, AnyErrorStartHandlerArgs, AsyncInputStream, AsyncInputStreamChunkEvent, AsyncInputStreamChunkHandler, AsyncInputStreamEndEvent, AsyncInputStreamEndHandler, AsyncInputStreamEvent, AsyncInputStreamStartEvent, AsyncToolCallStartHandler, AsyncToolCallStartHandlerAsync, AsyncToolCallStream, ChunkHandler, Citation, CitationEndEvent, CitationError, CitationEvent, CitationOptions, CitationSource, CitationSourceBase, CitationSourceMedia, CitationSourceUrl, CitationStartEvent, ClientSideTool, CompletedContentPart, CompletedMessage, CompletedToolCall, ContentPart, ContentPartChunkEvent, ContentPartCompletedHandler, ContentPartData, ContentPartEndEvent, ContentPartEndHandler, ContentPartEvent, ContentPartGetResponse, ContentPartInterrupted, ContentPartStartEvent, ContentPartStartEventOptions, ContentPartStartEventWithData, ContentPartStartHandler, ContentPartStartHandlerAsync, ContentPartStartMetaData, ContentPartStream, ConversationAttachmentCreateResponse, ConversationAttachmentUploadResponse, ConversationCreateOptions, ConversationCreateResponse, ConversationDeleteResponse, ConversationEvent, ConversationEventEmitter, ConversationEventErrorSource, ConversationEventHandler, ConversationEventHelperManagerConfig, ConversationEventHelperProperties, ConversationExchangeServiceModel, ConversationGetAllOptions, ConversationGetResponse, ConversationJobStartOverrides, ConversationMethods, ConversationServiceModel, ConversationSessionMethods, ConversationSessionOptions, ConversationUpdateOptions, ConversationUpdateResponse, ConversationalAgentOptions, ConversationalAgentServiceModel, CreateFeedbackOptions, DeletedHandler, ErrorEndEvent, ErrorEndEventOptions, ErrorEndHandler, ErrorEndHandlerArgs, ErrorEvent, ErrorStartEvent, ErrorStartEventOptions, ErrorStartHandler, ErrorStartHandlerArgs, Exchange, ExchangeEndEvent, ExchangeEndHandler, ExchangeEvent, ExchangeGetAllOptions, ExchangeGetByIdOptions, ExchangeGetResponse, ExchangeServiceModel, ExchangeStartEvent, ExchangeStartEventOptions, ExchangeStartHandler, ExchangeStartHandlerAsync, ExchangeStream, ExecutingToolCallEvent, ExecutingToolCallHandler, ExternalValue, FeatureFlags, FeedbackCreateResponse, FileUploadAccess, GenericInterruptStartEvent, InlineOrExternalValue, InlineValue, InputStreamStartEventOptions, InputStreamStartHandler, Interrupt, InterruptCompletedHandler, InterruptCompletedHandlerArgs, InterruptEndEvent, InterruptEndHandler, InterruptEndHandlerArgs, InterruptEvent, InterruptStartEvent, InterruptStartHandler, InterruptStartHandlerArgs, JSONArray, JSONObject, JSONPrimitive, JSONValue, LabelUpdatedEvent, LabelUpdatedHandler, MakeOptional, MakeRequired, Message, MessageCompletedHandler, MessageEndEvent, MessageEndHandler, MessageEvent, MessageGetResponse, MessageServiceModel, MessageStartEvent, MessageStartEventOptions, MessageStartHandler, MessageStartHandlerAsync, MessageStream, MetaData, MetaEvent, MetaEventHandler, RawAgentGetByIdResponse, RawAgentGetResponse, RawConversationGetResponse, SendMessageWithContentPartOptions, SessionCapabilities, SessionEndEvent, SessionEndHandler, SessionEndingEvent, SessionEndingHandler, SessionStartEvent, SessionStartEventOptions, SessionStartHandler, SessionStartHandlerAsync, SessionStartedEvent, SessionStartedHandler, SessionStream, Simplify, ToolCall, ToolCallCompletedHandler, ToolCallConfirmHandler, ToolCallConfirmationEndValue, ToolCallConfirmationEvent, ToolCallConfirmationHandler, ToolCallConfirmationHandlerArgs, ToolCallConfirmationInterruptStartEvent, ToolCallConfirmationValue, ToolCallEndEvent, ToolCallEndHandler, ToolCallEvent, ToolCallInputValue, ToolCallOutputValue, ToolCallResult, ToolCallStartEvent, ToolCallStartEventWithId, ToolCallStartHandler, ToolCallStartHandlerAsync, ToolCallStream, UnhandledErrorEndHandler, UnhandledErrorEndHandlerArgs, UnhandledErrorStartHandler, UnhandledErrorStartHandlerArgs, UserSettingsGetResponse, UserSettingsServiceModel, UserSettingsUpdateOptions, UserSettingsUpdateResponse };
|
|
@@ -1021,7 +1021,16 @@ const CONVERSATIONAL_TOKEN_PARAMS = {
|
|
|
1021
1021
|
* Returns the original value if parsing fails.
|
|
1022
1022
|
*/
|
|
1023
1023
|
/**
|
|
1024
|
-
* Transforms data by
|
|
1024
|
+
* Transforms data by renaming each key in `data` exactly once, using the
|
|
1025
|
+
* mapping (`sourceField → targetField`). Keys not present in the mapping
|
|
1026
|
+
* pass through unchanged. The original (pre-rename) key is dropped — the
|
|
1027
|
+
* result contains only the renamed key.
|
|
1028
|
+
*
|
|
1029
|
+
* Each rename is independent. If the mapping happens to contain chained
|
|
1030
|
+
* entries (`a → b` and `b → c`), they do NOT compose: a field named `a`
|
|
1031
|
+
* in `data` becomes `b` (not `c`), because the renames are applied based
|
|
1032
|
+
* on the original data's keys, not the running result.
|
|
1033
|
+
*
|
|
1025
1034
|
* @param data The source data to transform
|
|
1026
1035
|
* @param fieldMapping Object mapping source field names to target field names
|
|
1027
1036
|
* @returns Transformed data with mapped field names
|
|
@@ -1044,21 +1053,28 @@ const CONVERSATIONAL_TOKEN_PARAMS = {
|
|
|
1044
1053
|
* // { userId: '123', name: 'john' },
|
|
1045
1054
|
* // { userId: '456', name: 'jane' }
|
|
1046
1055
|
* // ]
|
|
1056
|
+
*
|
|
1057
|
+
* // No chaining — `a → b` does not become `a → c` even if the map has `b → c`.
|
|
1058
|
+
* transformData({ a: 1 }, { a: 'b', b: 'c' });
|
|
1059
|
+
* // result = { b: 1 }
|
|
1047
1060
|
* ```
|
|
1048
1061
|
*/
|
|
1049
1062
|
function transformData(data, fieldMapping) {
|
|
1063
|
+
// Pass null/undefined through unchanged — callers (e.g. AttachmentService.getById)
|
|
1064
|
+
// may invoke this on optional fields that an OData `select` excluded.
|
|
1065
|
+
if (data == null) {
|
|
1066
|
+
return data;
|
|
1067
|
+
}
|
|
1050
1068
|
// Handle array of objects
|
|
1051
1069
|
if (Array.isArray(data)) {
|
|
1052
1070
|
return data.map(item => transformData(item, fieldMapping));
|
|
1053
1071
|
}
|
|
1054
|
-
//
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
result[targetField] = value;
|
|
1061
|
-
}
|
|
1072
|
+
// Walk the ORIGINAL data's keys, look up each in the mapping. One rename
|
|
1073
|
+
// per data key — no mutation of an in-progress result, so chains can't form.
|
|
1074
|
+
const result = {};
|
|
1075
|
+
for (const [key, value] of Object.entries(data)) {
|
|
1076
|
+
const renamedKey = fieldMapping[key] ?? key;
|
|
1077
|
+
result[renamedKey] = value;
|
|
1062
1078
|
}
|
|
1063
1079
|
return result;
|
|
1064
1080
|
}
|
|
@@ -2819,6 +2835,7 @@ class ToolCallEventHelper extends ConversationEventHelperBase {
|
|
|
2819
2835
|
this.startEventMaybe = startEventMaybe;
|
|
2820
2836
|
this._endHandlers = new Array();
|
|
2821
2837
|
this._confirmHandlers = new Array();
|
|
2838
|
+
this._executingHandlers = new Array();
|
|
2822
2839
|
this.addStartEventTimestamp(startEventMaybe);
|
|
2823
2840
|
}
|
|
2824
2841
|
/**
|
|
@@ -2903,6 +2920,21 @@ class ToolCallEventHelper extends ConversationEventHelperBase {
|
|
|
2903
2920
|
this.assertNotEnded();
|
|
2904
2921
|
this.emit({ confirmToolCall });
|
|
2905
2922
|
}
|
|
2923
|
+
/**
|
|
2924
|
+
* Registers a handler for executingToolCall events.
|
|
2925
|
+
* Fired when the tool is about to be executed. For client-side tools,
|
|
2926
|
+
* the client should begin executing its handler upon receiving this.
|
|
2927
|
+
* @returns Cleanup function to remove the handler.
|
|
2928
|
+
* @internal
|
|
2929
|
+
*/
|
|
2930
|
+
onExecutingToolCall(cb) {
|
|
2931
|
+
this._executingHandlers.push(cb);
|
|
2932
|
+
return () => {
|
|
2933
|
+
const index = this._executingHandlers.indexOf(cb);
|
|
2934
|
+
if (index >= 0)
|
|
2935
|
+
this._executingHandlers.splice(index, 1);
|
|
2936
|
+
};
|
|
2937
|
+
}
|
|
2906
2938
|
/**
|
|
2907
2939
|
* Sends an error start event for this tool call.
|
|
2908
2940
|
*/
|
|
@@ -2982,6 +3014,10 @@ class ToolCallEventHelperImpl extends ToolCallEventHelper {
|
|
|
2982
3014
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2983
3015
|
this._confirmHandlers.forEach(cb => cb(toolCallEvent.confirmToolCall));
|
|
2984
3016
|
}
|
|
3017
|
+
if (toolCallEvent.executingToolCall) {
|
|
3018
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3019
|
+
this._executingHandlers.forEach(cb => cb(toolCallEvent.executingToolCall));
|
|
3020
|
+
}
|
|
2985
3021
|
if (toolCallEvent.endToolCall) {
|
|
2986
3022
|
this.setEnded();
|
|
2987
3023
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -3578,7 +3614,9 @@ class ExchangeEventHelper extends ConversationEventHelperBase {
|
|
|
3578
3614
|
this.emit({ metaEvent });
|
|
3579
3615
|
}
|
|
3580
3616
|
/**
|
|
3581
|
-
* Ends the exchange
|
|
3617
|
+
* Ends the exchange. Stops further events for that exchange from being received.
|
|
3618
|
+
* Can be called from either the client side (to stop an in-progress response) or
|
|
3619
|
+
* the server/agent side (to signal natural completion).
|
|
3582
3620
|
* @throws Error if exchange has already ended.
|
|
3583
3621
|
*/
|
|
3584
3622
|
sendExchangeEnd(endExchange = {}) {
|
package/dist/core/index.cjs
CHANGED
|
@@ -4822,7 +4822,7 @@ class EmbeddedTokenManager {
|
|
|
4822
4822
|
* SDK's public API.
|
|
4823
4823
|
*/
|
|
4824
4824
|
/** SDK version placeholder — patched by the SDK publish workflow. */
|
|
4825
|
-
const SDK_VERSION = '1.
|
|
4825
|
+
const SDK_VERSION = '1.5.1';
|
|
4826
4826
|
const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
|
|
4827
4827
|
const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
|
|
4828
4828
|
const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
|
package/dist/core/index.mjs
CHANGED
|
@@ -4820,7 +4820,7 @@ class EmbeddedTokenManager {
|
|
|
4820
4820
|
* SDK's public API.
|
|
4821
4821
|
*/
|
|
4822
4822
|
/** SDK version placeholder — patched by the SDK publish workflow. */
|
|
4823
|
-
const SDK_VERSION = '1.
|
|
4823
|
+
const SDK_VERSION = '1.5.1';
|
|
4824
4824
|
const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
|
|
4825
4825
|
const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
|
|
4826
4826
|
const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
|