@paddockai/server 0.0.3 → 0.0.5

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/dist/index.cjs CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/index.ts
@@ -33,9 +23,8 @@ __export(index_exports, {
33
23
  AgentResources: () => AgentResources,
34
24
  Agents: () => Agents,
35
25
  Collection: () => Collection,
36
- ConnectorResources: () => ConnectorResources,
37
- Connectors: () => Connectors,
38
26
  EventStream: () => EventStream,
27
+ Inbox: () => Inbox,
39
28
  Marketplaces: () => Marketplaces,
40
29
  ModelProviders: () => ModelProviders,
41
30
  Models: () => Models,
@@ -67,8 +56,10 @@ var streamEventNames = [
67
56
  "config.applied",
68
57
  "session.status",
69
58
  "outbox.queued",
59
+ "outbox.retrying",
70
60
  "outbox.delivered",
71
61
  "outbox.failed",
62
+ "inbox.failed",
72
63
  "status.update",
73
64
  "error"
74
65
  ];
@@ -569,9 +560,12 @@ var SessionOperations = class {
569
560
  get base() {
570
561
  return `/sessions/${segment(this.id)}`;
571
562
  }
572
- /** Stores a user message; resolves with its event once stored (002#operations_2). */
573
- send(text) {
574
- return this.transport.request({ method: "POST", path: `${this.base}/messages`, json: { text } });
563
+ /**
564
+ * Stores a user message; resolves with its event once stored (004#messages). author, the person
565
+ * the message speaks for, is allowed with an API key or a function token, never a session token.
566
+ */
567
+ send(text, options = {}) {
568
+ return this.transport.request({ method: "POST", path: `${this.base}/messages`, json: { text, ...options } });
575
569
  }
576
570
  /** Stores a stop.requested event and resolves with it. */
577
571
  stop() {
@@ -581,13 +575,15 @@ var SessionOperations = class {
581
575
  stream(options = {}) {
582
576
  return new EventStream(this.transport, `${this.base}/stream`, options);
583
577
  }
584
- /** Mints a session token for the browser. */
578
+ /**
579
+ * Mints a session token for the browser: ttl in seconds; participant authors the token's
580
+ * messages; readOnly makes a token that can only read and follow the session (004#credentials).
581
+ */
585
582
  createToken(options) {
586
- return this.transport.request({
587
- method: "POST",
588
- path: `${this.base}/tokens`,
589
- json: { ttlSeconds: options.ttl }
590
- });
583
+ const json = { ttlSeconds: options.ttl };
584
+ if (options.participant) json.participant = options.participant;
585
+ if (options.readOnly) json.readOnly = true;
586
+ return this.transport.request({ method: "POST", path: `${this.base}/tokens`, json });
591
587
  }
592
588
  /** Reads the session. */
593
589
  get() {
@@ -596,7 +592,7 @@ var SessionOperations = class {
596
592
  };
597
593
 
598
594
  // src/version.ts
599
- var version = "0.0.3";
595
+ var version = "0.0.5";
600
596
 
601
597
  // src/client.ts
602
598
  function nodeProcess() {
@@ -679,7 +675,7 @@ var Paddock = class {
679
675
  modelProviders;
680
676
  agents;
681
677
  sessions;
682
- connectors;
678
+ inbox;
683
679
  outbox;
684
680
  constructor(options = {}) {
685
681
  const { apiKey, baseUrl } = lookup(options);
@@ -696,7 +692,7 @@ var Paddock = class {
696
692
  this.modelProviders = new ModelProviders(transport);
697
693
  this.agents = new Agents(transport);
698
694
  this.sessions = new Sessions(transport);
699
- this.connectors = new Connectors(transport);
695
+ this.inbox = new Inbox(transport);
700
696
  this.outbox = new Outbox(transport);
701
697
  }
702
698
  };
@@ -706,18 +702,35 @@ var Templates = class {
706
702
  }
707
703
  t;
708
704
  /**
709
- * Saves a template document (013#template-document): a path sends the YAML file as
710
- * it is; a document is sent as JSON. The server assigns the version; a document equal
711
- * to the latest version returns that version. With dryRun, the server checks the
712
- * document and returns the version a create would return, storing nothing.
705
+ * Creates a template version from a bundle, the gzip tar that `paddock templates create DIR`
706
+ * builds from a template directory (014#build). secrets holds values of the template's
707
+ * template secrets. The server assigns the version; a bundle whose digest equals the latest
708
+ * version returns that version. With dryRun, the server checks everything and returns the
709
+ * version a create would return, storing nothing.
713
710
  */
714
- async create(pathOrDocument, options = {}) {
711
+ async create(bundle, options = {}) {
715
712
  const query = options.dryRun ? { dryRun: true } : void 0;
716
- if (typeof pathOrDocument !== "string")
717
- return this.t.request({ method: "POST", path: "/templates", query, json: pathOrDocument });
718
- const fs = await import("fs/promises");
719
- const yaml = await fs.readFile(pathOrDocument, "utf8");
720
- return this.t.request({ method: "POST", path: "/templates", query, body: yaml, contentType: "application/yaml" });
713
+ const form = new FormData();
714
+ const blob = bundle instanceof Blob ? bundle : new Blob([bundle], { type: "application/gzip" });
715
+ form.append("bundle", blob, "bundle.tar.gz");
716
+ if (options.secrets && Object.keys(options.secrets).length > 0)
717
+ form.append("secrets", JSON.stringify(options.secrets));
718
+ return this.t.request({ method: "POST", path: "/templates", query, body: form });
719
+ }
720
+ /** Each inbox entry of a template name's latest version with its template URL (010#endpoints). */
721
+ async inbox(name) {
722
+ return (await this.t.request({ method: "GET", path: `/templates/${segment(name)}/inbox` })).data;
723
+ }
724
+ /** A template name's template secrets, shared by its versions: names and set times, never values. */
725
+ secrets(name) {
726
+ const base = `/templates/${segment(name)}/secrets`;
727
+ return {
728
+ list: async () => (await this.t.request({ method: "GET", path: base })).data,
729
+ set: (secret, value) => this.t.request({ method: "PUT", path: `${base}/${segment(secret)}`, json: { value } }),
730
+ delete: async (secret) => {
731
+ await this.t.request({ method: "DELETE", path: `${base}/${segment(secret)}`, read: "none" });
732
+ }
733
+ };
721
734
  }
722
735
  /** "name@version" reads that version; "name" reads the latest. */
723
736
  get(ref) {
@@ -797,6 +810,11 @@ var Agents = class {
797
810
  this.t = t;
798
811
  }
799
812
  t;
813
+ /**
814
+ * Creates an agent from "name@version". env holds its own env values, which override the
815
+ * template's by name; secrets a value for every agent secret the template declares; harness,
816
+ * when given, replaces the template's harness block for this agent (014#harness-override).
817
+ */
800
818
  async create(options) {
801
819
  return agentHandle(this.t, await this.t.request({ method: "POST", path: "/agents", json: options }));
802
820
  }
@@ -897,8 +915,10 @@ var AgentResources = class {
897
915
  /** The value is null when neither the agent nor its template sets one. */
898
916
  systemPrompt;
899
917
  workflows;
900
- /** The agent's effective spec as a template document (013#export). */
918
+ /** The agent's effective configuration as paddock.yaml in JSON, secrets by name only. */
901
919
  export;
920
+ /** The agent's secrets: names and set times, never values. */
921
+ secrets;
902
922
  /**
903
923
  * Sends text to the agent's default session, its newest session whose defaultSession
904
924
  * metadata is "true", created on the first send; resolves with the stored user
@@ -906,8 +926,6 @@ var AgentResources = class {
906
926
  */
907
927
  send;
908
928
  permissions;
909
- /** The key patterns the agent may send to: its own list, or else the template's (015#allow). */
910
- outbox;
911
929
  memory;
912
930
  files;
913
931
  sessions;
@@ -923,16 +941,15 @@ var AgentResources = class {
923
941
  const workflows = new Collection(t, `${base}/workflows`);
924
942
  this.workflows = { list: (o) => workflows.list(o), get: (name) => workflows.get(name) };
925
943
  this.export = () => t.request({ method: "GET", path: `${base}/export` });
926
- this.send = (text) => t.request({ method: "POST", path: `${base}/messages`, json: { text } });
944
+ this.secrets = {
945
+ list: async () => (await t.request({ method: "GET", path: `${base}/secrets` })).data,
946
+ set: (name, value) => t.request({ method: "PUT", path: `${base}/secrets/${segment(name)}`, json: { value } })
947
+ };
948
+ this.send = (text, options = {}) => t.request({ method: "POST", path: `${base}/messages`, json: { text, ...options } });
927
949
  this.permissions = {
928
950
  get: () => t.request({ method: "GET", path: `${base}/permissions` }),
929
951
  set: (spec) => t.request({ method: "PUT", path: `${base}/permissions`, json: spec })
930
952
  };
931
- this.outbox = {
932
- get: () => t.request({ method: "GET", path: `${base}/outbox` }),
933
- set: (spec) => t.request({ method: "PUT", path: `${base}/outbox`, json: spec }),
934
- delete: () => t.request({ method: "DELETE", path: `${base}/outbox` })
935
- };
936
953
  const memoryPath = (p) => `${base}/memory/${segment(p, true)}`;
937
954
  this.memory = {
938
955
  list: () => t.request({ method: "GET", path: `${base}/memory`, timeoutMs: longTimeoutMs }),
@@ -980,7 +997,7 @@ var AgentResources = class {
980
997
  const page = await t.request({
981
998
  method: "GET",
982
999
  path: `${base}/sessions`,
983
- query: { metadata: o.metadata, limit: o.limit, cursor: cursor ?? o.cursor }
1000
+ query: { metadata: o.metadata, key: o.key, limit: o.limit, cursor: cursor ?? o.cursor }
984
1001
  });
985
1002
  return { ...page, data: page.data.map((s) => sessionHandle(t, s)) };
986
1003
  })
@@ -1018,6 +1035,7 @@ var Sessions = class {
1018
1035
  query: {
1019
1036
  agentId: options.agentId,
1020
1037
  metadata: options.metadata,
1038
+ key: options.key,
1021
1039
  createdAfter: options.createdAfter,
1022
1040
  createdBefore: options.createdBefore,
1023
1041
  limit: options.limit,
@@ -1034,116 +1052,43 @@ var Sessions = class {
1034
1052
  await this.t.request({ method: "DELETE", path: `/sessions/${segment(id)}`, read: "none" });
1035
1053
  }
1036
1054
  };
1037
- var Connectors = class {
1038
- constructor(t) {
1039
- this.t = t;
1040
- }
1041
- t;
1042
- /** Creates a connector with the sides given; the secret is generated when omitted. */
1043
- async create(spec) {
1044
- return connectorHandle(
1045
- this.t,
1046
- await this.t.request({ method: "POST", path: "/connectors", json: spec })
1047
- );
1048
- }
1049
- /** The connectors, newest first. */
1050
- list(options = {}) {
1051
- return new PageList(async (cursor) => {
1052
- const page = await this.t.request({
1053
- method: "GET",
1054
- path: "/connectors",
1055
- query: { limit: options.limit, cursor: cursor ?? options.cursor }
1056
- });
1057
- return { ...page, data: page.data.map((c) => connectorHandle(this.t, c)) };
1058
- });
1059
- }
1060
- /** By ID or by name. */
1061
- async get(idOrName) {
1062
- return connectorHandle(
1063
- this.t,
1064
- await this.t.request({ method: "GET", path: `/connectors/${segment(idOrName)}` })
1065
- );
1066
- }
1067
- /** Sets which sides exist and the outbound rate limit; a side omitted or null is removed with its function. */
1068
- async update(id, spec) {
1069
- return connectorHandle(
1070
- this.t,
1071
- await this.t.request({ method: "PUT", path: `/connectors/${segment(id)}`, json: spec })
1072
- );
1073
- }
1074
- /** Deletes its functions first; its URL answers 404 at once, and its deliveries and outbox messages are removed. */
1075
- async delete(id) {
1076
- await this.t.request({ method: "DELETE", path: `/connectors/${segment(id)}`, read: "none" });
1077
- }
1078
- /** Stock function code per side, in both runtimes, with the params each reads (015#presets). */
1079
- async functionPresets() {
1080
- const out = await this.t.request({
1081
- method: "GET",
1082
- path: "/connectors/function-presets"
1083
- });
1084
- return out.presets;
1085
- }
1086
- };
1087
- var ConnectorResources = class {
1088
- /** The connector's named secrets, whose values only these return; name defaults to "default". */
1089
- secret;
1090
- /** The code each side runs: inbound on every request, outbound on every message sent. */
1091
- functions;
1055
+ var Inbox = class {
1092
1056
  deliveries;
1093
- constructor(t, connectorId) {
1094
- const base = `/connectors/${segment(connectorId)}`;
1095
- this.secret = {
1096
- get: (o = {}) => t.request({ method: "GET", path: `${base}/secret`, query: { name: o.name } }),
1097
- rotate: (o = {}) => t.request({ method: "POST", path: `${base}/secret`, json: o }),
1098
- delete: async (o) => {
1099
- await t.request({ method: "DELETE", path: `${base}/secret`, query: { name: o.name }, read: "none" });
1100
- }
1101
- };
1102
- const fn = (side) => `${base}/functions/${segment(side)}`;
1103
- this.functions = {
1104
- get: (side) => t.request({ method: "GET", path: fn(side) }),
1105
- set: (side, spec) => t.request({ method: "PUT", path: fn(side), json: spec }),
1106
- delete: async (side) => {
1107
- await t.request({ method: "DELETE", path: fn(side), read: "none" });
1108
- },
1109
- test: (side, request) => t.request({ method: "POST", path: `${fn(side)}/test`, json: request })
1110
- };
1057
+ constructor(t) {
1111
1058
  this.deliveries = {
1112
1059
  list: (o = {}) => new PageList(
1113
1060
  (cursor) => t.request({
1114
1061
  method: "GET",
1115
- path: `${base}/deliveries`,
1116
- query: { status: o.status, limit: o.limit, cursor: cursor ?? o.cursor }
1062
+ path: "/inbox/deliveries",
1063
+ query: {
1064
+ template: o.template,
1065
+ entry: o.entry,
1066
+ agentId: o.agentId,
1067
+ status: o.status,
1068
+ limit: o.limit,
1069
+ cursor: cursor ?? o.cursor
1070
+ }
1117
1071
  })
1118
1072
  ),
1119
- get: (id) => t.request({ method: "GET", path: `${base}/deliveries/${segment(id)}` }),
1120
- replay: (id) => t.request({ method: "POST", path: `${base}/deliveries/${segment(id)}/replay` })
1073
+ get: (id) => t.request({ method: "GET", path: `/inbox/deliveries/${segment(id)}` }),
1074
+ replay: (id) => t.request({ method: "POST", path: `/inbox/deliveries/${segment(id)}/replay` })
1121
1075
  };
1122
1076
  }
1123
1077
  };
1124
- function connectorHandle(t, connector) {
1125
- const resources = new ConnectorResources(t, connector.id);
1126
- const handle = { ...connector };
1127
- for (const [name, value] of Object.entries(resources)) {
1128
- Object.defineProperty(handle, name, { value, enumerable: false });
1129
- }
1130
- return handle;
1131
- }
1132
1078
  var Outbox = class {
1133
1079
  constructor(t) {
1134
1080
  this.t = t;
1135
1081
  }
1136
1082
  t;
1137
- /** Newest first by createdAt; every filter given must match. */
1083
+ /** Outbox messages newest first; every filter left out matches all. */
1138
1084
  list(options = {}) {
1139
1085
  return new PageList(
1140
1086
  (cursor) => this.t.request({
1141
1087
  method: "GET",
1142
1088
  path: "/outbox",
1143
1089
  query: {
1144
- connectorId: options.connectorId,
1090
+ agentId: options.agentId,
1145
1091
  sessionId: options.sessionId,
1146
- key: options.key,
1147
1092
  status: options.status,
1148
1093
  limit: options.limit,
1149
1094
  cursor: cursor ?? options.cursor
@@ -1151,10 +1096,11 @@ var Outbox = class {
1151
1096
  })
1152
1097
  );
1153
1098
  }
1099
+ /** A message with each entry's deliver step and each target input's status, attempts, and last answer. */
1154
1100
  get(id) {
1155
1101
  return this.t.request({ method: "GET", path: `/outbox/${segment(id)}` });
1156
1102
  }
1157
- /** Queues a failed message again with the same ID. */
1103
+ /** Queues the message's failed steps again with their idempotency keys and their places in order. */
1158
1104
  retry(id) {
1159
1105
  return this.t.request({ method: "POST", path: `/outbox/${segment(id)}/retry` });
1160
1106
  }
@@ -1164,9 +1110,8 @@ var Outbox = class {
1164
1110
  AgentResources,
1165
1111
  Agents,
1166
1112
  Collection,
1167
- ConnectorResources,
1168
- Connectors,
1169
1113
  EventStream,
1114
+ Inbox,
1170
1115
  Marketplaces,
1171
1116
  ModelProviders,
1172
1117
  Models,