@dual-os/github-api 6.0.3 → 6.0.5
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.
- package/LICENSE +24 -0
- package/README.md +35 -0
- package/Runner.js +342 -576
- package/Runner.js.map +5 -9
- package/bundle-inventory.json +1 -1
- package/dist/auth.d.ts +13 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +5 -3
- package/dist/auth.js.map +1 -1
- package/dist/channel/github-app-client.d.ts +67 -0
- package/dist/channel/github-app-client.d.ts.map +1 -0
- package/dist/channel/github-app-client.js +18 -0
- package/dist/channel/github-app-client.js.map +9 -0
- package/dist/channel/github-app-definition.d.ts +190 -0
- package/dist/channel/github-app-definition.d.ts.map +1 -0
- package/dist/channel/github-app-definition.js +32 -0
- package/dist/channel/github-app-definition.js.map +9 -0
- package/dist/channel/github-app.d.ts +126 -0
- package/dist/channel/github-app.d.ts.map +1 -0
- package/dist/channel/github-app.js +17 -0
- package/dist/channel/github-app.js.map +9 -0
- package/dist/channel/internal/webhook.d.ts +38 -0
- package/dist/channel/internal/webhook.d.ts.map +1 -0
- package/dist/channel/internal/webhook.js +22 -0
- package/dist/channel/internal/webhook.js.map +9 -0
- package/dist/generated/http.js +7 -5
- package/dist/generated/http.js.map +1 -1
- package/dist/generated/operations.d.ts +1154 -1154
- package/dist/generated/operations.d.ts.map +1 -1
- package/dist/generated/operations.js +7 -5
- package/dist/generated/operations.js.map +1 -1
- package/dist/generated/plugin.js +14 -10515
- package/dist/generated/plugin.js.map +3 -4
- package/dist/plugin.d.ts +10 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +33 -0
- package/dist/plugin.js.map +10 -0
- package/dist/triggers.d.ts +26 -2
- package/dist/triggers.d.ts.map +1 -1
- package/dist/triggers.js +8 -6
- package/dist/triggers.js.map +1 -1
- package/dual-plugin.json +1 -1
- package/package.json +1 -1
- package/{plugin-t4j28rxn.js → plugin-1b35jx9g.js} +6 -4
- package/{plugin-t4j28rxn.js.map → plugin-1b35jx9g.js.map} +2 -2
- package/plugin-2qqpmr67.js +108 -0
- package/plugin-2qqpmr67.js.map +10 -0
- package/{plugin-yzj02c6j.js → plugin-3ryytw13.js} +193 -308
- package/{plugin-yzj02c6j.js.map → plugin-3ryytw13.js.map} +5 -6
- package/{plugin-3mpmm6hc.js → plugin-5rkcrntd.js} +4 -4
- package/plugin-7hfrx1dg.js +167 -0
- package/plugin-7hfrx1dg.js.map +10 -0
- package/plugin-e0mt19z7.js +377 -0
- package/plugin-e0mt19z7.js.map +10 -0
- package/{plugin-ahctqzvj.js → plugin-gtd7vh23.js} +4 -4
- package/plugin-p1y3h7d7.js +10516 -0
- package/plugin-p1y3h7d7.js.map +10 -0
- package/plugin-p6f7n836.js +631 -0
- package/plugin-p6f7n836.js.map +12 -0
- package/plugin-r0m0v72b.js +156 -0
- package/plugin-r0m0v72b.js.map +10 -0
- package/{plugin-gajxsj3f.js → plugin-w0va8331.js} +2495 -2288
- package/{plugin-gajxsj3f.js.map → plugin-w0va8331.js.map} +12 -13
- /package/licenses/{@dual-os_sdk@0.8.1 → @dual-os_sdk@0.9.0}/LICENSE +0 -0
- /package/{plugin-3mpmm6hc.js.map → plugin-5rkcrntd.js.map} +0 -0
- /package/{plugin-ahctqzvj.js.map → plugin-gtd7vh23.js.map} +0 -0
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import {
|
|
3
|
-
__exportAll2
|
|
4
|
-
} from "./plugin-2jdfj02n.js";
|
|
5
2
|
import {
|
|
6
3
|
dual,
|
|
7
4
|
identity,
|
|
@@ -36,9 +33,7 @@ import {
|
|
|
36
33
|
fromOption,
|
|
37
34
|
try_,
|
|
38
35
|
isSuccess,
|
|
39
|
-
mapError,
|
|
40
36
|
match3,
|
|
41
|
-
all,
|
|
42
37
|
fromEntries,
|
|
43
38
|
toEntries,
|
|
44
39
|
has,
|
|
@@ -53,7 +48,7 @@ import {
|
|
|
53
48
|
sort,
|
|
54
49
|
zip,
|
|
55
50
|
contains,
|
|
56
|
-
|
|
51
|
+
empty,
|
|
57
52
|
map3,
|
|
58
53
|
flatMap2,
|
|
59
54
|
filterMap,
|
|
@@ -80,14 +75,13 @@ import {
|
|
|
80
75
|
isEffect,
|
|
81
76
|
forEach,
|
|
82
77
|
promise,
|
|
83
|
-
|
|
78
|
+
succeed5,
|
|
84
79
|
suspend,
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
sync2,
|
|
81
|
+
void_3,
|
|
87
82
|
gen,
|
|
88
83
|
fail5,
|
|
89
|
-
|
|
90
|
-
fromResult,
|
|
84
|
+
withFiber2,
|
|
91
85
|
fromOption2,
|
|
92
86
|
flatMap3,
|
|
93
87
|
result,
|
|
@@ -103,7 +97,7 @@ import {
|
|
|
103
97
|
fn,
|
|
104
98
|
encode2,
|
|
105
99
|
encode3,
|
|
106
|
-
|
|
100
|
+
decode3,
|
|
107
101
|
makeZoned,
|
|
108
102
|
make3,
|
|
109
103
|
toUtc,
|
|
@@ -111,10 +105,10 @@ import {
|
|
|
111
105
|
toEpochMillis,
|
|
112
106
|
formatIso,
|
|
113
107
|
formatIsoOffset,
|
|
108
|
+
empty2,
|
|
114
109
|
empty3,
|
|
115
|
-
empty4,
|
|
116
110
|
InvalidValue,
|
|
117
|
-
|
|
111
|
+
compose,
|
|
118
112
|
transform,
|
|
119
113
|
transformEffect,
|
|
120
114
|
is,
|
|
@@ -138,7 +132,6 @@ import {
|
|
|
138
132
|
decodeTo,
|
|
139
133
|
Int,
|
|
140
134
|
Natural,
|
|
141
|
-
NonEmptyString,
|
|
142
135
|
Defect,
|
|
143
136
|
fromJsonString,
|
|
144
137
|
Uint8ArrayFromBase64,
|
|
@@ -159,12 +152,10 @@ import {
|
|
|
159
152
|
decodeText,
|
|
160
153
|
runCollect,
|
|
161
154
|
runHead,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
empty6,
|
|
155
|
+
__exportAll3,
|
|
156
|
+
empty5,
|
|
165
157
|
HttpClientError,
|
|
166
158
|
InvalidUrlError,
|
|
167
|
-
fromString,
|
|
168
159
|
makeWith,
|
|
169
160
|
post,
|
|
170
161
|
put,
|
|
@@ -172,10 +163,7 @@ import {
|
|
|
172
163
|
setMethod,
|
|
173
164
|
setHeader,
|
|
174
165
|
setHeaders,
|
|
175
|
-
basicAuth,
|
|
176
|
-
bearerToken,
|
|
177
166
|
setUrl,
|
|
178
|
-
updateUrl,
|
|
179
167
|
setUrlParam,
|
|
180
168
|
setBody,
|
|
181
169
|
bodyUint8Array,
|
|
@@ -184,13 +172,10 @@ import {
|
|
|
184
172
|
HttpClient,
|
|
185
173
|
transformResponse,
|
|
186
174
|
filterStatusOk,
|
|
187
|
-
mapRequest,
|
|
188
175
|
mapRequestEffect,
|
|
189
176
|
RequestInit,
|
|
190
|
-
__exportAll3,
|
|
191
177
|
ActionHandlerError,
|
|
192
178
|
fromHttpClientFailure,
|
|
193
|
-
AuthMethod_exports,
|
|
194
179
|
Schema,
|
|
195
180
|
Key3,
|
|
196
181
|
Event3,
|
|
@@ -198,9 +183,12 @@ import {
|
|
|
198
183
|
Service2,
|
|
199
184
|
File3,
|
|
200
185
|
read,
|
|
201
|
-
write
|
|
202
|
-
|
|
203
|
-
|
|
186
|
+
write
|
|
187
|
+
} from "./plugin-w0va8331.js";
|
|
188
|
+
|
|
189
|
+
// ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Boolean.js
|
|
190
|
+
var Boolean = globalThis.Boolean;
|
|
191
|
+
var match = /* @__PURE__ */ dual(2, (value, options) => value ? options.onTrue() : options.onFalse());
|
|
204
192
|
|
|
205
193
|
// ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/random.js
|
|
206
194
|
var Random = /* @__PURE__ */ Reference("effect/Random", {
|
|
@@ -216,13 +204,9 @@ var Random = /* @__PURE__ */ Reference("effect/Random", {
|
|
|
216
204
|
|
|
217
205
|
// ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Random.js
|
|
218
206
|
var Random2 = Random;
|
|
219
|
-
var randomWith = (f) =>
|
|
207
|
+
var randomWith = (f) => withFiber2((fiber) => succeed5(f(fiber.getRef(Random2))));
|
|
220
208
|
var nextInt = /* @__PURE__ */ randomWith((r) => r.nextIntUnsafe());
|
|
221
209
|
|
|
222
|
-
// ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Boolean.js
|
|
223
|
-
var Boolean = globalThis.Boolean;
|
|
224
|
-
var match = /* @__PURE__ */ dual(2, (value, options) => value ? options.onTrue() : options.onFalse());
|
|
225
|
-
|
|
226
210
|
// ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Ref.js
|
|
227
211
|
var TypeId = "~effect/Ref";
|
|
228
212
|
var RefProto = {
|
|
@@ -242,10 +226,10 @@ var makeUnsafe = (value) => {
|
|
|
242
226
|
self.ref = make5(value);
|
|
243
227
|
return self;
|
|
244
228
|
};
|
|
245
|
-
var make = (value) =>
|
|
246
|
-
var get = (self) =>
|
|
247
|
-
var set2 = /* @__PURE__ */ dual(2, (self, value) =>
|
|
248
|
-
var getAndUpdate = /* @__PURE__ */ dual(2, (self, f) =>
|
|
229
|
+
var make = (value) => sync2(() => makeUnsafe(value));
|
|
230
|
+
var get = (self) => sync2(() => self.ref.current);
|
|
231
|
+
var set2 = /* @__PURE__ */ dual(2, (self, value) => sync2(() => set(self.ref, value)));
|
|
232
|
+
var getAndUpdate = /* @__PURE__ */ dual(2, (self, f) => sync2(() => {
|
|
249
233
|
const current = self.ref.current;
|
|
250
234
|
self.ref.current = f(current);
|
|
251
235
|
return current;
|
|
@@ -403,155 +387,7 @@ class Retry extends (/* @__PURE__ */ TaggedClass("Retry")) {
|
|
|
403
387
|
}
|
|
404
388
|
}
|
|
405
389
|
|
|
406
|
-
// ../../../../node_modules/.bun/@dual-os+sdk@0.
|
|
407
|
-
var Command = commandSchema(Json);
|
|
408
|
-
var Fixture = Struct({
|
|
409
|
-
activate: Command,
|
|
410
|
-
channelId: Key3,
|
|
411
|
-
connectionId: optionalKey(Key3),
|
|
412
|
-
deactivate: Command,
|
|
413
|
-
definitionSettings: Json,
|
|
414
|
-
deliver: Command,
|
|
415
|
-
deploymentSettings: Json,
|
|
416
|
-
receive: Command
|
|
417
|
-
});
|
|
418
|
-
var ConformanceError = class extends TaggedError2()("AgentChannelConformanceError", {
|
|
419
|
-
command: Literals([
|
|
420
|
-
"activate",
|
|
421
|
-
"deactivate",
|
|
422
|
-
"receive",
|
|
423
|
-
"deliver"
|
|
424
|
-
]),
|
|
425
|
-
rule: Literals([
|
|
426
|
-
"command_kind",
|
|
427
|
-
"stable_result",
|
|
428
|
-
"stable_events",
|
|
429
|
-
"boundary_rejection"
|
|
430
|
-
])
|
|
431
|
-
}) {
|
|
432
|
-
};
|
|
433
|
-
var run = fn("AgentChannelConformance.run")(function* (input) {
|
|
434
|
-
const fixture = yield* decodeUnknownEffect(Fixture)(input, { onExcessProperty: "error" });
|
|
435
|
-
const runtime = yield* Service2;
|
|
436
|
-
const definition = yield* runtime.getAgentChannel({ channelId: fixture.channelId });
|
|
437
|
-
const { activate, receive, deliver, deactivate, ...config } = fixture;
|
|
438
|
-
const { connectionId: _connectionId, ...withoutConnection } = config;
|
|
439
|
-
const probes = [
|
|
440
|
-
{
|
|
441
|
-
code: "invalid_input",
|
|
442
|
-
input: {
|
|
443
|
-
...config,
|
|
444
|
-
channelId: "",
|
|
445
|
-
command: activate
|
|
446
|
-
}
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
input: {
|
|
450
|
-
...config,
|
|
451
|
-
channelId: "conformance/missing/channel",
|
|
452
|
-
command: activate
|
|
453
|
-
},
|
|
454
|
-
code: "not_found"
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
code: "invalid_input",
|
|
458
|
-
input: {
|
|
459
|
-
...config,
|
|
460
|
-
command: {
|
|
461
|
-
...activate,
|
|
462
|
-
operationKey: ""
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
code: "invalid_input",
|
|
468
|
-
input: {
|
|
469
|
-
...config,
|
|
470
|
-
agent: { id: "synthetic-authority" },
|
|
471
|
-
command: activate
|
|
472
|
-
}
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
code: "invalid_auth",
|
|
476
|
-
input: definition.authMethods.length === 0 ? {
|
|
477
|
-
...config,
|
|
478
|
-
command: activate,
|
|
479
|
-
connectionId: "unexpected"
|
|
480
|
-
} : {
|
|
481
|
-
...withoutConnection,
|
|
482
|
-
command: activate
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
];
|
|
486
|
-
for (const probe of probes) {
|
|
487
|
-
const outcome = yield* suspend(() => runtime.executeAgentChannel(probe.input)).pipe(result);
|
|
488
|
-
if (outcome._tag !== "Failure" || outcome.failure.code !== probe.code)
|
|
489
|
-
return yield* new ConformanceError({
|
|
490
|
-
command: "activate",
|
|
491
|
-
rule: "boundary_rejection"
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
const commands = [
|
|
495
|
-
["activate", activate],
|
|
496
|
-
["receive", receive],
|
|
497
|
-
["deliver", deliver],
|
|
498
|
-
["deactivate", deactivate]
|
|
499
|
-
];
|
|
500
|
-
for (const [kind, command] of commands)
|
|
501
|
-
if (command.kind !== kind)
|
|
502
|
-
return yield* new ConformanceError({
|
|
503
|
-
command: kind,
|
|
504
|
-
rule: "command_kind"
|
|
505
|
-
});
|
|
506
|
-
const activated = yield* acquireRelease(runtime.executeAgentChannel({
|
|
507
|
-
...config,
|
|
508
|
-
command: activate
|
|
509
|
-
}), (result2) => runtime.executeAgentChannel({
|
|
510
|
-
...config,
|
|
511
|
-
command: {
|
|
512
|
-
...deactivate,
|
|
513
|
-
...result2.kind === "activate" ? {
|
|
514
|
-
installationKey: result2.installationKey,
|
|
515
|
-
state: result2.state
|
|
516
|
-
} : {}
|
|
517
|
-
}
|
|
518
|
-
}).pipe(orDie));
|
|
519
|
-
for (const [kind, command] of commands) {
|
|
520
|
-
const first = kind === "activate" ? activated : yield* runtime.executeAgentChannel({
|
|
521
|
-
...config,
|
|
522
|
-
command
|
|
523
|
-
});
|
|
524
|
-
if (kind === "deliver" && definition.features.deliveryMode === "at-most-once")
|
|
525
|
-
continue;
|
|
526
|
-
const second = yield* runtime.executeAgentChannel({
|
|
527
|
-
...config,
|
|
528
|
-
command
|
|
529
|
-
});
|
|
530
|
-
const firstJson = yield* decodeUnknownEffect(Json)(first);
|
|
531
|
-
const secondJson = yield* decodeUnknownEffect(Json)(second);
|
|
532
|
-
if (!toEquivalence(Json)(firstJson, secondJson))
|
|
533
|
-
return yield* new ConformanceError({
|
|
534
|
-
command: kind,
|
|
535
|
-
rule: "stable_result"
|
|
536
|
-
});
|
|
537
|
-
if (kind === "receive") {
|
|
538
|
-
const nextReceipt = yield* runtime.executeAgentChannel({
|
|
539
|
-
...config,
|
|
540
|
-
command: {
|
|
541
|
-
...command,
|
|
542
|
-
operationKey: `${command.operationKey.slice(0, 500)}:replay`
|
|
543
|
-
}
|
|
544
|
-
});
|
|
545
|
-
if (first.kind !== "receive" || nextReceipt.kind !== "receive" || !toEquivalence(ArraySchema(Event3))(first.events, nextReceipt.events))
|
|
546
|
-
return yield* new ConformanceError({
|
|
547
|
-
command: kind,
|
|
548
|
-
rule: "stable_events"
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
}, scoped);
|
|
553
|
-
|
|
554
|
-
// ../../../../node_modules/.bun/@dual-os+sdk@0.8.1+a827849ded09603e/node_modules/@dual-os/sdk/dist/Mcp.js
|
|
390
|
+
// ../../../../node_modules/.bun/@dual-os+sdk@0.9.0+a827849ded09603e/node_modules/@dual-os/sdk/dist/Mcp.js
|
|
555
391
|
var McpError = class extends TaggedError2()("McpError", {
|
|
556
392
|
cause: optional(Defect()),
|
|
557
393
|
message: String3
|
|
@@ -596,8 +432,8 @@ var Message = Struct({
|
|
|
596
432
|
var responseTo = fnUntraced(function* (id, method, response) {
|
|
597
433
|
const payloads = match(pipe(response.headers["content-type"] ?? "", startsWith("text/event-stream")), {
|
|
598
434
|
onFalse: () => fromEffect(response.text),
|
|
599
|
-
onTrue: () => unwrap2(
|
|
600
|
-
const events = make5(
|
|
435
|
+
onTrue: () => unwrap2(sync2(() => {
|
|
436
|
+
const events = make5(empty());
|
|
601
437
|
const parser = makeParser((event) => {
|
|
602
438
|
if (event._tag === "Event")
|
|
603
439
|
update(events, append(event.data));
|
|
@@ -610,8 +446,8 @@ var responseTo = fnUntraced(function* (id, method, response) {
|
|
|
610
446
|
message: error.message
|
|
611
447
|
}));
|
|
612
448
|
const ready = get2(events);
|
|
613
|
-
set(events,
|
|
614
|
-
return
|
|
449
|
+
set(events, empty());
|
|
450
|
+
return succeed5(ready);
|
|
615
451
|
}), flatMap4(fromIterable2));
|
|
616
452
|
}))
|
|
617
453
|
});
|
|
@@ -657,7 +493,7 @@ var connect = fn("Mcp.connect")(function* (client, endpoint, headers) {
|
|
|
657
493
|
},
|
|
658
494
|
protocolVersion
|
|
659
495
|
}), (opened) => match2(opened.session, {
|
|
660
|
-
onNone: () =>
|
|
496
|
+
onNone: () => void_3,
|
|
661
497
|
onSome: (id) => flatMap3(get(negotiatedVersion), (version) => ignore(client.execute(pipe(del(endpoint), setHeaders({
|
|
662
498
|
...headers,
|
|
663
499
|
"mcp-protocol-version": version,
|
|
@@ -689,7 +525,7 @@ var listTools = fn("Mcp.listTools")(function* (client, endpoint, headers) {
|
|
|
689
525
|
};
|
|
690
526
|
}, scoped);
|
|
691
527
|
|
|
692
|
-
// ../../../../node_modules/.bun/@dual-os+sdk@0.
|
|
528
|
+
// ../../../../node_modules/.bun/@dual-os+sdk@0.9.0+a827849ded09603e/node_modules/@dual-os/sdk/dist/Http.js
|
|
693
529
|
var Http_exports = /* @__PURE__ */ __exportAll3({
|
|
694
530
|
Base64FromFile: () => Base64FromFile2,
|
|
695
531
|
Base64UrlFromFile: () => Base64UrlFromFile2,
|
|
@@ -735,7 +571,7 @@ function preserveJsonProperties(value, input) {
|
|
|
735
571
|
return value;
|
|
736
572
|
}
|
|
737
573
|
function decodeResponse(output) {
|
|
738
|
-
return flow(
|
|
574
|
+
return flow(succeed5, flatMap3((input) => pipe(decodeUnknownEffect(output)(input), map4((value) => preserveJsonProperties(value, input)))));
|
|
739
575
|
}
|
|
740
576
|
var File2 = Struct({
|
|
741
577
|
_tag: optionalKey(Literal("ToolFile")),
|
|
@@ -803,9 +639,9 @@ function invalid(expected, value, options) {
|
|
|
803
639
|
return fail5(new InvalidValue({ expected }, value, options));
|
|
804
640
|
}
|
|
805
641
|
function decodeBytes(text, options) {
|
|
806
|
-
return match3(
|
|
642
|
+
return match3(decode3(pipe(text, replaceAll("+", "-"), replaceAll("/", "_"))), {
|
|
807
643
|
onFailure: () => invalid("a Base64 or Base64Url string", text, options),
|
|
808
|
-
onSuccess: (bytes) =>
|
|
644
|
+
onSuccess: (bytes) => succeed5(bytes)
|
|
809
645
|
});
|
|
810
646
|
}
|
|
811
647
|
function contentOf(carrier) {
|
|
@@ -833,7 +669,7 @@ function textOf(carrier, content) {
|
|
|
833
669
|
}
|
|
834
670
|
function fileFrom(carrier) {
|
|
835
671
|
return String3.pipe(decodeTo(Schema, {
|
|
836
|
-
decode:
|
|
672
|
+
decode: compose(contentOf(carrier), transform((content) => toolFile(content.bytes, content.contentType, null))),
|
|
837
673
|
encode: transformEffect((file, options) => map4(decodeBytes(file.contentBase64, options), (bytes) => textOf(carrier, {
|
|
838
674
|
bytes,
|
|
839
675
|
contentType: file.contentType
|
|
@@ -846,7 +682,7 @@ function encodedFrom(carrier) {
|
|
|
846
682
|
bytes: file.contentBase64,
|
|
847
683
|
contentType: file.contentType ?? null
|
|
848
684
|
})),
|
|
849
|
-
encode:
|
|
685
|
+
encode: compose(contentOf(carrier), transform((content) => ({
|
|
850
686
|
contentBase64: content.bytes,
|
|
851
687
|
contentType: content.contentType
|
|
852
688
|
})))
|
|
@@ -866,11 +702,11 @@ function rfc3339Instant(text) {
|
|
|
866
702
|
function instants(wire, expected, read, write) {
|
|
867
703
|
const fromWire = transformEffect((value, options) => match2(read(value), {
|
|
868
704
|
onNone: () => invalid(expected, value, options),
|
|
869
|
-
onSome: (instant) =>
|
|
705
|
+
onSome: (instant) => succeed5(formatIso(instant))
|
|
870
706
|
}));
|
|
871
707
|
const toWire = transformEffect((text, options) => match2(rfc3339Instant(text), {
|
|
872
708
|
onNone: () => invalid("an ISO 8601 date-time", text, options),
|
|
873
|
-
onSome: (instant) =>
|
|
709
|
+
onSome: (instant) => succeed5(write(instant))
|
|
874
710
|
}));
|
|
875
711
|
return {
|
|
876
712
|
input: pipe(DateTimeText, decodeTo(wire, {
|
|
@@ -976,7 +812,7 @@ function mediaBytes(media) {
|
|
|
976
812
|
bytes,
|
|
977
813
|
contentType: media.contentType
|
|
978
814
|
}));
|
|
979
|
-
return
|
|
815
|
+
return succeed5({
|
|
980
816
|
bytes: media.contentBase64,
|
|
981
817
|
contentType: getOrNull(fromNullishOr(media.contentType))
|
|
982
818
|
});
|
|
@@ -992,17 +828,17 @@ function refused(message) {
|
|
|
992
828
|
}
|
|
993
829
|
function continuation2(request, nextLink) {
|
|
994
830
|
if (nextLink === undefined)
|
|
995
|
-
return
|
|
831
|
+
return succeed5(request);
|
|
996
832
|
const declared = new URL(request.url);
|
|
997
833
|
const next = URL.canParse(nextLink) ? new URL(nextLink) : undefined;
|
|
998
834
|
if (next === undefined || !isSafeUrl(nextLink) || next.pathname !== declared.pathname)
|
|
999
835
|
return refused("A continuation URL must be an HTTPS link to the same operation path");
|
|
1000
|
-
return
|
|
836
|
+
return succeed5(makeWith(request.method, `${declared.origin}${next.pathname}${next.search}`, empty3, none(), request.headers, empty5));
|
|
1001
837
|
}
|
|
1002
838
|
function preauthenticated2(method, url, ...steps) {
|
|
1003
839
|
if (!isSafeUrl(url))
|
|
1004
840
|
return refused("An upload session requires a preauthenticated HTTPS URL");
|
|
1005
|
-
return
|
|
841
|
+
return succeed5(reduce(steps, method(url), (request, step) => step(request)));
|
|
1006
842
|
}
|
|
1007
843
|
function failure(error) {
|
|
1008
844
|
return is(ActionHandlerError)(error) ? error : fromHttpClientFailure(error);
|
|
@@ -1013,12 +849,12 @@ function redirect(response) {
|
|
|
1013
849
|
return;
|
|
1014
850
|
const sent = response.request;
|
|
1015
851
|
const url = new URL(location, sent.url);
|
|
1016
|
-
const request = response.status === 303 && sent.method !== "GET" && sent.method !== "HEAD" || (response.status === 301 || response.status === 302) && sent.method === "POST" ? setBody(setMethod(sent, "GET"),
|
|
1017
|
-
return url.origin === new URL(sent.url).origin ? setUrl(request, url) : setUrl(makeWith(request.method, "",
|
|
852
|
+
const request = response.status === 303 && sent.method !== "GET" && sent.method !== "HEAD" || (response.status === 301 || response.status === 302) && sent.method === "POST" ? setBody(setMethod(sent, "GET"), empty5) : sent;
|
|
853
|
+
return url.origin === new URL(sent.url).origin ? setUrl(request, url) : setUrl(makeWith(request.method, "", empty3, none(), empty2, request.body), url);
|
|
1018
854
|
}
|
|
1019
855
|
function follow(client, response, redirects) {
|
|
1020
856
|
const next = redirect(response);
|
|
1021
|
-
return next === undefined || redirects === 10 ?
|
|
857
|
+
return next === undefined || redirects === 10 ? succeed5(response) : flatMap3(client.execute(next), (result) => follow(client, result, redirects + 1));
|
|
1022
858
|
}
|
|
1023
859
|
function dispositionName(header) {
|
|
1024
860
|
if (header === undefined)
|
|
@@ -1051,11 +887,11 @@ var read2 = fnUntraced(function* (response, body) {
|
|
|
1051
887
|
return toolFile(bytes, response.headers["content-type"] ?? null, name ?? null);
|
|
1052
888
|
});
|
|
1053
889
|
function make2(auth) {
|
|
1054
|
-
const { authorize, checkResponse = () =>
|
|
890
|
+
const { authorize, checkResponse = () => void_3 } = auth;
|
|
1055
891
|
const send = fnUntraced(function* (context, request) {
|
|
1056
892
|
const base = yield* HttpClient;
|
|
1057
893
|
const uploadPolicy = context === undefined ? auth.preauthenticatedUploadUrl : undefined;
|
|
1058
|
-
const client = uploadPolicy === undefined ? base : mapRequestEffect(base, (outgoing) => isSafeUrl(outgoing.url) && is(uploadPolicy)(outgoing.url) ?
|
|
894
|
+
const client = uploadPolicy === undefined ? base : mapRequestEffect(base, (outgoing) => isSafeUrl(outgoing.url) && is(uploadPolicy)(outgoing.url) ? succeed5(outgoing) : fail5(new HttpClientError({ reason: new InvalidUrlError({
|
|
1059
895
|
description: "The upload URL is not an approved provider HTTPS destination",
|
|
1060
896
|
request: outgoing
|
|
1061
897
|
}) })));
|
|
@@ -1267,106 +1103,155 @@ Content-Type: ${contentType}\r
|
|
|
1267
1103
|
};
|
|
1268
1104
|
}
|
|
1269
1105
|
|
|
1270
|
-
// dist/
|
|
1271
|
-
var
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1106
|
+
// ../../../../node_modules/.bun/@dual-os+sdk@0.9.0+a827849ded09603e/node_modules/@dual-os/sdk/dist/AgentChannelConformance.js
|
|
1107
|
+
var Command = commandSchema(Json);
|
|
1108
|
+
var Fixture = Struct({
|
|
1109
|
+
activate: Command,
|
|
1110
|
+
channelId: Key3,
|
|
1111
|
+
connectionId: optionalKey(Key3),
|
|
1112
|
+
deactivate: Command,
|
|
1113
|
+
definitionSettings: Json,
|
|
1114
|
+
deliver: Command,
|
|
1115
|
+
deploymentSettings: Json,
|
|
1116
|
+
receive: Command
|
|
1276
1117
|
});
|
|
1277
|
-
var
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
server: optionalKey(String3),
|
|
1292
|
-
token: NonEmptyString
|
|
1293
|
-
})
|
|
1294
|
-
}), AuthMethod_exports.oauth2("oauth2", {
|
|
1295
|
-
authorizationUrl: (context) => `${webOrigin(context.setup.server)}/login/oauth/authorize`,
|
|
1296
|
-
client: (options) => ({
|
|
1297
|
-
authentication: "post",
|
|
1298
|
-
clientId: options.setup.clientId,
|
|
1299
|
-
clientSecret: options.setup.clientSecret
|
|
1300
|
-
}),
|
|
1301
|
-
description: "Authenticate with a GitHub OAuth app; set server for GitHub Enterprise Server, whose OAuth endpoints are on the same host",
|
|
1302
|
-
material: AuthMethod_exports.OAuth2TokenMaterial,
|
|
1303
|
-
name: "GitHub OAuth app",
|
|
1304
|
-
resolve: (material, context) => ({
|
|
1305
|
-
accessToken: material.accessToken,
|
|
1306
|
-
server: context.setup.server
|
|
1307
|
-
}),
|
|
1308
|
-
scopes: [
|
|
1309
|
-
"repo",
|
|
1310
|
-
"admin:repo_hook",
|
|
1311
|
-
"admin:org",
|
|
1312
|
-
"admin:org_hook",
|
|
1313
|
-
"gist",
|
|
1314
|
-
"notifications",
|
|
1315
|
-
"user",
|
|
1316
|
-
"write:packages",
|
|
1317
|
-
"read:packages",
|
|
1318
|
-
"delete:packages",
|
|
1319
|
-
"workflow"
|
|
1320
|
-
],
|
|
1321
|
-
setup: Struct({
|
|
1322
|
-
clientId: String3,
|
|
1323
|
-
clientSecret: String3,
|
|
1324
|
-
server: optional(String3)
|
|
1325
|
-
}),
|
|
1326
|
-
tokenUrl: (context) => `${webOrigin(context.setup.server)}/login/oauth/access_token`,
|
|
1327
|
-
value: Struct({
|
|
1328
|
-
accessToken: String3,
|
|
1329
|
-
server: optional(String3)
|
|
1330
|
-
})
|
|
1331
|
-
})];
|
|
1332
|
-
function token(context) {
|
|
1333
|
-
return pipe(value2(context.auth.current), discriminatorsExhaustive("methodId")({
|
|
1334
|
-
oauth2: (binding) => binding.value.accessToken,
|
|
1335
|
-
"personal-access-token": (binding) => binding.value.token
|
|
1336
|
-
}));
|
|
1337
|
-
}
|
|
1338
|
-
function authorize2(client, context) {
|
|
1339
|
-
const server = context.auth.current.value.server;
|
|
1340
|
-
return pipe(client, mapRequest(bearerToken(token(context))), mapRequest(setHeader("X-GitHub-Api-Version", "2022-11-28")), mapRequestEffect(fnUntraced(function* (request) {
|
|
1341
|
-
if (server === undefined || server === "")
|
|
1342
|
-
return request;
|
|
1343
|
-
const urls = yield* pipe(all({
|
|
1344
|
-
base: fromString(server),
|
|
1345
|
-
target: fromString(request.url)
|
|
1346
|
-
}), mapError((cause) => new HttpClientError({ reason: new InvalidUrlError({
|
|
1347
|
-
cause,
|
|
1348
|
-
request
|
|
1349
|
-
}) })), fromResult);
|
|
1350
|
-
const publicApi = urls.base.origin === apiBase && urls.base.pathname === "/";
|
|
1351
|
-
const enterprise = `${urls.base.origin}${pipe(urls.base.pathname, replace(/\/+$/u, ""), replace(/\/api\/v3$/u, ""))}`;
|
|
1352
|
-
if (urls.target.origin === "https://uploads.github.com") {
|
|
1353
|
-
if (publicApi)
|
|
1354
|
-
return request;
|
|
1355
|
-
return updateUrl((url) => `${enterprise}/api/uploads${slice(26)(url)}`)(request);
|
|
1356
|
-
}
|
|
1357
|
-
if (urls.target.origin !== apiBase)
|
|
1358
|
-
return request;
|
|
1359
|
-
return updateUrl((url) => `${replace(/\/+$/u, "")(urls.base.href)}${slice(22)(url)}`)(request);
|
|
1360
|
-
})));
|
|
1361
|
-
}
|
|
1362
|
-
var sandboxAccess2 = {
|
|
1363
|
-
authorize: (request, context) => map(liftPredicate(request, (git) => Plugin_exports.isGitRequest(git) && match3(fromString(git.url), {
|
|
1364
|
-
onFailure: () => false,
|
|
1365
|
-
onSuccess: (url) => !startsWith("/api/")(url.pathname)
|
|
1366
|
-
})), (git) => basicAuth(git, "x-access-token", token(context))),
|
|
1367
|
-
origins: (context) => [webOrigin(context.auth.current.value.server)]
|
|
1118
|
+
var ConformanceError = class extends TaggedError2()("AgentChannelConformanceError", {
|
|
1119
|
+
command: Literals([
|
|
1120
|
+
"activate",
|
|
1121
|
+
"deactivate",
|
|
1122
|
+
"receive",
|
|
1123
|
+
"deliver"
|
|
1124
|
+
]),
|
|
1125
|
+
rule: Literals([
|
|
1126
|
+
"command_kind",
|
|
1127
|
+
"stable_result",
|
|
1128
|
+
"stable_events",
|
|
1129
|
+
"boundary_rejection"
|
|
1130
|
+
])
|
|
1131
|
+
}) {
|
|
1368
1132
|
};
|
|
1369
|
-
|
|
1133
|
+
var run = fn("AgentChannelConformance.run")(function* (input) {
|
|
1134
|
+
const fixture = yield* decodeUnknownEffect(Fixture)(input, { onExcessProperty: "error" });
|
|
1135
|
+
const runtime = yield* Service2;
|
|
1136
|
+
const definition = yield* runtime.getAgentChannel({ channelId: fixture.channelId });
|
|
1137
|
+
const { activate, receive, deliver, deactivate, ...config } = fixture;
|
|
1138
|
+
const { connectionId: _connectionId, ...withoutConnection } = config;
|
|
1139
|
+
const probes = [
|
|
1140
|
+
{
|
|
1141
|
+
code: "invalid_input",
|
|
1142
|
+
input: {
|
|
1143
|
+
...config,
|
|
1144
|
+
channelId: "",
|
|
1145
|
+
command: activate
|
|
1146
|
+
}
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
input: {
|
|
1150
|
+
...config,
|
|
1151
|
+
channelId: "conformance/missing/channel",
|
|
1152
|
+
command: activate
|
|
1153
|
+
},
|
|
1154
|
+
code: "not_found"
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
code: "invalid_input",
|
|
1158
|
+
input: {
|
|
1159
|
+
...config,
|
|
1160
|
+
command: {
|
|
1161
|
+
...activate,
|
|
1162
|
+
operationKey: ""
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
code: "invalid_input",
|
|
1168
|
+
input: {
|
|
1169
|
+
...config,
|
|
1170
|
+
agent: { id: "synthetic-authority" },
|
|
1171
|
+
command: activate
|
|
1172
|
+
}
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
code: "invalid_auth",
|
|
1176
|
+
input: definition.authMethods.length === 0 ? {
|
|
1177
|
+
...config,
|
|
1178
|
+
command: activate,
|
|
1179
|
+
connectionId: "unexpected"
|
|
1180
|
+
} : {
|
|
1181
|
+
...withoutConnection,
|
|
1182
|
+
command: activate
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
];
|
|
1186
|
+
for (const probe of probes) {
|
|
1187
|
+
const outcome = yield* suspend(() => runtime.executeAgentChannel(probe.input)).pipe(result);
|
|
1188
|
+
if (outcome._tag !== "Failure" || outcome.failure.code !== probe.code)
|
|
1189
|
+
return yield* new ConformanceError({
|
|
1190
|
+
command: "activate",
|
|
1191
|
+
rule: "boundary_rejection"
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
const commands = [
|
|
1195
|
+
["activate", activate],
|
|
1196
|
+
["receive", receive],
|
|
1197
|
+
["deliver", deliver],
|
|
1198
|
+
["deactivate", deactivate]
|
|
1199
|
+
];
|
|
1200
|
+
for (const [kind, command] of commands)
|
|
1201
|
+
if (command.kind !== kind)
|
|
1202
|
+
return yield* new ConformanceError({
|
|
1203
|
+
command: kind,
|
|
1204
|
+
rule: "command_kind"
|
|
1205
|
+
});
|
|
1206
|
+
const activated = yield* acquireRelease(runtime.executeAgentChannel({
|
|
1207
|
+
...config,
|
|
1208
|
+
command: activate
|
|
1209
|
+
}), (result2) => runtime.executeAgentChannel({
|
|
1210
|
+
...config,
|
|
1211
|
+
command: {
|
|
1212
|
+
...deactivate,
|
|
1213
|
+
...result2.kind === "activate" ? {
|
|
1214
|
+
installationKey: result2.installationKey,
|
|
1215
|
+
state: result2.state
|
|
1216
|
+
} : {}
|
|
1217
|
+
}
|
|
1218
|
+
}).pipe(orDie));
|
|
1219
|
+
for (const [kind, command] of commands) {
|
|
1220
|
+
const first = kind === "activate" ? activated : yield* runtime.executeAgentChannel({
|
|
1221
|
+
...config,
|
|
1222
|
+
command
|
|
1223
|
+
});
|
|
1224
|
+
if (kind === "deliver" && definition.features.deliveryMode === "at-most-once")
|
|
1225
|
+
continue;
|
|
1226
|
+
const second = yield* runtime.executeAgentChannel({
|
|
1227
|
+
...config,
|
|
1228
|
+
command
|
|
1229
|
+
});
|
|
1230
|
+
const firstJson = yield* decodeUnknownEffect(Json)(first);
|
|
1231
|
+
const secondJson = yield* decodeUnknownEffect(Json)(second);
|
|
1232
|
+
if (!toEquivalence(Json)(firstJson, secondJson))
|
|
1233
|
+
return yield* new ConformanceError({
|
|
1234
|
+
command: kind,
|
|
1235
|
+
rule: "stable_result"
|
|
1236
|
+
});
|
|
1237
|
+
if (kind === "receive") {
|
|
1238
|
+
const nextReceipt = yield* runtime.executeAgentChannel({
|
|
1239
|
+
...config,
|
|
1240
|
+
command: {
|
|
1241
|
+
...command,
|
|
1242
|
+
operationKey: `${command.operationKey.slice(0, 500)}:replay`
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
if (first.kind !== "receive" || nextReceipt.kind !== "receive" || !toEquivalence(ArraySchema(Event3))(first.events, nextReceipt.events))
|
|
1246
|
+
return yield* new ConformanceError({
|
|
1247
|
+
command: kind,
|
|
1248
|
+
rule: "stable_events"
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}, scoped);
|
|
1253
|
+
|
|
1254
|
+
export { match, Http_exports, File2, FileFromBase642, FileFromBase64Url2, Base64FromFile2, Base64UrlFromFile2, FileFromDataUri2, DataUriFromFile2, DateTimeFromUnixSeconds2, UnixSecondsFromDateTime2, DateTimeFromRfc28222, Rfc2822FromDateTime2, decoded2, path2, literal2, segments2, params2, form2, continuation2, preauthenticated2 };
|
|
1370
1255
|
|
|
1371
|
-
//# debugId=
|
|
1372
|
-
//# sourceMappingURL=plugin-
|
|
1256
|
+
//# debugId=0AB97DC27D5EF53664756E2164756E21
|
|
1257
|
+
//# sourceMappingURL=plugin-3ryytw13.js.map
|