@posthog/agent 2.3.354 → 2.3.363
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +6 -3
- package/dist/agent.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/posthog-api.js +1 -1
- package/dist/posthog-api.js.map +1 -1
- package/dist/server/agent-server.js +55 -51
- package/dist/server/agent-server.js.map +1 -1
- package/dist/server/bin.cjs +55 -51
- package/dist/server/bin.cjs.map +1 -1
- package/package.json +3 -3
- package/src/acp-extensions.ts +3 -0
- package/src/adapters/claude/hooks.ts +1 -2
- package/src/adapters/claude/session/options.ts +1 -1
- package/src/server/agent-server.ts +49 -50
package/dist/server/bin.cjs
CHANGED
|
@@ -8595,6 +8595,7 @@ function getCleanEnv() {
|
|
|
8595
8595
|
env[key] = value;
|
|
8596
8596
|
}
|
|
8597
8597
|
env.ELECTRON_RUN_AS_NODE = "1";
|
|
8598
|
+
env.GIT_LFS_SKIP_SMUDGE = "1";
|
|
8598
8599
|
return env;
|
|
8599
8600
|
}
|
|
8600
8601
|
var GitOperationManagerImpl = class _GitOperationManagerImpl {
|
|
@@ -8728,7 +8729,7 @@ var import_zod3 = require("zod");
|
|
|
8728
8729
|
// package.json
|
|
8729
8730
|
var package_default = {
|
|
8730
8731
|
name: "@posthog/agent",
|
|
8731
|
-
version: "2.3.
|
|
8732
|
+
version: "2.3.363",
|
|
8732
8733
|
repository: "https://github.com/PostHog/code",
|
|
8733
8734
|
description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
|
|
8734
8735
|
exports: {
|
|
@@ -8889,6 +8890,8 @@ var POSTHOG_NOTIFICATIONS = {
|
|
|
8889
8890
|
CLOSE: "_posthog/close",
|
|
8890
8891
|
/** Agent status update (thinking, working, etc.) */
|
|
8891
8892
|
STATUS: "_posthog/status",
|
|
8893
|
+
/** Structured backend progress notification; events in the same turn group into one card on the client */
|
|
8894
|
+
PROGRESS: "_posthog/progress",
|
|
8892
8895
|
/** Task-level notification (progress, milestones) */
|
|
8893
8896
|
TASK_NOTIFICATION: "_posthog/task_notification",
|
|
8894
8897
|
/** Marks a boundary for log compaction */
|
|
@@ -12742,7 +12745,7 @@ var registerHookCallback = (toolUseID, {
|
|
|
12742
12745
|
onPostToolUseHook
|
|
12743
12746
|
};
|
|
12744
12747
|
};
|
|
12745
|
-
var createPostToolUseHook = ({ onModeChange
|
|
12748
|
+
var createPostToolUseHook = ({ onModeChange }) => async (input, toolUseID) => {
|
|
12746
12749
|
if (input.hook_event_name === "PostToolUse") {
|
|
12747
12750
|
const toolName = input.tool_name;
|
|
12748
12751
|
if (onModeChange && toolName === "EnterPlanMode") {
|
|
@@ -14830,7 +14833,7 @@ function buildEnvironment() {
|
|
|
14830
14833
|
};
|
|
14831
14834
|
}
|
|
14832
14835
|
function buildHooks(userHooks, onModeChange, settingsManager, logger, enrichmentDeps, enrichedReadCache, registeredAgents) {
|
|
14833
|
-
const postToolUseHooks = [createPostToolUseHook({ onModeChange
|
|
14836
|
+
const postToolUseHooks = [createPostToolUseHook({ onModeChange })];
|
|
14834
14837
|
if (enrichmentDeps && enrichedReadCache) {
|
|
14835
14838
|
postToolUseHooks.push(
|
|
14836
14839
|
createReadEnrichmentHook(enrichmentDeps, enrichedReadCache)
|
|
@@ -19437,7 +19440,9 @@ var AgentServer = class _AgentServer {
|
|
|
19437
19440
|
port: this.config.port
|
|
19438
19441
|
},
|
|
19439
19442
|
() => {
|
|
19440
|
-
this.logger.
|
|
19443
|
+
this.logger.debug(
|
|
19444
|
+
`HTTP server listening on port ${this.config.port}`
|
|
19445
|
+
);
|
|
19441
19446
|
resolve4();
|
|
19442
19447
|
}
|
|
19443
19448
|
);
|
|
@@ -19446,10 +19451,10 @@ var AgentServer = class _AgentServer {
|
|
|
19446
19451
|
}
|
|
19447
19452
|
async autoInitializeSession() {
|
|
19448
19453
|
const { taskId, runId, mode, projectId } = this.config;
|
|
19449
|
-
this.logger.
|
|
19454
|
+
this.logger.debug("Auto-initializing session", { taskId, runId, mode });
|
|
19450
19455
|
const resumeRunId = process.env.POSTHOG_RESUME_RUN_ID;
|
|
19451
19456
|
if (resumeRunId) {
|
|
19452
|
-
this.logger.
|
|
19457
|
+
this.logger.debug("Resuming from previous run", {
|
|
19453
19458
|
resumeRunId,
|
|
19454
19459
|
currentRunId: runId
|
|
19455
19460
|
});
|
|
@@ -19461,13 +19466,13 @@ var AgentServer = class _AgentServer {
|
|
|
19461
19466
|
apiClient: this.posthogAPI,
|
|
19462
19467
|
logger: new Logger({ debug: true, prefix: "[Resume]" })
|
|
19463
19468
|
});
|
|
19464
|
-
this.logger.
|
|
19469
|
+
this.logger.debug("Resume state loaded", {
|
|
19465
19470
|
conversationTurns: this.resumeState.conversation.length,
|
|
19466
19471
|
snapshotApplied: this.resumeState.snapshotApplied,
|
|
19467
19472
|
logEntries: this.resumeState.logEntryCount
|
|
19468
19473
|
});
|
|
19469
19474
|
} catch (error) {
|
|
19470
|
-
this.logger.
|
|
19475
|
+
this.logger.debug("Failed to load resume state, starting fresh", {
|
|
19471
19476
|
error
|
|
19472
19477
|
});
|
|
19473
19478
|
this.resumeState = null;
|
|
@@ -19485,7 +19490,7 @@ var AgentServer = class _AgentServer {
|
|
|
19485
19490
|
await this.initializeSession(payload, null);
|
|
19486
19491
|
}
|
|
19487
19492
|
async stop() {
|
|
19488
|
-
this.logger.
|
|
19493
|
+
this.logger.debug("Stopping agent server...");
|
|
19489
19494
|
if (this.session) {
|
|
19490
19495
|
await this.cleanupSession();
|
|
19491
19496
|
}
|
|
@@ -19493,7 +19498,7 @@ var AgentServer = class _AgentServer {
|
|
|
19493
19498
|
this.server.close();
|
|
19494
19499
|
this.server = null;
|
|
19495
19500
|
}
|
|
19496
|
-
this.logger.
|
|
19501
|
+
this.logger.debug("Agent server stopped");
|
|
19497
19502
|
}
|
|
19498
19503
|
authenticateRequest(getHeader) {
|
|
19499
19504
|
if (!this.config.jwtPublicKey) {
|
|
@@ -19536,7 +19541,7 @@ var AgentServer = class _AgentServer {
|
|
|
19536
19541
|
blockTypes: prompt.map((block) => block.type)
|
|
19537
19542
|
});
|
|
19538
19543
|
const promptPreview = promptBlocksToText(prompt);
|
|
19539
|
-
this.logger.
|
|
19544
|
+
this.logger.debug(
|
|
19540
19545
|
`Processing user message (detectedPrUrl=${this.detectedPrUrl ?? "none"}): ${promptPreview.substring(0, 100)}...`
|
|
19541
19546
|
);
|
|
19542
19547
|
this.session.logWriter.resetTurnMessages(this.session.payload.run_id);
|
|
@@ -19551,7 +19556,7 @@ var AgentServer = class _AgentServer {
|
|
|
19551
19556
|
}
|
|
19552
19557
|
}
|
|
19553
19558
|
});
|
|
19554
|
-
this.logger.
|
|
19559
|
+
this.logger.debug("User message completed", {
|
|
19555
19560
|
stopReason: result.stopReason
|
|
19556
19561
|
});
|
|
19557
19562
|
if (result.stopReason === "end_turn") {
|
|
@@ -19560,7 +19565,7 @@ var AgentServer = class _AgentServer {
|
|
|
19560
19565
|
this.broadcastTurnComplete(result.stopReason);
|
|
19561
19566
|
if (result.stopReason === "end_turn") {
|
|
19562
19567
|
this.relayAgentResponse(this.session.payload).catch(
|
|
19563
|
-
(err2) => this.logger.
|
|
19568
|
+
(err2) => this.logger.debug("Failed to relay follow-up response", err2)
|
|
19564
19569
|
);
|
|
19565
19570
|
}
|
|
19566
19571
|
let assistantMessage;
|
|
@@ -19572,7 +19577,7 @@ var AgentServer = class _AgentServer {
|
|
|
19572
19577
|
this.session.payload.run_id
|
|
19573
19578
|
);
|
|
19574
19579
|
} catch {
|
|
19575
|
-
this.logger.
|
|
19580
|
+
this.logger.debug("Failed to extract assistant message from logs");
|
|
19576
19581
|
}
|
|
19577
19582
|
return {
|
|
19578
19583
|
stopReason: result.stopReason,
|
|
@@ -19581,7 +19586,7 @@ var AgentServer = class _AgentServer {
|
|
|
19581
19586
|
}
|
|
19582
19587
|
case POSTHOG_NOTIFICATIONS.CANCEL:
|
|
19583
19588
|
case "cancel": {
|
|
19584
|
-
this.logger.
|
|
19589
|
+
this.logger.debug("Cancel requested", {
|
|
19585
19590
|
acpSessionId: this.session.acpSessionId
|
|
19586
19591
|
});
|
|
19587
19592
|
await this.session.clientConnection.cancel({
|
|
@@ -19591,7 +19596,7 @@ var AgentServer = class _AgentServer {
|
|
|
19591
19596
|
}
|
|
19592
19597
|
case POSTHOG_NOTIFICATIONS.CLOSE:
|
|
19593
19598
|
case "close": {
|
|
19594
|
-
this.logger.
|
|
19599
|
+
this.logger.debug("Close requested");
|
|
19595
19600
|
await this.cleanupSession();
|
|
19596
19601
|
return { closed: true };
|
|
19597
19602
|
}
|
|
@@ -19599,7 +19604,7 @@ var AgentServer = class _AgentServer {
|
|
|
19599
19604
|
case "set_config_option": {
|
|
19600
19605
|
const configId = params.configId;
|
|
19601
19606
|
const value = params.value;
|
|
19602
|
-
this.logger.
|
|
19607
|
+
this.logger.debug("Set config option requested", { configId, value });
|
|
19603
19608
|
const result = await this.session.clientConnection.setSessionConfigOption({
|
|
19604
19609
|
sessionId: this.session.acpSessionId,
|
|
19605
19610
|
configId,
|
|
@@ -19627,7 +19632,7 @@ var AgentServer = class _AgentServer {
|
|
|
19627
19632
|
const optionId = params.optionId;
|
|
19628
19633
|
const customInput = params.customInput;
|
|
19629
19634
|
const answers = params.answers;
|
|
19630
|
-
this.logger.
|
|
19635
|
+
this.logger.debug("Permission response received", {
|
|
19631
19636
|
requestId,
|
|
19632
19637
|
optionId
|
|
19633
19638
|
});
|
|
@@ -19650,7 +19655,7 @@ var AgentServer = class _AgentServer {
|
|
|
19650
19655
|
}
|
|
19651
19656
|
async initializeSession(payload, sseController) {
|
|
19652
19657
|
if (this.initializationPromise) {
|
|
19653
|
-
this.logger.
|
|
19658
|
+
this.logger.debug("Waiting for in-progress initialization", {
|
|
19654
19659
|
runId: payload.run_id
|
|
19655
19660
|
});
|
|
19656
19661
|
await this.initializationPromise;
|
|
@@ -19675,7 +19680,7 @@ var AgentServer = class _AgentServer {
|
|
|
19675
19680
|
if (this.session) {
|
|
19676
19681
|
await this.cleanupSession();
|
|
19677
19682
|
}
|
|
19678
|
-
this.logger.
|
|
19683
|
+
this.logger.debug("Initializing session", {
|
|
19679
19684
|
runId: payload.run_id,
|
|
19680
19685
|
taskId: payload.task_id
|
|
19681
19686
|
});
|
|
@@ -19686,7 +19691,7 @@ var AgentServer = class _AgentServer {
|
|
|
19686
19691
|
this.configureEnvironment();
|
|
19687
19692
|
const [preTaskRun, preTask] = await Promise.all([
|
|
19688
19693
|
this.posthogAPI.getTaskRun(payload.task_id, payload.run_id).catch((err2) => {
|
|
19689
|
-
this.logger.
|
|
19694
|
+
this.logger.debug("Failed to fetch task run for session context", {
|
|
19690
19695
|
taskId: payload.task_id,
|
|
19691
19696
|
runId: payload.run_id,
|
|
19692
19697
|
error: err2
|
|
@@ -19694,7 +19699,7 @@ var AgentServer = class _AgentServer {
|
|
|
19694
19699
|
return null;
|
|
19695
19700
|
}),
|
|
19696
19701
|
this.posthogAPI.getTask(payload.task_id).catch((err2) => {
|
|
19697
|
-
this.logger.
|
|
19702
|
+
this.logger.debug("Failed to fetch task for session context", {
|
|
19698
19703
|
taskId: payload.task_id,
|
|
19699
19704
|
error: err2
|
|
19700
19705
|
});
|
|
@@ -19804,7 +19809,7 @@ var AgentServer = class _AgentServer {
|
|
|
19804
19809
|
}
|
|
19805
19810
|
});
|
|
19806
19811
|
const acpSessionId = sessionResponse.sessionId;
|
|
19807
|
-
this.logger.
|
|
19812
|
+
this.logger.debug("ACP session created", {
|
|
19808
19813
|
acpSessionId,
|
|
19809
19814
|
runId: payload.run_id
|
|
19810
19815
|
});
|
|
@@ -19824,19 +19829,18 @@ var AgentServer = class _AgentServer {
|
|
|
19824
19829
|
debug: true,
|
|
19825
19830
|
prefix: "[AgentServer]",
|
|
19826
19831
|
onLog: (level, scope, message, data) => {
|
|
19827
|
-
const _formatted = data !== void 0 ? `${message} ${JSON.stringify(data)}` : message;
|
|
19828
19832
|
this.emitConsoleLog(level, scope, message, data);
|
|
19829
19833
|
}
|
|
19830
19834
|
});
|
|
19831
|
-
this.logger.
|
|
19832
|
-
this.logger.
|
|
19835
|
+
this.logger.debug("Session initialized successfully");
|
|
19836
|
+
this.logger.debug(
|
|
19833
19837
|
`Agent version: ${this.config.version ?? package_default.version}`
|
|
19834
19838
|
);
|
|
19835
|
-
this.logger.
|
|
19839
|
+
this.logger.debug(`Initial permission mode: ${initialPermissionMode}`);
|
|
19836
19840
|
this.posthogAPI.updateTaskRun(payload.task_id, payload.run_id, {
|
|
19837
19841
|
status: "in_progress"
|
|
19838
19842
|
}).catch(
|
|
19839
|
-
(err2) => this.logger.
|
|
19843
|
+
(err2) => this.logger.debug("Failed to set task run to in_progress", err2)
|
|
19840
19844
|
);
|
|
19841
19845
|
await this.sendInitialTaskMessage(payload, preTaskRun);
|
|
19842
19846
|
}
|
|
@@ -19867,7 +19871,7 @@ var AgentServer = class _AgentServer {
|
|
|
19867
19871
|
payload.run_id
|
|
19868
19872
|
);
|
|
19869
19873
|
} catch (error) {
|
|
19870
|
-
this.logger.
|
|
19874
|
+
this.logger.debug("Failed to fetch task run", {
|
|
19871
19875
|
taskId: payload.task_id,
|
|
19872
19876
|
runId: payload.run_id,
|
|
19873
19877
|
error
|
|
@@ -19877,7 +19881,7 @@ var AgentServer = class _AgentServer {
|
|
|
19877
19881
|
if (!this.resumeState) {
|
|
19878
19882
|
const resumeRunId = this.getResumeRunId(taskRun);
|
|
19879
19883
|
if (resumeRunId) {
|
|
19880
|
-
this.logger.
|
|
19884
|
+
this.logger.debug("Resuming from previous run (via TaskRun state)", {
|
|
19881
19885
|
resumeRunId,
|
|
19882
19886
|
currentRunId: payload.run_id
|
|
19883
19887
|
});
|
|
@@ -19889,13 +19893,13 @@ var AgentServer = class _AgentServer {
|
|
|
19889
19893
|
apiClient: this.posthogAPI,
|
|
19890
19894
|
logger: new Logger({ debug: true, prefix: "[Resume]" })
|
|
19891
19895
|
});
|
|
19892
|
-
this.logger.
|
|
19896
|
+
this.logger.debug("Resume state loaded (via TaskRun state)", {
|
|
19893
19897
|
conversationTurns: this.resumeState.conversation.length,
|
|
19894
19898
|
snapshotApplied: this.resumeState.snapshotApplied,
|
|
19895
19899
|
logEntries: this.resumeState.logEntryCount
|
|
19896
19900
|
});
|
|
19897
19901
|
} catch (error) {
|
|
19898
|
-
this.logger.
|
|
19902
|
+
this.logger.debug("Failed to load resume state, starting fresh", {
|
|
19899
19903
|
error
|
|
19900
19904
|
});
|
|
19901
19905
|
this.resumeState = null;
|
|
@@ -19919,10 +19923,10 @@ var AgentServer = class _AgentServer {
|
|
|
19919
19923
|
initialPrompt = [{ type: "text", text: task.description }];
|
|
19920
19924
|
}
|
|
19921
19925
|
if (initialPrompt.length === 0) {
|
|
19922
|
-
this.logger.
|
|
19926
|
+
this.logger.debug("Task has no description, skipping initial message");
|
|
19923
19927
|
return;
|
|
19924
19928
|
}
|
|
19925
|
-
this.logger.
|
|
19929
|
+
this.logger.debug("Sending initial task message", {
|
|
19926
19930
|
taskId: payload.task_id,
|
|
19927
19931
|
descriptionLength: promptBlocksToText(initialPrompt).length,
|
|
19928
19932
|
usedInitialPromptOverride: !!initialPromptOverride,
|
|
@@ -19933,7 +19937,7 @@ var AgentServer = class _AgentServer {
|
|
|
19933
19937
|
sessionId: this.session.acpSessionId,
|
|
19934
19938
|
prompt: initialPrompt
|
|
19935
19939
|
});
|
|
19936
|
-
this.logger.
|
|
19940
|
+
this.logger.debug("Initial task message completed", {
|
|
19937
19941
|
stopReason: result.stopReason
|
|
19938
19942
|
});
|
|
19939
19943
|
await this.clearPendingInitialPromptState(payload, taskRun);
|
|
@@ -19995,7 +19999,7 @@ Continue from where you left off. The user is waiting for your response.`
|
|
|
19995
19999
|
}
|
|
19996
20000
|
];
|
|
19997
20001
|
}
|
|
19998
|
-
this.logger.
|
|
20002
|
+
this.logger.debug("Sending resume message", {
|
|
19999
20003
|
taskId: payload.task_id,
|
|
20000
20004
|
conversationTurns: this.resumeState.conversation.length,
|
|
20001
20005
|
promptLength: promptBlocksToText(resumePromptBlocks).length,
|
|
@@ -20008,7 +20012,7 @@ Continue from where you left off. The user is waiting for your response.`
|
|
|
20008
20012
|
sessionId: this.session.acpSessionId,
|
|
20009
20013
|
prompt: resumePromptBlocks
|
|
20010
20014
|
});
|
|
20011
|
-
this.logger.
|
|
20015
|
+
this.logger.debug("Resume message completed", {
|
|
20012
20016
|
stopReason: result.stopReason
|
|
20013
20017
|
});
|
|
20014
20018
|
if (result.stopReason === "end_turn") {
|
|
@@ -20354,7 +20358,7 @@ ${attributionInstructions}
|
|
|
20354
20358
|
try {
|
|
20355
20359
|
return await getCurrentBranch(this.config.repositoryPath);
|
|
20356
20360
|
} catch (error) {
|
|
20357
|
-
this.logger.
|
|
20361
|
+
this.logger.debug("Failed to determine current git branch", {
|
|
20358
20362
|
repositoryPath: this.config.repositoryPath,
|
|
20359
20363
|
error
|
|
20360
20364
|
});
|
|
@@ -20373,7 +20377,7 @@ ${attributionInstructions}
|
|
|
20373
20377
|
});
|
|
20374
20378
|
this.lastReportedBranch = branchName;
|
|
20375
20379
|
} catch (error) {
|
|
20376
|
-
this.logger.
|
|
20380
|
+
this.logger.debug("Failed to attach current branch to task run", {
|
|
20377
20381
|
taskId: payload.task_id,
|
|
20378
20382
|
runId: payload.run_id,
|
|
20379
20383
|
branchName,
|
|
@@ -20388,7 +20392,7 @@ ${attributionInstructions}
|
|
|
20388
20392
|
coalesce: true
|
|
20389
20393
|
});
|
|
20390
20394
|
} catch (error) {
|
|
20391
|
-
this.logger.
|
|
20395
|
+
this.logger.debug("Failed to flush session logs before completion", {
|
|
20392
20396
|
taskId: payload.task_id,
|
|
20393
20397
|
runId: payload.run_id,
|
|
20394
20398
|
error
|
|
@@ -20396,7 +20400,7 @@ ${attributionInstructions}
|
|
|
20396
20400
|
}
|
|
20397
20401
|
}
|
|
20398
20402
|
if (stopReason !== "error") {
|
|
20399
|
-
this.logger.
|
|
20403
|
+
this.logger.debug("Skipping status update for non-error stop reason", {
|
|
20400
20404
|
stopReason
|
|
20401
20405
|
});
|
|
20402
20406
|
return;
|
|
@@ -20407,7 +20411,7 @@ ${attributionInstructions}
|
|
|
20407
20411
|
status,
|
|
20408
20412
|
error_message: errorMessage ?? "Agent error"
|
|
20409
20413
|
});
|
|
20410
|
-
this.logger.
|
|
20414
|
+
this.logger.debug("Task completion signaled", { status, stopReason });
|
|
20411
20415
|
} catch (error) {
|
|
20412
20416
|
this.logger.error("Failed to signal task completion", error);
|
|
20413
20417
|
}
|
|
@@ -20486,7 +20490,7 @@ ${attributionInstructions}
|
|
|
20486
20490
|
const sessionPermissionMode = this.getSessionPermissionMode();
|
|
20487
20491
|
const needsDesktopApproval = isQuestion || this.shouldRelayPermissionToClient(sessionPermissionMode);
|
|
20488
20492
|
if (isPlanApproval || needsDesktopApproval && this.session?.hasDesktopConnected) {
|
|
20489
|
-
this.logger.
|
|
20493
|
+
this.logger.debug("Relaying permission request", {
|
|
20490
20494
|
kind: params.toolCall?.kind,
|
|
20491
20495
|
isQuestion,
|
|
20492
20496
|
hasDesktopConnected: this.session?.hasDesktopConnected ?? false,
|
|
@@ -20516,7 +20520,7 @@ ${attributionInstructions}
|
|
|
20516
20520
|
sessionUpdate: async (params) => {
|
|
20517
20521
|
if (params.update?.sessionUpdate === "current_mode_update" && typeof params.update?.currentModeId === "string" && this.session) {
|
|
20518
20522
|
this.session.permissionMode = params.update.currentModeId;
|
|
20519
|
-
this.logger.
|
|
20523
|
+
this.logger.debug("Permission mode updated", {
|
|
20520
20524
|
mode: params.update.currentModeId
|
|
20521
20525
|
});
|
|
20522
20526
|
}
|
|
@@ -20545,7 +20549,7 @@ ${attributionInstructions}
|
|
|
20545
20549
|
try {
|
|
20546
20550
|
await this.session.logWriter.flush(payload.run_id, { coalesce: true });
|
|
20547
20551
|
} catch (error) {
|
|
20548
|
-
this.logger.
|
|
20552
|
+
this.logger.debug("Failed to flush logs before Slack relay", {
|
|
20549
20553
|
taskId: payload.task_id,
|
|
20550
20554
|
runId: payload.run_id,
|
|
20551
20555
|
error
|
|
@@ -20553,7 +20557,7 @@ ${attributionInstructions}
|
|
|
20553
20557
|
}
|
|
20554
20558
|
const message = this.session.logWriter.getFullAgentResponse(payload.run_id);
|
|
20555
20559
|
if (!message) {
|
|
20556
|
-
this.logger.
|
|
20560
|
+
this.logger.debug("No agent message found for Slack relay", {
|
|
20557
20561
|
taskId: payload.task_id,
|
|
20558
20562
|
runId: payload.run_id,
|
|
20559
20563
|
sessionRegistered: this.session.logWriter.isRegistered(payload.run_id)
|
|
@@ -20567,7 +20571,7 @@ ${attributionInstructions}
|
|
|
20567
20571
|
message
|
|
20568
20572
|
);
|
|
20569
20573
|
} catch (error) {
|
|
20570
|
-
this.logger.
|
|
20574
|
+
this.logger.debug("Failed to relay initial agent response to Slack", {
|
|
20571
20575
|
taskId: payload.task_id,
|
|
20572
20576
|
runId: payload.run_id,
|
|
20573
20577
|
error
|
|
@@ -20594,7 +20598,7 @@ ${attributionInstructions}
|
|
|
20594
20598
|
message += "\nReply in this thread with your choice.";
|
|
20595
20599
|
this.questionRelayedToSlack = true;
|
|
20596
20600
|
this.posthogAPI.relayMessage(payload.task_id, payload.run_id, message).catch(
|
|
20597
|
-
(err2) => this.logger.
|
|
20601
|
+
(err2) => this.logger.debug("Failed to relay question to Slack", { err: err2 })
|
|
20598
20602
|
);
|
|
20599
20603
|
}
|
|
20600
20604
|
getFirstQuestionMeta(toolMeta2) {
|
|
@@ -20656,14 +20660,14 @@ ${attributionInstructions}
|
|
|
20656
20660
|
if (!prUrlMatch) return;
|
|
20657
20661
|
const prUrl = prUrlMatch[0];
|
|
20658
20662
|
this.detectedPrUrl = prUrl;
|
|
20659
|
-
this.logger.
|
|
20663
|
+
this.logger.debug("Detected PR URL in bash output", {
|
|
20660
20664
|
runId: payload.run_id,
|
|
20661
20665
|
prUrl
|
|
20662
20666
|
});
|
|
20663
20667
|
this.posthogAPI.updateTaskRun(payload.task_id, payload.run_id, {
|
|
20664
20668
|
output: { pr_url: prUrl }
|
|
20665
20669
|
}).then(() => {
|
|
20666
|
-
this.logger.
|
|
20670
|
+
this.logger.debug("PR URL attached to task run", {
|
|
20667
20671
|
taskId: payload.task_id,
|
|
20668
20672
|
runId: payload.run_id,
|
|
20669
20673
|
prUrl
|
|
@@ -20685,7 +20689,7 @@ ${attributionInstructions}
|
|
|
20685
20689
|
}
|
|
20686
20690
|
async cleanupSession() {
|
|
20687
20691
|
if (!this.session) return;
|
|
20688
|
-
this.logger.
|
|
20692
|
+
this.logger.debug("Cleaning up session");
|
|
20689
20693
|
try {
|
|
20690
20694
|
await this.captureTreeState();
|
|
20691
20695
|
} catch (error) {
|