@oh-my-pi/pi-coding-agent 17.2.11 → 17.2.12

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 (152) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/{CHANGELOG-d9xenpn9.md → CHANGELOG-k9ghy5sn.md} +13 -0
  3. package/dist/cli.js +10795 -10791
  4. package/dist/types/advisor/runtime.d.ts +1 -1
  5. package/dist/types/config/custom-models.d.ts +31 -0
  6. package/dist/types/config/model-config-values.d.ts +19 -0
  7. package/dist/types/config/model-patch.d.ts +93 -0
  8. package/dist/types/config/model-provider-discovery.d.ts +51 -0
  9. package/dist/types/config/model-registry.d.ts +5 -52
  10. package/dist/types/config/settings.d.ts +5 -3
  11. package/dist/types/debug/raw-sse-buffer.d.ts +9 -0
  12. package/dist/types/discovery/agent-plugin-format.d.ts +6 -13
  13. package/dist/types/discovery/contained-path.d.ts +2 -3
  14. package/dist/types/eval/executor-base.d.ts +8 -2
  15. package/dist/types/eval/kernel-session-registry.d.ts +60 -0
  16. package/dist/types/export/share.d.ts +1 -1
  17. package/dist/types/lsp/diagnostics.d.ts +96 -0
  18. package/dist/types/lsp/index.d.ts +7 -128
  19. package/dist/types/lsp/servers.d.ts +72 -0
  20. package/dist/types/lsp/tool.d.ts +42 -0
  21. package/dist/types/lsp/workspace-diagnostics.d.ts +12 -0
  22. package/dist/types/lsp/writethrough.d.ts +33 -0
  23. package/dist/types/mcp/transports/header-policy.d.ts +2 -1
  24. package/dist/types/modes/components/agent-hub-projection.d.ts +2 -7
  25. package/dist/types/modes/components/agent-hub-renderer.d.ts +0 -7
  26. package/dist/types/modes/theme/color.d.ts +19 -0
  27. package/dist/types/modes/theme/loader.d.ts +19 -0
  28. package/dist/types/modes/theme/schema.d.ts +175 -0
  29. package/dist/types/modes/theme/symbols.d.ts +28 -0
  30. package/dist/types/modes/theme/theme-class.d.ts +244 -0
  31. package/dist/types/modes/theme/theme.d.ts +9 -280
  32. package/dist/types/modes/theme/tui-adapters.d.ts +13 -0
  33. package/dist/types/registry/agent-registry.d.ts +1 -3
  34. package/dist/types/secrets/index.d.ts +3 -1
  35. package/dist/types/secrets/message-transform.d.ts +40 -0
  36. package/dist/types/secrets/obfuscator.d.ts +0 -108
  37. package/dist/types/secrets/placeholder-scan.d.ts +95 -0
  38. package/dist/types/secrets/placeholder.d.ts +94 -0
  39. package/dist/types/secrets/replacement.d.ts +82 -0
  40. package/dist/types/session/agent-session-types.d.ts +6 -0
  41. package/dist/types/session/agent-session.d.ts +1 -1
  42. package/dist/types/session/session-handoff.d.ts +3 -3
  43. package/dist/types/session/session-manager.d.ts +32 -0
  44. package/dist/types/session/session-provider-boundary.d.ts +1 -1
  45. package/dist/types/session/turn-recovery.d.ts +2 -2
  46. package/dist/types/slash-commands/builtin-collaboration.d.ts +2 -0
  47. package/dist/types/slash-commands/builtin-completions.d.ts +36 -0
  48. package/dist/types/slash-commands/builtin-control.d.ts +2 -0
  49. package/dist/types/slash-commands/builtin-lifecycle.d.ts +3 -0
  50. package/dist/types/slash-commands/builtin-marketplace.d.ts +11 -0
  51. package/dist/types/slash-commands/builtin-modes.d.ts +5 -0
  52. package/dist/types/slash-commands/builtin-registry.d.ts +1 -1
  53. package/dist/types/slash-commands/builtin-session.d.ts +2 -0
  54. package/dist/types/tools/gh-common.d.ts +69 -0
  55. package/dist/types/tools/gh-pr-checkout.d.ts +84 -0
  56. package/dist/types/tools/gh-pr-diff.d.ts +102 -0
  57. package/dist/types/tools/gh-run-watch.d.ts +78 -0
  58. package/dist/types/tools/gh-search.d.ts +61 -0
  59. package/dist/types/tools/gh-types.d.ts +340 -0
  60. package/dist/types/tools/gh-view.d.ts +88 -0
  61. package/dist/types/tools/gh.d.ts +4 -201
  62. package/dist/types/tools/read-archive.d.ts +16 -0
  63. package/dist/types/tools/read-format.d.ts +104 -0
  64. package/dist/types/tools/read-path-resolution.d.ts +19 -0
  65. package/dist/types/tools/read-pdf-images.d.ts +12 -0
  66. package/dist/types/tools/read-renderer.d.ts +24 -0
  67. package/dist/types/tools/read-selector.d.ts +27 -0
  68. package/dist/types/tools/read-sqlite.d.ts +16 -0
  69. package/dist/types/tools/read-summary.d.ts +19 -0
  70. package/dist/types/tools/read.d.ts +1 -23
  71. package/dist/types/tools/shell-tokenize.d.ts +2 -1
  72. package/dist/types/utils/changelog.d.ts +0 -5
  73. package/package.json +13 -13
  74. package/src/advisor/runtime.ts +12 -7
  75. package/src/config/custom-models.ts +188 -0
  76. package/src/config/model-config-values.ts +128 -0
  77. package/src/config/model-patch.ts +252 -0
  78. package/src/config/model-provider-discovery.ts +132 -0
  79. package/src/config/model-registry.ts +64 -704
  80. package/src/config/settings.ts +7 -3
  81. package/src/debug/raw-sse-buffer.ts +20 -0
  82. package/src/discovery/agent-plugin-format.ts +7 -7
  83. package/src/discovery/contained-path.ts +2 -5
  84. package/src/edit/hashline/diff.ts +5 -1
  85. package/src/eval/executor-base.ts +39 -6
  86. package/src/eval/jl/executor.ts +82 -371
  87. package/src/eval/kernel-session-registry.ts +398 -0
  88. package/src/eval/py/executor.ts +53 -261
  89. package/src/eval/rb/executor.ts +36 -279
  90. package/src/export/share.ts +2 -1
  91. package/src/lsp/diagnostics.ts +516 -0
  92. package/src/lsp/index.ts +20 -2819
  93. package/src/lsp/servers.ts +296 -0
  94. package/src/lsp/tool.ts +1352 -0
  95. package/src/lsp/workspace-diagnostics.ts +170 -0
  96. package/src/lsp/writethrough.ts +561 -0
  97. package/src/mcp/transports/header-policy.ts +1 -1
  98. package/src/modes/components/agent-hub-projection.ts +2 -2
  99. package/src/modes/components/agent-hub-renderer.ts +3 -7
  100. package/src/modes/controllers/command-controller.ts +4 -1
  101. package/src/modes/theme/color.ts +133 -0
  102. package/src/modes/theme/loader.ts +178 -0
  103. package/src/modes/theme/schema.ts +263 -0
  104. package/src/modes/theme/symbols.ts +1000 -0
  105. package/src/modes/theme/theme-class.ts +611 -0
  106. package/src/modes/theme/theme.ts +27 -2453
  107. package/src/modes/theme/tui-adapters.ts +279 -0
  108. package/src/registry/agent-registry.ts +2 -2
  109. package/src/secrets/index.ts +6 -12
  110. package/src/secrets/message-transform.ts +287 -0
  111. package/src/secrets/obfuscator.ts +39 -1303
  112. package/src/secrets/placeholder-scan.ts +506 -0
  113. package/src/secrets/placeholder.ts +309 -0
  114. package/src/secrets/replacement.ts +216 -0
  115. package/src/session/agent-session-types.ts +6 -0
  116. package/src/session/agent-session.ts +113 -7
  117. package/src/session/indexed-session-storage.ts +7 -2
  118. package/src/session/session-advisors.ts +32 -34
  119. package/src/session/session-handoff.ts +39 -20
  120. package/src/session/session-manager.ts +67 -3
  121. package/src/session/session-provider-boundary.ts +3 -6
  122. package/src/session/turn-recovery.ts +21 -12
  123. package/src/slash-commands/builtin-collaboration.ts +504 -0
  124. package/src/slash-commands/builtin-completions.ts +291 -0
  125. package/src/slash-commands/builtin-control.ts +78 -0
  126. package/src/slash-commands/builtin-lifecycle.ts +506 -0
  127. package/src/slash-commands/builtin-marketplace.ts +567 -0
  128. package/src/slash-commands/builtin-modes.ts +518 -0
  129. package/src/slash-commands/builtin-registry.ts +21 -3000
  130. package/src/slash-commands/builtin-session.ts +592 -0
  131. package/src/task/executor.ts +17 -14
  132. package/src/tools/gh-common.ts +288 -0
  133. package/src/tools/gh-pr-checkout.ts +679 -0
  134. package/src/tools/gh-pr-diff.ts +473 -0
  135. package/src/tools/gh-run-watch.ts +1015 -0
  136. package/src/tools/gh-search.ts +500 -0
  137. package/src/tools/gh-types.ts +379 -0
  138. package/src/tools/gh-view.ts +612 -0
  139. package/src/tools/gh.ts +109 -3821
  140. package/src/tools/read-archive.ts +209 -0
  141. package/src/tools/read-format.ts +593 -0
  142. package/src/tools/read-path-resolution.ts +36 -0
  143. package/src/tools/read-pdf-images.ts +250 -0
  144. package/src/tools/read-renderer.ts +289 -0
  145. package/src/tools/read-selector.ts +84 -0
  146. package/src/tools/read-sqlite.ts +215 -0
  147. package/src/tools/read-summary.ts +199 -0
  148. package/src/tools/read.ts +77 -1820
  149. package/src/tools/shell-tokenize.ts +1 -1
  150. package/src/utils/changelog.ts +1 -1
  151. package/src/utils/title-generator.ts +3 -1
  152. package/src/web/search/providers/zai.ts +12 -3
