@remits/remits-cli 0.1.133 → 0.1.136

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.
@@ -72,8 +72,8 @@ For long-running Action/Agent runners, use the tool's own async mode (`execution
72
72
  the `actionRunId`/`agentRunId` (and, for agents, `sessionId`) immediately:
73
73
 
74
74
  ```bash
75
- remits-cli tool --name "mcp_run_action" --input '{"accountId":37,"actionName":"Rebuild Invoice","executionMode":"async","actionInput":{"invoiceId":"abc"}}' --data-mode prod
76
- # poll by run id: {"controlAction":"status","accountId":37,"actionRunId":"<actionRunId>"}
75
+ remits-cli tool --account-id 21 --as-account 37 --target-account 37 --name mcp_run_action --input '{"actionName":"Rebuild Invoice","executionMode":"async","actionRunId":"my-stable-run-id","actionInput":{"invoiceId":"abc"}}' --data-mode prod
76
+ # poll by run id: --account-id 21 --as-account 37 --target-account 37 --input '{"controlAction":"status","actionRunId":"my-stable-run-id"}'
77
77
  ```
78
78
 
79
79
  For long tools that lack their own async mode, use the CLI transport async (`--async true`), optionally with
@@ -81,13 +81,24 @@ For long tools that lack their own async mode, use the CLI transport async (`--a
81
81
  (see `command-reference.md` → *Tool Execution Lifecycle*). Use `--timeout-ms <ms>` only to adjust the per-request client timeout; it is
82
82
  not a replacement for async mode on multi-minute workflows.
83
83
 
84
- **Account-id precedence for tool calls.** When the CLI and the tool input both carry an account id, the server resolves them in this order:
84
+ **Account roles for tool calls.** Keep the repo/scope account separate from the account whose data/runtime the
85
+ tool exercises:
85
86
 
86
- 1. Explicit `--account-id <ID>` flag — always wins. Use this when you want to be certain the tool runs against a specific account (and the user's session covers it).
87
- 2. `input.accountId` (or `input.account_id`) — the tool's per-call execution target.
88
- 3. The current repo's `account-info.json` / active session — the default fallback.
87
+ 1. `--account-id <ID>` is the repo/scope account that bounds discovery and verification.
88
+ 2. `--as-account <ID>` is the execution account, matching `test run --as-account`.
89
+ 3. `--target-account <ID>` is the tool/data target when the tool operates on a specific account but should not
90
+ change component resolution. It is sent as `input.accountId` and `input.targetAccountId` when `--input`
91
+ omits them — `input.accountId` is the key `mcp_run_action` and friends actually read, and without it they
92
+ fall back to the run scope.
89
93
 
90
- So from inside a parent account's repo you can target a child account just by setting `input.accountId`, or force it with `--account-id` if you need it to override whatever the tool input says. Verify with the `accountId` field in the response envelope.
94
+ A target does not move the run: pass `--as-account` too whenever the work should resolve as that account's
95
+ components, branch subscription and staging lane.
96
+
97
+ Legacy `input.accountId` (or `input.account_id`) is still accepted as an explicit target for older snippets,
98
+ but prefer flags for new work; the CLI warns on stderr and in `warnings[]` when it is used alone. The
99
+ response `world` block is the source of truth: check `repoAccountId`, `executionAccountId`,
100
+ `targetAccountId`, `componentBranch`, `workspace`, and `dataMode`. `world.accountId` is the execution
101
+ account.
91
102
 
92
103
  ### `mcp_account_view`
93
104
  Returns complete account structure — schemas, components, relationships.
@@ -414,7 +425,7 @@ staged-vs-DB provenance in the result.
414
425
  Describe the Action first when the input shape is not obvious. This does not execute the Action:
415
426
 
416
427
  ```bash
417
- remits-cli tool --name mcp_run_action --input '{"controlAction":"describe","accountId":743,"actionId":25,"includeInputSchema":true}' --data-mode prod
428
+ remits-cli tool --account-id 21 --as-account 49 --target-account 49 --name mcp_run_action --input '{"controlAction":"describe","actionId":25,"includeInputSchema":true}' --data-mode prod
418
429
  ```
419
430
 
420
431
  The describe response reports `hasInputSchema`, optional `inputSchema`, `inferredInputKeys`, and component
@@ -423,7 +434,7 @@ provenance. If `hasInputSchema:false`, treat `inferredInputKeys` as a best-effor
423
434
  Use direct mode only for quick Actions:
424
435
 
425
436
  ```bash
426
- remits-cli tool --name mcp_run_action --input '{"accountId":49,"actionId":200,"executionMode":"direct","actionInput":{"sourceDocumentId":"..."}}' --data-mode prod
437
+ remits-cli tool --account-id 21 --as-account 49 --target-account 49 --name mcp_run_action --input '{"actionId":200,"executionMode":"direct","actionInput":{"sourceDocumentId":"..."}}' --data-mode prod
427
438
  ```
428
439
 
429
440
  Use the tool's own async mode for long-running Action execution — it returns immediately with an
@@ -432,14 +443,14 @@ of the start response. Do **not** also pass the CLI `--async` flag; that only bu
432
443
  transport layer:
433
444
 
434
445
  ```bash
435
- remits-cli tool --name mcp_run_action --input '{"accountId":49,"actionId":200,"executionMode":"async","actionRunId":"my-stable-run-id","actionInput":{"sourceDocumentId":"..."}}' --data-mode prod
446
+ remits-cli tool --account-id 21 --as-account 49 --target-account 49 --name mcp_run_action --input '{"actionId":200,"executionMode":"async","actionRunId":"my-stable-run-id","actionInput":{"sourceDocumentId":"..."}}' --data-mode prod
436
447
  ```
437
448
 
438
449
  Then poll that run with another **regular tool call** carrying `controlAction:"status"` and the same
439
- `accountId` + `actionRunId`:
450
+ explicit account flags + `actionRunId`:
440
451
 
441
452
  ```bash
442
- remits-cli tool --name mcp_run_action --input '{"controlAction":"status","accountId":49,"actionRunId":"my-stable-run-id"}' --data-mode prod
453
+ remits-cli tool --account-id 21 --as-account 49 --target-account 49 --name mcp_run_action --input '{"controlAction":"status","actionRunId":"my-stable-run-id"}' --data-mode prod
443
454
  ```
444
455
 
445
456
  > This poll is a normal `remits-cli tool --name mcp_run_action` call — **not** `remits-cli tool status`,
@@ -448,12 +459,17 @@ remits-cli tool --name mcp_run_action --input '{"controlAction":"status","accoun
448
459
  > If you started the run with a different `userId`, include that same `userId` in the poll (the run's status
449
460
  > is keyed by account + user + `actionRunId`; it otherwise defaults to the current user).
450
461
 
462
+ `input.accountId` is still accepted by older tool implementations and legacy snippets, but it is no longer
463
+ the recommended way to describe cross-account work. Prefer `--account-id` for the repo/scope account and
464
+ `--as-account`/`--target-account` for the Action's execution/data account so verification packets and
465
+ `activity inspect --scope related` can report the split world without guessing.
466
+
451
467
  For job-style Actions only (`Action.job == true`), prefer `executionMode:"event"` when you want the durable
452
468
  Event lifecycle, Event status, and platform recovery behavior. Event mode is inherently async; poll it the
453
469
  same way (`controlAction:"status"` + `actionRunId`) — the status resolves the backing Event's terminal state:
454
470
 
455
471
  ```bash
456
- remits-cli tool --name mcp_run_action --input '{"accountId":49,"actionId":200,"executionMode":"event","actionRunId":"my-stable-run-id","actionInput":{}}' --data-mode prod
472
+ remits-cli tool --account-id 21 --as-account 49 --target-account 49 --name mcp_run_action --input '{"actionId":200,"executionMode":"event","actionRunId":"my-stable-run-id","actionInput":{}}' --data-mode prod
457
473
  ```
458
474
 
459
475
  Returned fields on the async/event start: `actionRunId`, `status:"running"`, `executionMode`,
@@ -482,10 +498,10 @@ turns up a run that is consuming resources and should not finish — the case th
482
498
 
483
499
  ```bash
484
500
  # the usual path: you found the event in mcp_record_listing / mcp_object_activity
485
- remits-cli tool --name mcp_run_action --data-mode prod --input '{"controlAction":"interrupt","accountId":49,"eventId":19102,"reason":"runaway extraction, 45min"}'
501
+ remits-cli tool --account-id 21 --as-account 49 --target-account 49 --name mcp_run_action --data-mode prod --input '{"controlAction":"interrupt","eventId":19102,"reason":"runaway extraction, 45min"}'
486
502
 
487
503
  # or stop a run you started yourself (executionMode:'event' only)
488
- remits-cli tool --name mcp_run_action --data-mode prod --input '{"controlAction":"interrupt","accountId":4,"actionRunId":"my-run-id"}'
504
+ remits-cli tool --account-id 21 --as-account 49 --target-account 49 --name mcp_run_action --data-mode prod --input '{"controlAction":"interrupt","actionRunId":"my-run-id"}'
489
505
  ```
490
506
 
491
507
  Aliases `cancel` / `stop` / `kill` all work. What you need to know before using it: