@cadenya/cadenya 0.42.0 → 0.44.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +4 -4
  3. package/client.d.mts +15 -3
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +15 -3
  6. package/client.d.ts.map +1 -1
  7. package/client.js +11 -1
  8. package/client.js.map +1 -1
  9. package/client.mjs +12 -2
  10. package/client.mjs.map +1 -1
  11. package/package.json +4 -2
  12. package/resources/account.d.mts +38 -1
  13. package/resources/account.d.mts.map +1 -1
  14. package/resources/account.d.ts +38 -1
  15. package/resources/account.d.ts.map +1 -1
  16. package/resources/account.js +6 -0
  17. package/resources/account.js.map +1 -1
  18. package/resources/account.mjs +6 -0
  19. package/resources/account.mjs.map +1 -1
  20. package/resources/{agents/variations.d.ts → agent-variations.d.mts} +84 -47
  21. package/resources/agent-variations.d.mts.map +1 -0
  22. package/resources/{agents/variations.d.mts → agent-variations.d.ts} +84 -47
  23. package/resources/agent-variations.d.ts.map +1 -0
  24. package/resources/{agents/variations.js → agent-variations.js} +29 -8
  25. package/resources/agent-variations.js.map +1 -0
  26. package/resources/{agents/variations.mjs → agent-variations.mjs} +27 -6
  27. package/resources/agent-variations.mjs.map +1 -0
  28. package/resources/agents/agents.d.mts +2 -11
  29. package/resources/agents/agents.d.mts.map +1 -1
  30. package/resources/agents/agents.d.ts +2 -11
  31. package/resources/agents/agents.d.ts.map +1 -1
  32. package/resources/agents/agents.js +0 -4
  33. package/resources/agents/agents.js.map +1 -1
  34. package/resources/agents/agents.mjs +0 -4
  35. package/resources/agents/agents.mjs.map +1 -1
  36. package/resources/agents/index.d.mts +0 -1
  37. package/resources/agents/index.d.mts.map +1 -1
  38. package/resources/agents/index.d.ts +0 -1
  39. package/resources/agents/index.d.ts.map +1 -1
  40. package/resources/agents/index.js +1 -3
  41. package/resources/agents/index.js.map +1 -1
  42. package/resources/agents/index.mjs +0 -1
  43. package/resources/agents/index.mjs.map +1 -1
  44. package/resources/index.d.mts +3 -1
  45. package/resources/index.d.mts.map +1 -1
  46. package/resources/index.d.ts +3 -1
  47. package/resources/index.d.ts.map +1 -1
  48. package/resources/index.js +5 -1
  49. package/resources/index.js.map +1 -1
  50. package/resources/index.mjs +3 -1
  51. package/resources/index.mjs.map +1 -1
  52. package/resources/objectives/feedback.d.mts +6 -6
  53. package/resources/objectives/feedback.d.ts +6 -6
  54. package/resources/objectives/objectives.d.mts +3 -3
  55. package/resources/objectives/objectives.d.mts.map +1 -1
  56. package/resources/objectives/objectives.d.ts +3 -3
  57. package/resources/objectives/objectives.d.ts.map +1 -1
  58. package/resources/objectives/tasks.d.mts +7 -7
  59. package/resources/objectives/tasks.d.ts +7 -7
  60. package/resources/objectives/tool-calls.d.mts +3 -2
  61. package/resources/objectives/tool-calls.d.mts.map +1 -1
  62. package/resources/objectives/tool-calls.d.ts +3 -2
  63. package/resources/objectives/tool-calls.d.ts.map +1 -1
  64. package/resources/objectives/tools.d.mts +6 -6
  65. package/resources/objectives/tools.d.ts +6 -6
  66. package/resources/shared.d.mts +13 -7
  67. package/resources/shared.d.mts.map +1 -1
  68. package/resources/shared.d.ts +13 -7
  69. package/resources/shared.d.ts.map +1 -1
  70. package/resources/webhooks.d.mts +116 -0
  71. package/resources/webhooks.d.mts.map +1 -0
  72. package/resources/webhooks.d.ts +116 -0
  73. package/resources/webhooks.d.ts.map +1 -0
  74. package/resources/webhooks.js +23 -0
  75. package/resources/webhooks.js.map +1 -0
  76. package/resources/webhooks.mjs +19 -0
  77. package/resources/webhooks.mjs.map +1 -0
  78. package/src/client.ts +78 -1
  79. package/src/resources/account.ts +44 -0
  80. package/src/resources/{agents/variations.ts → agent-variations.ts} +130 -61
  81. package/src/resources/agents/agents.ts +2 -54
  82. package/src/resources/agents/index.ts +0 -21
  83. package/src/resources/index.ts +32 -1
  84. package/src/resources/objectives/feedback.ts +6 -6
  85. package/src/resources/objectives/objectives.ts +3 -3
  86. package/src/resources/objectives/tasks.ts +7 -7
  87. package/src/resources/objectives/tool-calls.ts +3 -2
  88. package/src/resources/objectives/tools.ts +6 -6
  89. package/src/resources/shared.ts +14 -7
  90. package/src/resources/webhooks.ts +156 -0
  91. package/src/version.ts +1 -1
  92. package/version.d.mts +1 -1
  93. package/version.d.ts +1 -1
  94. package/version.js +1 -1
  95. package/version.mjs +1 -1
  96. package/resources/agents/variations.d.mts.map +0 -1
  97. package/resources/agents/variations.d.ts.map +0 -1
  98. package/resources/agents/variations.js.map +0 -1
  99. package/resources/agents/variations.mjs.map +0 -1
