feat: add task notification mode and skip review builtin option
- Add TASK_NOTIFICATION_TAG to distinguish task notifications from regular prompts - Add SKIP_REVIEW_BUILTIN=1 env var to skip review builtin generation during dev/build for faster startup Co-Authored-By: claude-sonnet-4-6 <noreply@anthropic.com>
This commit is contained in:
parent
e93a60264c
commit
196ff5ba21
16
build.ts
16
build.ts
|
|
@ -8,15 +8,19 @@ const outdir = 'dist'
|
||||||
const { rmSync } = await import('fs')
|
const { rmSync } = await import('fs')
|
||||||
rmSync(outdir, { recursive: true, force: true })
|
rmSync(outdir, { recursive: true, force: true })
|
||||||
|
|
||||||
// Step 1.5: Generate review builtin files
|
// Step 1.5: Generate review builtin files (skip with SKIP_REVIEW_BUILTIN=1)
|
||||||
console.log('Generating review builtin files...')
|
if (process.env.SKIP_REVIEW_BUILTIN) {
|
||||||
const { spawnSync: genSpawnSync } = await import('child_process')
|
console.log('Skipping review builtin generation (SKIP_REVIEW_BUILTIN is set)')
|
||||||
const genResult = genSpawnSync('bun', ['run', 'scripts/generate-review-builtin.ts'], {
|
} else {
|
||||||
|
console.log('Generating review builtin files...')
|
||||||
|
const { spawnSync: genSpawnSync } = await import('child_process')
|
||||||
|
const genResult = genSpawnSync('bun', ['run', 'scripts/generate-review-builtin.ts'], {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
cwd: process.cwd(),
|
cwd: process.cwd(),
|
||||||
})
|
})
|
||||||
if (genResult.status !== 0) {
|
if (genResult.status !== 0) {
|
||||||
console.warn('Warning: generate-review-builtin.ts failed, using existing files')
|
console.warn('Warning: generate-review-builtin.ts failed, using existing files')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default features that match the official CLI build.
|
// Default features that match the official CLI build.
|
||||||
|
|
|
||||||
|
|
@ -73,14 +73,18 @@ const inspectArgs = process.env.BUN_INSPECT
|
||||||
// npm, etc.) and on all platforms.
|
// npm, etc.) and on all platforms.
|
||||||
const bunCmd = process.execPath;
|
const bunCmd = process.execPath;
|
||||||
|
|
||||||
// Generate review builtin files before dev launch
|
// Generate review builtin files before dev launch (skip with SKIP_REVIEW_BUILTIN=1)
|
||||||
console.log('[dev] Generating review builtin files...');
|
if (process.env.SKIP_REVIEW_BUILTIN) {
|
||||||
const genResult = Bun.spawnSync(['bun', 'run', 'scripts/generate-review-builtin.ts'], {
|
console.log('[dev] Skipping review builtin generation (SKIP_REVIEW_BUILTIN is set)');
|
||||||
|
} else {
|
||||||
|
console.log('[dev] Generating review builtin files...');
|
||||||
|
const genResult = Bun.spawnSync(['bun', 'run', 'scripts/generate-review-builtin.ts'], {
|
||||||
stdio: ["inherit", "inherit", "inherit"],
|
stdio: ["inherit", "inherit", "inherit"],
|
||||||
cwd: projectRoot,
|
cwd: projectRoot,
|
||||||
});
|
});
|
||||||
if (!genResult.success) {
|
if (!genResult.success) {
|
||||||
console.warn('[dev] Warning: generate-review-builtin.ts failed, using existing files');
|
console.warn('[dev] Warning: generate-review-builtin.ts failed, using existing files');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const args = [bunCmd, ...inspectArgs, "run", ...defineArgs, ...featureArgs, cliPath, ...process.argv.slice(2)];
|
const args = [bunCmd, ...inspectArgs, "run", ...defineArgs, ...featureArgs, cliPath, ...process.argv.slice(2)];
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ import {
|
||||||
DEFAULT_OUTPUT_STYLE_NAME,
|
DEFAULT_OUTPUT_STYLE_NAME,
|
||||||
getAllOutputStyles,
|
getAllOutputStyles,
|
||||||
} from 'src/constants/outputStyles.js'
|
} from 'src/constants/outputStyles.js'
|
||||||
import { TEAMMATE_MESSAGE_TAG, TICK_TAG } from 'src/constants/xml.js'
|
import { TASK_NOTIFICATION_TAG, TEAMMATE_MESSAGE_TAG, TICK_TAG } from 'src/constants/xml.js'
|
||||||
import {
|
import {
|
||||||
getSettings_DEPRECATED,
|
getSettings_DEPRECATED,
|
||||||
getSettingsWithSources,
|
getSettingsWithSources,
|
||||||
|
|
@ -4360,6 +4360,20 @@ function runHeadlessStreaming(
|
||||||
trackReceivedMessageUuid(userMsg.uuid as UUID)
|
trackReceivedMessageUuid(userMsg.uuid as UUID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const rawContent = typeof userMsg.content === 'string' ? userMsg.content : ''
|
||||||
|
const isTaskNotification = rawContent.trimStart().startsWith(
|
||||||
|
`<${TASK_NOTIFICATION_TAG}>`,
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isTaskNotification) {
|
||||||
|
enqueue({
|
||||||
|
mode: 'task-notification' as const,
|
||||||
|
value: rawContent,
|
||||||
|
uuid: userMsg.uuid as `${string}-${string}-${string}-${string}-${string}`,
|
||||||
|
priority: (userMsg as { priority?: string })
|
||||||
|
.priority as import('src/types/textInputTypes.js').QueuePriority,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
enqueue({
|
enqueue({
|
||||||
mode: 'prompt' as const,
|
mode: 'prompt' as const,
|
||||||
// file_attachments rides the protobuf catchall from the web composer.
|
// file_attachments rides the protobuf catchall from the web composer.
|
||||||
|
|
@ -4384,6 +4398,7 @@ function runHeadlessStreaming(
|
||||||
}),
|
}),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void run()
|
void run()
|
||||||
}
|
}
|
||||||
inputClosed = true
|
inputClosed = true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user