shadok-ai 0.19.58 → 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 +18 -5
- 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 +186 -37
- package/public/secrets-panel.js +62 -0
package/README.md
CHANGED
|
@@ -392,8 +392,15 @@ Enter to skip; you can add it later from the web UI).
|
|
|
392
392
|
- **Provide the variable an agent asks for** — when an agent names a missing
|
|
393
393
|
credential in code (`` `HUBSPOT_TOKEN missing from the environment` ``), a
|
|
394
394
|
**+** sits right after it: one click opens the secret vault with the name
|
|
395
|
-
filled in and the agent's profile ticked, so you only paste the value
|
|
396
|
-
|
|
395
|
+
filled in and the agent's profile ticked, so you only paste the value — and
|
|
396
|
+
on *Add* **that agent is reloaded for you**, since a value only reaches a
|
|
397
|
+
process at spawn. Three cases it declines to do silently: an agent **mid-turn**
|
|
398
|
+
is offered instead of cut short (a reload is a respawn: the history is kept,
|
|
399
|
+
a running turn is not), an agent that **no binding feeds** is named so you can
|
|
400
|
+
tick a profile rather than restart it for nothing, and a **stopped** one needs
|
|
401
|
+
nothing — it reads the vault when it next launches. Any other live agent on a
|
|
402
|
+
profile that receives the secret is still offered, with a count of those
|
|
403
|
+
mid-turn. Only
|
|
397
404
|
names that look like a credential or a connection setting get one (`…_TOKEN`,
|
|
398
405
|
`…_KEY`, `…_URL`, `…_ID`…), never `NODE_ENV` nor shadok's own `SHADOK_*`.
|
|
399
406
|
- **`/` commands** — type `/` in the composer and a menu lists the Skill
|
|
@@ -1610,9 +1617,15 @@ key picked from the ⋯ menu, e.g. `emerald`; unknown/`amber` reverts to default
|
|
|
1610
1617
|
The default palette (stored key `amber`, labelled *Shadok*) is the Teams purple in
|
|
1611
1618
|
light mode and an indigo in dark mode; light mode follows Microsoft Teams, dark
|
|
1612
1619
|
mode a neutral near-black.
|
|
1613
|
-
Light/dark **mode** is an orthogonal, **
|
|
1614
|
-
(default
|
|
1615
|
-
|
|
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),
|
|
1616
1629
|
`/profiles`, `/secrets`, `/secrets/audit` (GET, **admin only** — the secret
|
|
1617
1630
|
audit log: who created/updated/deleted a secret, which profile it was attached
|
|
1618
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.
|