shadok-ai 0.17.47 → 0.17.48

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/index.html +15 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadok-ai",
3
- "version": "0.17.47",
3
+ "version": "0.17.48",
4
4
  "main": "dist/session.js",
5
5
  "scripts": {
6
6
  "test": "node --import tsx --test --test-timeout=120000 test/*.ts context/*/test/*.test.mjs",
package/public/index.html CHANGED
@@ -5335,6 +5335,16 @@
5335
5335
  // real group, because Main HAS its own vault).
5336
5336
  const COMMONS_GROUP_ID = "main";
5337
5337
  const foldCommons = (id) => (id != null && String(id) === COMMONS_GROUP_ID ? null : id);
5338
+ // Does the server carry that commons row (multi-tenant)? Then the "Main" view is
5339
+ // a REAL group a new agent must be filed into by name: a start with no `group`
5340
+ // is read by the server as "no choice made" and lands in the caller's own single
5341
+ // private group — the admin's Personal — so an agent created on the Main view
5342
+ // jumped to Personal on the next sync. Mono-tenant has no such row and keeps
5343
+ // omitting the key (its start message stays byte-for-byte what it was).
5344
+ let commonsOnServer = false;
5345
+ const noteCommons = (list) => {
5346
+ if (Array.isArray(list)) commonsOnServer = list.some((g) => g && String(g.id) === COMMONS_GROUP_ID);
5347
+ };
5338
5348
 
5339
5349
  // Group nature (server-owned): public / restricted / private. A walled group
5340
5350
  // (restricted or private) carries a padlock. The operator never sees the
@@ -6165,6 +6175,7 @@
6165
6175
  // A group created on another device must exist here before an agent can be
6166
6176
  // filed into it. Additive only: a group missing from the server may be one
6167
6177
  // this tab just made and has not pushed yet.
6178
+ noteCommons(srvGroups);
6168
6179
  if (Array.isArray(srvGroups)) {
6169
6180
  for (const sg of srvGroups) {
6170
6181
  if (sg == null || sg.id == null) continue;
@@ -8490,6 +8501,9 @@
8490
8501
  if (mode === "new") {
8491
8502
  const tg = viewGroupId();
8492
8503
  if (tg) msg.group = tg;
8504
+ // The Main view on screen is a choice too (see `commonsOnServer`). Only when
8505
+ // the rail shows it: a phone has no view, and keeps the server's default.
8506
+ else if (commonsOnServer && setupGroup == null && railShown()) msg.group = COMMONS_GROUP_ID;
8493
8507
  }
8494
8508
  $("startBtn").disabled = true;
8495
8509
  closeSetup();
@@ -14238,6 +14252,7 @@
14238
14252
  // empty. Only a failed fetch falls back to the (now dir-scoped) cache.
14239
14253
  let savedGroups = pickChannelSource(groupsR, JSON.parse(localStorage.getItem(dirKey("cp.groups", instanceKey)) || "[]"));
14240
14254
  // The commons group ("main") is the "Main" view, never a rail group (see foldCommons).
14255
+ if (groupsR.status === "fulfilled") noteCommons(groupsR.value);
14241
14256
  for (const g of savedGroups) if (String(g.id) !== COMMONS_GROUP_ID) createGroup(g);
14242
14257
 
14243
14258
  let saved = pickChannelSource(channelsR, JSON.parse(localStorage.getItem(dirKey("cp.channels", instanceKey)) || "[]"));