@ai-ecoverse/slicc-spectrum 1.53.1 → 1.55.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
@@ -20884,8 +20884,20 @@ var packageActions = {
20884
20884
  install: "Install",
20885
20885
  update: "Update",
20886
20886
  remove: "Remove",
20887
- retry: "Retry"
20887
+ retry: "Retry",
20888
+ unpin: "Unpin"
20888
20889
  };
20890
+ function packageLight(item2) {
20891
+ if (item2.pin && item2.state === "installed")
20892
+ return ["positive", item2.pin.base === null ? "Added" : "Pinned"];
20893
+ if (item2.pin?.base && item2.state === "removing") return ["info", "Unpinning"];
20894
+ return packageStates[item2.state];
20895
+ }
20896
+ function pinVersion(item2, pin) {
20897
+ const version2 = item2.version ?? pin.range;
20898
+ if (pin.base === null) return [pin.range === version2 ? version2 : `${pin.range} \u2192 ${version2}`];
20899
+ return [version2, pin.base === version2 ? "the version seven ships" : `seven ships ${pin.base}`];
20900
+ }
20889
20901
  var packageRunning = /* @__PURE__ */ new Set(["installing", "updating", "removing"]);
20890
20902
  var list3 = (names) => new Intl.ListFormat("en", { type: "conjunction" }).format(names);
20891
20903
  function requiresText(item2, all2) {
@@ -21335,6 +21347,14 @@ var SliccUpdates = class extends ModelElement {
21335
21347
  </article>`;
21336
21348
  }
21337
21349
  #packageMeta(item2, all2) {
21350
+ if (item2.pin) {
21351
+ const [version3, ...rest] = pinVersion(item2, item2.pin);
21352
+ return b`<p class="meta" data-pin=${item2.pin.base === null ? "added" : "pinned"}>
21353
+ <span class="version">${version3}</span>
21354
+ ${rest.map((part2) => b`<span>${part2}</span>`)}
21355
+ <span>in ${item2.pin.project}</span>
21356
+ </p>`;
21357
+ }
21338
21358
  const version2 = item2.version === null ? item2.offered : item2.offered && item2.offered !== item2.version ? `${item2.version} \u2192 ${item2.offered}` : item2.version;
21339
21359
  const download = item2.size !== void 0 && (item2.version === null || item2.offered !== item2.version);
21340
21360
  const requires = requiresText(item2, all2);
@@ -21360,11 +21380,11 @@ var SliccUpdates = class extends ModelElement {
21360
21380
  return b`<swc-progress-bar
21361
21381
  size="s"
21362
21382
  indeterminate
21363
- accessible-label=${`${item2.label}: ${packageStates[item2.state]?.[1].toLowerCase()}`}
21383
+ accessible-label=${`${item2.label}: ${packageLight(item2)?.[1].toLowerCase()}`}
21364
21384
  ></swc-progress-bar>`;
21365
21385
  }
21366
21386
  #package(item2, all2, act) {
21367
- const light = packageStates[item2.state];
21387
+ const light = packageLight(item2);
21368
21388
  const busy = this.busy.get(item2.id);
21369
21389
  const shown2 = busy ? [busy] : act ? item2.actions : [];
21370
21390
  const error = this.problems.get(item2.id) ?? item2.error;
@@ -21400,21 +21420,32 @@ var SliccUpdates = class extends ModelElement {
21400
21420
  ${item2.log ? b`<details><summary>Install log</summary><pre><span class="package">${item2.package}</span>\n${item2.log}</pre></details>` : A}
21401
21421
  </li>`;
21402
21422
  }
21423
+ #list(items, all2, port) {
21424
+ return b`<ul>${c(
21425
+ items,
21426
+ (item2) => item2.id,
21427
+ (item2) => this.#package(item2, all2, Boolean(port.actPackage))
21428
+ )}</ul>`;
21429
+ }
21403
21430
  #packages(port) {
21404
21431
  if (!port?.packages) return A;
21405
21432
  const all2 = port.packages();
21433
+ const offered = all2.filter((item2) => item2.origin !== "user");
21434
+ const yours = all2.filter((item2) => item2.origin === "user");
21406
21435
  return b`<section data-section="packages" aria-labelledby="packages">
21407
21436
  <swc-divider size="m"></swc-divider>
21408
21437
  <h2 id="packages">Optional packages</h2>
21409
21438
  <p class="hint">
21410
- ${all2.length ? "Tools for the agent and the terminal. Install the ones you need; you can remove them later." : "No optional packages are offered right now."}
21439
+ ${offered.length ? "Tools for the agent and the terminal. Install the ones you need; you can remove them later." : "No optional packages are offered right now."}
21411
21440
  </p>
21412
- ${all2.length ? b`<ul>${c(
21413
- all2,
21414
- (item2) => item2.id,
21415
- (item2) => this.#package(item2, all2, Boolean(port.actPackage))
21416
- )}</ul>` : A}
21417
- </section>`;
21441
+ ${offered.length ? this.#list(offered, all2, port) : A}
21442
+ </section>
21443
+ ${yours.length ? b`<section data-section="user-packages" aria-labelledby="user-packages">
21444
+ <swc-divider size="m"></swc-divider>
21445
+ <h2 id="user-packages">Your packages</h2>
21446
+ <p class="hint">Packages you added or pinned with pnpm in /opt/agent or /opt/grammars. Seven’s updates keep them until you unpin or remove them.</p>
21447
+ ${this.#list(yours, all2, port)}
21448
+ </section>` : A}`;
21418
21449
  }
21419
21450
  render() {
21420
21451
  const port = this.model?.updates;
@@ -26058,19 +26089,19 @@ var SliccComposer = class extends ModelElement {
26058
26089
  };
26059
26090
  }
26060
26091
  pick(choice) {
26061
- const popup = this.popup;
26062
- if (!popup) return;
26063
- if (popup.kind === "file") {
26092
+ const popup2 = this.popup;
26093
+ if (!popup2) return;
26094
+ if (popup2.kind === "file") {
26064
26095
  this.popup = null;
26065
26096
  void this.attachPath(choice.value);
26066
26097
  return;
26067
26098
  }
26068
26099
  const area = this.#textarea;
26069
26100
  const caret = area.selectionStart ?? this.value.length;
26070
- const insert = popup.kind === "command" ? `/${choice.value} ` : popup.kind === "mention" ? `@${choice.value} ` : `${choice.value} `;
26071
- this.value = this.value.slice(0, popup.start) + insert + this.value.slice(caret);
26101
+ const insert = popup2.kind === "command" ? `/${choice.value} ` : popup2.kind === "mention" ? `@${choice.value} ` : `${choice.value} `;
26102
+ this.value = this.value.slice(0, popup2.start) + insert + this.value.slice(caret);
26072
26103
  this.popup = null;
26073
- const position = popup.start + insert.length;
26104
+ const position = popup2.start + insert.length;
26074
26105
  void this.updateComplete.then(() => this.#field?.updateComplete).then(() => {
26075
26106
  area.focus();
26076
26107
  area.setSelectionRange(position, position);
@@ -26089,20 +26120,20 @@ var SliccComposer = class extends ModelElement {
26089
26120
  return true;
26090
26121
  }
26091
26122
  #popupKey(event2) {
26092
- const popup = this.popup;
26093
- if (!popup || popup.kind === "secret") return false;
26123
+ const popup2 = this.popup;
26124
+ if (!popup2 || popup2.kind === "secret") return false;
26094
26125
  if (event2.key === "Escape") {
26095
26126
  this.popup = null;
26096
26127
  return true;
26097
26128
  }
26098
- const count = popup.items.length;
26129
+ const count = popup2.items.length;
26099
26130
  if ((event2.key === "ArrowDown" || event2.key === "ArrowUp") && count) {
26100
26131
  const step = event2.key === "ArrowDown" ? 1 : -1;
26101
- this.popup = { ...popup, index: (popup.index + step + count) % count };
26132
+ this.popup = { ...popup2, index: (popup2.index + step + count) % count };
26102
26133
  return true;
26103
26134
  }
26104
26135
  if ((event2.key === "Enter" || event2.key === "Tab") && count && !event2.shiftKey) {
26105
- this.pick(popup.items[popup.index]);
26136
+ this.pick(popup2.items[popup2.index]);
26106
26137
  return true;
26107
26138
  }
26108
26139
  return false;
@@ -26207,9 +26238,9 @@ var SliccComposer = class extends ModelElement {
26207
26238
  </swc-upload-attachment>`;
26208
26239
  }
26209
26240
  #popup() {
26210
- const popup = this.popup;
26211
- if (!popup) return A;
26212
- if (popup.kind === "secret") {
26241
+ const popup2 = this.popup;
26242
+ if (!popup2) return A;
26243
+ if (popup2.kind === "secret") {
26213
26244
  const submit = (event2) => {
26214
26245
  event2.preventDefault();
26215
26246
  const form = event2.currentTarget;
@@ -26228,11 +26259,11 @@ var SliccComposer = class extends ModelElement {
26228
26259
  argument: "Options",
26229
26260
  mention: "Mention",
26230
26261
  file: "Attach a file from SLICC"
26231
- }[popup.kind];
26262
+ }[popup2.kind];
26232
26263
  const option2 = (item2, index) => b`<div
26233
26264
  class="item"
26234
26265
  role="option"
26235
- aria-selected=${index === popup.index ? "true" : "false"}
26266
+ aria-selected=${index === popup2.index ? "true" : "false"}
26236
26267
  data-value=${item2.value}
26237
26268
  @mousedown=${(event2) => {
26238
26269
  event2.preventDefault();
@@ -26242,13 +26273,13 @@ var SliccComposer = class extends ModelElement {
26242
26273
  <span class="label">${item2.label}</span><span class="detail">${item2.detail}</span>
26243
26274
  </div>`;
26244
26275
  const sections2 = [];
26245
- popup.items.forEach((item2, index) => {
26276
+ popup2.items.forEach((item2, index) => {
26246
26277
  const last = sections2.at(-1);
26247
26278
  if (last && last.group === item2.group) last.entries.push([item2, index]);
26248
26279
  else sections2.push({ group: item2.group, entries: [[item2, index]] });
26249
26280
  });
26250
- return b`<div class="popup" role="listbox" aria-label=${title} data-kind=${popup.kind}>
26251
- ${popup.items.length ? sections2.map(
26281
+ return b`<div class="popup" role="listbox" aria-label=${title} data-kind=${popup2.kind}>
26282
+ ${popup2.items.length ? sections2.map(
26252
26283
  ({ group, entries }) => group ? b`<div class="section" role="group" aria-label=${group} data-group=${group}>
26253
26284
  <div class="heading" aria-hidden="true">${group}</div>
26254
26285
  ${entries.map(([item2, index]) => option2(item2, index))}
@@ -27066,8 +27097,11 @@ var accountStatus = {
27066
27097
  expired: ["notice", "Expired"],
27067
27098
  disconnected: ["neutral", "Not connected"],
27068
27099
  "signing-in": ["info", "Signing in\u2026"],
27069
- rejected: ["notice", "Rejected"]
27100
+ rejected: ["notice", "Rejected"],
27101
+ "needs-sign-in": ["neutral", "Needs sign-in"],
27102
+ "sign-in-expired": ["notice", "Sign-in expired"]
27070
27103
  };
27104
+ var popup = (account) => account.group === "mcp" && account.auth === "oauth";
27071
27105
  var secretNames = { "api-key": "API key", token: "token" };
27072
27106
  var rejectedNames = { "api-key": "API key rejected", token: "Token rejected" };
27073
27107
  var SliccSettings = class extends ModelElement {
@@ -27317,14 +27351,14 @@ var SliccSettings = class extends ModelElement {
27317
27351
  @click=${() => this.#disconnect(account)}
27318
27352
  >Disconnect</swc-button>`;
27319
27353
  }
27320
- const label = account.status === "expired" ? "Reconnect" : "Connect";
27354
+ const label = popup(account) ? "Sign in" : account.status === "expired" ? "Reconnect" : "Connect";
27321
27355
  const entering = this.entering === account.id;
27322
27356
  const busy = this.#signingIn(account) || !entering && this.pending.has(account.id);
27323
27357
  return b`<swc-button
27324
27358
  size="m"
27325
27359
  variant="secondary"
27326
27360
  data-action="connect"
27327
- accessible-label=${`${label} ${account.provider}`}
27361
+ accessible-label=${popup(account) ? `Sign in to ${account.provider}` : `${label} ${account.provider}`}
27328
27362
  ?pending=${busy}
27329
27363
  ?disabled=${entering}
27330
27364
  @click=${() => this.#start(account)}
@@ -27333,6 +27367,8 @@ var SliccSettings = class extends ModelElement {
27333
27367
  #status(account) {
27334
27368
  if (this.#signingIn(account)) return "signing-in";
27335
27369
  if (account.status === "expired" && account.auth === "api-key") return "rejected";
27370
+ if (popup(account) && account.status === "disconnected") return "needs-sign-in";
27371
+ if (popup(account) && account.status === "expired") return "sign-in-expired";
27336
27372
  return account.status;
27337
27373
  }
27338
27374
  #account(account) {
@@ -61675,7 +61711,7 @@ var TabsContainer = class extends CompositeDisposable {
61675
61711
  groupById.set(tg.id, tg);
61676
61712
  if (overflowGroupSet.has(tg.id)) for (const pid of tg.panelIds) panelToGroup.set(pid, tg);
61677
61713
  }
61678
- const popup = () => this.accessor.getPopupServiceForGroup(this.group);
61714
+ const popup2 = () => this.accessor.getPopupServiceForGroup(this.group);
61679
61715
  const buildGroupHeader = (tg) => {
61680
61716
  const groupHeader = document.createElement("div");
61681
61717
  groupHeader.className = "dv-tabs-overflow-group-header";
@@ -61694,7 +61730,7 @@ var TabsContainer = class extends CompositeDisposable {
61694
61730
  groupHeader.appendChild(badge);
61695
61731
  }
61696
61732
  groupHeader.addEventListener("click", () => {
61697
- popup().close();
61733
+ popup2().close();
61698
61734
  if (tg.collapsed) tg.expand();
61699
61735
  const firstPanelId = tg.panelIds[0];
61700
61736
  if (firstPanelId) {
@@ -61746,7 +61782,7 @@ var TabsContainer = class extends CompositeDisposable {
61746
61782
  this.accessor.withOrigin("user", () => panel.api.setActive());
61747
61783
  };
61748
61784
  wrapper.addEventListener("click", (event2) => {
61749
- popup().close();
61785
+ popup2().close();
61750
61786
  if (event2.defaultPrevented) return;
61751
61787
  doActivate();
61752
61788
  });
@@ -61755,15 +61791,15 @@ var TabsContainer = class extends CompositeDisposable {
61755
61791
  element: wrapper,
61756
61792
  panel,
61757
61793
  activate: () => {
61758
- popup().close();
61794
+ popup2().close();
61759
61795
  doActivate();
61760
61796
  }
61761
61797
  };
61762
61798
  },
61763
61799
  open: (body4) => {
61764
- popup().openPopover(body4, anchor);
61800
+ popup2().openPopover(body4, anchor);
61765
61801
  },
61766
- close: () => popup().close(),
61802
+ close: () => popup2().close(),
61767
61803
  focusTrigger: () => {
61768
61804
  root2.tabIndex = -1;
61769
61805
  root2.focus();