Compare commits
1 Commits
fix/disabl
...
fix/update
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fb0316e46 |
@@ -34,7 +34,6 @@ const featureFlags: Record<string, boolean> = {
|
|||||||
WEB_BROWSER_TOOL: false, // Built-in browser automation (source not mirrored)
|
WEB_BROWSER_TOOL: false, // Built-in browser automation (source not mirrored)
|
||||||
CHICAGO_MCP: false, // Computer-use MCP (native Swift modules stubbed)
|
CHICAGO_MCP: false, // Computer-use MCP (native Swift modules stubbed)
|
||||||
COWORKER_TYPE_TELEMETRY: false, // Telemetry for agent/coworker type classification
|
COWORKER_TYPE_TELEMETRY: false, // Telemetry for agent/coworker type classification
|
||||||
MCP_SKILLS: false, // Dynamic MCP skill discovery (src/skills/mcpSkills.ts not mirrored; enabling this causes "fetchMcpSkillsForClient is not a function" when MCP servers with resources connect — see #856)
|
|
||||||
|
|
||||||
// ── Enabled: upstream defaults ──────────────────────────────────────
|
// ── Enabled: upstream defaults ──────────────────────────────────────
|
||||||
COORDINATOR_MODE: true, // Multi-agent coordinator with worker delegation
|
COORDINATOR_MODE: true, // Multi-agent coordinator with worker delegation
|
||||||
@@ -57,6 +56,7 @@ const featureFlags: Record<string, boolean> = {
|
|||||||
EXTRACT_MEMORIES: true, // Auto-extract durable memories from conversations
|
EXTRACT_MEMORIES: true, // Auto-extract durable memories from conversations
|
||||||
FORK_SUBAGENT: true, // Implicit context-forking when omitting subagent_type
|
FORK_SUBAGENT: true, // Implicit context-forking when omitting subagent_type
|
||||||
VERIFICATION_AGENT: true, // Built-in read-only agent for test/verification
|
VERIFICATION_AGENT: true, // Built-in read-only agent for test/verification
|
||||||
|
MCP_SKILLS: true, // Discover skills dynamically from MCP server resources
|
||||||
PROMPT_CACHE_BREAK_DETECTION: true, // Detect & log unexpected prompt cache invalidations
|
PROMPT_CACHE_BREAK_DETECTION: true, // Detect & log unexpected prompt cache invalidations
|
||||||
HOOK_PROMPTS: true, // Allow tools to request interactive user prompts
|
HOOK_PROMPTS: true, // Allow tools to request interactive user prompts
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
import { existsSync, readFileSync } from 'fs'
|
|
||||||
import { join } from 'path'
|
|
||||||
import { expect, test } from 'bun:test'
|
|
||||||
|
|
||||||
// Regression guard for #856. Several build feature flags require source files
|
|
||||||
// that are not mirrored into the open build. When such a flag is set to `true`
|
|
||||||
// without the source present, the bundler falls back to a missing-module stub
|
|
||||||
// that only exports `default`, which causes runtime errors like
|
|
||||||
// `fetchMcpSkillsForClient is not a function` when downstream code reaches
|
|
||||||
// through the `require()` to a named export.
|
|
||||||
//
|
|
||||||
// This test fails fast at test-time if someone re-enables one of these flags
|
|
||||||
// without first mirroring the corresponding source file.
|
|
||||||
|
|
||||||
const BUILD_SCRIPT = join(import.meta.dir, 'build.ts')
|
|
||||||
const REPO_ROOT = join(import.meta.dir, '..')
|
|
||||||
|
|
||||||
type FlagGuard = {
|
|
||||||
flag: string
|
|
||||||
source: string // path relative to repo root
|
|
||||||
}
|
|
||||||
|
|
||||||
const FLAG_REQUIRES_SOURCE: FlagGuard[] = [
|
|
||||||
{ flag: 'MCP_SKILLS', source: 'src/skills/mcpSkills.ts' },
|
|
||||||
]
|
|
||||||
|
|
||||||
test('build feature flags are not enabled without their source files', () => {
|
|
||||||
const buildScript = readFileSync(BUILD_SCRIPT, 'utf-8')
|
|
||||||
|
|
||||||
for (const { flag, source } of FLAG_REQUIRES_SOURCE) {
|
|
||||||
const enabledRe = new RegExp(`^\\s*${flag}\\s*:\\s*true\\b`, 'm')
|
|
||||||
const isEnabled = enabledRe.test(buildScript)
|
|
||||||
const sourceExists = existsSync(join(REPO_ROOT, source))
|
|
||||||
|
|
||||||
if (isEnabled && !sourceExists) {
|
|
||||||
throw new Error(
|
|
||||||
`Feature flag ${flag} is enabled in scripts/build.ts, but its required source file "${source}" does not exist. ` +
|
|
||||||
`Enabling this flag without the source will cause runtime errors (missing named exports from the missing-module stub). ` +
|
|
||||||
`Either mirror the source file or set ${flag}: false.`,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// When the source IS present, the flag can be either true or false; either
|
|
||||||
// is fine. We only care about the "enabled but missing" combination.
|
|
||||||
expect(true).toBe(true)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -35,15 +35,20 @@ export async function update() {
|
|||||||
// binary (without it).
|
// binary (without it).
|
||||||
if (getAPIProvider() !== 'firstParty') {
|
if (getAPIProvider() !== 'firstParty') {
|
||||||
writeToStdout(
|
writeToStdout(
|
||||||
chalk.yellow('Auto-update is not available for third-party provider builds.\n') +
|
chalk.yellow(
|
||||||
'To update, pull the latest source from the repository and rebuild:\n' +
|
`Auto-update is not available for third-party provider builds.\n`,
|
||||||
' git pull && bun install && bun run build\n',
|
) +
|
||||||
|
`Current version: ${MACRO.DISPLAY_VERSION}\n\n` +
|
||||||
|
`To update, reinstall from npm:\n` +
|
||||||
|
chalk.bold(` npm install -g ${MACRO.PACKAGE_URL}@latest`) + '\n\n' +
|
||||||
|
`Or, if you built from source, pull and rebuild:\n` +
|
||||||
|
chalk.bold(' git pull && bun install && bun run build') + '\n',
|
||||||
)
|
)
|
||||||
return
|
await gracefulShutdown(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
logEvent('tengu_update_check', {})
|
logEvent('tengu_update_check', {})
|
||||||
writeToStdout(`Current version: ${MACRO.VERSION}\n`)
|
writeToStdout(`Current version: ${MACRO.DISPLAY_VERSION}\n`)
|
||||||
|
|
||||||
const channel = getInitialSettings()?.autoUpdatesChannel ?? 'latest'
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? 'latest'
|
||||||
writeToStdout(`Checking for updates to ${channel} version...\n`)
|
writeToStdout(`Checking for updates to ${channel} version...\n`)
|
||||||
@@ -123,9 +128,14 @@ export async function update() {
|
|||||||
if (diagnostic.installationType === 'development') {
|
if (diagnostic.installationType === 'development') {
|
||||||
writeToStdout('\n')
|
writeToStdout('\n')
|
||||||
writeToStdout(
|
writeToStdout(
|
||||||
chalk.yellow('Warning: Cannot update development build') + '\n',
|
chalk.yellow('You are running a development build — auto-update is unavailable.') + '\n',
|
||||||
)
|
)
|
||||||
await gracefulShutdown(1)
|
writeToStdout('To update, pull the latest source and rebuild:\n')
|
||||||
|
writeToStdout(chalk.bold(' git pull && bun install && bun run build') + '\n')
|
||||||
|
writeToStdout('\n')
|
||||||
|
writeToStdout('Or reinstall from npm:\n')
|
||||||
|
writeToStdout(chalk.bold(` npm install -g ${MACRO.PACKAGE_URL}@latest`) + '\n')
|
||||||
|
await gracefulShutdown(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if running from a package manager
|
// Check if running from a package manager
|
||||||
@@ -136,8 +146,8 @@ export async function update() {
|
|||||||
if (packageManager === 'homebrew') {
|
if (packageManager === 'homebrew') {
|
||||||
writeToStdout('Claude is managed by Homebrew.\n')
|
writeToStdout('Claude is managed by Homebrew.\n')
|
||||||
const latest = await getLatestVersion(channel)
|
const latest = await getLatestVersion(channel)
|
||||||
if (latest && !gte(MACRO.VERSION, latest)) {
|
if (latest && !gte(MACRO.DISPLAY_VERSION, latest)) {
|
||||||
writeToStdout(`Update available: ${MACRO.VERSION} → ${latest}\n`)
|
writeToStdout(`Update available: ${MACRO.DISPLAY_VERSION} → ${latest}\n`)
|
||||||
writeToStdout('\n')
|
writeToStdout('\n')
|
||||||
writeToStdout('To update, run:\n')
|
writeToStdout('To update, run:\n')
|
||||||
writeToStdout(chalk.bold(' brew upgrade claude-code') + '\n')
|
writeToStdout(chalk.bold(' brew upgrade claude-code') + '\n')
|
||||||
@@ -147,8 +157,8 @@ export async function update() {
|
|||||||
} else if (packageManager === 'winget') {
|
} else if (packageManager === 'winget') {
|
||||||
writeToStdout('Claude is managed by winget.\n')
|
writeToStdout('Claude is managed by winget.\n')
|
||||||
const latest = await getLatestVersion(channel)
|
const latest = await getLatestVersion(channel)
|
||||||
if (latest && !gte(MACRO.VERSION, latest)) {
|
if (latest && !gte(MACRO.DISPLAY_VERSION, latest)) {
|
||||||
writeToStdout(`Update available: ${MACRO.VERSION} → ${latest}\n`)
|
writeToStdout(`Update available: ${MACRO.DISPLAY_VERSION} → ${latest}\n`)
|
||||||
writeToStdout('\n')
|
writeToStdout('\n')
|
||||||
writeToStdout('To update, run:\n')
|
writeToStdout('To update, run:\n')
|
||||||
writeToStdout(
|
writeToStdout(
|
||||||
@@ -160,8 +170,8 @@ export async function update() {
|
|||||||
} else if (packageManager === 'apk') {
|
} else if (packageManager === 'apk') {
|
||||||
writeToStdout('Claude is managed by apk.\n')
|
writeToStdout('Claude is managed by apk.\n')
|
||||||
const latest = await getLatestVersion(channel)
|
const latest = await getLatestVersion(channel)
|
||||||
if (latest && !gte(MACRO.VERSION, latest)) {
|
if (latest && !gte(MACRO.DISPLAY_VERSION, latest)) {
|
||||||
writeToStdout(`Update available: ${MACRO.VERSION} → ${latest}\n`)
|
writeToStdout(`Update available: ${MACRO.DISPLAY_VERSION} → ${latest}\n`)
|
||||||
writeToStdout('\n')
|
writeToStdout('\n')
|
||||||
writeToStdout('To update, run:\n')
|
writeToStdout('To update, run:\n')
|
||||||
writeToStdout(chalk.bold(' apk upgrade claude-code') + '\n')
|
writeToStdout(chalk.bold(' apk upgrade claude-code') + '\n')
|
||||||
@@ -250,14 +260,14 @@ export async function update() {
|
|||||||
await gracefulShutdown(1)
|
await gracefulShutdown(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.latestVersion === MACRO.VERSION) {
|
if (result.latestVersion === MACRO.DISPLAY_VERSION) {
|
||||||
writeToStdout(
|
writeToStdout(
|
||||||
chalk.green(`Claude Code is up to date (${MACRO.VERSION})`) + '\n',
|
chalk.green(`OpenClaude is up to date (${MACRO.DISPLAY_VERSION})`) + '\n',
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
writeToStdout(
|
writeToStdout(
|
||||||
chalk.green(
|
chalk.green(
|
||||||
`Successfully updated from ${MACRO.VERSION} to version ${result.latestVersion}`,
|
`Successfully updated from ${MACRO.DISPLAY_VERSION} to version ${result.latestVersion}`,
|
||||||
) + '\n',
|
) + '\n',
|
||||||
)
|
)
|
||||||
await regenerateCompletionCache()
|
await regenerateCompletionCache()
|
||||||
@@ -320,15 +330,15 @@ export async function update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if versions match exactly, including any build metadata (like SHA)
|
// Check if versions match exactly, including any build metadata (like SHA)
|
||||||
if (latestVersion === MACRO.VERSION) {
|
if (latestVersion === MACRO.DISPLAY_VERSION) {
|
||||||
writeToStdout(
|
writeToStdout(
|
||||||
chalk.green(`Claude Code is up to date (${MACRO.VERSION})`) + '\n',
|
chalk.green(`OpenClaude is up to date (${MACRO.DISPLAY_VERSION})`) + '\n',
|
||||||
)
|
)
|
||||||
await gracefulShutdown(0)
|
await gracefulShutdown(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
writeToStdout(
|
writeToStdout(
|
||||||
`New version available: ${latestVersion} (current: ${MACRO.VERSION})\n`,
|
`New version available: ${latestVersion} (current: ${MACRO.DISPLAY_VERSION})\n`,
|
||||||
)
|
)
|
||||||
writeToStdout('Installing update...\n')
|
writeToStdout('Installing update...\n')
|
||||||
|
|
||||||
@@ -388,7 +398,7 @@ export async function update() {
|
|||||||
case 'success':
|
case 'success':
|
||||||
writeToStdout(
|
writeToStdout(
|
||||||
chalk.green(
|
chalk.green(
|
||||||
`Successfully updated from ${MACRO.VERSION} to version ${latestVersion}`,
|
`Successfully updated from ${MACRO.DISPLAY_VERSION} to version ${latestVersion}`,
|
||||||
) + '\n',
|
) + '\n',
|
||||||
)
|
)
|
||||||
await regenerateCompletionCache()
|
await regenerateCompletionCache()
|
||||||
|
|||||||
Reference in New Issue
Block a user