create-pmos 0.595.0 → 0.596.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 +14 -14
- 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 +13 -0
- package/workspace/guide/settings-and-switches.md +15 -2
- package/workspace/lib/connector-directory.js +70 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-conndir.js +67 -0
- package/workspace/public/pm/cozy-ev.css +25 -0
- package/workspace/public/pm/cozy-settings.js +95 -14
- package/workspace/server.js +52 -0
- package/workspace/test-lists/connectors-directory.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.596.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": {
|
|
@@ -33,6 +33,19 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.596.0",
|
|
38
|
+
"at": "2026-11-18T03:21:21.557Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1333,
|
|
43
|
+
"t": "Settings › Connectors as a directory you can connect from",
|
|
44
|
+
"s": "Settings › Connectors as a directory you can connect from",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.595.0",
|
|
38
51
|
"at": "2026-11-18T02:36:22.728Z",
|
|
@@ -297,19 +310,6 @@
|
|
|
297
310
|
"k": "new"
|
|
298
311
|
}
|
|
299
312
|
]
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
"v": "0.576.0",
|
|
303
|
-
"at": "2026-11-16T11:57:06.812Z",
|
|
304
|
-
"f": 4,
|
|
305
|
-
"prs": [
|
|
306
|
-
{
|
|
307
|
-
"n": 1308,
|
|
308
|
-
"t": "Close the nine ADLC agent-factory gaps",
|
|
309
|
-
"s": "Close the nine ADLC agent-factory gaps",
|
|
310
|
-
"k": "new"
|
|
311
|
-
}
|
|
312
|
-
]
|
|
313
313
|
}
|
|
314
314
|
]
|
|
315
315
|
}
|
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-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T03:21:17Z"}
|
|
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-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T03:21:17Z"}
|
|
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-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T03:21:17Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.596.0",
|
|
4
|
+
"at": "2026-11-18T03:21:21.557Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1333,
|
|
9
|
+
"t": "Settings › Connectors as a directory you can connect from",
|
|
10
|
+
"s": "Settings › Connectors as a directory you can connect from",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.595.0",
|
|
4
17
|
"at": "2026-11-18T02:36:22.728Z",
|
|
@@ -13,7 +13,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
|
|
|
13
13
|
|---|---|
|
|
14
14
|
| General | The theme (Light, Dark or Auto), whether the Viewer opens as a column or a popup, the products Home, the Board and Intelligence read, when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›** and **Jev and Laya ›** open their own settings (see below). |
|
|
15
15
|
| PMOS | **How PMOS decides** for each kind of change, the calls that are **Always yours**, and PMOS's **Lessons**. Then the Claude profile that new sessions start with, the Anthropic API key for PMOS's own runs, Sharpen prompts, and **Checks**: when PMOS grills an initiative by itself and the monthly credit for its checks. |
|
|
16
|
-
| Connectors | Every connector your Claude session has. A switch chooses only what PMOS reads on its own. PMOS reads and never posts. |
|
|
16
|
+
| Connectors | Every connector your Claude session has, and a directory of services you can connect. A switch chooses only what PMOS reads on its own. PMOS reads and never posts. |
|
|
17
17
|
| Workspaces | The repositories PMOS works in. Remove forgets the address only; the folder is not deleted. Add one by its folder path. The **Workflows ›** row opens the stages each kind of initiative goes through, inside Settings, which then takes the whole window. See [Workflows](statuses.md). |
|
|
18
18
|
| Updates | The version of the app and of each workspace's kit, the check for updates, and what changed. |
|
|
19
19
|
|
|
@@ -350,7 +350,20 @@ On a day with 3 or more meetings, PMOS proposes ✦ **Read it more often on meet
|
|
|
350
350
|
|
|
351
351
|
The **Scheduled work** row under the sources lists everything that runs on a schedule: what PMOS reads, PMOS's own jobs (the day check, the initiative driver, signals) and your own scheduled tasks, each with its next run. Your own tasks can repeat every hour, every day, every week, every 2 weeks or every month.
|
|
352
352
|
|
|
353
|
-
When all is well, there is no other line. ↻ in the Connectors header is **Refresh all**. The (i) button says what PMOS reads and that it never posts.
|
|
353
|
+
When all is well, there is no other line. ↻ in the Connectors header is **Refresh all**. The (i) button says what PMOS reads and that it never posts. Under the list is the connectors directory:
|
|
354
|
+
|
|
355
|
+
- **Search** and the category chips (Mail and calendar, Chat, Tickets, Code, Docs and files, Design, Analytics) filter the directory.
|
|
356
|
+
- **Connected · N** lists every connector your Claude session has, each with its switch. A connector that backs a Briefing source (for example Gmail for Mail) has that source's switch. ⌄ folds the group.
|
|
357
|
+
- **More sources** lists the Briefing sources that no connector backs yet, with their switches.
|
|
358
|
+
- **For you** shows at most 3 services that PMOS suggests: services your initiatives link, then services that go with what you already use.
|
|
359
|
+
- **All connectors** lists the other services.
|
|
360
|
+
|
|
361
|
+
PMOS cannot add a connector, because it keeps no passwords or keys. To connect a service:
|
|
362
|
+
|
|
363
|
+
1. Press **+** on its row. Your Claude account's connector page (claude.ai/settings/connectors) opens in a new tab, and the row says **Waiting for** the service.
|
|
364
|
+
2. Add the connector there and sign in.
|
|
365
|
+
3. PMOS checks every 5 seconds for 2 minutes. When it sees the connector, it says so. If it does not see it in that time, the connector shows when your next session starts.
|
|
366
|
+
4. When a new connector appears, a ✦ card says what PMOS proposes to read from it. Nothing reads it until you press ✓. ✕ means not now. When a source needs you, the Connectors tab has an amber dot, an amber box at the top of the other Settings sections names it, and the place menu opens Settings at Connectors. PMOS repairs the other problems by itself, so you do not see a box for them (see below).
|
|
354
367
|
|
|
355
368
|
### When a source cannot be read: PMOS repairs it first
|
|
356
369
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* connector-directory.js — what Settings › Connectors needs from the server to be a directory (initiative connectors-directory;
|
|
3
|
+
* canvas CnA, CnB). Pure, except notice(), which takes its file reads and writes as arguments so the tests drive it.
|
|
4
|
+
*
|
|
5
|
+
* CONNECT_URL the connector page of the Claude account. PMOS never connects a service itself: it holds no
|
|
6
|
+
* key and no token. The + on a row opens this page; the PM adds the connector there.
|
|
7
|
+
* signalsOf(texts) → [catalog ids] the PM's initiative records point at (a github.com link → 'github'), for ✦ For you
|
|
8
|
+
* notice(prev, names, now) → { state, fresh } which connector names are new since the last read. The first read only
|
|
9
|
+
* remembers what is there (no flood of proposals). A new name becomes one pending proposal.
|
|
10
|
+
* decide(state, name, verdict) → { state, found } ✓ or Not now takes the proposal away; nothing else changes it
|
|
11
|
+
* proposalFor(name, source) → { name, label, source, reads, patch } what ✦ proposes for a new connector: the brief source
|
|
12
|
+
* it backs, else its own switch. The patch is what ✓ saves; until ✓ nothing reads it.
|
|
13
|
+
* probeNames(sources) → the connected names `claude mcp list` reported (lib/project-onboard.js parseMcpList)
|
|
14
|
+
*/
|
|
15
|
+
const { connectorLabel } = require('./proactive.js');
|
|
16
|
+
|
|
17
|
+
const CONNECT_URL = 'https://claude.ai/settings/connectors';
|
|
18
|
+
const MAX_PENDING = 20, MAX_SEEN = 200, MAX_TEXT = 65536;
|
|
19
|
+
|
|
20
|
+
// A link in an initiative record → the catalog id the directory knows it by (pm/cozy-conndir.js CATALOG).
|
|
21
|
+
const SIGNAL_DOMAINS = [
|
|
22
|
+
[/github\.com\//i, 'github'], [/\.atlassian\.net\/(browse|jira)/i, 'jira'], [/\.atlassian\.net\/wiki/i, 'confluence'],
|
|
23
|
+
[/notion\.(so|site)\//i, 'notion'], [/figma\.com\//i, 'figma'], [/linear\.app\//i, 'linear'], [/docs\.google\.com\/|drive\.google\.com\//i, 'gdrive'],
|
|
24
|
+
[/calendar\.google\.com\//i, 'gcal'], [/slack\.com\/(archives|app)/i, 'slack'], [/miro\.com\//i, 'miro'],
|
|
25
|
+
[/asana\.com\//i, 'asana'], [/intercom\.com\//i, 'intercom'],
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
function signalsOf(texts) {
|
|
29
|
+
const hits = new Map();
|
|
30
|
+
for (const t of Array.isArray(texts) ? texts : []) {
|
|
31
|
+
const s = String(t || '').slice(0, MAX_TEXT);
|
|
32
|
+
for (const [re, id] of SIGNAL_DOMAINS) if (re.test(s)) hits.set(id, (hits.get(id) || 0) + 1);
|
|
33
|
+
}
|
|
34
|
+
return [...hits.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([id, n]) => ({ id, n }));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const cleanState = (s) => ({
|
|
38
|
+
seen: Array.isArray(s && s.seen) ? s.seen.filter((x) => typeof x === 'string').slice(0, MAX_SEEN) : null,
|
|
39
|
+
pending: Array.isArray(s && s.pending) ? s.pending.filter((x) => x && typeof x.name === 'string').slice(0, MAX_PENDING) : [],
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
function notice(prev, names, now = Date.now()) {
|
|
43
|
+
const st = cleanState(prev);
|
|
44
|
+
const list = [...new Set((Array.isArray(names) ? names : []).filter((x) => typeof x === 'string' && x))];
|
|
45
|
+
if (st.seen === null) return { state: { seen: list.slice(0, MAX_SEEN), pending: [] }, fresh: [] }; // the first read remembers only
|
|
46
|
+
const seen = new Set(st.seen);
|
|
47
|
+
const fresh = list.filter((n) => !seen.has(n));
|
|
48
|
+
const pending = [...st.pending.filter((p) => list.includes(p.name)), ...fresh.map((name) => ({ name, at: new Date(now).toISOString() }))].slice(-MAX_PENDING);
|
|
49
|
+
return { state: { seen: [...new Set([...st.seen, ...list])].slice(-MAX_SEEN), pending }, fresh };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function decide(prev, name, verdict) {
|
|
53
|
+
const st = cleanState(prev);
|
|
54
|
+
if (verdict !== 'approve' && verdict !== 'dismiss') return { state: st, found: false };
|
|
55
|
+
const found = st.pending.some((p) => p.name === name);
|
|
56
|
+
return { state: { seen: st.seen || [], pending: st.pending.filter((p) => p.name !== name) }, found };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const SOURCE_READS = { calendar: 'your meetings for the Briefing', mail: 'mail that needs you for the Briefing', slack: 'threads that mention you for the Briefing',
|
|
60
|
+
jira: 'the tasks of your initiatives for the Briefing and the Board', confluence: 'pages your initiatives link', github: 'pull requests and checks for the Briefing',
|
|
61
|
+
drive: 'documents your initiatives link', figma: 'design comments your initiatives link', wispr: 'meeting notes for the Briefing' };
|
|
62
|
+
function proposalFor(name, source) {
|
|
63
|
+
const label = connectorLabel(name) || name;
|
|
64
|
+
if (source && SOURCE_READS[source]) return { name, label, source, reads: 'read ' + SOURCE_READS[source], patch: { briefSources: { [source]: true } } };
|
|
65
|
+
return { name, label, source: null, reads: 'keep it on, so a reader can use it when one comes', patch: { connectors: { [name]: true } } };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const probeNames = (sources) => (Array.isArray(sources) ? sources : []).filter((s) => s && s.status === 'connected' && s.id).map((s) => String(s.id));
|
|
69
|
+
|
|
70
|
+
module.exports = { CONNECT_URL, SIGNAL_DOMAINS, signalsOf, notice, decide, proposalFor, probeNames, MAX_PENDING };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.596.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.596.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* pm/cozy-conndir.js — Settings › Connectors as a directory (initiative connectors-directory; canvas CnA, CnB). Pure: no DOM, no fetch.
|
|
2
|
+
* CATS the category chips, All first
|
|
3
|
+
* CATALOG services a connector can be added for in the Claude account: id, name, category, what it does
|
|
4
|
+
* catOf(label) → the category of a connected connector by its name, 'other' when the catalog does not know it
|
|
5
|
+
* directory({ connected, signals, q, cat }) → { count, connected, forYou, all, empty }
|
|
6
|
+
* connected every connector the session has, each { name, label, id, cat }, filtered by the search and the chip. count is the
|
|
7
|
+
* number of connected rows before the filter, so the heading says how many you have, not how many match.
|
|
8
|
+
* forYou at most 3 services not connected yet, each with why: a link in your initiatives (signals) or what you already use
|
|
9
|
+
* all the rest of the catalog, not connected, not in For you
|
|
10
|
+
* letter(name) the letter tile on each row (the connector's own icon is not known to PMOS)
|
|
11
|
+
* PMOS holds no key or token: the + on a row opens the connector page of the Claude account, and PMOS notices the connector there. */
|
|
12
|
+
export const CATS = [['all', 'All'], ['mail', 'Mail and calendar'], ['chat', 'Chat'], ['tickets', 'Tickets'], ['code', 'Code'], ['docs', 'Docs and files'], ['design', 'Design'], ['analytics', 'Analytics']];
|
|
13
|
+
|
|
14
|
+
export const CATALOG = [
|
|
15
|
+
{ id: 'gmail', name: 'Gmail', cat: 'mail', what: 'Read and search mail', re: /gmail/i },
|
|
16
|
+
{ id: 'gcal', name: 'Google Calendar', cat: 'mail', what: 'Meetings and free time', re: /google.?calendar|gcal/i },
|
|
17
|
+
{ id: 'teams', name: 'Microsoft Teams', cat: 'chat', what: 'Chats and channels', re: /teams/i },
|
|
18
|
+
{ id: 'outlook', name: 'Microsoft 365', cat: 'mail', what: 'Outlook mail and calendar', re: /outlook|microsoft|m365|office/i },
|
|
19
|
+
{ id: 'wispr', name: 'Wispr Flow', cat: 'mail', what: 'Meeting notes and transcripts', re: /wispr/i },
|
|
20
|
+
{ id: 'slack', name: 'Slack', cat: 'chat', what: 'Channels, threads and mentions', re: /slack/i },
|
|
21
|
+
{ id: 'intercom', name: 'Intercom', cat: 'chat', what: 'Customer conversations', re: /intercom/i },
|
|
22
|
+
{ id: 'jira', name: 'Jira', cat: 'tickets', what: 'Issues, sprints and boards', re: /jira|atlassian/i },
|
|
23
|
+
{ id: 'linear', name: 'Linear', cat: 'tickets', what: 'Issues and projects', re: /linear/i },
|
|
24
|
+
{ id: 'asana', name: 'Asana', cat: 'tickets', what: 'Tasks and projects', re: /asana/i },
|
|
25
|
+
{ id: 'github', name: 'GitHub', cat: 'code', what: 'Pull requests, issues and checks', re: /github/i },
|
|
26
|
+
{ id: 'sentry', name: 'Sentry', cat: 'code', what: 'Errors and releases', re: /sentry/i },
|
|
27
|
+
{ id: 'confluence', name: 'Confluence', cat: 'docs', what: 'Pages and spaces', re: /confluence/i },
|
|
28
|
+
{ id: 'notion', name: 'Notion', cat: 'docs', what: 'Pages and databases', re: /notion/i },
|
|
29
|
+
{ id: 'gdrive', name: 'Google Drive', cat: 'docs', what: 'Search, read and share files', re: /google.?drive|\bdrive\b|google.?docs|sheets|slides/i },
|
|
30
|
+
{ id: 'box', name: 'Box', cat: 'docs', what: 'Files and folders', re: /\bbox\b/i },
|
|
31
|
+
{ id: 'figma', name: 'Figma', cat: 'design', what: 'Designs and comments', re: /figma/i },
|
|
32
|
+
{ id: 'miro', name: 'Miro', cat: 'design', what: 'Boards and stickies', re: /miro/i },
|
|
33
|
+
{ id: 'canva', name: 'Canva', cat: 'design', what: 'Designs and brand kits', re: /canva/i },
|
|
34
|
+
{ id: 'bigquery', name: 'BigQuery', cat: 'analytics', what: 'Query your data warehouse', re: /bigquery/i },
|
|
35
|
+
{ id: 'hex', name: 'Hex', cat: 'analytics', what: 'Notebooks and data apps', re: /\bhex\b/i },
|
|
36
|
+
];
|
|
37
|
+
const BY_ID = new Map(CATALOG.map((c) => [c.id, c]));
|
|
38
|
+
// what you already use → what goes with it (✦ For you, when no initiative links a service)
|
|
39
|
+
const PAIRS = { gmail: ['gcal', 'gdrive'], gcal: ['gmail'], outlook: ['teams'], slack: ['jira', 'github'], jira: ['confluence', 'github'], confluence: ['jira'],
|
|
40
|
+
github: ['linear', 'sentry'], linear: ['github'], notion: ['linear'], figma: ['miro'], gdrive: ['gmail'] };
|
|
41
|
+
|
|
42
|
+
const labelOf = (name) => String(name || '').replace(/^claude\.ai\s+/i, '').trim();
|
|
43
|
+
export const matchOf = (label) => CATALOG.find((c) => c.re.test(labelOf(label))) || null;
|
|
44
|
+
export const catOf = (label) => { const m = matchOf(label); return m ? m.cat : 'other'; };
|
|
45
|
+
export const letter = (name) => (labelOf(name).match(/[A-Za-z0-9]/) || ['?'])[0].toUpperCase();
|
|
46
|
+
|
|
47
|
+
const hit = (q, ...xs) => !q || xs.some((x) => String(x || '').toLowerCase().includes(q));
|
|
48
|
+
|
|
49
|
+
export function directory({ connected = [], signals = [], q = '', cat = 'all' } = {}) {
|
|
50
|
+
const query = String(q || '').trim().toLowerCase(), chip = CATS.some(([k]) => k === cat) ? cat : 'all';
|
|
51
|
+
const inCat = (c) => chip === 'all' || c === chip;
|
|
52
|
+
const mine = connected.map((c) => { const label = c.label || labelOf(c.name); const m = matchOf(label); return { ...c, label, id: m ? m.id : null, service: m ? m.name : '', cat: m ? m.cat : 'other', what: m ? m.what : '' }; });
|
|
53
|
+
const have = new Set(mine.map((c) => c.id).filter(Boolean));
|
|
54
|
+
// For you: services your initiatives link first (most links first), then what goes with what you use; never one you have
|
|
55
|
+
const why = new Map();
|
|
56
|
+
for (const s of Array.isArray(signals) ? signals : []) {
|
|
57
|
+
const id = s && (s.id || s); if (!BY_ID.has(id) || have.has(id) || why.has(id)) continue;
|
|
58
|
+
const n = s && s.n; why.set(id, n > 1 ? `Because ${n} initiatives link ${BY_ID.get(id).name}` : `Because an initiative links ${BY_ID.get(id).name}`);
|
|
59
|
+
}
|
|
60
|
+
for (const c of mine) for (const id of PAIRS[c.id] || []) if (!have.has(id) && !why.has(id)) why.set(id, 'Because you use ' + (BY_ID.get(c.id) || c).name);
|
|
61
|
+
const forYouIds = [...why.keys()].slice(0, 3);
|
|
62
|
+
const pick = (c) => inCat(c.cat) && hit(query, c.name, c.what, CATS.find(([k]) => k === c.cat)[1]);
|
|
63
|
+
const conn = mine.filter((c) => inCat(c.cat) && hit(query, c.label, c.name, c.service, c.what));
|
|
64
|
+
const forYou = forYouIds.map((id) => ({ ...BY_ID.get(id), why: why.get(id) })).filter(pick);
|
|
65
|
+
const all = CATALOG.filter((c) => !have.has(c.id) && !forYouIds.includes(c.id)).filter(pick);
|
|
66
|
+
return { count: mine.length, connected: conn, forYou, all, empty: !conn.length && !forYou.length && !all.length };
|
|
67
|
+
}
|
|
@@ -307,6 +307,31 @@
|
|
|
307
307
|
.ev-st .ev-fold { border-top: 1px solid var(--cz-hair); border-bottom: 0; }
|
|
308
308
|
.ev-st .ev-con-more { padding-left: 16px; border-left: 2px solid var(--cz-hair); margin-bottom: 12px; }
|
|
309
309
|
@media (max-width: 760px) { .ev-st .ev-fr .ev-ib, .ev-st .ev-fr .ev-ib-sp { width: 44px; height: 44px; } }
|
|
310
|
+
/* Settings › Connectors as a directory (initiative connectors-directory; canvas CnA, CnB) */
|
|
311
|
+
.ev-st .ev-cn { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
|
|
312
|
+
.ev-st .ev-cn-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; background: var(--cz-well); color: var(--cz-ink3); }
|
|
313
|
+
.ev-st .ev-cn-search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; flex: none; }
|
|
314
|
+
.ev-st .ev-cn-search input.ev-inp { background: transparent; padding: 0; height: 38px; }
|
|
315
|
+
.ev-st .ev-cn-search input.ev-inp:focus { outline: none; }
|
|
316
|
+
.ev-st .ev-cn-search:focus-within { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
|
|
317
|
+
.ev-st .ev-cn-chips { display: flex; gap: 6px; flex-wrap: wrap; }
|
|
318
|
+
.ev-st .ev-cn-sec { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
|
|
319
|
+
.ev-st .ev-cn-note { margin: -6px 0 0; }
|
|
320
|
+
.ev-st .ev-cn-note svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; vertical-align: -2px; }
|
|
321
|
+
.ev-st .ev-cn-sec svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; vertical-align: -2px; }
|
|
322
|
+
.ev-st .ev-cn-grp { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 16px; padding: 0 14px; }
|
|
323
|
+
.ev-st .ev-cn-r { padding: 10px 0; }
|
|
324
|
+
.ev-st .ev-cn-lg { width: 36px; height: 36px; border-radius: 10px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--cz-well); color: var(--cz-ink); font-weight: var(--fw-strong); font-size: var(--fs-row); }
|
|
325
|
+
.ev-st .ev-cn-slot:empty { display: none; }
|
|
326
|
+
.ev-st .ev-cn-add { background: var(--cz-solid); color: var(--cz-onsolid); }
|
|
327
|
+
.ev-st .ev-cn-add:hover { background: var(--cz-solid); opacity: .88; }
|
|
328
|
+
.ev-st .ev-cn-ok { background: var(--cz-solid); color: var(--cz-onsolid); }
|
|
329
|
+
.ev-st .ev-cn-rec { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-top: 12px; border-radius: 16px; background: var(--cz-bluebg); }
|
|
330
|
+
.ev-st .ev-cn-rec p { margin: 2px 0 0; }
|
|
331
|
+
.ev-st .ev-cn-rec p svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; vertical-align: -2px; }
|
|
332
|
+
.ev-st .ev-cn-none { padding: 12px 0; margin: 0; }
|
|
333
|
+
.ev-st .ev-cn-foot { margin: 4px 0 0; }
|
|
334
|
+
@media (max-width: 760px) { .ev-st .ev-cn-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .ev-st .ev-cn-r .ev-ib, .ev-st .ev-cn-rec .ev-ib { width: 44px; height: 44px; } .ev-st .ev-cn-r { flex-wrap: nowrap; } }
|
|
310
335
|
|
|
311
336
|
/* New for you's item Viewers (batch 18 items 2 and 2b, canvas OvA5Overlap, OvA6Given): the summary, then the two initiatives, the pick and ONE primary */
|
|
312
337
|
.nv { display: flex; flex-direction: column; gap: 10px; }
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
* /api/sources/refresh, or the place to fix it); a quiet row has its name and time, and "Checked 10:42 · same since 09:15"
|
|
23
23
|
* where a measured read applies (SrSee R3). Claude's failed background work and the Git sync failure are rows too. ↻ in the
|
|
24
24
|
* header reads every source (POST /api/sources/refresh-all); (i) says what PMOS reads and that it never posts. The switches
|
|
25
|
-
* (what PMOS reads on its own, the connectors your sessions have; GET and POST /api/proactive/settings)
|
|
25
|
+
* (what PMOS reads on its own, the connectors your sessions have; GET and POST /api/proactive/settings) sit under a directory
|
|
26
|
+
* (initiative connectors-directory, CnA/CnB): search, category chips, Connected · N, More sources, ✦ For you, All connectors,
|
|
27
|
+
* a + that opens the Claude account's connector page; PMOS notices the new connector and ✦ proposes what to read (pm/cozy-conndir.js).
|
|
26
28
|
* Scheduled work (batch 31 item 2, agreed design SwC): a scheduled source's line says how often and when it reads next, amber
|
|
27
29
|
* with ↻ only when PMOS missed a read; › on the row opens its page (Active, Next run, Repeats, ✦ rhythm, History, ▶ Read now),
|
|
28
30
|
* and one quiet entry opens the Scheduled work list, your own scheduled tasks too (pm/cozy-schedwork.js; T.sub 'sw:…').
|
|
@@ -49,6 +51,7 @@ import * as JL from './cozy-jl.js';
|
|
|
49
51
|
import { pmGet, pmPost, pressFetch } from './http.js';
|
|
50
52
|
import { esc, svg, ICON, toast, wsParam, wsQ } from './cozy-evui.js';
|
|
51
53
|
import { connectorRows, bannerOf } from './cozy-evmodel.js';
|
|
54
|
+
import * as CD from './cozy-conndir.js';
|
|
52
55
|
import * as SW from './cozy-schedwork.js';
|
|
53
56
|
import * as AD from './cozy-adler.js';
|
|
54
57
|
import * as SE from './cozy-seasons.js';
|
|
@@ -63,7 +66,7 @@ const SECTIONS = [['general', 'General'], ['claude', 'PMOS'], ['connectors', 'Co
|
|
|
63
66
|
const SUBS = { adler: 'Adler', jl: 'Jev and Laya', workflows: 'Workflows' }; // General › Extras and Workspaces › Workflows: each opens as a sub-panel of its section (U4, U1)
|
|
64
67
|
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' };
|
|
65
68
|
const VIEWER_KEY = 'pmos.cz.viewer';
|
|
66
|
-
const T = { el: null, sec: 'general', sub: '', ws: null, st: {}, src: null, con: {}, conn: [], set: null, prods: null, msg: '', busy: false, phase: '', say: '', back: null, fresh: null, reading: '', note: {}, info: false, fold: false, dress: false, more: false, bday: false, dset: {}, wkOpen: new Set(), wkMore: new Set(), arc: false };
|
|
69
|
+
const T = { el: null, sec: 'general', sub: '', ws: null, st: {}, src: null, con: {}, conn: [], set: null, prods: null, msg: '', busy: false, phase: '', say: '', back: null, fresh: null, reading: '', note: {}, info: false, fold: false, dir: null, q: '', cat: 'all', wait: null, dress: false, more: false, bday: false, dset: {}, wkOpen: new Set(), wkMore: new Set(), arc: false };
|
|
67
70
|
const cmpVer = (a, b) => { const x = String(a || '0').split('-')[0].split('.').map(Number), y = String(b || '0').split('-')[0].split('.').map(Number); for (let i = 0; i < 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) < (y[i] || 0) ? -1 : 1; return 0; };
|
|
68
71
|
const home = () => (T.ws && T.ws[0] ? T.st[T.ws[0].id] : null);
|
|
69
72
|
const latest = () => { const s = home(); return (s && (s.latest || (s.lastCheck && s.lastCheck.latest))) || null; };
|
|
@@ -221,20 +224,92 @@ function staleHtml() {
|
|
|
221
224
|
: `<a class="ev-ib ev-ib-card" href="${esc(a.href || '#' + a.sec)}"${a.href ? ' target="_blank" rel="noopener"' : ` data-ev-sec="${esc(a.sec)}"`} aria-label="${esc(a.label)}" title="${esc(a.label)}">${svg(ICON.open, 18)}</a>`;
|
|
222
225
|
return `<div class="ev-warn ev-line ev-st-warn" id="srcWarn" data-cause="${esc(b.cause || '')}"><i class="ev-dot risk" aria-hidden="true"></i><p class="ev-grow"><b>${esc(b.title)}</b> ${esc(b.body)}${a.read ? '' : ' ' + esc(a.how)}</p>${act}</div>`;
|
|
223
226
|
}
|
|
224
|
-
const INFO = 'PMOS reads these sources and never posts to them. A switch chooses only what PMOS reads on its own; your Claude sessions can use every connector.';
|
|
227
|
+
const INFO = 'PMOS reads these sources and never posts to them. A switch chooses only what PMOS reads on its own; your Claude sessions can use every connector. PMOS keeps no passwords or keys.';
|
|
228
|
+
/* The directory (initiative connectors-directory; canvas CnA, CnB): search and category chips, Connected · N with every switch of
|
|
229
|
+
* before (a brief source or a connector of the session; each row keeps a slot for the event relay's Listening), ✦ For you, All
|
|
230
|
+
* connectors, a + on each. PMOS cannot add a connector: + opens the connector page of the Claude account, and PMOS waits and notices
|
|
231
|
+
* it (GET /api/connectors/directory?probe=1 every 5 s for 2 minutes). A connector that appears gets one ✦ proposal of what to read;
|
|
232
|
+
* nothing reads it until ✓ (POST /api/proactive/settings with the proposal's patch, then POST /api/connectors/decide). */
|
|
233
|
+
const CONNECT_URL = 'https://claude.ai/settings/connectors';
|
|
234
|
+
const tile = (name) => `<span class="ev-cn-lg" aria-hidden="true">${esc(CD.letter(name))}</span>`;
|
|
235
|
+
const slot = (name) => `<span class="ev-cn-slot" data-ev-listen-slot="${esc(name)}"></span>`; // the event relay's Listening (initiative event-relay)
|
|
236
|
+
const plusBtn = (c) => T.wait && T.wait.id === c.id
|
|
237
|
+
? `<span class="ev-pill y ev-cn-wait" role="status">Waiting for ${esc(c.name)}</span>`
|
|
238
|
+
: `<a class="ev-ib ev-cn-add" href="${esc((T.dir && T.dir.connectUrl) || CONNECT_URL)}" target="_blank" rel="noopener" data-ev-cadd="${esc(c.id)}" aria-label="${esc('Connect ' + c.name + ' in your Claude account')}" title="${esc('Connect ' + c.name + ' in your Claude account')}">${svg(PLUS, 18)}</a>`;
|
|
239
|
+
function propCards() {
|
|
240
|
+
const ps = (T.dir && T.dir.proposals) || [];
|
|
241
|
+
return ps.map((x) => `<div class="ev-cn-rec" data-ev-prop="${esc(x.name)}">${tile(x.label, x.label)}<div class="ev-grow"><b>${esc(x.label)} is connected.</b><p class="ev-small ev-mut">${svg(SPARK, 14)} PMOS proposes: ${esc(x.reads)}. Nothing reads it until you approve.</p></div>`
|
|
242
|
+
+ `<button type="button" class="ev-ib" data-ev-pno="${esc(x.name)}" aria-label="${esc('Not now: ' + x.label)}" title="Not now">${svg(CROSS, 18)}</button>`
|
|
243
|
+
+ `<button type="button" class="ev-ib ev-cn-ok" data-ev-pok="${esc(x.name)}" aria-label="${esc('Approve: ' + x.reads)}" title="Approve">${svg(ICON.check, 18)}</button></div>`).join('');
|
|
244
|
+
}
|
|
245
|
+
function connList() {
|
|
246
|
+
const D = CD.directory({ connected: (T.dir && T.dir.connected) || T.conn, signals: (T.dir && T.dir.signals) || [], q: T.q, cat: T.cat });
|
|
247
|
+
const q = String(T.q || '').trim().toLowerCase(), cOk = (label) => (T.cat === 'all' || CD.catOf(label) === T.cat) && (!q || label.toLowerCase().includes(q));
|
|
248
|
+
const row = (label, key, sub, right, name) => `<div class="ev-trow ev-cn-r">${tile(label, key)}<div class="ev-tx ev-grow"><b>${esc(label)}</b><p class="ev-small ev-mut">${esc(sub)}</p></div>${slot(name || key)}${right}</div>`;
|
|
249
|
+
// a connected connector that backs a brief source carries that source's switch; one that backs none, its own switch (as before)
|
|
250
|
+
const list = (T.dir && T.dir.connected) || T.conn, backed = new Set(list.map((c) => c.source).filter(Boolean));
|
|
251
|
+
const conRows = D.connected.map((c) => { const label = c.label || c.name;
|
|
252
|
+
return c.source && c.source in T.src ? row(label, label, T.src[c.source] ? 'PMOS reads it on its own' : 'PMOS does not read it on its own', sw(T.src[c.source], `data-ev-src="${c.source}"`, label), c.name)
|
|
253
|
+
: row(label, label, T.con[c.name] ? 'On. Your sessions can use it' : 'Your sessions can use it', sw(T.con[c.name], `data-ev-conn="${esc(c.name)}"`, label), c.name); });
|
|
254
|
+
// the brief sources no connector backs yet keep their switch, with a + when the directory knows the service
|
|
255
|
+
const loose = Object.keys(SRC).filter((k) => k in T.src && !backed.has(k) && cOk(SRC[k]));
|
|
256
|
+
const looseIds = new Set(loose.map((k) => (CD.matchOf(SRC[k]) || {}).id).filter(Boolean));
|
|
257
|
+
const looseRows = loose.map((k) => { const m = CD.matchOf(SRC[k]); return row(SRC[k], SRC[k], T.src[k] ? 'PMOS reads it on its own' : 'PMOS does not read it on its own', (m ? plusBtn(m) : '') + sw(T.src[k], `data-ev-src="${k}"`, SRC[k]), k); });
|
|
258
|
+
const count = D.count;
|
|
259
|
+
const head = `<div class="ev-cn-sec"><b class="ev-lbl ev-grow">Connected · ${count}</b>`
|
|
260
|
+
+ `<button type="button" class="ev-ib" data-ev-fold aria-expanded="${!T.fold}" aria-controls="evConMore" aria-label="${T.fold ? 'Show the connected ones' : 'Hide the connected ones'}" title="${T.fold ? 'Show the connected ones' : 'Hide the connected ones'}">${svg(T.fold ? CHEV : ICON.down, 18)}</button></div><p class="ev-small ev-mut ev-cn-note">Your sessions can use all of them. A switch chooses what PMOS reads on its own.</p>`;
|
|
261
|
+
const conn = head + (T.fold && !q && T.cat === 'all' ? '' : `<div class="ev-cn-grp" id="evConMore">${conRows.join('') || '<p class="ev-small ev-mut ev-cn-none">None match.</p>'}</div>`)
|
|
262
|
+
+ (looseRows.length ? `<div class="ev-cn-sec"><b class="ev-lbl">More sources</b></div><div class="ev-cn-grp">${looseRows.join('')}</div>` : '');
|
|
263
|
+
const add = (c, sub) => `<div class="ev-trow ev-cn-r">${tile(c.name, c.id)}<div class="ev-tx ev-grow"><b>${esc(c.name)}</b><p class="ev-small ev-mut">${esc(sub)}</p></div>${plusBtn(c)}</div>`;
|
|
264
|
+
D.forYou = D.forYou.filter((c) => !looseIds.has(c.id));
|
|
265
|
+
const fy = D.forYou.length ? `<div class="ev-cn-sec"><b class="ev-lbl">For you</b></div><p class="ev-small ev-mut ev-cn-note">${svg(SPARK, 14)} PMOS suggests these from what you connected and what your initiatives link</p><div class="ev-cn-grp">${D.forYou.map((c) => add(c, c.why)).join('')}</div>` : '';
|
|
266
|
+
const rest = D.all.filter((c) => !looseIds.has(c.id));
|
|
267
|
+
const all = rest.length ? `<div class="ev-cn-sec"><b class="ev-lbl">All connectors</b></div><div class="ev-cn-grp">${rest.map((c) => add(c, c.what)).join('')}</div>` : '';
|
|
268
|
+
return conn + fy + all;
|
|
269
|
+
}
|
|
225
270
|
function connectors() {
|
|
226
271
|
if (T.sub && T.sub.startsWith('sw:')) return SW.swBody(T.sub);
|
|
227
272
|
const info = T.info ? `<p class="ev-small ev-mut ev-info" id="evConInfo">${esc(INFO)}</p>` : '';
|
|
228
273
|
if (T.src === null) return info + readsHtml() + '<p class="ev-small ev-mut">Reading the connectors.</p>';
|
|
229
|
-
const
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
274
|
+
const search = `<label class="ev-cn-search"><span class="ev-vh">Search connectors</span>${svg(ICON.search, 16)}<input type="search" class="ev-inp" id="evConQ" placeholder="Search connectors" value="${esc(T.q || '')}" autocomplete="off"></label>`;
|
|
275
|
+
const chips = `<div class="ev-cn-chips" role="group" aria-label="Category">${CD.CATS.map(([k, l]) => `<button type="button" class="ev-chip${T.cat === k ? ' on' : ''}" data-ev-ccat="${k}" aria-pressed="${T.cat === k}">${esc(l)}</button>`).join('')}</div>`;
|
|
276
|
+
return info + readsHtml() + propCards() + `<div class="ev-cn">${search}${chips}<div id="evConList">${connList()}</div>`
|
|
277
|
+
+ `<p class="ev-small ev-mut ev-cn-foot">PMOS keeps no passwords or keys. A connector is added in your Claude account: + opens that page, and PMOS notices when it is there.</p></div>`;
|
|
278
|
+
}
|
|
279
|
+
/** The directory's read; after a +, again every 5 s with the probe until the connector shows or 2 minutes pass. */
|
|
280
|
+
async function readDir(probe) {
|
|
281
|
+
const d = await pmGet('/api/connectors/directory' + (probe ? '?probe=1' : '')).catch(() => null);
|
|
282
|
+
if (d && d.ok) T.dir = d;
|
|
283
|
+
return d && d.ok ? d : null;
|
|
284
|
+
}
|
|
285
|
+
let waitTimer = null;
|
|
286
|
+
function stopWait() { if (waitTimer) clearTimeout(waitTimer); waitTimer = null; T.wait = null; }
|
|
287
|
+
function startWait(id) {
|
|
288
|
+
const c = CD.CATALOG.find((x) => x.id === id); if (!c) return;
|
|
289
|
+
stopWait();
|
|
290
|
+
const before = new Set(((T.dir && T.dir.connected) || T.conn).map((x) => x.name));
|
|
291
|
+
T.wait = { id, name: c.name, until: Date.now() + 120000 };
|
|
292
|
+
const tick = async () => {
|
|
293
|
+
if (!T.wait || T.wait.id !== id || !T.el || T.el.hidden) return;
|
|
294
|
+
const d = await readDir(true);
|
|
295
|
+
const got = d && d.connected.find((x) => !before.has(x.name) && (CD.matchOf(x.label || x.name) || {}).id === id);
|
|
296
|
+
if (got) { stopWait(); T.conn = d.connected; toast(c.name + ' is connected.'); draw(); return; }
|
|
297
|
+
if (Date.now() > T.wait.until) { stopWait(); T.msg = 'PMOS has not seen ' + c.name + ' yet. It shows here once it is added in your Claude account and a session starts.'; draw(); return; }
|
|
298
|
+
waitTimer = setTimeout(tick, 5000);
|
|
299
|
+
};
|
|
300
|
+
waitTimer = setTimeout(tick, 5000);
|
|
301
|
+
}
|
|
302
|
+
async function decideProp(name, ok) {
|
|
303
|
+
const x = ((T.dir && T.dir.proposals) || []).find((y) => y.name === name); if (!x) return;
|
|
304
|
+
if (ok) {
|
|
305
|
+
const r = await pmPost('/api/proactive/settings', x.patch);
|
|
306
|
+
if (!(r && r.ok)) { T.msg = (r && r.error) || 'Not saved.'; draw(); return; }
|
|
307
|
+
if (x.patch.briefSources) Object.assign(T.src, x.patch.briefSources); if (x.patch.connectors) Object.assign(T.con, x.patch.connectors);
|
|
308
|
+
}
|
|
309
|
+
const d = await pmPost('/api/connectors/decide', { name, verdict: ok ? 'approve' : 'dismiss' });
|
|
310
|
+
if (d && d.ok) T.dir = { ...T.dir, proposals: T.dir.proposals.filter((y) => y.name !== name) }; else if (!ok) T.msg = (d && d.error) || 'Not saved.';
|
|
311
|
+
if (ok) toast('Approved. PMOS will ' + x.reads + '.');
|
|
312
|
+
draw();
|
|
238
313
|
}
|
|
239
314
|
function workspaces() {
|
|
240
315
|
if (T.sub === 'workflows') return subHead('workflows') + '<div class="ev-wfh" data-ev-wfhost></div>'; // pm/wf-page.js draws into it (UI grill U1)
|
|
@@ -468,11 +543,15 @@ function mount() {
|
|
|
468
543
|
const we = r && r.ok && T.set && Array.isArray(T.set.settings) ? T.set.settings.find((x) => x.key === 'time.workEnd') : null; if (we) we.value = Number(e.target.value);
|
|
469
544
|
draw();
|
|
470
545
|
});
|
|
546
|
+
T.el.addEventListener('input', (e) => { if (e.target.id !== 'evConQ') return; T.q = e.target.value.slice(0, 80); const l = T.el.querySelector('#evConList'); if (l) l.innerHTML = connList(); });
|
|
471
547
|
T.el.addEventListener('click', press);
|
|
472
548
|
return T.el;
|
|
473
549
|
}
|
|
474
550
|
async function press(e) {
|
|
475
|
-
const t = e.target.closest('a[data-ev-sec], button'); if (!t) return;
|
|
551
|
+
const t = e.target.closest('a[data-ev-sec], a[data-ev-cadd], button'); if (!t) return;
|
|
552
|
+
if (t.dataset.evCadd) { startWait(t.dataset.evCadd); draw(); return; } // the link opens the Claude account's connector page; PMOS waits for it
|
|
553
|
+
if (t.dataset.evCcat) { T.cat = t.dataset.evCcat; draw(); const f = T.el.querySelector(`[data-ev-ccat="${T.cat}"]`); if (f) f.focus(); return; }
|
|
554
|
+
if (t.dataset.evPok || t.dataset.evPno) { if (T.busy) return; T.busy = true; try { await decideProp(t.dataset.evPok || t.dataset.evPno, !!t.dataset.evPok); } finally { T.busy = false; } return; }
|
|
476
555
|
if (t.dataset.evSec) { e.preventDefault(); const m = MOVED[t.dataset.evSec]; T.sec = m ? m[0] : t.dataset.evSec; T.sub = m ? m[1] : ''; T.msg = ''; T.dress = false; draw(); const f = T.el.querySelector(`[data-ev-sec="${T.sec}"]`); if (f) f.focus(); openCheck(); return; }
|
|
477
556
|
if ('evClose' in t.dataset) { closeSettings(); return; }
|
|
478
557
|
if (t.dataset.evWk) { const k = t.dataset.evWk; if (T.wkOpen.has(k)) T.wkOpen.delete(k); else T.wkOpen.add(k); draw(); return; }
|
|
@@ -621,6 +700,7 @@ async function load() {
|
|
|
621
700
|
JL.load(T.ws.filter((x) => !x.linked), draw); // a linked worktree is its repository: one row each
|
|
622
701
|
T.src = p && p.ok && p.settings ? { ...p.settings.briefSources } : {}; T.con = p && p.ok && p.settings ? { ...p.settings.connectors } : {};
|
|
623
702
|
T.conn = p && p.connectors && Array.isArray(p.connectors.list) ? p.connectors.list : [];
|
|
703
|
+
readDir(false).then(() => draw()); // the directory: proposals, ✦ For you signals (initiative connectors-directory)
|
|
624
704
|
T.set = s && s.ok ? s : null;
|
|
625
705
|
if (T.set) await AD.loadPrefs(async () => T.set);
|
|
626
706
|
// the registered products with their ticks: the pick's own read, the one Home, Board and Intelligence share (workspace grill W4: the
|
|
@@ -639,7 +719,7 @@ export function openSettings(section, o = {}) {
|
|
|
639
719
|
const m = MOVED[section];
|
|
640
720
|
if (m) { T.sec = m[0]; T.sub = m[1]; T.dress = section === 'dress'; } else if (section && BODY[section]) { T.sec = section; T.sub = ''; T.dress = false; }
|
|
641
721
|
else if (el.hidden) { T.sec = 'general'; T.sub = ''; T.dress = false; } // a fresh open with no section opens on General (R2), not on the section of the last visit
|
|
642
|
-
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.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dset = {}; T.cl = null; T.gr = null; T.np = null; T.ck = null; T.ls = null; JL.reset(); SW.swReset(); }
|
|
722
|
+
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.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dir = null; T.q = ''; T.cat = 'all'; stopWait(); T.dset = {}; T.cl = null; T.gr = null; T.np = null; T.ck = null; T.ls = null; JL.reset(); SW.swReset(); }
|
|
643
723
|
el.hidden = false; document.getElementById('evStScrim').hidden = false; el.setAttribute('data-esc-layer', '');
|
|
644
724
|
draw();
|
|
645
725
|
const f = el.querySelector('[aria-current="page"]'); if (f) f.focus();
|
|
@@ -648,6 +728,7 @@ export function openSettings(section, o = {}) {
|
|
|
648
728
|
return el;
|
|
649
729
|
}
|
|
650
730
|
export function closeSettings() {
|
|
731
|
+
stopWait();
|
|
651
732
|
if (!T.el || T.el.hidden) return;
|
|
652
733
|
if (disposeClaudeSetup) { disposeClaudeSetup(); disposeClaudeSetup = null; }
|
|
653
734
|
if (WF) WF.release();
|
package/workspace/server.js
CHANGED
|
@@ -5734,6 +5734,22 @@ function dayMarkIds(brief, run) {
|
|
|
5734
5734
|
for (const e of brief.calendar || []) known.set(e.id, 'event');
|
|
5735
5735
|
return known;
|
|
5736
5736
|
}
|
|
5737
|
+
const CONN_SEEN = () => path.join(STATE, 'connectors-seen.json');
|
|
5738
|
+
let connProbeAt = 0, connProbed = [], connSigMemo = null;
|
|
5739
|
+
/** The services the initiative records of every registered repository link, read at most every 10 minutes (✦ For you). */
|
|
5740
|
+
function connSignals(now = Date.now()) {
|
|
5741
|
+
if (connSigMemo && now - connSigMemo.at < 600000) return connSigMemo.list;
|
|
5742
|
+
const texts = [];
|
|
5743
|
+
for (const w of workspaces.values()) {
|
|
5744
|
+
if (!w || !w.root || texts.length >= 400) continue;
|
|
5745
|
+
const dir = path.join(w.root, 'planning', 'initiatives');
|
|
5746
|
+
let names = []; try { names = fs.readdirSync(dir).filter((f) => f.endsWith('.md')).slice(0, 400 - texts.length); } catch { continue; }
|
|
5747
|
+
for (const f of names) { try { texts.push(fs.readFileSync(path.join(dir, f), 'utf8').slice(0, 65536)); } catch { /* skip */ } }
|
|
5748
|
+
}
|
|
5749
|
+
const list = require('./lib/connector-directory.js').signalsOf(texts);
|
|
5750
|
+
connSigMemo = { at: now, list };
|
|
5751
|
+
return list;
|
|
5752
|
+
}
|
|
5737
5753
|
// ── Background prepare, slice D3 (initiative proactive-engine) ──────────────────────────────────────────────────
|
|
5738
5754
|
// The PM approves ONE plan hash from Today. The 60-second tick later starts that session through the SAME path a next-step
|
|
5739
5755
|
// `go` uses (startWork with origin next-step and the prompt that was shown), only while background prepare is on, outside quiet
|
|
@@ -10099,6 +10115,42 @@ async function handleRequest(req, res) {
|
|
|
10099
10115
|
if (!w) return json(res, { ok: false, error: 'no workspace' }, 400);
|
|
10100
10116
|
return json(res, { ok: true, ws: w.id, name: w.name, ...validateLib.readFindings(validationFindingsFile(w)) });
|
|
10101
10117
|
}
|
|
10118
|
+
/* ── Settings › Connectors as a directory (initiative connectors-directory; canvas CnA, CnB) ──
|
|
10119
|
+
* GET /api/connectors/directory[?probe=1]: the connectors the Claude session has, the new ones ✦ proposes what to read from, and the
|
|
10120
|
+
* services the initiative records link (for ✦ For you). probe=1 (the page sends it while it waits after a +) also asks `claude mcp
|
|
10121
|
+
* list` of the verified login, at most every 20 s, because a connector added in the Claude account reaches the config file only when
|
|
10122
|
+
* a session starts. POST /api/connectors/decide { name, verdict: approve|dismiss } takes a proposal away; the page saves the
|
|
10123
|
+
* proposal's switch with POST /api/proactive/settings first, so nothing reads a new connector before ✓. PMOS stores no key or token. */
|
|
10124
|
+
if (p === '/api/connectors/directory' && req.method === 'GET') {
|
|
10125
|
+
const CD = require('./lib/connector-directory.js');
|
|
10126
|
+
const sc = sessionConnectors(); const list = sc.list.slice(); let probed = false;
|
|
10127
|
+
if (url.searchParams.get('probe') === '1' && Date.now() - connProbeAt > 20000) {
|
|
10128
|
+
connProbeAt = Date.now();
|
|
10129
|
+
try {
|
|
10130
|
+
const b = claudeSetup.bound(defaultProfileFor('claude') || undefined);
|
|
10131
|
+
if (b) {
|
|
10132
|
+
const r = await require('./lib/project-onboard.js').discover({ bound: b });
|
|
10133
|
+
if (r.ok) { probed = true; for (const n of CD.probeNames(r.sources)) if (!list.some((c) => c.name === n)) list.push({ name: n, label: proactiveLib.connectorLabel(n) || n, source: proactiveLib.connectorSource(n), probed: true }); }
|
|
10134
|
+
}
|
|
10135
|
+
} catch { /* the config read stands */ }
|
|
10136
|
+
connProbed = list.filter((c) => c.probed);
|
|
10137
|
+
} else for (const c of connProbed) if (!list.some((x) => x.name === c.name)) list.push(c);
|
|
10138
|
+
let prev = null; try { prev = JSON.parse(fs.readFileSync(CONN_SEEN(), 'utf8')); } catch { /* the first read */ }
|
|
10139
|
+
const n = CD.notice(prev, list.map((c) => c.name));
|
|
10140
|
+
if (JSON.stringify(n.state) !== JSON.stringify(prev)) { try { fs.mkdirSync(STATE, { recursive: true }); fs.writeFileSync(CONN_SEEN(), JSON.stringify(n.state) + '\n'); } catch (e) { warnWriteFail('connectors-seen.json', e); } }
|
|
10141
|
+
return json(res, { ok: true, connectUrl: CD.CONNECT_URL, connected: list, probed,
|
|
10142
|
+
proposals: n.state.pending.map((x) => CD.proposalFor(x.name, proactiveLib.connectorSource(x.name))), signals: connSignals() });
|
|
10143
|
+
}
|
|
10144
|
+
if (p === '/api/connectors/decide' && req.method === 'POST') {
|
|
10145
|
+
let body = {}; try { body = JSON.parse((await readBody(req)) || '{}'); } catch { return json(res, { ok: false, error: 'invalid JSON body' }, 400); }
|
|
10146
|
+
const g = pmGuard.requirePagePress(req, body); if (!g.ok) return json(res, { ok: false, error: g.error }, g.status);
|
|
10147
|
+
const CD = require('./lib/connector-directory.js');
|
|
10148
|
+
let prev = null; try { prev = JSON.parse(fs.readFileSync(CONN_SEEN(), 'utf8')); } catch { /* none */ }
|
|
10149
|
+
const d = CD.decide(prev, String(body.name || ''), body.verdict);
|
|
10150
|
+
if (!d.found) return json(res, { ok: false, error: 'no proposal for that connector' }, 404);
|
|
10151
|
+
try { fs.writeFileSync(CONN_SEEN(), JSON.stringify(d.state) + '\n'); } catch (e) { warnWriteFail('connectors-seen.json', e); return json(res, { ok: false, error: 'could not save — nothing changed' }, 500); }
|
|
10152
|
+
return json(res, { ok: true });
|
|
10153
|
+
}
|
|
10102
10154
|
/* ── today-goals (G1, G4, G5): the PM's goals for the day, the plan that joins them to the brief and Today, and "plan my
|
|
10103
10155
|
* day". The goals routes write only goals/<date>.json in the state folder. "Plan my day" seeds the morning-brief
|
|
10104
10156
|
* schedule when the repository has none and runs it through fireSchedule, the run-now path. Nothing else starts. ── */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Initiative connectors-directory (feedback batch 31 item 3a; canvas CnA, CnB): Settings › Connectors as a directory. connectors-directory.test.js is pure: pm/cozy-conndir.js and lib/connector-directory.js.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"connectors-directory.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"connectors-directory.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|