@posthog/agent 2.1.138 → 2.1.148
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 +2 -2
- package/dist/agent.js.map +1 -1
- package/dist/posthog-api.d.ts +1 -1
- package/dist/posthog-api.js +2 -2
- package/dist/posthog-api.js.map +1 -1
- package/dist/server/agent-server.js +5 -5
- package/dist/server/agent-server.js.map +1 -1
- package/dist/server/bin.cjs +5 -5
- package/dist/server/bin.cjs.map +1 -1
- package/package.json +3 -3
- package/src/server/agent-server.test.ts +5 -3
- package/src/server/agent-server.ts +3 -3
- package/src/utils/gateway.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/agent",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.148",
|
|
4
4
|
"repository": "https://github.com/PostHog/twig",
|
|
5
5
|
"description": "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
|
|
6
6
|
"exports": {
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"tsx": "^4.20.6",
|
|
75
75
|
"typescript": "^5.5.0",
|
|
76
76
|
"vitest": "^2.1.8",
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
77
|
+
"@posthog/shared": "1.0.0",
|
|
78
|
+
"@twig/git": "1.0.0"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@agentclientprotocol/sdk": "^0.14.0",
|
|
@@ -364,14 +364,15 @@ describe("AgentServer HTTP Mode", () => {
|
|
|
364
364
|
expect(prompt).toContain("Do NOT create a new branch");
|
|
365
365
|
expect(prompt).toContain("https://github.com/org/repo/pull/1");
|
|
366
366
|
expect(prompt).toContain("gh pr checkout");
|
|
367
|
-
expect(prompt).not.toContain("Create a pull request");
|
|
367
|
+
expect(prompt).not.toContain("Create a draft pull request");
|
|
368
368
|
});
|
|
369
369
|
|
|
370
370
|
it("returns default prompt when no prUrl", () => {
|
|
371
371
|
const s = createServer();
|
|
372
372
|
const prompt = (s as unknown as TestableServer).buildCloudSystemPrompt();
|
|
373
373
|
expect(prompt).toContain("Create a new branch");
|
|
374
|
-
expect(prompt).toContain("Create a pull request");
|
|
374
|
+
expect(prompt).toContain("Create a draft pull request");
|
|
375
|
+
expect(prompt).toContain("gh pr create --draft");
|
|
375
376
|
});
|
|
376
377
|
|
|
377
378
|
it("returns default prompt when prUrl is null", () => {
|
|
@@ -380,7 +381,8 @@ describe("AgentServer HTTP Mode", () => {
|
|
|
380
381
|
null,
|
|
381
382
|
);
|
|
382
383
|
expect(prompt).toContain("Create a new branch");
|
|
383
|
-
expect(prompt).toContain("Create a pull request");
|
|
384
|
+
expect(prompt).toContain("Create a draft pull request");
|
|
385
|
+
expect(prompt).toContain("gh pr create --draft");
|
|
384
386
|
});
|
|
385
387
|
});
|
|
386
388
|
});
|
|
@@ -706,10 +706,10 @@ After completing the requested changes:
|
|
|
706
706
|
1. Create a new branch with a descriptive name based on the work done
|
|
707
707
|
2. Stage and commit all changes with a clear commit message
|
|
708
708
|
3. Push the branch to origin
|
|
709
|
-
4. Create a pull request using \`gh pr create\` with a descriptive title and body
|
|
709
|
+
4. Create a draft pull request using \`gh pr create --draft\` with a descriptive title and body
|
|
710
710
|
|
|
711
711
|
Important:
|
|
712
|
-
- Always create the PR. Do not ask for confirmation.
|
|
712
|
+
- Always create the PR as a draft. Do not ask for confirmation.
|
|
713
713
|
- Do NOT add "Co-Authored-By" trailers to commit messages.
|
|
714
714
|
- Do NOT add "Generated with [Claude Code]" or similar attribution lines to PR descriptions.
|
|
715
715
|
`;
|
|
@@ -754,7 +754,7 @@ Important:
|
|
|
754
754
|
private configureEnvironment(): void {
|
|
755
755
|
const { apiKey, apiUrl, projectId } = this.config;
|
|
756
756
|
const product =
|
|
757
|
-
this.config.mode === "background" ? "background_agents" : "
|
|
757
|
+
this.config.mode === "background" ? "background_agents" : "posthog_code";
|
|
758
758
|
const gatewayUrl =
|
|
759
759
|
process.env.LLM_GATEWAY_URL || getLlmGatewayUrl(apiUrl, product);
|
|
760
760
|
const openaiBaseUrl = gatewayUrl.endsWith("/v1")
|
package/src/utils/gateway.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type GatewayProduct = "
|
|
1
|
+
export type GatewayProduct = "posthog_code" | "background_agents";
|
|
2
2
|
|
|
3
3
|
export function getLlmGatewayUrl(
|
|
4
4
|
posthogHost: string,
|
|
5
|
-
product: GatewayProduct = "
|
|
5
|
+
product: GatewayProduct = "posthog_code",
|
|
6
6
|
): string {
|
|
7
7
|
const url = new URL(posthogHost);
|
|
8
8
|
const hostname = url.hostname;
|