@cadenya/cadenya 0.97.0 → 0.98.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 (84) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +18 -0
  3. package/client.d.mts +2 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +2 -2
  6. package/client.d.ts.map +1 -1
  7. package/core/streaming.d.mts +33 -0
  8. package/core/streaming.d.mts.map +1 -0
  9. package/core/streaming.d.ts +33 -0
  10. package/core/streaming.d.ts.map +1 -0
  11. package/core/streaming.js +263 -0
  12. package/core/streaming.js.map +1 -0
  13. package/core/streaming.mjs +258 -0
  14. package/core/streaming.mjs.map +1 -0
  15. package/internal/decoders/line.d.mts +17 -0
  16. package/internal/decoders/line.d.mts.map +1 -0
  17. package/internal/decoders/line.d.ts +17 -0
  18. package/internal/decoders/line.d.ts.map +1 -0
  19. package/internal/decoders/line.js +113 -0
  20. package/internal/decoders/line.js.map +1 -0
  21. package/internal/decoders/line.mjs +108 -0
  22. package/internal/decoders/line.mjs.map +1 -0
  23. package/internal/parse.d.mts.map +1 -1
  24. package/internal/parse.d.ts.map +1 -1
  25. package/internal/parse.js +10 -0
  26. package/internal/parse.js.map +1 -1
  27. package/internal/parse.mjs +10 -0
  28. package/internal/parse.mjs.map +1 -1
  29. package/internal/request-options.d.mts +2 -0
  30. package/internal/request-options.d.mts.map +1 -1
  31. package/internal/request-options.d.ts +2 -0
  32. package/internal/request-options.d.ts.map +1 -1
  33. package/internal/request-options.js.map +1 -1
  34. package/internal/request-options.mjs.map +1 -1
  35. package/internal/tslib.js +17 -17
  36. package/package.json +11 -1
  37. package/resources/ai-provider-keys.d.mts +8 -101
  38. package/resources/ai-provider-keys.d.mts.map +1 -1
  39. package/resources/ai-provider-keys.d.ts +8 -101
  40. package/resources/ai-provider-keys.d.ts.map +1 -1
  41. package/resources/index.d.mts +1 -1
  42. package/resources/index.d.mts.map +1 -1
  43. package/resources/index.d.ts +1 -1
  44. package/resources/index.d.ts.map +1 -1
  45. package/resources/objectives/index.d.mts +1 -1
  46. package/resources/objectives/index.d.mts.map +1 -1
  47. package/resources/objectives/index.d.ts +1 -1
  48. package/resources/objectives/index.d.ts.map +1 -1
  49. package/resources/objectives/objectives.d.mts +23 -37
  50. package/resources/objectives/objectives.d.mts.map +1 -1
  51. package/resources/objectives/objectives.d.ts +23 -37
  52. package/resources/objectives/objectives.d.ts.map +1 -1
  53. package/resources/objectives/objectives.js +12 -0
  54. package/resources/objectives/objectives.js.map +1 -1
  55. package/resources/objectives/objectives.mjs +12 -0
  56. package/resources/objectives/objectives.mjs.map +1 -1
  57. package/resources/webhooks.d.mts +2 -26
  58. package/resources/webhooks.d.mts.map +1 -1
  59. package/resources/webhooks.d.ts +2 -26
  60. package/resources/webhooks.d.ts.map +1 -1
  61. package/src/client.ts +6 -6
  62. package/src/core/streaming.ts +315 -0
  63. package/src/internal/decoders/line.ts +135 -0
  64. package/src/internal/parse.ts +14 -0
  65. package/src/internal/request-options.ts +2 -0
  66. package/src/resources/ai-provider-keys.ts +8 -116
  67. package/src/resources/index.ts +3 -3
  68. package/src/resources/objectives/index.ts +3 -3
  69. package/src/resources/objectives/objectives.ts +44 -52
  70. package/src/resources/webhooks.ts +2 -34
  71. package/src/streaming.ts +2 -0
  72. package/src/version.ts +1 -1
  73. package/streaming.d.mts +3 -0
  74. package/streaming.d.mts.map +1 -0
  75. package/streaming.d.ts +3 -0
  76. package/streaming.d.ts.map +1 -0
  77. package/streaming.js +6 -0
  78. package/streaming.js.map +1 -0
  79. package/streaming.mjs +3 -0
  80. package/streaming.mjs.map +1 -0
  81. package/version.d.mts +1 -1
  82. package/version.d.ts +1 -1
  83. package/version.js +1 -1
  84. package/version.mjs +1 -1
@@ -49,6 +49,8 @@ import * as ToolsAPI from './tools';
49
49
  import { ObjectiveTool, ObjectiveToolsCursorPagination, ToolListParams, Tools } from './tools';
50
50
  import { APIPromise } from '../../core/api-promise';
51
51
  import { CursorPagination, type CursorPaginationParams, PagePromise } from '../../core/pagination';
52
+ import { Stream } from '../../core/streaming';
53
+ import { buildHeaders } from '../../internal/headers';
52
54
  import { RequestOptions } from '../../internal/request-options';
53
55
  import { path } from '../../internal/utils/path';
54
56
 
@@ -127,7 +129,7 @@ export class Objectives extends APIResource {
127
129
  objectiveID: string,
128
130
  params: ObjectiveContinueParams,
129
131
  options?: RequestOptions,
130
- ): APIPromise<ObjectiveContinueResponse> {
132
+ ): APIPromise<ObjectiveEvent> {
131
133
  const { workspaceId, ...body } = params;
132
134
  return this._client.post(path`/v1/workspaces/${workspaceId}/objectives/${objectiveID}:continue`, {
133
135
  body,
@@ -159,21 +161,37 @@ export class Objectives extends APIResource {
159
161
  objectiveID: string,
160
162
  params: ObjectiveListEventsParams,
161
163
  options?: RequestOptions,
162
- ): PagePromise<ObjectiveListEventsResponsesCursorPagination, ObjectiveListEventsResponse> {
164
+ ): PagePromise<ObjectiveEventsCursorPagination, ObjectiveEvent> {
163
165
  const { workspaceId, ...query } = params;
164
166
  return this._client.getAPIList(
165
167
  path`/v1/workspaces/${workspaceId}/objectives/${objectiveID}/events`,
166
- CursorPagination<ObjectiveListEventsResponse>,
168
+ CursorPagination<ObjectiveEvent>,
167
169
  { query, ...options },
168
170
  );
169
171
  }
172
+
173
+ /**
174
+ * Streams events for an objective in real-time using server-sent events (SSE)
175
+ */
176
+ streamEvents(
177
+ objectiveID: string,
178
+ params: ObjectiveStreamEventsParams,
179
+ options?: RequestOptions,
180
+ ): APIPromise<Stream<ObjectiveEvent>> {
181
+ const { workspaceId } = params;
182
+ return this._client.get(path`/v1/workspaces/${workspaceId}/objectives/${objectiveID}/events:stream`, {
183
+ ...options,
184
+ headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
185
+ stream: true,
186
+ }) as APIPromise<Stream<ObjectiveEvent>>;
187
+ }
170
188
  }
171
189
 
172
190
  export type ObjectivesCursorPagination = CursorPagination<Objective>;
173
191
 
174
192
  export type ObjectiveContextWindowsCursorPagination = CursorPagination<ObjectiveContextWindow>;
175
193
 
176
- export type ObjectiveListEventsResponsesCursorPagination = CursorPagination<ObjectiveListEventsResponse>;
194
+ export type ObjectiveEventsCursorPagination = CursorPagination<ObjectiveEvent>;
177
195
 
178
196
  export interface AssistantMessage {
179
197
  content?: string;
@@ -503,6 +521,20 @@ export interface ObjectiveError {
503
521
  type?: string;
504
522
  }
505
523
 
524
+ export interface ObjectiveEvent {
525
+ data: ObjectiveEventData;
526
+
527
+ /**
528
+ * Metadata for ephemeral operations and activities (e.g., objectives, executions,
529
+ * runs)
530
+ */
531
+ metadata: Shared.OperationMetadata;
532
+
533
+ contextWindowId?: string;
534
+
535
+ info?: ObjectiveEventInfo;
536
+ }
537
+
506
538
  export interface ObjectiveEventData {
507
539
  assistantMessage?: AssistantMessage;
508
540
 
@@ -639,23 +671,7 @@ export namespace ObjectiveEventWebhookData {
639
671
  */
640
672
  objective: Shared.OperationMetadata;
641
673
 
642
- objectiveEvent: Data.ObjectiveEvent;
643
- }
644
-
645
- export namespace Data {
646
- export interface ObjectiveEvent {
647
- data: ObjectivesAPI.ObjectiveEventData;
648
-
649
- /**
650
- * Metadata for ephemeral operations and activities (e.g., objectives, executions,
651
- * runs)
652
- */
653
- metadata: Shared.OperationMetadata;
654
-
655
- contextWindowId?: string;
656
-
657
- info?: ObjectivesAPI.ObjectiveEventInfo;
658
- }
674
+ objectiveEvent: ObjectivesAPI.ObjectiveEvent;
659
675
  }
660
676
  }
661
677
 
@@ -851,34 +867,6 @@ export interface ObjectiveCompactResponse {
851
867
  contextWindow?: ObjectiveContextWindowData;
852
868
  }
853
869
 
854
- export interface ObjectiveContinueResponse {
855
- data: ObjectiveEventData;
856
-
857
- /**
858
- * Metadata for ephemeral operations and activities (e.g., objectives, executions,
859
- * runs)
860
- */
861
- metadata: Shared.OperationMetadata;
862
-
863
- contextWindowId?: string;
864
-
865
- info?: ObjectiveEventInfo;
866
- }
867
-
868
- export interface ObjectiveListEventsResponse {
869
- data: ObjectiveEventData;
870
-
871
- /**
872
- * Metadata for ephemeral operations and activities (e.g., objectives, executions,
873
- * runs)
874
- */
875
- metadata: Shared.OperationMetadata;
876
-
877
- contextWindowId?: string;
878
-
879
- info?: ObjectiveEventInfo;
880
- }
881
-
882
870
  export interface ObjectiveCreateParams {
883
871
  agentId: string;
884
872
 
@@ -1109,6 +1097,10 @@ export interface ObjectiveListEventsParams extends CursorPaginationParams {
1109
1097
  windowId?: string;
1110
1098
  }
1111
1099
 
1100
+ export interface ObjectiveStreamEventsParams {
1101
+ workspaceId: string;
1102
+ }
1103
+
1112
1104
  Objectives.Tools = Tools;
1113
1105
  Objectives.ToolCalls = ToolCalls;
1114
1106
  Objectives.Tasks = Tasks;
@@ -1127,6 +1119,7 @@ export declare namespace Objectives {
1127
1119
  type ObjectiveContextWindow as ObjectiveContextWindow,
1128
1120
  type ObjectiveContextWindowData as ObjectiveContextWindowData,
1129
1121
  type ObjectiveError as ObjectiveError,
1122
+ type ObjectiveEvent as ObjectiveEvent,
1130
1123
  type ObjectiveEventData as ObjectiveEventData,
1131
1124
  type ObjectiveEventInfo as ObjectiveEventInfo,
1132
1125
  type ObjectiveEventWebhookData as ObjectiveEventWebhookData,
@@ -1142,11 +1135,9 @@ export declare namespace Objectives {
1142
1135
  type ToolResult as ToolResult,
1143
1136
  type UserMessage as UserMessage,
1144
1137
  type ObjectiveCompactResponse as ObjectiveCompactResponse,
1145
- type ObjectiveContinueResponse as ObjectiveContinueResponse,
1146
- type ObjectiveListEventsResponse as ObjectiveListEventsResponse,
1147
1138
  type ObjectivesCursorPagination as ObjectivesCursorPagination,
1148
1139
  type ObjectiveContextWindowsCursorPagination as ObjectiveContextWindowsCursorPagination,
1149
- type ObjectiveListEventsResponsesCursorPagination as ObjectiveListEventsResponsesCursorPagination,
1140
+ type ObjectiveEventsCursorPagination as ObjectiveEventsCursorPagination,
1150
1141
  type ObjectiveCreateParams as ObjectiveCreateParams,
1151
1142
  type ObjectiveRetrieveParams as ObjectiveRetrieveParams,
1152
1143
  type ObjectiveListParams as ObjectiveListParams,
@@ -1155,6 +1146,7 @@ export declare namespace Objectives {
1155
1146
  type ObjectiveContinueParams as ObjectiveContinueParams,
1156
1147
  type ObjectiveListContextWindowsParams as ObjectiveListContextWindowsParams,
1157
1148
  type ObjectiveListEventsParams as ObjectiveListEventsParams,
1149
+ type ObjectiveStreamEventsParams as ObjectiveStreamEventsParams,
1158
1150
  };
1159
1151
 
1160
1152
  export {
@@ -66,23 +66,7 @@ export namespace UnsafeUnwrapWebhookEvent {
66
66
  */
67
67
  objective: Shared.OperationMetadata;
68
68
 
69
- objectiveEvent: Data.ObjectiveEvent;
70
- }
71
-
72
- export namespace Data {
73
- export interface ObjectiveEvent {
74
- data: ObjectivesAPI.ObjectiveEventData;
75
-
76
- /**
77
- * Metadata for ephemeral operations and activities (e.g., objectives, executions,
78
- * runs)
79
- */
80
- metadata: Shared.OperationMetadata;
81
-
82
- contextWindowId?: string;
83
-
84
- info?: ObjectivesAPI.ObjectiveEventInfo;
85
- }
69
+ objectiveEvent: ObjectivesAPI.ObjectiveEvent;
86
70
  }
87
71
  }
88
72
 
@@ -128,23 +112,7 @@ export namespace UnwrapWebhookEvent {
128
112
  */
129
113
  objective: Shared.OperationMetadata;
130
114
 
131
- objectiveEvent: Data.ObjectiveEvent;
132
- }
133
-
134
- export namespace Data {
135
- export interface ObjectiveEvent {
136
- data: ObjectivesAPI.ObjectiveEventData;
137
-
138
- /**
139
- * Metadata for ephemeral operations and activities (e.g., objectives, executions,
140
- * runs)
141
- */
142
- metadata: Shared.OperationMetadata;
143
-
144
- contextWindowId?: string;
145
-
146
- info?: ObjectivesAPI.ObjectiveEventInfo;
147
- }
115
+ objectiveEvent: ObjectivesAPI.ObjectiveEvent;
148
116
  }
149
117
  }
150
118
 
@@ -0,0 +1,2 @@
1
+ /** @deprecated Import from ./core/streaming instead */
2
+ export * from './core/streaming';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.97.0'; // x-release-please-version
1
+ export const VERSION = '0.98.0'; // x-release-please-version
@@ -0,0 +1,3 @@
1
+ /** @deprecated Import from ./core/streaming instead */
2
+ export * from "./core/streaming.mjs";
3
+ //# sourceMappingURL=streaming.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming.d.mts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,qCAAiC"}
package/streaming.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ /** @deprecated Import from ./core/streaming instead */
2
+ export * from "./core/streaming.js";
3
+ //# sourceMappingURL=streaming.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,oCAAiC"}
package/streaming.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("./internal/tslib.js");
4
+ /** @deprecated Import from ./core/streaming instead */
5
+ tslib_1.__exportStar(require("./core/streaming.js"), exports);
6
+ //# sourceMappingURL=streaming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming.js","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,8DAAiC"}
package/streaming.mjs ADDED
@@ -0,0 +1,3 @@
1
+ /** @deprecated Import from ./core/streaming instead */
2
+ export * from "./core/streaming.mjs";
3
+ //# sourceMappingURL=streaming.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming.mjs","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,qCAAiC"}
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.97.0";
1
+ export declare const VERSION = "0.98.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.97.0";
1
+ export declare const VERSION = "0.98.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.97.0'; // x-release-please-version
4
+ exports.VERSION = '0.98.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.97.0'; // x-release-please-version
1
+ export const VERSION = '0.98.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map