@jive-ai/cli 0.0.44 → 0.0.46

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/dist/index.mjs CHANGED
@@ -10,11 +10,11 @@ import os from "os";
10
10
  import { existsSync, mkdirSync, promises, readFileSync } from "fs";
11
11
  import { exec, spawn } from "child_process";
12
12
  import { promisify } from "util";
13
+ import { GraphQLClient } from "graphql-request";
13
14
  import crypto from "crypto";
14
15
  import "gray-matter";
15
16
  import WebSocket from "ws";
16
17
  import { decode, encode } from "js-base64";
17
- import { GraphQLClient } from "graphql-request";
18
18
  import { createSdkMcpServer, query, tool } from "@anthropic-ai/claude-agent-sdk";
19
19
  import yaml from "js-yaml";
20
20
  import { z } from "zod";
@@ -28,9 +28,16 @@ import httpProxy from "http-proxy";
28
28
 
29
29
  //#region src/lib/config.ts
30
30
  /**
31
+ * Get the effective home directory - uses SUDO_USER's home when running with sudo
32
+ */
33
+ function getEffectiveHomeDir() {
34
+ if (process.env.SUDO_USER) return `/home/${process.env.SUDO_USER}`;
35
+ return os.homedir();
36
+ }
37
+ /**
31
38
  * `~/.jive/credentials.json`
32
39
  */
33
- const CREDENTIALS_PATH = path.join(os.homedir(), ".jive", "credentials.json");
40
+ const CREDENTIALS_PATH = path.join(getEffectiveHomeDir(), ".jive", "credentials.json");
34
41
  /**
35
42
  * `<cwd>/.jive/config.json`
36
43
  */
@@ -280,18 +287,18 @@ var e = {
280
287
  NON_NULL_TYPE: "NonNullType"
281
288
  };
