@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.
@@ -0,0 +1,117 @@
1
+ /**
2
+ * The three conversational node types: `uipath.conversational.send-message`
3
+ * (1.0, 1.1), `.wait-for-message` (1.0, 1.1) and `.get-conversation-context`
4
+ * (1.0). Moved from serialize.ts / check.ts / decompile.ts in Phase 4 of
5
+ * docs/NODE_TYPE_ARCHITECTURE_DESIGN.md; serialized output, printed source,
6
+ * codes and messages unchanged.
7
+ */
8
+ import { Expr, toExpr } from '../../../core/expr.js';
9
+ import { jsonClone } from '../../../core/json-file.js';
10
+ import { checkConversational } from './check.js';
11
+ /**
12
+ * The definition's `inputDefaults`, which supply the fixed fields the platform's
13
+ * schema requires (`role: 'assistant'` and `mimeType: 'text/markdown'` on send,
14
+ * `from: 'User'` on wait) — the author never writes a value the enum only allows
15
+ * one of. Always the 1.0 definition's, whatever version is emitted: that is what
16
+ * the pipeline wrote before the port (its `defByType` holds the first bundled
17
+ * copy), so a 1.1 step still carries 1.0's `endExchange` / `numExchanges` keys.
18
+ */
19
+ function defaults(ctx, typeName) {
20
+ return jsonClone(ctx.definition(typeName, '1.0')?.inputDefaults ?? {});
21
+ }
22
+ /** A value rendered as the file stores it; a bare literal is wrapped first, as the pipeline did. */
23
+ const rendered = (ctx, v) => ctx.render(toExpr(v));
24
+ /**
25
+ * A serialized value as the author wrote it. Decompile's own reading: the text of
26
+ * a string, or of an envelope's `expression`; `=js:` and a bare `$vars.` path are
27
+ * references, anything else a literal string.
28
+ */
29
+ function lifted(x, ctx) {
30
+ const raw = typeof x === 'string' ? x : String(x?.expression ?? x ?? '');
31
+ if (raw.startsWith('=js:'))
32
+ return ctx.expr(raw);
33
+ if (raw.startsWith('$vars.'))
34
+ return ctx.expr(`=js:${raw}`);
35
+ return raw;
36
+ }
37
+ /** A number, or undefined for an absent or non-finite one. */
38
+ function liftedNumber(x) {
39
+ if (x === undefined || x === null)
40
+ return undefined;
41
+ const n = Number(x?.expression ?? x);
42
+ return Number.isFinite(n) ? n : undefined;
43
+ }
44
+ const printed = (v, ctx) => (v instanceof Expr ? ctx.value(v) : ctx.string(String(v)));
45
+ function conversationAt(kind, typeName, version) {
46
+ return {
47
+ kind, typeName, version, factory: kind, definition: 'bundled',
48
+ rawNode: { factory: `${kind}()` },
49
+ serialize: (spec, ctx) => {
50
+ const i = spec.inputs;
51
+ const base = { ...defaults(ctx, typeName), conversationId: rendered(ctx, i.conversationId) };
52
+ const inputs = kind === 'sendMessage'
53
+ ? {
54
+ ...base,
55
+ exchangeId: rendered(ctx, i.exchangeId),
56
+ content: rendered(ctx, i.content),
57
+ ...(i.endExchange !== undefined ? { endExchange: i.endExchange } : {}),
58
+ }
59
+ : kind === 'waitForMessage'
60
+ ? { ...base, ...(i.numExchanges !== undefined ? { numExchanges: i.numExchanges } : {}) }
61
+ : { ...base, ...(i.exchangeLimit !== undefined ? { exchangeLimit: i.exchangeLimit } : {}) };
62
+ // The service model stays on the DEFINITION only: these are
63
+ // `bpmn:ServiceTask` / `bpmn:IntermediateCatchEvent` nodes whose
64
+ // serviceType the platform resolves from `definitions[]`.
65
+ return { model: 'omit', inputs, port: 'output' };
66
+ },
67
+ // The fixed enum fields come from the definition's defaults, so nothing of
68
+ // them is recovered — only what an author could have written.
69
+ deserialize: (node, ctx) => {
70
+ const i = (node.inputs ?? {});
71
+ const conversationId = lifted(i.conversationId, ctx);
72
+ if (kind === 'sendMessage') {
73
+ return {
74
+ kind,
75
+ inputs: {
76
+ conversationId,
77
+ exchangeId: lifted(i.exchangeId, ctx),
78
+ content: lifted(i.content, ctx),
79
+ // The definition defaults `endExchange` to false; only a departure was authored.
80
+ ...(i.endExchange === true ? { endExchange: true } : {}),
81
+ },
82
+ };
83
+ }
84
+ const field = kind === 'waitForMessage' ? 'numExchanges' : 'exchangeLimit';
85
+ const n = liftedNumber(i[field]);
86
+ return { kind, inputs: { conversationId, ...(n !== undefined && n !== 20 ? { [field]: n } : {}) } };
87
+ },
88
+ print: (spec, ctx) => {
89
+ const i = spec.inputs;
90
+ const cid = ['conversationId', printed(i.conversationId, ctx)];
91
+ if (kind === 'sendMessage') {
92
+ return {
93
+ factory: kind,
94
+ options: [cid, ['exchangeId', printed(i.exchangeId, ctx)], ['content', printed(i.content, ctx)],
95
+ ['endExchange', i.endExchange === true ? 'true' : undefined]],
96
+ };
97
+ }
98
+ const field = kind === 'waitForMessage' ? 'numExchanges' : 'exchangeLimit';
99
+ return { factory: kind, options: [cid, [field, i[field] !== undefined ? ctx.json(i[field]) : undefined]] };
100
+ },
101
+ check: (spec, ctx) => checkConversational(kind, spec.inputs, ctx),
102
+ // check collected no expressions for a conversational step before the port; unchanged by it.
103
+ expressions: () => [],
104
+ output: () => ({ kind: 'opaque' }),
105
+ };
106
+ }
107
+ function conversationType(kind, typeName, versions) {
108
+ return {
109
+ kind, typeName, factory: kind, defaultVersion: '1.0',
110
+ versions: Object.fromEntries(versions.map((v) => [v, conversationAt(kind, typeName, v)])),
111
+ };
112
+ }
113
+ export const conversationNodeTypes = [
114
+ conversationType('sendMessage', 'uipath.conversational.send-message', ['1.0', '1.1']),
115
+ conversationType('waitForMessage', 'uipath.conversational.wait-for-message', ['1.0', '1.1']),
116
+ conversationType('conversationContext', 'uipath.conversational.get-conversation-context', ['1.0']),
117
+ ];
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The conversation family's authoring types (`uipath.conversational.send-message`,
3
+ * `.wait-for-message`, `.get-conversation-context`), and their kinds' entries in
4
+ * `FlowActionSpecs`. Moved from core/actions.ts in Phase 4 of
5
+ * docs/NODE_TYPE_ARCHITECTURE_DESIGN.md.
6
+ */
7
+ import type { Expr } from '../../../core/expr.js';
8
+ export interface SendMessageInputs {
9
+ /**
10
+ * The conversation to post into — from the conversation trigger
11
+ * (`out('start', 'conversationId')`) or a context read. Required.
12
+ */
13
+ conversationId: string | Expr;
14
+ /**
15
+ * The exchange (one user turn plus its answers) the message belongs to —
16
+ * `out('<waitStep>', 'conversationContext.latestExchangeId')`, or the
17
+ * trigger's exchange for the first answer. Required by the node's schema.
18
+ */
19
+ exchangeId: string | Expr;
20
+ /** What to say. Markdown — the node's only supported `mimeType`. Required. */
21
+ content: string | Expr;
22
+ /**
23
+ * Whether this message CLOSES the exchange. The platform's legacy default is
24
+ * to end it; pass `false` to keep the exchange open for another message.
25
+ */
26
+ endExchange?: boolean;
27
+ }
28
+ export interface WaitForMessageInputs {
29
+ /** The conversation to wait on. Required. */
30
+ conversationId: string | Expr;
31
+ /**
32
+ * How many past exchanges the returned context carries. 1–40 in the
33
+ * designer; the platform default is 20.
34
+ */
35
+ numExchanges?: number;
36
+ }
37
+ export interface ConversationContextInputs {
38
+ /** The conversation to read. Required. */
39
+ conversationId: string | Expr;
40
+ /**
41
+ * How many exchanges to return, 1–40. The platform default is 20.
42
+ */
43
+ exchangeLimit?: number;
44
+ }
45
+ declare module '../../../core/actions.js' {
46
+ interface FlowActionSpecs {
47
+ /** The spec {@link sendMessage} builds. */
48
+ sendMessage: {
49
+ inputs: SendMessageInputs;
50
+ };
51
+ /** The spec {@link waitForMessage} builds. */
52
+ waitForMessage: {
53
+ inputs: WaitForMessageInputs;
54
+ };
55
+ /** The spec {@link conversationContext} builds. */
56
+ conversationContext: {
57
+ inputs: ConversationContextInputs;
58
+ };
59
+ }
60
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/serialize.js CHANGED
@@ -90,9 +90,6 @@ const NODE_TYPE = {
90
90
  scheduledTrigger: 'core.trigger.scheduled',
91
91
  formTrigger: 'core.trigger.form',
92
92
  conversationTrigger: 'core.trigger.conversation',
93
- sendMessage: 'uipath.conversational.send-message',
94
- waitForMessage: 'uipath.conversational.wait-for-message',
95
- conversationContext: 'uipath.conversational.get-conversation-context',
96
93
  voiceTrigger: 'core.trigger.voice',
97
94
  voiceAgent: 'uipath.agent.voice',
98
95
  conversationalAgent: 'uipath.agent.conversational',
@@ -3635,9 +3632,6 @@ export function bundledActionNodeType(spec) {
3635
3632
  case 'hitl': return hitlNodeType(spec.inputs);
3636
3633
  case 'inlineAgent': return INLINE_AGENT_TYPE;
3637
3634
  case 'subflow':
3638
- case 'sendMessage':
3639
- case 'waitForMessage':
3640
- case 'conversationContext':
3641
3635
  case 'createOutgoingCall':
3642
3636
  case 'endCall':
3643
3637
  case 'voiceAgent':
@@ -6020,48 +6014,6 @@ export function serialize(built, opts = {}) {
6020
6014
  addEdge(scope, t, id);
6021
6015
  return [{ node: id, port: successPort(NODE_TYPE.voiceAgent) }];
6022
6016
  }
6023
- if (spec.kind === 'sendMessage' || spec.kind === 'waitForMessage' || spec.kind === 'conversationContext') {
6024
- // One emit path for the three CONVERSATIONAL steps: they differ in their
6025
- // definition and in which fields they carry. Each field is written under
6026
- // the node's own name, and the definition's `inputDefaults` supply the
6027
- // fixed ones the platform's schema requires (`role: 'assistant'` and
6028
- // `mimeType: 'text/markdown'` on send, `from: 'User'` on wait) — the
6029
- // author never writes a value the enum only allows one of.
6030
- const type = spec.kind === 'sendMessage' ? NODE_TYPE.sendMessage
6031
- : spec.kind === 'waitForMessage' ? NODE_TYPE.waitForMessage
6032
- : NODE_TYPE.conversationContext;
6033
- const id = stepUid(scope, step.name);
6034
- const node = makeNode(type, id, step.name, { parentId, requestedVersion: step.options?.version });
6035
- // The service model stays on the DEFINITION only, as it does for the AI
6036
- // patterns and the published families: these are `bpmn:ServiceTask` /
6037
- // `bpmn:IntermediateCatchEvent` nodes whose serviceType the platform
6038
- // resolves from `definitions[]`.
6039
- delete node.model;
6040
- const defaults = jsonClone(defByType.get(type)?.inputDefaults ?? {});
6041
- node.inputs = spec.kind === 'sendMessage'
6042
- ? {
6043
- ...defaults,
6044
- conversationId: renderValue(toExpr(spec.inputs.conversationId), scope.rename),
6045
- exchangeId: renderValue(toExpr(spec.inputs.exchangeId), scope.rename),
6046
- content: renderValue(toExpr(spec.inputs.content), scope.rename),
6047
- ...(spec.inputs.endExchange !== undefined ? { endExchange: spec.inputs.endExchange } : {}),
6048
- }
6049
- : spec.kind === 'waitForMessage'
6050
- ? {
6051
- ...defaults,
6052
- conversationId: renderValue(toExpr(spec.inputs.conversationId), scope.rename),
6053
- ...(spec.inputs.numExchanges !== undefined ? { numExchanges: spec.inputs.numExchanges } : {}),
6054
- }
6055
- : {
6056
- ...defaults,
6057
- conversationId: renderValue(toExpr(spec.inputs.conversationId), scope.rename),
6058
- ...(spec.inputs.exchangeLimit !== undefined ? { exchangeLimit: spec.inputs.exchangeLimit } : {}),
6059
- };
6060
- scope.nodes.push(node);
6061
- for (const t of tails)
6062
- addEdge(scope, t, id);
6063
- return [{ node: id, port: successPort(type) }];
6064
- }
6065
6017
  if (spec.kind === 'ixpExtract') {
6066
6018
  const s = spec.inputs;
6067
6019
  const def = perCallDefinition(spec); // ixpExtractDef: throws on an unparseable project
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.23.0",
3
+ "version": "6.24.0",
4
4
  "description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.uipath.com/maestro",
@@ -92,5 +92,5 @@
92
92
  "@types/node": "^22.7.0",
93
93
  "esbuild": "^0.28.1"
94
94
  },
95
- "gitref": "4e81a94f4009b646e93353cd0043286f725a4507"
95
+ "gitref": "a3e8314b01bff6cf76316765840e31bd2e3860e5"
96
96
  }