@@ -0,0 +1,340 @@
1
+ export interface GithubInput {
2
+ op: "repo_view" | "file_read" | "pr_create" | "pr_checkout" | "pr_push" | "search_issues" | "search_prs" | "search_code" | "search_commits" | "search_repos" | "run_watch";
3
+ repo?: string;
4
+ branch?: string;
5
+ path?: string;
6
+ pr?: string | string[];
7
+ force?: boolean;
8
+ forceWithLease?: boolean;
9
+ title?: string;
10
+ body?: string;
11
+ base?: string;
12
+ head?: string;
13
+ draft?: boolean;
14
+ fill?: boolean;
15
+ reviewer?: string[];
16
+ assignee?: string[];
17
+ label?: string[];
18
+ query?: string;
19
+ since?: string;
20
+ until?: string;
21
+ dateField?: "created" | "updated";
22
+ limit?: number;
23
+ run?: string;
24
+ tail?: number;
25
+ }
26
+ export interface GhApiSearchResponse<T> {
27
+ total_count?: number;
28
+ incomplete_results?: boolean;
29
+ items?: T[];
30
+ }
31
+ export interface GhApiUser {
32
+ login?: string;
33
+ name?: string | null;
34
+ }
35
+ export interface GhApiLabel {
36
+ name?: string;
37
+ }
38
+ export interface GhApiPullRequestRef {
39
+ merged_at?: string | null;
40
+ }
41
+ export interface GhApiSearchIssueItem {
42
+ number?: number;
43
+ title?: string;
44
+ state?: string;
45
+ state_reason?: string | null;
46
+ user?: GhApiUser | null;
47
+ labels?: GhApiLabel[];
48
+ created_at?: string;
49
+ updated_at?: string;
50
+ html_url?: string;
51
+ repository_url?: string;
52
+ pull_request?: GhApiPullRequestRef | null;
53
+ }
54
+ export interface GhApiSearchCodeItem {
55
+ name?: string;
56
+ path?: string;
57
+ sha?: string;
58
+ html_url?: string;
59
+ repository?: {
60
+ full_name?: string;
61
+ } | null;
62
+ text_matches?: Array<{
63
+ fragment?: string;
64
+ property?: string;
65
+ }>;
66
+ }
67
+ export interface GhApiSearchCommitGitActor {
68
+ name?: string;
69
+ email?: string;
70
+ date?: string;
71
+ }
72
+ export interface GhApiSearchCommitItem {
73
+ sha?: string;
74
+ node_id?: string;
75
+ html_url?: string;
76
+ author?: GhApiUser | null;
77
+ committer?: GhApiUser | null;
78
+ commit?: {
79
+ author?: GhApiSearchCommitGitActor | null;
80
+ committer?: GhApiSearchCommitGitActor | null;
81
+ message?: string;
82
+ } | null;
83
+ repository?: {
84
+ full_name?: string;
85
+ } | null;
86
+ }
87
+ export interface GhApiSearchRepoItem {
88
+ full_name?: string;
89
+ description?: string | null;
90
+ language?: string | null;
91
+ stargazers_count?: number;
92
+ forks_count?: number;
93
+ open_issues_count?: number;
94
+ archived?: boolean;
95
+ fork?: boolean;
96
+ private?: boolean;
97
+ visibility?: string | null;
98
+ updated_at?: string;
99
+ created_at?: string;
100
+ html_url?: string;
101
+ owner?: GhApiUser | null;
102
+ }
103
+ export interface GhUser {
104
+ login?: string;
105
+ name?: string | null;
106
+ }
107
+ export interface GhLabel {
108
+ name?: string;
109
+ }
110
+ export interface GhComment {
111
+ author?: GhUser | null;
112
+ body?: string;
113
+ createdAt?: string;
114
+ url?: string;
115
+ isMinimized?: boolean;
116
+ minimizedReason?: string | null;
117
+ }
118
+ export interface GhRepoTopic {
119
+ name?: string;
120
+ topic?: {
121
+ name?: string;
122
+ };
123
+ }
124
+ export interface GhRepoLanguage {
125
+ name?: string;
126
+ }
127
+ export interface GhRepoBranch {
128
+ name?: string;
129
+ }
130
+ export interface GhRepoViewData {
131
+ nameWithOwner?: string;
132
+ description?: string | null;
133
+ url?: string;
134
+ sshUrl?: string;
135
+ defaultBranchRef?: GhRepoBranch | null;
136
+ homepageUrl?: string | null;
137
+ forkCount?: number;
138
+ isArchived?: boolean;
139
+ isFork?: boolean;
140
+ primaryLanguage?: GhRepoLanguage | null;
141
+ repositoryTopics?: GhRepoTopic[];
142
+ stargazerCount?: number;
143
+ updatedAt?: string;
144
+ viewerPermission?: string | null;
145
+ visibility?: string | null;
146
+ }
147
+ export interface GhIssueViewData {
148
+ author?: GhUser | null;
149
+ body?: string | null;
150
+ comments?: GhComment[];
151
+ createdAt?: string;
152
+ labels?: GhLabel[];
153
+ number?: number;
154
+ state?: string;
155
+ stateReason?: string | null;
156
+ title?: string;
157
+ updatedAt?: string;
158
+ url?: string;
159
+ }
160
+ export interface GhPrFile {
161
+ path?: string;
162
+ additions?: number;
163
+ deletions?: number;
164
+ changeType?: string;
165
+ }
166
+ export interface GhPrViewData extends GhIssueViewData {
167
+ baseRefName?: string;
168
+ files?: GhPrFile[];
169
+ headRefName?: string;
170
+ headRefOid?: string;
171
+ headRepository?: GhRepoViewData | null;
172
+ headRepositoryOwner?: GhUser | null;
173
+ isCrossRepository?: boolean;
174
+ isDraft?: boolean;
175
+ maintainerCanModify?: boolean;
176
+ mergeStateStatus?: string;
177
+ reviewComments?: GhPrReviewComment[];
178
+ reviews?: GhPrReview[];
179
+ reviewDecision?: string;
180
+ }
181
+ export interface GhPrReviewCommit {
182
+ oid?: string | null;
183
+ }
184
+ export interface GhPrReview {
185
+ author?: GhUser | null;
186
+ body?: string | null;
187
+ commit?: GhPrReviewCommit | null;
188
+ state?: string | null;
189
+ submittedAt?: string | null;
190
+ }
191
+ export interface GhPrReviewCommentApi {
192
+ body?: string | null;
193
+ created_at?: string | null;
194
+ html_url?: string | null;
195
+ id?: number;
196
+ in_reply_to_id?: number | null;
197
+ line?: number | null;
198
+ original_line?: number | null;
199
+ path?: string | null;
200
+ side?: string | null;
201
+ user?: GhUser | null;
202
+ }
203
+ export interface GhPrReviewComment {
204
+ author?: GhUser | null;
205
+ body?: string | null;
206
+ createdAt?: string;
207
+ id: number;
208
+ inReplyToId?: number;
209
+ line?: number;
210
+ originalLine?: number;
211
+ path?: string;
212
+ side?: string;
213
+ url?: string;
214
+ }
215
+ export interface GhBranchApiResponse {
216
+ commit?: {
217
+ sha?: string | null;
218
+ } | null;
219
+ }
220
+ export interface GhSearchRepository {
221
+ nameWithOwner?: string;
222
+ }
223
+ export interface GhSearchResult {
224
+ author?: GhUser | null;
225
+ createdAt?: string;
226
+ labels?: GhLabel[];
227
+ number?: number;
228
+ repository?: GhSearchRepository | null;
229
+ state?: string;
230
+ title?: string;
231
+ updatedAt?: string;
232
+ url?: string;
233
+ }
234
+ export interface GhSearchCodeTextMatch {
235
+ fragment?: string;
236
+ property?: string;
237
+ }
238
+ export interface GhSearchCodeResult {
239
+ path?: string;
240
+ repository?: GhSearchRepository | null;
241
+ sha?: string;
242
+ textMatches?: GhSearchCodeTextMatch[];
243
+ url?: string;
244
+ }
245
+ export interface GhSearchCommitGitActor {
246
+ name?: string;
247
+ email?: string;
248
+ date?: string;
249
+ }
250
+ export interface GhSearchCommitDetail {
251
+ author?: GhSearchCommitGitActor | null;
252
+ committer?: GhSearchCommitGitActor | null;
253
+ message?: string;
254
+ }
255
+ export interface GhSearchCommitResult {
256
+ author?: GhUser | null;
257
+ commit?: GhSearchCommitDetail | null;
258
+ committer?: GhUser | null;
259
+ id?: string;
260
+ repository?: GhSearchRepository | null;
261
+ sha?: string;
262
+ url?: string;
263
+ }
264
+ export interface GhSearchRepoResult {
265
+ createdAt?: string;
266
+ description?: string | null;
267
+ forksCount?: number;
268
+ fullName?: string;
269
+ isArchived?: boolean;
270
+ isFork?: boolean;
271
+ isPrivate?: boolean;
272
+ language?: string | null;
273
+ openIssuesCount?: number;
274
+ owner?: GhUser | null;
275
+ stargazersCount?: number;
276
+ updatedAt?: string;
277
+ url?: string;
278
+ visibility?: string | null;
279
+ }
280
+ export interface GhRunReference {
281
+ repo?: string;
282
+ runId?: number;
283
+ }
284
+ export interface GhActionsRunListResponse {
285
+ workflow_runs?: GhActionsRunApi[];
286
+ }
287
+ export interface GhActionsRunApi {
288
+ id?: number;
289
+ name?: string | null;
290
+ display_title?: string | null;
291
+ status?: string | null;
292
+ conclusion?: string | null;
293
+ head_branch?: string | null;
294
+ head_sha?: string | null;
295
+ created_at?: string | null;
296
+ updated_at?: string | null;
297
+ html_url?: string | null;
298
+ }
299
+ export interface GhActionsJobsResponse {
300
+ total_count?: number;
301
+ jobs?: GhActionsJobApi[];
302
+ }
303
+ export interface GhActionsJobApi {
304
+ id?: number;
305
+ name?: string | null;
306
+ status?: string | null;
307
+ conclusion?: string | null;
308
+ started_at?: string | null;
309
+ completed_at?: string | null;
310
+ html_url?: string | null;
311
+ }
312
+ export interface GhRunJobSnapshot {
313
+ id: number;
314
+ name: string;
315
+ status?: string;
316
+ conclusion?: string;
317
+ startedAt?: string;
318
+ completedAt?: string;
319
+ url?: string;
320
+ }
321
+ export interface GhRunSnapshot {
322
+ id: number;
323
+ workflowName?: string;
324
+ displayTitle?: string;
325
+ status?: string;
326
+ conclusion?: string;
327
+ branch?: string;
328
+ headSha?: string;
329
+ createdAt?: string;
330
+ updatedAt?: string;
331
+ url?: string;
332
+ jobs: GhRunJobSnapshot[];
333
+ }
334
+ export interface GhFailedJobLog {
335
+ run: GhRunSnapshot;
336
+ job: GhRunJobSnapshot;
337
+ full?: string;
338
+ tail?: string;
339
+ available: boolean;
340
+ }
@@ -0,0 +1,88 @@
1
+ import type { AgentToolResult } from "@oh-my-pi/pi-agent-core";
2
+ import type { Settings } from "../config/settings.js";
3
+ import * as git from "../utils/git.js";
4
+ import type { ToolSession } from "./index.js";
5
+ import type { GhToolDetails } from "./gh.js";
6
+ import type { GhComment, GhIssueViewData, GhPrFile, GhPrReview, GhPrReviewComment, GhPrReviewCommentApi, GhPrViewData, GhRepoViewData, GithubInput } from "./gh-types.js";
7
+ import { type CacheStatus } from "./github-cache.js";
8
+ export declare const GH_REPO_FIELDS: string[];
9
+ export declare const GH_ISSUE_FIELDS: string[];
10
+ export declare const GH_ISSUE_FIELDS_NO_COMMENTS: string[];
11
+ export declare const GH_ISSUE_STATE_REASON_FIELD = "stateReason";
12
+ export declare function ghJsonErrorNamesField(err: unknown, field: string): boolean;
13
+ export declare function dropJsonField(args: readonly string[], field: string): string[] | undefined;
14
+ /** Runs `gh --json` for issue data, retrying without optional stateReason on older gh releases. */
15
+ export declare function githubIssueJsonWithStateReasonFallback<T>(cwd: string, args: readonly string[], signal: AbortSignal | undefined, options?: git.GhCommandOptions): Promise<T>;
16
+ export declare const GH_PR_FIELDS: string[];
17
+ export declare const GH_PR_FIELDS_NO_COMMENTS: string[];
18
+ export declare const GH_REPO_CLONE_FIELDS: string[];
19
+ export declare const REVIEW_COMMENTS_PAGE_SIZE = 100;
20
+ export declare function normalizePrReviewComment(comment: GhPrReviewCommentApi): GhPrReviewComment | null;
21
+ export declare function fetchPrReviewComments(cwd: string, repo: string, prNumber: number, signal?: AbortSignal): Promise<GhPrReviewComment[]>;
22
+ export declare function formatCommentsSection(comments: GhComment[] | undefined): string[];
23
+ export declare function formatReviewsSection(reviews: GhPrReview[] | undefined): string[];
24
+ export declare function formatReviewCommentLocation(comment: GhPrReviewComment): string | undefined;
25
+ export declare function formatReviewCommentsSection(comments: GhPrReviewComment[] | undefined): string[];
26
+ export declare function formatRepoView(data: GhRepoViewData, input: {
27
+ repo?: string;
28
+ branch?: string;
29
+ }): string;
30
+ export declare function formatIssueView(data: GhIssueViewData, input: {
31
+ issue: string;
32
+ repo?: string;
33
+ comments?: boolean;
34
+ }): string;
35
+ export declare function formatPrFiles(files: GhPrFile[] | undefined): string[];
36
+ export declare function formatPrView(data: GhPrViewData, input: {
37
+ pr?: string;
38
+ repo?: string;
39
+ comments?: boolean;
40
+ }): string;
41
+ export declare function executeRepoView(session: ToolSession, params: GithubInput, signal: AbortSignal | undefined): Promise<AgentToolResult<GhToolDetails>>;
42
+ export interface IssueViewLookupOptions {
43
+ cwd: string;
44
+ repo?: string;
45
+ /** Issue number or GitHub issue URL. */
46
+ issue: string;
47
+ includeComments?: boolean;
48
+ signal?: AbortSignal;
49
+ settings?: Settings;
50
+ cacheAuthKey?: string | null;
51
+ }
52
+ export interface PrViewLookupOptions {
53
+ cwd: string;
54
+ repo: string;
55
+ number: number;
56
+ includeComments?: boolean;
57
+ signal?: AbortSignal;
58
+ settings?: Settings;
59
+ cacheAuthKey?: string | null;
60
+ }
61
+ export interface ViewLookupResult<T> {
62
+ rendered: string;
63
+ sourceUrl: string | undefined;
64
+ payload: T;
65
+ status: CacheStatus;
66
+ fetchedAt: number;
67
+ }
68
+ export declare function fetchIssueViewFresh(cwd: string, repo: string | undefined, identifier: string, includeComments: boolean, signal: AbortSignal | undefined): Promise<{
69
+ rendered: string;
70
+ sourceUrl: string | undefined;
71
+ payload: GhIssueViewData;
72
+ }>;
73
+ export declare function fetchPrViewFresh(cwd: string, repo: string, number: number, includeComments: boolean, signal: AbortSignal | undefined): Promise<{
74
+ rendered: string;
75
+ sourceUrl: string | undefined;
76
+ payload: GhPrViewData;
77
+ }>;
78
+ /**
79
+ * Cache-aware issue/view fetcher. Used by both the `github` tool op and the
80
+ * `issue://` protocol handler so a single shared row services both surfaces.
81
+ */
82
+ export declare function getOrFetchIssue(options: IssueViewLookupOptions): Promise<ViewLookupResult<GhIssueViewData>>;
83
+ /**
84
+ * Cache-aware PR view fetcher. Caller must supply a numeric PR number;
85
+ * branch-name / current-branch lookups bypass the cache entirely upstream
86
+ * (see `executePrView`).
87
+ */
88
+ export declare function getOrFetchPr(options: PrViewLookupOptions): Promise<ViewLookupResult<GhPrViewData>>;
@@ -1,11 +1,10 @@
1
1
  import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback, ToolApprovalDecision } from "@oh-my-pi/pi-agent-core";
2
- import type { Settings } from "../config/settings.js";
3
- import * as git from "../utils/git.js";
4
2
  import type { ToolSession } from "./index.js";
5
- import { type CacheStatus } from "./github-cache.js";
6
3
  import type { OutputMeta } from "./output-meta.js";
7
- /** Runs `gh --json` for issue data, retrying without optional stateReason on older gh releases. */
8
- export declare function githubIssueJsonWithStateReasonFallback<T>(cwd: string, args: readonly string[], signal: AbortSignal | undefined, options?: git.GhCommandOptions): Promise<T>;
4
+ export { parsePositiveDecimalInt, resolveDefaultRepoMemoized } from "./gh-common.js";
5
+ export { getOrFetchPrDiff, type PrDiffFile, type PrDiffLookupOptions, type PrDiffPayload, parsePrUnifiedDiff, } from "./gh-pr-diff.js";
6
+ export { buildSearchDateQualifier, parseSearchDateBound } from "./gh-search.js";
7
+ export { getOrFetchIssue, getOrFetchPr, githubIssueJsonWithStateReasonFallback, type IssueViewLookupOptions, type PrViewLookupOptions, type ViewLookupResult, } from "./gh-view.js";
9
8
  declare const githubSchema: import("@oh-my-pi/omptype").FluentType<{
10
9
  assignee?: string[] | undefined;
11
10
  base?: string | undefined;
@@ -121,125 +120,6 @@ export interface GhRunWatchViewDetails {
121
120
  runs?: GhRunWatchRunDetails[];
122
121
  failedLogs?: GhRunWatchFailedLogDetails[];
123
122
  }
124
- interface GhUser {
125
- login?: string;
126
- name?: string | null;
127
- }
128
- interface GhLabel {
129
- name?: string;
130
- }
131
- interface GhComment {
132
- author?: GhUser | null;
133
- body?: string;
134
- createdAt?: string;
135
- url?: string;
136
- isMinimized?: boolean;
137
- minimizedReason?: string | null;
138
- }
139
- interface GhRepoTopic {
140
- name?: string;
141
- topic?: {
142
- name?: string;
143
- };
144
- }
145
- interface GhRepoLanguage {
146
- name?: string;
147
- }
148
- interface GhRepoBranch {
149
- name?: string;
150
- }
151
- interface GhRepoViewData {
152
- nameWithOwner?: string;
153
- description?: string | null;
154
- url?: string;
155
- sshUrl?: string;
156
- defaultBranchRef?: GhRepoBranch | null;
157
- homepageUrl?: string | null;
158
- forkCount?: number;
159
- isArchived?: boolean;
160
- isFork?: boolean;
161
- primaryLanguage?: GhRepoLanguage | null;
162
- repositoryTopics?: GhRepoTopic[];
163
- stargazerCount?: number;
164
- updatedAt?: string;
165
- viewerPermission?: string | null;
166
- visibility?: string | null;
167
- }
168
- interface GhIssueViewData {
169
- author?: GhUser | null;
170
- body?: string | null;
171
- comments?: GhComment[];
172
- createdAt?: string;
173
- labels?: GhLabel[];
174
- number?: number;
175
- state?: string;
176
- stateReason?: string | null;
177
- title?: string;
178
- updatedAt?: string;
179
- url?: string;
180
- }
181
- interface GhPrFile {
182
- path?: string;
183
- additions?: number;
184
- deletions?: number;
185
- changeType?: string;
186
- }
187
- interface GhPrViewData extends GhIssueViewData {
188
- baseRefName?: string;
189
- files?: GhPrFile[];
190
- headRefName?: string;
191
- headRefOid?: string;
192
- headRepository?: GhRepoViewData | null;
193
- headRepositoryOwner?: GhUser | null;
194
- isCrossRepository?: boolean;
195
- isDraft?: boolean;
196
- maintainerCanModify?: boolean;
197
- mergeStateStatus?: string;
198
- reviewComments?: GhPrReviewComment[];
199
- reviews?: GhPrReview[];
200
- reviewDecision?: string;
201
- }
202
- interface GhPrReviewCommit {
203
- oid?: string | null;
204
- }
205
- interface GhPrReview {
206
- author?: GhUser | null;
207
- body?: string | null;
208
- commit?: GhPrReviewCommit | null;
209
- state?: string | null;
210
- submittedAt?: string | null;
211
- }
212
- interface GhPrReviewComment {
213
- author?: GhUser | null;
214
- body?: string | null;
215
- createdAt?: string;
216
- id: number;
217
- inReplyToId?: number;
218
- line?: number;
219
- originalLine?: number;
220
- path?: string;
221
- side?: string;
222
- url?: string;
223
- }
224
- /**
225
- * Resolve a search date bound to a GitHub-search-compatible literal. Returns
226
- * either a `YYYY-MM-DD` date (relative durations and date-only inputs) or a
227
- * full ISO 8601 datetime string (datetime inputs), so the caller can drop it
228
- * straight into a qualifier like `created:>=<value>`.
229
- */
230
- export declare function parseSearchDateBound(raw: string, now?: Date): string;
231
- /**
232
- * Build the GitHub-search qualifier (e.g. `created:>=2026-05-09`) for the
233
- * provided bounds, or `undefined` if neither bound is set.
234
- */
235
- export declare function buildSearchDateQualifier(field: string, since: string | undefined, until: string | undefined, now?: Date): string | undefined;
236
- /**
237
- * Parse a digit-only decimal positive integer or return undefined. Rejects
238
- * `1e2`, `0x10`, `12.0`, leading +/-, or any other shape `Number()` would
239
- * accept — those would otherwise key the cache against the wrong row.
240
- */
241
- export declare function parsePositiveDecimalInt(value: string | undefined): number | undefined;
242
- export declare function resolveDefaultRepoMemoized(cwd: string, signal?: AbortSignal): Promise<string>;
243
123
  export declare class GithubTool implements AgentTool<typeof githubSchema, GhToolDetails> {
244
124
  private readonly session;
245
125
  readonly name = "github";
@@ -302,80 +182,3 @@ export declare class GithubTool implements AgentTool<typeof githubSchema, GhTool
302
182
  static createIf(session: ToolSession): GithubTool | null;
303
183
  execute(_toolCallId: string, params: GithubInput, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<GhToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<GhToolDetails>>;
304
184
  }
305
- export interface IssueViewLookupOptions {
306
- cwd: string;
307
- repo?: string;
308
- /** Issue number or GitHub issue URL. */
309
- issue: string;
310
- includeComments?: boolean;
311
- signal?: AbortSignal;
312
- settings?: Settings;
313
- cacheAuthKey?: string | null;
314
- }
315
- export interface PrViewLookupOptions {
316
- cwd: string;
317
- repo: string;
318
- number: number;
319
- includeComments?: boolean;
320
- signal?: AbortSignal;
321
- settings?: Settings;
322
- cacheAuthKey?: string | null;
323
- }
324
- export interface ViewLookupResult<T> {
325
- rendered: string;
326
- sourceUrl: string | undefined;
327
- payload: T;
328
- status: CacheStatus;
329
- fetchedAt: number;
330
- }
331
- /**
332
- * Cache-aware issue/view fetcher. Used by both the `github` tool op and the
333
- * `issue://` protocol handler so a single shared row services both surfaces.
334
- */
335
- export declare function getOrFetchIssue(options: IssueViewLookupOptions): Promise<ViewLookupResult<GhIssueViewData>>;
336
- /**
337
- * Cache-aware PR view fetcher. Caller must supply a numeric PR number;
338
- * branch-name / current-branch lookups bypass the cache entirely upstream
339
- * (see `executePrView`).
340
- */
341
- export declare function getOrFetchPr(options: PrViewLookupOptions): Promise<ViewLookupResult<GhPrViewData>>;
342
- export interface PrDiffFile {
343
- /** Display path. Prefers the post-image (`b/<path>`) when present. */
344
- path: string;
345
- additions: number;
346
- deletions: number;
347
- changeType: "modified" | "added" | "deleted" | "renamed" | "binary";
348
- /** Pre-image path for renames/deletes; same as `path` otherwise. */
349
- oldPath?: string;
350
- /** Byte offset of the section's `diff --git` line in the unified diff. */
351
- startOffset: number;
352
- /** Byte offset of the next section (or end-of-text). */
353
- endOffset: number;
354
- }
355
- export interface PrDiffPayload {
356
- /** Full unified diff text as returned by `gh pr diff --color never`. */
357
- unified: string;
358
- files: PrDiffFile[];
359
- }
360
- export interface PrDiffLookupOptions {
361
- cwd: string;
362
- repo: string;
363
- number: number;
364
- signal?: AbortSignal;
365
- settings?: Settings;
366
- cacheAuthKey?: string | null;
367
- }
368
- /**
369
- * Split `gh pr diff` output on `^diff --git ` boundaries and parse per-file
370
- * metadata. The unified diff is preserved verbatim so callers can slice it by
371
- * byte offsets without re-running gh.
372
- */
373
- export declare function parsePrUnifiedDiff(text: string): PrDiffPayload;
374
- /**
375
- * Cache-aware PR diff fetcher. Stores the full unified diff plus a parsed
376
- * file index in a single `pr-diff` cache row so the listing, full-diff, and
377
- * per-file slice variants of `pr://<n>/diff` share one `gh pr diff`
378
- * invocation.
379
- */
380
- export declare function getOrFetchPrDiff(options: PrDiffLookupOptions): Promise<ViewLookupResult<PrDiffPayload>>;
381
- export {};
@@ -0,0 +1,16 @@
1
+ import type { AgentToolResult } from "@oh-my-pi/pi-agent-core";
2
+ import type { ToolSession } from "../sdk.js";
3
+ import type { ReadToolDetails } from "./read.js";
4
+ import { type SuffixMatchCache } from "./read-path-resolution.js";
5
+ import { type ParsedSelector } from "./read-selector.js";
6
+ interface ResolvedArchiveReadPath {
7
+ absolutePath: string;
8
+ archiveSubPath: string;
9
+ suffixResolution?: {
10
+ from: string;
11
+ to: string;
12
+ };
13
+ }
14
+ export declare function resolveArchiveReadPath(session: ToolSession, readPath: string, suffixCache: SuffixMatchCache, signal?: AbortSignal): Promise<ResolvedArchiveReadPath | null>;
15
+ export declare function readArchive(session: ToolSession, readPath: string, parsedSel: ParsedSelector, resolvedArchivePath: ResolvedArchiveReadPath, signal?: AbortSignal): Promise<AgentToolResult<ReadToolDetails>>;
16
+ export {};