@code-yeongyu/senpi 2026.6.6-3 → 2026.6.10
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/CHANGELOG.md +25 -0
- package/README.md +113 -111
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/project-trust.d.ts +10 -0
- package/dist/cli/project-trust.d.ts.map +1 -0
- package/dist/cli/project-trust.js +48 -0
- package/dist/cli/project-trust.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +7 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +59 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/cli.js +10 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +3 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +4 -1
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +2 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +6 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/experimental.d.ts +2 -0
- package/dist/core/experimental.d.ts.map +1 -0
- package/dist/core/experimental.js +4 -0
- package/dist/core/experimental.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/index.js +0 -2
- package/dist/core/extensions/builtin/todotools/index.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.d.ts +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.js +0 -2
- package/dist/core/extensions/builtin/todotools/prompt.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +4 -4
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +7 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +34 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +21 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/model-registry.d.ts +3 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +22 -3
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/project-trust.d.ts +15 -0
- package/dist/core/project-trust.d.ts.map +1 -0
- package/dist/core/project-trust.js +58 -0
- package/dist/core/project-trust.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +2 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +24 -26
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/resource-loader.d.ts +14 -3
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +128 -58
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/session-manager.d.ts +3 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +34 -17
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-resident-store.d.ts +16 -0
- package/dist/core/session-resident-store.d.ts.map +1 -0
- package/dist/core/session-resident-store.js +48 -0
- package/dist/core/session-resident-store.js.map +1 -0
- package/dist/core/settings-manager.d.ts +4 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +9 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/trust-manager.d.ts +22 -0
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +75 -22
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +92 -129
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +39 -34
- package/dist/migrations.js.map +1 -1
- package/dist/modes/index.d.ts +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +7 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +26 -4
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts +6 -3
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +22 -18
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +15 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +158 -19
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/working-status.d.ts +2 -0
- package/dist/modes/interactive/working-status.d.ts.map +1 -1
- package/dist/modes/interactive/working-status.js +34 -0
- package/dist/modes/interactive/working-status.js.map +1 -1
- package/dist/package-manager-cli.d.ts +6 -2
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +58 -11
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/senpi +10 -1
- package/dist/utils/changelog.d.ts +1 -0
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +78 -0
- package/dist/utils/changelog.js.map +1 -1
- package/docs/docs.json +4 -0
- package/docs/extensions.md +30 -1
- package/docs/index.md +1 -0
- package/docs/models.md +6 -39
- package/docs/packages.md +0 -2
- package/docs/prompt-templates.md +8 -1
- package/docs/sdk.md +5 -0
- package/docs/security.md +55 -0
- package/docs/settings.md +7 -4
- package/docs/terminal-setup.md +36 -2
- package/docs/tmux.md +4 -2
- package/docs/usage.md +12 -7
- package/examples/extensions/README.md +1 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +125 -77
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +6 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/README.md +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +6 -6
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +373 -116
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +353 -202
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +15 -7
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +17 -7
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +4 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +5 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +2 -0
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +6 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +89 -39
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +5 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +18 -4
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +131 -61
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +4 -7
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +38 -76
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +14 -4
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +43 -15
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -8
- package/dist/core/extensions/builtin/todotools/continuation/config.d.ts +0 -10
- package/dist/core/extensions/builtin/todotools/continuation/config.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/config.js +0 -33
- package/dist/core/extensions/builtin/todotools/continuation/config.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/index.d.ts +0 -2
- package/dist/core/extensions/builtin/todotools/continuation/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/index.js +0 -2
- package/dist/core/extensions/builtin/todotools/continuation/index.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/prompt.d.ts +0 -5
- package/dist/core/extensions/builtin/todotools/continuation/prompt.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/prompt.js +0 -34
- package/dist/core/extensions/builtin/todotools/continuation/prompt.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/runtime.d.ts +0 -11
- package/dist/core/extensions/builtin/todotools/continuation/runtime.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/runtime.js +0 -201
- package/dist/core/extensions/builtin/todotools/continuation/runtime.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/settings.d.ts +0 -6
- package/dist/core/extensions/builtin/todotools/settings.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/settings.js +0 -58
- package/dist/core/extensions/builtin/todotools/settings.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/system-messages.d.ts +0 -34
- package/dist/core/extensions/builtin/todotools/system-messages.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/system-messages.js +0 -82
- package/dist/core/extensions/builtin/todotools/system-messages.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/utils/changelog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAS9C;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,aAAqB;IACnD,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAChC,OAAO,EAAE,CAAC;IACX,CAAC;IAED,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,OAAO,GAAqB,EAAE,CAAC;QAErC,IAAI,YAAY,GAAa,EAAE,CAAC;QAChC,IAAI,cAAc,GAA2D,IAAI,CAAC;QAElF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YAC1B,qDAAqD;YACrD,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5B,gCAAgC;gBAChC,IAAI,cAAc,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC/C,OAAO,CAAC,I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C;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,EAAkB,EAAE,EAAkB;IACrE,IAAI,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;IACtD,IAAI,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;IACtD,OAAO,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAyB,EAAE,WAAmB;IAC3E,oBAAoB;IACpB,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACjD,MAAM,IAAI,GAAmB;QAC5B,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QACpB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QACpB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QACpB,OAAO,EAAE,EAAE;KACX,CAAC;IAEF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,2DAA2D;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"fs\";\n\nexport interface ChangelogEntry {\n\tmajor: number;\n\tminor: number;\n\tpatch: number;\n\tcontent: string;\n}\n\n/**\n * Parse changelog entries from CHANGELOG.md\n * Scans for ## lines and collects content until next ## or EOF\n */\nexport function parseChangelog(changelogPath: string): ChangelogEntry[] {\n\tif (!existsSync(changelogPath)) {\n\t\treturn [];\n\t}\n\n\ttry {\n\t\tconst content = readFileSync(changelogPath, \"utf-8\");\n\t\tconst lines = content.split(\"\\n\");\n\t\tconst entries: ChangelogEntry[] = [];\n\n\t\tlet currentLines: string[] = [];\n\t\tlet currentVersion: { major: number; minor: number; patch: number } | null = null;\n\n\t\tfor (const line of lines) {\n\t\t\t// Check if this is a version header (## [x.y.z] ...)\n\t\t\tif (line.startsWith(\"## \")) {\n\t\t\t\t// Save previous entry if exists\n\t\t\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\t\t\tentries.push({\n\t\t\t\t\t\t...currentVersion,\n\t\t\t\t\t\tcontent: currentLines.join(\"\\n\").trim(),\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Try to parse version from this line\n\t\t\t\tconst versionMatch = line.match(/##\\s+\\[?(\\d+)\\.(\\d+)\\.(\\d+)\\]?/);\n\t\t\t\tif (versionMatch) {\n\t\t\t\t\tcurrentVersion = {\n\t\t\t\t\t\tmajor: Number.parseInt(versionMatch[1], 10),\n\t\t\t\t\t\tminor: Number.parseInt(versionMatch[2], 10),\n\t\t\t\t\t\tpatch: Number.parseInt(versionMatch[3], 10),\n\t\t\t\t\t};\n\t\t\t\t\tcurrentLines = [line];\n\t\t\t\t} else {\n\t\t\t\t\t// Reset if we can't parse version\n\t\t\t\t\tcurrentVersion = null;\n\t\t\t\t\tcurrentLines = [];\n\t\t\t\t}\n\t\t\t} else if (currentVersion) {\n\t\t\t\t// Collect lines for current version\n\t\t\t\tcurrentLines.push(line);\n\t\t\t}\n\t\t}\n\n\t\t// Save last entry\n\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\tentries.push({\n\t\t\t\t...currentVersion,\n\t\t\t\tcontent: currentLines.join(\"\\n\").trim(),\n\t\t\t});\n\t\t}\n\n\t\treturn entries;\n\t} catch (error) {\n\t\tconsole.error(`Warning: Could not parse changelog: ${error}`);\n\t\treturn [];\n\t}\n}\n\n/**\n * Compare versions. Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2\n */\nexport function compareVersions(v1: ChangelogEntry, v2: ChangelogEntry): number {\n\tif (v1.major !== v2.major) return v1.major - v2.major;\n\tif (v1.minor !== v2.minor) return v1.minor - v2.minor;\n\treturn v1.patch - v2.patch;\n}\n\n/**\n * Get entries newer than lastVersion\n */\nexport function getNewEntries(entries: ChangelogEntry[], lastVersion: string): ChangelogEntry[] {\n\t// Parse lastVersion\n\tconst parts = lastVersion.split(\".\").map(Number);\n\tconst last: ChangelogEntry = {\n\t\tmajor: parts[0] || 0,\n\t\tminor: parts[1] || 0,\n\t\tpatch: parts[2] || 0,\n\t\tcontent: \"\",\n\t};\n\n\treturn entries.filter((entry) => compareVersions(entry, last) > 0);\n}\n\n// Re-export getChangelogPath from paths.ts for convenience\nexport { getChangelogPath } from \"../config.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/utils/changelog.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAS9C,MAAM,WAAW,GAAG,mBAAmB,CAAC;AACxC,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AACzD,MAAM,cAAc,GAAG,sEAAsE,CAAC;AAC9F,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAC7C,MAAM,uBAAuB,GAAG,+CAA+C,CAAC;AAEhF,SAAS,YAAY,CAAC,KAAqB;IAC1C,OAAO,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;AACvD,CAAC;AAED,SAAS,YAAY,CAAC,OAAgC;IACrD,MAAM,aAAa,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACpF,OAAO,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,C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C,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,2DAA2D;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import path from \"node:path\";\nimport { existsSync, readFileSync } from \"fs\";\n\nexport interface ChangelogEntry {\n\tmajor: number;\n\tminor: number;\n\tpatch: number;\n\tcontent: string;\n}\n\nconst GITHUB_REPO = \"earendil-works/pi\";\nconst CHANGELOG_LINK_BASE_PATH = \"packages/coding-agent\";\nconst LEGACY_REPO_RE = /^https:\\/\\/github\\.com\\/(?:badlogic|earendil-works)\\/pi-mono(?=\\/|$)/;\nconst URL_SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i;\nconst INLINE_MARKDOWN_LINK_RE = /(!?\\[[^\\]\\n]+\\]\\()([^\\s)]+)((?:\\s+[^)]*)?\\))/g;\n\nfunction entryVersion(entry: ChangelogEntry): string {\n\treturn `${entry.major}.${entry.minor}.${entry.patch}`;\n}\n\nfunction normalizeTag(version: string | ChangelogEntry): string {\n\tconst versionString = typeof version === \"string\" ? version : entryVersion(version);\n\treturn versionString.startsWith(\"v\") ? versionString : `v${versionString}`;\n}\n\nfunction splitLocalTarget(target: string): { fragment: string; pathPart: string; query: string } {\n\tconst hashIndex = target.indexOf(\"#\");\n\tconst beforeHash = hashIndex === -1 ? target : target.slice(0, hashIndex);\n\tconst fragment = hashIndex === -1 ? \"\" : target.slice(hashIndex);\n\tconst queryIndex = beforeHash.indexOf(\"?\");\n\n\tif (queryIndex === -1) {\n\t\treturn { fragment, pathPart: beforeHash, query: \"\" };\n\t}\n\n\treturn {\n\t\tfragment,\n\t\tpathPart: beforeHash.slice(0, queryIndex),\n\t\tquery: beforeHash.slice(queryIndex),\n\t};\n}\n\nfunction normalizePathPart(value: string): string {\n\treturn value.replaceAll(\"\\\\\", \"/\");\n}\n\nfunction resolveRepositoryPath(targetPath: string): string | undefined {\n\tconst normalizedTarget = normalizePathPart(targetPath);\n\tconst joined = normalizedTarget.startsWith(\"/\")\n\t\t? path.posix.normalize(normalizedTarget.replace(/^\\/+/, \"\"))\n\t\t: path.posix.normalize(path.posix.join(CHANGELOG_LINK_BASE_PATH, normalizedTarget));\n\n\tif (joined === \".\" || joined.startsWith(\"../\") || joined === \"..\") {\n\t\treturn undefined;\n\t}\n\n\treturn joined;\n}\n\nfunction isDirectoryTarget(originalPath: string, repositoryPath: string): boolean {\n\tif (originalPath.endsWith(\"/\")) {\n\t\treturn true;\n\t}\n\n\tconst basename = path.posix.basename(repositoryPath);\n\treturn !basename.includes(\".\");\n}\n\nfunction normalizeChangelogLinkTarget(target: string, tag: string): string {\n\tlet canonicalTarget = target.replace(LEGACY_REPO_RE, `https://github.com/${GITHUB_REPO}`);\n\tconst repoUrl = `https://github.com/${GITHUB_REPO}`;\n\n\tfor (const route of [\"blob\", \"tree\"]) {\n\t\tfor (const branch of [\"main\", \"master\"]) {\n\t\t\tconst floatingRefPrefix = `${repoUrl}/${route}/${branch}/`;\n\t\t\tif (canonicalTarget.startsWith(floatingRefPrefix)) {\n\t\t\t\tcanonicalTarget = `${repoUrl}/${route}/${tag}/${canonicalTarget.slice(floatingRefPrefix.length)}`;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (canonicalTarget.startsWith(\"#\") || canonicalTarget.startsWith(\"//\") || URL_SCHEME_RE.test(canonicalTarget)) {\n\t\treturn canonicalTarget;\n\t}\n\n\tconst { fragment, pathPart, query } = splitLocalTarget(canonicalTarget);\n\tif (!pathPart) {\n\t\treturn canonicalTarget;\n\t}\n\n\tconst repositoryPath = resolveRepositoryPath(pathPart);\n\tif (!repositoryPath) {\n\t\treturn canonicalTarget;\n\t}\n\n\tconst route = isDirectoryTarget(pathPart, repositoryPath) ? \"tree\" : \"blob\";\n\treturn `https://github.com/${GITHUB_REPO}/${route}/${tag}/${encodeURI(repositoryPath)}${query}${fragment}`;\n}\n\nexport function normalizeChangelogLinks(markdown: string, version: string | ChangelogEntry): string {\n\tconst tag = normalizeTag(version);\n\treturn markdown.replace(INLINE_MARKDOWN_LINK_RE, (_match, prefix, target, suffix) => {\n\t\treturn `${prefix}${normalizeChangelogLinkTarget(target, tag)}${suffix}`;\n\t});\n}\n\n/**\n * Parse changelog entries from CHANGELOG.md\n * Scans for ## lines and collects content until next ## or EOF\n */\nexport function parseChangelog(changelogPath: string): ChangelogEntry[] {\n\tif (!existsSync(changelogPath)) {\n\t\treturn [];\n\t}\n\n\ttry {\n\t\tconst content = readFileSync(changelogPath, \"utf-8\");\n\t\tconst lines = content.split(\"\\n\");\n\t\tconst entries: ChangelogEntry[] = [];\n\n\t\tlet currentLines: string[] = [];\n\t\tlet currentVersion: { major: number; minor: number; patch: number } | null = null;\n\n\t\tfor (const line of lines) {\n\t\t\t// Check if this is a version header (## [x.y.z] ...)\n\t\t\tif (line.startsWith(\"## \")) {\n\t\t\t\t// Save previous entry if exists\n\t\t\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\t\t\tentries.push({\n\t\t\t\t\t\t...currentVersion,\n\t\t\t\t\t\tcontent: currentLines.join(\"\\n\").trim(),\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Try to parse version from this line\n\t\t\t\tconst versionMatch = line.match(/##\\s+\\[?(\\d+)\\.(\\d+)\\.(\\d+)\\]?/);\n\t\t\t\tif (versionMatch) {\n\t\t\t\t\tcurrentVersion = {\n\t\t\t\t\t\tmajor: Number.parseInt(versionMatch[1], 10),\n\t\t\t\t\t\tminor: Number.parseInt(versionMatch[2], 10),\n\t\t\t\t\t\tpatch: Number.parseInt(versionMatch[3], 10),\n\t\t\t\t\t};\n\t\t\t\t\tcurrentLines = [line];\n\t\t\t\t} else {\n\t\t\t\t\t// Reset if we can't parse version\n\t\t\t\t\tcurrentVersion = null;\n\t\t\t\t\tcurrentLines = [];\n\t\t\t\t}\n\t\t\t} else if (currentVersion) {\n\t\t\t\t// Collect lines for current version\n\t\t\t\tcurrentLines.push(line);\n\t\t\t}\n\t\t}\n\n\t\t// Save last entry\n\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\tentries.push({\n\t\t\t\t...currentVersion,\n\t\t\t\tcontent: currentLines.join(\"\\n\").trim(),\n\t\t\t});\n\t\t}\n\n\t\treturn entries;\n\t} catch (error) {\n\t\tconsole.error(`Warning: Could not parse changelog: ${error}`);\n\t\treturn [];\n\t}\n}\n\n/**\n * Compare versions. Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2\n */\nexport function compareVersions(v1: ChangelogEntry, v2: ChangelogEntry): number {\n\tif (v1.major !== v2.major) return v1.major - v2.major;\n\tif (v1.minor !== v2.minor) return v1.minor - v2.minor;\n\treturn v1.patch - v2.patch;\n}\n\n/**\n * Get entries newer than lastVersion\n */\nexport function getNewEntries(entries: ChangelogEntry[], lastVersion: string): ChangelogEntry[] {\n\t// Parse lastVersion\n\tconst parts = lastVersion.split(\".\").map(Number);\n\tconst last: ChangelogEntry = {\n\t\tmajor: parts[0] || 0,\n\t\tminor: parts[1] || 0,\n\t\tpatch: parts[2] || 0,\n\t\tcontent: \"\",\n\t};\n\n\treturn entries.filter((entry) => compareVersions(entry, last) > 0);\n}\n\n// Re-export getChangelogPath from paths.ts for convenience\nexport { getChangelogPath } from \"../config.ts\";\n"]}
|
package/docs/docs.json
CHANGED
package/docs/extensions.md
CHANGED
|
@@ -270,6 +270,7 @@ Run `npm install` in the extension directory, then imports from `node_modules/`
|
|
|
270
270
|
```
|
|
271
271
|
pi starts
|
|
272
272
|
│
|
|
273
|
+
├─► project_trust (user/global and CLI extensions only, before project resources load)
|
|
273
274
|
├─► session_start { reason: "startup" }
|
|
274
275
|
└─► resources_discover { reason: "startup" }
|
|
275
276
|
│
|
|
@@ -334,6 +335,25 @@ exit (Ctrl+C, Ctrl+D, SIGHUP, SIGTERM)
|
|
|
334
335
|
└─► session_shutdown
|
|
335
336
|
```
|
|
336
337
|
|
|
338
|
+
### Startup Events
|
|
339
|
+
|
|
340
|
+
#### project_trust
|
|
341
|
+
|
|
342
|
+
Fired before pi decides whether to trust a project with dynamic configs (`.pi` or `.agents/skills`). It runs during startup and when session replacement (for example `/resume`) enters a cwd whose trust has not been resolved in the current process. Only user/global extensions and CLI `-e` extensions participate; project-local extensions are not loaded until after trust is resolved.
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
pi.on("project_trust", async (event, ctx) => {
|
|
346
|
+
// event.cwd - current working directory
|
|
347
|
+
// ctx has a limited trust context: cwd, mode, hasUI, and select/confirm/input/notify UI helpers
|
|
348
|
+
if (await ctx.ui.confirm("Trust project?", event.cwd)) {
|
|
349
|
+
return { trusted: "yes", remember: true };
|
|
350
|
+
}
|
|
351
|
+
return { trusted: "undecided" };
|
|
352
|
+
});
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
A `project_trust` handler must return `{ trusted: "yes" | "no" | "undecided" }`. A user/global or CLI extension that returns `"yes"` or `"no"` owns the decision; the first yes/no decision wins and suppresses the built-in trust prompt. Use `remember: true` to persist a yes/no decision; otherwise it applies only to the current process. Return `"undecided"` to let later handlers or the built-in trust flow decide. Check `ctx.hasUI` before prompting. If no handler returns yes/no, normal trust resolution continues: saved `trust.json` decisions apply first, then `defaultProjectTrust` controls whether pi asks, trusts, or declines by default.
|
|
356
|
+
|
|
337
357
|
### Resource Events
|
|
338
358
|
|
|
339
359
|
#### resources_discover
|
|
@@ -872,6 +892,12 @@ Current run mode: `"tui"`, `"rpc"`, `"json"`, or `"print"`. Use `ctx.mode === "t
|
|
|
872
892
|
|
|
873
893
|
Current working directory.
|
|
874
894
|
|
|
895
|
+
### ctx.isProjectTrusted()
|
|
896
|
+
|
|
897
|
+
Returns whether project-local trust is active for the current session context. This includes temporary trust decisions and CLI trust overrides, not just saved decisions in the global trust store.
|
|
898
|
+
|
|
899
|
+
Use this before reading project-local extension configuration that should only be honored for trusted projects.
|
|
900
|
+
|
|
875
901
|
### ctx.sessionManager
|
|
876
902
|
|
|
877
903
|
Read-only access to session state. See [Session Format](session-format.md) for the full SessionManager API and entry types.
|
|
@@ -2255,6 +2281,7 @@ ctx.ui.pasteToEditor("pasted content");
|
|
|
2255
2281
|
|
|
2256
2282
|
// Stack custom autocomplete behavior on top of the built-in provider
|
|
2257
2283
|
ctx.ui.addAutocompleteProvider((current) => ({
|
|
2284
|
+
triggerCharacters: ["#"],
|
|
2258
2285
|
async getSuggestions(lines, line, col, options) {
|
|
2259
2286
|
const beforeCursor = (lines[line] ?? "").slice(0, col);
|
|
2260
2287
|
const match = beforeCursor.match(/(?:^|[ \t])#([^\s#]*)$/);
|
|
@@ -2303,7 +2330,7 @@ Custom working-indicator frames are rendered verbatim. If you want colors, add t
|
|
|
2303
2330
|
|
|
2304
2331
|
### Autocomplete Providers
|
|
2305
2332
|
|
|
2306
|
-
Use `ctx.ui.addAutocompleteProvider()` to stack custom autocomplete logic on top of the built-in slash-command and path provider.
|
|
2333
|
+
Use `ctx.ui.addAutocompleteProvider()` to stack custom autocomplete logic on top of the built-in slash-command and path provider. Set `triggerCharacters` for custom natural triggers such as `$`.
|
|
2307
2334
|
|
|
2308
2335
|
Typical pattern:
|
|
2309
2336
|
|
|
@@ -2315,6 +2342,7 @@ Typical pattern:
|
|
|
2315
2342
|
```typescript
|
|
2316
2343
|
pi.on("session_start", (_event, ctx) => {
|
|
2317
2344
|
ctx.ui.addAutocompleteProvider((current) => ({
|
|
2345
|
+
triggerCharacters: ["#"],
|
|
2318
2346
|
async getSuggestions(lines, cursorLine, cursorCol, options) {
|
|
2319
2347
|
const line = lines[cursorLine] ?? "";
|
|
2320
2348
|
const beforeCursor = line.slice(0, cursorCol);
|
|
@@ -2567,6 +2595,7 @@ All examples in [examples/extensions/](../examples/extensions/).
|
|
|
2567
2595
|
| `shutdown-command.ts` | Graceful shutdown command | `registerCommand`, `shutdown()` |
|
|
2568
2596
|
| **Events & Gates** |||
|
|
2569
2597
|
| `permission-gate.ts` | Block dangerous commands | `on("tool_call")`, `ui.confirm` |
|
|
2598
|
+
| `project-trust.ts` | Decide or defer project trust from a user/global or CLI extension | `on("project_trust")`, trust UI, required trust result |
|
|
2570
2599
|
| `protected-paths.ts` | Block writes to specific paths | `on("tool_call")` |
|
|
2571
2600
|
| `confirm-destructive.ts` | Confirm session changes | `on("session_before_switch")`, `on("session_before_fork")` |
|
|
2572
2601
|
| `dirty-repo-guard.ts` | Warn on dirty git repo | `on("session_before_*")`, `exec` |
|
package/docs/index.md
CHANGED
|
@@ -33,6 +33,7 @@ For the full first-run flow, see [Quickstart](quickstart.md).
|
|
|
33
33
|
- [Quickstart](quickstart.md) - install, authenticate, and run a first session.
|
|
34
34
|
- [Using Senpi](usage.md) - interactive mode, slash commands, context files, and CLI reference.
|
|
35
35
|
- [Providers](providers.md) - subscription and API-key setup for built-in providers.
|
|
36
|
+
- [Security](security.md) - project trust, sandbox boundaries, and vulnerability reporting.
|
|
36
37
|
- [Containerization](containerization.md) - sandbox pi with OpenShell, Gondolin, or Docker.
|
|
37
38
|
- [Settings](settings.md) - global and project settings.
|
|
38
39
|
- [Keybindings](keybindings.md) - default shortcuts and custom keybindings.
|
package/docs/models.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Custom Models
|
|
2
2
|
|
|
3
|
-
Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.
|
|
3
|
+
Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.pi/agent/models.json`.
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
@@ -198,8 +198,7 @@ If your command is slow, expensive, rate-limited, or should keep using a previou
|
|
|
198
198
|
| Field | Required | Default | Description |
|
|
199
199
|
|-------|----------|---------|-------------|
|
|
200
200
|
| `id` | Yes | — | Model identifier (passed to the API) |
|
|
201
|
-
| `name` | No | `id` | Human-readable model label. Used for matching (`--model` patterns) and shown
|
|
202
|
-
| `promptPreset` | No | auto-detected | System prompt preset for this model. Use this when a provider-specific model ID should force a known preset, such as `"kimi-k2-6"`. |
|
|
201
|
+
| `name` | No | `id` | Human-readable model label. Used for matching (`--model` patterns) and shown as secondary model detail text. |
|
|
203
202
|
| `api` | No | provider's `api` | Override provider's API for this model |
|
|
204
203
|
| `reasoning` | No | `false` | Supports extended thinking |
|
|
205
204
|
| `thinkingLevelMap` | No | omitted | Maps pi thinking levels to provider values and marks unsupported levels (see below) |
|
|
@@ -210,32 +209,8 @@ If your command is slow, expensive, rate-limited, or should keep using a previou
|
|
|
210
209
|
| `compat` | No | provider `compat` | Provider compatibility overrides. Merged with provider-level `compat` when both are set. |
|
|
211
210
|
|
|
212
211
|
Current behavior:
|
|
213
|
-
- `/model
|
|
214
|
-
- The configured `name` is used for model matching and detail/status
|
|
215
|
-
|
|
216
|
-
### Prompt Preset
|
|
217
|
-
|
|
218
|
-
Use `promptPreset` on a model when auto-detection cannot infer the right system prompt preset from the provider's model ID.
|
|
219
|
-
|
|
220
|
-
```json
|
|
221
|
-
{
|
|
222
|
-
"providers": {
|
|
223
|
-
"moonshot": {
|
|
224
|
-
"baseUrl": "https://api.moonshot.ai/v1",
|
|
225
|
-
"api": "openai-responses",
|
|
226
|
-
"apiKey": "MOONSHOT_API_KEY",
|
|
227
|
-
"models": [
|
|
228
|
-
{
|
|
229
|
-
"id": "kimi-k2p6-turbo",
|
|
230
|
-
"promptPreset": "kimi-k2-6"
|
|
231
|
-
}
|
|
232
|
-
]
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
If `settings.json` sets `promptPreset` to anything other than `"auto"`, that settings override wins. Model-level `promptPreset` is used when settings remain on `"auto"`.
|
|
212
|
+
- `/model`, `--list-models`, and the interactive footer display entries by model `id`.
|
|
213
|
+
- The configured `name` is used for model matching and secondary model detail text. It does not replace the footer/status-bar model id.
|
|
239
214
|
|
|
240
215
|
### Thinking Level Map
|
|
241
216
|
|
|
@@ -339,12 +314,13 @@ Use `modelOverrides` to customize specific built-in models without replacing the
|
|
|
339
314
|
}
|
|
340
315
|
```
|
|
341
316
|
|
|
342
|
-
`modelOverrides` supports these fields per model: `name`, `
|
|
317
|
+
`modelOverrides` supports these fields per model: `name`, `reasoning`, `input`, `cost` (partial), `contextWindow`, `maxTokens`, `headers`, `compat`.
|
|
343
318
|
|
|
344
319
|
Behavior notes:
|
|
345
320
|
- `modelOverrides` are applied to built-in provider models.
|
|
346
321
|
- Unknown model IDs are ignored.
|
|
347
322
|
- You can combine provider-level `baseUrl`/`headers` with `modelOverrides`.
|
|
323
|
+
- Overriding `name` changes model matching and secondary detail text only; the footer and primary model lists continue to show the model `id`.
|
|
348
324
|
- If `models` is also defined for a provider, custom models are merged after built-in overrides. A custom model with the same `id` replaces the overridden built-in model entry.
|
|
349
325
|
|
|
350
326
|
## Anthropic Messages Compatibility
|
|
@@ -432,15 +408,6 @@ For providers with partial OpenAI compatibility, use the `compat` field.
|
|
|
432
408
|
| `openRouterRouting` | OpenRouter provider routing preferences. This object is sent as-is in the `provider` field of the [OpenRouter API request](https://openrouter.ai/docs/guides/routing/provider-selection). |
|
|
433
409
|
| `vercelGatewayRouting` | Vercel AI Gateway routing config for provider selection (`only`, `order`) |
|
|
434
410
|
|
|
435
|
-
For `api: "openai-responses"` models, only Responses-specific `compat` fields apply:
|
|
436
|
-
|
|
437
|
-
| Field | Description |
|
|
438
|
-
|-------|-------------|
|
|
439
|
-
| `sendSessionIdHeader` | Send the OpenAI cache-affinity `session_id` header from `sessionId`. Default: `true`. |
|
|
440
|
-
| `supportsLongCacheRetention` | Accepts `prompt_cache_retention: "24h"` when cache retention is `long`. Default: `true`. |
|
|
441
|
-
| `supportsWebSocket` | Supports OpenAI Responses WebSocket transport. Default: `true` only for `api.openai.com`. |
|
|
442
|
-
| `supportsWebSearchPreview` | Supports OpenAI-native `web_search_preview` tools. Default: `true` only for `api.openai.com`; custom Responses proxies must opt in. |
|
|
443
|
-
|
|
444
411
|
`openrouter` uses `reasoning: { effort }`. `together` uses `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` uses top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that require `chat_template_kwargs.enable_thinking`.
|
|
445
412
|
|
|
446
413
|
`cacheControlFormat: "anthropic"` is for OpenAI-compatible providers that expose Anthropic-style prompt caching through `cache_control` markers on text content and tool definitions.
|
package/docs/packages.md
CHANGED
|
@@ -40,8 +40,6 @@ These commands manage senpi packages, not the senpi CLI installation. To uninsta
|
|
|
40
40
|
|
|
41
41
|
By default, `install` and `remove` write to global settings (`~/.senpi/agent/settings.json`). Use `-l` to write to project settings (`.senpi/settings.json`) instead. Project settings can be shared with your team, and senpi installs any missing packages automatically on startup after the project is trusted.
|
|
42
42
|
|
|
43
|
-
Project package commands read project settings only when the project is trusted. Use `--approve` to trust project-local files for one command, or `--no-approve` to ignore them for one command.
|
|
44
|
-
|
|
45
43
|
To try a package without installing it, use `--extension` or `-e`. This installs to a temporary directory for the current run only:
|
|
46
44
|
|
|
47
45
|
```bash
|
package/docs/prompt-templates.md
CHANGED
|
@@ -64,10 +64,11 @@ Type `/` followed by the template name in the editor. Autocomplete shows availab
|
|
|
64
64
|
|
|
65
65
|
## Arguments
|
|
66
66
|
|
|
67
|
-
Templates support positional arguments and simple slicing:
|
|
67
|
+
Templates support positional arguments, defaults, and simple slicing:
|
|
68
68
|
|
|
69
69
|
- `$1`, `$2`, ... positional args
|
|
70
70
|
- `$@` or `$ARGUMENTS` for all args joined
|
|
71
|
+
- `${1:-default}` uses arg 1 when present/non-empty, otherwise `default`
|
|
71
72
|
- `${@:N}` for args from the Nth position (1-indexed)
|
|
72
73
|
- `${@:N:L}` for `L` args starting at N
|
|
73
74
|
|
|
@@ -80,6 +81,12 @@ description: Create a component
|
|
|
80
81
|
Create a React component named $1 with features: $@
|
|
81
82
|
```
|
|
82
83
|
|
|
84
|
+
Default values are useful for optional arguments:
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
Summarize the current state in ${1:-7} bullet points.
|
|
88
|
+
```
|
|
89
|
+
|
|
83
90
|
Usage: `/component Button "onClick handler" "disabled support"`
|
|
84
91
|
|
|
85
92
|
## Loading Rules
|
package/docs/sdk.md
CHANGED
package/docs/security.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
Pi is a local coding agent. It runs with the permissions of the user account that starts it, and it treats files writable by that user as inside the same local trust boundary.
|
|
4
|
+
|
|
5
|
+
## Project Trust
|
|
6
|
+
|
|
7
|
+
Project trust controls whether pi loads project-local settings, resources, packages, and extensions. It is not a sandbox and it does not restrict what the model can ask tools to do after you start working in a directory.
|
|
8
|
+
|
|
9
|
+
Pi considers a project to have trust inputs when it finds any of these from the current working directory:
|
|
10
|
+
|
|
11
|
+
- `.pi/` in the current directory
|
|
12
|
+
- `.agents/skills` in the current directory or an ancestor directory
|
|
13
|
+
|
|
14
|
+
When an interactive session starts in a project with configs in `.pi` or `.agents/skills` and no saved decision for the current directory or a parent directory, pi follows `defaultProjectTrust` from global settings. The default value is `"ask"`, which asks whether to trust the project when UI is available. Saved decisions are stored by canonical directory in `~/.pi/agent/trust.json`, and the closest saved decision on the current or parent path applies before the global default.
|
|
15
|
+
|
|
16
|
+
Trusting a project allows pi to load trust-gated project inputs, including:
|
|
17
|
+
|
|
18
|
+
- `.pi/settings.json`
|
|
19
|
+
- `.pi` resources such as extensions, skills, prompt templates, themes, and system prompt files
|
|
20
|
+
- missing project packages configured through project settings
|
|
21
|
+
- project-local extensions and project package-managed extensions
|
|
22
|
+
|
|
23
|
+
Declining trust skips protected resources. `AGENTS.md` and `CLAUDE.md` context files are loaded regardless of project trust unless context loading is disabled. Before trust is resolved, pi only loads context files, user/global extensions, and CLI `-e` extensions. User/global and CLI extensions can handle the `project_trust` event; the first extension that returns a yes/no decision owns the decision.
|
|
24
|
+
|
|
25
|
+
Non-interactive modes (`-p`, `--mode json`, and `--mode rpc`) do not show a trust prompt. Without an applicable saved trust decision, `defaultProjectTrust: "ask"` and `"never"` ignore such resources, while `"always"` trusts them. Use `--approve`/`-a` or `--no-approve`/`-na` to override project trust for one run.
|
|
26
|
+
|
|
27
|
+
## No Built-in Sandbox
|
|
28
|
+
|
|
29
|
+
Pi does not include a built-in sandbox. Built-in tools can read files, write files, edit files, and run shell commands with the permissions of the pi process. Extensions are TypeScript modules that run with the same permissions. Package installs, shell commands, language servers, test commands, and other developer tools behave as ordinary local processes.
|
|
30
|
+
|
|
31
|
+
This is intentional. Pi is designed to operate on local source trees, invoke project toolchains, and integrate with the user's existing development environment. A partial in-process sandbox would be easy to misunderstand as a security boundary while still depending on the host shell, filesystem, package managers, credentials, and extension code. Real isolation needs to come from the operating system or a virtualization/container boundary.
|
|
32
|
+
|
|
33
|
+
Project trust is only an input-loading guard. It prevents a repository from silently changing pi's settings or extensions before you approve it. It does not make untrusted code, untrusted prompts, or untrusted model output safe. Prompt injection from repository files, comments, documentation, context files, or build output is expected local-agent risk and cannot be reliably prevented by pi.
|
|
34
|
+
|
|
35
|
+
## Running Untrusted or Unmonitored Work
|
|
36
|
+
|
|
37
|
+
For untrusted repositories, generated code you do not intend to monitor closely, or unattended automation, run pi in a contained environment. Use a container, VM, micro-VM, remote sandbox, or policy-controlled sandbox with only the files and credentials required for the task.
|
|
38
|
+
|
|
39
|
+
Common patterns are documented in [Containerization](containerization.md):
|
|
40
|
+
|
|
41
|
+
- run the whole `pi` process inside OpenShell or Docker
|
|
42
|
+
- run host pi while routing built-in tool execution into a Gondolin micro-VM
|
|
43
|
+
- mount only the workspace paths the agent should access
|
|
44
|
+
- avoid mounting host `~/.pi/agent` unless the container should access host sessions, settings, and credentials
|
|
45
|
+
- pass the minimum required API keys or use short-lived credentials
|
|
46
|
+
- restrict network access when the task does not need it
|
|
47
|
+
- review diffs and outputs before copying results back to trusted systems
|
|
48
|
+
|
|
49
|
+
If you bind-mount a host workspace read/write, writes from inside the container or VM can still modify host files. Use read-only mounts or copy files into and out of the sandbox when you need stronger protection from unintended writes.
|
|
50
|
+
|
|
51
|
+
## Reporting Security Issues
|
|
52
|
+
|
|
53
|
+
To report a security issue, follow the repository [Security Policy](https://github.com/earendil-works/pi-mono/blob/main/SECURITY.md). Do not open a public issue for security-sensitive reports.
|
|
54
|
+
|
|
55
|
+
Expected local-agent behavior, lack of a built-in sandbox, prompt injection from untrusted content, and behavior of user-installed extensions or skills are generally outside the security boundary unless the report demonstrates a real privilege-boundary bypass or shows how pi grants access that the local user did not already have.
|
package/docs/settings.md
CHANGED
|
@@ -11,13 +11,15 @@ Edit directly or use `/settings` for common options.
|
|
|
11
11
|
|
|
12
12
|
## Project Trust
|
|
13
13
|
|
|
14
|
-
On interactive startup, pi asks before trusting a project folder that contains
|
|
14
|
+
On interactive startup, pi asks before trusting a project folder that contains trust-gated project inputs and has no saved decision for the folder or a parent folder in `~/.pi/agent/trust.json`. Trusting a project allows pi to load `.pi/settings.json` and `.pi` resources, install missing project packages, and execute project extensions.
|
|
15
15
|
|
|
16
|
-
Non-interactive modes (`-p`, `--mode json`, and `--mode rpc`) do not show a trust prompt. Without
|
|
16
|
+
Non-interactive modes (`-p`, `--mode json`, and `--mode rpc`) do not show a trust prompt. Without an applicable saved trust decision, they use `defaultProjectTrust` from global settings: `ask` (default) and `never` ignore trust-gated project inputs, while `always` trusts them. Pass `--approve`/`-a` or `--no-approve`/`-na` to override project trust for one run.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
If no extension or saved decision applies, `defaultProjectTrust` controls the fallback behavior. Set it to `"ask"`, `"always"`, or `"never"` in `~/.pi/agent/settings.json`, or change it with `/settings`.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
`pi config` and package commands use the same project trust flow. Pass `--approve` to trust project-local settings for one command or `--no-approve` to ignore them.
|
|
21
|
+
|
|
22
|
+
Use `/trust` in interactive mode to save a project trust decision for future sessions, including trust for the immediate parent folder. It writes `~/.pi/agent/trust.json` only; the current session is not reloaded, so restart pi for changes to take effect.
|
|
21
23
|
|
|
22
24
|
## All Settings
|
|
23
25
|
|
|
@@ -64,6 +66,7 @@ When this value is anything other than `"auto"`, it overrides any model-level `p
|
|
|
64
66
|
|---------|------|---------|-------------|
|
|
65
67
|
| `theme` | string | `"dark"` | Theme name (`"dark"`, `"light"`, or custom) |
|
|
66
68
|
| `quietStartup` | boolean | `false` | Hide startup header |
|
|
69
|
+
| `defaultProjectTrust` | string | `"ask"` | Fallback project trust behavior: `"ask"`, `"always"`, or `"never"`. Global setting only |
|
|
67
70
|
| `collapseChangelog` | boolean | `false` | Show condensed changelog after updates |
|
|
68
71
|
| `enableInstallTelemetry` | boolean | `true` | Send an anonymous install/update version ping after first install or changelog-detected updates. This does not control update checks |
|
|
69
72
|
| `doubleEscapeAction` | string | `"tree"` | Action for double-escape: `"tree"`, `"fork"`, or `"none"` |
|
package/docs/terminal-setup.md
CHANGED
|
@@ -40,7 +40,7 @@ If you want `Shift+Enter` to keep working in tmux via that remap, add `ctrl+j` t
|
|
|
40
40
|
|
|
41
41
|
## WezTerm
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
WezTerm usually works out of the box for `Shift+Enter` via xterm modifyOtherKeys. To use the Kitty keyboard protocol explicitly, create `~/.wezterm.lua`:
|
|
44
44
|
|
|
45
45
|
```lua
|
|
46
46
|
local wezterm = require 'wezterm'
|
|
@@ -49,16 +49,50 @@ config.enable_kitty_keyboard = true
|
|
|
49
49
|
return config
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
On macOS, WezTerm binds `Option+Enter` to fullscreen by default. To use `Option+Enter` for pi follow-up queueing, add this key override:
|
|
53
|
+
|
|
54
|
+
```lua
|
|
55
|
+
local wezterm = require 'wezterm'
|
|
56
|
+
local config = wezterm.config_builder()
|
|
57
|
+
config.keys = {
|
|
58
|
+
{
|
|
59
|
+
key = 'Enter',
|
|
60
|
+
mods = 'ALT',
|
|
61
|
+
action = wezterm.action.SendString('\x1b[13;3u'),
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
return config
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
If you already have a `config.keys` table, add the entry to it.
|
|
68
|
+
|
|
52
69
|
On WSL, WezTerm may require a visible hardware cursor for IME candidate window positioning. If CJK IME candidates do not follow the text cursor, set `PI_HARDWARE_CURSOR=1` before running pi or set `showHardwareCursor` to `true` in settings.
|
|
53
70
|
|
|
71
|
+
## Alacritty
|
|
72
|
+
|
|
73
|
+
Alacritty usually works out of the box for `Shift+Enter`. On macOS, `Option+Enter` may arrive as plain `Enter`. To use `Option+Enter` for pi follow-up queueing, add to `~/.config/alacritty/alacritty.toml`:
|
|
74
|
+
|
|
75
|
+
```toml
|
|
76
|
+
[[keyboard.bindings]]
|
|
77
|
+
key = "Enter"
|
|
78
|
+
mods = "Alt"
|
|
79
|
+
chars = "\u001b[13;3u"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Restart Alacritty after changing the config.
|
|
83
|
+
|
|
54
84
|
## VS Code (Integrated Terminal)
|
|
55
85
|
|
|
86
|
+
VS Code 1.109.5 and newer enable Kitty keyboard protocol in the integrated terminal by default, so `Shift+Enter` should work out of the box.
|
|
87
|
+
|
|
88
|
+
VS Code versions older than 1.109.5 need an explicit terminal keybinding for `Shift+Enter`.
|
|
89
|
+
|
|
56
90
|
`keybindings.json` locations:
|
|
57
91
|
- macOS: `~/Library/Application Support/Code/User/keybindings.json`
|
|
58
92
|
- Linux: `~/.config/Code/User/keybindings.json`
|
|
59
93
|
- Windows: `%APPDATA%\\Code\\User\\keybindings.json`
|
|
60
94
|
|
|
61
|
-
Add to `keybindings.json
|
|
95
|
+
Add to `keybindings.json`:
|
|
62
96
|
|
|
63
97
|
```json
|
|
64
98
|
{
|
package/docs/tmux.md
CHANGED
|
@@ -18,7 +18,7 @@ tmux kill-server
|
|
|
18
18
|
tmux
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Pi requests extended key reporting automatically when Kitty keyboard protocol is not available. With `extended-keys-format csi-u`, tmux forwards modified keys in CSI-u format, which is the most reliable configuration.
|
|
21
|
+
Pi requests extended key reporting automatically when Kitty keyboard protocol is not available. With `extended-keys-format csi-u`, tmux forwards modified keys in CSI-u format, which is the most reliable configuration. The `extended-keys-format` option requires tmux 3.5 or later.
|
|
22
22
|
|
|
23
23
|
## Why `csi-u` Is Recommended
|
|
24
24
|
|
|
@@ -57,5 +57,7 @@ This affects the default keybindings (`Enter` to submit, `Shift+Enter` for newli
|
|
|
57
57
|
|
|
58
58
|
## Requirements
|
|
59
59
|
|
|
60
|
-
- tmux 3.
|
|
60
|
+
- tmux 3.5 or later for `extended-keys-format csi-u` (run `tmux -V` to check)
|
|
61
61
|
- A terminal emulator that supports extended keys (Ghostty, Kitty, iTerm2, WezTerm, Windows Terminal)
|
|
62
|
+
|
|
63
|
+
With tmux 3.2 through 3.4, omit `extended-keys-format csi-u`; Pi still supports tmux's default xterm `modifyOtherKeys` format.
|
package/docs/usage.md
CHANGED
|
@@ -96,8 +96,8 @@ See [Sessions](sessions.md) and [Compaction](compaction.md) for details.
|
|
|
96
96
|
Pi loads `AGENTS.md` or `CLAUDE.md` at startup from:
|
|
97
97
|
|
|
98
98
|
- `~/.pi/agent/AGENTS.md` for global instructions
|
|
99
|
-
- parent directories, walking up from the current working directory
|
|
100
|
-
- the current directory
|
|
99
|
+
- parent directories, walking up from the current working directory
|
|
100
|
+
- the current directory
|
|
101
101
|
|
|
102
102
|
Use context files for project conventions, commands, safety rules, and preferences. Disable loading with `--no-context-files` or `-nc`.
|
|
103
103
|
|
|
@@ -112,13 +112,18 @@ Append to the default prompt without replacing it with `APPEND_SYSTEM.md` in eit
|
|
|
112
112
|
|
|
113
113
|
### Project Trust
|
|
114
114
|
|
|
115
|
-
On interactive startup, pi asks before trusting a project folder that contains project-local
|
|
115
|
+
On interactive startup, pi asks before trusting a project folder that contains project-local extensions or settings and has no saved decision for the folder or a parent folder in `~/.pi/agent/trust.json`. Trusting a project allows pi to load `.pi/settings.json` and `.pi` resources, install missing project packages, and execute project extensions.
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
Before the trust decision, pi loads only context files, user/global extensions, and CLI `-e` extensions so they can handle the `project_trust` event. Project-local extensions, project package-managed extensions, and project settings are loaded only after the project is trusted. This split also applies when switching to a session from a different cwd whose trust has not been resolved in the current process.
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
Non-interactive modes (`-p`, `--mode json`, and `--mode rpc`) do not show a trust prompt. Without an applicable saved trust decision, they use `defaultProjectTrust` from global settings: `ask` (default) and `never` ignore trust-gated project inputs, while `always` trusts them. Pass `--approve`/`-a` or `--no-approve`/`-na` to override project trust for one run.
|
|
120
|
+
|
|
121
|
+
If no extension or saved decision applies, `defaultProjectTrust` controls the fallback behavior. Set it to `"ask"`, `"always"`, or `"never"` in `~/.pi/agent/settings.json`, or change it with `/settings`.
|
|
122
|
+
|
|
123
|
+
`pi config` and package commands use the same project trust flow. Pass `--approve` to trust project-local settings for one command or `--no-approve` to ignore them.
|
|
124
|
+
|
|
125
|
+
Use `/trust` in interactive mode to save a project trust decision for future sessions, including trust for the immediate parent folder. It writes `~/.pi/agent/trust.json` only; the current session is not reloaded, so restart pi for changes to take effect.
|
|
120
126
|
|
|
121
|
-
Use `/trust` in interactive mode to save a project trust decision for future sessions. It writes `~/.pi/agent/trust.json` only; the current session is not reloaded, so restart pi for changes to take effect.
|
|
122
127
|
|
|
123
128
|
## Exporting and Sharing Sessions
|
|
124
129
|
|
|
@@ -148,7 +153,7 @@ pi list # List installed packages
|
|
|
148
153
|
pi config # Enable/disable package resources
|
|
149
154
|
```
|
|
150
155
|
|
|
151
|
-
These commands manage pi packages, not the pi CLI installation. To uninstall pi itself, see [Quickstart](quickstart.md#uninstall).
|
|
156
|
+
These commands manage pi packages, not the pi CLI installation. To uninstall pi itself, see [Quickstart](quickstart.md#uninstall). `pi config` and project package commands accept `--approve`/`--no-approve` to trust or ignore project-local settings for one command.
|
|
152
157
|
|
|
153
158
|
See [Pi Packages](packages.md) for package sources and security notes.
|
|
154
159
|
|
|
@@ -19,6 +19,7 @@ cp permission-gate.ts ~/.senpi/agent/extensions/
|
|
|
19
19
|
| Extension | Description |
|
|
20
20
|
|-----------|-------------|
|
|
21
21
|
| `permission-gate.ts` | Prompts for confirmation before dangerous bash commands (rm -rf, sudo, etc.) |
|
|
22
|
+
| `project-trust.ts` | Demonstrates the `project_trust` event for user/global and CLI extensions |
|
|
22
23
|
| `protected-paths.ts` | Blocks writes to protected paths (.env, .git/, node_modules/) |
|
|
23
24
|
| `confirm-destructive.ts` | Confirms before destructive session actions (clear, switch, fork) |
|
|
24
25
|
| `dirty-repo-guard.ts` | Prevents session changes with uncommitted git changes |
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.79.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-custom-provider",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.79.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-gondolin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.79.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-gondolin",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.79.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@earendil-works/gondolin": "0.12.0"
|
|
12
12
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project Trust Extension
|
|
3
|
+
*
|
|
4
|
+
* Demonstrates the project_trust event. Install globally or pass via -e:
|
|
5
|
+
*
|
|
6
|
+
* mkdir -p ~/.pi/agent/extensions
|
|
7
|
+
* cp packages/coding-agent/examples/extensions/project-trust.ts ~/.pi/agent/extensions/
|
|
8
|
+
*
|
|
9
|
+
* Or:
|
|
10
|
+
*
|
|
11
|
+
* pi -e packages/coding-agent/examples/extensions/project-trust.ts
|
|
12
|
+
*
|
|
13
|
+
* Try it in a project containing .pi, AGENTS.md/CLAUDE.md, or .agents/skills.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import type { ExtensionAPI, ProjectTrustEventResult } from "@earendil-works/pi-coding-agent";
|
|
17
|
+
|
|
18
|
+
export default function (pi: ExtensionAPI) {
|
|
19
|
+
let loadCount = 0;
|
|
20
|
+
loadCount++;
|
|
21
|
+
|
|
22
|
+
// Multiple handlers in one extension are allowed. The first handler that returns
|
|
23
|
+
// { trusted: "yes" } or { trusted: "no" } wins and suppresses the built-in
|
|
24
|
+
// trust prompt. Return { trusted: "undecided" } to let another handler or the
|
|
25
|
+
// built-in flow decide.
|
|
26
|
+
pi.on("project_trust", async (event, ctx): Promise<ProjectTrustEventResult> => {
|
|
27
|
+
ctx.ui.notify(`project_trust fired for ${event.cwd} (mode: ${ctx.mode}, load: ${loadCount})`, "info");
|
|
28
|
+
|
|
29
|
+
if (!ctx.hasUI) {
|
|
30
|
+
return { trusted: "undecided" };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const choice = await ctx.ui.select(`Project trust for:\n${event.cwd}`, [
|
|
34
|
+
"Trust and remember",
|
|
35
|
+
"Trust with note and remember",
|
|
36
|
+
"Trust this session",
|
|
37
|
+
"Do not trust this session",
|
|
38
|
+
"Let built-in prompt decide",
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
if (choice === "Trust with note and remember") {
|
|
42
|
+
const note = await ctx.ui.input("Project trust note", "Optional note for this demo");
|
|
43
|
+
ctx.ui.notify(note ? `Recorded demo note: ${note}` : "No demo note entered", "info");
|
|
44
|
+
return { trusted: "yes", remember: true };
|
|
45
|
+
}
|
|
46
|
+
if (choice === "Trust and remember") {
|
|
47
|
+
return { trusted: "yes", remember: true };
|
|
48
|
+
}
|
|
49
|
+
if (choice === "Trust this session") {
|
|
50
|
+
return { trusted: "yes" };
|
|
51
|
+
}
|
|
52
|
+
if (choice === "Do not trust this session") {
|
|
53
|
+
return { trusted: "no" };
|
|
54
|
+
}
|
|
55
|
+
if (choice === "Let built-in prompt decide") {
|
|
56
|
+
return { trusted: "undecided" };
|
|
57
|
+
}
|
|
58
|
+
return { trusted: "undecided" };
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
pi.on("session_start", (_event, ctx) => {
|
|
62
|
+
ctx.ui.notify(`project-trust example loaded after trust resolution in ${ctx.cwd}`, "info");
|
|
63
|
+
});
|
|
64
|
+
}
|