@trim21/personal-pi-extensions 0.1.612 → 0.1.619

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 (77) hide show
  1. package/package.json +1 -1
  2. package/src/aft/config.ts +9 -3
  3. package/src/aft/index.ts +6 -2
  4. package/src/aft/logger.ts +9 -3
  5. package/src/aft/tools.ts +3 -1
  6. package/src/bwrap/README.md +19 -10
  7. package/src/bwrap/approval-rules.ts +42 -14
  8. package/src/bwrap/approval-suggest.ts +12 -4
  9. package/src/bwrap/core.ts +39 -13
  10. package/src/bwrap/dcg-scan.ts +16 -6
  11. package/src/bwrap/holder.ts +3 -1
  12. package/src/bwrap/mihomo-config.ts +18 -6
  13. package/src/bwrap/network-stack.ts +69 -24
  14. package/src/bwrap/runtime.ts +30 -10
  15. package/src/bwrap/sandbox.ts +1 -1
  16. package/src/claude-code/common.ts +6 -2
  17. package/src/claude-code/edit-utils.ts +3 -1
  18. package/src/claude-code/files.ts +40 -14
  19. package/src/claude-code/glob.ts +12 -4
  20. package/src/claude-code/grep.ts +41 -14
  21. package/src/claude-code/session-tools.ts +18 -6
  22. package/src/claude-code/shell.ts +9 -3
  23. package/src/gh/base.ts +72 -24
  24. package/src/gh/tools/download-release-assets.ts +12 -4
  25. package/src/gh/tools/list-releases.ts +3 -1
  26. package/src/gh/tools/list-workflow-runs.ts +9 -3
  27. package/src/gh/tools/read-ci-logs.ts +21 -7
  28. package/src/gh/tools/read-repo.ts +3 -1
  29. package/src/lib/cli-args.ts +6 -2
  30. package/src/lib/cli.ts +48 -16
  31. package/src/lib/file-reads.ts +24 -8
  32. package/src/lib/github.ts +35 -12
  33. package/src/lib/lsp/adapter.ts +6 -2
  34. package/src/lib/lsp/bin.ts +12 -4
  35. package/src/lib/lsp/client.ts +205 -69
  36. package/src/lib/lsp/diagnostic.ts +6 -2
  37. package/src/lib/lsp/inspect-tool.ts +25 -9
  38. package/src/lib/lsp/lsp.ts +138 -46
  39. package/src/lib/lsp/rename-tool.ts +11 -4
  40. package/src/lib/lsp/rename.ts +25 -8
  41. package/src/lib/lsp/server-config.ts +41 -14
  42. package/src/lib/lsp/watcher.ts +51 -17
  43. package/src/lib/path.ts +18 -6
  44. package/src/lib/proc.ts +3 -1
  45. package/src/lib/proxy.ts +9 -3
  46. package/src/lib/request-policy.ts +3 -1
  47. package/src/lib/seq-state.ts +3 -1
  48. package/src/lib/ui.ts +23 -8
  49. package/src/lib/write-guard.ts +21 -7
  50. package/src/openai-cost/config.ts +3 -1
  51. package/src/openai-cost/cost.ts +54 -18
  52. package/src/openai-cost/index.ts +3 -1
  53. package/src/openai-cost/provider.ts +6 -2
  54. package/src/opencode/bash.ts +9 -3
  55. package/src/opencode/edit-engine.ts +24 -8
  56. package/src/opencode/files.ts +30 -10
  57. package/src/opencode/glob.ts +3 -1
  58. package/src/opencode/grep.ts +12 -4
  59. package/src/opencode/question.ts +3 -1
  60. package/src/opencode/ripgrep.ts +18 -6
  61. package/src/opencode/todo.ts +3 -1
  62. package/src/session-name.ts +39 -13
  63. package/src/spawn-agent-agents.ts +18 -6
  64. package/src/spawn-agent.ts +53 -18
  65. package/src/system-prompt/index.ts +9 -3
  66. package/src/talk/core.ts +143 -48
  67. package/src/talk/format.ts +12 -4
  68. package/src/talk/group.ts +9 -3
  69. package/src/talk/index.ts +30 -10
  70. package/src/talk/mailbox.ts +30 -10
  71. package/src/talk/policy.ts +6 -2
  72. package/src/talk/registry.ts +33 -11
  73. package/src/talk/storage.ts +3 -1
  74. package/src/vision-agent.ts +41 -14
  75. package/src/web/config.ts +3 -1
  76. package/src/web/fetch.ts +75 -25
  77. package/src/web/search.ts +30 -10
package/src/lib/github.ts CHANGED
@@ -91,7 +91,9 @@ export function buildSearchQuery(kind: SearchKind, params: SearchParams): string
91
91
  const state = params.state ?? "open";
92
92
 
93
93
  const parts: string[] = [];
94
- if (repo) parts.push(`repo:${repo}`);
94
+ if (repo) {
95
+ parts.push(`repo:${repo}`);
96
+ }
95
97
  parts.push(kind === "issue" ? "is:issue" : "is:pr");
96
98
  switch (state) {
97
99
  case "open": {
@@ -105,7 +107,9 @@ export function buildSearchQuery(kind: SearchKind, params: SearchParams): string
105
107
  break;
106
108
  }
107
109
  case "merged": {
108
- if (kind === "issue") throw new Error("state=merged is only valid for PR searches");
110
+ if (kind === "issue") {
111
+ throw new Error("state=merged is only valid for PR searches");
112
+ }
109
113
  parts.push("is:merged");
110
114
 
111
115
  break;
@@ -118,17 +122,29 @@ export function buildSearchQuery(kind: SearchKind, params: SearchParams): string
118
122
  }
119
123
  }
120
124
  }
121
- if (keywords) parts.push(keywords);
122
- if (label) parts.push(`label:${quoteQualifier(label)}`);
123
- if (author) parts.push(`author:${author}`);
124
- if (assignee) parts.push(`assignee:${assignee}`);
125
- if (milestone) parts.push(`milestone:${quoteQualifier(milestone)}`);
125
+ if (keywords) {
126
+ parts.push(keywords);
127
+ }
128
+ if (label) {
129
+ parts.push(`label:${quoteQualifier(label)}`);
130
+ }
131
+ if (author) {
132
+ parts.push(`author:${author}`);
133
+ }
134
+ if (assignee) {
135
+ parts.push(`assignee:${assignee}`);
136
+ }
137
+ if (milestone) {
138
+ parts.push(`milestone:${quoteQualifier(milestone)}`);
139
+ }
126
140
  return parts.join(" ");
127
141
  }
128
142
 
129
143
  /** Quote a qualifier value that contains whitespace or special characters. */
130
144
  function quoteQualifier(value: string): string {
131
- if (/^[\w@./-]+$/.test(value)) return value;
145
+ if (/^[\w@./-]+$/.test(value)) {
146
+ return value;
147
+ }
132
148
  return `"${value.replaceAll('"', String.raw`\"`)}"`;
133
149
  }
134
150
 
@@ -251,10 +267,15 @@ export class GithubSearchError extends Error {
251
267
  }
252
268
 
253
269
  function describeHttpError(status: number | undefined): string {
254
- if (status === 401)
270
+ if (status === 401) {
255
271
  return 'GitHub auth failed (401): token invalid or expired — run "gh auth login"';
256
- if (status === 403) return "GitHub rate limit or permissions error (403)";
257
- if (status === 404) return "repository not found, or the token has no access to it (404)";
272
+ }
273
+ if (status === 403) {
274
+ return "GitHub rate limit or permissions error (403)";
275
+ }
276
+ if (status === 404) {
277
+ return "repository not found, or the token has no access to it (404)";
278
+ }
258
279
  return `GitHub API error${status === undefined ? "" : ` (HTTP ${status})`}`;
259
280
  }
260
281
 
@@ -530,7 +551,9 @@ export function createGithubChecks(options: GithubClientOptions = {}): GithubChe
530
551
  );
531
552
  for (const run of commitRuns) {
532
553
  const id = String(run.id);
533
- if (runIds.has(id)) events.set(id, run.event);
554
+ if (runIds.has(id)) {
555
+ events.set(id, run.event);
556
+ }
534
557
  }
535
558
  }
536
559
  return runs.map((run) => {
@@ -57,7 +57,9 @@ export interface LspServerAdapter {
57
57
  function dirChain(cwd: string, target: string): string[] {
58
58
  const dirs = [cwd];
59
59
  const rel = relative(cwd, target);
60
- if (rel === "" || rel.startsWith("..") || isAbsolute(rel)) return dirs;
60
+ if (rel === "" || rel.startsWith("..") || isAbsolute(rel)) {
61
+ return dirs;
62
+ }
61
63
  let current = cwd;
62
64
  for (const part of rel.split(sep)) {
63
65
  current = join(current, part);
@@ -84,7 +86,9 @@ export function serverRoot(
84
86
  const markers = adapter.rootMarkers ?? [];
85
87
  if (markers.length > 0) {
86
88
  for (const dir of dirChain(cwd, dirname(file))) {
87
- if (markers.some((marker) => exists(join(dir, marker)))) return dir;
89
+ if (markers.some((marker) => exists(join(dir, marker)))) {
90
+ return dir;
91
+ }
88
92
  }
89
93
  return cwd;
90
94
  }
@@ -21,9 +21,13 @@ export function walkUp(fromDir: string, stopDir: string): string[] {
21
21
  const stop = normalize(stopDir);
22
22
  for (;;) {
23
23
  dirs.push(current);
24
- if (current === stop) break;
24
+ if (current === stop) {
25
+ break;
26
+ }
25
27
  const parent = dirname(current);
26
- if (parent === current) break;
28
+ if (parent === current) {
29
+ break;
30
+ }
27
31
  current = parent;
28
32
  }
29
33
  return dirs;
@@ -55,7 +59,9 @@ export function findBinaryInWorkspace(
55
59
  for (const root of roots) {
56
60
  for (const name of binaryNames(cmd)) {
57
61
  const candidate = join(root, name);
58
- if (exists(candidate)) return Promise.resolve(candidate);
62
+ if (exists(candidate)) {
63
+ return Promise.resolve(candidate);
64
+ }
59
65
  }
60
66
  }
61
67
  }
@@ -68,7 +74,9 @@ export function which(cmd: string): string | undefined {
68
74
  for (const dir of pathDirs) {
69
75
  for (const name of binaryNames(cmd)) {
70
76
  const candidate = join(dir, name);
71
- if (existsSync(candidate)) return candidate;
77
+ if (existsSync(candidate)) {
78
+ return candidate;
79
+ }
72
80
  }
73
81
  }
74
82
  return undefined;