@b3os/sdk 0.2.1 → 0.2.2
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/dist/cjs/core/util.d.ts +1 -1
- package/dist/cjs/core/util.js +1 -1
- package/dist/cjs/generated/client.d.ts +13 -0
- package/dist/cjs/generated/client.js +25 -0
- package/dist/cjs/generated/client.js.map +1 -1
- package/dist/cjs/generated/errors.d.ts +1 -1
- package/dist/cjs/generated/errors.js +75 -0
- package/dist/cjs/generated/errors.js.map +1 -1
- package/dist/cjs/generated/ids.d.ts +61 -0
- package/dist/cjs/generated/ids.js +15 -0
- package/dist/cjs/generated/ids.js.map +1 -1
- package/dist/cjs/generated/jobs.js +4 -0
- package/dist/cjs/generated/jobs.js.map +1 -1
- package/dist/cjs/generated/ns/actions.d.ts +267 -33
- package/dist/cjs/generated/ns/actions.js +375 -33
- package/dist/cjs/generated/ns/actions.js.map +1 -1
- package/dist/cjs/generated/ns/agents.d.ts +229 -0
- package/dist/cjs/generated/ns/agents.js +402 -0
- package/dist/cjs/generated/ns/agents.js.map +1 -0
- package/dist/cjs/generated/ns/images.d.ts +81 -0
- package/dist/cjs/generated/ns/images.js +122 -0
- package/dist/cjs/generated/ns/images.js.map +1 -0
- package/dist/cjs/generated/ns/infer.d.ts +71 -3
- package/dist/cjs/generated/ns/infer.js +98 -3
- package/dist/cjs/generated/ns/infer.js.map +1 -1
- package/dist/cjs/generated/ns/keys.d.ts +3 -1
- package/dist/cjs/generated/ns/keys.js +3 -1
- package/dist/cjs/generated/ns/keys.js.map +1 -1
- package/dist/cjs/generated/ns/listeners.d.ts +159 -0
- package/dist/cjs/generated/ns/listeners.js +264 -0
- package/dist/cjs/generated/ns/listeners.js.map +1 -0
- package/dist/cjs/generated/ns/orgs.d.ts +10 -0
- package/dist/cjs/generated/ns/orgs.js +26 -1
- package/dist/cjs/generated/ns/orgs.js.map +1 -1
- package/dist/cjs/generated/ns/projects.d.ts +32 -0
- package/dist/cjs/generated/ns/projects.js +66 -0
- package/dist/cjs/generated/ns/projects.js.map +1 -1
- package/dist/cjs/generated/ns/render.d.ts +192 -21
- package/dist/cjs/generated/ns/render.js +267 -24
- package/dist/cjs/generated/ns/render.js.map +1 -1
- package/dist/cjs/generated/ns/requests.d.ts +3 -1
- package/dist/cjs/generated/ns/requests.js +3 -1
- package/dist/cjs/generated/ns/requests.js.map +1 -1
- package/dist/cjs/generated/ns/routines.d.ts +11 -4
- package/dist/cjs/generated/ns/routines.js +11 -4
- package/dist/cjs/generated/ns/routines.js.map +1 -1
- package/dist/cjs/generated/ns/sandboxes.d.ts +292 -7
- package/dist/cjs/generated/ns/sandboxes.js +444 -6
- package/dist/cjs/generated/ns/sandboxes.js.map +1 -1
- package/dist/cjs/generated/ns/usage.d.ts +1 -1
- package/dist/cjs/generated/ns/usage.js +1 -1
- package/dist/cjs/generated/ns/vision.d.ts +59 -17
- package/dist/cjs/generated/ns/vision.js +59 -21
- package/dist/cjs/generated/ns/vision.js.map +1 -1
- package/dist/cjs/generated/types.d.ts +2564 -68
- package/dist/cjs/helpers/sandboxes.d.ts +20 -1
- package/dist/cjs/helpers/sandboxes.js +13 -1
- package/dist/cjs/helpers/sandboxes.js.map +1 -1
- package/dist/esm/core/util.d.ts +1 -1
- package/dist/esm/core/util.js +1 -1
- package/dist/esm/generated/client.d.ts +13 -0
- package/dist/esm/generated/client.js +25 -0
- package/dist/esm/generated/client.js.map +1 -1
- package/dist/esm/generated/errors.d.ts +1 -1
- package/dist/esm/generated/errors.js +75 -0
- package/dist/esm/generated/errors.js.map +1 -1
- package/dist/esm/generated/ids.d.ts +61 -0
- package/dist/esm/generated/ids.js +15 -0
- package/dist/esm/generated/ids.js.map +1 -1
- package/dist/esm/generated/jobs.js +4 -0
- package/dist/esm/generated/jobs.js.map +1 -1
- package/dist/esm/generated/ns/actions.d.ts +267 -33
- package/dist/esm/generated/ns/actions.js +375 -33
- package/dist/esm/generated/ns/actions.js.map +1 -1
- package/dist/esm/generated/ns/agents.d.ts +229 -0
- package/dist/esm/generated/ns/agents.js +398 -0
- package/dist/esm/generated/ns/agents.js.map +1 -0
- package/dist/esm/generated/ns/images.d.ts +81 -0
- package/dist/esm/generated/ns/images.js +118 -0
- package/dist/esm/generated/ns/images.js.map +1 -0
- package/dist/esm/generated/ns/infer.d.ts +71 -3
- package/dist/esm/generated/ns/infer.js +98 -3
- package/dist/esm/generated/ns/infer.js.map +1 -1
- package/dist/esm/generated/ns/keys.d.ts +3 -1
- package/dist/esm/generated/ns/keys.js +3 -1
- package/dist/esm/generated/ns/keys.js.map +1 -1
- package/dist/esm/generated/ns/listeners.d.ts +159 -0
- package/dist/esm/generated/ns/listeners.js +260 -0
- package/dist/esm/generated/ns/listeners.js.map +1 -0
- package/dist/esm/generated/ns/orgs.d.ts +10 -0
- package/dist/esm/generated/ns/orgs.js +26 -1
- package/dist/esm/generated/ns/orgs.js.map +1 -1
- package/dist/esm/generated/ns/projects.d.ts +32 -0
- package/dist/esm/generated/ns/projects.js +66 -0
- package/dist/esm/generated/ns/projects.js.map +1 -1
- package/dist/esm/generated/ns/render.d.ts +192 -21
- package/dist/esm/generated/ns/render.js +267 -24
- package/dist/esm/generated/ns/render.js.map +1 -1
- package/dist/esm/generated/ns/requests.d.ts +3 -1
- package/dist/esm/generated/ns/requests.js +3 -1
- package/dist/esm/generated/ns/requests.js.map +1 -1
- package/dist/esm/generated/ns/routines.d.ts +11 -4
- package/dist/esm/generated/ns/routines.js +11 -4
- package/dist/esm/generated/ns/routines.js.map +1 -1
- package/dist/esm/generated/ns/sandboxes.d.ts +292 -7
- package/dist/esm/generated/ns/sandboxes.js +444 -6
- package/dist/esm/generated/ns/sandboxes.js.map +1 -1
- package/dist/esm/generated/ns/usage.d.ts +1 -1
- package/dist/esm/generated/ns/usage.js +1 -1
- package/dist/esm/generated/ns/vision.d.ts +59 -17
- package/dist/esm/generated/ns/vision.js +59 -21
- package/dist/esm/generated/ns/vision.js.map +1 -1
- package/dist/esm/generated/types.d.ts +2564 -68
- package/dist/esm/helpers/sandboxes.d.ts +20 -1
- package/dist/esm/helpers/sandboxes.js +13 -1
- package/dist/esm/helpers/sandboxes.js.map +1 -1
- package/package.json +1 -1
- package/src/core/util.ts +1 -1
- package/src/generated/client.ts +28 -0
- package/src/generated/errors.ts +150 -0
- package/src/generated/ids.ts +15 -0
- package/src/generated/jobs.ts +4 -0
- package/src/generated/ns/actions.ts +403 -33
- package/src/generated/ns/agents.ts +461 -0
- package/src/generated/ns/images.ts +128 -0
- package/src/generated/ns/infer.ts +100 -3
- package/src/generated/ns/keys.ts +3 -1
- package/src/generated/ns/listeners.ts +296 -0
- package/src/generated/ns/orgs.ts +27 -1
- package/src/generated/ns/projects.ts +74 -0
- package/src/generated/ns/render.ts +277 -24
- package/src/generated/ns/requests.ts +3 -1
- package/src/generated/ns/routines.ts +11 -4
- package/src/generated/ns/sandboxes.ts +492 -7
- package/src/generated/ns/usage.ts +1 -1
- package/src/generated/ns/vision.ts +59 -21
- package/src/generated/types.ts +2907 -192
- package/src/helpers/sandboxes.ts +31 -2
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import type { RequestOptions, StreamOptions } from "../../core/client.ts";
|
|
2
|
+
import { Namespace } from "../../core/namespace.ts";
|
|
3
|
+
import type { Op } from "../../core/op.ts";
|
|
4
|
+
import type { APIPromise, JobPromise, ListPromise } from "../../core/promise.ts";
|
|
5
|
+
import type { EventStream } from "../../core/sse.ts";
|
|
6
|
+
import type * as T from "../types.ts";
|
|
7
|
+
/** Descriptors of every agents operation, keyed by method name (for tooling and custom clients). */
|
|
8
|
+
export declare const agentsOps: {
|
|
9
|
+
readonly listAgents: Op;
|
|
10
|
+
readonly createAgent: Op;
|
|
11
|
+
readonly getSession: Op;
|
|
12
|
+
readonly cancelSession: Op;
|
|
13
|
+
readonly streamSession: Op;
|
|
14
|
+
readonly deleteAgent: Op;
|
|
15
|
+
readonly getAgent: Op;
|
|
16
|
+
readonly updateAgent: Op;
|
|
17
|
+
readonly listInstances: Op;
|
|
18
|
+
readonly deleteInstance: Op;
|
|
19
|
+
readonly getInstance: Op;
|
|
20
|
+
readonly putInstance: Op;
|
|
21
|
+
readonly listInstanceEvents: Op;
|
|
22
|
+
readonly sendMessage: Op;
|
|
23
|
+
readonly sleepInstance: Op;
|
|
24
|
+
readonly listSessions: Op;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Actors: agent definitions, keyed instances (one microVM per key) and agent sessions; a message wakes its instance (`/v1/agents`).
|
|
28
|
+
*/
|
|
29
|
+
export declare class AgentsAPI extends Namespace {
|
|
30
|
+
/**
|
|
31
|
+
* List agents
|
|
32
|
+
*
|
|
33
|
+
* Lists the project's agents, newest first.
|
|
34
|
+
*
|
|
35
|
+
* `GET /v1/agents` · scope `agents:read` · served by the node
|
|
36
|
+
*/
|
|
37
|
+
listAgents(params?: T.AgentsListAgentsParams, options?: RequestOptions): ListPromise<T.AgentList, T.Agent>;
|
|
38
|
+
/**
|
|
39
|
+
* Create an agent
|
|
40
|
+
*
|
|
41
|
+
* Creates an agent: the definition every instance of it starts from. Nothing starts until the first message to
|
|
42
|
+
* a key (or `PUT /v1/agents/{agent}/instances/{key}`). `name` is unique in the project and is how the other
|
|
43
|
+
* operations name the agent (its `agt_` ID works too).
|
|
44
|
+
*
|
|
45
|
+
* `entry` is the harness: `command` runs in each instance, and the node delivers each message as a `POST` to
|
|
46
|
+
* `entry.port` and `entry.path` inside it. `api` is the grant each instance runs with, at most your own scopes:
|
|
47
|
+
* its `scopes`, its vault `connections` and its actions rule, whose packs it calls as MCP tools at
|
|
48
|
+
* `B3OS_MCP_URL`. `agents:write` is granted only when named exactly, so a harness changes its own memory and
|
|
49
|
+
* disk, never its definition. Instances belong to the project: revoking the key that created the agent does
|
|
50
|
+
* not stop them.
|
|
51
|
+
*
|
|
52
|
+
* `POST /v1/agents` · scope `agents:write` · served by the node
|
|
53
|
+
*/
|
|
54
|
+
createAgent(body: T.AgentCreateRequest, options?: RequestOptions): APIPromise<T.Agent>;
|
|
55
|
+
/**
|
|
56
|
+
* Get an agent session
|
|
57
|
+
*
|
|
58
|
+
* One turn: its status and phase, who sent it (`initiator`), its conversation, how its instance woke
|
|
59
|
+
* (`woke_from`), its trace and its timing. The message and the harness's answer are kept only for a session that
|
|
60
|
+
* was answered `202` (so you can read the result here, for 24 hours) or when the project's
|
|
61
|
+
* `platform.capture_content` setting is on. Sessions are kept 30 days after they end.
|
|
62
|
+
*
|
|
63
|
+
* `GET /v1/agents/sessions/{session_id}` · scope `agents:read` · served by the node
|
|
64
|
+
*/
|
|
65
|
+
getSession(sessionId: string, options?: RequestOptions): APIPromise<T.AgentSession>;
|
|
66
|
+
/**
|
|
67
|
+
* Cancel an agent session
|
|
68
|
+
*
|
|
69
|
+
* Cancels a turn. A queued session leaves the queue and is never delivered. A delivered one has its request into
|
|
70
|
+
* the harness closed; what the harness already did stands. Cancelling an ended session returns it unchanged.
|
|
71
|
+
*
|
|
72
|
+
* `POST /v1/agents/sessions/{session_id}/cancel` · scope `agents:run` · served by the node
|
|
73
|
+
*/
|
|
74
|
+
cancelSession(sessionId: string, options?: RequestOptions): APIPromise<T.AgentSession>;
|
|
75
|
+
/**
|
|
76
|
+
* Stream an agent session's events
|
|
77
|
+
*
|
|
78
|
+
* Server-sent events for one turn: `job.queued` when it was accepted, `session.waking` when its instance began
|
|
79
|
+
* to wake (with `woke_from`), `session.delivered` when the harness received it, `session.output` for each event
|
|
80
|
+
* the harness streamed back (when it answered with `text/event-stream`), and the terminal `job.succeeded`,
|
|
81
|
+
* `job.failed` or `job.canceled`, which carries the final session and ends the stream. Reconnect with
|
|
82
|
+
* `Last-Event-ID` to resume while the session runs; a session that ended sends its terminal event alone.
|
|
83
|
+
*
|
|
84
|
+
* `GET /v1/agents/sessions/{session_id}/events` · scope `agents:read` · served by the node
|
|
85
|
+
*/
|
|
86
|
+
streamSession(sessionId: string, options?: StreamOptions): EventStream<T.AgentSessionEvent>;
|
|
87
|
+
/**
|
|
88
|
+
* Delete an agent
|
|
89
|
+
*
|
|
90
|
+
* Deletes the agent and every instance of it: their microVMs, memory snapshots and disks. Their sessions stay
|
|
91
|
+
* readable until they expire.
|
|
92
|
+
*
|
|
93
|
+
* `DELETE /v1/agents/{agent}` · scope `agents:write` · served by the node
|
|
94
|
+
*/
|
|
95
|
+
deleteAgent(agent: string, options?: RequestOptions): APIPromise<T.Deleted>;
|
|
96
|
+
/**
|
|
97
|
+
* Get an agent
|
|
98
|
+
*
|
|
99
|
+
* The agent, by name or `agt_` ID, with its current revision and how many instances it has.
|
|
100
|
+
*
|
|
101
|
+
* `GET /v1/agents/{agent}` · scope `agents:read` · served by the node
|
|
102
|
+
*/
|
|
103
|
+
getAgent(agent: string, options?: RequestOptions): APIPromise<T.Agent>;
|
|
104
|
+
/**
|
|
105
|
+
* Update an agent
|
|
106
|
+
*
|
|
107
|
+
* Changes the definition and makes a new revision. `upgrade` says what happens to instances of earlier
|
|
108
|
+
* revisions: `new_instances` (the default) leaves them on the revision they were made from, so their memory
|
|
109
|
+
* and disk stay as they are, and only new instances take the change; `on_wake` makes a sleeping instance of an
|
|
110
|
+
* earlier revision again from this one at its next wake, which ends its memory and disk. `name` cannot change.
|
|
111
|
+
* The grant is checked again against your own scopes.
|
|
112
|
+
*
|
|
113
|
+
* `PATCH /v1/agents/{agent}` · scope `agents:write` · served by the node
|
|
114
|
+
*/
|
|
115
|
+
updateAgent(agent: string, body: T.AgentUpdateRequest, options?: RequestOptions): APIPromise<T.Agent>;
|
|
116
|
+
/**
|
|
117
|
+
* List an agent's instances
|
|
118
|
+
*
|
|
119
|
+
* Lists the agent's instances, most recently messaged first. Filter by `status`.
|
|
120
|
+
*
|
|
121
|
+
* `GET /v1/agents/{agent}/instances` · scope `agents:read` · served by the node
|
|
122
|
+
*/
|
|
123
|
+
listInstances(agent: string, params?: T.AgentsListInstancesParams, options?: RequestOptions): ListPromise<T.AgentInstanceList, T.AgentInstance>;
|
|
124
|
+
/**
|
|
125
|
+
* Delete an instance
|
|
126
|
+
*
|
|
127
|
+
* Deletes the instance: its microVM, its memory snapshot and its disk. Queued messages end `canceled` and are
|
|
128
|
+
* never delivered. This and deleting the agent are the only ways an instance ends; idleness never does. The
|
|
129
|
+
* next message to the key makes a new instance unless it sends `create: false`.
|
|
130
|
+
*
|
|
131
|
+
* `DELETE /v1/agents/{agent}/instances/{key}` · scope `agents:write` · served by the node
|
|
132
|
+
*/
|
|
133
|
+
deleteInstance(agent: string, key: string, options?: RequestOptions): APIPromise<T.Deleted>;
|
|
134
|
+
/**
|
|
135
|
+
* Get an instance
|
|
136
|
+
*
|
|
137
|
+
* The instance for `key`: its status (`running`, `paused` in memory, `hibernated` as a memory snapshot,
|
|
138
|
+
* `dormant` on its disk alone), the host memory it holds now (`resident_mib`), the disk it holds on the node
|
|
139
|
+
* (`storage_bytes`), how many messages wait in its queue, and when it last got a message and went to sleep.
|
|
140
|
+
*
|
|
141
|
+
* `GET /v1/agents/{agent}/instances/{key}` · scope `agents:read` · served by the node
|
|
142
|
+
*/
|
|
143
|
+
getInstance(agent: string, key: string, options?: RequestOptions): APIPromise<T.AgentInstance>;
|
|
144
|
+
/**
|
|
145
|
+
* Get or create an instance
|
|
146
|
+
*
|
|
147
|
+
* The instance for `key`, made if it does not exist: `201` when this request made it (its microVM started and
|
|
148
|
+
* its harness passed readiness), `200` when it existed. An existing instance is not woken unless `wake: true`.
|
|
149
|
+
* `replace: true` deletes an existing instance (its memory, snapshot and disk) and makes it again from the
|
|
150
|
+
* agent's current revision. Two requests for a new key at once make one instance.
|
|
151
|
+
*
|
|
152
|
+
* Each instance is its own microVM: instances of different keys never share one. The key is stored and shown as
|
|
153
|
+
* written, so never use a credential or a personal detail as a key.
|
|
154
|
+
*
|
|
155
|
+
* `PUT /v1/agents/{agent}/instances/{key}` · scope `agents:run` · served by the node
|
|
156
|
+
*/
|
|
157
|
+
putInstance(agent: string, key: string, body?: T.AgentInstancePutRequest, options?: RequestOptions): APIPromise<T.AgentInstance>;
|
|
158
|
+
/**
|
|
159
|
+
* List an instance's lifecycle events
|
|
160
|
+
*
|
|
161
|
+
* What happened to the instance, newest first: `instance.created`, `instance.paused`, `instance.hibernated`,
|
|
162
|
+
* `instance.dormant`, `instance.woke` (with `woke_from`), `instance.failed`, `instance.recovered` (with
|
|
163
|
+
* `woke_from`: from its memory snapshot, which takes memory and disk back to the snapshot's time together,
|
|
164
|
+
* from its disk, with memory lost, or `new`, when its disk was gone too) and `instance.upgraded`. The last 200
|
|
165
|
+
* are kept.
|
|
166
|
+
*
|
|
167
|
+
* `GET /v1/agents/{agent}/instances/{key}/events` · scope `agents:read` · served by the node
|
|
168
|
+
*/
|
|
169
|
+
listInstanceEvents(agent: string, key: string, params?: T.AgentsListInstanceEventsParams, options?: RequestOptions): ListPromise<T.AgentInstanceEventList, T.AgentInstanceEvent>;
|
|
170
|
+
/**
|
|
171
|
+
* Send a message to an instance
|
|
172
|
+
*
|
|
173
|
+
* Sends one message to the instance for `key` and starts a session (one turn). The instance is made if it does
|
|
174
|
+
* not exist, unless `create: false`; a sleeping one is woken, from memory, from its memory snapshot or from its
|
|
175
|
+
* disk (`woke_from`). Nobody calls resume.
|
|
176
|
+
*
|
|
177
|
+
* The message is written to disk before any answer. With `?wait=0` (the default) the answer is `202` with the
|
|
178
|
+
* session `queued` right after that write, before the instance wakes or the turn runs: from then on the message
|
|
179
|
+
* is not lost when the node's daemon restarts. With `?wait=N` the answer waits up to N seconds for the turn;
|
|
180
|
+
* with `Accept: text/event-stream` it streams the session's events, the harness's own streamed events among
|
|
181
|
+
* them (`session.output`). A `200` carries the harness's answer as `result` (its JSON body, or its text).
|
|
182
|
+
*
|
|
183
|
+
* An instance runs one turn at a time. A message that arrives during a turn waits in the instance's queue, in
|
|
184
|
+
* order, up to the agent's `turns.queue_max`; past it the answer is `429 instance_busy` with `Retry-After`, and
|
|
185
|
+
* nothing was queued. Retry with the same `Idempotency-Key`: a retry within 24 hours returns the first answer
|
|
186
|
+
* and never queues the message twice.
|
|
187
|
+
*
|
|
188
|
+
* The node delivers the message as a `POST` to the agent's `entry.port` and `entry.path` inside the instance,
|
|
189
|
+
* with the JSON body `{session, message, conversation, subject, initiator}` and the headers `traceparent`,
|
|
190
|
+
* `baggage` and `x-b3os-session`. `message` is your request body without the reserved members. A 2xx answer
|
|
191
|
+
* ends the session `succeeded`; any other ends it `failed` with `harness_error`. A message is delivered into
|
|
192
|
+
* the harness at most once: if the node restarts while the harness has it, the session ends `failed` with
|
|
193
|
+
* `session_interrupted`, unless the agent sets `turns.redeliver: true`.
|
|
194
|
+
*
|
|
195
|
+
* `conversation` and `subject` are taken from the body, else from the `b3os.conversation` and `b3os.subject`
|
|
196
|
+
* baggage that `b3.traces.turn` sends. `initiator` (the key, dashboard user, sandbox, instance, routine run or
|
|
197
|
+
* listener that sent the message) is taken from the credential, never from the body. A message whose key is
|
|
198
|
+
* revoked before it is delivered ends `failed` with `credential_revoked`. Code in an instance cannot message
|
|
199
|
+
* that same instance (`409 instance_self_message`).
|
|
200
|
+
*
|
|
201
|
+
* `Server-Timing` and the session's `timing` split the turn into `queue`, `wake` (`desc` names the tier),
|
|
202
|
+
* `deliver` and `harness`.
|
|
203
|
+
*
|
|
204
|
+
* `POST /v1/agents/{agent}/instances/{key}/messages` · scope `agents:run` · served by the node
|
|
205
|
+
*/
|
|
206
|
+
sendMessage(agent: string, key: string, body: T.AgentMessageRequest, options?: RequestOptions): JobPromise<T.AgentSession, T.AgentSessionEvent>;
|
|
207
|
+
/**
|
|
208
|
+
* Put an instance to sleep now
|
|
209
|
+
*
|
|
210
|
+
* Sends the instance to a sleep tier now instead of waiting for its timers: `ram` pauses it, `snapshot` writes
|
|
211
|
+
* its memory snapshot and frees its memory (an instance with a volume answers `409 volume_attached` and stays as
|
|
212
|
+
* it was). A harness may call this on its own instance when it knows it is done
|
|
213
|
+
* (from inside, at `http://127.0.0.1:7700`); the pause then happens once its current turn ends. An instance with
|
|
214
|
+
* a turn running or messages queued goes to sleep after them. Asleep already in that tier or a deeper one:
|
|
215
|
+
* returned unchanged.
|
|
216
|
+
*
|
|
217
|
+
* `POST /v1/agents/{agent}/instances/{key}/sleep` · scope `agents:run` · served by the node
|
|
218
|
+
*/
|
|
219
|
+
sleepInstance(agent: string, key: string, body?: T.AgentInstanceSleepRequest, options?: RequestOptions): APIPromise<T.AgentInstance>;
|
|
220
|
+
/**
|
|
221
|
+
* List an agent's sessions
|
|
222
|
+
*
|
|
223
|
+
* Lists the agent's sessions, newest first. Filter by instance `key`, by `conversation` (the ID you sent with the
|
|
224
|
+
* message, or the `b3os.conversation` baggage of `b3.traces.turn`) or by `status`.
|
|
225
|
+
*
|
|
226
|
+
* `GET /v1/agents/{agent}/sessions` · scope `agents:read` · served by the node
|
|
227
|
+
*/
|
|
228
|
+
listSessions(agent: string, params?: T.AgentsListSessionsParams, options?: RequestOptions): ListPromise<T.AgentSessionList, T.AgentSession>;
|
|
229
|
+
}
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
// Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
|
|
2
|
+
import { isTerminalJobEvent } from "../../core/jobs.js";
|
|
3
|
+
import { Namespace } from "../../core/namespace.js";
|
|
4
|
+
const listAgentsOp = {
|
|
5
|
+
id: "agentsListAgents",
|
|
6
|
+
method: "GET",
|
|
7
|
+
path: "/v1/agents",
|
|
8
|
+
timeoutMs: 10000,
|
|
9
|
+
scope: "agents:read",
|
|
10
|
+
};
|
|
11
|
+
const createAgentOp = {
|
|
12
|
+
id: "agentsCreateAgent",
|
|
13
|
+
method: "POST",
|
|
14
|
+
path: "/v1/agents",
|
|
15
|
+
body: "json",
|
|
16
|
+
idem: true,
|
|
17
|
+
timeoutMs: 10000,
|
|
18
|
+
scope: "agents:write",
|
|
19
|
+
};
|
|
20
|
+
const getSessionOp = {
|
|
21
|
+
id: "agentsGetSession",
|
|
22
|
+
method: "GET",
|
|
23
|
+
path: "/v1/agents/sessions/{session_id}",
|
|
24
|
+
params: ["session_id"],
|
|
25
|
+
timeoutMs: 10000,
|
|
26
|
+
scope: "agents:read",
|
|
27
|
+
};
|
|
28
|
+
const cancelSessionOp = {
|
|
29
|
+
id: "agentsCancelSession",
|
|
30
|
+
method: "POST",
|
|
31
|
+
path: "/v1/agents/sessions/{session_id}/cancel",
|
|
32
|
+
params: ["session_id"],
|
|
33
|
+
timeoutMs: 10000,
|
|
34
|
+
scope: "agents:run",
|
|
35
|
+
};
|
|
36
|
+
const streamSessionOp = {
|
|
37
|
+
id: "agentsStreamSession",
|
|
38
|
+
method: "GET",
|
|
39
|
+
path: "/v1/agents/sessions/{session_id}/events",
|
|
40
|
+
params: ["session_id"],
|
|
41
|
+
stream: "sse",
|
|
42
|
+
timeoutMs: 3600000,
|
|
43
|
+
scope: "agents:read",
|
|
44
|
+
};
|
|
45
|
+
const deleteAgentOp = {
|
|
46
|
+
id: "agentsDeleteAgent",
|
|
47
|
+
method: "DELETE",
|
|
48
|
+
path: "/v1/agents/{agent}",
|
|
49
|
+
params: ["agent"],
|
|
50
|
+
timeoutMs: 30000,
|
|
51
|
+
scope: "agents:write",
|
|
52
|
+
};
|
|
53
|
+
const getAgentOp = {
|
|
54
|
+
id: "agentsGetAgent",
|
|
55
|
+
method: "GET",
|
|
56
|
+
path: "/v1/agents/{agent}",
|
|
57
|
+
params: ["agent"],
|
|
58
|
+
timeoutMs: 10000,
|
|
59
|
+
scope: "agents:read",
|
|
60
|
+
};
|
|
61
|
+
const updateAgentOp = {
|
|
62
|
+
id: "agentsUpdateAgent",
|
|
63
|
+
method: "PATCH",
|
|
64
|
+
path: "/v1/agents/{agent}",
|
|
65
|
+
params: ["agent"],
|
|
66
|
+
body: "json",
|
|
67
|
+
timeoutMs: 10000,
|
|
68
|
+
scope: "agents:write",
|
|
69
|
+
};
|
|
70
|
+
const listInstancesOp = {
|
|
71
|
+
id: "agentsListInstances",
|
|
72
|
+
method: "GET",
|
|
73
|
+
path: "/v1/agents/{agent}/instances",
|
|
74
|
+
params: ["agent"],
|
|
75
|
+
timeoutMs: 10000,
|
|
76
|
+
scope: "agents:read",
|
|
77
|
+
};
|
|
78
|
+
const deleteInstanceOp = {
|
|
79
|
+
id: "agentsDeleteInstance",
|
|
80
|
+
method: "DELETE",
|
|
81
|
+
path: "/v1/agents/{agent}/instances/{key}",
|
|
82
|
+
params: ["agent", "key"],
|
|
83
|
+
timeoutMs: 30000,
|
|
84
|
+
scope: "agents:write",
|
|
85
|
+
};
|
|
86
|
+
const getInstanceOp = {
|
|
87
|
+
id: "agentsGetInstance",
|
|
88
|
+
method: "GET",
|
|
89
|
+
path: "/v1/agents/{agent}/instances/{key}",
|
|
90
|
+
params: ["agent", "key"],
|
|
91
|
+
timeoutMs: 10000,
|
|
92
|
+
scope: "agents:read",
|
|
93
|
+
};
|
|
94
|
+
const putInstanceOp = {
|
|
95
|
+
id: "agentsPutInstance",
|
|
96
|
+
method: "PUT",
|
|
97
|
+
path: "/v1/agents/{agent}/instances/{key}",
|
|
98
|
+
params: ["agent", "key"],
|
|
99
|
+
body: "json",
|
|
100
|
+
timeoutMs: 65000,
|
|
101
|
+
scope: "agents:run",
|
|
102
|
+
};
|
|
103
|
+
const listInstanceEventsOp = {
|
|
104
|
+
id: "agentsListInstanceEvents",
|
|
105
|
+
method: "GET",
|
|
106
|
+
path: "/v1/agents/{agent}/instances/{key}/events",
|
|
107
|
+
params: ["agent", "key"],
|
|
108
|
+
timeoutMs: 10000,
|
|
109
|
+
scope: "agents:read",
|
|
110
|
+
};
|
|
111
|
+
const sleepInstanceOp = {
|
|
112
|
+
id: "agentsSleepInstance",
|
|
113
|
+
method: "POST",
|
|
114
|
+
path: "/v1/agents/{agent}/instances/{key}/sleep",
|
|
115
|
+
params: ["agent", "key"],
|
|
116
|
+
body: "json",
|
|
117
|
+
timeoutMs: 30000,
|
|
118
|
+
scope: "agents:run",
|
|
119
|
+
};
|
|
120
|
+
const listSessionsOp = {
|
|
121
|
+
id: "agentsListSessions",
|
|
122
|
+
method: "GET",
|
|
123
|
+
path: "/v1/agents/{agent}/sessions",
|
|
124
|
+
params: ["agent"],
|
|
125
|
+
timeoutMs: 10000,
|
|
126
|
+
scope: "agents:read",
|
|
127
|
+
};
|
|
128
|
+
const sendMessageOp = {
|
|
129
|
+
id: "agentsSendMessage",
|
|
130
|
+
method: "POST",
|
|
131
|
+
path: "/v1/agents/{agent}/instances/{key}/messages",
|
|
132
|
+
params: ["agent", "key"],
|
|
133
|
+
body: "json",
|
|
134
|
+
idem: true,
|
|
135
|
+
stream: "sse",
|
|
136
|
+
timeoutMs: 3600000,
|
|
137
|
+
scope: "agents:run",
|
|
138
|
+
job: { get: getSessionOp, events: streamSessionOp, cancel: cancelSessionOp },
|
|
139
|
+
};
|
|
140
|
+
/** Descriptors of every agents operation, keyed by method name (for tooling and custom clients). */
|
|
141
|
+
export const agentsOps = {
|
|
142
|
+
listAgents: listAgentsOp,
|
|
143
|
+
createAgent: createAgentOp,
|
|
144
|
+
getSession: getSessionOp,
|
|
145
|
+
cancelSession: cancelSessionOp,
|
|
146
|
+
streamSession: streamSessionOp,
|
|
147
|
+
deleteAgent: deleteAgentOp,
|
|
148
|
+
getAgent: getAgentOp,
|
|
149
|
+
updateAgent: updateAgentOp,
|
|
150
|
+
listInstances: listInstancesOp,
|
|
151
|
+
deleteInstance: deleteInstanceOp,
|
|
152
|
+
getInstance: getInstanceOp,
|
|
153
|
+
putInstance: putInstanceOp,
|
|
154
|
+
listInstanceEvents: listInstanceEventsOp,
|
|
155
|
+
sendMessage: sendMessageOp,
|
|
156
|
+
sleepInstance: sleepInstanceOp,
|
|
157
|
+
listSessions: listSessionsOp,
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Actors: agent definitions, keyed instances (one microVM per key) and agent sessions; a message wakes its instance (`/v1/agents`).
|
|
161
|
+
*/
|
|
162
|
+
export class AgentsAPI extends Namespace {
|
|
163
|
+
/**
|
|
164
|
+
* List agents
|
|
165
|
+
*
|
|
166
|
+
* Lists the project's agents, newest first.
|
|
167
|
+
*
|
|
168
|
+
* `GET /v1/agents` · scope `agents:read` · served by the node
|
|
169
|
+
*/
|
|
170
|
+
listAgents(params, options) {
|
|
171
|
+
return this._client._list(listAgentsOp, { query: params }, options);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Create an agent
|
|
175
|
+
*
|
|
176
|
+
* Creates an agent: the definition every instance of it starts from. Nothing starts until the first message to
|
|
177
|
+
* a key (or `PUT /v1/agents/{agent}/instances/{key}`). `name` is unique in the project and is how the other
|
|
178
|
+
* operations name the agent (its `agt_` ID works too).
|
|
179
|
+
*
|
|
180
|
+
* `entry` is the harness: `command` runs in each instance, and the node delivers each message as a `POST` to
|
|
181
|
+
* `entry.port` and `entry.path` inside it. `api` is the grant each instance runs with, at most your own scopes:
|
|
182
|
+
* its `scopes`, its vault `connections` and its actions rule, whose packs it calls as MCP tools at
|
|
183
|
+
* `B3OS_MCP_URL`. `agents:write` is granted only when named exactly, so a harness changes its own memory and
|
|
184
|
+
* disk, never its definition. Instances belong to the project: revoking the key that created the agent does
|
|
185
|
+
* not stop them.
|
|
186
|
+
*
|
|
187
|
+
* `POST /v1/agents` · scope `agents:write` · served by the node
|
|
188
|
+
*/
|
|
189
|
+
createAgent(body, options) {
|
|
190
|
+
return this._client._call(createAgentOp, { body }, options);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Get an agent session
|
|
194
|
+
*
|
|
195
|
+
* One turn: its status and phase, who sent it (`initiator`), its conversation, how its instance woke
|
|
196
|
+
* (`woke_from`), its trace and its timing. The message and the harness's answer are kept only for a session that
|
|
197
|
+
* was answered `202` (so you can read the result here, for 24 hours) or when the project's
|
|
198
|
+
* `platform.capture_content` setting is on. Sessions are kept 30 days after they end.
|
|
199
|
+
*
|
|
200
|
+
* `GET /v1/agents/sessions/{session_id}` · scope `agents:read` · served by the node
|
|
201
|
+
*/
|
|
202
|
+
getSession(sessionId, options) {
|
|
203
|
+
return this._client._call(getSessionOp, { path: [sessionId] }, options);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Cancel an agent session
|
|
207
|
+
*
|
|
208
|
+
* Cancels a turn. A queued session leaves the queue and is never delivered. A delivered one has its request into
|
|
209
|
+
* the harness closed; what the harness already did stands. Cancelling an ended session returns it unchanged.
|
|
210
|
+
*
|
|
211
|
+
* `POST /v1/agents/sessions/{session_id}/cancel` · scope `agents:run` · served by the node
|
|
212
|
+
*/
|
|
213
|
+
cancelSession(sessionId, options) {
|
|
214
|
+
return this._client._call(cancelSessionOp, { path: [sessionId] }, options);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Stream an agent session's events
|
|
218
|
+
*
|
|
219
|
+
* Server-sent events for one turn: `job.queued` when it was accepted, `session.waking` when its instance began
|
|
220
|
+
* to wake (with `woke_from`), `session.delivered` when the harness received it, `session.output` for each event
|
|
221
|
+
* the harness streamed back (when it answered with `text/event-stream`), and the terminal `job.succeeded`,
|
|
222
|
+
* `job.failed` or `job.canceled`, which carries the final session and ends the stream. Reconnect with
|
|
223
|
+
* `Last-Event-ID` to resume while the session runs; a session that ended sends its terminal event alone.
|
|
224
|
+
*
|
|
225
|
+
* `GET /v1/agents/sessions/{session_id}/events` · scope `agents:read` · served by the node
|
|
226
|
+
*/
|
|
227
|
+
streamSession(sessionId, options) {
|
|
228
|
+
return this._client._stream(streamSessionOp, { path: [sessionId] }, options, {
|
|
229
|
+
terminal: isTerminalJobEvent,
|
|
230
|
+
reconnectOnEnd: true,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Delete an agent
|
|
235
|
+
*
|
|
236
|
+
* Deletes the agent and every instance of it: their microVMs, memory snapshots and disks. Their sessions stay
|
|
237
|
+
* readable until they expire.
|
|
238
|
+
*
|
|
239
|
+
* `DELETE /v1/agents/{agent}` · scope `agents:write` · served by the node
|
|
240
|
+
*/
|
|
241
|
+
deleteAgent(agent, options) {
|
|
242
|
+
return this._client._call(deleteAgentOp, { path: [agent] }, options);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Get an agent
|
|
246
|
+
*
|
|
247
|
+
* The agent, by name or `agt_` ID, with its current revision and how many instances it has.
|
|
248
|
+
*
|
|
249
|
+
* `GET /v1/agents/{agent}` · scope `agents:read` · served by the node
|
|
250
|
+
*/
|
|
251
|
+
getAgent(agent, options) {
|
|
252
|
+
return this._client._call(getAgentOp, { path: [agent] }, options);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Update an agent
|
|
256
|
+
*
|
|
257
|
+
* Changes the definition and makes a new revision. `upgrade` says what happens to instances of earlier
|
|
258
|
+
* revisions: `new_instances` (the default) leaves them on the revision they were made from, so their memory
|
|
259
|
+
* and disk stay as they are, and only new instances take the change; `on_wake` makes a sleeping instance of an
|
|
260
|
+
* earlier revision again from this one at its next wake, which ends its memory and disk. `name` cannot change.
|
|
261
|
+
* The grant is checked again against your own scopes.
|
|
262
|
+
*
|
|
263
|
+
* `PATCH /v1/agents/{agent}` · scope `agents:write` · served by the node
|
|
264
|
+
*/
|
|
265
|
+
updateAgent(agent, body, options) {
|
|
266
|
+
return this._client._call(updateAgentOp, { path: [agent], body }, options);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* List an agent's instances
|
|
270
|
+
*
|
|
271
|
+
* Lists the agent's instances, most recently messaged first. Filter by `status`.
|
|
272
|
+
*
|
|
273
|
+
* `GET /v1/agents/{agent}/instances` · scope `agents:read` · served by the node
|
|
274
|
+
*/
|
|
275
|
+
listInstances(agent, params, options) {
|
|
276
|
+
return this._client._list(listInstancesOp, { path: [agent], query: params }, options);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Delete an instance
|
|
280
|
+
*
|
|
281
|
+
* Deletes the instance: its microVM, its memory snapshot and its disk. Queued messages end `canceled` and are
|
|
282
|
+
* never delivered. This and deleting the agent are the only ways an instance ends; idleness never does. The
|
|
283
|
+
* next message to the key makes a new instance unless it sends `create: false`.
|
|
284
|
+
*
|
|
285
|
+
* `DELETE /v1/agents/{agent}/instances/{key}` · scope `agents:write` · served by the node
|
|
286
|
+
*/
|
|
287
|
+
deleteInstance(agent, key, options) {
|
|
288
|
+
return this._client._call(deleteInstanceOp, { path: [agent, key] }, options);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Get an instance
|
|
292
|
+
*
|
|
293
|
+
* The instance for `key`: its status (`running`, `paused` in memory, `hibernated` as a memory snapshot,
|
|
294
|
+
* `dormant` on its disk alone), the host memory it holds now (`resident_mib`), the disk it holds on the node
|
|
295
|
+
* (`storage_bytes`), how many messages wait in its queue, and when it last got a message and went to sleep.
|
|
296
|
+
*
|
|
297
|
+
* `GET /v1/agents/{agent}/instances/{key}` · scope `agents:read` · served by the node
|
|
298
|
+
*/
|
|
299
|
+
getInstance(agent, key, options) {
|
|
300
|
+
return this._client._call(getInstanceOp, { path: [agent, key] }, options);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Get or create an instance
|
|
304
|
+
*
|
|
305
|
+
* The instance for `key`, made if it does not exist: `201` when this request made it (its microVM started and
|
|
306
|
+
* its harness passed readiness), `200` when it existed. An existing instance is not woken unless `wake: true`.
|
|
307
|
+
* `replace: true` deletes an existing instance (its memory, snapshot and disk) and makes it again from the
|
|
308
|
+
* agent's current revision. Two requests for a new key at once make one instance.
|
|
309
|
+
*
|
|
310
|
+
* Each instance is its own microVM: instances of different keys never share one. The key is stored and shown as
|
|
311
|
+
* written, so never use a credential or a personal detail as a key.
|
|
312
|
+
*
|
|
313
|
+
* `PUT /v1/agents/{agent}/instances/{key}` · scope `agents:run` · served by the node
|
|
314
|
+
*/
|
|
315
|
+
putInstance(agent, key, body, options) {
|
|
316
|
+
return this._client._call(putInstanceOp, { path: [agent, key], body }, options);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* List an instance's lifecycle events
|
|
320
|
+
*
|
|
321
|
+
* What happened to the instance, newest first: `instance.created`, `instance.paused`, `instance.hibernated`,
|
|
322
|
+
* `instance.dormant`, `instance.woke` (with `woke_from`), `instance.failed`, `instance.recovered` (with
|
|
323
|
+
* `woke_from`: from its memory snapshot, which takes memory and disk back to the snapshot's time together,
|
|
324
|
+
* from its disk, with memory lost, or `new`, when its disk was gone too) and `instance.upgraded`. The last 200
|
|
325
|
+
* are kept.
|
|
326
|
+
*
|
|
327
|
+
* `GET /v1/agents/{agent}/instances/{key}/events` · scope `agents:read` · served by the node
|
|
328
|
+
*/
|
|
329
|
+
listInstanceEvents(agent, key, params, options) {
|
|
330
|
+
return this._client._list(listInstanceEventsOp, { path: [agent, key], query: params }, options);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Send a message to an instance
|
|
334
|
+
*
|
|
335
|
+
* Sends one message to the instance for `key` and starts a session (one turn). The instance is made if it does
|
|
336
|
+
* not exist, unless `create: false`; a sleeping one is woken, from memory, from its memory snapshot or from its
|
|
337
|
+
* disk (`woke_from`). Nobody calls resume.
|
|
338
|
+
*
|
|
339
|
+
* The message is written to disk before any answer. With `?wait=0` (the default) the answer is `202` with the
|
|
340
|
+
* session `queued` right after that write, before the instance wakes or the turn runs: from then on the message
|
|
341
|
+
* is not lost when the node's daemon restarts. With `?wait=N` the answer waits up to N seconds for the turn;
|
|
342
|
+
* with `Accept: text/event-stream` it streams the session's events, the harness's own streamed events among
|
|
343
|
+
* them (`session.output`). A `200` carries the harness's answer as `result` (its JSON body, or its text).
|
|
344
|
+
*
|
|
345
|
+
* An instance runs one turn at a time. A message that arrives during a turn waits in the instance's queue, in
|
|
346
|
+
* order, up to the agent's `turns.queue_max`; past it the answer is `429 instance_busy` with `Retry-After`, and
|
|
347
|
+
* nothing was queued. Retry with the same `Idempotency-Key`: a retry within 24 hours returns the first answer
|
|
348
|
+
* and never queues the message twice.
|
|
349
|
+
*
|
|
350
|
+
* The node delivers the message as a `POST` to the agent's `entry.port` and `entry.path` inside the instance,
|
|
351
|
+
* with the JSON body `{session, message, conversation, subject, initiator}` and the headers `traceparent`,
|
|
352
|
+
* `baggage` and `x-b3os-session`. `message` is your request body without the reserved members. A 2xx answer
|
|
353
|
+
* ends the session `succeeded`; any other ends it `failed` with `harness_error`. A message is delivered into
|
|
354
|
+
* the harness at most once: if the node restarts while the harness has it, the session ends `failed` with
|
|
355
|
+
* `session_interrupted`, unless the agent sets `turns.redeliver: true`.
|
|
356
|
+
*
|
|
357
|
+
* `conversation` and `subject` are taken from the body, else from the `b3os.conversation` and `b3os.subject`
|
|
358
|
+
* baggage that `b3.traces.turn` sends. `initiator` (the key, dashboard user, sandbox, instance, routine run or
|
|
359
|
+
* listener that sent the message) is taken from the credential, never from the body. A message whose key is
|
|
360
|
+
* revoked before it is delivered ends `failed` with `credential_revoked`. Code in an instance cannot message
|
|
361
|
+
* that same instance (`409 instance_self_message`).
|
|
362
|
+
*
|
|
363
|
+
* `Server-Timing` and the session's `timing` split the turn into `queue`, `wake` (`desc` names the tier),
|
|
364
|
+
* `deliver` and `harness`.
|
|
365
|
+
*
|
|
366
|
+
* `POST /v1/agents/{agent}/instances/{key}/messages` · scope `agents:run` · served by the node
|
|
367
|
+
*/
|
|
368
|
+
sendMessage(agent, key, body, options) {
|
|
369
|
+
return this._client._job(sendMessageOp, { path: [agent, key], body }, options);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Put an instance to sleep now
|
|
373
|
+
*
|
|
374
|
+
* Sends the instance to a sleep tier now instead of waiting for its timers: `ram` pauses it, `snapshot` writes
|
|
375
|
+
* its memory snapshot and frees its memory (an instance with a volume answers `409 volume_attached` and stays as
|
|
376
|
+
* it was). A harness may call this on its own instance when it knows it is done
|
|
377
|
+
* (from inside, at `http://127.0.0.1:7700`); the pause then happens once its current turn ends. An instance with
|
|
378
|
+
* a turn running or messages queued goes to sleep after them. Asleep already in that tier or a deeper one:
|
|
379
|
+
* returned unchanged.
|
|
380
|
+
*
|
|
381
|
+
* `POST /v1/agents/{agent}/instances/{key}/sleep` · scope `agents:run` · served by the node
|
|
382
|
+
*/
|
|
383
|
+
sleepInstance(agent, key, body, options) {
|
|
384
|
+
return this._client._call(sleepInstanceOp, { path: [agent, key], body }, options);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* List an agent's sessions
|
|
388
|
+
*
|
|
389
|
+
* Lists the agent's sessions, newest first. Filter by instance `key`, by `conversation` (the ID you sent with the
|
|
390
|
+
* message, or the `b3os.conversation` baggage of `b3.traces.turn`) or by `status`.
|
|
391
|
+
*
|
|
392
|
+
* `GET /v1/agents/{agent}/sessions` · scope `agents:read` · served by the node
|
|
393
|
+
*/
|
|
394
|
+
listSessions(agent, params, options) {
|
|
395
|
+
return this._client._list(listSessionsOp, { path: [agent], query: params }, options);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../../src/generated/ns/agents.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAG5G,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMpD,MAAM,YAAY,GAAO;IACvB,EAAE,EAAE,kBAAkB;IACtB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,YAAY;IAClB,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,aAAa;CACrB,CAAC;AACF,MAAM,aAAa,GAAO;IACxB,EAAE,EAAE,mBAAmB;IACvB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,cAAc;CACtB,CAAC;AACF,MAAM,YAAY,GAAO;IACvB,EAAE,EAAE,kBAAkB;IACtB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,kC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