@@ -0,0 +1,116 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import * as Shared from "./shared.mjs";
3
+ import * as ObjectivesAPI from "./objectives/objectives.mjs";
4
+ export declare class Webhooks extends APIResource {
5
+ unsafeUnwrap(body: string): UnsafeUnwrapWebhookEvent;
6
+ unwrap(body: string, { headers, key }: {
7
+ headers: Record<string, string>;
8
+ key?: string;
9
+ }): UnwrapWebhookEvent;
10
+ }
11
+ /**
12
+ * The envelope for an objective event webhook delivery. Contains timestamp, event
13
+ * type, and the webhook data payload.
14
+ */
15
+ export interface UnsafeUnwrapWebhookEvent {
16
+ /**
17
+ * The webhook data payload with flat top-level keys for agent, variation,
18
+ * objective, and event.
19
+ */
20
+ data: UnsafeUnwrapWebhookEvent.Data;
21
+ timestamp: string;
22
+ /**
23
+ * The event type, prefixed with objective_event. (e.g.,
24
+ * objective_event.tool_result)
25
+ */
26
+ type: string;
27
+ }
28
+ export declare namespace UnsafeUnwrapWebhookEvent {
29
+ /**
30
+ * The webhook data payload with flat top-level keys for agent, variation,
31
+ * objective, and event.
32
+ */
33
+ interface Data {
34
+ /**
35
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
36
+ */
37
+ agent: Shared.ResourceMetadata;
38
+ /**
39
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
40
+ */
41
+ agentVariation: Shared.ResourceMetadata;
42
+ /**
43
+ * Metadata for ephemeral operations and activities (e.g., objectives, executions,
44
+ * runs)
45
+ */
46
+ objective: Shared.OperationMetadata;
47
+ objectiveEvent: Data.ObjectiveEvent;
48
+ }
49
+ namespace Data {
50
+ interface ObjectiveEvent {
51
+ data: ObjectivesAPI.ObjectiveEventData;
52
+ /**
53
+ * Metadata for ephemeral operations and activities (e.g., objectives, executions,
54
+ * runs)
55
+ */
56
+ metadata: Shared.OperationMetadata;
57
+ contextWindowId?: string;
58
+ info?: ObjectivesAPI.ObjectiveEventInfo;
59
+ }
60
+ }
61
+ }
62
+ /**
63
+ * The envelope for an objective event webhook delivery. Contains timestamp, event
64
+ * type, and the webhook data payload.
65
+ */
66
+ export interface UnwrapWebhookEvent {
67
+ /**
68
+ * The webhook data payload with flat top-level keys for agent, variation,
69
+ * objective, and event.
70
+ */
71
+ data: UnwrapWebhookEvent.Data;
72
+ timestamp: string;
73
+ /**
74
+ * The event type, prefixed with objective_event. (e.g.,
75
+ * objective_event.tool_result)
76
+ */
77
+ type: string;
78
+ }
79
+ export declare namespace UnwrapWebhookEvent {
80
+ /**
81
+ * The webhook data payload with flat top-level keys for agent, variation,
82
+ * objective, and event.
83
+ */
84
+ interface Data {
85
+ /**
86
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
87
+ */
88
+ agent: Shared.ResourceMetadata;
89
+ /**
90
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
91
+ */
92
+ agentVariation: Shared.ResourceMetadata;
93
+ /**
94
+ * Metadata for ephemeral operations and activities (e.g., objectives, executions,
95
+ * runs)
96
+ */
97
+ objective: Shared.OperationMetadata;
98
+ objectiveEvent: Data.ObjectiveEvent;
99
+ }
100
+ namespace Data {
101
+ interface ObjectiveEvent {
102
+ data: ObjectivesAPI.ObjectiveEventData;
103
+ /**
104
+ * Metadata for ephemeral operations and activities (e.g., objectives, executions,
105
+ * runs)
106
+ */
107
+ metadata: Shared.OperationMetadata;
108
+ contextWindowId?: string;
109
+ info?: ObjectivesAPI.ObjectiveEventInfo;
110
+ }
111
+ }
112
+ }
113
+ export declare namespace Webhooks {
114
+ export { type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent, type UnwrapWebhookEvent as UnwrapWebhookEvent, };
115
+ }
116
+ //# sourceMappingURL=webhooks.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.mts","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,KAAK,aAAa;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB;IAIpD,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAClE,kBAAkB;CAStB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,IAAI,EAAE,wBAAwB,CAAC,IAAI,CAAC;IAEpC,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yBAAiB,wBAAwB,CAAC;IACxC;;;OAGG;IACH,UAAiB,IAAI;QACnB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAE/B;;WAEG;QACH,cAAc,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAExC;;;WAGG;QACH,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC;QAEpC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC;KACrC;IAED,UAAiB,IAAI,CAAC;QACpB,UAAiB,cAAc;YAC7B,IAAI,EAAE,aAAa,CAAC,kBAAkB,CAAC;YAEvC;;;eAGG;YACH,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC;YAEnC,eAAe,CAAC,EAAE,MAAM,CAAC;YAEzB,IAAI,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC;SACzC;KACF;CACF;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC;IAE9B,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yBAAiB,kBAAkB,CAAC;IAClC;;;OAGG;IACH,UAAiB,IAAI;QACnB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAE/B;;WAEG;QACH,cAAc,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAExC;;;WAGG;QACH,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC;QAEpC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC;KACrC;IAED,UAAiB,IAAI,CAAC;QACpB,UAAiB,cAAc;YAC7B,IAAI,EAAE,aAAa,CAAC,kBAAkB,CAAC;YAEvC;;;eAGG;YACH,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC;YAEnC,eAAe,CAAC,EAAE,MAAM,CAAC;YAEzB,IAAI,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC;SACzC;KACF;CACF;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
@@ -0,0 +1,116 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as Shared from "./shared.js";
3
+ import * as ObjectivesAPI from "./objectives/objectives.js";
4
+ export declare class Webhooks extends APIResource {
5
+ unsafeUnwrap(body: string): UnsafeUnwrapWebhookEvent;
6
+ unwrap(body: string, { headers, key }: {
7
+ headers: Record<string, string>;
8
+ key?: string;
9
+ }): UnwrapWebhookEvent;
10
+ }
11
+ /**
12
+ * The envelope for an objective event webhook delivery. Contains timestamp, event
13
+ * type, and the webhook data payload.
14
+ */
15
+ export interface UnsafeUnwrapWebhookEvent {
16
+ /**
17
+ * The webhook data payload with flat top-level keys for agent, variation,
18
+ * objective, and event.
19
+ */
20
+ data: UnsafeUnwrapWebhookEvent.Data;
21
+ timestamp: string;
22
+ /**
23
+ * The event type, prefixed with objective_event. (e.g.,
24
+ * objective_event.tool_result)
25
+ */
26
+ type: string;
27
+ }
28
+ export declare namespace UnsafeUnwrapWebhookEvent {
29
+ /**
30
+ * The webhook data payload with flat top-level keys for agent, variation,
31
+ * objective, and event.
32
+ */
33
+ interface Data {
34
+ /**
35
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
36
+ */
37
+ agent: Shared.ResourceMetadata;
38
+ /**
39
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
40
+ */
41
+ agentVariation: Shared.ResourceMetadata;
42
+ /**
43
+ * Metadata for ephemeral operations and activities (e.g., objectives, executions,
44
+ * runs)
45
+ */
46
+ objective: Shared.OperationMetadata;
47
+ objectiveEvent: Data.ObjectiveEvent;
48
+ }
49
+ namespace Data {
50
+ interface ObjectiveEvent {
51
+ data: ObjectivesAPI.ObjectiveEventData;
52
+ /**
53
+ * Metadata for ephemeral operations and activities (e.g., objectives, executions,
54
+ * runs)
55
+ */
56
+ metadata: Shared.OperationMetadata;
57
+ contextWindowId?: string;
58
+ info?: ObjectivesAPI.ObjectiveEventInfo;
59
+ }
60
+ }
61
+ }
62
+ /**
63
+ * The envelope for an objective event webhook delivery. Contains timestamp, event
64
+ * type, and the webhook data payload.
65
+ */
66
+ export interface UnwrapWebhookEvent {
67
+ /**
68
+ * The webhook data payload with flat top-level keys for agent, variation,
69
+ * objective, and event.
70
+ */
71
+ data: UnwrapWebhookEvent.Data;
72
+ timestamp: string;
73
+ /**
74
+ * The event type, prefixed with objective_event. (e.g.,
75
+ * objective_event.tool_result)
76
+ */
77
+ type: string;
78
+ }
79
+ export declare namespace UnwrapWebhookEvent {
80
+ /**
81
+ * The webhook data payload with flat top-level keys for agent, variation,
82
+ * objective, and event.
83
+ */
84
+ interface Data {
85
+ /**
86
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
87
+ */
88
+ agent: Shared.ResourceMetadata;
89
+ /**
90
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
91
+ */
92
+ agentVariation: Shared.ResourceMetadata;
93
+ /**
94
+ * Metadata for ephemeral operations and activities (e.g., objectives, executions,
95
+ * runs)
96
+ */
97
+ objective: Shared.OperationMetadata;
98
+ objectiveEvent: Data.ObjectiveEvent;
99
+ }
100
+ namespace Data {
101
+ interface ObjectiveEvent {
102
+ data: ObjectivesAPI.ObjectiveEventData;
103
+ /**
104
+ * Metadata for ephemeral operations and activities (e.g., objectives, executions,
105
+ * runs)
106
+ */
107
+ metadata: Shared.OperationMetadata;
108
+ contextWindowId?: string;
109
+ info?: ObjectivesAPI.ObjectiveEventInfo;
110
+ }
111
+ }
112
+ }
113
+ export declare namespace Webhooks {
114
+ export { type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent, type UnwrapWebhookEvent as UnwrapWebhookEvent, };
115
+ }
116
+ //# sourceMappingURL=webhooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,KAAK,aAAa;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB;IAIpD,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAClE,kBAAkB;CAStB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,IAAI,EAAE,wBAAwB,CAAC,IAAI,CAAC;IAEpC,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yBAAiB,wBAAwB,CAAC;IACxC;;;OAGG;IACH,UAAiB,IAAI;QACnB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAE/B;;WAEG;QACH,cAAc,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAExC;;;WAGG;QACH,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC;QAEpC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC;KACrC;IAED,UAAiB,IAAI,CAAC;QACpB,UAAiB,cAAc;YAC7B,IAAI,EAAE,aAAa,CAAC,kBAAkB,CAAC;YAEvC;;;eAGG;YACH,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC;YAEnC,eAAe,CAAC,EAAE,MAAM,CAAC;YAEzB,IAAI,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC;SACzC;KACF;CACF;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC;IAE9B,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yBAAiB,kBAAkB,CAAC;IAClC;;;OAGG;IACH,UAAiB,IAAI;QACnB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAE/B;;WAEG;QACH,cAAc,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAExC;;;WAGG;QACH,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC;QAEpC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC;KACrC;IAED,UAAiB,IAAI,CAAC;QACpB,UAAiB,cAAc;YAC7B,IAAI,EAAE,aAAa,CAAC,kBAAkB,CAAC;YAEvC;;;eAGG;YACH,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC;YAEnC,eAAe,CAAC,EAAE,MAAM,CAAC;YAEzB,IAAI,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC;SACzC;KACF;CACF;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Webhooks = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const standardwebhooks_1 = require("standardwebhooks");
7
+ class Webhooks extends resource_1.APIResource {
8
+ unsafeUnwrap(body) {
9
+ return JSON.parse(body);
10
+ }
11
+ unwrap(body, { headers, key }) {
12
+ if (headers !== undefined) {
13
+ const keyStr = key === undefined ? this._client.webhookKey : key;
14
+ if (keyStr === null)
15
+ throw new Error('Webhook key must not be null in order to unwrap');
16
+ const wh = new standardwebhooks_1.Webhook(keyStr);
17
+ wh.verify(body, headers);
18
+ }
19
+ return JSON.parse(body);
20
+ }
21
+ }
22
+ exports.Webhooks = Webhooks;
23
+ //# sourceMappingURL=webhooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,uDAA2C;AAE3C,MAAa,QAAS,SAAQ,sBAAW;IACvC,YAAY,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAA6B,CAAC;IACtD,CAAC;IAED,MAAM,CACJ,IAAY,EACZ,EAAE,OAAO,EAAE,GAAG,EAAqD;QAEnE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,MAAM,GAAkB,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;YAChF,IAAI,MAAM,KAAK,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;YACxF,MAAM,EAAE,GAAG,IAAI,0BAAO,CAAC,MAAM,CAAC,CAAC;YAC/B,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAC;IAChD,CAAC;CACF;AAjBD,4BAiBC"}
@@ -0,0 +1,19 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ import { Webhook } from 'standardwebhooks';
4
+ export class Webhooks extends APIResource {
5
+ unsafeUnwrap(body) {
6
+ return JSON.parse(body);
7
+ }
8
+ unwrap(body, { headers, key }) {
9
+ if (headers !== undefined) {
10
+ const keyStr = key === undefined ? this._client.webhookKey : key;
11
+ if (keyStr === null)
12
+ throw new Error('Webhook key must not be null in order to unwrap');
13
+ const wh = new Webhook(keyStr);
14
+ wh.verify(body, headers);
15
+ }
16
+ return JSON.parse(body);
17
+ }
18
+ }
19
+ //# sourceMappingURL=webhooks.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.mjs","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,OAAO,EAAE,MAAM,kBAAkB;AAE1C,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC,YAAY,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAA6B,CAAC;IACtD,CAAC;IAED,MAAM,CACJ,IAAY,EACZ,EAAE,OAAO,EAAE,GAAG,EAAqD;QAEnE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,MAAM,GAAkB,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;YAChF,IAAI,MAAM,KAAK,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;YACxF,MAAM,EAAE,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;YAC/B,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAC;IAChD,CAAC;CACF"}
package/src/client.ts CHANGED
@@ -19,7 +19,37 @@ import { AbstractPage, type CursorPaginationParams, CursorPaginationResponse } f
19
19
  import * as Uploads from './core/uploads';
