@jwilger/pi-development-system 0.36.1 → 0.37.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jwilger/pi-development-system",
3
- "version": "0.36.1",
3
+ "version": "0.37.0",
4
4
  "description": "A pi extension package representing a seasoned approach to software development using a full AI SDLC.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -29,14 +29,19 @@ export function assistantParts(message: AgentMessage): Parts | undefined {
29
29
  return { text, callsTools: message.content.some((c) => c.type === "toolCall") };
30
30
  }
31
31
 
32
- /** True when the last non-empty line of the message ends with a question mark. */
32
+ const LIST_ITEM = /^(?:\d+[.)]|[-*+])\s/;
33
+
34
+ /**
35
+ * True when the message ends by asking the user something: the last non-empty line that is not an
36
+ * option-list item ends with a question mark, optionally followed by a short parenthetical ("(y/n)").
37
+ */
33
38
  export function asksUser(text: string): boolean {
34
39
  const last = text
35
40
  .split("\n")
36
41
  .map((l) => l.trim())
37
- .filter((l) => l !== "")
42
+ .filter((l) => l !== "" && !LIST_ITEM.test(l))
38
43
  .at(-1);
39
- return last !== undefined && /\?[\s)"'*_`]*$/.test(last);
44
+ return last !== undefined && /\?(?:\s*\([^()]{0,40}\))?[\s)"'*_`]*$/.test(last);
40
45
  }
41
46
 
42
47
  const claimMessage = (): string =>
@@ -86,9 +86,10 @@ function reportedExit(result: ResultLike): number {
86
86
 
87
87
  /** The last few non-empty output lines, redacted and bounded: what the runner said at the end. */
88
88
  export function summarizeOutput(output: string): string {
89
- const lines = output
89
+ // Redact first: a multi-line secret (PEM key) must be recognised before the tail is cut off its BEGIN line.
90
+ const lines = redactSecrets(output)
90
91
  .split("\n")
91
92
  .map((l) => l.trim())
92
93
  .filter((l) => l !== "" && !/^Command exited with code \d+$/.test(l));
93
- return redactSecrets(lines.slice(-SUMMARY_LINES).join(" | ")).slice(0, SUMMARY_MAX);
94
+ return lines.slice(-SUMMARY_LINES).join(" | ").slice(0, SUMMARY_MAX);
94
95
  }