@diegopetrucci/pi-triage-comments 0.1.4 → 0.1.6

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.
@@ -1 +1 @@
1
- 0.79.10
1
+ 0.80.6
package/index.ts CHANGED
@@ -91,6 +91,13 @@ const MUTATING_GH_API_METHODS = new Set(["POST", "PUT", "PATCH", "DELETE"]);
91
91
 
92
92
  type TriageStatus = "running" | "done" | "error" | "aborted";
93
93
 
94
+ type CreateAgentSessionOptions = NonNullable<Parameters<typeof createAgentSession>[0]>;
95
+
96
+ function getModelRuntimeOption(ctx: { modelRegistry?: unknown }): Pick<CreateAgentSessionOptions, "modelRuntime"> {
97
+ const modelRuntime = (ctx.modelRegistry as { runtime?: CreateAgentSessionOptions["modelRuntime"] } | undefined)?.runtime;
98
+ return modelRuntime ? { modelRuntime } : {};
99
+ }
100
+
94
101
  type ToolCall = {
95
102
  id: string;
96
103
  name: string;
@@ -227,14 +234,14 @@ function normalizeComment(raw: unknown, index: number): NormalizedComment | unde
227
234
 
228
235
  return {
229
236
  index,
230
- id: asTrimmedString(record.id ?? record.databaseId ?? record.nodeId),
237
+ id: asStableIdPart(record.id, record.databaseId, record.nodeId),
231
238
  body,
232
239
  path: asTrimmedString(record.path ?? record.file ?? record.filePath),
233
240
  line: asFiniteNumber(record.line ?? record.position),
234
241
  startLine: asFiniteNumber(record.startLine ?? record.start_line),
235
242
  side: asTrimmedString(record.side),
236
243
  diffHunk: asTrimmedString(record.diffHunk ?? record.diff_hunk ?? record.hunk),
237
- author: asTrimmedString(record.author ?? record.user ?? record.login),
244
+ author: githubLogin(record.author) ?? githubLogin(record.user) ?? asTrimmedString(record.login),
238
245
  url: asTrimmedString(record.url ?? record.htmlUrl ?? record.html_url),
239
246
  createdAt: asTrimmedString(record.createdAt ?? record.created_at),
240
247
  context: asTrimmedString(record.context ?? record.extraContext),
@@ -670,7 +677,11 @@ function normalizeFlagValue(value: string | undefined): string | undefined {
670
677
  }
671
678
 
672
679
  function getBlockedGhApiReason(tokens: string[]): string | undefined {
673
- if (getGhCommand(tokens).command !== "api") return undefined;
680
+ const parsed = getGhCommand(tokens);
681
+ if (parsed.command !== "api") return undefined;
682
+ if (tokens.find((token) => token.toLowerCase() === "graphql")) {
683
+ return "Triage bash blocks gh api graphql because it uses POST/body fields.";
684
+ }
674
685
  for (let index = 1; index < tokens.length; index += 1) {
675
686
  const token = tokens[index];
676
687
  const lowerToken = token.toLowerCase();
@@ -1877,6 +1888,24 @@ async function runPrMode(pi: ExtensionAPI, ctx: ExtensionCommandContext, target?
1877
1888
  }
1878
1889
  }
1879
1890
 
1891
+ export const __test__ = {
1892
+ assertToolPathInsideCwd,
1893
+ buildCommandPayload,
1894
+ buildSystemPrompt,
1895
+ buildUserPrompt,
1896
+ createTriageRuntimeGuardExtension,
1897
+ ensureImplementationNote,
1898
+ formatFetchedCommentsForSelection,
1899
+ formatInlineFilterContext,
1900
+ formatToolCall,
1901
+ getBlockedBashReason,
1902
+ normalizeComment,
1903
+ normalizeInput,
1904
+ parseSelectionList,
1905
+ parseTriageCommandArgs,
1906
+ prepareArguments,
1907
+ };
1908
+
1880
1909
  export default function triageCommentsExtension(pi: ExtensionAPI) {
1881
1910
  pi.registerCommand("triage-comments", {
1882
1911
  description: "Collect pasted feedback or PR comments, then start a triage_comments investigation",
@@ -2013,7 +2042,7 @@ export default function triageCommentsExtension(pi: ExtensionAPI) {
2013
2042
 
2014
2043
  const created = await createAgentSession({
2015
2044
  cwd,
2016
- modelRegistry: ctx.modelRegistry,
2045
+ ...getModelRuntimeOption(ctx),
2017
2046
  resourceLoader,
2018
2047
  settingsManager: isolatedSettingsManager,
2019
2048
  sessionManager: SessionManager.inMemory(cwd),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-triage-comments",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A pi extension that adds /triage-comments and a read-only triage_comments subagent tool for review-comment triage.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -33,5 +33,9 @@
33
33
  "@earendil-works/pi-coding-agent": "*",
34
34
  "@earendil-works/pi-tui": "*",
35
35
  "typebox": "*"
36
+ },
37
+ "type": "module",
38
+ "engines": {
39
+ "node": ">=22.19.0"
36
40
  }
37
41
  }