terse-sdk 0.1.11 → 0.1.13

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionStream.js","sourceRoot":"","sources":["../src/sessionStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAoBvC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,UAAkB,EAAE,MAAc,EAAE,UAAoC,EAAE;IAC9G,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IAC1C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE;QACnE,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,MAAM,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE;KAC9E,CAAC,CAAA;IAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,6CAA6C,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAA;IACpF,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,CAAA;IACxC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;IACjC,IAAI,MAAM,GAAG,EAAE,CAAA;IAEf,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAC/E,uBAAuB,CAAC,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;IAE1E,OAAO;QACH,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,GAAG,EAAE;YACR,MAAM,CAAC,M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from "@slack/types";
2
1
  import { IntegrationType } from "terse-types";
3
- import type { ConfigData } from "terse-types";
4
- import type { SerializedEvent } from "terse-types";
5
- import type { WorkOSEventType } from "terse-types";
6
- /**
7
- * Lightweight interface for input events.
8
- * The backend's concrete InputEvent abstract class structurally satisfies this interface.
9
- */
10
- export interface InputEvent {
11
- readonly integrationType: IntegrationType;
12
- readonly eventType: string;
13
- formatForAgentRunner(): string;
14
- debugLog(): string;
15
- }
2
+ import type { ConfigData, SerializedEvent, Trigger } from "terse-types";
16
3
  /**
17
4
  * Lightweight interface for toolbox entries.
18
5
  * The backend's concrete ToolboxEntry (which depends on @openai/agents Tool) structurally satisfies this interface.
@@ -22,309 +9,19 @@ export interface ToolboxEntry {
22
9
  integration: IntegrationType;
23
10
  displayName: string;
24
11
  }
25
- export type TypedTrigger<TEvent extends InputEvent = InputEvent> = ConfigData & {
12
+ export type SDKTrigger<TEvent extends Trigger = Trigger> = TEvent & {
13
+ formatForAgentRunner(): string;
14
+ debugLog(): string;
15
+ };
16
+ export declare function createSDKTrigger(serialized: SerializedEvent): SDKTrigger;
17
+ export type TypedTrigger<TEvent extends Trigger = Trigger> = ConfigData & {
26
18
  readonly __eventType?: TEvent;
27
19
  };
28
- export type InferEvent<T> = T extends TypedTrigger<infer E> ? E : InputEvent;
20
+ export type InferEvent<T> = T extends TypedTrigger<infer E> ? SDKTrigger<E> : SDKTrigger;
29
21
  export type InferEvents<T extends readonly unknown[]> = InferEvent<T[number]>;
30
22
  export type TypedSkill<TToolName extends string = never> = ConfigData & {
31
23
  readonly __toolApprovalNames?: TToolName;
32
24
  };
33
25
  export type InferToolApproval<T> = T extends TypedSkill<infer TToolName> ? TToolName : never;
34
26
  export type InferToolApprovals<T extends readonly unknown[]> = InferToolApproval<T[number]>;
35
- export interface GithubRepository {
36
- id: number;
37
- name: string;
38
- owner: string;
39
- defaultBranch: string;
40
- }
41
- export interface GithubUser {
42
- login: string;
43
- email?: string;
44
- }
45
- export interface GithubFileDiff {
46
- filename: string;
47
- diff: string;
48
- }
49
- export interface GithubCommit {
50
- sha: string;
51
- message: string;
52
- fileDiffs: GithubFileDiff[];
53
- }
54
- export interface GithubPRData {
55
- number: number;
56
- title: string;
57
- body?: string;
58
- state: "open" | "closed";
59
- merged: boolean;
60
- head: {
61
- ref: string;
62
- sha: string;
63
- };
64
- base: {
65
- ref: string;
66
- sha: string;
67
- };
68
- author: GithubUser;
69
- url: string;
70
- }
71
- export declare class GithubInputEvent implements InputEvent {
72
- readonly integrationType = IntegrationType.GITHUB;
73
- readonly eventType: string;
74
- readonly repository: GithubRepository;
75
- readonly sender: GithubUser;
76
- readonly commits: GithubCommit[];
77
- private readonly _formattedContent;
78
- private readonly _debugLog;
79
- constructor(opts: {
80
- eventType: string;
81
- repository: GithubRepository;
82
- sender: GithubUser;
83
- commits: GithubCommit[];
84
- formattedContent: string;
85
- debugLog: string;
86
- });
87
- formatForAgentRunner(): string;
88
- debugLog(): string;
89
- }
90
- export declare class GithubPRInputEvent extends GithubInputEvent {
91
- readonly pullRequest: GithubPRData;
92
- constructor(opts: {
93
- eventType: string;
94
- repository: GithubRepository;
95
- sender: GithubUser;
96
- commits: GithubCommit[];
97
- pullRequest: GithubPRData;
98
- formattedContent: string;
99
- debugLog: string;
100
- });
101
- }
102
- export declare class GithubPushInputEvent extends GithubInputEvent {
103
- readonly branch: string;
104
- constructor(opts: {
105
- eventType: string;
106
- repository: GithubRepository;
107
- sender: GithubUser;
108
- commits: GithubCommit[];
109
- branch: string;
110
- formattedContent: string;
111
- debugLog: string;
112
- });
113
- }
114
- export declare function isGithubEvent(event: InputEvent): event is GithubInputEvent;
115
- export declare function isGithubPREvent(event: InputEvent): event is GithubPRInputEvent;
116
- export declare function isGithubPushEvent(event: InputEvent): event is GithubPushInputEvent;
117
- export interface WorkOSEventUser {
118
- id: string;
119
- email: string;
120
- firstName?: string;
121
- lastName?: string;
122
- emailVerified: boolean;
123
- profilePictureUrl?: string;
124
- }
125
- export interface WorkOSEventMembership {
126
- id: string;
127
- userId: string;
128
- organizationId: string;
129
- role: {
130
- slug: string;
131
- };
132
- status: string;
133
- }
134
- export interface WorkOSEventInvitation {
135
- id: string;
136
- email: string;
137
- organizationId: string;
138
- inviterEmail?: string;
139
- state: string;
140
- acceptedAt?: string;
141
- }
142
- export interface WorkOSEventOrganization {
143
- id: string;
144
- name: string;
145
- }
146
- export declare class WorkOSInputEvent implements InputEvent {
147
- readonly integrationType = IntegrationType.WORKOS;
148
- readonly eventType: WorkOSEventType | string;
149
- readonly eventId: string;
150
- readonly createdAt: string;
151
- private readonly _formattedContent;
152
- private readonly _debugLog;
153
- constructor(opts: {
154
- eventType: WorkOSEventType | string;
155
- eventId: string;
156
- createdAt: string;
157
- formattedContent: string;
158
- debugLog: string;
159
- });
160
- formatForAgentRunner(): string;
161
- debugLog(): string;
162
- }
163
- export declare class WorkOSUserInputEvent extends WorkOSInputEvent {
164
- readonly user: WorkOSEventUser;
165
- constructor(opts: {
166
- eventType: WorkOSEventType | string;
167
- eventId: string;
168
- createdAt: string;
169
- user: WorkOSEventUser;
170
- formattedContent: string;
171
- debugLog: string;
172
- });
173
- }
174
- export declare class WorkOSMembershipInputEvent extends WorkOSInputEvent {
175
- readonly membership: WorkOSEventMembership;
176
- constructor(opts: {
177
- eventType: WorkOSEventType | string;
178
- eventId: string;
179
- createdAt: string;
180
- membership: WorkOSEventMembership;
181
- formattedContent: string;
182
- debugLog: string;
183
- });
184
- }
185
- export declare class WorkOSInvitationInputEvent extends WorkOSInputEvent {
186
- readonly invitation: WorkOSEventInvitation;
187
- readonly user?: WorkOSEventUser;
188
- constructor(opts: {
189
- eventType: WorkOSEventType | string;
190
- eventId: string;
191
- createdAt: string;
192
- invitation: WorkOSEventInvitation;
193
- user?: WorkOSEventUser;
194
- formattedContent: string;
195
- debugLog: string;
196
- });
197
- }
198
- export declare class WorkOSOrganizationInputEvent extends WorkOSInputEvent {
199
- readonly organization: WorkOSEventOrganization;
200
- constructor(opts: {
201
- eventType: WorkOSEventType | string;
202
- eventId: string;
203
- createdAt: string;
204
- organization: WorkOSEventOrganization;
205
- formattedContent: string;
206
- debugLog: string;
207
- });
208
- }
209
- export declare function isWorkOSEvent(event: InputEvent): event is WorkOSInputEvent;
210
- export declare function isWorkOSUserEvent(event: InputEvent): event is WorkOSUserInputEvent;
211
- export declare function isWorkOSMembershipEvent(event: InputEvent): event is WorkOSMembershipInputEvent;
212
- export declare function isWorkOSInvitationEvent(event: InputEvent): event is WorkOSInvitationInputEvent;
213
- export declare function isWorkOSOrganizationEvent(event: InputEvent): event is WorkOSOrganizationInputEvent;
214
- export declare enum SlackChannelType {
215
- CHANNEL = "channel",
216
- GROUP = "group",
217
- MPIM = "mpim",
218
- IM = "im"
219
- }
220
- export interface SlackAttachment {
221
- fallback?: string;
222
- color?: string;
223
- pretext?: string;
224
- author_name?: string;
225
- author_link?: string;
226
- author_icon?: string;
227
- title?: string;
228
- title_link?: string;
229
- text?: string;
230
- fields?: Array<{
231
- title: string;
232
- value: string;
233
- short: boolean;
234
- }>;
235
- image_url?: string;
236
- thumb_url?: string;
237
- footer?: string;
238
- footer_icon?: string;
239
- ts?: number;
240
- }
241
- export interface SlackFile {
242
- id: string;
243
- name?: string;
244
- title?: string;
245
- mimetype?: string;
246
- filetype?: string;
247
- url_private?: string;
248
- url_private_download?: string;
249
- thumb_64?: string;
250
- thumb_80?: string;
251
- thumb_160?: string;
252
- thumb_360?: string;
253
- thumb_480?: string;
254
- thumb_720?: string;
255
- thumb_800?: string;
256
- thumb_960?: string;
257
- thumb_1024?: string;
258
- original_w?: number;
259
- original_h?: number;
260
- }
261
- export declare class SlackMessageEvent implements InputEvent {
262
- readonly eventType: string;
263
- readonly integrationType = IntegrationType.SLACK;
264
- readonly channelId: string;
265
- readonly channelName?: string;
266
- readonly userId: string;
267
- readonly userName?: string;
268
- readonly text: string;
269
- readonly timestamp: string;
270
- readonly threadTs?: string;
271
- readonly teamId: string;
272
- readonly permalink?: string;
273
- readonly channelType?: SlackChannelType;
274
- readonly blocks?: KnownBlock[];
275
- readonly attachments?: SlackAttachment[];
276
- readonly files?: SlackFile[];
277
- private readonly _formattedContent;
278
- private readonly _debugLog;
279
- constructor(opts: {
280
- eventType: string;
281
- channelId: string;
282
- channelName?: string;
283
- userId: string;
284
- userName?: string;
285
- text: string;
286
- timestamp: string;
287
- threadTs?: string;
288
- teamId: string;
289
- permalink?: string;
290
- channelType?: SlackChannelType;
291
- blocks?: KnownBlock[];
292
- attachments?: SlackAttachment[];
293
- files?: SlackFile[];
294
- formattedContent: string;
295
- debugLog: string;
296
- });
297
- formatForAgentRunner(): string;
298
- debugLog(): string;
299
- get threadTimestamp(): string | undefined;
300
- }
301
- export declare class WebhookInputEvent implements InputEvent {
302
- readonly integrationType = IntegrationType.WEBHOOK;
303
- readonly eventType = "webhook";
304
- readonly body: Record<string, unknown>;
305
- readonly headers: Record<string, string>;
306
- readonly method: string;
307
- private readonly _formattedContent;
308
- private readonly _debugLog;
309
- constructor(opts: {
310
- body: Record<string, unknown>;
311
- headers: Record<string, string>;
312
- method: string;
313
- formattedContent: string;
314
- debugLog: string;
315
- });
316
- formatForAgentRunner(): string;
317
- debugLog(): string;
318
- }
319
- export declare function isWebhookEvent(event: InputEvent): event is WebhookInputEvent;
320
- export declare class SerializedEventInputEvent implements InputEvent {
321
- readonly integrationType: IntegrationType;
322
- readonly eventType: string;
323
- private readonly formattedContent;
324
- private readonly debugLogResult;
325
- constructor(serializedEvent: SerializedEvent);
326
- formatForAgentRunner(): string;
327
- debugLog(): string;
328
- }
329
- export declare function deserializeInputEvent(se: SerializedEvent): InputEvent;
330
27
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE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A;IAC5B,WAAW,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,OAAO,GAAG,OAAO,IAAI,MAAM,GAAG;IAChE,oBAAoB,IAAI,MAAM,CAAA;IAC9B,QAAQ,IAAI,MAAM,CAAA;CACrB,CAAA;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,eAAe,GAAG,UAAU,CAKxE;AAMD,MAAM,MAAM,YAAY,CAAC,MAAM,SAAS,OAAO,GAAG,OAAO,IAAI,UAAU,GAAG;IACtE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAA;AACxF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAM7E,MAAM,MAAM,UAAU,CAAC,SAAS,SAAS,MAAM,GAAG,KAAK,IAAI,UAAU,GAAG;IACpE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,UAAU,CAAC,MAAM,SAAS,CAAC,GAAG,SAAS,GAAG,KAAK,CAAA;AAC5F,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,IAAI,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA"}
package/dist/types.js CHANGED
@@ -1,309 +1,7 @@
1
- import { IntegrationType } from "terse-types";
2
- // ---------------------------------------------------------------------------
3
- // GitHub event classes
4
- // ---------------------------------------------------------------------------
5
- export class GithubInputEvent {
6
- integrationType = IntegrationType.GITHUB;
7
- eventType;
8
- repository;
9
- sender;
10
- commits;
11
- _formattedContent;
12
- _debugLog;
13
- constructor(opts) {
14
- this.eventType = opts.eventType;
15
- this.repository = opts.repository;
16
- this.sender = opts.sender;
17
- this.commits = opts.commits;
18
- this._formattedContent = opts.formattedContent;
19
- this._debugLog = opts.debugLog;
20
- }
21
- formatForAgentRunner() {
22
- return this._formattedContent;
23
- }
24
- debugLog() {
25
- return this._debugLog;
26
- }
27
- }
28
- export class GithubPRInputEvent extends GithubInputEvent {
29
- pullRequest;
30
- constructor(opts) {
31
- super(opts);
32
- this.pullRequest = opts.pullRequest;
33
- }
34
- }
35
- export class GithubPushInputEvent extends GithubInputEvent {
36
- branch;
37
- constructor(opts) {
38
- super(opts);
39
- this.branch = opts.branch;
40
- }
41
- }
42
- // ---------------------------------------------------------------------------
43
- // Type guards
44
- // ---------------------------------------------------------------------------
45
- export function isGithubEvent(event) {
46
- return event instanceof GithubInputEvent;
47
- }
48
- export function isGithubPREvent(event) {
49
- return event instanceof GithubPRInputEvent;
50
- }
51
- export function isGithubPushEvent(event) {
52
- return event instanceof GithubPushInputEvent;
53
- }
54
- // ---------------------------------------------------------------------------
55
- // WorkOS event classes
56
- // ---------------------------------------------------------------------------
57
- export class WorkOSInputEvent {
58
- integrationType = IntegrationType.WORKOS;
59
- eventType;
60
- eventId;
61
- createdAt;
62
- _formattedContent;
63
- _debugLog;
64
- constructor(opts) {
65
- this.eventType = opts.eventType;
66
- this.eventId = opts.eventId;
67
- this.createdAt = opts.createdAt;
68
- this._formattedContent = opts.formattedContent;
69
- this._debugLog = opts.debugLog;
70
- }
71
- formatForAgentRunner() {
72
- return this._formattedContent;
73
- }
74
- debugLog() {
75
- return this._debugLog;
76
- }
77
- }
78
- export class WorkOSUserInputEvent extends WorkOSInputEvent {
79
- user;
80
- constructor(opts) {
81
- super(opts);
82
- this.user = opts.user;
83
- }
84
- }
85
- export class WorkOSMembershipInputEvent extends WorkOSInputEvent {
86
- membership;
87
- constructor(opts) {
88
- super(opts);
89
- this.membership = opts.membership;
90
- }
91
- }
92
- export class WorkOSInvitationInputEvent extends WorkOSInputEvent {
93
- invitation;
94
- user;
95
- constructor(opts) {
96
- super(opts);
97
- this.invitation = opts.invitation;
98
- this.user = opts.user;
99
- }
100
- }
101
- export class WorkOSOrganizationInputEvent extends WorkOSInputEvent {
102
- organization;
103
- constructor(opts) {
104
- super(opts);
105
- this.organization = opts.organization;
106
- }
107
- }
108
- // ---------------------------------------------------------------------------
109
- // WorkOS type guards
110
- // ---------------------------------------------------------------------------
111
- export function isWorkOSEvent(event) {
112
- return event instanceof WorkOSInputEvent;
113
- }
114
- export function isWorkOSUserEvent(event) {
115
- return event instanceof WorkOSUserInputEvent;
116
- }
117
- export function isWorkOSMembershipEvent(event) {
118
- return event instanceof WorkOSMembershipInputEvent;
119
- }
120
- export function isWorkOSInvitationEvent(event) {
121
- return event instanceof WorkOSInvitationInputEvent;
122
- }
123
- export function isWorkOSOrganizationEvent(event) {
124
- return event instanceof WorkOSOrganizationInputEvent;
125
- }
126
- // ---------------------------------------------------------------------------
127
- // Slack event data interfaces
128
- // ---------------------------------------------------------------------------
129
- export var SlackChannelType;
130
- (function (SlackChannelType) {
131
- SlackChannelType["CHANNEL"] = "channel";
132
- SlackChannelType["GROUP"] = "group";
133
- SlackChannelType["MPIM"] = "mpim";
134
- SlackChannelType["IM"] = "im";
135
- })(SlackChannelType || (SlackChannelType = {}));
136
- export class SlackMessageEvent {
137
- eventType;
138
- integrationType = IntegrationType.SLACK;
139
- channelId;
140
- channelName;
141
- userId;
142
- userName;
143
- text;
144
- timestamp;
145
- threadTs;
146
- teamId;
147
- permalink;
148
- channelType;
149
- blocks;
150
- attachments;
151
- files;
152
- _formattedContent;
153
- _debugLog;
154
- constructor(opts) {
155
- this.eventType = opts.eventType;
156
- this.channelId = opts.channelId;
157
- this.channelName = opts.channelName;
158
- this.userId = opts.userId;
159
- this.userName = opts.userName;
160
- this.text = opts.text;
161
- this.timestamp = opts.timestamp;
162
- this.threadTs = opts.threadTs;
163
- this.teamId = opts.teamId;
164
- this.permalink = opts.permalink;
165
- this.channelType = opts.channelType;
166
- this.blocks = opts.blocks;
167
- this.attachments = opts.attachments;
168
- this.files = opts.files;
169
- this._formattedContent = opts.formattedContent;
170
- this._debugLog = opts.debugLog;
171
- }
172
- formatForAgentRunner() {
173
- return this._formattedContent;
174
- }
175
- debugLog() {
176
- return this._debugLog;
177
- }
178
- get threadTimestamp() {
179
- return this.threadTs;
180
- }
181
- }
182
- // ---------------------------------------------------------------------------
183
- // Webhook event classes
184
- // ---------------------------------------------------------------------------
185
- export class WebhookInputEvent {
186
- integrationType = IntegrationType.WEBHOOK;
187
- eventType = "webhook";
188
- body;
189
- headers;
190
- method;
191
- _formattedContent;
192
- _debugLog;
193
- constructor(opts) {
194
- this.body = opts.body;
195
- this.headers = opts.headers;
196
- this.method = opts.method;
197
- this._formattedContent = opts.formattedContent;
198
- this._debugLog = opts.debugLog;
199
- }
200
- formatForAgentRunner() {
201
- return this._formattedContent;
202
- }
203
- debugLog() {
204
- return this._debugLog;
205
- }
206
- }
207
- export function isWebhookEvent(event) {
208
- return event instanceof WebhookInputEvent;
209
- }
210
- // ---------------------------------------------------------------------------
211
- // Generic fallback for non-typed serialized events
212
- // ---------------------------------------------------------------------------
213
- export class SerializedEventInputEvent {
214
- integrationType;
215
- eventType;
216
- formattedContent;
217
- debugLogResult;
218
- constructor(serializedEvent) {
219
- this.integrationType = serializedEvent.integrationType;
220
- this.eventType = serializedEvent.eventType ?? "unknown";
221
- this.formattedContent = serializedEvent.formattedContent;
222
- this.debugLogResult = serializedEvent.debugLog;
223
- }
224
- formatForAgentRunner() {
225
- return this.formattedContent;
226
- }
227
- debugLog() {
228
- return this.debugLogResult;
229
- }
230
- }
231
- // ---------------------------------------------------------------------------
232
- // Deserialization – constructs typed event subclasses from SerializedEvent
233
- // ---------------------------------------------------------------------------
234
- export function deserializeInputEvent(se) {
235
- if (se.integrationType === IntegrationType.GITHUB && se.metadata) {
236
- const meta = se.metadata;
237
- const base = {
238
- eventType: se.eventType ?? "unknown",
239
- repository: meta.repository ?? { id: 0, name: "", owner: "", defaultBranch: "main" },
240
- sender: meta.sender ?? { login: "" },
241
- commits: meta.commits ?? [],
242
- formattedContent: se.formattedContent,
243
- debugLog: se.debugLog
244
- };
245
- if (meta.pullRequest) {
246
- return new GithubPRInputEvent({ ...base, pullRequest: meta.pullRequest });
247
- }
248
- if (meta.branch) {
249
- return new GithubPushInputEvent({ ...base, branch: meta.branch });
250
- }
251
- return new GithubInputEvent(base);
252
- }
253
- if (se.integrationType === IntegrationType.WORKOS && se.metadata) {
254
- const meta = se.metadata;
255
- const base = {
256
- eventType: se.eventType ?? "unknown",
257
- eventId: meta.eventId ?? "",
258
- createdAt: meta.createdAt ?? "",
259
- formattedContent: se.formattedContent,
260
- debugLog: se.debugLog
261
- };
262
- if (meta.invitation) {
263
- return new WorkOSInvitationInputEvent({ ...base, invitation: meta.invitation, user: meta.user });
264
- }
265
- if (meta.user) {
266
- return new WorkOSUserInputEvent({ ...base, user: meta.user });
267
- }
268
- if (meta.membership) {
269
- return new WorkOSMembershipInputEvent({ ...base, membership: meta.membership });
270
- }
271
- if (meta.organization) {
272
- return new WorkOSOrganizationInputEvent({ ...base, organization: meta.organization });
273
- }
274
- return new WorkOSInputEvent(base);
275
- }
276
- if (se.integrationType === IntegrationType.SLACK && se.metadata) {
277
- const meta = se.metadata;
278
- return new SlackMessageEvent({
279
- eventType: se.eventType ?? "unknown",
280
- channelId: meta.channelId ?? "",
281
- channelName: meta.channelName,
282
- userId: meta.userId ?? "",
283
- userName: meta.userName,
284
- text: meta.text ?? "",
285
- timestamp: meta.timestamp ?? "",
286
- threadTs: meta.threadTs,
287
- teamId: meta.teamId ?? "",
288
- permalink: meta.permalink,
289
- channelType: meta.channelType,
290
- blocks: meta.blocks,
291
- attachments: meta.attachments,
292
- files: meta.files,
293
- formattedContent: se.formattedContent,
294
- debugLog: se.debugLog
295
- });
296
- }
297
- if (se.integrationType === IntegrationType.WEBHOOK && se.metadata) {
298
- const meta = se.metadata;
299
- return new WebhookInputEvent({
300
- body: meta.body ?? {},
301
- headers: meta.headers ?? {},
302
- method: meta.method ?? "POST",
303
- formattedContent: se.formattedContent,
304
- debugLog: se.debugLog
305
- });
306
- }
307
- return new SerializedEventInputEvent(se);
1
+ export function createSDKTrigger(serialized) {
2
+ return Object.assign({}, serialized.data, {
3
+ formatForAgentRunner: () => serialized.formattedContent,
4
+ debugLog: () => serialized.debugLog
5
+ });
308
6
  }
309
7
  //# sourceMappingURL=types.js.map