@uipath/maestro-builder-sdk 6.23.0 → 6.24.0
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/api-index.md +112 -112
- package/dist/api-members.md +335 -335
- package/dist/check.js +0 -52
- package/dist/core/actions.d.ts +0 -100
- package/dist/core/actions.js +0 -57
- package/dist/core/typed-raw-node.js +0 -3
- package/dist/decompile.js +0 -44
- package/dist/flow-node-registry.js +2 -1
- package/dist/flow-sdk.d.ts +1 -0
- package/dist/flow-sdk.js +1 -0
- package/dist/nodes/conversation/flow/check.d.ts +17 -0
- package/dist/nodes/conversation/flow/check.js +54 -0
- package/dist/nodes/conversation/flow/factories.d.ts +58 -0
- package/dist/nodes/conversation/flow/factories.js +63 -0
- package/dist/nodes/conversation/flow/family.d.ts +3 -0
- package/dist/nodes/conversation/flow/family.js +8 -0
- package/dist/nodes/conversation/flow/index.d.ts +3 -0
- package/dist/nodes/conversation/flow/index.js +3 -0
- package/dist/nodes/conversation/flow/node-type.d.ts +14 -0
- package/dist/nodes/conversation/flow/node-type.js +117 -0
- package/dist/nodes/conversation/flow/spec.d.ts +60 -0
- package/dist/nodes/conversation/flow/spec.js +1 -0
- package/dist/serialize.js +0 -48
- package/package.json +2 -2
package/dist/check.js
CHANGED
|
@@ -453,10 +453,6 @@ function checkFlow(built, ancestors, opts = {}) {
|
|
|
453
453
|
if (s.spec.kind === 'publishedFunction') {
|
|
454
454
|
checkPublishedFunction(s.name, s.spec.inputs, diags);
|
|
455
455
|
}
|
|
456
|
-
if (s.spec.kind === 'sendMessage' || s.spec.kind === 'waitForMessage'
|
|
457
|
-
|| s.spec.kind === 'conversationContext') {
|
|
458
|
-
checkConversational(s.name, s.spec.kind, s.spec.inputs, diags);
|
|
459
|
-
}
|
|
460
456
|
if (s.spec.kind === 'createOutgoingCall' || s.spec.kind === 'endCall' || s.spec.kind === 'voiceAgent') {
|
|
461
457
|
checkVoice(s.name, s.spec.kind, s.spec.inputs, diags);
|
|
462
458
|
}
|
|
@@ -2283,54 +2279,6 @@ function checkVoice(step, kind, inputs, diags) {
|
|
|
2283
2279
|
}
|
|
2284
2280
|
}
|
|
2285
2281
|
}
|
|
2286
|
-
/**
|
|
2287
|
-
* A conversational step (Phase 5C): send-message, wait-for-message, or
|
|
2288
|
-
* get-conversation-context.
|
|
2289
|
-
*
|
|
2290
|
-
* Everything here is decidable offline and invisible later: the node's own
|
|
2291
|
-
* schema requires `conversationId` (and `exchangeId`/`content` on send), and
|
|
2292
|
-
* the two numeric limits are range-checked by the designer but silently
|
|
2293
|
-
* clamped at run time.
|
|
2294
|
-
*/
|
|
2295
|
-
function checkConversational(step, kind, inputs, diags) {
|
|
2296
|
-
const at = (code, message, suggestion) => {
|
|
2297
|
-
diags.push({ level: 'error', code, message, step, ...(suggestion ? { suggestion } : {}) });
|
|
2298
|
-
};
|
|
2299
|
-
const blank = (v) => v === undefined || v === null || (typeof v === 'string' && v.trim() === '');
|
|
2300
|
-
const label = kind === 'sendMessage' ? 'sendMessage'
|
|
2301
|
-
: kind === 'waitForMessage' ? 'waitForMessage' : 'conversationContext';
|
|
2302
|
-
if (blank(inputs?.conversationId)) {
|
|
2303
|
-
at('CONVERSATION_NO_ID', `${label} step "${step}" has no \`conversationId\`, which the node's schema requires — every `
|
|
2304
|
-
+ `conversational step is keyed by the conversation it belongs to. The conversation trigger publishes `
|
|
2305
|
-
+ `it as out('start', 'conversationId').`, `conversationId: out('start', 'conversationId')`);
|
|
2306
|
-
}
|
|
2307
|
-
if (kind === 'sendMessage') {
|
|
2308
|
-
if (blank(inputs?.exchangeId)) {
|
|
2309
|
-
at('SEND_MESSAGE_NO_EXCHANGE', `sendMessage step "${step}" has no \`exchangeId\` — the node's schema requires it, because a message `
|
|
2310
|
-
+ `belongs to one exchange (a user turn and its answers). A wait step publishes it as `
|
|
2311
|
-
+ `out('<waitStep>', 'conversationContext.latestExchangeId').`, `exchangeId: out('<waitStep>', 'conversationContext.latestExchangeId')`);
|
|
2312
|
-
}
|
|
2313
|
-
if (blank(inputs?.content)) {
|
|
2314
|
-
at('SEND_MESSAGE_NO_CONTENT', `sendMessage step "${step}" has no \`content\` — the node's schema requires a non-empty message `
|
|
2315
|
-
+ `(Markdown), and an empty one posts a blank turn into the conversation.`, `content: 'Looking into it.'`);
|
|
2316
|
-
}
|
|
2317
|
-
}
|
|
2318
|
-
const rangeCheck = (field, max) => {
|
|
2319
|
-
const raw = inputs?.[field];
|
|
2320
|
-
if (raw === undefined || raw instanceof Expr)
|
|
2321
|
-
return;
|
|
2322
|
-
const n = Number(raw);
|
|
2323
|
-
if (!Number.isFinite(n) || !Number.isInteger(n) || n < 1 || n > max) {
|
|
2324
|
-
at('CONVERSATION_RANGE', `${label} step "${step}"'s \`${field}\` is ${JSON.stringify(raw)}. The node accepts a whole number from `
|
|
2325
|
-
+ `1 to ${max} (the platform default is 20); anything else is clamped at run time, so the flow reads `
|
|
2326
|
-
+ `a different amount of history than it says.`, `${field}: 20`);
|
|
2327
|
-
}
|
|
2328
|
-
};
|
|
2329
|
-
if (kind === 'waitForMessage')
|
|
2330
|
-
rangeCheck('numExchanges', 40);
|
|
2331
|
-
if (kind === 'conversationContext')
|
|
2332
|
-
rangeCheck('exchangeLimit', 40);
|
|
2333
|
-
}
|
|
2334
2282
|
/**
|
|
2335
2283
|
* A published FUNCTION step (Phase 5B).
|
|
2336
2284
|
*
|
package/dist/core/actions.d.ts
CHANGED
|
@@ -354,43 +354,6 @@ export interface HitlInputs {
|
|
|
354
354
|
*/
|
|
355
355
|
document?: DocValidationInputs;
|
|
356
356
|
}
|
|
357
|
-
export interface SendMessageInputs {
|
|
358
|
-
/**
|
|
359
|
-
* The conversation to post into — from the conversation trigger
|
|
360
|
-
* (`out('start', 'conversationId')`) or a context read. Required.
|
|
361
|
-
*/
|
|
362
|
-
conversationId: string | Expr;
|
|
363
|
-
/**
|
|
364
|
-
* The exchange (one user turn plus its answers) the message belongs to —
|
|
365
|
-
* `out('<waitStep>', 'conversationContext.latestExchangeId')`, or the
|
|
366
|
-
* trigger's exchange for the first answer. Required by the node's schema.
|
|
367
|
-
*/
|
|
368
|
-
exchangeId: string | Expr;
|
|
369
|
-
/** What to say. Markdown — the node's only supported `mimeType`. Required. */
|
|
370
|
-
content: string | Expr;
|
|
371
|
-
/**
|
|
372
|
-
* Whether this message CLOSES the exchange. The platform's legacy default is
|
|
373
|
-
* to end it; pass `false` to keep the exchange open for another message.
|
|
374
|
-
*/
|
|
375
|
-
endExchange?: boolean;
|
|
376
|
-
}
|
|
377
|
-
export interface WaitForMessageInputs {
|
|
378
|
-
/** The conversation to wait on. Required. */
|
|
379
|
-
conversationId: string | Expr;
|
|
380
|
-
/**
|
|
381
|
-
* How many past exchanges the returned context carries. 1–40 in the
|
|
382
|
-
* designer; the platform default is 20.
|
|
383
|
-
*/
|
|
384
|
-
numExchanges?: number;
|
|
385
|
-
}
|
|
386
|
-
export interface ConversationContextInputs {
|
|
387
|
-
/** The conversation to read. Required. */
|
|
388
|
-
conversationId: string | Expr;
|
|
389
|
-
/**
|
|
390
|
-
* How many exchanges to return, 1–40. The platform default is 20.
|
|
391
|
-
*/
|
|
392
|
-
exchangeLimit?: number;
|
|
393
|
-
}
|
|
394
357
|
/**
|
|
395
358
|
* How a conversational agent gets its turn — the node's own
|
|
396
359
|
* `conversationalAgentSettings` sub-object.
|
|
@@ -1753,18 +1716,6 @@ export interface FlowActionSpecs {
|
|
|
1753
1716
|
publishedFunction: {
|
|
1754
1717
|
inputs: PublishedFunctionInputs;
|
|
1755
1718
|
};
|
|
1756
|
-
/** The spec {@link sendMessage} builds. */
|
|
1757
|
-
sendMessage: {
|
|
1758
|
-
inputs: SendMessageInputs;
|
|
1759
|
-
};
|
|
1760
|
-
/** The spec {@link waitForMessage} builds. */
|
|
1761
|
-
waitForMessage: {
|
|
1762
|
-
inputs: WaitForMessageInputs;
|
|
1763
|
-
};
|
|
1764
|
-
/** The spec {@link conversationContext} builds. */
|
|
1765
|
-
conversationContext: {
|
|
1766
|
-
inputs: ConversationContextInputs;
|
|
1767
|
-
};
|
|
1768
1719
|
/** The spec {@link createOutgoingCall} builds. */
|
|
1769
1720
|
createOutgoingCall: {
|
|
1770
1721
|
inputs: CreateOutgoingCallInputs;
|
|
@@ -2068,57 +2019,6 @@ export declare function apiWorkflow(inputs: ApiWorkflowInputs): ActionSpec;
|
|
|
2068
2019
|
* @returns An action spec to pass to `.step(...)`.
|
|
2069
2020
|
*/
|
|
2070
2021
|
export declare function publishedFunction(inputs: PublishedFunctionInputs): ActionSpec;
|
|
2071
|
-
/**
|
|
2072
|
-
* Post an assistant message into a live conversation
|
|
2073
|
-
* (`uipath.conversational.send-message`).
|
|
2074
|
-
*
|
|
2075
|
-
* ```ts
|
|
2076
|
-
* .step('answer', sendMessage({
|
|
2077
|
-
* conversationId: out('start', 'conversationId'),
|
|
2078
|
-
* exchangeId: out('listen', 'conversationContext.latestExchangeId'),
|
|
2079
|
-
* content: 'Your order ships tomorrow.',
|
|
2080
|
-
* }))
|
|
2081
|
-
* ```
|
|
2082
|
-
*
|
|
2083
|
-
* The message is Markdown (`text/markdown` is the node's only supported type)
|
|
2084
|
-
* and the role is always `assistant` — a flow speaks as the assistant.
|
|
2085
|
-
*
|
|
2086
|
-
* @param inputs - The conversation, the exchange, and what to say.
|
|
2087
|
-
* @returns An action spec to pass to `.step(...)`.
|
|
2088
|
-
*/
|
|
2089
|
-
export declare function sendMessage(inputs: SendMessageInputs): ActionSpec;
|
|
2090
|
-
/**
|
|
2091
|
-
* PAUSE until the person sends their next message
|
|
2092
|
-
* (`uipath.conversational.wait-for-message`) — a catch event, like
|
|
2093
|
-
* `waitForEvent`, so the flow suspends rather than polling.
|
|
2094
|
-
*
|
|
2095
|
-
* ```ts
|
|
2096
|
-
* .step('listen', waitForMessage({ conversationId: out('start', 'conversationId') }))
|
|
2097
|
-
* ```
|
|
2098
|
-
*
|
|
2099
|
-
* It resumes with the conversation context:
|
|
2100
|
-
* `out('listen', 'conversationContext.messages')` is the transcript and
|
|
2101
|
-
* `…conversationContext.latestExchangeId` is the turn to answer.
|
|
2102
|
-
*
|
|
2103
|
-
* @param inputs - The conversation to wait on, and how much history to return.
|
|
2104
|
-
* @returns An action spec to pass to `.step(...)`.
|
|
2105
|
-
*/
|
|
2106
|
-
export declare function waitForMessage(inputs: WaitForMessageInputs): ActionSpec;
|
|
2107
|
-
/**
|
|
2108
|
-
* READ a conversation's transcript so far without waiting
|
|
2109
|
-
* (`uipath.conversational.get-conversation-context`) — the shape a
|
|
2110
|
-
* conversational agent takes as its turn context.
|
|
2111
|
-
*
|
|
2112
|
-
* ```ts
|
|
2113
|
-
* .step('history', conversationContext({
|
|
2114
|
-
* conversationId: out('start', 'conversationId'), exchangeLimit: 10,
|
|
2115
|
-
* }))
|
|
2116
|
-
* ```
|
|
2117
|
-
*
|
|
2118
|
-
* @param inputs - The conversation to read, and how many exchanges to return.
|
|
2119
|
-
* @returns An action spec to pass to `.step(...)`.
|
|
2120
|
-
*/
|
|
2121
|
-
export declare function conversationContext(inputs: ConversationContextInputs): ActionSpec;
|
|
2122
2022
|
/**
|
|
2123
2023
|
* Place an outgoing phone call
|
|
2124
2024
|
* (`uipath.conversational.voice.create-outgoing-call`) and get back the
|
package/dist/core/actions.js
CHANGED
|
@@ -310,63 +310,6 @@ export function apiWorkflow(inputs) {
|
|
|
310
310
|
export function publishedFunction(inputs) {
|
|
311
311
|
return builtinActionSpec({ kind: 'publishedFunction', inputs });
|
|
312
312
|
}
|
|
313
|
-
/**
|
|
314
|
-
* Post an assistant message into a live conversation
|
|
315
|
-
* (`uipath.conversational.send-message`).
|
|
316
|
-
*
|
|
317
|
-
* ```ts
|
|
318
|
-
* .step('answer', sendMessage({
|
|
319
|
-
* conversationId: out('start', 'conversationId'),
|
|
320
|
-
* exchangeId: out('listen', 'conversationContext.latestExchangeId'),
|
|
321
|
-
* content: 'Your order ships tomorrow.',
|
|
322
|
-
* }))
|
|
323
|
-
* ```
|
|
324
|
-
*
|
|
325
|
-
* The message is Markdown (`text/markdown` is the node's only supported type)
|
|
326
|
-
* and the role is always `assistant` — a flow speaks as the assistant.
|
|
327
|
-
*
|
|
328
|
-
* @param inputs - The conversation, the exchange, and what to say.
|
|
329
|
-
* @returns An action spec to pass to `.step(...)`.
|
|
330
|
-
*/
|
|
331
|
-
export function sendMessage(inputs) {
|
|
332
|
-
return builtinActionSpec({ kind: 'sendMessage', inputs });
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* PAUSE until the person sends their next message
|
|
336
|
-
* (`uipath.conversational.wait-for-message`) — a catch event, like
|
|
337
|
-
* `waitForEvent`, so the flow suspends rather than polling.
|
|
338
|
-
*
|
|
339
|
-
* ```ts
|
|
340
|
-
* .step('listen', waitForMessage({ conversationId: out('start', 'conversationId') }))
|
|
341
|
-
* ```
|
|
342
|
-
*
|
|
343
|
-
* It resumes with the conversation context:
|
|
344
|
-
* `out('listen', 'conversationContext.messages')` is the transcript and
|
|
345
|
-
* `…conversationContext.latestExchangeId` is the turn to answer.
|
|
346
|
-
*
|
|
347
|
-
* @param inputs - The conversation to wait on, and how much history to return.
|
|
348
|
-
* @returns An action spec to pass to `.step(...)`.
|
|
349
|
-
*/
|
|
350
|
-
export function waitForMessage(inputs) {
|
|
351
|
-
return builtinActionSpec({ kind: 'waitForMessage', inputs });
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* READ a conversation's transcript so far without waiting
|
|
355
|
-
* (`uipath.conversational.get-conversation-context`) — the shape a
|
|
356
|
-
* conversational agent takes as its turn context.
|
|
357
|
-
*
|
|
358
|
-
* ```ts
|
|
359
|
-
* .step('history', conversationContext({
|
|
360
|
-
* conversationId: out('start', 'conversationId'), exchangeLimit: 10,
|
|
361
|
-
* }))
|
|
362
|
-
* ```
|
|
363
|
-
*
|
|
364
|
-
* @param inputs - The conversation to read, and how many exchanges to return.
|
|
365
|
-
* @returns An action spec to pass to `.step(...)`.
|
|
366
|
-
*/
|
|
367
|
-
export function conversationContext(inputs) {
|
|
368
|
-
return builtinActionSpec({ kind: 'conversationContext', inputs });
|
|
369
|
-
}
|
|
370
313
|
/**
|
|
371
314
|
* Place an outgoing phone call
|
|
372
315
|
* (`uipath.conversational.voice.create-outgoing-call`) and get back the
|
|
@@ -32,11 +32,8 @@ export const TYPED_FACTORIES = {
|
|
|
32
32
|
'uipath.agent.autonomous': { factory: 'inlineAgent()' },
|
|
33
33
|
'uipath.agent.conversational': { factory: 'conversationalAgent()' },
|
|
34
34
|
'uipath.agent.voice': { factory: 'voiceAgent()' },
|
|
35
|
-
'uipath.conversational.get-conversation-context': { factory: 'conversationContext()' },
|
|
36
|
-
'uipath.conversational.send-message': { factory: 'sendMessage()' },
|
|
37
35
|
'uipath.conversational.voice.create-outgoing-call': { factory: 'createOutgoingCall()' },
|
|
38
36
|
'uipath.conversational.voice.end-call': { factory: 'endCall()' },
|
|
39
|
-
'uipath.conversational.wait-for-message': { factory: 'waitForMessage()' },
|
|
40
37
|
'uipath.human-in-the-loop': { factory: 'hitl()' },
|
|
41
38
|
'uipath.human-in-the-loop.coded-action-app': {
|
|
42
39
|
factory: "hitl({ variant: 'action-app' })",
|
package/dist/decompile.js
CHANGED
|
@@ -229,9 +229,6 @@ const T = {
|
|
|
229
229
|
hitlQuickForm: 'uipath.human-in-the-loop.quick-form',
|
|
230
230
|
hitlActionApp: 'uipath.human-in-the-loop.coded-action-app',
|
|
231
231
|
hitlDocValidation: 'uipath.human-in-the-loop.document-validation',
|
|
232
|
-
sendMessage: 'uipath.conversational.send-message',
|
|
233
|
-
waitForMessage: 'uipath.conversational.wait-for-message',
|
|
234
|
-
conversationContext: 'uipath.conversational.get-conversation-context',
|
|
235
232
|
triggerVoice: 'core.trigger.voice',
|
|
236
233
|
createOutgoingCall: 'uipath.conversational.voice.create-outgoing-call',
|
|
237
234
|
endCall: 'uipath.conversational.voice.end-call',
|
|
@@ -659,47 +656,6 @@ function emitStepSpec(node, imp, inputNames, o, graph) {
|
|
|
659
656
|
case T.hitlActionApp:
|
|
660
657
|
case T.hitlDocValidation:
|
|
661
658
|
return emitHitl(node, imp, inputNames, graph);
|
|
662
|
-
case T.sendMessage:
|
|
663
|
-
case T.waitForMessage:
|
|
664
|
-
case T.conversationContext: {
|
|
665
|
-
// The fixed enum fields (`role`/`mimeType`/`from`) come from the
|
|
666
|
-
// definition's defaults, so nothing of them is recovered — only what an
|
|
667
|
-
// author could have written.
|
|
668
|
-
const i = (node.inputs ?? {});
|
|
669
|
-
const v = (x) => {
|
|
670
|
-
const raw = typeof x === 'string' ? x : String(x?.expression ?? x ?? '');
|
|
671
|
-
return raw.startsWith('=js:') ? emitBareExpr(raw.slice(4), imp, inputNames)
|
|
672
|
-
: raw.startsWith('$vars.') ? emitBareExpr(raw, imp, inputNames)
|
|
673
|
-
: tsLiteral(raw);
|
|
674
|
-
};
|
|
675
|
-
const num = (x) => {
|
|
676
|
-
if (x === undefined || x === null)
|
|
677
|
-
return undefined;
|
|
678
|
-
const n = Number(x?.expression ?? x);
|
|
679
|
-
return Number.isFinite(n) ? String(n) : undefined;
|
|
680
|
-
};
|
|
681
|
-
const cid = ['conversationId', v(i.conversationId)];
|
|
682
|
-
if (node.type === T.sendMessage) {
|
|
683
|
-
return `${imp.use('sendMessage')}(${opts([
|
|
684
|
-
cid,
|
|
685
|
-
['exchangeId', v(i.exchangeId)],
|
|
686
|
-
['content', v(i.content)],
|
|
687
|
-
// The definition defaults `endExchange` to false; only a departure
|
|
688
|
-
// from the default is something the author wrote.
|
|
689
|
-
['endExchange', i.endExchange === true ? 'true' : undefined],
|
|
690
|
-
])})`;
|
|
691
|
-
}
|
|
692
|
-
if (node.type === T.waitForMessage) {
|
|
693
|
-
return `${imp.use('waitForMessage')}(${opts([
|
|
694
|
-
cid,
|
|
695
|
-
['numExchanges', num(i.numExchanges) === '20' ? undefined : num(i.numExchanges)],
|
|
696
|
-
])})`;
|
|
697
|
-
}
|
|
698
|
-
return `${imp.use('conversationContext')}(${opts([
|
|
699
|
-
cid,
|
|
700
|
-
['exchangeLimit', num(i.exchangeLimit) === '20' ? undefined : num(i.exchangeLimit)],
|
|
701
|
-
])})`;
|
|
702
|
-
}
|
|
703
659
|
default:
|
|
704
660
|
// A connector action node: `uipath.connector.<key>.<action>` (but NOT the
|
|
705
661
|
// event nodes `uipath.connector.event.*` / `.trigger.*`, which are triggers).
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { NodeTypeRegistry } from './core/nodes/registry.js';
|
|
10
10
|
import { hasBundledDefinition } from './flow-definitions.js';
|
|
11
11
|
import { aiPatternsFlowFamily } from './nodes/ai-patterns/flow/family.js';
|
|
12
|
+
import { conversationFlowFamily } from './nodes/conversation/flow/family.js';
|
|
12
13
|
import { dataFabricFlowFamily } from './nodes/data-fabric/flow/family.js';
|
|
13
14
|
import { delayFlowFamily } from './nodes/delay/flow/family.js';
|
|
14
15
|
import { documentFlowFamily } from './nodes/document/flow/family.js';
|
|
@@ -18,5 +19,5 @@ import { queueFlowFamily } from './nodes/queue/flow/family.js';
|
|
|
18
19
|
import { scriptFlowFamily } from './nodes/script/flow/family.js';
|
|
19
20
|
import { transformFlowFamily } from './nodes/transform/flow/family.js';
|
|
20
21
|
/** The families, in no significant order. Adding one is the whole of registering it. */
|
|
21
|
-
export const FLOW_NODE_FAMILIES = [aiPatternsFlowFamily, dataFabricFlowFamily, delayFlowFamily, documentFlowFamily, httpFlowFamily, mockFlowFamily, queueFlowFamily, scriptFlowFamily, transformFlowFamily];
|
|
22
|
+
export const FLOW_NODE_FAMILIES = [aiPatternsFlowFamily, conversationFlowFamily, dataFabricFlowFamily, delayFlowFamily, documentFlowFamily, httpFlowFamily, mockFlowFamily, queueFlowFamily, scriptFlowFamily, transformFlowFamily];
|
|
22
23
|
export const FLOW_NODE_TYPES = new NodeTypeRegistry('flow', FLOW_NODE_FAMILIES, { hasBundledDefinition });
|
package/dist/flow-sdk.d.ts
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
export * from './core/expr.js';
|
|
20
20
|
export * from './core/actions.js';
|
|
21
21
|
export * from './nodes/ai-patterns/flow/index.js';
|
|
22
|
+
export * from './nodes/conversation/flow/index.js';
|
|
22
23
|
export * from './nodes/data-fabric/flow/index.js';
|
|
23
24
|
export * from './nodes/delay/flow/index.js';
|
|
24
25
|
export * from './nodes/document/flow/index.js';
|
package/dist/flow-sdk.js
CHANGED
|
@@ -23,6 +23,7 @@ export * from './core/expr.js';
|
|
|
23
23
|
export * from './core/actions.js';
|
|
24
24
|
// Node families' public surfaces (docs/NODE_TYPE_ARCHITECTURE_DESIGN.md §8).
|
|
25
25
|
export * from './nodes/ai-patterns/flow/index.js';
|
|
26
|
+
export * from './nodes/conversation/flow/index.js';
|
|
26
27
|
export * from './nodes/data-fabric/flow/index.js';
|
|
27
28
|
export * from './nodes/delay/flow/index.js';
|
|
28
29
|
export * from './nodes/document/flow/index.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The conversation family's rules. Moved from check.ts in Phase 4 of
|
|
3
|
+
* docs/NODE_TYPE_ARCHITECTURE_DESIGN.md; codes and messages unchanged.
|
|
4
|
+
*/
|
|
5
|
+
import type { DiagnosticCatalog } from '../../../core/nodes/family.js';
|
|
6
|
+
import type { FlowCheckContext } from '../../../flow-node-type.js';
|
|
7
|
+
export declare const CONVERSATION_DIAGNOSTICS: DiagnosticCatalog;
|
|
8
|
+
/**
|
|
9
|
+
* A conversational step (Phase 5C): send-message, wait-for-message, or
|
|
10
|
+
* get-conversation-context.
|
|
11
|
+
*
|
|
12
|
+
* Everything here is decidable offline and invisible later: the node's own
|
|
13
|
+
* schema requires `conversationId` (and `exchangeId`/`content` on send), and
|
|
14
|
+
* the two numeric limits are range-checked by the designer but silently
|
|
15
|
+
* clamped at run time.
|
|
16
|
+
*/
|
|
17
|
+
export declare function checkConversational(kind: 'sendMessage' | 'waitForMessage' | 'conversationContext', inputs: Record<string, unknown> | undefined, ctx: FlowCheckContext): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Expr } from '../../../core/expr.js';
|
|
2
|
+
export const CONVERSATION_DIAGNOSTICS = {
|
|
3
|
+
CONVERSATION_NO_ID: { severity: 'error', summary: 'a conversational step with no conversationId' },
|
|
4
|
+
SEND_MESSAGE_NO_EXCHANGE: { severity: 'error', summary: 'sendMessage with no exchangeId' },
|
|
5
|
+
SEND_MESSAGE_NO_CONTENT: { severity: 'error', summary: 'sendMessage with no content' },
|
|
6
|
+
CONVERSATION_RANGE: { severity: 'error', summary: 'a history limit outside 1–40' },
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A conversational step (Phase 5C): send-message, wait-for-message, or
|
|
10
|
+
* get-conversation-context.
|
|
11
|
+
*
|
|
12
|
+
* Everything here is decidable offline and invisible later: the node's own
|
|
13
|
+
* schema requires `conversationId` (and `exchangeId`/`content` on send), and
|
|
14
|
+
* the two numeric limits are range-checked by the designer but silently
|
|
15
|
+
* clamped at run time.
|
|
16
|
+
*/
|
|
17
|
+
export function checkConversational(kind, inputs, ctx) {
|
|
18
|
+
const step = ctx.step;
|
|
19
|
+
const at = (code, message, suggestion) => ctx.report(code, message, suggestion);
|
|
20
|
+
const blank = (v) => v === undefined || v === null || (typeof v === 'string' && v.trim() === '');
|
|
21
|
+
const label = kind === 'sendMessage' ? 'sendMessage'
|
|
22
|
+
: kind === 'waitForMessage' ? 'waitForMessage' : 'conversationContext';
|
|
23
|
+
if (blank(inputs?.conversationId)) {
|
|
24
|
+
at('CONVERSATION_NO_ID', `${label} step "${step}" has no \`conversationId\`, which the node's schema requires — every `
|
|
25
|
+
+ `conversational step is keyed by the conversation it belongs to. The conversation trigger publishes `
|
|
26
|
+
+ `it as out('start', 'conversationId').`, `conversationId: out('start', 'conversationId')`);
|
|
27
|
+
}
|
|
28
|
+
if (kind === 'sendMessage') {
|
|
29
|
+
if (blank(inputs?.exchangeId)) {
|
|
30
|
+
at('SEND_MESSAGE_NO_EXCHANGE', `sendMessage step "${step}" has no \`exchangeId\` — the node's schema requires it, because a message `
|
|
31
|
+
+ `belongs to one exchange (a user turn and its answers). A wait step publishes it as `
|
|
32
|
+
+ `out('<waitStep>', 'conversationContext.latestExchangeId').`, `exchangeId: out('<waitStep>', 'conversationContext.latestExchangeId')`);
|
|
33
|
+
}
|
|
34
|
+
if (blank(inputs?.content)) {
|
|
35
|
+
at('SEND_MESSAGE_NO_CONTENT', `sendMessage step "${step}" has no \`content\` — the node's schema requires a non-empty message `
|
|
36
|
+
+ `(Markdown), and an empty one posts a blank turn into the conversation.`, `content: 'Looking into it.'`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const rangeCheck = (field, max) => {
|
|
40
|
+
const raw = inputs?.[field];
|
|
41
|
+
if (raw === undefined || raw instanceof Expr)
|
|
42
|
+
return;
|
|
43
|
+
const n = Number(raw);
|
|
44
|
+
if (!Number.isFinite(n) || !Number.isInteger(n) || n < 1 || n > max) {
|
|
45
|
+
at('CONVERSATION_RANGE', `${label} step "${step}"'s \`${field}\` is ${JSON.stringify(raw)}. The node accepts a whole number from `
|
|
46
|
+
+ `1 to ${max} (the platform default is 20); anything else is clamped at run time, so the flow reads `
|
|
47
|
+
+ `a different amount of history than it says.`, `${field}: 20`);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
if (kind === 'waitForMessage')
|
|
51
|
+
rangeCheck('numExchanges', 40);
|
|
52
|
+
if (kind === 'conversationContext')
|
|
53
|
+
rangeCheck('exchangeLimit', 40);
|
|
54
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The conversation factories, `sendMessage()`, `waitForMessage()` and
|
|
3
|
+
* `conversationContext()`. Moved from core/actions.ts in Phase 4 of
|
|
4
|
+
* docs/NODE_TYPE_ARCHITECTURE_DESIGN.md; the package entry re-exports them.
|
|
5
|
+
*/
|
|
6
|
+
import { type ActionSpec } from '../../../core/actions.js';
|
|
7
|
+
import type { ConversationContextInputs, SendMessageInputs, WaitForMessageInputs } from './spec.js';
|
|
8
|
+
/**
|
|
9
|
+
* Post an assistant message into a live conversation
|
|
10
|
+
* (`uipath.conversational.send-message`).
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* .step('answer', sendMessage({
|
|
14
|
+
* conversationId: out('start', 'conversationId'),
|
|
15
|
+
* exchangeId: out('listen', 'conversationContext.latestExchangeId'),
|
|
16
|
+
* content: 'Your order ships tomorrow.',
|
|
17
|
+
* }))
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* The message is Markdown (`text/markdown` is the node's only supported type)
|
|
21
|
+
* and the role is always `assistant` — a flow speaks as the assistant.
|
|
22
|
+
*
|
|
23
|
+
* @param inputs - The conversation, the exchange, and what to say.
|
|
24
|
+
* @returns An action spec to pass to `.step(...)`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function sendMessage(inputs: SendMessageInputs): ActionSpec;
|
|
27
|
+
/**
|
|
28
|
+
* PAUSE until the person sends their next message
|
|
29
|
+
* (`uipath.conversational.wait-for-message`) — a catch event, like
|
|
30
|
+
* `waitForEvent`, so the flow suspends rather than polling.
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* .step('listen', waitForMessage({ conversationId: out('start', 'conversationId') }))
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* It resumes with the conversation context:
|
|
37
|
+
* `out('listen', 'conversationContext.messages')` is the transcript and
|
|
38
|
+
* `…conversationContext.latestExchangeId` is the turn to answer.
|
|
39
|
+
*
|
|
40
|
+
* @param inputs - The conversation to wait on, and how much history to return.
|
|
41
|
+
* @returns An action spec to pass to `.step(...)`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function waitForMessage(inputs: WaitForMessageInputs): ActionSpec;
|
|
44
|
+
/**
|
|
45
|
+
* READ a conversation's transcript so far without waiting
|
|
46
|
+
* (`uipath.conversational.get-conversation-context`) — the shape a
|
|
47
|
+
* conversational agent takes as its turn context.
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* .step('history', conversationContext({
|
|
51
|
+
* conversationId: out('start', 'conversationId'), exchangeLimit: 10,
|
|
52
|
+
* }))
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @param inputs - The conversation to read, and how many exchanges to return.
|
|
56
|
+
* @returns An action spec to pass to `.step(...)`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function conversationContext(inputs: ConversationContextInputs): ActionSpec;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The conversation factories, `sendMessage()`, `waitForMessage()` and
|
|
3
|
+
* `conversationContext()`. Moved from core/actions.ts in Phase 4 of
|
|
4
|
+
* docs/NODE_TYPE_ARCHITECTURE_DESIGN.md; the package entry re-exports them.
|
|
5
|
+
*/
|
|
6
|
+
import { builtinActionSpec } from '../../../core/actions.js';
|
|
7
|
+
/**
|
|
8
|
+
* Post an assistant message into a live conversation
|
|
9
|
+
* (`uipath.conversational.send-message`).
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* .step('answer', sendMessage({
|
|
13
|
+
* conversationId: out('start', 'conversationId'),
|
|
14
|
+
* exchangeId: out('listen', 'conversationContext.latestExchangeId'),
|
|
15
|
+
* content: 'Your order ships tomorrow.',
|
|
16
|
+
* }))
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* The message is Markdown (`text/markdown` is the node's only supported type)
|
|
20
|
+
* and the role is always `assistant` — a flow speaks as the assistant.
|
|
21
|
+
*
|
|
22
|
+
* @param inputs - The conversation, the exchange, and what to say.
|
|
23
|
+
* @returns An action spec to pass to `.step(...)`.
|
|
24
|
+
*/
|
|
25
|
+
export function sendMessage(inputs) {
|
|
26
|
+
return builtinActionSpec({ kind: 'sendMessage', inputs });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* PAUSE until the person sends their next message
|
|
30
|
+
* (`uipath.conversational.wait-for-message`) — a catch event, like
|
|
31
|
+
* `waitForEvent`, so the flow suspends rather than polling.
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* .step('listen', waitForMessage({ conversationId: out('start', 'conversationId') }))
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* It resumes with the conversation context:
|
|
38
|
+
* `out('listen', 'conversationContext.messages')` is the transcript and
|
|
39
|
+
* `…conversationContext.latestExchangeId` is the turn to answer.
|
|
40
|
+
*
|
|
41
|
+
* @param inputs - The conversation to wait on, and how much history to return.
|
|
42
|
+
* @returns An action spec to pass to `.step(...)`.
|
|
43
|
+
*/
|
|
44
|
+
export function waitForMessage(inputs) {
|
|
45
|
+
return builtinActionSpec({ kind: 'waitForMessage', inputs });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* READ a conversation's transcript so far without waiting
|
|
49
|
+
* (`uipath.conversational.get-conversation-context`) — the shape a
|
|
50
|
+
* conversational agent takes as its turn context.
|
|
51
|
+
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* .step('history', conversationContext({
|
|
54
|
+
* conversationId: out('start', 'conversationId'), exchangeLimit: 10,
|
|
55
|
+
* }))
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @param inputs - The conversation to read, and how many exchanges to return.
|
|
59
|
+
* @returns An action spec to pass to `.step(...)`.
|
|
60
|
+
*/
|
|
61
|
+
export function conversationContext(inputs) {
|
|
62
|
+
return builtinActionSpec({ kind: 'conversationContext', inputs });
|
|
63
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CONVERSATION_DIAGNOSTICS } from './check.js';
|
|
2
|
+
import { conversationNodeTypes } from './node-type.js';
|
|
3
|
+
export const conversationFlowFamily = {
|
|
4
|
+
id: 'conversation',
|
|
5
|
+
title: 'Conversation',
|
|
6
|
+
types: conversationNodeTypes,
|
|
7
|
+
diagnostics: CONVERSATION_DIAGNOSTICS,
|
|
8
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FlowVersionedNodeType } from '../../../flow-node-type.js';
|
|
2
|
+
import type { ConversationContextInputs, SendMessageInputs, WaitForMessageInputs } from './spec.js';
|
|
3
|
+
type Spec = {
|
|
4
|
+
kind: 'sendMessage';
|
|
5
|
+
inputs: SendMessageInputs;
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'waitForMessage';
|
|
8
|
+
inputs: WaitForMessageInputs;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'conversationContext';
|
|
11
|
+
inputs: ConversationContextInputs;
|
|
12
|
+
};
|
|
13
|
+
export declare const conversationNodeTypes: FlowVersionedNodeType<Spec>[];
|
|
14
|
+
export {};
|