apex-code 0.0.1-alpha.0 → 0.0.1-alpha.2
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 +24 -0
- package/README.md +66 -681
- package/dist/cli/args.d.ts +5 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +45 -6
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-command.d.ts.map +1 -1
- package/dist/cli/auth-command.js +3 -3
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/cli/cost-command.d.ts +19 -0
- package/dist/cli/cost-command.d.ts.map +1 -0
- package/dist/cli/cost-command.js +107 -0
- package/dist/cli/cost-command.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +1 -2
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +45 -16
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +14 -7
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +2 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +9 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +30 -4
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +46 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +137 -19
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +6 -6
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/context/deferred-schemas.d.ts +92 -0
- package/dist/core/context/deferred-schemas.d.ts.map +1 -0
- package/dist/core/context/deferred-schemas.js +74 -0
- package/dist/core/context/deferred-schemas.js.map +1 -0
- package/dist/core/context/eviction.d.ts +47 -0
- package/dist/core/context/eviction.d.ts.map +1 -0
- package/dist/core/context/eviction.js +83 -0
- package/dist/core/context/eviction.js.map +1 -0
- package/dist/core/context/pipeline.d.ts +90 -0
- package/dist/core/context/pipeline.d.ts.map +1 -0
- package/dist/core/context/pipeline.js +109 -0
- package/dist/core/context/pipeline.js.map +1 -0
- package/dist/core/credential-failover.d.ts +30 -0
- package/dist/core/credential-failover.d.ts.map +1 -0
- package/dist/core/credential-failover.js +46 -0
- package/dist/core/credential-failover.js.map +1 -0
- package/dist/core/credential-pool.d.ts +60 -0
- package/dist/core/credential-pool.d.ts.map +1 -0
- package/dist/core/credential-pool.js +84 -0
- package/dist/core/credential-pool.js.map +1 -0
- package/dist/core/delegation/agents.d.ts +15 -0
- package/dist/core/delegation/agents.d.ts.map +1 -0
- package/dist/core/delegation/agents.js +55 -0
- package/dist/core/delegation/agents.js.map +1 -0
- package/dist/core/delegation/ceiling.d.ts +29 -0
- package/dist/core/delegation/ceiling.d.ts.map +1 -0
- package/dist/core/delegation/ceiling.js +34 -0
- package/dist/core/delegation/ceiling.js.map +1 -0
- package/dist/core/delegation/runtime.d.ts +94 -0
- package/dist/core/delegation/runtime.d.ts.map +1 -0
- package/dist/core/delegation/runtime.js +117 -0
- package/dist/core/delegation/runtime.js.map +1 -0
- package/dist/core/durable-state/daemon.d.ts +37 -0
- package/dist/core/durable-state/daemon.d.ts.map +1 -0
- package/dist/core/durable-state/daemon.js +62 -0
- package/dist/core/durable-state/daemon.js.map +1 -0
- package/dist/core/durable-state/provenance.d.ts +7 -0
- package/dist/core/durable-state/provenance.d.ts.map +1 -0
- package/dist/core/durable-state/provenance.js +24 -0
- package/dist/core/durable-state/provenance.js.map +1 -0
- package/dist/core/durable-state/sqlite.d.ts +84 -0
- package/dist/core/durable-state/sqlite.d.ts.map +1 -0
- package/dist/core/durable-state/sqlite.js +331 -0
- package/dist/core/durable-state/sqlite.js.map +1 -0
- package/dist/core/environment.d.ts +12 -0
- package/dist/core/environment.d.ts.map +1 -0
- package/dist/core/environment.js +69 -0
- package/dist/core/environment.js.map +1 -0
- package/dist/core/evidence-policy.d.ts +17 -0
- package/dist/core/evidence-policy.d.ts.map +1 -0
- package/dist/core/evidence-policy.js +25 -0
- package/dist/core/evidence-policy.js.map +1 -0
- package/dist/core/evidence.d.ts +16 -0
- package/dist/core/evidence.d.ts.map +1 -0
- package/dist/core/evidence.js +51 -0
- package/dist/core/evidence.js.map +1 -0
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js +2 -1
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/extensions/types.d.ts +2 -0
- 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-config.d.ts +8 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +21 -5
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts +20 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +59 -0
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +73 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +225 -8
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/observability/aggregate.d.ts +21 -0
- package/dist/core/observability/aggregate.d.ts.map +1 -0
- package/dist/core/observability/aggregate.js +36 -0
- package/dist/core/observability/aggregate.js.map +1 -0
- package/dist/core/observability/otlp.d.ts +66 -0
- package/dist/core/observability/otlp.d.ts.map +1 -0
- package/dist/core/observability/otlp.js +95 -0
- package/dist/core/observability/otlp.js.map +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +3 -2
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/permissions/gate.d.ts +35 -0
- package/dist/core/permissions/gate.d.ts.map +1 -0
- package/dist/core/permissions/gate.js +72 -0
- package/dist/core/permissions/gate.js.map +1 -0
- package/dist/core/permissions/modes.d.ts +18 -0
- package/dist/core/permissions/modes.d.ts.map +1 -0
- package/dist/core/permissions/modes.js +57 -0
- package/dist/core/permissions/modes.js.map +1 -0
- package/dist/core/permissions/responder.d.ts +30 -0
- package/dist/core/permissions/responder.d.ts.map +1 -0
- package/dist/core/permissions/responder.js +32 -0
- package/dist/core/permissions/responder.js.map +1 -0
- package/dist/core/permissions/rules.d.ts +34 -0
- package/dist/core/permissions/rules.d.ts.map +1 -0
- package/dist/core/permissions/rules.js +74 -0
- package/dist/core/permissions/rules.js.map +1 -0
- package/dist/core/permissions/startup.d.ts +33 -0
- package/dist/core/permissions/startup.d.ts.map +1 -0
- package/dist/core/permissions/startup.js +55 -0
- package/dist/core/permissions/startup.js.map +1 -0
- package/dist/core/permissions/store.d.ts +114 -0
- package/dist/core/permissions/store.d.ts.map +1 -0
- package/dist/core/permissions/store.js +229 -0
- package/dist/core/permissions/store.js.map +1 -0
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/provider-attribution.d.ts.map +1 -1
- package/dist/core/provider-attribution.js +6 -7
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +2 -2
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +20 -16
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/sandbox/child-entry.d.ts +2 -0
- package/dist/core/sandbox/child-entry.d.ts.map +1 -0
- package/dist/core/sandbox/child-entry.js +11 -0
- package/dist/core/sandbox/child-entry.js.map +1 -0
- package/dist/core/sandbox/cli-launch.d.ts +27 -0
- package/dist/core/sandbox/cli-launch.d.ts.map +1 -0
- package/dist/core/sandbox/cli-launch.js +133 -0
- package/dist/core/sandbox/cli-launch.js.map +1 -0
- package/dist/core/sandbox/cli-supervisor.d.ts +25 -0
- package/dist/core/sandbox/cli-supervisor.d.ts.map +1 -0
- package/dist/core/sandbox/cli-supervisor.js +57 -0
- package/dist/core/sandbox/cli-supervisor.js.map +1 -0
- package/dist/core/sandbox/linux-backend.d.ts +18 -0
- package/dist/core/sandbox/linux-backend.d.ts.map +1 -0
- package/dist/core/sandbox/linux-backend.js +186 -0
- package/dist/core/sandbox/linux-backend.js.map +1 -0
- package/dist/core/sandbox/macos-backend.d.ts +18 -0
- package/dist/core/sandbox/macos-backend.d.ts.map +1 -0
- package/dist/core/sandbox/macos-backend.js +195 -0
- package/dist/core/sandbox/macos-backend.js.map +1 -0
- package/dist/core/sandbox/network-proxy.d.ts +19 -0
- package/dist/core/sandbox/network-proxy.d.ts.map +1 -0
- package/dist/core/sandbox/network-proxy.js +79 -0
- package/dist/core/sandbox/network-proxy.js.map +1 -0
- package/dist/core/sandbox/policy.d.ts +32 -0
- package/dist/core/sandbox/policy.d.ts.map +1 -0
- package/dist/core/sandbox/policy.js +38 -0
- package/dist/core/sandbox/policy.js.map +1 -0
- package/dist/core/sandbox/supervisor.d.ts +31 -0
- package/dist/core/sandbox/supervisor.d.ts.map +1 -0
- package/dist/core/sandbox/supervisor.js +18 -0
- package/dist/core/sandbox/supervisor.js.map +1 -0
- package/dist/core/sandbox/violations.d.ts +23 -0
- package/dist/core/sandbox/violations.d.ts.map +1 -0
- package/dist/core/sandbox/violations.js +30 -0
- package/dist/core/sandbox/violations.js.map +1 -0
- package/dist/core/sdk.d.ts +20 -36
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +129 -2
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +41 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +57 -0
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-share.d.ts +16 -0
- package/dist/core/session-share.d.ts.map +1 -0
- package/dist/core/session-share.js +22 -0
- package/dist/core/session-share.js.map +1 -0
- package/dist/core/settings-manager.d.ts +38 -9
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +39 -24
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +5 -5
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/timings.d.ts +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +3 -2
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/ask-user.d.ts +25 -0
- package/dist/core/tools/ask-user.d.ts.map +1 -0
- package/dist/core/tools/ask-user.js +49 -0
- package/dist/core/tools/ask-user.js.map +1 -0
- package/dist/core/tools/bash-command-segments.d.ts +22 -0
- package/dist/core/tools/bash-command-segments.d.ts.map +1 -0
- package/dist/core/tools/bash-command-segments.js +128 -0
- package/dist/core/tools/bash-command-segments.js.map +1 -0
- package/dist/core/tools/bash.d.ts +26 -3
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +105 -16
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/contract.d.ts +156 -0
- package/dist/core/tools/contract.d.ts.map +1 -0
- package/dist/core/tools/contract.js +48 -0
- package/dist/core/tools/contract.js.map +1 -0
- package/dist/core/tools/delegate.d.ts +38 -0
- package/dist/core/tools/delegate.d.ts.map +1 -0
- package/dist/core/tools/delegate.js +66 -0
- package/dist/core/tools/delegate.js.map +1 -0
- package/dist/core/tools/edit.d.ts +2 -2
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +24 -0
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +2 -2
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +12 -0
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +2 -2
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +12 -0
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +29 -4
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +118 -2
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +2 -2
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +12 -0
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +1 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/path-permission.d.ts +18 -0
- package/dist/core/tools/path-permission.d.ts.map +1 -0
- package/dist/core/tools/path-permission.js +28 -0
- package/dist/core/tools/path-permission.js.map +1 -0
- package/dist/core/tools/plan-present.d.ts +27 -0
- package/dist/core/tools/plan-present.d.ts.map +1 -0
- package/dist/core/tools/plan-present.js +55 -0
- package/dist/core/tools/plan-present.js.map +1 -0
- package/dist/core/tools/read.d.ts +2 -2
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +12 -0
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/test.d.ts +34 -0
- package/dist/core/tools/test.d.ts.map +1 -0
- package/dist/core/tools/test.js +75 -0
- package/dist/core/tools/test.js.map +1 -0
- package/dist/core/tools/todo-write.d.ts +31 -0
- package/dist/core/tools/todo-write.d.ts.map +1 -0
- package/dist/core/tools/todo-write.js +51 -0
- package/dist/core/tools/todo-write.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +13 -2
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +11 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/tool-schema.d.ts +22 -0
- package/dist/core/tools/tool-schema.d.ts.map +1 -0
- package/dist/core/tools/tool-schema.js +45 -0
- package/dist/core/tools/tool-schema.js.map +1 -0
- package/dist/core/tools/web-fetch.d.ts +26 -0
- package/dist/core/tools/web-fetch.d.ts.map +1 -0
- package/dist/core/tools/web-fetch.js +62 -0
- package/dist/core/tools/web-fetch.js.map +1 -0
- package/dist/core/tools/web-search.d.ts +26 -0
- package/dist/core/tools/web-search.d.ts.map +1 -0
- package/dist/core/tools/web-search.js +53 -0
- package/dist/core/tools/web-search.js.map +1 -0
- package/dist/core/tools/write.d.ts +6 -2
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +32 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/usage-performance-store.d.ts +56 -0
- package/dist/core/usage-performance-store.d.ts.map +1 -0
- package/dist/core/usage-performance-store.js +85 -0
- package/dist/core/usage-performance-store.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +48 -6
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +2 -2
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +9 -6
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +1 -4
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +11 -39
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +8 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +49 -20
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -2
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +6 -6
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +2 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +58 -9
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +2 -3
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +92 -104
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +2 -2
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +15 -10
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/rpc-entry.d.ts.map +1 -1
- package/dist/rpc-entry.js +2 -1
- package/dist/rpc-entry.js.map +1 -1
- package/dist/server/create-harness.d.ts +1 -1
- package/dist/server/create-harness.d.ts.map +1 -1
- package/dist/server/create-harness.js +6 -5
- package/dist/server/create-harness.js.map +1 -1
- package/dist/testing/replay/metrics.d.ts +24 -0
- package/dist/testing/replay/metrics.d.ts.map +1 -0
- package/dist/testing/replay/metrics.js +35 -0
- package/dist/testing/replay/metrics.js.map +1 -0
- package/dist/testing/replay/recorded-provider.d.ts +10 -0
- package/dist/testing/replay/recorded-provider.d.ts.map +1 -0
- package/dist/testing/replay/recorded-provider.js +108 -0
- package/dist/testing/replay/recorded-provider.js.map +1 -0
- package/dist/testing/replay/runner.d.ts +56 -0
- package/dist/testing/replay/runner.d.ts.map +1 -0
- package/dist/testing/replay/runner.js +406 -0
- package/dist/testing/replay/runner.js.map +1 -0
- package/dist/utils/apex-code-user-agent.d.ts +2 -0
- package/dist/utils/apex-code-user-agent.d.ts.map +1 -0
- package/dist/utils/apex-code-user-agent.js +5 -0
- package/dist/utils/apex-code-user-agent.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +32 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +198 -100
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +5 -5
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +23 -14
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/dist/utils/windows-self-update.js +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/docs/compaction.md +21 -21
- package/docs/containerization.md +24 -21
- package/docs/custom-provider.md +9 -9
- package/docs/development.md +11 -11
- package/docs/environment-variables.md +36 -77
- package/docs/extensions.md +47 -47
- package/docs/index.md +12 -24
- package/docs/json.md +6 -6
- package/docs/keybindings.md +3 -3
- package/docs/llama-cpp.md +7 -7
- package/docs/models.md +11 -11
- package/docs/packages.md +46 -42
- package/docs/prompt-templates.md +3 -3
- package/docs/providers.md +10 -10
- package/docs/quickstart.md +49 -32
- package/docs/rpc.md +11 -11
- package/docs/sdk.md +4 -4
- package/docs/security.md +18 -18
- package/docs/session-format.md +9 -9
- package/docs/sessions.md +13 -13
- package/docs/settings.md +10 -14
- package/docs/shell-aliases.md +1 -1
- package/docs/skills.md +8 -8
- package/docs/terminal-setup.md +12 -12
- package/docs/termux.md +4 -4
- package/docs/themes.md +8 -8
- package/docs/tmux.md +4 -4
- package/docs/tui.md +3 -3
- package/docs/usage.md +54 -51
- package/docs/windows.md +1 -1
- package/npm-shrinkwrap.json +5 -5
- package/package.json +2 -3
- package/dist/core/telemetry.d.ts +0 -3
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js +0 -9
- package/dist/core/telemetry.js.map +0 -1
- package/dist/utils/pi-user-agent.d.ts +0 -2
- package/dist/utils/pi-user-agent.d.ts.map +0 -1
- package/dist/utils/pi-user-agent.js +0 -5
- package/dist/utils/pi-user-agent.js.map +0 -1
package/docs/extensions.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
>
|
|
1
|
+
> Apex Code can create extensions. Ask it to build one for your use case.
|
|
2
2
|
|
|
3
3
|
# Extensions
|
|
4
4
|
|
|
5
|
-
Extensions are TypeScript modules that extend
|
|
5
|
+
Extensions are TypeScript modules that extend Apex Code's behavior. They can subscribe to lifecycle events, register custom tools callable by the LLM, add commands, and more.
|
|
6
6
|
|
|
7
|
-
> **Placement for /reload:** Put extensions in `~/.apex-code/agent/extensions/` (global) or `.apex-code/extensions/` (project-local) for auto-discovery. Use `
|
|
7
|
+
> **Placement for /reload:** Put extensions in `~/.apex-code/agent/extensions/` (global) or `.apex-code/extensions/` (project-local) for auto-discovery. Use `apex-code -e ./path.ts` only for quick tests. Extensions in auto-discovered locations can be hot-reloaded with `/reload`.
|
|
8
8
|
|
|
9
9
|
**Key capabilities:**
|
|
10
10
|
- **Custom tools** - Register tools the LLM can call via `pi.registerTool()`
|
|
@@ -103,7 +103,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
103
103
|
Test with `--extension` (or `-e`) flag:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
-
|
|
106
|
+
apex-code -e ./my-extension.ts
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
## Extension Locations
|
|
@@ -134,7 +134,7 @@ Additional paths via `settings.json`:
|
|
|
134
134
|
}
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
To share extensions via npm or git as
|
|
137
|
+
To share extensions via npm or git as Apex Code packages, see [packages.md](packages.md).
|
|
138
138
|
|
|
139
139
|
## Available Imports
|
|
140
140
|
|
|
@@ -147,7 +147,7 @@ To share extensions via npm or git as pi packages, see [packages.md](packages.md
|
|
|
147
147
|
|
|
148
148
|
npm dependencies work too. Add a `package.json` next to your extension (or in a parent directory), run `npm install`, and imports from `node_modules/` are resolved automatically.
|
|
149
149
|
|
|
150
|
-
For distributed
|
|
150
|
+
For distributed Apex Code packages installed with `apex-code install` (npm or git), runtime deps must be in `dependencies`. Package installation uses production installs (`npm install --omit=dev`) by default, so `devDependencies` are not available at runtime; when `npmCommand` is configured, git packages use plain `install` for compatibility with wrappers.
|
|
151
151
|
|
|
152
152
|
Node.js built-ins (`node:fs`, `node:path`, etc.) are also available.
|
|
153
153
|
|
|
@@ -215,7 +215,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
215
215
|
}
|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
-
This pattern makes the fetched models available during normal startup and to `
|
|
218
|
+
This pattern makes the fetched models available during normal startup and to `apex-code --list-models`.
|
|
219
219
|
|
|
220
220
|
### Long-lived resources and shutdown
|
|
221
221
|
|
|
@@ -275,7 +275,7 @@ Run `npm install` in the extension directory, then imports from `node_modules/`
|
|
|
275
275
|
### Lifecycle Overview
|
|
276
276
|
|
|
277
277
|
```
|
|
278
|
-
|
|
278
|
+
apex-code starts
|
|
279
279
|
│
|
|
280
280
|
├─► project_trust (user/global and CLI extensions only, before project resources load)
|
|
281
281
|
├─► session_start { reason: "startup" }
|
|
@@ -351,7 +351,7 @@ exit (Ctrl+C, Ctrl+D, SIGHUP, SIGTERM)
|
|
|
351
351
|
|
|
352
352
|
#### project_trust
|
|
353
353
|
|
|
354
|
-
Fired before
|
|
354
|
+
Fired before Apex Code decides whether to trust a project with dynamic configs (`.apex-code` 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.
|
|
355
355
|
|
|
356
356
|
```typescript
|
|
357
357
|
pi.on("project_trust", async (event, ctx) => {
|
|
@@ -364,7 +364,7 @@ pi.on("project_trust", async (event, ctx) => {
|
|
|
364
364
|
});
|
|
365
365
|
```
|
|
366
366
|
|
|
367
|
-
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
|
|
367
|
+
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 Apex Code asks, trusts, or declines by default.
|
|
368
368
|
|
|
369
369
|
### Resource Events
|
|
370
370
|
|
|
@@ -428,7 +428,7 @@ pi.on("session_before_switch", async (event, ctx) => {
|
|
|
428
428
|
});
|
|
429
429
|
```
|
|
430
430
|
|
|
431
|
-
After a successful switch or new-session action,
|
|
431
|
+
After a successful switch or new-session action, Apex Code emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "new" | "resume"` and `previousSessionFile`.
|
|
432
432
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
433
433
|
|
|
434
434
|
#### session_before_fork
|
|
@@ -445,7 +445,7 @@ pi.on("session_before_fork", async (event, ctx) => {
|
|
|
445
445
|
});
|
|
446
446
|
```
|
|
447
447
|
|
|
448
|
-
After a successful fork or clone,
|
|
448
|
+
After a successful fork or clone, Apex Code emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "fork"` and `previousSessionFile`.
|
|
449
449
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
450
450
|
|
|
451
451
|
#### session_before_compact / session_compact
|
|
@@ -551,13 +551,13 @@ pi.on("before_agent_start", async (event, ctx) => {
|
|
|
551
551
|
});
|
|
552
552
|
```
|
|
553
553
|
|
|
554
|
-
The `systemPromptOptions` field gives extensions access to the same structured data
|
|
554
|
+
The `systemPromptOptions` field gives extensions access to the same structured data Apex Code uses to build the system prompt. This lets you inspect what Apex Code has loaded — custom prompts, guidelines, tool snippets, context files, skills — without re-discovering resources or re-parsing flags. Use it when your extension needs to make deep, informed changes to the system prompt while respecting user-provided configuration.
|
|
555
555
|
|
|
556
556
|
Inside `before_agent_start`, `event.systemPrompt` and `ctx.getSystemPrompt()` both reflect the chained system prompt as of the current handler. Later `before_agent_start` handlers can still modify it again.
|
|
557
557
|
|
|
558
558
|
#### agent_start / agent_end / agent_settled
|
|
559
559
|
|
|
560
|
-
`agent_start` fires when a low-level agent run begins. `agent_end` fires when that run ends, but
|
|
560
|
+
`agent_start` fires when a low-level agent run begins. `agent_end` fires when that run ends, but Apex Code may still auto-retry, auto-compact and retry, or continue with queued follow-up messages. Use `agent_settled` for status integrations that need to know Apex Code will not continue running automatically.
|
|
561
561
|
|
|
562
562
|
```typescript
|
|
563
563
|
pi.on("agent_start", async (_event, ctx) => {});
|
|
@@ -668,7 +668,7 @@ pi.on("before_provider_headers", (event, ctx) => {
|
|
|
668
668
|
// Add or override — e.g. a session id for gateway tracing/attribution
|
|
669
669
|
event.headers["x-session-id"] = ctx.sessionManager.getSessionId();
|
|
670
670
|
|
|
671
|
-
// Drop a tracking header
|
|
671
|
+
// Drop a tracking header Apex Code adds for this call
|
|
672
672
|
event.headers["X-OpenRouter-Title"] = null;
|
|
673
673
|
});
|
|
674
674
|
```
|
|
@@ -679,7 +679,7 @@ Runs once per provider request; retries reuse the same headers rather than re-fi
|
|
|
679
679
|
|
|
680
680
|
Fired after the provider-specific payload is built, right before the request is sent. Handlers run in extension load order. Returning `undefined` keeps the payload unchanged. Returning any other value replaces the payload for later handlers and for the actual request.
|
|
681
681
|
|
|
682
|
-
This hook can rewrite provider-level system instructions or remove them entirely. Those payload-level changes are not reflected by `ctx.getSystemPrompt()`, which reports
|
|
682
|
+
This hook can rewrite provider-level system instructions or remove them entirely. Those payload-level changes are not reflected by `ctx.getSystemPrompt()`, which reports Apex Code's system prompt string rather than the final serialized provider payload.
|
|
683
683
|
|
|
684
684
|
```typescript
|
|
685
685
|
pi.on("before_provider_request", (event, ctx) => {
|
|
@@ -752,7 +752,7 @@ Use this to update extension UI when `pi.setThinkingLevel()`, model changes, or
|
|
|
752
752
|
|
|
753
753
|
Fired after `tool_execution_start`, before the tool executes. **Can block.** Use `isToolCallEventType` to narrow and get typed inputs.
|
|
754
754
|
|
|
755
|
-
Before `tool_call` runs,
|
|
755
|
+
Before `tool_call` runs, Apex Code waits for previously emitted Agent events to finish draining through `AgentSession`. This means `ctx.sessionManager` is up to date through the current assistant tool-calling message.
|
|
756
756
|
|
|
757
757
|
In the default parallel tool execution mode, sibling tool calls from the same assistant message are preflighted sequentially, then executed concurrently. `tool_call` is not guaranteed to see sibling tool results from that same assistant message in `ctx.sessionManager`.
|
|
758
758
|
|
|
@@ -864,7 +864,7 @@ pi.on("user_bash", (event, ctx) => {
|
|
|
864
864
|
// Option 1: Provide custom operations (e.g., SSH)
|
|
865
865
|
return { operations: remoteBashOps };
|
|
866
866
|
|
|
867
|
-
// Option 2: Wrap
|
|
867
|
+
// Option 2: Wrap Apex Code's built-in local bash backend
|
|
868
868
|
const local = createLocalBashOperations();
|
|
869
869
|
return {
|
|
870
870
|
operations: {
|
|
@@ -950,7 +950,7 @@ Current run mode: `"tui"`, `"rpc"`, `"json"`, or `"print"`. Use `ctx.mode === "t
|
|
|
950
950
|
|
|
951
951
|
Current working directory.
|
|
952
952
|
|
|
953
|
-
Use `CONFIG_DIR_NAME` instead of hardcoding `.
|
|
953
|
+
Use `CONFIG_DIR_NAME` instead of hardcoding `.apex-code` when constructing project-local config paths. Rebranded distributions can use a different config directory name.
|
|
954
954
|
|
|
955
955
|
```typescript
|
|
956
956
|
import { CONFIG_DIR_NAME, type ExtensionAPI } from "apex-code";
|
|
@@ -999,7 +999,7 @@ Use this for abort-aware nested work started by extension handlers, for example:
|
|
|
999
999
|
- file or process helpers that accept `AbortSignal`
|
|
1000
1000
|
|
|
1001
1001
|
`ctx.signal` is typically defined during active turn events such as `tool_call`, `tool_result`, `message_update`, and `turn_end`.
|
|
1002
|
-
It is usually `undefined` in idle or non-turn contexts such as session events, extension commands, and shortcuts fired while
|
|
1002
|
+
It is usually `undefined` in idle or non-turn contexts such as session events, extension commands, and shortcuts fired while Apex Code is idle.
|
|
1003
1003
|
|
|
1004
1004
|
```typescript
|
|
1005
1005
|
pi.on("tool_result", async (event, ctx) => {
|
|
@@ -1016,11 +1016,11 @@ pi.on("tool_result", async (event, ctx) => {
|
|
|
1016
1016
|
|
|
1017
1017
|
### ctx.isIdle() / ctx.abort() / ctx.hasPendingMessages()
|
|
1018
1018
|
|
|
1019
|
-
Control flow helpers. `ctx.isIdle()` is false while
|
|
1019
|
+
Control flow helpers. `ctx.isIdle()` is false while Apex Code is processing an agent run, automatic retry, auto-compaction retry, or queued continuation.
|
|
1020
1020
|
|
|
1021
1021
|
### ctx.shutdown()
|
|
1022
1022
|
|
|
1023
|
-
Request a graceful shutdown of
|
|
1023
|
+
Request a graceful shutdown of Apex Code.
|
|
1024
1024
|
|
|
1025
1025
|
- **Interactive mode:** Deferred until the agent becomes idle (after processing all queued steering and follow-up messages).
|
|
1026
1026
|
- **RPC mode:** Deferred until the next idle state (after completing the current command response, when waiting for the next command).
|
|
@@ -1065,7 +1065,7 @@ ctx.compact({
|
|
|
1065
1065
|
|
|
1066
1066
|
### ctx.getSystemPrompt()
|
|
1067
1067
|
|
|
1068
|
-
Returns
|
|
1068
|
+
Returns Apex Code's current system prompt string.
|
|
1069
1069
|
|
|
1070
1070
|
- During `before_agent_start`, this reflects chained system-prompt changes made so far for the current turn.
|
|
1071
1071
|
- It does not include later `context` message mutations.
|
|
@@ -1085,7 +1085,7 @@ Command handlers receive `ExtensionCommandContext`, which extends `ExtensionCont
|
|
|
1085
1085
|
|
|
1086
1086
|
### ctx.getSystemPromptOptions()
|
|
1087
1087
|
|
|
1088
|
-
Returns the base inputs
|
|
1088
|
+
Returns the base inputs Apex Code currently uses to build the system prompt.
|
|
1089
1089
|
|
|
1090
1090
|
```typescript
|
|
1091
1091
|
const options = ctx.getSystemPromptOptions();
|
|
@@ -1495,7 +1495,7 @@ Labels persist in the session and survive restarts. Use them to mark important p
|
|
|
1495
1495
|
|
|
1496
1496
|
Register a command.
|
|
1497
1497
|
|
|
1498
|
-
If multiple extensions register the same command name,
|
|
1498
|
+
If multiple extensions register the same command name, Apex Code keeps them all and assigns numeric invocation suffixes in load order, for example `/review:1` and `/review:2`.
|
|
1499
1499
|
|
|
1500
1500
|
```typescript
|
|
1501
1501
|
pi.registerCommand("stats", {
|
|
@@ -1565,7 +1565,7 @@ Register a custom TUI renderer for custom messages with your `customType`. Custo
|
|
|
1565
1565
|
|
|
1566
1566
|
### pi.registerMarkdownTransformer(transformer)
|
|
1567
1567
|
|
|
1568
|
-
Register a transformer for the Markdown in normal user text, assistant text, and thinking blocks. Transformers run in extension load order, and each transformer receives the Markdown returned by the previous transformer. After the chain finishes,
|
|
1568
|
+
Register a transformer for the Markdown in normal user text, assistant text, and thinking blocks. Transformers run in extension load order, and each transformer receives the Markdown returned by the previous transformer. After the chain finishes, Apex Code renders the transformed content with its built-in renderer.
|
|
1569
1569
|
|
|
1570
1570
|
The transformer receives the Markdown string and a context with:
|
|
1571
1571
|
|
|
@@ -1582,7 +1582,7 @@ pi.registerMarkdownTransformer((markdown, { messageType, isStreaming }) => {
|
|
|
1582
1582
|
});
|
|
1583
1583
|
```
|
|
1584
1584
|
|
|
1585
|
-
If a transformer throws,
|
|
1585
|
+
If a transformer throws, Apex Code keeps the Markdown produced so far and continues with the next transformer. The hook is display-only: the original message remains unchanged in the session and model context. It runs for new user messages, assistant streaming updates, restored session messages, and terminal width changes, so transformers should remain synchronous and inexpensive.
|
|
1586
1586
|
|
|
1587
1587
|
### pi.registerEntryRenderer(customType, renderer)
|
|
1588
1588
|
|
|
@@ -1708,7 +1708,7 @@ Register or override a model provider dynamically. Useful for proxies, custom en
|
|
|
1708
1708
|
|
|
1709
1709
|
Calls made during the extension factory function are queued and applied once the runner initialises. Calls made after that — for example from a command handler following a user setup flow — take effect immediately without requiring a `/reload`.
|
|
1710
1710
|
|
|
1711
|
-
Dynamic providers can implement `refreshModels`.
|
|
1711
|
+
Dynamic providers can implement `refreshModels`. Apex Code calls it during model refresh, publishes the returned list synchronously through the provider, and passes the canonical credential/stored-catalog/network/signal context. The extension decides whether to persist catalog metadata through generation-checked `context.publish({ persist: entry })`; live servers such as llama.cpp can return models without persisting them.
|
|
1712
1712
|
|
|
1713
1713
|
`context.signal` is always a concrete signal and provider callbacks must pass it to blocking I/O. Public `ModelRuntime.refresh()` and `ModelRegistry.refresh()` calls accept an optional signal and are unbounded when it is omitted; extensions and applications choose their own deadlines. Cancellation stops the caller waiting even if a provider ignores the signal, but cooperation is still required to stop the underlying work.
|
|
1714
1714
|
|
|
@@ -1979,7 +1979,7 @@ pi.registerTool({
|
|
|
1979
1979
|
});
|
|
1980
1980
|
```
|
|
1981
1981
|
|
|
1982
|
-
**Usage accounting:** If a tool makes nested LLM calls, return their combined `Usage` as `usage`.
|
|
1982
|
+
**Usage accounting:** If a tool makes nested LLM calls, return their combined `Usage` as `usage`. Apex Code persists it on the tool result and includes it in footer, `/session`, and RPC session totals. `tool_result` handlers can inspect or replace this value.
|
|
1983
1983
|
|
|
1984
1984
|
**Signaling errors:** To mark a tool execution as failed (sets `isError: true` on the result and reports it to the LLM), throw an error from `execute`. Returning a value never sets the error flag regardless of what properties you include in the return object.
|
|
1985
1985
|
|
|
@@ -1997,7 +1997,7 @@ async execute(toolCallId, params) {
|
|
|
1997
1997
|
|
|
1998
1998
|
**Important:** Use `StringEnum` from `@earendil-works/pi-ai` for string enums. `Type.Union`/`Type.Literal` doesn't work with Google's API.
|
|
1999
1999
|
|
|
2000
|
-
**Argument preparation:** `prepareArguments(args)` is optional. If defined, it runs before schema validation and before `execute()`. Use it to mimic an older accepted input shape when
|
|
2000
|
+
**Argument preparation:** `prepareArguments(args)` is optional. If defined, it runs before schema validation and before `execute()`. Use it to mimic an older accepted input shape when Apex Code resumes an older session whose stored tool call arguments no longer match the current schema. Return the object you want validated against `parameters`. Keep the public schema strict. Do not add deprecated compatibility fields to `parameters` just to keep old resumed sessions working.
|
|
2001
2001
|
|
|
2002
2002
|
Example: an older session may contain an `edit` tool call with top-level `oldText` and `newText`, while the current schema only accepts `edits: [{ oldText, newText }]`.
|
|
2003
2003
|
|
|
@@ -2050,13 +2050,13 @@ Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`,
|
|
|
2050
2050
|
|
|
2051
2051
|
```bash
|
|
2052
2052
|
# Extension's read tool replaces built-in read
|
|
2053
|
-
|
|
2053
|
+
apex-code -e ./tool-override.ts
|
|
2054
2054
|
```
|
|
2055
2055
|
|
|
2056
2056
|
Alternatively, use `--no-builtin-tools` to start without any built-in tools while keeping extension tools enabled:
|
|
2057
2057
|
```bash
|
|
2058
2058
|
# No built-in tools, only extension tools
|
|
2059
|
-
|
|
2059
|
+
apex-code --no-builtin-tools -e ./my-extension.ts
|
|
2060
2060
|
```
|
|
2061
2061
|
|
|
2062
2062
|
See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.ts) for a complete example that overrides `read` with logging and access control.
|
|
@@ -2068,13 +2068,13 @@ See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.
|
|
|
2068
2068
|
**Your implementation must match the exact result shape**, including the `details` type. The UI and session logic depend on these shapes for rendering and state tracking.
|
|
2069
2069
|
|
|
2070
2070
|
Built-in tool implementations:
|
|
2071
|
-
- [read.ts](https://github.com/
|
|
2072
|
-
- [bash.ts](https://github.com/
|
|
2073
|
-
- [edit.ts](https://github.com/
|
|
2074
|
-
- [write.ts](https://github.com/
|
|
2075
|
-
- [grep.ts](https://github.com/
|
|
2076
|
-
- [find.ts](https://github.com/
|
|
2077
|
-
- [ls.ts](https://github.com/
|
|
2071
|
+
- [read.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/read.ts) - `ReadToolDetails`
|
|
2072
|
+
- [bash.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/bash.ts) - `BashToolDetails`
|
|
2073
|
+
- [edit.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/edit.ts)
|
|
2074
|
+
- [write.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/write.ts)
|
|
2075
|
+
- [grep.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/grep.ts) - `GrepToolDetails`
|
|
2076
|
+
- [find.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/find.ts) - `FindToolDetails`
|
|
2077
|
+
- [ls.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/ls.ts) - `LsToolDetails`
|
|
2078
2078
|
|
|
2079
2079
|
### Remote Execution
|
|
2080
2080
|
|
|
@@ -2107,7 +2107,7 @@ pi.registerTool({
|
|
|
2107
2107
|
|
|
2108
2108
|
**Operations interfaces:** `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
|
|
2109
2109
|
|
|
2110
|
-
For `user_bash`, extensions can reuse
|
|
2110
|
+
For `user_bash`, extensions can reuse Apex Code's local shell backend via `createLocalBashOperations()` instead of reimplementing local process spawning, shell resolution, and process-tree termination.
|
|
2111
2111
|
|
|
2112
2112
|
The bash tool also supports a spawn hook to adjust the command, cwd, or env before execution:
|
|
2113
2113
|
|
|
@@ -2205,7 +2205,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2205
2205
|
|
|
2206
2206
|
### Custom Rendering
|
|
2207
2207
|
|
|
2208
|
-
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/
|
|
2208
|
+
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/modes/interactive/components/tool-execution.ts) for how tool rows are composed.
|
|
2209
2209
|
|
|
2210
2210
|
By default, tool output is wrapped in a `Box` that handles padding and background. A defined `renderCall` or `renderResult` must return a `Component`. If a slot renderer is not defined, `tool-execution.ts` uses fallback rendering for that slot.
|
|
2211
2211
|
|
|
@@ -2339,8 +2339,8 @@ The lifecycle is:
|
|
|
2339
2339
|
1. Register every tool with `pi.registerTool()` so it appears in `pi.getAllTools()`.
|
|
2340
2340
|
2. Keep loader tools, such as `search_tools`, active and leave searchable tools inactive.
|
|
2341
2341
|
3. During loader execution, call `pi.setActiveTools([...currentTools, ...matchingTools])`. The change must be additive: do not remove currently active tools in the same call.
|
|
2342
|
-
4.
|
|
2343
|
-
5. Before the next model response,
|
|
2342
|
+
4. Apex Code records which tools were added on the loader's tool result.
|
|
2343
|
+
5. Before the next model response, Apex Code exposes the added definitions using native deferred loading when supported, or the normal active tool list otherwise.
|
|
2344
2344
|
|
|
2345
2345
|
You do not need to return provider-specific tool references or mark the loader as a special search tool. The active-tool change is the signal. Names passed to `pi.setActiveTools()` must already be registered; unknown names are ignored.
|
|
2346
2346
|
|
|
@@ -2351,15 +2351,15 @@ You do not need to return provider-specific tool references or mark the loader a
|
|
|
2351
2351
|
- **Native representation:** Deferred definitions use `defer_loading`; the load point uses `tool_reference` content.
|
|
2352
2352
|
- **OpenAI**
|
|
2353
2353
|
- **Models:** `gpt-5.4` and newer family
|
|
2354
|
-
- **Native representation:**
|
|
2354
|
+
- **Native representation:** Apex Code adds completed client `tool_search_call` and `tool_search_output` items at the load point.
|
|
2355
2355
|
|
|
2356
2356
|
For a verified custom model or proxy, native handling can be enabled with `compat.supportsToolReferences: true` for `anthropic-messages`, or `compat.supportsToolSearch: true` for `openai-responses` and `openai-codex-responses`. Leave these disabled unless the endpoint and model accept the corresponding native protocol.
|
|
2357
2357
|
|
|
2358
2358
|
#### Fallback behavior
|
|
2359
2359
|
|
|
2360
|
-
For all other models and providers, dynamic activation still works:
|
|
2360
|
+
For all other models and providers, dynamic activation still works: Apex Code sends the complete current active tool list normally on the next request. The model can call the newly activated tools, but adding their definitions may invalidate the provider's cached prompt prefix.
|
|
2361
2361
|
|
|
2362
|
-
|
|
2362
|
+
Apex Code also uses this safe fallback when the active set is not purely additive, such as replacing one group of tools with another. Tool removals therefore work, but they do not use deferred loading.
|
|
2363
2363
|
|
|
2364
2364
|
For the best cache behavior, keep the loader tool active for the whole session and add tools instead of replacing the active set. Also note that activating a tool with `promptSnippet` or `promptGuidelines` rebuilds the system prompt; that system-prompt change can invalidate the prefix even when the provider supports deferred schemas. Lazily loaded tools should usually rely on their tool `description` and omit active-only prompt metadata.
|
|
2365
2365
|
|
|
@@ -2591,7 +2591,7 @@ ctx.ui.setFooter((tui, theme) => ({
|
|
|
2591
2591
|
ctx.ui.setFooter(undefined); // Restore built-in footer
|
|
2592
2592
|
|
|
2593
2593
|
// Terminal title
|
|
2594
|
-
ctx.ui.setTitle("
|
|
2594
|
+
ctx.ui.setTitle("apex-code - my-project");
|
|
2595
2595
|
|
|
2596
2596
|
// Editor text
|
|
2597
2597
|
ctx.ui.setEditorText("Prefill text");
|
package/docs/index.md
CHANGED
|
@@ -1,49 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Apex Code Documentation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Apex Code is a minimal terminal coding harness. It is designed to stay small at the core while being extended through TypeScript extensions, skills, prompt templates, themes, and Apex Code packages.
|
|
4
4
|
|
|
5
5
|
## Quick start
|
|
6
6
|
|
|
7
|
-
Install
|
|
7
|
+
Install Apex Code with npm, pnpm, Yarn, or Bun — all resolve it from the same npm registry:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm install -g --ignore-scripts apex-code
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
`--ignore-scripts` disables dependency lifecycle scripts during install.
|
|
13
|
+
`--ignore-scripts` disables dependency lifecycle scripts during install. Apex Code does not require install scripts for normal npm installs.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
curl -fsSL https://pi.dev/install.sh | sh
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
To uninstall pi itself, use npm for curl and npm installs:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npm uninstall -g apex-code
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
For pnpm, Yarn, or Bun installs, use the matching global remove command: `pnpm remove -g apex-code`, `yarn global remove apex-code`, or `bun uninstall -g apex-code`.
|
|
15
|
+
To uninstall, use the package manager that installed it: `npm uninstall -g apex-code`, `pnpm remove -g apex-code`, `yarn global remove apex-code`, or `bun uninstall -g apex-code`.
|
|
28
16
|
|
|
29
17
|
Then run it in a project directory:
|
|
30
18
|
|
|
31
19
|
```bash
|
|
32
|
-
|
|
20
|
+
apex-code
|
|
33
21
|
```
|
|
34
22
|
|
|
35
|
-
Authenticate with `/login` for subscription providers, or set an API key such as `ANTHROPIC_API_KEY` before starting
|
|
23
|
+
Authenticate with `/login` for subscription providers, or set an API key such as `ANTHROPIC_API_KEY` before starting Apex Code.
|
|
36
24
|
|
|
37
25
|
For the full first-run flow, see [Quickstart](quickstart.md).
|
|
38
26
|
|
|
39
27
|
## Start here
|
|
40
28
|
|
|
41
29
|
- [Quickstart](quickstart.md) - install, authenticate, and run a first session.
|
|
42
|
-
- [Using
|
|
30
|
+
- [Using Apex Code](usage.md) - interactive mode, slash commands, context files, and CLI reference.
|
|
43
31
|
- [Providers](providers.md) - subscription and API-key setup for built-in providers.
|
|
44
32
|
- [llama.cpp](llama-cpp.md) - run a local router and manage models with `/llama`.
|
|
45
33
|
- [Security](security.md) - project trust, sandbox boundaries, and vulnerability reporting.
|
|
46
|
-
- [Containerization](containerization.md) - sandbox
|
|
34
|
+
- [Containerization](containerization.md) - sandbox Apex Code with Gondolin, Docker, or OpenShell.
|
|
47
35
|
- [Settings](settings.md) - global and project settings.
|
|
48
36
|
- [Keybindings](keybindings.md) - default shortcuts and custom keybindings.
|
|
49
37
|
- [Sessions](sessions.md) - session management, branching, and tree navigation.
|
|
@@ -55,20 +43,20 @@ For the full first-run flow, see [Quickstart](quickstart.md).
|
|
|
55
43
|
- [Skills](skills.md) - Agent Skills for reusable on-demand capabilities.
|
|
56
44
|
- [Prompt templates](prompt-templates.md) - reusable prompts that expand from slash commands.
|
|
57
45
|
- [Themes](themes.md) - built-in and custom terminal themes.
|
|
58
|
-
- [
|
|
46
|
+
- [Apex Code packages](packages.md) - bundle and share extensions, skills, prompts, and themes.
|
|
59
47
|
- [Custom models](models.md) - add model entries for supported provider APIs.
|
|
60
48
|
- [Custom providers](custom-provider.md) - implement custom APIs and OAuth flows.
|
|
61
49
|
|
|
62
50
|
## Programmatic usage
|
|
63
51
|
|
|
64
|
-
- [SDK](sdk.md) - embed
|
|
52
|
+
- [SDK](sdk.md) - embed Apex Code in Node.js applications.
|
|
65
53
|
- [RPC mode](rpc.md) - integrate over stdin/stdout JSONL.
|
|
66
54
|
- [JSON event stream mode](json.md) - print mode with structured events.
|
|
67
55
|
- [TUI components](tui.md) - build custom terminal UI for extensions.
|
|
68
56
|
|
|
69
57
|
## Reference
|
|
70
58
|
|
|
71
|
-
- [Environment variables](environment-variables.md) -
|
|
59
|
+
- [Environment variables](environment-variables.md) - Apex Code process configuration and session metadata available to bash tools.
|
|
72
60
|
- [Session format](session-format.md) - JSONL session file format, entry types, and SessionManager API.
|
|
73
61
|
|
|
74
62
|
## Platform setup
|
package/docs/json.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# JSON Event Stream Mode
|
|
2
2
|
|
|
3
3
|
```bash
|
|
4
|
-
|
|
4
|
+
apex-code --mode json "Your prompt"
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
Outputs all session events as JSON lines to stdout. Useful for integrating
|
|
7
|
+
Outputs all session events as JSON lines to stdout. Useful for integrating Apex Code into other tools or custom UIs.
|
|
8
8
|
|
|
9
9
|
## Event Types
|
|
10
10
|
|
|
11
11
|
Wire events use `JsonAgentSessionEvent`. It matches
|
|
12
|
-
[`AgentSessionEvent`](https://github.com/
|
|
12
|
+
[`AgentSessionEvent`](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/agent-session.ts)
|
|
13
13
|
except that streaming message updates omit cumulative snapshots:
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
@@ -26,7 +26,7 @@ type JsonAgentSessionEvent =
|
|
|
26
26
|
`queue_update` emits the full pending steering and follow-up queues whenever they change. `compaction_start` and `compaction_end` cover both manual and automatic compaction.
|
|
27
27
|
|
|
28
28
|
Other base events come from
|
|
29
|
-
[`AgentEvent`](https://github.com/
|
|
29
|
+
[`AgentEvent`](https://github.com/Fchery87/apex-code/blob/main/packages/agent/src/types.ts):
|
|
30
30
|
|
|
31
31
|
```typescript
|
|
32
32
|
type AgentEvent =
|
|
@@ -53,7 +53,7 @@ Base messages from [`packages/ai/src/types.ts`](https://github.com/earendil-work
|
|
|
53
53
|
- `AssistantMessage` (line 140)
|
|
54
54
|
- `ToolResultMessage` (line 152)
|
|
55
55
|
|
|
56
|
-
Extended messages from [`packages/coding-agent/src/core/messages.ts`](https://github.com/
|
|
56
|
+
Extended messages from [`packages/coding-agent/src/core/messages.ts`](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/messages.ts#L29):
|
|
57
57
|
- `BashExecutionMessage` (line 29)
|
|
58
58
|
- `CustomMessage` (line 46)
|
|
59
59
|
- `BranchSummaryMessage` (line 55)
|
|
@@ -87,5 +87,5 @@ the final authoritative message.
|
|
|
87
87
|
## Example
|
|
88
88
|
|
|
89
89
|
```bash
|
|
90
|
-
|
|
90
|
+
apex-code --mode json "List files" 2>/dev/null | jq -c 'select(.type == "message_end")'
|
|
91
91
|
```
|
package/docs/keybindings.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All keyboard shortcuts can be customized via `~/.apex-code/agent/keybindings.json`. Each action can be bound to one or more keys.
|
|
4
4
|
|
|
5
|
-
The config file uses the same namespaced keybinding ids that
|
|
5
|
+
The config file uses the same namespaced keybinding ids that Apex Code uses internally and that extension authors use in `keyHint()` and injected `keybindings` managers.
|
|
6
6
|
|
|
7
7
|
Older configs using pre-namespaced ids such as `cursorUp` or `expandTools` are migrated automatically to the namespaced ids on startup.
|
|
8
8
|
|
|
9
|
-
After editing `keybindings.json`, run `/reload` in
|
|
9
|
+
After editing `keybindings.json`, run `/reload` in Apex Code to apply the changes without restarting the session.
|
|
10
10
|
|
|
11
11
|
## Key Format
|
|
12
12
|
|
|
@@ -198,7 +198,7 @@ Create `~/.apex-code/agent/keybindings.json`:
|
|
|
198
198
|
|
|
199
199
|
Each action can have a single key or an array of keys. User config overrides defaults.
|
|
200
200
|
|
|
201
|
-
On native Windows, `app.suspend` has no default binding because Windows terminals do not support Unix job control. If you bind it manually,
|
|
201
|
+
On native Windows, `app.suspend` has no default binding because Windows terminals do not support Unix job control. If you bind it manually, Apex Code shows a status message instead of suspending. In WSL, the normal Linux `ctrl+z`/`fg` behavior still applies.
|
|
202
202
|
|
|
203
203
|
### Emacs Example
|
|
204
204
|
|
package/docs/llama-cpp.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# llama.cpp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Apex Code supports the [llama.cpp](https://github.com/ggml-org/llama.cpp) router server. The router discovers multiple GGUF models and loads or unloads them on demand.
|
|
4
4
|
|
|
5
5
|
Use a current llama.cpp build with router support. Follow the [build instructions](https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md) or install a [prebuilt release](https://github.com/ggml-org/llama.cpp/releases) for your platform.
|
|
6
6
|
|
|
@@ -43,9 +43,9 @@ A single-file model can sit directly in the model directory. Put multimodal and
|
|
|
43
43
|
|
|
44
44
|
Restart the router after manually adding files. For per-model context sizes and other options, use [llama.cpp model presets](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md#model-presets).
|
|
45
45
|
|
|
46
|
-
## Configure
|
|
46
|
+
## Configure Apex Code
|
|
47
47
|
|
|
48
|
-
Start
|
|
48
|
+
Start Apex Code and configure the provider:
|
|
49
49
|
|
|
50
50
|
```text
|
|
51
51
|
/login llama.cpp
|
|
@@ -58,7 +58,7 @@ Environment variables can configure the same values without `/login`:
|
|
|
58
58
|
```bash
|
|
59
59
|
export LLAMA_BASE_URL=http://127.0.0.1:8080
|
|
60
60
|
export LLAMA_API_KEY=optional-secret
|
|
61
|
-
|
|
61
|
+
apex-code
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
If the server uses an API key, start `llama-server` with the matching `--api-key` value. Keep `--host 127.0.0.1` for local-only access.
|
|
@@ -76,11 +76,11 @@ Run:
|
|
|
76
76
|
- Select **Download model…**, search Hugging Face, then choose a repository and quantization. Exact `owner/repository[:quant]` values also work.
|
|
77
77
|
- Press Escape during a load or download to confirm cancellation.
|
|
78
78
|
|
|
79
|
-
Hugging Face search uses `HF_TOKEN` when set, then checks `$HF_TOKEN_PATH`, `$HF_HOME/token`, `$XDG_CACHE_HOME/huggingface/token`, and `~/.cache/huggingface/token`. Search also works without authentication, subject to lower rate limits.
|
|
79
|
+
Hugging Face search uses `HF_TOKEN` when set, then checks `$HF_TOKEN_PATH`, `$HF_HOME/token`, `$XDG_CACHE_HOME/huggingface/token`, and `~/.cache/huggingface/token`. Search also works without authentication, subject to lower rate limits. Apex Code warns before downloading gated repositories and links to their access page. The llama.cpp server performs the download, so its process must also have `HF_TOKEN` when the selected repository requires access.
|
|
80
80
|
|
|
81
|
-
If other models are loaded,
|
|
81
|
+
If other models are loaded, Apex Code asks whether to unload them first or keep them loaded. Apex Code does not silently unload models and never deletes model files. The router may be shared with other clients, so `/llama` always displays the router's current state.
|
|
82
82
|
|
|
83
|
-
Only loaded models appear in `/model`. After loading a model, run `/model` to select it for the current
|
|
83
|
+
Only loaded models appear in `/model`. After loading a model, run `/model` to select it for the current Apex Code session.
|
|
84
84
|
|
|
85
85
|
If the router disconnects, `/llama` shows **Retry** and **Close**. Retry reconnects and refreshes model state without replaying the interrupted operation.
|
|
86
86
|
|