@dual-os/linear-api 6.0.5 → 6.1.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 (52) hide show
  1. package/README.md +2 -1
  2. package/Runner.js +3 -3
  3. package/Runner.js.map +2 -2
  4. package/bundle-inventory.json +1 -1
  5. package/dist/auth.js +4 -4
  6. package/dist/channel/internal/webhook.d.ts +3 -0
  7. package/dist/channel/internal/webhook.d.ts.map +1 -1
  8. package/dist/channel/internal/webhook.js +3 -3
  9. package/dist/channel/linear-app-client.d.ts +1 -0
  10. package/dist/channel/linear-app-client.d.ts.map +1 -1
  11. package/dist/channel/linear-app-client.js +3 -3
  12. package/dist/channel/linear-app-definition.d.ts +3 -0
  13. package/dist/channel/linear-app-definition.d.ts.map +1 -1
  14. package/dist/channel/linear-app-definition.js +3 -3
  15. package/dist/channel/linear-app.d.ts +1 -0
  16. package/dist/channel/linear-app.d.ts.map +1 -1
  17. package/dist/channel/linear-app.js +6 -6
  18. package/dist/generated/http.js +5 -5
  19. package/dist/generated/operations.js +6 -6
  20. package/dist/generated/plugin.js +8 -8
  21. package/dist/plugin.d.ts +3 -0
  22. package/dist/plugin.d.ts.map +1 -1
  23. package/dist/plugin.js +11 -11
  24. package/dist/triggers.js +7 -7
  25. package/dual-contracts.json +1 -0
  26. package/dual-plugin.json +1 -1
  27. package/package.json +1 -1
  28. package/{plugin-evq9z31a.js → plugin-2s4a8q89.js} +3 -3
  29. package/{plugin-292sech3.js → plugin-7dyhjnyq.js} +3 -3
  30. package/{plugin-acwx0zjc.js → plugin-8540346t.js} +5 -5
  31. package/{plugin-aaq7c99y.js → plugin-8gk6v58x.js} +4 -3
  32. package/{plugin-aaq7c99y.js.map → plugin-8gk6v58x.js.map} +3 -3
  33. package/{plugin-0pkez622.js → plugin-bysj8fds.js} +45 -30
  34. package/{plugin-0pkez622.js.map → plugin-bysj8fds.js.map} +5 -4
  35. package/{plugin-c5xtmfce.js → plugin-cfmatvhp.js} +3 -3
  36. package/{plugin-5d2kw2pq.js → plugin-d9nmerg6.js} +10 -9
  37. package/{plugin-5d2kw2pq.js.map → plugin-d9nmerg6.js.map} +3 -3
  38. package/{plugin-jgac4d6v.js → plugin-r9hrxt0e.js} +3 -3
  39. package/{plugin-9vdeenc2.js → plugin-rmaz7x3d.js} +268 -131
  40. package/{plugin-9vdeenc2.js.map → plugin-rmaz7x3d.js.map} +8 -9
  41. package/{plugin-03c4ezxj.js → plugin-s6xrx2a0.js} +5 -4
  42. package/plugin-s6xrx2a0.js.map +10 -0
  43. package/{plugin-pbx41zqr.js → plugin-v011a9pv.js} +19 -3
  44. package/plugin-v011a9pv.js.map +10 -0
  45. package/plugin-03c4ezxj.js.map +0 -10
  46. package/plugin-pbx41zqr.js.map +0 -10
  47. /package/licenses/{@dual-os_sdk@0.9.0 → @dual-os_sdk@0.11.0}/LICENSE +0 -0
  48. /package/{plugin-evq9z31a.js.map → plugin-2s4a8q89.js.map} +0 -0
  49. /package/{plugin-292sech3.js.map → plugin-7dyhjnyq.js.map} +0 -0
  50. /package/{plugin-acwx0zjc.js.map → plugin-8540346t.js.map} +0 -0
  51. /package/{plugin-c5xtmfce.js.map → plugin-cfmatvhp.js.map} +0 -0
  52. /package/{plugin-jgac4d6v.js.map → plugin-r9hrxt0e.js.map} +0 -0
@@ -54,7 +54,7 @@ import {
54
54
  schemaBodyJson,
55
55
  HttpClient,
56
56
  AgentChannel_exports
57
- } from "./plugin-9vdeenc2.js";
57
+ } from "./plugin-rmaz7x3d.js";
58
58
 
59
59
  // dist/channel/linear-app-client.js
60
60
  var endpoint = "https://api.linear.app/graphql";
@@ -105,6 +105,7 @@ var Comment = Struct({
105
105
  createdAt: DateTimeUtcFromString,
106
106
  id: String3,
107
107
  user: NullOr(Struct({
108
+ email: optionalKey(NullOr(String3)),
108
109
  id: String3,
109
110
  name: String3
110
111
  }))
@@ -211,7 +212,7 @@ var make = gen(function* () {
211
212
  createActivity,
212
213
  issueComments: fn("LinearAppClient.issueComments")(function* (token, issueId, limit) {
213
214
  const read = fn("LinearAppClient.issueComments.page")(function* (after, seen) {
214
- const page = yield* graphql(token, "query LinearAppIssueComments($id: String!, $after: String) { issue(id: $id) { comments(first: 100, after: $after) { nodes { id body createdAt user { id name } } pageInfo { endCursor hasNextPage } } } }", match(after, {
215
+ const page = yield* graphql(token, "query LinearAppIssueComments($id: String!, $after: String) { issue(id: $id) { comments(first: 100, after: $after) { nodes { id body createdAt user { id name email } } pageInfo { endCursor hasNextPage } } } }", match(after, {
215
216
  onNone: () => ({ id: issueId }),
216
217
  onSome: (cursor) => ({
217
218
  after: cursor,
@@ -240,5 +241,5 @@ var LinearAppClient2 = class extends Service()("@dual-os/linear-app/linear-app-c
240
241
  };
241
242
  export { ActivityContent2, LinearAppClient2 };
242
243
 
243
- //# debugId=293D3781D326E0F964756E2164756E21
244
- //# sourceMappingURL=plugin-03c4ezxj.js.map
244
+ //# debugId=7F577E5E50F6FC7E64756E2164756E21
245
+ //# sourceMappingURL=plugin-s6xrx2a0.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../bundle-input/dist/channel/linear-app-client.js"],
4
+ "sourcesContent": [
5
+ "import { Array, Context, DateTime, Effect, Layer, Match, Option, Order, Schema, String, pipe } from \"effect\";\nimport { HttpClient, HttpClientRequest, HttpClientResponse } from \"effect/http\";\nimport { AgentChannel } from \"@dual-os/sdk\";\n//#region src/channel/linear-app-client.ts\nconst endpoint = \"https://api.linear.app/graphql\";\n/** The comments `issueComments` pages through at most before keeping the latest. */\nconst maxComments = 500;\n/** Linear refused an entity ID it already has, or a deletion of one it does not have. */\nvar Refused = class extends Schema.TaggedError()(\"LinearAppRefused\", { reason: Schema.Literals([\"already_exists\", \"not_found\"]) }) {};\nconst GraphqlError = Schema.Struct({\n\textensions: Schema.optionalKey(Schema.Struct({\n\t\tcode: Schema.optionalKey(Schema.String),\n\t\tuserPresentableMessage: Schema.optionalKey(Schema.String)\n\t})),\n\tmessage: Schema.optionalKey(Schema.String)\n});\nconst Success = Schema.Struct({ success: Schema.Boolean });\nconst ActivityContent = Schema.Struct({\n\tbody: Schema.NonEmptyString,\n\ttype: Schema.Literals([\n\t\t\"thought\",\n\t\t\"response\",\n\t\t\"error\",\n\t\t\"elicitation\"\n\t])\n});\nSchema.Struct({\n\tagentSessionId: Schema.String,\n\tcontent: ActivityContent,\n\tephemeral: Schema.Boolean,\n\tid: Schema.String,\n\t/** The choices of a question, shown as Linear's `select` signal. */\n\toptions: Schema.Array(Schema.String)\n});\nSchema.Struct({\n\tcontent: Schema.NonEmptyString,\n\tstatus: Schema.Literals([\n\t\t\"pending\",\n\t\t\"inProgress\",\n\t\t\"completed\",\n\t\t\"canceled\"\n\t])\n});\nSchema.Struct({\n\tactive: Schema.Boolean,\n\temoji: Schema.String,\n\tid: Schema.String,\n\ttarget: Schema.Union([Schema.Struct({ commentId: Schema.String }), Schema.Struct({ issueId: Schema.String })])\n});\nconst Comment = Schema.Struct({\n\tbody: Schema.String,\n\tcreatedAt: Schema.DateTimeUtcFromString,\n\tid: Schema.String,\n\tuser: Schema.NullOr(Schema.Struct({\n\t\temail: Schema.optionalKey(Schema.NullOr(Schema.String)),\n\t\tid: Schema.String,\n\t\tname: Schema.String\n\t}))\n});\nconst CommentPage = Schema.Struct({ issue: Schema.Struct({ comments: Schema.Struct({\n\tnodes: Schema.Array(Comment),\n\tpageInfo: Schema.Struct({\n\t\tendCursor: Schema.NullOr(Schema.String),\n\t\thasNextPage: Schema.Boolean\n\t})\n}) }) });\nfunction fail(code) {\n\treturn Effect.fail(AgentChannel.HandlerError.make({ code }));\n}\nfunction matches(pattern, text) {\n\treturn Option.isSome(String.match(pattern)(text ?? \"\"));\n}\n/** Linear answers an input error with `INPUT_ERROR`, told apart only by its message. */\nfunction inputRefusal(error) {\n\tif (matches(/conflict on insert/iu, error.message) || matches(/already exists/iu, error.extensions?.userPresentableMessage)) return Effect.fail(Refused.make({ reason: \"already_exists\" }));\n\tif (matches(/^entity not found\\b/iu, error.message)) return Effect.fail(Refused.make({ reason: \"not_found\" }));\n\treturn fail(\"rejected\");\n}\n/** Linear refuses a request it does not complete with `success: false`. */\nfunction succeeded(result) {\n\treturn Effect.filterOrElse(Effect.void, () => result.success, () => fail(\"rejected\"));\n}\n/** A refusal where the caller chose no ID is a plain rejection. */\nfunction refusedAsRejected(self) {\n\treturn Effect.catchTag(self, \"LinearAppRefused\", () => fail(\"rejected\"));\n}\n/** A request whose caller-chosen ID Linear refused for `expected` was done by an earlier attempt. */\nfunction settledWhen(expected) {\n\treturn (self) => Effect.catchTag(self, \"LinearAppRefused\", (refused) => Effect.filterOrElse(Effect.void, () => refused.reason === expected, () => fail(\"rejected\")));\n}\nconst make = Effect.gen(function* () {\n\tconst client = yield* HttpClient.HttpClient;\n\tconst graphql = Effect.fn(\"LinearAppClient.graphql\")(function* (token, query, variables, data) {\n\t\tconst response = yield* pipe(HttpClientRequest.post(endpoint), HttpClientRequest.bearerToken(token), HttpClientRequest.acceptJson, HttpClientRequest.bodyJsonUnsafe({\n\t\t\tquery,\n\t\t\tvariables\n\t\t}), client.execute, Effect.timeout(\"30 seconds\"), Effect.catch(() => fail(\"unavailable\")));\n\t\tif (response.status === 401 || response.status === 403) return yield* fail(\"unauthorized\");\n\t\tif (response.status === 429) return yield* fail(\"rate_limited\");\n\t\tif (response.status >= 500) return yield* fail(\"unavailable\");\n\t\tconst envelope = yield* pipe(response, HttpClientResponse.schemaBodyJson(Schema.Struct({\n\t\t\tdata: Schema.optionalKey(Schema.NullOr(data)),\n\t\t\terrors: Schema.optionalKey(Schema.Array(GraphqlError))\n\t\t})), Effect.catch(() => fail(\"rejected\")), Effect.timeoutOrElse({\n\t\t\tduration: \"30 seconds\",\n\t\t\torElse: () => fail(\"unavailable\")\n\t\t}));\n\t\treturn yield* Option.match(Array.head(envelope.errors ?? []), {\n\t\t\tonNone: () => pipe(Option.fromNullishOr(envelope.data), Option.filter(() => response.status < 300), Effect.fromOption, Effect.catch(() => fail(\"rejected\"))),\n\t\t\tonSome: (error) => pipe(Match.value(String.toUpperCase(error.extensions?.code ?? \"\")), Match.when(\"INPUT_ERROR\", () => inputRefusal(error)), Match.whenOr(\"RATELIMITED\", \"RATE_LIMITED\", () => fail(\"rate_limited\")), Match.whenOr(\"UNAUTHENTICATED\", \"AUTHENTICATION_ERROR\", \"FORBIDDEN\", () => fail(\"unauthorized\")), Match.orElse(() => fail(\"rejected\")))\n\t\t});\n\t});\n\t/** The app user and workspace the token acts as. */\n\tconst viewer = Effect.fn(\"LinearAppClient.viewer\")(function* (token) {\n\t\tconst result = yield* graphql(token, \"query LinearAppViewer { viewer { id organization { id } } }\", {}, Schema.Struct({ viewer: Schema.Struct({\n\t\t\tid: Schema.String,\n\t\t\torganization: Schema.Struct({ id: Schema.String })\n\t\t}) }));\n\t\treturn {\n\t\t\tappUserId: result.viewer.id,\n\t\t\torganizationId: result.viewer.organization.id\n\t\t};\n\t}, refusedAsRejected);\n\t/** Post one activity. Linear refuses an ID it has seen, so a retry posts nothing new. */\n\tconst createActivity = Effect.fn(\"LinearAppClient.createActivity\")(function* (token, activity) {\n\t\tconst input = {\n\t\t\tagentSessionId: activity.agentSessionId,\n\t\t\tcontent: activity.content,\n\t\t\tephemeral: activity.ephemeral,\n\t\t\tid: activity.id\n\t\t};\n\t\tyield* succeeded((yield* graphql(token, \"mutation LinearAppActivityCreate($input: AgentActivityCreateInput!) { agentActivityCreate(input: $input) { success } }\", { input: Array.match(activity.options, {\n\t\t\tonEmpty: () => input,\n\t\t\tonNonEmpty: (options) => ({\n\t\t\t\t...input,\n\t\t\t\tsignal: \"select\",\n\t\t\t\tsignalMetadata: { options: Array.map(options, (value) => ({\n\t\t\t\t\tlabel: value,\n\t\t\t\t\tvalue\n\t\t\t\t})) }\n\t\t\t})\n\t\t}) }, Schema.Struct({ agentActivityCreate: Success }))).agentActivityCreate);\n\t}, settledWhen(\"already_exists\"));\n\t/** Replace the session's whole Agent Plan, a Linear technology preview. */\n\tconst setPlan = Effect.fn(\"LinearAppClient.setPlan\")(function* (token, agentSessionId, plan) {\n\t\tyield* succeeded((yield* graphql(token, \"mutation LinearAppSessionPlan($id: String!, $input: AgentSessionUpdateInput!) { agentSessionUpdate(id: $id, input: $input) { success } }\", {\n\t\t\tid: agentSessionId,\n\t\t\tinput: { plan }\n\t\t}, Schema.Struct({ agentSessionUpdate: Success }))).agentSessionUpdate);\n\t}, refusedAsRejected);\n\t/** Make the reaction with the caller's UUID present or absent; one already so is done. */\n\tconst setReaction = Effect.fn(\"LinearAppClient.setReaction\")(function* (token, reaction) {\n\t\tif (reaction.active) return yield* pipe(graphql(token, \"mutation LinearAppReactionCreate($input: ReactionCreateInput!) { reactionCreate(input: $input) { success } }\", { input: {\n\t\t\temoji: reaction.emoji,\n\t\t\tid: reaction.id,\n\t\t\t...reaction.target\n\t\t} }, Schema.Struct({ reactionCreate: Success })), Effect.flatMap((result) => succeeded(result.reactionCreate)), settledWhen(\"already_exists\"));\n\t\treturn yield* pipe(graphql(token, \"mutation LinearAppReactionDelete($id: String!) { reactionDelete(id: $id) { success } }\", { id: reaction.id }, Schema.Struct({ reactionDelete: Success })), Effect.flatMap((result) => succeeded(result.reactionDelete)), settledWhen(\"not_found\"));\n\t});\n\treturn {\n\t\tcreateActivity,\n\t\tissueComments: Effect.fn(\"LinearAppClient.issueComments\")(function* (token, issueId, limit) {\n\t\t\tconst read = Effect.fn(\"LinearAppClient.issueComments.page\")(function* (after, seen) {\n\t\t\t\tconst page = yield* graphql(token, \"query LinearAppIssueComments($id: String!, $after: String) { issue(id: $id) { comments(first: 100, after: $after) { nodes { id body createdAt user { id name email } } pageInfo { endCursor hasNextPage } } } }\", Option.match(after, {\n\t\t\t\t\tonNone: () => ({ id: issueId }),\n\t\t\t\t\tonSome: (cursor) => ({\n\t\t\t\t\t\tafter: cursor,\n\t\t\t\t\t\tid: issueId\n\t\t\t\t\t})\n\t\t\t\t}), CommentPage);\n\t\t\t\tconst comments = Array.appendAll(seen, page.issue.comments.nodes);\n\t\t\t\tconst next = pipe(Option.fromNullishOr(page.issue.comments.pageInfo.endCursor), Option.filter(() => page.issue.comments.pageInfo.hasNextPage), Option.filter(() => comments.length < maxComments));\n\t\t\t\tif (Option.isNone(next)) return comments;\n\t\t\t\treturn yield* read(next, comments);\n\t\t\t});\n\t\t\tconst comments = yield* pipe(read(Option.none(), []), refusedAsRejected);\n\t\t\treturn pipe(comments, Array.map((comment) => Option.map(Option.fromNullishOr(comment.user), (user) => ({\n\t\t\t\t...comment,\n\t\t\t\tuser\n\t\t\t}))), Array.getSomes, Array.sortWith((comment) => DateTime.toEpochMillis(comment.createdAt), Order.Number), Array.takeRight(limit));\n\t\t}),\n\t\tsetPlan,\n\t\tsetReaction,\n\t\tviewer\n\t};\n});\n/** Linear's GraphQL API for Agent Sessions, called with the installation's token. */\nvar LinearAppClient = class extends Context.Service()(\"@dual-os/linear-app/linear-app-client/LinearAppClient\") {\n\tstatic layer = Layer.effect(this, make);\n};\n//#endregion\nexport { ActivityContent, LinearAppClient };\n\n//# sourceMappingURL=linear-app-client.js.map"
6
+ ],
7
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAM,WAAW;AAEjB,IAAM,cAAc;AAEpB,IAAI,UAAU,cAAc,aAAmB,EAAE,oBAAoB,EAAE,QAAQ,SAAgB,CAAC,kBAAkB,WAAW,CAAC,EAAE,CAAC,EAAE;AAAC;AACpI,IAAM,eAAe,OAAc;AAAA,EAClC,YAAY,YAAmB,OAAc;AAAA,IAC5C,MAAM,YAAmB,OAAa;AAAA,IACtC,wBAAwB,YAAmB,OAAa;AAAA,EACzD,CAAC,CAAC;AAAA,EACF,SAAS,YAAmB,OAAa;AAC1C,CAAC;AACD,IAAM,UAAU,OAAc,EAAE,SAAS,SAAe,CAAC;AACzD,IAAM,mBAAkB,OAAc;AAAA,EACrC,MAAM;AAAA,EACN,MAAM,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AAI,mBAAkB,cAAc,QAAgB,EAAE,uDAAuD,EAAE;AAAA,SACvG,QAAQ,OAAa,MAAM,IAAI;AACvC;",
8
+ "debugId": "7F577E5E50F6FC7E64756E2164756E21",
9
+ "names": []
10
+ }
@@ -42,7 +42,7 @@ import {
42
42
  DateTimeUtcFromString,
43
43
  AgentChannel_exports,
44
44
  Trigger_exports
45
- } from "./plugin-9vdeenc2.js";
45
+ } from "./plugin-rmaz7x3d.js";
46
46
 
47
47
  // dist/channel/internal/webhook.js
48
48
  var maxText = 65536;
@@ -53,6 +53,17 @@ var Envelope = fromJsonString(Struct({
53
53
  organizationId: optionalKey(String3),
54
54
  type: String3
55
55
  }));
56
+ var Person = NullOr(Struct({
57
+ email: optionalKey(NullOr(String3)),
58
+ id: AgentChannel_exports.Key,
59
+ name: optionalKey(NullOr(String3))
60
+ }));
61
+ function detailsOf(person, senderKey) {
62
+ return person == null || person.id !== senderKey ? {} : AgentChannel_exports.senderDetails({
63
+ email: person.email,
64
+ name: person.name
65
+ });
66
+ }
56
67
  var Prompt = Struct({
57
68
  agentSessionId: AgentChannel_exports.Key,
58
69
  content: Struct({ body: optionalKey(NullOr(String3)) }),
@@ -60,6 +71,7 @@ var Prompt = Struct({
60
71
  id: AgentChannel_exports.Key,
61
72
  signal: optionalKey(NullOr(String3)),
62
73
  sourceCommentId: optionalKey(NullOr(AgentChannel_exports.Key)),
74
+ user: optionalKey(Person),
63
75
  userId: AgentChannel_exports.Key
64
76
  });
65
77
  var SessionEvent = fromJsonString(Struct({
@@ -70,6 +82,7 @@ var SessionEvent = fromJsonString(Struct({
70
82
  commentId: optionalKey(NullOr(AgentChannel_exports.Key)),
71
83
  sourceCommentId: optionalKey(NullOr(AgentChannel_exports.Key)),
72
84
  createdAt: DateTimeUtcFromString,
85
+ creator: optionalKey(Person),
73
86
  creatorId: optionalKey(NullOr(AgentChannel_exports.Key)),
74
87
  id: AgentChannel_exports.Key,
75
88
  issue: optionalKey(NullOr(Struct({
@@ -146,6 +159,8 @@ function sessionStarted(webhook, identity, issueId) {
146
159
  }),
147
160
  respond: true,
148
161
  senderKey,
162
+ ...detailsOf(webhook.agentActivity?.user, senderKey),
163
+ ...detailsOf(session.creator, senderKey),
149
164
  timestamp: formatIso(session.createdAt)
150
165
  });
151
166
  }
@@ -168,6 +183,7 @@ function prompted(prompt, identity, issueId) {
168
183
  return empty();
169
184
  return of({
170
185
  ...shared,
186
+ ...detailsOf(prompt.user, prompt.userId),
171
187
  content: { text },
172
188
  kind: "message",
173
189
  messageKey: match(fromNullishOr(prompt.sourceCommentId), {
@@ -200,5 +216,5 @@ var webhookEvents2 = fn("LinearAppWebhook.events")(function* (body, identity, te
200
216
  });
201
217
  export { verifyWebhook2, commentKey2, commentOf2, issueOf2, webhookEvents2 };
202
218
 
203
- //# debugId=197E048866F2CD1B64756E2164756E21
204
- //# sourceMappingURL=plugin-pbx41zqr.js.map
219
+ //# debugId=09755443E126275064756E2164756E21
220
+ //# sourceMappingURL=plugin-v011a9pv.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../bundle-input/dist/channel/internal/webhook.js"],
4
+ "sourcesContent": [
5
+ "import { Array, Clock, DateTime, Effect, Number, Option, Predicate, Record, Schema, String, pipe } from \"effect\";\nimport { AgentChannel, Trigger } from \"@dual-os/sdk\";\n//#region src/channel/internal/webhook.ts\n/** The longest message text the contract accepts; a longer prompt context is cut. */\nconst maxText = 65536;\n/** Linear's guide refuses a delivery dated more than a minute away from now, against replays. */\nconst maxSkewMs = 6e4;\nconst Signed = Schema.fromJsonString(Schema.Struct({ webhookTimestamp: Schema.Finite }));\nconst Envelope = Schema.fromJsonString(Schema.Struct({\n\taction: Schema.optionalKey(Schema.String),\n\torganizationId: Schema.optionalKey(Schema.String),\n\ttype: Schema.String\n}));\nconst Person = Schema.NullOr(Schema.Struct({\n\temail: Schema.optionalKey(Schema.NullOr(Schema.String)),\n\tid: AgentChannel.Key,\n\tname: Schema.optionalKey(Schema.NullOr(Schema.String))\n}));\n/** A person's details, only when they are the sender the event is keyed by. */\nfunction detailsOf(person, senderKey) {\n\treturn person == null || person.id !== senderKey ? {} : AgentChannel.senderDetails({\n\t\temail: person.email,\n\t\tname: person.name\n\t});\n}\nconst Prompt = Schema.Struct({\n\tagentSessionId: AgentChannel.Key,\n\tcontent: Schema.Struct({ body: Schema.optionalKey(Schema.NullOr(Schema.String)) }),\n\tcreatedAt: Schema.DateTimeUtcFromString,\n\tid: AgentChannel.Key,\n\t/** `stop` when the user stops the session. */\n\tsignal: Schema.optionalKey(Schema.NullOr(Schema.String)),\n\t/** The comment the user prompted with, when they replied in the session's comment thread. */\n\tsourceCommentId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\tuser: Schema.optionalKey(Person),\n\tuserId: AgentChannel.Key\n});\nconst SessionEvent = Schema.fromJsonString(Schema.Struct({\n\taction: Schema.Literals([\"created\", \"prompted\"]),\n\tagentActivity: Schema.optionalKey(Schema.NullOr(Prompt)),\n\tagentSession: Schema.Struct({\n\t\tappUserId: AgentChannel.Key,\n\t\t/** The root comment of the session's own thread. */\n\t\tcommentId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\t\t/** The originating mention, when the session starts in a different thread. */\n\t\tsourceCommentId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\t\tcreatedAt: Schema.DateTimeUtcFromString,\n\t\tcreator: Schema.optionalKey(Person),\n\t\tcreatorId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\t\tid: AgentChannel.Key,\n\t\tissue: Schema.optionalKey(Schema.NullOr(Schema.Struct({\n\t\t\tid: AgentChannel.Key,\n\t\t\tidentifier: Schema.String,\n\t\t\tteamId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\t\t\ttitle: Schema.String\n\t\t}))),\n\t\tissueId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\t\torganizationId: AgentChannel.Key\n\t}),\n\tappUserId: AgentChannel.Key,\n\torganizationId: AgentChannel.Key,\n\t/** Linear's summary of the issue, its comments and guidance, sent when a session starts. */\n\tpromptContext: Schema.optionalKey(Schema.NullOr(Schema.String)),\n\ttype: Schema.Literal(\"AgentSessionEvent\")\n}));\nfunction unauthorized() {\n\treturn AgentChannel.HandlerError.make({ code: \"unauthorized\" });\n}\nfunction rejected() {\n\treturn AgentChannel.HandlerError.make({ code: \"rejected\" });\n}\n/** Linear signs the raw body in `Linear-Signature` and dates it in `webhookTimestamp`. */\nconst verifyWebhook = Effect.fn(\"LinearAppWebhook.verify\")(function* (request, signingSecret) {\n\tconst signatures = pipe(Record.toEntries(request.headers), Array.filter((entry) => String.toLowerCase(entry[0]) === \"linear-signature\"), Array.map((entry) => entry[1]));\n\tif (request.method !== \"POST\" || signatures.length !== 1) return yield* unauthorized();\n\tif (!(yield* Trigger.verifyHmac({\n\t\talgorithm: \"sha256\",\n\t\tencoding: \"hex\",\n\t\tmessage: request.body,\n\t\tsecret: signingSecret,\n\t\tsignature: signatures\n\t}))) return yield* unauthorized();\n\tconst sent = (yield* pipe(request.body, Schema.decodeEffect(Signed), Effect.mapError(unauthorized))).webhookTimestamp;\n\tconst now = yield* Clock.currentTimeMillis;\n\tif (!Number.between(sent, {\n\t\tmaximum: now + maxSkewMs,\n\t\tminimum: now - maxSkewMs\n\t})) return yield* unauthorized();\n\treturn { verified: true };\n});\n/** A provider message key: the comment a user wrote, else the session or prompt it started. */\nfunction commentKey(commentId) {\n\treturn `comment/${commentId}`;\n}\n/** The Linear comment a message key names, if it names one. */\nfunction commentOf(messageKey) {\n\treturn pipe(Option.some(messageKey), Option.filter(String.startsWith(\"comment/\")), Option.map(String.slice(8)));\n}\n/** A session's conversation is its issue; a session outside an issue is its own conversation. */\nfunction destination(sessionId, issueId) {\n\treturn {\n\t\tconversationKey: Option.getOrElse(issueId, () => sessionId),\n\t\tkind: \"group\",\n\t\tthreadKey: sessionId\n\t};\n}\n/** The issue a destination names, or none for a session outside an issue. */\nfunction issueOf(target) {\n\treturn pipe(Option.some(target.conversationKey), Option.filter((key) => key !== target.threadKey));\n}\nfunction sessionStarted(webhook, identity, issueId) {\n\tconst session = webhook.agentSession;\n\tconst senderKey = session.creatorId ?? webhook.agentActivity?.userId ?? void 0;\n\tif (senderKey === void 0 || senderKey === identity.appUserId) return Array.empty();\n\tconst text = pipe([webhook.promptContext ?? \"\", webhook.agentActivity?.content.body ?? \"\"], Array.findFirst(String.isNonEmpty), Option.orElse(() => Option.map(Option.fromNullishOr(session.issue), (issue) => `${issue.identifier}: ${issue.title}`)), Option.getOrElse(() => \"Linear Agent Session started\"), String.slice(0, maxText));\n\treturn Array.of({\n\t\tcontent: { text },\n\t\tconversation: destination(session.id, issueId),\n\t\teventKey: `session/${session.id}`,\n\t\tkind: \"message\",\n\t\tmessageKey: Option.match(Option.fromNullishOr(session.sourceCommentId ?? session.commentId), {\n\t\t\tonNone: () => `session/${session.id}`,\n\t\t\tonSome: commentKey\n\t\t}),\n\t\trespond: true,\n\t\tsenderKey,\n\t\t...detailsOf(webhook.agentActivity?.user, senderKey),\n\t\t...detailsOf(session.creator, senderKey),\n\t\ttimestamp: DateTime.formatIso(session.createdAt)\n\t});\n}\nfunction prompted(prompt, identity, issueId) {\n\tif (prompt.userId === identity.appUserId) return Array.empty();\n\tconst shared = {\n\t\tconversation: destination(prompt.agentSessionId, issueId),\n\t\teventKey: `activity/${prompt.id}`,\n\t\tsenderKey: prompt.userId,\n\t\ttimestamp: DateTime.formatIso(prompt.createdAt)\n\t};\n\tif (prompt.signal === \"stop\") return Array.of({\n\t\t...shared,\n\t\tkind: \"stop\"\n\t});\n\tconst text = String.slice(0, maxText)(prompt.content.body ?? \"\");\n\tif (String.isEmpty(text)) return Array.empty();\n\treturn Array.of({\n\t\t...shared,\n\t\t...detailsOf(prompt.user, prompt.userId),\n\t\tcontent: { text },\n\t\tkind: \"message\",\n\t\tmessageKey: Option.match(Option.fromNullishOr(prompt.sourceCommentId), {\n\t\t\tonNone: () => `activity/${prompt.id}`,\n\t\t\tonSome: commentKey\n\t\t}),\n\t\trespond: true\n\t});\n}\n/** The events of one verified webhook: a session start, a prompt or a stop; nothing for the rest. */\nconst webhookEvents = Effect.fn(\"LinearAppWebhook.events\")(function* (body, identity, teams) {\n\tconst envelope = yield* pipe(body, Schema.decodeEffect(Envelope), Effect.mapError(rejected));\n\tif ((envelope.organizationId ?? identity.organizationId) !== identity.organizationId) return yield* unauthorized();\n\tif (envelope.type !== \"AgentSessionEvent\" || envelope.action !== \"created\" && envelope.action !== \"prompted\") return Array.empty();\n\tconst webhook = yield* pipe(body, Schema.decodeEffect(SessionEvent), Effect.mapError(rejected));\n\tconst session = webhook.agentSession;\n\tif (webhook.organizationId !== identity.organizationId || session.organizationId !== identity.organizationId || webhook.appUserId !== identity.appUserId || session.appUserId !== identity.appUserId) return yield* unauthorized();\n\tconst issueIds = Array.dedupe(Array.filter([session.issue?.id, session.issueId], Predicate.isNotNullish));\n\tif (issueIds.length > 1 || Predicate.isNotNullish(webhook.agentActivity) && webhook.agentActivity.agentSessionId !== session.id) return yield* rejected();\n\tif (Array.isReadonlyArrayNonEmpty(teams) && !Array.contains(teams, session.issue?.teamId ?? \"\")) return Array.empty();\n\tif (webhook.action === \"created\") return sessionStarted(webhook, identity, Array.head(issueIds));\n\tif (Predicate.isNullish(webhook.agentActivity)) return yield* rejected();\n\treturn prompted(webhook.agentActivity, identity, Array.head(issueIds));\n});\n//#endregion\nexport { commentKey, commentOf, issueOf, verifyWebhook, webhookEvents };\n\n//# sourceMappingURL=webhook.js.map"
6
+ ],
7
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAM,UAAU;AAEhB,IAAM,YAAY;AAClB,IAAM,SAAS,eAAsB,OAAc,EAAE,kBAAkB,OAAc,CAAC,CAAC;AACvF,IAAM,WAAW,eAAsB,OAAc;AAAA,EACpD,QAAQ,YAAmB,OAAa;AAAA,EACxC,gBAAgB,YAAmB,OA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AS,oBAAoB,SAAS;AAAA,IAAgB,OAAO,OAAO,aAAa;AAAA,EACjH,IAAI,SAAS,SAAS,uBAAuB,SAAS,WAAW,aAAa,SAAS,WAAW;AAAA,IAAY,OAAO,MAAY;AAAA,EACjI,MAAM,UAAU,OAAO,KAAK,MAAM,aAAoB,YAAY,GAAG,SAAgB,QAAQ,CAAC;AAAA,EAC9F,MAAM,UAAU,QAAQ;AAAA,EACxB,IAAI,QAAQ,mBAAmB,SAAS,kBAAkB,QAAQ,mBAAmB,SAAS,kBAAkB,QAAQ,cAAc,SAAS,aAAa,QAAQ,cAAc,SAAS;AAAA,IAAW,OAAO,OAAO,aAAa;AAAA,EACjO,MAAM,WAAW,OAAa,QAAa,CAAC,QAAQ,OAAO,IAAI,QAAQ,OAAO,GAAG,YAAsB,CAAC;AAAA,EACxG,IAAI,SAAS,SAAS,KAAK,aAAuB,QAAQ,aAAa,KAAK,QAAQ,cAAc,mBAAmB,QAAQ;AAAA,IAAI,OAAO,OAAO,SAAS;AAAA,EACxJ,IAAI,wBAA8B,KAAK,KAAK,CAAC,SAAe,OAAO,QAAQ,OAAO,UAAU,EAAE;AAAA,IAAG,OAAO,MAAY;AAAA,EACpH,IAAI,QAAQ,WAAW;AAAA,IAAW,OAAO,eAAe,SAAS,UAAU,KAAW,QAAQ,CAAC;AAAA,EAC/F,IAAI,UAAoB,QAAQ,aAAa;AAAA,IAAG,OAAO,OAAO,SAAS;AAAA,EACvE,OAAO,SAAS,QAAQ,eAAe,UAAU,KAAW,QAAQ,CAAC;AAAA,CACrE;",
8
+ "debugId": "09755443E126275064756E2164756E21",
9
+ "names": []
10
+ }
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../bundle-input/dist/channel/linear-app-client.js"],
4
- "sourcesContent": [
5
- "import { Array, Context, DateTime, Effect, Layer, Match, Option, Order, Schema, String, pipe } from \"effect\";\nimport { HttpClient, HttpClientRequest, HttpClientResponse } from \"effect/http\";\nimport { AgentChannel } from \"@dual-os/sdk\";\n//#region src/channel/linear-app-client.ts\nconst endpoint = \"https://api.linear.app/graphql\";\n/** The comments `issueComments` pages through at most before keeping the latest. */\nconst maxComments = 500;\n/** Linear refused an entity ID it already has, or a deletion of one it does not have. */\nvar Refused = class extends Schema.TaggedError()(\"LinearAppRefused\", { reason: Schema.Literals([\"already_exists\", \"not_found\"]) }) {};\nconst GraphqlError = Schema.Struct({\n\textensions: Schema.optionalKey(Schema.Struct({\n\t\tcode: Schema.optionalKey(Schema.String),\n\t\tuserPresentableMessage: Schema.optionalKey(Schema.String)\n\t})),\n\tmessage: Schema.optionalKey(Schema.String)\n});\nconst Success = Schema.Struct({ success: Schema.Boolean });\nconst ActivityContent = Schema.Struct({\n\tbody: Schema.NonEmptyString,\n\ttype: Schema.Literals([\n\t\t\"thought\",\n\t\t\"response\",\n\t\t\"error\",\n\t\t\"elicitation\"\n\t])\n});\nSchema.Struct({\n\tagentSessionId: Schema.String,\n\tcontent: ActivityContent,\n\tephemeral: Schema.Boolean,\n\tid: Schema.String,\n\t/** The choices of a question, shown as Linear's `select` signal. */\n\toptions: Schema.Array(Schema.String)\n});\nSchema.Struct({\n\tcontent: Schema.NonEmptyString,\n\tstatus: Schema.Literals([\n\t\t\"pending\",\n\t\t\"inProgress\",\n\t\t\"completed\",\n\t\t\"canceled\"\n\t])\n});\nSchema.Struct({\n\tactive: Schema.Boolean,\n\temoji: Schema.String,\n\tid: Schema.String,\n\ttarget: Schema.Union([Schema.Struct({ commentId: Schema.String }), Schema.Struct({ issueId: Schema.String })])\n});\nconst Comment = Schema.Struct({\n\tbody: Schema.String,\n\tcreatedAt: Schema.DateTimeUtcFromString,\n\tid: Schema.String,\n\tuser: Schema.NullOr(Schema.Struct({\n\t\tid: Schema.String,\n\t\tname: Schema.String\n\t}))\n});\nconst CommentPage = Schema.Struct({ issue: Schema.Struct({ comments: Schema.Struct({\n\tnodes: Schema.Array(Comment),\n\tpageInfo: Schema.Struct({\n\t\tendCursor: Schema.NullOr(Schema.String),\n\t\thasNextPage: Schema.Boolean\n\t})\n}) }) });\nfunction fail(code) {\n\treturn Effect.fail(AgentChannel.HandlerError.make({ code }));\n}\nfunction matches(pattern, text) {\n\treturn Option.isSome(String.match(pattern)(text ?? \"\"));\n}\n/** Linear answers an input error with `INPUT_ERROR`, told apart only by its message. */\nfunction inputRefusal(error) {\n\tif (matches(/conflict on insert/iu, error.message) || matches(/already exists/iu, error.extensions?.userPresentableMessage)) return Effect.fail(Refused.make({ reason: \"already_exists\" }));\n\tif (matches(/^entity not found\\b/iu, error.message)) return Effect.fail(Refused.make({ reason: \"not_found\" }));\n\treturn fail(\"rejected\");\n}\n/** Linear refuses a request it does not complete with `success: false`. */\nfunction succeeded(result) {\n\treturn Effect.filterOrElse(Effect.void, () => result.success, () => fail(\"rejected\"));\n}\n/** A refusal where the caller chose no ID is a plain rejection. */\nfunction refusedAsRejected(self) {\n\treturn Effect.catchTag(self, \"LinearAppRefused\", () => fail(\"rejected\"));\n}\n/** A request whose caller-chosen ID Linear refused for `expected` was done by an earlier attempt. */\nfunction settledWhen(expected) {\n\treturn (self) => Effect.catchTag(self, \"LinearAppRefused\", (refused) => Effect.filterOrElse(Effect.void, () => refused.reason === expected, () => fail(\"rejected\")));\n}\nconst make = Effect.gen(function* () {\n\tconst client = yield* HttpClient.HttpClient;\n\tconst graphql = Effect.fn(\"LinearAppClient.graphql\")(function* (token, query, variables, data) {\n\t\tconst response = yield* pipe(HttpClientRequest.post(endpoint), HttpClientRequest.bearerToken(token), HttpClientRequest.acceptJson, HttpClientRequest.bodyJsonUnsafe({\n\t\t\tquery,\n\t\t\tvariables\n\t\t}), client.execute, Effect.timeout(\"30 seconds\"), Effect.catch(() => fail(\"unavailable\")));\n\t\tif (response.status === 401 || response.status === 403) return yield* fail(\"unauthorized\");\n\t\tif (response.status === 429) return yield* fail(\"rate_limited\");\n\t\tif (response.status >= 500) return yield* fail(\"unavailable\");\n\t\tconst envelope = yield* pipe(response, HttpClientResponse.schemaBodyJson(Schema.Struct({\n\t\t\tdata: Schema.optionalKey(Schema.NullOr(data)),\n\t\t\terrors: Schema.optionalKey(Schema.Array(GraphqlError))\n\t\t})), Effect.catch(() => fail(\"rejected\")), Effect.timeoutOrElse({\n\t\t\tduration: \"30 seconds\",\n\t\t\torElse: () => fail(\"unavailable\")\n\t\t}));\n\t\treturn yield* Option.match(Array.head(envelope.errors ?? []), {\n\t\t\tonNone: () => pipe(Option.fromNullishOr(envelope.data), Option.filter(() => response.status < 300), Effect.fromOption, Effect.catch(() => fail(\"rejected\"))),\n\t\t\tonSome: (error) => pipe(Match.value(String.toUpperCase(error.extensions?.code ?? \"\")), Match.when(\"INPUT_ERROR\", () => inputRefusal(error)), Match.whenOr(\"RATELIMITED\", \"RATE_LIMITED\", () => fail(\"rate_limited\")), Match.whenOr(\"UNAUTHENTICATED\", \"AUTHENTICATION_ERROR\", \"FORBIDDEN\", () => fail(\"unauthorized\")), Match.orElse(() => fail(\"rejected\")))\n\t\t});\n\t});\n\t/** The app user and workspace the token acts as. */\n\tconst viewer = Effect.fn(\"LinearAppClient.viewer\")(function* (token) {\n\t\tconst result = yield* graphql(token, \"query LinearAppViewer { viewer { id organization { id } } }\", {}, Schema.Struct({ viewer: Schema.Struct({\n\t\t\tid: Schema.String,\n\t\t\torganization: Schema.Struct({ id: Schema.String })\n\t\t}) }));\n\t\treturn {\n\t\t\tappUserId: result.viewer.id,\n\t\t\torganizationId: result.viewer.organization.id\n\t\t};\n\t}, refusedAsRejected);\n\t/** Post one activity. Linear refuses an ID it has seen, so a retry posts nothing new. */\n\tconst createActivity = Effect.fn(\"LinearAppClient.createActivity\")(function* (token, activity) {\n\t\tconst input = {\n\t\t\tagentSessionId: activity.agentSessionId,\n\t\t\tcontent: activity.content,\n\t\t\tephemeral: activity.ephemeral,\n\t\t\tid: activity.id\n\t\t};\n\t\tyield* succeeded((yield* graphql(token, \"mutation LinearAppActivityCreate($input: AgentActivityCreateInput!) { agentActivityCreate(input: $input) { success } }\", { input: Array.match(activity.options, {\n\t\t\tonEmpty: () => input,\n\t\t\tonNonEmpty: (options) => ({\n\t\t\t\t...input,\n\t\t\t\tsignal: \"select\",\n\t\t\t\tsignalMetadata: { options: Array.map(options, (value) => ({\n\t\t\t\t\tlabel: value,\n\t\t\t\t\tvalue\n\t\t\t\t})) }\n\t\t\t})\n\t\t}) }, Schema.Struct({ agentActivityCreate: Success }))).agentActivityCreate);\n\t}, settledWhen(\"already_exists\"));\n\t/** Replace the session's whole Agent Plan, a Linear technology preview. */\n\tconst setPlan = Effect.fn(\"LinearAppClient.setPlan\")(function* (token, agentSessionId, plan) {\n\t\tyield* succeeded((yield* graphql(token, \"mutation LinearAppSessionPlan($id: String!, $input: AgentSessionUpdateInput!) { agentSessionUpdate(id: $id, input: $input) { success } }\", {\n\t\t\tid: agentSessionId,\n\t\t\tinput: { plan }\n\t\t}, Schema.Struct({ agentSessionUpdate: Success }))).agentSessionUpdate);\n\t}, refusedAsRejected);\n\t/** Make the reaction with the caller's UUID present or absent; one already so is done. */\n\tconst setReaction = Effect.fn(\"LinearAppClient.setReaction\")(function* (token, reaction) {\n\t\tif (reaction.active) return yield* pipe(graphql(token, \"mutation LinearAppReactionCreate($input: ReactionCreateInput!) { reactionCreate(input: $input) { success } }\", { input: {\n\t\t\temoji: reaction.emoji,\n\t\t\tid: reaction.id,\n\t\t\t...reaction.target\n\t\t} }, Schema.Struct({ reactionCreate: Success })), Effect.flatMap((result) => succeeded(result.reactionCreate)), settledWhen(\"already_exists\"));\n\t\treturn yield* pipe(graphql(token, \"mutation LinearAppReactionDelete($id: String!) { reactionDelete(id: $id) { success } }\", { id: reaction.id }, Schema.Struct({ reactionDelete: Success })), Effect.flatMap((result) => succeeded(result.reactionDelete)), settledWhen(\"not_found\"));\n\t});\n\treturn {\n\t\tcreateActivity,\n\t\tissueComments: Effect.fn(\"LinearAppClient.issueComments\")(function* (token, issueId, limit) {\n\t\t\tconst read = Effect.fn(\"LinearAppClient.issueComments.page\")(function* (after, seen) {\n\t\t\t\tconst page = yield* graphql(token, \"query LinearAppIssueComments($id: String!, $after: String) { issue(id: $id) { comments(first: 100, after: $after) { nodes { id body createdAt user { id name } } pageInfo { endCursor hasNextPage } } } }\", Option.match(after, {\n\t\t\t\t\tonNone: () => ({ id: issueId }),\n\t\t\t\t\tonSome: (cursor) => ({\n\t\t\t\t\t\tafter: cursor,\n\t\t\t\t\t\tid: issueId\n\t\t\t\t\t})\n\t\t\t\t}), CommentPage);\n\t\t\t\tconst comments = Array.appendAll(seen, page.issue.comments.nodes);\n\t\t\t\tconst next = pipe(Option.fromNullishOr(page.issue.comments.pageInfo.endCursor), Option.filter(() => page.issue.comments.pageInfo.hasNextPage), Option.filter(() => comments.length < maxComments));\n\t\t\t\tif (Option.isNone(next)) return comments;\n\t\t\t\treturn yield* read(next, comments);\n\t\t\t});\n\t\t\tconst comments = yield* pipe(read(Option.none(), []), refusedAsRejected);\n\t\t\treturn pipe(comments, Array.map((comment) => Option.map(Option.fromNullishOr(comment.user), (user) => ({\n\t\t\t\t...comment,\n\t\t\t\tuser\n\t\t\t}))), Array.getSomes, Array.sortWith((comment) => DateTime.toEpochMillis(comment.createdAt), Order.Number), Array.takeRight(limit));\n\t\t}),\n\t\tsetPlan,\n\t\tsetReaction,\n\t\tviewer\n\t};\n});\n/** Linear's GraphQL API for Agent Sessions, called with the installation's token. */\nvar LinearAppClient = class extends Context.Service()(\"@dual-os/linear-app/linear-app-client/LinearAppClient\") {\n\tstatic layer = Layer.effect(this, make);\n};\n//#endregion\nexport { ActivityContent, LinearAppClient };\n\n//# sourceMappingURL=linear-app-client.js.map"
6
- ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAM,WAAW;AAEjB,IAAM,cAAc;AAEpB,IAAI,UAAU,cAAc,aAAmB,EAAE,oBAAoB,EAAE,QAAQ,SAAgB,CAAC,kBAAkB,WAAW,CAAC,EAAE,C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,KAAU,CAAC,YAAY,IAAW,cAAqB,QAAQ,IAAI,GAAG,CAAC,UAAU;AAAA,WACnG;AAAA,QACH;AAAA,MACD,EAAE,CAAC,GAAG,UAAgB,SAAe,CAAC,YAAY,cAAuB,QAAQ,SAAS,GAAG,OAAY,GAAG,UAAgB,KAAK,CAAC;AAAA,KAClI;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,CACA;AAED,IAAI,mBAAkB,cAAc,QAAgB,EAAE,uDAAuD,EAAE;AAAA,SACvG,QAAQ,OAAa,MAAM,IAAI;AACvC;",
8
- "debugId": "293D3781D326E0F964756E2164756E21",
9
- "names": []
10
- }
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../bundle-input/dist/channel/internal/webhook.js"],
4
- "sourcesContent": [
5
- "import { Array, Clock, DateTime, Effect, Number, Option, Predicate, Record, Schema, String, pipe } from \"effect\";\nimport { AgentChannel, Trigger } from \"@dual-os/sdk\";\n//#region src/channel/internal/webhook.ts\n/** The longest message text the contract accepts; a longer prompt context is cut. */\nconst maxText = 65536;\n/** Linear's guide refuses a delivery dated more than a minute away from now, against replays. */\nconst maxSkewMs = 6e4;\nconst Signed = Schema.fromJsonString(Schema.Struct({ webhookTimestamp: Schema.Finite }));\nconst Envelope = Schema.fromJsonString(Schema.Struct({\n\taction: Schema.optionalKey(Schema.String),\n\torganizationId: Schema.optionalKey(Schema.String),\n\ttype: Schema.String\n}));\nconst Prompt = Schema.Struct({\n\tagentSessionId: AgentChannel.Key,\n\tcontent: Schema.Struct({ body: Schema.optionalKey(Schema.NullOr(Schema.String)) }),\n\tcreatedAt: Schema.DateTimeUtcFromString,\n\tid: AgentChannel.Key,\n\t/** `stop` when the user stops the session. */\n\tsignal: Schema.optionalKey(Schema.NullOr(Schema.String)),\n\t/** The comment the user prompted with, when they replied in the session's comment thread. */\n\tsourceCommentId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\tuserId: AgentChannel.Key\n});\nconst SessionEvent = Schema.fromJsonString(Schema.Struct({\n\taction: Schema.Literals([\"created\", \"prompted\"]),\n\tagentActivity: Schema.optionalKey(Schema.NullOr(Prompt)),\n\tagentSession: Schema.Struct({\n\t\tappUserId: AgentChannel.Key,\n\t\t/** The root comment of the session's own thread. */\n\t\tcommentId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\t\t/** The originating mention, when the session starts in a different thread. */\n\t\tsourceCommentId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\t\tcreatedAt: Schema.DateTimeUtcFromString,\n\t\tcreatorId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\t\tid: AgentChannel.Key,\n\t\tissue: Schema.optionalKey(Schema.NullOr(Schema.Struct({\n\t\t\tid: AgentChannel.Key,\n\t\t\tidentifier: Schema.String,\n\t\t\tteamId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\t\t\ttitle: Schema.String\n\t\t}))),\n\t\tissueId: Schema.optionalKey(Schema.NullOr(AgentChannel.Key)),\n\t\torganizationId: AgentChannel.Key\n\t}),\n\tappUserId: AgentChannel.Key,\n\torganizationId: AgentChannel.Key,\n\t/** Linear's summary of the issue, its comments and guidance, sent when a session starts. */\n\tpromptContext: Schema.optionalKey(Schema.NullOr(Schema.String)),\n\ttype: Schema.Literal(\"AgentSessionEvent\")\n}));\nfunction unauthorized() {\n\treturn AgentChannel.HandlerError.make({ code: \"unauthorized\" });\n}\nfunction rejected() {\n\treturn AgentChannel.HandlerError.make({ code: \"rejected\" });\n}\n/** Linear signs the raw body in `Linear-Signature` and dates it in `webhookTimestamp`. */\nconst verifyWebhook = Effect.fn(\"LinearAppWebhook.verify\")(function* (request, signingSecret) {\n\tconst signatures = pipe(Record.toEntries(request.headers), Array.filter((entry) => String.toLowerCase(entry[0]) === \"linear-signature\"), Array.map((entry) => entry[1]));\n\tif (request.method !== \"POST\" || signatures.length !== 1) return yield* unauthorized();\n\tif (!(yield* Trigger.verifyHmac({\n\t\talgorithm: \"sha256\",\n\t\tencoding: \"hex\",\n\t\tmessage: request.body,\n\t\tsecret: signingSecret,\n\t\tsignature: signatures\n\t}))) return yield* unauthorized();\n\tconst sent = (yield* pipe(request.body, Schema.decodeEffect(Signed), Effect.mapError(unauthorized))).webhookTimestamp;\n\tconst now = yield* Clock.currentTimeMillis;\n\tif (!Number.between(sent, {\n\t\tmaximum: now + maxSkewMs,\n\t\tminimum: now - maxSkewMs\n\t})) return yield* unauthorized();\n\treturn { verified: true };\n});\n/** A provider message key: the comment a user wrote, else the session or prompt it started. */\nfunction commentKey(commentId) {\n\treturn `comment/${commentId}`;\n}\n/** The Linear comment a message key names, if it names one. */\nfunction commentOf(messageKey) {\n\treturn pipe(Option.some(messageKey), Option.filter(String.startsWith(\"comment/\")), Option.map(String.slice(8)));\n}\n/** A session's conversation is its issue; a session outside an issue is its own conversation. */\nfunction destination(sessionId, issueId) {\n\treturn {\n\t\tconversationKey: Option.getOrElse(issueId, () => sessionId),\n\t\tkind: \"group\",\n\t\tthreadKey: sessionId\n\t};\n}\n/** The issue a destination names, or none for a session outside an issue. */\nfunction issueOf(target) {\n\treturn pipe(Option.some(target.conversationKey), Option.filter((key) => key !== target.threadKey));\n}\nfunction sessionStarted(webhook, identity, issueId) {\n\tconst session = webhook.agentSession;\n\tconst senderKey = session.creatorId ?? webhook.agentActivity?.userId ?? void 0;\n\tif (senderKey === void 0 || senderKey === identity.appUserId) return Array.empty();\n\tconst text = pipe([webhook.promptContext ?? \"\", webhook.agentActivity?.content.body ?? \"\"], Array.findFirst(String.isNonEmpty), Option.orElse(() => Option.map(Option.fromNullishOr(session.issue), (issue) => `${issue.identifier}: ${issue.title}`)), Option.getOrElse(() => \"Linear Agent Session started\"), String.slice(0, maxText));\n\treturn Array.of({\n\t\tcontent: { text },\n\t\tconversation: destination(session.id, issueId),\n\t\teventKey: `session/${session.id}`,\n\t\tkind: \"message\",\n\t\tmessageKey: Option.match(Option.fromNullishOr(session.sourceCommentId ?? session.commentId), {\n\t\t\tonNone: () => `session/${session.id}`,\n\t\t\tonSome: commentKey\n\t\t}),\n\t\trespond: true,\n\t\tsenderKey,\n\t\ttimestamp: DateTime.formatIso(session.createdAt)\n\t});\n}\nfunction prompted(prompt, identity, issueId) {\n\tif (prompt.userId === identity.appUserId) return Array.empty();\n\tconst shared = {\n\t\tconversation: destination(prompt.agentSessionId, issueId),\n\t\teventKey: `activity/${prompt.id}`,\n\t\tsenderKey: prompt.userId,\n\t\ttimestamp: DateTime.formatIso(prompt.createdAt)\n\t};\n\tif (prompt.signal === \"stop\") return Array.of({\n\t\t...shared,\n\t\tkind: \"stop\"\n\t});\n\tconst text = String.slice(0, maxText)(prompt.content.body ?? \"\");\n\tif (String.isEmpty(text)) return Array.empty();\n\treturn Array.of({\n\t\t...shared,\n\t\tcontent: { text },\n\t\tkind: \"message\",\n\t\tmessageKey: Option.match(Option.fromNullishOr(prompt.sourceCommentId), {\n\t\t\tonNone: () => `activity/${prompt.id}`,\n\t\t\tonSome: commentKey\n\t\t}),\n\t\trespond: true\n\t});\n}\n/** The events of one verified webhook: a session start, a prompt or a stop; nothing for the rest. */\nconst webhookEvents = Effect.fn(\"LinearAppWebhook.events\")(function* (body, identity, teams) {\n\tconst envelope = yield* pipe(body, Schema.decodeEffect(Envelope), Effect.mapError(rejected));\n\tif ((envelope.organizationId ?? identity.organizationId) !== identity.organizationId) return yield* unauthorized();\n\tif (envelope.type !== \"AgentSessionEvent\" || envelope.action !== \"created\" && envelope.action !== \"prompted\") return Array.empty();\n\tconst webhook = yield* pipe(body, Schema.decodeEffect(SessionEvent), Effect.mapError(rejected));\n\tconst session = webhook.agentSession;\n\tif (webhook.organizationId !== identity.organizationId || session.organizationId !== identity.organizationId || webhook.appUserId !== identity.appUserId || session.appUserId !== identity.appUserId) return yield* unauthorized();\n\tconst issueIds = Array.dedupe(Array.filter([session.issue?.id, session.issueId], Predicate.isNotNullish));\n\tif (issueIds.length > 1 || Predicate.isNotNullish(webhook.agentActivity) && webhook.agentActivity.agentSessionId !== session.id) return yield* rejected();\n\tif (Array.isReadonlyArrayNonEmpty(teams) && !Array.contains(teams, session.issue?.teamId ?? \"\")) return Array.empty();\n\tif (webhook.action === \"created\") return sessionStarted(webhook, identity, Array.head(issueIds));\n\tif (Predicate.isNullish(webhook.agentActivity)) return yield* rejected();\n\treturn prompted(webhook.agentActivity, identity, Array.head(issueIds));\n});\n//#endregion\nexport { commentKey, commentOf, issueOf, verifyWebhook, webhookEvents };\n\n//# sourceMappingURL=webhook.js.map"
6
- ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAM,UAAU;AAEhB,IAAM,YAAY;AAClB,IAAM,SAAS,eAAsB,OAAc,EAAE,kBAAkB,OAAc,CAAC,CAAC;AACvF,IAAM,WAAW,eAAsB,OAAc;AAAA,EACpD,QAAQ,YAAmB,OAAa;AAAA,EACxC,gBAAgB,YAAmB,OAAa;AAAA,EAChD,MAAM;AACP,CAAC,CAAC;AACF,IAAM,SAAS,OAAc;AAAA,EAC5B,gBAAgB,qBAAa;AAAA,EAC7B,SAAS,OAAc,EAAE,MAAM,YAAmB,OAAc,OAAa,CAAC,EAAE,CAAC;AAAA,EACjF,WAAW;AAAA,EACX,IAAI,qBAAa;AAAA,EAEjB,QAAQ,YAAmB,OAAc,OAAa,CAAC;AAAA,EAEvD,iBAAiB,YAAmB,OAAc,qBAAa,GAAG,CAAC;AAAA,EACnE,QAAQ,qBAAa;AACtB,CAAC;AACD,IAAM,eAAe,eAAsB,OAAc;AAAA,EACxD,QAAQ,SAAgB,CAAC,WAAW,UAAU,CAAC;AAAA,EAC/C,eAAe,YAAmB,OAAc,MAAM,CAAC;AAAA,EACvD,cAAc,OAAc;AAAA,IAC3B,WAAW,qBAAa;AAAA,IAExB,WAAW,YAAmB,OAAc,qBAAa,GAAG,CAAC;AAAA,IAE7D,iBAAiB,YAAmB,OAAc,qBAAa,GAAG,CAAC;AAAA,I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