@parall/cli 1.41.0 → 1.42.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.
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/commands/messages.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QA8MvD"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/commands/messages.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QAuOvD"}
@@ -1,6 +1,6 @@
1
1
  import { ApiError } from '@parall/sdk';
2
2
  import { randomUUID } from 'node:crypto';
3
- import { LaneContextError, markLaneReplyCommitted, resolveCredentials, resolveLaneDispatchContext, resolveRuntimeContext, } from '../lib/client.js';
3
+ import { LaneContextError, markLaneReplyCommitted, resolveCredentials, resolveLaneDispatchContext, resolveRuntimeContext, resolveSourceDispatchBinding, } from '../lib/client.js';
4
4
  import { printError, printJson, printRefHint, stripPrllScheme } from '../lib/output.js';
5
5
  import { NO_BODY_ERROR, resolveMessageText, TEXT_FILE_OPTION_DESC, TEXT_OPTION_DESC, } from '../lib/text-input.js';
6
6
  import { uploadFile } from '../lib/upload.js';
@@ -99,7 +99,17 @@ export function registerMessageCommands(program) {
99
99
  };
100
100
  if (attachmentIds)
101
101
  req.attachment_ids = attachmentIds;
102
- const threadRootId = opts.threadRootId !== undefined ? stripPrllScheme(opts.threadRootId) : undefined;
102
+ let threadRootId = opts.threadRootId !== undefined ? stripPrllScheme(opts.threadRootId) : undefined;
103
+ // By-source turns (parel — PRLL_DISPATCH_SOURCE_* set): a bare send
104
+ // back into the trigger chat defaults to the trigger's thread, so a
105
+ // thread message is answered in its thread without the model having
106
+ // to know the thread id. An explicit --thread-root-id always wins.
107
+ if (threadRootId === undefined &&
108
+ ctx.dispatchSourceId &&
109
+ ctx.threadRootId &&
110
+ chatId === ctx.chatId) {
111
+ threadRootId = ctx.threadRootId;
112
+ }
103
113
  if (threadRootId !== undefined)
104
114
  req.thread_root_id = threadRootId;
105
115
  if (opts.reply === false)
@@ -133,6 +143,20 @@ export function registerMessageCommands(program) {
133
143
  if (!req.agent_session_id && laneCtx.sessionId)
134
144
  req.agent_session_id = laneCtx.sessionId;
135
145
  }
146
+ else {
147
+ // By-source dispatch binding (parel — PRLL_DISPATCH_SOURCE_* env,
148
+ // never set in CC/Codex environments): a send back into the exact
149
+ // trigger (chat, thread) carries dispatch_source, so the server
150
+ // resolves the WorkItem (effect + result_uri) in the same
151
+ // transaction. Any other target is a side effect and stays
152
+ // unbound. Informational: the server never rejects the message
153
+ // over it.
154
+ const sourceBinding = resolveSourceDispatchBinding(ctx, chatId, threadRootId);
155
+ if (sourceBinding) {
156
+ req.dispatch_source = sourceBinding;
157
+ req.idempotency_key = `cli:${randomUUID()}`;
158
+ }
159
+ }
136
160
  const { message: result, deduplicated } = await client.sendMessageDetailed(orgId, chatId, req);
