@korallis/k-pi 0.1.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/CHANGELOG.md +5619 -0
- package/LICENSE +21 -0
- package/NOTICE +66 -0
- package/README.md +723 -0
- package/dist/bundle/chunks/anthropic-messages-IBCPCIJO.js +45 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-GUUG57CZ.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +74 -0
- package/dist/bundle/chunks/chunk-4L3WN2XY.js +2 -0
- package/dist/bundle/chunks/chunk-6CYCI3EJ.js +12 -0
- package/dist/bundle/chunks/chunk-6R7UI4IY.js +2 -0
- package/dist/bundle/chunks/chunk-AXIIZGTV.js +2 -0
- package/dist/bundle/chunks/chunk-CO7LIZG5.js +2 -0
- package/dist/bundle/chunks/chunk-DRQDKNXA.js +2 -0
- package/dist/bundle/chunks/chunk-GMWCTUPB.js +2 -0
- package/dist/bundle/chunks/chunk-HOFU6X66.js +50 -0
- package/dist/bundle/chunks/chunk-JUUC5AZY.js +2 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
- package/dist/bundle/chunks/chunk-MNAIPA3J.js +2 -0
- package/dist/bundle/chunks/chunk-NBBFIJUL.js +11 -0
- package/dist/bundle/chunks/chunk-NUHFSC37.js +25 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
- package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
- package/dist/bundle/chunks/chunk-TRDNDS6A.js +4 -0
- package/dist/bundle/chunks/chunk-UAQELI3K.js +2 -0
- package/dist/bundle/chunks/chunk-X5QHCKY4.js +1653 -0
- package/dist/bundle/chunks/chunk-XDUWOHPL.js +6 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-generative-ai-YRXF7C4I.js +2 -0
- package/dist/bundle/chunks/google-vertex-BVZ6VBRQ.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/lib-HGQMNYVT.js +9 -0
- package/dist/bundle/chunks/mistral-conversations-Q3AWZJAZ.js +5 -0
- package/dist/bundle/chunks/multipart-parser-SQ6GDJL7.js +3 -0
- package/dist/bundle/chunks/openai-codex-responses-GJVBJXLB.js +8 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-OICQQ5JB.js +7 -0
- package/dist/bundle/chunks/openai-responses-P5LIZTXX.js +2 -0
- package/dist/bundle/chunks/openrouter-images-XTKS2AS3.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pi-messages-TPFH44NP.js +8 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/src-UK77SYZE.js +4 -0
- package/dist/bundle/chunks/xai.js +2 -0
- package/dist/bundle/cli.js +3 -0
- package/dist/bundle/client.js +2 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1864 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +78 -0
- package/dist/kpi/graphs/coding-loop.auto.json +377 -0
- package/dist/kpi/graphs/coding-loop.gated.json +417 -0
- package/dist/kpi/graphs/spec-first.json +40 -0
- package/dist/kpi/kstack/NOTICE +5 -0
- package/dist/kpi/kstack/UPSTREAM.md +23 -0
- package/dist/kpi/kstack/generated/LICENSE +21 -0
- package/dist/kpi/kstack/generated/skills/architect/SKILL.md +83 -0
- package/dist/kpi/kstack/generated/skills/architect/references/design-red-flags.md +33 -0
- package/dist/kpi/kstack/generated/skills/architect/references/rationale-template.md +35 -0
- package/dist/kpi/kstack/generated/skills/architect/references/runner-prompt.md +20 -0
- package/dist/kpi/kstack/generated/skills/arena/SKILL.md +29 -0
- package/dist/kpi/kstack/generated/skills/blast-radius/SKILL.md +50 -0
- package/dist/kpi/kstack/generated/skills/bro/SKILL.md +7 -0
- package/dist/kpi/kstack/generated/skills/create-verification-skill/SKILL.md +44 -0
- package/dist/kpi/kstack/generated/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
- package/dist/kpi/kstack/generated/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
- package/dist/kpi/kstack/generated/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
- package/dist/kpi/kstack/generated/skills/figure-it-out/SKILL.md +55 -0
- package/dist/kpi/kstack/generated/skills/how/SKILL.md +135 -0
- package/dist/kpi/kstack/generated/skills/how/references/critic-prompt.md +59 -0
- package/dist/kpi/kstack/generated/skills/how/references/critique-rubric.md +58 -0
- package/dist/kpi/kstack/generated/skills/how/references/explainer-prompt.md +55 -0
- package/dist/kpi/kstack/generated/skills/how/references/explorer-prompt.md +52 -0
- package/dist/kpi/kstack/generated/skills/interrogate/SKILL.md +113 -0
- package/dist/kpi/kstack/generated/skills/interrogate/references/code-quality-review.md +47 -0
- package/dist/kpi/kstack/generated/skills/interrogate/references/lead-judgment.md +58 -0
- package/dist/kpi/kstack/generated/skills/interrogate/references/reviewer-prompt.md +72 -0
- package/dist/kpi/kstack/generated/skills/interrogate/references/rubric.md +77 -0
- package/dist/kpi/kstack/generated/skills/k-agent/SKILL.md +17 -0
- package/dist/kpi/kstack/generated/skills/k-mode/SKILL.md +64 -0
- package/dist/kpi/kstack/generated/skills/k-stack-principles/SKILL.md +24 -0
- package/dist/kpi/kstack/generated/skills/maintain-verification-skill/SKILL.md +39 -0
- package/dist/kpi/kstack/generated/skills/no-comments/SKILL.md +24 -0
- package/dist/kpi/kstack/generated/skills/playbook-arena/SKILL.md +20 -0
- package/dist/kpi/kstack/generated/skills/playbook-autonomous-run/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/playbook-autopilot-full/SKILL.md +20 -0
- package/dist/kpi/kstack/generated/skills/playbook-autopilot-stack/SKILL.md +20 -0
- package/dist/kpi/kstack/generated/skills/playbook-bug-fix/SKILL.md +21 -0
- package/dist/kpi/kstack/generated/skills/playbook-feature/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/playbook-investigation/SKILL.md +21 -0
- package/dist/kpi/kstack/generated/skills/playbook-shipping/SKILL.md +18 -0
- package/dist/kpi/kstack/generated/skills/playbook-swarm/SKILL.md +20 -0
- package/dist/kpi/kstack/generated/skills/principle-boundary-discipline/SKILL.md +34 -0
- package/dist/kpi/kstack/generated/skills/principle-build-the-lever/SKILL.md +23 -0
- package/dist/kpi/kstack/generated/skills/principle-encode-lessons-in-structure/SKILL.md +31 -0
- package/dist/kpi/kstack/generated/skills/principle-exhaust-the-design-space/SKILL.md +21 -0
- package/dist/kpi/kstack/generated/skills/principle-experience-first/SKILL.md +19 -0
- package/dist/kpi/kstack/generated/skills/principle-fix-root-causes/SKILL.md +23 -0
- package/dist/kpi/kstack/generated/skills/principle-foundational-thinking/SKILL.md +21 -0
- package/dist/kpi/kstack/generated/skills/principle-guard-the-context-window/SKILL.md +17 -0
- package/dist/kpi/kstack/generated/skills/principle-laziness-protocol/SKILL.md +18 -0
- package/dist/kpi/kstack/generated/skills/principle-make-operations-idempotent/SKILL.md +24 -0
- package/dist/kpi/kstack/generated/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/principle-minimize-reader-load/SKILL.md +23 -0
- package/dist/kpi/kstack/generated/skills/principle-model-the-domain/SKILL.md +26 -0
- package/dist/kpi/kstack/generated/skills/principle-never-block-on-the-human/SKILL.md +23 -0
- package/dist/kpi/kstack/generated/skills/principle-outcome-oriented-execution/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/principle-prove-it-works/SKILL.md +33 -0
- package/dist/kpi/kstack/generated/skills/principle-redesign-from-first-principles/SKILL.md +16 -0
- package/dist/kpi/kstack/generated/skills/principle-separate-before-serializing-shared-state/SKILL.md +16 -0
- package/dist/kpi/kstack/generated/skills/principle-sequence-verifiable-units/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/principle-subtract-before-you-add/SKILL.md +22 -0
- package/dist/kpi/kstack/generated/skills/principle-type-system-discipline/SKILL.md +31 -0
- package/dist/kpi/kstack/generated/skills/recall/SKILL.md +35 -0
- package/dist/kpi/kstack/generated/skills/reflect/SKILL.md +77 -0
- package/dist/kpi/kstack/generated/skills/reflect/references/divergent-reviewer.md +43 -0
- package/dist/kpi/kstack/generated/skills/reflect/references/judgment-reviewer.md +42 -0
- package/dist/kpi/kstack/generated/skills/reflect/references/synthesizer.md +56 -0
- package/dist/kpi/kstack/generated/skills/reflect/references/tooling-reviewer.md +57 -0
- package/dist/kpi/kstack/generated/skills/setup-kstack/SKILL.md +48 -0
- package/dist/kpi/kstack/generated/skills/show-me-your-work/SKILL.md +82 -0
- package/dist/kpi/kstack/generated/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
- package/dist/kpi/kstack/generated/skills/show-me-your-work/scripts/log.sh +40 -0
- package/dist/kpi/kstack/generated/skills/swarm/SKILL.md +27 -0
- package/dist/kpi/kstack/generated/skills/tdd/SKILL.md +44 -0
- package/dist/kpi/kstack/generated/skills/teach/SKILL.md +21 -0
- package/dist/kpi/kstack/generated/skills/technical-writing/SKILL.md +130 -0
- package/dist/kpi/kstack/generated/skills/typescript-best-practices/SKILL.md +30 -0
- package/dist/kpi/kstack/generated/skills/typescript-best-practices/references/patterns.md +313 -0
- package/dist/kpi/kstack/generated/skills/unslop/SKILL.md +81 -0
- package/dist/kpi/kstack/generated/skills/why/SKILL.md +230 -0
- package/dist/kpi/kstack/generated/skills/why/references/epistemics.md +144 -0
- package/dist/kpi/kstack/generated/skills/why/references/investigator-prompt.md +103 -0
- package/dist/kpi/kstack/generated/skills/why/references/source-playbook.md +17 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/code-archaeology.md +88 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/databricks.md +70 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/datadog.md +99 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/incident-postmortem.md +15 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/linear.md +48 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/notion.md +55 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/sentry.md +100 -0
- package/dist/kpi/kstack/generated/skills/why/references/sources/slack.md +54 -0
- package/dist/kpi/kstack/generated/skills/why/references/synthesizer-prompt.md +135 -0
- package/dist/kpi/kstack/model-ladder.md +50 -0
- package/dist/kpi/kstack/provenance.json +17 -0
- package/dist/kpi/prompts/implement.md +6 -0
- package/dist/kpi/prompts/plan.md +6 -0
- package/dist/kpi/prompts/review.md +6 -0
- package/dist/kpi/prompts/ship.md +6 -0
- package/dist/kpi/prompts/specify.md +6 -0
- package/dist/kpi/prompts/verify.md +6 -0
- package/dist/kpi/schemas/event.schema.json +1314 -0
- package/dist/kpi/schemas/evidence.schema.json +43 -0
- package/dist/kpi/schemas/stack.schema.json +102 -0
- package/dist/kpi/schemas/task.schema.json +165 -0
- package/dist/kpi/schemas/verdict.schema.json +44 -0
- package/dist/kpi/skills/concise-output/SKILL.md +10 -0
- package/dist/kpi/skills/context-pack/SKILL.md +10 -0
- package/dist/kpi/skills/conventional-commit/SKILL.md +12 -0
- package/dist/kpi/skills/isolated-review/SKILL.md +10 -0
- package/dist/kpi/skills/kg-claim/SKILL.md +26 -0
- package/dist/kpi/skills/minimalist/SKILL.md +24 -0
- package/dist/kpi/skills/quality-gates/SKILL.md +10 -0
- package/dist/kpi/skills/spec-first/SKILL.md +10 -0
- package/dist/kpi/skills/tdd-cycle/SKILL.md +10 -0
- package/dist/kpi/templates/AGENTS.md +31 -0
- package/dist/kpi/templates/APPEND_SYSTEM.md +13 -0
- package/dist/kpi/templates/context-pack/product.md +7 -0
- package/dist/kpi/templates/context-pack/structure.md +7 -0
- package/dist/kpi/templates/context-pack/tech.md +9 -0
- package/dist/kpi/templates/policy.json +17 -0
- package/dist/kpi/themes/loop-amber.json +82 -0
- package/dist/kpi/themes/protocol-blue.json +82 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/theme/dark.json +90 -0
- package/dist/modes/interactive/theme/light.json +89 -0
- package/dist/modes/interactive/theme/theme-schema.json +352 -0
- package/docs/compaction.md +418 -0
- package/docs/containerization.md +111 -0
- package/docs/custom-provider.md +777 -0
- package/docs/development.md +71 -0
- package/docs/docs.json +156 -0
- package/docs/environment-variables.md +97 -0
- package/docs/extensions.md +3020 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +84 -0
- package/docs/json.md +98 -0
- package/docs/keybindings.md +236 -0
- package/docs/llama-cpp.md +101 -0
- package/docs/models.md +571 -0
- package/docs/packages.md +228 -0
- package/docs/prompt-templates.md +96 -0
- package/docs/providers.md +317 -0
- package/docs/quickstart.md +167 -0
- package/docs/rpc.md +1618 -0
- package/docs/sdk.md +1219 -0
- package/docs/security.md +59 -0
- package/docs/session-format.md +438 -0
- package/docs/sessions.md +145 -0
- package/docs/settings.md +369 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +232 -0
- package/docs/terminal-setup.md +177 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +320 -0
- package/docs/tmux.md +63 -0
- package/docs/tui.md +942 -0
- package/docs/usage.md +311 -0
- package/docs/windows.md +39 -0
- package/examples/README.md +25 -0
- package/examples/extensions/README.md +213 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +150 -0
- package/examples/extensions/built-in-tool-renderer.ts +249 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +117 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +611 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/entry-renderer.ts +41 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/gondolin/index.ts +531 -0
- package/examples/extensions/gondolin/package-lock.json +185 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +190 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/kimi-deferred-tools.ts +61 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +426 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +57 -0
- package/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/examples/extensions/overlay-test.ts +153 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +66 -0
- package/examples/extensions/plan-mode/index.ts +390 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +436 -0
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +118 -0
- package/examples/extensions/question.ts +286 -0
- package/examples/extensions/questionnaire.ts +448 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +321 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +177 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +157 -0
- package/examples/extensions/subagent/index.ts +1038 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +199 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +297 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +146 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +195 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/rpc-extension-ui.ts +641 -0
- package/examples/sdk/01-minimal.ts +26 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +75 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/06-extensions.ts +99 -0
- package/examples/sdk/07-context-files.ts +47 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +74 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +140 -0
- package/package.json +55 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Development
|
|
2
|
+
|
|
3
|
+
See [AGENTS.md](https://github.com/earendil-works/pi-mono/blob/main/AGENTS.md) for additional guidelines.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/earendil-works/pi-mono
|
|
9
|
+
cd pi-mono
|
|
10
|
+
npm install
|
|
11
|
+
npm run build
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Run from source:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
/path/to/pi-mono/pi-test.sh
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The script can be run from any directory. Pi keeps the caller's current working directory.
|
|
21
|
+
|
|
22
|
+
## Forking / Rebranding
|
|
23
|
+
|
|
24
|
+
Configure via `package.json`:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"piConfig": {
|
|
29
|
+
"name": "pi",
|
|
30
|
+
"configDir": ".pi"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Change `name`, `configDir`, and `bin` field for your fork. Affects CLI banner, config paths, and environment variable names.
|
|
36
|
+
|
|
37
|
+
## Path Resolution
|
|
38
|
+
|
|
39
|
+
Three execution modes: npm install, standalone binary, tsx from source.
|
|
40
|
+
|
|
41
|
+
**Always use `src/config.ts`** for package assets:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { getPackageDir, getThemeDir } from "./config.js";
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Never use `__dirname` directly for package assets.
|
|
48
|
+
|
|
49
|
+
## Debug Command
|
|
50
|
+
|
|
51
|
+
`/debug` (hidden) writes to `~/.pi/agent/pi-debug.log`:
|
|
52
|
+
- Rendered TUI lines with ANSI codes
|
|
53
|
+
- Last messages sent to the LLM
|
|
54
|
+
|
|
55
|
+
## Testing
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
./test.sh # Run non-LLM tests (no API keys needed)
|
|
59
|
+
npm test # Run all tests
|
|
60
|
+
npm test -- test/specific.test.ts # Run specific test
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Project Structure
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
packages/
|
|
67
|
+
ai/ # LLM provider abstraction
|
|
68
|
+
agent/ # Agent loop and message types
|
|
69
|
+
tui/ # Terminal UI components
|
|
70
|
+
coding-agent/ # CLI and interactive mode
|
|
71
|
+
```
|
package/docs/docs.json
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
{
|
|
2
|
+
"navigation": [
|
|
3
|
+
{
|
|
4
|
+
"title": "Start here",
|
|
5
|
+
"items": [
|
|
6
|
+
{
|
|
7
|
+
"title": "Overview",
|
|
8
|
+
"path": "index.md"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"title": "Quickstart",
|
|
12
|
+
"path": "quickstart.md"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"title": "Using Pi",
|
|
16
|
+
"path": "usage.md"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"title": "Providers",
|
|
20
|
+
"path": "providers.md"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"title": "Security",
|
|
24
|
+
"path": "security.md"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"title": "Containerization",
|
|
28
|
+
"path": "containerization.md"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"title": "Settings",
|
|
32
|
+
"path": "settings.md"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"title": "Keybindings",
|
|
36
|
+
"path": "keybindings.md"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"title": "Sessions",
|
|
40
|
+
"path": "sessions.md"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"title": "Compaction",
|
|
44
|
+
"path": "compaction.md"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"title": "Customization",
|
|
50
|
+
"items": [
|
|
51
|
+
{
|
|
52
|
+
"title": "Extensions",
|
|
53
|
+
"path": "extensions.md"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"title": "Skills",
|
|
57
|
+
"path": "skills.md"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"title": "Prompt Templates",
|
|
61
|
+
"path": "prompt-templates.md"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"title": "Themes",
|
|
65
|
+
"path": "themes.md"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"title": "Pi Packages",
|
|
69
|
+
"path": "packages.md"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"title": "Custom Models",
|
|
73
|
+
"path": "models.md"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"title": "Custom Providers",
|
|
77
|
+
"path": "custom-provider.md"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"title": "Reference",
|
|
83
|
+
"items": [
|
|
84
|
+
{
|
|
85
|
+
"title": "Session Format",
|
|
86
|
+
"path": "session-format.md"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"title": "Programmatic Usage",
|
|
92
|
+
"items": [
|
|
93
|
+
{
|
|
94
|
+
"title": "SDK",
|
|
95
|
+
"path": "sdk.md"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"title": "RPC Mode",
|
|
99
|
+
"path": "rpc.md"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"title": "JSON Event Stream Mode",
|
|
103
|
+
"path": "json.md"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"title": "TUI Components",
|
|
107
|
+
"path": "tui.md"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"title": "Platform Setup",
|
|
113
|
+
"items": [
|
|
114
|
+
{
|
|
115
|
+
"title": "Windows",
|
|
116
|
+
"path": "windows.md"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"title": "Termux on Android",
|
|
120
|
+
"path": "termux.md"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"title": "tmux",
|
|
124
|
+
"path": "tmux.md"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"title": "Terminal Setup",
|
|
128
|
+
"path": "terminal-setup.md"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"title": "Shell Aliases",
|
|
132
|
+
"path": "shell-aliases.md"
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"title": "Development",
|
|
138
|
+
"items": [
|
|
139
|
+
{
|
|
140
|
+
"title": "Development",
|
|
141
|
+
"path": "development.md"
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"redirects": [
|
|
147
|
+
{
|
|
148
|
+
"from": "session.md",
|
|
149
|
+
"to": "session-format.md"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"from": "tree.md",
|
|
153
|
+
"to": "sessions.md"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Environment Variables
|
|
2
|
+
|
|
3
|
+
Pi uses environment variables in three ways:
|
|
4
|
+
|
|
5
|
+
- Variables such as `PI_OFFLINE` configure the Pi process.
|
|
6
|
+
- Pi sets process markers so child processes can identify Pi as the launching agent.
|
|
7
|
+
- Commands run by the LLM-callable shell tools receive `PI_*` variables describing the current session.
|
|
8
|
+
|
|
9
|
+
Provider API-key variables are documented separately in [Providers](providers.md#environment-variables-or-auth-file).
|
|
10
|
+
|
|
11
|
+
## Process Marker
|
|
12
|
+
|
|
13
|
+
The CLI and RPC entry points set two process markers:
|
|
14
|
+
|
|
15
|
+
- `AI_AGENT=pi` is a generic marker that lets tooling identify Pi as the agent that launched the process.
|
|
16
|
+
- `PI_CODING_AGENT=true` is Pi-specific and lets child processes detect that they run inside Pi.
|
|
17
|
+
|
|
18
|
+
Child processes inherit both markers. They are not session-specific and are not set automatically when Pi is embedded through the SDK.
|
|
19
|
+
|
|
20
|
+
## Shell Tool Session Environment
|
|
21
|
+
|
|
22
|
+
Commands run by the `bash` and `powershell` tools receive the current Pi session state:
|
|
23
|
+
|
|
24
|
+
| Variable | Description |
|
|
25
|
+
|----------|-------------|
|
|
26
|
+
| `PI_SESSION_ID` | Current session ID |
|
|
27
|
+
| `PI_SESSION_FILE` | Absolute path to the current session JSONL file; unset for ephemeral sessions |
|
|
28
|
+
| `PI_PROVIDER` | Currently selected model provider |
|
|
29
|
+
| `PI_MODEL` | Currently selected model ID |
|
|
30
|
+
| `PI_REASONING_LEVEL` | Current effective reasoning level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` |
|
|
31
|
+
|
|
32
|
+
The values are resolved when each command starts. Switching models or changing the reasoning level therefore affects the next shell command without restarting Pi. `PI_PROVIDER` and `PI_MODEL` identify the selected Pi model, not a different upstream model that a router may choose internally.
|
|
33
|
+
|
|
34
|
+
When asked which model or provider is running, inspect these variables instead of inferring the answer from the system prompt:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
printf '%s/%s\n' "$PI_PROVIDER" "$PI_MODEL"
|
|
38
|
+
printf 'reasoning=%s session=%s\n' "$PI_REASONING_LEVEL" "$PI_SESSION_ID"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The session file can be inspected directly when the session is persistent:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
if [ -n "$PI_SESSION_FILE" ]; then
|
|
45
|
+
tail -n 1 "$PI_SESSION_FILE"
|
|
46
|
+
fi
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
These variables are injected into the LLM-callable `bash` and `powershell` tools. They are not injected into user-entered `!` or `!!` commands.
|
|
50
|
+
|
|
51
|
+
### Custom Shell Tools
|
|
52
|
+
|
|
53
|
+
Tools created with `createBashTool()` or `createPowerShellTool()` expose the session environment by default when registered with Pi. Injection happens before `spawnHook`, so a hook receives the variables in `ctx.env`:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
const bashTool = createBashTool(cwd, {
|
|
57
|
+
spawnHook: (ctx) => ({
|
|
58
|
+
...ctx,
|
|
59
|
+
env: { ...ctx.env, CI: "1" },
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Disable session metadata independently of the spawn hook:
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
const powershellTool = createPowerShellTool(cwd, {
|
|
68
|
+
exposeSessionEnvironment: false,
|
|
69
|
+
spawnHook: (ctx) => ctx,
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
When disabled, Pi removes inherited values for these variables so nested Pi processes do not expose stale parent-session metadata.
|
|
74
|
+
|
|
75
|
+
## Pi Process Configuration
|
|
76
|
+
|
|
77
|
+
These variables are read by Pi itself:
|
|
78
|
+
|
|
79
|
+
| Variable | Description |
|
|
80
|
+
|----------|-------------|
|
|
81
|
+
| `PI_CODING_AGENT_DIR` | Override the config directory; default is `~/.pi/agent` |
|
|
82
|
+
| `PI_CODING_AGENT_SESSION_DIR` | Override session storage; overridden by `--session-dir` |
|
|
83
|
+
| `PI_PACKAGE_DIR` | Override the package directory, useful for Nix/Guix store paths |
|
|
84
|
+
| `PI_OFFLINE` | Disable startup network operations, including update checks, package updates, and install/update telemetry |
|
|
85
|
+
| `PI_SKIP_VERSION_CHECK` | Disable the `pi.dev` latest-version request |
|
|
86
|
+
| `PI_TELEMETRY` | Override install/update telemetry and provider attribution headers: `1`/`true`/`yes` or `0`/`false`/`no` |
|
|
87
|
+
| `PI_CACHE_RETENTION` | Set to `long` for extended provider prompt caching where supported |
|
|
88
|
+
| `PI_SHARE_VIEWER_URL` | Override the base URL used by `/share` |
|
|
89
|
+
| `PI_HARDWARE_CURSOR` | Set to `1` to show the hardware cursor; see [Terminal setup](terminal-setup.md) |
|
|
90
|
+
| `PI_HYPERLINKS` | Override OSC 8 hyperlink detection with `1`, `0`, or `auto` |
|
|
91
|
+
| `PI_IMAGE_PROTOCOL` | Override inline image detection with `kitty`, `iterm2`, `none`, or `auto` |
|
|
92
|
+
| `PI_TRUE_COLOR` | Override truecolor detection with `1`, `0`, or `auto` |
|
|
93
|
+
| `PI_TUI_ESC_TIMEOUT` | How long to wait after a lone ESC before treating it as Escape, in milliseconds; defaults to `100` over SSH and `10` otherwise. Increase if Alt-key input is misread as Escape |
|
|
94
|
+
| `VISUAL`, `EDITOR` | External editor fallback when `externalEditor` is unset |
|
|
95
|
+
| `HTTP_PROXY`, `HTTPS_PROXY` | Proxy outbound HTTP requests |
|
|
96
|
+
|
|
97
|
+
Provider credentials such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, and cloud-provider configuration are listed in [Providers](providers.md#environment-variables-or-auth-file).
|