@posthog/agent 2.3.386 → 2.3.388

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.
Files changed (45) hide show
  1. package/dist/adapters/claude/session/jsonl-hydration.d.ts +1 -0
  2. package/dist/agent.d.ts +1 -0
  3. package/dist/agent.js +20 -2
  4. package/dist/agent.js.map +1 -1
  5. package/dist/handoff-checkpoint.d.ts +43 -0
  6. package/dist/handoff-checkpoint.js +6684 -0
  7. package/dist/handoff-checkpoint.js.map +1 -0
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.js +2 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/posthog-api.d.ts +2 -0
  12. package/dist/posthog-api.js +18 -2
  13. package/dist/posthog-api.js.map +1 -1
  14. package/dist/resume.d.ts +4 -8
  15. package/dist/resume.js +266 -6491
  16. package/dist/resume.js.map +1 -1
  17. package/dist/server/agent-server.d.ts +7 -16
  18. package/dist/server/agent-server.js +2333 -1383
  19. package/dist/server/agent-server.js.map +1 -1
  20. package/dist/server/bin.cjs +2332 -1382
  21. package/dist/server/bin.cjs.map +1 -1
  22. package/dist/server/schemas.d.ts +191 -0
  23. package/dist/server/schemas.js +108 -0
  24. package/dist/server/schemas.js.map +1 -0
  25. package/dist/tree-tracker.d.ts +1 -0
  26. package/dist/tree-tracker.js +18 -4
  27. package/dist/tree-tracker.js.map +1 -1
  28. package/dist/types.d.ts +18 -1
  29. package/dist/types.js +5 -0
  30. package/dist/types.js.map +1 -1
  31. package/package.json +10 -2
  32. package/src/acp-extensions.ts +3 -0
  33. package/src/handoff-checkpoint.test.ts +183 -0
  34. package/src/handoff-checkpoint.ts +367 -0
  35. package/src/posthog-api.test.ts +29 -0
  36. package/src/posthog-api.ts +13 -1
  37. package/src/resume.ts +27 -12
  38. package/src/sagas/apply-snapshot-saga.ts +7 -0
  39. package/src/sagas/capture-tree-saga.ts +10 -3
  40. package/src/sagas/resume-saga.test.ts +7 -47
  41. package/src/sagas/resume-saga.ts +42 -64
  42. package/src/sagas/test-fixtures.ts +46 -0
  43. package/src/server/agent-server.ts +193 -70
  44. package/src/server/schemas.ts +21 -2
  45. package/src/types.ts +24 -0
@@ -1,6 +1,7 @@
1
1
  import { ContentBlock } from '@agentclientprotocol/sdk';
2
2
  import { PostHogAPIClient } from '../../../posthog-api.js';
3
3
  import { StoredEntry } from '../../../types.js';
4
+ import '@posthog/git/handoff';
4
5
 
5
6
  interface ConversationTurn {
6
7
  role: "user" | "assistant";
package/dist/agent.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { AgentSideConnection } from '@agentclientprotocol/sdk';
2
2
  import { PostHogAPIClient } from './posthog-api.js';
3
3
  import { AgentConfig, TaskExecutionOptions } from './types.js';
4
+ import '@posthog/git/handoff';
4
5
 
5
6
  type StreamPair = {
6
7
  readable: globalThis.ReadableStream<Uint8Array>;
package/dist/agent.js CHANGED
@@ -4030,7 +4030,7 @@ import { v7 as uuidv7 } from "uuid";
4030
4030
  // package.json
4031
4031
  var package_default = {
4032
4032
  name: "@posthog/agent",
4033
- version: "2.3.386",
4033
+ version: "2.3.388",
4034
4034
  repository: "https://github.com/PostHog/code",
4035
4035
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
4036
4036
  exports: {
@@ -4090,6 +4090,10 @@ var package_default = {
4090
4090
  types: "./dist/resume.d.ts",
4091
4091
  import: "./dist/resume.js"
4092
4092
  },
4093
+ "./handoff-checkpoint": {
4094
+ types: "./dist/handoff-checkpoint.d.ts",
4095
+ import: "./dist/handoff-checkpoint.js"
4096
+ },
4093
4097
  "./tree-tracker": {
4094
4098
  types: "./dist/tree-tracker.d.ts",
4095
4099
  import: "./dist/tree-tracker.js"
@@ -4097,6 +4101,10 @@ var package_default = {
4097
4101
  "./server": {
4098
4102
  types: "./dist/server/agent-server.d.ts",
4099
4103
  import: "./dist/server/agent-server.js"
4104
+ },
4105
+ "./server/schemas": {
4106
+ types: "./dist/server/schemas.d.ts",
4107
+ import: "./dist/server/schemas.js"
4100
4108
  }
4101
4109
  },
4102
4110
  bin: {
@@ -4187,6 +4195,8 @@ var POSTHOG_NOTIFICATIONS = {
4187
4195
  SDK_SESSION: "_posthog/sdk_session",
4188
4196
  /** Tree state snapshot captured (git tree hash + file archive) */
4189
4197
  TREE_SNAPSHOT: "_posthog/tree_snapshot",
4198
+ /** Git checkpoint captured for handoff */
4199
+ GIT_CHECKPOINT: "_posthog/git_checkpoint",
4190
4200
  /** Agent mode changed (interactive/background) */
4191
4201
  MODE_CHANGE: "_posthog/mode_change",
4192
4202
  /** Request to resume a session from previous state */
@@ -18419,6 +18429,13 @@ var PostHogAPIClient = class {
18419
18429
  `/api/projects/${teamId}/tasks/${taskId}/runs/${runId}/`
18420
18430
  );
18421
18431
  }
18432
+ async resumeRunInCloud(taskId, runId) {
18433
+ const teamId = this.getTeamId();
18434
+ return this.apiRequest(
18435
+ `/api/projects/${teamId}/tasks/${taskId}/runs/${runId}/resume_in_cloud/`,
18436
+ { method: "POST" }
18437
+ );
18438
+ }
18422
18439
  async updateTaskRun(taskId, runId, payload) {
18423
18440
  const teamId = this.getTeamId();
18424
18441
  return this.apiRequest(
@@ -18470,7 +18487,8 @@ var PostHogAPIClient = class {
18470
18487
  body: JSON.stringify({ artifacts })
18471
18488
  }
18472
18489
  );
18473
- return response.artifacts ?? [];
18490
+ const manifest = response.artifacts ?? [];
18491
+ return manifest.slice(-artifacts.length);
18474
18492
  }
18475
18493
  /**
18476
18494
  * Download artifact content by storage path