Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
refactor(view): build the release facts in hosted-release [N26]
Corey Olson33e084ff31ef
diff --git a/src/cockpit.js b/src/cockpit.jsindex 274a2b42..41b0c048 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -1,7 +1,6 @@import {- HOSTED_RELEASE,hostedReleaseDistance,- shippedReleaseVersions,+ hostedReleaseInfo,} from './view/hosted-release.js';import {effectiveGuards,@@ -56,7 +55,7 @@ function lifecycle() {* @param {{snapshot?: boolean, readOnly?: boolean, requests?: boolean, transportModule?: string|null, apiBase?: string, apiHeaders?: Record<string, string>, stylesheet?: string, paths?: boolean, hostedLocal?: boolean, relaySession?: boolean, signIn?: string|null, hostedReleaseVersion?: string, hostedReleaseVersions?: string[]|null}} [options] - Served connection and assets, optional person requests over a read-only transport, host routes, a static page with event replay, or the hosted page that reads this machine's view first.* @returns {string}*/-export function cockpitPage(key = '', { snapshot = false, readOnly = false, requests = false, transportModule = null, apiBase = '', apiHeaders = { 'x-pullboard-key': key }, stylesheet = null, paths = false, hostedLocal = false, relaySession = false, signIn = null, hostedReleaseVersion = HOSTED_RELEASE, hostedReleaseVersions: suppliedReleaseVersions = null } = {}) {+export function cockpitPage(key = '', { snapshot = false, readOnly = false, requests = false, transportModule = null, apiBase = '', apiHeaders = { 'x-pullboard-key': key }, stylesheet = null, paths = false, hostedLocal = false, relaySession = false, signIn = null, hostedReleaseVersion, hostedReleaseVersions = null } = {}) {// Derive the current CLI inventory for every served, relay or exported page.const COMMAND_SOURCE = 'pullboard (?:' + commandPhrases().join('|') + ')(?![\\w-])(?: (?:--?[\\w-]+|\\d+|#\\d+|"[^"\\n]*"|[A-Z][A-Z0-9_]*|[\\w-]*[\\/.:@][^\\s"]*|[a-z]+-\\d+)(?![\\w-]))*';@@ -66,8 +65,7 @@ export function cockpitPage(key = '', { snapshot = false, readOnly = false, requconst requestMode = Boolean(readOnly && requests && !snapshot && transportModule);if (signIn !== null && (typeof signIn !== 'string' || !signIn.startsWith('/') || signIn.startsWith('//'))) throw new TypeError('signIn must be a path on the hosting site, or null');const hostedOptions = JSON.stringify({ local: Boolean(hostedLocal) && !snapshot, relaySession: Boolean(relaySession), signIn }).replace(/</g, '\\u003c');- const releaseVersions = suppliedReleaseVersions ?? (hostedLocal && !snapshot ? shippedReleaseVersions() : []);- const releaseInfo = JSON.stringify({ version: hostedReleaseVersion, versions: releaseVersions }).replace(/</g, '\\u003c');+ const releaseInfo = hostedReleaseInfo(hostedReleaseVersion, hostedReleaseVersions, Boolean(hostedLocal) && !snapshot);const css = stylesheet ?? (snapshot ? 'view.css' : transportModule ? '/view.css' : '/view.css?k=' + encodeURIComponent(key));const cssAttribute = css.replace(/[&<>"']/g, (character) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[character]);return `<!doctype html>diff --git a/src/view/hosted-release.js b/src/view/hosted-release.jsindex a4653304..05f9d27e 100644--- a/src/view/hosted-release.js+++ b/src/view/hosted-release.js@@ -66,3 +66,17 @@ export function hostedReleaseDistance(installed, current, releases) {const installedAt = releases.indexOf(installed), currentAt = releases.indexOf(current);return installedAt >= 0 && currentAt > installedAt ? currentAt - installedAt : 0;}++/**+ * The page's embedded release facts, as script-safe JSON: the release it was built from and the+ * shipped releases to count against. Only the hosted page reads the changelog; others count nothing.+ *+ * @param {string} [version] - The page's release; defaults to the package's own.+ * @param {string[]|null} [versions] - Shipped releases to use instead of the packaged changelog.+ * @param {boolean} [hostedPage] - Whether this is the hosted page that reads this machine's view.+ * @returns {string}+ */+export function hostedReleaseInfo(version = HOSTED_RELEASE, versions = null, hostedPage = false) {+ const releases = versions ?? (hostedPage ? shippedReleaseVersions() : []);+ return JSON.stringify({ version, versions: releases }).replace(/</g, '\\u003c');+}