@ai-ecoverse/slicc-spectrum 1.96.1 → 1.98.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.
@@ -24,7 +24,7 @@ import {
24
24
  skillEdit,
25
25
  tabs,
26
26
  terminals
27
- } from "./chunk-YUDOYEMB.js";
27
+ } from "./chunk-LOQJK2JE.js";
28
28
  import {
29
29
  Emitter
30
30
  } from "./chunk-T5NHW4KC.js";
@@ -705,7 +705,7 @@ function guestTranscript(now2 = Date.now(), twin = false) {
705
705
  function refusal() {
706
706
  return Object.assign(new Error(guestOnly), { code: "EACCES" });
707
707
  }
708
- function closed(name2, refused) {
708
+ function closed(name2, refused2) {
709
709
  return new Proxy(
710
710
  {},
711
711
  {
@@ -713,7 +713,7 @@ function closed(name2, refused) {
713
713
  if (key === "on") return () => () => void 0;
714
714
  if (typeof key !== "string" || key === "then") return void 0;
715
715
  return () => {
716
- refused.push(`${name2}.${key}`);
716
+ refused2.push(`${name2}.${key}`);
717
717
  return Promise.reject(refusal());
718
718
  };
719
719
  }
@@ -729,13 +729,13 @@ var DummyGuestAgent = class extends Emitter {
729
729
  #clock;
730
730
  #next = 1;
731
731
  #reviews = 0;
732
- constructor(cone, messages, seat, time, refused) {
732
+ constructor(cone, messages, seat, time, refused2) {
733
733
  super();
734
734
  this.#cone = { ...cone };
735
735
  this.#messages = structuredClone([...messages]);
736
736
  this.#seat = seat;
737
737
  this.#clock = time;
738
- this.refused = refused;
738
+ this.refused = refused2;
739
739
  }
740
740
  list() {
741
741
  return [{ ...this.#cone }];
@@ -903,9 +903,9 @@ var DummyGuestAgent = class extends Emitter {
903
903
  };
904
904
  var GuestSprinkles = class extends Emitter {
905
905
  #refused;
906
- constructor(refused) {
906
+ constructor(refused2) {
907
907
  super();
908
- this.#refused = refused;
908
+ this.#refused = refused2;
909
909
  }
910
910
  list() {
911
911
  return [forecastSprinkle];
@@ -921,7 +921,7 @@ function createGuestModel({
921
921
  storage = null
922
922
  } = {}) {
923
923
  const time = clock(delay);
924
- const refused = [];
924
+ const refused2 = [];
925
925
  const seat = guestSeat(scenario);
926
926
  const cone = agents.find((agent2) => agent2.id === seat.agentId);
927
927
  const agent = new DummyGuestAgent(
@@ -929,20 +929,20 @@ function createGuestModel({
929
929
  history === "none" ? [] : guestTranscript(Date.now(), history === "twin"),
930
930
  seat,
931
931
  time,
932
- refused
932
+ refused2
933
933
  );
934
934
  return {
935
935
  seat,
936
936
  agent,
937
- refused,
937
+ refused: refused2,
938
938
  settings: new DummySettings(defaults, [], [], storage, time, [guestSettingsKey]),
939
- sprinkles: new GuestSprinkles(refused),
940
- files: closed("files", refused),
941
- terminals: closed("terminals", refused),
942
- browser: closed("browser", refused),
943
- memory: closed("memory", refused),
944
- monitor: closed("monitor", refused),
945
- tray: closed("tray", refused)
939
+ sprinkles: new GuestSprinkles(refused2),
940
+ files: closed("files", refused2),
941
+ terminals: closed("terminals", refused2),
942
+ browser: closed("browser", refused2),
943
+ memory: closed("memory", refused2),
944
+ monitor: closed("monitor", refused2),
945
+ tray: closed("tray", refused2)
946
946
  };
947
947
  }
948
948
 
@@ -1012,8 +1012,8 @@ var DummyGuests = class extends Emitter {
1012
1012
  }
1013
1013
  async mint(agentId, draft) {
1014
1014
  await this.#clock.sleep(4);
1015
- const refused = this.unavailable() ?? (this.scenario === "fail" ? guestsRefused : null);
1016
- if (refused) throw new Error(refused);
1015
+ const refused2 = this.unavailable() ?? (this.scenario === "fail" ? guestsRefused : null);
1016
+ if (refused2) throw new Error(refused2);
1017
1017
  this.#count += 1;
1018
1018
  const now2 = Date.now();
1019
1019
  const seat = {
@@ -1507,6 +1507,9 @@ var DummyAgent = class extends Emitter {
1507
1507
  #frozen = [];
1508
1508
  #hold = null;
1509
1509
  #readOnly = null;
1510
+ #starting = null;
1511
+ #absent = [];
1512
+ #arrival = 0;
1510
1513
  #ice = /* @__PURE__ */ new Map();
1511
1514
  #suggestions = /* @__PURE__ */ new Map();
1512
1515
  #runs = /* @__PURE__ */ new Map();
@@ -1985,6 +1988,34 @@ var DummyAgent = class extends Emitter {
1985
1988
  this.#readOnly = text || null;
1986
1989
  this.emit("readOnly", this.#readOnly);
1987
1990
  }
1991
+ starting() {
1992
+ return this.#starting;
1993
+ }
1994
+ setStarting(line) {
1995
+ this.#arrival++;
1996
+ this.#starting = line || null;
1997
+ this.emit("starting", this.#starting);
1998
+ }
1999
+ withhold(line, ticks2) {
2000
+ this.#absent = [...this.#absent, ...this.#agents];
2001
+ this.#agents = [];
2002
+ this.#active = "";
2003
+ this.#changed();
2004
+ this.setStarting(line);
2005
+ if (ticks2 === void 0) return;
2006
+ const arrival = this.#arrival;
2007
+ void this.#clock.sleep(ticks2).then(() => {
2008
+ if (arrival === this.#arrival) this.arrive();
2009
+ });
2010
+ }
2011
+ arrive() {
2012
+ this.#agents = [...this.#agents, ...this.#absent];
2013
+ this.#absent = [];
2014
+ this.#active = this.#agents[0]?.id ?? "";
2015
+ this.#changed();
2016
+ this.emit("active", this.#active);
2017
+ this.setStarting(null);
2018
+ }
1988
2019
  frozen() {
1989
2020
  const live = this.#agents.filter((agent) => !agent.frozen).map((agent) => {
1990
2021
  const messages = this.#messages.get(agent.id);
@@ -4467,6 +4498,7 @@ var DummyNetwork = class extends Emitter {
4467
4498
 
4468
4499
  // src/dummy/notices.ts
4469
4500
  var readOnlyText = "Watch only. The SLICC you follow runs a newer version. Update this one to send prompts.";
4501
+ var startingText = "Seven is installing its agent.";
4470
4502
  var noticeFixtures = {
4471
4503
  storage: {
4472
4504
  id: "storage",
@@ -4489,6 +4521,14 @@ var noticeFixtures = {
4489
4521
  body: "The SLICC you follow moved to a newer version. Until you update SLICC on this device, it can only watch.",
4490
4522
  actions: [],
4491
4523
  dismissible: false
4524
+ },
4525
+ starting: {
4526
+ id: "starting",
4527
+ tone: "info",
4528
+ title: "Seven is installing its agent",
4529
+ body: "The chat starts once the agent is installed. Messages you send now wait for it.",
4530
+ actions: [],
4531
+ dismissible: false
4492
4532
  }
4493
4533
  };
4494
4534
  var DummyNotices = class extends Emitter {
@@ -4499,7 +4539,7 @@ var DummyNotices = class extends Emitter {
4499
4539
  super();
4500
4540
  this.#scenario = scenario;
4501
4541
  this.#time = time;
4502
- this.#notices = scenario === "mixed" ? [noticeFixtures.storage, noticeFixtures.welcome] : scenario === "readonly" ? [noticeFixtures.readonly] : [noticeFixtures.storage];
4542
+ this.#notices = scenario === "mixed" ? [noticeFixtures.storage, noticeFixtures.welcome] : scenario === "readonly" || scenario === "starting" ? [noticeFixtures[scenario]] : [noticeFixtures.storage];
4503
4543
  }
4504
4544
  list() {
4505
4545
  return this.#notices;
@@ -4515,13 +4555,19 @@ var DummyNotices = class extends Emitter {
4515
4555
  this.#remove(id);
4516
4556
  }
4517
4557
  readOnly(on) {
4518
- const shown = this.#notices.some((notice) => notice.id === "readonly");
4558
+ this.#toggle("readonly", on);
4559
+ }
4560
+ starting(on) {
4561
+ this.#toggle("starting", on);
4562
+ }
4563
+ #toggle(id, on) {
4564
+ const shown = this.#notices.some((notice) => notice.id === id);
4519
4565
  if (on === shown) return;
4520
4566
  if (on) {
4521
- this.#notices = [noticeFixtures.readonly, ...this.#notices];
4567
+ this.#notices = [noticeFixtures[id], ...this.#notices];
4522
4568
  this.emit("notices", this.#notices);
4523
4569
  } else {
4524
- this.#remove("readonly");
4570
+ this.#remove(id);
4525
4571
  }
4526
4572
  }
4527
4573
  #remove(id) {
@@ -5346,6 +5392,11 @@ function vaultSecrets(now2 = Date.now()) {
5346
5392
  }
5347
5393
  ];
5348
5394
  }
5395
+ function refused(settings) {
5396
+ const bad = Object.entries(settings).find(([, value]) => value.startsWith("bad"));
5397
+ if (bad)
5398
+ throw vaultFailure("EINVAL", `The vault refused ${bad[0]}. Check that value and try again.`);
5399
+ }
5349
5400
  function accountRecords(now2 = Date.now(), pin) {
5350
5401
  return [
5351
5402
  {
@@ -5744,6 +5795,7 @@ var DummyVault = class extends Emitter {
5744
5795
  buttons = [];
5745
5796
  puts = [];
5746
5797
  endpointChanges = [];
5798
+ settingsCalls = [];
5747
5799
  #refuses;
5748
5800
  cancelled = [];
5749
5801
  imports = [];
@@ -5887,17 +5939,33 @@ var DummyVault = class extends Emitter {
5887
5939
  const problem = nameProblem(name2) ?? valueProblem(value);
5888
5940
  if (problem) throw vaultFailure("EINVAL", problem);
5889
5941
  if (request !== void 0) this.#take(request, name2);
5942
+ if (options?.settings) refused(options.settings);
5890
5943
  this.puts.push({
5891
5944
  name: name2,
5892
5945
  ...request === void 0 ? {} : { request },
5893
5946
  ...options ? { options: { ...options } } : {}
5894
5947
  });
5895
- const { kind = "secret", provider, server } = options ?? {};
5948
+ const { kind = "secret", provider, server, settings } = options ?? {};
5896
5949
  return this.#seal(name2, "settings", kind, {
5897
5950
  ...provider === void 0 ? {} : { provider },
5898
- ...server === void 0 ? {} : { server }
5951
+ ...server === void 0 ? {} : { server },
5952
+ ...settings === void 0 ? {} : { settings: { ...settings } }
5899
5953
  });
5900
5954
  }
5955
+ async settings(name2, kind, settings) {
5956
+ await this.#time.sleep(5);
5957
+ this.#unlocked();
5958
+ const secret = this.#find(name2, kind);
5959
+ refused(settings);
5960
+ this.settingsCalls.push({ name: name2, kind, settings: { ...settings } });
5961
+ this.#list = {
5962
+ ...this.#list,
5963
+ secrets: this.#list.secrets.map(
5964
+ (item) => item === secret ? { ...item, settings: { ...settings } } : item
5965
+ )
5966
+ };
5967
+ this.emit("list", this.#list);
5968
+ }
5901
5969
  #take(request, name2) {
5902
5970
  const found = this.#status.waiting.find((item) => item.id === request);
5903
5971
  if (!found) throw vaultFailure("ENOENT", "That request is no longer waiting.");
@@ -6050,6 +6118,15 @@ function importPort(scenario, agent, time) {
6050
6118
  agent.importCancel = port.importCancel.bind(port);
6051
6119
  agent.importing = port.importing.bind(port);
6052
6120
  }
6121
+ function noticesPort(agent, time, notices, readonly, arrival) {
6122
+ if (readonly !== "off") agent.setReadOnly(readOnlyText);
6123
+ if (arrival !== "ready") agent.withhold(startingText, arrival === "starting" ? 100 : void 0);
6124
+ const notice = readonly !== "off" ? "readonly" : arrival !== "ready" ? "starting" : notices;
6125
+ const port = notice === "off" ? null : new DummyNotices(notice, time);
6126
+ if (port && readonly !== "off") agent.on("readOnly", (text) => port.readOnly(Boolean(text)));
6127
+ if (port && arrival !== "ready") agent.on("starting", (line) => port.starting(Boolean(line)));
6128
+ return port;
6129
+ }
6053
6130
  function createDummyModel({
6054
6131
  delay = 30,
6055
6132
  storage = null,
@@ -6074,6 +6151,7 @@ function createDummyModel({
6074
6151
  transport,
6075
6152
  hold = "off",
6076
6153
  readonly = "off",
6154
+ agent: arrival = "ready",
6077
6155
  browser: scenario = "idle",
6078
6156
  sprinkles: sprinkles2 = "builtin",
6079
6157
  monitor = "dummy",
@@ -6103,12 +6181,7 @@ function createDummyModel({
6103
6181
  };
6104
6182
  importPort(imports, agent, time);
6105
6183
  if (hold !== "off") agent.setHold({ reason: hold, held: 2 });
6106
- if (readonly !== "off") agent.setReadOnly(readOnlyText);
6107
- const notice = readonly !== "off" ? "readonly" : notices;
6108
- const noticePort = notice === "off" ? null : new DummyNotices(notice, time);
6109
- if (noticePort && readonly !== "off") {
6110
- agent.on("readOnly", (text) => noticePort.readOnly(Boolean(text)));
6111
- }
6184
+ const noticePort = noticesPort(agent, time, notices, readonly, arrival);
6112
6185
  if (scenario === "driving") void browser.run(drive);
6113
6186
  const base = {
6114
6187
  agent,