@parall/parel-channel 1.55.4 → 1.56.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.
@@ -44,6 +44,12 @@ export interface ChatPromptArgs {
44
44
  */
45
45
  messageId?: string;
46
46
  threadRootId?: string;
47
+ /**
48
+ * WorkItem delivery_reason (mention / watcher / policy) — why THIS agent
49
+ * was selected. Rendered only when present: routine group-mode deliveries
50
+ * carry none, so their frame is unchanged.
51
+ */
52
+ deliveryReason?: string;
47
53
  /** The inbound message text (raw, un-framed); may be empty (attachment-only). */
48
54
  text: string;
49
55
  /** Message attachments — rendered as reference lines (agent fetches via CLI). */
@@ -1 +1 @@
1
- {"version":3,"file":"channel-prompt.d.ts","sourceRoot":"","sources":["../src/channel-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AA+BH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,8FAA8F;IAC9F,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAmBD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAoB5D;AAED,MAAM,WAAW,iBAAiB;IAChC,gEAAg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E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAkBlE"}
@@ -81,6 +81,8 @@ export function buildChatPrompt(args) {
81
81
  lines.push(`[From: ${sanitizeMeta(args.senderId)}]`);
82
82
  if (args.threadRootId)
83
83
  lines.push(`[Thread: ${sanitizeMeta(args.threadRootId)}]`);
84
+ if (args.deliveryReason)
85
+ lines.push(`[Delivery: ${sanitizeMeta(args.deliveryReason)}]`);
84
86
  if (args.noReply)
85
87
  lines.push(`[Hint: no_reply]`);
86
88
  if (isForwardedMessageBody(args.text)) {
@@ -1 +1 @@
1
- {"version":3,"file":"inbound.d.ts","sourceRoot":"","sources":["../src/inbound.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACf,MAAM,mBAAmB,CAAC;AAsI3B,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAWrF;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,EACrB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,eAAe,EAAE,CAAC,CAE5B;AAoDD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACtB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,eAAe,EAAE,CAAC,CAE5B;AAsCD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAElF;AA0oBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAE7B"}
1
+ {"version":3,"file":"inbound.d.ts","sourceRoot":"","sources":["../src/inbound.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACf,MAAM,mBAAmB,CAAC;AAsI3B,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAWrF;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,EACrB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,eAAe,EAAE,CAAC,CAE5B;AAoDD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACtB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,eAAe,EAAE,CAAC,CAE5B;AAsCD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAElF;AA2oBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAE7B"}
package/dist/inbound.js CHANGED
@@ -265,6 +265,7 @@ async function effectsForDispatch(data, ctx) {
265
265
  senderId,
266
266
  messageId: sourceId,
267
267
  threadRootId,
268
+ deliveryReason: data.delivery_reason ? String(data.delivery_reason) : undefined,
268
269
  text,
269
270
  attachments,
270
271
  noReply,
@@ -1 +1 @@
1
- {"version":3,"file":"typed-dispatch.d.ts","sourceRoot":"","sources":["../src/typed-dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAI1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,kIAQpB,CAAC;AAEX,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAChD,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,mBAAmB,GAC3B,cAAc;A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CAAC;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,mBAAmB,GAC3B,cAAc;AAChB,2CAA2C;GACzC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE;AACtB;oEACoE;GAClE;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC;AA0B3B;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,iBAAiB,EACvB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,mBAAmB,CAAC,CAmC9B"}
@@ -25,6 +25,12 @@ function sanitizeMeta(value) {
25
25
  .replace(/[[\]|]/g, ' ')
26
26
  .trim();
27
27
  }
28
+ function formatApprovalDecisionReason(status, reason) {
29
+ const normalized = reason?.trim();
30
+ if (status !== 'rejected' || !normalized)
31
+ return '';
32
+ return `Reason (JSON): ${JSON.stringify(normalized)}`;
33
+ }
28
34
  /**
29
35
  * Build the plan for one typed dispatch. Throws on transient failures
30
36
  * (including unexpected handler errors — a poisoned row surfaces as catch-up
@@ -344,6 +350,9 @@ async function planApprovalDecided(ctx, approvalId, chatId, actor) {
344
350
  lines.push(`[Chat: prll://${resolvedChat}]`);
345
351
  lines.push(`[Decided by: ${sanitizeMeta(actor ?? approval.decided_by ?? 'system')}]`);
346
352
  lines.push('', `${statusLabel}: ${approval.title ?? ''}${execInfo}`);
353
+ const reasonLine = formatApprovalDecisionReason(approval.status, approval.decision_reason);
354
+ if (reasonLine)
355
+ lines.push(reasonLine);
347
356
  return {
348
357
  outcome: 'emit',
349
358
  // The decision belongs to the chat conversation it happened in — group
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/parel-channel",
3
- "version": "1.55.4",
3
+ "version": "1.56.0",
4
4
  "description": "Parall channel plugin for the parel runtime — lets a parel agent treat Parall as a managed_ws channel (receive dispatches, reply via the Parall API)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -75,6 +75,12 @@ export interface ChatPromptArgs {
75
75
  */
76
76
  messageId?: string;
77
77
  threadRootId?: string;
78
+ /**
79
+ * WorkItem delivery_reason (mention / watcher / policy) — why THIS agent
80
+ * was selected. Rendered only when present: routine group-mode deliveries
81
+ * carry none, so their frame is unchanged.
82
+ */
83
+ deliveryReason?: string;
78
84
  /** The inbound message text (raw, un-framed); may be empty (attachment-only). */
79
85
  text: string;
80
86
  /** Message attachments — rendered as reference lines (agent fetches via CLI). */
@@ -113,6 +119,7 @@ export function buildChatPrompt(args: ChatPromptArgs): string {
113
119
  const lines = [`[Chat: ${chatLabel}]`];
114
120
  if (args.senderId) lines.push(`[From: ${sanitizeMeta(args.senderId)}]`);
115
121
  if (args.threadRootId) lines.push(`[Thread: ${sanitizeMeta(args.threadRootId)}]`);
122
+ if (args.deliveryReason) lines.push(`[Delivery: ${sanitizeMeta(args.deliveryReason)}]`);
116
123
  if (args.noReply) lines.push(`[Hint: no_reply]`);
117
124
  if (isForwardedMessageBody(args.text)) {
118
125
  // Embed the concrete --from anchor: parel snapshots one invocation
package/src/inbound.ts CHANGED
@@ -416,6 +416,7 @@ async function effectsForDispatch(
416
416
  senderId,
417
417
  messageId: sourceId,
418
418
  threadRootId,
419
+ deliveryReason: data.delivery_reason ? String(data.delivery_reason) : undefined,
419
420
  text,
420
421
  attachments,
421
422
  noReply,
@@ -106,6 +106,15 @@ function sanitizeMeta(value: string): string {
106
106
  .trim();
107
107
  }
108
108
 
109
+ function formatApprovalDecisionReason(
110
+ status: string | undefined,
111
+ reason: string | null | undefined,
112
+ ): string {
113
+ const normalized = reason?.trim();
114
+ if (status !== 'rejected' || !normalized) return '';
115
+ return `Reason (JSON): ${JSON.stringify(normalized)}`;
116
+ }
117
+
109
118
  /**
110
119
  * Build the plan for one typed dispatch. Throws on transient failures
111
120
  * (including unexpected handler errors — a poisoned row surfaces as catch-up
@@ -501,6 +510,7 @@ interface ApprovalRow {
501
510
  execution_status?: string;
502
511
  chat_id?: string;
503
512
  decided_by?: string;
513
+ decision_reason?: string | null;
504
514
  }
505
515
 
506
516
  async function planApprovalDecided(
@@ -530,6 +540,8 @@ async function planApprovalDecided(
530
540
  if (resolvedChat) lines.push(`[Chat: prll://${resolvedChat}]`);
531
541
  lines.push(`[Decided by: ${sanitizeMeta(actor ?? approval.decided_by ?? 'system')}]`);
532
542
  lines.push('', `${statusLabel}: ${approval.title ?? ''}${execInfo}`);
543
+ const reasonLine = formatApprovalDecisionReason(approval.status, approval.decision_reason);
544
+ if (reasonLine) lines.push(reasonLine);
533
545
 
534
546
  return {
535
547
  outcome: 'emit',