@posthog/agent 1.28.0 → 1.29.0
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/index.d.ts +3 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/claude/claude.ts +25 -0
- package/src/worktree-manager.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"repository": "https://github.com/PostHog/array",
|
|
5
5
|
"description": "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -135,6 +135,8 @@ export type NewSessionMeta = {
|
|
|
135
135
|
*/
|
|
136
136
|
options?: Options;
|
|
137
137
|
};
|
|
138
|
+
/** Initial model to use for the session (e.g., 'claude-opus-4-5', 'gpt-5.1') */
|
|
139
|
+
model?: string;
|
|
138
140
|
};
|
|
139
141
|
|
|
140
142
|
/**
|
|
@@ -443,6 +445,20 @@ export class ClaudeAcpAgent implements Agent {
|
|
|
443
445
|
const availableCommands = await getAvailableSlashCommands(q);
|
|
444
446
|
const models = await getAvailableModels(q);
|
|
445
447
|
|
|
448
|
+
// Set initial model if provided via _meta (must be after getAvailableModels which resets to default)
|
|
449
|
+
const requestedModel = (params._meta as NewSessionMeta | undefined)?.model;
|
|
450
|
+
if (requestedModel) {
|
|
451
|
+
try {
|
|
452
|
+
await q.setModel(requestedModel);
|
|
453
|
+
this.logger.info("Set initial model", { model: requestedModel });
|
|
454
|
+
} catch (err) {
|
|
455
|
+
this.logger.warn("Failed to set initial model, using default", {
|
|
456
|
+
requestedModel,
|
|
457
|
+
error: err,
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
446
462
|
// Needs to happen after we return the session
|
|
447
463
|
setTimeout(() => {
|
|
448
464
|
this.client.sessionUpdate({
|
|
@@ -922,6 +938,15 @@ export class ClaudeAcpAgent implements Agent {
|
|
|
922
938
|
return {};
|
|
923
939
|
}
|
|
924
940
|
|
|
941
|
+
if (method === "session/setModel") {
|
|
942
|
+
const { sessionId, modelId } = params as {
|
|
943
|
+
sessionId: string;
|
|
944
|
+
modelId: string;
|
|
945
|
+
};
|
|
946
|
+
await this.setSessionModel({ sessionId, modelId });
|
|
947
|
+
return {};
|
|
948
|
+
}
|
|
949
|
+
|
|
925
950
|
throw RequestError.methodNotFound(method);
|
|
926
951
|
}
|
|
927
952
|
|
package/src/worktree-manager.ts
CHANGED
|
@@ -628,7 +628,9 @@ export class WorktreeManager {
|
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
630
|
|
|
631
|
-
async createWorktree(
|
|
631
|
+
async createWorktree(options?: {
|
|
632
|
+
baseBranch?: string;
|
|
633
|
+
}): Promise<WorktreeInfo> {
|
|
632
634
|
// Only modify .git/info/exclude when using in-repo storage
|
|
633
635
|
if (!this.usesExternalPath()) {
|
|
634
636
|
await this.ensureArrayDirIgnored();
|
|
@@ -644,7 +646,7 @@ export class WorktreeManager {
|
|
|
644
646
|
const worktreeName = await this.generateUniqueWorktreeName();
|
|
645
647
|
const worktreePath = this.getWorktreePath(worktreeName);
|
|
646
648
|
const branchName = `array/${worktreeName}`;
|
|
647
|
-
const baseBranch = await this.getDefaultBranch();
|
|
649
|
+
const baseBranch = options?.baseBranch ?? (await this.getDefaultBranch());
|
|
648
650
|
|
|
649
651
|
this.logger.info("Creating worktree", {
|
|
650
652
|
worktreeName,
|