@enderfga/claw-orchestrator 4.14.0 → 5.0.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.
Files changed (37) hide show
  1. package/README.md +3 -3
  2. package/dist/src/base-oneshot-session.d.ts +10 -1
  3. package/dist/src/base-oneshot-session.js +13 -1
  4. package/dist/src/base-oneshot-session.js.map +1 -1
  5. package/dist/src/embedded-server.js +1 -0
  6. package/dist/src/embedded-server.js.map +1 -1
  7. package/dist/src/models.js +65 -14
  8. package/dist/src/models.js.map +1 -1
  9. package/dist/src/persistent-agy-session.d.ts +1 -1
  10. package/dist/src/persistent-agy-session.js +53 -10
  11. package/dist/src/persistent-agy-session.js.map +1 -1
  12. package/dist/src/persistent-codex-app-session.js +11 -1
  13. package/dist/src/persistent-codex-app-session.js.map +1 -1
  14. package/dist/src/persistent-codex-session.js +7 -2
  15. package/dist/src/persistent-codex-session.js.map +1 -1
  16. package/dist/src/persistent-cursor-session.js +5 -2
  17. package/dist/src/persistent-cursor-session.js.map +1 -1
  18. package/dist/src/persistent-custom-session.js +15 -1
  19. package/dist/src/persistent-custom-session.js.map +1 -1
  20. package/dist/src/persistent-gemini-session.js +5 -1
  21. package/dist/src/persistent-gemini-session.js.map +1 -1
  22. package/dist/src/persistent-opencode-session.js +8 -3
  23. package/dist/src/persistent-opencode-session.js.map +1 -1
  24. package/dist/src/persistent-session.d.ts +1 -0
  25. package/dist/src/persistent-session.js +9 -0
  26. package/dist/src/persistent-session.js.map +1 -1
  27. package/dist/src/run-ledger.js +4 -1
  28. package/dist/src/run-ledger.js.map +1 -1
  29. package/dist/src/session-manager.d.ts +1 -0
  30. package/dist/src/session-manager.js +26 -2
  31. package/dist/src/session-manager.js.map +1 -1
  32. package/dist/src/types.d.ts +34 -4
  33. package/package.json +1 -1
  34. package/skills/references/multi-engine.md +29 -8
  35. package/skills/references/observability.md +2 -2
  36. package/skills/references/openai-compat.md +7 -1
  37. package/skills/references/sessions.md +23 -0
@@ -43,8 +43,8 @@ every engine passes through.
43
43
  | `tokensEstimated` | `true` when the counts came from `estimateTokens()` (see below) |
44
44
  | `durationMs` | Wall-clock for the turn |
45
45
  | `toolCalls` / `toolErrors` | Per-turn deltas |
46
- | `ok` | `false` for a turn that threw or reported `is_error` |
47
- | `error` | Failure text, truncated to 500 chars |
46
+ | `ok` | `false` for a turn that threw, or that the session's own `turnsSucceeded` counter did not count (see `sessions.md`). Falls back to "nothing was thrown" when the counter cannot be read |
47
+ | `error` | Failure text, truncated to 500 chars. Absent when the turn resolved but the engine did not count it as succeeded (an interrupted or non-SUCCESS turn), so a failed row does not always carry one |
48
48
  | `parent` | council id / fanout id / autoloop run id, when the turn belongs to one |
49
49
 
50
50
  Deltas rather than totals means summing a query window gives that window's spend
@@ -148,7 +148,8 @@ Sample response:
148
148
  "model": "claude-opus-4-6",
149
149
  "cwd": "/home/user/projects",
150
150
  "created": "2026-04-09T03:12:18.441Z",
151
- "turns": 14,
151
+ "turns": 68,
152
+ "turns_succeeded": 14,
152
153
  "tokens_in": 248312,
153
154
  "tokens_out": 38201,
154
155
  "cached_tokens": 198104,
@@ -159,6 +160,11 @@ Sample response:
159
160
  }
160
161
  ```
161
162
 
163
+ `turns_succeeded` is one per request; `turns` is not comparable to it on these
164
+ sessions — the Claude CLI emits a `user` event per tool-result batch and `turns`
165
+ counts those, so the gap above is tool use, not failures. Compare
166
+ `turns_succeeded` against your own request count.
167
+
162
168
  The single most important field is **`cached_tokens`**. If it grows turn-over-turn, the persistent CLI is being reused and Anthropic prompt caching is warming. If it stays at 0, something is killing the session every turn — check that no client is sending `X-Session-Reset` unintentionally and that `OPENAI_COMPAT_NEW_CONVO_HEURISTIC` is not set when it shouldn't be.
163
169
 
164
170
  ## Smoke tests
@@ -138,6 +138,29 @@ tokens the session has been billed for in total, which only ever grows.
138
138
  (`codex`, `agy`, `cursor`, `opencode`); those sessions log a warning the first
139
139
  time it is called.
140
140
 
141
+ `stats.turns` and `stats.turnsSucceeded` are the same kind of distinction.
142
+ `turns` counts turns that reached the engine, whatever their outcome, including
143
+ the ones that then failed. `turnsSucceeded` counts only the ones the engine
144
+ reported as successful, and it is one per send on every engine.
145
+
146
+ **The two are only comparable on the one-shot engines.** There `turns` is also
147
+ one per send, so the difference between them is the failure count. On `claude`
148
+ and a persistent `custom`, `turns` counts `user` events — and the CLI emits one
149
+ per tool-result batch as well as the prompt echo, so a send that used eight tools
150
+ counts nine. Compare `turnsSucceeded` against the number of sends there, never
151
+ against `turns`.
152
+
153
+ Which outcome counts as a success is the engine's own verdict, not the exit
154
+ code's: `codex` fails a turn that emits `turn.failed` while exiting 0, `agy`
155
+ requires a `SUCCESS` status *and* a zero exit (it can report success and then die
156
+ in cleanup), `gemini` succeeds on exit 53 because its turn limit resolves,
157
+ `codex-app` requires `status: 'completed'` so a turn cancelled through
158
+ `interrupt()` does not count, and `opencode` refuses a turn on purpose when
159
+ read-only enforcement did not load.
160
+
161
+ The run ledger's `ok` reads this same counter, so a turn cannot be a failure on
162
+ `/v1/sessions` and a success in `clawo runs`.
163
+
141
164
  ### Cost Tracking
142
165
 
143
166
  ```typescript