yourskills 0.4.2 → 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 +287 -252
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1198,6 +1198,7 @@ function LoginScreen({
1198
1198
  const { exit } = useApp();
1199
1199
  const width = useFrameWidth();
1200
1200
  const [state, setState] = useState3({ phase: "starting" });
1201
+ const [finished, setFinished] = useState3(false);
1201
1202
  useEffect2(() => {
1202
1203
  let live = true;
1203
1204
  (async () => {
@@ -1218,15 +1219,18 @@ function LoginScreen({
1218
1219
  }
1219
1220
  if (!live)
1220
1221
  return;
1222
+ setFinished(true);
1221
1223
  if (onDone)
1222
1224
  onDone();
1223
- else
1224
- exit();
1225
1225
  })();
1226
1226
  return () => {
1227
1227
  live = false;
1228
1228
  };
1229
- }, [exit, onError, onDone]);
1229
+ }, [onError, onDone]);
1230
+ useEffect2(() => {
1231
+ if (finished && !onDone)
1232
+ exit();
1233
+ }, [finished, onDone, exit]);
1230
1234
  if (state.phase === "done") {
1231
1235
  return /* @__PURE__ */ jsx8(Frame, {
1232
1236
  title: "login",
@@ -2273,13 +2277,15 @@ function Installer({
2273
2277
  return;
2274
2278
  setDone(true);
2275
2279
  onDone?.(summarise(current));
2276
- if (exitWhenDone)
2277
- exit();
2278
2280
  })();
2279
2281
  return () => {
2280
2282
  live = false;
2281
2283
  };
2282
- }, [stream, onDone, exit, exitWhenDone]);
2284
+ }, [stream, onDone]);
2285
+ useEffect4(() => {
2286
+ if (done && exitWhenDone)
2287
+ exit();
2288
+ }, [done, exit, exitWhenDone]);
2283
2289
  const counts = done ? receipt(lines) : null;
2284
2290
  const pending = counts?.pending ?? 0;
2285
2291
  const questions = counts?.questions ?? 0;
@@ -2373,57 +2379,6 @@ function Installer({
2373
2379
  ]
2374
2380
  });
2375
2381
  }
2376
- function plainLine(line) {
2377
- switch (line.state) {
2378
- case "installing":
2379
- return `installing ${line.name} ${line.where}`;
2380
- case "installed":
2381
- return `${line.name} ${line.where}${line.deprecated ? ` ${lifecycleTag("deprecated")}` : ""}`;
2382
- case "pending":
2383
- return pendingMessage(line.vendor);
2384
- case "question":
2385
- return licenceQuestionMessage(line.name, line.licence);
2386
- case "failed":
2387
- return `error: ${line.name}: ${line.message}`;
2388
- default:
2389
- return null;
2390
- }
2391
- }
2392
- async function installPlain(stream) {
2393
- let lines = [];
2394
- const printed = new Set;
2395
- const started = new Set;
2396
- for await (const event of stream) {
2397
- lines = reduce(lines, event);
2398
- for (const line of lines) {
2399
- if (line.state === "installing" && !started.has(line.name)) {
2400
- started.add(line.name);
2401
- const text = plainLine(line);
2402
- if (text !== null)
2403
- console.log(text);
2404
- continue;
2405
- }
2406
- if (printed.has(line.name) || !settled(line))
2407
- continue;
2408
- const text = plainLine(line);
2409
- if (text === null)
2410
- continue;
2411
- printed.add(line.name);
2412
- if (line.state === "failed") {
2413
- console.error(text);
2414
- if (line.detail)
2415
- console.error(line.detail);
2416
- } else {
2417
- console.log(text);
2418
- }
2419
- }
2420
- }
2421
- const counts = receipt(lines);
2422
- if (counts) {
2423
- console.log(`${counts.installed} installed, ${counts.pending} pending, ${counts.failed} failed` + (counts.questions > 0 ? `, ${counts.questions} unanswered` : ""));
2424
- }
2425
- return summarise(lines);
2426
- }
2427
2382
  // src/screens.tsx
2428
2383
  import { Box as Box8, Text as Text10, useApp as useApp4, useInput as useInput4 } from "ink";
2429
2384
  import { useEffect as useEffect5, useState as useState6 } from "react";
@@ -2431,25 +2386,36 @@ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2431
2386
  var HELP_COLUMN = 26;
