heyquilt 0.3.181 → 0.3.183
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -97
- package/RELEASES.md +17 -0
- package/bin/quilt.js +32 -32
- package/desktop/main.js +1 -1
- package/package.json +1 -1
- package/src/account.js +2 -2
- package/src/admit-policy.js +2 -2
- package/src/agent-join.js +3 -3
- package/src/agent-task-workflow.js +14 -14
- package/src/ai-vm.js +1 -1
- package/src/api/agent-placement.js +2 -2
- package/src/api/audit.js +1 -1
- package/src/api/file-paths.js +1 -1
- package/src/api/file-store.js +1 -1
- package/src/api/invite-email.js +4 -4
- package/src/api/join-text.js +5 -5
- package/src/api/notify.js +7 -7
- package/src/api/permissions.js +1 -1
- package/src/api/routes/agent-wake.js +1 -1
- package/src/api/routes/agents.js +2 -2
- package/src/api/routes/ai-vm.js +5 -5
- package/src/api/routes/connections.js +13 -13
- package/src/api/routes/grants.js +2 -2
- package/src/api/routes/mail.js +10 -10
- package/src/api/routes/relay.js +1 -1
- package/src/api/routes/secrets.js +11 -11
- package/src/api/routes/session-invites.js +5 -5
- package/src/api/routes/sessions.js +3 -3
- package/src/api/routes/workspace-agents.js +14 -14
- package/src/api/routes/workspace-files.js +12 -12
- package/src/api/routes/workspace-invites.js +5 -5
- package/src/api/routes/workspaces.js +11 -11
- package/src/api/secrets-access.js +1 -1
- package/src/api/server.js +3 -3
- package/src/api/team-access.js +1 -1
- package/src/api/workspace-access.js +1 -1
- package/src/api/workspace-reach.js +3 -3
- package/src/app-tools.js +10 -10
- package/src/autowork.js +4 -4
- package/src/branch-view.js +1 -1
- package/src/catchup.js +5 -5
- package/src/chat-links.js +18 -18
- package/src/connection.js +11 -11
- package/src/control.js +5 -5
- package/src/conversation.js +1 -1
- package/src/doctor.js +2 -2
- package/src/duties.js +1 -1
- package/src/fsutil.js +1 -1
- package/src/gitstate.js +117 -1
- package/src/held.js +4 -4
- package/src/hooks.js +3 -3
- package/src/hosted-client.js +2 -2
- package/src/identity.js +1 -1
- package/src/inbox.js +1 -1
- package/src/key-cli.js +1 -1
- package/src/mail-tools.js +11 -11
- package/src/mcp-proxy.js +1 -1
- package/src/mcp.js +59 -59
- package/src/new-session.js +112 -0
- package/src/project-rules.js +2 -2
- package/src/relay-ask.js +2 -2
- package/src/relay-cluster.js +3 -3
- package/src/relay-live-write.js +3 -3
- package/src/relay-mcp.js +56 -56
- package/src/relay-prune.js +1 -1
- package/src/relay-turn-sync.js +1 -1
- package/src/repo-ref.js +54 -0
- package/src/secret-import.js +1 -1
- package/src/secret-names.js +6 -6
- package/src/secret-run.js +3 -3
- package/src/server.js +41 -41
- package/src/session-access.js +3 -3
- package/src/session-name.js +1 -1
- package/src/session.js +118 -52
- package/src/setup.js +7 -7
- package/src/status.js +2 -2
- package/src/tasks.js +1 -1
- package/src/turn-sync.js +4 -4
- package/src/ui/account-sessions.js +2 -2
- package/src/ui/agent-env-key.js +1 -1
- package/src/ui/agent-guide.js +35 -35
- package/src/ui/agent-kinds.js +8 -8
- package/src/ui/agent-place.js +16 -16
- package/src/ui/agents-table.js +6 -6
- package/src/ui/app.css +357 -0
- package/src/ui/app.js +29 -14
- package/src/ui/board.js +2 -2
- package/src/ui/catchup.js +5 -5
- package/src/ui/changes-seen.js +2 -2
- package/src/ui/changes.js +3 -3
- package/src/ui/cloud-ai.js +12 -12
- package/src/ui/common.js +1 -1
- package/src/ui/connections.js +1 -1
- package/src/ui/diffview.js +2 -2
- package/src/ui/feed.js +1 -1
- package/src/ui/feedback.js +4 -4
- package/src/ui/files.js +120 -14
- package/src/ui/fileview.js +3 -3
- package/src/ui/git-rule.js +3 -3
- package/src/ui/home.js +95 -67
- package/src/ui/index.html +1 -1
- package/src/ui/invite.js +8 -8
- package/src/ui/invites.js +3 -3
- package/src/ui/new-session.js +151 -0
- package/src/ui/prail-model.js +22 -0
- package/src/ui/prail.js +43 -0
- package/src/ui/project-board.js +359 -0
- package/src/ui/project-model.js +197 -0
- package/src/ui/project-pop.js +451 -0
- package/src/ui/projects.js +406 -0
- package/src/ui/sandbox-keys.js +3 -3
- package/src/ui/secrets-view.js +5 -5
- package/src/ui/session-words.js +2 -2
- package/src/ui/session.js +156 -43
- package/src/ui/tree.js +3 -3
- package/src/ui/voice.js +6 -6
- package/src/ui/workspaces.js +23 -23
- package/src/ui-server.js +104 -26
- package/src/update-check.js +2 -2
- package/src/voice.js +7 -7
- package/src/wake-tool.js +1 -1
- package/src/webhooks.js +1 -1
- package/src/workspace-cli.js +12 -12
- package/src/workspace-tools.js +33 -33
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
// Home and a project's page, once projects are on: a header that says where you are, and under it
|
|
2
|
+
// either Home (the codebases in no project, and what every project gets) or a project with its
|
|
3
|
+
// sidebar (its pages, its codebases, its people) beside its page. The strip on the far left
|
|
4
|
+
// (prail.js) moves between projects. home.js draws this in place of its own sidebar and pages.
|
|
5
|
+
import { I, state, $, esc, ago, api, toast, ask, avatar, COLORS, loadingHtml } from './common.js'
|
|
6
|
+
import { quiltMark } from './mark.js'
|
|
7
|
+
import { quiltBlock, projectCodebases, looseCodebases, whoLine, readFolded } from './project-model.js'
|
|
8
|
+
import { tileLetter } from './prail-model.js'
|
|
9
|
+
import { loadWorkspaces, openWorkspace, wsIdOf } from './workspaces.js'
|
|
10
|
+
import { openNewProject, openProjectPop } from './project-pop.js'
|
|
11
|
+
import { artifactsHtml, bindAllFiles } from './files.js'
|
|
12
|
+
import { mountProjectBoard, projectOpenTasks } from './project-board.js'
|
|
13
|
+
import { mountConnections } from './connections.js'
|
|
14
|
+
import { toolLogo } from './tool-logo.js'
|
|
15
|
+
import { FOREIGN_JOINS } from './agent-place.js'
|
|
16
|
+
|
|
17
|
+
const colorOf = (w) => COLORS[w.color] || COLORS.lilac
|
|
18
|
+
const tile = (w, size = '') => `<span class="pj-tile ${size}" style="background:${esc(colorOf(w))}">${esc(tileLetter(w.name))}</span>`
|
|
19
|
+
const faces = (list) => list.length ? `<span class="pj-faces sm">${list.map((f) => avatar(f.name, f.color)).join('')}</span>` : ''
|
|
20
|
+
const panelIcon = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="2.5"/><path d="M9 4v16"/></svg>'
|
|
21
|
+
|
|
22
|
+
// Kept on this computer: whether the sidebar is closed, and which of its sections are folded.
|
|
23
|
+
const saved = (key) => { try { return localStorage.getItem(key) } catch { return null } }
|
|
24
|
+
const save = (key, value) => { try { localStorage.setItem(key, value) } catch {} }
|
|
25
|
+
let folded = null
|
|
26
|
+
const foldedNow = () => (folded ||= readFolded(saved('quilt.sideFolded')))
|
|
27
|
+
/** Whether the sidebar of a project or a codebase is closed (one choice for both, kept on this computer). */
|
|
28
|
+
export const sideShut = () => saved('quilt.projectSide') === 'shut'
|
|
29
|
+
export const toggleSideShut = () => save('quilt.projectSide', sideShut() ? 'open' : 'shut')
|
|
30
|
+
/** Folds or unfolds one of the sidebar's sections. */
|
|
31
|
+
export function toggleFolded (k) { const f = foldedNow(); f.has(k) ? f.delete(k) : f.add(k); save('quilt.sideFolded', JSON.stringify([...f])) }
|
|
32
|
+
|
|
33
|
+
/** The project a view shows, as the list of projects has it; null on Home. */
|
|
34
|
+
const projectOfView = (view) => /^(ws|wsfiles):/.test(view) ? (state.workspaces || []).find((w) => w.id === wsIdOf(view)) || { id: wsIdOf(view), name: '', color: '' } : null
|
|
35
|
+
/** The page of a project that is showing: its overview, its tasks, its artifacts or its connections. */
|
|
36
|
+
const pageOf = (view) => view.startsWith('wsfiles:') ? 'artifacts' : state.projectPage === 'tasks' ? 'tasks' : state.projectPage === 'connections' && state.connectionsOn ? 'connections' : ''
|
|
37
|
+
|
|
38
|
+
// ---------------------------------------------------------------- header --
|
|
39
|
+
function headerHtml (p) {
|
|
40
|
+
const me = state.profile || {}
|
|
41
|
+
return `
|
|
42
|
+
<header class="ws-top">
|
|
43
|
+
<button class="brand" data-go="home" aria-label="Home">${quiltMark({ sew: 'first' })}</button>
|
|
44
|
+
${p ? `<button type="button" class="btn sm ghost icon" id="pj-side-btn" aria-pressed="${!sideShut()}" title="${sideShut() ? 'Show' : 'Hide'} the sidebar" aria-label="${sideShut() ? 'Show' : 'Hide'} the sidebar">${panelIcon}</button>
|
|
45
|
+
<button type="button" class="pj-crumb" data-go="ws:${esc(p.id)}" title="${esc(p.description || p.name)}">${tile(p, 'xs')}<span>${esc(p.name)}</span></button>` : ''}
|
|
46
|
+
<span class="spacer"></span>
|
|
47
|
+
${p ? '' : `<div class="menu-wrap pj-new"><button type="button" class="btn sm primary" id="pj-new-btn" aria-haspopup="true" aria-expanded="false">${I.plus}<span>New</span><span class="caret">${I.caret}</span></button>
|
|
48
|
+
<div class="popover menu pj-new-menu" role="menu" hidden>
|
|
49
|
+
<button type="button" class="pop-item" role="menuitem" data-new="codebase">${I.folder}<span><b>Codebase</b><small>Code together on a repository, a folder or a new idea. It doesn't need a project.</small></span></button>
|
|
50
|
+
<button type="button" class="pop-item" role="menuitem" data-new="project">${I.grid}<span><b>Project</b><small>A product or an idea: its codebases, artifacts, agents, connections and people.</small></span></button>
|
|
51
|
+
</div></div>`}
|
|
52
|
+
<div class="overflow you">
|
|
53
|
+
<button class="you-btn" id="you-btn" type="button" aria-haspopup="true" aria-expanded="false" aria-controls="you-menu" aria-label="${esc(me.name || 'You')}: settings">${avatar(me.name || '?', me.color)}</button>
|
|
54
|
+
<div class="popover more-menu you-menu" id="you-menu" role="menu" hidden>
|
|
55
|
+
<div class="you-who"><b>${esc(me.name || '')}</b><small>${esc(me.tool || '')}</small></div>
|
|
56
|
+
<div class="pop-sep"></div>
|
|
57
|
+
<button class="pop-item" role="menuitem" data-account-settings title="Your defaults for new codebases">${I.gear}Account settings…</button>
|
|
58
|
+
${window.quiltDesktop?.dev ? `<button class="pop-item" role="menuitem" data-dev-restart>${I.refresh}Restart (dev)</button>` : ''}
|
|
59
|
+
<button class="pop-item" role="menuitem" data-shutdown>${I.power}Shut down Quilt</button>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</header>`
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ------------------------------------------------------------- codebases --
|
|
66
|
+
// Codebases are what you came for: the dark cards on the page, each with a quilt block of its own.
|
|
67
|
+
// On Home these are the ones in no project; on a project's page, that project's.
|
|
68
|
+
function openButton (c) {
|
|
69
|
+
if (c.where === 'open') return `<button class="btn sm primary" data-go="${esc(c.id)}">Open</button>`
|
|
70
|
+
if (c.where === 'here') return `<button class="btn sm primary" data-rejoin="${esc(c.dir)}">Open</button>`
|
|
71
|
+
return `<button class="btn sm" data-join-room="${esc(c.room)}" data-name="${esc(c.name)}" title="Quilt puts it in a folder on this computer and opens it">Join</button>`
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function codebasesHtml (list, { project = null, canAdd = true } = {}) {
|
|
75
|
+
const head = project
|
|
76
|
+
? `<h2>Codebases</h2><span class="count">${list.length}</span><span class="hint">One for each repository. Open one to code in it with the team.</span><span class="spacer"></span>${canAdd ? `<button type="button" class="btn sm primary" data-new-codebase>${I.plus}<span>New codebase</span></button>` : ''}`
|
|
77
|
+
: `<h2>Codebases not in a project</h2><span class="count">${list.length}</span><span class="spacer"></span><button class="btn sm ghost" data-join-session>${I.link}<span>Join with an invite</span></button>`
|
|
78
|
+
const none = project ? `No codebases yet.${canAdd ? ' Start one with New codebase.' : ''}` : state.sessions.size || state.recent.length ? 'Every codebase is in a project.' : 'No codebases yet. Start one with New.'
|
|
79
|
+
return `
|
|
80
|
+
<section class="pj-sec pj-s-dark">
|
|
81
|
+
<div class="sec-head">${head}</div>
|
|
82
|
+
${list.length ? `<div class="ws-chips">${list.map((c) => `
|
|
83
|
+
<div class="ws-chip"${c.dir ? ` title="${esc(c.dir)}"` : ''}>${quiltBlock(c.name)}<span class="t"><b>${esc(c.name)}</b><span class="who">${faces(c.faces)}${esc(whoLine(c, ago))}</span></span>
|
|
84
|
+
${openButton(c)}
|
|
85
|
+
${!project && c.dir && (state.workspaces || []).length ? `<button class="btn sm ghost icon" data-move-codebase="${esc(c.dir)}" title="Move to a project" aria-label="Move ${esc(c.name)} to a project">${I.folder}</button>` : ''}</div>`).join('')}</div>` : `<p class="hint">${none}</p>`}
|
|
86
|
+
</section>`
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ---------------------------------------------------------------- agents --
|
|
90
|
+
// Agents are who works with you: a grid of small cards (a person could have hundreds), each with
|
|
91
|
+
// its name, the tool it runs on, what it does, and a switch. On: it is invited to every new
|
|
92
|
+
// codebase (of every project on Home, of this project on its page). Off: only when someone invites it.
|
|
93
|
+
const sw = (attrs, on, { disabled = false, why = '' } = {}) => `<label class="toggle"${why ? ` title="${esc(why)}"` : ''}><input type="checkbox" ${attrs} ${on ? 'checked' : ''} ${disabled ? 'disabled' : ''}><span class="track"><span class="knob"></span></span></label>`
|
|
94
|
+
const scopePill = (own) => `<span class="pill pj-scope${own ? ' own' : ''}">${own ? 'This project' : 'Every project'}</span>`
|
|
95
|
+
|
|
96
|
+
/** One agent's card. `a`: { name, provider, does }; `pill`: where it comes from (a project's page); `toggle`: its switch. */
|
|
97
|
+
const mateHtml = (a, { pill = '', toggle }) => `
|
|
98
|
+
<div class="pj-mate pj-item"><span class="pj-face ink">${I.bot}</span><span class="t"><span class="nm"><b>${esc(a.name)}</b>${a.provider ? `<span class="pj-toolchip">${toolLogo(a.provider, { className: 'pj-tool' })}${esc(a.provider)}</span>` : ''}</span>${a.does ? `<span class="does" title="${esc(a.does)}">${esc(a.does)}</span>` : ''}${pill}</span>${toggle}</div>`
|
|
99
|
+
|
|
100
|
+
function agentsSectionHtml ({ list, hint, body }) {
|
|
101
|
+
return `
|
|
102
|
+
<section class="pj-sec pj-s-crew" data-agents>
|
|
103
|
+
<div class="sec-head"><h2>Agents</h2><span class="count">${list === null ? '' : list.length}</span><span class="hint">${hint}</span><span class="spacer"></span>
|
|
104
|
+
<button type="button" class="btn sm ghost" data-manage-agents>${I.gear}<span>Manage</span></button>
|
|
105
|
+
<button type="button" class="btn sm" data-manage-agents>${I.plus}<span>Add an agent</span></button></div>
|
|
106
|
+
${body}
|
|
107
|
+
</section>`
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** What an agent does, in a line: what its owner wrote, else what kind it is. */
|
|
111
|
+
const doesOf = (a) => a.description || a.type || ''
|
|
112
|
+
|
|
113
|
+
/** Home's Agents: yours that work in every project. `state.placedAgents` is the last answer (null: not asked yet). */
|
|
114
|
+
function homeAgentsHtml () {
|
|
115
|
+
const all = state.placedAgents
|
|
116
|
+
const list = all === null || all === undefined ? null : all.filter((a) => a.placement && a.placement.reach === 'all')
|
|
117
|
+
const body = list === null ? '<p class="hint">Loading agents…</p>'
|
|
118
|
+
: list.length ? `<div class="pj-crew pj-cards">${list.map((a) => mateHtml({ name: a.name, provider: a.provider, does: doesOf(a) }, { toggle: sw(`data-agent-all="${esc(a.id)}" aria-label="${esc(a.name)}: invited to every new codebase"`, a.placement.sessions === 'all') })).join('')}</div>`
|
|
119
|
+
: `<p class="hint">${all.length ? 'None of your agents works in every project yet. Manage sets where each one works.' : 'No agents yet. Add one and it can work in every project.'}</p>`
|
|
120
|
+
return agentsSectionHtml({ list, hint: 'They work in the codebases of every project.', body })
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** A project's Agents: the ones added to it and the ones that work in every project, with where each comes from. */
|
|
124
|
+
function projectAgentsHtml (d) {
|
|
125
|
+
const mine = new Map((state.placedAgents || []).map((a) => [a.id, a]))
|
|
126
|
+
const list = (d.agents || []).filter((a) => a.agentId)
|
|
127
|
+
const admin = !!d.access?.admin
|
|
128
|
+
const card = (a) => {
|
|
129
|
+
const on = !a.excluded && a.sessions === 'all'
|
|
130
|
+
const why = !admin ? "Only the project's admins change this" : a.foreign ? FOREIGN_JOINS : a.excluded ? 'Kept out of this project: let it back in from Team' : ''
|
|
131
|
+
return mateHtml({ name: a.name, provider: a.provider, does: doesOf(mine.get(a.agentId) || {}) }, { pill: scopePill(a.via !== 'global'), toggle: sw(`data-agent-here="${esc(a.agentId)}" aria-label="${esc(a.name)}: invited to every new codebase in this project"`, on, { disabled: !!why, why }) })
|
|
132
|
+
}
|
|
133
|
+
const body = list.length ? `<div class="pj-crew pj-cards">${list.map(card).join('')}</div>` : '<p class="hint">No agents in this project yet.</p>'
|
|
134
|
+
return agentsSectionHtml({ list, hint: 'They work in every codebase in this project.', body })
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// ----------------------------------------------------------- connections --
|
|
138
|
+
// Connections are apps plugged in: a square tile each, and a dashed one to connect another. A
|
|
139
|
+
// project shows its own and the ones it gets from above, each marked with where it comes from.
|
|
140
|
+
// The switch says whether agents may use it; off, it is for people only.
|
|
141
|
+
const appFace = (c) => `<span class="pj-face md sq">${c.logo ? `<img src="${esc(c.logo)}" alt="" loading="lazy" referrerpolicy="no-referrer">` : `<i class="show">${esc(String(c.name || '?').slice(0, 1).toUpperCase())}</i>`}</span>`
|
|
142
|
+
const APP_STATE = { pending: 'Waiting for sign-in', failed: "Didn't connect" }
|
|
143
|
+
|
|
144
|
+
/** A project's connections, as tiles. `v`: what the accounts API says for the project (null: not asked yet). */
|
|
145
|
+
function projectAppsHtml (v) {
|
|
146
|
+
const own = v ? v.connections || [] : []
|
|
147
|
+
const above = v ? v.inherited || [] : []
|
|
148
|
+
const tile = (c, mine) => `
|
|
149
|
+
<div class="pj-app pj-item">${appFace(c)}${sw(`data-app-who="${esc(c.id)}" aria-label="${esc(c.name)}: agents may use it"`, c.who !== 'people' && c.status === 'active', { disabled: !mine || !c.mayChange || c.status !== 'active', why: mine ? '' : `Set where it was connected${c.levelName ? ` (${c.levelName})` : ''}` })}<b>${esc(c.name)}</b><span class="hint" title="Connected by ${esc(c.by)}">${esc(APP_STATE[c.status] || `Connected by ${c.by}`)}</span>${scopePill(mine)}</div>`
|
|
150
|
+
const n = own.length + above.length
|
|
151
|
+
return `
|
|
152
|
+
<section class="pj-sec pj-s-tiles" data-apps>
|
|
153
|
+
<div class="sec-head"><h2>Connections</h2><span class="count">${v ? n : ''}</span><span class="hint">Apps this project's agents can use.</span><span class="spacer"></span>
|
|
154
|
+
<button type="button" class="btn sm ghost" data-page="connections">${I.gear}<span>Manage</span></button></div>
|
|
155
|
+
${v ? `<div class="pj-apps pj-cards">${own.map((c) => tile(c, true)).join('')}${above.map((c) => tile(c, false)).join('')}
|
|
156
|
+
${v.canManage ? `<button type="button" class="pj-app pj-slot" data-page="connections"><span class="pj-plus">${I.plus}</span><span>Connect an app</span></button>` : ''}</div>` : '<p class="hint">Loading connections…</p>'}
|
|
157
|
+
</section>`
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// --------------------------------------------------------------- sidebar --
|
|
161
|
+
// A project has a sidebar of its own, just right of the strip of projects: its pages, its
|
|
162
|
+
// codebases, its people. It closes from the button beside the logo, and each section folds.
|
|
163
|
+
function sideHtml (p, d, page) {
|
|
164
|
+
const list = projectCodebases(d, state.sessions, `person:${state.account?.id}`)
|
|
165
|
+
const files = (d.files || []).filter((f) => f.kind !== 'folder').length
|
|
166
|
+
const team = [...(d.owner?.account ? [{ name: d.owner.name }] : []), ...(d.members || []).filter((m) => (m.kind || '') !== 'agent' && !String(m.account).startsWith('agent:'))]
|
|
167
|
+
const count = (d.owner?.account ? 1 : 0) + (d.members || []).length + (d.agents || []).filter((a) => !(d.members || []).some((m) => m.account === a.account)).length
|
|
168
|
+
const nav = (v, icon, label, n) => `<button type="button" class="${page === v ? 'on' : ''}" data-page="${v}"${page === v ? ' aria-current="page"' : ''}>${icon}<span class="nm">${label}</span>${n === undefined ? '' : `<span class="ct">${n}</span>`}</button>`
|
|
169
|
+
const isFolded = (k) => foldedNow().has(k)
|
|
170
|
+
const label = (k, text, n, extra = '') => `<div class="side-label pj-side-label"><button type="button" class="pj-fold" data-fold="${k}" aria-expanded="${!isFolded(k)}" title="${isFolded(k) ? 'Show' : 'Hide'} ${text.toLowerCase()}"><span>${text}</span>${I.chevDown}</button>${isFolded(k) && n ? `<span class="ct">${n}</span>` : ''}${extra}</div>`
|
|
171
|
+
const row = (c) => {
|
|
172
|
+
const act = c.where === 'open' ? `data-go="${esc(c.id)}"` : c.where === 'here' ? `data-rejoin="${esc(c.dir)}"` : `data-join-room="${esc(c.room)}" data-name="${esc(c.name)}"`
|
|
173
|
+
const say = c.where === 'away' ? 'Not on this computer yet: join it' : `Open ${c.name}${c.dir ? ` (${c.dir})` : ''}`
|
|
174
|
+
return `<div class="pj-code${c.where === 'away' ? ' away' : ''}"><button type="button" ${act} title="${esc(say)}">${quiltBlock(c.name)}<span class="nm grow">${esc(c.name)}</span>${faces(c.faces)}</button></div>`
|
|
175
|
+
}
|
|
176
|
+
return `
|
|
177
|
+
<aside class="pj-side" aria-label="${esc(p.name)}">
|
|
178
|
+
<nav class="side-nav" aria-label="Pages">${nav('', I.grid, 'Overview')}${nav('tasks', I.board, 'Tasks', projectOpenTasks(d))}${nav('artifacts', I.folder, 'Artifacts', files)}${state.connectionsOn ? nav('connections', I.link, 'Connections') : ''}</nav>
|
|
179
|
+
${label('codebases', 'Codebases', list.length, d.access?.access === 'edit' ? `<button type="button" class="btn sm ghost icon" data-new-codebase title="New codebase" aria-label="New codebase">${I.plus}</button>` : '')}
|
|
180
|
+
<div class="side-sessions">${isFolded('codebases') ? '' : list.map(row).join('')}</div>
|
|
181
|
+
<div class="side-foot side-nav">
|
|
182
|
+
<button type="button" data-team title="People and agents in this project"><span class="pj-faces sm">${team.slice(0, 3).map((m) => avatar(m.name)).join('')}</span><span class="nm">Team</span><span class="ct">${count}</span></button>
|
|
183
|
+
${d.access?.admin ? `<button type="button" data-invite-project>${I.link}<span class="nm">Invite</span></button>` : ''}
|
|
184
|
+
</div>
|
|
185
|
+
</aside>`
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// --------------------------------------------- a codebase's sidebar and header --
|
|
189
|
+
// A codebase's page (session.js) wears the same sidebar, trimmed to that codebase: Loom in place
|
|
190
|
+
// of Overview (the loom is a codebase's main page), no list of codebases, and its chat as a channel.
|
|
191
|
+
|
|
192
|
+
/** Beside the logo on a codebase's page: the button that closes the sidebar, then the project it is in, if any. */
|
|
193
|
+
export function codeCrumbHtml (project) {
|
|
194
|
+
const shut = sideShut()
|
|
195
|
+
return `<button type="button" class="btn sm ghost icon" id="pj-side-btn" aria-pressed="${!shut}" title="${shut ? 'Show' : 'Hide'} the sidebar" aria-label="${shut ? 'Show' : 'Hide'} the sidebar">${panelIcon}</button>${project ? `
|
|
196
|
+
<button type="button" class="pj-crumb" data-go="ws:${esc(project.id)}" title="${esc(project.description || project.name)}">${tile(project, 'xs')}<span>${esc(project.name)}</span></button><span class="pj-crumb-sep">/</span>` : ''}`
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The sidebar of a codebase's page. `page`: the row that is on ('loom', 'tasks', 'artifacts', 'chat', 'connections');
|
|
201
|
+
* `tasks`: its open tasks; `artifacts`: how many the project has, once known; `chatNew`: messages in its channel since it was last looked at;
|
|
202
|
+
* `people`: who is in it, you first ({ name, color }).
|
|
203
|
+
*/
|
|
204
|
+
export function codeSideHtml ({ page, name, project, tasks = 0, artifacts = 0, chatNew = 0, people = [], connections = false, canInvite = true }) {
|
|
205
|
+
const nav = (v, icon, label, n, attr = `data-code-page="${v}"`) => `<button type="button" class="${page === v ? 'on' : ''}" ${attr}${page === v ? ' aria-current="page"' : ''}>${icon}<span class="nm">${label}</span>${n ? `<span class="ct">${n}</span>` : ''}</button>`
|
|
206
|
+
const isFolded = (k) => foldedNow().has(k)
|
|
207
|
+
const label = (k, text, n) => `<div class="side-label pj-side-label"><button type="button" class="pj-fold" data-fold="${k}" aria-expanded="${!isFolded(k)}" title="${isFolded(k) ? 'Show' : 'Hide'} ${text.toLowerCase()}"><span>${text}</span>${I.chevDown}</button>${isFolded(k) && n ? `<span class="ct new">${n}</span>` : ''}</div>`
|
|
208
|
+
// A folded section keeps the row you are on and what is new.
|
|
209
|
+
const channel = !isFolded('channels') || page === 'chat' || chatNew
|
|
210
|
+
return `
|
|
211
|
+
<nav class="side-nav" aria-label="Pages">${nav('loom', I.users, 'Loom')}${nav('tasks', I.board, 'Tasks', tasks)}${project ? nav('artifacts', I.folder, 'Artifacts', artifacts) : ''}${connections ? nav('connections', I.link, 'Connections') : ''}</nav>
|
|
212
|
+
${label('channels', 'Channels', chatNew)}
|
|
213
|
+
<div class="side-sessions pj-rooms">${channel ? `<button type="button" class="${page === 'chat' ? 'on' : ''}" data-code-page="chat" title="Everyone working in ${esc(name)}"${page === 'chat' ? ' aria-current="page"' : ''}><span class="pj-hash">#</span><span class="nm">${esc(name)}</span>${chatNew ? `<span class="ct new">${chatNew > 99 ? '99+' : chatNew}</span>` : ''}</button>` : ''}</div>
|
|
214
|
+
<div class="side-foot side-nav">
|
|
215
|
+
<button type="button" data-code-team title="People in this codebase"><span class="pj-faces sm">${people.slice(0, 3).map((m) => avatar(m.name, m.color)).join('')}</span><span class="nm">Team</span><span class="ct">${people.length}</span></button>
|
|
216
|
+
${canInvite ? `<button type="button" data-code-invite>${I.link}<span class="nm">Invite</span></button>` : ''}
|
|
217
|
+
</div>`
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// ------------------------------------------------------------------ data --
|
|
221
|
+
// What the pages ask for besides the project itself: your agents with where each works, and a
|
|
222
|
+
// project's connections. Each is asked once a page is drawn and kept, so drawing again shows it at once.
|
|
223
|
+
const apps = new Map() // project id -> its connections, as last answered
|
|
224
|
+
const appsOf = (id) => apps.get(id) || null
|
|
225
|
+
let agentsAsked = 0
|
|
226
|
+
|
|
227
|
+
/** Asks for your agents (at most every few seconds) and draws the page again when the answer differs. */
|
|
228
|
+
function loadAgents (rerender) {
|
|
229
|
+
if (Date.now() - agentsAsked < 5000) return
|
|
230
|
+
agentsAsked = Date.now()
|
|
231
|
+
api('GET', '/api/agents/placed').then((r) => {
|
|
232
|
+
const was = JSON.stringify(state.placedAgents || null)
|
|
233
|
+
state.placedAgents = r.agents || []
|
|
234
|
+
if (JSON.stringify(state.placedAgents) !== was) rerender()
|
|
235
|
+
}).catch(() => { if (!state.placedAgents) { state.placedAgents = []; rerender() } })
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const appsAsked = new Map()
|
|
239
|
+
function loadApps (id, rerender, { now = false } = {}) {
|
|
240
|
+
if (!now && Date.now() - (appsAsked.get(id) || 0) < 5000) return
|
|
241
|
+
appsAsked.set(id, Date.now())
|
|
242
|
+
api('GET', `/api/connections/workspace/${encodeURIComponent(id)}`).then((v) => {
|
|
243
|
+
const was = JSON.stringify(apps.get(id) || null)
|
|
244
|
+
apps.set(id, v)
|
|
245
|
+
if (JSON.stringify(v) !== was) rerender()
|
|
246
|
+
}).catch(() => { if (!apps.has(id)) { apps.set(id, { connections: [], inherited: [], canManage: false }); rerender() } })
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// ------------------------------------------------------------------ page --
|
|
250
|
+
function homePageHtml () {
|
|
251
|
+
return codebasesHtml(looseCodebases({ sessions: state.sessions, recent: state.recent, projects: state.workspaces || [] })) + homeAgentsHtml()
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function projectPageHtml (p, view) {
|
|
255
|
+
const d = state.workspace
|
|
256
|
+
if (!d || d.workspace.id !== p.id) {
|
|
257
|
+
// A refresh while it is still loading draws it again without fading it in again.
|
|
258
|
+
const steady = state.wsLoading === p.id
|
|
259
|
+
state.wsLoading = p.id
|
|
260
|
+
return loadingHtml({ label: 'Loading project', name: p.name, steady })
|
|
261
|
+
}
|
|
262
|
+
state.wsLoading = null
|
|
263
|
+
const page = pageOf(view)
|
|
264
|
+
const main = page === 'artifacts' ? artifactsHtml(d)
|
|
265
|
+
: page === 'tasks' ? '<div class="pj-board" data-project-board></div>'
|
|
266
|
+
: page === 'connections' ? `<div class="files-head"><div class="t"><h2 class="crumbs">Connections</h2><p class="hint">Apps this project's agents can use. Agents never see the logins.</p></div></div><div data-project-connections></div>`
|
|
267
|
+
: codebasesHtml(projectCodebases(d, state.sessions, `person:${state.account?.id}`), { project: p, canAdd: d.access?.access === 'edit' }) +
|
|
268
|
+
projectAgentsHtml(d) + (state.connectionsOn ? projectAppsHtml(appsOf(p.id)) : '')
|
|
269
|
+
return `${sideHtml(p, d, page)}<div class="pj-pmain${page === 'artifacts' ? ' pj-files' : page === 'tasks' ? ' pj-tasks' : ''}">${main}</div>`
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** Home or a project's page, under the header, for `view` ('home', 'ws:<id>' or 'wsfiles:<id>'). */
|
|
273
|
+
export function projectShellHtml (view) {
|
|
274
|
+
const p = projectOfView(view)
|
|
275
|
+
const loaded = p && state.workspace && state.workspace.workspace.id === p.id
|
|
276
|
+
return `
|
|
277
|
+
<div class="ws pj-home"${p && sideShut() ? ' data-side="shut"' : ''}>
|
|
278
|
+
${headerHtml(p)}
|
|
279
|
+
<main class="page ${p ? (loaded ? 'pj-proj' : 'pj-wait') : 'pj-look'}" id="page">${p ? projectPageHtml(p, view) : homePageHtml()}</main>
|
|
280
|
+
</div>`
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// ------------------------------------------------------------------ bind --
|
|
284
|
+
function bindMenu (btn, menu) {
|
|
285
|
+
if (!btn || !menu) return
|
|
286
|
+
const set = (open) => { menu.hidden = !open; btn.setAttribute('aria-expanded', String(open)) }
|
|
287
|
+
btn.onclick = (e) => { e.stopPropagation(); set(menu.hidden) }
|
|
288
|
+
menu.addEventListener('click', (e) => { if (e.target.closest('button')) set(false) })
|
|
289
|
+
menu.addEventListener('keydown', (e) => { if (e.key === 'Escape') { set(false); btn.focus() } })
|
|
290
|
+
// One listener however often the page is drawn: it finds the menu that is on the page now.
|
|
291
|
+
if (!bindMenu.wired) {
|
|
292
|
+
bindMenu.wired = true
|
|
293
|
+
document.addEventListener('mousedown', (e) => {
|
|
294
|
+
for (const m of document.querySelectorAll('.pj-home .ws-top .popover:not([hidden])')) {
|
|
295
|
+
if (!m.parentElement.contains(e.target)) { m.hidden = true; m.parentElement.querySelector('[aria-haspopup]')?.setAttribute('aria-expanded', 'false') }
|
|
296
|
+
}
|
|
297
|
+
})
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Makes the page work. `go(view)` opens a page and `rerender()` draws this one again; the rest are
|
|
303
|
+
* Home's own (home.js): the Create a codebase pop-up, Join, a project's invite, the small dialog,
|
|
304
|
+
* Settings, and what the Open buttons of codebases on this computer do (`bindSessionActions`).
|
|
305
|
+
*/
|
|
306
|
+
export function bindProjectShell (view, { go, rerender, newSessionDialog, joinSessionDialog, openSettings, bindSessionActions, submitSession }) {
|
|
307
|
+
const root = $('#app .pj-home')
|
|
308
|
+
if (!root) return
|
|
309
|
+
const p = projectOfView(view)
|
|
310
|
+
const reload = async () => { if (p) await openWorkspace(p.id).catch((err) => toast(err.message)); await loadWorkspaces(); rerender() }
|
|
311
|
+
root.querySelectorAll('[data-go]').forEach((b) => { b.onclick = () => go(b.dataset.go) })
|
|
312
|
+
bindSessionActions(root) // Join with an invite, and Open for a codebase on this computer that is not open
|
|
313
|
+
bindMenu($('#you-btn'), $('#you-menu'))
|
|
314
|
+
root.querySelector('[data-account-settings]').onclick = () => openSettings()
|
|
315
|
+
bindMenu($('#pj-new-btn'), root.querySelector('.pj-new-menu'))
|
|
316
|
+
root.querySelector('[data-new="codebase"]')?.addEventListener('click', () => newSessionDialog())
|
|
317
|
+
root.querySelector('[data-new="project"]')?.addEventListener('click', () => openNewProject())
|
|
318
|
+
root.querySelectorAll('[data-new-codebase]').forEach((b) => { b.onclick = () => newSessionDialog(p.id) })
|
|
319
|
+
// A codebase of this project that is not on this computer: joined by its room, into a folder of its own.
|
|
320
|
+
root.querySelectorAll('[data-join-room]').forEach((b) => {
|
|
321
|
+
b.onclick = async () => {
|
|
322
|
+
b.disabled = true
|
|
323
|
+
try { await submitSession({ mode: 'join', room: b.dataset.joinRoom, name: b.dataset.name }) } catch (err) { toast(err.message); b.disabled = false }
|
|
324
|
+
}
|
|
325
|
+
})
|
|
326
|
+
root.querySelectorAll('[data-move-codebase]').forEach((b) => { b.onclick = () => moveToProject(b.dataset.moveCodebase, rerender) })
|
|
327
|
+
// Agents: Manage and Add an agent open Settings on Agents; a switch saves at once and is put back if that fails.
|
|
328
|
+
root.querySelectorAll('[data-manage-agents]').forEach((b) => { b.onclick = () => { state.settingsTab = 'agents'; openSettings() } })
|
|
329
|
+
if (root.querySelector('[data-agents]')) loadAgents(rerender)
|
|
330
|
+
root.querySelectorAll('[data-agent-all]').forEach((box) => {
|
|
331
|
+
box.onchange = async () => {
|
|
332
|
+
const a = (state.placedAgents || []).find((x) => x.id === box.dataset.agentAll)
|
|
333
|
+
if (!a) return
|
|
334
|
+
const { reach, workspaceIds, access, scopes } = a.placement
|
|
335
|
+
try {
|
|
336
|
+
a.placement = (await api('POST', `/api/agents/${encodeURIComponent(a.id)}/placement`, { reach, workspaceIds, access, scopes, sessions: box.checked ? 'all' : 'invited' })).placement
|
|
337
|
+
} catch (err) { toast(err.message); box.checked = !box.checked }
|
|
338
|
+
}
|
|
339
|
+
})
|
|
340
|
+
if (!p) return
|
|
341
|
+
// The sidebar: its pages, closing it, folding a section.
|
|
342
|
+
const side = $('#pj-side-btn')
|
|
343
|
+
if (side) side.onclick = () => { toggleSideShut(); rerender() }
|
|
344
|
+
root.querySelectorAll('[data-page]').forEach((b) => {
|
|
345
|
+
b.onclick = () => {
|
|
346
|
+
const page = b.dataset.page
|
|
347
|
+
state.projectPage = page === 'connections' || page === 'tasks' ? page : ''
|
|
348
|
+
const to = page === 'artifacts' ? `wsfiles:${p.id}` : `ws:${p.id}`
|
|
349
|
+
if (to === state.view) rerender(); else go(to)
|
|
350
|
+
}
|
|
351
|
+
})
|
|
352
|
+
root.querySelectorAll('[data-fold]').forEach((b) => {
|
|
353
|
+
b.onclick = () => { toggleFolded(b.dataset.fold); rerender() }
|
|
354
|
+
})
|
|
355
|
+
// Team and Invite open the project's own pop-up on People.
|
|
356
|
+
root.querySelector('[data-team]')?.addEventListener('click', () => openProjectPop({ id: p.id, section: 'people' }))
|
|
357
|
+
root.querySelector('[data-invite-project]')?.addEventListener('click', () => openProjectPop({ id: p.id, section: 'people', focusInvite: true }))
|
|
358
|
+
const d = state.workspace
|
|
359
|
+
if (!d || d.workspace.id !== p.id) return
|
|
360
|
+
const main = root.querySelector('.pj-pmain')
|
|
361
|
+
if (pageOf(view) === 'artifacts') bindAllFiles(main, { id: p.id, go, rerender, reload })
|
|
362
|
+
const board = root.querySelector('[data-project-board]')
|
|
363
|
+
// The open count beside Tasks follows the board as it changes.
|
|
364
|
+
if (board) mountProjectBoard(board, { d, go, reload, changed: () => { const ct = root.querySelector('[data-page="tasks"] .ct'); if (ct) ct.textContent = projectOpenTasks(state.workspace) } })
|
|
365
|
+
const conns = root.querySelector('[data-project-connections]')
|
|
366
|
+
if (conns) mountConnections(conns, { type: 'workspace', id: p.id })
|
|
367
|
+
// An agent's switch in this project: one added here keeps its place and changes whether it is invited; one from above gets this project's own setting.
|
|
368
|
+
root.querySelectorAll('[data-agent-here]').forEach((box) => {
|
|
369
|
+
box.onchange = async () => {
|
|
370
|
+
const a = (d.agents || []).find((x) => x.agentId === box.dataset.agentHere)
|
|
371
|
+
if (!a) return
|
|
372
|
+
const sessions = box.checked ? 'all' : 'invited'
|
|
373
|
+
const url = `/api/workspaces/${encodeURIComponent(p.id)}`
|
|
374
|
+
try {
|
|
375
|
+
if (a.via === 'member') await api('POST', `${url}/members`, { account: a.account, access: a.access, sessions })
|
|
376
|
+
else await api('POST', `${url}/agents/${encodeURIComponent(a.agentId)}`, { sessions })
|
|
377
|
+
a.sessions = sessions
|
|
378
|
+
} catch (err) { toast(err.message); box.checked = !box.checked }
|
|
379
|
+
}
|
|
380
|
+
})
|
|
381
|
+
// Connections: asked for when the overview shows them; a switch says whether agents may use one.
|
|
382
|
+
if (root.querySelector('[data-apps]')) loadApps(p.id, rerender)
|
|
383
|
+
root.querySelectorAll('[data-app-who]').forEach((box) => {
|
|
384
|
+
box.onchange = async () => {
|
|
385
|
+
try { await api('PATCH', `/api/connections/workspace/${encodeURIComponent(p.id)}/${encodeURIComponent(box.dataset.appWho)}`, { who: box.checked ? 'all' : 'people' }); loadApps(p.id, rerender, { now: true }) } catch (err) { toast(err.message); box.checked = !box.checked }
|
|
386
|
+
}
|
|
387
|
+
})
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** Moves a codebase on this computer into a project you can edit, picked from a list. */
|
|
391
|
+
async function moveToProject (dir, rerender) {
|
|
392
|
+
const options = (state.workspaces || []).filter((w) => w.access === 'edit')
|
|
393
|
+
if (!options.length) return toast('No project you can edit.')
|
|
394
|
+
const choice = await ask({ title: 'Move to a project', input: { label: 'Project', select: options.map((w) => ({ value: w.id, label: w.name })) }, ok: 'Move' })
|
|
395
|
+
if (!choice) return
|
|
396
|
+
try {
|
|
397
|
+
const moved = await api('POST', `/api/workspaces/${encodeURIComponent(choice)}/sessions/move`, { dir })
|
|
398
|
+
// The folder's project changed on this computer: take the fresh list and summaries.
|
|
399
|
+
const st = await api('GET', '/api/state')
|
|
400
|
+
state.recent = st.recent
|
|
401
|
+
for (const sum of st.sessions) { const s = state.sessions.get(sum.id); if (s) s.workspace = sum.workspace }
|
|
402
|
+
await loadWorkspaces(); rerender()
|
|
403
|
+
const n = (moved.added || []).length
|
|
404
|
+
toast(moved.peopleNeedAdmin ? "Moved. Only the project's admins can add its people." : n ? `Moved, with ${n} ${n === 1 ? 'person or agent' : 'people and agents'} added to the project` : 'Moved')
|
|
405
|
+
} catch (err) { toast(err.message) }
|
|
406
|
+
}
|
package/src/ui/sandbox-keys.js
CHANGED
|
@@ -33,8 +33,8 @@ function rowHtml (k, now, q) {
|
|
|
33
33
|
|
|
34
34
|
function newRowHtml (sessions) {
|
|
35
35
|
const where = sessions.length
|
|
36
|
-
? `<select class="input sm" name="sk-session" aria-label="
|
|
37
|
-
: '<input class="input sm" name="sk-link" type="url" placeholder="
|
|
36
|
+
? `<select class="input sm" name="sk-session" aria-label="Codebase">${sessions.map((s) => `<option value="${esc(s.value)}">${esc(s.name)}</option>`).join('')}</select>`
|
|
37
|
+
: '<input class="input sm" name="sk-link" type="url" placeholder="Codebase invite link" aria-label="Codebase invite link" autocomplete="off">'
|
|
38
38
|
return `<tr class="sk-newrow"><td colspan="6"><form class="sk-inline" data-sk-form>
|
|
39
39
|
<input class="input sm" name="sk-name" maxlength="40" placeholder="Name, e.g. bolt.new · checkout" aria-label="Key name" autocomplete="off" required>
|
|
40
40
|
${where}
|
|
@@ -59,7 +59,7 @@ export function keysCardHtml (agent, v) {
|
|
|
59
59
|
${v.fresh ? `<div class="sk-once"><span class="pill live">New</span><code class="sk-key" data-sk-value>${esc(v.fresh.envKey)}</code><span class="sk-acts"><button type="button" class="btn sm" data-sk-copy>${I.copy}<span>Copy</span></button><span class="hint">shown once</span></span></div>` : ''}
|
|
60
60
|
${v.error ? `<p class="error sk-error">${esc(v.error)}</p>` : ''}
|
|
61
61
|
<div class="sk-scroll"><table class="sk-tbl">
|
|
62
|
-
<thead><tr><th>Key</th><th>
|
|
62
|
+
<thead><tr><th>Key</th><th>Codebase</th><th class="sk-n">Last used</th><th class="sk-n sk-m">Use, 7 days</th><th>Status</th><th><span class="sr-only">Actions</span></th></tr></thead>
|
|
63
63
|
<tbody>${v.adding ? newRowHtml(v.sessions || []) : ''}${body}</tbody>
|
|
64
64
|
</table></div>
|
|
65
65
|
</div>`
|
package/src/ui/secrets-view.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// a person types stays in its input (secrets.js sets it back after a redraw, never in markup).
|
|
5
5
|
import { FORMATS, FORMAT_IDS, formatLabel } from './secret-rules.js'
|
|
6
6
|
|
|
7
|
-
export const LEVEL_WORDS = { org: 'Team', workspace: '
|
|
7
|
+
export const LEVEL_WORDS = { org: 'Team', workspace: 'Project', session: 'Codebase' }
|
|
8
8
|
const ORDER = ['org', 'workspace', 'session']
|
|
9
9
|
const LOCK = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg>'
|
|
10
10
|
const AVATAR_COLORS = ['#24706b', '#8a5a08', '#5b4bb7', '#2f5d8a', '#a8263e', '#2f6b40']
|
|
@@ -30,7 +30,7 @@ export function levelTabs (view) {
|
|
|
30
30
|
/** What the inherit switch says: "Workspace and team secrets here", "Team secrets here". */
|
|
31
31
|
export function inheritLabel (view) {
|
|
32
32
|
const above = (view.levels || []).slice(1).map((l) => l.type)
|
|
33
|
-
const words = above.map((t) => (t === 'org' ? 'team' : '
|
|
33
|
+
const words = above.map((t) => (t === 'org' ? 'team' : 'project'))
|
|
34
34
|
if (!words.length) return ''
|
|
35
35
|
const list = words.length === 1 ? words[0] : `${words.slice(0, -1).join(', ')} and ${words.at(-1)}`
|
|
36
36
|
return `${list[0].toUpperCase()}${list.slice(1)} secrets here`
|
|
@@ -80,11 +80,11 @@ function importHtml (ui) {
|
|
|
80
80
|
if (im.loading) return '<div class="sx-import"><span class="sx-faint">Looking for .env files…</span></div>'
|
|
81
81
|
if (im.done) {
|
|
82
82
|
return `<div class="sx-import"><div class="sx-import-done">
|
|
83
|
-
<span>Saved ${im.done.saved.length} secret${im.done.saved.length === 1 ? '' : 's'} from <code>${esc(im.done.rel)}</code>. Your
|
|
83
|
+
<span>Saved ${im.done.saved.length} secret${im.done.saved.length === 1 ? '' : 's'} from <code>${esc(im.done.rel)}</code>. Your code reaches them through <code>quilt run</code> now${im.done.deleted ? ', and the file is deleted.' : ': the file is no longer needed.'}</span>
|
|
84
84
|
<span class="sx-grow"></span>${im.done.deleted ? '' : `<button type="button" class="btn sm danger" data-import-delete>Delete ${esc(im.done.rel)}</button><button type="button" class="btn sm ghost" data-import-close>Keep it</button>`}${im.done.deleted ? '<button type="button" class="btn sm ghost" data-import-close>Done</button>' : ''}
|
|
85
85
|
</div></div>`
|
|
86
86
|
}
|
|
87
|
-
if (!im.files.length) return `<div class="sx-import"><div class="sx-import-done"><span>${esc(im.empty || 'No .env files in this
|
|
87
|
+
if (!im.files.length) return `<div class="sx-import"><div class="sx-import-done"><span>${esc(im.empty || 'No .env files in this codebase\'s folder.')}</span><span class="sx-grow"></span><button type="button" class="btn sm ghost" data-import-close>Close</button></div></div>`
|
|
88
88
|
const f = im.files[im.fileIdx]
|
|
89
89
|
const picked = im.rows.filter((r) => r.pick && !r.skip).length
|
|
90
90
|
return `<div class="sx-import">
|
|
@@ -133,7 +133,7 @@ export function secretsCardHtml (view, ui = {}) {
|
|
|
133
133
|
${inheritable ? `<div>${sw(!s.inheritOff, 'data-inherit', `<b>${esc(inheritLabel(view))}</b>`, { disabled: !manage })}<span class="sx-grow"></span>${inheritRight(view)}</div>` : ''}
|
|
134
134
|
<div>${sw(s.agentsOn, 'data-agents-on', '<b>Agents can use secrets</b>', { disabled: !manage })}<span class="sx-grow"></span>${avatars(view)}${manage && s.agentsOn ? `<button type="button" class="btn sm ghost" data-choose ${ui.choose ? 'aria-expanded="true"' : ''}>Choose</button>` : ''}</div>
|
|
135
135
|
</div>`
|
|
136
|
-
const off = s.inheritOff && view.offCount ? `<div class="sx-off-note"><span>${view.offCount} ${esc(inheritLabel(view).replace(/ here$/, '').replace(/^./, (c) => c.toLowerCase()))} ${view.offCount === 1 ? 'is' : 'are'} off ${view.scope.type === 'session' ? 'in this
|
|
136
|
+
const off = s.inheritOff && view.offCount ? `<div class="sx-off-note"><span>${view.offCount} ${esc(inheritLabel(view).replace(/ here$/, '').replace(/^./, (c) => c.toLowerCase()))} ${view.offCount === 1 ? 'is' : 'are'} off ${view.scope.type === 'session' ? 'in this codebase' : 'in this project'}. Nothing here can use them.</span><span class="sx-grow"></span>${manage ? '<button type="button" class="btn sm" data-inherit-on>Turn back on</button>' : ''}</div>` : ''
|
|
137
137
|
const f = ui.form
|
|
138
138
|
const mode = ui.mode && ui.mode.name ? ui.mode : null
|
|
139
139
|
const add = manage ? `<form class="sx-new" data-add autocomplete="off">
|
package/src/ui/session-words.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export function stoppedWords (session, why) {
|
|
8
8
|
const st = session && session.status
|
|
9
|
-
const name = (st && st.sessionName) || (session && session.dir ? String(session.dir).split(/[\\/]/).filter(Boolean).pop() : '') || 'The
|
|
9
|
+
const name = (st && st.sessionName) || (session && session.dir ? String(session.dir).split(/[\\/]/).filter(Boolean).pop() : '') || 'The codebase'
|
|
10
10
|
return `${name} stopped: ${String(why || '').replace(/^Relay refused connection: /, '')}`
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -22,6 +22,6 @@ export function heldCard (st) {
|
|
|
22
22
|
const named = open.slice(0, 3).map((r) => `${r.path} (${r.by === me ? 'yours' : `${r.by}'s`})`).join(', ')
|
|
23
23
|
return {
|
|
24
24
|
title: `${open.length} open conflict${open.length === 1 ? '' : 's'}`,
|
|
25
|
-
text: `Changes to ${named}${open.length > 3 ? ` and ${open.length - 3} more` : ''} were held back: each file keeps the version that landed first, and the held lines wait for an AI to resolve them. Every AI in the
|
|
25
|
+
text: `Changes to ${named}${open.length > 3 ? ` and ${open.length - 3} more` : ''} were held back: each file keeps the version that landed first, and the held lines wait for an AI to resolve them. Every AI in the codebase sees ${open.length === 1 ? 'it' : 'them'} at the top of its next answer; ask yours to take ${open.length === 1 ? 'it' : 'them'}.`
|
|
26
26
|
}
|
|
27
27
|
}
|