diff --git a/README.md b/README.md index f10638b..382ae1f 100644 --- a/README.md +++ b/README.md @@ -115,10 +115,10 @@ change it. runs, Jobs or image builds. It opens on the last day (or 7, 30 or 90); filter by type, or by the repository of a local folder (**Code → View releases**). A deployment opens its stages and logs. Times are in the machine's time zone, which the panel names. - Read-only. Nothing is read again while nothing deploys. While a shown deployment is - queued or running, the panel checks only those every 30 s and reads the history again - once one ends or starts; checks wait while the panel is hidden and pause after an hour - (**Refresh** starts them again). + Read-only. While the history is shown, the panel checks every 30 s only the deployments + queued or running, so one that starts after the read appears by itself, and reads the + history again once one ends or starts; checks wait while the panel is hidden and pause + after an hour in which nothing started or ended (**Refresh** starts them again). - **Deployments.** The latest run of a repository branch, its stages and logs, and the environment's deployment history, including jobs and images. A running deployment's details are read again every 10 s while they are on screen, with the same pauses. diff --git a/docs/agents-tools-panel.md b/docs/agents-tools-panel.md index 0983d91..85b132b 100644 --- a/docs/agents-tools-panel.md +++ b/docs/agents-tools-panel.md @@ -15,7 +15,7 @@ stay unchanged. No probe or custom Codex build is shipped. | Tools | Saved connections, Add MCP, connect/disconnect review, fresh schemas, explicit JSON tool-call review; catalog cache survives refresh failure; stable model-facing discovery/call tools | | Code | Remote/local search, branch selection, setup with optional install; folder/type, status/resolve/SDK; sync/install/SDK update and preview; instructions/skills and preview/sync; environment cleanup; Docker build preview; devcontainer preview/write; local deletion preview and explicit confirmation | | Projects | Search/pages, branch counts, descriptions, repository/branch links; local setup/update with Codex AGENTS.md; progress, cancellation, partial-effect reporting and explicit native workspace handoff | -| Releases | The deployment history of resource releases only (APIs, agents, static sites), as in Command Center: one row per deployment, newest first, over the last day by default or 7, 30 or 90, with type and local-repository filters, repository and release, branch, commit, start, state, stage progress, duration, source and error; pages; a deployment opens its stages and logs; dates and times in the machine's zone, named under the history; read-only. No re-read while nothing deploys; while a shown deployment is active, `deployment-active` every 30 s and one re-read when one ends or starts; checks wait while hidden, never overlap and pause after an hour | +| Releases | The deployment history of resource releases only (APIs, agents, static sites), as in Command Center: one row per deployment, newest first, over the last day by default or 7, 30 or 90, with type and local-repository filters, repository and release, branch, commit, start, state, stage progress, duration, source and error; pages; a deployment opens its stages and logs; dates and times in the machine's zone, named under the history; read-only. While the history is shown, `deployment-active` every 30 s, so a deployment that starts after the read appears by itself, and one re-read when one ends or starts; checks wait while hidden, never overlap and pause after an hour in which nothing started or ended | | Deployments | Environment/branch history, pages, run/workflow stages, related runs, durations, errors, stage logs, log filtering/cursors; a running run's details re-read every 10 s while shown and visible, pausing after an hour; read-only | | Settings | Existing shared account, browser login, connection check, renewal, explicit shared sign-out; repositories folder/backend/Command Center settings; diagnostics and local scan | | Activity | Agent receipts/tasks plus accepted workspace operations, progress, explicit cancellation and results; accepted workspace work survives panel close/native Stop while the server remains alive | diff --git a/manifests/codex/.codex-plugin/plugin.json b/manifests/codex/.codex-plugin/plugin.json index 2ffdf1e..c4e03c3 100644 --- a/manifests/codex/.codex-plugin/plugin.json +++ b/manifests/codex/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "mainsequence", - "version": "0.7.17", + "version": "0.7.18", "description": "Message MainSequence agents in Codex chat, recover saved replies, discover project MCPs and run developer commands using your shared session.", "author": { "name": "MainSequence" diff --git a/package-lock.json b/package-lock.json index e84f963..de1516c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@dev-mainsequence/codex-plugin", - "version": "0.7.17", + "version": "0.7.18", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@dev-mainsequence/codex-plugin", - "version": "0.7.17", + "version": "0.7.18", "license": "MIT", "dependencies": { "@dev-mainsequence/devtools": "0.3.22" diff --git a/package.json b/package.json index 13eb3aa..34dcbf8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dev-mainsequence/codex-plugin", - "version": "0.7.17", + "version": "0.7.18", "description": "MainSequence for Codex: durable agent messaging in native chat, Agents and Tools discovery, developer commands and conversational MCPs", "license": "MIT", "engines": { diff --git a/src/hosts/panel/panel.html b/src/hosts/panel/panel.html index 4e89ca3..d9b1095 100644 --- a/src/hosts/panel/panel.html +++ b/src/hosts/panel/panel.html @@ -256,9 +256,9 @@ async function projectDetail(project,target,run) {if(run!==generation)return;return detail(async()=>({...await view('project',{projectUid:project.uid},target),workspace:await workspace(),operations:await operations()}),data=>{const prepared=operationCache.find(op=>op.action==='organization-project-setup'&&op.context===project.uid&&op.status==='success')?.result?.data;const progress=node('div'),center=data.workspace.preferences.commandCenterUrl,link=(target,branchUid)=>runOperation('organization-project-link',{projectUid:project.uid,target,...(branchUid?{branchUid}:{}),commandCenterUrl:center},progress);const setup=actionButton(prepared?'Update local workspace':'Set up locally','organization-project-setup',{projectUid:project.uid,baseDir:data.workspace.preferences.baseDir},progress,{primary:true,description:'Prepare separate checkouts for '+data.branches.length+' assigned branches in '+data.workspace.preferences.baseDir+'. Existing changes are preserved.'});setup.disabled=!data.branches.length; const centerButton=button('Open in Command Center',()=>link('project'));centerButton.disabled=!center;centerButton.title=center?'':'Set the Command Center URL in Settings.'; append($('results'),back('Projects',()=>discover()),node('h2',data.project.name),markdown(data.project.description),group('row wrap',setup,centerButton),prepared&&caption(prepared.root),prepared&&operationRow(operationCache.find(op=>op.result?.data===prepared),target),progress,node('h3','Repositories'),...data.branches.map(b=>group('item',button(b.code_repository_name,()=>link('repository',b.uid),'name'),group('row',button(b.repository_branch,()=>link('branch',b.uid)),caption(b.is_initialized?'Ready':'Initializing')))));}); } -// Deployments and releases follow devtools' polling rules (docs/deployments.md): nothing re-reads while nothing deploys. -// While the deployment history shows one in progress it checks only those every 30 s and reads itself once more when -// one ends or starts; a deployment's details re-read it every 10 s. A check that comes due while the panel is hidden +// Deployments and releases follow devtools' polling rules (docs/deployments.md). While the release deployment history is +// shown it checks only the deployments in progress every 30 s and reads itself once more when one ends or starts; the +// environment's deployment list checks while it shows one in progress; a deployment's details re-read it every 10 s. A check that comes due while the panel is hidden // waits until it is visible again, checks never overlap, and they pause after an hour. const RELEASE_CHECK_MS = 30000, RUN_CHECK_MS = 10000, WATCH_LIMIT_MS = 3600000, AGE_MS = 60000, RELEASE_PAGE = 25; const RELEASE_FILTERS = [['', 'All types'], ['fastapi', 'APIs'], ['harness_agent', 'Agents'], ['static_site', 'Static sites']]; @@ -301,11 +301,12 @@ } // A watched screen reads itself again without the loading state, and replaces itself only while it is still shown. async function redraw(load, draw) { const shown = generation, data = await load(); if (shown !== generation) return; const screen = ++generation; clearResults(); $('list-toolbar').hidden = true; draw(data, screen); } -// While shown deployments are queued or running, check only those; read the history again once one ends or another starts. +// While the history is shown, check only the deployments queued or running: a shown one moves on in place, and the history is +// read again once one ends or another starts, so a deployment that starts after the read appears by itself. function watchDeployments(screen, list, note, live, reread, started) { const watched = list.results.filter(item => ACTIVE_RUNS.includes(item.state)).map(item => item.uid), known = new Set(list.results.map(item => item.uid)); const { kind, branch } = list.query; - note.textContent = 'Auto-refresh every 30 s while deploying.'; + note.textContent = 'Checks for new deployments every 30 s.'; startWatch(screen, RELEASE_CHECK_MS, async w => { const data = await readWorkspace('deployment-active', branch ? { codeRepositoryBranchUid: branch } : {}, list.target); if (!w.alive()) return false; @@ -395,8 +396,9 @@ append(out, group('pager', node('small', list.results.length + ' of ' + list.count + ' deployments'), more)); } append(out, note); - if (list.results.some(item => ACTIVE_RUNS.includes(item.state))) watchDeployments(screen, list, note, live, - w => redraw(() => readHistory(list.target, list.query, Math.max(RELEASE_PAGE, list.loaded)), (next, again) => drawReleases(next, again, w.started)), started); + // Something started or ended: the re-read history watches for a new hour. + watchDeployments(screen, list, note, live, + () => redraw(() => readHistory(list.target, list.query, Math.max(RELEASE_PAGE, list.loaded)), (next, again) => drawReleases(next, again)), started); } // The Releases list offers "This repository" once the panel has resolved a local folder to its repository branch. function rememberBranch(data, root) { const branch = data?.resolution?.code_repository_branch; folderBranch = branch?.uid ? { uid: branch.uid, root, label: [branch.code_repository_name, branch.repository_branch].filter(Boolean).join(' · '), environmentUid: $('environment').value } : null; } diff --git a/tests/panel-ui.test.cjs b/tests/panel-ui.test.cjs index f7dc134..23fba50 100644 --- a/tests/panel-ui.test.cjs +++ b/tests/panel-ui.test.cjs @@ -464,7 +464,7 @@ test('an empty history says there were no deployments', async () => { const ui = await releasePanel(); ui.state.empty = true; await ui.el('releases-tab').onclick(); const text = flatten(ui.el('results')); assert.match(text, /No deployments in the last day/); assert.match(text, /Choose a longer window/); assert.doesNotMatch(text, /No runs/); - assert.equal(ui.timers(30000).length, 0); + assert.equal(ui.timers(30000).length, 1, 'an empty history still watches for a deployment that starts'); }); test('a history longer than a page loads more from where it stopped', async () => { @@ -477,9 +477,9 @@ test('a history longer than a page loads more from where it stopped', async () = assert.equal(walk(ui.el('results')).filter(el => el.className === 'name').length, 30); assert.equal(button(ui, 'results', 'Load more'), undefined); }); -test('Releases re-checks only deployments in progress every 30 s, reads the history once when one ends or starts, then stops', async () => { +test('Releases checks the deployments in progress every 30 s and reads the history once when one ends or starts', async () => { const ui = await releasePanel(); await ui.el('releases-tab').onclick(); - assert.equal(ui.timers(30000).length, 1); assert.match(flatten(ui.el('results')), /Auto-refresh every 30 s while deploying\./); + assert.equal(ui.timers(30000).length, 1); assert.match(flatten(ui.el('results')), /Checks for new deployments every 30 s\./); // Still deploying, one stage further: the row updates in place and the history is not read again. ui.state.active = [deployment('run-1', 'running', { durationMs: 270000, steps: [{ name: 'Build', state: 'succeeded' }, { name: 'Deploy', state: 'succeeded' }, { name: 'Verify', state: 'running' }] })]; await ui.timers(30000)[0].fn(); @@ -492,22 +492,27 @@ test('Releases re-checks only deployments in progress every 30 s, reads the hist ui.state.active = [...ui.state.active, started]; ui.state.more = [started]; await ui.timers(30000)[0].fn(); assert.equal(ui.reads('deployment-release-history').length, 2); assert.match(flatten(ui.el('results')), /pricing-engine · other/); - // They end: the history is read once more and, with nothing deploying, nothing is watched. + // They end: the history is read once more, and the check goes on for the next deployment. ui.state.active = []; ui.state.more = []; ui.state.deploying = false; await ui.timers(30000)[0].fn(); assert.equal(ui.reads('deployment-release-history').length, 3); - assert.equal(ui.timers(30000).length, 0); - assert.doesNotMatch(flatten(ui.el('results')), /so far|Auto-refresh/); + assert.equal(ui.timers(30000).length, 1); + assert.doesNotMatch(flatten(ui.el('results')), /so far/); assert.match(flatten(ui.el('results')), /Checks for new deployments every 30 s\./); }); -test('nothing re-reads while nothing deploys; only the read age moves', async () => { +test('with nothing deploying, only the small check runs until a deployment starts, which then appears by itself', async () => { const time = clock(Date.now()); const ui = await releasePanel({ Date: time.Date }); ui.state.deploying = false; await ui.el('releases-tab').onclick(); - assert.equal(ui.timers(30000).length, 0); + assert.equal(ui.timers(30000).length, 1); + ui.state.active = []; await ui.timers(30000)[0].fn(); + assert.deepEqual(ui.calls.map(call => call.action), ['deployment-release-history', 'deployment-active'], 'nothing new: the history is not read again'); const [age] = ui.timers(60000); time.state.now += 60000; age.fn(); assert.match(flatten(ui.el('results')), /read 1 min ago/); - assert.deepEqual(ui.calls.map(call => call.action), ['deployment-release-history']); + const started = deployment('run-9', 'queued', { repositoryName: 'Markets', releaseName: 'api', createdAt: minutesAgo(0) }); + ui.state.active = [started]; ui.state.more = [started]; + await ui.timers(30000)[0].fn(); + assert.equal(ui.reads('deployment-release-history').length, 2, 'it started: the history is read once more'); assert.match(flatten(ui.el('results')), /Markets · api/); }); test('a check waits while the panel is hidden, runs as soon as it is visible, and pauses after an hour', async () => {