yourskills 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +270 -244
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -2379,57 +2379,6 @@ function Installer({
2379
2379
  ]
2380
2380
  });
2381
2381
  }
2382
- function plainLine(line) {
2383
- switch (line.state) {
2384
- case "installing":
2385
- return `installing ${line.name} ${line.where}`;
2386
- case "installed":
2387
- return `${line.name} ${line.where}${line.deprecated ? ` ${lifecycleTag("deprecated")}` : ""}`;
2388
- case "pending":
2389
- return pendingMessage(line.vendor);
2390
- case "question":
2391
- return licenceQuestionMessage(line.name, line.licence);
2392
- case "failed":
2393
- return `error: ${line.name}: ${line.message}`;
2394
- default:
2395
- return null;
2396
- }
2397
- }
2398
- async function installPlain(stream) {
2399
- let lines = [];
2400
- const printed = new Set;
2401
- const started = new Set;
2402
- for await (const event of stream) {
2403
- lines = reduce(lines, event);
2404
- for (const line of lines) {
2405
- if (line.state === "installing" && !started.has(line.name)) {
2406
- started.add(line.name);
2407
- const text = plainLine(line);
2408
- if (text !== null)
2409
- console.log(text);
2410
- continue;
2411
- }
2412
- if (printed.has(line.name) || !settled(line))
2413
- continue;
2414
- const text = plainLine(line);
2415
- if (text === null)
2416
- continue;
2417
- printed.add(line.name);
2418
- if (line.state === "failed") {
2419
- console.error(text);
2420
- if (line.detail)
2421
- console.error(line.detail);
2422
- } else {
2423
- console.log(text);
2424
- }
2425
- }
2426
- }
2427
- const counts = receipt(lines);
2428
- if (counts) {
2429
- console.log(`${counts.installed} installed, ${counts.pending} pending, ${counts.failed} failed` + (counts.questions > 0 ? `, ${counts.questions} unanswered` : ""));
2430
- }
2431
- return summarise(lines);
2432
- }
2433
2382
  // src/screens.tsx
2434
2383
  import { Box as Box8, Text as Text10, useApp as useApp4, useInput as useInput4 } from "ink";
2435
2384
  import { useEffect as useEffect5, useState as useState6 } from "react";
@@ -2437,25 +2386,36 @@ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2437
2386
  var HELP_COLUMN = 26;
