pi-code 1.0.63 → 1.0.64

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 (48) hide show
  1. package/README.md +1 -1
  2. package/extensions/commands.ts +9 -6
  3. package/extensions/context-imports.ts +3 -3
  4. package/extensions/git-checkpoint.ts +137 -21
  5. package/extensions/hooks/config.ts +16 -10
  6. package/extensions/hooks/decisions.ts +9 -9
  7. package/extensions/hooks/index.ts +13 -9
  8. package/extensions/hooks/matcher.ts +12 -7
  9. package/extensions/hooks/runners.ts +7 -28
  10. package/extensions/internal/agent-run.ts +1 -1
  11. package/extensions/internal/bash-rules.ts +1 -2
  12. package/extensions/internal/claude-tool-names.ts +4 -7
  13. package/extensions/internal/command-file.ts +2 -3
  14. package/extensions/internal/external-imports.ts +4 -5
  15. package/extensions/internal/goal-evaluator.ts +4 -3
  16. package/extensions/internal/instruction-events.ts +5 -5
  17. package/extensions/internal/managed-settings.ts +1 -1
  18. package/extensions/internal/mcp-oauth.ts +13 -3
  19. package/extensions/internal/model-complete.ts +7 -1
  20. package/extensions/internal/model-lookup.ts +10 -3
  21. package/extensions/internal/path-rules.ts +10 -13
  22. package/extensions/internal/plugins.ts +5 -5
  23. package/extensions/internal/process-tree.ts +39 -0
  24. package/extensions/internal/project-approval.ts +7 -7
  25. package/extensions/internal/project-root.ts +13 -13
  26. package/extensions/internal/settings-chain.ts +19 -0
  27. package/extensions/internal/settings-watch.ts +3 -1
  28. package/extensions/internal/shell-resolve.ts +3 -1
  29. package/extensions/internal/tool-target.ts +4 -5
  30. package/extensions/internal/values.ts +20 -4
  31. package/extensions/mcp/config.ts +11 -4
  32. package/extensions/mcp/index.ts +40 -4
  33. package/extensions/mcp/policy.ts +14 -12
  34. package/extensions/mcp/transport.ts +2 -8
  35. package/extensions/memory.ts +4 -4
  36. package/extensions/notify.ts +2 -7
  37. package/extensions/output-styles.ts +22 -17
  38. package/extensions/question.ts +2 -7
  39. package/extensions/skills.ts +5 -5
  40. package/extensions/subagent/agents.ts +4 -4
  41. package/extensions/subagent/background.ts +35 -41
  42. package/extensions/subagent/child.ts +2 -2
  43. package/extensions/subagent/modes.ts +18 -13
  44. package/extensions/subagent/params.ts +1 -2
  45. package/extensions/subagent/run.ts +3 -14
  46. package/extensions/thinking.ts +3 -3
  47. package/extensions/web.ts +3 -4
  48. package/package.json +1 -1
@@ -17,6 +17,7 @@ import type { AgentToolResult } from '@earendil-works/pi-agent-core'
17
17
  import type { Message } from '@earendil-works/pi-ai'
18
18
  import { withFileMutationQueue } from '@earendil-works/pi-coding-agent'
19
19
 
20
+ import { killProcessTree } from '../internal/process-tree.js'
20
21
  import { runSubagentStartHooks } from '../internal/subagent-hooks.js'
21
22
  import { type AgentConfig, resolveModelAlias } from './agents.js'
22
23
  import { agentHooksEnv, agentInvocationArgs, agentMemoryPromptSection, childPromptBody, taskWithStartContext, unresolvedToolsError, withMemoryTools } from './child.js'
