shadok-ai 0.19.59 → 0.19.60
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/README.md +9 -3
- package/dist/server.js +36 -0
- package/dist/server.js.map +1 -1
- package/dist/user-prefs.d.ts +40 -0
- package/dist/user-prefs.js +57 -0
- package/dist/user-prefs.js.map +1 -0
- package/package.json +1 -1
- package/public/index.html +83 -16
package/README.md
CHANGED
|
@@ -1617,9 +1617,15 @@ key picked from the ⋯ menu, e.g. `emerald`; unknown/`amber` reverts to default
|
|
|
1617
1617
|
The default palette (stored key `amber`, labelled *Shadok*) is the Teams purple in
|
|
1618
1618
|
light mode and an indigo in dark mode; light mode follows Microsoft Teams, dark
|
|
1619
1619
|
mode a neutral near-black.
|
|
1620
|
-
Light/dark **mode** is an orthogonal, **
|
|
1621
|
-
(default
|
|
1622
|
-
|
|
1620
|
+
Light/dark **mode** is an orthogonal, **personal** choice in the same menu
|
|
1621
|
+
(default light) — the accent is the instance's shared identity, the mode is
|
|
1622
|
+
personal), `/prefs` (GET/PUT — the caller's OWN display preferences, stored per
|
|
1623
|
+
account so they follow the person to another browser, the phone or the desktop
|
|
1624
|
+
client: light/dark `mode`, `soundMuted` (the chime), `railMini` (collapsed groups
|
|
1625
|
+
column), `tourSeen`. PUT merges the keys it carries and drops unknown ones; an
|
|
1626
|
+
agent or a peer gets 403. The browser keeps a localStorage copy so the mode is
|
|
1627
|
+
applied before first paint, and pushes a choice it already had up to the account
|
|
1628
|
+
the first time),
|
|
1623
1629
|
`/profiles`, `/secrets`, `/secrets/audit` (GET, **admin only** — the secret
|
|
1624
1630
|
audit log: who created/updated/deleted a secret, which profile it was attached
|
|
1625
1631
|
to — from the profile's editor or from a tick on the secret's *Injected into*
|
package/dist/server.js
CHANGED
|
@@ -70,6 +70,7 @@ import { mediaDirForGroup, mediaFileMode, parseMediaRequest, groupForMediaKey, p
|
|
|
70
70
|
import { runPrivileged, TREE_OP_TIMEOUT_MS } from "./privileged.js";
|
|
71
71
|
import { HOME_SKILLS_BASE, missingHomeSkillLinks, rewriteSkillsBase } from "./skill-paths.js";
|
|
72
72
|
import { instanceKey } from "./paths.js";
|
|
73
|
+
import { prefsFor, savePrefsFor } from "./user-prefs.js";
|
|
73
74
|
import { peerFileFor, loadPeers, savePeers, peerFromToken, signPeerToken, newPeer, withSalts, redeemVerdict, redeemPeer, normPeerName, removePeer, ownedByPeer, peersOutFileFor, tierPeersOutSeed, agentInvitePrompt, peerScope, } from "./peers.js";
|
|
74
75
|
import { loadCrons, saveCrons, upsertCron, removeCron, resolveCronId, nextRunFor, nextRunAfterFailure, isTransient, CRON_MAX_RETRIES, markCronPrompt, isCronPrompt, normalizeSchedule, parseDays, onceAt, stateAfterFire, scheduleLabel, cronTimeZone, defaultTimeZone, systemTimeZone, isValidTimeZone, } from "./crons.js";
|
|
75
76
|
import { loadWebhooks, saveWebhooks, upsertWebhook, removeWebhook, recordWebhookRun, publicWebhook, newWebhookToken, hashWebhookToken, presentedToken, callVerdict, payloadText, webhookPrompt, isWebhookPrompt, } from "./webhooks.js";
|
|
@@ -2157,6 +2158,41 @@ app.put("/mute", (req, res) => {
|
|
|
2157
2158
|
setMutedForCwd(loadConfig(), process.cwd(), req.body?.muted === true);
|
|
2158
2159
|
res.json({ muted: mutedForCwd(loadConfig(), process.cwd()) });
|
|
2159
2160
|
});
|
|
2161
|
+
// The caller's OWN display preferences (light/dark, chime, rail, tour seen),
|
|
2162
|
+
// stored per account so they follow the person across browsers and devices
|
|
2163
|
+
// (src/user-prefs.ts). A PERSON's: an agent or a peer is refused — it has no
|
|
2164
|
+
// screen to paint, and a peer's name is not an account name, so letting it
|
|
2165
|
+
// write could land on a human's row of the same name. No password = the
|
|
2166
|
+
// bootstrap admin, the one person such an instance has.
|
|
2167
|
+
function prefsOwner(req, res) {
|
|
2168
|
+
const me = currentAccount(req);
|
|
2169
|
+
if (!me) {
|
|
2170
|
+
res.status(401).json({ error: "unauthorized" });
|
|
2171
|
+
return null;
|
|
2172
|
+
}
|
|
2173
|
+
if (me.agent || peerRow(req)) {
|
|
2174
|
+
res.status(403).json({ error: "preferences belong to a person" });
|
|
2175
|
+
return null;
|
|
2176
|
+
}
|
|
2177
|
+
return me.name;
|
|
2178
|
+
}
|
|
2179
|
+
app.get("/prefs", (req, res) => {
|
|
2180
|
+
const who = prefsOwner(req, res);
|
|
2181
|
+
if (who)
|
|
2182
|
+
res.json(prefsFor(who));
|
|
2183
|
+
});
|
|
2184
|
+
// A PATCH in spirit: only the keys sent change, unknown keys are dropped.
|
|
2185
|
+
app.put("/prefs", (req, res) => {
|
|
2186
|
+
const who = prefsOwner(req, res);
|
|
2187
|
+
if (!who)
|
|
2188
|
+
return;
|
|
2189
|
+
try {
|
|
2190
|
+
res.json(savePrefsFor(who, req.body));
|
|
2191
|
+
}
|
|
2192
|
+
catch (e) {
|
|
2193
|
+
res.status(500).json({ error: `could not save preferences: ${e.message}` });
|
|
2194
|
+
}
|
|
2195
|
+
});
|
|
2160
2196
|
// Materialises shadok-ai's own source for the "Tweak Shadok-AI" CTA, and hands
|
|
2161
2197
|
// back the directory to start the agent in. Sits here so it inherits the same
|
|
2162
2198
|
// password gate as its neighbours.
|