282
289
  var GraphQLError = class extends Error {
283
- constructor(e$3, r$1, i$2, n$1, t$2, a$2, o$1) {
284
- if (super(e$3), this.name = "GraphQLError", this.message = e$3, t$2) this.path = t$2;
285
- if (r$1) this.nodes = Array.isArray(r$1) ? r$1 : [r$1];
286
- if (i$2) this.source = i$2;
290
+ constructor(e$2, r, i$1, n$1, t$2, a$2, o$1) {
291
+ if (super(e$2), this.name = "GraphQLError", this.message = e$2, t$2) this.path = t$2;
292
+ if (r) this.nodes = Array.isArray(r) ? r : [r];
293
+ if (i$1) this.source = i$1;
287
294
  if (n$1) this.positions = n$1;
288
295
  if (a$2) this.originalError = a$2;
289
- var l$1 = o$1;
290
- if (!l$1 && a$2) {
291
- var d$2 = a$2.extensions;
292
- if (d$2 && "object" == typeof d$2) l$1 = d$2;
296
+ var l = o$1;
297
+ if (!l && a$2) {
298
+ var d = a$2.extensions;
299
+ if (d && "object" == typeof d) l = d;
293
300
  }
294
- this.extensions = l$1 || {};
301
+ this.extensions = l || {};
295
302
  }
296
303
  toJSON() {
297
304
  return {
@@ -306,40 +313,40 @@ var GraphQLError = class extends Error {
306
313
  return "GraphQLError";
307
314
  }
308
315
  };
309
- var i$1;
316
+ var i;
310
317
  var n;
311
- function error(e$3) {
312
- return new GraphQLError(`Syntax Error: Unexpected token at ${n} in ${e$3}`);
318
+ function error(e$2) {
319
+ return new GraphQLError(`Syntax Error: Unexpected token at ${n} in ${e$2}`);
313
320
  }
314
- function advance(e$3) {
315
- if (e$3.lastIndex = n, e$3.test(i$1)) return i$1.slice(n, n = e$3.lastIndex);
321
+ function advance(e$2) {
322
+ if (e$2.lastIndex = n, e$2.test(i)) return i.slice(n, n = e$2.lastIndex);
316
323
  }
317
324
  var t$1 = / +(?=[^\s])/y;
318
- function blockString(e$3) {
319
- var r$1 = e$3.split("\n");
320
- var i$2 = "";
325
+ function blockString(e$2) {
326
+ var r = e$2.split("\n");
327
+ var i$1 = "";
321
328
  var n$1 = 0;
322
329
  var a$2 = 0;
323
- var o$1 = r$1.length - 1;
324
- for (var l$1 = 0; l$1 < r$1.length; l$1++) if (t$1.lastIndex = 0, t$1.test(r$1[l$1])) {
325
- if (l$1 && (!n$1 || t$1.lastIndex < n$1)) n$1 = t$1.lastIndex;
326
- a$2 = a$2 || l$1, o$1 = l$1;
330
+ var o$1 = r.length - 1;
331
+ for (var l = 0; l < r.length; l++) if (t$1.lastIndex = 0, t$1.test(r[l])) {
332
+ if (l && (!n$1 || t$1.lastIndex < n$1)) n$1 = t$1.lastIndex;
333
+ a$2 = a$2 || l, o$1 = l;
327
334
  }
328
- for (var d$2 = a$2; d$2 <= o$1; d$2++) {
329
- if (d$2 !== a$2) i$2 += "\n";
330
- i$2 += r$1[d$2].slice(n$1).replace(/\\"""/g, "\"\"\"");
335
+ for (var d = a$2; d <= o$1; d++) {
336
+ if (d !== a$2) i$1 += "\n";
337
+ i$1 += r[d].slice(n$1).replace(/\\"""/g, "\"\"\"");
331
338
  }
332
- return i$2;
339
+ return i$1;
333
340
  }
334
341
  function ignored() {
335
- for (var e$3 = 0 | i$1.charCodeAt(n++); 9 === e$3 || 10 === e$3 || 13 === e$3 || 32 === e$3 || 35 === e$3 || 44 === e$3 || 65279 === e$3; e$3 = 0 | i$1.charCodeAt(n++)) if (35 === e$3) for (; (e$3 = 0 | i$1.charCodeAt(n++)) && 10 !== e$3 && 13 !== e$3;);
342
+ for (var e$2 = 0 | i.charCodeAt(n++); 9 === e$2 || 10 === e$2 || 13 === e$2 || 32 === e$2 || 35 === e$2 || 44 === e$2 || 65279 === e$2; e$2 = 0 | i.charCodeAt(n++)) if (35 === e$2) for (; (e$2 = 0 | i.charCodeAt(n++)) && 10 !== e$2 && 13 !== e$2;);
336
343
  n--;
337
344
  }
338
345
  function name() {
339
- var e$3 = n;
340
- for (var r$1 = 0 | i$1.charCodeAt(n++); r$1 >= 48 && r$1 <= 57 || r$1 >= 65 && r$1 <= 90 || 95 === r$1 || r$1 >= 97 && r$1 <= 122; r$1 = 0 | i$1.charCodeAt(n++));
341
- if (e$3 === n - 1) throw error("Name");
342
- var t$2 = i$1.slice(e$3, --n);
346
+ var e$2 = n;
347
+ for (var r = 0 | i.charCodeAt(n++); r >= 48 && r <= 57 || r >= 65 && r <= 90 || 95 === r || r >= 97 && r <= 122; r = 0 | i.charCodeAt(n++));
348
+ if (e$2 === n - 1) throw error("Name");
349
+ var t$2 = i.slice(e$2, --n);
343
350
  return ignored(), t$2;
344
351
  }
345
352
  function nameNode() {
@@ -350,56 +357,56 @@ function nameNode() {
350
357
  }
351
358
  var a$1 = /(?:"""|(?:[\s\S]*?[^\\])""")/y;
352
359
  var o = /(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;
353
- function value(e$3) {
354
- var r$1;
355
- switch (i$1.charCodeAt(n)) {
360
+ function value(e$2) {
361
+ var r;
362
+ switch (i.charCodeAt(n)) {
356
363
  case 91:
357
364
  n++, ignored();
358
365
  var t$2 = [];
359
- for (; 93 !== i$1.charCodeAt(n);) t$2.push(value(e$3));
366
+ for (; 93 !== i.charCodeAt(n);) t$2.push(value(e$2));
360
367
  return n++, ignored(), {
361
368
  kind: "ListValue",
362
369
  values: t$2
363
370
  };
364
371
  case 123:
365
372
  n++, ignored();
366
- var l$1 = [];
367
- for (; 125 !== i$1.charCodeAt(n);) {
368
- var d$2 = nameNode();
369
- if (58 !== i$1.charCodeAt(n++)) throw error("ObjectField");
370
- ignored(), l$1.push({
373
+ var l = [];
374
+ for (; 125 !== i.charCodeAt(n);) {
375
+ var d = nameNode();
376
+ if (58 !== i.charCodeAt(n++)) throw error("ObjectField");
377
+ ignored(), l.push({
371
378
  kind: "ObjectField",
372
- name: d$2,
373
- value: value(e$3)
379
+ name: d,
380
+ value: value(e$2)
374
381
  });
375
382
  }
376
383
  return n++, ignored(), {
377
384
  kind: "ObjectValue",
378
- fields: l$1
385
+ fields: l
379
386
  };
380
387
  case 36:
381
- if (e$3) throw error("Variable");
388
+ if (e$2) throw error("Variable");
382
389
  return n++, {
383
390
  kind: "Variable",
384
391
  name: nameNode()
385
392
  };
386
- case 34: if (34 === i$1.charCodeAt(n + 1) && 34 === i$1.charCodeAt(n + 2)) {
387
- if (n += 3, null == (r$1 = advance(a$1))) throw error("StringValue");
393
+ case 34: if (34 === i.charCodeAt(n + 1) && 34 === i.charCodeAt(n + 2)) {
394
+ if (n += 3, null == (r = advance(a$1))) throw error("StringValue");
388
395
  return ignored(), {
389
396
  kind: "StringValue",
390
- value: blockString(r$1.slice(0, -3)),
397
+ value: blockString(r.slice(0, -3)),
391
398
  block: !0
392
399
  };
393
400
  } else {
394
- var u$2 = n;
401
+ var u = n;
395
402
  var s;
396
403
  n++;
397
- var c$1 = !1;
398
- for (s = 0 | i$1.charCodeAt(n++); 92 === s && (n++, c$1 = !0) || 10 !== s && 13 !== s && 34 !== s && s; s = 0 | i$1.charCodeAt(n++));
404
+ var c = !1;
405
+ for (s = 0 | i.charCodeAt(n++); 92 === s && (n++, c = !0) || 10 !== s && 13 !== s && 34 !== s && s; s = 0 | i.charCodeAt(n++));
399
406
  if (34 !== s) throw error("StringValue");
400
- return r$1 = i$1.slice(u$2, n), ignored(), {
407
+ return r = i.slice(u, n), ignored(), {
401
408
  kind: "StringValue",
402
- value: c$1 ? JSON.parse(r$1) : r$1.slice(1, -1),
409
+ value: c ? JSON.parse(r) : r.slice(1, -1),
403
410
  block: !1
404
411
  };
405
412
  }
@@ -414,28 +421,28 @@ function value(e$3) {
414
421
  case 55:
415
422
  case 56:
416
423
  case 57:
417
- var v$1 = n++;
418
- var f$1;
419
- for (; (f$1 = 0 | i$1.charCodeAt(n++)) >= 48 && f$1 <= 57;);
420
- var m = i$1.slice(v$1, --n);
421
- if (46 === (f$1 = i$1.charCodeAt(n)) || 69 === f$1 || 101 === f$1) {
422
- if (null == (r$1 = advance(o))) throw error("FloatValue");
424
+ var v = n++;
425
+ var f;
426
+ for (; (f = 0 | i.charCodeAt(n++)) >= 48 && f <= 57;);
427
+ var m = i.slice(v, --n);
428
+ if (46 === (f = i.charCodeAt(n)) || 69 === f || 101 === f) {
429
+ if (null == (r = advance(o))) throw error("FloatValue");
423
430
  return ignored(), {
424
431
  kind: "FloatValue",
425
- value: m + r$1
432
+ value: m + r
426
433
  };
427
434
  } else return ignored(), {
428
435
  kind: "IntValue",
429
436
  value: m
430
437
  };
431
- case 110: if (117 === i$1.charCodeAt(n + 1) && 108 === i$1.charCodeAt(n + 2) && 108 === i$1.charCodeAt(n + 3)) return n += 4, ignored(), { kind: "NullValue" };
438
+ case 110: if (117 === i.charCodeAt(n + 1) && 108 === i.charCodeAt(n + 2) && 108 === i.charCodeAt(n + 3)) return n += 4, ignored(), { kind: "NullValue" };
432
439
  else break;
433
- case 116: if (114 === i$1.charCodeAt(n + 1) && 117 === i$1.charCodeAt(n + 2) && 101 === i$1.charCodeAt(n + 3)) return n += 4, ignored(), {
440
+ case 116: if (114 === i.charCodeAt(n + 1) && 117 === i.charCodeAt(n + 2) && 101 === i.charCodeAt(n + 3)) return n += 4, ignored(), {
434
441
  kind: "BooleanValue",
435
442
  value: !0
436
443
  };
437
444
  else break;
438
- case 102: if (97 === i$1.charCodeAt(n + 1) && 108 === i$1.charCodeAt(n + 2) && 115 === i$1.charCodeAt(n + 3) && 101 === i$1.charCodeAt(n + 4)) return n += 5, ignored(), {
445
+ case 102: if (97 === i.charCodeAt(n + 1) && 108 === i.charCodeAt(n + 2) && 115 === i.charCodeAt(n + 3) && 101 === i.charCodeAt(n + 4)) return n += 5, ignored(), {
439
446
  kind: "BooleanValue",
440
447
  value: !1
441
448
  };
@@ -446,69 +453,69 @@ function value(e$3) {
446
453
  value: name()
447
454
  };
448
455
  }
449
- function arguments_(e$3) {
450
- if (40 === i$1.charCodeAt(n)) {
451
- var r$1 = [];
456
+ function arguments_(e$2) {
457
+ if (40 === i.charCodeAt(n)) {
458
+ var r = [];
452
459
  n++, ignored();
453
460
  do {
454
461
  var t$2 = nameNode();
455
- if (58 !== i$1.charCodeAt(n++)) throw error("Argument");
456
- ignored(), r$1.push({
462
+ if (58 !== i.charCodeAt(n++)) throw error("Argument");
463
+ ignored(), r.push({
457
464
  kind: "Argument",
458
465
  name: t$2,
459
- value: value(e$3)
466
+ value: value(e$2)
460
467
  });
461
- } while (41 !== i$1.charCodeAt(n));
462
- return n++, ignored(), r$1;
468
+ } while (41 !== i.charCodeAt(n));
469
+ return n++, ignored(), r;
463
470
  }
464
471
  }
465
- function directives(e$3) {
466
- if (64 === i$1.charCodeAt(n)) {
467
- var r$1 = [];
472
+ function directives(e$2) {
473
+ if (64 === i.charCodeAt(n)) {
474
+ var r = [];
468
475
  do
469
- n++, r$1.push({
476
+ n++, r.push({
470
477
  kind: "Directive",
471
478
  name: nameNode(),
472
- arguments: arguments_(e$3)
479
+ arguments: arguments_(e$2)
473
480
  });
474
- while (64 === i$1.charCodeAt(n));
475
- return r$1;
481
+ while (64 === i.charCodeAt(n));
482
+ return r;
476
483
  }
477
484
  }
478
485
  function type() {
479
- var e$3 = 0;
480
- for (; 91 === i$1.charCodeAt(n);) e$3++, n++, ignored();
481
- var r$1 = {
486
+ var e$2 = 0;
487
+ for (; 91 === i.charCodeAt(n);) e$2++, n++, ignored();
488
+ var r = {
482
489
  kind: "NamedType",
483
490
  name: nameNode()
484
491
  };
485
492
  do {
486
- if (33 === i$1.charCodeAt(n)) n++, ignored(), r$1 = {
493
+ if (33 === i.charCodeAt(n)) n++, ignored(), r = {
487
494
  kind: "NonNullType",
488
- type: r$1
495
+ type: r
489
496
  };
490
- if (e$3) {
491
- if (93 !== i$1.charCodeAt(n++)) throw error("NamedType");
492
- ignored(), r$1 = {
497
+ if (e$2) {
498
+ if (93 !== i.charCodeAt(n++)) throw error("NamedType");
499
+ ignored(), r = {
493
500
  kind: "ListType",
494
- type: r$1
501
+ type: r
495
502
  };
496
503
  }
497
- } while (e$3--);
498
- return r$1;
504
+ } while (e$2--);
505
+ return r;
499
506
  }
500
507
  function selectionSetStart() {
501
- if (123 !== i$1.charCodeAt(n++)) throw error("SelectionSet");
508
+ if (123 !== i.charCodeAt(n++)) throw error("SelectionSet");
502
509
  return ignored(), selectionSet();
503
510
  }
504
511
  function selectionSet() {
505
- var e$3 = [];
512
+ var e$2 = [];
506
513
  do
507
- if (46 === i$1.charCodeAt(n)) {
508
- if (46 !== i$1.charCodeAt(++n) || 46 !== i$1.charCodeAt(++n)) throw error("SelectionSet");
509
- switch (n++, ignored(), i$1.charCodeAt(n)) {
514
+ if (46 === i.charCodeAt(n)) {
515
+ if (46 !== i.charCodeAt(++n) || 46 !== i.charCodeAt(++n)) throw error("SelectionSet");
516
+ switch (n++, ignored(), i.charCodeAt(n)) {
510
517
  case 64:
511
- e$3.push({
518
+ e$2.push({
512
519
  kind: "InlineFragment",
513
520
  typeCondition: void 0,
514
521
  directives: directives(!1),
@@ -516,7 +523,7 @@ function selectionSet() {
516
523
  });
517
524
  break;
518
525
  case 111:
519
- if (110 === i$1.charCodeAt(n + 1)) n += 2, ignored(), e$3.push({
526
+ if (110 === i.charCodeAt(n + 1)) n += 2, ignored(), e$2.push({
520
527
  kind: "InlineFragment",
521
528
  typeCondition: {
522
529
  kind: "NamedType",
@@ -525,65 +532,65 @@ function selectionSet() {
525
532
  directives: directives(!1),
526
533
  selectionSet: selectionSetStart()
527
534
  });
528
- else e$3.push({
535
+ else e$2.push({
529
536
  kind: "FragmentSpread",
530
537
  name: nameNode(),
531
538
  directives: directives(!1)
532
539
  });
533
540
  break;
534
541
  case 123:
535
- n++, ignored(), e$3.push({
542
+ n++, ignored(), e$2.push({
536
543
  kind: "InlineFragment",
537
544
  typeCondition: void 0,
538
545
  directives: void 0,
539
546
  selectionSet: selectionSet()
540
547
  });
541
548
  break;
542
- default: e$3.push({
549
+ default: e$2.push({
543
550
  kind: "FragmentSpread",
544
551
  name: nameNode(),
545
552
  directives: directives(!1)
546
553
  });
547
554
  }
548
555
  } else {
549
- var r$1 = nameNode();
556
+ var r = nameNode();
550
557
  var t$2 = void 0;
551
- if (58 === i$1.charCodeAt(n)) n++, ignored(), t$2 = r$1, r$1 = nameNode();
558
+ if (58 === i.charCodeAt(n)) n++, ignored(), t$2 = r, r = nameNode();
552
559
  var a$2 = arguments_(!1);
553
560
  var o$1 = directives(!1);
554
- var l$1 = void 0;
555
- if (123 === i$1.charCodeAt(n)) n++, ignored(), l$1 = selectionSet();
556
- e$3.push({
561
+ var l = void 0;
562
+ if (123 === i.charCodeAt(n)) n++, ignored(), l = selectionSet();
563
+ e$2.push({
557
564
  kind: "Field",
558
565
  alias: t$2,
559
- name: r$1,
566
+ name: r,
560
567
  arguments: a$2,
561
568
  directives: o$1,
562
- selectionSet: l$1
569
+ selectionSet: l
563
570
  });
564
571
  }
565
- while (125 !== i$1.charCodeAt(n));
572
+ while (125 !== i.charCodeAt(n));
566
573
  return n++, ignored(), {
567
574
  kind: "SelectionSet",
568
- selections: e$3
575
+ selections: e$2
569
576
  };
570
577
  }
571
578
  function variableDefinitions() {
572
- if (ignored(), 40 === i$1.charCodeAt(n)) {
573
- var e$3 = [];
579
+ if (ignored(), 40 === i.charCodeAt(n)) {
580
+ var e$2 = [];
574
581
  n++, ignored();
575
582
  do {
576
- var r$1 = void 0;
577
- if (34 === i$1.charCodeAt(n)) r$1 = value(!0);
578
- if (36 !== i$1.charCodeAt(n++)) throw error("Variable");
583
+ var r = void 0;
584
+ if (34 === i.charCodeAt(n)) r = value(!0);
585
+ if (36 !== i.charCodeAt(n++)) throw error("Variable");
579
586
  var t$2 = nameNode();
580
- if (58 !== i$1.charCodeAt(n++)) throw error("VariableDefinition");
587
+ if (58 !== i.charCodeAt(n++)) throw error("VariableDefinition");
581
588
  ignored();
582
589
  var a$2 = type();
583
590
  var o$1 = void 0;
584
- if (61 === i$1.charCodeAt(n)) n++, ignored(), o$1 = value(!0);
591
+ if (61 === i.charCodeAt(n)) n++, ignored(), o$1 = value(!0);
585
592
  ignored();
586
- var l$1 = {
593
+ var l = {
587
594
  kind: "VariableDefinition",
588
595
  variable: {
589
596
  kind: "Variable",
@@ -593,19 +600,19 @@ function variableDefinitions() {
593
600
  defaultValue: o$1,
594
601
  directives: directives(!0)
595
602
  };
596
- if (r$1) l$1.description = r$1;
597
- e$3.push(l$1);
598
- } while (41 !== i$1.charCodeAt(n));
599
- return n++, ignored(), e$3;
603
+ if (r) l.description = r;
604
+ e$2.push(l);
605
+ } while (41 !== i.charCodeAt(n));
606
+ return n++, ignored(), e$2;
600
607
  }
601
608
  }
602
- function fragmentDefinition(e$3) {
603
- var r$1 = nameNode();
604
- if (111 !== i$1.charCodeAt(n++) || 110 !== i$1.charCodeAt(n++)) throw error("FragmentDefinition");
609
+ function fragmentDefinition(e$2) {
610
+ var r = nameNode();
611
+ if (111 !== i.charCodeAt(n++) || 110 !== i.charCodeAt(n++)) throw error("FragmentDefinition");
605
612
  ignored();
606
613
  var t$2 = {
607
614
  kind: "FragmentDefinition",
608
- name: r$1,
615
+ name: r,
609
616
  typeCondition: {
610
617
  kind: "NamedType",
611
618
  name: nameNode()
@@ -613,17 +620,17 @@ function fragmentDefinition(e$3) {
613
620
  directives: directives(!1),
614
621
  selectionSet: selectionSetStart()
615
622
  };
616
- if (e$3) t$2.description = e$3;
623
+ if (e$2) t$2.description = e$2;
617
624
  return t$2;
618
625
  }
619
626
  function definitions() {
620
- var e$3 = [];
627
+ var e$2 = [];
621
628
  do {
622
- var r$1 = void 0;
623
- if (34 === i$1.charCodeAt(n)) r$1 = value(!0);
624
- if (123 === i$1.charCodeAt(n)) {
625
- if (r$1) throw error("Document");
626
- n++, ignored(), e$3.push({
629
+ var r = void 0;
630
+ if (34 === i.charCodeAt(n)) r = value(!0);
631
+ if (123 === i.charCodeAt(n)) {
632
+ if (r) throw error("Document");
633
+ n++, ignored(), e$2.push({
627
634
  kind: "OperationDefinition",
628
635
  operation: "query",
629
636
  name: void 0,
@@ -635,15 +642,15 @@ function definitions() {
635
642
  var t$2 = name();
636
643
  switch (t$2) {
637
644
  case "fragment":
638
- e$3.push(fragmentDefinition(r$1));
645
+ e$2.push(fragmentDefinition(r));
639
646
  break;
640
647
  case "query":
641
648
  case "mutation":
642
649
  case "subscription":
643
650
  var a$2;
644
651
  var o$1 = void 0;
645
- if (40 !== (a$2 = i$1.charCodeAt(n)) && 64 !== a$2 && 123 !== a$2) o$1 = nameNode();
646
- var l$1 = {
652
+ if (40 !== (a$2 = i.charCodeAt(n)) && 64 !== a$2 && 123 !== a$2) o$1 = nameNode();
653
+ var l = {
647
654
  kind: "OperationDefinition",
648
655
  operation: t$2,
649
656
  name: o$1,
@@ -651,17 +658,17 @@ function definitions() {
651
658
  directives: directives(!1),
652
659
  selectionSet: selectionSetStart()
653
660
  };
654
- if (r$1) l$1.description = r$1;
655
- e$3.push(l$1);
661
+ if (r) l.description = r;
662
+ e$2.push(l);
656
663
  break;
657
664
  default: throw error("Document");
658
665
  }
659
666
  }
660
- } while (n < i$1.length);
661
- return e$3;
667
+ } while (n < i.length);
668
+ return e$2;
662
669
  }
663
- function parse(e$3, r$1) {
664
- if (i$1 = e$3.body ? e$3.body : e$3, n = 0, ignored(), r$1 && r$1.noLocation) return {
670
+ function parse(e$2, r) {
671
+ if (i = e$2.body ? e$2.body : e$2, n = 0, ignored(), r && r.noLocation) return {
665
672
  kind: "Document",
666
673
  definitions: definitions()
667
674
  };
@@ -670,11 +677,11 @@ function parse(e$3, r$1) {
670
677
  definitions: definitions(),
671
678
  loc: {
672
679
  start: 0,
673
- end: i$1.length,
680
+ end: i.length,
674
681
  startToken: void 0,
675
682
  endToken: void 0,
676
683
  source: {
677
- body: i$1,
684
+ body: i,
678
685
  name: "graphql.web",
679
686
  locationOffset: {
680
687
  line: 1,
@@ -684,142 +691,46 @@ function parse(e$3, r$1) {
684
691
  }
685
692
  };
686
693
  }
687
- function mapJoin(e$3, r$1, i$2) {
688
- var n$1 = "";
689
- for (var t$2 = 0; t$2 < e$3.length; t$2++) {
690
- if (t$2) n$1 += r$1;
691
- n$1 += i$2(e$3[t$2]);
692
- }
693
- return n$1;
694
- }
695
- function printString(e$3) {
696
- return JSON.stringify(e$3);
697
- }
698
- function printBlockString(e$3) {
699
- return "\"\"\"\n" + e$3.replace(/"""/g, "\\\"\"\"") + "\n\"\"\"";
700
- }
701
- var d$1 = "\n";
702
- var u$1 = {
703
- OperationDefinition(e$3) {
704
- var r$1 = "";
705
- if (e$3.description) r$1 += u$1.StringValue(e$3.description) + "\n";
706
- if (r$1 += e$3.operation, e$3.name) r$1 += " " + e$3.name.value;
707
- if (e$3.variableDefinitions && e$3.variableDefinitions.length) {
708
- if (!e$3.name) r$1 += " ";
709
- r$1 += "(" + mapJoin(e$3.variableDefinitions, ", ", u$1.VariableDefinition) + ")";
710
- }
711
- if (e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
712
- var i$2 = u$1.SelectionSet(e$3.selectionSet);
713
- return "query" !== r$1 ? r$1 + " " + i$2 : i$2;
714
- },
715
- VariableDefinition(e$3) {
716
- var r$1 = "";
717
- if (e$3.description) r$1 += u$1.StringValue(e$3.description) + " ";
718
- if (r$1 += u$1.Variable(e$3.variable) + ": " + _print(e$3.type), e$3.defaultValue) r$1 += " = " + _print(e$3.defaultValue);
719
- if (e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
720
- return r$1;
721
- },
722
- Field(e$3) {
723
- var r$1 = e$3.alias ? e$3.alias.value + ": " + e$3.name.value : e$3.name.value;
724
- if (e$3.arguments && e$3.arguments.length) {
725
- var i$2 = mapJoin(e$3.arguments, ", ", u$1.Argument);
726
- if (r$1.length + i$2.length + 2 > 80) r$1 += "(" + (d$1 += " ") + mapJoin(e$3.arguments, d$1, u$1.Argument) + (d$1 = d$1.slice(0, -2)) + ")";
727
- else r$1 += "(" + i$2 + ")";
728
- }
729
- if (e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
730
- if (e$3.selectionSet && e$3.selectionSet.selections.length) r$1 += " " + u$1.SelectionSet(e$3.selectionSet);
731
- return r$1;
732
- },
733
- StringValue(e$3) {
734
- if (e$3.block) return printBlockString(e$3.value).replace(/\n/g, d$1);
735
- else return printString(e$3.value);
736
- },
737
- BooleanValue: (e$3) => "" + e$3.value,
738
- NullValue: (e$3) => "null",
739
- IntValue: (e$3) => e$3.value,
740
- FloatValue: (e$3) => e$3.value,
741
- EnumValue: (e$3) => e$3.value,
742
- Name: (e$3) => e$3.value,
743
- Variable: (e$3) => "$" + e$3.name.value,
744
- ListValue: (e$3) => "[" + mapJoin(e$3.values, ", ", _print) + "]",
745
- ObjectValue: (e$3) => "{" + mapJoin(e$3.fields, ", ", u$1.ObjectField) + "}",
746
- ObjectField: (e$3) => e$3.name.value + ": " + _print(e$3.value),
747
- Document(e$3) {
748
- if (!e$3.definitions || !e$3.definitions.length) return "";
749
- else return mapJoin(e$3.definitions, "\n\n", _print);
750
- },
751
- SelectionSet: (e$3) => "{" + (d$1 += " ") + mapJoin(e$3.selections, d$1, _print) + (d$1 = d$1.slice(0, -2)) + "}",
752
- Argument: (e$3) => e$3.name.value + ": " + _print(e$3.value),
753
- FragmentSpread(e$3) {
754
- var r$1 = "..." + e$3.name.value;
755
- if (e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
756
- return r$1;
757
- },
758
- InlineFragment(e$3) {
759
- var r$1 = "...";
760
- if (e$3.typeCondition) r$1 += " on " + e$3.typeCondition.name.value;
761
- if (e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
762
- return r$1 += " " + u$1.SelectionSet(e$3.selectionSet);
763
- },
764
- FragmentDefinition(e$3) {
765
- var r$1 = "";
766
- if (e$3.description) r$1 += u$1.StringValue(e$3.description) + "\n";
767
- if (r$1 += "fragment " + e$3.name.value, r$1 += " on " + e$3.typeCondition.name.value, e$3.directives && e$3.directives.length) r$1 += " " + mapJoin(e$3.directives, " ", u$1.Directive);
768
- return r$1 + " " + u$1.SelectionSet(e$3.selectionSet);
769
- },
770
- Directive(e$3) {
771
- var r$1 = "@" + e$3.name.value;
772
- if (e$3.arguments && e$3.arguments.length) r$1 += "(" + mapJoin(e$3.arguments, ", ", u$1.Argument) + ")";
773
- return r$1;
774
- },
775
- NamedType: (e$3) => e$3.name.value,
776
- ListType: (e$3) => "[" + _print(e$3.type) + "]",
777
- NonNullType: (e$3) => _print(e$3.type) + "!"
778
- };
779
- var _print = (e$3) => u$1[e$3.kind](e$3);
780
- function print(e$3) {
781
- return d$1 = "\n", u$1[e$3.kind] ? u$1[e$3.kind](e$3) : "";
782
- }
783
694
 
784
695
  //#endregion
785
696
  //#region ../node_modules/gql.tada/dist/gql-tada.mjs
786
697
  var a = 0;
787
- var e$2 = /* @__PURE__ */ new Set();
698
+ var e$1 = /* @__PURE__ */ new Set();
788
699
  function initGraphQLTada() {
789
- function graphql$1(t$2, i$2) {
700
+ function graphql$1(t$2, i$1) {
790
701
  var o$1 = parse(t$2).definitions;
791
702
  var s = /* @__PURE__ */ new Set();
792
- for (var f$1 of i$2 || []) for (var u$2 of f$1.definitions) if (u$2.kind === e.FRAGMENT_DEFINITION && !s.has(u$2)) {
793
- o$1.push(u$2);
794
- s.add(u$2);
703
+ for (var f of i$1 || []) for (var u of f.definitions) if (u.kind === e.FRAGMENT_DEFINITION && !s.has(u)) {
704
+ o$1.push(u);
705
+ s.add(u);
795
706
  }
796
- var d$2;
797
- if ((d$2 = o$1[0].kind === e.FRAGMENT_DEFINITION) && o$1[0].directives) o$1[0].directives = o$1[0].directives.filter(((r$1) => "_unmask" !== r$1.name.value));
798
- var c$1;
707
+ var d;
708
+ if ((d = o$1[0].kind === e.FRAGMENT_DEFINITION) && o$1[0].directives) o$1[0].directives = o$1[0].directives.filter(((r) => "_unmask" !== r.name.value));
709
+ var c;
799
710
  return {
800
711
  kind: e.DOCUMENT,
801
712
  definitions: o$1,
802
713
  get loc() {
803
- if (!c$1 && d$2) {
804
- var r$1 = t$2 + function concatLocSources(r$2) {
714
+ if (!c && d) {
715
+ var r = t$2 + function concatLocSources(r$1) {
805
716
  try {
806
717
  a++;
807
718
  var n$1 = "";
808
- for (var t$3 of r$2) if (!e$2.has(t$3)) {
809
- e$2.add(t$3);
810
- var { loc: i$3 } = t$3;
811
- if (i$3) n$1 += i$3.source.body;
719
+ for (var t$3 of r$1) if (!e$1.has(t$3)) {
720
+ e$1.add(t$3);
721
+ var { loc: i$2 } = t$3;
722
+ if (i$2) n$1 += i$2.source.body;
812
723
  }
813
724
  return n$1;
814
725
  } finally {
815
- if (0 == --a) e$2.clear();
726
+ if (0 == --a) e$1.clear();
816
727
  }
817
- }(i$2 || []);
728
+ }(i$1 || []);
818
729
  return {
819
730
  start: 0,
820
- end: r$1.length,
731
+ end: r.length,
821
732
  source: {
822
- body: r$1,
733
+ body: r,
823
734
  name: "GraphQLTada",
824
735
  locationOffset: {
825
736
  line: 1,
@@ -828,14 +739,14 @@ function initGraphQLTada() {
828
739
  }
829
740
  };
830
741
  }
831
- return c$1;
742
+ return c;
832
743
  },
833
- set loc(r$1) {
834
- c$1 = r$1;
744
+ set loc(r) {
745
+ c = r;
835
746
  }
836
747
  };
837
748
  }
838
- graphql$1.scalar = function scalar(r$1, n$1) {
749
+ graphql$1.scalar = function scalar(r, n$1) {
839
750
  return n$1;
840
751
  };
841
752
  graphql$1.persisted = function persisted(n$1, a$2) {
@@ -849,1403 +760,9 @@ function initGraphQLTada() {
849
760
  }
850
761
  var t = initGraphQLTada();
851
762
 
852
- //#endregion
853
- //#region ../node_modules/wonka/dist/wonka.mjs
854
- var teardownPlaceholder = () => {};
855
- var e$1 = teardownPlaceholder;
856
- function start(e$3) {
857
- return {
858
- tag: 0,
859
- 0: e$3
860
- };
861
- }
862
- function push(e$3) {
863
- return {
864
- tag: 1,
865
- 0: e$3
866
- };
867
- }
868
- var asyncIteratorSymbol = () => "function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator";
869
- var identity = (e$3) => e$3;
870
- function filter(r$1) {
871
- return (t$2) => (i$2) => {
872
- var a$2 = e$1;
873
- t$2(((e$3) => {
874
- if (0 === e$3) i$2(0);
875
- else if (0 === e$3.tag) {
876
- a$2 = e$3[0];
877
- i$2(e$3);
878
- } else if (!r$1(e$3[0])) a$2(0);
879
- else i$2(e$3);
880
- }));
881
- };
882
- }
883
- function map(e$3) {
884
- return (r$1) => (t$2) => r$1(((r$2) => {
885
- if (0 === r$2 || 0 === r$2.tag) t$2(r$2);
886
- else t$2(push(e$3(r$2[0])));
887
- }));
888
- }
889
- function mergeMap(r$1) {
890
- return (t$2) => (i$2) => {
891
- var a$2 = [];
892
- var f$1 = e$1;
893
- var n$1 = !1;
894
- var s = !1;
895
- t$2(((t$3) => {
896
- if (s) {} else if (0 === t$3) {
897
- s = !0;
898
- if (!a$2.length) i$2(0);
899
- } else if (0 === t$3.tag) f$1 = t$3[0];
900
- else {
901
- n$1 = !1;
902
- (function applyInnerSource(r$2) {
903
- var t$4 = e$1;
904
- r$2(((e$3) => {
905
- if (0 === e$3) {
906
- if (a$2.length) {
907
- var r$3 = a$2.indexOf(t$4);
908
- if (r$3 > -1) (a$2 = a$2.slice()).splice(r$3, 1);
909
- if (!a$2.length) {
910
- if (s) i$2(0);
911
- else if (!n$1) {
912
- n$1 = !0;
913
- f$1(0);
914
- }
915
- }
916
- }
917
- } else if (0 === e$3.tag) {
918
- a$2.push(t$4 = e$3[0]);
919
- t$4(0);
920
- } else if (a$2.length) {
921
- i$2(e$3);
922
- t$4(0);
923
- }
924
- }));
925
- })(r$1(t$3[0]));
926
- if (!n$1) {
927
- n$1 = !0;
928
- f$1(0);
929
- }
930
- }
931
- }));
932
- i$2(start(((e$3) => {
933
- if (1 === e$3) {
934
- if (!s) {
935
- s = !0;
936
- f$1(1);
937
- }
938
- for (var r$2 = 0, t$3 = a$2, i$3 = a$2.length; r$2 < i$3; r$2++) t$3[r$2](1);
939
- a$2.length = 0;
940
- } else {
941
- if (!s && !n$1) {
942
- n$1 = !0;
943
- f$1(0);
944
- } else n$1 = !1;
945
- for (var l$1 = 0, u$2 = a$2, o$1 = a$2.length; l$1 < o$1; l$1++) u$2[l$1](0);
946
- }
947
- })));
948
- };
949
- }
950
- function mergeAll(e$3) {
951
- return mergeMap(identity)(e$3);
952
- }
953
- function merge(e$3) {
954
- return mergeAll(r(e$3));
955
- }
956
- function onEnd(e$3) {
957
- return (r$1) => (t$2) => {
958
- var i$2 = !1;
959
- r$1(((r$2) => {
960
- if (i$2) {} else if (0 === r$2) {
961
- i$2 = !0;
962
- t$2(0);
963
- e$3();
964
- } else if (0 === r$2.tag) {
965
- var a$2 = r$2[0];
966
- t$2(start(((r$3) => {
967
- if (1 === r$3) {
968
- i$2 = !0;
969
- a$2(1);
970
- e$3();
971
- } else a$2(r$3);
972
- })));
973
- } else t$2(r$2);
974
- }));
975
- };
976
- }
977
- function onPush(e$3) {
978
- return (r$1) => (t$2) => {
979
- var i$2 = !1;
980
- r$1(((r$2) => {
981
- if (i$2) {} else if (0 === r$2) {
982
- i$2 = !0;
983
- t$2(0);
984
- } else if (0 === r$2.tag) {
985
- var a$2 = r$2[0];
986
- t$2(start(((e$4) => {
987
- if (1 === e$4) i$2 = !0;
988
- a$2(e$4);
989
- })));
990
- } else {
991
- e$3(r$2[0]);
992
- t$2(r$2);
993
- }
994
- }));
995
- };
996
- }
997
- function onStart(e$3) {
998
- return (r$1) => (t$2) => r$1(((r$2) => {
999
- if (0 === r$2) t$2(0);
1000
- else if (0 === r$2.tag) {
1001
- t$2(r$2);
1002
- e$3();
1003
- } else t$2(r$2);
1004
- }));
1005
- }
1006
- function share(r$1) {
1007
- var t$2 = [];
1008
- var i$2 = e$1;
1009
- var a$2 = !1;
1010
- return (e$3) => {
1011
- t$2.push(e$3);
1012
- if (1 === t$2.length) r$1(((e$4) => {
1013
- if (0 === e$4) {
1014
- for (var r$2 = 0, f$1 = t$2, n$1 = t$2.length; r$2 < n$1; r$2++) f$1[r$2](0);
1015
- t$2.length = 0;
1016
- } else if (0 === e$4.tag) i$2 = e$4[0];
1017
- else {
1018
- a$2 = !1;
1019
- for (var s = 0, l$1 = t$2, u$2 = t$2.length; s < u$2; s++) l$1[s](e$4);
1020
- }
1021
- }));
1022
- e$3(start(((r$2) => {
1023
- if (1 === r$2) {
1024
- var f$1 = t$2.indexOf(e$3);
1025
- if (f$1 > -1) (t$2 = t$2.slice()).splice(f$1, 1);
1026
- if (!t$2.length) i$2(1);
1027
- } else if (!a$2) {
1028
- a$2 = !0;
1029
- i$2(0);
1030
- }
1031
- })));
1032
- };
1033
- }
1034
- function switchMap(r$1) {
1035
- return (t$2) => (i$2) => {
1036
- var a$2 = e$1;
1037
- var f$1 = e$1;
1038
- var n$1 = !1;
1039
- var s = !1;
1040
- var l$1 = !1;
1041
- var u$2 = !1;
1042
- t$2(((t$3) => {
1043
- if (u$2) {} else if (0 === t$3) {
1044
- u$2 = !0;
1045
- if (!l$1) i$2(0);
1046
- } else if (0 === t$3.tag) a$2 = t$3[0];
1047
- else {
1048
- if (l$1) {
1049
- f$1(1);
1050
- f$1 = e$1;
1051
- }
1052
- if (!n$1) {
1053
- n$1 = !0;
1054
- a$2(0);
1055
- } else n$1 = !1;
1056
- (function applyInnerSource(e$3) {
1057
- l$1 = !0;
1058
- e$3(((e$4) => {
1059
- if (!l$1) {} else if (0 === e$4) {
1060
- l$1 = !1;
1061
- if (u$2) i$2(0);
1062
- else if (!n$1) {
1063
- n$1 = !0;
1064
- a$2(0);
1065
- }
1066
- } else if (0 === e$4.tag) {
1067
- s = !1;
1068
- (f$1 = e$4[0])(0);
1069
- } else {
1070
- i$2(e$4);
1071
- if (!s) f$1(0);
1072
- else s = !1;
1073
- }
1074
- }));
1075
- })(r$1(t$3[0]));
1076
- }
1077
- }));
1078
- i$2(start(((e$3) => {
1079
- if (1 === e$3) {
1080
- if (!u$2) {
1081
- u$2 = !0;
1082
- a$2(1);
1083
- }
1084
- if (l$1) {
1085
- l$1 = !1;
1086
- f$1(1);
1087
- }
1088
- } else {
1089
- if (!u$2 && !n$1) {
1090
- n$1 = !0;
1091
- a$2(0);
1092
- }
1093
- if (l$1 && !s) {
1094
- s = !0;
1095
- f$1(0);
1096
- }
1097
- }
1098
- })));
1099
- };
1100
- }
1101
- function take(r$1) {
1102
- return (t$2) => (i$2) => {
1103
- var a$2 = e$1;
1104
- var f$1 = !1;
1105
- var n$1 = 0;
1106
- t$2(((e$3) => {
1107
- if (f$1) {} else if (0 === e$3) {
1108
- f$1 = !0;
1109
- i$2(0);
1110
- } else if (0 === e$3.tag) if (r$1 <= 0) {
1111
- f$1 = !0;
1112
- i$2(0);
1113
- e$3[0](1);
1114
- } else a$2 = e$3[0];
1115
- else if (n$1++ < r$1) {
1116
- i$2(e$3);
1117
- if (!f$1 && n$1 >= r$1) {
1118
- f$1 = !0;
1119
- i$2(0);
1120
- a$2(1);
1121
- }
1122
- } else i$2(e$3);
1123
- }));
1124
- i$2(start(((e$3) => {
1125
- if (1 === e$3 && !f$1) {
1126
- f$1 = !0;
1127
- a$2(1);
1128
- } else if (0 === e$3 && !f$1 && n$1 < r$1) a$2(0);
1129
- })));
1130
- };
1131
- }
1132
- function takeUntil(r$1) {
1133
- return (t$2) => (i$2) => {
1134
- var a$2 = e$1;
1135
- var f$1 = e$1;
1136
- var n$1 = !1;
1137
- t$2(((e$3) => {
1138
- if (n$1) {} else if (0 === e$3) {
1139
- n$1 = !0;
1140
- f$1(1);
1141
- i$2(0);
1142
- } else if (0 === e$3.tag) {
1143
- a$2 = e$3[0];
1144
- r$1(((e$4) => {
1145
- if (0 === e$4) {} else if (0 === e$4.tag) (f$1 = e$4[0])(0);
1146
- else {
1147
- n$1 = !0;
1148
- f$1(1);
1149
- a$2(1);
1150
- i$2(0);
1151
- }
1152
- }));
1153
- } else i$2(e$3);
1154
- }));
1155
- i$2(start(((e$3) => {
1156
- if (1 === e$3 && !n$1) {
1157
- n$1 = !0;
1158
- a$2(1);
1159
- f$1(1);
1160
- } else if (!n$1) a$2(0);
1161
- })));
1162
- };
1163
- }
1164
- function takeWhile(r$1, t$2) {
1165
- return (i$2) => (a$2) => {
1166
- var f$1 = e$1;
1167
- var n$1 = !1;
1168
- i$2(((e$3) => {
1169
- if (n$1) {} else if (0 === e$3) {
1170
- n$1 = !0;
1171
- a$2(0);
1172
- } else if (0 === e$3.tag) {
1173
- f$1 = e$3[0];
1174
- a$2(e$3);
1175
- } else if (!r$1(e$3[0])) {
1176
- n$1 = !0;
1177
- if (t$2) a$2(e$3);
1178
- a$2(0);
1179
- f$1(1);
1180
- } else a$2(e$3);
1181
- }));
1182
- };
1183
- }
1184
- function lazy(e$3) {
1185
- return (r$1) => e$3()(r$1);
1186
- }
1187
- function fromAsyncIterable(e$3) {
1188
- return (r$1) => {
1189
- var t$2 = e$3[asyncIteratorSymbol()] && e$3[asyncIteratorSymbol()]() || e$3;
1190
- var i$2 = !1;
1191
- var a$2 = !1;
1192
- var f$1 = !1;
1193
- var n$1;
1194
- r$1(start((async (e$4) => {
1195
- if (1 === e$4) {
1196
- i$2 = !0;
1197
- if (t$2.return) t$2.return();
1198
- } else if (a$2) f$1 = !0;
1199
- else {
1200
- for (f$1 = a$2 = !0; f$1 && !i$2;) if ((n$1 = await t$2.next()).done) {
1201
- i$2 = !0;
1202
- if (t$2.return) await t$2.return();
1203
- r$1(0);
1204
- } else try {
1205
- f$1 = !1;
1206
- r$1(push(n$1.value));
1207
- } catch (e$5) {
1208
- if (t$2.throw) {
1209
- if (i$2 = !!(await t$2.throw(e$5)).done) r$1(0);
1210
- } else throw e$5;
1211
- }
1212
- a$2 = !1;
1213
- }
1214
- })));
1215
- };
1216
- }
1217
- function fromIterable(e$3) {
1218
- if (e$3[Symbol.asyncIterator]) return fromAsyncIterable(e$3);
1219
- return (r$1) => {
1220
- var t$2 = e$3[Symbol.iterator]();
1221
- var i$2 = !1;
1222
- var a$2 = !1;
1223
- var f$1 = !1;
1224
- var n$1;
1225
- r$1(start(((e$4) => {
1226
- if (1 === e$4) {
1227
- i$2 = !0;
1228
- if (t$2.return) t$2.return();
1229
- } else if (a$2) f$1 = !0;
1230
- else {
1231
- for (f$1 = a$2 = !0; f$1 && !i$2;) if ((n$1 = t$2.next()).done) {
1232
- i$2 = !0;
1233
- if (t$2.return) t$2.return();
1234
- r$1(0);
1235
- } else try {
1236
- f$1 = !1;
1237
- r$1(push(n$1.value));
1238
- } catch (e$5) {
1239
- if (t$2.throw) {
1240
- if (i$2 = !!t$2.throw(e$5).done) r$1(0);
1241
- } else throw e$5;
1242
- }
1243
- a$2 = !1;
1244
- }
1245
- })));
1246
- };
1247
- }
1248
- var r = fromIterable;
1249
- function fromValue(e$3) {
1250
- return (r$1) => {
1251
- var t$2 = !1;
1252
- r$1(start(((i$2) => {
1253
- if (1 === i$2) t$2 = !0;
1254
- else if (!t$2) {
1255
- t$2 = !0;
1256
- r$1(push(e$3));
1257
- r$1(0);
1258
- }
1259
- })));
1260
- };
1261
- }
1262
- function make(e$3) {
1263
- return (r$1) => {
1264
- var t$2 = !1;
1265
- var i$2 = e$3({
1266
- next(e$4) {
1267
- if (!t$2) r$1(push(e$4));
1268
- },
1269
- complete() {
1270
- if (!t$2) {
1271
- t$2 = !0;
1272
- r$1(0);
1273
- }
1274
- }
1275
- });
1276
- r$1(start(((e$4) => {
1277
- if (1 === e$4 && !t$2) {
1278
- t$2 = !0;
1279
- i$2();
1280
- }
1281
- })));
1282
- };
1283
- }
1284
- function makeSubject() {
1285
- var e$3;
1286
- var r$1;
1287
- return {
1288
- source: share(make(((t$2) => {
1289
- e$3 = t$2.next;
1290
- r$1 = t$2.complete;
1291
- return teardownPlaceholder;
1292
- }))),
1293
- next(r$2) {
1294
- if (e$3) e$3(r$2);
1295
- },
1296
- complete() {
1297
- if (r$1) r$1();
1298
- }
1299
- };
1300
- }
1301
- function subscribe(r$1) {
1302
- return (t$2) => {
1303
- var i$2 = e$1;
1304
- var a$2 = !1;
1305
- t$2(((e$3) => {
1306
- if (0 === e$3) a$2 = !0;
1307
- else if (0 === e$3.tag) (i$2 = e$3[0])(0);
1308
- else if (!a$2) {
1309
- r$1(e$3[0]);
1310
- i$2(0);
1311
- }
1312
- }));
1313
- return { unsubscribe() {
1314
- if (!a$2) {
1315
- a$2 = !0;
1316
- i$2(1);
1317
- }
1318
- } };
1319
- };
1320
- }
1321
- function publish(e$3) {
1322
- subscribe(((e$4) => {}))(e$3);
1323
- }
1324
- function toPromise(r$1) {
1325
- return new Promise(((t$2) => {
1326
- var i$2 = e$1;
1327
- var a$2;
1328
- r$1(((e$3) => {
1329
- if (0 === e$3) Promise.resolve(a$2).then(t$2);
1330
- else if (0 === e$3.tag) (i$2 = e$3[0])(0);
1331
- else {
1332
- a$2 = e$3[0];
1333
- i$2(0);
1334
- }
1335
- }));
1336
- }));
1337
- }
1338
-
1339
- //#endregion
1340
- //#region ../node_modules/@urql/core/dist/urql-core-chunk.mjs
1341
- var rehydrateGraphQlError = (r$1) => {
1342
- if (r$1 && "string" == typeof r$1.message && (r$1.extensions || "GraphQLError" === r$1.name)) return r$1;
1343
- else if ("object" == typeof r$1 && "string" == typeof r$1.message) return new GraphQLError(r$1.message, r$1.nodes, r$1.source, r$1.positions, r$1.path, r$1, r$1.extensions || {});
1344
- else return new GraphQLError(r$1);
1345
- };
1346
- var CombinedError = class extends Error {
1347
- constructor(e$3) {
1348
- var r$1 = (e$3.graphQLErrors || []).map(rehydrateGraphQlError);
1349
- var t$2 = ((e$4, r$2) => {
1350
- var t$3 = "";
1351
- if (e$4) return `[Network] ${e$4.message}`;
1352
- if (r$2) for (var a$2 = 0, n$1 = r$2.length; a$2 < n$1; a$2++) {
1353
- if (t$3) t$3 += "\n";
1354
- t$3 += `[GraphQL] ${r$2[a$2].message}`;
1355
- }
1356
- return t$3;
1357
- })(e$3.networkError, r$1);
1358
- super(t$2);
1359
- this.name = "CombinedError";
1360
- this.message = t$2;
1361
- this.graphQLErrors = r$1;
1362
- this.networkError = e$3.networkError;
1363
- this.response = e$3.response;
1364
- }
1365
- toString() {
1366
- return this.message;
1367
- }
1368
- };
1369
- var phash = (e$3, r$1) => {
1370
- var t$2 = 0 | (r$1 || 5381);
1371
- for (var a$2 = 0, n$1 = 0 | e$3.length; a$2 < n$1; a$2++) t$2 = (t$2 << 5) + t$2 + e$3.charCodeAt(a$2);
1372
- return t$2;
1373
- };
1374
- var i = /* @__PURE__ */ new Set();
1375
- var f = /* @__PURE__ */ new WeakMap();
1376
- var stringify = (e$3, r$1) => {
1377
- if (null === e$3 || i.has(e$3)) return "null";
1378
- else if ("object" != typeof e$3) return JSON.stringify(e$3) || "";
1379
- else if (e$3.toJSON) return stringify(e$3.toJSON(), r$1);
1380
- else if (Array.isArray(e$3)) {
1381
- var t$2 = "[";
1382
- for (var a$2 = 0, n$1 = e$3.length; a$2 < n$1; a$2++) {
1383
- if (t$2.length > 1) t$2 += ",";
1384
- t$2 += stringify(e$3[a$2], r$1) || "null";
1385
- }
1386
- return t$2 += "]";
1387
- } else if (!r$1 && (d !== NoopConstructor && e$3 instanceof d || l !== NoopConstructor && e$3 instanceof l)) return "null";
1388
- var o$1 = Object.keys(e$3).sort();
1389
- if (!o$1.length && e$3.constructor && Object.getPrototypeOf(e$3).constructor !== Object.prototype.constructor) {
1390
- var s = f.get(e$3) || Math.random().toString(36).slice(2);
1391
- f.set(e$3, s);
1392
- return stringify({ __key: s }, r$1);
1393
- }
1394
- i.add(e$3);
1395
- var c$1 = "{";
1396
- for (var v$1 = 0, u$2 = o$1.length; v$1 < u$2; v$1++) {
1397
- var p$1 = stringify(e$3[o$1[v$1]], r$1);
1398
- if (p$1) {
1399
- if (c$1.length > 1) c$1 += ",";
1400
- c$1 += stringify(o$1[v$1], r$1) + ":" + p$1;
1401
- }
1402
- }
1403
- i.delete(e$3);
1404
- return c$1 += "}";
1405
- };
1406
- var extract = (e$3, r$1, t$2) => {
1407
- if (null == t$2 || "object" != typeof t$2 || t$2.toJSON || i.has(t$2)) {} else if (Array.isArray(t$2)) for (var a$2 = 0, n$1 = t$2.length; a$2 < n$1; a$2++) extract(e$3, `${r$1}.${a$2}`, t$2[a$2]);
1408
- else if (t$2 instanceof d || t$2 instanceof l) e$3.set(r$1, t$2);
1409
- else {
1410
- i.add(t$2);
1411
- for (var o$1 in t$2) extract(e$3, `${r$1}.${o$1}`, t$2[o$1]);
1412
- }
1413
- };
1414
- var stringifyVariables = (e$3, r$1) => {
1415
- i.clear();
1416
- return stringify(e$3, r$1 || !1);
1417
- };
1418
- var NoopConstructor = class {};
1419
- var d = "undefined" != typeof File ? File : NoopConstructor;
1420
- var l = "undefined" != typeof Blob ? Blob : NoopConstructor;
1421
- var c = /("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g;
1422
- var v = /(?:#[^\n\r]+)?(?:[\r\n]+|$)/g;
1423
- var replaceOutsideStrings = (e$3, r$1) => r$1 % 2 == 0 ? e$3.replace(v, "\n") : e$3;
1424
- var sanitizeDocument = (e$3) => e$3.split(c).map(replaceOutsideStrings).join("").trim();
1425
- var u = /* @__PURE__ */ new Map();
1426
- var p = /* @__PURE__ */ new Map();
1427
- var stringifyDocument = (e$3) => {
1428
- var t$2;
1429
- if ("string" == typeof e$3) t$2 = sanitizeDocument(e$3);
1430
- else if (e$3.loc && p.get(e$3.__key) === e$3) t$2 = e$3.loc.source.body;
1431
- else {
1432
- t$2 = u.get(e$3) || sanitizeDocument(print(e$3));
1433
- u.set(e$3, t$2);
1434
- }
1435
- if ("string" != typeof e$3 && !e$3.loc) e$3.loc = {
1436
- start: 0,
1437
- end: t$2.length,
1438
- source: {
1439
- body: t$2,
1440
- name: "gql",
1441
- locationOffset: {
1442
- line: 1,
1443
- column: 1
1444
- }
1445
- }
1446
- };
1447
- return t$2;
1448
- };
1449
- var hashDocument = (e$3) => {
1450
- var r$1;
1451
- if (e$3.documentId) r$1 = phash(e$3.documentId);
1452
- else {
1453
- r$1 = phash(stringifyDocument(e$3));
1454
- if (e$3.definitions) {
1455
- var t$2 = getOperationName(e$3);
1456
- if (t$2) r$1 = phash(`\n# ${t$2}`, r$1);
1457
- }
1458
- }
1459
- return r$1;
1460
- };
1461
- var keyDocument = (e$3) => {
1462
- var r$1;
1463
- var t$2;
1464
- if ("string" == typeof e$3) {
1465
- r$1 = hashDocument(e$3);
1466
- t$2 = p.get(r$1) || parse(e$3, { noLocation: !0 });
1467
- } else {
1468
- r$1 = e$3.__key || hashDocument(e$3);
1469
- t$2 = p.get(r$1) || e$3;
1470
- }
1471
- if (!t$2.loc) stringifyDocument(t$2);
1472
- t$2.__key = r$1;
1473
- p.set(r$1, t$2);
1474
- return t$2;
1475
- };
1476
- var createRequest = (e$3, r$1, t$2) => {
1477
- var a$2 = r$1 || {};
1478
- var n$1 = keyDocument(e$3);
1479
- var o$1 = stringifyVariables(a$2, !0);
1480
- var s = n$1.__key;
1481
- if ("{}" !== o$1) s = phash(o$1, s);
1482
- return {
1483
- key: s,
1484
- query: n$1,
1485
- variables: a$2,
1486
- extensions: t$2
1487
- };
1488
- };
1489
- var getOperationName = (e$3) => {
1490
- for (var r$1 = 0, a$2 = e$3.definitions.length; r$1 < a$2; r$1++) {
1491
- var n$1 = e$3.definitions[r$1];
1492
- if (n$1.kind === e.OPERATION_DEFINITION) return n$1.name ? n$1.name.value : void 0;
1493
- }
1494
- };
1495
- var getOperationType = (e$3) => {
1496
- for (var r$1 = 0, a$2 = e$3.definitions.length; r$1 < a$2; r$1++) {
1497
- var n$1 = e$3.definitions[r$1];
1498
- if (n$1.kind === e.OPERATION_DEFINITION) return n$1.operation;
1499
- }
1500
- };
1501
- var makeResult = (e$3, r$1, t$2) => {
1502
- if (!("data" in r$1 || "errors" in r$1 && Array.isArray(r$1.errors))) throw new Error("No Content");
1503
- var a$2 = "subscription" === e$3.kind;
1504
- return {
1505
- operation: e$3,
1506
- data: r$1.data,
1507
- error: Array.isArray(r$1.errors) ? new CombinedError({
1508
- graphQLErrors: r$1.errors,
1509
- response: t$2
1510
- }) : void 0,
1511
- extensions: r$1.extensions ? { ...r$1.extensions } : void 0,
1512
- hasNext: null == r$1.hasNext ? a$2 : r$1.hasNext,
1513
- stale: !1
1514
- };
1515
- };
1516
- var deepMerge = (e$3, r$1) => {
1517
- if ("object" == typeof e$3 && null != e$3) {
1518
- if (Array.isArray(e$3)) {
1519
- e$3 = [...e$3];
1520
- for (var t$2 = 0, a$2 = r$1.length; t$2 < a$2; t$2++) e$3[t$2] = deepMerge(e$3[t$2], r$1[t$2]);
1521
- return e$3;
1522
- }
1523
- if (!e$3.constructor || e$3.constructor === Object) {
1524
- e$3 = { ...e$3 };
1525
- for (var n$1 in r$1) e$3[n$1] = deepMerge(e$3[n$1], r$1[n$1]);
1526
- return e$3;
1527
- }
1528
- }
1529
- return r$1;
1530
- };
1531
- var mergeResultPatch = (e$3, r$1, t$2, a$2) => {
1532
- var n$1 = e$3.error ? e$3.error.graphQLErrors : [];
1533
- var o$1 = !!e$3.extensions || !!(r$1.payload || r$1).extensions;
1534
- var s = {
1535
- ...e$3.extensions,
1536
- ...(r$1.payload || r$1).extensions
1537
- };
1538
- var i$2 = r$1.incremental;
1539
- if ("path" in r$1) i$2 = [r$1];
1540
- var f$1 = { data: e$3.data };
1541
- if (i$2) {
1542
- var _loop = function() {
1543
- var e$4 = i$2[d$2];
1544
- if (Array.isArray(e$4.errors)) n$1.push(...e$4.errors);
1545
- if (e$4.extensions) {
1546
- Object.assign(s, e$4.extensions);
1547
- o$1 = !0;
1548
- }
1549
- var r$2 = "data";
1550
- var t$3 = f$1;
1551
- var l$2 = [];
1552
- if (e$4.path) l$2 = e$4.path;
1553
- else if (a$2) {
1554
- var c$1 = a$2.find(((r$3) => r$3.id === e$4.id));
1555
- if (e$4.subPath) l$2 = [...c$1.path, ...e$4.subPath];
1556
- else l$2 = c$1.path;
1557
- }
1558
- for (var v$1 = 0, u$2 = l$2.length; v$1 < u$2; r$2 = l$2[v$1++]) t$3 = t$3[r$2] = Array.isArray(t$3[r$2]) ? [...t$3[r$2]] : { ...t$3[r$2] };
1559
- if (e$4.items) {
1560
- var p$1 = +r$2 >= 0 ? r$2 : 0;
1561
- for (var h$1 = 0, y$1 = e$4.items.length; h$1 < y$1; h$1++) t$3[p$1 + h$1] = deepMerge(t$3[p$1 + h$1], e$4.items[h$1]);
1562
- } else if (void 0 !== e$4.data) t$3[r$2] = deepMerge(t$3[r$2], e$4.data);
1563
- };
1564
- for (var d$2 = 0, l$1 = i$2.length; d$2 < l$1; d$2++) _loop();
1565
- } else {
1566
- f$1.data = (r$1.payload || r$1).data || e$3.data;
1567
- n$1 = r$1.errors || r$1.payload && r$1.payload.errors || n$1;
1568
- }
1569
- return {
1570
- operation: e$3.operation,
1571
- data: f$1.data,
1572
- error: n$1.length ? new CombinedError({
1573
- graphQLErrors: n$1,
1574
- response: t$2
1575
- }) : void 0,
1576
- extensions: o$1 ? s : void 0,
1577
- hasNext: null != r$1.hasNext ? r$1.hasNext : e$3.hasNext,
1578
- stale: !1
1579
- };
1580
- };
1581
- var makeErrorResult = (e$3, r$1, t$2) => ({
1582
- operation: e$3,
1583
- data: void 0,
1584
- error: new CombinedError({
1585
- networkError: r$1,
1586
- response: t$2
1587
- }),
1588
- extensions: void 0,
1589
- hasNext: !1,
1590
- stale: !1
1591
- });
1592
- function makeFetchBody(e$3) {
1593
- var r$1 = {
1594
- query: void 0,
1595
- documentId: void 0,
1596
- operationName: getOperationName(e$3.query),
1597
- variables: e$3.variables || void 0,
1598
- extensions: e$3.extensions
1599
- };
1600
- if ("documentId" in e$3.query && e$3.query.documentId && (!e$3.query.definitions || !e$3.query.definitions.length)) r$1.documentId = e$3.query.documentId;
1601
- else if (!e$3.extensions || !e$3.extensions.persistedQuery || e$3.extensions.persistedQuery.miss) r$1.query = stringifyDocument(e$3.query);
1602
- return r$1;
1603
- }
1604
- var makeFetchURL = (e$3, r$1) => {
1605
- var t$2 = "query" === e$3.kind && e$3.context.preferGetMethod;
1606
- if (!t$2 || !r$1) return e$3.context.url;
1607
- var a$2 = splitOutSearchParams(e$3.context.url);
1608
- for (var n$1 in r$1) {
1609
- var o$1 = r$1[n$1];
1610
- if (o$1) a$2[1].set(n$1, "object" == typeof o$1 ? stringifyVariables(o$1) : o$1);
1611
- }
1612
- var s = a$2.join("?");
1613
- if (s.length > 2047 && "force" !== t$2) {
1614
- e$3.context.preferGetMethod = !1;
1615
- return e$3.context.url;
1616
- }
1617
- return s;
1618
- };
1619
- var splitOutSearchParams = (e$3) => {
1620
- var r$1 = e$3.indexOf("?");
1621
- return r$1 > -1 ? [e$3.slice(0, r$1), new URLSearchParams(e$3.slice(r$1 + 1))] : [e$3, new URLSearchParams()];
1622
- };
1623
- var serializeBody = (e$3, r$1) => {
1624
- if (r$1 && !("query" === e$3.kind && !!e$3.context.preferGetMethod)) {
1625
- var t$2 = stringifyVariables(r$1);
1626
- var a$2 = ((e$4) => {
1627
- var r$2 = /* @__PURE__ */ new Map();
1628
- if (d !== NoopConstructor || l !== NoopConstructor) {
1629
- i.clear();
1630
- extract(r$2, "variables", e$4);
1631
- }
1632
- return r$2;
1633
- })(r$1.variables);
1634
- if (a$2.size) {
1635
- var n$1 = new FormData();
1636
- n$1.append("operations", t$2);
1637
- n$1.append("map", stringifyVariables({ ...[...a$2.keys()].map(((e$4) => [e$4])) }));
1638
- var o$1 = 0;
1639
- for (var s of a$2.values()) n$1.append("" + o$1++, s);
1640
- return n$1;
1641
- }
1642
- return t$2;
1643
- }
1644
- };
1645
- var makeFetchOptions = (e$3, r$1) => {
1646
- var t$2 = { accept: "subscription" === e$3.kind ? "text/event-stream, multipart/mixed" : "application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed" };
1647
- var a$2 = ("function" == typeof e$3.context.fetchOptions ? e$3.context.fetchOptions() : e$3.context.fetchOptions) || {};
1648
- if (a$2.headers) if (((e$4) => "has" in e$4 && !Object.keys(e$4).length)(a$2.headers)) a$2.headers.forEach(((e$4, r$2) => {
1649
- t$2[r$2] = e$4;
1650
- }));
1651
- else if (Array.isArray(a$2.headers)) a$2.headers.forEach(((e$4, r$2) => {
1652
- if (Array.isArray(e$4)) if (t$2[e$4[0]]) t$2[e$4[0]] = `${t$2[e$4[0]]},${e$4[1]}`;
1653
- else t$2[e$4[0]] = e$4[1];
1654
- else t$2[r$2] = e$4;
1655
- }));
1656
- else for (var n$1 in a$2.headers) t$2[n$1.toLowerCase()] = a$2.headers[n$1];
1657
- var o$1 = serializeBody(e$3, r$1);
1658
- if ("string" == typeof o$1 && !t$2["content-type"]) t$2["content-type"] = "application/json";
1659
- return {
1660
- ...a$2,
1661
- method: o$1 ? "POST" : "GET",
1662
- body: o$1,
1663
- headers: t$2
1664
- };
1665
- };
1666
- var h = /boundary="?([^=";]+)"?/i;
1667
- var y = /data: ?([^\n]+)/;
1668
- async function* streamBody(e$3) {
1669
- if (e$3.body[Symbol.asyncIterator]) for await (var r$1 of e$3.body) yield r$1;
1670
- else {
1671
- var t$2 = e$3.body.getReader();
1672
- var a$2;
1673
- try {
1674
- while (!(a$2 = await t$2.read()).done) yield a$2.value;
1675
- } finally {
1676
- t$2.cancel();
1677
- }
1678
- }
1679
- }
1680
- async function* streamToBoundedChunks(e$3, r$1) {
1681
- var t$2 = "undefined" != typeof TextDecoder ? new TextDecoder() : null;
1682
- var a$2 = "";
1683
- var n$1;
1684
- for await (var o$1 of e$3) {
1685
- a$2 += "Buffer" === o$1.constructor.name ? o$1.toString() : t$2.decode(o$1, { stream: !0 });
1686
- while ((n$1 = a$2.indexOf(r$1)) > -1) {
1687
- yield a$2.slice(0, n$1);
1688
- a$2 = a$2.slice(n$1 + r$1.length);
1689
- }
1690
- }
1691
- }
1692
- async function* fetchOperation(e$3, r$1, t$2) {
1693
- var a$2 = !0;
1694
- var n$1 = null;
1695
- var o$1;
1696
- try {
1697
- yield await Promise.resolve();
1698
- var s = (o$1 = await (e$3.context.fetch || fetch)(r$1, t$2)).headers.get("Content-Type") || "";
1699
- var i$2;
1700
- if (/multipart\/mixed/i.test(s)) i$2 = async function* parseMultipartMixed(e$4, r$2) {
1701
- var t$3 = e$4.match(h);
1702
- var a$3 = "--" + (t$3 ? t$3[1] : "-");
1703
- var n$2 = !0;
1704
- var o$2;
1705
- for await (var s$1 of streamToBoundedChunks(streamBody(r$2), "\r\n" + a$3)) {
1706
- if (n$2) {
1707
- n$2 = !1;
1708
- var i$3 = s$1.indexOf(a$3);
1709
- if (i$3 > -1) s$1 = s$1.slice(i$3 + a$3.length);
1710
- else continue;
1711
- }
1712
- try {
1713
- yield o$2 = JSON.parse(s$1.slice(s$1.indexOf("\r\n\r\n") + 4));
1714
- } catch (e$5) {
1715
- if (!o$2) throw e$5;
1716
- }
1717
- if (o$2 && !1 === o$2.hasNext) break;
1718
- }
1719
- if (o$2 && !1 !== o$2.hasNext) yield { hasNext: !1 };
1720
- }(s, o$1);
1721
- else if (/text\/event-stream/i.test(s)) i$2 = async function* parseEventStream(e$4) {
1722
- var r$2;
1723
- for await (var t$3 of streamToBoundedChunks(streamBody(e$4), "\n\n")) {
1724
- var a$3 = t$3.match(y);
1725
- if (a$3) {
1726
- var n$2 = a$3[1];
1727
- try {
1728
- yield r$2 = JSON.parse(n$2);
1729
- } catch (e$5) {
1730
- if (!r$2) throw e$5;
1731
- }
1732
- if (r$2 && !1 === r$2.hasNext) break;
1733
- }
1734
- }
1735
- if (r$2 && !1 !== r$2.hasNext) yield { hasNext: !1 };
1736
- }(o$1);
1737
- else if (!/text\//i.test(s)) i$2 = async function* parseJSON(e$4) {
1738
- yield JSON.parse(await e$4.text());
1739
- }(o$1);
1740
- else i$2 = async function* parseMaybeJSON(e$4) {
1741
- var r$2 = await e$4.text();
1742
- try {
1743
- var t$3 = JSON.parse(r$2);
1744
- if ("production" !== process.env.NODE_ENV) console.warn("Found response with content-type \"text/plain\" but it had a valid \"application/json\" response.");
1745
- yield t$3;
1746
- } catch (e$5) {
1747
- throw new Error(r$2);
1748
- }
1749
- }(o$1);
1750
- var f$1;
1751
- for await (var d$2 of i$2) {
1752
- if (d$2.pending && !n$1) f$1 = d$2.pending;
1753
- else if (d$2.pending) f$1 = [...f$1, ...d$2.pending];
1754
- n$1 = n$1 ? mergeResultPatch(n$1, d$2, o$1, f$1) : makeResult(e$3, d$2, o$1);
1755
- a$2 = !1;
1756
- yield n$1;
1757
- a$2 = !0;
1758
- }
1759
- if (!n$1) yield n$1 = makeResult(e$3, {}, o$1);
1760
- } catch (r$2) {
1761
- if (!a$2) throw r$2;
1762
- yield makeErrorResult(e$3, o$1 && (o$1.status < 200 || o$1.status >= 300) && o$1.statusText ? new Error(o$1.statusText) : r$2, o$1);
1763
- }
1764
- }
1765
- function makeFetchSource(e$3, r$1, t$2) {
1766
- var a$2;
1767
- if ("undefined" != typeof AbortController) t$2.signal = (a$2 = new AbortController()).signal;
1768
- return onEnd((() => {
1769
- if (a$2) a$2.abort();
1770
- }))(filter(((e$4) => !!e$4))(fromAsyncIterable(fetchOperation(e$3, r$1, t$2))));
1771
- }
1772
-
1773
- //#endregion
1774
- //#region ../node_modules/@urql/core/dist/urql-core.mjs
1775
- var collectTypes = (e$3, r$1) => {
1776
- if (Array.isArray(e$3)) for (var t$2 = 0, n$1 = e$3.length; t$2 < n$1; t$2++) collectTypes(e$3[t$2], r$1);
1777
- else if ("object" == typeof e$3 && null !== e$3) for (var a$2 in e$3) if ("__typename" === a$2 && "string" == typeof e$3[a$2]) r$1.add(e$3[a$2]);
1778
- else collectTypes(e$3[a$2], r$1);
1779
- return r$1;
1780
- };
1781
- var formatNode = (r$1) => {
1782
- if ("definitions" in r$1) {
1783
- var t$2 = [];
1784
- for (var n$1 = 0, a$2 = r$1.definitions.length; n$1 < a$2; n$1++) {
1785
- var i$2 = formatNode(r$1.definitions[n$1]);
1786
- t$2.push(i$2);
1787
- }
1788
- return {
1789
- ...r$1,
1790
- definitions: t$2
1791
- };
1792
- }
1793
- if ("directives" in r$1 && r$1.directives && r$1.directives.length) {
1794
- var o$1 = [];
1795
- var s = {};
1796
- for (var c$1 = 0, u$2 = r$1.directives.length; c$1 < u$2; c$1++) {
1797
- var p$1 = r$1.directives[c$1];
1798
- var d$2 = p$1.name.value;
1799
- if ("_" !== d$2[0]) o$1.push(p$1);
1800
- else d$2 = d$2.slice(1);
1801
- s[d$2] = p$1;
1802
- }
1803
- r$1 = {
1804
- ...r$1,
1805
- directives: o$1,
1806
- _directives: s
1807
- };
1808
- }
1809
- if ("selectionSet" in r$1) {
1810
- var l$1 = [];
1811
- var v$1 = r$1.kind === e.OPERATION_DEFINITION;
1812
- if (r$1.selectionSet) {
1813
- for (var f$1 = 0, h$1 = r$1.selectionSet.selections.length; f$1 < h$1; f$1++) {
1814
- var k = r$1.selectionSet.selections[f$1];
1815
- v$1 = v$1 || k.kind === e.FIELD && "__typename" === k.name.value && !k.alias;
1816
- var y$1 = formatNode(k);
1817
- l$1.push(y$1);
1818
- }
1819
- if (!v$1) l$1.push({
1820
- kind: e.FIELD,
1821
- name: {
1822
- kind: e.NAME,
1823
- value: "__typename"
1824
- },
1825
- _generated: !0
1826
- });
1827
- return {
1828
- ...r$1,
1829
- selectionSet: {
1830
- ...r$1.selectionSet,
1831
- selections: l$1
1832
- }
1833
- };
1834
- }
1835
- }
1836
- return r$1;
1837
- };
1838
- var I = /* @__PURE__ */ new Map();
1839
- var formatDocument = (e$3) => {
1840
- var t$2 = keyDocument(e$3);
1841
- var n$1 = I.get(t$2.__key);
1842
- if (!n$1) {
1843
- I.set(t$2.__key, n$1 = formatNode(t$2));
1844
- Object.defineProperty(n$1, "__key", {
1845
- value: t$2.__key,
1846
- enumerable: !1
1847
- });
1848
- }
1849
- return n$1;
1850
- };
1851
- function withPromise(e$3) {
1852
- var source$ = (r$1) => e$3(r$1);
1853
- source$.toPromise = () => toPromise(take(1)(filter(((e$4) => !e$4.stale && !e$4.hasNext))(source$)));
1854
- source$.then = (e$4, r$1) => source$.toPromise().then(e$4, r$1);
1855
- source$.subscribe = (e$4) => subscribe(e$4)(source$);
1856
- return source$;
1857
- }
1858
- function makeOperation(e$3, r$1, t$2) {
1859
- return {
1860
- ...r$1,
1861
- kind: e$3,
1862
- context: r$1.context ? {
1863
- ...r$1.context,
1864
- ...t$2
1865
- } : t$2 || r$1.context
1866
- };
1867
- }
1868
- var addMetadata = (e$3, r$1) => makeOperation(e$3.kind, e$3, { meta: {
1869
- ...e$3.context.meta,
1870
- ...r$1
1871
- } });
1872
- var noop = () => {};
1873
- var shouldSkip = ({ kind: e$3 }) => "mutation" !== e$3 && "query" !== e$3;
1874
- var mapTypeNames = (e$3) => {
1875
- var r$1 = formatDocument(e$3.query);
1876
- if (r$1 !== e$3.query) {
1877
- var t$2 = makeOperation(e$3.kind, e$3);
1878
- t$2.query = r$1;
1879
- return t$2;
1880
- } else return e$3;
1881
- };
1882
- var cacheExchange = ({ forward: e$3, client: r$1, dispatchDebug: t$2 }) => {
1883
- var a$2 = /* @__PURE__ */ new Map();
1884
- var i$2 = /* @__PURE__ */ new Map();
1885
- var isOperationCached = (e$4) => "query" === e$4.kind && "network-only" !== e$4.context.requestPolicy && ("cache-only" === e$4.context.requestPolicy || a$2.has(e$4.key));
1886
- return (o$1) => {
1887
- return merge([map(((e$4) => {
1888
- var i$3 = a$2.get(e$4.key);
1889
- "production" !== process.env.NODE_ENV && t$2({
1890
- operation: e$4,
1891
- ...i$3 ? {
1892
- type: "cacheHit",
1893
- message: "The result was successfully retrieved from the cache"
1894
- } : {
1895
- type: "cacheMiss",
1896
- message: "The result could not be retrieved from the cache"
1897
- },
1898
- source: "cacheExchange"
1899
- });
1900
- var o$2 = i$3 || makeResult(e$4, { data: null });
1901
- o$2 = {
1902
- ...o$2,
1903
- operation: addMetadata(e$4, { cacheOutcome: i$3 ? "hit" : "miss" })
1904
- };
1905
- if ("cache-and-network" === e$4.context.requestPolicy) {
1906
- o$2.stale = !0;
1907
- reexecuteOperation(r$1, e$4);
1908
- }
1909
- return o$2;
1910
- }))(filter(((e$4) => !shouldSkip(e$4) && isOperationCached(e$4)))(o$1)), onPush(((e$4) => {
1911
- var { operation: n$1 } = e$4;
1912
- if (!n$1) return;
1913
- var o$2 = n$1.context.additionalTypenames || [];
1914
- if ("subscription" !== e$4.operation.kind) o$2 = ((e$5) => [...collectTypes(e$5, /* @__PURE__ */ new Set())])(e$4.data).concat(o$2);
1915
- if ("mutation" === e$4.operation.kind || "subscription" === e$4.operation.kind) {
1916
- var s = /* @__PURE__ */ new Set();
1917
- "production" !== process.env.NODE_ENV && t$2({
1918
- type: "cacheInvalidation",
1919
- message: `The following typenames have been invalidated: ${o$2}`,
1920
- operation: n$1,
1921
- data: {
1922
- typenames: o$2,
1923
- response: e$4
1924
- },
1925
- source: "cacheExchange"
1926
- });
1927
- for (var c$1 = 0; c$1 < o$2.length; c$1++) {
1928
- var u$2 = o$2[c$1];
1929
- var p$1 = i$2.get(u$2);
1930
- if (!p$1) i$2.set(u$2, p$1 = /* @__PURE__ */ new Set());
1931
- for (var d$2 of p$1.values()) s.add(d$2);
1932
- p$1.clear();
1933
- }
1934
- for (var l$1 of s.values()) if (a$2.has(l$1)) {
1935
- n$1 = a$2.get(l$1).operation;
1936
- a$2.delete(l$1);
1937
- reexecuteOperation(r$1, n$1);
1938
- }
1939
- } else if ("query" === n$1.kind && e$4.data) {
1940
- a$2.set(n$1.key, e$4);
1941
- for (var v$1 = 0; v$1 < o$2.length; v$1++) {
1942
- var f$1 = o$2[v$1];
1943
- var h$1 = i$2.get(f$1);
1944
- if (!h$1) i$2.set(f$1, h$1 = /* @__PURE__ */ new Set());
1945
- h$1.add(n$1.key);
1946
- }
1947
- }
1948
- }))(e$3(filter(((e$4) => "query" !== e$4.kind || "cache-only" !== e$4.context.requestPolicy))(map(((e$4) => addMetadata(e$4, { cacheOutcome: "miss" })))(merge([map(mapTypeNames)(filter(((e$4) => !shouldSkip(e$4) && !isOperationCached(e$4)))(o$1)), filter(((e$4) => shouldSkip(e$4)))(o$1)])))))]);
1949
- };
1950
- };
1951
- var reexecuteOperation = (e$3, r$1) => e$3.reexecuteOperation(makeOperation(r$1.kind, r$1, { requestPolicy: "network-only" }));
1952
- var fetchExchange = ({ forward: e$3, dispatchDebug: r$1 }) => (t$2) => {
1953
- return merge([mergeMap(((e$4) => {
1954
- var n$1 = makeFetchBody(e$4);
1955
- var a$2 = makeFetchURL(e$4, n$1);
1956
- var i$2 = makeFetchOptions(e$4, n$1);
1957
- "production" !== process.env.NODE_ENV && r$1({
1958
- type: "fetchRequest",
1959
- message: "A fetch request is being executed.",
1960
- operation: e$4,
1961
- data: {
1962
- url: a$2,
1963
- fetchOptions: i$2
1964
- },
1965
- source: "fetchExchange"
1966
- });
1967
- var s = takeUntil(filter(((r$2) => "teardown" === r$2.kind && r$2.key === e$4.key))(t$2))(makeFetchSource(e$4, a$2, i$2));
1968
- if ("production" !== process.env.NODE_ENV) return onPush(((t$3) => {
1969
- var n$2 = !t$3.data ? t$3.error : void 0;
1970
- "production" !== process.env.NODE_ENV && r$1({
1971
- type: n$2 ? "fetchError" : "fetchSuccess",
1972
- message: `A ${n$2 ? "failed" : "successful"} fetch response has been returned.`,
1973
- operation: e$4,
1974
- data: {
1975
- url: a$2,
1976
- fetchOptions: i$2,
1977
- value: n$2 || t$3
1978
- },
1979
- source: "fetchExchange"
1980
- });
1981
- }))(s);
1982
- return s;
1983
- }))(filter(((e$4) => "teardown" !== e$4.kind && ("subscription" !== e$4.kind || !!e$4.context.fetchSubscriptions)))(t$2)), e$3(filter(((e$4) => "teardown" === e$4.kind || "subscription" === e$4.kind && !e$4.context.fetchSubscriptions))(t$2))]);
1984
- };
1985
- var composeExchanges = (e$3) => ({ client: r$1, forward: t$2, dispatchDebug: n$1 }) => e$3.reduceRight(((e$4, t$3) => {
1986
- var a$2 = !1;
1987
- return t$3({
1988
- client: r$1,
1989
- forward(r$2) {
1990
- if ("production" !== process.env.NODE_ENV) {
1991
- if (a$2) throw new Error("forward() must only be called once in each Exchange.");
1992
- a$2 = !0;
1993
- }
1994
- return share(e$4(share(r$2)));
1995
- },
1996
- dispatchDebug(e$5) {
1997
- "production" !== process.env.NODE_ENV && n$1({
1998
- timestamp: Date.now(),
1999
- source: t$3.name,
2000
- ...e$5
2001
- });
2002
- }
2003
- });
2004
- }), t$2);
2005
- var fallbackExchange = ({ dispatchDebug: e$3 }) => (r$1) => {
2006
- if ("production" !== process.env.NODE_ENV) r$1 = onPush(((r$2) => {
2007
- if ("teardown" !== r$2.kind && "production" !== process.env.NODE_ENV) {
2008
- var t$2 = `No exchange has handled operations of kind "${r$2.kind}". Check whether you've added an exchange responsible for these operations.`;
2009
- "production" !== process.env.NODE_ENV && e$3({
2010
- type: "fallbackCatch",
2011
- message: t$2,
2012
- operation: r$2,
2013
- source: "fallbackExchange"
2014
- });
2015
- console.warn(t$2);
2016
- }
2017
- }))(r$1);
2018
- return filter(((e$4) => !1))(r$1);
2019
- };
2020
- var C = function Client(e$3) {
2021
- if ("production" !== process.env.NODE_ENV && !e$3.url) throw new Error("You are creating an urql-client without a url.");
2022
- var r$1 = 0;
2023
- var t$2 = /* @__PURE__ */ new Map();
2024
- var n$1 = /* @__PURE__ */ new Map();
2025
- var a$2 = /* @__PURE__ */ new Set();
2026
- var i$2 = [];
2027
- var o$1 = {
2028
- url: e$3.url,
2029
- fetchSubscriptions: e$3.fetchSubscriptions,
2030
- fetchOptions: e$3.fetchOptions,
2031
- fetch: e$3.fetch,
2032
- preferGetMethod: null != e$3.preferGetMethod ? e$3.preferGetMethod : "within-url-limit",
2033
- requestPolicy: e$3.requestPolicy || "cache-first"
2034
- };
2035
- var s = makeSubject();
2036
- function nextOperation(e$4) {
2037
- if ("mutation" === e$4.kind || "teardown" === e$4.kind || !a$2.has(e$4.key)) {
2038
- if ("teardown" === e$4.kind) a$2.delete(e$4.key);
2039
- else if ("mutation" !== e$4.kind) a$2.add(e$4.key);
2040
- s.next(e$4);
2041
- }
2042
- }
2043
- var c$1 = !1;
2044
- function dispatchOperation(e$4) {
2045
- if (e$4) nextOperation(e$4);
2046
- if (!c$1) {
2047
- c$1 = !0;
2048
- while (c$1 && (e$4 = i$2.shift())) nextOperation(e$4);
2049
- c$1 = !1;
2050
- }
2051
- }
2052
- var makeResultSource = (e$4) => {
2053
- var r$2 = takeUntil(filter(((r$3) => "teardown" === r$3.kind && r$3.key === e$4.key))(s.source))(filter(((r$3) => r$3.operation.kind === e$4.kind && r$3.operation.key === e$4.key && (!r$3.operation.context._instance || r$3.operation.context._instance === e$4.context._instance)))(E));
2054
- if ("query" !== e$4.kind) r$2 = takeWhile(((e$5) => !!e$5.hasNext), !0)(r$2);
2055
- else r$2 = switchMap(((r$3) => {
2056
- var t$3 = fromValue(r$3);
2057
- return r$3.stale || r$3.hasNext ? t$3 : merge([t$3, map((() => {
2058
- r$3.stale = !0;
2059
- return r$3;
2060
- }))(take(1)(filter(((r$4) => r$4.key === e$4.key))(s.source)))]);
2061
- }))(r$2);
2062
- if ("mutation" !== e$4.kind) r$2 = onEnd((() => {
2063
- a$2.delete(e$4.key);
2064
- t$2.delete(e$4.key);
2065
- n$1.delete(e$4.key);
2066
- c$1 = !1;
2067
- for (var r$3 = i$2.length - 1; r$3 >= 0; r$3--) if (i$2[r$3].key === e$4.key) i$2.splice(r$3, 1);
2068
- nextOperation(makeOperation("teardown", e$4, e$4.context));
2069
- }))(onPush(((r$3) => {
2070
- if (r$3.stale) if (!r$3.hasNext) a$2.delete(e$4.key);
2071
- else for (var n$2 = 0; n$2 < i$2.length; n$2++) {
2072
- var o$2 = i$2[n$2];
2073
- if (o$2.key === r$3.operation.key) {
2074
- a$2.delete(o$2.key);
2075
- break;
2076
- }
2077
- }
2078
- else if (!r$3.hasNext) a$2.delete(e$4.key);
2079
- t$2.set(e$4.key, r$3);
2080
- }))(r$2));
2081
- else r$2 = onStart((() => {
2082
- nextOperation(e$4);
2083
- }))(r$2);
2084
- return share(r$2);
2085
- };
2086
- var u$2 = this instanceof Client ? this : Object.create(Client.prototype);
2087
- var p$1 = Object.assign(u$2, {
2088
- suspense: !!e$3.suspense,
2089
- operations$: s.source,
2090
- reexecuteOperation(e$4) {
2091
- if ("teardown" === e$4.kind) dispatchOperation(e$4);
2092
- else if ("mutation" === e$4.kind) {
2093
- i$2.push(e$4);
2094
- Promise.resolve().then(dispatchOperation);
2095
- } else if (n$1.has(e$4.key)) {
2096
- var r$2 = !1;
2097
- for (var t$3 = 0; t$3 < i$2.length; t$3++) if (i$2[t$3].key === e$4.key) {
2098
- i$2[t$3] = e$4;
2099
- r$2 = !0;
2100
- }
2101
- if (!(r$2 || a$2.has(e$4.key) && "network-only" !== e$4.context.requestPolicy)) {
2102
- i$2.push(e$4);
2103
- Promise.resolve().then(dispatchOperation);
2104
- } else {
2105
- a$2.delete(e$4.key);
2106
- Promise.resolve().then(dispatchOperation);
2107
- }
2108
- }
2109
- },
2110
- createRequestOperation(e$4, t$3, n$2) {
2111
- if (!n$2) n$2 = {};
2112
- var a$3;
2113
- if ("production" !== process.env.NODE_ENV && "teardown" !== e$4 && (a$3 = getOperationType(t$3.query)) !== e$4) throw new Error(`Expected operation of type "${e$4}" but found "${a$3}"`);
2114
- return makeOperation(e$4, t$3, {
2115
- _instance: "mutation" === e$4 ? r$1 = r$1 + 1 | 0 : void 0,
2116
- ...o$1,
2117
- ...n$2,
2118
- requestPolicy: n$2.requestPolicy || o$1.requestPolicy,
2119
- suspense: n$2.suspense || !1 !== n$2.suspense && p$1.suspense
2120
- });
2121
- },
2122
- executeRequestOperation(e$4) {
2123
- if ("mutation" === e$4.kind) return withPromise(makeResultSource(e$4));
2124
- return withPromise(lazy((() => {
2125
- var r$2 = n$1.get(e$4.key);
2126
- if (!r$2) n$1.set(e$4.key, r$2 = makeResultSource(e$4));
2127
- r$2 = onStart((() => {
2128
- dispatchOperation(e$4);
2129
- }))(r$2);
2130
- var a$3 = t$2.get(e$4.key);
2131
- if ("query" === e$4.kind && a$3 && (a$3.stale || a$3.hasNext)) return switchMap(fromValue)(merge([r$2, filter(((r$3) => r$3 === t$2.get(e$4.key)))(fromValue(a$3))]));
2132
- else return r$2;
2133
- })));
2134
- },
2135
- executeQuery(e$4, r$2) {
2136
- var t$3 = p$1.createRequestOperation("query", e$4, r$2);
2137
- return p$1.executeRequestOperation(t$3);
2138
- },
2139
- executeSubscription(e$4, r$2) {
2140
- var t$3 = p$1.createRequestOperation("subscription", e$4, r$2);
2141
- return p$1.executeRequestOperation(t$3);
2142
- },
2143
- executeMutation(e$4, r$2) {
2144
- var t$3 = p$1.createRequestOperation("mutation", e$4, r$2);
2145
- return p$1.executeRequestOperation(t$3);
2146
- },
2147
- readQuery(e$4, r$2, t$3) {
2148
- var n$2 = null;
2149
- subscribe(((e$5) => {
2150
- n$2 = e$5;
2151
- }))(p$1.query(e$4, r$2, t$3)).unsubscribe();
2152
- return n$2;
2153
- },
2154
- query: (e$4, r$2, t$3) => p$1.executeQuery(createRequest(e$4, r$2), t$3),
2155
- subscription: (e$4, r$2, t$3) => p$1.executeSubscription(createRequest(e$4, r$2), t$3),
2156
- mutation: (e$4, r$2, t$3) => p$1.executeMutation(createRequest(e$4, r$2), t$3)
2157
- });
2158
- var d$2 = noop;
2159
- if ("production" !== process.env.NODE_ENV) {
2160
- var { next: f$1, source: x } = makeSubject();
2161
- p$1.subscribeToDebugTarget = (e$4) => subscribe(e$4)(x);
2162
- d$2 = f$1;
2163
- }
2164
- var E = share(composeExchanges(e$3.exchanges)({
2165
- client: p$1,
2166
- dispatchDebug: d$2,
2167
- forward: fallbackExchange({ dispatchDebug: d$2 })
2168
- })(s.source));
2169
- publish(E);
2170
- return p$1;
2171
- };
2172
-
2173
763
  //#endregion
2174
764
  //#region ../graphql/src/client/index.ts
2175
765
  const graphql = initGraphQLTada();
2176
- /**
2177
- * Create a type-safe Jive GraphQL client using urql
2178
- *
2179
- * @example
2180
- * ```typescript
2181
- * import { createJiveGraphqlClient, graphql } from '@jive-ai/graphql/client';
2182
- *
2183
- * const client = createJiveGraphqlClient({
2184
- * url: 'http://localhost:4000/graphql',
2185
- * apiKey: 'jive_xxx',
2186
- * });
2187
- *
2188
- * const GetTaskQuery = graphql(`
2189
- * query GetTask($id: ID!) {
2190
- * task(id: $id) {
2191
- * id
2192
- * title
2193
- * status
2194
- * }
2195
- * }
2196
- * `);
2197
- *
2198
- * const result = await client.request(GetTaskQuery, { id: '1' });
2199
- * // result.task is fully typed!
2200
- * ```
2201
- */
2202
- function createJiveGraphqlClient(config$2) {
2203
- const { url, apiKey, bearerToken, headers: customHeaders = {} } = config$2;
2204
- const urqlClient = new C({
2205
- url,
2206
- exchanges: [cacheExchange, fetchExchange],
2207
- fetchOptions: () => {
2208
- const headers = { ...customHeaders };
2209
- if (apiKey) headers["X-API-Key"] = apiKey;
2210
- if (bearerToken) headers["Authorization"] = `Bearer ${bearerToken}`;
2211
- return { headers };
2212
- }
2213
- });
2214
- return {
2215
- urql: urqlClient,
2216
- async request(document, variables) {
2217
- const result = await urqlClient.query(document, variables ?? {}).toPromise();
2218
- if (result.error) {
2219
- if (result.error.networkError) {
2220
- const cause = result.error.networkError.cause || result.error.networkError;
2221
- throw new Error(`GraphQL network error: ${cause?.message || cause}`, { cause });
2222
- }
2223
- throw new Error(`GraphQL error: ${result.error.message}`);
2224
- }
2225
- if (!result.data) throw new Error("No data returned from GraphQL");
2226
- return result.data;
2227
- },
2228
- async mutate(document, variables) {
2229
- const result = await urqlClient.mutation(document, variables ?? {}).toPromise();
2230
- if (result.error) {
2231
- console.error(result.error);
2232
- throw new Error(`GraphQL error: ${result.error.message}`);
2233
- }
2234
- if (!result.data) throw new Error("No data returned from GraphQL");
2235
- return result.data;
2236
- },
2237
- async requestWithErrors(document, variables) {
2238
- const result = await urqlClient.query(document, variables ?? {}).toPromise();
2239
- return {
2240
- data: result.data,
2241
- errors: result.error?.graphQLErrors?.map((e$3) => ({
2242
- message: e$3.message,
2243
- path: e$3.path
2244
- }))
2245
- };
2246
- }
2247
- };
2248
- }
2249
766
  const queries = {
2250
767
  GetTask: graphql(`
2251
768
  query GetTask($id: ID!) {
@@ -2513,6 +1030,48 @@ const mutations = {
2513
1030
  }
2514
1031
  }
2515
1032
  }
1033
+ `),
1034
+ CreateIssue: graphql(`
1035
+ mutation CreateIssue($input: CreateIssueInput!) {
1036
+ createIssue(input: $input) {
1037
+ success
1038
+ issue {
1039
+ id
1040
+ number
1041
+ title
1042
+ htmlUrl
1043
+ labels {
1044
+ name
1045
+ color
1046
+ }
1047
+ }
1048
+ errors {
1049
+ message
1050
+ code
1051
+ }
1052
+ }
1053
+ }
1054
+ `),
1055
+ UpdateIssue: graphql(`
1056
+ mutation UpdateIssue($input: UpdateIssueInput!) {
1057
+ updateIssue(input: $input) {
1058
+ success
1059
+ issue {
1060
+ id
1061
+ number
1062
+ title
1063
+ htmlUrl
1064
+ labels {
1065
+ name
1066
+ color
1067
+ }
1068
+ }
1069
+ errors {
1070
+ message
1071
+ code
1072
+ }
1073
+ }
1074
+ }
2516
1075
  `),
2517
1076
  RegisterRunner: graphql(`
2518
1077
  mutation RegisterRunner($input: RegisterRunnerInput!) {
@@ -2782,11 +1341,18 @@ const cliMutations = {
2782
1341
  //#endregion
2783
1342
  //#region src/lib/graphql-client.ts
2784
1343
  let graphqlClient = null;
1344
+ function createGraphQLClient$1(apiKey) {
1345
+ const client = new GraphQLClient(GRAPHQL_API_URL, { headers: { "X-API-Key": apiKey } });
1346
+ return { async request(document, variables) {
1347
+ return client.request(document, variables);
1348
+ } };
1349
+ }
2785
1350
  async function getGraphQLClient() {
2786
- if (!graphqlClient) graphqlClient = createJiveGraphqlClient({
2787
- url: GRAPHQL_API_URL,
2788
- apiKey: (await getCredentials())?.token
2789
- });
1351
+ if (!graphqlClient) {
1352
+ const credentials = await getCredentials();
1353
+ if (!credentials?.token) throw new Error("No credentials found, run `jive login` first");
1354
+ graphqlClient = createGraphQLClient$1(credentials.token);
1355
+ }
2790
1356
  return graphqlClient;
2791
1357
  }
2792
1358
 
@@ -2839,14 +1405,14 @@ var ApiClient = class {
2839
1405
  })) };
2840
1406
  }
2841
1407
  async getProjects(teamId) {
2842
- return { projects: (await (await getGraphQLClient()).request(cliQueries.Projects, { teamId: String(teamId) })).projects.map((p$1) => ({
2843
- id: parseInt(p$1.id, 10),
2844
- name: p$1.name,
2845
- createdAt: new Date(p$1.createdAt)
1408
+ return { projects: (await (await getGraphQLClient()).request(cliQueries.Projects, { teamId: String(teamId) })).projects.map((p) => ({
1409
+ id: parseInt(p.id, 10),
1410
+ name: p.name,
1411
+ createdAt: new Date(p.createdAt)
2846
1412
  })) };
2847
1413
  }
2848
1414
  async createProject(teamId, data) {
2849
- const result = await (await getGraphQLClient()).mutate(cliMutations.CreateProject, { input: {
1415
+ const result = await (await getGraphQLClient()).request(cliMutations.CreateProject, { input: {
2850
1416
  teamId: String(teamId),
2851
1417
  name: data.name,
2852
1418
  description: data.description,
@@ -2862,7 +1428,7 @@ var ApiClient = class {
2862
1428
  };
2863
1429
  }
2864
1430
  async createTeam(name$1, description) {
2865
- const result = await (await getGraphQLClient()).mutate(cliMutations.CreateTeam, { input: {
1431
+ const result = await (await getGraphQLClient()).request(cliMutations.CreateTeam, { input: {
2866
1432
  name: name$1,
2867
1433
  description
2868
1434
  } });
@@ -2876,14 +1442,14 @@ var ApiClient = class {
2876
1442
  };
2877
1443
  }
2878
1444
  async inviteToTeam(teamId, email) {
2879
- const result = await (await getGraphQLClient()).mutate(cliMutations.InviteToTeam, { input: {
1445
+ const result = await (await getGraphQLClient()).request(cliMutations.InviteToTeam, { input: {
2880
1446
  teamId,
2881
1447
  email
2882
1448
  } });
2883
1449
  if (result.inviteToTeam.errors?.length) throw this.formatError({ message: result.inviteToTeam.errors[0].message });
2884
1450
  }
2885
1451
  async registerRunner(data) {
2886
- const result = await (await getGraphQLClient()).mutate(mutations.RegisterRunner, { input: {
1452
+ const result = await (await getGraphQLClient()).request(mutations.RegisterRunner, { input: {
2887
1453
  teamId: String(data.teamId),
2888
1454
  name: data.name,
2889
1455
  type: data.type.toUpperCase(),
@@ -2899,12 +1465,12 @@ var ApiClient = class {
2899
1465
  };
2900
1466
  }
2901
1467
  async getRunners(teamId) {
2902
- return (await (await getGraphQLClient()).request(cliQueries.Runners, { teamId })).runners.map((r$1) => ({
2903
- id: parseInt(r$1.id, 10),
2904
- name: r$1.name,
2905
- type: r$1.type.toLowerCase(),
2906
- status: r$1.status.toLowerCase(),
2907
- lastHeartbeat: r$1.lastHeartbeat || void 0
1468
+ return (await (await getGraphQLClient()).request(cliQueries.Runners, { teamId })).runners.map((r) => ({
1469
+ id: parseInt(r.id, 10),
1470
+ name: r.name,
1471
+ type: r.type.toLowerCase(),
1472
+ status: r.status.toLowerCase(),
1473
+ lastHeartbeat: r.lastHeartbeat || void 0
2908
1474
  }));
2909
1475
  }
2910
1476
  async getRunner(runnerId) {
@@ -2919,7 +1485,7 @@ var ApiClient = class {
2919
1485
  };
2920
1486
  }
2921
1487
  async updateRunnerStatus(runnerId, data) {
2922
- const result = await (await getGraphQLClient()).mutate(mutations.UpdateRunner, {
1488
+ const result = await (await getGraphQLClient()).request(mutations.UpdateRunner, {
2923
1489
  runnerId: String(runnerId),
2924
1490
  input: {
2925
1491
  status: data.status ? mapRunnerStatusToGraphQL(data.status) : void 0,
@@ -2931,7 +1497,7 @@ var ApiClient = class {
2931
1497
  if (result.updateRunner.errors?.length) throw this.formatError({ message: result.updateRunner.errors[0].message });
2932
1498
  }
2933
1499
  async deleteRunner(runnerId) {
2934
- const result = await (await getGraphQLClient()).mutate(cliMutations.DeleteRunner, { runnerId: String(runnerId) });
1500
+ const result = await (await getGraphQLClient()).request(cliMutations.DeleteRunner, { runnerId: String(runnerId) });
2935
1501
  if (result.deleteRunner.errors?.length) throw this.formatError({ message: result.deleteRunner.errors[0].message });
2936
1502
  }
2937
1503
  async getInterruptedTasks(runnerId, limit = 5) {
@@ -3021,7 +1587,7 @@ var ApiClient = class {
3021
1587
  }));
3022
1588
  }
3023
1589
  async updateTask(taskId, data) {
3024
- const result = await (await getGraphQLClient()).mutate(mutations.UpdateTask, {
1590
+ const result = await (await getGraphQLClient()).request(mutations.UpdateTask, {
3025
1591
  id: String(taskId),
3026
1592
  input: {
3027
1593
  status: data.status ? mapStatusToGraphQL(data.status) : void 0,
@@ -3031,7 +1597,7 @@ var ApiClient = class {
3031
1597
  if (result.updateTask.errors?.length) throw this.formatError({ message: result.updateTask.errors[0].message });
3032
1598
  }
3033
1599
  async createPullRequest(taskId, data) {
3034
- const result = await (await getGraphQLClient()).mutate(mutations.CreatePullRequest, { input: {
1600
+ const result = await (await getGraphQLClient()).request(mutations.CreatePullRequest, { input: {
3035
1601
  taskId: String(taskId),
3036
1602
  title: data.title,
3037
1603
  description: data.description
@@ -3046,6 +1612,46 @@ var ApiClient = class {
3046
1612
  }
3047
1613
  };
3048
1614
  }
1615
+ async createIssue(projectId, data) {
1616
+ const result = await (await getGraphQLClient()).request(mutations.CreateIssue, { input: {
1617
+ projectId: String(projectId),
1618
+ title: data.title,
1619
+ body: data.body,
1620
+ labels: data.labels
1621
+ } });
1622
+ if (result.createIssue.errors?.length) throw this.formatError({ message: result.createIssue.errors[0].message });
1623
+ return {
1624
+ success: result.createIssue.success,
1625
+ issue: {
1626
+ id: result.createIssue.issue.id,
1627
+ number: result.createIssue.issue.number,
1628
+ title: result.createIssue.issue.title,
1629
+ htmlUrl: result.createIssue.issue.htmlUrl,
1630
+ labels: result.createIssue.issue.labels
1631
+ }
1632
+ };
1633
+ }
1634
+ async updateIssue(projectId, data) {
1635
+ const result = await (await getGraphQLClient()).request(mutations.UpdateIssue, { input: {
1636
+ projectId: String(projectId),
1637
+ number: data.number,
1638
+ title: data.title,
1639
+ body: data.body,
1640
+ state: data.state,
1641
+ labels: data.labels
1642
+ } });
1643
+ if (result.updateIssue.errors?.length) throw this.formatError({ message: result.updateIssue.errors[0].message });
1644
+ return {
1645
+ success: result.updateIssue.success,
1646
+ issue: {
1647
+ id: result.updateIssue.issue.id,
1648
+ number: result.updateIssue.issue.number,
1649
+ title: result.updateIssue.issue.title,
1650
+ htmlUrl: result.updateIssue.issue.htmlUrl,
1651
+ labels: result.updateIssue.issue.labels
1652
+ }
1653
+ };
1654
+ }
3049
1655
  async getTaskSteps(id) {
3050
1656
  const data = await (await getGraphQLClient()).request(queries.GetPlan, { id: String(id) });
3051
1657
  if (!data.plan?.steps) return [];
@@ -3082,7 +1688,7 @@ var ApiClient = class {
3082
1688
  };
3083
1689
  }
3084
1690
  async updateStep(taskId, stepId, data) {
3085
- const result = await (await getGraphQLClient()).mutate(mutations.UpdateStep, {
1691
+ const result = await (await getGraphQLClient()).request(mutations.UpdateStep, {
3086
1692
  taskId: String(taskId),
3087
1693
  stepId: String(stepId),
3088
1694
  input: {
@@ -3109,7 +1715,7 @@ var ApiClient = class {
3109
1715
  };
3110
1716
  }
3111
1717
  async createPlan(taskId, plan) {
3112
- const result = await (await getGraphQLClient()).mutate(mutations.CreatePlan, { input: {
1718
+ const result = await (await getGraphQLClient()).request(mutations.CreatePlan, { input: {
3113
1719
  taskId: String(taskId),
3114
1720
  title: plan.title,
3115
1721
  steps: plan.steps.map((s) => ({
@@ -3444,7 +2050,7 @@ async function createGraphQLClient() {
3444
2050
 
3445
2051
  //#endregion
3446
2052
  //#region package.json
3447
- var version = "0.0.44";
2053
+ var version = "0.0.46";
3448
2054
 
3449
2055
  //#endregion
3450
2056
  //#region src/runner/index.ts
@@ -3606,7 +2212,7 @@ var TaskRunner = class {
3606
2212
  async fetchTaskProcess(taskId) {
3607
2213
  const existingProcess = this.taskProcesses[taskId.toString()];
3608
2214
  if (existingProcess) return existingProcess;
3609
- if (Object.values(this.taskProcesses).filter((p$1) => p$1 !== null).length >= this.maxConcurrentTasks) {
2215
+ if (Object.values(this.taskProcesses).filter((p) => p !== null).length >= this.maxConcurrentTasks) {
3610
2216
  console.warn(chalk.yellow(`Maximum concurrent tasks reached (${this.maxConcurrentTasks})`));
3611
2217
  return null;
3612
2218
  }
@@ -3644,6 +2250,22 @@ var TaskRunner = class {
3644
2250
  }
3645
2251
  result.process.stdin?.write(JSON.stringify(message) + "\n");
3646
2252
  }
2253
+ async restartTask(taskId) {
2254
+ const existingPromise = this.taskProcesses[taskId.toString()];
2255
+ if (!existingPromise) console.log(chalk.dim(`No existing process for task ${taskId}, nothing to restart`));
2256
+ else try {
2257
+ const result = await existingPromise;
2258
+ if (result?.process) {
2259
+ console.log(chalk.yellow(`Killing task ${taskId} process for restart...`));
2260
+ result.process.kill("SIGTERM");
2261
+ }
2262
+ } catch (error$1) {
2263
+ console.warn(chalk.yellow(`Error stopping task ${taskId} for restart: ${error$1.message}`));
2264
+ }
2265
+ this.taskProcesses[taskId.toString()] = null;
2266
+ console.log(chalk.green(`Task ${taskId} cleared for restart`));
2267
+ await this.fetchTaskProcess(taskId);
2268
+ }
3647
2269
  async connect() {
3648
2270
  console.log(chalk.dim(`Connecting to ${WS_URL}...`));
3649
2271
  const jiveApiKey = (await getCredentials())?.token || "";
@@ -3651,7 +2273,6 @@ var TaskRunner = class {
3651
2273
  const url = new URL(WS_URL);
3652
2274
  url.searchParams.set("apiKey", jiveApiKey);
3653
2275
  url.searchParams.set("runnerId", this.config.id.toString());
3654
- console.log(chalk.dim(`Connecting to ${url.toString()}...`));
3655
2276
  this.ws = new WebSocket(url.toString());
3656
2277
  this.ws.on("open", () => this.handleOpen());
3657
2278
  this.ws.on("message", (data) => this.handleMessage(data));
@@ -3704,7 +2325,7 @@ var TaskRunner = class {
3704
2325
  return null;
3705
2326
  }
3706
2327
  }
3707
- handleMessage(data) {
2328
+ async handleMessage(data) {
3708
2329
  console.log(chalk.dim(`(CLI WS) Received message: ${data.toString()}`));
3709
2330
  try {
3710
2331
  const message = JSON.parse(data.toString());
@@ -3719,7 +2340,18 @@ var TaskRunner = class {
3719
2340
  case "task_message":
3720
2341
  const { taskId, message: taskMsg } = message.payload;
3721
2342
  const messageId = message.payload.messageId;
3722
- const activeCount = Object.values(this.taskProcesses).filter((p$1) => p$1 !== null).length;
2343
+ if (taskMsg.type === "restart") {
2344
+ await this.restartTask(taskId);
2345
+ if (messageId) this.send({
2346
+ type: "task_ack",
2347
+ payload: {
2348
+ messageId,
2349
+ accepted: true
2350
+ }
2351
+ });
2352
+ break;
2353
+ }
2354
+ const activeCount = Object.values(this.taskProcesses).filter((p) => p !== null).length;
3723
2355
  const accepted = activeCount < this.maxConcurrentTasks;
3724
2356
  if (messageId) this.send({
3725
2357
  type: "task_ack",
@@ -3776,7 +2408,7 @@ var TaskRunner = class {
3776
2408
  }
3777
2409
  }
3778
2410
  async pollForPendingTasks() {
3779
- const activeCount = Object.values(this.taskProcesses).filter((p$1) => p$1 !== null).length;
2411
+ const activeCount = Object.values(this.taskProcesses).filter((p) => p !== null).length;
3780
2412
  if (activeCount >= this.maxConcurrentTasks) {
3781
2413
  console.log(chalk.dim(`At capacity (${activeCount}/${this.maxConcurrentTasks}), skipping poll`));
3782
2414
  return;
@@ -3801,7 +2433,7 @@ var TaskRunner = class {
3801
2433
  }
3802
2434
  }
3803
2435
  `);
3804
- const pendingTasks = (await client.request(query$1, { limit: availableSlots })).tasks.edges.map((e$3) => e$3.node);
2436
+ const pendingTasks = (await client.request(query$1, { limit: availableSlots })).tasks.edges.map((e$2) => e$2.node);
3805
2437
  if (pendingTasks.length > 0) console.log(chalk.yellow(`Found ${pendingTasks.length} pending task(s) to pick up`));
3806
2438
  for (const task of pendingTasks) await this.pickupPendingTask(parseInt(task.id));
3807
2439
  } catch (error$1) {
@@ -3929,9 +2561,9 @@ async function publishPlan(plan) {
3929
2561
  if (!context) throw new Error("Task context not initialized");
3930
2562
  if (!plan.title || typeof plan.title !== "string") throw new Error("Plan must have a title");
3931
2563
  if (!plan.steps || !Array.isArray(plan.steps) || plan.steps.length === 0) throw new Error("Plan must have at least one step");
3932
- for (let i$2 = 0; i$2 < plan.steps.length; i$2++) {
3933
- const step = plan.steps[i$2];
3934
- if (!step.title || !step.prompt || !step.outputPrompt) throw new Error(`Step ${i$2 + 1} is missing required fields (title, prompt, outputPrompt)`);
2564
+ for (let i$1 = 0; i$1 < plan.steps.length; i$1++) {
2565
+ const step = plan.steps[i$1];
2566
+ if (!step.title || !step.prompt || !step.outputPrompt) throw new Error(`Step ${i$1 + 1} is missing required fields (title, prompt, outputPrompt)`);
3935
2567
  }
3936
2568
  return await getApiClient().createPlan(context.taskId, plan);
3937
2569
  }
@@ -4170,6 +2802,104 @@ function createTasksSdkServer(task) {
4170
2802
  isError: true
4171
2803
  };
4172
2804
  }
2805
+ }),
2806
+ tool("create_issue", "Create an issue on GitHub or GitLab for the current project. Use this to track bugs, feature requests, or other work items.", {
2807
+ title: z.string().describe("Issue title - a concise summary of the issue"),
2808
+ body: z.string().describe("Issue body/description - detailed explanation of the issue"),
2809
+ labels: z.array(z.string()).optional().describe("Optional labels to apply to the issue")
2810
+ }, async (args) => {
2811
+ if (!context) return {
2812
+ content: [{
2813
+ type: "text",
2814
+ text: "Error: Task context not initialized"
2815
+ }],
2816
+ isError: true
2817
+ };
2818
+ try {
2819
+ const apiClient$1 = getApiClient();
2820
+ const { project } = await apiClient$1.getTask(context.taskId);
2821
+ if (!project) return {
2822
+ content: [{
2823
+ type: "text",
2824
+ text: "Error: Project not found for this task"
2825
+ }],
2826
+ isError: true
2827
+ };
2828
+ task.debugLog(`Creating issue: ${args.title}`);
2829
+ const result = await apiClient$1.createIssue(project.id, {
2830
+ title: args.title,
2831
+ body: args.body,
2832
+ labels: args.labels
2833
+ });
2834
+ task.debugLog(`Issue created: ${JSON.stringify(result, null, 2)}`);
2835
+ return { content: [{
2836
+ type: "text",
2837
+ text: JSON.stringify({
2838
+ success: true,
2839
+ projectId: project.id,
2840
+ issue: result.issue
2841
+ }, null, 2)
2842
+ }] };
2843
+ } catch (error$1) {
2844
+ return {
2845
+ content: [{
2846
+ type: "text",
2847
+ text: `Error creating issue: ${error$1.message}`
2848
+ }],
2849
+ isError: true
2850
+ };
2851
+ }
2852
+ }),
2853
+ tool("update_issue", "Update an existing issue on GitHub or GitLab. Use this to modify issue title, body, state (open/closed), or labels.", {
2854
+ number: z.number().describe("Issue number to update"),
2855
+ title: z.string().optional().describe("New title for the issue"),
2856
+ body: z.string().optional().describe("New body/description for the issue"),
2857
+ state: z.enum(["open", "closed"]).optional().describe("Issue state - \"open\" or \"closed\""),
2858
+ labels: z.array(z.string()).optional().describe("Labels to set on the issue (replaces existing labels)")
2859
+ }, async (args) => {
2860
+ if (!context) return {
2861
+ content: [{
2862
+ type: "text",
2863
+ text: "Error: Task context not initialized"
2864
+ }],
2865
+ isError: true
2866
+ };
2867
+ try {
2868
+ const apiClient$1 = getApiClient();
2869
+ const { project } = await apiClient$1.getTask(context.taskId);
2870
+ if (!project) return {
2871
+ content: [{
2872
+ type: "text",
2873
+ text: "Error: Project not found for this task"
2874
+ }],
2875
+ isError: true
2876
+ };
2877
+ task.debugLog(`Updating issue #${args.number}`);
2878
+ const result = await apiClient$1.updateIssue(project.id, {
2879
+ number: args.number,
2880
+ title: args.title,
2881
+ body: args.body,
2882
+ state: args.state,
2883
+ labels: args.labels
2884
+ });
2885
+ task.debugLog(`Issue updated: ${JSON.stringify(result, null, 2)}`);
2886
+ return { content: [{
2887
+ type: "text",
2888
+ text: JSON.stringify({
2889
+ success: true,
2890
+ projectId: project.id,
2891
+ issue: result.issue
2892
+ }, null, 2)
2893
+ }] };
2894
+ } catch (error$1) {
2895
+ return {
2896
+ content: [{
2897
+ type: "text",
2898
+ text: `Error updating issue: ${error$1.message}`
2899
+ }],
2900
+ isError: true
2901
+ };
2902
+ }
4173
2903
  })
4174
2904
  ]
4175
2905
  });
@@ -5104,7 +3834,7 @@ Host gitlab.com
5104
3834
  if (!await exists(this.claudeSessionFilePath)) await mkdir(path$1.dirname(this.claudeSessionFilePath), { recursive: true });
5105
3835
  const messages = await getApiClient().getSessionLines(this.ctx.taskId, this.ctx.sessionId, true);
5106
3836
  const sessionLines = [...messages.length === 0 ? makeInitialLines(this.ctx.claudeSessionId) : [], ...messages.map((m) => m.payload)];
5107
- this.sentLineIds = new Set(sessionLines.map((l$1) => l$1.uuid ?? null));
3837
+ this.sentLineIds = new Set(sessionLines.map((l) => l.uuid ?? null));
5108
3838
  const jsonlContent = sessionLines.map((m) => JSON.stringify(m)).join("\n");
5109
3839
  await writeFile(this.claudeSessionFilePath, jsonlContent + "\n");
5110
3840
  this.debugLog(`✓ Saved session file to ${this.claudeSessionFilePath}`);
@@ -5188,6 +3918,17 @@ Host gitlab.com
5188
3918
  this.claudeAbortController = null;
5189
3919
  this.sendStatusUpdate("idle");
5190
3920
  }
3921
+ reportUsage(message) {
3922
+ if (!("total_cost_usd" in message)) return;
3923
+ this.sendToTaskRunner({
3924
+ type: "usage",
3925
+ payload: { usage: {
3926
+ total_cost_usd: message.total_cost_usd,
3927
+ total_input_tokens: message.usage.input_tokens,
3928
+ total_output_tokens: message.usage.output_tokens
3929
+ } }
3930
+ });
3931
+ }
5191
3932
  async queryClaude(prompt, mode = "BYPASS_PERMISSIONS") {
5192
3933
  if (this.status !== "idle") {
5193
3934
  this.debugLog(`WARNING: queryClaude called while status is '${this.status}'`);
@@ -5206,7 +3947,7 @@ Host gitlab.com
5206
3947
  permissionMode: mode,
5207
3948
  task: this
5208
3949
  });
5209
- for await (const _message of result);
3950
+ for await (const message of result) if (message.type === "result") this.reportUsage(message);
5210
3951
  const finalLines = await this.readNewSessionLines();
5211
3952
  for (const line of finalLines) try {
5212
3953
  const parsed = JSON.parse(line);
@@ -5595,7 +4336,7 @@ async function installServiceCommand() {
5595
4336
  console.log(chalk.bold("\nJive Task Runner Service Installation"));
5596
4337
  console.log(chalk.dim("=========================================\n"));
5597
4338
  try {
5598
- const { getServiceManager, validateServiceInstallation, detectPlatform } = await import("./service-4H4YceKv.mjs");
4339
+ const { getServiceManager, validateServiceInstallation, detectPlatform } = await import("./service-MMjLsA9C.mjs");
5599
4340
  if (detectPlatform() === "unsupported") {
5600
4341
  console.error(chalk.red("Service installation is not supported on this platform."));
5601
4342
  console.log(chalk.dim("\nCurrently supported platforms:"));
@@ -5627,7 +4368,8 @@ async function installServiceCommand() {
5627
4368
  }
5628
4369
  if (validation.hasWarnings) console.log(chalk.yellow("\n⚠ Installation can proceed, but there are warnings."));
5629
4370
  console.log(chalk.dim(`\nPlatform: Linux (systemd)`));
5630
- console.log(chalk.dim(`Service file: ~/.config/systemd/user/jive-task-runner.service\n`));
4371
+ console.log(chalk.dim(`Service file: /etc/systemd/system/jive-task-runner.service`));
4372
+ console.log(chalk.dim(`Credentials: /etc/jive/runner.env\n`));
5631
4373
  const { confirm } = await prompts({
5632
4374
  type: "confirm",
5633
4375
  name: "confirm",
@@ -5638,8 +4380,9 @@ async function installServiceCommand() {
5638
4380
  console.log(chalk.yellow("Installation cancelled"));
5639
4381
  return;
5640
4382
  }
5641
- spinner.start("Creating service file...");
5642
4383
  const manager = getServiceManager();
4384
+ await manager.checkAndMigrateLegacyService();
4385
+ spinner.start("Creating service file...");
5643
4386
  await manager.install();
5644
4387
  spinner.succeed("Service installed successfully!");
5645
4388
  const { startNow } = await prompts({
@@ -5657,9 +4400,10 @@ async function installServiceCommand() {
5657
4400
  if (status.uptime) console.log(chalk.dim(`Uptime: ${status.uptime}`));
5658
4401
  }
5659
4402
  console.log(chalk.bold("\nNext steps:"));
5660
- console.log(chalk.dim(" • View logs: ") + chalk.cyan("jive task-runner service-logs"));
5661
- console.log(chalk.dim(" • Check status: ") + chalk.cyan("jive task-runner service-status"));
5662
- console.log(chalk.dim(" • Restart: ") + chalk.cyan("jive task-runner service-restart"));
4403
+ console.log(chalk.dim(" • View logs: ") + chalk.cyan("journalctl -u jive-task-runner -f"));
4404
+ console.log(chalk.dim(" • Check status: ") + chalk.cyan("systemctl status jive-task-runner"));
4405
+ console.log(chalk.dim(" • Restart: ") + chalk.cyan("sudo systemctl restart jive-task-runner"));
4406
+ console.log(chalk.dim(" • Uninstall: ") + chalk.cyan("jive task-runner uninstall-service"));
5663
4407
  } catch (error$1) {
5664
4408
  console.error(chalk.red(`\n✗ Installation failed: ${error$1.message}`));
5665
4409
  process.exit(1);
@@ -5670,7 +4414,7 @@ async function installServiceCommand() {
5670
4414
  */
5671
4415
  async function uninstallServiceCommand() {
5672
4416
  try {
5673
- const { getServiceManager } = await import("./service-4H4YceKv.mjs");
4417
+ const { getServiceManager } = await import("./service-MMjLsA9C.mjs");
5674
4418
  const manager = getServiceManager();
5675
4419
  if (!await manager.isInstalled()) {
5676
4420
  console.log(chalk.yellow("Service is not installed."));
@@ -5700,7 +4444,7 @@ async function uninstallServiceCommand() {
5700
4444
  */
5701
4445
  async function serviceStatusCommand() {
5702
4446
  try {
5703
- const { getServiceManager } = await import("./service-4H4YceKv.mjs");
4447
+ const { getServiceManager } = await import("./service-MMjLsA9C.mjs");
5704
4448
  const manager = getServiceManager();
5705
4449
  if (!await manager.isInstalled()) {
5706
4450
  console.log(chalk.dim("Service is not installed."));
@@ -5732,10 +4476,10 @@ async function serviceStatusCommand() {
5732
4476
  }
5733
4477
  console.log(chalk.bold("\nCommands:"));
5734
4478
  console.log(chalk.dim("─".repeat(60)));
5735
- console.log(chalk.dim(" Logs: ") + chalk.cyan("jive task-runner service-logs [-f]"));
5736
- console.log(chalk.dim(" Restart: ") + chalk.cyan("jive task-runner service-restart"));
5737
- if (status.running) console.log(chalk.dim(" Stop: ") + chalk.cyan("systemctl --user stop jive-task-runner"));
5738
- else console.log(chalk.dim(" Start: ") + chalk.cyan("systemctl --user start jive-task-runner"));
4479
+ console.log(chalk.dim(" Logs: ") + chalk.cyan("journalctl -u jive-task-runner -f"));
4480
+ console.log(chalk.dim(" Restart: ") + chalk.cyan("sudo systemctl restart jive-task-runner"));
4481
+ if (status.running) console.log(chalk.dim(" Stop: ") + chalk.cyan("sudo systemctl stop jive-task-runner"));
4482
+ else console.log(chalk.dim(" Start: ") + chalk.cyan("sudo systemctl start jive-task-runner"));
5739
4483
  console.log(chalk.dim(" Uninstall: ") + chalk.cyan("jive task-runner uninstall-service"));
5740
4484
  console.log();
5741
4485
  } catch (error$1) {
@@ -5748,7 +4492,7 @@ async function serviceStatusCommand() {
5748
4492
  */
5749
4493
  async function serviceLogsCommand(options) {
5750
4494
  try {
5751
- const { getServiceManager } = await import("./service-4H4YceKv.mjs");
4495
+ const { getServiceManager } = await import("./service-MMjLsA9C.mjs");
5752
4496
  const manager = getServiceManager();
5753
4497
  if (!await manager.isInstalled()) {
5754
4498
  console.log(chalk.dim("Service is not installed."));
@@ -5770,7 +4514,7 @@ async function serviceLogsCommand(options) {
5770
4514
  */
5771
4515
  async function serviceRestartCommand() {
5772
4516
  try {
5773
- const { getServiceManager } = await import("./service-4H4YceKv.mjs");
4517
+ const { getServiceManager } = await import("./service-MMjLsA9C.mjs");
5774
4518
  const manager = getServiceManager();
5775
4519
  if (!await manager.isInstalled()) {
5776
4520
  console.log(chalk.dim("Service is not installed."));