@@ -130,7 +131,7 @@ function appendPartialNote(result: SingleResult): void {
130
131
  * the spawn() call site instead; catching it here, in one place with an explicit
131
132
  * return type, keeps the caller's non-null stdout/stderr narrowing that a bare
132
133
  * try/catch around an inline spawn() call loses. */
133
- function spawnChild(command: string, args: string[], options: { cwd: string; env: NodeJS.ProcessEnv }): { proc: ChildProcessByStdio<null, Readable, Readable> } | { error: Error } {
134
+ export function spawnChild(command: string, args: string[], options: { cwd: string; env: NodeJS.ProcessEnv }): { proc: ChildProcessByStdio<null, Readable, Readable> } | { error: Error } {
134
135
  try {
135
136
  return {
136
137
  proc: spawn(command, args, {
@@ -348,19 +349,7 @@ async function runSingleAgentInner(options: RunAgentOptions): Promise<SingleResu
348
349
  resolve(1)
349
350
  })
350
351
 
351
- const killGroup = (sig: NodeJS.Signals): void => {
352
- try {
353
- // A child that never spawned has no pid and no group; the direct kill is all there is.
354
- if (proc.pid) process.kill(-proc.pid, sig)
355
- else proc.kill(sig)
356
- } catch {
357
- try {
358
- proc.kill(sig)
359
- } catch {
360
- /* already gone */
361
- }
362
- }
363
- }
352
+ const killGroup = (sig: NodeJS.Signals): void => killProcessTree(proc, sig)
364
353
  if (signal) {
365
354
  onAbort = () => {
366
355
  wasAborted = true
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Thinking Keyword Escalation
3
3
  *
4
- * Claude Code raises reasoning effort for a single turn when the prompt carries a
5
- * think keyword: `ultrathink` asks for the maximum, `think hard`/`think harder` for
6
- * a high level, and a bare `think` for a medium one. The word stays in the prompt
4
+ * Claude Code raises reasoning effort for a single turn when the prompt carries
5
+ * `ultrathink`, the only keyword: `think`, `think hard` and similar phrases pass
6
+ * through as ordinary prompt text. The word stays in the prompt
7
7
  * (the input is observed, never consumed or transformed), the escalation only ever
8
8
  * raises the level, and the prior level is restored once the turn settles, mirroring
9
9
  * how commands.ts restores a per-command model override on agent_settled.
package/extensions/web.ts CHANGED
@@ -16,6 +16,7 @@ import { Type } from 'typebox'
16
16
  import { htmlToMarkdown, removeTags } from './internal/html-markdown.js'
17
17
  import { completeText } from './internal/model-complete.js'
18
18
  import { capForContext } from './internal/output-guard.js'
19
+ import { parseNumericEnv } from './internal/values.js'
19
20
  import { httpFetch } from './internal/web-transport.js'
20
21
 
21
22
  const SEARCH_ENDPOINT = 'https://html.duckduckgo.com/html/?q='
@@ -265,10 +266,8 @@ async function fetchText(rawUrl: string, crossHost: CrossHost, transport = httpF
265
266
  const FETCH_CACHE_TTL_DEFAULT_MS = 15 * 60 * 1000
266
267
 
267
268
  function fetchCacheTtlMs(): number {
268
- const raw = process.env.CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS
269
- if (raw === undefined || raw.trim() === '') return FETCH_CACHE_TTL_DEFAULT_MS
270
- const parsed = Number(raw)
271
- return Number.isFinite(parsed) && parsed >= 0 ? parsed : FETCH_CACHE_TTL_DEFAULT_MS
269
+ const parsed = parseNumericEnv(process.env.CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS)
270
+ return parsed !== undefined && parsed >= 0 ? parsed : FETCH_CACHE_TTL_DEFAULT_MS
272
271
  }
273
272
  const FETCH_CACHE_MAX_ENTRIES = 50
274
273
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-code",
3
- "version": "1.0.63",
3
+ "version": "1.0.64",
4
4
  "description": "Claude Code experience for the pi coding agent: reads your .claude config (rules, commands, skills, hooks, output styles, MCP servers, agents) and adds todo, checkpoints, memory, web, subagents, and goals",
5
5
  "keywords": [
6
6
  "pi",