Merge main into copilot/fix-pm2-race-condition
Resolved conflicts in built files by rebuilding from source
This commit is contained in:
@@ -31,7 +31,7 @@ async function saveHook(input?: PostToolUseInput): Promise<void> {
|
||||
throw new Error('saveHook requires input');
|
||||
}
|
||||
|
||||
const { session_id, tool_name, tool_input, tool_response } = input;
|
||||
const { session_id, cwd, tool_name, tool_input, tool_response } = input;
|
||||
|
||||
if (SKIP_TOOLS.has(tool_name)) {
|
||||
console.log(createHookResponse('PostToolUse', true));
|
||||
@@ -65,7 +65,8 @@ async function saveHook(input?: PostToolUseInput): Promise<void> {
|
||||
tool_name,
|
||||
tool_input: tool_input !== undefined ? JSON.stringify(tool_input) : '{}',
|
||||
tool_response: tool_response !== undefined ? JSON.stringify(tool_response) : '{}',
|
||||
prompt_number: promptNumber
|
||||
prompt_number: promptNumber,
|
||||
cwd: cwd || ''
|
||||
}),
|
||||
signal: AbortSignal.timeout(2000)
|
||||
});
|
||||
|
||||
+7
-1
@@ -9,6 +9,7 @@ export interface Observation {
|
||||
tool_input: string;
|
||||
tool_output: string;
|
||||
created_at_epoch: number;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
export interface SDKSession {
|
||||
@@ -31,6 +32,11 @@ Date: ${new Date().toISOString().split('T')[0]}
|
||||
|
||||
SESSION LIFECYCLE: You will observe tool executions, create observations, generate progress summaries when requested, and receive continuation prompts as the session progresses.
|
||||
|
||||
SPATIAL AWARENESS: Tool executions include the working directory (tool_cwd) to help you understand:
|
||||
- Which repository/project is being worked on
|
||||
- Where files are located relative to the project root
|
||||
- How to match requested paths to actual execution paths
|
||||
|
||||
WHAT TO RECORD
|
||||
--------------
|
||||
Focus on deliverables and capabilities:
|
||||
@@ -149,7 +155,7 @@ export function buildObservationPrompt(obs: Observation): string {
|
||||
|
||||
return `<tool_used>
|
||||
<tool_name>${obs.tool_name}</tool_name>
|
||||
<tool_time>${new Date(obs.created_at_epoch).toISOString()}</tool_time>
|
||||
<tool_time>${new Date(obs.created_at_epoch).toISOString()}</tool_time>${obs.cwd ? `\n <tool_cwd>${obs.cwd}</tool_cwd>` : ''}
|
||||
<tool_input>${JSON.stringify(toolInput, null, 2)}</tool_input>
|
||||
<tool_output>${JSON.stringify(toolOutput, null, 2)}</tool_output>
|
||||
</tool_used>`;
|
||||
|
||||
@@ -287,13 +287,14 @@ export class WorkerService {
|
||||
private handleObservations(req: Request, res: Response): void {
|
||||
try {
|
||||
const sessionDbId = parseInt(req.params.sessionDbId, 10);
|
||||
const { tool_name, tool_input, tool_response, prompt_number } = req.body;
|
||||
const { tool_name, tool_input, tool_response, prompt_number, cwd } = req.body;
|
||||
|
||||
this.sessionManager.queueObservation(sessionDbId, {
|
||||
tool_name,
|
||||
tool_input,
|
||||
tool_response,
|
||||
prompt_number
|
||||
prompt_number,
|
||||
cwd
|
||||
});
|
||||
|
||||
// CRITICAL: Ensure SDK agent is running to consume the queue
|
||||
|
||||
@@ -27,6 +27,7 @@ export interface PendingMessage {
|
||||
tool_input?: any;
|
||||
tool_response?: any;
|
||||
prompt_number?: number;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
export interface ObservationData {
|
||||
@@ -34,6 +35,7 @@ export interface ObservationData {
|
||||
tool_input: any;
|
||||
tool_response: any;
|
||||
prompt_number: number;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
@@ -141,7 +141,8 @@ export class SDKAgent {
|
||||
tool_name: message.tool_name!,
|
||||
tool_input: JSON.stringify(message.tool_input),
|
||||
tool_output: JSON.stringify(message.tool_response),
|
||||
created_at_epoch: Date.now()
|
||||
created_at_epoch: Date.now(),
|
||||
cwd: message.cwd
|
||||
})
|
||||
},
|
||||
session_id: session.claudeSessionId,
|
||||
|
||||
@@ -83,7 +83,8 @@ export class SessionManager {
|
||||
tool_name: data.tool_name,
|
||||
tool_input: data.tool_input,
|
||||
tool_response: data.tool_response,
|
||||
prompt_number: data.prompt_number
|
||||
prompt_number: data.prompt_number,
|
||||
cwd: data.cwd
|
||||
});
|
||||
|
||||
// Notify generator immediately (zero latency)
|
||||
|
||||
Reference in New Issue
Block a user