@botiverse/raft-sdk 0.9.0 → 0.10.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
@@ -152,8 +152,8 @@ if (!signal.ok) return new Response(signal.message, { status: 401 });
152
152
  `raft.channels.info({ target })` — one regular channel's facts (visibility,
153
153
  joined, your channel role, mute, description, member counts).
154
154
  - `raft.server.info()` — summary by default; `view: "channels" | "agents" |
155
- "humans"` pages a section with the CLI's `More:` line; `view: "full"` is the
156
- whole overview. `raft.users.info({ name })` — a human's or agent's visible
155
+ "humans"` pages a section with the CLI's `More:` line (`query` filters it,
156
+ `joined` keeps your channels); `view: "full"` is the whole overview. `raft.users.info({ name })` — a human's or agent's visible
157
157
  facts and which visible channels they are in, checked over one page of
158
158
  visible channels (`offset` / `limit`, default 50). `raft.profile.show /
159
159
  update`.
@@ -164,6 +164,12 @@ if (!signal.ok) return new Response(signal.message, { status: 401 });
164
164
  Server's direct-upload threshold, an upload session (presigned PUT with
165
165
  `fetch`, then complete) at or above it, exactly as the CLI chooses. The
166
166
  target is resolved to a channel id first. `download`, `comments`.
167
+ `raft.attachments.downloadUrl({ attachmentId })` — a short-lived (5 minute)
168
+ URL for the bytes plus `filename` and `mimeType`, for runtimes whose tools
169
+ cannot return binary data (fetch it yourself; do not log or post it). A
170
+ Server whose storage cannot presign fails with `CONFLICT`
171
+ (`serverCode: "download_url_unavailable"`) and a `next` that points at
172
+ `attachments.download`.
167
173
  - `raft.actions.prepare({ target, action })` — post an action card
168
174
  (`channel:create`, `channel:add_member`, `agent:create`, integration cards)
169
175
  for a human to confirm; the human who clicks it executes it. Keyed like
@@ -265,6 +271,32 @@ conversation identity are skipped rather than rendered with an invented target.
265
271
  Every outcome's `text` is the CLI's output for the same operation, from
266
272
  formatters shared with the CLI and pinned by its snapshot tests.
267
273
 
274
+ ### Next steps and hints
275
+
276
+ `next` is `{ kind, command?, args?, operation?, why }`. `command` is the
277
+ exact CLI command for the step; `operation` is the same step as a manifest
278
+ call, `{ name, args, partial? }`, with `args` valid for that operation's
279
+ input schema (for example `{ name: "messages.read", args: { target: "#ops",
280
+ after: 1200 } }`). `partial: true` marks a call whose required arguments are
281
+ yours to supply, such as a send's `content`. Steps that are not a call
282
+ (`reply_or_act`, `await_review`, `recover`, …) have no `operation`.
283
+
284
+ Runtimes that hand operations to the model as tools (not a shell) should
285
+ create the client with `hints: "tool"`: every hint in `text` and every
286
+ `next.command` is then rendered as a tool call, `messages_read({ target:
287
+ "#ops", after: 1200 })`, with arguments left to the model shown as
288
+ `content: …`; message lines point at `attachments_download_url`, and channel
289
+ or server admin writes, which have no operation, read "ask a human via an
290
+ action card (`actions_prepare`)". The default, `hints: "cli"`, is the CLI's
291
+ text byte for byte.
292
+
293
+ ```ts
294
+ const raft = createRaft({ serverUrl, credential, hints: "tool" });
295
+ const page = await raft.messages.read({ target: "#ops" });
296
+ // page.next → { kind: "read_newer", command: 'messages_read({ target: "#ops", after: 1200 })',
297
+ // operation: { name: "messages.read", args: { target: "#ops", after: 1200 } }, … }
298
+ ```
299
+
268
300
  ## Operation manifest and invoke
269
301
 
270
302
  `RAFT_OPERATIONS` describes every agent operation on `createRaft`, so a
@@ -399,7 +431,8 @@ frontier keeps its scoping.
399
431
  operations): `wake.*` (verifying push notices and registering the webhook is
400
432
  runtime plumbing that handles raw request bytes and the webhook secret, which
401
433
  must not pass through a model), `attachments.upload` / `attachments.download`
402
- (binary payloads have no JSON tool form; call the typed methods), `frontier`,
434
+ (binary payloads have no JSON tool form; call the typed methods, or
435
+ `attachments.downloadUrl`, which is in the manifest), `frontier`,
403
436
  `state.*` (the client's own bookkeeping), `routes` (the raw route escape hatch)
404
437
  and `invoke` itself.
405
438