@remits/remits-cli 0.1.91 → 0.1.92

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remits/remits-cli",
3
- "version": "0.1.91",
3
+ "version": "0.1.92",
4
4
  "description": "Local CLI for auth, component sync, and live test execution against Remits",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -1179,9 +1179,17 @@ the compile cache without colliding.
1179
1179
  That signature is logged. Querying for it is the single most reliable way to know what ran:
1180
1180
 
1181
1181
  ```bash
1182
- remits-cli tool --name mcp_system_logs --input '{"node":"remitsAdmin-east5","timeRange":"1h","filter":"textPayload:\"Using Cached BCD\""}' --data-mode prod
1182
+ remits-cli tool --name mcp_system_logs --input '{"node":"remitsAdmin-east5","timeRange":"1h","filter":"Using Cached BCD"}' --data-mode prod
1183
1183
  ```
1184
1184
 
1185
+ > **Pass the bare phrase — never hand-write a `textPayload:` filter.** In production the platform's
1186
+ > logback encoder writes every `log.*` line to **`jsonPayload.message`**; only `println`/stdout lands in
1187
+ > `textPayload`. A `textPayload:"..."` filter therefore matches **zero** rows for nearly every platform
1188
+ > log line, and zero rows is indistinguishable from "it never happened" — which has already caused a real
1189
+ > misdiagnosis. `mcp_system_logs` now widens a bare phrase (and any `textPayload:"..."` clause) to cover
1190
+ > both shapes, and echoes the executed filter back as `filterApplied`. A filter that names `jsonPayload`
1191
+ > explicitly is passed through untouched.
1192
+
1185
1193
  `Using Cached BCD [ID: 230, Type: Action, Signature: cli:08cc...]` → ran a **staged** override.
1186
1194
  `...Signature: variant:14:9f2c1a...]` → ran a **committed branch variant**.
1187
1195
  `...Signature: version:37:abc123def456]` → ran the **committed trunk** version.
@@ -1739,8 +1747,7 @@ Before starting an investigation outside the confirmed current repo:
1739
1747
  **Stuck / failed / recovered Event:**
1740
1748
 
1741
1749
  Do **not** open the Action source first. The platform records each attempt's delivery envelope (which
1742
- queue delivered it, which delivery attempt this was, which instance owned it, how long it was ever
1743
- allowed to run) and will classify the failure for you. From a Test or any component:
1750
+ queue delivered it, which delivery attempt this was, and how long it was ever allowed to run) and will classify the failure for you. From a Test or any component:
1744
1751
 
1745
1752
  ```groovy
1746
1753
  eventDiagnostics(18838)
@@ -2169,6 +2176,41 @@ Returned fields on the async/event start: `actionRunId`, `status:"running"`, `ex
2169
2176
  `threadGroupingId`, `componentSource`, `componentSignature`, and (event mode) `eventId`/`eventStatus`. The
2170
2177
  `status` poll adds `result` on completion, or `message`/`error` on failure.
2171
2178
 
2179
+ > **In event mode the EVENT is the source of truth, not the promise.** `status` is driven by the Event's
2180
+ > own state; the value the dispatch call returned is reported separately as `dispatchResult` and is **not**
2181
+ > the Action's result. Read `eventStatus` for the outcome.
2182
+
2183
+ #### Stopping a run — `controlAction:'interrupt'`
2184
+
2185
+ The tool counterpart of the **Interrupt** button on the admin Events page. Use it when an investigation
2186
+ turns up a run that is consuming resources and should not finish — the case this exists for is finding a
2187
+ `PROCESSING` event that has been running far too long.
2188
+
2189
+ ```bash
2190
+ # the usual path: you found the event in mcp_record_listing / mcp_object_activity
2191
+ remits-cli tool --name mcp_run_action --data-mode prod --input '{"controlAction":"interrupt","accountId":49,"eventId":19102,"reason":"runaway extraction, 45min"}'
2192
+
2193
+ # or stop a run you started yourself (executionMode:'event' only)
2194
+ remits-cli tool --name mcp_run_action --data-mode prod --input '{"controlAction":"interrupt","accountId":4,"actionRunId":"my-run-id"}'
2195
+ ```
2196
+
2197
+ Aliases `cancel` / `stop` / `kill` all work. What you need to know before using it:
2198
+
2199
+ - **It is COOPERATIVE cancellation, not a thread kill.** It sets a flag the running work observes at its
2200
+ next checkpoint, then throws. Checkpoints are dense across everything that matters — every Firestore
2201
+ read/write, outbound HTTP call, AI turn, and front-stage DSL call — so a normal run stops promptly. A
2202
+ run blocked inside a *single* long call (one slow AI turn) stops when that call returns, not instantly.
2203
+ - **Work already committed is NOT rolled back.** This stops further work; it does not undo what has run.
2204
+ - **Only `PENDING`/`QUEUED`/`PROCESSING` can be interrupted.** A terminal event is reported back with its
2205
+ status rather than being silently reported as "interrupted".
2206
+ - **Event-scoped.** A `direct` or `async` run has no Event and cannot be stopped this way.
2207
+ - Tenant-scoped: you cannot interrupt another account's event.
2208
+ - The response returns `previousStatus`, `eventStatus`, and `threadGroupingId`, so you can pivot straight
2209
+ into `mcp_performance_trace` / `mcp_system_logs` to see what it was doing when you stopped it.
2210
+
2211
+ **AI sessions are stopped separately** with `mcp_ai_session_search` (`action:'interrupt'`, plus
2212
+ `pause`/`unpause`) — that controls an agent's conversation loop, whereas this controls an Action's Event.
2213
+
2172
2214
  ### `mcp_run_agent`
2173
2215
  Run one real Agent turn on a target account. The Agent hooks and tools execute for real against the requested
2174
2216
  `dataMode`; pass `dataMode:"test"` for safer tuning.
@@ -2205,6 +2247,24 @@ remits-cli tool --name mcp_ai_session_search --input '{"action":"detail","sessio
2205
2247
  Key returned fields: `agentRunId`, `sessionId`, `status`, `threadGroupingId`, runtime pause/interruption
2206
2248
  hints, `lastAssistantMessage`, `toolCallCount`, `result`, `message`, and `error`.
2207
2249
 
2250
+ #### Controlling a live agent — `pause` / `unpause` / `interrupt`
2251
+
2252
+ ```bash
2253
+ remits-cli tool --name mcp_run_agent --data-mode prod --input '{"controlAction":"pause","accountId":49,"agentRunId":"my-run-id"}'
2254
+ remits-cli tool --name mcp_run_agent --data-mode prod --input '{"controlAction":"interrupt","accountId":49,"sessionId":"<sessionId>"}'
2255
+ ```
2256
+
2257
+ Target the session with the `agentRunId` an async start returned, or the `sessionId` directly.
2258
+
2259
+ - **`interrupt` is TERMINAL** (aliases `stop`/`cancel`/`kill`). It clears any pending resume and pending
2260
+ guardrails and persists a terminal lifecycle status. An interrupted session **cannot be unpaused** —
2261
+ attempting it is refused with that reason rather than silently doing nothing. Use `pause` if you intend
2262
+ to resume.
2263
+ - If the session is not resident on the serving node, it is rehydrated by agent name — so pass `agentName`
2264
+ (or an `agentRunId`, which carries it) when controlling a session you did not just start.
2265
+ - The same controls remain available on `mcp_ai_session_search`, which is the right tool when you are
2266
+ *searching* for the session; this is the right one when you *started* the run.
2267
+
2208
2268
  ### `mcp_system_logs`
2209
2269
  Query Cloud Run service logs.
2210
2270
 
@@ -2218,7 +2278,8 @@ Query Cloud Run service logs.
2218
2278
  | `endTime` | no | ISO 8601 upper bound (defaults to now) |
2219
2279
  | `severity` | no | Minimum: `INFO`, `WARNING`, `ERROR`, etc. |
2220
2280
  | `threadGroupingId` | no | Filter by processing chain ID |
2221
- | `filter` | no | Additional Cloud Logging filter (LQL) |
2281
+ | `filter` | no | Additional Cloud Logging filter (LQL). **To search message text, pass the bare phrase** — it is widened automatically to match both `jsonPayload.message` (all `log.*` output) and `textPayload` (`println`/stdout). See the warning under "Diagnosing which version is in play". |
2282
+ | `maxPreviewChars` | no | Per-entry truncation width. Default 512, max 8000. Raise it when an entry carries a structured payload (a serialized `RemitsTrace`, a long stack frame) that the default cuts mid-JSON. |
2222
2283
  | `pageSize` | no | Default 25, max 100. Also accepts `limit`. |
2223
2284
 
2224
2285
  *Provide either `node` or `serviceName`+`region`. Provide either `timeRange` or `startTime`.
@@ -2252,11 +2313,26 @@ remits-cli tool --name mcp_performance_trace --input '{"action":"snapshot","limi
2252
2313
  | `traceId` / `threadGroupingId` | for `trace` | Request/grouping id to open across local ring and Cloud Logging. |
2253
2314
  | `lookbackHours` | no | Cloud Logging window for `trace`/`slowest`. Defaults are 6 and 4 hours. |
2254
2315
  | `accountId` | no | Account filter for `slowest`. |
