Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Point your ACP client to the built `dist/index.js`:
- `PI_ACP_ENABLE_EMBEDDED_CONTEXT=true` advertises ACP `promptCapabilities.embeddedContext` support to the client.
- Default: unset/any other value means `false`.
- When disabled, compliant ACP clients should avoid sending embedded `resource` blocks. If they send them anyway, `pi-acp` still degrades gracefully by converting them into plain-text prompt context.
- `PI_ACP_CHECK_FOR_UPDATES=false` skips the startup check for newer pi versions. Unset, `true`, and any other value keep the update check enabled.

You can add the environment variable in the Zed settings with:

Expand Down
2 changes: 1 addition & 1 deletion src/acp/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export class PiAcpAgent implements ACPAgent {
})

const quietStartup = getQuietStartup(params.cwd)
const updateNotice = buildUpdateNotice()
const updateNotice = process.env.PI_ACP_CHECK_FOR_UPDATES === 'false' ? null : buildUpdateNotice()

// If quietStartup is enabled, suppress the full "startup info" prelude, but still surface
// the "New version available" notice (if any) since it's high-signal and actionable.
Expand Down
22 changes: 9 additions & 13 deletions test/unit/startup-info-env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ class FakeSessions {
}
}

test('PiAcpAgent: quietStartup=true disables startup info generation/emission', async () => {
test('PiAcpAgent: quietStartup=true and update checks disabled suppress startup info', async () => {
const prevAgentDir = process.env.PI_CODING_AGENT_DIR
const prevCheckForUpdates = process.env.PI_ACP_CHECK_FOR_UPDATES

// Force quietStartup in pi settings by pointing PI_CODING_AGENT_DIR at a temp dir.
// Force quietStartup and disable the update check in a temporary agent environment.
const { mkdtempSync, writeFileSync } = await import('node:fs')
const { tmpdir } = await import('node:os')
const { join } = await import('node:path')
const dir = mkdtempSync(join(tmpdir(), 'pi-acp-quietstartup-'))
writeFileSync(join(dir, 'settings.json'), JSON.stringify({ quietStartup: true }, null, 2), 'utf-8')
process.env.PI_CODING_AGENT_DIR = dir
process.env.PI_ACP_CHECK_FOR_UPDATES = 'false'

// Spy on setTimeout calls (agent schedules startup info + available commands)
const realSetTimeout = globalThis.setTimeout
Expand Down Expand Up @@ -62,20 +64,14 @@ test('PiAcpAgent: quietStartup=true disables startup info generation/emission',

const startupInfo = res?._meta?.piAcp?.startupInfo ?? null

// When quietStartup=true the full prelude is suppressed. However, an update notice
// (if one exists) is still surfaced because it's high-signal and actionable.
// The test must tolerate both cases since the live npm check may or may not find an update.
if (startupInfo) {
assert.match(startupInfo, /New version available/)
assert.equal(setStartupInfoCalled, true)
assert.equal(timeouts.length, 2)
} else {
assert.equal(setStartupInfoCalled, false)
assert.equal(timeouts.length, 1)
}
assert.equal(startupInfo, null)
assert.equal(setStartupInfoCalled, false)
assert.equal(timeouts.length, 1)
} finally {
;(globalThis as any).setTimeout = realSetTimeout
if (prevAgentDir == null) delete process.env.PI_CODING_AGENT_DIR
else process.env.PI_CODING_AGENT_DIR = prevAgentDir
if (prevCheckForUpdates == null) delete process.env.PI_ACP_CHECK_FOR_UPDATES
else process.env.PI_ACP_CHECK_FOR_UPDATES = prevCheckForUpdates
}
})