@soat/sdk 0.69.0 → 0.70.1

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/index.cjs CHANGED
@@ -779,7 +779,7 @@ var Agents = class {
779
779
  /**
780
780
  * Delete an agent
781
781
  *
782
- * Deletes an agent by ID. Fails with `409` if the agent has dependent generations or traces, unless `force=true` is passed, in which case those generations and traces are deleted along with the agent.
782
+ * Deletes an agent by ID. Fails with `409` if the agent has dependent generations or traces, or another project has accepted a share of it, unless `force=true` is passed, in which case those generations and traces are deleted along with the agent and the shares are revoked. Every share of the agent is revoked when it is deleted.
783
783
  *
784
784
  */
785
785
  static deleteAgent(options) {
@@ -791,7 +791,8 @@ var Agents = class {
791
791
  /**
792
792
  * Get an agent
793
793
  *
794
- * Returns a single agent by ID.
794
+ * Returns a single agent by ID. A credential scoped to a project the agent is shared with, through an accepted share, reads its `id` and `name` only.
795
+ *
795
796
  */
796
797
  static getAgent(options) {
797
798
  return (options.client ?? client).get({
@@ -834,6 +835,8 @@ var Agents = class {
834
835
  *
835
836
  * Sends messages to the agent, resolves its tools, and runs the AI model loop. Background by default: returns `202 Accepted` with a `generation_id` to poll via `GET /api/v1/generations/{generation_id}`. Pass `?wait=true` to block and receive the result inline, where client tools pause the generation and return `requires_action`. Streaming (`stream: true`) implies waiting. Pass `idempotency_key` to make a retry safe: a request whose key is already claimed runs nothing and answers `202` with the generation the key names.
836
837
  *
838
+ * A credential scoped to a project the agent is shared with, through an accepted share, runs it in that project: on the publisher's configuration, recorded, metered and governed in the grantee project.
839
+ *
837
840
  */
838
841
  static createAgentGeneration(options) {
839
842
  return (options.client ?? client).post({
@@ -4141,6 +4144,167 @@ var Sessions = class {
4141
4144
  });
4142
4145
  }
4143
4146
  };
4147
+ var Shares = class {
4148
+ /**
4149
+ * List shares
4150
+ *
4151
+ * With `role=publisher` (the default), the shares the project published. With `role=grantee`, the shares addressed to the project and the public shares it accepted, each with the project's own `acceptance`. A public share the project never accepted is not listed.
4152
+ */
4153
+ static listShares(options) {
4154
+ return (options?.client ?? client).get({
4155
+ url: "/api/v1/shares",
4156
+ ...options
4157
+ });
4158
+ }
4159
+ /**
4160
+ * Create a share
4161
+ *
4162
+ * Offers one of the project's resources to another project — or, with `grantee: "*"`, to every project — with the listed actions. The share grants nothing until the grantee accepts it. `grantee: "*"` is refused with `403 PUBLIC_SHARES_DISABLED` unless the deployment sets `SHARES_ALLOW_PUBLIC=true`.
4163
+ */
4164
+ static createShare(options) {
4165
+ return (options.client ?? client).post({
4166
+ url: "/api/v1/shares",
4167
+ ...options,
4168
+ headers: {
4169
+ "Content-Type": "application/json",
4170
+ ...options.headers
4171
+ }
4172
+ });
4173
+ }
4174
+ /**
4175
+ * Delete a share
4176
+ *
4177
+ * Deletes a share and every acceptance of it. Each project whose acceptance was active gets a `share_revoked` activity entry.
4178
+ */
4179
+ static deleteShare(options) {
4180
+ return (options.client ?? client).delete({
4181
+ url: "/api/v1/shares/{share_id}",
4182
+ ...options
4183
+ });
4184
+ }
4185
+ /**
4186
+ * Get a share
4187
+ *
4188
+ * Returns a share with the grantee's view of the resource in `projection`. The publisher reads any of its shares; a grantee project, named by `project_id` or by its scoped credential, reads a share addressed to it or a public one, with its own `acceptance`.
4189
+ */
4190
+ static getShare(options) {
4191
+ return (options.client ?? client).get({
4192
+ url: "/api/v1/shares/{share_id}",
4193
+ ...options
4194
+ });
4195
+ }
4196
+ /**
4197
+ * Update a share
4198
+ *
4199
+ * Changes a share's `cap`, as its publisher. The next call through the share reads the new cap; a changed `window` starts a fresh count.
4200
+ */
4201
+ static updateShare(options) {
4202
+ return (options.client ?? client).patch({
4203
+ url: "/api/v1/shares/{share_id}",
4204
+ ...options,
4205
+ headers: {
4206
+ "Content-Type": "application/json",
4207
+ ...options.headers
4208
+ }
4209
+ });
4210
+ }
4211
+ /**
4212
+ * Accept a share
4213
+ *
4214
+ * Records the grantee project's acceptance, which is what makes the share grant anything. Idempotent. A project that revoked its own acceptance may accept again; one whose acceptance the publisher revoked answers `403 SHARE_REVOKED` until the publisher deletes that acceptance. A suspended share can be accepted and grants nothing until resumed.
4215
+ */
4216
+ static acceptShare(options) {
4217
+ return (options.client ?? client).post({
4218
+ url: "/api/v1/shares/{share_id}/accept",
4219
+ ...options,
4220
+ headers: {
4221
+ "Content-Type": "application/json",
4222
+ ...options.headers
4223
+ }
4224
+ });
4225
+ }
4226
+ /**
4227
+ * Suspend a share
4228
+ *
4229
+ * Sets `suspended_at`, which denies every acceptance without removing any. Reversible with resume; nobody re-accepts. Each project with an active acceptance gets a `share_suspended` activity entry. Idempotent.
4230
+ */
4231
+ static suspendShare(options) {
4232
+ return (options.client ?? client).post({
4233
+ url: "/api/v1/shares/{share_id}/suspend",
4234
+ ...options
4235
+ });
4236
+ }
4237
+ /**
4238
+ * Resume a share
4239
+ *
4240
+ * Clears `suspended_at`. Each project with an active acceptance gets a `share_resumed` activity entry. Idempotent.
4241
+ */
4242
+ static resumeShare(options) {
4243
+ return (options.client ?? client).post({
4244
+ url: "/api/v1/shares/{share_id}/resume",
4245
+ ...options
4246
+ });
4247
+ }
4248
+ /**
4249
+ * Revoke a share
4250
+ *
4251
+ * As the publisher, revokes the whole share and every acceptance of it; terminal. Each project whose acceptance was active gets a `share_revoked` activity entry. As a grantee (`project_id`, or a credential scoped to it), revokes that project's own acceptance, which it may accept again later; while the project's own resources still name the shared resource (see `GET /api/v1/shares/{share_id}/references`), that answers `409 SHARE_IN_USE` unless `force=true`. A publisher's revoke is never refused on that account. Idempotent.
4252
+ */
4253
+ static revokeShare(options) {
4254
+ return (options.client ?? client).post({
4255
+ url: "/api/v1/shares/{share_id}/revoke",
4256
+ ...options,
4257
+ headers: {
4258
+ "Content-Type": "application/json",
4259
+ ...options.headers
4260
+ }
4261
+ });
4262
+ }
4263
+ /**
4264
+ * List a grantee's references to a shared resource
4265
+ *
4266
+ * The grantee project's own resources that name the resource the share grants: agents binding a shared tool, pipelines stepping through it, ingestion rules converting with it, orchestrations, triggers and formations naming it. What degrades if the project revokes its acceptance, and what `409 SHARE_IN_USE` lists. The grantee is named by `project_id` or by its scoped credential; the publisher holds none of these and is answered `400`.
4267
+ */
4268
+ static listShareReferences(options) {
4269
+ return (options.client ?? client).get({
4270
+ url: "/api/v1/shares/{share_id}/references",
4271
+ ...options
4272
+ });
4273
+ }
4274
+ /**
4275
+ * List a share's acceptances
4276
+ *
4277
+ * The projects that accepted the share, for its publisher.
4278
+ */
4279
+ static listShareAcceptances(options) {
4280
+ return (options.client ?? client).get({
4281
+ url: "/api/v1/shares/{share_id}/acceptances",
4282
+ ...options
4283
+ });
4284
+ }
4285
+ /**
4286
+ * Revoke an acceptance
4287
+ *
4288
+ * The publisher cutting one consumer. The acceptance is kept with `revoked_by: publisher`, and a new accept from that project answers `403 SHARE_REVOKED` until the publisher deletes it. The project gets a `share_revoked` activity entry if the acceptance was active.
4289
+ */
4290
+ static revokeShareAcceptance(options) {
4291
+ return (options.client ?? client).post({
4292
+ url: "/api/v1/shares/{share_id}/acceptances/{acceptance_id}/revoke",
4293
+ ...options
4294
+ });
4295
+ }
4296
+ /**
4297
+ * Delete an acceptance
4298
+ *
4299
+ * Removes one project's acceptance, which lets a project the publisher revoked accept again. The project gets a `share_revoked` activity entry if the acceptance was active.
4300
+ */
4301
+ static deleteShareAcceptance(options) {
4302
+ return (options.client ?? client).delete({
4303
+ url: "/api/v1/shares/{share_id}/acceptances/{acceptance_id}",
4304
+ ...options
4305
+ });
4306
+ }
4307
+ };
4144
4308
  var Tasks = class {
4145
4309
  /**
4146
4310
  * List tasks
@@ -4292,7 +4456,7 @@ var Tools = class {
4292
4456
  /**
4293
4457
  * Delete a tool
4294
4458
  *
4295
- * Deletes a tool by ID. A tool that is a decider's backend is refused with `409 TOOL_HAS_DEPENDENTS`.
4459
+ * Deletes a tool by ID. A tool that is a decider's backend is refused with `409 TOOL_HAS_DEPENDENTS`, and so is one another project has accepted a share of, or one of its own project's ingestion rules converts with, until `force=true`. Every share of the tool is revoked when it is deleted; an ingestion rule keeps its `tool_id` and fails the documents it matches with `CONVERTER_FAILED` until repointed.
4296
4460
  */
4297
4461
  static deleteTool(options) {
4298
4462
  return (options.client ?? client).delete({
@@ -4303,7 +4467,8 @@ var Tools = class {
4303
4467
  /**
4304
4468
  * Get a tool
4305
4469
  *
4306
- * Returns a single tool by ID.
4470
+ * Returns a single tool by ID. A credential scoped to a project the tool is shared with, through an accepted share, reads its `id`, `name`, `description` and `parameters` only.
4471
+ *
4307
4472
  */
4308
4473
  static getTool(options) {
4309
4474
  return (options.client ?? client).get({
@@ -4334,6 +4499,8 @@ var Tools = class {
4334
4499
  * `preset_parameters` stored on the tool are pinned over the caller-supplied `input` before execution: a key the tool presets keeps its preset value even when `input` sets it. Keys the presets do not name are taken from `input` as sent.
4335
4500
  * Guardrails attached to the tool or to its project adjudicate the call before dispatch, composing project + tool scope. A call this route cannot await a decision on — class C (human sign-off), class D, or a class-B tripwire — is refused with `422 TOOL_DISPATCH_FAILED`, whose `meta` carries the `tool_id` and the `outcome`. A `pipeline` tool is adjudicated before its first step runs, and every step is adjudicated as the call of that tool it is.
4336
4501
  *
4502
+ * A credential scoped to a project the tool is shared with, through an accepted share, calls it in that project: the calling project's guardrails adjudicate it, it is metered there with `publisher_project_id`, and the tool receives the calling project as the `calling_project_id` tool context key.
4503
+ *
4337
4504
  */
4338
4505
  static callTool(options) {
4339
4506
  return (options.client ?? client).post({
@@ -4541,9 +4708,9 @@ var Usage = class {
4541
4708
  /**
4542
4709
  * Get aggregated usage for a project
4543
4710
  *
4544
- * Returns a project's usage rolled up over an optional `[from, to]` time window, optionally bucketed by a single dimension and narrowed by any combination of fifteen filters — session, actor, agent, AI provider, orchestration run, orchestration, generation, trace, tool, meter type, model, source, trigger, action and outcome. That is how "what did this conversation cost", "what has this end user cost" and "what did this agent cost" are answered. Each group and the grand total carry an `event_count`, summed token counts, a measured `quantity` per component (so infra meters report their real amount, not zeros), and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw usage events client-side.
4711
+ * Returns a project's usage rolled up over an optional `[from, to]` time window, optionally bucketed by a single dimension and narrowed by any combination of sixteen filters — session, actor, agent, AI provider, orchestration run, orchestration, generation, trace, tool, publisher project, meter type, model, source, trigger, action and outcome. That is how "what did this conversation cost", "what has this end user cost" and "what did this agent cost" are answered. Each group and the grand total carry an `event_count`, summed token counts, a measured `quantity` per component (so infra meters report their real amount, not zeros), and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw usage events client-side.
4545
4712
  *
4546
- * Narrowings intersect and apply to the whole rollup — every bucket, `totals` and `totals.distinct` alike — so each composes with any `group_by`, and all fifteen are echoed back under `filters`. The nine naming a resource are resolved against the project, and one naming nothing there empties the rollup rather than being dropped: a mistyped id must never read back as the project's whole spend. The other six are matched against the value the event recorded.
4713
+ * Narrowings intersect and apply to the whole rollup — every bucket, `totals` and `totals.distinct` alike — so each composes with any `group_by`, and all sixteen are echoed back under `filters`. The ten naming a resource are resolved against the project (a tool also through an accepted share), and one naming nothing there empties the rollup rather than being dropped: a mistyped id must never read back as the project's whole spend. The other six are matched against the value the event recorded.
4547
4714
  *
4548
4715
  * `groups` is paginated. Its `total` is the number of distinct buckets in the window — bucket cardinality, including a null bucket for the events the dimension does not apply to, and never a count of entities. To count entities, send `include=distinct` and read `totals.distinct`. `totals` always describes the whole window — never the page above it, and never the bucketing: omit `group_by` and `totals` is unchanged while `groups` is empty.
4549
4716
  *
@@ -5051,6 +5218,7 @@ var SoatClient = class {
5051
5218
  quotas;
5052
5219
  secrets;
5053
5220
  sessions;
5221
+ shares;
5054
5222
  tasks;
5055
5223
  tools;
5056
5224
  traces;
@@ -5101,6 +5269,7 @@ var SoatClient = class {
5101
5269
  this.quotas = bindResource(Quotas, httpClient);
5102
5270
  this.secrets = bindResource(Secrets, httpClient);
5103
5271
  this.sessions = bindResource(Sessions, httpClient);
5272
+ this.shares = bindResource(Shares, httpClient);
5104
5273
  this.tasks = bindResource(Tasks, httpClient);
5105
5274
  this.tools = bindResource(Tools, httpClient);
5106
5275
  this.traces = bindResource(Traces, httpClient);
@@ -5145,6 +5314,7 @@ exports.Projects = Projects;
5145
5314
  exports.Quotas = Quotas;
5146
5315
  exports.Secrets = Secrets;
5147
5316
  exports.Sessions = Sessions;
5317
+ exports.Shares = Shares;
5148
5318
  exports.SoatClient = SoatClient;
5149
5319
  exports.Tasks = Tasks;
5150
5320
  exports.Tools = Tools;