@cadenya/cadenya 0.41.0 → 0.43.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 (120) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +4 -4
  3. package/client.d.mts +17 -5
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +17 -5
  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/internal/utils/env.js +2 -2
  12. package/internal/utils/env.js.map +1 -1
  13. package/internal/utils/env.mjs +2 -2
  14. package/internal/utils/env.mjs.map +1 -1
  15. package/package.json +4 -2
  16. package/resources/account.d.mts +38 -1
  17. package/resources/account.d.mts.map +1 -1
  18. package/resources/account.d.ts +38 -1
  19. package/resources/account.d.ts.map +1 -1
  20. package/resources/account.js +6 -0
  21. package/resources/account.js.map +1 -1
  22. package/resources/account.mjs +6 -0
  23. package/resources/account.mjs.map +1 -1
  24. package/resources/{agents/variations.d.ts → agent-variations.d.mts} +124 -49
  25. package/resources/agent-variations.d.mts.map +1 -0
  26. package/resources/{agents/variations.d.mts → agent-variations.d.ts} +124 -49
  27. package/resources/agent-variations.d.ts.map +1 -0
  28. package/resources/{agents/variations.js → agent-variations.js} +29 -8
  29. package/resources/agent-variations.js.map +1 -0
  30. package/resources/{agents/variations.mjs → agent-variations.mjs} +27 -6
  31. package/resources/agent-variations.mjs.map +1 -0
  32. package/resources/agents/agents.d.mts +2 -11
  33. package/resources/agents/agents.d.mts.map +1 -1
  34. package/resources/agents/agents.d.ts +2 -11
  35. package/resources/agents/agents.d.ts.map +1 -1
  36. package/resources/agents/agents.js +0 -4
  37. package/resources/agents/agents.js.map +1 -1
  38. package/resources/agents/agents.mjs +0 -4
  39. package/resources/agents/agents.mjs.map +1 -1
  40. package/resources/agents/index.d.mts +0 -1
  41. package/resources/agents/index.d.mts.map +1 -1
  42. package/resources/agents/index.d.ts +0 -1
  43. package/resources/agents/index.d.ts.map +1 -1
  44. package/resources/agents/index.js +1 -3
  45. package/resources/agents/index.js.map +1 -1
  46. package/resources/agents/index.mjs +0 -1
  47. package/resources/agents/index.mjs.map +1 -1
  48. package/resources/agents/webhook-deliveries.d.mts +2 -2
  49. package/resources/agents/webhook-deliveries.d.mts.map +1 -1
  50. package/resources/agents/webhook-deliveries.d.ts +2 -2
  51. package/resources/agents/webhook-deliveries.d.ts.map +1 -1
  52. package/resources/index.d.mts +4 -2
  53. package/resources/index.d.mts.map +1 -1
  54. package/resources/index.d.ts +4 -2
  55. package/resources/index.d.ts.map +1 -1
  56. package/resources/index.js +5 -1
  57. package/resources/index.js.map +1 -1
  58. package/resources/index.mjs +3 -1
  59. package/resources/index.mjs.map +1 -1
  60. package/resources/objectives/feedback.d.mts +6 -6
  61. package/resources/objectives/feedback.d.ts +6 -6
  62. package/resources/objectives/index.d.mts +1 -1
  63. package/resources/objectives/index.d.mts.map +1 -1
  64. package/resources/objectives/index.d.ts +1 -1
  65. package/resources/objectives/index.d.ts.map +1 -1
  66. package/resources/objectives/index.js.map +1 -1
  67. package/resources/objectives/index.mjs.map +1 -1
  68. package/resources/objectives/objectives.d.mts +43 -3
  69. package/resources/objectives/objectives.d.mts.map +1 -1
  70. package/resources/objectives/objectives.d.ts +43 -3
  71. package/resources/objectives/objectives.d.ts.map +1 -1
  72. package/resources/objectives/objectives.js +7 -0
  73. package/resources/objectives/objectives.js.map +1 -1
  74. package/resources/objectives/objectives.mjs +7 -0
  75. package/resources/objectives/objectives.mjs.map +1 -1
  76. package/resources/objectives/tasks.d.mts +6 -6
  77. package/resources/objectives/tasks.d.ts +6 -6
  78. package/resources/objectives/tool-calls.d.mts +1 -0
  79. package/resources/objectives/tool-calls.d.mts.map +1 -1
  80. package/resources/objectives/tool-calls.d.ts +1 -0
  81. package/resources/objectives/tool-calls.d.ts.map +1 -1
  82. package/resources/objectives/tools.d.mts +6 -6
  83. package/resources/objectives/tools.d.ts +6 -6
  84. package/resources/shared.d.mts +13 -7
  85. package/resources/shared.d.mts.map +1 -1
  86. package/resources/shared.d.ts +13 -7
  87. package/resources/shared.d.ts.map +1 -1
  88. package/resources/webhooks.d.mts +116 -0
  89. package/resources/webhooks.d.mts.map +1 -0
  90. package/resources/webhooks.d.ts +116 -0
  91. package/resources/webhooks.d.ts.map +1 -0
  92. package/resources/webhooks.js +23 -0
  93. package/resources/webhooks.js.map +1 -0
  94. package/resources/webhooks.mjs +19 -0
  95. package/resources/webhooks.mjs.map +1 -0
  96. package/src/client.ts +84 -1
  97. package/src/internal/utils/env.ts +2 -2
  98. package/src/resources/account.ts +44 -0
  99. package/src/resources/{agents/variations.ts → agent-variations.ts} +175 -64
  100. package/src/resources/agents/agents.ts +2 -50
  101. package/src/resources/agents/index.ts +0 -19
  102. package/src/resources/agents/webhook-deliveries.ts +4 -2
  103. package/src/resources/index.ts +35 -1
  104. package/src/resources/objectives/feedback.ts +6 -6
  105. package/src/resources/objectives/index.ts +3 -0
  106. package/src/resources/objectives/objectives.ts +59 -2
  107. package/src/resources/objectives/tasks.ts +6 -6
  108. package/src/resources/objectives/tool-calls.ts +7 -0
  109. package/src/resources/objectives/tools.ts +6 -6
  110. package/src/resources/shared.ts +14 -7
  111. package/src/resources/webhooks.ts +156 -0
  112. package/src/version.ts +1 -1
  113. package/version.d.mts +1 -1
  114. package/version.d.ts +1 -1
  115. package/version.js +1 -1
  116. package/version.mjs +1 -1
  117. package/resources/agents/variations.d.mts.map +0 -1
  118. package/resources/agents/variations.d.ts.map +0 -1
  119. package/resources/agents/variations.js.map +0 -1
  120. 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,
