apex-code 0.0.1-alpha.0 → 0.0.1-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +471 -0
- package/README.md +74 -680
- package/dist/cli/args.d.ts +21 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +119 -15
- 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/concurrent-session.d.ts +3 -0
- package/dist/cli/concurrent-session.d.ts.map +1 -0
- package/dist/cli/concurrent-session.js +13 -0
- package/dist/cli/concurrent-session.js.map +1 -0
- 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/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +2 -1
- package/dist/cli/file-processor.js.map +1 -1
- 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 +99 -16
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +5 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +35 -20
- 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 +28 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +140 -4
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +121 -9
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +364 -123
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +17 -14
- 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 +11 -10
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +3 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +4 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +41 -32
- package/dist/core/compaction/compaction.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/defaults.d.ts +1 -0
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/defaults.js +9 -0
- package/dist/core/defaults.js.map +1 -1
- 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 +355 -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 +4 -0
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js +6 -1
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/extensions/index.d.ts +2 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +115 -48
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +44 -9
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +3 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +1 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +1 -2
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +2 -17
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/http-idle-timeout.d.ts +12 -0
- package/dist/core/http-idle-timeout.d.ts.map +1 -0
- package/dist/core/http-idle-timeout.js +27 -0
- package/dist/core/http-idle-timeout.js.map +1 -0
- 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/keybindings.d.ts +38 -13
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +26 -5
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/lsp/client.d.ts +78 -0
- package/dist/core/lsp/client.d.ts.map +1 -0
- package/dist/core/lsp/client.js +494 -0
- package/dist/core/lsp/client.js.map +1 -0
- package/dist/core/lsp/diagnostics.d.ts +47 -0
- package/dist/core/lsp/diagnostics.d.ts.map +1 -0
- package/dist/core/lsp/diagnostics.js +224 -0
- package/dist/core/lsp/diagnostics.js.map +1 -0
- package/dist/core/lsp/pool.d.ts +48 -0
- package/dist/core/lsp/pool.d.ts.map +1 -0
- package/dist/core/lsp/pool.js +150 -0
- package/dist/core/lsp/pool.js.map +1 -0
- package/dist/core/lsp/registry.d.ts +49 -0
- package/dist/core/lsp/registry.d.ts.map +1 -0
- package/dist/core/lsp/registry.js +215 -0
- package/dist/core/lsp/registry.js.map +1 -0
- package/dist/core/lsp/status.d.ts +23 -0
- package/dist/core/lsp/status.d.ts.map +1 -0
- package/dist/core/lsp/status.js +35 -0
- package/dist/core/lsp/status.js.map +1 -0
- package/dist/core/lsp/sync.d.ts +13 -0
- package/dist/core/lsp/sync.d.ts.map +1 -0
- package/dist/core/lsp/sync.js +71 -0
- package/dist/core/lsp/sync.js.map +1 -0
- package/dist/core/model-config.d.ts +18 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +25 -6
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts +21 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +73 -8
- 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/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +2 -1
- package/dist/core/models-store.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 +40 -16
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/permissions/gate.d.ts +42 -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 +45 -0
- package/dist/core/permissions/startup.d.ts.map +1 -0
- package/dist/core/permissions/startup.js +63 -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/pi-manifest.d.ts.map +1 -1
- package/dist/core/pi-manifest.js +2 -1
- package/dist/core/pi-manifest.js.map +1 -1
- 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 +22 -17
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +3 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sandbox/bwrap-arguments.d.ts +52 -0
- package/dist/core/sandbox/bwrap-arguments.d.ts.map +1 -0
- package/dist/core/sandbox/bwrap-arguments.js +86 -0
- package/dist/core/sandbox/bwrap-arguments.js.map +1 -0
- 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 +22 -0
- package/dist/core/sandbox/child-entry.js.map +1 -0
- package/dist/core/sandbox/cli-launch.d.ts +88 -0
- package/dist/core/sandbox/cli-launch.d.ts.map +1 -0
- package/dist/core/sandbox/cli-launch.js +272 -0
- package/dist/core/sandbox/cli-launch.js.map +1 -0
- package/dist/core/sandbox/cli-supervisor.d.ts +30 -0
- package/dist/core/sandbox/cli-supervisor.d.ts.map +1 -0
- package/dist/core/sandbox/cli-supervisor.js +123 -0
- package/dist/core/sandbox/cli-supervisor.js.map +1 -0
- package/dist/core/sandbox/default-hosts.d.ts +28 -0
- package/dist/core/sandbox/default-hosts.d.ts.map +1 -0
- package/dist/core/sandbox/default-hosts.js +69 -0
- package/dist/core/sandbox/default-hosts.js.map +1 -0
- package/dist/core/sandbox/full-access.d.ts +28 -0
- package/dist/core/sandbox/full-access.d.ts.map +1 -0
- package/dist/core/sandbox/full-access.js +63 -0
- package/dist/core/sandbox/full-access.js.map +1 -0
- package/dist/core/sandbox/git-identity.d.ts +57 -0
- package/dist/core/sandbox/git-identity.d.ts.map +1 -0
- package/dist/core/sandbox/git-identity.js +78 -0
- package/dist/core/sandbox/git-identity.js.map +1 -0
- package/dist/core/sandbox/host-approval.d.ts +42 -0
- package/dist/core/sandbox/host-approval.d.ts.map +1 -0
- package/dist/core/sandbox/host-approval.js +99 -0
- package/dist/core/sandbox/host-approval.js.map +1 -0
- package/dist/core/sandbox/linux-backend.d.ts +46 -0
- package/dist/core/sandbox/linux-backend.d.ts.map +1 -0
- package/dist/core/sandbox/linux-backend.js +304 -0
- package/dist/core/sandbox/linux-backend.js.map +1 -0
- package/dist/core/sandbox/macos-backend.d.ts +28 -0
- package/dist/core/sandbox/macos-backend.d.ts.map +1 -0
- package/dist/core/sandbox/macos-backend.js +313 -0
- package/dist/core/sandbox/macos-backend.js.map +1 -0
- package/dist/core/sandbox/network-proxy.d.ts +38 -0
- package/dist/core/sandbox/network-proxy.d.ts.map +1 -0
- package/dist/core/sandbox/network-proxy.js +153 -0
- package/dist/core/sandbox/network-proxy.js.map +1 -0
- package/dist/core/sandbox/network-refusal.d.ts +24 -0
- package/dist/core/sandbox/network-refusal.d.ts.map +1 -0
- package/dist/core/sandbox/network-refusal.js +72 -0
- package/dist/core/sandbox/network-refusal.js.map +1 -0
- package/dist/core/sandbox/policy.d.ts +40 -0
- package/dist/core/sandbox/policy.d.ts.map +1 -0
- package/dist/core/sandbox/policy.js +55 -0
- package/dist/core/sandbox/policy.js.map +1 -0
- package/dist/core/sandbox/profiles.d.ts +25 -0
- package/dist/core/sandbox/profiles.d.ts.map +1 -0
- package/dist/core/sandbox/profiles.js +23 -0
- package/dist/core/sandbox/profiles.js.map +1 -0
- package/dist/core/sandbox/rpc/command-client.d.ts +28 -0
- package/dist/core/sandbox/rpc/command-client.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/command-client.js +86 -0
- package/dist/core/sandbox/rpc/command-client.js.map +1 -0
- package/dist/core/sandbox/rpc/command-proxy.d.ts +48 -0
- package/dist/core/sandbox/rpc/command-proxy.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/command-proxy.js +120 -0
- package/dist/core/sandbox/rpc/command-proxy.js.map +1 -0
- package/dist/core/sandbox/rpc/credential-client.d.ts +20 -0
- package/dist/core/sandbox/rpc/credential-client.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/credential-client.js +170 -0
- package/dist/core/sandbox/rpc/credential-client.js.map +1 -0
- package/dist/core/sandbox/rpc/credential-proxy.d.ts +44 -0
- package/dist/core/sandbox/rpc/credential-proxy.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/credential-proxy.js +287 -0
- package/dist/core/sandbox/rpc/credential-proxy.js.map +1 -0
- package/dist/core/sandbox/rpc/framing.d.ts +35 -0
- package/dist/core/sandbox/rpc/framing.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/framing.js +114 -0
- package/dist/core/sandbox/rpc/framing.js.map +1 -0
- package/dist/core/sandbox/rpc/git-credential-helper.d.ts +40 -0
- package/dist/core/sandbox/rpc/git-credential-helper.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/git-credential-helper.js +152 -0
- package/dist/core/sandbox/rpc/git-credential-helper.js.map +1 -0
- package/dist/core/sandbox/rpc/git-credential-proxy.d.ts +48 -0
- package/dist/core/sandbox/rpc/git-credential-proxy.d.ts.map +1 -0
- package/dist/core/sandbox/rpc/git-credential-proxy.js +142 -0
- package/dist/core/sandbox/rpc/git-credential-proxy.js.map +1 -0
- package/dist/core/sandbox/supervisor-temp.d.ts +18 -0
- package/dist/core/sandbox/supervisor-temp.d.ts.map +1 -0
- package/dist/core/sandbox/supervisor-temp.js +21 -0
- package/dist/core/sandbox/supervisor-temp.js.map +1 -0
- package/dist/core/sandbox/supervisor.d.ts +51 -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/terminal-handoff.d.ts +45 -0
- package/dist/core/sandbox/terminal-handoff.d.ts.map +1 -0
- package/dist/core/sandbox/terminal-handoff.js +176 -0
- package/dist/core/sandbox/terminal-handoff.js.map +1 -0
- package/dist/core/sandbox/terminal-size.d.ts +40 -0
- package/dist/core/sandbox/terminal-size.d.ts.map +1 -0
- package/dist/core/sandbox/terminal-size.js +105 -0
- package/dist/core/sandbox/terminal-size.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 +32 -41
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +161 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-export.d.ts +4 -0
- package/dist/core/session-export.d.ts.map +1 -0
- package/dist/core/session-export.js +32 -0
- package/dist/core/session-export.js.map +1 -0
- package/dist/core/session-lease.d.ts +31 -0
- package/dist/core/session-lease.d.ts.map +1 -0
- package/dist/core/session-lease.js +138 -0
- package/dist/core/session-lease.js.map +1 -0
- package/dist/core/session-manager.d.ts +46 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +62 -4
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-share.d.ts +31 -0
- package/dist/core/session-share.d.ts.map +1 -0
- package/dist/core/session-share.js +45 -0
- package/dist/core/session-share.js.map +1 -0
- package/dist/core/settings-diagnostics.d.ts +9 -0
- package/dist/core/settings-diagnostics.d.ts.map +1 -0
- package/dist/core/settings-diagnostics.js +21 -0
- package/dist/core/settings-diagnostics.js.map +1 -0
- package/dist/core/settings-manager.d.ts +92 -9
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +138 -36
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +19 -7
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +128 -52
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +5 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts +2 -2
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +59 -68
- 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 +40 -4
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +183 -32
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/contract.d.ts +183 -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 +90 -0
- package/dist/core/tools/delegate.js.map +1 -0
- package/dist/core/tools/diagnostics.d.ts +39 -0
- package/dist/core/tools/diagnostics.d.ts.map +1 -0
- package/dist/core/tools/diagnostics.js +62 -0
- package/dist/core/tools/diagnostics.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +0 -5
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +2 -5
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +12 -2
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +61 -10
- 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 +13 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +4 -2
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +47 -10
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +51 -6
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +145 -2
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +4 -2
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +17 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/lsp.d.ts +62 -0
- package/dist/core/tools/lsp.d.ts.map +1 -0
- package/dist/core/tools/lsp.js +216 -0
- package/dist/core/tools/lsp.js.map +1 -0
- 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/powershell.d.ts +16 -0
- package/dist/core/tools/powershell.d.ts.map +1 -0
- package/dist/core/tools/powershell.js +39 -0
- package/dist/core/tools/powershell.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 +14 -0
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/skill-search.d.ts +32 -0
- package/dist/core/tools/skill-search.d.ts.map +1 -0
- package/dist/core/tools/skill-search.js +56 -0
- package/dist/core/tools/skill-search.js.map +1 -0
- 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-exa.d.ts +33 -0
- package/dist/core/tools/web-search-exa.d.ts.map +1 -0
- package/dist/core/tools/web-search-exa.js +128 -0
- package/dist/core/tools/web-search-exa.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 +16 -2
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +48 -2
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +2 -1
- package/dist/core/trust-manager.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/core/web-search-provider.d.ts +64 -0
- package/dist/core/web-search-provider.d.ts.map +1 -0
- package/dist/core/web-search-provider.js +149 -0
- package/dist/core/web-search-provider.js.map +1 -0
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +2 -0
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +6 -2
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +5 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +87 -22
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +6 -5
- 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/custom-editor.d.ts +72 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +338 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts +7 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +11 -2
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +4 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +24 -6
- package/dist/modes/interactive/components/extension-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 +17 -41
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/first-use-hints.d.ts +8 -0
- package/dist/modes/interactive/components/first-use-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/first-use-hints.js +22 -0
- package/dist/modes/interactive/components/first-use-hints.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +23 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +182 -21
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +2 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +2 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +31 -9
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +236 -96
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +25 -5
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +226 -58
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-submenu.js +165 -0
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
- package/dist/modes/interactive/components/splash-header.d.ts +66 -0
- package/dist/modes/interactive/components/splash-header.d.ts.map +1 -0
- package/dist/modes/interactive/components/splash-header.js +180 -0
- package/dist/modes/interactive/components/splash-header.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +74 -17
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +16 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +113 -35
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-panel.d.ts +30 -0
- package/dist/modes/interactive/components/tool-panel.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-panel.js +130 -0
- package/dist/modes/interactive/components/tool-panel.js.map +1 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +60 -10
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +61 -5
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +642 -203
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.js +34 -0
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
- package/dist/modes/interactive/theme/apex.json +93 -0
- package/dist/modes/interactive/theme/dark.json +2 -0
- package/dist/modes/interactive/theme/light.json +3 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +10 -2
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +25 -11
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +11 -3
- package/dist/modes/interactive/theme/theme.d.ts +14 -3
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +65 -10
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts +18 -12
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js +22 -5
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +2 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +211 -14
- 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 +8 -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/themes/apex-logo.d.ts +41 -0
- package/dist/themes/apex-logo.d.ts.map +1 -0
- package/dist/themes/apex-logo.js +35 -0
- package/dist/themes/apex-logo.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/changelog.d.ts +7 -2
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +82 -13
- package/dist/utils/changelog.js.map +1 -1
- 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/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +2 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/management-http.d.ts +5 -3
- package/dist/utils/management-http.d.ts.map +1 -1
- package/dist/utils/management-http.js +14 -10
- package/dist/utils/management-http.js.map +1 -1
- package/dist/utils/shell.d.ts +3 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +17 -5
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +60 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/text.d.ts +8 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +9 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +70 -2
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +280 -124
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +7 -5
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +25 -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 +39 -24
- package/docs/containerization.md +24 -21
- package/docs/custom-provider.md +15 -12
- package/docs/development.md +11 -11
- package/docs/environment-variables.md +37 -77
- package/docs/extensions.md +68 -54
- package/docs/index.md +12 -24
- package/docs/json.md +18 -11
- package/docs/keybindings.md +18 -12
- package/docs/llama-cpp.md +9 -7
- package/docs/models.md +17 -11
- package/docs/packages.md +47 -43
- package/docs/prompt-templates.md +3 -3
- package/docs/providers.md +10 -10
- package/docs/quickstart.md +49 -32
- package/docs/rpc.md +35 -18
- package/docs/sdk.md +20 -6
- package/docs/security.md +18 -18
- package/docs/session-format.md +9 -9
- package/docs/sessions.md +13 -13
- package/docs/settings.md +83 -16
- package/docs/shell-aliases.md +1 -1
- package/docs/skills.md +66 -15
- package/docs/terminal-setup.md +44 -19
- package/docs/termux.md +4 -4
- package/docs/themes.md +32 -11
- package/docs/tmux.md +4 -4
- package/docs/tui.md +5 -5
- package/docs/usage.md +61 -53
- package/docs/windows.md +24 -2
- package/examples/extensions/border-status-editor.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/git-checkpoint.ts +2 -2
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/notify.ts +3 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/README.md +3 -1
- package/examples/extensions/subagent/agents.ts +40 -9
- package/examples/extensions/subagent/index.ts +27 -4
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/rpc-extension-ui.ts +1 -1
- package/examples/sdk/06-extensions.ts +1 -1
- package/examples/sdk/README.md +1 -1
- package/npm-shrinkwrap.json +280 -445
- package/package.json +9 -12
- 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" }
|
|
@@ -330,7 +330,8 @@ user sends another prompt ◄─────────────────
|
|
|
330
330
|
|
|
331
331
|
/compact or auto-compaction
|
|
332
332
|
├─► session_before_compact (can cancel or customize)
|
|
333
|
-
|
|
333
|
+
├─► session_compact (success)
|
|
334
|
+
└─► session_compact_failed (failure or abort)
|
|
334
335
|
|
|
335
336
|
/tree navigation
|
|
336
337
|
├─► session_before_tree (can cancel or customize)
|
|
@@ -351,7 +352,7 @@ exit (Ctrl+C, Ctrl+D, SIGHUP, SIGTERM)
|
|
|
351
352
|
|
|
352
353
|
#### project_trust
|
|
353
354
|
|
|
354
|
-
Fired before
|
|
355
|
+
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
356
|
|
|
356
357
|
```typescript
|
|
357
358
|
pi.on("project_trust", async (event, ctx) => {
|
|
@@ -364,7 +365,7 @@ pi.on("project_trust", async (event, ctx) => {
|
|
|
364
365
|
});
|
|
365
366
|
```
|
|
366
367
|
|
|
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
|
|
368
|
+
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
369
|
|
|
369
370
|
### Resource Events
|
|
370
371
|
|
|
@@ -428,7 +429,7 @@ pi.on("session_before_switch", async (event, ctx) => {
|
|
|
428
429
|
});
|
|
429
430
|
```
|
|
430
431
|
|
|
431
|
-
After a successful switch or new-session action,
|
|
432
|
+
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
433
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
433
434
|
|
|
434
435
|
#### session_before_fork
|
|
@@ -445,10 +446,10 @@ pi.on("session_before_fork", async (event, ctx) => {
|
|
|
445
446
|
});
|
|
446
447
|
```
|
|
447
448
|
|
|
448
|
-
After a successful fork or clone,
|
|
449
|
+
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
450
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
450
451
|
|
|
451
|
-
#### session_before_compact / session_compact
|
|
452
|
+
#### session_before_compact / session_compact / session_compact_failed
|
|
452
453
|
|
|
453
454
|
Fired on compaction. See [compaction.md](compaction.md) for details.
|
|
454
455
|
|
|
@@ -479,6 +480,14 @@ pi.on("session_compact", async (event, ctx) => {
|
|
|
479
480
|
// event.reason - "manual" (/compact), "threshold", or "overflow"
|
|
480
481
|
// event.willRetry - whether the aborted turn is retried after compaction (overflow recovery)
|
|
481
482
|
});
|
|
483
|
+
|
|
484
|
+
pi.on("session_compact_failed", async (event, ctx) => {
|
|
485
|
+
// event.reason - "manual" (/compact), "threshold", or "overflow"
|
|
486
|
+
// event.errorMessage - present for non-abort failures
|
|
487
|
+
// event.aborted - true for cancelled/aborted compactions
|
|
488
|
+
// event.willRetry - whether the aborted turn would have retried after compaction
|
|
489
|
+
// event.fromExtension - whether extension-provided compaction content was being used
|
|
490
|
+
});
|
|
482
491
|
```
|
|
483
492
|
|
|
484
493
|
#### session_before_tree / session_tree
|
|
@@ -551,13 +560,13 @@ pi.on("before_agent_start", async (event, ctx) => {
|
|
|
551
560
|
});
|
|
552
561
|
```
|
|
553
562
|
|
|
554
|
-
The `systemPromptOptions` field gives extensions access to the same structured data
|
|
563
|
+
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
564
|
|
|
556
565
|
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
566
|
|
|
558
567
|
#### agent_start / agent_end / agent_settled
|
|
559
568
|
|
|
560
|
-
`agent_start` fires when a low-level agent run begins. `agent_end` fires when that run ends, but
|
|
569
|
+
`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
570
|
|
|
562
571
|
```typescript
|
|
563
572
|
pi.on("agent_start", async (_event, ctx) => {});
|
|
@@ -668,7 +677,7 @@ pi.on("before_provider_headers", (event, ctx) => {
|
|
|
668
677
|
// Add or override — e.g. a session id for gateway tracing/attribution
|
|
669
678
|
event.headers["x-session-id"] = ctx.sessionManager.getSessionId();
|
|
670
679
|
|
|
671
|
-
// Drop a tracking header
|
|
680
|
+
// Drop a tracking header Apex Code adds for this call
|
|
672
681
|
event.headers["X-OpenRouter-Title"] = null;
|
|
673
682
|
});
|
|
674
683
|
```
|
|
@@ -679,7 +688,7 @@ Runs once per provider request; retries reuse the same headers rather than re-fi
|
|
|
679
688
|
|
|
680
689
|
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
690
|
|
|
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
|
|
691
|
+
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
692
|
|
|
684
693
|
```typescript
|
|
685
694
|
pi.on("before_provider_request", (event, ctx) => {
|
|
@@ -752,7 +761,7 @@ Use this to update extension UI when `pi.setThinkingLevel()`, model changes, or
|
|
|
752
761
|
|
|
753
762
|
Fired after `tool_execution_start`, before the tool executes. **Can block.** Use `isToolCallEventType` to narrow and get typed inputs.
|
|
754
763
|
|
|
755
|
-
Before `tool_call` runs,
|
|
764
|
+
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
765
|
|
|
757
766
|
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
767
|
|
|
@@ -864,7 +873,7 @@ pi.on("user_bash", (event, ctx) => {
|
|
|
864
873
|
// Option 1: Provide custom operations (e.g., SSH)
|
|
865
874
|
return { operations: remoteBashOps };
|
|
866
875
|
|
|
867
|
-
// Option 2: Wrap
|
|
876
|
+
// Option 2: Wrap Apex Code's built-in local bash backend
|
|
868
877
|
const local = createLocalBashOperations();
|
|
869
878
|
return {
|
|
870
879
|
operations: {
|
|
@@ -950,7 +959,7 @@ Current run mode: `"tui"`, `"rpc"`, `"json"`, or `"print"`. Use `ctx.mode === "t
|
|
|
950
959
|
|
|
951
960
|
Current working directory.
|
|
952
961
|
|
|
953
|
-
Use `CONFIG_DIR_NAME` instead of hardcoding `.
|
|
962
|
+
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
963
|
|
|
955
964
|
```typescript
|
|
956
965
|
import { CONFIG_DIR_NAME, type ExtensionAPI } from "apex-code";
|
|
@@ -999,7 +1008,7 @@ Use this for abort-aware nested work started by extension handlers, for example:
|
|
|
999
1008
|
- file or process helpers that accept `AbortSignal`
|
|
1000
1009
|
|
|
1001
1010
|
`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
|
|
1011
|
+
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
1012
|
|
|
1004
1013
|
```typescript
|
|
1005
1014
|
pi.on("tool_result", async (event, ctx) => {
|
|
@@ -1016,11 +1025,11 @@ pi.on("tool_result", async (event, ctx) => {
|
|
|
1016
1025
|
|
|
1017
1026
|
### ctx.isIdle() / ctx.abort() / ctx.hasPendingMessages()
|
|
1018
1027
|
|
|
1019
|
-
Control flow helpers. `ctx.isIdle()` is false while
|
|
1028
|
+
Control flow helpers. `ctx.isIdle()` is false while Apex Code is processing an agent run, automatic retry, auto-compaction retry, or queued continuation.
|
|
1020
1029
|
|
|
1021
1030
|
### ctx.shutdown()
|
|
1022
1031
|
|
|
1023
|
-
Request a graceful shutdown of
|
|
1032
|
+
Request a graceful shutdown of Apex Code.
|
|
1024
1033
|
|
|
1025
1034
|
- **Interactive mode:** Deferred until the agent becomes idle (after processing all queued steering and follow-up messages).
|
|
1026
1035
|
- **RPC mode:** Deferred until the next idle state (after completing the current command response, when waiting for the next command).
|
|
@@ -1065,7 +1074,7 @@ ctx.compact({
|
|
|
1065
1074
|
|
|
1066
1075
|
### ctx.getSystemPrompt()
|
|
1067
1076
|
|
|
1068
|
-
Returns
|
|
1077
|
+
Returns Apex Code's current system prompt string.
|
|
1069
1078
|
|
|
1070
1079
|
- During `before_agent_start`, this reflects chained system-prompt changes made so far for the current turn.
|
|
1071
1080
|
- It does not include later `context` message mutations.
|
|
@@ -1085,7 +1094,7 @@ Command handlers receive `ExtensionCommandContext`, which extends `ExtensionCont
|
|
|
1085
1094
|
|
|
1086
1095
|
### ctx.getSystemPromptOptions()
|
|
1087
1096
|
|
|
1088
|
-
Returns the base inputs
|
|
1097
|
+
Returns the base inputs Apex Code currently uses to build the system prompt.
|
|
1089
1098
|
|
|
1090
1099
|
```typescript
|
|
1091
1100
|
const options = ctx.getSystemPromptOptions();
|
|
@@ -1426,12 +1435,16 @@ pi.sendUserMessage([
|
|
|
1426
1435
|
// During streaming - must specify delivery mode
|
|
1427
1436
|
pi.sendUserMessage("Focus on error handling", { deliverAs: "steer" });
|
|
1428
1437
|
pi.sendUserMessage("And then summarize", { deliverAs: "followUp" });
|
|
1438
|
+
|
|
1439
|
+
// Opt in to extension command dispatch and skill/prompt template expansion
|
|
1440
|
+
pi.sendUserMessage("/review src/index.ts", { expandPromptTemplates: true });
|
|
1429
1441
|
```
|
|
1430
1442
|
|
|
1431
1443
|
**Options:**
|
|
1432
1444
|
- `deliverAs` - Required when agent is streaming:
|
|
1433
1445
|
- `"steer"` - Queues the message for delivery after the current assistant turn finishes executing its tool calls
|
|
1434
1446
|
- `"followUp"` - Waits for agent to finish all tools
|
|
1447
|
+
- `expandPromptTemplates` - Dispatch extension commands and expand skill commands and prompt templates. Defaults to `false`.
|
|
1435
1448
|
|
|
1436
1449
|
When not streaming, the message is sent immediately and triggers a new turn. When streaming without `deliverAs`, throws an error.
|
|
1437
1450
|
|
|
@@ -1495,7 +1508,7 @@ Labels persist in the session and survive restarts. Use them to mark important p
|
|
|
1495
1508
|
|
|
1496
1509
|
Register a command.
|
|
1497
1510
|
|
|
1498
|
-
If multiple extensions register the same command name,
|
|
1511
|
+
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
1512
|
|
|
1500
1513
|
```typescript
|
|
1501
1514
|
pi.registerCommand("stats", {
|
|
@@ -1565,7 +1578,7 @@ Register a custom TUI renderer for custom messages with your `customType`. Custo
|
|
|
1565
1578
|
|
|
1566
1579
|
### pi.registerMarkdownTransformer(transformer)
|
|
1567
1580
|
|
|
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,
|
|
1581
|
+
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
1582
|
|
|
1570
1583
|
The transformer receives the Markdown string and a context with:
|
|
1571
1584
|
|
|
@@ -1582,7 +1595,7 @@ pi.registerMarkdownTransformer((markdown, { messageType, isStreaming }) => {
|
|
|
1582
1595
|
});
|
|
1583
1596
|
```
|
|
1584
1597
|
|
|
1585
|
-
If a transformer throws,
|
|
1598
|
+
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
1599
|
|
|
1587
1600
|
### pi.registerEntryRenderer(customType, renderer)
|
|
1588
1601
|
|
|
@@ -1708,7 +1721,7 @@ Register or override a model provider dynamically. Useful for proxies, custom en
|
|
|
1708
1721
|
|
|
1709
1722
|
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
1723
|
|
|
1711
|
-
Dynamic providers can implement `refreshModels`.
|
|
1724
|
+
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
1725
|
|
|
1713
1726
|
`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
1727
|
|
|
@@ -1979,7 +1992,7 @@ pi.registerTool({
|
|
|
1979
1992
|
});
|
|
1980
1993
|
```
|
|
1981
1994
|
|
|
1982
|
-
**Usage accounting:** If a tool makes nested LLM calls, return their combined `Usage` as `usage`.
|
|
1995
|
+
**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
1996
|
|
|
1984
1997
|
**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
1998
|
|
|
@@ -1997,7 +2010,7 @@ async execute(toolCallId, params) {
|
|
|
1997
2010
|
|
|
1998
2011
|
**Important:** Use `StringEnum` from `@earendil-works/pi-ai` for string enums. `Type.Union`/`Type.Literal` doesn't work with Google's API.
|
|
1999
2012
|
|
|
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
|
|
2013
|
+
**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
2014
|
|
|
2002
2015
|
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
2016
|
|
|
@@ -2046,17 +2059,17 @@ pi.registerTool({
|
|
|
2046
2059
|
|
|
2047
2060
|
### Overriding Built-in Tools
|
|
2048
2061
|
|
|
2049
|
-
Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`) by registering a tool with the same name. Interactive mode displays a warning when this happens.
|
|
2062
|
+
Extensions can override built-in tools (`read`, `bash`, `powershell`, `edit`, `write`, `grep`, `find`, `ls`) by registering a tool with the same name. Interactive mode displays a warning when this happens.
|
|
2050
2063
|
|
|
2051
2064
|
```bash
|
|
2052
2065
|
# Extension's read tool replaces built-in read
|
|
2053
|
-
|
|
2066
|
+
apex-code -e ./tool-override.ts
|
|
2054
2067
|
```
|
|
2055
2068
|
|
|
2056
2069
|
Alternatively, use `--no-builtin-tools` to start without any built-in tools while keeping extension tools enabled:
|
|
2057
2070
|
```bash
|
|
2058
2071
|
# No built-in tools, only extension tools
|
|
2059
|
-
|
|
2072
|
+
apex-code --no-builtin-tools -e ./my-extension.ts
|
|
2060
2073
|
```
|
|
2061
2074
|
|
|
2062
2075
|
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 +2081,14 @@ See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.
|
|
|
2068
2081
|
**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
2082
|
|
|
2070
2083
|
Built-in tool implementations:
|
|
2071
|
-
- [read.ts](https://github.com/
|
|
2072
|
-
- [bash.ts](https://github.com/
|
|
2073
|
-
- [
|
|
2074
|
-
- [
|
|
2075
|
-
- [
|
|
2076
|
-
- [
|
|
2077
|
-
- [
|
|
2084
|
+
- [read.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/read.ts) - `ReadToolDetails`
|
|
2085
|
+
- [bash.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/bash.ts) - `BashToolDetails`
|
|
2086
|
+
- [powershell.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/powershell.ts) - `PowerShellToolDetails`
|
|
2087
|
+
- [edit.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/edit.ts)
|
|
2088
|
+
- [write.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/write.ts)
|
|
2089
|
+
- [grep.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/grep.ts) - `GrepToolDetails`
|
|
2090
|
+
- [find.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/find.ts) - `FindToolDetails`
|
|
2091
|
+
- [ls.ts](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/tools/ls.ts) - `LsToolDetails`
|
|
2078
2092
|
|
|
2079
2093
|
### Remote Execution
|
|
2080
2094
|
|
|
@@ -2105,11 +2119,11 @@ pi.registerTool({
|
|
|
2105
2119
|
});
|
|
2106
2120
|
```
|
|
2107
2121
|
|
|
2108
|
-
**Operations interfaces:** `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
|
|
2122
|
+
**Operations interfaces:** `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `PowerShellOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
|
|
2109
2123
|
|
|
2110
|
-
For `user_bash`, extensions can reuse
|
|
2124
|
+
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
2125
|
|
|
2112
|
-
The bash
|
|
2126
|
+
The `bash` and `powershell` tools also support a spawn hook to adjust the command, cwd, or env before execution:
|
|
2113
2127
|
|
|
2114
2128
|
```typescript
|
|
2115
2129
|
import { createBashTool } from "apex-code";
|
|
@@ -2123,7 +2137,7 @@ const bashTool = createBashTool(cwd, {
|
|
|
2123
2137
|
});
|
|
2124
2138
|
```
|
|
2125
2139
|
|
|
2126
|
-
`createBashTool()`
|
|
2140
|
+
`createBashTool()` and `createPowerShellTool()` expose the current session to commands through `PI_SESSION_ID`, `PI_SESSION_FILE`, `PI_PROVIDER`, `PI_MODEL`, and `PI_REASONING_LEVEL`. Injection happens before `spawnHook`, so hooks receive these values in `env` and preserve them when they spread the existing environment as above. Set `exposeSessionEnvironment: false` to disable them:
|
|
2127
2141
|
|
|
2128
2142
|
```typescript
|
|
2129
2143
|
const bashTool = createBashTool(cwd, {
|
|
@@ -2131,7 +2145,7 @@ const bashTool = createBashTool(cwd, {
|
|
|
2131
2145
|
});
|
|
2132
2146
|
```
|
|
2133
2147
|
|
|
2134
|
-
See [
|
|
2148
|
+
See [Shell tool session environment](environment-variables.md#shell-tool-session-environment) for variable semantics. See [examples/extensions/ssh.ts](../examples/extensions/ssh.ts) for a complete SSH example with `--ssh` flag.
|
|
2135
2149
|
|
|
2136
2150
|
### Output Truncation
|
|
2137
2151
|
|
|
@@ -2205,7 +2219,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2205
2219
|
|
|
2206
2220
|
### Custom Rendering
|
|
2207
2221
|
|
|
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/
|
|
2222
|
+
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
2223
|
|
|
2210
2224
|
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
2225
|
|
|
@@ -2339,8 +2353,8 @@ The lifecycle is:
|
|
|
2339
2353
|
1. Register every tool with `pi.registerTool()` so it appears in `pi.getAllTools()`.
|
|
2340
2354
|
2. Keep loader tools, such as `search_tools`, active and leave searchable tools inactive.
|
|
2341
2355
|
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,
|
|
2356
|
+
4. Apex Code records which tools were added on the loader's tool result.
|
|
2357
|
+
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
2358
|
|
|
2345
2359
|
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
2360
|
|
|
@@ -2351,15 +2365,15 @@ You do not need to return provider-specific tool references or mark the loader a
|
|
|
2351
2365
|
- **Native representation:** Deferred definitions use `defer_loading`; the load point uses `tool_reference` content.
|
|
2352
2366
|
- **OpenAI**
|
|
2353
2367
|
- **Models:** `gpt-5.4` and newer family
|
|
2354
|
-
- **Native representation:**
|
|
2368
|
+
- **Native representation:** Apex Code adds completed client `tool_search_call` and `tool_search_output` items at the load point.
|
|
2355
2369
|
|
|
2356
2370
|
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
2371
|
|
|
2358
2372
|
#### Fallback behavior
|
|
2359
2373
|
|
|
2360
|
-
For all other models and providers, dynamic activation still works:
|
|
2374
|
+
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
2375
|
|
|
2362
|
-
|
|
2376
|
+
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
2377
|
|
|
2364
2378
|
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
2379
|
|
|
@@ -2591,7 +2605,7 @@ ctx.ui.setFooter((tui, theme) => ({
|
|
|
2591
2605
|
ctx.ui.setFooter(undefined); // Restore built-in footer
|
|
2592
2606
|
|
|
2593
2607
|
// Terminal title
|
|
2594
|
-
ctx.ui.setTitle("
|
|
2608
|
+
ctx.ui.setTitle("apex-code - my-project");
|
|
2595
2609
|
|
|
2596
2610
|
// Editor text
|
|
2597
2611
|
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,32 +1,37 @@
|
|
|
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
|
|
16
16
|
type WithoutPartial<T> = T extends { partial: unknown } ? Omit<T, "partial"> : T;
|
|
17
17
|
|
|
18
|
+
type JsonAssistantMessageEvent<T> = T extends { type: "toolcall_start"; partial: unknown }
|
|
19
|
+
? WithoutPartial<T> & { id: string; toolName: string }
|
|
20
|
+
: WithoutPartial<T>;
|
|
21
|
+
|
|
18
22
|
type JsonAgentSessionEvent =
|
|
19
23
|
| Exclude<AgentSessionEvent, { type: "message_update" }>
|
|
20
24
|
| {
|
|
21
25
|
type: "message_update";
|
|
22
|
-
|
|
26
|
+
usage: Usage;
|
|
27
|
+
assistantMessageEvent: JsonAssistantMessageEvent<AssistantMessageEvent>;
|
|
23
28
|
};
|
|
24
29
|
```
|
|
25
30
|
|
|
26
31
|
`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
32
|
|
|
28
33
|
Other base events come from
|
|
29
|
-
[`AgentEvent`](https://github.com/
|
|
34
|
+
[`AgentEvent`](https://github.com/Fchery87/apex-code/blob/main/packages/agent/src/types.ts):
|
|
30
35
|
|
|
31
36
|
```typescript
|
|
32
37
|
type AgentEvent =
|
|
@@ -53,7 +58,7 @@ Base messages from [`packages/ai/src/types.ts`](https://github.com/earendil-work
|
|
|
53
58
|
- `AssistantMessage` (line 140)
|
|
54
59
|
- `ToolResultMessage` (line 152)
|
|
55
60
|
|
|
56
|
-
Extended messages from [`packages/coding-agent/src/core/messages.ts`](https://github.com/
|
|
61
|
+
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
62
|
- `BashExecutionMessage` (line 29)
|
|
58
63
|
- `CustomMessage` (line 46)
|
|
59
64
|
- `BranchSummaryMessage` (line 55)
|
|
@@ -73,19 +78,21 @@ Followed by events as they occur:
|
|
|
73
78
|
{"type":"agent_start"}
|
|
74
79
|
{"type":"turn_start"}
|
|
75
80
|
{"type":"message_start","message":{"role":"assistant","content":[],...}}
|
|
76
|
-
{"type":"message_update","assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello"}}
|
|
81
|
+
{"type":"message_update","usage":{...},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello"}}
|
|
77
82
|
{"type":"message_end","message":{...}}
|
|
78
83
|
{"type":"turn_end","message":{...},"toolResults":[]}
|
|
79
84
|
{"type":"agent_end","messages":[...]}
|
|
80
85
|
```
|
|
81
86
|
|
|
82
87
|
`message_update` records are delta-only. They omit both the cumulative `message` field and
|
|
83
|
-
`assistantMessageEvent.partial` to keep stream size linear.
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
`assistantMessageEvent.partial` to keep stream size linear. The top-level `usage` field contains
|
|
89
|
+
the latest cumulative provider-reported usage and may remain zero when a provider only reports
|
|
90
|
+
usage at completion. Use `contentIndex` and `delta` to assemble live text, thinking, or tool-call
|
|
91
|
+
arguments if needed. A `toolcall_start` event also includes the constant-sized `id` and `toolName`
|
|
92
|
+
fields. `message_end` contains the final authoritative message.
|
|
86
93
|
|
|
87
94
|
## Example
|
|
88
95
|
|
|
89
96
|
```bash
|
|
90
|
-
|
|
97
|
+
apex-code --mode json "List files" 2>/dev/null | jq -c 'select(.type == "message_end")'
|
|
91
98
|
```
|