2432
2387
  function NoticeScreen({
2433
2388
  title,
2434
- message
2389
+ message,
2390
+ exitWhenDone = true,
2391
+ onBack
2435
2392
  }) {
2436
2393
  const { exit } = useApp4();
2437
2394
  const width = useFrameWidth();
2438
- useEffect5(exit, [exit]);
2439
- return /* @__PURE__ */ jsx11(Frame, {
2395
+ useEffect5(() => {
2396
+ if (exitWhenDone)
2397
+ exit();
2398
+ }, [exit, exitWhenDone]);
2399
+ return /* @__PURE__ */ jsxs10(Frame, {
2440
2400
  title,
2441
2401
  width,
2442
- children: /* @__PURE__ */ jsxs10(Text10, {
2443
- children: [
2444
- /* @__PURE__ */ jsx11(Text10, {
2445
- color: "green",
2446
- children: mark.ok
2447
- }),
2448
- /* @__PURE__ */ jsx11(Text10, {
2449
- children: ` ${message}`
2450
- })
2451
- ]
2452
- })
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
+ ]
2453
2419
  });
2454
2420
  }
2455
2421
  var COLOURS = {
@@ -2565,39 +2531,105 @@ function numberedLines(text) {
2565
2531
  return text.split(`
2566
2532
  `).map((line, i) => ({ id: `${i}:${line}`, line }));
2567
2533
  }
2568
- function HelpScreen({ text }) {
2534
+ function HelpScreen({
2535
+ text,
2536
+ exitWhenDone = true,
2537
+ onBack
2538
+ }) {
2569
2539
  const { exit } = useApp4();
2570
2540
  const width = useFrameWidth();
2571
- useEffect5(exit, [exit]);
2572
- return /* @__PURE__ */ jsx11(Frame, {
2541
+ useEffect5(() => {
2542
+ if (exitWhenDone)
2543
+ exit();
2544
+ }, [exit, exitWhenDone]);
2545
+ return /* @__PURE__ */ jsxs10(Frame, {
2573
2546
  title: "yourskills",
2574
2547
  width,
2575
- children: /* @__PURE__ */ jsx11(Box8, {
2576
- flexDirection: "column",
2577
- children: numberedLines(text).map(({ id, line }) => {
2578
- if (line.length === 0)
2579
- return /* @__PURE__ */ jsx11(Blank, {}, id);
2580
- if (!line.startsWith(" "))
2581
- return /* @__PURE__ */ jsx11(Text10, {
2582
- children: clip(line, width - FRAME_CHROME)
2583
- }, id);
2584
- return /* @__PURE__ */ jsxs10(Text10, {
2585
- children: [
2586
- /* @__PURE__ */ jsx11(Text10, {
2587
- color: tone.primary,
2588
- children: line.slice(0, HELP_COLUMN)
2589
- }),
2590
- /* @__PURE__ */ jsx11(Text10, {
2591
- dimColor: true,
2592
- children: clip(line.slice(HELP_COLUMN), width - FRAME_CHROME - HELP_COLUMN)
2593
- })
2594
- ]
2595
- }, 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
2596
2575
  })
2597
- })
2576
+ ]
2598
2577
  });
2599
2578
  }
2600
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
+
2601
2633
  // src/install/screens/run.tsx
2602
2634
  import { jsx as jsx12 } from "react/jsx-runtime";
2603
2635
  function RunScreen({
@@ -2630,13 +2662,13 @@ function RunScreen({
2630
2662
  ...onNext ? { onNext } : {}
2631
2663
  });
2632
2664
  }
2633
- async function plainRun(run, emit) {
2665
+ async function plainRun(run, emit, io) {
2634
2666
  if (run.kind === "report") {
2635
2667
  const done = await run.report();
2636
2668
  emit(done);
2637
2669
  return done;
2638
2670
  }
2639
- return installPlain(run.stream());
2671
+ return installPlain(run.stream(), io);
2640
2672
  }
2641
2673
  // src/install/empty.ts
2642
2674
  function nothingTracked(nearest, kind, all = false) {
@@ -3066,7 +3098,6 @@ function CatalogScreen({
3066
3098
  if (!live)
3067
3099
  return;
3068
3100
  setRows(result);
3069
- exit();
3070
3101
  }).catch((error) => {
3071
3102
  if (live)
3072
3103
  onError(error);
@@ -3074,7 +3105,11 @@ function CatalogScreen({
3074
3105
  return () => {
3075
3106
  live = false;
3076
3107
  };
3077
- }, [load, exit, onError]);
3108
+ }, [load, onError]);
3109
+ useEffect7(() => {
3110
+ if (rows !== null)
3111
+ exit();
3112
+ }, [rows, exit]);
3078
3113
  if (rows === null) {
3079
3114
  return /* @__PURE__ */ jsx14(Frame, {
3080
3115
  title,
@@ -5808,7 +5843,7 @@ import { realpathSync } from "node:fs";
5808
5843
  // package.json
5809
5844
  var package_default = {
5810
5845
  name: "yourskills",
5811
- version: "0.4.2",
5846
+ version: "0.4.4",
5812
5847
  description: "Browse, install and keep up to date the agent skills and bundles your team publishes on yourskills.",
5813
5848
  license: "UNLICENSED",
5814
5849
  homepage: "https://yourskills.store",
@@ -8195,6 +8230,65 @@ async function paletteFacts(scope, server) {
8195
8230
  import { Box as Box14, Text as Text16, useApp as useApp7, useInput as useInput8 } from "ink";
8196
8231
  import { useCallback as useCallback3, useEffect as useEffect9, useMemo as useMemo4, useRef, useState as useState11 } from "react";
8197
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
+
8198
8292
  // src/shell/feed.ts
8199
8293
  async function feedFacts(client, where, server) {
8200
8294
  const installed = Object.keys(where.manifest.skills).length > 0;
@@ -8493,7 +8587,7 @@ function runnable(typed) {
8493
8587
 
8494
8588
  // src/shell/screens/keys.tsx
8495
8589
  import { Box as Box11, Text as Text13 } from "ink";
8496
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
8590
+ import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
8497
8591
  var KEYS = [
8498
8592
  ["^ v", "move the cursor", "move, or scroll"],
8499
8593
  ["enter", "run the highlighted row", "confirm the layer's action"],
@@ -8519,15 +8613,15 @@ function KeysScreen({ onBack }) {
8519
8613
  children: [
8520
8614
  /* @__PURE__ */ jsxs13(Text13, {
8521
8615
  children: [
8522
- /* @__PURE__ */ jsx15(Text13, {
8616
+ /* @__PURE__ */ jsx16(Text13, {
8523
8617
  dimColor: true,
8524
8618
  children: "".padEnd(key)
8525
8619
  }),
8526
- /* @__PURE__ */ jsx15(Text13, {
8620
+ /* @__PURE__ */ jsx16(Text13, {
8527
8621
  dimColor: true,
8528
8622
  children: "at the prompt".padEnd(half)
8529
8623
  }),
8530
- /* @__PURE__ */ jsx15(Text13, {
8624
+ /* @__PURE__ */ jsx16(Text13, {
8531
8625
  dimColor: true,
8532
8626
  children: "in a layer"
8533
8627
  })
@@ -8535,21 +8629,21 @@ function KeysScreen({ onBack }) {
8535
8629
  }),
8536
8630
  KEYS.map(([k, root, layer]) => /* @__PURE__ */ jsxs13(Text13, {
8537
8631
  children: [
8538
- /* @__PURE__ */ jsx15(Text13, {
8632
+ /* @__PURE__ */ jsx16(Text13, {
8539
8633
  color: tone.primary,
8540
8634
  children: k.padEnd(key)
8541
8635
  }),
8542
- /* @__PURE__ */ jsx15(Text13, {
8636
+ /* @__PURE__ */ jsx16(Text13, {
8543
8637
  children: clip(root, half - 2).padEnd(half)
8544
8638
  }),
8545
- /* @__PURE__ */ jsx15(Text13, {
8639
+ /* @__PURE__ */ jsx16(Text13, {
8546
8640
  children: clip(layer, interior - key - half)
8547
8641
  })
8548
8642
  ]
8549
8643
  }, k))
8550
8644
  ]
8551
8645
  }),
8552
- /* @__PURE__ */ jsx15(Back, {
8646
+ /* @__PURE__ */ jsx16(Back, {
8553
8647
  width,
8554
8648
  onBack
8555
8649
  })
@@ -8560,7 +8654,7 @@ function KeysScreen({ onBack }) {
8560
8654
  // src/shell/screens/picker.tsx
8561
8655
  import { Box as Box12, Text as Text14, useInput as useInput6 } from "ink";
8562
8656
  import { useEffect as useEffect8, useMemo as useMemo3, useState as useState9 } from "react";
8563
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
8657
+ import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
8564
8658
  function PickScreen({
8565
8659
  title,
8566
8660
  rows,
@@ -8630,7 +8724,7 @@ function PickScreen({
8630
8724
  });
8631
8725
  const names = nameWidth(rows);
8632
8726
  const page = visible.slice(first, first + size);
8633
- return /* @__PURE__ */ jsx16(Frame, {
8727
+ return /* @__PURE__ */ jsx17(Frame, {
8634
8728
  title,
8635
8729
  width,
8636
8730
  children: /* @__PURE__ */ jsxs14(Box12, {
@@ -8638,26 +8732,26 @@ function PickScreen({
8638
8732
  children: [
8639
8733
  /* @__PURE__ */ jsxs14(Box12, {
8640
8734
  children: [
8641
- /* @__PURE__ */ jsx16(Text14, {
8735
+ /* @__PURE__ */ jsx17(Text14, {
8642
8736
  color: tone.primary,
8643
8737
  children: "> "
8644
8738
  }),
8645
- /* @__PURE__ */ jsx16(SearchInput, {
8739
+ /* @__PURE__ */ jsx17(SearchInput, {
8646
8740
  value: query,
8647
8741
  placeholder: "type to filter"
8648
8742
  })
8649
8743
  ]
8650
8744
  }),
8651
- /* @__PURE__ */ jsx16(Divider, {
8745
+ /* @__PURE__ */ jsx17(Divider, {
8652
8746
  width
8653
8747
  }),
8654
- rows.length === 0 ? /* @__PURE__ */ jsx16(Text14, {
8748
+ rows.length === 0 ? /* @__PURE__ */ jsx17(Text14, {
8655
8749
  dimColor: true,
8656
8750
  children: empty
8657
- }) : visible.length === 0 ? /* @__PURE__ */ jsx16(Text14, {
8751
+ }) : visible.length === 0 ? /* @__PURE__ */ jsx17(Text14, {
8658
8752
  dimColor: true,
8659
8753
  children: `Nothing matches "${query}".`
8660
- }) : page.map((row, i) => /* @__PURE__ */ jsx16(SkillRow, {
8754
+ }) : page.map((row, i) => /* @__PURE__ */ jsx17(SkillRow, {
8661
8755
  row,
8662
8756
  width: width - 2,
8663
8757
  names,
@@ -8665,20 +8759,20 @@ function PickScreen({
8665
8759
  cursor: first + i === cursor,
8666
8760
  selected: single ? row.name === marked : picked.has(row.name)
8667
8761
  }, row.name)),
8668
- /* @__PURE__ */ jsx16(Divider, {
8762
+ /* @__PURE__ */ jsx17(Divider, {
8669
8763
  width
8670
8764
  }),
8671
8765
  /* @__PURE__ */ jsxs14(Box12, {
8672
8766
  children: [
8673
- /* @__PURE__ */ jsx16(Text14, {
8767
+ /* @__PURE__ */ jsx17(Text14, {
8674
8768
  dimColor: true,
8675
8769
  children: `${position(cursor, visible.length)} `
8676
8770
  }),
8677
- picked.size > 0 && !single ? /* @__PURE__ */ jsx16(Text14, {
8771
+ picked.size > 0 && !single ? /* @__PURE__ */ jsx17(Text14, {
8678
8772
  color: tone.notice,
8679
8773
  children: `${mark.selected} ${picked.size} marked `
8680
8774
  }) : null,
8681
- /* @__PURE__ */ jsx16(Hints, {
8775
+ /* @__PURE__ */ jsx17(Hints, {
8682
8776
  hints: [
8683
8777
  ["^v", "move"],
8684
8778
  ...single ? [] : [["space", "mark"]],
@@ -8696,7 +8790,7 @@ function PickScreen({
8696
8790
  // src/shell/screens/welcome.tsx
8697
8791
  import { Box as Box13, Text as Text15, useInput as useInput7 } from "ink";
8698
8792
  import { useState as useState10 } from "react";
8699
- import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
8793
+ import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
8700
8794
  function WelcomeScreen({
8701
8795
  agents,
8702
8796
  onStart,
@@ -8727,16 +8821,16 @@ function WelcomeScreen({
8727
8821
  const gap = Math.max(interior - 2 - label.length - hint.length, 1);
8728
8822
  return /* @__PURE__ */ jsxs15(Text15, {
8729
8823
  children: [
8730
- /* @__PURE__ */ jsx17(Text15, {
8824
+ /* @__PURE__ */ jsx18(Text15, {
8731
8825
  color: tone.primary,
8732
8826
  children: `${active ? mark.cursor : " "} `
8733
8827
  }),
8734
- /* @__PURE__ */ jsx17(Text15, {
8828
+ /* @__PURE__ */ jsx18(Text15, {
8735
8829
  bold: active,
8736
8830
  color: active ? tone.primary : undefined,
8737
8831
  children: label
8738
8832
  }),
8739
- /* @__PURE__ */ jsx17(Text15, {
8833
+ /* @__PURE__ */ jsx18(Text15, {
8740
8834
  dimColor: true,
8741
8835
  children: `${" ".repeat(gap)}${hint}`
8742
8836
  })
@@ -8750,34 +8844,34 @@ function WelcomeScreen({
8750
8844
  /* @__PURE__ */ jsxs15(Box13, {
8751
8845
  flexDirection: "column",
8752
8846
  children: [
8753
- /* @__PURE__ */ jsx17(Text15, {
8847
+ /* @__PURE__ */ jsx18(Text15, {
8754
8848
  children: "Welcome. Three steps, about a minute."
8755
8849
  }),
8756
- /* @__PURE__ */ jsx17(Blank, {}),
8850
+ /* @__PURE__ */ jsx18(Blank, {}),
8757
8851
  steps.map(([n, what, how]) => /* @__PURE__ */ jsxs15(Text15, {
8758
8852
  children: [
8759
- /* @__PURE__ */ jsx17(Text15, {
8853
+ /* @__PURE__ */ jsx18(Text15, {
8760
8854
  color: tone.primary,
8761
8855
  children: `${n} `
8762
8856
  }),
8763
- /* @__PURE__ */ jsx17(Text15, {
8857
+ /* @__PURE__ */ jsx18(Text15, {
8764
8858
  children: what.padEnd(16)
8765
8859
  }),
8766
- /* @__PURE__ */ jsx17(Text15, {
8860
+ /* @__PURE__ */ jsx18(Text15, {
8767
8861
  dimColor: true,
8768
8862
  children: clip(how, interior - 19)
8769
8863
  })
8770
8864
  ]
8771
8865
  }, n)),
8772
- /* @__PURE__ */ jsx17(Blank, {}),
8866
+ /* @__PURE__ */ jsx18(Blank, {}),
8773
8867
  row("start", "", choice === "start"),
8774
8868
  row("skip, I know what I am doing", "yourskills login", choice === "skip")
8775
8869
  ]
8776
8870
  }),
8777
- /* @__PURE__ */ jsx17(Divider, {
8871
+ /* @__PURE__ */ jsx18(Divider, {
8778
8872
  width
8779
8873
  }),
8780
- /* @__PURE__ */ jsx17(Hints, {
8874
+ /* @__PURE__ */ jsx18(Hints, {
8781
8875
  hints: [
8782
8876
  ["enter", choice === "start" ? "start" : "skip"],
8783
8877
  ["esc", "skip"]
@@ -8788,7 +8882,7 @@ function WelcomeScreen({
8788
8882
  }
8789
8883
 
8790
8884
  // src/shell/screens/home.tsx
8791
- import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
8885
+ import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
8792
8886
  function failure(title, error) {
8793
8887
  const message = error instanceof Error ? error.message : String(error);
8794
8888
  return {
@@ -8832,25 +8926,25 @@ function AccountLine({ facts, width }) {
8832
8926
  children: [
8833
8927
  /* @__PURE__ */ jsxs16(Text16, {
8834
8928
  children: [
8835
- /* @__PURE__ */ jsx18(Text16, {
8929
+ /* @__PURE__ */ jsx19(Text16, {
8836
8930
  color: facts.signedIn ? "green" : tone.notice,
8837
8931
  children: facts.signedIn ? mark.ok : mark.fail
8838
8932
  }),
8839
- /* @__PURE__ */ jsx18(Text16, {
8933
+ /* @__PURE__ */ jsx19(Text16, {
8840
8934
  color: facts.signedIn ? undefined : tone.notice,
8841
8935
  children: ` ${clip(head, room - 2)}`
8842
8936
  }),
8843
- showOrg ? /* @__PURE__ */ jsx18(Text16, {
8937
+ showOrg ? /* @__PURE__ */ jsx19(Text16, {
8844
8938
  color: tone.primary,
8845
8939
  children: org
8846
8940
  }) : null,
8847
- showTail ? /* @__PURE__ */ jsx18(Text16, {
8941
+ showTail ? /* @__PURE__ */ jsx19(Text16, {
8848
8942
  dimColor: true,
8849
8943
  children: tail
8850
8944
  }) : null
8851
8945
  ]
8852
8946
  }),
8853
- /* @__PURE__ */ jsx18(Text16, {
8947
+ /* @__PURE__ */ jsx19(Text16, {
8854
8948
  dimColor: true,
8855
8949
  children: clip(right, inner - room)
8856
8950
  })
@@ -8859,9 +8953,9 @@ function AccountLine({ facts, width }) {
8859
8953
  }
8860
8954
  function StaleLine({ stale, width }) {
8861
8955
  const text = `${mark.ok} ${stale.latest} is out; you have ${stale.current}. type upgrade`;
8862
- return /* @__PURE__ */ jsx18(Box14, {
8956
+ return /* @__PURE__ */ jsx19(Box14, {
8863
8957
  width: width - FRAME_CHROME,
8864
- children: /* @__PURE__ */ jsx18(Text16, {
8958
+ children: /* @__PURE__ */ jsx19(Text16, {
8865
8959
  color: tone.notice,
8866
8960
  children: clip(text, width - FRAME_CHROME)
8867
8961
  })
@@ -8960,28 +9054,15 @@ function HomeScreen({
8960
9054
  };
8961
9055
  }, [facts.signedIn, connect, loadFeed, where, server]);
8962
9056
  const checkSession = useCallback3(async () => facts.signedIn, [facts.signedIn]);
8963
- const answering = useCallback3((title, working, load) => ({
8964
- kind: "report",
8965
- title,
8966
- working,
8967
- load: async () => {
8968
- try {
8969
- return await load();
8970
- } catch (error) {
8971
- return failure(title, error);
8972
- }
9057
+ const failing = useCallback3((title, error) => ({
9058
+ kind: "answer",
9059
+ working: "",
9060
+ answer: {
9061
+ kind: "report",
9062
+ title,
9063
+ load: async () => failure(title, error)
8973
9064
  }
8974
9065
  }), []);
8975
- const answeringRun = useCallback3((run) => run.kind === "stream" ? run : {
8976
- ...run,
8977
- report: async () => {
8978
- try {
8979
- return await run.report();
8980
- } catch (error) {
8981
- return failure(run.title, error);
8982
- }
8983
- }
8984
- }, []);
8985
9066
  const ctx = useMemo4(() => ({
8986
9067
  where,
8987
9068
  resite,
@@ -9011,20 +9092,9 @@ function HomeScreen({
9011
9092
  ...answer.tab ? { tab: answer.tab } : {},
9012
9093
  ...answer.query ? { query: answer.query } : {}
9013
9094
  };
9014
- case "text":
9015
- return answering(answer.title, plan, async () => ({
9016
- title: answer.title,
9017
- lines: [{ mark: "ok", text: answer.body }],
9018
- json: { ok: true }
9019
- }));
9020
- case "report":
9021
- return answering(answer.title, plan, answer.load);
9022
- case "rows":
9023
- return answering(answer.title, plan, async () => answer.report(await answer.load()));
9024
- case "stream":
9025
- return { kind: "run", run: answeringRun(answer.run) };
9026
9095
  }
9027
- }, [answering, answeringRun]);
9096
+ return { kind: "answer", answer, working: plan };
9097
+ }, []);
9028
9098
  const routeForCommand = useCallback3(async (command) => {
9029
9099
  if (command.kind === "error")
9030
9100
  return null;
@@ -9125,9 +9195,9 @@ function HomeScreen({
9125
9195
  if (next)
9126
9196
  setRoute(next);
9127
9197
  }).catch((error) => {
9128
- setRoute(answering(title, "", async () => failure(title, error)));
9198
+ setRoute(failing(title, error));
9129
9199
  });
9130
- }, [answering]);
9200
+ }, [failing]);
9131
9201
  const runText = useCallback3((text) => {
9132
9202
  const parsed = typedCommand(text);
9133
9203
  if (!runnable(parsed))
@@ -9218,7 +9288,7 @@ function HomeScreen({
9218
9288
  }, [onWelcomed]);
9219
9289
  const browseTab = route?.kind === "browse" ? route.tab : undefined;
9220
9290
  const browseQuery = route?.kind === "browse" ? route.query : undefined;
9221
- const browser = useCallback3((live) => /* @__PURE__ */ jsx18(BrowserScreen, {
9291
+ const browser = useCallback3((live) => /* @__PURE__ */ jsx19(BrowserScreen, {
9222
9292
  client: live,
9223
9293
  where,
9224
9294
  onError,
@@ -9227,6 +9297,14 @@ function HomeScreen({
9227
9297
  ...browseTab ? { initialTab: browseTab } : {},
9228
9298
  ...browseQuery ? { initialQuery: browseQuery } : {}
9229
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]);
9230
9308
  useInput8((input, key) => {
9231
9309
  if (key.upArrow) {
9232
9310
  setCursor((c) => Math.max(0, c - 1));
@@ -9252,48 +9330,29 @@ function HomeScreen({
9252
9330
  }
9253
9331
  }, { isActive: route === null && !welcome });
9254
9332
  if (welcome) {
9255
- return /* @__PURE__ */ jsx18(WelcomeScreen, {
9333
+ return /* @__PURE__ */ jsx19(WelcomeScreen, {
9256
9334
  agents: facts.agentsOnDisk,
9257
9335
  onStart: () => leaveWelcome(true),
9258
9336
  onSkip: () => leaveWelcome(false)
9259
9337
  });
9260
9338
  }
9261
9339
  if (route?.kind === "login") {
9262
- return /* @__PURE__ */ jsx18(LoginScreen, {
9340
+ return /* @__PURE__ */ jsx19(LoginScreen, {
9263
9341
  onError,
9264
9342
  onDone: afterLogin,
9265
9343
  onBack: back
9266
9344
  });
9267
9345
  }
9268
9346
  if (route?.kind === "keys") {
9269
- return /* @__PURE__ */ jsx18(KeysScreen, {
9347
+ return /* @__PURE__ */ jsx19(KeysScreen, {
9270
9348
  onBack: back
9271
9349
  });
9272
9350
  }
9273
- if (route?.kind === "report") {
9274
- return /* @__PURE__ */ jsx18(ReportScreen, {
9275
- title: route.title,
9276
- load: route.load,
9277
- working: route.working,
9278
- onError,
9279
- exitWhenDone: false,
9280
- onBack: back,
9281
- onNext: runText
9282
- });
9283
- }
9284
- if (route?.kind === "run") {
9285
- return /* @__PURE__ */ jsx18(RunScreen, {
9286
- run: route.run,
9287
- exitWhenDone: false,
9288
- onError,
9289
- onDone: onSummary,
9290
- onBack: back,
9291
- onNext: runText
9292
- });
9293
- }
9351
+ if (drawn)
9352
+ return drawn;
9294
9353
  if (route?.kind === "pick") {
9295
9354
  const picked = route;
9296
- return /* @__PURE__ */ jsx18(PickScreen, {
9355
+ return /* @__PURE__ */ jsx19(PickScreen, {
9297
9356
  title: picked.title,
9298
9357
  rows: picked.rows,
9299
9358
  empty: picked.empty,
@@ -9309,7 +9368,7 @@ function HomeScreen({
9309
9368
  }
9310
9369
  if (route?.kind === "ask") {
9311
9370
  const { spec } = route;
9312
- return /* @__PURE__ */ jsx18(ConfirmScreen, {
9371
+ return /* @__PURE__ */ jsx19(ConfirmScreen, {
9313
9372
  title: spec.title,
9314
9373
  headline: spec.headline,
9315
9374
  lines: spec.lines,
@@ -9317,12 +9376,16 @@ function HomeScreen({
9317
9376
  yes: spec.yes,
9318
9377
  no: spec.no,
9319
9378
  argv: spec.argv,
9320
- 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
+ }),
9321
9384
  onNo: back
9322
9385
  });
9323
9386
  }
9324
9387
  if (route?.kind === "browse") {
9325
- return /* @__PURE__ */ jsx18(AuthGate, {
9388
+ return /* @__PURE__ */ jsx19(AuthGate, {
9326
9389
  title: "browse",
9327
9390
  check: checkSession,
9328
9391
  connect,
@@ -9340,36 +9403,36 @@ function HomeScreen({
9340
9403
  title: "yourskills",
9341
9404
  width,
9342
9405
  children: [
9343
- /* @__PURE__ */ jsx18(AccountLine, {
9406
+ /* @__PURE__ */ jsx19(AccountLine, {
9344
9407
  facts: shown,
9345
9408
  width
9346
9409
  }),
9347
- stale ? /* @__PURE__ */ jsx18(StaleLine, {
9410
+ stale ? /* @__PURE__ */ jsx19(StaleLine, {
9348
9411
  stale,
9349
9412
  width
9350
9413
  }) : null,
9351
- /* @__PURE__ */ jsx18(Divider, {
9414
+ /* @__PURE__ */ jsx19(Divider, {
9352
9415
  width
9353
9416
  }),
9354
- /* @__PURE__ */ jsx18(CommandPalette, {
9417
+ /* @__PURE__ */ jsx19(CommandPalette, {
9355
9418
  groups: visible,
9356
9419
  query,
9357
9420
  cursor,
9358
9421
  width,
9359
9422
  emptyMessage: empty
9360
9423
  }),
9361
- /* @__PURE__ */ jsx18(Divider, {
9424
+ /* @__PURE__ */ jsx19(Divider, {
9362
9425
  width
9363
9426
  }),
9364
- /* @__PURE__ */ jsx18(Text16, {
9427
+ /* @__PURE__ */ jsx19(Text16, {
9365
9428
  dimColor: true,
9366
9429
  children: clip(description, width - FRAME_CHROME)
9367
9430
  }),
9368
- /* @__PURE__ */ jsx18(Text16, {
9431
+ /* @__PURE__ */ jsx19(Text16, {
9369
9432
  dimColor: true,
9370
9433
  children: found ? clip(` ${found}`, width - FRAME_CHROME) : " "
9371
9434
  }),
9372
- /* @__PURE__ */ jsx18(Hints, {
9435
+ /* @__PURE__ */ jsx19(Hints, {
9373
9436
  hints: [
9374
9437
  ["^v", "move"],
9375
9438
  ["tab", "complete"],
@@ -9382,7 +9445,7 @@ function HomeScreen({
9382
9445
  });
9383
9446
  }
9384
9447
  // src/drive.tsx
9385
- import { jsx as jsx19 } from "react/jsx-runtime";
9448
+ import { jsx as jsx20 } from "react/jsx-runtime";
9386
9449
  var liveChores = {
9387
9450
  sendUsage: flushQuietly,
9388
9451
  offerHooks: ensureHooksRegistered,
@@ -9457,7 +9520,7 @@ async function drawPlain(answer, output, io) {
9457
9520
  let code = EXIT.ok;
9458
9521
  const done = await plainRun(answer.run, (report) => {
9459
9522
  code = emit2(report, output, io);
9460
- });
9523
+ }, io);
9461
9524
  return "pending" in done ? landed(done) : code;
9462
9525
  }
9463
9526
  }
@@ -9465,7 +9528,7 @@ async function drawPlain(answer, output, io) {
9465
9528
  async function screenFor(command, ctx, resite, fail, exit) {
9466
9529
  const summarise = (summary) => exit.raise(landed(summary));
9467
9530
  const report = (result) => exit.raise(result.failed ? EXIT.failed : EXIT.ok);
9468
- const gate = (title, build) => /* @__PURE__ */ jsx19(AuthGate, {
9531
+ const gate = (title, build) => /* @__PURE__ */ jsx20(AuthGate, {
9469
9532
  title,
9470
9533
  build,
9471
9534
  connect: ctx.client,
@@ -9475,7 +9538,7 @@ async function screenFor(command, ctx, resite, fail, exit) {
9475
9538
  const { row, answer } = await answerFor(command, ctx);
9476
9539
  if (answer.kind === "home") {
9477
9540
  const reload = () => paletteFacts(ctx.where.scope, ctx.server);
9478
- return /* @__PURE__ */ jsx19(HomeScreen, {
9541
+ return /* @__PURE__ */ jsx20(HomeScreen, {
9479
9542
  where: ctx.where,
9480
9543
  resite,
9481
9544
  facts: await reload(),
@@ -9494,54 +9557,26 @@ async function screenFor(command, ctx, resite, fail, exit) {
9494
9557
  });
9495
9558
  }
9496
9559
  if (answer.kind === "login")
9497
- return /* @__PURE__ */ jsx19(LoginScreen, {
9560
+ return /* @__PURE__ */ jsx20(LoginScreen, {
9498
9561
  onError: fail
9499
9562
  });
9500
9563
  if (answer.kind === "browse")
9501
- return gate("browse", (client) => /* @__PURE__ */ jsx19(BrowserScreen, {
9564
+ return gate("browse", (client) => /* @__PURE__ */ jsx20(BrowserScreen, {
9502
9565
  client,
9503
9566
  where: ctx.where,
9504
9567
  onError: fail,
9505
9568
  onSummary: summarise
9506
9569
  }));
9507
- const drawn = drawInk(answer, fail, summarise, report);
9570
+ const drawn = drawInk(answer, {
9571
+ onError: fail,
9572
+ onSummary: summarise,
9573
+ onReport: report
9574
+ });
9508
9575
  return sessionFirst(row, answer) ? gate(answer.title, () => drawn) : drawn;
9509
9576
  }
9510
9577
  function sessionFirst(row, answer) {
9511
9578
  return answer.kind === "stream" ? answer.run.needsSession : row.needs === "session";
9512
9579
  }
9513
- function drawInk(answer, fail, summarise, report) {
9514
- switch (answer.kind) {
9515
- case "text":
9516
- return answer.style === "document" ? /* @__PURE__ */ jsx19(HelpScreen, {
9517
- text: answer.body
9518
- }) : /* @__PURE__ */ jsx19(NoticeScreen, {
9519
- title: answer.title,
9520
- message: answer.body
9521
- });
9522
- case "report":
9523
- return /* @__PURE__ */ jsx19(ReportScreen, {
9524
- title: answer.title,
9525
- load: answer.load,
9526
- onError: fail,
9527
- onReport: report,
9528
- ...answer.working ? { working: answer.working } : {}
9529
- });
9530
- case "rows":
9531
- return /* @__PURE__ */ jsx19(CatalogScreen, {
9532
- title: answer.title,
9533
- load: async () => toRows(await answer.load()),
9534
- onError: fail
9535
- });
9536
- case "stream":
9537
- return /* @__PURE__ */ jsx19(RunScreen, {
9538
- run: answer.run,
9539
- onError: fail,
9540
- onDone: summarise,
9541
- onReport: report
9542
- });
9543
- }
9544
- }
9545
9580
  async function runInk(command, ctx, resite, io, exit) {
9546
9581
  let failure = null;
9547
9582
  let frame = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yourskills",
3
- "version": "0.4.2",
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",