20
20
  import * as API from './resources/index';
21
21
  import { APIPromise } from './core/api-promise';
22
- import { Account, AccountResource, AccountSpec, Profile, ProfileSpec } from './resources/account';
22
+ import {
23
+ Account,
24
+ AccountResource,
25
+ AccountSpec,
26
+ Profile,
27
+ ProfileSpec,
28
+ RotateWebhookSigningKeyResponse,
29
+ } from './resources/account';
30
+ import {
31
+ AgentVariation,
32
+ AgentVariationAddAssignmentParams,
33
+ AgentVariationCreateParams,
34
+ AgentVariationDeleteParams,
35
+ AgentVariationInfo,
36
+ AgentVariationListParams,
37
+ AgentVariationRemoveAssignmentParams,
38
+ AgentVariationRetrieveParams,
39
+ AgentVariationSpec,
40
+ AgentVariationSpecCompactionConfig,
41
+ AgentVariationSpecConstraints,
42
+ AgentVariationSpecModelConfig,
43
+ AgentVariationSpecToolSelection,
44
+ AgentVariationUpdateParams,
45
+ AgentVariations,
46
+ AgentVariationsCursorPagination,
47
+ CompactionConfigSummarizationStrategy,
48
+ CompactionConfigToolResultClearingStrategy,
49
+ ToolSelectionAssignedTools,
50
+ ToolSelectionAutoDiscovery,
51
+ VariationAssignment,
52
+ } from './resources/agent-variations';
23
53
  import {
24
54
  APIKey,
25
55
  APIKeyCreateParams,
@@ -43,6 +73,7 @@ import {
43
73
  SearchSearchToolsOrToolSetsParams,
44
74
  SearchSearchToolsOrToolSetsResponse,
45
75
  } from './resources/search';
76
+ import { UnsafeUnwrapWebhookEvent, UnwrapWebhookEvent, Webhooks } from './resources/webhooks';
46
77
  import {
47
78
  WorkspaceSecret,
48
79
  WorkspaceSecretCreateParams,
@@ -150,6 +181,11 @@ export interface ClientOptions {
150
181
  */
151
182
  apiKey?: string | undefined;
152
183
 
184
+ /**
185
+ * Defaults to process.env['CADENYA_WEBHOOK_KEY'].
186
+ */
187
+ webhookKey?: string | null | undefined;
188
+
153
189
  /**
154
190
  * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
155
191
  *
@@ -224,6 +260,7 @@ export interface ClientOptions {
224
260
  */
225
261
  export class Cadenya {
226
262
  apiKey: string;
263
+ webhookKey: string | null;
227
264
 
228
265
  baseURL: string;
229
266
  maxRetries: number;
@@ -241,6 +278,7 @@ export class Cadenya {
241
278
  * API Client for interfacing with the Cadenya API.
242
279
  *
243
280
  * @param {string | undefined} [opts.apiKey=process.env['CADENYA_API_KEY'] ?? undefined]
281
+ * @param {string | null | undefined} [opts.webhookKey=process.env['CADENYA_WEBHOOK_KEY'] ?? null]
244
282
  * @param {string} [opts.baseURL=process.env['CADENYA_BASE_URL'] ?? https://api.cadenya.com] - Override the default base URL for the API.
245
283
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
246
284
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
@@ -252,6 +290,7 @@ export class Cadenya {
252
290
  constructor({
253
291
  baseURL = readEnv('CADENYA_BASE_URL'),
254
292
  apiKey = readEnv('CADENYA_API_KEY'),
293
+ webhookKey = readEnv('CADENYA_WEBHOOK_KEY') ?? null,
255
294
  ...opts
256
295
  }: ClientOptions = {}) {
257
296
  if (apiKey === undefined) {
@@ -262,6 +301,7 @@ export class Cadenya {
262
301
 
263
302
  const options: ClientOptions = {
264
303
  apiKey,
304
+ webhookKey,
265
305
  ...opts,
266
306
  baseURL: baseURL || `https://api.cadenya.com`,
267
307
  };
@@ -284,6 +324,7 @@ export class Cadenya {
284
324
  this._options = options;
285
325
 
286
326
  this.apiKey = apiKey;
327
+ this.webhookKey = webhookKey;
287
328
  }
288
329
 
289
330
  /**
@@ -300,6 +341,7 @@ export class Cadenya {
300
341
  fetch: this.fetch,
301
342
  fetchOptions: this.fetchOptions,
302
343
  apiKey: this.apiKey,
344
+ webhookKey: this.webhookKey,
303
345
  ...options,
304
346
  });
305
347
  return client;
@@ -873,6 +915,7 @@ export class Cadenya {
873
915
  * Scope: Workspace-level operations
874
916
  */
875
917
  agents: API.Agents = new API.Agents(this);
918
+ agentVariations: API.AgentVariations = new API.AgentVariations(this);
876
919
  objectives: API.Objectives = new API.Objectives(this);
877
920
  /**
878
921
  * ModelService manages LLM models at the WORKSPACE level.
@@ -915,10 +958,12 @@ export class Cadenya {
915
958
  * Scope: Account-level operations (manages workspaces themselves, not resources within workspaces)
916
959
  */
917
960
  workspaces: API.Workspaces = new API.Workspaces(this);
961
+ webhooks: API.Webhooks = new API.Webhooks(this);
918
962
  }
919
963
 
920
964
  Cadenya.AccountResource = AccountResource;
921
965
  Cadenya.Agents = Agents;
966
+ Cadenya.AgentVariations = AgentVariations;
922
967
  Cadenya.Objectives = Objectives;
923
968
  Cadenya.Models = Models;
924
969
  Cadenya.Search = Search;
@@ -926,6 +971,7 @@ Cadenya.ToolSets = ToolSets;
926
971
  Cadenya.APIKeys = APIKeys;
927
972
  Cadenya.WorkspaceSecrets = WorkspaceSecrets;
928
973
  Cadenya.Workspaces = Workspaces;
974
+ Cadenya.Webhooks = Webhooks;
929
975
 
930
976
  export declare namespace Cadenya {
931
977
  export type RequestOptions = Opts.RequestOptions;
@@ -942,6 +988,7 @@ export declare namespace Cadenya {
942
988
  type AccountSpec as AccountSpec,
943
989
  type Profile as Profile,
944
990
  type ProfileSpec as ProfileSpec,
991
+ type RotateWebhookSigningKeyResponse as RotateWebhookSigningKeyResponse,
945
992
  };
946
993
 
947
994
  export {
@@ -956,6 +1003,30 @@ export declare namespace Cadenya {
956
1003
  type AgentListParams as AgentListParams,
957
1004
  };
958
1005
 
1006
+ export {
1007
+ AgentVariations as AgentVariations,
1008
+ type AgentVariation as AgentVariation,
1009
+ type AgentVariationInfo as AgentVariationInfo,
1010
+ type AgentVariationSpec as AgentVariationSpec,
1011
+ type AgentVariationSpecCompactionConfig as AgentVariationSpecCompactionConfig,
1012
+ type AgentVariationSpecConstraints as AgentVariationSpecConstraints,
1013
+ type AgentVariationSpecModelConfig as AgentVariationSpecModelConfig,
1014
+ type AgentVariationSpecToolSelection as AgentVariationSpecToolSelection,
1015
+ type CompactionConfigSummarizationStrategy as CompactionConfigSummarizationStrategy,
1016
+ type CompactionConfigToolResultClearingStrategy as CompactionConfigToolResultClearingStrategy,
1017
+ type ToolSelectionAssignedTools as ToolSelectionAssignedTools,
1018
+ type ToolSelectionAutoDiscovery as ToolSelectionAutoDiscovery,
1019
+ type VariationAssignment as VariationAssignment,
1020
+ type AgentVariationsCursorPagination as AgentVariationsCursorPagination,
1021
+ type AgentVariationCreateParams as AgentVariationCreateParams,
1022
+ type AgentVariationRetrieveParams as AgentVariationRetrieveParams,
1023
+ type AgentVariationUpdateParams as AgentVariationUpdateParams,
1024
+ type AgentVariationListParams as AgentVariationListParams,
1025
+ type AgentVariationDeleteParams as AgentVariationDeleteParams,
1026
+ type AgentVariationAddAssignmentParams as AgentVariationAddAssignmentParams,
1027
+ type AgentVariationRemoveAssignmentParams as AgentVariationRemoveAssignmentParams,
1028
+ };
1029
+
959
1030
  export {
960
1031
  Objectives as Objectives,
961
1032
  type AssistantMessage as AssistantMessage,
@@ -1063,6 +1134,12 @@ export declare namespace Cadenya {
1063
1134
  type WorkspaceListParams as WorkspaceListParams,
1064
1135
  };
1065
1136
 
1137
+ export {
1138
+ Webhooks as Webhooks,
1139
+ type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent,
1140
+ type UnwrapWebhookEvent as UnwrapWebhookEvent,
1141
+ };
1142
+
1066
1143
  export type AccountResourceMetadata = API.AccountResourceMetadata;
1067
1144
  export type BareMetadata = API.BareMetadata;
1068
1145
  export type CreateOperationMetadata = API.CreateOperationMetadata;
@@ -22,18 +22,53 @@ export class AccountResource extends APIResource {
22
22
  retrieve(options?: RequestOptions): APIPromise<Account> {
23
23
  return this._client.get('/v1/account', options);
24
24
  }
25
+
26
+ /**
27
+ * Rotates the webhook signing key for the account. Returns only the new key.
28
+ */
29
+ rotateWebhookSigningKey(options?: RequestOptions): APIPromise<RotateWebhookSigningKeyResponse> {
30
+ return this._client.post('/v1/account/rotate_webhook_signing_key', options);
31
+ }
25
32
  }
26
33
 
34
+ /**
35
+ * Account is an account resource.
36
+ */
27
37
  export interface Account {
38
+ /**
39
+ * AccountInfo contains information about the account.
40
+ */
41
+ info: Account.Info;
42
+
28
43
  /**
29
44
  * AccountResourceMetadata is used to represent a resource that is associated to an
30
45
  * account but not to a workspace.
31
46
  */
32
47
  metadata: Shared.AccountResourceMetadata;
33
48
 
49
+ /**
50
+ * AccountSpec contains the specification for an account.
51
+ */
34
52
  spec: AccountSpec;
35
53
  }
36
54
 
55
+ export namespace Account {
56
+ /**
57
+ * AccountInfo contains information about the account.
58
+ */
59
+ export interface Info {
60
+ /**
61
+ * The generated secret that will sign all webhooks that are sent to your
62
+ * configured Webhook URL. Formatted as "wh_asdf1234" per the
63
+ * https://www.standardwebhooks.com/ format.
64
+ */
65
+ webhookEventsHmacSecret?: string;
66
+ }
67
+ }
68
+
69
+ /**
70
+ * AccountSpec contains the specification for an account.
71
+ */
37
72
  export interface AccountSpec {
38
73
  billingEmail?: string;
39
74
 
@@ -83,11 +118,20 @@ export interface ProfileSpec {
83
118
  name?: string;
84
119
  }
85
120
 
121
+ /**
122
+ * RotateWebhookEventsHmacSecretResponse is a response to a
123
+ * RotateWebhookEventsHmacSecretRequest.
124
+ */
125
+ export interface RotateWebhookSigningKeyResponse {
126
+ webhookEventsHmacSecret?: string;
127
+ }
128
+
86
129
  export declare namespace AccountResource {
87
130
  export {
88
131
  type Account as Account,
89
132
  type AccountSpec as AccountSpec,
90
133
  type Profile as Profile,
91
134
  type ProfileSpec as ProfileSpec,
135
+ type RotateWebhookSigningKeyResponse as RotateWebhookSigningKeyResponse,
92
136
  };
93
137
  }