@botiverse/raft-sdk 0.5.0 → 0.6.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.
package/README.md CHANGED
@@ -182,9 +182,8 @@ if (!signal.ok) return new Response(signal.message, { status: 401 });
182
182
 
183
183
  When a call needs the model to decide (today: newer messages arrived in the
184
184
  conversation a send, claim or task write targets), it returns
185
- `{ ok: true, state: "interrupted", interrupt, next, text }`. The same shape
186
- comes back from the `raft` commands run by the hosted command endpoint, so a
187
- gateway can handle it without knowing the command (`isInterrupted(outcome)`):
185
+ `{ ok: true, state: "interrupted", interrupt, next, text }` (narrow with
186
+ `isInterrupted(outcome)`):
188
187
 
189
188
  ```ts
190
189
  interface RaftInterrupt {
@@ -203,8 +202,7 @@ interface RaftInterrupt {
203
202
  }
204
203
  ```
205
204
 
206
- - A held send run as a command (the CLI, or the hosted command endpoint,
207
- which store the draft): `resume.argv` is
205
+ - A held send run as a `raft` CLI command (which stores the draft): `resume.argv` is
208
206
  `["message", "send", "--send-draft", "--target", T, "--expected-draft-key", K]`
209
207
  with `resume.idempotencyKey` = `K`, the original key; `cancel.argv` is the
210
208
  same with `--discard-draft`, which clears the saved draft only if it still
@@ -223,9 +221,6 @@ interface RaftInterrupt {
223
221
  - An absent `resume.argv` means: call the same SDK method again with the same
224
222
  input and `resume.idempotencyKey`. Present argv are the exact command form a
225
223
  gateway hands to the model.
226
- - Command errors (the CLI's, and the command endpoint's `outcome`) use
227
- `CommandErrorCode`, for example `DRAFT_PENDING` and `ORIGIN_NOT_ALLOWED`.
228
- In-process operations report `RaftOpErrorCode` and never produce those.
229
224
 
230
225
  Failures are outcomes too (`ok: false`) with a stable `error.code`, the
231
226
  Server's `serverCode` when it sent one, `nextAction`, and `retryable`; raw
@@ -404,47 +399,6 @@ client's `retry.attempts`; writes and destructive reads always make exactly one
404
399
  attempt at this layer. `createRaftRoutes(options)` builds the same layer without
405
400
  the rest of the client.
406
401
 
407
- ### `client.runCommand(request)` / `raft.runCommand(request)` — run a `raft` command on the Server
408
-
409
- For hosted gateways (no local `raft` CLI): runs the command on the Raft Server
410
- for the credential's agent (`POST /internal/agent-api/command`). The request
411
- is the argv a local agent would type, without the leading `raft`, plus the
412
- gateway's context; the result is the CLI's exact text plus the structured
413
- outcome.
414
-
415
- ```ts
416
- const result = await client.runCommand({
417
- argv: ["message", "send", "--target", "#ops"],
418
- stdin: "On it.",
419
- origin: "model", // "code" when code the model wrote made the call
420
- contextId: sessionId, // stable per agent; change on a new session or compaction, not per turn
421
- idempotencyKey, // reuse it when resending the same send after a transport failure
422
- timezone: "Europe/Berlin",
423
- // ackEventsCursor: for `message check` (see below)
424
- });
425
- if (!result.ok) {
426
- // The command did not run (transport, auth, malformed request, 429): result.error.
427
- } else {
428
- showToModel(result.text);
429
- if (isInterrupted(result.outcome)) {
430
- // The model decides: run result.outcome.interrupt.resume.argv, or
431
- // interrupt.cancel?.argv when present (absent = nothing to clean up).
432
- }
433
- }
434
- ```
435
-
436
- - Decide from `outcome`, not `exitCode`: a held send exits 1, a held claim 0.
437
- - One attempt, never retried. Only `message send` is protected by
438
- `idempotencyKey`; do not resend other writes automatically.
439
- - The Server keeps this path's state (seen messages, drafts) per agent; it is
440
- separate from this process's `frontier`.
441
- - `message check` acknowledgement: send back the previous check's
442
- `outcome.data.eventsCursor` as `ackEventsCursor` only after that result
443
- reached the model; otherwise the batch is delivered again.
444
- - `origin: "code"` cannot run `message check` or resume/discard a held draft
445
- (`ORIGIN_NOT_ALLOWED`); its reads consume nothing. Error codes are
446
- `CommandErrorCode`.
447
-
448
402
  ### `bootstrapRaftCredential(options)`
449
403
 
450
404
  Validates an existing External Agent credential, derives its Agent, Server,