@parall/cli 1.52.0 → 1.52.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.
@@ -1,3 +1,33 @@
1
1
  import type { Command } from 'commander';
2
+ /**
3
+ * Message ↔ session/step attribution for a send. Lane context WINS over the
4
+ * process-level runtime context: the lane file is written per dispatch (a
5
+ * fork turn carries its child ase_/step), while PRLL_CONTEXT_FILE on
6
+ * single-process runtimes (codex app-server) is pinned to the MAIN session
7
+ * for the process's whole life — letting it win stamps fork replies and
8
+ * their dispatch rows with main's session. Runtime context only fills what
9
+ * the lane context does not provide.
10
+ *
11
+ * session and step are resolved as a PAIR, never independently: the server
12
+ * validates agent_step_id first and derives agent_session_id FROM that step,
13
+ * ignoring the supplied session whenever the step is valid (its check is
14
+ * chat-level, so a main-session step passes for a same-chat fork); when the
15
+ * step is stale it falls back to the supplied session instead. Either half
16
+ * can therefore decide the attribution, so a pair mixed from two sources has
17
+ * no single correct reading. The lane file writes session_id and step_id
18
+ * independently and may carry either alone — so once the lane supplies ANY
19
+ * attribution it owns both fields, and the runtime fills a gap only when it
20
+ * demonstrably describes the same session the lane names.
21
+ */
22
+ export declare function resolveSendAttribution(ctx: {
23
+ sessionId?: string;
24
+ stepId?: string;
25
+ }, laneCtx: {
26
+ sessionId?: string;
27
+ stepId?: string;
28
+ } | null): {
29
+ sessionId?: string;
30
+ stepId?: string;
31
+ };
2
32
  export declare function registerMessageCommands(program: Command): void;
3
33
  //# sourceMappingURL=messages.d.ts.map
@@ -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;AAmBzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QAsPvD"}
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;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAC5C,OAAO,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GACtD;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CASzC;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QAoPvD"}
@@ -4,6 +4,36 @@ import { LaneContextError, markLaneReplyCommitted, resolveCredentials, resolveLa
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';
7
+ /**
8
+ * Message ↔ session/step attribution for a send. Lane context WINS over the
9
+ * process-level runtime context: the lane file is written per dispatch (a
10
+ * fork turn carries its child ase_/step), while PRLL_CONTEXT_FILE on
11
+ * single-process runtimes (codex app-server) is pinned to the MAIN session
12
+ * for the process's whole life — letting it win stamps fork replies and
13
+ * their dispatch rows with main's session. Runtime context only fills what
14
+ * the lane context does not provide.
15
+ *
16
+ * session and step are resolved as a PAIR, never independently: the server
17
+ * validates agent_step_id first and derives agent_session_id FROM that step,
18
+ * ignoring the supplied session whenever the step is valid (its check is
19
+ * chat-level, so a main-session step passes for a same-chat fork); when the
20
+ * step is stale it falls back to the supplied session instead. Either half
21
+ * can therefore decide the attribution, so a pair mixed from two sources has
22
+ * no single correct reading. The lane file writes session_id and step_id
23
+ * independently and may carry either alone — so once the lane supplies ANY
24
+ * attribution it owns both fields, and the runtime fills a gap only when it
25
+ * demonstrably describes the same session the lane names.
26
+ */
27
+ export function resolveSendAttribution(ctx, laneCtx) {
28
+ if (!laneCtx?.sessionId && !laneCtx?.stepId) {
29
+ return { sessionId: ctx.sessionId, stepId: ctx.stepId };
30
+ }
31
+ const sameSession = laneCtx.sessionId !== undefined && laneCtx.sessionId === ctx.sessionId;
32
+ return {
33
+ sessionId: laneCtx.sessionId,
34
+ stepId: laneCtx.stepId ?? (sameSession ? ctx.stepId : undefined),
35
+ };
36
+ }
7
37
  export function registerMessageCommands(program) {
8
38
  const messages = program.command('messages').description('Manage messages');
9
39
  messages
@@ -129,10 +159,6 @@ export function registerMessageCommands(program) {
129
159
  req.thread_root_id = threadRootId;
130
160
  if (opts.reply === false)
131
161
  req.hints = { no_reply: true };
132
- if (ctx.stepId)
133
- req.agent_step_id = ctx.stepId;
134
- if (ctx.sessionId)
135
- req.agent_session_id = ctx.sessionId;
136
162
  // Dispatch lane binding (PRLL_CONTEXT_DIR contract): a send whose
137
163
  // exact (chat, thread) target has an active lane context rides the
138
164
  // server's dispatch ledger — the lane token authorizes the write,
@@ -143,6 +169,11 @@ export function registerMessageCommands(program) {
143
169
  // per-invocation idempotency key. All of this stays out of the
144
170
  // model's view.
145
171
  const laneCtx = resolveLaneDispatchContext(chatId, threadRootId);
172
+ const attribution = resolveSendAttribution(ctx, laneCtx);
173
+ if (attribution.stepId)
174
+ req.agent_step_id = attribution.stepId;
175
+ if (attribution.sessionId)
176
+ req.agent_session_id = attribution.sessionId;
146
177
  let usedReplyKey = false;
147
178
  if (laneCtx) {
148
179
  req.dispatch_lane = laneCtx.lane;
@@ -153,10 +184,6 @@ export function registerMessageCommands(program) {
153
184
  else {
154
185
  req.idempotency_key = `cli:${randomUUID()}`;
155
186
  }
156
- if (!req.agent_step_id && laneCtx.stepId)
157
- req.agent_step_id = laneCtx.stepId;
158
- if (!req.agent_session_id && laneCtx.sessionId)
159
- req.agent_session_id = laneCtx.sessionId;
160
187
  }
161
188
  else {
162
189
  // By-source dispatch binding (parel — PRLL_DISPATCH_SOURCE_* env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/cli",
3
- "version": "1.52.0",
3
+ "version": "1.52.1",
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/sdk": "1.52.0",
40
- "@parall/agent-core": "1.52.0"
39
+ "@parall/sdk": "1.52.1",
40
+ "@parall/agent-core": "1.52.1"
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.52.0"
46
+ "@parall/agent-core": "1.52.1"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsc",