@ai-ecoverse/slicc-spectrum 1.27.2 → 1.28.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
@@ -9582,7 +9582,7 @@ var SliccAgents = class extends ModelElement {
9582
9582
  if (!port?.drop) return;
9583
9583
  const ok = await confirm({
9584
9584
  title: `Drop scoop ${agent.name}?`,
9585
- body: "It stops working. Its files stay.",
9585
+ body: "It stops, and its working folder is deleted. Its conversation and reports are kept. You can\u2019t undo this.",
9586
9586
  action: "Drop",
9587
9587
  variant: "destructive",
9588
9588
  trigger: trigger2
@@ -19815,15 +19815,20 @@ var SliccChat = class extends ThemedElement {
19815
19815
  }),
19816
19816
  model.agent.on("agents", () => this.requestUpdate()),
19817
19817
  model.agent.on("messages", (agentId) => {
19818
- if (agentId === this.#id()) this.#refresh(true);
19818
+ if (agentId === this.#id()) this.#refresh(this.#sent(agentId));
19819
19819
  }),
19820
19820
  model.agent.on("message", ({ agentId }) => {
19821
- if (agentId === this.#id()) this.#refresh(false);
19821
+ if (agentId === this.#id()) this.#refresh(this.#sent(agentId));
19822
19822
  })
19823
19823
  ];
19824
19824
  }
19825
19825
  #stuck = true;
19826
19826
  #last = 0;
19827
+ #tail = "";
19828
+ #sent(agentId) {
19829
+ const last = this.model?.agent.messages(agentId).at(-1);
19830
+ return last?.role === "user" && last.id !== this.#tail && (last.origin ?? "user") === "user";
19831
+ }
19827
19832
  #resize = new ResizeObserver(() => this.#pin());
19828
19833
  #log() {
19829
19834
  return this.renderRoot.querySelector(".log");
@@ -19967,6 +19972,7 @@ var SliccChat = class extends ThemedElement {
19967
19972
  const agent = this.#agent();
19968
19973
  this.#handlers.readOnly = !!agent?.frozen;
19969
19974
  const messages = agent ? this.model?.agent.messages(agent.id) ?? [] : [];
19975
+ this.#tail = messages.at(-1)?.id ?? "";
19970
19976
  return b`
19971
19977
  <header>
19972
19978
  ${agent ? this.#meta(agent) : b`<span>No agent</span>`}
@@ -21820,6 +21826,7 @@ function visible(memories, scope, tag3, query) {
21820
21826
  (memory) => memory.scope === scope && (tag3 === "all" || (tag3 === "untagged" ? memory.tag === null : memory.tag === tag3)) && (!needle || `${memory.title} ${memory.body} ${memory.section}`.toLowerCase().includes(needle))
21821
21827
  );
21822
21828
  }
21829
+ var scopeGroups = { cones: "Cones", roles: "Roles" };
21823
21830
  var tagLabels = {
21824
21831
  user: "User",
21825
21832
  feedback: "Feedback",
@@ -21912,6 +21919,12 @@ var SliccMemory = class extends ModelElement {
21912
21919
  font-weight: var(--swc-bold-font-weight);
21913
21920
  line-height: var(--swc-line-height-100);
21914
21921
  }
21922
+ .from {
21923
+ grid-column: 1 / -1;
21924
+ margin-top: var(--swc-spacing-50);
21925
+ font-size: var(--swc-font-size-75);
21926
+ color: var(--swc-neutral-subdued-content-color-default);
21927
+ }
21915
21928
  .summary {
21916
21929
  grid-column: 1 / -1;
21917
21930
  color: var(--swc-neutral-subdued-content-color-default);
@@ -22002,6 +22015,7 @@ var SliccMemory = class extends ModelElement {
22002
22015
  <span class="title">${memory.title}</span>
22003
22016
  ${memory.tag ? b`<swc-badge size="s" variant="neutral" subtle>${tagLabels[memory.tag]}</swc-badge>` : A}
22004
22017
  ${open ? A : b`<span class="summary">${memory.body}</span>`}
22018
+ ${memory.source === "notes" ? b`<span class="from">From MEMORY.md</span>` : A}
22005
22019
  </button>
22006
22020
  ${open ? b`<div class="body">${markdown(memory.body)}</div>
22007
22021
  <div class="actions">
@@ -22014,19 +22028,33 @@ var SliccMemory = class extends ModelElement {
22014
22028
  </div>` : A}
22015
22029
  </div>`;
22016
22030
  }
22017
- render() {
22031
+ #scopes = [];
22032
+ willUpdate(changed) {
22033
+ super.willUpdate(changed);
22018
22034
  const model = this.model;
22019
- const all2 = model?.memory.list() ?? [];
22020
- const shown = visible(all2, this.scope, this.tag, this.query);
22021
- const cones = (model?.agent.list() ?? []).filter((agent) => agent.kind === "cone");
22022
- return b`<div class="bar"><span>${shown.length} of ${all2.filter((memory) => memory.scope === this.scope).length} memories</span><span class="spacer"></span>
22035
+ this.#scopes = model?.memory.scopes?.() ?? [
22036
+ { id: "global", label: "Everyone" },
22037
+ ...(model?.agent.list() ?? []).filter((agent) => agent.kind === "cone").map((cone) => ({ id: cone.id, label: cone.name }))
22038
+ ];
22039
+ if (!this.#scopes.some((item2) => item2.id === this.scope)) this.scope = "global";
22040
+ }
22041
+ render() {
22042
+ const all2 = this.model?.memory.list() ?? [];
22043
+ const scopes = this.#scopes;
22044
+ const scope = this.scope;
22045
+ const option2 = (item2) => b`<sp-menu-item value=${item2.id}>${item2.label}</sp-menu-item>`;
22046
+ const shown = visible(all2, scope, this.tag, this.query);
22047
+ return b`<div class="bar"><span>${shown.length} of ${all2.filter((memory) => memory.scope === scope).length} memories</span><span class="spacer"></span>
22023
22048
  <swc-action-button size="s" quiet @click=${() => this.editing = "new"}><swc-icon-add slot="icon"></swc-icon-add>Remember</swc-action-button>
22024
22049
  </div>
22025
22050
  <div class="tools">
22026
22051
  <sp-search size="s" label="Search memories" placeholder="Search memories" .value=${this.query} @input=${(event2) => this.query = event2.target.value} @submit=${(event2) => event2.preventDefault()}></sp-search>
22027
- <sp-picker size="s" label="Scope" value=${this.scope} @change=${(event2) => this.scope = event2.target.value}>
22028
- <sp-menu-item value="global">Everyone</sp-menu-item>
22029
- ${cones.map((cone) => b`<sp-menu-item value=${cone.id}>${cone.name}</sp-menu-item>`)}
22052
+ <sp-picker size="s" label="Scope" value=${scope} @change=${(event2) => this.scope = event2.target.value}>
22053
+ ${scopes.filter((item2) => !item2.group).map(option2)}
22054
+ ${["cones", "roles"].map((group) => {
22055
+ const items = scopes.filter((item2) => item2.group === group);
22056
+ return items.length ? b`<sp-menu-group size="s"><span slot="header">${scopeGroups[group]}</span>${items.map(option2)}</sp-menu-group>` : A;
22057
+ })}
22030
22058
  </sp-picker>
22031
22059
  <sp-picker size="s" label="Tag" value=${this.tag} @change=${(event2) => this.tag = event2.target.value}>
22032
22060
  <sp-menu-item value="all">All tags</sp-menu-item>
@@ -22037,7 +22065,7 @@ var SliccMemory = class extends ModelElement {
22037
22065
  </sp-picker>
22038
22066
  </div>
22039
22067
  <div class="list">
22040
- ${this.editing === "new" ? b`<div class="row">${this.#form({ scope: this.scope })}</div>` : A}
22068
+ ${this.editing === "new" ? b`<div class="row">${this.#form({ scope })}</div>` : A}
22041
22069
  ${shown.length ? sections(shown).map(
22042
22070
  ([section, items]) => b`<h3>${section}</h3>${items.map((memory) => this.#row(memory))}`
22043
22071
  ) : b`<div class="note">${all2.length ? "No memories match." : "No memories yet."}</div>`}