fix: orchestrator button + Pi SDK session error
- Move leftSidebarMode from URL state to local useState in unified-shell,
avoiding force-dynamic router round-trip that made the button appear broken - Replace fileURLToPath(new URL(..., import.meta.url)) with process.cwd()
in bb-pi-bootstrap.ts — import.meta.url is a webpack:// URL in Next.js,
causing cross-realm TypeError when passed to Node.js fileURLToPath()
This commit is contained in:
parent
643fa299dd
commit
d335e5bf71
98 changed files with 17851 additions and 944 deletions
39
src/tui/tools/bb-deviation.ts
Normal file
39
src/tui/tools/bb-deviation.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { Type } from '@sinclair/typebox';
|
||||
import type { ToolDefinition } from '@mariozechner/pi-coding-agent';
|
||||
import { embeddedPiDaemon } from '../../lib/embedded-daemon';
|
||||
|
||||
export function createDeviationTool(projectRoot: string): ToolDefinition {
|
||||
return {
|
||||
name: 'bb_record_deviation',
|
||||
label: 'Record Template Deviation',
|
||||
description: 'Log when and why you are deviating from a standard mission template (e.g., adding an extra worker, skipping an archetype, changing the flow).',
|
||||
parameters: Type.Object({
|
||||
reason: Type.String({ description: 'Why the deviation was necessary' }),
|
||||
deviation_type: Type.String({ description: 'What kind of deviation (e.g., "extra_worker", "missing_archetype", "custom_flow")' }),
|
||||
details: Type.Optional(Type.String({ description: 'Additional context about the deviation' })),
|
||||
}),
|
||||
async execute(_toolCallId, params: any) {
|
||||
try {
|
||||
// We use the existing daemon event system to record this
|
||||
embeddedPiDaemon.appendEvent(projectRoot, {
|
||||
kind: 'deviation.proposed',
|
||||
title: `Deviation [${params.deviation_type}]`,
|
||||
detail: params.reason,
|
||||
status: 'idle',
|
||||
});
|
||||
|
||||
return {
|
||||
content: [{ type: 'text', text: 'Deviation recorded successfully.' }],
|
||||
details: {},
|
||||
};
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return {
|
||||
content: [{ type: 'text', text: `Failed to record deviation: ${message}` }],
|
||||
isError: true,
|
||||
details: {},
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue