@akon-labs/nexus-cli 0.1.2 → 0.1.4
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 +16 -5316
- package/README.md +30 -26
- package/dist/cli.js +90 -62
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +18 -63
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/extensions/gitnexus/gateway.d.ts +2 -0
- package/dist/extensions/gitnexus/gateway.d.ts.map +1 -1
- package/dist/extensions/gitnexus/gateway.js +22 -4
- package/dist/extensions/gitnexus/gateway.js.map +1 -1
- package/dist/extensions/gitnexus/index.d.ts.map +1 -1
- package/dist/extensions/gitnexus/index.js +21 -3
- package/dist/extensions/gitnexus/index.js.map +1 -1
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +1 -1
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/web-access.d.ts +8 -1
- package/dist/extensions/web-access.d.ts.map +1 -1
- package/dist/extensions/web-access.js +48 -2
- package/dist/extensions/web-access.js.map +1 -1
- package/dist/index.js +93 -65
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +2 -2
- package/dist/migrations.js.map +1 -1
- package/dist/rpc-entry.js +90 -62
- package/dist/vendor/agent-core.js +6805 -0
- package/dist/vendor/ai.js +12407 -0
- package/dist/vendor/tui.js +11645 -0
- package/dist/vendor/web-access.js +93103 -0
- package/docs/compaction.md +14 -14
- package/docs/containerization.md +1 -1
- package/docs/custom-provider.md +17 -17
- package/docs/development.md +2 -2
- package/docs/environment-variables.md +1 -1
- package/docs/extensions.md +44 -44
- package/docs/index.md +5 -11
- package/docs/json.md +4 -4
- package/docs/llama-cpp.md +2 -2
- package/docs/models.md +3 -3
- package/docs/packages.md +6 -6
- package/docs/providers.md +13 -13
- package/docs/quickstart.md +19 -13
- package/docs/rpc.md +1 -1
- package/docs/sdk.md +28 -28
- package/docs/security.md +1 -1
- package/docs/session-format.md +6 -6
- package/docs/settings.md +1 -1
- package/docs/termux.md +1 -1
- package/docs/themes.md +2 -2
- package/docs/tui.md +20 -20
- package/docs/usage.md +5 -4
- package/examples/extensions/README.md +2 -2
- package/examples/extensions/auto-commit-on-exit.ts +1 -1
- package/examples/extensions/bash-spawn-hook.ts +2 -2
- package/examples/extensions/bookmark.ts +1 -1
- package/examples/extensions/border-status-editor.ts +3 -3
- package/examples/extensions/built-in-tool-renderer.ts +3 -3
- package/examples/extensions/claude-rules.ts +1 -1
- package/examples/extensions/commands.ts +1 -1
- package/examples/extensions/confirm-destructive.ts +1 -1
- package/examples/extensions/custom-compaction.ts +3 -3
- package/examples/extensions/custom-footer.ts +3 -3
- package/examples/extensions/custom-header.ts +2 -2
- package/examples/extensions/custom-provider-anthropic/index.ts +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
- package/examples/extensions/dirty-repo-guard.ts +1 -1
- package/examples/extensions/doom-overlay/doom-component.ts +2 -2
- package/examples/extensions/doom-overlay/doom-keys.ts +1 -1
- package/examples/extensions/doom-overlay/index.ts +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/dynamic-resources/index.ts +1 -1
- package/examples/extensions/dynamic-tools.ts +1 -1
- package/examples/extensions/entry-renderer.ts +2 -2
- package/examples/extensions/event-bus.ts +1 -1
- package/examples/extensions/file-trigger.ts +1 -1
- package/examples/extensions/git-checkpoint.ts +1 -1
- package/examples/extensions/git-merge-and-resolve.ts +1 -1
- package/examples/extensions/github-issue-autocomplete.ts +2 -2
- package/examples/extensions/gondolin/index.ts +2 -2
- package/examples/extensions/handoff.ts +4 -4
- package/examples/extensions/hello.ts +2 -2
- package/examples/extensions/hidden-thinking-label.ts +1 -1
- package/examples/extensions/inline-bash.ts +1 -1
- package/examples/extensions/input-transform-streaming.ts +1 -1
- package/examples/extensions/input-transform.ts +1 -1
- package/examples/extensions/interactive-shell.ts +1 -1
- package/examples/extensions/kimi-deferred-tools.ts +1 -1
- package/examples/extensions/mac-system-theme.ts +1 -1
- package/examples/extensions/message-renderer.ts +2 -2
- package/examples/extensions/minimal-mode.ts +3 -3
- package/examples/extensions/modal-editor.ts +2 -2
- package/examples/extensions/model-status.ts +1 -1
- package/examples/extensions/notify.ts +1 -1
- package/examples/extensions/overlay-qa-tests.ts +5 -5
- package/examples/extensions/overlay-test.ts +2 -2
- package/examples/extensions/permission-gate.ts +1 -1
- package/examples/extensions/pirate.ts +1 -1
- package/examples/extensions/plan-mode/index.ts +4 -4
- package/examples/extensions/preset.ts +4 -4
- package/examples/extensions/project-trust.ts +1 -1
- package/examples/extensions/prompt-customizer.ts +1 -1
- package/examples/extensions/protected-paths.ts +1 -1
- package/examples/extensions/provider-payload.ts +1 -1
- package/examples/extensions/qna.ts +3 -3
- package/examples/extensions/question.ts +2 -2
- package/examples/extensions/questionnaire.ts +2 -2
- package/examples/extensions/rainbow-editor.ts +1 -1
- package/examples/extensions/reload-runtime.ts +1 -1
- package/examples/extensions/rpc-demo.ts +1 -1
- package/examples/extensions/sandbox/index.ts +2 -2
- package/examples/extensions/send-user-message.ts +1 -1
- package/examples/extensions/session-name.ts +1 -1
- package/examples/extensions/shutdown-command.ts +1 -1
- package/examples/extensions/snake.ts +2 -2
- package/examples/extensions/space-invaders.ts +2 -2
- package/examples/extensions/ssh.ts +2 -2
- package/examples/extensions/status-line.ts +1 -1
- package/examples/extensions/structured-output.ts +2 -2
- package/examples/extensions/subagent/agents.ts +1 -1
- package/examples/extensions/subagent/index.ts +5 -5
- package/examples/extensions/summarize.ts +4 -4
- package/examples/extensions/system-prompt-header.ts +1 -1
- package/examples/extensions/tic-tac-toe.ts +3 -3
- package/examples/extensions/timed-confirm.ts +1 -1
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/todo.ts +3 -3
- package/examples/extensions/tool-override.ts +2 -2
- package/examples/extensions/tools.ts +3 -3
- package/examples/extensions/trigger-compact.ts +1 -1
- package/examples/extensions/truncated-tool.ts +3 -3
- package/examples/extensions/widget-placement.ts +1 -1
- package/examples/extensions/with-deps/index.ts +1 -1
- package/examples/extensions/working-indicator.ts +1 -1
- package/examples/extensions/working-message-test.ts +1 -1
- package/examples/rpc-extension-ui.ts +1 -1
- package/examples/sdk/01-minimal.ts +1 -1
- package/examples/sdk/02-custom-model.ts +1 -1
- package/examples/sdk/03-custom-prompt.ts +1 -6
- package/examples/sdk/04-skills.ts +1 -1
- package/examples/sdk/05-tools.ts +1 -1
- package/examples/sdk/06-extensions.ts +2 -7
- package/examples/sdk/07-context-files.ts +1 -6
- package/examples/sdk/08-prompt-templates.ts +1 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +1 -1
- package/examples/sdk/10-settings.ts +1 -1
- package/examples/sdk/11-sessions.ts +1 -1
- package/examples/sdk/12-full-control.ts +2 -2
- package/examples/sdk/13-session-runtime.ts +1 -1
- package/examples/sdk/README.md +2 -2
- package/npm-shrinkwrap.json +2 -26
- package/package.json +10 -25
package/docs/compaction.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
LLMs have limited context windows. When conversations grow too long, nexus uses compaction to summarize older content while preserving recent work. This page covers both auto-compaction and branch summarization.
|
|
4
4
|
|
|
5
|
-
**Source files** ([nexus-mono](https://github.com/
|
|
6
|
-
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/
|
|
7
|
-
- [`packages/coding-agent/src/core/compaction/branch-summarization.ts`](https://github.com/
|
|
8
|
-
- [`packages/coding-agent/src/core/compaction/utils.ts`](https://github.com/
|
|
9
|
-
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/
|
|
10
|
-
- [`packages/coding-agent/src/core/extensions/types.ts`](https://github.com/
|
|
5
|
+
**Source files** ([nexus-mono](https://github.com/Akon-Labs/nexus-cli)):
|
|
6
|
+
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) - Auto-compaction logic
|
|
7
|
+
- [`packages/coding-agent/src/core/compaction/branch-summarization.ts`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) - Branch summarization
|
|
8
|
+
- [`packages/coding-agent/src/core/compaction/utils.ts`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/compaction/utils.ts) - Shared utilities (file tracking, serialization)
|
|
9
|
+
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/session-manager.ts) - Entry types (`CompactionEntry`, `BranchSummaryEntry`)
|
|
10
|
+
- [`packages/coding-agent/src/core/extensions/types.ts`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/extensions/types.ts) - Extension event types
|
|
11
11
|
|
|
12
|
-
For TypeScript definitions in your project, inspect `node_modules/@
|
|
12
|
+
For TypeScript definitions in your project, inspect `node_modules/@akon-labs/nexus-cli/dist/`.
|
|
13
13
|
|
|
14
14
|
## Overview
|
|
15
15
|
|
|
@@ -118,7 +118,7 @@ Never cut at tool results (they must stay with their tool call).
|
|
|
118
118
|
|
|
119
119
|
### CompactionEntry Structure
|
|
120
120
|
|
|
121
|
-
Defined in [`session-manager.ts`](https://github.com/
|
|
121
|
+
Defined in [`session-manager.ts`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/session-manager.ts):
|
|
122
122
|
|
|
123
123
|
```typescript
|
|
124
124
|
interface CompactionEntry<T = unknown> {
|
|
@@ -143,7 +143,7 @@ interface CompactionDetails {
|
|
|
143
143
|
|
|
144
144
|
Extensions can store any JSON-serializable data in `details`. The default compaction tracks file operations, but custom extension implementations can use their own structure. Generated and extension-provided summaries store their LLM `usage` when available so session totals include summarization work.
|
|
145
145
|
|
|
146
|
-
See [`prepareCompaction()`](https://github.com/
|
|
146
|
+
See [`prepareCompaction()`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) and [`compact()`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) for the implementation. For direct programmatic summarization, `generateSummary()` returns the summary text and `generateSummaryWithUsage()` returns `{ text, usage }`.
|
|
147
147
|
|
|
148
148
|
## Branch Summarization
|
|
149
149
|
|
|
@@ -186,7 +186,7 @@ This means file tracking accumulates across multiple compactions or nested branc
|
|
|
186
186
|
|
|
187
187
|
### BranchSummaryEntry Structure
|
|
188
188
|
|
|
189
|
-
Defined in [`session-manager.ts`](https://github.com/
|
|
189
|
+
Defined in [`session-manager.ts`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/session-manager.ts):
|
|
190
190
|
|
|
191
191
|
```typescript
|
|
192
192
|
interface BranchSummaryEntry<T = unknown> {
|
|
@@ -210,7 +210,7 @@ interface BranchSummaryDetails {
|
|
|
210
210
|
|
|
211
211
|
Same as compaction, extensions can store custom data in `details`.
|
|
212
212
|
|
|
213
|
-
See [`collectEntriesForBranchSummary()`](https://github.com/
|
|
213
|
+
See [`collectEntriesForBranchSummary()`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), [`prepareBranchEntries()`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), and [`generateBranchSummary()`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) for the implementation.
|
|
214
214
|
|
|
215
215
|
## Summary Format
|
|
216
216
|
|
|
@@ -254,7 +254,7 @@ path/to/changed.ts
|
|
|
254
254
|
|
|
255
255
|
### Message Serialization
|
|
256
256
|
|
|
257
|
-
Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/
|
|
257
|
+
Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/compaction/utils.ts):
|
|
258
258
|
|
|
259
259
|
```
|
|
260
260
|
[User]: What they said
|
|
@@ -270,7 +270,7 @@ Tool results are truncated to 2000 characters during serialization. Content beyo
|
|
|
270
270
|
|
|
271
271
|
## Custom Summarization via Extensions
|
|
272
272
|
|
|
273
|
-
Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/
|
|
273
|
+
Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/extensions/types.ts) for event type definitions.
|
|
274
274
|
|
|
275
275
|
### session_before_compact
|
|
276
276
|
|
|
@@ -314,7 +314,7 @@ nexus.on("session_before_compact", async (event, ctx) => {
|
|
|
314
314
|
To generate a summary with your own model, convert messages to text using `serializeConversation`:
|
|
315
315
|
|
|
316
316
|
```typescript
|
|
317
|
-
import { convertToLlm, serializeConversation } from "@
|
|
317
|
+
import { convertToLlm, serializeConversation } from "@akon-labs/nexus-cli";
|
|
318
318
|
|
|
319
319
|
nexus.on("session_before_compact", async (event, ctx) => {
|
|
320
320
|
const { preparation } = event;
|
package/docs/containerization.md
CHANGED
|
@@ -54,7 +54,7 @@ FROM node:24-bookworm-slim
|
|
|
54
54
|
RUN apt-get update \
|
|
55
55
|
&& apt-get install -y --no-install-recommends bash ca-certificates git ripgrep \
|
|
56
56
|
&& rm -rf /var/lib/apt/lists/*
|
|
57
|
-
RUN npm install -g --ignore-scripts @
|
|
57
|
+
RUN npm install -g --ignore-scripts @akon-labs/nexus-cli
|
|
58
58
|
|
|
59
59
|
WORKDIR /workspace
|
|
60
60
|
ENTRYPOINT ["nexus"]
|
package/docs/custom-provider.md
CHANGED
|
@@ -33,8 +33,8 @@ See these complete provider examples:
|
|
|
33
33
|
Extensions can register either a complete pi-ai `Provider` or use the legacy provider-config form. Prefer a complete provider when custom authentication, filtering, refresh, or streaming behavior is required. Nexus composes `models.json` overrides above registered native providers.
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
import { createProvider, openAICompletionsApi } from "@
|
|
37
|
-
import type { ExtensionAPI } from "@
|
|
36
|
+
import { createProvider, openAICompletionsApi } from "@akon-labs/nexus-cli/ai";
|
|
37
|
+
import type { ExtensionAPI } from "@akon-labs/nexus-cli";
|
|
38
38
|
|
|
39
39
|
export default function (nexus: ExtensionAPI) {
|
|
40
40
|
nexus.registerProvider(createProvider({
|
|
@@ -125,7 +125,7 @@ To add a completely new provider, specify `models` along with the required confi
|
|
|
125
125
|
If the model list comes from a remote endpoint, use an async extension factory:
|
|
126
126
|
|
|
127
127
|
```typescript
|
|
128
|
-
import type { ExtensionAPI } from "@
|
|
128
|
+
import type { ExtensionAPI } from "@akon-labs/nexus-cli";
|
|
129
129
|
|
|
130
130
|
export default async function (nexus: ExtensionAPI) {
|
|
131
131
|
const response = await fetch("http://localhost:1234/v1/models");
|
|
@@ -285,10 +285,10 @@ The key is resolved for each request. An explicit request `Authorization` header
|
|
|
285
285
|
|
|
286
286
|
## OAuth Support
|
|
287
287
|
|
|
288
|
-
Add OAuth/SSO authentication that integrates with `/
|
|
288
|
+
Add OAuth/SSO authentication that integrates with `/byok`:
|
|
289
289
|
|
|
290
290
|
```typescript
|
|
291
|
-
import type { OAuthCredentials, OAuthLoginCallbacks } from "@
|
|
291
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "@akon-labs/nexus-cli/ai";
|
|
292
292
|
|
|
293
293
|
nexus.registerProvider("corporate-ai", {
|
|
294
294
|
baseUrl: "https://ai.corp.com/v1",
|
|
@@ -347,7 +347,7 @@ nexus.registerProvider("corporate-ai", {
|
|
|
347
347
|
});
|
|
348
348
|
```
|
|
349
349
|
|
|
350
|
-
After registration, users can authenticate via `/
|
|
350
|
+
After registration, users can authenticate via `/byok corporate-ai`.
|
|
351
351
|
|
|
352
352
|
### OAuthLoginCallbacks
|
|
353
353
|
|
|
@@ -397,12 +397,12 @@ interface OAuthCredentials {
|
|
|
397
397
|
For providers with non-standard APIs, implement `streamSimple`. Study the existing provider implementations before writing your own:
|
|
398
398
|
|
|
399
399
|
**Reference implementations:**
|
|
400
|
-
- [anthropic.ts](https://github.com/
|
|
401
|
-
- [mistral.ts](https://github.com/
|
|
402
|
-
- [openai-completions.ts](https://github.com/
|
|
403
|
-
- [openai-responses.ts](https://github.com/
|
|
404
|
-
- [google.ts](https://github.com/
|
|
405
|
-
- [amazon-bedrock.ts](https://github.com/
|
|
400
|
+
- [anthropic.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/ai/src/providers/anthropic.ts) - Anthropic Messages API
|
|
401
|
+
- [mistral.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/ai/src/providers/mistral.ts) - Mistral Conversations API
|
|
402
|
+
- [openai-completions.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/ai/src/providers/openai-completions.ts) - OpenAI Chat Completions
|
|
403
|
+
- [openai-responses.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/ai/src/providers/openai-responses.ts) - OpenAI Responses API
|
|
404
|
+
- [google.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/ai/src/providers/google.ts) - Google Generative AI
|
|
405
|
+
- [amazon-bedrock.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/ai/src/providers/amazon-bedrock.ts) - AWS Bedrock
|
|
406
406
|
|
|
407
407
|
### Stream Pattern
|
|
408
408
|
|
|
@@ -417,7 +417,7 @@ import {
|
|
|
417
417
|
type SimpleStreamOptions,
|
|
418
418
|
calculateCost,
|
|
419
419
|
createAssistantMessageEventStream,
|
|
420
|
-
} from "@
|
|
420
|
+
} from "@akon-labs/nexus-cli/ai";
|
|
421
421
|
|
|
422
422
|
function streamMyProvider(
|
|
423
423
|
model: Model<any>,
|
|
@@ -571,7 +571,7 @@ When a request exceeds the model's context window, nexus can recover automatical
|
|
|
571
571
|
Detection runs on the finalized assistant message:
|
|
572
572
|
|
|
573
573
|
- `stopReason === "error"`
|
|
574
|
-
- `errorMessage` matches one of nexus's known overflow patterns (see [`packages/ai/src/utils/overflow.ts`](https://github.com/
|
|
574
|
+
- `errorMessage` matches one of nexus's known overflow patterns (see [`packages/ai/src/utils/overflow.ts`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/ai/src/utils/overflow.ts))
|
|
575
575
|
|
|
576
576
|
If your provider returns overflow errors with a message nexus does not recognize, normalize the error from the same extension that registers the provider. Use a `message_end` handler to rewrite the assistant message so its `errorMessage` starts with a phrase nexus recognizes. The generic fallback `context_length_exceeded` is the safest choice.
|
|
577
577
|
|
|
@@ -634,7 +634,7 @@ nexus.registerProvider("my-provider", {
|
|
|
634
634
|
|
|
635
635
|
## Testing Your Implementation
|
|
636
636
|
|
|
637
|
-
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/
|
|
637
|
+
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/Akon-Labs/nexus-cli/tree/main/packages/ai/test):
|
|
638
638
|
|
|
639
639
|
| Test | Purpose |
|
|
640
640
|
|------|---------|
|
|
@@ -656,7 +656,7 @@ Run tests with your provider/model pairs to verify compatibility.
|
|
|
656
656
|
|
|
657
657
|
```typescript
|
|
658
658
|
interface ProviderConfig {
|
|
659
|
-
/** Display name for the provider in UI such as /
|
|
659
|
+
/** Display name for the provider in UI such as /byok. */
|
|
660
660
|
name?: string;
|
|
661
661
|
|
|
662
662
|
/** API endpoint URL. Required when defining models. */
|
|
@@ -684,7 +684,7 @@ interface ProviderConfig {
|
|
|
684
684
|
/** Models to register. If provided, replaces all existing models for this provider. */
|
|
685
685
|
models?: ProviderModelConfig[];
|
|
686
686
|
|
|
687
|
-
/** OAuth provider for /
|
|
687
|
+
/** OAuth provider for /byok support. */
|
|
688
688
|
oauth?: {
|
|
689
689
|
name: string;
|
|
690
690
|
login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
|
package/docs/development.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Development
|
|
2
2
|
|
|
3
|
-
See [AGENTS.md](https://github.com/
|
|
3
|
+
See [AGENTS.md](https://github.com/Akon-Labs/nexus-cli/blob/main/AGENTS.md) for additional guidelines.
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
git clone https://github.com/
|
|
8
|
+
git clone https://github.com/Akon-Labs/nexus-cli
|
|
9
9
|
cd nexus-mono
|
|
10
10
|
npm install
|
|
11
11
|
npm run build
|
|
@@ -87,7 +87,7 @@ These variables are read by Nexus itself:
|
|
|
87
87
|
| `NEXUS_CODING_AGENT_SESSION_DIR` | Override session storage; overridden by `--session-dir` |
|
|
88
88
|
| `NEXUS_PACKAGE_DIR` | Override the package directory, useful for Nix/Guix store paths |
|
|
89
89
|
| `NEXUS_OFFLINE` | Disable startup network operations, including update checks, package updates, and install/update telemetry |
|
|
90
|
-
| `NEXUS_SKIP_VERSION_CHECK` | Disable the
|
|
90
|
+
| `NEXUS_SKIP_VERSION_CHECK` | Disable the latest-version request (only applies when `NEXUS_LATEST_VERSION_URL` is configured) |
|
|
91
91
|
| `NEXUS_TELEMETRY` | Override install/update telemetry and provider attribution headers: `1`/`true`/`yes` or `0`/`false`/`no` |
|
|
92
92
|
| `NEXUS_CACHE_RETENTION` | Set to `long` for extended provider prompt caching where supported |
|
|
93
93
|
| `NEXUS_SHARE_VIEWER_URL` | Override the base URL used by `/share` |
|
package/docs/extensions.md
CHANGED
|
@@ -58,7 +58,7 @@ See [examples/extensions/](../examples/extensions/) for working implementations.
|
|
|
58
58
|
Create `~/.nexus/agent/extensions/my-extension.ts`:
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
|
-
import type { ExtensionAPI } from "@
|
|
61
|
+
import type { ExtensionAPI } from "@akon-labs/nexus-cli";
|
|
62
62
|
import { Type } from "typebox";
|
|
63
63
|
|
|
64
64
|
export default function (nexus: ExtensionAPI) {
|
|
@@ -140,10 +140,10 @@ To share extensions via npm or git as nexus packages, see [packages.md](packages
|
|
|
140
140
|
|
|
141
141
|
| Package | Purpose |
|
|
142
142
|
|---------|---------|
|
|
143
|
-
| `@
|
|
143
|
+
| `@akon-labs/nexus-cli` | Extension types (`ExtensionAPI`, `ExtensionContext`, events) |
|
|
144
144
|
| `typebox` | Schema definitions for tool parameters |
|
|
145
|
-
| `@
|
|
146
|
-
| `@
|
|
145
|
+
| `@akon-labs/nexus-cli/ai` | AI utilities (`StringEnum` for Google-compatible enums) |
|
|
146
|
+
| `@akon-labs/nexus-cli/tui` | TUI components for custom rendering |
|
|
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
|
|
|
@@ -156,7 +156,7 @@ Node.js built-ins (`node:fs`, `node:path`, etc.) are also available.
|
|
|
156
156
|
An extension exports a default factory function that receives `ExtensionAPI`. The factory can be synchronous or asynchronous:
|
|
157
157
|
|
|
158
158
|
```typescript
|
|
159
|
-
import type { ExtensionAPI } from "@
|
|
159
|
+
import type { ExtensionAPI } from "@akon-labs/nexus-cli";
|
|
160
160
|
|
|
161
161
|
export default function (nexus: ExtensionAPI) {
|
|
162
162
|
// Subscribe to events
|
|
@@ -185,7 +185,7 @@ If the factory returns a `Promise`, nexus awaits it before continuing startup. T
|
|
|
185
185
|
Use an async factory for one-time startup work such as fetching remote configuration or dynamically discovering available models.
|
|
186
186
|
|
|
187
187
|
```typescript
|
|
188
|
-
import type { ExtensionAPI } from "@
|
|
188
|
+
import type { ExtensionAPI } from "@akon-labs/nexus-cli";
|
|
189
189
|
|
|
190
190
|
export default async function (nexus: ExtensionAPI) {
|
|
191
191
|
const response = await fetch("http://localhost:1234/v1/models");
|
|
@@ -765,7 +765,7 @@ Behavior guarantees:
|
|
|
765
765
|
- Return values from `tool_call` only control blocking via `{ block: true, reason?: string }`
|
|
766
766
|
|
|
767
767
|
```typescript
|
|
768
|
-
import { isToolCallEventType } from "@
|
|
768
|
+
import { isToolCallEventType } from "@akon-labs/nexus-cli";
|
|
769
769
|
|
|
770
770
|
nexus.on("tool_call", async (event, ctx) => {
|
|
771
771
|
// event.toolName - "bash", "read", "write", "edit", etc.
|
|
@@ -801,7 +801,7 @@ export type MyToolInput = Static<typeof myToolSchema>;
|
|
|
801
801
|
Use `isToolCallEventType` with explicit type parameters:
|
|
802
802
|
|
|
803
803
|
```typescript
|
|
804
|
-
import { isToolCallEventType } from "@
|
|
804
|
+
import { isToolCallEventType } from "@akon-labs/nexus-cli";
|
|
805
805
|
import type { MyToolInput } from "my-extension";
|
|
806
806
|
|
|
807
807
|
nexus.on("tool_call", (event) => {
|
|
@@ -825,7 +825,7 @@ In parallel tool mode, `tool_result` and `tool_execution_end` may interleave in
|
|
|
825
825
|
Use `ctx.signal` for nested async work inside the handler. This lets Esc cancel model calls, `fetch()`, and other abort-aware operations started by the extension.
|
|
826
826
|
|
|
827
827
|
```typescript
|
|
828
|
-
import { isBashToolResult } from "@
|
|
828
|
+
import { isBashToolResult } from "@akon-labs/nexus-cli";
|
|
829
829
|
|
|
830
830
|
nexus.on("tool_result", async (event, ctx) => {
|
|
831
831
|
// event.toolName, event.toolCallId, event.input
|
|
@@ -853,7 +853,7 @@ nexus.on("tool_result", async (event, ctx) => {
|
|
|
853
853
|
Fired when user executes `!` or `!!` commands. **Can intercept.**
|
|
854
854
|
|
|
855
855
|
```typescript
|
|
856
|
-
import { createLocalBashOperations } from "@
|
|
856
|
+
import { createLocalBashOperations } from "@akon-labs/nexus-cli";
|
|
857
857
|
|
|
858
858
|
nexus.on("user_bash", (event, ctx) => {
|
|
859
859
|
// event.command - the bash command
|
|
@@ -952,7 +952,7 @@ Current working directory.
|
|
|
952
952
|
Use `CONFIG_DIR_NAME` instead of hardcoding `.nexus` when constructing project-local config paths. Rebranded distributions can use a different config directory name.
|
|
953
953
|
|
|
954
954
|
```typescript
|
|
955
|
-
import { CONFIG_DIR_NAME, type ExtensionAPI } from "@
|
|
955
|
+
import { CONFIG_DIR_NAME, type ExtensionAPI } from "@akon-labs/nexus-cli";
|
|
956
956
|
import { join } from "node:path";
|
|
957
957
|
|
|
958
958
|
export default function (nexus: ExtensionAPI) {
|
|
@@ -1207,7 +1207,7 @@ Options:
|
|
|
1207
1207
|
To discover available sessions, use the static `SessionManager.list()` or `SessionManager.listAll()` methods:
|
|
1208
1208
|
|
|
1209
1209
|
```typescript
|
|
1210
|
-
import { SessionManager } from "@
|
|
1210
|
+
import { SessionManager } from "@akon-labs/nexus-cli";
|
|
1211
1211
|
|
|
1212
1212
|
nexus.registerCommand("switch", {
|
|
1213
1213
|
description: "Switch to another session",
|
|
@@ -1301,7 +1301,7 @@ Tools run with `ExtensionContext`, so they cannot call `ctx.reload()` directly.
|
|
|
1301
1301
|
Example tool the LLM can call to trigger reload:
|
|
1302
1302
|
|
|
1303
1303
|
```typescript
|
|
1304
|
-
import type { ExtensionAPI } from "@
|
|
1304
|
+
import type { ExtensionAPI } from "@akon-labs/nexus-cli";
|
|
1305
1305
|
import { Type } from "typebox";
|
|
1306
1306
|
|
|
1307
1307
|
export default function (nexus: ExtensionAPI) {
|
|
@@ -1350,7 +1350,7 @@ See [dynamic-tools.ts](../examples/extensions/dynamic-tools.ts) for a full examp
|
|
|
1350
1350
|
|
|
1351
1351
|
```typescript
|
|
1352
1352
|
import { Type } from "typebox";
|
|
1353
|
-
import { StringEnum } from "@
|
|
1353
|
+
import { StringEnum } from "@akon-labs/nexus-cli/ai";
|
|
1354
1354
|
|
|
1355
1355
|
nexus.registerTool({
|
|
1356
1356
|
name: "my_tool",
|
|
@@ -1509,7 +1509,7 @@ nexus.registerCommand("stats", {
|
|
|
1509
1509
|
Optional: add argument auto-completion for `/command ...`:
|
|
1510
1510
|
|
|
1511
1511
|
```typescript
|
|
1512
|
-
import type { AutocompleteItem } from "@
|
|
1512
|
+
import type { AutocompleteItem } from "@akon-labs/nexus-cli/tui";
|
|
1513
1513
|
|
|
1514
1514
|
nexus.registerCommand("deploy", {
|
|
1515
1515
|
description: "Deploy to an environment",
|
|
@@ -1588,7 +1588,7 @@ If a transformer throws, Nexus keeps the Markdown produced so far and continues
|
|
|
1588
1588
|
Register a custom TUI renderer for custom entries with your `customType`. Custom entries are created with `nexus.appendEntry()` and do not participate in LLM context.
|
|
1589
1589
|
|
|
1590
1590
|
```typescript
|
|
1591
|
-
import { Box, Text } from "@
|
|
1591
|
+
import { Box, Text } from "@akon-labs/nexus-cli/tui";
|
|
1592
1592
|
|
|
1593
1593
|
nexus.registerEntryRenderer("status-card", (entry, { expanded }, theme) => {
|
|
1594
1594
|
const data = entry.data as { title: string; count: number };
|
|
@@ -1711,10 +1711,10 @@ Dynamic providers can implement `refreshModels`. Nexus calls it during model ref
|
|
|
1711
1711
|
|
|
1712
1712
|
`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.
|
|
1713
1713
|
|
|
1714
|
-
Extensions that need native provider auth, filtering, refresh, or stream behavior can register a complete `Provider` from `@
|
|
1714
|
+
Extensions that need native provider auth, filtering, refresh, or stream behavior can register a complete `Provider` from `@akon-labs/nexus-cli/ai`. The provider becomes the composition base and `models.json` overrides still apply above it.
|
|
1715
1715
|
|
|
1716
1716
|
```typescript
|
|
1717
|
-
import { createProvider, openAICompletionsApi } from "@
|
|
1717
|
+
import { createProvider, openAICompletionsApi } from "@akon-labs/nexus-cli/ai";
|
|
1718
1718
|
|
|
1719
1719
|
const provider = createProvider({
|
|
1720
1720
|
id: "local-server",
|
|
@@ -1786,7 +1786,7 @@ nexus.registerProvider("anthropic", {
|
|
|
1786
1786
|
baseUrl: "https://proxy.example.com"
|
|
1787
1787
|
});
|
|
1788
1788
|
|
|
1789
|
-
// Register provider with OAuth support for /
|
|
1789
|
+
// Register provider with OAuth support for /byok
|
|
1790
1790
|
nexus.registerProvider("corporate-ai", {
|
|
1791
1791
|
baseUrl: "https://ai.corp.com",
|
|
1792
1792
|
api: "openai-responses",
|
|
@@ -1814,7 +1814,7 @@ nexus.registerProvider("corporate-ai", {
|
|
|
1814
1814
|
The object form accepts a complete pi-ai `Provider`, including native `auth`, `getModels`, `refreshModels`, `filterModels`, `stream`, and `streamSimple` behavior.
|
|
1815
1815
|
|
|
1816
1816
|
**Legacy config options:**
|
|
1817
|
-
- `name` - Display name for the provider in UI such as `/
|
|
1817
|
+
- `name` - Display name for the provider in UI such as `/byok`.
|
|
1818
1818
|
- `baseUrl` - API endpoint URL. Required when defining models.
|
|
1819
1819
|
- `apiKey` - API key literal, environment interpolation (`$ENV_VAR` or `${ENV_VAR}`), or leading `!command`. Required when defining models (unless `oauth` provided). `$$` escapes `$`, and `$!` escapes a literal `!` without triggering command execution.
|
|
1820
1820
|
- `api` - API type: `"anthropic-messages"`, `"openai-completions"`, `"openai-responses"`, etc.
|
|
@@ -1822,7 +1822,7 @@ The object form accepts a complete pi-ai `Provider`, including native `auth`, `g
|
|
|
1822
1822
|
- `authHeader` - If true, adds `Authorization: Bearer` header automatically.
|
|
1823
1823
|
- `models` - Array of model definitions. If provided, replaces all existing models for this provider. Model definitions can set `baseUrl` to override the provider endpoint for that model.
|
|
1824
1824
|
- `refreshModels` - Async dynamic discovery callback. Its returned models replace extension-provided models. `context.stored` contains the persisted provider snapshot; use generation-checked `context.publish({ persist: entry })` only when updated catalog data should persist. Use `persist: null` to delete that snapshot.
|
|
1825
|
-
- `oauth` - OAuth provider config for `/
|
|
1825
|
+
- `oauth` - OAuth provider config for `/byok` support. When provided, the provider appears in the model-provider setup menu.
|
|
1826
1826
|
- `streamSimple` - Custom streaming implementation for non-standard APIs.
|
|
1827
1827
|
|
|
1828
1828
|
See [custom-provider.md](custom-provider.md) for advanced topics: custom streaming APIs, OAuth details, model definition reference.
|
|
@@ -1897,7 +1897,7 @@ Pass the real target file path to `withFileMutationQueue()`, not the raw user ar
|
|
|
1897
1897
|
Queue the entire mutation window on that target path. That includes read-modify-write logic, not just the final write.
|
|
1898
1898
|
|
|
1899
1899
|
```typescript
|
|
1900
|
-
import { withFileMutationQueue } from "@
|
|
1900
|
+
import { withFileMutationQueue } from "@akon-labs/nexus-cli";
|
|
1901
1901
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
1902
1902
|
import { dirname, resolve } from "node:path";
|
|
1903
1903
|
|
|
@@ -1922,8 +1922,8 @@ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
|
1922
1922
|
|
|
1923
1923
|
```typescript
|
|
1924
1924
|
import { Type } from "typebox";
|
|
1925
|
-
import { StringEnum } from "@
|
|
1926
|
-
import { Text } from "@
|
|
1925
|
+
import { StringEnum } from "@akon-labs/nexus-cli/ai";
|
|
1926
|
+
import { Text } from "@akon-labs/nexus-cli/tui";
|
|
1927
1927
|
|
|
1928
1928
|
nexus.registerTool({
|
|
1929
1929
|
name: "my_tool",
|
|
@@ -1994,7 +1994,7 @@ async execute(toolCallId, params) {
|
|
|
1994
1994
|
}
|
|
1995
1995
|
```
|
|
1996
1996
|
|
|
1997
|
-
**Important:** Use `StringEnum` from `@
|
|
1997
|
+
**Important:** Use `StringEnum` from `@akon-labs/nexus-cli/ai` for string enums. `Type.Union`/`Type.Literal` doesn't work with Google's API.
|
|
1998
1998
|
|
|
1999
1999
|
**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 nexus 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.
|
|
2000
2000
|
|
|
@@ -2067,20 +2067,20 @@ See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.
|
|
|
2067
2067
|
**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.
|
|
2068
2068
|
|
|
2069
2069
|
Built-in tool implementations:
|
|
2070
|
-
- [read.ts](https://github.com/
|
|
2071
|
-
- [bash.ts](https://github.com/
|
|
2072
|
-
- [edit.ts](https://github.com/
|
|
2073
|
-
- [write.ts](https://github.com/
|
|
2074
|
-
- [grep.ts](https://github.com/
|
|
2075
|
-
- [find.ts](https://github.com/
|
|
2076
|
-
- [ls.ts](https://github.com/
|
|
2070
|
+
- [read.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/tools/read.ts) - `ReadToolDetails`
|
|
2071
|
+
- [bash.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/tools/bash.ts) - `BashToolDetails`
|
|
2072
|
+
- [edit.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/tools/edit.ts)
|
|
2073
|
+
- [write.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/tools/write.ts)
|
|
2074
|
+
- [grep.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/tools/grep.ts) - `GrepToolDetails`
|
|
2075
|
+
- [find.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/tools/find.ts) - `FindToolDetails`
|
|
2076
|
+
- [ls.ts](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/core/tools/ls.ts) - `LsToolDetails`
|
|
2077
2077
|
|
|
2078
2078
|
### Remote Execution
|
|
2079
2079
|
|
|
2080
2080
|
Built-in tools support pluggable operations for delegating to remote systems (SSH, containers, etc.):
|
|
2081
2081
|
|
|
2082
2082
|
```typescript
|
|
2083
|
-
import { createReadTool, createBashTool, type ReadOperations } from "@
|
|
2083
|
+
import { createReadTool, createBashTool, type ReadOperations } from "@akon-labs/nexus-cli";
|
|
2084
2084
|
|
|
2085
2085
|
// Create tool with custom operations
|
|
2086
2086
|
const remoteRead = createReadTool(cwd, {
|
|
@@ -2111,7 +2111,7 @@ For `user_bash`, extensions can reuse nexus's local shell backend via `createLoc
|
|
|
2111
2111
|
The bash tool also supports a spawn hook to adjust the command, cwd, or env before execution:
|
|
2112
2112
|
|
|
2113
2113
|
```typescript
|
|
2114
|
-
import { createBashTool } from "@
|
|
2114
|
+
import { createBashTool } from "@akon-labs/nexus-cli";
|
|
2115
2115
|
|
|
2116
2116
|
const bashTool = createBashTool(cwd, {
|
|
2117
2117
|
spawnHook: ({ command, cwd, env }) => ({
|
|
@@ -2149,7 +2149,7 @@ import {
|
|
|
2149
2149
|
formatSize, // Human-readable size (e.g., "50KB", "1.5MB")
|
|
2150
2150
|
DEFAULT_MAX_BYTES, // 50KB
|
|
2151
2151
|
DEFAULT_MAX_LINES, // 2000
|
|
2152
|
-
} from "@
|
|
2152
|
+
} from "@akon-labs/nexus-cli";
|
|
2153
2153
|
|
|
2154
2154
|
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
2155
2155
|
const output = await runCommand();
|
|
@@ -2204,7 +2204,7 @@ export default function (nexus: ExtensionAPI) {
|
|
|
2204
2204
|
|
|
2205
2205
|
### Custom Rendering
|
|
2206
2206
|
|
|
2207
|
-
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/
|
|
2207
|
+
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/Akon-Labs/nexus-cli/blob/main/packages/coding-agent/src/modes/interactive/components/tool-execution.ts) for how tool rows are composed.
|
|
2208
2208
|
|
|
2209
2209
|
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.
|
|
2210
2210
|
|
|
@@ -2240,7 +2240,7 @@ Use `context.state` for cross-slot shared state. Keep slot-local caches on the r
|
|
|
2240
2240
|
Renders the tool call or header:
|
|
2241
2241
|
|
|
2242
2242
|
```typescript
|
|
2243
|
-
import { Text } from "@
|
|
2243
|
+
import { Text } from "@akon-labs/nexus-cli/tui";
|
|
2244
2244
|
|
|
2245
2245
|
renderCall(args, theme, context) {
|
|
2246
2246
|
const text = (context.lastComponent as Text | undefined) ?? new Text("", 0, 0);
|
|
@@ -2285,7 +2285,7 @@ If a slot intentionally has no visible content, return an empty `Component` such
|
|
|
2285
2285
|
Use `keyHint()` to display keybinding hints that respect the active keybinding configuration:
|
|
2286
2286
|
|
|
2287
2287
|
```typescript
|
|
2288
|
-
import { keyHint } from "@
|
|
2288
|
+
import { keyHint } from "@akon-labs/nexus-cli";
|
|
2289
2289
|
|
|
2290
2290
|
renderResult(result, { expanded }, theme, context) {
|
|
2291
2291
|
let text = theme.fg("success", "✓ Done");
|
|
@@ -2367,7 +2367,7 @@ For the best cache behavior, keep the loader tool active for the whole session a
|
|
|
2367
2367
|
The following extension registers two searchable tools, removes them from the initial active set, and keeps only `search_tools` as their loader. The example uses simple keyword matching, but the search implementation could use BM25, embeddings, a remote catalog, or project-specific routing.
|
|
2368
2368
|
|
|
2369
2369
|
```typescript
|
|
2370
|
-
import type { ExtensionAPI } from "@
|
|
2370
|
+
import type { ExtensionAPI } from "@akon-labs/nexus-cli";
|
|
2371
2371
|
import { Type } from "typebox";
|
|
2372
2372
|
|
|
2373
2373
|
const SEARCHABLE_TOOL_NAMES = new Set(["lookup_weather", "search_issues"]);
|
|
@@ -2698,7 +2698,7 @@ See [github-issue-autocomplete.ts](../examples/extensions/github-issue-autocompl
|
|
|
2698
2698
|
For complex UI, use `ctx.ui.custom()`. This temporarily replaces the editor with your component until `done()` is called:
|
|
2699
2699
|
|
|
2700
2700
|
```typescript
|
|
2701
|
-
import { Text, Component } from "@
|
|
2701
|
+
import { Text, Component } from "@akon-labs/nexus-cli/tui";
|
|
2702
2702
|
|
|
2703
2703
|
const result = await ctx.ui.custom<boolean>((tui, theme, keybindings, done) => {
|
|
2704
2704
|
const text = new Text("Press Enter to confirm, Escape to cancel", 1, 1);
|
|
@@ -2763,8 +2763,8 @@ See [tui.md](tui.md) for the full `OverlayOptions` and `OverlayHandle` API and [
|
|
|
2763
2763
|
Replace the main input editor with a custom implementation (vim mode, emacs mode, etc.):
|
|
2764
2764
|
|
|
2765
2765
|
```typescript
|
|
2766
|
-
import { CustomEditor, type ExtensionAPI } from "@
|
|
2767
|
-
import { matchesKey } from "@
|
|
2766
|
+
import { CustomEditor, type ExtensionAPI } from "@akon-labs/nexus-cli";
|
|
2767
|
+
import { matchesKey } from "@akon-labs/nexus-cli/tui";
|
|
2768
2768
|
|
|
2769
2769
|
class VimEditor extends CustomEditor {
|
|
2770
2770
|
private mode: "normal" | "insert" = "insert";
|
|
@@ -2814,7 +2814,7 @@ See [tui.md](tui.md) Pattern 7 for a complete example with mode indicator.
|
|
|
2814
2814
|
Register a custom renderer for messages with your `customType`. Use message renderers for content that should participate in LLM context:
|
|
2815
2815
|
|
|
2816
2816
|
```typescript
|
|
2817
|
-
import { Text } from "@
|
|
2817
|
+
import { Text } from "@akon-labs/nexus-cli/tui";
|
|
2818
2818
|
|
|
2819
2819
|
nexus.registerMessageRenderer("my-extension", (message, options, theme) => {
|
|
2820
2820
|
const { expanded, outputPad } = options;
|
|
@@ -2873,7 +2873,7 @@ theme.strikethrough(text)
|
|
|
2873
2873
|
For syntax highlighting in custom tool renderers:
|
|
2874
2874
|
|
|
2875
2875
|
```typescript
|
|
2876
|
-
import { highlightCode, getLanguageFromPath } from "@
|
|
2876
|
+
import { highlightCode, getLanguageFromPath } from "@akon-labs/nexus-cli";
|
|
2877
2877
|
|
|
2878
2878
|
// Highlight code with explicit language
|
|
2879
2879
|
const highlighted = highlightCode("const x = 1;", "typescript", theme);
|
package/docs/index.md
CHANGED
|
@@ -7,24 +7,18 @@ Nexus is a minimal terminal coding harness. It is designed to stay small at the
|
|
|
7
7
|
Install Nexus with npm:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install -g --ignore-scripts @
|
|
10
|
+
npm install -g --ignore-scripts @akon-labs/nexus-cli
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
`--ignore-scripts` disables dependency lifecycle scripts during install. Nexus does not require install scripts for normal npm installs.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
To uninstall nexus itself:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
|
|
18
|
+
npm uninstall -g @akon-labs/nexus-cli
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npm uninstall -g @earendil-works/pi-coding-agent
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
For pnpm, Yarn, or Bun installs, use the matching global remove command: `pnpm remove -g @earendil-works/pi-coding-agent`, `yarn global remove @earendil-works/pi-coding-agent`, or `bun uninstall -g @earendil-works/pi-coding-agent`.
|
|
21
|
+
For pnpm, Yarn, or Bun installs, use the matching global remove command with `@akon-labs/nexus-cli`.
|
|
28
22
|
|
|
29
23
|
Then run it in a project directory:
|
|
30
24
|
|
|
@@ -32,7 +26,7 @@ Then run it in a project directory:
|
|
|
32
26
|
nexus
|
|
33
27
|
```
|
|
34
28
|
|
|
35
|
-
|
|
29
|
+
The first interactive launch signs in to GitNexus. Use `/login` to repeat that account flow, `/byok` to configure a model provider, and `/model` to choose a model. Provider environment variables such as `ANTHROPIC_API_KEY` also work.
|
|
36
30
|
|
|
37
31
|
For the full first-run flow, see [Quickstart](quickstart.md).
|
|
38
32
|
|
package/docs/json.md
CHANGED
|
@@ -9,7 +9,7 @@ Outputs all session events as JSON lines to stdout. Useful for integrating nexus
|
|
|
9
9
|
## Event Types
|
|
10
10
|
|
|
11
11
|
Wire events use `JsonAgentSessionEvent`. It matches
|
|
12
|
-
[`AgentSessionEvent`](https://github.com/
|
|
12
|
+
[`AgentSessionEvent`](https://github.com/Akon-Labs/nexus-cli/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/Akon-Labs/nexus-cli/blob/main/packages/agent/src/types.ts):
|
|
30
30
|
|
|
31
31
|
```typescript
|
|
32
32
|
type AgentEvent =
|
|
@@ -48,12 +48,12 @@ type AgentEvent =
|
|
|
48
48
|
|
|
49
49
|
## Message Types
|
|
50
50
|
|
|
51
|
-
Base messages from [`packages/ai/src/types.ts`](https://github.com/
|
|
51
|
+
Base messages from [`packages/ai/src/types.ts`](https://github.com/Akon-Labs/nexus-cli/blob/main/packages/ai/src/types.ts#L134):
|
|
52
52
|
- `UserMessage` (line 134)
|
|
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/Akon-Labs/nexus-cli/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)
|