@posthog/agent 2.3.663 → 2.3.675

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.
@@ -9315,7 +9315,7 @@ import { z as z5 } from "zod";
9315
9315
  // package.json
9316
9316
  var package_default = {
9317
9317
  name: "@posthog/agent",
9318
- version: "2.3.663",
9318
+ version: "2.3.675",
9319
9319
  repository: "https://github.com/PostHog/code",
9320
9320
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
9321
9321
  exports: {
@@ -14264,7 +14264,10 @@ async function withTimeout(operation, timeoutMs) {
14264
14264
  var IS_ROOT = typeof process !== "undefined" && (process.geteuid?.() ?? process.getuid?.()) === 0;
14265
14265
  var ALLOW_BYPASS = !IS_ROOT || !!process.env.IS_SANDBOX;
14266
14266
  function isCloudRun(meta) {
14267
- return !!process.env.IS_SANDBOX || !!meta?.taskRunId;
14267
+ if (meta?.environment) {
14268
+ return meta.environment === "cloud";
14269
+ }
14270
+ return !!process.env.IS_SANDBOX;
14268
14271
  }
14269
14272
  function resolveGithubToken() {
14270
14273
  return readGithubTokenFromEnv();
@@ -14482,11 +14485,25 @@ var signedCommitTool = defineLocalTool({
14482
14485
  description: SIGNED_COMMIT_TOOL_DESCRIPTION,
14483
14486
  schema: signedCommitToolSchema,
14484
14487
  alwaysLoad: true,
14485
- isEnabled: (ctx, meta) => isCloudRun(meta) && !!ctx.token,
14486
- handler: (ctx, args2) => runSignedCommitTool(
14487
- { cwd: ctx.cwd, token: ctx.token ?? "", taskId: ctx.taskId },
14488
- args2
14489
- )
14488
+ isEnabled: (_ctx, meta) => isCloudRun(meta),
14489
+ handler: (ctx, args2) => {
14490
+ const token = ctx.token ?? resolveGithubToken();
14491
+ if (!token) {
14492
+ return Promise.resolve({
14493
+ content: [
14494
+ {
14495
+ type: "text",
14496
+ text: `${SIGNED_COMMIT_TOOL_NAME} failed: no GitHub token in env (GH_TOKEN/GITHUB_TOKEN)`
14497
+ }
14498
+ ],
14499
+ isError: true
14500
+ });
14501
+ }
14502
+ return runSignedCommitTool(
14503
+ { cwd: ctx.cwd, token, taskId: ctx.taskId },
14504
+ args2
14505
+ );
14506
+ }
14490
14507
  });
14491
14508
 
14492
14509
  // src/adapters/local-tools/index.ts
@@ -23958,6 +23975,7 @@ var AgentServer = class {
23958
23975
  sessionId: payload.run_id,
23959
23976
  taskRunId: payload.run_id,
23960
23977
  taskId: payload.task_id,
23978
+ environment: "cloud",
23961
23979
  systemPrompt: sessionSystemPrompt,
23962
23980
  ...this.config.model && { model: this.config.model },
23963
23981
  allowedDomains: this.config.allowedDomains,