samva 0.26.0 → 0.27.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
@@ -188,6 +188,7 @@ match the template's input schema. `samva templates types` generates TypeScript
188
188
 
189
189
  The Promise client exposes:
190
190
 
191
+ - `agents`
191
192
  - `analytics`
192
193
  - `apiKeys`
193
194
  - `attachments`
@@ -215,6 +216,7 @@ The Promise client exposes:
215
216
 
216
217
  The Effect SDK exposes Pascal-cased domain modules with lower-camel operations:
217
218
 
219
+ - `Agents`
218
220
  - `Analytics`
219
221
  - `ApiKeys`
220
222
  - `Attachments`
@@ -4616,6 +4616,250 @@ var Journeys = class {
4616
4616
  });
4617
4617
  }
4618
4618
  };
4619
+ var Agents = class {
4620
+ /**
4621
+ * List agents
4622
+ *
4623
+ * Returns the agents the caller can reach, newest first, without their drafts. Pass nextCursor back as cursor for the next page.
4624
+ */
4625
+ static list(parameters, options) {
4626
+ const params = buildClientParams([parameters], [{ args: [{
4627
+ in: "query",
4628
+ key: "limit"
4629
+ }, {
4630
+ in: "query",
4631
+ key: "cursor"
4632
+ }] }]);
4633
+ return (options?.client ?? client).get({
4634
+ security: [{
4635
+ name: "x-api-key",
4636
+ type: "apiKey"
4637
+ }],
4638
+ url: "/v1/agents",
4639
+ ...options,
4640
+ ...params
4641
+ });
4642
+ }
4643
+ /**
4644
+ * Create an agent
4645
+ *
4646
+ * Creates an agent with a draft and returns it with status 201. The agent answers nothing until its draft is published. A new agent starts in supervised mode, so each reply waits for a person to approve it. The namespace is set at creation and cannot change.
4647
+ */
4648
+ static create(parameters, options) {
4649
+ const params = buildClientParams([parameters], [{ args: [
4650
+ {
4651
+ in: "body",
4652
+ key: "name"
4653
+ },
4654
+ {
4655
+ in: "body",
4656
+ key: "namespaceId"
4657
+ },
4658
+ {
4659
+ in: "body",
4660
+ key: "definition"
4661
+ }
4662
+ ] }]);
4663
+ return (options?.client ?? client).post({
4664
+ security: [{
4665
+ name: "x-api-key",
4666
+ type: "apiKey"
4667
+ }],
4668
+ url: "/v1/agents",
4669
+ ...options,
4670
+ ...params,
4671
+ headers: {
4672
+ "Content-Type": "application/json",
4673
+ ...options?.headers,
4674
+ ...params.headers
4675
+ }
4676
+ });
4677
+ }
4678
+ /**
4679
+ * Delete an agent
4680
+ *
4681
+ * Deletes an agent with its draft and published versions. The endpoints it answered on stop being answered by an agent. A reply already running finishes on the version it started on.
4682
+ */
4683
+ static remove(parameters, options) {
4684
+ const params = buildClientParams([parameters], [{ args: [{
4685
+ in: "path",
4686
+ key: "id"
4687
+ }] }]);
4688
+ return (options?.client ?? client).delete({
4689
+ security: [{
4690
+ name: "x-api-key",
4691
+ type: "apiKey"
4692
+ }],
4693
+ url: "/v1/agents/{id}",
4694
+ ...options,
4695
+ ...params
4696
+ });
4697
+ }
4698
+ /**
4699
+ * Get an agent
4700
+ *
4701
+ * Returns an agent with its draft, its current revision, and its newest published version number.
4702
+ */
4703
+ static get(parameters, options) {
4704
+ const params = buildClientParams([parameters], [{ args: [{
4705
+ in: "path",
4706
+ key: "id"
4707
+ }] }]);
4708
+ return (options?.client ?? client).get({
4709
+ security: [{
4710
+ name: "x-api-key",
4711
+ type: "apiKey"
4712
+ }],
4713
+ url: "/v1/agents/{id}",
4714
+ ...options,
4715
+ ...params
4716
+ });
4717
+ }
4718
+ /**
4719
+ * Rename an agent
4720
+ *
4721
+ * Renames an agent.
4722
+ */
4723
+ static update(parameters, options) {
4724
+ const params = buildClientParams([parameters], [{ args: [{
4725
+ in: "path",
4726
+ key: "id"
4727
+ }, {
4728
+ in: "body",
4729
+ key: "name"
4730
+ }] }]);
4731
+ return (options?.client ?? client).patch({
4732
+ security: [{
4733
+ name: "x-api-key",
4734
+ type: "apiKey"
4735
+ }],
4736
+ url: "/v1/agents/{id}",
4737
+ ...options,
4738
+ ...params,
4739
+ headers: {
4740
+ "Content-Type": "application/json",
4741
+ ...options?.headers,
4742
+ ...params.headers
4743
+ }
4744
+ });
4745
+ }
4746
+ /**
4747
+ * Replace an agent draft
4748
+ *
4749
+ * Replaces the whole draft and returns the agent with a new revision. The request names the revision it read; a stale revision returns 409. Published versions, and the conversations answered on them, do not change. An endpoint answers for one agent at a time: a draft that names an endpoint another agent answers on returns 409.
4750
+ */
4751
+ static replaceDraft(parameters, options) {
4752
+ const params = buildClientParams([parameters], [{ args: [
4753
+ {
4754
+ in: "path",
4755
+ key: "id"
4756
+ },
4757
+ {
4758
+ in: "body",
4759
+ key: "revision"
4760
+ },
4761
+ {
4762
+ in: "body",
4763
+ key: "definition"
4764
+ }
4765
+ ] }]);
4766
+ return (options?.client ?? client).put({
4767
+ security: [{
4768
+ name: "x-api-key",
4769
+ type: "apiKey"
4770
+ }],
4771
+ url: "/v1/agents/{id}/draft",
4772
+ ...options,
4773
+ ...params,
4774
+ headers: {
4775
+ "Content-Type": "application/json",
4776
+ ...options?.headers,
4777
+ ...params.headers
4778
+ }
4779
+ });
4780
+ }
4781
+ /**
4782
+ * Publish an agent
4783
+ *
4784
+ * Publishes the draft as the next immutable version. Each conversation moves to it from its next agent reply; a reply already running finishes on the version it started on. The request names the revision it read; a stale revision returns 409. Publishing a draft identical to the newest version changes nothing and answers published false. An endpoint answers for one agent at a time: publishing a draft whose endpoint another agent answers on returns 409. In supervised mode each reply waits for a person to approve it.
4785
+ */
4786
+ static publish(parameters, options) {
4787
+ const params = buildClientParams([parameters], [{ args: [{
4788
+ in: "path",
4789
+ key: "id"
4790
+ }, {
4791
+ in: "body",
4792
+ key: "revision"
4793
+ }] }]);
4794
+ return (options?.client ?? client).post({
4795
+ security: [{
4796
+ name: "x-api-key",
4797
+ type: "apiKey"
4798
+ }],
4799
+ url: "/v1/agents/{id}/publish",
4800
+ ...options,
4801
+ ...params,
4802
+ headers: {
4803
+ "Content-Type": "application/json",
4804
+ ...options?.headers,
4805
+ ...params.headers
4806
+ }
4807
+ });
4808
+ }
4809
+ /**
4810
+ * List published agent versions
4811
+ *
4812
+ * Returns an agent's published versions, newest first, without their definitions. Pass nextCursor back as cursor for the next page.
4813
+ */
4814
+ static listVersions(parameters, options) {
4815
+ const params = buildClientParams([parameters], [{ args: [
4816
+ {
4817
+ in: "path",
4818
+ key: "id"
4819
+ },
4820
+ {
4821
+ in: "query",
4822
+ key: "limit"
4823
+ },
4824
+ {
4825
+ in: "query",
4826
+ key: "cursor"
4827
+ }
4828
+ ] }]);
4829
+ return (options?.client ?? client).get({
4830
+ security: [{
4831
+ name: "x-api-key",
4832
+ type: "apiKey"
4833
+ }],
4834
+ url: "/v1/agents/{id}/versions",
4835
+ ...options,
4836
+ ...params
4837
+ });
4838
+ }
4839
+ /**
4840
+ * Get a published agent version
4841
+ *
4842
+ * Returns the immutable definition of one published version.
4843
+ */
4844
+ static getVersion(parameters, options) {
4845
+ const params = buildClientParams([parameters], [{ args: [{
4846
+ in: "path",
4847
+ key: "id"
4848
+ }, {
4849
+ in: "path",
4850
+ key: "version"
4851
+ }] }]);
4852
+ return (options?.client ?? client).get({
4853
+ security: [{
4854
+ name: "x-api-key",
4855
+ type: "apiKey"
4856
+ }],
4857
+ url: "/v1/agents/{id}/versions/{version}",
4858
+ ...options,
4859
+ ...params
4860
+ });
4861
+ }
4862
+ };
4619
4863
  var Subscriptions = class {
4620
4864
  /**
4621
4865
  * Request subscription confirmation
@@ -10356,6 +10600,6 @@ var ExtensionInstallations = class {
10356
10600
  }
10357
10601
  };
10358
10602
  //#endregion
10359
- export { Analytics, ApiKeys, Attachments, Brands, Campaigns, ContactEvents, ContactGroups, Contacts, Conversations, CustomFields, Email, Events, ExtensionInstallations, Extensions, Feedback, Journeys, Mailboxes, Media, Messages, Namespaces, Operations, Organizations, ScheduledMessages, Subscriptions, Templates, Unsubscribe, Webhooks, Whoami };
10603
+ export { Agents, Analytics, ApiKeys, Attachments, Brands, Campaigns, ContactEvents, ContactGroups, Contacts, Conversations, CustomFields, Email, Events, ExtensionInstallations, Extensions, Feedback, Journeys, Mailboxes, Media, Messages, Namespaces, Operations, Organizations, ScheduledMessages, Subscriptions, Templates, Unsubscribe, Webhooks, Whoami };
10360
10604
 
10361
10605
  //# sourceMappingURL=sdk.gen.js.map
@@ -0,0 +1,121 @@
1
+ export declare const list: ((input?: {
2
+ readonly limit?: string | null | undefined;
3
+ readonly cursor?: string | null | undefined;
4
+ } | undefined) => import("./internal/operation").OperationResult<"agentsList">) & {
5
+ readonly pages: (input?: {
6
+ readonly limit?: string | null | undefined;
7
+ readonly cursor?: string | null | undefined;
8
+ } | undefined) => import("effect/Stream").Stream<{
9
+ readonly items: readonly {
10
+ readonly id: string & import("effect/Brand").Brand<"AgentId">;
11
+ readonly name: string;
12
+ readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
13
+ readonly publishedVersion: number | null;
14
+ readonly publishedAt: string | null;
15
+ readonly createdAt: string;
16
+ readonly updatedAt: string;
17
+ }[];
18
+ readonly nextCursor: string | null;
19
+ }, import("./errors").ForbiddenError | import("./errors").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors").InternalError | import("effect/Schema").SchemaError | import("./errors").UnauthorizedError | import("./errors").ValidationError, import("./client").Service>;
20
+ readonly items: (input?: {
21
+ readonly limit?: string | null | undefined;
22
+ readonly cursor?: string | null | undefined;
23
+ } | undefined) => import("effect/Stream").Stream<{
24
+ readonly id: string & import("effect/Brand").Brand<"AgentId">;
25
+ readonly name: string;
26
+ readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
27
+ readonly publishedVersion: number | null;
28
+ readonly publishedAt: string | null;
29
+ readonly createdAt: string;
30
+ readonly updatedAt: string;
31
+ }, import("./errors").ForbiddenError | import("./errors").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors").InternalError | import("effect/Schema").SchemaError | import("./errors").UnauthorizedError | import("./errors").ValidationError, import("./client").Service>;
32
+ };
33
+ export declare const create: (input: {
34
+ readonly name: string;
35
+ readonly namespaceId?: string | null | undefined;
36
+ readonly definition?: {
37
+ readonly instructions: string;
38
+ readonly knowledge: string;
39
+ readonly endpointIds: readonly string[];
40
+ readonly integrationIds: readonly string[];
41
+ readonly mode: "live" | "supervised";
42
+ readonly model: "max" | "standard";
43
+ readonly approvalPolicy: "none" | "toolActions";
44
+ readonly workingHours: {
45
+ readonly timeZone: string;
46
+ readonly ranges: readonly {
47
+ readonly day: "friday" | "monday" | "saturday" | "sunday" | "thursday" | "tuesday" | "wednesday";
48
+ readonly opens: string;
49
+ readonly closes: string;
50
+ }[];
51
+ } | null;
52
+ readonly takeoverTimeoutMinutes: number;
53
+ } | null | undefined;
54
+ }) => import("./internal/operation").OperationResult<"agentsCreate">;
55
+ export declare const get: (input: {
56
+ readonly id: string;
57
+ }) => import("./internal/operation").OperationResult<"agentsGet">;
58
+ export declare const update: (input: {
59
+ readonly id: string;
60
+ readonly name: string;
61
+ }) => import("./internal/operation").OperationResult<"agentsUpdate">;
62
+ export declare const remove: (input: {
63
+ readonly id: string;
64
+ }) => import("./internal/operation").OperationResult<"agentsRemove">;
65
+ export declare const replaceDraft: (input: {
66
+ readonly id: string;
67
+ readonly revision: string;
68
+ readonly definition: {
69
+ readonly instructions: string;
70
+ readonly knowledge: string;
71
+ readonly endpointIds: readonly string[];
72
+ readonly integrationIds: readonly string[];
73
+ readonly mode: "live" | "supervised";
74
+ readonly model: "max" | "standard";
75
+ readonly approvalPolicy: "none" | "toolActions";
76
+ readonly workingHours: {
77
+ readonly timeZone: string;
78
+ readonly ranges: readonly {
79
+ readonly day: "friday" | "monday" | "saturday" | "sunday" | "thursday" | "tuesday" | "wednesday";
80
+ readonly opens: string;
81
+ readonly closes: string;
82
+ }[];
83
+ } | null;
84
+ readonly takeoverTimeoutMinutes: number;
85
+ };
86
+ }) => import("./internal/operation").OperationResult<"agentsReplaceDraft">;
87
+ export declare const publish: (input: {
88
+ readonly id: string;
89
+ readonly revision: string;
90
+ }) => import("./internal/operation").OperationResult<"agentsPublish">;
91
+ export declare const listVersions: ((input: {
92
+ readonly id: string;
93
+ readonly limit?: string | null | undefined;
94
+ readonly cursor?: string | null | undefined;
95
+ }) => import("./internal/operation").OperationResult<"agentsListVersions">) & {
96
+ readonly pages: (input: {
97
+ readonly id: string;
98
+ readonly limit?: string | null | undefined;
99
+ readonly cursor?: string | null | undefined;
100
+ }) => import("effect/Stream").Stream<{
101
+ readonly items: readonly {
102
+ readonly agentId: string & import("effect/Brand").Brand<"AgentId">;
103
+ readonly version: number;
104
+ readonly publishedAt: string;
105
+ }[];
106
+ readonly nextCursor: string | null;
107
+ }, import("./errors").ForbiddenError | import("./errors").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors").InternalError | import("./errors").ResourceNotFoundError | import("effect/Schema").SchemaError | import("./errors").UnauthorizedError | import("./errors").ValidationError, import("./client").Service>;
108
+ readonly items: (input: {
109
+ readonly id: string;
110
+ readonly limit?: string | null | undefined;
111
+ readonly cursor?: string | null | undefined;
112
+ }) => import("effect/Stream").Stream<{
113
+ readonly agentId: string & import("effect/Brand").Brand<"AgentId">;
114
+ readonly version: number;
115
+ readonly publishedAt: string;
116
+ }, import("./errors").ForbiddenError | import("./errors").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors").InternalError | import("./errors").ResourceNotFoundError | import("effect/Schema").SchemaError | import("./errors").UnauthorizedError | import("./errors").ValidationError, import("./client").Service>;
117
+ };
118
+ export declare const getVersion: (input: {
119
+ readonly id: string;
120
+ readonly version: string;
121
+ }) => import("./internal/operation").OperationResult<"agentsGetVersion">;
@@ -0,0 +1,29 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { AgentsGroup } from "./generated/agents.js";
3
+ import { forGroup } from "./internal/operation.js";
4
+ //#region src/effect/agents.ts
5
+ var agents_exports = /* @__PURE__ */ __exportAll({
6
+ create: () => create,
7
+ get: () => get,
8
+ getVersion: () => getVersion,
9
+ list: () => list,
10
+ listVersions: () => listVersions,
11
+ publish: () => publish,
12
+ remove: () => remove,
13
+ replaceDraft: () => replaceDraft,
14
+ update: () => update
15
+ });
16
+ const make = /* @__PURE__ */ forGroup(AgentsGroup);
17
+ const list = /* @__PURE__ */ make("agentsList");
18
+ const create = /* @__PURE__ */ make("agentsCreate");
19
+ const get = /* @__PURE__ */ make("agentsGet");
20
+ const update = /* @__PURE__ */ make("agentsUpdate");
21
+ const remove = /* @__PURE__ */ make("agentsRemove");
22
+ const replaceDraft = /* @__PURE__ */ make("agentsReplaceDraft");
23
+ const publish = /* @__PURE__ */ make("agentsPublish");
24
+ const listVersions = /* @__PURE__ */ make("agentsListVersions");
25
+ const getVersion = /* @__PURE__ */ make("agentsGetVersion");
26
+ //#endregion
27
+ export { agents_exports, create, get, getVersion, list, listVersions, publish, remove, replaceDraft, update };
28
+
29
+ //# sourceMappingURL=agents.js.map
@@ -1,6 +1,6 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
- import { AnalyticsGroup } from "./generated/analytics.js";
3
2
  import { forGroup } from "./internal/operation.js";
3
+ import { AnalyticsGroup } from "./generated/analytics.js";
4
4
  //#region src/effect/analytics.ts
5
5
  var analytics_exports = /* @__PURE__ */ __exportAll({
6
6
  exportData: () => exportData,