2255
- | `kind` | no | Operation kind filter for `slowest`, e.g. `embeddable`, `action`, `reader`. |
2316
+ | `kind` | no | Operation kind filter for `slowest`. **Rarely what you want** — see the note below. |
2317
+ | `componentType` | no | Filter `slowest` by the component that did the work: `Action`, `Reader`, `Rule`, `Embeddable`, `Tool`, `Test`. **This is the right axis for "which Actions/Rules are slow".** |
2318
+ | `componentId` / `componentName` | no | Narrow `slowest` to one component. |
2319
+
2320
+ > **Filter by `componentType`, not `kind`.** `kind` is set by whoever OPENS the trace. An Action delivered
2321
+ > by Cloud Tasks arrives over HTTP, so the trace is `kind:'web'` and the Action is a `component.Action`
2322
+ > *span inside it*; a Rule fired during a request and a Tool invoked by an agent are the same. So
2323
+ > `kind:'action'` matches almost nothing in production. Every component execution annotates
2324
+ > `componentType`/`componentId`/`componentName` — filter on those.
2256
2325
  | `minMs` | no | Minimum duration for `slowest`. Default: 1500. |
2257
2326
  | `limit` | no | Result limit. |
2258
2327
  | `format` / `markdown` | no | Set `format:"markdown"` or `markdown:true` for a rendered trace report. |
2259
2328
 
2329
+ > **Tools are components, so availability is per ACCOUNT.** `Tool not found: mcp_performance_trace` does
2330
+ > not mean the tool is broken or that tracing is off — it means that tool has not been synced to the
2331
+ > account you are resolving against. This bites most often on **localhost** (a Test Account that has not
2332
+ > pulled the System Account's tool set) and on **client accounts**. Run `remits-cli tools` for the account
2333
+ > in question, or re-run against an account that owns the tool (`--account-id 4` for the System Account).
2334
+ > The same is true of every `mcp_*` tool, including the component tools noted below.
2335
+
2260
2336
  Reading rule: first use `slowest` to get candidate trace ids, then call `trace` on the suspicious id, then use
2261
2337
  `mcp_system_logs` only if you need surrounding log lines. A trace dominated by `firestore.*`, `http.*`,
2262
2338
  `gorm.save.*`, or component spans points you at the relevant platform seam or front-stage component. Large
@@ -2367,6 +2443,34 @@ Execute a Test component.
2367
2443
  | `accountId` | yes | Account ID |
2368
2444
  | `testId` | yes | Test component ID |
2369
2445
  | `testNames` | no | Array of specific test case names |
2446
+ | `taskId` | no | Stable id for the run. **Declare your own if you may need to stop it** — see below. Echoed back either way. |
2447
+ | `controlAction` | no | `interrupt` (aliases `stop`/`cancel`/`kill`) stops a running suite identified by `taskId`. |
2448
+
2449
+ #### Stopping a running suite
2450
+
2451
+ A suite that loops dozens of cases — or sits in one slow AI/HTTP call — used to have to be waited out.
2452
+ It can now be stopped, from the admin test runner's **Stop** button or from here.
2453
+
2454
+ ```bash
2455
+ # declare the id when you start, so the run is addressable while it is still going
2456
+ remits-cli tool --name mcp_run_test --data-mode test --input '{"accountId":1,"testId":7,"taskId":"my-run"}'
2457
+
2458
+ # ...then from another call/session:
2459
+ remits-cli tool --name mcp_run_test --data-mode test --input '{"controlAction":"interrupt","accountId":1,"taskId":"my-run"}'
2460
+ ```
2461
+
2462
+ > **This tool runs the suite SYNCHRONOUSLY**, so you cannot stop a run you are yourself blocked on —
2463
+ > which is exactly why you declare `taskId` up front. Without one, a run gets a generated id you never see.
2464
+
2465
+ Semantics, same as everywhere else in the platform:
2466
+
2467
+ - **Cooperative.** The suite ends at its next checkpoint — between cases, or mid-case at any
2468
+ Firestore/HTTP/AI/DSL call. A case stuck in one long external call stops when that call returns.
2469
+ - **Cases already completed keep their results**, and committed work is **not** rolled back.
2470
+ - An interrupted run returns `interrupted: true` and its partial results. A stop is reported as
2471
+ **INTERRUPTED, never as a test failure** — so it can't be mistaken for a broken suite.
2472
+ - Keyed per RUN, not per Test: the same Test can be running concurrently (different users, branches, or
2473
+ data modes), and stopping one never stops another.
2370
2474
 
2371
2475
  ### `mcp_component_edit`
2372
2476
  Edit a component field, server-side, with stage or commit semantics. The agent counterpart to local file