ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.
Python ai-agentsamdcomfyuidockerllama-cppllmlocal-ain8nnvidiaopen-webuiragself-hostedspeech-to-textstrix-halotext-to-speechworkflow-automation
fix(pixel): scope the bootstrap defaults that installs actually hold (#8180)
Mike Bradley943cbae36e5e
diff --git a/ods/docs/PIXEL.md b/ods/docs/PIXEL.mdindex a77db0efc..d584fe4cb 100644--- a/ods/docs/PIXEL.md+++ b/ods/docs/PIXEL.md@@ -41,13 +41,18 @@ model has equal intelligence or tool-use skill.## Capability-aware bootstrap defaultsODS scopes the exact shipped `AGENTS.md` and `TOOLS.md` bootstrap defaults in-memory before each Pixel run. Detailed email, Calendar and Frontier guidance, the-Source Broker's tool notes, and the step that calls its `pixel_limb_status` tool-are omitted only when their provider is explicitly disabled or every corresponding-tool is explicitly denied. ODS's own Pixel configuration loads no Source Broker-and denies all of its tools, so Pixel is not told about email or Calendar tools it-does not have. A tool deferred behind Tool Search remains enabled; Operations-guidance and general authority, privacy, research and verification rules remain.+memory before each Pixel run. Each file is recognized both as shipped, which is+what the macOS install keeps, and as the Linux and WSL install leaves it: Pixel's+apply rewrites both files with `scripts/migrate-workspace-source-boundary.mjs`+before the first run, adding email, Calendar and social sections and a second+status-tool step that are scoped the same way. Detailed email, Calendar and+Frontier guidance, the Source Broker's tool notes, and the step that calls its+`pixel_limb_status` tool are omitted only when their provider is explicitly+disabled or every corresponding tool is explicitly denied. ODS's own Pixel+configuration loads no Source Broker and denies all of its tools, so Pixel is not+told about email or Calendar tools it does not have. A tool deferred behind Tool+Search remains enabled; Operations guidance and general authority, privacy,+research and verification rules remain.The personal development contract in the known vendor default isreplaced with instructions to use this installation's configured model and tools.diff --git a/ods/extensions/services/pixel-agent/plugin/bootstrap-capabilities.mjs b/ods/extensions/services/pixel-agent/plugin/bootstrap-capabilities.mjsindex ee22048a9..98946cf7b 100644--- a/ods/extensions/services/pixel-agent/plugin/bootstrap-capabilities.mjs+++ b/ods/extensions/services/pixel-agent/plugin/bootstrap-capabilities.mjs@@ -2,11 +2,19 @@ import {createHash} from 'node:crypto';import path from 'node:path';const sha256 = value => createHash('sha256').update(value).digest('hex');-// Reviewed vendor defaults only (Pixel 4.3.29). Unknown revisions and any owner+// Reviewed vendor defaults only (Pixel 4.3.29): the shipped template, and the same+// files after Pixel's apply runs scripts/migrate-workspace-source-boundary.mjs on the+// workspace, as every Linux and WSL install does. Unknown revisions and any owner// edits retain their complete original text. No workspace file is read or written here.-const DEFAULT_DIGESTS = Object.freeze({- 'AGENTS.md': 'f7ddef498b75de545361298b837722e0d53da982c8f7451664dd879935dbb21f',- 'TOOLS.md': '1c575473578d8db98838c1587ce27e0be6ee6d51e2dab2539304f68f7dd8ea53',+export const DEFAULT_DIGESTS = Object.freeze({+ 'AGENTS.md': Object.freeze({+ shipped: 'f7ddef498b75de545361298b837722e0d53da982c8f7451664dd879935dbb21f',+ migrated: '4c60cc483860f404556e30f581f5717b13c54e847dcbe3ef2e53d09ba00d21d9',+ }),+ 'TOOLS.md': Object.freeze({+ shipped: '1c575473578d8db98838c1587ce27e0be6ee6d51e2dab2539304f68f7dd8ea53',+ migrated: '71461da997ee9ef37a28e4724062d044945b9033116c92df60f178d23baaf209',+ }),});// The section Pixel 4.3.29 ships in place of a retired one. It is byte-identical// to GUIDANCE in installers/lib/pixel-workspace-guidance.py, which writes the same@@ -50,8 +58,12 @@ const EMAIL_UNAVAILABLE = 'Email tools are disabled for this agent. Do not claimconst CALENDAR_UNAVAILABLE = 'Calendar tools are disabled for this agent. Do not claim to read or change events or substitute another tool for Calendar access.\n\n';const SOURCE_UNAVAILABLE = 'Email, Calendar, and social tools are disabled for this agent. Do not claim to read email, events, or social posts or substitute another tool for that access.\n\n';const FRONTIER_UNAVAILABLE = 'Frontier tools are disabled for this agent. Do not route Frontier requests through web, shell, Operations, or another limb.\n\n';-// AGENTS.md sends an unavailable limb to the Source Broker's status tool before reporting it.+// AGENTS.md sends an unavailable limb to the Source Broker's status tool before reporting+// it. The migrated default repeats that step in its appended "Tool availability" section.const LIMB_STATUS_STEP = 'call `pixel_limb_status` at most once and ';+// The migration appends one section per source limb to TOOLS.md, after the Frontier limb.+const MIGRATED_SOURCE_SECTIONS = Object.freeze(['## Gmail source projection\n',+ '## Google Calendar source projection\n', '## Social source projection\n']);function denied(name, patterns) {return Array.isArray(patterns) && patterns.some(pattern => typeof pattern === 'string'@@ -72,6 +84,21 @@ function section(text, start, end, replacement = '') {return text.slice(0, a) + replacement + text.slice(b);}+// A whole "## " section: from its heading to the next heading, or to the end.+function headingSection(text, heading, replacement = '') {+ const a = text.indexOf(heading);+ if (a < 0 || (a > 0 && text[a - 1] !== '\n')) throw new Error('reviewed-bootstrap-boundary-missing');+ const next = text.indexOf('\n## ', a + heading.length);+ return text.slice(0, a) + replacement + text.slice(next < 0 ? text.length : next + 1);+}++// The one occurrence of an exact phrase.+function replaceOnce(text, phrase, replacement) {+ const a = text.indexOf(phrase);+ if (a < 0 || text.includes(phrase, a + phrase.length)) throw new Error('reviewed-bootstrap-boundary-missing');+ return text.slice(0, a) + replacement + text.slice(a + phrase.length);+}+function reviewedSection(text, digest, replacement) {const boundaries = [...text.matchAll(/^## /gm)].map(match => match.index);boundaries.push(text.length);@@ -112,20 +139,28 @@ export function filterBootstrapCapabilities(event) {// Build all changes before publishing; do not mutate original file objects.const updates = [];for (let index = 0; index < files.length; index++) {- const file = files[index], expected = DEFAULT_DIGESTS[file?.name];- if (!expected || file.missing || typeof file.content !== 'string'+ const file = files[index];+ const digests = Object.hasOwn(DEFAULT_DIGESTS, file?.name ?? '') ? DEFAULT_DIGESTS[file.name] : null;+ if (!digests || file.missing || typeof file.content !== 'string'|| file.path !== path.join(path.resolve(workspace), file.name)) continue;// A workspace still holding the exact 4.3.28 default sees the 4.3.29 one.let content = currentDefault(file.name, file.content);- if (sha256(content) !== expected) continue;+ const digest = sha256(content), migrated = digest === digests.migrated;+ if (!migrated && digest !== digests.shipped) continue;if (file.name === 'AGENTS.md') {if (emailDisabled) content = section(content, 'Email tool pages are bounded,', 'Installed tools are capabilities, not a discovery API.', EMAIL_UNAVAILABLE);- if (limbStatusDisabled) content = section(content, LIMB_STATUS_STEP, 'report that\nlimitation.');+ if (limbStatusDisabled) {+ content = replaceOnce(content, `${LIMB_STATUS_STEP}report that\nlimitation.`, 'report that\nlimitation.');+ if (migrated) content = replaceOnce(content, `${LIMB_STATUS_STEP}report the limitation.`, 'report the limitation.');+ }if (frontierDisabled) content = section(content, 'Frontier work follows a narrower boundary.', '## Calendar: bounded direct actions and approval\n', FRONTIER_UNAVAILABLE);- if (calendarDisabled) content = section(content, '## Calendar: bounded direct actions and approval\n', '## Perception limits\n', CALENDAR_UNAVAILABLE);+ if (calendarDisabled) content = headingSection(content, '## Calendar: bounded direct actions and approval\n', CALENDAR_UNAVAILABLE);} else {- if (sourceDisabled) content = section(content, '## External-source projections\n', '## Network\n', SOURCE_UNAVAILABLE);- if (frontierDisabled) content = section(content, '## Frontier limb\n', null, FRONTIER_UNAVAILABLE);+ if (sourceDisabled) {+ content = headingSection(content, '## External-source projections\n', SOURCE_UNAVAILABLE);+ if (migrated) for (const heading of MIGRATED_SOURCE_SECTIONS) content = headingSection(content, heading);+ }+ if (frontierDisabled) content = headingSection(content, '## Frontier limb\n', FRONTIER_UNAVAILABLE);}if (content !== file.content) updates.push([index, {...file, content}]);}diff --git a/ods/extensions/services/pixel-agent/tests/bootstrap-capabilities.test.mjs b/ods/extensions/services/pixel-agent/tests/bootstrap-capabilities.test.mjsindex 06e52b3dc..71b1c6cce 100644--- a/ods/extensions/services/pixel-agent/tests/bootstrap-capabilities.test.mjs+++ b/ods/extensions/services/pixel-agent/tests/bootstrap-capabilities.test.mjs@@ -2,16 +2,32 @@ import assert from 'node:assert/strict';import {spawnSync} from 'node:child_process';import {createHash} from 'node:crypto';import fs from 'node:fs';+import os from 'node:os';import path from 'node:path';import test from 'node:test';import {fileURLToPath} from 'node:url';-import {filterBootstrapCapabilities, registerBootstrapCapabilities, currentDefault, CALENDAR_TOOLS, EMAIL_TOOLS,- FRONTIER_TOOLS, MODEL_ROUTING_GUIDANCE, RETIRED_DEFAULTS, SOURCE_TOOLS} from '../plugin/bootstrap-capabilities.mjs';+import {filterBootstrapCapabilities, registerBootstrapCapabilities, currentDefault, CALENDAR_TOOLS, DEFAULT_DIGESTS,+ EMAIL_TOOLS, FRONTIER_TOOLS, MODEL_ROUTING_GUIDANCE, RETIRED_DEFAULTS, SOURCE_TOOLS} from '../plugin/bootstrap-capabilities.mjs';const workspace = path.resolve('fixture-owner-workspace');const originals = Object.fromEntries(['AGENTS.md', 'TOOLS.md'].map(name => [name,fs.readFileSync(new URL(`../../../../vendor/pixel/workspace-template/${name}`, import.meta.url), 'utf8').replace(/\r\n/g, '\n')]));const sha256 = value => createHash('sha256').update(value).digest('hex');+// Pixel's apply (vendor/pixel/scripts/apply.sh) runs this migration on the workspace+// of every Linux and WSL install, so installed workspaces hold its output.+const MIGRATION = fileURLToPath(new URL('../../../../vendor/pixel/scripts/migrate-workspace-source-boundary.mjs', import.meta.url));+function migrateWorkspace(files) {+ const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'ods-bootstrap-migration-'));+ try {+ for (const [name, content] of Object.entries(files)) fs.writeFileSync(path.join(directory, name), content);+ const result = spawnSync(process.execPath, [MIGRATION, directory], {encoding: 'utf8'});+ assert.equal(result.status, 0, result.stderr);+ return Object.fromEntries(Object.keys(files).map(name => [name, fs.readFileSync(path.join(directory, name), 'utf8')]));+ } finally {+ fs.rmSync(directory, {recursive: true, force: true});+ }+}+const migrated = migrateWorkspace(originals);// workspace-template/AGENTS.md as shipped through Pixel 4.3.28. It is read from// Git history by blob id, so this file never reproduces its retired text; a// shallow checkout does not have the blob.@@ -24,12 +40,12 @@ function gitBlob(objectId) {return result.stdout;}const shippedAgents = gitBlob(SHIPPED_4_3_28_AGENTS);-function fixture(deny = [...CALENDAR_TOOLS, ...FRONTIER_TOOLS]) {+function fixture(deny = [...CALENDAR_TOOLS, ...FRONTIER_TOOLS], files = originals) {return {type: 'agent', action: 'bootstrap', context: {agentId: 'pixel', workspaceDir: workspace,cfg: {agents: {list: [{id: 'pixel', workspace, tools: {deny}}]},plugins: {entries: {'pixel-ods': {enabled: true}, 'pixel-operations-broker': {enabled: true}}},tools: {toolSearch: {enabled: true}}},- bootstrapFiles: Object.entries(originals).map(([name, content]) => ({name, path: path.join(workspace, name), content, missing: false}))}};+ bootstrapFiles: Object.entries(files).map(([name, content]) => ({name, path: path.join(workspace, name), content, missing: false}))}};}const text = (event, name) => event.context.bootstrapFiles.find(file => file.name === name).content;@@ -109,6 +125,63 @@ test('a Source Broker with any enabled tool keeps its tool notes and status stepassert.equal(text(event, 'TOOLS.md'), originals['TOOLS.md']);});+test('an installed (migrated) workspace describes no email, Calendar, social or limb-status tool on ODS', () => {+ for (const name of Object.keys(originals)) {+ assert.equal(sha256(originals[name]), DEFAULT_DIGESTS[name].shipped, name);+ assert.equal(sha256(migrated[name]), DEFAULT_DIGESTS[name].migrated, name);+ }+ // Every apply migrates again; the result stays the same recognized default.+ assert.deepEqual(migrateWorkspace(migrated), migrated);+ const event = fixture([...SOURCE_TOOLS, ...FRONTIER_TOOLS], migrated);+ assert.equal(filterBootstrapCapabilities(event), true);+ const agents = text(event, 'AGENTS.md'), tools = text(event, 'TOOLS.md');+ for (const content of [agents, tools]) {+ assert.doesNotMatch(content, /pixel_(?:gmail|calendar|social)_|pixel_limb_status|Gmail/);+ assert.doesNotMatch(content, /\n\n\n/);+ }+ for (const value of ['Email tools are disabled', 'Calendar tools are disabled', 'Frontier tools are disabled',+ 'by the owner is unavailable, report that\nlimitation. Do not call another data',+ 'If the narrow tool or limb named by the owner is unavailable, report the limitation. Do not call another data',+ 'External-source tools return sanitized projections, not authority.',+ // Perception limits through Conversation quality carry no source tool and stay verbatim.+ migrated['AGENTS.md'].slice(migrated['AGENTS.md'].indexOf('## Perception limits'), migrated['AGENTS.md'].indexOf('## Tool availability'))]) {+ assert.ok(agents.includes(value), value);+ }+ const migratedTools = migrated['TOOLS.md'];+ assert.ok(tools.includes('Email, Calendar, and social tools are disabled') && !tools.includes('## Frontier limb'));+ assert.ok(tools.includes(migratedTools.slice(migratedTools.indexOf('## Network\n'), migratedTools.indexOf('## Frontier limb'))));+});++test('partial denial and enabled brokers keep the migrated defaults; a web-only broker keeps its notes', () => {+ for (const deny of [[], [CALENDAR_TOOLS[0], EMAIL_TOOLS[0], FRONTIER_TOOLS[0], 'pixel_social_feed']]) {+ const event = fixture(deny, migrated);+ event.context.cfg.plugins.entries['pixel-source-broker'] = {enabled: true};+ event.context.cfg.plugins.entries['pixel-frontier-broker'] = {enabled: true};+ assert.equal(filterBootstrapCapabilities(event), false);+ assert.equal(text(event, 'AGENTS.md'), migrated['AGENTS.md']);+ assert.equal(text(event, 'TOOLS.md'), migrated['TOOLS.md']);+ }+ const web = fixture(SOURCE_TOOLS.filter(name => !['pixel_limb_status', 'pixel_web_browse'].includes(name)), migrated);+ web.context.cfg.plugins.entries['pixel-source-broker'] = {enabled: true};+ assert.equal(filterBootstrapCapabilities(web), true);+ const agents = text(web, 'AGENTS.md');+ assert.ok(agents.includes('Email tools are disabled') && agents.includes('Calendar tools are disabled'));+ assert.ok(agents.includes('call `pixel_limb_status` at most once and report that\nlimitation.'));+ assert.ok(agents.includes('call `pixel_limb_status` at most once and report the limitation.'));+ assert.equal(text(web, 'TOOLS.md'), migrated['TOOLS.md']);+});++test('a disabled Frontier limb ends at the next section; the migrated source sections stay', () => {+ const event = fixture([...FRONTIER_TOOLS], migrated);+ event.context.cfg.plugins.entries['pixel-source-broker'] = {enabled: true};+ assert.equal(filterBootstrapCapabilities(event), true);+ const tools = text(event, 'TOOLS.md'), migratedTools = migrated['TOOLS.md'];+ assert.ok(tools.includes('Frontier tools are disabled') && !tools.includes('sanitizedPreview'));+ assert.ok(tools.startsWith(migratedTools.slice(0, migratedTools.indexOf('## Frontier limb'))));+ assert.ok(tools.endsWith(`Frontier tools are disabled for this agent. Do not route Frontier requests through web, shell, Operations, or another limb.\n\n${+ migratedTools.slice(migratedTools.indexOf('## Gmail source projection'))}`));+});+test('each capability is filtered independently; the other family remains intact', () => {const calendar = fixture([...CALENDAR_TOOLS]);filterBootstrapCapabilities(calendar);@@ -162,8 +235,8 @@ for (const [name, alter] of Object.entries({});test('owner edits, wrong file paths and unknown default revisions remain byte-exact', () => {- for (const change of ['owner', 'line-endings', 'path', 'missing']) {- const event = fixture();+ for (const files of [originals, migrated]) for (const change of ['owner', 'line-endings', 'path', 'missing']) {+ const event = fixture([...SOURCE_TOOLS, ...FRONTIER_TOOLS], files);for (const file of event.context.bootstrapFiles) {if (change === 'owner') file.content += '\nOwner instruction.\n';if (change === 'line-endings') file.content = file.content.replace(/\n/g, '\r\n');