137
161
  if (laneCtx && usedReplyKey) {
138
162
  markLaneReplyCommitted(laneCtx);
@@ -17,6 +17,17 @@ export type RuntimeContext = {
17
17
  laneTargetUri?: string;
18
18
  /** Typed binding hint: the task this dispatch is about (task dispatch turns only). */
19
19
  taskId?: string;
20
+ /**
21
+ * By-source dispatch binding (lane-less runtimes — parel injects these per
22
+ * turn; CC/Codex never set them). A send back into the trigger (chat,
23
+ * thread) carries them as dispatch_source so the server resolves the
24
+ * WorkItem in the same transaction.
25
+ * Design: docs/engineering-design/parel-reply-contract-alignment.md.
26
+ */
27
+ dispatchSourceType?: string;
28
+ dispatchSourceId?: string;
29
+ /** Trigger thread root (parel invocation context) — the by-source send's default thread. */
30
+ threadRootId?: string;
20
31
  };
21
32
  /**
22
33
  * Read per-dispatch context from ENV + sideband files.
@@ -27,6 +38,18 @@ export type RuntimeContext = {
27
38
  * 3. PRLL_STEP_ID_FILE plain text (legacy step-id-only backward compat)
28
39
  */
29
40
  export declare function resolveRuntimeContext(): RuntimeContext;
41
+ /**
42
+ * By-source dispatch binding for a message send (lane-less runtimes — parel).
43
+ * Returns the dispatch_source payload iff the send's (chat, thread) exactly
44
+ * matches the trigger's: a thread trigger is only resolved by a reply back
45
+ * into that thread, never by a same-chat top-level or different-thread send
46
+ * (the thread-binding guard, parel-reply-contract-alignment.md §5.2 — the
47
+ * server enforces the same match authoritatively).
48
+ */
49
+ export declare function resolveSourceDispatchBinding(ctx: RuntimeContext, chatId: string, threadRootId: string | undefined): {
50
+ source_type: string;
51
+ source_id: string;
52
+ } | null;
30
53
  /** Typed dispatch binding for a task write, derived from the turn context. */
31
54
  export type TypedDispatchBinding = {
32
55
  lane: string;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,6DAA6D;AAC7D,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oGAAoG;IACpG,OAAO,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAA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,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;CAAG;AAE9C;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,GACpB,mBAAmB,GAAG,IAAI,CA+E5B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAYzE;AAED,wBAAgB,kBAAkB,IAAI,mBAAmB,CA8BxD"}
@@ -15,6 +15,9 @@ export function resolveRuntimeContext() {
15
15
  let chatId = process.env.PRLL_CHAT_ID?.trim() || undefined;
16
16
  let triggerMessageId = process.env.PRLL_TRIGGER_MESSAGE_ID?.trim() || undefined;
17
17
  let noReply = process.env.PRLL_NO_REPLY === '1';
18
+ const dispatchSourceType = process.env.PRLL_DISPATCH_SOURCE_TYPE?.trim() || undefined;
19
+ const dispatchSourceId = process.env.PRLL_DISPATCH_SOURCE_ID?.trim() || undefined;
20
+ const threadRootId = process.env.PRLL_THREAD_ROOT_ID?.trim() || undefined;
18
21
  let dispatchEventId;
19
22
  let lane;
20
23
  let laneTargetUri;
@@ -60,8 +63,28 @@ export function resolveRuntimeContext() {
60
63
  lane,
61
64
  laneTargetUri,
62
65
  taskId,
66
+ dispatchSourceType,
67
+ dispatchSourceId,
68
+ threadRootId,
63
69
  };
64
70
  }
71
+ /**
72
+ * By-source dispatch binding for a message send (lane-less runtimes — parel).
73
+ * Returns the dispatch_source payload iff the send's (chat, thread) exactly
74
+ * matches the trigger's: a thread trigger is only resolved by a reply back
75
+ * into that thread, never by a same-chat top-level or different-thread send
76
+ * (the thread-binding guard, parel-reply-contract-alignment.md §5.2 — the
77
+ * server enforces the same match authoritatively).
78
+ */
79
+ export function resolveSourceDispatchBinding(ctx, chatId, threadRootId) {
80
+ if (!ctx.dispatchSourceType || !ctx.dispatchSourceId)
81
+ return null;
82
+ if (chatId !== ctx.chatId)
83
+ return null;
84
+ if ((threadRootId ?? '') !== (ctx.threadRootId ?? ''))
85
+ return null;
86
+ return { source_type: ctx.dispatchSourceType, source_id: ctx.dispatchSourceId };
87
+ }
65
88
  /**
66
89
  * Resolve the typed-lane binding for `parall task update <taskId>`: the
67
90
  * current turn must be a typed dispatch (lane target `dsp:<id>`) about this
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/cli",
3
- "version": "1.41.0",
3
+ "version": "1.42.0",
4
4
  "description": "CLI client for Parall — universal agent & human access to Parall API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,14 +36,14 @@
36
36
  "diff": "^8.0.3",
37
37
  "js-yaml": "^4.1.0",
38
38
  "zod": "^4.3.6",
39
- "@parall/agent-core": "1.41.0",
40
- "@parall/sdk": "1.41.0"
39
+ "@parall/agent-core": "1.42.0",
40
+ "@parall/sdk": "1.42.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/js-yaml": "^4.0.9",
44
44
  "@types/node": "^22.0.0",
45
45
  "typescript": "^5.7.0",
46
- "@parall/agent-core": "1.41.0"
46
+ "@parall/agent-core": "1.42.0"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsc",