@ai-ecoverse/slicc-spectrum 1.36.0 → 1.37.0

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/slicc-ui.js CHANGED
@@ -10682,9 +10682,8 @@ var SliccNetwork = class extends ModelElement {
10682
10682
  margin: 0 auto;
10683
10683
  box-sizing: border-box;
10684
10684
  }
10685
- .page:focus-visible {
10686
- outline: var(--swc-focus-indicator-thickness) solid var(--swc-focus-indicator-color);
10687
- outline-offset: calc(-1 * var(--swc-focus-indicator-thickness));
10685
+ .page:focus {
10686
+ outline: none;
10688
10687
  }
10689
10688
  section {
10690
10689
  display: grid;
@@ -14498,6 +14497,7 @@ e25("swc-progress-bar", o56);
14498
14497
  var states = {
14499
14498
  current: ["neutral", "Up to date"],
14500
14499
  queued: ["neutral", "Waiting"],
14500
+ starting: ["info", "Starting"],
14501
14501
  checking: ["info", "Checking"],
14502
14502
  downloading: ["info", "Downloading"],
14503
14503
  linking: ["info", "Linking"],
@@ -14528,7 +14528,7 @@ function updatesStatus(items) {
14528
14528
  if (items.some((item2) => item2.state === "ready" || item2.state === "available")) {
14529
14529
  return "update ready";
14530
14530
  }
14531
- return null;
14531
+ return items.some((item2) => item2.state === "starting") ? "starting" : null;
14532
14532
  }
14533
14533
  var UpdateVisibility = class {
14534
14534
  #boot;
@@ -14579,9 +14579,8 @@ var SliccUpdates = class extends ModelElement {
14579
14579
  padding: var(--swc-spacing-400);
14580
14580
  margin: 0 auto;
14581
14581
  }
14582
- .page:focus-visible {
14583
- outline: var(--swc-focus-indicator-thickness) solid var(--swc-focus-indicator-color);
14584
- outline-offset: calc(-1 * var(--swc-focus-indicator-thickness));
14582
+ .page:focus {
14583
+ outline: none;
14585
14584
  }
14586
14585
  .hint {
14587
14586
  margin: 0 0 var(--swc-spacing-300);
@@ -14733,7 +14732,7 @@ var SliccUpdates = class extends ModelElement {
14733
14732
  accessible-label=${`${item2.label}: ${progress.phase === "download" ? "downloading" : "linking"}`}
14734
14733
  ></swc-progress-bar>`;
14735
14734
  }
14736
- if (!running.has(item2.state)) return A;
14735
+ if (!running.has(item2.state) && item2.state !== "starting") return A;
14737
14736
  return b`<swc-progress-bar
14738
14737
  size="s"
14739
14738
  indeterminate
@@ -14772,7 +14771,7 @@ var SliccUpdates = class extends ModelElement {
14772
14771
  </div>
14773
14772
  <div class="meta">
14774
14773
  <span class="version">${item2.from ?? "Not installed"}${item2.to && item2.to !== item2.from ? b` → ${item2.to}` : A}</span>
14775
- ${this.#checked(item2.checkedAt)}
14774
+ ${item2.state === "starting" ? A : this.#checked(item2.checkedAt)}
14776
14775
  </div>
14777
14776
  ${this.#progress(item2)}
14778
14777
  ${error ? b`<div class="error" role="alert">
@@ -14818,6 +14817,7 @@ function railCapacity(width, count) {
14818
14817
  function updatesVariant(status2) {
14819
14818
  if (status2.endsWith("failed")) return "negative";
14820
14819
  if (status2.startsWith("updating")) return "info";
14820
+ if (status2 === "starting") return "neutral";
14821
14821
  return "notice";
14822
14822
  }
14823
14823
  var overscrollLocks = /* @__PURE__ */ new WeakMap();
@@ -16803,14 +16803,29 @@ function groups(changes) {
16803
16803
  }
16804
16804
  return [...byRepo];
16805
16805
  }
16806
+ function commands(text2) {
16807
+ const parts2 = text2.split("`").map((part2, index) => index % 2 ? { code: part2 } : part2);
16808
+ if (parts2.length % 2 === 0) return { parts: [text2], codes: [] };
16809
+ const codes = parts2.flatMap(
16810
+ (part2) => typeof part2 === "string" || !part2.code ? [] : [part2.code]
16811
+ );
16812
+ return { parts: parts2, codes: [...new Set(codes)] };
16813
+ }
16806
16814
  function errorLine(error) {
16807
16815
  return b`<div class="error" role="status" aria-live="polite">${error ? b`<swc-icon-alert-diamond size="s" aria-hidden="true"></swc-icon-alert-diamond><span>${error}</span>` : A}</div>`;
16808
16816
  }
16809
16817
  var SliccChanges = class extends ModelElement {
16810
- static properties = { ...ModelElement.properties, error: { state: true } };
16818
+ static properties = {
16819
+ ...ModelElement.properties,
16820
+ error: { state: true },
16821
+ copied: { state: true },
16822
+ uncopied: { state: true }
16823
+ };
16811
16824
  constructor() {
16812
16825
  super();
16813
16826
  this.error = "";
16827
+ this.copied = "";
16828
+ this.uncopied = false;
16814
16829
  }
16815
16830
  static styles = [
16816
16831
  shared,
@@ -16829,6 +16844,36 @@ var SliccChanges = class extends ModelElement {
16829
16844
  padding: 0;
16830
16845
  overflow: visible;
16831
16846
  }
16847
+ .unavailable {
16848
+ display: grid;
16849
+ gap: var(--swc-spacing-200);
16850
+ align-content: start;
16851
+ padding: var(--swc-spacing-300);
16852
+ overflow-y: auto;
16853
+ color: var(--swc-neutral-subdued-content-color-default);
16854
+ }
16855
+ .unavailable p {
16856
+ margin: 0;
16857
+ }
16858
+ .command {
16859
+ display: flex;
16860
+ align-items: center;
16861
+ gap: var(--swc-spacing-100);
16862
+ padding: var(--swc-spacing-75) var(--swc-spacing-75) var(--swc-spacing-75) var(--swc-spacing-200);
16863
+ border-radius: var(--swc-corner-radius-medium-default);
16864
+ background: var(--swc-background-layer-1-color);
16865
+ }
16866
+ code {
16867
+ overflow-wrap: anywhere;
16868
+ font-family: var(--swc-code-font-family-stack);
16869
+ font-size: var(--swc-font-size-75);
16870
+ color: var(--swc-code-color);
16871
+ }
16872
+ .command code {
16873
+ flex: 1;
16874
+ min-width: 0;
16875
+ user-select: all;
16876
+ }
16832
16877
  .repo {
16833
16878
  display: flex;
16834
16879
  gap: var(--swc-spacing-100);
@@ -16989,10 +17034,35 @@ var SliccChanges = class extends ModelElement {
16989
17034
  </li>`
16990
17035
  )}</ul>`;
16991
17036
  }
17037
+ async copy(code2) {
17038
+ try {
17039
+ await globalThis.navigator.clipboard.writeText(code2);
17040
+ this.copied = code2;
17041
+ this.uncopied = false;
17042
+ } catch {
17043
+ this.copied = "";
17044
+ this.uncopied = true;
17045
+ }
17046
+ }
17047
+ #unavailable(text2) {
17048
+ const { parts: parts2, codes } = commands(text2);
17049
+ return b`<div class="unavailable">
17050
+ <p data-unavailable>${parts2.map((part2) => typeof part2 === "string" ? part2 : b`<code>${part2.code}</code>`)}</p>
17051
+ ${codes.map(
17052
+ (code2) => b`<div class="command" data-command=${code2}>
17053
+ <code>${code2}</code>
17054
+ <swc-action-button size="s" quiet data-action="copy-command" accessible-label=${this.copied === code2 ? "Copied" : `Copy ${code2}`} @click=${() => this.copy(code2)}>
17055
+ <swc-icon-copy slot="icon"></swc-icon-copy>${this.copied === code2 ? "Copied" : "Copy"}
17056
+ </swc-action-button>
17057
+ </div>`
17058
+ )}
17059
+ ${this.uncopied ? b`<div class="error" role="alert" data-error="copy"><swc-icon-alert-diamond size="s" aria-hidden="true"></swc-icon-alert-diamond><span>Couldn’t copy. Select the command and copy it.</span></div>` : A}
17060
+ </div>`;
17061
+ }
16992
17062
  render() {
16993
17063
  const port = this.model ? changesOf(this.model) : null;
16994
17064
  const unavailable = port?.unavailable?.() ?? null;
16995
- if (unavailable) return b`<div class="note" data-unavailable>${unavailable}</div>`;
17065
+ if (unavailable) return this.#unavailable(unavailable);
16996
17066
  const changes = port?.changes() ?? [];
16997
17067
  return b`<div class="bar">
16998
17068
  <span>${changes.length} pending ${changes.length === 1 ? "change" : "changes"}</span>
@@ -19758,12 +19828,15 @@ function tool(call, color = "light") {
19758
19828
  const kind = toolKind(call.name);
19759
19829
  return b`<details class="tool" data-status=${call.status} data-tool=${call.name} data-kind=${kind.id}>
19760
19830
  <summary>
19761
- <swc-icon-chevron-right class="chevron" size="s" aria-hidden="true"></swc-icon-chevron-right>
19762
- <span class="kind">${kind.icon}</span>
19763
- <span class="title">${call.title}</span>
19764
- <span class="name">${call.name}</span>
19765
- ${call.meta ? b`<span class="tool-meta">${call.meta}</span>` : A}
19766
- ${state(call.status)}
19831
+ <span class="head">
19832
+ <swc-icon-chevron-right class="chevron" size="s" aria-hidden="true"></swc-icon-chevron-right>
19833
+ <span class="kind">${kind.icon}</span>
19834
+ <span class="title">${call.title}</span>
19835
+ <span class="name">${call.name}</span>
19836
+ ${call.meta ? b`<span class="tool-meta">${call.meta}</span>` : A}
19837
+ ${state(call.status)}
19838
+ </span>
19839
+ ${call.image ? b`<span class="thumb"><img src=${call.image} alt="" /></span>` : A}
19767
19840
  </summary>
19768
19841
  <div class="call">
19769
19842
  ${body(call, color)}
@@ -20315,6 +20388,18 @@ var messageCss = i`
20315
20388
  :is(details.tool, details.cluster) > summary {
20316
20389
  padding-inline: var(--swc-spacing-100);
20317
20390
  }
20391
+ details.tool > summary {
20392
+ flex-direction: column;
20393
+ align-items: stretch;
20394
+ justify-content: center;
20395
+ gap: 0;
20396
+ }
20397
+ details.tool > summary > .head {
20398
+ display: flex;
20399
+ align-items: center;
20400
+ gap: var(--swc-spacing-100);
20401
+ min-inline-size: 0;
20402
+ }
20318
20403
  :is(details.tool, details.cluster) > summary:hover {
20319
20404
  background: var(--swc-gray-100);
20320
20405
  }
@@ -20432,6 +20517,19 @@ var messageCss = i`
20432
20517
  white-space: pre-wrap;
20433
20518
  overflow-wrap: anywhere;
20434
20519
  }
20520
+ .thumb {
20521
+ padding-inline-start: calc(var(--swc-spacing-100) + var(--swc-spacing-300));
20522
+ padding-block: var(--swc-spacing-75);
20523
+ }
20524
+ .thumb img {
20525
+ display: block;
20526
+ max-inline-size: min(100%, calc(var(--swc-spacing-1000) * 2));
20527
+ max-block-size: calc(var(--swc-spacing-1000) * 1.25);
20528
+ border-radius: var(--swc-corner-radius-75);
20529
+ }
20530
+ details[open] > summary .thumb {
20531
+ display: none;
20532
+ }
20435
20533
  .shot {
20436
20534
  display: block;
20437
20535
  max-inline-size: min(100%, calc(var(--swc-spacing-1000) * 5));
@@ -21906,9 +22004,9 @@ e25("swc-icon-clock", o70);
21906
22004
  // src/app/composer.ts
21907
22005
  var limit = 25 * 1024 * 1024;
21908
22006
  function available(model) {
21909
- return commands.filter((command2) => command2.available?.(model) ?? true);
22007
+ return commands2.filter((command2) => command2.available?.(model) ?? true);
21910
22008
  }
21911
- var commands = [
22009
+ var commands2 = [
21912
22010
  {
21913
22011
  name: "clear",
21914
22012
  detail: "Start a new chat",
@@ -22097,14 +22195,27 @@ var SliccComposer = class extends ModelElement {
22097
22195
  min-height: var(--swc-component-height-75);
22098
22196
  }
22099
22197
  .hint {
22198
+ display: flex;
22100
22199
  flex: 1;
22200
+ flex-wrap: wrap;
22201
+ align-items: center;
22101
22202
  min-width: 0;
22102
- white-space: nowrap;
22203
+ max-block-size: var(--swc-component-height-75);
22103
22204
  overflow: hidden;
22104
- text-overflow: ellipsis;
22105
22205
  font-size: var(--swc-font-size-75);
22106
22206
  color: var(--swc-neutral-subdued-content-color-default);
22107
22207
  }
22208
+ .hint > span {
22209
+ display: flex;
22210
+ align-items: center;
22211
+ block-size: var(--swc-component-height-75);
22212
+ gap: var(--swc-spacing-50);
22213
+ white-space: nowrap;
22214
+ }
22215
+ .hint > span + span::before {
22216
+ content: '·';
22217
+ padding-inline-start: var(--swc-spacing-75);
22218
+ }
22108
22219
  .below swc-action-button {
22109
22220
  margin-inline-start: auto;
22110
22221
  }
@@ -22385,7 +22496,7 @@ var SliccComposer = class extends ModelElement {
22385
22496
  }
22386
22497
  if (kind === "argument") {
22387
22498
  const name = this.value.match(/^\/(\w+)/)?.[1];
22388
- return filter(commands.find((command2) => command2.name === name)?.args?.(model) ?? [], query);
22499
+ return filter(commands2.find((command2) => command2.name === name)?.args?.(model) ?? [], query);
22389
22500
  }
22390
22501
  const files = this.#paths.map((path) => ({
22391
22502
  value: path,
@@ -22405,7 +22516,7 @@ var SliccComposer = class extends ModelElement {
22405
22516
  if (this.popup?.kind === "file" || this.popup?.kind === "secret") return;
22406
22517
  const found = trigger(this.value, area.selectionStart ?? this.value.length);
22407
22518
  const name = this.value.match(/^\/(\w+)/)?.[1];
22408
- const takes = commands.some((command2) => command2.name === name && command2.args);
22519
+ const takes = commands2.some((command2) => command2.name === name && command2.args);
22409
22520
  this.popup = found && (found.kind !== "argument" || takes) ? { ...found, items: this.#choices(found.kind, found.query), index: 0 } : null;
22410
22521
  }
22411
22522
  openPopup(kind) {
@@ -22687,8 +22798,12 @@ var SliccComposer = class extends ModelElement {
22687
22798
  </div>
22688
22799
  <div class="below">
22689
22800
  <div class="hint">
22690
- <kbd>Enter</kbd> ${busy ? "steer" : "send"} · <kbd>Ctrl+Enter</kbd> queue · <kbd>Shift+Enter</kbd> new line · <kbd>/</kbd> commands ·
22691
- <kbd>@</kbd> mention · <kbd>↑</kbd> history${busy ? b` · <kbd>Esc</kbd> stop` : A}
22801
+ <span><kbd>Enter</kbd> ${busy ? "steer" : "send"}</span>
22802
+ ${busy ? b`<span><kbd>Ctrl+Enter</kbd> queue</span><span><kbd>Esc</kbd> stop</span>` : A}
22803
+ <span><kbd>/</kbd> commands</span>
22804
+ <span><kbd>@</kbd> mention</span>
22805
+ <span><kbd>Shift+Enter</kbd> new line</span>
22806
+ <span><kbd>↑</kbd> history</span>
22692
22807
  </div>
22693
22808
  ${speech ? b`<swc-action-button
22694
22809
  size="s"
@@ -32968,31 +33083,31 @@ function parseColor(sequence) {
32968
33083
  }
32969
33084
  }
32970
33085
  function parseSequence(sequence) {
32971
- const commands2 = [];
33086
+ const commands3 = [];
32972
33087
  while (sequence.length > 0) {
32973
33088
  const code2 = sequence.shift();
32974
33089
  if (!code2) continue;
32975
33090
  const codeInt = Number.parseInt(code2);
32976
33091
  if (Number.isNaN(codeInt)) continue;
32977
- if (codeInt === 0) commands2.push({ type: "resetAll" });
33092
+ if (codeInt === 0) commands3.push({ type: "resetAll" });
32978
33093
  else if (codeInt <= 9) {
32979
- if (decorations[codeInt]) commands2.push({
33094
+ if (decorations[codeInt]) commands3.push({
32980
33095
  type: "setDecoration",
32981
33096
  value: decorations[codeInt]
32982
33097
  });
32983
33098
  } else if (codeInt <= 29) {
32984
33099
  const decoration = decorations[codeInt - 20];
32985
33100
  if (decoration) {
32986
- commands2.push({
33101
+ commands3.push({
32987
33102
  type: "resetDecoration",
32988
33103
  value: decoration
32989
33104
  });
32990
- if (decoration === "dim") commands2.push({
33105
+ if (decoration === "dim") commands3.push({
32991
33106
  type: "resetDecoration",
32992
33107
  value: "bold"
32993
33108
  });
32994
33109
  }
32995
- } else if (codeInt <= 37) commands2.push({
33110
+ } else if (codeInt <= 37) commands3.push({
32996
33111
  type: "setForegroundColor",
32997
33112
  value: {
32998
33113
  type: "named",
@@ -33001,12 +33116,12 @@ function parseSequence(sequence) {
33001
33116
  });
33002
33117
  else if (codeInt === 38) {
33003
33118
  const color = parseColor(sequence);
33004
- if (color) commands2.push({
33119
+ if (color) commands3.push({
33005
33120
  type: "setForegroundColor",
33006
33121
  value: color
33007
33122
  });
33008
- } else if (codeInt === 39) commands2.push({ type: "resetForegroundColor" });
33009
- else if (codeInt <= 47) commands2.push({
33123
+ } else if (codeInt === 39) commands3.push({ type: "resetForegroundColor" });
33124
+ else if (codeInt <= 47) commands3.push({
33010
33125
  type: "setBackgroundColor",
33011
33126
  value: {
33012
33127
  type: "named",
@@ -33015,27 +33130,27 @@ function parseSequence(sequence) {
33015
33130
  });
33016
33131
  else if (codeInt === 48) {
33017
33132
  const color = parseColor(sequence);
33018
- if (color) commands2.push({
33133
+ if (color) commands3.push({
33019
33134
  type: "setBackgroundColor",
33020
33135
  value: color
33021
33136
  });
33022
- } else if (codeInt === 49) commands2.push({ type: "resetBackgroundColor" });
33023
- else if (codeInt === 53) commands2.push({
33137
+ } else if (codeInt === 49) commands3.push({ type: "resetBackgroundColor" });
33138
+ else if (codeInt === 53) commands3.push({
33024
33139
  type: "setDecoration",
33025
33140
  value: "overline"
33026
33141
  });
33027
- else if (codeInt === 55) commands2.push({
33142
+ else if (codeInt === 55) commands3.push({
33028
33143
  type: "resetDecoration",
33029
33144
  value: "overline"
33030
33145
  });
33031
- else if (codeInt >= 90 && codeInt <= 97) commands2.push({
33146
+ else if (codeInt >= 90 && codeInt <= 97) commands3.push({
33032
33147
  type: "setForegroundColor",
33033
33148
  value: {
33034
33149
  type: "named",
33035
33150
  name: namedColors[codeInt - 90 + 8]
33036
33151
  }
33037
33152
  });
33038
- else if (codeInt >= 100 && codeInt <= 107) commands2.push({
33153
+ else if (codeInt >= 100 && codeInt <= 107) commands3.push({
33039
33154
  type: "setBackgroundColor",
33040
33155
  value: {
33041
33156
  type: "named",
@@ -33043,7 +33158,7 @@ function parseSequence(sequence) {
33043
33158
  }
33044
33159
  });
33045
33160
  }
33046
- return commands2;
33161
+ return commands3;
33047
33162
  }
33048
33163
  function createAnsiSequenceParser() {
33049
33164
  let foreground = null;
@@ -33062,15 +33177,15 @@ function createAnsiSequenceParser() {
33062
33177
  decorations: new Set(decorations2)
33063
33178
  });
33064
33179
  if (findResult.sequence) {
33065
- const commands2 = parseSequence(findResult.sequence);
33066
- for (const styleToken of commands2) if (styleToken.type === "resetAll") {
33180
+ const commands3 = parseSequence(findResult.sequence);
33181
+ for (const styleToken of commands3) if (styleToken.type === "resetAll") {
33067
33182
  foreground = null;
33068
33183
  background = null;
33069
33184
  decorations2.clear();
33070
33185
  } else if (styleToken.type === "resetForegroundColor") foreground = null;
33071
33186
  else if (styleToken.type === "resetBackgroundColor") background = null;
33072
33187
  else if (styleToken.type === "resetDecoration") decorations2.delete(styleToken.value);
33073
- for (const styleToken of commands2) if (styleToken.type === "setForegroundColor") foreground = styleToken.value;
33188
+ for (const styleToken of commands3) if (styleToken.type === "setForegroundColor") foreground = styleToken.value;
33074
33189
  else if (styleToken.type === "setBackgroundColor") background = styleToken.value;
33075
33190
  else if (styleToken.type === "setDecoration") decorations2.add(styleToken.value);
33076
33191
  }