@agimon-ai/doompi-git 0.0.1-alpha.3 → 0.0.1-alpha.30

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 (179) hide show
  1. package/README.md +2 -0
  2. package/dist/apiContracts.cjs +149 -0
  3. package/dist/apiContracts.cjs.map +1 -0
  4. package/dist/apiContracts.d.mts +53 -0
  5. package/dist/apiContracts.d.mts.map +1 -0
  6. package/dist/apiContracts.mjs +144 -0
  7. package/dist/apiContracts.mjs.map +1 -0
  8. package/dist/extensions/pi.cjs +109 -1
  9. package/dist/extensions/pi.cjs.map +1 -0
  10. package/dist/extensions/pi.d.mts +6 -2
  11. package/dist/extensions/pi.d.mts.map +1 -0
  12. package/dist/extensions/pi.mjs +104 -1
  13. package/dist/extensions/pi.mjs.map +1 -0
  14. package/dist/extensions/server.cjs +495 -0
  15. package/dist/extensions/server.cjs.map +1 -0
  16. package/dist/extensions/server.d.mts +5 -0
  17. package/dist/extensions/server.d.mts.map +1 -0
  18. package/dist/extensions/server.mjs +490 -0
  19. package/dist/extensions/server.mjs.map +1 -0
  20. package/dist/extensions/web.mjs +580 -0
  21. package/dist/extensions/web.mjs.map +1 -0
  22. package/dist/gitDependencies-D-EUEIkE.mjs +22 -0
  23. package/dist/gitDependencies-D-EUEIkE.mjs.map +1 -0
  24. package/dist/gitDependencies-DKJr5kLQ.cjs +33 -0
  25. package/dist/gitDependencies-DKJr5kLQ.cjs.map +1 -0
  26. package/dist/index-BQq2vblZ.d.mts +143 -0
  27. package/dist/index-BQq2vblZ.d.mts.map +1 -0
  28. package/dist/index.cjs +4 -1
  29. package/dist/index.d.mts +2 -5
  30. package/dist/index.mjs +2 -1
  31. package/dist/runWorktree-B6ikYRrG.cjs +318 -0
  32. package/dist/runWorktree-B6ikYRrG.cjs.map +1 -0
  33. package/dist/runWorktree-BL99h9oH.mjs +289 -0
  34. package/dist/runWorktree-BL99h9oH.mjs.map +1 -0
  35. package/dist/worktreeOperations-DAbs0ZTX.mjs +1054 -0
  36. package/dist/worktreeOperations-DAbs0ZTX.mjs.map +1 -0
  37. package/dist/worktreeOperations-DjO_Y5Yv.cjs +1138 -0
  38. package/dist/worktreeOperations-DjO_Y5Yv.cjs.map +1 -0
  39. package/package.json +53 -39
  40. package/src/prompts/doompi-use-git/SKILL.md +5 -2
  41. package/dist/_virtual/_rolldown/runtime.cjs +0 -1
  42. package/dist/adapters/channel/worktreeChannel.cjs +0 -2
  43. package/dist/adapters/channel/worktreeChannel.cjs.map +0 -1
  44. package/dist/adapters/channel/worktreeChannel.d.cts +0 -40
  45. package/dist/adapters/channel/worktreeChannel.d.cts.map +0 -1
  46. package/dist/adapters/channel/worktreeChannel.d.mts +0 -40
  47. package/dist/adapters/channel/worktreeChannel.d.mts.map +0 -1
  48. package/dist/adapters/channel/worktreeChannel.mjs +0 -2
  49. package/dist/adapters/channel/worktreeChannel.mjs.map +0 -1
  50. package/dist/adapters/filesystem/atomicJson.cjs +0 -2
  51. package/dist/adapters/filesystem/atomicJson.cjs.map +0 -1
  52. package/dist/adapters/filesystem/atomicJson.mjs +0 -2
  53. package/dist/adapters/filesystem/atomicJson.mjs.map +0 -1
  54. package/dist/adapters/filesystem/paths.cjs +0 -2
  55. package/dist/adapters/filesystem/paths.cjs.map +0 -1
  56. package/dist/adapters/filesystem/paths.mjs +0 -2
  57. package/dist/adapters/filesystem/paths.mjs.map +0 -1
  58. package/dist/adapters/hub/hubClient.cjs +0 -2
  59. package/dist/adapters/hub/hubClient.cjs.map +0 -1
  60. package/dist/adapters/hub/hubClient.d.cts +0 -1
  61. package/dist/adapters/hub/hubClient.d.mts +0 -1
  62. package/dist/adapters/hub/hubClient.mjs +0 -2
  63. package/dist/adapters/hub/hubClient.mjs.map +0 -1
  64. package/dist/adapters/pi/extension.cjs +0 -2
  65. package/dist/adapters/pi/extension.cjs.map +0 -1
  66. package/dist/adapters/pi/extension.d.cts +0 -9
  67. package/dist/adapters/pi/extension.d.cts.map +0 -1
  68. package/dist/adapters/pi/extension.d.mts +0 -9
  69. package/dist/adapters/pi/extension.d.mts.map +0 -1
  70. package/dist/adapters/pi/extension.mjs +0 -2
  71. package/dist/adapters/pi/extension.mjs.map +0 -1
  72. package/dist/adapters/pi/extensions/runWorktreeTool.cjs +0 -15
  73. package/dist/adapters/pi/extensions/runWorktreeTool.cjs.map +0 -1
  74. package/dist/adapters/pi/extensions/runWorktreeTool.mjs +0 -15
  75. package/dist/adapters/pi/extensions/runWorktreeTool.mjs.map +0 -1
  76. package/dist/adapters/web/worktreesChannel.cjs +0 -2
  77. package/dist/adapters/web/worktreesChannel.cjs.map +0 -1
  78. package/dist/adapters/web/worktreesChannel.d.cts +0 -21
  79. package/dist/adapters/web/worktreesChannel.d.cts.map +0 -1
  80. package/dist/adapters/web/worktreesChannel.d.mts +0 -21
  81. package/dist/adapters/web/worktreesChannel.d.mts.map +0 -1
  82. package/dist/adapters/web/worktreesChannel.mjs +0 -2
  83. package/dist/adapters/web/worktreesChannel.mjs.map +0 -1
  84. package/dist/adapters/worktree/dependencyInstall.cjs +0 -2
  85. package/dist/adapters/worktree/dependencyInstall.cjs.map +0 -1
  86. package/dist/adapters/worktree/dependencyInstall.mjs +0 -2
  87. package/dist/adapters/worktree/dependencyInstall.mjs.map +0 -1
  88. package/dist/adapters/worktree/gitCli.cjs +0 -4
  89. package/dist/adapters/worktree/gitCli.cjs.map +0 -1
  90. package/dist/adapters/worktree/gitCli.mjs +0 -4
  91. package/dist/adapters/worktree/gitCli.mjs.map +0 -1
  92. package/dist/adapters/worktree/repositoryIdentity.cjs +0 -2
  93. package/dist/adapters/worktree/repositoryIdentity.cjs.map +0 -1
  94. package/dist/adapters/worktree/repositoryIdentity.mjs +0 -2
  95. package/dist/adapters/worktree/repositoryIdentity.mjs.map +0 -1
  96. package/dist/adapters/worktree/worktreeOperations.cjs +0 -2
  97. package/dist/adapters/worktree/worktreeOperations.cjs.map +0 -1
  98. package/dist/adapters/worktree/worktreeOperations.d.cts +0 -32
  99. package/dist/adapters/worktree/worktreeOperations.d.cts.map +0 -1
  100. package/dist/adapters/worktree/worktreeOperations.d.mts +0 -32
  101. package/dist/adapters/worktree/worktreeOperations.d.mts.map +0 -1
  102. package/dist/adapters/worktree/worktreeOperations.mjs +0 -2
  103. package/dist/adapters/worktree/worktreeOperations.mjs.map +0 -1
  104. package/dist/adapters/worktree/worktreeRegistry.cjs +0 -2
  105. package/dist/adapters/worktree/worktreeRegistry.cjs.map +0 -1
  106. package/dist/adapters/worktree/worktreeRegistry.mjs +0 -2
  107. package/dist/adapters/worktree/worktreeRegistry.mjs.map +0 -1
  108. package/dist/commands/doomGitCommand.cjs +0 -2
  109. package/dist/commands/doomGitCommand.cjs.map +0 -1
  110. package/dist/commands/doomGitCommand.mjs +0 -2
  111. package/dist/commands/doomGitCommand.mjs.map +0 -1
  112. package/dist/container/index.cjs +0 -2
  113. package/dist/container/index.cjs.map +0 -1
  114. package/dist/container/index.d.cts +0 -6
  115. package/dist/container/index.d.cts.map +0 -1
  116. package/dist/container/index.d.mts +0 -6
  117. package/dist/container/index.d.mts.map +0 -1
  118. package/dist/container/index.mjs +0 -2
  119. package/dist/container/index.mjs.map +0 -1
  120. package/dist/extensions/pi.d.cts +0 -2
  121. package/dist/hubApi.cjs +0 -2
  122. package/dist/hubApi.cjs.map +0 -1
  123. package/dist/hubApi.d.cts +0 -6
  124. package/dist/hubApi.d.cts.map +0 -1
  125. package/dist/hubApi.d.mts +0 -6
  126. package/dist/hubApi.d.mts.map +0 -1
  127. package/dist/hubApi.mjs +0 -2
  128. package/dist/hubApi.mjs.map +0 -1
  129. package/dist/index.d.cts +0 -5
  130. package/dist/schemas/runWorktreeTool.cjs +0 -2
  131. package/dist/schemas/runWorktreeTool.cjs.map +0 -1
  132. package/dist/schemas/runWorktreeTool.mjs +0 -2
  133. package/dist/schemas/runWorktreeTool.mjs.map +0 -1
  134. package/dist/services/extensionService.cjs +0 -2
  135. package/dist/services/extensionService.cjs.map +0 -1
  136. package/dist/services/extensionService.d.cts +0 -8
  137. package/dist/services/extensionService.d.cts.map +0 -1
  138. package/dist/services/extensionService.d.mts +0 -8
  139. package/dist/services/extensionService.d.mts.map +0 -1
  140. package/dist/services/extensionService.mjs +0 -2
  141. package/dist/services/extensionService.mjs.map +0 -1
  142. package/dist/services/support/errors.cjs +0 -2
  143. package/dist/services/support/errors.cjs.map +0 -1
  144. package/dist/services/support/errors.mjs +0 -2
  145. package/dist/services/support/errors.mjs.map +0 -1
  146. package/dist/services/worktreeNaming.cjs +0 -2
  147. package/dist/services/worktreeNaming.cjs.map +0 -1
  148. package/dist/services/worktreeNaming.d.cts +0 -27
  149. package/dist/services/worktreeNaming.d.cts.map +0 -1
  150. package/dist/services/worktreeNaming.d.mts +0 -27
  151. package/dist/services/worktreeNaming.d.mts.map +0 -1
  152. package/dist/services/worktreeNaming.mjs +0 -2
  153. package/dist/services/worktreeNaming.mjs.map +0 -1
  154. package/dist/types/extension.d.cts +0 -17
  155. package/dist/types/extension.d.cts.map +0 -1
  156. package/dist/types/extension.d.mts +0 -17
  157. package/dist/types/extension.d.mts.map +0 -1
  158. package/dist/types/webWorktrees.cjs +0 -2
  159. package/dist/types/webWorktrees.cjs.map +0 -1
  160. package/dist/types/webWorktrees.mjs +0 -2
  161. package/dist/types/webWorktrees.mjs.map +0 -1
  162. package/dist/types/worktreeRegistry.d.cts +0 -41
  163. package/dist/types/worktreeRegistry.d.cts.map +0 -1
  164. package/dist/types/worktreeRegistry.d.mts +0 -41
  165. package/dist/types/worktreeRegistry.d.mts.map +0 -1
  166. package/dist/webHub.cjs +0 -1
  167. package/dist/webHub.d.cts +0 -2
  168. package/dist/webHub.d.mts +0 -2
  169. package/dist/webHub.mjs +0 -1
  170. package/src/exports/webClient.ts +0 -1
  171. package/src/types/webWorktrees.ts +0 -55
  172. package/src/types/worktreeRegistry.ts +0 -69
  173. package/src/web/components/RunWorktreeToolMessage.tsx +0 -37
  174. package/src/web/components/WorktreesActivitySection.tsx +0 -64
  175. package/src/web/components/WorktreesPanel.tsx +0 -125
  176. package/src/web/components/toolRenderers.ts +0 -7
  177. package/src/web/index.ts +0 -30
  178. package/src/web/stores/worktreesActivityStore.ts +0 -124
  179. package/src/web/tsconfig.json +0 -22
@@ -0,0 +1,22 @@
1
+ import { t as createWorktreeOperations, u as createWorktreeGit } from "./worktreeOperations-DAbs0ZTX.mjs";
2
+ //#region src/services/extensionService/index.ts
3
+ var DefaultGitExtensionService = class {
4
+ async execute() {
5
+ return {
6
+ message: "Show git worktrees owned by this session",
7
+ level: "info"
8
+ };
9
+ }
10
+ };
11
+ //#endregion
12
+ //#region src/services/gitDependencies/index.ts
13
+ function createGitDependencies(overrides = {}) {
14
+ return {
15
+ service: overrides.service ?? new DefaultGitExtensionService(),
16
+ operations: overrides.operations ?? createWorktreeOperations({ git: createWorktreeGit() })
17
+ };
18
+ }
19
+ //#endregion
20
+ export { DefaultGitExtensionService as n, createGitDependencies as t };
21
+
22
+ //# sourceMappingURL=gitDependencies-D-EUEIkE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitDependencies-D-EUEIkE.mjs","names":[],"sources":["../src/services/extensionService/index.ts","../src/services/gitDependencies/index.ts"],"sourcesContent":["// @scaffold-generated\nimport type { GitExtensionResult, GitExtensionService } from '../../types/extension';\n\nexport class DefaultGitExtensionService implements GitExtensionService {\n async execute(): Promise<GitExtensionResult> {\n return { message: 'Show git worktrees owned by this session', level: 'info' };\n }\n}\n","import type { GitExtensionDependencies } from '../../types/extension';\nimport { DefaultGitExtensionService } from '../extensionService';\n// @scaffold-generated\nimport { createWorktreeGit } from '../gitCli';\nimport { createWorktreeOperations } from '../worktreeOperations';\n\nexport function createGitDependencies(overrides: Partial<GitExtensionDependencies> = {}): GitExtensionDependencies {\n return {\n service: overrides.service ?? new DefaultGitExtensionService(),\n operations: overrides.operations ?? createWorktreeOperations({ git: createWorktreeGit() }),\n };\n}\n"],"mappings":";;AAGA,IAAa,6BAAb,MAAuE;CACrE,MAAM,UAAuC;EAC3C,OAAO;GAAE,SAAS;GAA4C,OAAO;EAAO;CAC9E;AACF;;;ACDA,SAAgB,sBAAsB,YAA+C,CAAC,GAA6B;CACjH,OAAO;EACL,SAAS,UAAU,WAAW,IAAI,2BAA2B;EAC7D,YAAY,UAAU,cAAc,yBAAyB,EAAE,KAAK,kBAAkB,EAAE,CAAC;CAC3F;AACF"}
@@ -0,0 +1,33 @@
1
+ const require_worktreeOperations = require("./worktreeOperations-DjO_Y5Yv.cjs");
2
+ //#region src/services/extensionService/index.ts
3
+ var DefaultGitExtensionService = class {
4
+ async execute() {
5
+ return {
6
+ message: "Show git worktrees owned by this session",
7
+ level: "info"
8
+ };
9
+ }
10
+ };
11
+ //#endregion
12
+ //#region src/services/gitDependencies/index.ts
13
+ function createGitDependencies(overrides = {}) {
14
+ return {
15
+ service: overrides.service ?? new DefaultGitExtensionService(),
16
+ operations: overrides.operations ?? require_worktreeOperations.createWorktreeOperations({ git: require_worktreeOperations.createWorktreeGit() })
17
+ };
18
+ }
19
+ //#endregion
20
+ Object.defineProperty(exports, "DefaultGitExtensionService", {
21
+ enumerable: true,
22
+ get: function() {
23
+ return DefaultGitExtensionService;
24
+ }
25
+ });
26
+ Object.defineProperty(exports, "createGitDependencies", {
27
+ enumerable: true,
28
+ get: function() {
29
+ return createGitDependencies;
30
+ }
31
+ });
32
+
33
+ //# sourceMappingURL=gitDependencies-DKJr5kLQ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitDependencies-DKJr5kLQ.cjs","names":["createWorktreeOperations","createWorktreeGit"],"sources":["../src/services/extensionService/index.ts","../src/services/gitDependencies/index.ts"],"sourcesContent":["// @scaffold-generated\nimport type { GitExtensionResult, GitExtensionService } from '../../types/extension';\n\nexport class DefaultGitExtensionService implements GitExtensionService {\n async execute(): Promise<GitExtensionResult> {\n return { message: 'Show git worktrees owned by this session', level: 'info' };\n }\n}\n","import type { GitExtensionDependencies } from '../../types/extension';\nimport { DefaultGitExtensionService } from '../extensionService';\n// @scaffold-generated\nimport { createWorktreeGit } from '../gitCli';\nimport { createWorktreeOperations } from '../worktreeOperations';\n\nexport function createGitDependencies(overrides: Partial<GitExtensionDependencies> = {}): GitExtensionDependencies {\n return {\n service: overrides.service ?? new DefaultGitExtensionService(),\n operations: overrides.operations ?? createWorktreeOperations({ git: createWorktreeGit() }),\n };\n}\n"],"mappings":";;AAGA,IAAa,6BAAb,MAAuE;CACrE,MAAM,UAAuC;EAC3C,OAAO;GAAE,SAAS;GAA4C,OAAO;EAAO;CAC9E;AACF;;;ACDA,SAAgB,sBAAsB,YAA+C,CAAC,GAA6B;CACjH,OAAO;EACL,SAAS,UAAU,WAAW,IAAI,2BAA2B;EAC7D,YAAY,UAAU,cAAcA,2BAAAA,yBAAyB,EAAE,KAAKC,2BAAAA,kBAAkB,EAAE,CAAC;CAC3F;AACF"}
@@ -0,0 +1,143 @@
1
+ import "@agimon-ai/doompi-session";
2
+ import "@agimon-ai/doompi-core/hubChannel";
3
+ //#region src/services/worktreeEvents/index.d.ts
4
+ declare const WORKTREE_MESSAGE_VERSION: 1;
5
+ type WorktreeMessageParty = 'parent' | 'child';
6
+ interface WorktreeMessage {
7
+ readonly version: typeof WORKTREE_MESSAGE_VERSION;
8
+ readonly worktreeId: string;
9
+ readonly fromSessionId: string;
10
+ readonly from: WorktreeMessageParty;
11
+ readonly text: string;
12
+ readonly sentAt: string;
13
+ }
14
+ //#endregion
15
+ //#region src/types/worktreeRegistry.d.ts
16
+ /**
17
+ * The worktree registry: what this package knows about the worktrees it made.
18
+ *
19
+ * It deliberately does not mirror `git worktree list`. Git knows which
20
+ * worktrees exist; only this registry knows which of them this package created,
21
+ * which session runs in each, and which process to signal. Reconciling the two
22
+ * is how orphans are found, so the two views are kept separate on purpose.
23
+ */
24
+ /**
25
+ * A worktree's lifecycle as this package sees it.
26
+ *
27
+ * `orphaned` is a finding, not a cleanup: the session process is gone or the
28
+ * directory has vanished, but the worktree may still hold uncommitted work, so
29
+ * the record is kept until someone decides what to do with it.
30
+ */
31
+ type WorktreeStatus = 'spawning' | 'running' | 'closing' | 'orphaned';
32
+ declare const WORKTREE_RECORD_VERSION = 1;
33
+ interface WorktreeRecord {
34
+ version: typeof WORKTREE_RECORD_VERSION;
35
+ /** This registry's own id, distinct from the session id, and stable across restarts. */
36
+ id: string;
37
+ /** The branch checked out in the worktree. */
38
+ branch: string;
39
+ /** The ref the branch was created from, kept so a merge can name its base. */
40
+ baseRef: string;
41
+ /** Absolute path to the worktree directory. */
42
+ path: string;
43
+ /** Absolute path to the repository the worktree belongs to. */
44
+ repositoryRoot: string;
45
+ /** The session spawned into the worktree. */
46
+ sessionId: string;
47
+ /** The session that asked for the worktree; the rail nests one under the other. */
48
+ parentSessionId: string;
49
+ status: WorktreeStatus;
50
+ /** ISO 8601. */
51
+ createdAt: string;
52
+ }
53
+ //#endregion
54
+ //#region src/services/worktreeNaming/index.d.ts
55
+ interface PrunePlan {
56
+ /** Orphans whose directory git still lists, safe to remove. */
57
+ remove: WorktreeRecord[];
58
+ /** Orphans whose directory is already gone; drop the record only. */
59
+ forget: WorktreeRecord[];
60
+ /** Paths git lists under our root that we have no record of; report, never touch. */
61
+ untracked: string[];
62
+ /** Orphans left alone because they still hold uncommitted work. */
63
+ keptDirty: WorktreeRecord[];
64
+ /**
65
+ * Branches git refused to delete because they hold commits.
66
+ *
67
+ * Filled by the prune itself, not by the plan: a dry run destroys nothing, so
68
+ * it has nothing to report here and leaves it empty.
69
+ */
70
+ keptBranches: string[];
71
+ }
72
+ /**
73
+ * What a prune would do, decided before anything is destroyed.
74
+ *
75
+ * Separating the plan from the execution is what makes dryRun honest and lets
76
+ * the destructive half be reviewed on its own.
77
+ */
78
+ declare function planPrune(input: {
79
+ records: readonly WorktreeRecord[];
80
+ gitPaths: readonly string[];
81
+ worktreesRoot: string;
82
+ dirtyByPath: ReadonlyMap<string, readonly string[]>;
83
+ }): PrunePlan;
84
+ //#endregion
85
+ //#region src/services/worktreeOperations/index.d.ts
86
+ interface WorktreeContext {
87
+ /** Where the calling session is working, used to find the repository. */
88
+ cwd: string;
89
+ /** The calling session, recorded as the new session's parent. */
90
+ sessionId: string;
91
+ }
92
+ interface SpawnWorktreeRequest {
93
+ branch: string;
94
+ baseRef?: string;
95
+ name?: string;
96
+ task?: string;
97
+ /** Host-owned execution setup, exposed by the UI rather than the agent tool. */
98
+ reservationId?: string;
99
+ }
100
+ interface SpawnOptions {
101
+ /** Aborted when the caller gives up, so a spawn nobody is waiting for stops. */
102
+ signal?: AbortSignal;
103
+ /** Phase labels, for a caller that can show them while the work runs. */
104
+ onProgress?: (label: string) => void;
105
+ }
106
+ interface WorktreeOperations {
107
+ spawn(context: WorktreeContext, request: SpawnWorktreeRequest, options?: SpawnOptions): Promise<WorktreeRecord>;
108
+ close(context: WorktreeContext, id: string, force: boolean): Promise<WorktreeRecord>;
109
+ list(context: WorktreeContext): Promise<WorktreeRecord[]>;
110
+ status(context: WorktreeContext, id: string): Promise<{
111
+ record: WorktreeRecord;
112
+ dirtyFiles: string[];
113
+ }>;
114
+ merge(context: WorktreeContext, id: string, message?: string): Promise<WorktreeRecord>;
115
+ prune(context: WorktreeContext, dryRun: boolean): Promise<ReturnType<typeof planPrune>>;
116
+ send(context: WorktreeContext, id: string, message: string): Promise<void>;
117
+ messages(context: WorktreeContext, id: string): Promise<WorktreeMessage[]>;
118
+ }
119
+ //#endregion
120
+ //#region src/types/extension.d.ts
121
+ type GitNotificationLevel = 'info';
122
+ interface GitExtensionResult {
123
+ message: string;
124
+ level: GitNotificationLevel;
125
+ }
126
+ interface GitExtensionService {
127
+ execute(): Promise<GitExtensionResult>;
128
+ }
129
+ interface GitExtensionDependencies {
130
+ service: GitExtensionService;
131
+ operations: WorktreeOperations;
132
+ }
133
+ //#endregion
134
+ //#region src/services/extensionService/index.d.ts
135
+ declare class DefaultGitExtensionService implements GitExtensionService {
136
+ execute(): Promise<GitExtensionResult>;
137
+ }
138
+ //#endregion
139
+ //#region src/services/gitDependencies/index.d.ts
140
+ declare function createGitDependencies(overrides?: Partial<GitExtensionDependencies>): GitExtensionDependencies;
141
+ //#endregion
142
+ export { GitExtensionService as a, GitExtensionResult as i, DefaultGitExtensionService as n, GitExtensionDependencies as r, createGitDependencies as t };
143
+ //# sourceMappingURL=index-BQq2vblZ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BQq2vblZ.d.mts","names":[],"sources":["../src/services/worktreeEvents/index.ts","../src/types/worktreeRegistry.ts","../src/services/worktreeNaming/index.ts","../src/services/worktreeOperations/index.ts","../src/types/extension.ts","../src/services/extensionService/index.ts","../src/services/gitDependencies/index.ts"],"mappings":";;;cAIa;KASD;UAEK;WACN,gBAAgB;WAChB;WACA;WACA,MAAM;WACN;WACA;;;;;;;;;;;;;;;;;;;KCLC;cAEC;UAEI;EACf,gBAAgB;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,QAAQ;;EAER;;;;UC8De;;EAEf,QAAQ;;EAER,QAAQ;;EAER;;EAEA,WAAW;;;;;;;EAOX;;;;;;;;iBASc,UAAU;EACxB,kBAAkB;EAClB;EACA;EACA,aAAa;IACX;;;UC7Ga;;EAEf;;EAEA;;UAGe;EACf;EACA;EACA;EACA;;EAEA;;UAGe;;EAEf,SAAS;;EAET,cAAc;;UAGC;EACf,MAAM,SAAS,iBAAiB,SAAS,sBAAsB,UAAU,eAAe,QAAQ;EAChG,MAAM,SAAS,iBAAiB,YAAY,iBAAiB,QAAQ;EACrE,KAAK,SAAS,kBAAkB,QAAQ;EACxC,OAAO,SAAS,iBAAiB,aAAa;IAAU,QAAQ;IAAgB;;EAChF,MAAM,SAAS,iBAAiB,YAAY,mBAAmB,QAAQ;EACvE,MAAM,SAAS,iBAAiB,kBAAkB,QAAQ,kBAAkB;EAC5E,KAAK,SAAS,iBAAiB,YAAY,kBAAkB;EAC7D,SAAS,SAAS,iBAAiB,aAAa,QAA9B;;;;KChDR;UAEK;EACf;EACA,OAAO;;UAGQ;EACf,WAAW,QAAQ;;UAGJ;EACf,SAAS;EACT,YAAY;;;;cCbD,sCAAsC;EAC3C,WAAW,QAAQ;;;;iBCEX,sBAAsB,YAAW,QAAQ,4BAAiC"}
package/dist/index.cjs CHANGED
@@ -1 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/extensionService.cjs"),t=require("./container/index.cjs"),n=require("./adapters/pi/extension.cjs");exports.DefaultGitExtensionService=e.DefaultGitExtensionService,exports.activateGitExtension=n.activateGitExtension,exports.createGitContainer=t.createGitContainer;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_gitDependencies = require("./gitDependencies-DKJr5kLQ.cjs");
3
+ exports.DefaultGitExtensionService = require_gitDependencies.DefaultGitExtensionService;
4
+ exports.createGitDependencies = require_gitDependencies.createGitDependencies;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,2 @@
1
- import { GitExtensionDependencies, GitExtensionResult, GitExtensionService } from "./types/extension.mjs";
2
- import { activateGitExtension } from "./adapters/pi/extension.mjs";
3
- import { DefaultGitExtensionService } from "./services/extensionService.mjs";
4
- import { createGitContainer } from "./container/index.mjs";
5
- export { DefaultGitExtensionService, type GitExtensionDependencies, type GitExtensionResult, type GitExtensionService, activateGitExtension, createGitContainer };
1
+ import { a as GitExtensionService, i as GitExtensionResult, n as DefaultGitExtensionService, r as GitExtensionDependencies, t as createGitDependencies } from "./index-BQq2vblZ.mjs";
2
+ export { DefaultGitExtensionService, type GitExtensionDependencies, type GitExtensionResult, type GitExtensionService, createGitDependencies };
package/dist/index.mjs CHANGED
@@ -1 +1,2 @@
1
- import{DefaultGitExtensionService as e}from"./services/extensionService.mjs";import{createGitContainer as t}from"./container/index.mjs";import{activateGitExtension as n}from"./adapters/pi/extension.mjs";export{e as DefaultGitExtensionService,n as activateGitExtension,t as createGitContainer};
1
+ import { n as DefaultGitExtensionService, t as createGitDependencies } from "./gitDependencies-D-EUEIkE.mjs";
2
+ export { DefaultGitExtensionService, createGitDependencies };
@@ -0,0 +1,318 @@
1
+ const require_worktreeOperations = require("./worktreeOperations-DjO_Y5Yv.cjs");
2
+ let typebox = require("typebox");
3
+ //#region src/schemas/runWorktreeTool.ts
4
+ /**
5
+ * The tool's action vocabulary.
6
+ *
7
+ * One tool with an action field rather than six tools, matching `subagent`:
8
+ * the actions share a subject and are meaningless apart from it, and six
9
+ * separate tools would spend six description budgets teaching the same nouns.
10
+ */
11
+ const WORKTREE_ACTIONS = {
12
+ spawn_worktree: "spawn_worktree",
13
+ close_worktree: "close_worktree",
14
+ list: "list",
15
+ status: "status",
16
+ merge: "merge",
17
+ prune: "prune",
18
+ send: "send",
19
+ messages: "messages"
20
+ };
21
+ /**
22
+ * Which fields each action accepts.
23
+ *
24
+ * Rejecting an unknown field is what stops a plausible-looking call from doing
25
+ * something other than what it reads like: `close_worktree` with `branch`
26
+ * instead of `id` would otherwise close whatever the default resolved to.
27
+ */
28
+ const WORKTREE_ACTION_FIELDS = {
29
+ spawn_worktree: [
30
+ "action",
31
+ "branch",
32
+ "baseRef",
33
+ "task",
34
+ "name"
35
+ ],
36
+ close_worktree: [
37
+ "action",
38
+ "id",
39
+ "force"
40
+ ],
41
+ list: ["action"],
42
+ status: ["action", "id"],
43
+ merge: [
44
+ "action",
45
+ "id",
46
+ "message"
47
+ ],
48
+ prune: ["action", "dryRun"],
49
+ send: [
50
+ "action",
51
+ "id",
52
+ "message"
53
+ ],
54
+ messages: ["action", "id"]
55
+ };
56
+ const SpawnParams = typebox.Type.Object({
57
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.spawn_worktree),
58
+ branch: typebox.Type.String({ minLength: 1 }),
59
+ baseRef: typebox.Type.Optional(typebox.Type.String({ minLength: 1 })),
60
+ task: typebox.Type.Optional(typebox.Type.String({ minLength: 1 })),
61
+ name: typebox.Type.Optional(typebox.Type.String({ minLength: 1 }))
62
+ }, { additionalProperties: false });
63
+ const CloseParams = typebox.Type.Object({
64
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.close_worktree),
65
+ id: typebox.Type.String({ minLength: 1 }),
66
+ force: typebox.Type.Optional(typebox.Type.Boolean())
67
+ }, { additionalProperties: false });
68
+ const ListParams = typebox.Type.Object({ action: typebox.Type.Literal(WORKTREE_ACTIONS.list) }, { additionalProperties: false });
69
+ const StatusParams = typebox.Type.Object({
70
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.status),
71
+ id: typebox.Type.String({ minLength: 1 })
72
+ }, { additionalProperties: false });
73
+ const MergeParams = typebox.Type.Object({
74
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.merge),
75
+ id: typebox.Type.String({ minLength: 1 }),
76
+ message: typebox.Type.Optional(typebox.Type.String({ minLength: 1 }))
77
+ }, { additionalProperties: false });
78
+ const PruneParams = typebox.Type.Object({
79
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.prune),
80
+ dryRun: typebox.Type.Optional(typebox.Type.Boolean())
81
+ }, { additionalProperties: false });
82
+ const SendParams = typebox.Type.Object({
83
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.send),
84
+ id: typebox.Type.String({ minLength: 1 }),
85
+ message: typebox.Type.String({ minLength: 1 })
86
+ }, { additionalProperties: false });
87
+ const MessagesParams = typebox.Type.Object({
88
+ action: typebox.Type.Literal(WORKTREE_ACTIONS.messages),
89
+ id: typebox.Type.String({ minLength: 1 })
90
+ }, { additionalProperties: false });
91
+ typebox.Type.Union([
92
+ SpawnParams,
93
+ CloseParams,
94
+ ListParams,
95
+ StatusParams,
96
+ MergeParams,
97
+ PruneParams,
98
+ SendParams,
99
+ MessagesParams
100
+ ]);
101
+ /** The actions that accept `field`, so the declared docs cannot drift from the validator. */
102
+ function acceptingActions(field) {
103
+ return Object.values(WORKTREE_ACTIONS).filter((action) => WORKTREE_ACTION_FIELDS[action].includes(field)).join(", ");
104
+ }
105
+ /**
106
+ * The schema declared to the model.
107
+ *
108
+ * A flat object rather than `RunWorktreeParams` itself. A top-level union is
109
+ * `{anyOf:[...]}` with no `properties`, and Pi's Anthropic Messages adapter
110
+ * rebuilds tool input as `{type:'object', properties: schema.properties ?? {},
111
+ * required: schema.required ?? []}`, so the union arrived at the model as an
112
+ * empty object while the host went on validating calls against it. Nothing here
113
+ * relaxes what is accepted: `validateParams` still rejects an unknown action, a
114
+ * field the action does not take, and a missing required one.
115
+ */
116
+ const RunWorktreeToolSchema = typebox.Type.Object({
117
+ action: typebox.Type.String({
118
+ enum: Object.values(WORKTREE_ACTIONS),
119
+ description: "The operation to run. Every other field is accepted only by the actions its description names."
120
+ }),
121
+ branch: typebox.Type.Optional(typebox.Type.String({
122
+ minLength: 1,
123
+ description: `New branch to create. Actions: ${acceptingActions("branch")}.`
124
+ })),
125
+ baseRef: typebox.Type.Optional(typebox.Type.String({
126
+ minLength: 1,
127
+ description: `Base ref, defaulting to the current branch. Actions: ${acceptingActions("baseRef")}.`
128
+ })),
129
+ task: typebox.Type.Optional(typebox.Type.String({
130
+ minLength: 1,
131
+ description: `First message for the new session. Actions: ${acceptingActions("task")}.`
132
+ })),
133
+ name: typebox.Type.Optional(typebox.Type.String({
134
+ minLength: 1,
135
+ description: `Rail label for the worktree. Actions: ${acceptingActions("name")}.`
136
+ })),
137
+ id: typebox.Type.Optional(typebox.Type.String({
138
+ minLength: 1,
139
+ description: `Worktree id. Actions: ${acceptingActions("id")}.`
140
+ })),
141
+ force: typebox.Type.Optional(typebox.Type.Boolean({ description: `Close even when the tree is dirty. Actions: ${acceptingActions("force")}.` })),
142
+ message: typebox.Type.Optional(typebox.Type.String({
143
+ minLength: 1,
144
+ description: `Merge commit message, or the text to send. Actions: ${acceptingActions("message")}.`
145
+ })),
146
+ dryRun: typebox.Type.Optional(typebox.Type.Boolean({ description: `Report the plan without destroying anything. Actions: ${acceptingActions("dryRun")}.` }))
147
+ }, { additionalProperties: false });
148
+ //#endregion
149
+ //#region src/services/runWorktree/index.ts
150
+ const RUN_WORKTREE_TOOL_NAME = "run_worktree";
151
+ const IMPLEMENTED_ACTIONS = new Set(Object.values(WORKTREE_ACTIONS));
152
+ const RUN_WORKTREE_DESCRIPTION = `Create and manage git worktrees, each with its own DoomPi session nested under this one.
153
+
154
+ Actions:
155
+ - spawn_worktree: create a worktree on a new branch and start a session in it. Requires 'branch'. Optional 'baseRef' (defaults to the current branch's remote-tracking ref, then the remote default branch), 'name' for the rail, 'task' as the first message.
156
+ - close_worktree: stop a worktree's session, delete its checkout, and remove its generated sync storage. Requires 'id'. Refuses a dirty tree unless 'force' is true.
157
+ - list: every worktree for this repository, with status.
158
+ - status: one worktree and its uncommitted files. Requires 'id'.
159
+ - merge: merge a worktree's branch into this checkout. Requires 'id'. Refuses when this checkout is dirty.
160
+ - prune: remove orphaned worktrees and their generated sync storage. Pass 'dryRun' to see the plan without destroying anything.
161
+ - send: send a message to the other side of a worktree. Requires 'id' and 'message'.
162
+ - messages: read messages waiting for you from a worktree. Requires 'id'.
163
+
164
+ Worktrees live outside the repository, under ~/.pi/.doom/git/worktrees.`;
165
+ /** Rejects calls that do not match one documented action shape. */
166
+ function validateParams(input) {
167
+ if (typeof input !== "object" || input === null || Array.isArray(input)) throw require_worktreeOperations.invalidRequest("run_worktree parameters must be an object.", "Call it with one documented action shape.");
168
+ const record = input;
169
+ const action = record.action;
170
+ if (typeof action !== "string" || !IMPLEMENTED_ACTIONS.has(action)) throw require_worktreeOperations.invalidRequest(`Unknown action ${typeof action === "string" ? `'${action}'` : "value"}.`, `Use one of: ${[...IMPLEMENTED_ACTIONS].join(", ")}.`);
171
+ const allowed = WORKTREE_ACTION_FIELDS[action];
172
+ const unexpected = Object.keys(record).filter((key) => !allowed.includes(key));
173
+ if (unexpected.length > 0) throw require_worktreeOperations.invalidRequest(`action='${action}' does not accept: ${unexpected.join(", ")}.`, `Fields for '${action}': ${allowed.join(", ")}.`);
174
+ for (const field of ["branch", "id"]) if (allowed.includes(field) && field in record) {
175
+ const value = record[field];
176
+ if (typeof value !== "string" || value.trim() === "") throw require_worktreeOperations.invalidRequest(`action='${action}' requires a nonblank '${field}'.`, `Pass a ${field}.`);
177
+ }
178
+ for (const field of [
179
+ "baseRef",
180
+ "name",
181
+ "task",
182
+ "message"
183
+ ]) if (field in record && (typeof record[field] !== "string" || record[field].trim() === "")) throw require_worktreeOperations.invalidRequest(`action='${action}' requires a nonblank '${field}'.`, `Pass a ${field}.`);
184
+ for (const field of ["force", "dryRun"]) if (field in record && typeof record[field] !== "boolean") throw require_worktreeOperations.invalidRequest(`action='${action}' requires boolean '${field}'.`, `Pass true or false for ${field}.`);
185
+ if (action === WORKTREE_ACTIONS.send && typeof record.message !== "string") throw require_worktreeOperations.invalidRequest("action='send' requires 'message'.", "Pass the message to send.");
186
+ if (action === WORKTREE_ACTIONS.spawn_worktree && typeof record.branch !== "string") throw require_worktreeOperations.invalidRequest("action='spawn_worktree' requires 'branch'.", "Name the branch to create.");
187
+ if ((action === WORKTREE_ACTIONS.close_worktree || action === WORKTREE_ACTIONS.status || action === WORKTREE_ACTIONS.merge || action === WORKTREE_ACTIONS.send || action === WORKTREE_ACTIONS.messages) && typeof record.id !== "string") throw require_worktreeOperations.invalidRequest(`action='${action}' requires 'id'.`, "Call list to see the current ids.");
188
+ return record;
189
+ }
190
+ function describe(record) {
191
+ return `${record.id} ${record.branch} ${record.status} ${record.path}`;
192
+ }
193
+ function text(...lines) {
194
+ return [{
195
+ type: "text",
196
+ text: lines.join("\n")
197
+ }];
198
+ }
199
+ async function executeRunWorktreeTool(params, operations, context, options = {}) {
200
+ switch (params.action) {
201
+ case WORKTREE_ACTIONS.spawn_worktree: {
202
+ const record = await operations.spawn(context, {
203
+ branch: params.branch,
204
+ ...params.baseRef === void 0 ? {} : { baseRef: params.baseRef },
205
+ ...params.name === void 0 ? {} : { name: params.name },
206
+ ...params.task === void 0 ? {} : { task: params.task }
207
+ }, options);
208
+ return {
209
+ content: text(`Worktree ${record.id} created on ${record.branch} from ${record.baseRef}.`, `Path: ${record.path}`, params.task === void 0 ? `Session ${record.sessionId} is starting; it appears nested under this one in the rail.` : `Session ${record.sessionId} is starting with its task; it appears nested under this one in the rail.`),
210
+ details: {
211
+ action: params.action,
212
+ records: [record]
213
+ }
214
+ };
215
+ }
216
+ case WORKTREE_ACTIONS.close_worktree: {
217
+ const record = await operations.close(context, params.id, params.force ?? false);
218
+ return {
219
+ content: text(`Worktree ${record.id} (${record.branch}) closed and removed.`),
220
+ details: {
221
+ action: params.action,
222
+ records: [record]
223
+ }
224
+ };
225
+ }
226
+ case WORKTREE_ACTIONS.list: {
227
+ const records = await operations.list(context);
228
+ return {
229
+ content: records.length === 0 ? text("No worktrees for this repository.") : text(`${String(records.length)} worktree(s):`, ...records.map(describe)),
230
+ details: {
231
+ action: params.action,
232
+ records
233
+ }
234
+ };
235
+ }
236
+ case WORKTREE_ACTIONS.status: {
237
+ const { record, dirtyFiles } = await operations.status(context, params.id);
238
+ return {
239
+ content: text(describe(record), `Session: ${record.sessionId}`, dirtyFiles.length === 0 ? "Clean." : `${String(dirtyFiles.length)} uncommitted file(s): ${dirtyFiles.slice(0, 20).join(", ")}`),
240
+ details: {
241
+ action: params.action,
242
+ records: [record]
243
+ }
244
+ };
245
+ }
246
+ case WORKTREE_ACTIONS.merge: {
247
+ const record = await operations.merge(context, params.id, ...params.message === void 0 ? [] : [params.message]);
248
+ return {
249
+ content: text(`Merged ${record.branch} into this checkout.`),
250
+ details: {
251
+ action: params.action,
252
+ records: [record]
253
+ }
254
+ };
255
+ }
256
+ case WORKTREE_ACTIONS.send:
257
+ await operations.send(context, params.id, params.message);
258
+ return {
259
+ content: text(`Message sent to worktree ${params.id}.`),
260
+ details: { action: params.action }
261
+ };
262
+ case WORKTREE_ACTIONS.messages: {
263
+ const waiting = await operations.messages(context, params.id);
264
+ return {
265
+ content: waiting.length === 0 ? text("No messages.") : text(`${String(waiting.length)} message(s):`, ...waiting.map((entry) => `[${entry.sentAt}] ${entry.from}: ${entry.text}`)),
266
+ details: { action: params.action }
267
+ };
268
+ }
269
+ case WORKTREE_ACTIONS.prune: {
270
+ const dryRun = params.dryRun ?? false;
271
+ const plan = await operations.prune(context, dryRun);
272
+ return {
273
+ content: text(...[
274
+ dryRun ? "Prune plan (nothing was changed):" : "Pruned:",
275
+ `Remove: ${plan.remove.length === 0 ? "none" : plan.remove.map((record) => record.id).join(", ")}`,
276
+ `Forget: ${plan.forget.length === 0 ? "none" : plan.forget.map((record) => record.id).join(", ")}`,
277
+ `Kept, uncommitted work: ${plan.keptDirty.length === 0 ? "none" : plan.keptDirty.map((record) => record.id).join(", ")}`,
278
+ `Untracked directories, left alone: ${plan.untracked.length === 0 ? "none" : plan.untracked.join(", ")}`,
279
+ ...plan.keptBranches.length === 0 ? [] : [`Branches kept, they hold commits: ${plan.keptBranches.join(", ")}`]
280
+ ]),
281
+ details: { action: params.action }
282
+ };
283
+ }
284
+ }
285
+ }
286
+ //#endregion
287
+ Object.defineProperty(exports, "RUN_WORKTREE_DESCRIPTION", {
288
+ enumerable: true,
289
+ get: function() {
290
+ return RUN_WORKTREE_DESCRIPTION;
291
+ }
292
+ });
293
+ Object.defineProperty(exports, "RUN_WORKTREE_TOOL_NAME", {
294
+ enumerable: true,
295
+ get: function() {
296
+ return RUN_WORKTREE_TOOL_NAME;
297
+ }
298
+ });
299
+ Object.defineProperty(exports, "RunWorktreeToolSchema", {
300
+ enumerable: true,
301
+ get: function() {
302
+ return RunWorktreeToolSchema;
303
+ }
304
+ });
305
+ Object.defineProperty(exports, "executeRunWorktreeTool", {
306
+ enumerable: true,
307
+ get: function() {
308
+ return executeRunWorktreeTool;
309
+ }
310
+ });
311
+ Object.defineProperty(exports, "validateParams", {
312
+ enumerable: true,
313
+ get: function() {
314
+ return validateParams;
315
+ }
316
+ });
317
+
318
+ //# sourceMappingURL=runWorktree-B6ikYRrG.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runWorktree-B6ikYRrG.cjs","names":["Type","invalidRequest"],"sources":["../src/schemas/runWorktreeTool.ts","../src/services/runWorktree/index.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\n/**\n * The tool's action vocabulary.\n *\n * One tool with an action field rather than six tools, matching `subagent`:\n * the actions share a subject and are meaningless apart from it, and six\n * separate tools would spend six description budgets teaching the same nouns.\n */\nexport const WORKTREE_ACTIONS = {\n spawn_worktree: 'spawn_worktree',\n close_worktree: 'close_worktree',\n list: 'list',\n status: 'status',\n merge: 'merge',\n prune: 'prune',\n send: 'send',\n messages: 'messages',\n} as const;\n\nexport type WorktreeAction = (typeof WORKTREE_ACTIONS)[keyof typeof WORKTREE_ACTIONS];\n\n/**\n * Which fields each action accepts.\n *\n * Rejecting an unknown field is what stops a plausible-looking call from doing\n * something other than what it reads like: `close_worktree` with `branch`\n * instead of `id` would otherwise close whatever the default resolved to.\n */\nexport const WORKTREE_ACTION_FIELDS: Record<WorktreeAction, readonly string[]> = {\n spawn_worktree: ['action', 'branch', 'baseRef', 'task', 'name'],\n close_worktree: ['action', 'id', 'force'],\n list: ['action'],\n status: ['action', 'id'],\n merge: ['action', 'id', 'message'],\n prune: ['action', 'dryRun'],\n send: ['action', 'id', 'message'],\n messages: ['action', 'id'],\n};\n\nconst SpawnParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.spawn_worktree),\n branch: Type.String({ minLength: 1 }),\n baseRef: Type.Optional(Type.String({ minLength: 1 })),\n task: Type.Optional(Type.String({ minLength: 1 })),\n name: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst CloseParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.close_worktree),\n id: Type.String({ minLength: 1 }),\n force: Type.Optional(Type.Boolean()),\n },\n { additionalProperties: false },\n);\n\nconst ListParams = Type.Object({ action: Type.Literal(WORKTREE_ACTIONS.list) }, { additionalProperties: false });\n\nconst StatusParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.status), id: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\n\nconst MergeParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.merge),\n id: Type.String({ minLength: 1 }),\n message: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst PruneParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.prune), dryRun: Type.Optional(Type.Boolean()) },\n { additionalProperties: false },\n);\n\nconst SendParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.send),\n id: Type.String({ minLength: 1 }),\n message: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nconst MessagesParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.messages), id: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\n\nexport const RunWorktreeParams = Type.Union([\n SpawnParams,\n CloseParams,\n ListParams,\n StatusParams,\n MergeParams,\n PruneParams,\n SendParams,\n MessagesParams,\n]);\n\n/** The actions that accept `field`, so the declared docs cannot drift from the validator. */\nfunction acceptingActions(field: string): string {\n return Object.values(WORKTREE_ACTIONS)\n .filter((action) => WORKTREE_ACTION_FIELDS[action].includes(field))\n .join(', ');\n}\n\n/**\n * The schema declared to the model.\n *\n * A flat object rather than `RunWorktreeParams` itself. A top-level union is\n * `{anyOf:[...]}` with no `properties`, and Pi's Anthropic Messages adapter\n * rebuilds tool input as `{type:'object', properties: schema.properties ?? {},\n * required: schema.required ?? []}`, so the union arrived at the model as an\n * empty object while the host went on validating calls against it. Nothing here\n * relaxes what is accepted: `validateParams` still rejects an unknown action, a\n * field the action does not take, and a missing required one.\n */\nexport const RunWorktreeToolSchema = Type.Object(\n {\n action: Type.String({\n enum: Object.values(WORKTREE_ACTIONS),\n description: 'The operation to run. Every other field is accepted only by the actions its description names.',\n }),\n branch: Type.Optional(\n Type.String({ minLength: 1, description: `New branch to create. Actions: ${acceptingActions('branch')}.` }),\n ),\n baseRef: Type.Optional(\n Type.String({\n minLength: 1,\n description: `Base ref, defaulting to the current branch. Actions: ${acceptingActions('baseRef')}.`,\n }),\n ),\n task: Type.Optional(\n Type.String({\n minLength: 1,\n description: `First message for the new session. Actions: ${acceptingActions('task')}.`,\n }),\n ),\n name: Type.Optional(\n Type.String({ minLength: 1, description: `Rail label for the worktree. Actions: ${acceptingActions('name')}.` }),\n ),\n id: Type.Optional(Type.String({ minLength: 1, description: `Worktree id. Actions: ${acceptingActions('id')}.` })),\n force: Type.Optional(\n Type.Boolean({ description: `Close even when the tree is dirty. Actions: ${acceptingActions('force')}.` }),\n ),\n message: Type.Optional(\n Type.String({\n minLength: 1,\n description: `Merge commit message, or the text to send. Actions: ${acceptingActions('message')}.`,\n }),\n ),\n dryRun: Type.Optional(\n Type.Boolean({\n description: `Report the plan without destroying anything. Actions: ${acceptingActions('dryRun')}.`,\n }),\n ),\n },\n { additionalProperties: false },\n);\n\nexport type RunWorktreeToolParams = Static<typeof RunWorktreeParams>;\n","import {\n RunWorktreeParams,\n WORKTREE_ACTION_FIELDS,\n WORKTREE_ACTIONS,\n type WorktreeAction,\n type RunWorktreeToolParams,\n} from '../../schemas/runWorktreeTool';\nimport type { WorktreeRecord } from '../../types/worktreeRegistry';\nimport { invalidRequest } from '../errors';\nimport type { WorktreeOperations } from '../worktreeOperations';\n\nexport { RunWorktreeParams };\nexport type { RunWorktreeToolParams, WorktreeAction };\n\nexport const RUN_WORKTREE_TOOL_NAME = 'run_worktree';\n\nconst IMPLEMENTED_ACTIONS: ReadonlySet<string> = new Set(Object.values(WORKTREE_ACTIONS));\n\nexport const RUN_WORKTREE_DESCRIPTION = `Create and manage git worktrees, each with its own DoomPi session nested under this one.\n\nActions:\n- spawn_worktree: create a worktree on a new branch and start a session in it. Requires 'branch'. Optional 'baseRef' (defaults to the current branch's remote-tracking ref, then the remote default branch), 'name' for the rail, 'task' as the first message.\n- close_worktree: stop a worktree's session, delete its checkout, and remove its generated sync storage. Requires 'id'. Refuses a dirty tree unless 'force' is true.\n- list: every worktree for this repository, with status.\n- status: one worktree and its uncommitted files. Requires 'id'.\n- merge: merge a worktree's branch into this checkout. Requires 'id'. Refuses when this checkout is dirty.\n- prune: remove orphaned worktrees and their generated sync storage. Pass 'dryRun' to see the plan without destroying anything.\n- send: send a message to the other side of a worktree. Requires 'id' and 'message'.\n- messages: read messages waiting for you from a worktree. Requires 'id'.\n\nWorktrees live outside the repository, under ~/.pi/.doom/git/worktrees.`;\n\nexport interface RunWorktreeToolDetails {\n action: WorktreeAction;\n records?: WorktreeRecord[];\n}\n\nexport interface RunWorktreeToolResult {\n content: [{ type: 'text'; text: string }];\n details: RunWorktreeToolDetails;\n}\n\nexport interface RunWorktreeExecutionContext {\n readonly cwd: string;\n readonly sessionId: string;\n}\n\nexport interface RunWorktreeExecutionOptions {\n readonly signal?: AbortSignal;\n readonly onProgress?: (label: string) => void;\n}\n\n/** Rejects calls that do not match one documented action shape. */\nexport function validateParams(input: unknown): RunWorktreeToolParams {\n if (typeof input !== 'object' || input === null || Array.isArray(input)) {\n throw invalidRequest('run_worktree parameters must be an object.', 'Call it with one documented action shape.');\n }\n const record = input as Record<string, unknown>;\n const action = record.action;\n if (typeof action !== 'string' || !IMPLEMENTED_ACTIONS.has(action)) {\n throw invalidRequest(\n `Unknown action ${typeof action === 'string' ? `'${action}'` : 'value'}.`,\n `Use one of: ${[...IMPLEMENTED_ACTIONS].join(', ')}.`,\n );\n }\n const allowed = WORKTREE_ACTION_FIELDS[action as WorktreeAction];\n const unexpected = Object.keys(record).filter((key) => !allowed.includes(key));\n if (unexpected.length > 0) {\n throw invalidRequest(\n `action='${action}' does not accept: ${unexpected.join(', ')}.`,\n `Fields for '${action}': ${allowed.join(', ')}.`,\n );\n }\n for (const field of ['branch', 'id'] as const) {\n if (allowed.includes(field) && field in record) {\n const value = record[field];\n if (typeof value !== 'string' || value.trim() === '') {\n throw invalidRequest(`action='${action}' requires a nonblank '${field}'.`, `Pass a ${field}.`);\n }\n }\n }\n const stringFields = ['baseRef', 'name', 'task', 'message'] as const;\n for (const field of stringFields) {\n if (field in record && (typeof record[field] !== 'string' || record[field].trim() === '')) {\n throw invalidRequest(`action='${action}' requires a nonblank '${field}'.`, `Pass a ${field}.`);\n }\n }\n for (const field of ['force', 'dryRun'] as const) {\n if (field in record && typeof record[field] !== 'boolean') {\n throw invalidRequest(`action='${action}' requires boolean '${field}'.`, `Pass true or false for ${field}.`);\n }\n }\n if (action === WORKTREE_ACTIONS.send && typeof record.message !== 'string') {\n throw invalidRequest(\"action='send' requires 'message'.\", 'Pass the message to send.');\n }\n if (action === WORKTREE_ACTIONS.spawn_worktree && typeof record.branch !== 'string') {\n throw invalidRequest(\"action='spawn_worktree' requires 'branch'.\", 'Name the branch to create.');\n }\n if (\n (action === WORKTREE_ACTIONS.close_worktree ||\n action === WORKTREE_ACTIONS.status ||\n action === WORKTREE_ACTIONS.merge ||\n action === WORKTREE_ACTIONS.send ||\n action === WORKTREE_ACTIONS.messages) &&\n typeof record.id !== 'string'\n ) {\n throw invalidRequest(`action='${action}' requires 'id'.`, 'Call list to see the current ids.');\n }\n return record as RunWorktreeToolParams;\n}\n\nfunction describe(record: WorktreeRecord): string {\n return `${record.id} ${record.branch} ${record.status} ${record.path}`;\n}\n\nfunction text(...lines: readonly string[]): [{ type: 'text'; text: string }] {\n return [{ type: 'text', text: lines.join('\\n') }];\n}\n\nexport async function executeRunWorktreeTool(\n params: RunWorktreeToolParams,\n operations: WorktreeOperations,\n context: RunWorktreeExecutionContext,\n options: RunWorktreeExecutionOptions = {},\n): Promise<RunWorktreeToolResult> {\n switch (params.action) {\n case WORKTREE_ACTIONS.spawn_worktree: {\n const record = await operations.spawn(\n context,\n {\n branch: params.branch,\n ...(params.baseRef === undefined ? {} : { baseRef: params.baseRef }),\n ...(params.name === undefined ? {} : { name: params.name }),\n ...(params.task === undefined ? {} : { task: params.task }),\n },\n options,\n );\n return {\n content: text(\n `Worktree ${record.id} created on ${record.branch} from ${record.baseRef}.`,\n `Path: ${record.path}`,\n params.task === undefined\n ? `Session ${record.sessionId} is starting; it appears nested under this one in the rail.`\n : `Session ${record.sessionId} is starting with its task; it appears nested under this one in the rail.`,\n ),\n details: { action: params.action, records: [record] },\n };\n }\n case WORKTREE_ACTIONS.close_worktree: {\n const record = await operations.close(context, params.id, params.force ?? false);\n return {\n content: text(`Worktree ${record.id} (${record.branch}) closed and removed.`),\n details: { action: params.action, records: [record] },\n };\n }\n case WORKTREE_ACTIONS.list: {\n const records = await operations.list(context);\n return {\n content:\n records.length === 0\n ? text('No worktrees for this repository.')\n : text(`${String(records.length)} worktree(s):`, ...records.map(describe)),\n details: { action: params.action, records },\n };\n }\n case WORKTREE_ACTIONS.status: {\n const { record, dirtyFiles } = await operations.status(context, params.id);\n return {\n content: text(\n describe(record),\n `Session: ${record.sessionId}`,\n dirtyFiles.length === 0\n ? 'Clean.'\n : `${String(dirtyFiles.length)} uncommitted file(s): ${dirtyFiles.slice(0, 20).join(', ')}`,\n ),\n details: { action: params.action, records: [record] },\n };\n }\n case WORKTREE_ACTIONS.merge: {\n const record = await operations.merge(\n context,\n params.id,\n ...(params.message === undefined ? [] : ([params.message] as const)),\n );\n return {\n content: text(`Merged ${record.branch} into this checkout.`),\n details: { action: params.action, records: [record] },\n };\n }\n case WORKTREE_ACTIONS.send: {\n await operations.send(context, params.id, params.message);\n return { content: text(`Message sent to worktree ${params.id}.`), details: { action: params.action } };\n }\n case WORKTREE_ACTIONS.messages: {\n const waiting = await operations.messages(context, params.id);\n return {\n content:\n waiting.length === 0\n ? text('No messages.')\n : text(\n `${String(waiting.length)} message(s):`,\n ...waiting.map((entry) => `[${entry.sentAt}] ${entry.from}: ${entry.text}`),\n ),\n details: { action: params.action },\n };\n }\n case WORKTREE_ACTIONS.prune: {\n const dryRun = params.dryRun ?? false;\n const plan = await operations.prune(context, dryRun);\n const lines = [\n dryRun ? 'Prune plan (nothing was changed):' : 'Pruned:',\n `Remove: ${plan.remove.length === 0 ? 'none' : plan.remove.map((record) => record.id).join(', ')}`,\n `Forget: ${plan.forget.length === 0 ? 'none' : plan.forget.map((record) => record.id).join(', ')}`,\n `Kept, uncommitted work: ${plan.keptDirty.length === 0 ? 'none' : plan.keptDirty.map((record) => record.id).join(', ')}`,\n `Untracked directories, left alone: ${plan.untracked.length === 0 ? 'none' : plan.untracked.join(', ')}`,\n ...(plan.keptBranches.length === 0\n ? []\n : [`Branches kept, they hold commits: ${plan.keptBranches.join(', ')}`]),\n ];\n return { content: text(...lines), details: { action: params.action } };\n }\n }\n}\n"],"mappings":";;;;;;;;;;AASA,MAAa,mBAAmB;CAC9B,gBAAgB;CAChB,gBAAgB;CAChB,MAAM;CACN,QAAQ;CACR,OAAO;CACP,OAAO;CACP,MAAM;CACN,UAAU;AACZ;;;;;;;;AAWA,MAAa,yBAAoE;CAC/E,gBAAgB;EAAC;EAAU;EAAU;EAAW;EAAQ;CAAM;CAC9D,gBAAgB;EAAC;EAAU;EAAM;CAAO;CACxC,MAAM,CAAC,QAAQ;CACf,QAAQ,CAAC,UAAU,IAAI;CACvB,OAAO;EAAC;EAAU;EAAM;CAAS;CACjC,OAAO,CAAC,UAAU,QAAQ;CAC1B,MAAM;EAAC;EAAU;EAAM;CAAS;CAChC,UAAU,CAAC,UAAU,IAAI;AAC3B;AAEA,MAAM,cAAcA,QAAAA,KAAK,OACvB;CACE,QAAQA,QAAAA,KAAK,QAAQ,iBAAiB,cAAc;CACpD,QAAQA,QAAAA,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;CACpC,SAASA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;CACpD,MAAMA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;CACjD,MAAMA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;AACnD,GACA,EAAE,sBAAsB,MAAM,CAChC;AAEA,MAAM,cAAcA,QAAAA,KAAK,OACvB;CACE,QAAQA,QAAAA,KAAK,QAAQ,iBAAiB,cAAc;CAC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