@ai-ecoverse/slicc-spectrum 1.62.2 → 1.63.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
@@ -13845,13 +13845,16 @@ function table(rows) {
13845
13845
  var done = (result, note = "") => result.code === 0 ? { stdout: `${result.message}${note}
13846
13846
  `, stderr: "", code: 0 } : { stdout: "", stderr: `panel: ${result.message}
13847
13847
  `, code: result.code };
13848
+ function closedWhen(ago2) {
13849
+ return ago2 < 5e3 ? "just now" : `${Math.round(ago2 / 1e3)} s ago`;
13850
+ }
13848
13851
  function act(scope, parsed) {
13849
13852
  const { panels, reachable: reachable2, cone } = scope;
13850
13853
  if (parsed.verb === "reset") {
13851
13854
  const recent = scope.agent ? panels.recentClose() : null;
13852
13855
  if (recent)
13853
13856
  return refusedOutput(
13854
- `the user closed ${recent.id} ${Math.round(recent.ago / 1e3)} s ago; ask before resetting the layout`
13857
+ `the user closed ${recent.id} ${closedWhen(recent.ago)}; ask before resetting the layout`
13855
13858
  );
13856
13859
  return done(panels.reset());
13857
13860
  }
@@ -13867,9 +13870,7 @@ function act(scope, parsed) {
13867
13870
  if (parsed.verb === "close") return done(panels.close(id));
13868
13871
  const ago2 = scope.agent && !panels.find(id)?.open ? panels.closedAgo(id) : null;
13869
13872
  if (ago2 !== null)
13870
- return refusedOutput(
13871
- `the user closed ${id} ${Math.round(ago2 / 1e3)} s ago; ask before opening it again`
13872
- );
13873
+ return refusedOutput(`the user closed ${id} ${closedWhen(ago2)}; ask before opening it again`);
13873
13874
  if (parsed.verb === "move") return done(panels.move(id, place3));
13874
13875
  const options = { place: place3, section: parsed.section };
13875
13876
  if (parsed.verb === "open") return done(panels.open(id, options));
@@ -20497,6 +20498,16 @@ function body(call, color) {
20497
20498
  }
20498
20499
  return b`<pre class="input">${call.input}</pre>`;
20499
20500
  }
20501
+ var severityWords = {
20502
+ error: "Error: ",
20503
+ warn: "Warning: ",
20504
+ info: "Note: "
20505
+ };
20506
+ function notes(list5) {
20507
+ return b`<ul class="notes">${list5.map(
20508
+ (note) => b`<li data-note data-severity=${note.severity}>${note.severity === "info" ? b`<swc-icon-info-circle size="s" aria-hidden="true"></swc-icon-info-circle>` : b`<swc-icon-alert-triangle size="s" aria-hidden="true"></swc-icon-alert-triangle>`}<span><span class="sr">${severityWords[note.severity]}</span>${note.text}</span></li>`
20509
+ )}</ul>`;
20510
+ }
20500
20511
  function tool(call, color = "light") {
20501
20512
  const kind = toolKind(call.name);
20502
20513
  return b`<details class="tool" data-status=${call.status} data-tool=${call.name} data-kind=${kind.id}>
@@ -20514,6 +20525,7 @@ function tool(call, color = "light") {
20514
20525
  <div class="call">
20515
20526
  ${body(call, color)}
20516
20527
  ${call.output ? b`<pre class="output">${call.output}</pre>` : A}
20528
+ ${call.notes?.length ? notes(call.notes) : A}
20517
20529
  ${call.image ? b`<img class="shot" src=${call.image} alt=${call.title} />` : A}
20518
20530
  </div>
20519
20531
  </details>`;
@@ -21168,6 +21180,33 @@ var messageCss = i`
21168
21180
  max-block-size: calc(var(--swc-spacing-1000) * 2.5);
21169
21181
  overflow: auto;
21170
21182
  }
21183
+ .call > pre {
21184
+ white-space: pre-wrap;
21185
+ overflow-wrap: anywhere;
21186
+ }
21187
+ .notes {
21188
+ display: flex;
21189
+ flex-direction: column;
21190
+ gap: var(--swc-spacing-75);
21191
+ margin: var(--swc-spacing-100) 0 0;
21192
+ padding: 0;
21193
+ list-style: none;
21194
+ color: var(--swc-neutral-subdued-content-color-default);
21195
+ }
21196
+ .notes li {
21197
+ display: flex;
21198
+ align-items: flex-start;
21199
+ gap: var(--swc-spacing-75);
21200
+ overflow-wrap: anywhere;
21201
+ }
21202
+ .notes swc-icon-alert-triangle,
21203
+ .notes swc-icon-info-circle {
21204
+ flex: none;
21205
+ margin-block-start: var(--swc-spacing-50);
21206
+ }
21207
+ .notes [data-severity='error'] {
21208
+ color: var(--swc-negative-content-color-default);
21209
+ }
21171
21210
  .call > pre.input:has(+ pre.output) {
21172
21211
  margin-block-end: calc(-1 * var(--swc-spacing-100));
21173
21212
  border-block-end: 0;
@@ -21455,7 +21494,8 @@ var messageCss = i`
21455
21494
  .lick[data-severity='warn'] {
21456
21495
  --severity: var(--swc-notice-visual-color);
21457
21496
  }
21458
- .lick .sr {
21497
+ .lick .sr,
21498
+ .notes .sr {
21459
21499
  position: absolute;
21460
21500
  inline-size: 1px;
21461
21501
  block-size: 1px;
@@ -27746,11 +27786,13 @@ function attention(section) {
27746
27786
  var SliccMonitor = class extends ModelElement {
27747
27787
  static properties = {
27748
27788
  ...ModelElement.properties,
27749
- expanded: { state: true }
27789
+ expanded: { state: true },
27790
+ copied: { state: true }
27750
27791
  };
27751
27792
  constructor() {
27752
27793
  super();
27753
27794
  this.expanded = {};
27795
+ this.copied = null;
27754
27796
  }
27755
27797
  static styles = [
27756
27798
  shared,
@@ -27850,6 +27892,36 @@ var SliccMonitor = class extends ModelElement {
27850
27892
  display: block;
27851
27893
  color: var(--swc-neutral-subdued-content-color-default);
27852
27894
  }
27895
+ .alert > div {
27896
+ min-width: 0;
27897
+ }
27898
+ .alert .command {
27899
+ display: flex;
27900
+ align-items: center;
27901
+ gap: var(--swc-spacing-100);
27902
+ margin-block-start: var(--swc-spacing-75);
27903
+ padding-inline-start: var(--swc-spacing-100);
27904
+ border-radius: var(--swc-corner-radius-medium-default);
27905
+ background: var(--swc-background-layer-1-color);
27906
+ }
27907
+ .alert code {
27908
+ flex: 1;
27909
+ min-width: 0;
27910
+ overflow-x: auto;
27911
+ white-space: nowrap;
27912
+ font-family: var(--swc-code-font-family-stack);
27913
+ font-size: var(--swc-font-size-75);
27914
+ color: var(--swc-code-color);
27915
+ }
27916
+ .alert .lead {
27917
+ display: block;
27918
+ margin-block-start: var(--swc-spacing-75);
27919
+ color: var(--swc-neutral-subdued-content-color-default);
27920
+ }
27921
+ .alert .uncopied {
27922
+ display: block;
27923
+ color: var(--swc-negative-content-color-default);
27924
+ }
27853
27925
  .sections {
27854
27926
  display: grid;
27855
27927
  margin: 0;
@@ -27974,9 +28046,16 @@ var SliccMonitor = class extends ModelElement {
27974
28046
  const error = alert.severity === "error";
27975
28047
  return b`<li class="alert" data-severity=${alert.severity}>
27976
28048
  ${error ? b`<swc-icon-alert-diamond size="s" aria-hidden="true"></swc-icon-alert-diamond>` : b`<swc-icon-alert-triangle size="s" aria-hidden="true"></swc-icon-alert-triangle>`}
27977
- <div><span class="sr">${error ? "Error: " : "Warning: "}</span><strong>${alert.title}</strong><span class="detail">${alert.detail}</span></div>
28049
+ <div><span class="sr">${error ? "Error: " : "Warning: "}</span><strong>${alert.title}</strong><span class="detail">${alert.detail}</span>${alert.command ? this.#command(alert.id, alert.command, alert.commandLabel ?? "Run") : A}</div>
27978
28050
  </li>`;
27979
28051
  }
28052
+ #command(id, text2, label) {
28053
+ const copied = this.copied?.id === id && this.copied.text === text2 ? this.copied : null;
28054
+ return b`<span class="lead">${label}:</span><div class="command" data-command><code>${text2}</code><swc-action-button size="s" quiet data-action="copy-command" accessible-label=${copied?.done ? "Copied" : "Copy command"} @click=${() => this.#copy(id, text2)}><swc-icon-copy slot="icon"></swc-icon-copy>${copied?.done ? "Copied" : "Copy"}</swc-action-button></div>${copied && !copied.done ? b`<span class="uncopied" role="alert" data-error="copy">Couldn’t copy. Select the command and copy it.</span>` : A}`;
28055
+ }
28056
+ async #copy(id, text2) {
28057
+ this.copied = { id, text: text2, done: await copyText(text2) };
28058
+ }
27980
28059
  #open(id) {
27981
28060
  this.dispatchEvent(
27982
28061
  new CustomEvent("show-surface", { detail: { id }, bubbles: true, composed: true })