heyquilt 0.3.176 → 0.3.178
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/RELEASES.md +16 -0
- package/bin/quilt.js +1 -1
- package/package.json +2 -2
- package/src/agent-task-workflow.js +15 -3
- package/src/connection.js +1 -9
- package/src/control.js +9 -3
- package/src/duties.js +2 -4
- package/src/gitstate.js +174 -10
- package/src/hooks.js +2 -2
- package/src/identity.js +1 -1
- package/src/mcp.js +7 -21
- package/src/now-summary.js +2 -4
- package/src/pathrules.js +1 -1
- package/src/protocol.js +2 -2
- package/src/relay-ask.js +2 -3
- package/src/relay-live-write.js +0 -1
- package/src/relay-mcp.js +7 -48
- package/src/relay-prune.js +1 -2
- package/src/relay-turn-sync.js +11 -37
- package/src/server.js +20 -287
- package/src/session.js +399 -240
- package/src/setup.js +17 -27
- package/src/status.js +3 -8
- package/src/ui/agent-guide.js +8 -17
- package/src/ui/app.css +22 -121
- package/src/ui/common.js +1 -4
- package/src/ui/feedback.js +3 -3
- package/src/ui/fileview.js +6 -12
- package/src/ui/rail-model.js +19 -35
- package/src/ui/rail.js +13 -153
- package/src/ui/session.js +63 -146
- package/src/ui/tree.js +5 -28
- package/src/ui-server.js +0 -4
- package/src/boxes.js +0 -36
- package/src/ui/boxes.js +0 -80
package/src/ui/rail.js
CHANGED
|
@@ -1,161 +1,21 @@
|
|
|
1
|
-
// The
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { esc, I, avatar, basename } from './common.js'
|
|
6
|
-
import { boxedFor } from './rail-model.js'
|
|
7
|
-
|
|
8
|
-
const AVATARS = 5 // people shown on the rail; past that, a "+N" that opens everyone's
|
|
9
|
-
|
|
10
|
-
let pop = null // the box list, once made
|
|
11
|
-
let open = null // { filter, anchor, pinned }: what the open list shows and where
|
|
12
|
-
let last = null // { model, opts }: the latest model, so an open list follows it
|
|
13
|
-
let hoverTimer = 0
|
|
14
|
-
let leaveTimer = 0
|
|
15
|
-
|
|
16
|
-
const who = (name, me) => name === me ? 'You' : name
|
|
17
|
-
const whose = (name, me) => name === me ? 'Your unfinished work' : `${name}'s unfinished work`
|
|
1
|
+
// The People rail: the folded People pane (session.js) as avatars instead of rows. One per person
|
|
2
|
+
// here, you first (rail-model.js), each saying who they are and what they are working on when
|
|
3
|
+
// pointed at. A click on any of them opens the pane again.
|
|
4
|
+
import { esc, avatar } from './common.js'
|
|
18
5
|
|
|
19
6
|
/** The rail's buttons for model `m` (railModel). */
|
|
20
|
-
export function railHtml (m
|
|
21
|
-
const out =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (m.people.length) {
|
|
26
|
-
out.push('<span class="rail-sep" aria-hidden="true"></span>')
|
|
27
|
-
const shown = m.people.length > AVATARS + 1 ? m.people.slice(0, AVATARS) : m.people
|
|
28
|
-
for (const p of shown) {
|
|
29
|
-
const say = `${who(p.name, me)}: ${p.count} file${p.count === 1 ? '' : 's'} with unfinished work`
|
|
30
|
-
out.push(`<button type="button" class="rail-who${p.ai ? ' ai' : ''}" data-rail="who" data-name="${esc(p.name)}" title="${esc(say)}" aria-label="${esc(say)}">${avatar(p.name, colorOf(p.name))}<span class="rail-n">${p.count}</span></button>`)
|
|
31
|
-
}
|
|
32
|
-
if (shown.length < m.people.length) out.push(`<button type="button" class="rail-more" data-rail="all" title="Everyone's unfinished work">+${m.people.length - shown.length}</button>`)
|
|
7
|
+
export function railHtml (m) {
|
|
8
|
+
const out = m.shown.map((p) => `<button type="button" class="rail-who${p.ai ? ' ai' : ''}" data-rail="who" data-name="${esc(p.name)}" title="${esc(p.title)}" aria-label="${esc(p.title)}">${avatar(p.name, p.color, p.online)}</button>`)
|
|
9
|
+
if (m.more) {
|
|
10
|
+
const say = `${m.more} more: ${m.rest.join(', ')}`
|
|
11
|
+
out.push(`<button type="button" class="rail-more" data-rail="more" title="${esc(say)}" aria-label="${esc(say)}">+${m.more}</button>`)
|
|
33
12
|
}
|
|
34
13
|
return out.join('')
|
|
35
14
|
}
|
|
36
15
|
|
|
37
|
-
/**
|
|
38
|
-
export function
|
|
39
|
-
const
|
|
40
|
-
const rows = byWho ? m.items.filter((it) => it.by === byWho) : m.items
|
|
41
|
-
const title = byWho ? whose(byWho, me) : 'Unfinished work'
|
|
42
|
-
const row = (it) => {
|
|
43
|
-
const dir = it.path.includes('/') ? it.path.slice(0, it.path.lastIndexOf('/') + 1) : ''
|
|
44
|
-
return `<li class="lk-row${it.mine ? ' ours' : ''}">
|
|
45
|
-
<button type="button" class="lk-main" data-lk-file="${esc(it.path)}" title="${esc(`Open ${it.path}`)}">
|
|
46
|
-
<span class="lk-dot" style="--c:${esc(colorOf(it.by))}"></span>
|
|
47
|
-
<span class="lk-name">${esc(basename(it.path))}</span>
|
|
48
|
-
<span class="lk-held" title="Boxed since ${esc(new Date(it.since).toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }))}">${esc(boxedFor(it, now))}</span>
|
|
49
|
-
</button>
|
|
50
|
-
${dir ? `<div class="lk-dir">${esc(dir)}</div>` : ''}
|
|
51
|
-
<div class="lk-who"><b>${esc(who(it.by, me))}</b>${it.away ? ' <i>(away)</i>' : ''}${it.why ? ` · ${esc(it.why)}` : ''}</div>
|
|
52
|
-
</li>`
|
|
53
|
-
}
|
|
54
|
-
return `<div class="lk-head"><span>${esc(title)}</span><span class="lk-total">${rows.length}</span></div>
|
|
55
|
-
${rows.length ? `<ul class="lk-list">${rows.map(row).join('')}</ul>` : '<p class="lk-none">No unfinished work in boxes.</p>'}
|
|
56
|
-
<div class="lk-foot">Unfinished work stays in its owner's folder until they commit it. Anyone can still edit the file: that opens the box.</div>`
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Draws the rail into `el` and keeps an open box list up to date. `opts`: { me, colorOf, onFile }.
|
|
61
|
-
*/
|
|
62
|
-
export function renderRail (el, model, opts) {
|
|
63
|
-
last = { model, opts }
|
|
64
|
-
const html = railHtml(model, opts)
|
|
16
|
+
/** Draws the rail into `el`. `onOpen`: opens the pane, when an avatar is clicked. */
|
|
17
|
+
export function renderRail (el, model, { onOpen }) {
|
|
18
|
+
const html = railHtml(model)
|
|
65
19
|
if (el.dataset.html !== html) { el.innerHTML = html; el.dataset.html = html }
|
|
66
|
-
if (
|
|
67
|
-
if (open && pop && !pop.hidden) {
|
|
68
|
-
if (!open.anchor.isConnected) {
|
|
69
|
-
// The rail redrew: keep the list on the button that opened it.
|
|
70
|
-
const again = el.querySelector(open.filter && typeof open.filter === 'object' ? `[data-rail="who"][data-name="${CSS.escape(open.filter.who)}"]` : `[data-rail="${open.filter}"]`)
|
|
71
|
-
if (again) open.anchor = again
|
|
72
|
-
}
|
|
73
|
-
fill()
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function bindRail (el) {
|
|
78
|
-
el.dataset.bound = '1'
|
|
79
|
-
const filterOf = (b) => b.dataset.rail === 'who' ? { who: b.dataset.name } : b.dataset.rail
|
|
80
|
-
el.addEventListener('click', (e) => {
|
|
81
|
-
const b = e.target.closest('[data-rail]')
|
|
82
|
-
if (!b) return
|
|
83
|
-
const filter = filterOf(b)
|
|
84
|
-
if (open && open.pinned && same(open.filter, filter)) { closeBoxList(); return }
|
|
85
|
-
openBoxList(b, filter, { pinned: true })
|
|
86
|
-
})
|
|
87
|
-
el.addEventListener('pointerover', (e) => {
|
|
88
|
-
const b = e.target.closest('[data-rail]')
|
|
89
|
-
if (!b || e.pointerType === 'touch') return
|
|
90
|
-
clearTimeout(leaveTimer)
|
|
91
|
-
if (open && open.pinned) return
|
|
92
|
-
clearTimeout(hoverTimer)
|
|
93
|
-
hoverTimer = setTimeout(() => openBoxList(b, filterOf(b), { pinned: false }), open ? 0 : 250)
|
|
94
|
-
})
|
|
95
|
-
el.addEventListener('pointerleave', () => { clearTimeout(hoverTimer); leaveSoon() })
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const same = (a, b) => (a && typeof a === 'object' && b && typeof b === 'object') ? a.who === b.who : a === b
|
|
99
|
-
|
|
100
|
-
function leaveSoon () {
|
|
101
|
-
if (!open || open.pinned) return
|
|
102
|
-
clearTimeout(leaveTimer)
|
|
103
|
-
leaveTimer = setTimeout(closeBoxList, 300)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** Opens the box list beside `anchor`. `pinned`: opened by a click, so it stays until a click elsewhere or Escape. */
|
|
107
|
-
export function openBoxList (anchor, filter, { pinned = true } = {}) {
|
|
108
|
-
if (!last) return
|
|
109
|
-
if (!pop) {
|
|
110
|
-
pop = document.createElement('div')
|
|
111
|
-
pop.className = 'lk-pop'
|
|
112
|
-
pop.id = 'box-list'
|
|
113
|
-
pop.setAttribute('role', 'dialog')
|
|
114
|
-
pop.setAttribute('aria-label', 'Unfinished work')
|
|
115
|
-
pop.hidden = true
|
|
116
|
-
document.body.appendChild(pop)
|
|
117
|
-
pop.addEventListener('click', (e) => {
|
|
118
|
-
const f = e.target.closest('[data-lk-file]')
|
|
119
|
-
if (f) { closeBoxList(); last.opts.onFile(f.dataset.lkFile) }
|
|
120
|
-
})
|
|
121
|
-
pop.addEventListener('pointerenter', () => clearTimeout(leaveTimer))
|
|
122
|
-
pop.addEventListener('pointerleave', leaveSoon)
|
|
123
|
-
document.addEventListener('pointerdown', (e) => {
|
|
124
|
-
if (!open || pop.hidden || pop.contains(e.target) || open.anchor.contains(e.target)) return
|
|
125
|
-
if (e.target.closest?.('[data-rail]')) return // their own click decides
|
|
126
|
-
closeBoxList()
|
|
127
|
-
}, true)
|
|
128
|
-
document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && open && !pop.hidden) { const a = open.anchor; closeBoxList(); a.focus?.() } })
|
|
129
|
-
}
|
|
130
|
-
clearTimeout(leaveTimer)
|
|
131
|
-
const fresh = pop.hidden
|
|
132
|
-
open = { filter, anchor, pinned: pinned || !!(open && open.pinned && !fresh) }
|
|
133
|
-
pop.hidden = false
|
|
134
|
-
fill()
|
|
135
|
-
if (fresh) { pop.classList.remove('in'); void pop.offsetWidth; pop.classList.add('in') }
|
|
136
|
-
for (const b of document.querySelectorAll('[aria-controls="box-list"]')) b.setAttribute('aria-expanded', 'false')
|
|
137
|
-
anchor.setAttribute('aria-controls', 'box-list')
|
|
138
|
-
anchor.setAttribute('aria-expanded', 'true')
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export function closeBoxList () {
|
|
142
|
-
clearTimeout(hoverTimer)
|
|
143
|
-
clearTimeout(leaveTimer)
|
|
144
|
-
if (open) open.anchor.setAttribute?.('aria-expanded', 'false')
|
|
145
|
-
open = null
|
|
146
|
-
if (pop) pop.hidden = true
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function fill () {
|
|
150
|
-
const { model, opts } = last
|
|
151
|
-
pop.innerHTML = boxListHtml(model, open.filter, opts)
|
|
152
|
-
// Beside its button: to the right (the rail, a lane head), else below.
|
|
153
|
-
const r = open.anchor.getBoundingClientRect()
|
|
154
|
-
const w = pop.offsetWidth
|
|
155
|
-
const h = pop.offsetHeight
|
|
156
|
-
const right = r.right + 8 + w <= window.innerWidth - 8
|
|
157
|
-
const left = right ? r.right + 8 : Math.max(8, Math.min(r.left, window.innerWidth - w - 8))
|
|
158
|
-
const top = right ? r.top - 6 : r.bottom + 6
|
|
159
|
-
pop.style.left = `${left}px`
|
|
160
|
-
pop.style.top = `${Math.max(8, Math.min(top, window.innerHeight - h - 8))}px`
|
|
20
|
+
el.onclick = (e) => { if (e.target.closest('[data-rail]')) onOpen() }
|
|
161
21
|
}
|
package/src/ui/session.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The session workspace:
|
|
1
|
+
// The session workspace: the people on the left (who is working on what); in the middle the Loom (everyone's
|
|
2
2
|
// AI conversations at once), one person's AI chat, a shared file or the task board;
|
|
3
3
|
// the team chat on the right.
|
|
4
4
|
import { mountSecrets } from './secrets.js'
|
|
@@ -10,7 +10,7 @@ import { renderFeed } from './feed.js'
|
|
|
10
10
|
import { renderLoom, resetLoom, focusFile, showsLoom } from './loom.js'
|
|
11
11
|
import { buildLoom, foldAiLanes, aiWorking } from './loom-model.js'
|
|
12
12
|
import { railModel } from './rail-model.js'
|
|
13
|
-
import { renderRail
|
|
13
|
+
import { renderRail } from './rail.js'
|
|
14
14
|
import { feedbackDockHtml, bindFeedback } from './feedback.js'
|
|
15
15
|
import { conversations } from './feed-convs.js'
|
|
16
16
|
import { renderFileView, renderFileTabs } from './fileview.js'
|
|
@@ -25,7 +25,6 @@ import { accessFormValues, accessSaveBody, grantsLoading, grantsLoaded, grantsFa
|
|
|
25
25
|
import { workspaceFilePicker } from './files.js'
|
|
26
26
|
import { sessionAgentsHtml } from './agent-place.js'
|
|
27
27
|
import { renderCatchUp, bindCatchUp } from './catchup.js'
|
|
28
|
-
import { boxSummary, boxesOf, unplaced, boxesSig, boxListHtml, boxFoldHtml } from './boxes.js'
|
|
29
28
|
import { heldCard } from './session-words.js'
|
|
30
29
|
import { callButtonMarkup, callPinMarkup, screenStageMarkup, mountCall, unmountCall, renderCall, callCards } from './voice.js'
|
|
31
30
|
|
|
@@ -34,10 +33,6 @@ let timers = []
|
|
|
34
33
|
let grantLoad = grantsLoading() // this session's grants (the owner's view, from the API), for the Access sections
|
|
35
34
|
let wsAgents = { id: null, agents: [] } // the agents this session's workspace invites (workspaces on), for its People
|
|
36
35
|
let mounted = null // AbortController for document-level listeners of this mount
|
|
37
|
-
// Boxes in the people panel (boxes.js): the latest from the app, what they were fetched for, and
|
|
38
|
-
// the ones whose change is shown in place.
|
|
39
|
-
let boxView = { id: null, sig: null, at: 0, loading: false, data: { on: false, boxes: [] }, open: new Set(), people: new Set() }
|
|
40
|
-
const BOXES_FRESH_MS = 3000 // while the panel is open, a box's change is fetched again at most this often
|
|
41
36
|
|
|
42
37
|
// ------------------------------------------------------------ layout state --
|
|
43
38
|
// Per session: mode ('ai' | 'files'), open tabs per mode, expanded folders.
|
|
@@ -54,13 +49,16 @@ function ws (id) {
|
|
|
54
49
|
fileSel: null,
|
|
55
50
|
fileTab: {}, // file path -> 'changes' when that tab is shown (absent: the file)
|
|
56
51
|
expanded: {},
|
|
57
|
-
|
|
52
|
+
peopleCollapsed: false, // the People pane (who is working on what) starts open; folded, it is a rail of avatars (rail.js)
|
|
58
53
|
stale: {}, // file path -> changed while not visible
|
|
59
54
|
loom: { chat: true, tasks: true, density: 'detailed', layout: 'lanes', hidden: [] },
|
|
60
55
|
...(saved || {}),
|
|
61
56
|
drawer: null
|
|
62
57
|
})
|
|
63
58
|
const w = state.ws.get(id)
|
|
59
|
+
// A fold saved under the setting's earlier name is kept.
|
|
60
|
+
if (saved && saved.peopleCollapsed == null && saved.boxesCollapsed != null) w.peopleCollapsed = saved.boxesCollapsed === true
|
|
61
|
+
delete w.boxesCollapsed
|
|
64
62
|
// The Loom is where the AI area starts: once, for a session opened before it existed.
|
|
65
63
|
if (!w.loomSeen) { w.loomSeen = true; w.aiSel = null }
|
|
66
64
|
}
|
|
@@ -93,8 +91,8 @@ function peopleHere (st) {
|
|
|
93
91
|
/** Whose AI session each name in this session is (chat.js aiOwners). */
|
|
94
92
|
function owners (s) {
|
|
95
93
|
const st = s.status
|
|
96
|
-
//
|
|
97
|
-
return aiOwners({ peers: st.peers, messages: renderable(state.messages.get(current)), people: [st.me?.name, ...humanNames(st.peers), ...humanNames(st.members)], names: [...(st.members || []).map((m) => m.name), ...(st.
|
|
94
|
+
// Tasks and commits name them too (an older app's AI session): those are their person as well.
|
|
95
|
+
return aiOwners({ peers: st.peers, messages: renderable(state.messages.get(current)), people: [st.me?.name, ...humanNames(st.peers), ...humanNames(st.members)], names: [...(st.members || []).map((m) => m.name), ...(st.tasks || []).map((t) => t && t.assignee), ...(st.commits || []).map((r) => r && r.by)] })
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
function personInfo (name) {
|
|
@@ -108,7 +106,6 @@ function personInfo (name) {
|
|
|
108
106
|
export function mountSession (id) {
|
|
109
107
|
current = id
|
|
110
108
|
pendingAssign = null
|
|
111
|
-
if (boxView.id !== id) boxView = { id, sig: null, at: 0, loading: false, data: { on: false, boxes: [] }, open: new Set(), people: new Set() }
|
|
112
109
|
resetLoom()
|
|
113
110
|
boardQuery = '' // a search is for the board it was typed on
|
|
114
111
|
filterOpen = false
|
|
@@ -136,7 +133,7 @@ export function mountSession (id) {
|
|
|
136
133
|
<span class="spacer"></span>
|
|
137
134
|
<span class="relay-problem" id="relay-problem" role="status" hidden></span>
|
|
138
135
|
<span class="access-pill" id="access-pill" hidden></span>
|
|
139
|
-
<button class="btn sm ghost icon narrow-only" id="toggle-tree" title="
|
|
136
|
+
<button class="btn sm ghost icon narrow-only" id="toggle-tree" title="People: who is working on what" aria-label="Show people">${I.users}</button>
|
|
140
137
|
<button class="btn sm ghost conn-btn" id="connections-btn" type="button" title="Apps agents in this session can use" ${state.connectionsOn ? '' : 'hidden'}>${I.plug}<span class="wide-only">Connections</span></button>
|
|
141
138
|
<div class="people" id="people">
|
|
142
139
|
<div class="people-pill">
|
|
@@ -167,14 +164,14 @@ export function mountSession (id) {
|
|
|
167
164
|
</div>
|
|
168
165
|
</header>
|
|
169
166
|
<div class="ws-body" id="ws-body">
|
|
170
|
-
<aside class="ws-tree ws-
|
|
167
|
+
<aside class="ws-tree ws-people" aria-label="People: who is working on what">
|
|
171
168
|
<div class="pane-head">
|
|
172
|
-
<button type="button" class="tree-collapse wide-tree" id="collapse-tree" title="Collapse
|
|
173
|
-
<span class="pane-title">
|
|
169
|
+
<button type="button" class="tree-collapse wide-tree" id="collapse-tree" title="Collapse people" aria-label="Collapse people" aria-expanded="true" aria-controls="people-side">${I.arrowLeft}</button>
|
|
170
|
+
<span class="pane-title">People</span>
|
|
174
171
|
</div>
|
|
175
|
-
<div class="tree-rail" id="tree-rail" role="toolbar" aria-orientation="vertical" aria-label="
|
|
176
|
-
<div class="tree-scroll
|
|
177
|
-
${feedbackDockHtml('
|
|
172
|
+
<div class="tree-rail" id="tree-rail" role="toolbar" aria-orientation="vertical" aria-label="People here"></div>
|
|
173
|
+
<div class="tree-scroll people-side" id="people-side"></div>
|
|
174
|
+
${feedbackDockHtml('people')}
|
|
178
175
|
</aside>
|
|
179
176
|
<main class="ws-main">
|
|
180
177
|
<div class="requests catchup" id="catchup" role="region" aria-label="While you were away" hidden></div>
|
|
@@ -220,8 +217,8 @@ export function mountSession (id) {
|
|
|
220
217
|
bindAccess()
|
|
221
218
|
bindChanges(id, mounted.signal, { onOpen: (path) => openFile(path, { tab: 'changes' }), close: () => setGitOpen(false), onCount: renderGitChip })
|
|
222
219
|
bindCatchUp($('#catchup'), { sessionId: () => current, onOpen: openFile })
|
|
223
|
-
// Report a bug / Suggest a feature at the bottom of the
|
|
224
|
-
bindFeedback($('.ws-
|
|
220
|
+
// Report a bug / Suggest a feature at the bottom of the People pane (feedback.js): onto this session's board.
|
|
221
|
+
bindFeedback($('.ws-people'), { session: () => current, where: () => state.sessions.get(current)?.status?.sessionName || 'a session' })
|
|
225
222
|
bindMain()
|
|
226
223
|
bindTreeEvents()
|
|
227
224
|
applyTreeCollapsed()
|
|
@@ -261,7 +258,6 @@ export function sessionUnmount () {
|
|
|
261
258
|
timers = []
|
|
262
259
|
if (mounted) mounted.abort()
|
|
263
260
|
mounted = null
|
|
264
|
-
closeBoxList()
|
|
265
261
|
pendingAssign = null
|
|
266
262
|
unbindChanges()
|
|
267
263
|
current = null
|
|
@@ -423,8 +419,6 @@ function bindTop () {
|
|
|
423
419
|
|
|
424
420
|
menu.addEventListener('click', async (e) => {
|
|
425
421
|
if (e.target.closest('[data-session-settings]')) { openSessionSettings(); return }
|
|
426
|
-
const bx = e.target.closest('[data-box-toggle],[data-unpack]')
|
|
427
|
-
if (bx) { boxAction(bx); return }
|
|
428
422
|
const t = e.target.closest('[data-person],[data-dm],[data-sharing]')
|
|
429
423
|
if (!t) return
|
|
430
424
|
if (t.dataset.sharing) {
|
|
@@ -919,72 +913,27 @@ async function loadGrants () {
|
|
|
919
913
|
/** Redraws whatever shows people and access: the people menu and the Session settings window, when open. */
|
|
920
914
|
function refreshPeople (opts = {}) {
|
|
921
915
|
if (!$('#people-menu').hidden) renderPeopleMenu()
|
|
922
|
-
|
|
916
|
+
renderTreePane()
|
|
923
917
|
if (document.querySelector('.session-settings-back')) renderSessionSettings(opts)
|
|
924
918
|
}
|
|
925
919
|
|
|
926
|
-
/**
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
const id = current
|
|
932
|
-
const sig = boxesSig(st.boxes)
|
|
933
|
-
if (boxView.loading || (!force && sig === boxView.sig && Date.now() - boxView.at < BOXES_FRESH_MS)) return
|
|
934
|
-
if (!force && !sig && sig === boxView.sig) return // nothing boxed, as before: nothing to fetch
|
|
935
|
-
boxView.loading = true
|
|
936
|
-
api('GET', `/api/sessions/${id}/boxes`).then((r) => {
|
|
937
|
-
if (current !== id) return
|
|
938
|
-
const same = JSON.stringify(r) === JSON.stringify(boxView.data)
|
|
939
|
-
boxView = { ...boxView, sig, at: Date.now(), data: { on: !!r.on, boxes: Array.isArray(r.boxes) ? r.boxes : [] } }
|
|
940
|
-
if (same) return
|
|
941
|
-
if (!$('#people-menu').hidden) renderPeopleMenu()
|
|
942
|
-
renderBoxesSide()
|
|
943
|
-
}, () => {}).finally(() => { if (boxView.id === id) boxView.loading = false })
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
/** A box's controls in the people panel: show its change, Unpack your own. */
|
|
947
|
-
async function boxAction (el) {
|
|
948
|
-
const st = sum().status
|
|
949
|
-
if (el.dataset.boxToggle) {
|
|
950
|
-
const p = el.dataset.boxToggle
|
|
951
|
-
if (boxView.open.has(p)) boxView.open.delete(p)
|
|
952
|
-
else boxView.open.add(p)
|
|
953
|
-
if (!$('#people-menu').hidden) renderPeopleMenu()
|
|
954
|
-
renderBoxesSide()
|
|
955
|
-
return
|
|
956
|
-
}
|
|
957
|
-
el.disabled = true
|
|
958
|
-
try {
|
|
959
|
-
const p = el.dataset.unpack
|
|
960
|
-
const r = await api('POST', `/api/sessions/${current}/unpack`, { paths: [p] })
|
|
961
|
-
toast(r.unpacked && r.unpacked.length ? `Unpacked ${basename(p)}: in everyone's folder now` : `${basename(p)} isn't boxed by you anymore`)
|
|
962
|
-
} catch (err) { toast(err.message); el.disabled = false }
|
|
963
|
-
loadBoxes(st, { force: true })
|
|
920
|
+
/** The pane's rows in their order: you, your AI, then everyone else here (peopleRows and the rail). */
|
|
921
|
+
function paneOrder (st) {
|
|
922
|
+
const here = peopleHere(st)
|
|
923
|
+
const myAi = here.find((p) => p.sessions && p.mine)
|
|
924
|
+
return { here, self: personInfo(st.me.name), myAi, others: here.filter((p) => p !== myAi) }
|
|
964
925
|
}
|
|
965
926
|
|
|
966
927
|
/**
|
|
967
|
-
* Everyone here as rows, each with what they are working on
|
|
968
|
-
*
|
|
969
|
-
* block of their own, with their boxes folded under one line until it is clicked (boxView.people).
|
|
928
|
+
* Everyone here as rows, each with what they are working on: the people menu and the People pane
|
|
929
|
+
* draw the same rows. `blocks` (the pane): each person is a block of their own.
|
|
970
930
|
*/
|
|
971
|
-
function peopleRows (st, {
|
|
972
|
-
|
|
973
|
-
const
|
|
974
|
-
const placed = []
|
|
975
|
-
// Under each row: how many of its files are boxed, and the boxes themselves (boxes.js).
|
|
976
|
-
const boxesFor = (names) => { placed.push(...names); return boxesOf(boxes, names) }
|
|
977
|
-
// Folded, a person's boxed files are counted on the line that opens them instead of in their row.
|
|
978
|
-
const boxSub = (list) => (fold && list.length) || !(list.length || boxView.data.on) ? '' : `<span class="pm-sub pm-boxsum">${esc(boxSummary(list))}</span>`
|
|
979
|
-
const boxList = (list, holder, key) => fold
|
|
980
|
-
? boxFoldHtml(list, { key, unfolded: boxView.people, me: st.me.name, open: boxView.open, holder })
|
|
981
|
-
: boxListHtml(list, { me: st.me.name, open: boxView.open, holder })
|
|
982
|
-
const person = (html) => fold ? `<div class="bs-person">${html}</div>` : html
|
|
983
|
-
const self = personInfo(st.me.name)
|
|
931
|
+
function peopleRows (st, { blocks = false } = {}) {
|
|
932
|
+
const person = (html) => blocks ? `<div class="pp-person">${html}</div>` : html
|
|
933
|
+
const { here, self, myAi, others } = paneOrder(st)
|
|
984
934
|
const message = (name) => `<button class="btn sm ghost icon pm-dm" data-dm="${esc(name)}" title="Message ${esc(name)}" aria-label="Message ${esc(name)}">${I.chat}</button>`
|
|
985
935
|
const row = (p) => {
|
|
986
936
|
const editing = p.editing && p.editing[0] ? `<span class="pm-sub">Editing <code>${esc(p.editing[0].path)}</code></span>` : ''
|
|
987
|
-
const mine = boxesFor([p.name])
|
|
988
937
|
return person(`<div class="pm-row">
|
|
989
938
|
<button class="pm-open" data-person="${esc(p.name)}" title="Open ${p.isMe ? 'your' : `${esc(p.name)}'s`} AI chat">${avatar(p.name, p.color, p.online)}
|
|
990
939
|
<span class="pm-main">
|
|
@@ -992,34 +941,24 @@ function peopleRows (st, { fold = false } = {}) {
|
|
|
992
941
|
${p.focus && !p.isMe ? `<span class="pm-sub pm-what">${esc(p.focus)}</span>` : ''}
|
|
993
942
|
${editing}
|
|
994
943
|
${agentLine(p) ? `<span class="pm-sub">${agentLine(p)}</span>` : ''}
|
|
995
|
-
${boxSub(mine)}
|
|
996
944
|
</span></button>
|
|
997
945
|
${p.isMe ? '' : message(p.name)}
|
|
998
|
-
</div
|
|
946
|
+
</div>`)
|
|
999
947
|
}
|
|
1000
948
|
// A person's AI sessions are one row, "Daniel's AI", with what each is working on under it.
|
|
1001
|
-
const aiRow = (g) =>
|
|
1002
|
-
const mine = boxesFor(g.sessions.map((x) => x.name))
|
|
1003
|
-
return person(`<div class="pm-row">
|
|
949
|
+
const aiRow = (g) => person(`<div class="pm-row">
|
|
1004
950
|
<div class="pm-open" title="${g.sessions.length === 1 ? 'One chat' : `${g.sessions.length} chats`}: a message goes to the one active last">${avatar(g.name, null, true)}
|
|
1005
951
|
<span class="pm-main">
|
|
1006
952
|
<span class="pm-name">${esc(g.mine ? 'Your AI' : g.name)}<span class="tag bot">${I.bot}AI</span>${g.agents.map((t) => `<span class="tag">${esc(t)}</span>`).join('')}</span>
|
|
1007
953
|
${g.sessions.map((x) => `<span class="pm-sub pm-what" title="${esc(x.name)}">${esc(x.focus || x.name.split(' · ').slice(1).join(' · ') || x.tool || 'AI')}</span>`).join('')}
|
|
1008
|
-
${boxSub(mine)}
|
|
1009
954
|
</span></div>
|
|
1010
955
|
${message(g.name)}
|
|
1011
|
-
</div
|
|
1012
|
-
}
|
|
1013
|
-
const here = peopleHere(st)
|
|
1014
|
-
const myAi = here.find((p) => p.sessions && p.mine)
|
|
1015
|
-
const others = here.filter((p) => p !== myAi)
|
|
956
|
+
</div>`)
|
|
1016
957
|
const selfRow = row(self)
|
|
1017
958
|
const myAiRow = myAi ? aiRow(myAi) : ''
|
|
1018
959
|
const otherRows = others.length ? others.map((p) => p.sessions ? aiRow(p) : row(personInfo(p.name))).join('') : '<div class="pm-empty">Nobody else is here yet. Use <b>Invite</b> to bring someone in.</div>'
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1021
|
-
const left = unplaced(boxes, placed).map(([who, list]) => row({ name: who, away: true, online: 'away', agent: null })).filter(Boolean)
|
|
1022
|
-
return { here, selfRow, myAiRow, otherRows, awayRows: [...away, ...left] }
|
|
960
|
+
const awayRows = (st.away || []).map((a) => row({ ...a, away: true, online: 'away', agent: null }))
|
|
961
|
+
return { here, selfRow, myAiRow, otherRows, awayRows }
|
|
1023
962
|
}
|
|
1024
963
|
|
|
1025
964
|
/** Who is here and what each is working on, at a glance. Access and sharing live in Session settings. */
|
|
@@ -1047,26 +986,17 @@ function renderPeopleMenu () {
|
|
|
1047
986
|
}
|
|
1048
987
|
}
|
|
1049
988
|
|
|
1050
|
-
/**
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
* files stay folded until their boxes are clicked, and a click on a file shows its change in place.
|
|
1054
|
-
*/
|
|
1055
|
-
function renderBoxesSide () {
|
|
1056
|
-
const el = $('#boxes-side')
|
|
989
|
+
/** The People pane (left): everyone here and what each is working on. A dashed line divides people. */
|
|
990
|
+
function renderPeopleSide () {
|
|
991
|
+
const el = $('#people-side')
|
|
1057
992
|
const s = current && sum()
|
|
1058
993
|
if (!el || !s) return
|
|
1059
|
-
const
|
|
1060
|
-
const
|
|
1061
|
-
const n = boxView.data.boxes.length
|
|
1062
|
-
const count = $('#box-count')
|
|
1063
|
-
if (count) { count.textContent = n ? String(n) : ''; count.title = n ? `${n} file${n === 1 ? '' : 's'} boxed: changed, not in everyone's folder yet` : '' }
|
|
1064
|
-
const html = `<div class="pm-list bs-list">
|
|
994
|
+
const { selfRow, myAiRow, otherRows, awayRows } = peopleRows(s.status, { blocks: true })
|
|
995
|
+
const html = `<div class="pm-list pp-list">
|
|
1065
996
|
${selfRow}${myAiRow}
|
|
1066
997
|
${otherRows}
|
|
1067
|
-
${awayRows.length ? `<div class="pm-sep"></div><div class="
|
|
1068
|
-
</div
|
|
1069
|
-
<p class="bs-hint">${boxView.data.on ? 'A box is a file someone is changing that isn\'t in everyone\'s folder yet. Click someone\'s boxes to see the files, and a file to see its change.' : 'What everyone is working on. Their unfinished files show here as boxes.'}</p>`
|
|
998
|
+
${awayRows.length ? `<div class="pm-sep"></div><div class="pp-head">Away</div>${awayRows.join('')}` : ''}
|
|
999
|
+
</div>`
|
|
1070
1000
|
if (el.dataset.html === html) return
|
|
1071
1001
|
const top = el.scrollTop
|
|
1072
1002
|
el.innerHTML = html
|
|
@@ -2044,7 +1974,7 @@ function renderMain () {
|
|
|
2044
1974
|
} else {
|
|
2045
1975
|
if (!w.fileSel) {
|
|
2046
1976
|
el.innerHTML = `<div class="main-empty"><div class="ill">${I.file}</div><h3>Open a file</h3>
|
|
2047
|
-
<p class="hint">Open one from the git panel's changes
|
|
1977
|
+
<p class="hint">Open one from the git panel's changes. Lines your partners change light up as they happen.</p></div>`
|
|
2048
1978
|
return
|
|
2049
1979
|
}
|
|
2050
1980
|
const cached = state.files.get(fileKey(w.fileSel))
|
|
@@ -2122,7 +2052,7 @@ function treeMeta (path) {
|
|
|
2122
2052
|
const f = t && t.files.find((x) => x.path === path)
|
|
2123
2053
|
if (f) return f
|
|
2124
2054
|
// Deleted or unknown: nobody edited it in this session.
|
|
2125
|
-
return { path, edited: null
|
|
2055
|
+
return { path, edited: null }
|
|
2126
2056
|
}
|
|
2127
2057
|
|
|
2128
2058
|
const fileLoads = new Set() // fileKey -> being read for the first time
|
|
@@ -2270,7 +2200,7 @@ async function loadTree () {
|
|
|
2270
2200
|
renderTreePane()
|
|
2271
2201
|
const w = ws(id)
|
|
2272
2202
|
if (w.mode === 'files' && w.fileSel) {
|
|
2273
|
-
// Keep the banner (
|
|
2203
|
+
// Keep the banner (who edited it) fresh without re-highlighting.
|
|
2274
2204
|
const cached = state.files.get(fileKey(w.fileSel))
|
|
2275
2205
|
const meta = treeMeta(w.fileSel)
|
|
2276
2206
|
if (cached) renderFileView($('#main'), { path: w.fileSel, file: cached.file, meta, me: me(), bannerOnly: true, chatHref: meta?.chat ? fileCardHref(id, meta.chat.id, TOKEN) : null, rawHref: rawHrefFor(id) })
|
|
@@ -2278,11 +2208,11 @@ async function loadTree () {
|
|
|
2278
2208
|
} catch {}
|
|
2279
2209
|
}
|
|
2280
2210
|
|
|
2281
|
-
/** The left pane: the
|
|
2211
|
+
/** The left pane: the People pane and, folded, its rail of avatars. The file list stays loaded for the file view. */
|
|
2282
2212
|
function renderTreePane () {
|
|
2283
|
-
if (!current || !$('#
|
|
2284
|
-
|
|
2285
|
-
renderRailPane(
|
|
2213
|
+
if (!current || !$('#people-side')) return
|
|
2214
|
+
renderPeopleSide()
|
|
2215
|
+
renderRailPane()
|
|
2286
2216
|
}
|
|
2287
2217
|
|
|
2288
2218
|
function openTaskNotes (task, { instant = false } = {}) {
|
|
@@ -2326,47 +2256,45 @@ function openTaskNotes (task, { instant = false } = {}) {
|
|
|
2326
2256
|
if (instant) back.querySelector('.task-comment-text').focus()
|
|
2327
2257
|
}
|
|
2328
2258
|
|
|
2329
|
-
/** The folded
|
|
2330
|
-
function renderRailPane (
|
|
2259
|
+
/** The folded People pane: an avatar for each of the pane's rows who is here, in the pane's order (rail.js). */
|
|
2260
|
+
function renderRailPane () {
|
|
2331
2261
|
const el = $('#tree-rail')
|
|
2332
2262
|
const s = sum()
|
|
2333
2263
|
if (!el || !s) return
|
|
2334
|
-
const
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
})
|
|
2342
|
-
renderRail(el, model, { me: st.me.name, colorOf: (name) => personInfo(name).color, onFile: (path) => openFile(path) })
|
|
2264
|
+
const { self, myAi, others } = paneOrder(s.status)
|
|
2265
|
+
// What a row says its person is working on: what they said, else the file they are editing.
|
|
2266
|
+
const what = (p) => p.focus || (p.editing && p.editing[0] ? `editing ${p.editing[0].path}` : '')
|
|
2267
|
+
const one = (p) => p.sessions
|
|
2268
|
+
? { name: p.name, label: p.mine ? 'Your AI' : p.name, what: p.sessions.map((x) => x.focus).filter(Boolean).join(', '), ai: true, online: true }
|
|
2269
|
+
: { name: p.name, label: p.isMe ? `${p.name} (you)` : p.name, what: what(p), ai: p.kind === 'agent', color: p.color, online: p.online }
|
|
2270
|
+
const people = [self, ...(myAi ? [myAi] : []), ...others.map((p) => p.sessions ? p : personInfo(p.name))].map(one)
|
|
2271
|
+
renderRail(el, railModel({ people }), { onOpen: () => { if (ws(current).peopleCollapsed) toggleTreeCollapsed() } })
|
|
2343
2272
|
}
|
|
2344
2273
|
|
|
2345
2274
|
function applyTreeCollapsed () {
|
|
2346
2275
|
const body = $('#ws-body')
|
|
2347
2276
|
const btn = $('#collapse-tree')
|
|
2348
2277
|
if (!body || !current) return
|
|
2349
|
-
const collapsed = ws(current).
|
|
2278
|
+
const collapsed = ws(current).peopleCollapsed === true
|
|
2350
2279
|
body.classList.toggle('tree-collapsed', collapsed)
|
|
2351
2280
|
const rail = $('#tree-rail')
|
|
2352
2281
|
if (rail) rail.toggleAttribute('inert', !collapsed)
|
|
2353
|
-
|
|
2354
|
-
const scroll = $('#boxes-side')
|
|
2282
|
+
const scroll = $('#people-side')
|
|
2355
2283
|
if (scroll) {
|
|
2356
2284
|
scroll.toggleAttribute('inert', collapsed)
|
|
2357
2285
|
scroll.setAttribute('aria-hidden', collapsed ? 'true' : 'false')
|
|
2358
2286
|
}
|
|
2359
2287
|
if (!btn) return
|
|
2360
2288
|
btn.setAttribute('aria-expanded', String(!collapsed))
|
|
2361
|
-
btn.title = collapsed ? 'Expand
|
|
2362
|
-
btn.setAttribute('aria-label', collapsed ? 'Expand
|
|
2289
|
+
btn.title = collapsed ? 'Expand people' : 'Collapse people'
|
|
2290
|
+
btn.setAttribute('aria-label', collapsed ? 'Expand people' : 'Collapse people')
|
|
2363
2291
|
btn.innerHTML = collapsed ? I.arrowRight : I.arrowLeft
|
|
2364
2292
|
}
|
|
2365
2293
|
|
|
2366
2294
|
function toggleTreeCollapsed () {
|
|
2367
2295
|
if (!current) return
|
|
2368
2296
|
const w = ws(current)
|
|
2369
|
-
w.
|
|
2297
|
+
w.peopleCollapsed = !w.peopleCollapsed
|
|
2370
2298
|
saveWs(current)
|
|
2371
2299
|
applyTreeCollapsed()
|
|
2372
2300
|
}
|
|
@@ -2461,19 +2389,8 @@ function bindChatPane () {
|
|
|
2461
2389
|
function bindTreeEvents () {
|
|
2462
2390
|
const collapse = $('#collapse-tree')
|
|
2463
2391
|
if (collapse) collapse.onclick = () => toggleTreeCollapsed()
|
|
2464
|
-
const el = $('#
|
|
2392
|
+
const el = $('#people-side')
|
|
2465
2393
|
el.addEventListener('click', (e) => {
|
|
2466
|
-
// A person's boxes: folded until clicked, and folded again by another click.
|
|
2467
|
-
const fold = e.target.closest('[data-box-person]')
|
|
2468
|
-
if (fold) {
|
|
2469
|
-
const k = fold.dataset.boxPerson
|
|
2470
|
-
if (boxView.people.has(k)) boxView.people.delete(k)
|
|
2471
|
-
else boxView.people.add(k)
|
|
2472
|
-
renderBoxesSide()
|
|
2473
|
-
return
|
|
2474
|
-
}
|
|
2475
|
-
const bx = e.target.closest('[data-box-toggle],[data-unpack]')
|
|
2476
|
-
if (bx) { boxAction(bx); return }
|
|
2477
2394
|
const t = e.target.closest('[data-person],[data-dm]')
|
|
2478
2395
|
if (!t) return
|
|
2479
2396
|
if (t.dataset.dm) {
|