2438
2387
  function NoticeScreen({
2439
2388
  title,
2440
- message
2389
+ message,
2390
+ exitWhenDone = true,
2391
+ onBack
2441
2392
  }) {
2442
2393
  const { exit } = useApp4();
2443
2394
  const width = useFrameWidth();
2444
- useEffect5(exit, [exit]);
2445
- return /* @__PURE__ */ jsx11(Frame, {
2395
+ useEffect5(() => {
2396
+ if (exitWhenDone)
2397
+ exit();
2398
+ }, [exit, exitWhenDone]);
2399
+ return /* @__PURE__ */ jsxs10(Frame, {
2446
2400
  title,
2447
2401
  width,
2448
- children: /* @__PURE__ */ jsxs10(Text10, {
2449
- children: [
2450
- /* @__PURE__ */ jsx11(Text10, {
2451
- color: "green",
2452
- children: mark.ok
2453
- }),
2454
- /* @__PURE__ */ jsx11(Text10, {
2455
- children: ` ${message}`
2456
- })
2457
- ]
2458
- })
2402
+ children: [
2403
+ /* @__PURE__ */ jsxs10(Text10, {
2404
+ children: [
2405
+ /* @__PURE__ */ jsx11(Text10, {
2406
+ color: "green",
2407
+ children: mark.ok
2408
+ }),
2409
+ /* @__PURE__ */ jsx11(Text10, {
2410
+ children: ` ${message}`
2411
+ })
2412
+ ]
2413
+ }),
2414
+ /* @__PURE__ */ jsx11(Back, {
2415
+ width,
2416
+ onBack
2417
+ })
2418
+ ]
2459
2419
  });
2460
2420
  }
2461
2421
  var COLOURS = {
@@ -2571,39 +2531,105 @@ function numberedLines(text) {
2571
2531
  return text.split(`
2572
2532
  `).map((line, i) => ({ id: `${i}:${line}`, line }));
2573
2533
  }
2574
- function HelpScreen({ text }) {
2534
+ function HelpScreen({
2535
+ text,
2536
+ exitWhenDone = true,
2537
+ onBack
2538
+ }) {
2575
2539
  const { exit } = useApp4();
2576
2540
  const width = useFrameWidth();
2577
- useEffect5(exit, [exit]);
2578
- return /* @__PURE__ */ jsx11(Frame, {
2541
+ useEffect5(() => {
2542
+ if (exitWhenDone)
2543
+ exit();
2544
+ }, [exit, exitWhenDone]);
2545
+ return /* @__PURE__ */ jsxs10(Frame, {
2579
2546
  title: "yourskills",
2580
2547
  width,
2581
- children: /* @__PURE__ */ jsx11(Box8, {
2582
- flexDirection: "column",
2583
- children: numberedLines(text).map(({ id, line }) => {
2584
- if (line.length === 0)
2585
- return /* @__PURE__ */ jsx11(Blank, {}, id);
2586
- if (!line.startsWith(" "))
2587
- return /* @__PURE__ */ jsx11(Text10, {
2588
- children: clip(line, width - FRAME_CHROME)
2589
- }, id);
2590
- return /* @__PURE__ */ jsxs10(Text10, {
2591
- children: [
2592
- /* @__PURE__ */ jsx11(Text10, {
2593
- color: tone.primary,
2594
- children: line.slice(0, HELP_COLUMN)
2595
- }),
2596
- /* @__PURE__ */ jsx11(Text10, {
2597
- dimColor: true,
2598
- children: clip(line.slice(HELP_COLUMN), width - FRAME_CHROME - HELP_COLUMN)
2599
- })
2600
- ]
2601
- }, line);
2548
+ children: [
2549
+ /* @__PURE__ */ jsx11(Box8, {
2550
+ flexDirection: "column",
2551
+ children: numberedLines(text).map(({ id, line }) => {
2552
+ if (line.length === 0)
2553
+ return /* @__PURE__ */ jsx11(Blank, {}, id);
2554
+ if (!line.startsWith(" "))
2555
+ return /* @__PURE__ */ jsx11(Text10, {
2556
+ children: clip(line, width - FRAME_CHROME)
2557
+ }, id);
2558
+ return /* @__PURE__ */ jsxs10(Text10, {
2559
+ children: [
2560
+ /* @__PURE__ */ jsx11(Text10, {
2561
+ color: tone.primary,
2562
+ children: line.slice(0, HELP_COLUMN)
2563
+ }),
2564
+ /* @__PURE__ */ jsx11(Text10, {
2565
+ dimColor: true,
2566
+ children: clip(line.slice(HELP_COLUMN), width - FRAME_CHROME - HELP_COLUMN)
2567
+ })
2568
+ ]
2569
+ }, line);
2570
+ })
2571
+ }),
2572
+ /* @__PURE__ */ jsx11(Back, {
2573
+ width,
2574
+ onBack
2602
2575
  })
2603
- })
2576
+ ]
2604
2577
  });
2605
2578
  }
2606
2579
 
2580
+ // src/install/plain.ts
2581
+ function plainLine(line) {
2582
+ switch (line.state) {
2583
+ case "installing":
2584
+ return `installing ${line.name} ${line.where}`;
2585
+ case "installed":
2586
+ return `${line.name} ${line.where}${line.deprecated ? ` ${lifecycleTag("deprecated")}` : ""}`;
2587
+ case "pending":
2588
+ return pendingMessage(line.vendor);
2589
+ case "question":
2590
+ return licenceQuestionMessage(line.name, line.licence);
2591
+ case "failed":
2592
+ return `error: ${line.name}: ${line.message}`;
2593
+ default:
2594
+ return null;
2595
+ }
2596
+ }
2597
+ async function installPlain(stream, io) {
2598
+ let lines = [];
2599
+ const printed = new Set;
2600
+ const started = new Set;
2601
+ for await (const event of stream) {
2602
+ lines = reduce(lines, event);
2603
+ for (const line of lines) {
2604
+ if (line.state === "installing" && !started.has(line.name)) {
2605
+ started.add(line.name);
2606
+ const text = plainLine(line);
2607
+ if (text !== null)
2608
+ io.out(text);
2609
+ continue;
2610
+ }
2611
+ if (printed.has(line.name) || !settled(line))
2612
+ continue;
2613
+ const text = plainLine(line);
2614
+ if (text === null)
2615
+ continue;
2616
+ printed.add(line.name);
2617
+ if (line.state === "failed") {
2618
+ io.err(text);
2619
+ if (line.detail)
2620
+ io.err(line.detail);
2621
+ } else {
2622
+ io.out(text);
2623
+ }
2624
+ }
2625
+ }
2626
+ const counts = receipt(lines);
2627
+ if (counts) {
2628
+ io.out(`${counts.installed} installed, ${counts.pending} pending, ${counts.failed} failed` + (counts.questions > 0 ? `, ${counts.questions} unanswered` : ""));
2629
+ }
2630
+ return summarise(lines);
2631
+ }
2632
+
2607
2633
  // src/install/screens/run.tsx
2608
2634
  import { jsx as jsx12 } from "react/jsx-runtime";
2609
2635
  function RunScreen({
@@ -2636,13 +2662,13 @@ function RunScreen({
2636
2662
  ...onNext ? { onNext } : {}
2637
2663
  });
2638
2664
  }
2639
- async function plainRun(run, emit) {
2665
+ async function plainRun(run, emit, io) {
2640
2666
  if (run.kind === "report") {
2641
2667
  const done = await run.report();
2642
2668
  emit(done);
2643
2669
  return done;
2644
2670
  }
2645
- return installPlain(run.stream());
2671
+ return installPlain(run.stream(), io);
2646
2672
  }
2647
2673
  // src/install/empty.ts
2648
2674
  function nothingTracked(nearest, kind, all = false) {
@@ -5817,7 +5843,7 @@ import { realpathSync } from "node:fs";
5817
5843
  // package.json
5818
5844
  var package_default = {
5819
5845
  name: "yourskills",
5820
- version: "0.4.3",
5846
+ version: "0.4.4",
5821
5847
  description: "Browse, install and keep up to date the agent skills and bundles your team publishes on yourskills.",
5822
5848
  license: "UNLICENSED",
5823
5849
  homepage: "https://yourskills.store",
@@ -8204,6 +8230,65 @@ async function paletteFacts(scope, server) {
8204
8230
  import { Box as Box14, Text as Text16, useApp as useApp7, useInput as useInput8 } from "ink";
8205
8231
  import { useCallback as useCallback3, useEffect as useEffect9, useMemo as useMemo4, useRef, useState as useState11 } from "react";
8206
8232
 
8233
+ // src/draw.tsx
8234
+ import { jsx as jsx15 } from "react/jsx-runtime";
8235
+ function drawInk(answer, {
8236
+ onError,
8237
+ onSummary,
8238
+ onReport,
8239
+ exitWhenDone,
8240
+ onBack,
8241
+ onNext,
8242
+ working
8243
+ }) {
8244
+ const leaves = exitWhenDone === undefined ? {} : { exitWhenDone };
8245
+ const back = onBack ? { onBack } : {};
8246
+ const next = onNext ? { onNext } : {};
8247
+ const reported = onReport ? { onReport } : {};
8248
+ switch (answer.kind) {
8249
+ case "text":
8250
+ return answer.style === "document" ? /* @__PURE__ */ jsx15(HelpScreen, {
8251
+ text: answer.body,
8252
+ ...leaves,
8253
+ ...back
8254
+ }) : /* @__PURE__ */ jsx15(NoticeScreen, {
8255
+ title: answer.title,
8256
+ message: answer.body,
8257
+ ...leaves,
8258
+ ...back
8259
+ });
8260
+ case "report": {
8261
+ const says = working ?? answer.working;
8262
+ return /* @__PURE__ */ jsx15(ReportScreen, {
8263
+ title: answer.title,
8264
+ load: answer.load,
8265
+ onError,
8266
+ ...says ? { working: says } : {},
8267
+ ...reported,
8268
+ ...leaves,
8269
+ ...back,
8270
+ ...next
8271
+ });
8272
+ }
8273
+ case "rows":
8274
+ return /* @__PURE__ */ jsx15(CatalogScreen, {
8275
+ title: answer.title,
8276
+ load: async () => toRows(await answer.load()),
8277
+ onError
8278
+ });
8279
+ case "stream":
8280
+ return /* @__PURE__ */ jsx15(RunScreen, {
8281
+ run: answer.run,
8282
+ onError,
8283
+ ...onSummary ? { onDone: onSummary } : {},
8284
+ ...reported,
8285
+ ...leaves,
8286
+ ...back,
8287
+ ...next
8288
+ });
8289
+ }
8290
+ }
8291
+
8207
8292
  // src/shell/feed.ts
8208
8293
  async function feedFacts(client, where, server) {
8209
8294
  const installed = Object.keys(where.manifest.skills).length > 0;
@@ -8502,7 +8587,7 @@ function runnable(typed) {
8502
8587
 
8503
8588
  // src/shell/screens/keys.tsx
8504
8589
  import { Box as Box11, Text as Text13 } from "ink";
8505
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
8590
+ import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
8506
8591
  var KEYS = [
8507
8592
  ["^ v", "move the cursor", "move, or scroll"],
8508
8593
  ["enter", "run the highlighted row", "confirm the layer's action"],
@@ -8528,15 +8613,15 @@ function KeysScreen({ onBack }) {
8528
8613
  children: [
8529
8614
  /* @__PURE__ */ jsxs13(Text13, {
8530
8615
  children: [
8531
- /* @__PURE__ */ jsx15(Text13, {
8616
+ /* @__PURE__ */ jsx16(Text13, {
8532
8617
  dimColor: true,
8533
8618
  children: "".padEnd(key)
8534
8619
  }),
8535
- /* @__PURE__ */ jsx15(Text13, {
8620
+ /* @__PURE__ */ jsx16(Text13, {
8536
8621
  dimColor: true,
8537
8622
  children: "at the prompt".padEnd(half)
8538
8623
  }),
8539
- /* @__PURE__ */ jsx15(Text13, {
8624
+ /* @__PURE__ */ jsx16(Text13, {
8540
8625
  dimColor: true,
8541
8626
  children: "in a layer"
8542
8627
  })
@@ -8544,21 +8629,21 @@ function KeysScreen({ onBack }) {
8544
8629
  }),
8545
8630
  KEYS.map(([k, root, layer]) => /* @__PURE__ */ jsxs13(Text13, {
8546
8631
  children: [
8547
- /* @__PURE__ */ jsx15(Text13, {
8632
+ /* @__PURE__ */ jsx16(Text13, {
8548
8633
  color: tone.primary,
8549
8634
  children: k.padEnd(key)
8550
8635
  }),
8551
- /* @__PURE__ */ jsx15(Text13, {
8636
+ /* @__PURE__ */ jsx16(Text13, {
8552
8637
  children: clip(root, half - 2).padEnd(half)
8553
8638
  }),
8554
- /* @__PURE__ */ jsx15(Text13, {
8639
+ /* @__PURE__ */ jsx16(Text13, {
8555
8640
  children: clip(layer, interior - key - half)
8556
8641
  })
8557
8642
  ]
8558
8643
  }, k))
8559
8644
  ]
8560
8645
  }),
8561
- /* @__PURE__ */ jsx15(Back, {
8646
+ /* @__PURE__ */ jsx16(Back, {
8562
8647
  width,
8563
8648
  onBack
8564
8649
  })
@@ -8569,7 +8654,7 @@ function KeysScreen({ onBack }) {
8569
8654
  // src/shell/screens/picker.tsx
8570
8655
  import { Box as Box12, Text as Text14, useInput as useInput6 } from "ink";
8571
8656
  import { useEffect as useEffect8, useMemo as useMemo3, useState as useState9 } from "react";
8572
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
8657
+ import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
8573
8658
  function PickScreen({
8574
8659
  title,
8575
8660
  rows,
@@ -8639,7 +8724,7 @@ function PickScreen({
8639
8724
  });
8640
8725
  const names = nameWidth(rows);
8641
8726
  const page = visible.slice(first, first + size);
8642
- return /* @__PURE__ */ jsx16(Frame, {
8727
+ return /* @__PURE__ */ jsx17(Frame, {
8643
8728
  title,
8644
8729
  width,
8645
8730
  children: /* @__PURE__ */ jsxs14(Box12, {
@@ -8647,26 +8732,26 @@ function PickScreen({
8647
8732
  children: [
8648
8733
  /* @__PURE__ */ jsxs14(Box12, {
8649
8734
  children: [
8650
- /* @__PURE__ */ jsx16(Text14, {
8735
+ /* @__PURE__ */ jsx17(Text14, {
8651
8736
  color: tone.primary,
8652
8737
  children: "> "
8653
8738
  }),
8654
- /* @__PURE__ */ jsx16(SearchInput, {
8739
+ /* @__PURE__ */ jsx17(SearchInput, {
8655
8740
  value: query,
8656
8741
  placeholder: "type to filter"
8657
8742
  })
8658
8743
  ]
8659
8744
  }),
8660
- /* @__PURE__ */ jsx16(Divider, {
8745
+ /* @__PURE__ */ jsx17(Divider, {
8661
8746
  width
8662
8747
  }),
8663
- rows.length === 0 ? /* @__PURE__ */ jsx16(Text14, {
8748
+ rows.length === 0 ? /* @__PURE__ */ jsx17(Text14, {
8664
8749
  dimColor: true,
8665
8750
  children: empty
8666
- }) : visible.length === 0 ? /* @__PURE__ */ jsx16(Text14, {
8751
+ }) : visible.length === 0 ? /* @__PURE__ */ jsx17(Text14, {
8667
8752
  dimColor: true,
8668
8753
  children: `Nothing matches "${query}".`
8669
- }) : page.map((row, i) => /* @__PURE__ */ jsx16(SkillRow, {
8754
+ }) : page.map((row, i) => /* @__PURE__ */ jsx17(SkillRow, {
8670
8755
  row,
8671
8756
  width: width - 2,
8672
8757
  names,
@@ -8674,20 +8759,20 @@ function PickScreen({
8674
8759
  cursor: first + i === cursor,
8675
8760
  selected: single ? row.name === marked : picked.has(row.name)
8676
8761
  }, row.name)),
8677
- /* @__PURE__ */ jsx16(Divider, {
8762
+ /* @__PURE__ */ jsx17(Divider, {
8678
8763
  width
8679
8764
  }),
8680
8765
  /* @__PURE__ */ jsxs14(Box12, {
8681
8766
  children: [
8682
- /* @__PURE__ */ jsx16(Text14, {
8767
+ /* @__PURE__ */ jsx17(Text14, {
8683
8768
  dimColor: true,
8684
8769
  children: `${position(cursor, visible.length)} `
8685
8770
  }),
8686
- picked.size > 0 && !single ? /* @__PURE__ */ jsx16(Text14, {
8771
+ picked.size > 0 && !single ? /* @__PURE__ */ jsx17(Text14, {
8687
8772
  color: tone.notice,
8688
8773
  children: `${mark.selected} ${picked.size} marked `
8689
8774
  }) : null,
8690
- /* @__PURE__ */ jsx16(Hints, {
8775
+ /* @__PURE__ */ jsx17(Hints, {
8691
8776
  hints: [
8692
8777
  ["^v", "move"],
8693
8778
  ...single ? [] : [["space", "mark"]],
@@ -8705,7 +8790,7 @@ function PickScreen({
8705
8790
  // src/shell/screens/welcome.tsx
8706
8791
  import { Box as Box13, Text as Text15, useInput as useInput7 } from "ink";
8707
8792
  import { useState as useState10 } from "react";
8708
- import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
8793
+ import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
8709
8794
  function WelcomeScreen({
8710
8795
  agents,
8711
8796
  onStart,
@@ -8736,16 +8821,16 @@ function WelcomeScreen({
8736
8821
  const gap = Math.max(interior - 2 - label.length - hint.length, 1);
8737
8822
  return /* @__PURE__ */ jsxs15(Text15, {
8738
8823
  children: [
8739
- /* @__PURE__ */ jsx17(Text15, {
8824
+ /* @__PURE__ */ jsx18(Text15, {
8740
8825
  color: tone.primary,
8741
8826
  children: `${active ? mark.cursor : " "} `
8742
8827
  }),
8743
- /* @__PURE__ */ jsx17(Text15, {
8828
+ /* @__PURE__ */ jsx18(Text15, {
8744
8829
  bold: active,
8745
8830
  color: active ? tone.primary : undefined,
8746
8831
  children: label
8747
8832
  }),
8748
- /* @__PURE__ */ jsx17(Text15, {
8833
+ /* @__PURE__ */ jsx18(Text15, {
8749
8834
  dimColor: true,
8750
8835
  children: `${" ".repeat(gap)}${hint}`
8751
8836
  })
@@ -8759,34 +8844,34 @@ function WelcomeScreen({
8759
8844
  /* @__PURE__ */ jsxs15(Box13, {
8760
8845
  flexDirection: "column",
8761
8846
  children: [
8762
- /* @__PURE__ */ jsx17(Text15, {
8847
+ /* @__PURE__ */ jsx18(Text15, {
8763
8848
  children: "Welcome. Three steps, about a minute."
8764
8849
  }),
8765
- /* @__PURE__ */ jsx17(Blank, {}),
8850
+ /* @__PURE__ */ jsx18(Blank, {}),
8766
8851
  steps.map(([n, what, how]) => /* @__PURE__ */ jsxs15(Text15, {
8767
8852
  children: [
8768
- /* @__PURE__ */ jsx17(Text15, {
8853
+ /* @__PURE__ */ jsx18(Text15, {
8769
8854
  color: tone.primary,
8770
8855
  children: `${n} `
8771
8856
  }),
8772
- /* @__PURE__ */ jsx17(Text15, {
8857
+ /* @__PURE__ */ jsx18(Text15, {
8773
8858
  children: what.padEnd(16)
8774
8859
  }),
8775
- /* @__PURE__ */ jsx17(Text15, {
8860
+ /* @__PURE__ */ jsx18(Text15, {
8776
8861
  dimColor: true,
8777
8862
  children: clip(how, interior - 19)
8778
8863
  })
8779
8864
  ]
8780
8865
  }, n)),
8781
- /* @__PURE__ */ jsx17(Blank, {}),
8866
+ /* @__PURE__ */ jsx18(Blank, {}),
8782
8867
  row("start", "", choice === "start"),
8783
8868
  row("skip, I know what I am doing", "yourskills login", choice === "skip")
8784
8869
  ]
8785
8870
  }),
8786
- /* @__PURE__ */ jsx17(Divider, {
8871
+ /* @__PURE__ */ jsx18(Divider, {
8787
8872
  width
8788
8873
  }),
8789
- /* @__PURE__ */ jsx17(Hints, {
8874
+ /* @__PURE__ */ jsx18(Hints, {
8790
8875
  hints: [
8791
8876
  ["enter", choice === "start" ? "start" : "skip"],
8792
8877
  ["esc", "skip"]
@@ -8797,7 +8882,7 @@ function WelcomeScreen({
8797
8882
  }
8798
8883
 
8799
8884
  // src/shell/screens/home.tsx
8800
- import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
8885
+ import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
8801
8886
  function failure(title, error) {
8802
8887
  const message = error instanceof Error ? error.message : String(error);
8803
8888
  return {
@@ -8841,25 +8926,25 @@ function AccountLine({ facts, width }) {
8841
8926
  children: [
8842
8927
  /* @__PURE__ */ jsxs16(Text16, {
8843
8928
  children: [
8844
- /* @__PURE__ */ jsx18(Text16, {
8929
+ /* @__PURE__ */ jsx19(Text16, {
8845
8930
  color: facts.signedIn ? "green" : tone.notice,
8846
8931
  children: facts.signedIn ? mark.ok : mark.fail
8847
8932
  }),
8848
- /* @__PURE__ */ jsx18(Text16, {
8933
+ /* @__PURE__ */ jsx19(Text16, {
8849
8934
  color: facts.signedIn ? undefined : tone.notice,
8850
8935
  children: ` ${clip(head, room - 2)}`
8851
8936
  }),
8852
- showOrg ? /* @__PURE__ */ jsx18(Text16, {
8937
+ showOrg ? /* @__PURE__ */ jsx19(Text16, {
8853
8938
  color: tone.primary,
8854
8939
  children: org
8855
8940
  }) : null,
8856
- showTail ? /* @__PURE__ */ jsx18(Text16, {
8941
+ showTail ? /* @__PURE__ */ jsx19(Text16, {
8857
8942
  dimColor: true,
8858
8943
  children: tail
8859
8944
  }) : null
8860
8945
  ]
8861
8946
  }),
8862
- /* @__PURE__ */ jsx18(Text16, {
8947
+ /* @__PURE__ */ jsx19(Text16, {
8863
8948
  dimColor: true,
8864
8949
  children: clip(right, inner - room)
8865
8950
  })
@@ -8868,9 +8953,9 @@ function AccountLine({ facts, width }) {
8868
8953
  }
8869
8954
  function StaleLine({ stale, width }) {
8870
8955
  const text = `${mark.ok} ${stale.latest} is out; you have ${stale.current}. type upgrade`;
8871
- return /* @__PURE__ */ jsx18(Box14, {
8956
+ return /* @__PURE__ */ jsx19(Box14, {
8872
8957
  width: width - FRAME_CHROME,
8873
- children: /* @__PURE__ */ jsx18(Text16, {
8958
+ children: /* @__PURE__ */ jsx19(Text16, {
8874
8959
  color: tone.notice,
8875
8960
  children: clip(text, width - FRAME_CHROME)
8876
8961
  })
@@ -8969,28 +9054,15 @@ function HomeScreen({
8969
9054
  };
8970
9055
  }, [facts.signedIn, connect, loadFeed, where, server]);
8971
9056
  const checkSession = useCallback3(async () => facts.signedIn, [facts.signedIn]);
8972
- const answering = useCallback3((title, working, load) => ({
8973
- kind: "report",
8974
- title,
8975
- working,
8976
- load: async () => {
8977
- try {
8978
- return await load();
8979
- } catch (error) {
8980
- return failure(title, error);
8981
- }
9057
+ const failing = useCallback3((title, error) => ({
9058
+ kind: "answer",
9059
+ working: "",
9060
+ answer: {
9061
+ kind: "report",
9062
+ title,
9063
+ load: async () => failure(title, error)
8982
9064
  }
8983
9065
  }), []);
8984
- const answeringRun = useCallback3((run) => run.kind === "stream" ? run : {
8985
- ...run,
8986
- report: async () => {
8987
- try {
8988
- return await run.report();
8989
- } catch (error) {
8990
- return failure(run.title, error);
8991
- }
8992
- }
8993
- }, []);
8994
9066
  const ctx = useMemo4(() => ({
8995
9067
  where,
8996
9068
  resite,
@@ -9020,20 +9092,9 @@ function HomeScreen({
9020
9092
  ...answer.tab ? { tab: answer.tab } : {},
9021
9093
  ...answer.query ? { query: answer.query } : {}
9022
9094
  };
9023
- case "text":
9024
- return answering(answer.title, plan, async () => ({
9025
- title: answer.title,
9026
- lines: [{ mark: "ok", text: answer.body }],
9027
- json: { ok: true }
9028
- }));
9029
- case "report":
9030
- return answering(answer.title, plan, answer.load);
9031
- case "rows":
9032
- return answering(answer.title, plan, async () => answer.report(await answer.load()));
9033
- case "stream":
9034
- return { kind: "run", run: answeringRun(answer.run) };
9035
9095
  }
9036
- }, [answering, answeringRun]);
9096
+ return { kind: "answer", answer, working: plan };
9097
+ }, []);
9037
9098
  const routeForCommand = useCallback3(async (command) => {
9038
9099
  if (command.kind === "error")
9039
9100
  return null;
@@ -9134,9 +9195,9 @@ function HomeScreen({
9134
9195
  if (next)
9135
9196
  setRoute(next);
9136
9197
  }).catch((error) => {
9137
- setRoute(answering(title, "", async () => failure(title, error)));
9198
+ setRoute(failing(title, error));
9138
9199
  });
9139
- }, [answering]);
9200
+ }, [failing]);
9140
9201
  const runText = useCallback3((text) => {
9141
9202
  const parsed = typedCommand(text);
9142
9203
  if (!runnable(parsed))
@@ -9227,7 +9288,7 @@ function HomeScreen({
9227
9288
  }, [onWelcomed]);
9228
9289
  const browseTab = route?.kind === "browse" ? route.tab : undefined;
9229
9290
  const browseQuery = route?.kind === "browse" ? route.query : undefined;
9230
- const browser = useCallback3((live) => /* @__PURE__ */ jsx18(BrowserScreen, {
9291
+ const browser = useCallback3((live) => /* @__PURE__ */ jsx19(BrowserScreen, {
9231
9292
  client: live,
9232
9293
  where,
9233
9294
  onError,
@@ -9236,6 +9297,14 @@ function HomeScreen({
9236
9297
  ...browseTab ? { initialTab: browseTab } : {},
9237
9298
  ...browseQuery ? { initialQuery: browseQuery } : {}
9238
9299
  }), [where, onError, onSummary, back, browseTab, browseQuery]);
9300
+ const drawn = useMemo4(() => route?.kind === "answer" ? drawInk(route.answer, {
9301
+ onError: (error) => setRoute(failing(route.answer.title, error)),
9302
+ onSummary,
9303
+ exitWhenDone: false,
9304
+ onBack: back,
9305
+ onNext: runText,
9306
+ working: route.working
9307
+ }) : null, [route, onSummary, back, runText, failing]);
9239
9308
  useInput8((input, key) => {
9240
9309
  if (key.upArrow) {
9241
9310
  setCursor((c) => Math.max(0, c - 1));
@@ -9261,48 +9330,29 @@ function HomeScreen({
9261
9330
  }
9262
9331
  }, { isActive: route === null && !welcome });
9263
9332
  if (welcome) {
9264
- return /* @__PURE__ */ jsx18(WelcomeScreen, {
9333
+ return /* @__PURE__ */ jsx19(WelcomeScreen, {
9265
9334
  agents: facts.agentsOnDisk,
9266
9335
  onStart: () => leaveWelcome(true),
9267
9336
  onSkip: () => leaveWelcome(false)
9268
9337
  });
9269
9338
  }
9270
9339
  if (route?.kind === "login") {
9271
- return /* @__PURE__ */ jsx18(LoginScreen, {
9340
+ return /* @__PURE__ */ jsx19(LoginScreen, {
9272
9341
  onError,
9273
9342
  onDone: afterLogin,
9274
9343
  onBack: back
9275
9344
  });
9276
9345
  }
9277
9346
  if (route?.kind === "keys") {
9278
- return /* @__PURE__ */ jsx18(KeysScreen, {
9347
+ return /* @__PURE__ */ jsx19(KeysScreen, {
9279
9348
  onBack: back
9280
9349
  });
9281
9350
  }
9282
- if (route?.kind === "report") {
9283
- return /* @__PURE__ */ jsx18(ReportScreen, {
9284
- title: route.title,
9285
- load: route.load,
9286
- working: route.working,
9287
- onError,
9288
- exitWhenDone: false,
9289
- onBack: back,
9290
- onNext: runText
9291
- });
9292
- }
9293
- if (route?.kind === "run") {
9294
- return /* @__PURE__ */ jsx18(RunScreen, {
9295
- run: route.run,
9296
- exitWhenDone: false,
9297
- onError,
9298
- onDone: onSummary,
9299
- onBack: back,
9300
- onNext: runText
9301
- });
9302
- }
9351
+ if (drawn)
9352
+ return drawn;
9303
9353
  if (route?.kind === "pick") {
9304
9354
  const picked = route;
9305
- return /* @__PURE__ */ jsx18(PickScreen, {
9355
+ return /* @__PURE__ */ jsx19(PickScreen, {
9306
9356
  title: picked.title,
9307
9357
  rows: picked.rows,
9308
9358
  empty: picked.empty,
@@ -9318,7 +9368,7 @@ function HomeScreen({
9318
9368
  }
9319
9369
  if (route?.kind === "ask") {
9320
9370
  const { spec } = route;
9321
- return /* @__PURE__ */ jsx18(ConfirmScreen, {
9371
+ return /* @__PURE__ */ jsx19(ConfirmScreen, {
9322
9372
  title: spec.title,
9323
9373
  headline: spec.headline,
9324
9374
  lines: spec.lines,
@@ -9326,12 +9376,16 @@ function HomeScreen({
9326
9376
  yes: spec.yes,
9327
9377
  no: spec.no,
9328
9378
  argv: spec.argv,
9329
- onYes: () => setRoute(answering(spec.title, spec.working, spec.run)),
9379
+ onYes: () => setRoute({
9380
+ kind: "answer",
9381
+ working: spec.working,
9382
+ answer: { kind: "report", title: spec.title, load: spec.run }
9383
+ }),
9330
9384
  onNo: back
9331
9385
  });
9332
9386
  }
9333
9387
  if (route?.kind === "browse") {
9334
- return /* @__PURE__ */ jsx18(AuthGate, {
9388
+ return /* @__PURE__ */ jsx19(AuthGate, {
9335
9389
  title: "browse",
9336
9390
  check: checkSession,
9337
9391
  connect,
@@ -9349,36 +9403,36 @@ function HomeScreen({
9349
9403
  title: "yourskills",
9350
9404
  width,
9351
9405
  children: [
9352
- /* @__PURE__ */ jsx18(AccountLine, {
9406
+ /* @__PURE__ */ jsx19(AccountLine, {
9353
9407
  facts: shown,
9354
9408
  width
9355
9409
  }),
9356
- stale ? /* @__PURE__ */ jsx18(StaleLine, {
9410
+ stale ? /* @__PURE__ */ jsx19(StaleLine, {
9357
9411
  stale,
9358
9412
  width
9359
9413
  }) : null,
9360
- /* @__PURE__ */ jsx18(Divider, {
9414
+ /* @__PURE__ */ jsx19(Divider, {
9361
9415
  width
9362
9416
  }),
9363
- /* @__PURE__ */ jsx18(CommandPalette, {
9417
+ /* @__PURE__ */ jsx19(CommandPalette, {
9364
9418
  groups: visible,
9365
9419
  query,
9366
9420
  cursor,
9367
9421
  width,
9368
9422
  emptyMessage: empty
9369
9423
  }),
9370
- /* @__PURE__ */ jsx18(Divider, {
9424
+ /* @__PURE__ */ jsx19(Divider, {
9371
9425
  width
9372
9426
  }),
9373
- /* @__PURE__ */ jsx18(Text16, {
9427
+ /* @__PURE__ */ jsx19(Text16, {
9374
9428
  dimColor: true,
9375
9429
  children: clip(description, width - FRAME_CHROME)
9376
9430
  }),
9377
- /* @__PURE__ */ jsx18(Text16, {
9431
+ /* @__PURE__ */ jsx19(Text16, {
9378
9432
  dimColor: true,
9379
9433
  children: found ? clip(` ${found}`, width - FRAME_CHROME) : " "
9380
9434
  }),
9381
- /* @__PURE__ */ jsx18(Hints, {
9435
+ /* @__PURE__ */ jsx19(Hints, {
9382
9436
  hints: [
9383
9437
  ["^v", "move"],
9384
9438
  ["tab", "complete"],
@@ -9391,7 +9445,7 @@ function HomeScreen({
9391
9445
  });
9392
9446
  }
9393
9447
  // src/drive.tsx
9394
- import { jsx as jsx19 } from "react/jsx-runtime";
9448
+ import { jsx as jsx20 } from "react/jsx-runtime";
9395
9449
  var liveChores = {
9396
9450
  sendUsage: flushQuietly,
9397
9451
  offerHooks: ensureHooksRegistered,
@@ -9466,7 +9520,7 @@ async function drawPlain(answer, output, io) {
9466
9520
  let code = EXIT.ok;
9467
9521
  const done = await plainRun(answer.run, (report) => {
9468
9522
  code = emit2(report, output, io);
9469
- });
9523
+ }, io);
9470
9524
  return "pending" in done ? landed(done) : code;
9471
9525
  }
9472
9526
  }
@@ -9474,7 +9528,7 @@ async function drawPlain(answer, output, io) {
9474
9528
  async function screenFor(command, ctx, resite, fail, exit) {
9475
9529
  const summarise = (summary) => exit.raise(landed(summary));
9476
9530
  const report = (result) => exit.raise(result.failed ? EXIT.failed : EXIT.ok);
9477
- const gate = (title, build) => /* @__PURE__ */ jsx19(AuthGate, {
9531
+ const gate = (title, build) => /* @__PURE__ */ jsx20(AuthGate, {
9478
9532
  title,
9479
9533
  build,
9480
9534
  connect: ctx.client,
@@ -9484,7 +9538,7 @@ async function screenFor(command, ctx, resite, fail, exit) {
9484
9538
  const { row, answer } = await answerFor(command, ctx);
9485
9539
  if (answer.kind === "home") {
9486
9540
  const reload = () => paletteFacts(ctx.where.scope, ctx.server);
9487
- return /* @__PURE__ */ jsx19(HomeScreen, {
9541
+ return /* @__PURE__ */ jsx20(HomeScreen, {
9488
9542
  where: ctx.where,
9489
9543
  resite,
9490
9544
  facts: await reload(),
@@ -9503,54 +9557,26 @@ async function screenFor(command, ctx, resite, fail, exit) {
9503
9557
  });
9504
9558
  }
9505
9559
  if (answer.kind === "login")
9506
- return /* @__PURE__ */ jsx19(LoginScreen, {
9560
+ return /* @__PURE__ */ jsx20(LoginScreen, {
9507
9561
  onError: fail
9508
9562
  });
9509
9563
  if (answer.kind === "browse")
9510
- return gate("browse", (client) => /* @__PURE__ */ jsx19(BrowserScreen, {
9564
+ return gate("browse", (client) => /* @__PURE__ */ jsx20(BrowserScreen, {
9511
9565
  client,
9512
9566
  where: ctx.where,
9513
9567
  onError: fail,
9514
9568
  onSummary: summarise
9515
9569
  }));
9516
- const drawn = drawInk(answer, fail, summarise, report);
9570
+ const drawn = drawInk(answer, {
9571
+ onError: fail,
9572
+ onSummary: summarise,
9573
+ onReport: report
9574
+ });
9517
9575
  return sessionFirst(row, answer) ? gate(answer.title, () => drawn) : drawn;
9518
9576
  }
9519
9577
  function sessionFirst(row, answer) {
9520
9578
  return answer.kind === "stream" ? answer.run.needsSession : row.needs === "session";
9521
9579
  }
9522
- function drawInk(answer, fail, summarise, report) {
9523
- switch (answer.kind) {
9524
- case "text":
9525
- return answer.style === "document" ? /* @__PURE__ */ jsx19(HelpScreen, {
9526
- text: answer.body
9527
- }) : /* @__PURE__ */ jsx19(NoticeScreen, {
9528
- title: answer.title,
9529
- message: answer.body
9530
- });
9531
- case "report":
9532
- return /* @__PURE__ */ jsx19(ReportScreen, {
9533
- title: answer.title,
9534
- load: answer.load,
9535
- onError: fail,
9536
- onReport: report,
9537
- ...answer.working ? { working: answer.working } : {}
9538
- });
9539
- case "rows":
9540
- return /* @__PURE__ */ jsx19(CatalogScreen, {
9541
- title: answer.title,
9542
- load: async () => toRows(await answer.load()),
9543
- onError: fail
9544
- });
9545
- case "stream":
9546
- return /* @__PURE__ */ jsx19(RunScreen, {
9547
- run: answer.run,
9548
- onError: fail,
9549
- onDone: summarise,
9550
- onReport: report
9551
- });
9552
- }
9553
- }
9554
9580
  async function runInk(command, ctx, resite, io, exit) {
9555
9581
  let failure = null;
9556
9582
  let frame = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yourskills",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Browse, install and keep up to date the agent skills and bundles your team publishes on yourskills.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://yourskills.store",