create-pmos 0.451.0 → 0.453.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/package.json +25 -25
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +24 -0
- package/workspace/guide/adler.md +1 -0
- package/workspace/guide/settings.md +8 -1
- package/workspace/lib/anthropic-key.js +66 -0
- package/workspace/lib/grill-api.js +8 -6
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-adler.js +12 -1
- package/workspace/public/pm/cozy-settings.js +41 -4
- package/workspace/public/pm/ini-view.css +6 -10
- package/workspace/public/pm/mission.js +33 -34
- package/workspace/run-tests.js +2 -1
- package/workspace/server.js +17 -1
- package/workspace/test-lists/anthropic-key.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.453.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -32,6 +32,30 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.453.0",
|
|
37
|
+
"at": "2026-10-29T13:00:26.537Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 1099,
|
|
42
|
+
"t": "The mission scene uses the blue Adler PNG set",
|
|
43
|
+
"s": "The mission scene uses the blue Adler PNG set"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"v": "0.452.0",
|
|
49
|
+
"at": "2026-10-29T12:06:35.455Z",
|
|
50
|
+
"f": 2,
|
|
51
|
+
"prs": [
|
|
52
|
+
{
|
|
53
|
+
"n": 1098,
|
|
54
|
+
"t": "Settings > Claude: API key and Claude profile",
|
|
55
|
+
"s": "Settings > Claude: API key and Claude profile"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
35
59
|
{
|
|
36
60
|
"v": "0.451.0",
|
|
37
61
|
"at": "2026-10-29T08:39:19.762Z",
|
|
@@ -247,30 +271,6 @@
|
|
|
247
271
|
"s": "Your impact and Claude runs the OKRs (batch 16 items 6, 7)"
|
|
248
272
|
}
|
|
249
273
|
]
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
"v": "0.433.0",
|
|
253
|
-
"at": "2026-10-28T02:16:22.945Z",
|
|
254
|
-
"f": 2,
|
|
255
|
-
"prs": [
|
|
256
|
-
{
|
|
257
|
-
"n": 1076,
|
|
258
|
-
"t": "The end diamond always names a milestone when the row has one (hotfix)",
|
|
259
|
-
"s": "When an initiative has any dated milestone task, the end ◇ is one of them."
|
|
260
|
-
}
|
|
261
|
-
]
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
"v": "0.432.0",
|
|
265
|
-
"at": "2026-10-28T02:08:08.690Z",
|
|
266
|
-
"f": 2,
|
|
267
|
-
"prs": [
|
|
268
|
-
{
|
|
269
|
-
"n": 1074,
|
|
270
|
-
"t": "Fewer menus, a short initiative menu, Delete with Undo (batch 16 item 5)",
|
|
271
|
-
"s": "Fewer menus, a short initiative menu, Delete with Undo (batch 16 item 5)"
|
|
272
|
-
}
|
|
273
|
-
]
|
|
274
274
|
}
|
|
275
275
|
]
|
|
276
276
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-29T13:00:22Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-29T13:00:22Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-29T13:00:22Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.453.0",
|
|
4
|
+
"at": "2026-10-29T13:00:26.537Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1099,
|
|
9
|
+
"t": "The mission scene uses the blue Adler PNG set",
|
|
10
|
+
"s": "The mission scene uses the blue Adler PNG set"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"v": "0.452.0",
|
|
16
|
+
"at": "2026-10-29T12:06:35.455Z",
|
|
17
|
+
"f": 2,
|
|
18
|
+
"prs": [
|
|
19
|
+
{
|
|
20
|
+
"n": 1098,
|
|
21
|
+
"t": "Settings > Claude: API key and Claude profile",
|
|
22
|
+
"s": "Settings > Claude: API key and Claude profile"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
2
26
|
{
|
|
3
27
|
"v": "0.451.0",
|
|
4
28
|
"at": "2026-10-29T08:39:19.762Z",
|
package/workspace/guide/adler.md
CHANGED
|
@@ -31,6 +31,7 @@ Each mood comes from real state. When nothing happens, Adler is calm or he rests
|
|
|
31
31
|
- **Claude's suggestions.** Adler asks with his worried face when Claude suggests a split or a merge, milestones, a goal or a success measure.
|
|
32
32
|
- **Intelligence.** His face in Claude's line at the top only. Charts, numbers and key results never show him.
|
|
33
33
|
- **Search.** Adler with a telescope when nothing matches.
|
|
34
|
+
- **Initiative mission.** The scene at the top of an initiative card uses the same art: the rocket on its pad (a blueprint, then built, then lift-off), the planet, the dish and the clouds. While Discover is open, Adler stands at the telescope; when Discover is done, he is gone. On a festival, the day's things hang in the sky in place of the clouds. When the news is bad (the initiative is late) the festival goes. With **Face only** or **Off**, neither he nor the festival shows.
|
|
34
35
|
- **Welcome.** Adler says hello once on the first step, and shows his thinking face while PMOS reads your folder.
|
|
35
36
|
- **Board.** His small face on the Jira chip: calm when Jira was read in the last day and a half, honest when it was not, and his thinking face while a press reads it again. He heads **New asks**: needs you while asks wait. When a delivery is missed, his honest face stands once in the Deliveries lane's header; hover it to see which. When you open a milestone that was delivered, he celebrates once in the panel (at most once a week); after that his face is calm. The diamond on the timeline stays plain, and nothing is sent to anyone.
|
|
36
37
|
- **Program charter.** His face on the check line, with his thinking face while Claude checks the milestones.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Settings in console3: one home for each setting"
|
|
4
4
|
description: "How to open Settings in console3, what each section holds, what the scope tags and the environment notes mean, and where the settings are kept."
|
|
5
|
-
timestamp: 2026-10-
|
|
5
|
+
timestamp: 2026-10-29
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Settings in console3: one home for each setting
|
|
@@ -35,6 +35,7 @@ Settings is not a tab. While it is open, no tab is selected. Press a tab to go b
|
|
|
35
35
|
| Claude sessions | What a new session starts with: the CLI, the model, the Claude profile and the launch flags for sessions you start, and the flags for automatic sessions. The session limits. Validate consent for this workspace. |
|
|
36
36
|
| Privacy and data | A list of what leaves this computer and when. Whether a TypeSafe key is saved, the local model that answers when there is no key (Off, Winnow or Laya), and the data folder. |
|
|
37
37
|
| Appearance | The theme (Same as system, Light or Dark) and the page that opens first. |
|
|
38
|
+
| Claude | The Claude profile that new Claude sessions start with, and the Anthropic API key for Claude's own runs on the API (see below). |
|
|
38
39
|
| Updates | The version of the app and of each workspace's kit. Check for updates, and how updates are found and applied. |
|
|
39
40
|
|
|
40
41
|
Type in **Search settings** to find a setting in any section. Press **Open section** to go to its section.
|
|
@@ -63,6 +64,12 @@ Open **Updates** and press **Check now**. PMOS asks the npm registry for the lat
|
|
|
63
64
|
- When PMOS runs from a PMOS checkout, the row says to update it with `git pull`. There is no Update button.
|
|
64
65
|
- **Update** on a workspace row updates the kit in that repository. It replaces the kit files in its `pmos/` folder (AGENTS.md, skills, scripts, templates, `okf/core`, the mod and KIT-VERSION). It does not change `state/`, `planning/` or `okf/product/`, and it does not commit. Review the change in the repository as a normal pull request.
|
|
65
66
|
|
|
67
|
+
## Claude: the profile and the API key
|
|
68
|
+
|
|
69
|
+
**Claude profile.** Pick one of the profiles on this computer, or **No profile**. New Claude sessions start with it. The list comes from the profile files in `~/.claude/profiles/`.
|
|
70
|
+
|
|
71
|
+
**API key.** Some runs of Claude, for example Grill, can use the Claude API and not a Claude session. Paste an Anthropic API key and press **Save** to turn this on. The key stays on this computer, in a file only you can read, outside every repository. PMOS never shows the key again: the row only says that a key is set. Press **Remove** to delete it. A key saved here is used before `ANTHROPIC_API_KEY`. A command that a run starts does not get the key. Only the computer that runs the workspace can change it. Set `PMOS_GRILL_API=off` to stop runs on the API.
|
|
72
|
+
|
|
66
73
|
## Where the settings are kept
|
|
67
74
|
|
|
68
75
|
The settings that had a home before this page keep it. For example, the recording engine is kept by the notes engine, Validate consent by the validate route, and the theme and the new-session defaults in this browser.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* anthropic-key.js — where the PM's Anthropic API key lives (D101). It pays for Claude's own runs on the API (lib/grill-api.js).
|
|
3
|
+
*
|
|
4
|
+
* The file is `<runtime state>/anthropic.json`, in the per-user runtime directory that lib/state-root.js keeps OUTSIDE every
|
|
5
|
+
* repository, so no commit, sync or share can carry it. It is written with mode 0600 through a temporary file and a rename, and
|
|
6
|
+
* a symlink at the target is refused (the lib/typesafe-settings.js pattern).
|
|
7
|
+
*
|
|
8
|
+
* What leaves this module: `status()` says whether a key is present and where it came from, never the key and never its length.
|
|
9
|
+
* `getKey()` is for the server's own API calls. No route returns its value, and nothing writes it to a log or to a child's
|
|
10
|
+
* environment: a session the server starts never sees it. `ANTHROPIC_API_KEY` in the environment is the fallback, read in place.
|
|
11
|
+
*
|
|
12
|
+
* validKey(k) · status(stateDir, env) → { present, source } · getKey(stateDir, env) → string | null
|
|
13
|
+
* setKey(stateDir, key) → { ok } | { ok: false, error } · clearKey(stateDir)
|
|
14
|
+
*/
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const path = require('path');
|
|
17
|
+
|
|
18
|
+
const FILE = 'anthropic.json';
|
|
19
|
+
const ENV_NAME = 'ANTHROPIC_API_KEY';
|
|
20
|
+
const validKey = (k) => typeof k === 'string' && /^sk-ant-[A-Za-z0-9_-]{8,400}$/.test(k);
|
|
21
|
+
const file = (stateDir) => path.join(stateDir, FILE);
|
|
22
|
+
|
|
23
|
+
function read(stateDir) {
|
|
24
|
+
try {
|
|
25
|
+
if (!fs.lstatSync(file(stateDir)).isFile()) return null;
|
|
26
|
+
const o = JSON.parse(fs.readFileSync(file(stateDir), 'utf8'));
|
|
27
|
+
return o && validKey(o.key) ? o.key : null;
|
|
28
|
+
} catch { return null; }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function write(stateDir, data) {
|
|
32
|
+
const target = file(stateDir);
|
|
33
|
+
try { if (fs.lstatSync(target).isSymbolicLink()) return { ok: false, error: 'the settings file is a symlink and was not written' }; } catch { /* not there yet */ }
|
|
34
|
+
const tmp = target + '.' + process.pid + '.tmp';
|
|
35
|
+
try {
|
|
36
|
+
fs.mkdirSync(stateDir, { recursive: true });
|
|
37
|
+
fs.writeFileSync(tmp, JSON.stringify(data), { mode: 0o600 });
|
|
38
|
+
fs.chmodSync(tmp, 0o600);
|
|
39
|
+
fs.renameSync(tmp, target);
|
|
40
|
+
return { ok: true };
|
|
41
|
+
} catch (e) {
|
|
42
|
+
try { fs.unlinkSync(tmp); } catch { /* nothing to clean */ }
|
|
43
|
+
return { ok: false, error: 'the key could not be saved (' + String((e && e.code) || 'write failed') + ')' };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The key for the server's own use: the saved one first, then the environment. */
|
|
48
|
+
function getKey(stateDir, env = null) {
|
|
49
|
+
return read(stateDir) || (env && validKey(String(env[ENV_NAME] || '').trim()) ? String(env[ENV_NAME]).trim() : null);
|
|
50
|
+
}
|
|
51
|
+
/** What the browser may know: present or not, and from where. */
|
|
52
|
+
function status(stateDir, env = null) {
|
|
53
|
+
if (read(stateDir)) return { present: true, source: 'settings' };
|
|
54
|
+
if (env && validKey(String(env[ENV_NAME] || '').trim())) return { present: true, source: 'environment' };
|
|
55
|
+
return { present: false, source: null };
|
|
56
|
+
}
|
|
57
|
+
function setKey(stateDir, key) {
|
|
58
|
+
const k = typeof key === 'string' ? key.trim() : '';
|
|
59
|
+
if (!validKey(k)) return { ok: false, error: 'that does not look like an Anthropic key: it starts with sk-ant- and has no spaces' };
|
|
60
|
+
return write(stateDir, { key: k });
|
|
61
|
+
}
|
|
62
|
+
function clearKey(stateDir) {
|
|
63
|
+
try { fs.unlinkSync(file(stateDir)); return { ok: true }; } catch (e) { return e && e.code === 'ENOENT' ? { ok: true } : { ok: false, error: 'the key could not be removed (' + String((e && e.code) || 'failed') + ')' }; }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = { FILE, ENV_NAME, validKey, status, getKey, setKey, clearKey };
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* The run's only write is `pmos grill find` (pinned by the run's PMOS_GRILL_* env, as in the CLI run). The loop stops at its budget:
|
|
9
9
|
* after every response the cost is counted from the usage, and the run ends before it can pass --budget.
|
|
10
10
|
*
|
|
11
|
-
* available(env) → bool
|
|
11
|
+
* available(env, apiKey?) → bool a key is saved in Settings (lib/anthropic-key.js) or set in ANTHROPIC_API_KEY, and PMOS_GRILL_API is not off
|
|
12
12
|
* costOf(model, usage) → US dollars null for a model with no known price
|
|
13
|
-
* run({ prompt, root, env, budget, model?, client?, signal?, pmosBin? }) → Promise<{ ok, code, costUsd, note?, turns }>
|
|
13
|
+
* run({ prompt, root, env, budget, model?, client?, signal?, pmosBin?, apiKey? }) → Promise<{ ok, code, costUsd, note?, turns }>
|
|
14
14
|
* (the shape lib/grill-runs.js `ended` reads: { code, result: { ok, costUsd } })
|
|
15
15
|
*/
|
|
16
16
|
const fs = require('fs');
|
|
@@ -29,7 +29,7 @@ const SKIP = new Set(['node_modules', '.git', 'dist', 'build']);
|
|
|
29
29
|
const PMOS_OK = [['initiative', 'export'], ['task', 'list'], ['source', 'status'], ['source', 'show'], ['grill', 'find'], ['grill', 'voices'], ['grill', 'status']];
|
|
30
30
|
|
|
31
31
|
const flagOff = (v) => /^(off|0|false|no)$/i.test(String(v || '').trim());
|
|
32
|
-
const available = (env = process.env) => !!(env.ANTHROPIC_API_KEY && String(env.ANTHROPIC_API_KEY).trim()) && !flagOff(env.PMOS_GRILL_API);
|
|
32
|
+
const available = (env = process.env, apiKey = null) => !!((apiKey && String(apiKey).trim()) || (env.ANTHROPIC_API_KEY && String(env.ANTHROPIC_API_KEY).trim())) && !flagOff(env.PMOS_GRILL_API);
|
|
33
33
|
const modelOf = (env = process.env) => String(env.PMOS_GRILL_MODEL || '').trim() || DEFAULT_MODEL;
|
|
34
34
|
function costOf(model, usage) {
|
|
35
35
|
const p = PRICE[model]; if (!p || !usage) return null;
|
|
@@ -105,12 +105,14 @@ async function callTool(name, input, ctx) {
|
|
|
105
105
|
} catch (e) { return { text: 'failed: ' + String((e && e.message) || e).slice(0, 200), error: true }; }
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
async function run({ prompt, root, env: extra, budget, model, client, signal, pmosBin } = {}) {
|
|
108
|
+
async function run({ prompt, root, env: extra, budget, model, client, signal, pmosBin, apiKey } = {}) {
|
|
109
109
|
const env = { ...process.env, ...(extra || {}) };
|
|
110
|
+
const key = (apiKey && String(apiKey).trim()) || env.ANTHROPIC_API_KEY;
|
|
111
|
+
delete env.ANTHROPIC_API_KEY; // the key is the loop's own: a pmos command it runs never sees it
|
|
110
112
|
const useModel = model || modelOf(env), limit = Number(budget);
|
|
111
|
-
if (!
|
|
113
|
+
if (!key && !client) return { ok: false, code: 1, costUsd: 0, turns: 0, note: 'no ANTHROPIC_API_KEY' };
|
|
112
114
|
if (PRICE[useModel] == null) return { ok: false, code: 1, costUsd: 0, turns: 0, note: `no known price for ${useModel}: the budget cannot be held` };
|
|
113
|
-
const api = client || new (require('@anthropic-ai/sdk'))({ apiKey:
|
|
115
|
+
const api = client || new (require('@anthropic-ai/sdk'))({ apiKey: key });
|
|
114
116
|
const ctx = { root: path.resolve(root || process.cwd()), env, pmosBin: pmosBin || path.join(__dirname, '..', 'bin', 'pmos.js') };
|
|
115
117
|
const messages = [{ role: 'user', content: String(prompt) }];
|
|
116
118
|
let cost = 0, turns = 0;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.453.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.453.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -79,7 +79,7 @@ const r1 = (v) => Math.round(v * 10) / 10;
|
|
|
79
79
|
const tw = (i) => (i % 3 ? ' d' + (i % 3 + 1) : '');
|
|
80
80
|
/* One PNG in an SVG. (x, y): where its anchor lands. w (or o.h): the width (height) its solid pixels get. o: { ax, ay (the anchor inside the
|
|
81
81
|
* solid pixels, 0-1, default the middle), rot (degrees about the anchor), op, cls } */
|
|
82
|
-
function put(name, x, y, w, o = {}) {
|
|
82
|
+
export function put(name, x, y, w, o = {}) {
|
|
83
83
|
const a = ART[name]; if (!a) return '';
|
|
84
84
|
const bw = a[3] - a[1], bh = a[4] - a[2], s = o.h ? o.h / bh : w / bw, ax = o.ax == null ? 0.5 : o.ax, ay = o.ay == null ? 0.5 : o.ay;
|
|
85
85
|
return `<image href="${artUrl(name)}" x="${r1(x - (a[1] + ax * bw) * s)}" y="${r1(y - (a[2] + ay * bh) * s)}" width="${r1(512 * s)}" height="${r1(512 * s)}" decoding="async"`
|
|
@@ -268,6 +268,17 @@ function dressed(mood, o) {
|
|
|
268
268
|
return CH[key] ? { ch: CH[key], colors: o.colors || (today && today.colors) || null } : null;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
/** The festive things of today's charm (or o.charm) for a small scene of W by H units: { key, name, back } with back as markup, or null. Only with
|
|
272
|
+
* Settings > Adler > How much: Full. Scaled from the 400 by 260 scenes; the big backdrops (mountains, forests) stay out, and only things that float in the sky stay, a strand (bunting, garland, lights) hangs at the top left, clear of the rocket's flight, and what would stand on
|
|
273
|
+
* the right where the mission's planet is moves left of it. The mission scene (pm/mission.js) draws it behind everything else. */
|
|
274
|
+
export function festive(W, H, o = {}) {
|
|
275
|
+
const key = o.charm || (D && D.key), ch = CH[key];
|
|
276
|
+
if (!ch || P['adler.amount'] !== 'full') return null;
|
|
277
|
+
const k = H / 260 * 0.9, STRAND = ['bunting', 'flower_garland', 'string_lights'];
|
|
278
|
+
const list = (ch.back || []).filter(([n, , yf, w]) => STRAND.includes(n) || (w <= 200 && yf <= 0.4))
|
|
279
|
+
.map(([n, xf, yf, w, e = {}]) => (STRAND.includes(n) ? [n, 0.24, 0.12, r1(W * 0.24), e] : [n, xf > 0.74 && xf < 0.92 && yf < 0.45 ? 0.4 : xf, yf, Math.max(14, r1(w * k)), e]));
|
|
280
|
+
return { key, name: ch.name, back: things(W, H, list) };
|
|
281
|
+
}
|
|
271
282
|
/** One press in Settings > Adler: POST /api/settings, then the page follows at once. → the server's answer */
|
|
272
283
|
export async function savePref(post, key, value) {
|
|
273
284
|
if (!(key in PREF_DEF) || !PREF_OPTIONS[key].includes(value)) return { ok: false, error: 'That is not an Adler setting.' };
|
|
@@ -22,13 +22,18 @@
|
|
|
22
22
|
* it with ↻ Read again, and the place menu opens Settings at Connectors. Every write is the PM's press (pmPost carries the launch nonce).
|
|
23
23
|
* PMOS reads the sources and never posts to them.
|
|
24
24
|
* openSettings(section?) */
|
|
25
|
-
import { pmGet, pmPost } from './http.js';
|
|
25
|
+
import { pmGet, pmPost, pressFetch } from './http.js';
|
|
26
26
|
import { esc, svg, ICON, toast, wsParam, wsQ } from './cozy-evui.js';
|
|
27
27
|
import { sourceRows, staleOf, partsOf } from './cozy-evmodel.js';
|
|
28
28
|
import * as AD from './cozy-adler.js';
|
|
29
29
|
import * as SE from './cozy-seasons.js';
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
/** PUT or DELETE with the page's launch nonce (pressFetch). Only the key row needs them. */
|
|
32
|
+
async function pmSend(method, path, body) {
|
|
33
|
+
try { const res = await pressFetch(path, { method, ...(body === undefined ? {} : { body: JSON.stringify(body) }) }); const out = await res.json(); if (out && typeof out === 'object' && !res.ok) out.status = res.status; return out; }
|
|
34
|
+
catch (e) { return { ok: false, error: 'could not reach the workspace server — ' + ((e && e.message) || String(e)) }; }
|
|
35
|
+
}
|
|
36
|
+
const SECTIONS = [['general', 'General'], ['claude', 'Claude'], ['adler', 'Adler'], ['connectors', 'Connectors'], ['workspaces', 'Workspaces'], ['workflows', 'Workflows'], ['updates', 'Updates'], ['whatsnew', "What's new"]];
|
|
32
37
|
const PAGE_LINKS = { workflows: '/premium-workflows.html' }; // a section that is a page of its own: the row goes there
|
|
33
38
|
const SRC = { calendar: 'Calendar', wispr: 'Wispr Flow', mail: 'Mail', slack: 'Slack', jira: 'Jira', confluence: 'Confluence', github: 'GitHub', drive: 'Google Drive', figma: 'Figma', website: 'Your websites' };
|
|
34
39
|
const VIEWER_KEY = 'pmos.cz.viewer';
|
|
@@ -205,7 +210,23 @@ function whatsnew() {
|
|
|
205
210
|
if (!L.length) return '<p class="ev-small ev-mut">No kit summaries yet. Each kit published from now on carries one, and Check now reads the newest ones.</p>';
|
|
206
211
|
return `<ul class="ev-kv">${L.slice(0, 40).map((e) => `<li><b>${esc(e.v)}</b><div class="ev-tx">${mine && e.v === mine ? '<span class="ev-pill">Yours</span> ' : mine && cmpVer(e.v, mine) > 0 ? '<span class="ev-pill y">Newer</span> ' : ''}${(e.prs || []).map((p) => `<p>${esc(p.t && p.t !== p.s ? p.t + ': ' + p.s : p.s)}${p.n ? ' <span class="ev-mut">#' + esc(p.n) + '</span>' : ''}</p>`).join('') || '<p class="ev-mut">No summary was recorded for this kit.</p>'}</div></li>`).join('')}</ul>`;
|
|
207
212
|
}
|
|
208
|
-
|
|
213
|
+
/* Settings > Claude: which Claude profile PMOS starts Claude sessions with, and the API key for Claude's own runs (D101).
|
|
214
|
+
* The key is typed here and goes to this computer only; the page never gets it back, only whether one is set and where from. */
|
|
215
|
+
function claudeSec() {
|
|
216
|
+
const C = T.cl;
|
|
217
|
+
if (!C) return '<p class="ev-small ev-mut">Reading the profiles and the key.</p>';
|
|
218
|
+
const ps = C.profiles || [], pref = (C.prefs && C.prefs.claude) || '';
|
|
219
|
+
const opts = `<option value=""${pref ? '' : ' selected'}>No profile</option>` + ps.map((x) => `<option value="${esc(x.id)}"${x.id === pref ? ' selected' : ''}>${esc(x.label || x.id)}${x.account ? ' · ' + esc(x.account) : ''}</option>`).join('');
|
|
220
|
+
const gone = pref && !ps.some((x) => x.id === pref);
|
|
221
|
+
const profSub = C.perr ? 'The profiles could not be read: ' + C.perr : !ps.length ? 'No profiles on this computer. PMOS starts Claude as you are signed in.' : gone ? 'The saved profile is no longer on this computer.' : pref ? 'New Claude sessions start with it.' : 'New Claude sessions start as you are signed in.';
|
|
222
|
+
const k = C.key || {};
|
|
223
|
+
const keySub = k.present ? (k.source === 'environment' ? 'Set in ANTHROPIC_API_KEY. A key saved here is used first.' : 'Saved on this computer only. PMOS never shows it again.') : 'Not set. Claude\u2019s own runs, such as Grill, use a Claude session instead.';
|
|
224
|
+
const keyRight = `<span class="ev-dr-pl"><label class="ev-vh" for="evKey">Anthropic API key</label><input id="evKey" class="ev-inp" type="password" autocomplete="off" spellcheck="false" placeholder="${k.present ? 'Replace the key' : 'sk-ant-\u2026'}" data-ev-key><button type="button" class="ev-btn sm pri" data-ev-keysave>Save</button>${k.source === 'settings' ? '<button type="button" class="ev-btn sm" data-ev-keyclear>Remove</button>' : ''}</span>`;
|
|
225
|
+
return trow('Claude profile', profSub, `<label class="ev-vh" for="evProf">Claude profile</label><select id="evProf" class="ev-inp" data-ev-prof>${opts}</select>`)
|
|
226
|
+
+ trow('API key', keySub, keyRight)
|
|
227
|
+
+ (k.present && C.off ? trow('Runs on the API', 'Off: PMOS_GRILL_API is off in the environment.', '<span class="ev-pill">Off</span>') : '');
|
|
228
|
+
}
|
|
229
|
+
const BODY = { general, claude: claudeSec, adler: adlerSec, connectors, workspaces, updates, whatsnew };
|
|
209
230
|
function draw() {
|
|
210
231
|
const el = T.el; if (!el || el.hidden) return;
|
|
211
232
|
// a redraw replaces the nodes: keep focus on the same control (by its data-ev-* key), else on the open section, never on the body
|
|
@@ -231,6 +252,12 @@ function mount() {
|
|
|
231
252
|
document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && T.el && !T.el.hidden && !T.el.contains(e.target)) { e.preventDefault(); e.stopPropagation(); closeSettings(); } }, true);
|
|
232
253
|
T.el.addEventListener('change', async (e) => {
|
|
233
254
|
const x = e.target;
|
|
255
|
+
if (x.matches('[data-ev-prof]')) {
|
|
256
|
+
const r = await pmPost('/api/profiles/prefer', { agent: 'claude', profile: x.value || null });
|
|
257
|
+
if (r && r.ok) { T.cl = { ...T.cl, prefs: { ...((T.cl && T.cl.prefs) || {}) } }; if (x.value) T.cl.prefs.claude = x.value; else delete T.cl.prefs.claude; }
|
|
258
|
+
T.msg = r && r.ok ? (x.value ? 'Saved. New Claude sessions start with this profile.' : 'Saved. New Claude sessions start without a profile.') : (r && r.error) || 'Not saved.';
|
|
259
|
+
draw(); return;
|
|
260
|
+
}
|
|
234
261
|
if (x.matches('[data-ev-dsel]')) { await saveDress(x.dataset.evDsel, x.value); return; }
|
|
235
262
|
if (x.matches('[data-ev-dcol]')) { const c = [...(dp()['adler.dress.colors'] || ['blue', 'green'])]; c[Number(x.dataset.evDcol)] = x.value; await saveDress('adler.dress.colors', c); return; }
|
|
236
263
|
if (x.matches('[data-ev-bday]')) { if (!/^\d{4}-\d{2}-\d{2}$/.test(x.value)) return; T.bday = false; await saveDress('adler.dress.birthday', x.value.slice(5), 'Saved. He dresses up on your birthday.'); return; }
|
|
@@ -274,6 +301,15 @@ async function press(e) {
|
|
|
274
301
|
PP.openPicker(t, { P, label: 'Products', onApply: async (on) => { const r = await PP.savePick(on); if (!r.ok) { T.msg = r.error; draw(); return; } T.prods = r.products; draw(); } });
|
|
275
302
|
return;
|
|
276
303
|
}
|
|
304
|
+
if ('evKeysave' in t.dataset || 'evKeyclear' in t.dataset) {
|
|
305
|
+
const clear = 'evKeyclear' in t.dataset, inp = T.el.querySelector('#evKey'), val = inp ? inp.value.trim() : '';
|
|
306
|
+
if (!clear && !val) { T.msg = 'Paste the key first.'; draw(); return; }
|
|
307
|
+
const r = clear ? await pmSend('DELETE', '/api/anthropic/key') : await pmSend('PUT', '/api/anthropic/key', { key: val });
|
|
308
|
+
if (inp) inp.value = '';
|
|
309
|
+
if (r && r.ok) T.cl = { ...T.cl, key: r.key };
|
|
310
|
+
T.msg = r && r.ok ? (clear ? 'The saved key is removed.' : 'Saved on this computer. Claude\u2019s own runs use it from now on.') : (r && r.error) || 'Not saved.';
|
|
311
|
+
draw(); return;
|
|
312
|
+
}
|
|
277
313
|
if (t.dataset.evRead || 'evReadall' in t.dataset) { readAgain(t.dataset.evRead || ''); return; }
|
|
278
314
|
if (T.busy) return;
|
|
279
315
|
T.busy = true; T.msg = '';
|
|
@@ -349,6 +385,7 @@ async function readAgain(id) {
|
|
|
349
385
|
}
|
|
350
386
|
async function load() {
|
|
351
387
|
readFresh();
|
|
388
|
+
pmGet('/api/profiles').then(async (pr) => { const k = await pmGet('/api/anthropic'); T.cl = { profiles: pr && Array.isArray(pr.profiles) ? pr.profiles : [], prefs: (pr && pr.prefs) || {}, perr: pr && pr.ok === false ? (pr.error || 'the server did not answer') : '', key: k && k.ok ? k.key : { present: false, source: null }, off: !!(k && k.off) }; draw(); }).catch(() => { T.cl = { profiles: [], prefs: {}, perr: 'the server did not answer', key: { present: false, source: null } }; draw(); });
|
|
352
389
|
const [w, p, s, b] = await Promise.all([pmGet('/api/workspaces'), pmGet('/api/proactive/settings'), pmGet('/api/settings'), pmGet('/api/briefing-premium')]);
|
|
353
390
|
T.ws = w && Array.isArray(w.workspaces) ? w.workspaces : [];
|
|
354
391
|
T.src = p && p.ok && p.settings ? { ...p.settings.briefSources } : {}; T.con = p && p.ok && p.settings ? { ...p.settings.connectors } : {};
|
|
@@ -364,7 +401,7 @@ async function load() {
|
|
|
364
401
|
export function openSettings(section) {
|
|
365
402
|
const el = mount();
|
|
366
403
|
if (section === 'dress') { T.sec = 'adler'; T.dress = true; } else if (section && BODY[section]) { T.sec = section; T.dress = false; }
|
|
367
|
-
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.fresh = null; T.note = {}; T.dset = {}; }
|
|
404
|
+
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.fresh = null; T.note = {}; T.dset = {}; T.cl = null; }
|
|
368
405
|
el.hidden = false; document.getElementById('evStScrim').hidden = false; el.setAttribute('data-esc-layer', '');
|
|
369
406
|
draw();
|
|
370
407
|
const f = el.querySelector('[aria-current="page"]'); if (f) f.focus();
|
|
@@ -1001,23 +1001,19 @@ button.iv-mt.iv-wf { padding: 0 !important; margin: 0 !important; }
|
|
|
1001
1001
|
.mi-s0 { stop-color: var(--mi-s0); } .mi-s1 { stop-color: var(--mi-s1); }
|
|
1002
1002
|
.mi-t0 { stop-color: var(--mi-gold); stop-opacity: 0; } .mi-t1 { stop-color: var(--mi-t1); }
|
|
1003
1003
|
.mi-star { fill: var(--mi-star); }
|
|
1004
|
-
.mi-
|
|
1005
|
-
.mi-ring { stroke: var(--mi-gold); } .mi-spot { fill: var(--mi-spot); opacity: .8; } .mi-qm { fill: var(--mi-qm); font-size: var(--fs-1); font-weight: 800; }
|
|
1004
|
+
.mi-qm { fill: var(--mi-qm); font-size: var(--fs-1); font-weight: 800; }
|
|
1006
1005
|
.mi-gr { fill: var(--mi-gr); }
|
|
1007
1006
|
.mi-st.dn { fill: var(--mi-dn); } .mi-st.nw { fill: var(--mi-nw); } .mi-st.q { fill: var(--mi-q); } .mi-st.late { fill: var(--mi-late); } .mi-st.hold { fill: var(--mi-hold); }
|
|
1008
1007
|
.mi-dsh { stroke: var(--mi-dash); } .mi-dsh.nw { stroke: var(--mi-nw); } .mi-dsh.late { stroke: var(--mi-late); } .mi-dsh.dn { stroke: var(--mi-dn); }
|
|
1009
1008
|
.mi-pole { fill: var(--mi-pole); }
|
|
1010
1009
|
.mi-fl.dn { fill: var(--mi-gold); } .mi-fl.q { fill: var(--mi-dash); } .mi-fl.late { fill: var(--mi-late); }
|
|
1011
|
-
.mi-ln { stroke: var(--mi-line); }
|
|
1012
|
-
.mi-wh { fill: var(--mi-wh); } .mi-lens { fill: var(--mi-lens); }
|
|
1013
1010
|
.mi-beam { stroke: var(--mi-lens); opacity: .7; }
|
|
1014
1011
|
.mi-pad { fill: var(--mi-pad); } .mi-padl { stroke: var(--mi-pad); }
|
|
1015
|
-
|
|
1016
|
-
.mi-
|
|
1012
|
+
/* the PNG art: the blueprint is the rocket washed out; a late mission's rocket glows orange (the picture's own colours stay) */
|
|
1013
|
+
.mi-bp { filter: grayscale(1) contrast(.8); }
|
|
1014
|
+
.mi-lt { filter: drop-shadow(0 0 2px var(--mi-late)); }
|
|
1017
1015
|
.mi-spark { fill: var(--mi-gold); }
|
|
1018
|
-
.mi-smoke { fill: var(--mi-smoke); }
|
|
1019
1016
|
.mi-path { stroke: var(--mi-path); }
|
|
1020
|
-
.mi-fo { fill: var(--mi-t1); } .mi-fy { fill: var(--mi-gold); }
|
|
1021
1017
|
.mi-flag { fill: var(--mi-nw); }
|
|
1022
1018
|
.mi-lamp { fill: var(--mi-off); } .mi-lamp.on { fill: var(--mi-ok); } .mi-lamp.ls { fill: var(--mi-gold); }
|
|
1023
1019
|
.mi-wave { stroke: var(--mi-gold); }
|
|
@@ -1032,12 +1028,12 @@ button.iv-mt.iv-wf { padding: 0 !important; margin: 0 !important; }
|
|
|
1032
1028
|
.mi-svg .mi-beam { animation: mi-beam 1.6s linear infinite; }
|
|
1033
1029
|
.mi-svg .mi-spark { animation: mi-fade .5s ease-out infinite; }
|
|
1034
1030
|
.mi-svg .mi-spark.mi-k1 { animation-delay: .22s; } .mi-svg .mi-spark.mi-k2 { animation-delay: .44s; }
|
|
1035
|
-
.mi-svg .mi-flame { transform-box: fill-box; transform-origin: 50% 0%; animation: mi-flick .12s ease-in-out infinite alternate; }
|
|
1036
1031
|
.mi-svg .mi-rk { animation: mi-shake 2.4s ease-in-out infinite; }
|
|
1037
1032
|
.mi-svg .mi-puff { transform-box: fill-box; transform-origin: center; animation: mi-puff 3.2s ease-in-out infinite; }
|
|
1038
1033
|
.mi-svg .mi-vn { stroke-dasharray: 100; stroke-dashoffset: 100; animation: mi-draw 1.6s ease-out .2s forwards; }
|
|
1039
1034
|
.mi-svg .mi-flag { animation: mi-wavef 1.8s ease-in-out infinite; }
|
|
1040
1035
|
.mi-svg .mi-wave { animation: mi-fade 1.5s ease-out infinite; }
|
|
1036
|
+
.mi-svg .mi-cloud { animation: mi-drift 16s ease-in-out infinite alternate; } .mi-svg .mi-cloud.mi-d3 { animation-duration: 21s; }
|
|
1041
1037
|
.mi-svg .mi-wave.mi-k1 { animation-delay: .5s; } .mi-svg .mi-wave.mi-k2 { animation-delay: 1s; }
|
|
1042
1038
|
/* the stars twinkle out of step (was an inline animation-delay; R28-1) */
|
|
1043
1039
|
.mi-svg .mi-d1 { animation-delay: 0.37s; } .mi-svg .mi-d2 { animation-delay: 0.74s; } .mi-svg .mi-d3 { animation-delay: 1.11s; } .mi-svg .mi-d4 { animation-delay: 1.48s; } .mi-svg .mi-d5 { animation-delay: 1.85s; } .mi-svg .mi-d6 { animation-delay: 2.22s; }
|
|
@@ -1045,8 +1041,8 @@ button.iv-mt.iv-wf { padding: 0 !important; margin: 0 !important; }
|
|
|
1045
1041
|
@keyframes mi-pulse { 0%, 100% { transform: scale(.8); opacity: .6; } 50% { transform: scale(1.25); opacity: 1; } }
|
|
1046
1042
|
@keyframes mi-scan { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(4deg); } }
|
|
1047
1043
|
@keyframes mi-beam { to { stroke-dashoffset: -14; } }
|
|
1044
|
+
@keyframes mi-drift { to { transform: translateX(8px); } }
|
|
1048
1045
|
@keyframes mi-fade { 0% { opacity: 1; } 100% { opacity: 0; } }
|
|
1049
|
-
@keyframes mi-flick { from { transform: scaleY(.7); opacity: .85; } to { transform: scaleY(1.2); opacity: 1; } }
|
|
1050
1046
|
@keyframes mi-shake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(.4px, -1.2px); } 50% { transform: translate(-.3px, -2px); } 75% { transform: translate(.3px, -.8px); } }
|
|
1051
1047
|
@keyframes mi-puff { 0%, 100% { transform: scale(.85) translateY(0); opacity: .85; } 50% { transform: scale(1.15) translateY(-1.5px); opacity: .55; } }
|
|
1052
1048
|
@keyframes mi-draw { to { stroke-dashoffset: 0; } }
|
|
@@ -20,7 +20,15 @@
|
|
|
20
20
|
* The stages say what happened and the dates how far along it is: the rocket stays a blueprint until Build runs, flies once Build is done,
|
|
21
21
|
* and lands only when the release milestone is done (with none, when Deliver is done).
|
|
22
22
|
* Monitor: a dish at the right edge listens, with waves; the last milestone ("Did it work?") lights it green.
|
|
23
|
-
* Motion (draw-in,
|
|
23
|
+
* Motion (draw-in, sparks, scan, twinkle, waves) is CSS; all of it stops under reduced motion and Settings > Adler > Motion: Still.
|
|
24
|
+
*
|
|
25
|
+
* THE ART (Wawan, 2026-10-29, the blue Adler's PNG set): the telescope, the planet, the rocket and the dish are PNGs of pm/adler/05_space and
|
|
26
|
+
* 03_growth_activity, placed by cozy-adler.js put() by each picture's solid pixels. The rocket is rocket_idle on the pad (a faded blueprint,
|
|
27
|
+
* then built from the bottom up by a clip), rocket_flying in flight (turned to the curve), rocket_idle again when it has landed or the work is
|
|
28
|
+
* on hold; the sky has clouds, the lift-off is rocket_liftoff, a landing and a heard "Did it work?" sparkle; and on a festival (Settings > Adler
|
|
29
|
+
* > Dress for the day) the sky takes the day's things (cozy-adler.js festive()). The telescope is the PNG with Adler at it, so it stands only while
|
|
30
|
+
* Discover is open (the scene's one Adler, and only with Settings > Adler > How much: Full). The ground, the stage strip, the flags, the pad, the trail and the stars stay drawn, in the --mi-* tokens. */
|
|
31
|
+
import { put, prefs, festive } from './cozy-adler.js';
|
|
24
32
|
|
|
25
33
|
export const W = 340, H = 100;
|
|
26
34
|
const GY = 78; // the ground line
|
|
@@ -119,13 +127,6 @@ export function crowded(points, gap = NEAR) {
|
|
|
119
127
|
return out;
|
|
120
128
|
}
|
|
121
129
|
|
|
122
|
-
const rocketBody = (fin = 'mi-fin') => '<path d="M-5 0 L-5 -18 Q-5 -26 0 -31 Q5 -26 5 -18 L5 0Z" class="mi-rb mi-ln" stroke-width="1.1" stroke-linejoin="round"/>'
|
|
123
|
-
+ `<path d="M-5 -7 L-10 1 L-5 0Z M5 -7 L10 1 L5 0Z" class="${fin} mi-ln" stroke-width=".9" stroke-linejoin="round"/>`
|
|
124
|
-
+ '<circle cx="0" cy="-17" r="2.4" class="mi-win mi-ln" stroke-width=".8"/>';
|
|
125
|
-
const ghostBody = () => '<path d="M-5 0 L-5 -18 Q-5 -26 0 -31 Q5 -26 5 -18 L5 0Z" fill="none" class="mi-gh" stroke-width="1.1" stroke-dasharray="2 2" stroke-linejoin="round"/>'
|
|
126
|
-
+ '<path d="M-5 -7 L-10 1 L-5 0Z M5 -7 L10 1 L5 0Z" fill="none" class="mi-gh" stroke-width=".9" stroke-dasharray="2 2" stroke-linejoin="round"/>'
|
|
127
|
-
+ '<circle cx="0" cy="-17" r="2.4" fill="none" class="mi-gh" stroke-width=".8" stroke-dasharray="2 2"/>';
|
|
128
|
-
|
|
129
130
|
let seq = 0;
|
|
130
131
|
/** The press around one drawn milestone: a 44 px square, the words for a reader, the task it opens. */
|
|
131
132
|
function press(inner, it, x, y, o, key, hold) {
|
|
@@ -147,12 +148,14 @@ export function missionSvg(M, o = {}) {
|
|
|
147
148
|
[[30, 12, 1], [84, 26, 0.8], [124, 9, 1.2], [160, 30, 0.9], [250, 12, 1], [292, 30, 0.8], [W - 26, 8, 1]].forEach(([x, y, r], k) => {
|
|
148
149
|
s += `<circle class="mi-tw mi-star mi-d${k}" transform-origin="${x} ${y}" cx="${x}" cy="${y}" r="${r}"/>`;
|
|
149
150
|
});
|
|
151
|
+
// clouds drift in the sky; on a festival the sky takes the day's things instead (never on bad news: the charm comes off)
|
|
152
|
+
const fest = M.late ? null : festive(W, H);
|
|
153
|
+
if (!fest) s += `<g class="mi-cloud" aria-hidden="true">${put('cloud_medium', 62, 24, 34, { op: 0.9 })}</g><g class="mi-cloud mi-d3" aria-hidden="true">${put('cloud_small', 132, 40, 24, { op: 0.8 })}</g>`;
|
|
154
|
+
if (fest) s += `<g class="mi-fest" aria-label="${esc('Dressed for ' + fest.name)}" role="img">${fest.back}</g>`;
|
|
150
155
|
// the target planet
|
|
151
156
|
const planet = `<g class="${M.found ? '' : 'mi-seek'}" transform-origin="${PX} ${PY}">`
|
|
152
|
-
+
|
|
153
|
-
|
|
154
|
-
+ `<circle cx="${PX - 4}" cy="${PY - 3}" r="2.6" class="mi-spot"/><circle cx="${PX + 4}" cy="${PY + 4}" r="1.8" class="mi-spot"/>`
|
|
155
|
-
: `<text x="${PX}" y="${PY + 4}" text-anchor="middle" class="mi-qm">?</text>`) + '</g>';
|
|
157
|
+
+ (M.found ? put('planet_cloud', PX, PY, 36, { cls: 'mi-art' })
|
|
158
|
+
: put('planet_glass', PX, PY, 36, { op: 0.5, cls: 'mi-art' }) + `<text x="${PX}" y="${PY + 4}" text-anchor="middle" class="mi-qm">?</text>`) + '</g>';
|
|
156
159
|
s += press(planet, M.planet, PX, PY, o, 'planet', crowd);
|
|
157
160
|
// the ground and the stage strip
|
|
158
161
|
s += `<path d="M0 ${H} L0 ${GY - 2} Q60 ${GY - 5} 130 ${GY - 2} T${W} ${GY - 3} L${W} ${H}Z" class="mi-gr"/>`;
|
|
@@ -170,29 +173,26 @@ export function missionSvg(M, o = {}) {
|
|
|
170
173
|
// Discover: the telescope looks for the planet
|
|
171
174
|
const still = M.hold || M.empty;
|
|
172
175
|
const seeking = !M.found && !M.hold;
|
|
173
|
-
|
|
174
|
-
s += `<
|
|
175
|
-
+ `<g class="${seeking ? 'mi-scan' : ''}" transform-origin="${TX} ${GY - 12}"><g transform="translate(${TX} ${GY - 12}) rotate(${ang.toFixed(1)})">`
|
|
176
|
-
+ '<rect x="-4" y="-2.6" width="15" height="5.2" rx="2" class="mi-wh mi-ln" stroke-width="1.1"/><rect x="10" y="-3.4" width="3" height="6.8" rx="1" class="mi-lens mi-ln" stroke-width=".9"/></g></g></g>';
|
|
177
|
-
if (seeking && !M.empty) s += `<line class="mi-beam" x1="${TX + 10}" y1="${GY - 19}" x2="${PX - 12}" y2="${PY + 4}" stroke-width="1.2" stroke-dasharray="2 5" aria-hidden="true"/>`;
|
|
176
|
+
if (!M.found && prefs()['adler.amount'] === 'full') s += `<g aria-hidden="true"><g class="${seeking ? 'mi-scan' : ''}" transform-origin="${TX} ${GY}">${put('telescope', TX, GY + 1, 36, { ay: 1 })}</g></g>`;
|
|
177
|
+
if (seeking && !M.empty) s += `<line class="mi-beam" x1="${TX + 15}" y1="${GY - 25}" x2="${PX - 12}" y2="${PY + 4}" stroke-width="1.2" stroke-dasharray="2 5" aria-hidden="true"/>`;
|
|
178
178
|
// Plan to Build: the pad at the start of Build; the rocket is a blueprint, then built from the bottom up; past Build 50% it flies
|
|
179
179
|
// the pad stands in the middle, as the telescope stands left and the dish right (Wawan 12:26): the props keep their places, only the
|
|
180
180
|
// stages under them follow the dates
|
|
181
181
|
const bx = W / 2;
|
|
182
|
-
const
|
|
182
|
+
const late = M.late ? 'mi-lt' : ''; // an orange glow round the rocket (the PNG's own colours stay)
|
|
183
183
|
s += `<g aria-hidden="true"><rect x="${f1(bx - 12)}" y="${GY - 1}" width="24" height="3" rx="1.5" class="mi-pad"/>`
|
|
184
184
|
+ `<path d="M${f1(bx - 14)} ${GY} L${f1(bx - 14)} ${GY - 34} M${f1(bx - 14)} ${GY - 26} L${f1(bx - 6)} ${GY - 26} M${f1(bx - 14)} ${GY - 14} L${f1(bx - 6)} ${GY - 14}" fill="none" class="mi-padl" stroke-width="1.2"/></g>`;
|
|
185
185
|
if (M.phase === 'pad' || M.phase === 'build') {
|
|
186
186
|
let b = `<g transform="translate(${f1(bx)} ${GY - 1})" role="img" aria-label="${esc(M.phase === 'pad' ? 'The rocket, a blueprint on the pad' : 'The rocket, ' + Math.round(M.frac * 100) + '% built')}">`;
|
|
187
|
-
b +=
|
|
187
|
+
b += put('rocket_idle', 0, 2, 0, { h: 34, ay: 1, op: M.frac === 0 ? 0.5 : 0.35, cls: 'mi-bp' });
|
|
188
188
|
if (M.frac > 0) {
|
|
189
189
|
const h = 34 * M.frac;
|
|
190
|
-
b += `<clipPath id="${id}b"><rect x="-
|
|
190
|
+
b += `<clipPath id="${id}b"><rect x="-16" y="${f1(2 - h)}" width="32" height="${f1(h)}"/></clipPath><g clip-path="url(#${id}b)" class="${late}">${put('rocket_idle', 0, 2, 0, { h: 34, ay: 1 })}</g>`;
|
|
191
191
|
if (!still) for (let k = 0; k < 3; k++) b += `<circle class="mi-spark mi-k${k}" cx="${-6 + k * 6}" cy="${f1(2 - h)}" r="1.1"/>`;
|
|
192
192
|
}
|
|
193
193
|
s += b + '</g>';
|
|
194
194
|
} else {
|
|
195
|
-
s += `<g class="mi-puff" aria-hidden="true"
|
|
195
|
+
s += `<g class="mi-puff" aria-hidden="true">${put('cloud_small', bx - 7, GY - 2, 14)}${put('cloud_small', bx + 7, GY - 3, 12)}</g>`;
|
|
196
196
|
const p0 = [bx, GY - 20], c1 = [bx + 10, 4], p1 = [PX - 12, PY - 9]; // it comes down onto the planet's upper left
|
|
197
197
|
const bz = (u) => [(1 - u) ** 2 * p0[0] + 2 * (1 - u) * u * c1[0] + u * u * p1[0], (1 - u) ** 2 * p0[1] + 2 * (1 - u) * u * c1[1] + u * u * p1[1]];
|
|
198
198
|
const all = Array.from({ length: 41 }, (_, i) => bz(i / 40)), pts = Array.from({ length: 41 }, (_, i) => bz((i / 40) * M.fly));
|
|
@@ -200,24 +200,23 @@ export function missionSvg(M, o = {}) {
|
|
|
200
200
|
const d = (P) => 'M' + P.map(([x, y]) => f1(x) + ' ' + f1(y)).join(' L');
|
|
201
201
|
if (!M.landed) s += `<path d="${d(all)}" fill="none" class="mi-path" stroke-width="1.4" stroke-dasharray="1.5 5" aria-hidden="true"/>`;
|
|
202
202
|
s += `<path class="mi-vn" d="${d(pts)}" fill="none" stroke="url(#${id}x)" stroke-width="${M.landed ? 2.4 : 3}" stroke-linecap="round" opacity="${M.landed ? 0.45 : 1}" pathLength="100" aria-hidden="true"/>`;
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
// the farther it flies the smaller it looks (Wawan 12:27); rocket_flying points about 38 degrees right of up, so it turns by the rest
|
|
204
|
+
let art;
|
|
205
|
+
if (M.landed) art = put('rocket_idle', PX - 5, PY - 11, 0, { h: 14, ay: 1, rot: -12 });
|
|
205
206
|
else {
|
|
206
|
-
[rx, ry] = pts[40];
|
|
207
|
-
|
|
208
|
-
if (!M.hold) flame = '<g class="mi-flame"><path d="M-3.4 1 Q0 12 3.4 1Z" class="mi-fo"/><path d="M-1.8 1 Q0 7 1.8 1Z" class="mi-fy"/></g>';
|
|
207
|
+
const [rx, ry] = pts[40], a = (Math.atan2(pts[40][1] - pts[38][1], pts[40][0] - pts[38][0]) * 180) / Math.PI + 90;
|
|
208
|
+
art = M.hold ? put('rocket_idle', rx, ry, 0, { h: 24 - 10 * M.fly, rot: +a.toFixed(1) }) : M.fly < 0.12 ? put('rocket_liftoff', bx, GY + 2, 0, { h: 46, ay: 1 }) : put('rocket_flying', rx, ry, 30 - 14 * M.fly, { rot: +(a - 38).toFixed(1) });
|
|
209
209
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
s += `<g class="${M.landed ? '' : 'mi-rk'}" role="img" aria-label="${M.landed ? 'Landed at the release' : 'Flying to the release'}"><g transform="translate(${f1(rx)} ${f1(ry)}) rotate(${a.toFixed(1)}) scale(${sc.toFixed(2)})">${flame}${rocketBody(fin)}</g></g>`;
|
|
210
|
+
s += `<g class="${M.landed ? '' : 'mi-rk'}" role="img" aria-label="${M.landed ? 'Landed at the release' : 'Flying to the release'}"><g class="${late}">${art}</g></g>`;
|
|
211
|
+
if (M.landed) s += `<g class="mi-tw mi-d1" transform-origin="${PX - 14} ${PY - 16}" aria-hidden="true">${put('gold_sparkles', PX - 14, PY - 16, 14)}</g>`;
|
|
213
212
|
if (M.landed) s += `<g aria-hidden="true"><rect x="${PX + 5}" y="${PY - 20}" width="1.4" height="9" class="mi-pole"/><path class="mi-flag" transform-origin="${PX + 6} ${PY - 19}" d="M${PX + 6.4} ${PY - 20} L${PX + 14} ${PY - 17.5} L${PX + 6.4} ${PY - 15}Z"/></g>`;
|
|
214
213
|
}
|
|
215
214
|
// Monitor: the dish listens; the last milestone lights it green
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
+ `<
|
|
219
|
-
|
|
220
|
-
if (M.
|
|
215
|
+
const dpx = DX - 4; // the dish's foot; its feed (the lamp) is at 83% across and 16% down its solid pixels
|
|
216
|
+
let dish = put('satellite_dish', dpx, GY + 1, 0, { h: 28, ay: 1 })
|
|
217
|
+
+ `<circle cx="${f1(dpx + 7.2)}" cy="${f1(GY - 22.5)}" r="2" class="mi-lamp ${M.heard ? 'on' : M.listening ? 'ls' : ''}"/>`;
|
|
218
|
+
if (M.listening && !M.hold) for (let k = 0; k < 3; k++) dish += `<path class="mi-wave mi-k${k}" d="M${DX - 18 - k * 7} ${GY - 26 - k * 3} q-4 4 0 8" fill="none" stroke-width="1.3" stroke-linecap="round"/>`;
|
|
219
|
+
if (M.heard) dish += `<g class="mi-tw mi-d2" transform-origin="${f1(dpx - 2)} ${GY - 34}">${put('gold_star', dpx - 2, GY - 34, 9)}</g>`;
|
|
221
220
|
s += press(dish, M.dish, DX - 2, GY - 12, o, 'dish', crowd);
|
|
222
221
|
// Today
|
|
223
222
|
if (M.today != null) {
|
package/workspace/run-tests.js
CHANGED
|
@@ -355,7 +355,8 @@ function traceChanges(changes, ctx) {
|
|
|
355
355
|
if (b) { const w = routes(b.keys, `server.js:${n}`); if (w) return w; continue; }
|
|
356
356
|
const own = fnAt(n);
|
|
357
357
|
if (own && own.name !== 'handleRequest') { const w = useOf(own.name); if (w) return `${own.name} (server.js:${n}) is used by ${w}`; continue; }
|
|
358
|
-
const
|
|
358
|
+
const req = /^(?:const|let)\s+\w+\s*=\s*require\(\s*'\.\/(lib\/[\w.-]+)'\s*\)\s*;?\s*$/.exec(raw); // a plain top-level `const x = require('./lib/m.js')`: its uses are other lines, traced on their own
|
|
359
|
+
const mod = wiringOf(n) || (req ? req[1] : null);
|
|
359
360
|
if (mod) { nameHits(mod).forEach((x) => picked.add(x)); if (inList.has('test.js')) picked.add('test.js'); continue; } // start-up wiring of one lib module: the suites that name it, and the server boot suite
|
|
360
361
|
return `server.js:${n}, outside every route and function`;
|
|
361
362
|
}
|
package/workspace/server.js
CHANGED
|
@@ -73,6 +73,8 @@ ensureSpawnHelperExecutable();
|
|
|
73
73
|
const { checkSurface } = require('./lib/surface-contract');
|
|
74
74
|
const { createSinkGuard } = require('./lib/sink.js');
|
|
75
75
|
const tsSettings = require('./lib/typesafe-settings.js');
|
|
76
|
+
const anthropicKey = require('./lib/anthropic-key.js'); // the PM's Anthropic API key for Claude's own API runs (D101)
|
|
77
|
+
const grillApi = require('./lib/grill-api.js');
|
|
76
78
|
const sessionOrigin = require('./lib/session-origin'); // which sessions the workspace started itself, and when they may end (workspace-auto-sessions)
|
|
77
79
|
const sessionFlag = require('./lib/session-flag'); // PMOS_WORKSPACE=1 in each agent terminal (cockpit mod, M12)
|
|
78
80
|
const tsClient = require('./lib/typesafe.js');
|
|
@@ -2953,7 +2955,8 @@ const grillRuns = require('./lib/grill-runs.js').create({
|
|
|
2953
2955
|
open: deepOpenNow,
|
|
2954
2956
|
headlessOff: () => headlessLib.switchedOff(process.env),
|
|
2955
2957
|
env: process.env,
|
|
2956
|
-
|
|
2958
|
+
// Claude's own API runs (D101): the key saved in Settings (lib/anthropic-key.js), else ANTHROPIC_API_KEY
|
|
2959
|
+
api: { available: (env) => grillApi.available(env, anthropicKey.getKey(STATE, null)), run: (o) => grillApi.run({ ...o, apiKey: anthropicKey.getKey(STATE, null) }) },
|
|
2957
2960
|
promptFor: (skillId) => { const h = homeWorkspace(); const t = taskById(skillId, h ? h.root : SELF_ROOT); return t && t.prompt ? t.prompt : null; },
|
|
2958
2961
|
spawn: (spec) => orchSpawn.spawn({ name: spec.name, agent: 'claude', ws: spec.ws, origin: spec.origin, initialInput: spec.initialInput, initiative: spec.initiative, extraEnv: spec.env, autoDelete: undefined, onDone: spec.onDone }),
|
|
2959
2962
|
stop: (s) => { if (s && s.child) stopHeadless(s); },
|
|
@@ -9531,6 +9534,19 @@ async function handleRequest(req, res) {
|
|
|
9531
9534
|
if (!out.ok) return json(res, { ok: false, error: out.error }, req.method === 'PUT' && /look like a key/.test(out.error) ? 400 : 500);
|
|
9532
9535
|
return json(res, { ok: true, key: tsSettings.status(STATE) });
|
|
9533
9536
|
}
|
|
9537
|
+
// D101 — the Anthropic API key. Status never carries the value; only the computer that runs the workspace may change it.
|
|
9538
|
+
if (p === '/api/anthropic' && req.method === 'GET') return json(res, { ok: true, key: anthropicKey.status(STATE, process.env), model: grillApi.modelOf(process.env), off: !grillApi.available(process.env, 'x') });
|
|
9539
|
+
if (p === '/api/anthropic/key' && (req.method === 'PUT' || req.method === 'DELETE')) {
|
|
9540
|
+
if (!onlineChangeAllowed(req)) return json(res, { ok: false, error: 'The key can only be changed on the computer that runs the workspace' }, 403);
|
|
9541
|
+
let body = {};
|
|
9542
|
+
if (req.method === 'PUT') {
|
|
9543
|
+
try { body = JSON.parse((await readBody(req)) || '{}'); }
|
|
9544
|
+
catch { return json(res, { ok: false, error: 'invalid JSON body' }, 400); }
|
|
9545
|
+
}
|
|
9546
|
+
const out = req.method === 'PUT' ? anthropicKey.setKey(STATE, body.key) : anthropicKey.clearKey(STATE);
|
|
9547
|
+
if (!out.ok) return json(res, { ok: false, error: out.error }, req.method === 'PUT' && /does not look like/.test(out.error) ? 400 : 500);
|
|
9548
|
+
return json(res, { ok: true, key: anthropicKey.status(STATE, process.env) });
|
|
9549
|
+
}
|
|
9534
9550
|
if (p === '/api/validate/repo' && (req.method === 'GET' || req.method === 'POST')) {
|
|
9535
9551
|
let body = {};
|
|
9536
9552
|
if (req.method === 'POST') {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "The Anthropic API key store (D101) and the key path of Claude's own API runs: saved 0600, never in a status, never inherited by a command the run starts. Fake parts only.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"anthropic-key.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"anthropic-key.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|