@@ -75,8 +106,11 @@ import {
75
106
  AssistantMessage,
76
107
  AssistantToolCall,
77
108
  CallableTool,
109
+ ContextWindowCompacted,
78
110
  Objective,
79
111
  ObjectiveCancelParams,
112
+ ObjectiveCompactParams,
113
+ ObjectiveCompactResponse,
80
114
  ObjectiveContextWindow,
81
115
  ObjectiveContextWindowData,
82
116
  ObjectiveContextWindowsCursorPagination,
@@ -147,6 +181,11 @@ export interface ClientOptions {
147
181
  */
148
182
  apiKey?: string | undefined;
149
183
 
184
+ /**
185
+ * Defaults to process.env['CADENYA_WEBHOOK_KEY'].
186
+ */
187
+ webhookKey?: string | null | undefined;
188
+
150
189
  /**
151
190
  * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
152
191
  *
@@ -221,6 +260,7 @@ export interface ClientOptions {
221
260
  */
222
261
  export class Cadenya {
223
262
  apiKey: string;
263
+ webhookKey: string | null;
224
264
 
225
265
  baseURL: string;
226
266
  maxRetries: number;
@@ -238,6 +278,7 @@ export class Cadenya {
238
278
  * API Client for interfacing with the Cadenya API.
239
279
  *
240
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]
241
282
  * @param {string} [opts.baseURL=process.env['CADENYA_BASE_URL'] ?? https://api.cadenya.com] - Override the default base URL for the API.
242
283
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
243
284
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
@@ -249,6 +290,7 @@ export class Cadenya {
249
290
  constructor({
250
291
  baseURL = readEnv('CADENYA_BASE_URL'),
251
292
  apiKey = readEnv('CADENYA_API_KEY'),
293
+ webhookKey = readEnv('CADENYA_WEBHOOK_KEY') ?? null,
252
294
  ...opts
253
295
  }: ClientOptions = {}) {
254
296
  if (apiKey === undefined) {
@@ -259,6 +301,7 @@ export class Cadenya {
259
301
 
260
302
  const options: ClientOptions = {
261
303
  apiKey,
304
+ webhookKey,
262
305
  ...opts,
263
306
  baseURL: baseURL || `https://api.cadenya.com`,
264
307
  };
@@ -281,6 +324,7 @@ export class Cadenya {
281
324
  this._options = options;
282
325
 
283
326
  this.apiKey = apiKey;
327
+ this.webhookKey = webhookKey;
284
328
  }
285
329
 
286
330
  /**
@@ -297,6 +341,7 @@ export class Cadenya {
297
341
  fetch: this.fetch,
298
342
  fetchOptions: this.fetchOptions,
299
343
  apiKey: this.apiKey,
344
+ webhookKey: this.webhookKey,
300
345
  ...options,
301
346
  });
302
347
  return client;
@@ -870,6 +915,7 @@ export class Cadenya {
870
915
  * Scope: Workspace-level operations
871
916
  */
872
917
  agents: API.Agents = new API.Agents(this);
918
+ agentVariations: API.AgentVariations = new API.AgentVariations(this);
873
919
  objectives: API.Objectives = new API.Objectives(this);
874
920
  /**
875
921
  * ModelService manages LLM models at the WORKSPACE level.
@@ -912,10 +958,12 @@ export class Cadenya {
912
958
  * Scope: Account-level operations (manages workspaces themselves, not resources within workspaces)
913
959
  */
914
960
  workspaces: API.Workspaces = new API.Workspaces(this);
961
+ webhooks: API.Webhooks = new API.Webhooks(this);
915
962
  }
916
963
 
917
964
  Cadenya.AccountResource = AccountResource;
918
965
  Cadenya.Agents = Agents;
966
+ Cadenya.AgentVariations = AgentVariations;
919
967
  Cadenya.Objectives = Objectives;
920
968
  Cadenya.Models = Models;
921
969
  Cadenya.Search = Search;
@@ -923,6 +971,7 @@ Cadenya.ToolSets = ToolSets;
923
971
  Cadenya.APIKeys = APIKeys;
924
972
  Cadenya.WorkspaceSecrets = WorkspaceSecrets;
925
973
  Cadenya.Workspaces = Workspaces;
974
+ Cadenya.Webhooks = Webhooks;
926
975
 
927
976
  export declare namespace Cadenya {
928
977
  export type RequestOptions = Opts.RequestOptions;
@@ -939,6 +988,7 @@ export declare namespace Cadenya {
939
988
  type AccountSpec as AccountSpec,
940
989
  type Profile as Profile,
941
990
  type ProfileSpec as ProfileSpec,
991
+ type RotateWebhookSigningKeyResponse as RotateWebhookSigningKeyResponse,
942
992
  };
943
993
 
944
994
  export {
@@ -953,11 +1003,36 @@ export declare namespace Cadenya {
953
1003
  type AgentListParams as AgentListParams,
954
1004
  };
955
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
+
956
1030
  export {
957
1031
  Objectives as Objectives,
958
1032
  type AssistantMessage as AssistantMessage,
959
1033
  type AssistantToolCall as AssistantToolCall,
960
1034
  type CallableTool as CallableTool,
1035
+ type ContextWindowCompacted as ContextWindowCompacted,
961
1036
  type Objective as Objective,
962
1037
  type ObjectiveContextWindow as ObjectiveContextWindow,
963
1038
  type ObjectiveContextWindowData as ObjectiveContextWindowData,
@@ -977,6 +1052,7 @@ export declare namespace Cadenya {
977
1052
  type ToolError as ToolError,
978
1053
  type ToolResult as ToolResult,
979
1054
  type UserMessage as UserMessage,
1055
+ type ObjectiveCompactResponse as ObjectiveCompactResponse,
980
1056
  type ObjectiveContinueResponse as ObjectiveContinueResponse,
981
1057
  type ObjectiveListEventsResponse as ObjectiveListEventsResponse,
982
1058
  type ObjectivesCursorPagination as ObjectivesCursorPagination,
@@ -985,6 +1061,7 @@ export declare namespace Cadenya {
985
1061
  type ObjectiveCreateParams as ObjectiveCreateParams,
986
1062
  type ObjectiveListParams as ObjectiveListParams,
987
1063
  type ObjectiveCancelParams as ObjectiveCancelParams,
1064
+ type ObjectiveCompactParams as ObjectiveCompactParams,
988
1065
  type ObjectiveContinueParams as ObjectiveContinueParams,
989
1066
  type ObjectiveListContextWindowsParams as ObjectiveListContextWindowsParams,
990
1067
  type ObjectiveListEventsParams as ObjectiveListEventsParams,
@@ -1057,6 +1134,12 @@ export declare namespace Cadenya {
1057
1134
  type WorkspaceListParams as WorkspaceListParams,
1058
1135
  };
1059
1136
 
1137
+ export {
1138
+ Webhooks as Webhooks,
1139
+ type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent,
1140
+ type UnwrapWebhookEvent as UnwrapWebhookEvent,
1141
+ };
1142
+
1060
1143
  export type AccountResourceMetadata = API.AccountResourceMetadata;
1061
1144
  export type BareMetadata = API.BareMetadata;
1062
1145
  export type CreateOperationMetadata = API.CreateOperationMetadata;
@@ -9,10 +9,10 @@
9
9
  */
10
10
  export const readEnv = (env: string): string | undefined => {
11
11
  if (typeof (globalThis as any).process !== 'undefined') {
12
- return (globalThis as any).process.env?.[env]?.trim() ?? undefined;
12
+ return (globalThis as any).process.env?.[env]?.trim() || undefined;
13
13
  }
14
14
  if (typeof (globalThis as any).Deno !== 'undefined') {
15
- return (globalThis as any).Deno.env?.get?.(env)?.trim();
15
+ return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
16
16
  }
17
17
  return undefined;
18
18
  };
@@ -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
  }