terminal-pilot 0.0.20 → 0.0.21

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.
@@ -206,11 +206,11 @@ function resolveAgentSupport(input, registry = agentSkillConfigs) {
206
206
  if (!resolvedId) {
207
207
  return { status: "unknown", input };
208
208
  }
209
- const config = registry[resolvedId];
210
- if (!config) {
209
+ const config2 = registry[resolvedId];
210
+ if (!config2) {
211
211
  return { status: "unsupported", input, id: resolvedId };
212
212
  }
213
- return { status: "supported", input, id: resolvedId, config: { ...config } };
213
+ return { status: "supported", input, id: resolvedId, config: { ...config2 } };
214
214
  }
215
215
 
216
216
  // ../config-mutations/src/mutations/file-mutation.ts
@@ -307,7 +307,7 @@ var templateMutation = {
307
307
  // ../config-mutations/src/execution/apply-mutation.ts
308
308
  import path3 from "node:path";
309
309
 
310
- // ../design-system/src/internal/color-support.ts
310
+ // ../toolcraft-design/src/internal/color-support.ts
311
311
  function supportsColor(env = process.env, stream = process.stdout) {
312
312
  if (env.FORCE_COLOR !== void 0 && env.FORCE_COLOR !== "0") {
313
313
  return true;
@@ -321,7 +321,7 @@ function supportsColor(env = process.env, stream = process.stdout) {
321
321
  return typeof env.TERM === "string" && env.TERM.length > 0 && env.TERM !== "dumb";
322
322
  }
323
323
 
324
- // ../design-system/src/components/color.ts
324
+ // ../toolcraft-design/src/components/color.ts
325
325
  var reset = "\x1B[0m";
326
326
  var ansiStyles = {
327
327
  reset: { open: reset },
@@ -423,41 +423,122 @@ function createColor(styles = []) {
423
423
  }
424
424
  var color = createColor();
425
425
 
426
- // ../design-system/src/tokens/colors.ts
427
- var dark = {
428
- header: (text4) => color.magentaBright.bold(text4),
429
- divider: (text4) => color.dim(text4),
430
- prompt: (text4) => color.cyan(text4),
431
- number: (text4) => color.cyanBright(text4),
432
- intro: (text4) => color.bgMagenta.white(` Poe - ${text4} `),
433
- resolvedSymbol: color.magenta("\u25C7"),
434
- errorSymbol: color.red("\u25A0"),
435
- accent: (text4) => color.cyan(text4),
436
- muted: (text4) => color.dim(text4),
437
- success: (text4) => color.green(text4),
438
- warning: (text4) => color.yellow(text4),
439
- error: (text4) => color.red(text4),
440
- info: (text4) => color.magenta(text4),
441
- badge: (text4) => color.bgYellow.black(` ${text4} `)
426
+ // ../toolcraft-design/src/tokens/brand.ts
427
+ var brands = {
428
+ purple: { name: "purple", primary: "#a200ff" },
429
+ blue: { name: "blue", primary: "#2f6fed" },
430
+ green: { name: "green", primary: "#1f9d57" }
442
431
  };
443
- var light = {
444
- header: (text4) => color.hex("#a200ff").bold(text4),
445
- divider: (text4) => color.hex("#666666")(text4),
446
- prompt: (text4) => color.hex("#006699").bold(text4),
447
- number: (text4) => color.hex("#0077cc").bold(text4),
448
- intro: (text4) => color.bgHex("#a200ff").white(` Poe - ${text4} `),
449
- resolvedSymbol: color.hex("#a200ff")("\u25C7"),
450
- errorSymbol: color.hex("#cc0000")("\u25A0"),
451
- accent: (text4) => color.hex("#006699").bold(text4),
452
- muted: (text4) => color.hex("#666666")(text4),
453
- success: (text4) => color.hex("#008800")(text4),
454
- warning: (text4) => color.hex("#cc6600")(text4),
455
- error: (text4) => color.hex("#cc0000")(text4),
456
- info: (text4) => color.hex("#a200ff")(text4),
457
- badge: (text4) => color.bgHex("#cc6600").white(` ${text4} `)
432
+
433
+ // ../toolcraft-design/src/internal/theme-state.ts
434
+ var defaults = {
435
+ brand: "purple",
436
+ label: "Poe"
458
437
  };
438
+ var config = { ...defaults };
439
+ var revision = 0;
440
+ var brandConfigured = false;
441
+ function getThemeConfig() {
442
+ return { ...config };
443
+ }
444
+ function getThemeRevision() {
445
+ return revision;
446
+ }
447
+ function isThemeBrandConfigured() {
448
+ return brandConfigured;
449
+ }
459
450
 
460
- // ../design-system/src/internal/output-format.ts
451
+ // ../toolcraft-design/src/tokens/colors.ts
452
+ var brand = brands.purple.primary;
453
+ function withStyles(palette, styles) {
454
+ return Object.defineProperty(palette, "styles", {
455
+ value: styles,
456
+ enumerable: false
457
+ });
458
+ }
459
+ function brandColor(activeBrand, purple) {
460
+ return activeBrand.name === "purple" ? purple : color.hex(activeBrand.primary);
461
+ }
462
+ function brandBackground(activeBrand, purple) {
463
+ return activeBrand.name === "purple" ? purple : color.bgHex(activeBrand.primary);
464
+ }
465
+ function createPalette(activeBrand, mode) {
466
+ const isPurple = activeBrand.name === "purple";
467
+ if (mode === "light") {
468
+ const active2 = color.hex(activeBrand.primary);
469
+ const prompt2 = isPurple ? color.hex("#006699") : active2;
470
+ const number2 = isPurple ? color.hex("#0077cc") : active2;
471
+ return withStyles(
472
+ {
473
+ header: (text4) => active2.bold(text4),
474
+ divider: (text4) => color.hex("#666666")(text4),
475
+ prompt: (text4) => prompt2.bold(text4),
476
+ number: (text4) => number2.bold(text4),
477
+ intro: (text4) => color.bgHex(activeBrand.primary).white(` ${getThemeConfig().label} - ${text4} `),
478
+ get resolvedSymbol() {
479
+ return active2("\u25C7");
480
+ },
481
+ get errorSymbol() {
482
+ return color.hex("#cc0000")("\u25A0");
483
+ },
484
+ accent: (text4) => prompt2.bold(text4),
485
+ muted: (text4) => color.hex("#666666")(text4),
486
+ success: (text4) => color.hex("#008800")(text4),
487
+ warning: (text4) => color.hex("#cc6600")(text4),
488
+ error: (text4) => color.hex("#cc0000")(text4),
489
+ info: (text4) => active2(text4),
490
+ badge: (text4) => color.bgHex("#cc6600").white(` ${text4} `)
491
+ },
492
+ {
493
+ accent: { fg: isPurple ? "#006699" : activeBrand.primary, bold: true },
494
+ muted: { fg: "#666666" },
495
+ success: { fg: "#008800" },
496
+ warning: { fg: "#cc6600" },
497
+ error: { fg: "#cc0000" },
498
+ info: { fg: activeBrand.primary }
499
+ }
500
+ );
501
+ }
502
+ const active = brandColor(activeBrand, color.magenta);
503
+ const activeBright = brandColor(activeBrand, color.magentaBright);
504
+ const activeBackground = brandBackground(activeBrand, color.bgMagenta);
505
+ const prompt = isPurple ? color.cyan : active;
506
+ const number = isPurple ? color.cyanBright : active;
507
+ return withStyles(
508
+ {
509
+ header: (text4) => activeBright.bold(text4),
510
+ divider: (text4) => color.dim(text4),
511
+ prompt: (text4) => prompt(text4),
512
+ number: (text4) => number(text4),
513
+ intro: (text4) => activeBackground.white(` ${getThemeConfig().label} - ${text4} `),
514
+ get resolvedSymbol() {
515
+ return active("\u25C7");
516
+ },
517
+ get errorSymbol() {
518
+ return color.red("\u25A0");
519
+ },
520
+ accent: (text4) => prompt(text4),
521
+ muted: (text4) => color.dim(text4),
522
+ success: (text4) => color.green(text4),
523
+ warning: (text4) => color.yellow(text4),
524
+ error: (text4) => color.red(text4),
525
+ info: (text4) => active(text4),
526
+ badge: (text4) => color.bgYellow.black(` ${text4} `)
527
+ },
528
+ {
529
+ accent: { fg: isPurple ? "cyan" : activeBrand.primary, bold: true },
530
+ muted: { dim: true },
531
+ success: { fg: "green" },
532
+ warning: { fg: "yellow" },
533
+ error: { fg: "red" },
534
+ info: { fg: isPurple ? "magenta" : activeBrand.primary }
535
+ }
536
+ );
537
+ }
538
+ var dark = createPalette(brands.purple, "dark");
539
+ var light = createPalette(brands.purple, "light");
540
+
541
+ // ../toolcraft-design/src/internal/output-format.ts
461
542
  import { AsyncLocalStorage } from "node:async_hooks";
462
543
  var VALID_FORMATS = /* @__PURE__ */ new Set(["terminal", "markdown", "json"]);
463
544
  var formatStorage = new AsyncLocalStorage();
@@ -475,7 +556,7 @@ function resolveOutputFormat(env = process.env) {
475
556
  return cached;
476
557
  }
477
558
 
478
- // ../design-system/src/internal/theme-detect.ts
559
+ // ../toolcraft-design/src/internal/theme-detect.ts
479
560
  function detectThemeFromEnv(env) {
480
561
  const apple = env.APPLE_INTERFACE_STYLE;
481
562
  if (typeof apple === "string") {
@@ -512,17 +593,30 @@ function resolveThemeName(env = process.env) {
512
593
  }
513
594
  return "dark";
514
595
  }
515
- var cachedTheme;
596
+ var themeCache = /* @__PURE__ */ new Map();
597
+ var cachedRevision = -1;
516
598
  function getTheme(env) {
599
+ const themeName = resolveThemeName(env);
600
+ const config2 = getThemeConfig();
601
+ const requestedBrand = env?.POE_BRAND?.toLowerCase();
602
+ const activeBrandName = !isThemeBrandConfigured() && requestedBrand && Object.hasOwn(brands, requestedBrand) ? requestedBrand : config2.brand;
603
+ const revision2 = getThemeRevision();
604
+ if (revision2 !== cachedRevision) {
605
+ themeCache.clear();
606
+ cachedRevision = revision2;
607
+ }
608
+ const cacheKey = `${activeBrandName}:${themeName}`;
609
+ const cachedTheme = themeCache.get(cacheKey);
517
610
  if (cachedTheme) {
518
611
  return cachedTheme;
519
612
  }
520
- const themeName = resolveThemeName(env);
521
- cachedTheme = themeName === "light" ? light : dark;
522
- return cachedTheme;
613
+ const activeBrand = brands[activeBrandName];
614
+ const theme = activeBrandName === "purple" ? themeName === "light" ? light : dark : createPalette(activeBrand, themeName);
615
+ themeCache.set(cacheKey, theme);
616
+ return theme;
523
617
  }
524
618
 
525
- // ../design-system/src/components/symbols.ts
619
+ // ../toolcraft-design/src/components/symbols.ts
526
620
  var symbols = {
527
621
  get info() {
528
622
  const format = resolveOutputFormat();
@@ -576,12 +670,12 @@ var symbols = {
576
670
  }
577
671
  };
578
672
 
579
- // ../design-system/src/internal/strip-ansi.ts
673
+ // ../toolcraft-design/src/internal/strip-ansi.ts
580
674
  function stripAnsi(value) {
581
675
  return value.replace(/\u001b\[[0-9;]*m/g, "");
582
676
  }
583
677
 
584
- // ../design-system/src/prompts/primitives/log.ts
678
+ // ../toolcraft-design/src/prompts/primitives/log.ts
585
679
  function renderMarkdownInline(value) {
586
680
  return stripAnsi(value).replaceAll("\r\n", " ").replaceAll("\n", " ").replaceAll("\r", " ");
587
681
  }
@@ -708,7 +802,7 @@ var log = {
708
802
  error
709
803
  };
710
804
 
711
- // ../design-system/src/components/logger.ts
805
+ // ../toolcraft-design/src/components/logger.ts
712
806
  function createLogger(emitter) {
713
807
  const emit = (level, message2) => {
714
808
  if (emitter) {
@@ -769,13 +863,13 @@ function createLogger(emitter) {
769
863
  }
770
864
  var logger = createLogger();
771
865
 
772
- // ../design-system/src/components/help-formatter.ts
866
+ // ../toolcraft-design/src/components/help-formatter.ts
773
867
  var graphemeSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
774
868
 
775
- // ../design-system/src/components/table.ts
869
+ // ../toolcraft-design/src/components/table.ts
776
870
  var graphemeSegmenter2 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
777
871
 
778
- // ../design-system/src/components/template.ts
872
+ // ../toolcraft-design/src/components/template.ts
779
873
  var MAX_PARTIAL_DEPTH = 100;
780
874
  var HTML_ESCAPE = {
781
875
  "&": "&",
@@ -1187,22 +1281,22 @@ function hasProperty(value, key) {
1187
1281
  return Object.prototype.hasOwnProperty.call(value, key);
1188
1282
  }
1189
1283
 
1190
- // ../design-system/src/components/browser.ts
1284
+ // ../toolcraft-design/src/components/browser.ts
1191
1285
  import { spawn } from "node:child_process";
1192
1286
  import process2 from "node:process";
1193
1287
 
1194
- // ../design-system/src/acp/writer.ts
1288
+ // ../toolcraft-design/src/acp/writer.ts
1195
1289
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
1196
1290
  var storage = new AsyncLocalStorage2();
1197
1291
 
1198
- // ../design-system/src/dashboard/terminal-width.ts
1292
+ // ../toolcraft-design/src/dashboard/terminal-width.ts
1199
1293
  var graphemeSegmenter3 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
1200
1294
 
1201
- // ../design-system/src/dashboard/terminal.ts
1295
+ // ../toolcraft-design/src/dashboard/terminal.ts
1202
1296
  import readline from "node:readline";
1203
1297
  import { PassThrough } from "node:stream";
1204
1298
 
1205
- // ../design-system/src/explorer/state.ts
1299
+ // ../toolcraft-design/src/explorer/state.ts
1206
1300
  var REGION_HEADER = 1 << 0;
1207
1301
  var REGION_LIST = 1 << 1;
1208
1302
  var REGION_DETAIL = 1 << 2;
@@ -1211,13 +1305,13 @@ var REGION_MODAL = 1 << 4;
1211
1305
  var REGION_TOAST = 1 << 5;
1212
1306
  var REGION_ALL = REGION_HEADER | REGION_LIST | REGION_DETAIL | REGION_FOOTER | REGION_MODAL | REGION_TOAST;
1213
1307
 
1214
- // ../design-system/src/prompts/index.ts
1308
+ // ../toolcraft-design/src/prompts/index.ts
1215
1309
  import * as clack from "@clack/prompts";
1216
1310
 
1217
- // ../design-system/src/prompts/primitives/cancel.ts
1311
+ // ../toolcraft-design/src/prompts/primitives/cancel.ts
1218
1312
  import { isCancel } from "@clack/prompts";
1219
1313
 
1220
- // ../design-system/src/static/spinner.ts
1314
+ // ../toolcraft-design/src/static/spinner.ts
1221
1315
  var SPINNER_FRAMES = Object.freeze(["\u25D2", "\u25D0", "\u25D3", "\u25D1"]);
1222
1316
 
1223
1317
  // ../config-mutations/src/formats/json.ts
@@ -2451,14 +2545,14 @@ async function installSkill(agentId, skill, options) {
2451
2545
  throw new UnsupportedAgentError(agentId);
2452
2546
  }
2453
2547
  const scope = options.scope ?? "local";
2454
- const config = support.config;
2548
+ const config2 = support.config;
2455
2549
  if (skill.name.length === 0 || skill.name === "." || skill.name === ".." || skill.name.includes("/") || skill.name.includes("\\") || skill.name.includes("\n") || skill.name.includes("\r")) {
2456
2550
  throw new Error(`Invalid skill name: ${skill.name}`);
2457
2551
  }
2458
- const skillDir = scope === "global" ? config.globalSkillDir : toHomeRelative(config.localSkillDir);
2552
+ const skillDir = scope === "global" ? config2.globalSkillDir : toHomeRelative(config2.localSkillDir);
2459
2553
  const skillFolderPath = `${skillDir}/${skill.name}`;
2460
2554
  const skillFilePath = `${skillFolderPath}/SKILL.md`;
2461
- const displayPath = `${scope === "global" ? config.globalSkillDir : config.localSkillDir}/${skill.name}/SKILL.md`;
2555
+ const displayPath = `${scope === "global" ? config2.globalSkillDir : config2.localSkillDir}/${skill.name}/SKILL.md`;
2462
2556
  const absoluteSkillPath = `${scope === "global" ? options.homeDir : options.cwd}/${skillFilePath.slice(2)}`;
2463
2557
  if (await pathExists2(options.fs, absoluteSkillPath)) {
2464
2558
  throw new Error(`Skill already exists: ${displayPath}`);
@@ -2517,19 +2611,19 @@ var UserError = class extends Error {
2517
2611
  };
2518
2612
 
2519
2613
  // ../toolcraft/src/human-in-loop/config.ts
2520
- function validateHumanInLoopOnDefine(config) {
2521
- const label = Array.isArray(config.children) ? "group" : "command";
2522
- if (config.confirm === true && config.humanInLoop !== void 0 && config.humanInLoop !== null) {
2523
- throw new Error(`${label} '${config.name}': use either confirm or humanInLoop, not both`);
2614
+ function validateHumanInLoopOnDefine(config2) {
2615
+ const label = Array.isArray(config2.children) ? "group" : "command";
2616
+ if (config2.confirm === true && config2.humanInLoop !== void 0 && config2.humanInLoop !== null) {
2617
+ throw new Error(`${label} '${config2.name}': use either confirm or humanInLoop, not both`);
2524
2618
  }
2525
- if (config.humanInLoop === void 0 || config.humanInLoop === null) {
2619
+ if (config2.humanInLoop === void 0 || config2.humanInLoop === null) {
2526
2620
  return;
2527
2621
  }
2528
- if (config.humanInLoop.mode !== "sync" && config.humanInLoop.mode !== "async") {
2529
- throw new Error(`${label} '${config.name}': humanInLoop.mode must be "sync" or "async"`);
2622
+ if (config2.humanInLoop.mode !== "sync" && config2.humanInLoop.mode !== "async") {
2623
+ throw new Error(`${label} '${config2.name}': humanInLoop.mode must be "sync" or "async"`);
2530
2624
  }
2531
- if (typeof config.humanInLoop.message !== "function") {
2532
- throw new Error(`${label} '${config.name}': humanInLoop.message must be a function`);
2625
+ if (typeof config2.humanInLoop.message !== "function") {
2626
+ throw new Error(`${label} '${config2.name}': humanInLoop.message must be a function`);
2533
2627
  }
2534
2628
  }
2535
2629
  function mergeHumanInLoopFromGroup(groupHumanInLoop, childHumanInLoop) {
@@ -2559,12 +2653,12 @@ function assertValidBranches(branches, discriminator) {
2559
2653
  }
2560
2654
  }
2561
2655
  }
2562
- function OneOf(config) {
2563
- assertValidBranches(config.branches, config.discriminator);
2656
+ function OneOf(config2) {
2657
+ assertValidBranches(config2.branches, config2.discriminator);
2564
2658
  return {
2565
2659
  kind: "oneOf",
2566
- discriminator: config.discriminator,
2567
- branches: config.branches
2660
+ discriminator: config2.discriminator,
2661
+ branches: config2.branches
2568
2662
  };
2569
2663
  }
2570
2664
 
@@ -2844,28 +2938,28 @@ function mergeSecrets(parent, child) {
2844
2938
  function resolveCommandScope(ownScope, inheritedScope) {
2845
2939
  return cloneScope(ownScope ?? inheritedScope) ?? ["cli", "sdk"];
2846
2940
  }
2847
- function createBaseCommand(config) {
2941
+ function createBaseCommand(config2) {
2848
2942
  const command = {
2849
2943
  kind: "command",
2850
- name: config.name,
2851
- description: config.description,
2852
- aliases: [...config.aliases ?? []],
2853
- positional: [...config.positional ?? []],
2854
- params: config.params,
2855
- secrets: cloneSecrets(config.secrets),
2856
- scope: resolveCommandScope(config.scope, void 0),
2857
- confirm: config.confirm ?? false,
2858
- humanInLoop: config.humanInLoop,
2859
- requires: cloneRequires(config.requires),
2860
- handler: config.handler,
2861
- render: config.render
2944
+ name: config2.name,
2945
+ description: config2.description,
2946
+ aliases: [...config2.aliases ?? []],
2947
+ positional: [...config2.positional ?? []],
2948
+ params: config2.params,
2949
+ secrets: cloneSecrets(config2.secrets),
2950
+ scope: resolveCommandScope(config2.scope, void 0),
2951
+ confirm: config2.confirm ?? false,
2952
+ humanInLoop: config2.humanInLoop,
2953
+ requires: cloneRequires(config2.requires),
2954
+ handler: config2.handler,
2955
+ render: config2.render
2862
2956
  };
2863
2957
  Object.defineProperty(command, commandConfigSymbol, {
2864
2958
  value: {
2865
- scope: cloneScope(config.scope),
2866
- humanInLoop: config.humanInLoop,
2867
- secrets: cloneSecrets(config.secrets),
2868
- requires: cloneRequires(config.requires),
2959
+ scope: cloneScope(config2.scope),
2960
+ humanInLoop: config2.humanInLoop,
2961
+ secrets: cloneSecrets(config2.secrets),
2962
+ requires: cloneRequires(config2.requires),
2869
2963
  sourcePath: inferCommandSourcePath()
2870
2964
  }
2871
2965
  });
@@ -2905,10 +2999,10 @@ function materializeCommand(command, inherited) {
2905
2999
  });
2906
3000
  return materialized;
2907
3001
  }
2908
- function defineCommand(config) {
2909
- validateHumanInLoopOnDefine(config);
3002
+ function defineCommand(config2) {
3003
+ validateHumanInLoopOnDefine(config2);
2910
3004
  return materializeCommand(
2911
- createBaseCommand(config),
3005
+ createBaseCommand(config2),
2912
3006
  {
2913
3007
  scope: void 0,
2914
3008
  humanInLoop: void 0,