byterover-cli 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +132 -11
- package/dist/core/domain/errors/headless-prompt-error.d.ts +11 -0
- package/dist/core/domain/errors/headless-prompt-error.js +18 -0
- package/dist/core/interfaces/i-cogit-pull-service.d.ts +0 -1
- package/dist/core/interfaces/i-memory-retrieval-service.d.ts +0 -1
- package/dist/core/interfaces/i-memory-storage-service.d.ts +0 -2
- package/dist/core/interfaces/i-space-service.d.ts +1 -2
- package/dist/core/interfaces/i-team-service.d.ts +1 -2
- package/dist/core/interfaces/i-user-service.d.ts +1 -2
- package/dist/core/interfaces/usecase/i-curate-use-case.d.ts +2 -0
- package/dist/core/interfaces/usecase/i-init-use-case.d.ts +9 -3
- package/dist/core/interfaces/usecase/i-login-use-case.d.ts +4 -1
- package/dist/core/interfaces/usecase/i-pull-use-case.d.ts +5 -3
- package/dist/core/interfaces/usecase/i-push-use-case.d.ts +6 -4
- package/dist/core/interfaces/usecase/i-query-use-case.d.ts +2 -0
- package/dist/core/interfaces/usecase/i-status-use-case.d.ts +1 -0
- package/dist/infra/cipher/agent/service-initializer.d.ts +1 -1
- package/dist/infra/cipher/agent/service-initializer.js +0 -1
- package/dist/infra/cipher/http/internal-llm-http-service.d.ts +0 -1
- package/dist/infra/cipher/http/internal-llm-http-service.js +1 -2
- package/dist/infra/cogit/http-cogit-pull-service.js +1 -1
- package/dist/infra/cogit/http-cogit-push-service.js +0 -1
- package/dist/infra/http/authenticated-http-client.d.ts +1 -3
- package/dist/infra/http/authenticated-http-client.js +1 -5
- package/dist/infra/memory/http-memory-retrieval-service.js +1 -1
- package/dist/infra/memory/http-memory-storage-service.js +2 -2
- package/dist/infra/process/inline-agent-executor.d.ts +32 -0
- package/dist/infra/process/inline-agent-executor.js +259 -0
- package/dist/infra/space/http-space-service.d.ts +1 -1
- package/dist/infra/space/http-space-service.js +2 -2
- package/dist/infra/storage/token-store.d.ts +4 -3
- package/dist/infra/storage/token-store.js +6 -5
- package/dist/infra/team/http-team-service.d.ts +1 -1
- package/dist/infra/team/http-team-service.js +2 -2
- package/dist/infra/terminal/headless-terminal.d.ts +91 -0
- package/dist/infra/terminal/headless-terminal.js +211 -0
- package/dist/infra/usecase/curate-use-case.d.ts +40 -1
- package/dist/infra/usecase/curate-use-case.js +176 -15
- package/dist/infra/usecase/init-use-case.d.ts +27 -5
- package/dist/infra/usecase/init-use-case.js +200 -34
- package/dist/infra/usecase/login-use-case.d.ts +10 -8
- package/dist/infra/usecase/login-use-case.js +35 -2
- package/dist/infra/usecase/pull-use-case.d.ts +19 -5
- package/dist/infra/usecase/pull-use-case.js +71 -13
- package/dist/infra/usecase/push-use-case.d.ts +18 -5
- package/dist/infra/usecase/push-use-case.js +81 -14
- package/dist/infra/usecase/query-use-case.d.ts +21 -0
- package/dist/infra/usecase/query-use-case.js +114 -29
- package/dist/infra/usecase/space-list-use-case.js +1 -1
- package/dist/infra/usecase/space-switch-use-case.js +2 -2
- package/dist/infra/usecase/status-use-case.d.ts +36 -0
- package/dist/infra/usecase/status-use-case.js +185 -48
- package/dist/infra/user/http-user-service.d.ts +1 -1
- package/dist/infra/user/http-user-service.js +2 -2
- package/dist/oclif/commands/curate.d.ts +6 -1
- package/dist/oclif/commands/curate.js +24 -3
- package/dist/oclif/commands/init.d.ts +18 -0
- package/dist/oclif/commands/init.js +129 -0
- package/dist/oclif/commands/login.d.ts +9 -0
- package/dist/oclif/commands/login.js +45 -0
- package/dist/oclif/commands/pull.d.ts +16 -0
- package/dist/oclif/commands/pull.js +78 -0
- package/dist/oclif/commands/push.d.ts +17 -0
- package/dist/oclif/commands/push.js +87 -0
- package/dist/oclif/commands/query.d.ts +6 -1
- package/dist/oclif/commands/query.js +29 -4
- package/dist/oclif/commands/status.d.ts +5 -1
- package/dist/oclif/commands/status.js +17 -5
- package/dist/tui/hooks/use-auth-polling.js +1 -1
- package/dist/utils/environment-detector.d.ts +15 -0
- package/dist/utils/environment-detector.js +62 -1
- package/oclif.manifest.json +287 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ Command-line interface for ByteRover, featuring an interactive REPL with a moder
|
|
|
12
12
|
* [Quick Start](#quick-start)
|
|
13
13
|
* [Interactive REPL](#interactive-repl)
|
|
14
14
|
* [Keyboard Shortcuts](#keyboard-shortcuts)
|
|
15
|
+
* [CLI Commands](#cli-commands)
|
|
16
|
+
* [Headless Mode](#headless-mode)
|
|
15
17
|
* [What is Context Tree?](#what-is-context-tree)
|
|
16
18
|
* [Supported AI Agents](#supported-ai-agents)
|
|
17
19
|
* [LLM Providers](#llm-providers) (BETA)
|
|
@@ -124,7 +126,7 @@ The terminal UI includes:
|
|
|
124
126
|
- **Streaming Output**: Live responses with markdown rendering (headings, lists, blockquotes, code blocks)
|
|
125
127
|
- **Reasoning Display**: View agent thinking process with streamed reasoning blocks
|
|
126
128
|
- **File References**: Type `@` in curate mode to browse and attach files
|
|
127
|
-
- **PDF Support**: Reference and extract text from PDF files using `@` (
|
|
129
|
+
- **PDF Support**: Reference and extract text from PDF files using `@` (100 pages default, 200 max)
|
|
128
130
|
- **Dynamic Domains**: Automatically creates new knowledge domains as your context tree grows
|
|
129
131
|
- **Session Persistence**: Sessions auto-resume after restart
|
|
130
132
|
- **Expandable Views**: Press `Ctrl+O` to expand messages or logs to full-screen with vim-style navigation
|
|
@@ -142,17 +144,123 @@ The terminal UI includes:
|
|
|
142
144
|
| `/` | Show command suggestions |
|
|
143
145
|
| `@` | Browse files (in curate mode) |
|
|
144
146
|
|
|
145
|
-
|
|
147
|
+
## CLI Commands
|
|
146
148
|
|
|
147
|
-
In the REPL,
|
|
149
|
+
In addition to the interactive REPL, ByteRover CLI provides direct command-line commands for automation and scripting.
|
|
148
150
|
|
|
151
|
+
### Authentication
|
|
152
|
+
|
|
153
|
+
| Command | Description |
|
|
154
|
+
|---------|-------------|
|
|
155
|
+
| `brv login -k <key>` | Authenticate with an API key |
|
|
156
|
+
|
|
157
|
+
**Example:**
|
|
158
|
+
```bash
|
|
159
|
+
brv login --api-key your-api-key
|
|
149
160
|
```
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
161
|
+
|
|
162
|
+
Get your API key at [app.byterover.dev/settings/keys](https://app.byterover.dev/settings/keys).
|
|
163
|
+
|
|
164
|
+
### Project Commands
|
|
165
|
+
|
|
166
|
+
| Command | Description |
|
|
167
|
+
|---------|-------------|
|
|
168
|
+
| `brv init` | Initialize a project with ByteRover |
|
|
169
|
+
| `brv status [dir]` | Show CLI status and project information |
|
|
170
|
+
|
|
171
|
+
**Init flags:**
|
|
172
|
+
- `-f, --force`: Force re-initialization without confirmation
|
|
173
|
+
- `--headless`: Run in headless mode (requires `--team` and `--space`)
|
|
174
|
+
- `--team <id|name>`: Team ID or name
|
|
175
|
+
- `--space <id|name>`: Space ID or name
|
|
176
|
+
- `--format <text|json>`: Output format (default: text)
|
|
177
|
+
|
|
178
|
+
**Status flags:**
|
|
179
|
+
- `-f, --format <text|json>`: Output format (default: text)
|
|
180
|
+
- `--headless`: Run in headless mode
|
|
181
|
+
|
|
182
|
+
### Context Operations
|
|
183
|
+
|
|
184
|
+
| Command | Description |
|
|
185
|
+
|---------|-------------|
|
|
186
|
+
| `brv query <question>` | Query the context tree |
|
|
187
|
+
| `brv curate [context]` | Curate context to the context tree |
|
|
188
|
+
|
|
189
|
+
**Note:** `query` and `curate` require a running `brv` instance in another terminal.
|
|
190
|
+
|
|
191
|
+
**Query flags:**
|
|
192
|
+
- `--headless`: Run in headless mode
|
|
193
|
+
- `--format <text|json>`: Output format (default: text)
|
|
194
|
+
|
|
195
|
+
**Curate flags:**
|
|
196
|
+
- `-f, --files <path>`: Include specific files (max 5, can be repeated)
|
|
197
|
+
- `--headless`: Run in headless mode
|
|
198
|
+
- `--format <text|json>`: Output format (default: text)
|
|
199
|
+
|
|
200
|
+
### Cloud Sync
|
|
201
|
+
|
|
202
|
+
| Command | Description |
|
|
203
|
+
|---------|-------------|
|
|
204
|
+
| `brv push` | Push context tree to ByteRover cloud |
|
|
205
|
+
| `brv pull` | Pull context tree from ByteRover cloud |
|
|
206
|
+
|
|
207
|
+
**Push flags:**
|
|
208
|
+
- `-b, --branch <name>`: ByteRover branch name (default: main, not Git branch)
|
|
209
|
+
- `-y, --yes`: Skip confirmation prompt
|
|
210
|
+
- `--headless`: Run in headless mode (auto-skips confirmation)
|
|
211
|
+
- `--format <text|json>`: Output format (default: text)
|
|
212
|
+
|
|
213
|
+
**Pull flags:**
|
|
214
|
+
- `-b, --branch <name>`: ByteRover branch name (default: main, not Git branch)
|
|
215
|
+
- `--headless`: Run in headless mode
|
|
216
|
+
- `--format <text|json>`: Output format (default: text)
|
|
217
|
+
|
|
218
|
+
## Headless Mode
|
|
219
|
+
|
|
220
|
+
ByteRover CLI supports headless mode for automation, CI/CD pipelines, and scripting. Headless mode disables interactive prompts and supports machine-readable JSON output.
|
|
221
|
+
|
|
222
|
+
### Supported Commands
|
|
223
|
+
|
|
224
|
+
The following commands support `--headless` mode:
|
|
225
|
+
- `brv init` (requires `--team` and `--space`)
|
|
226
|
+
- `brv status`
|
|
227
|
+
- `brv query`
|
|
228
|
+
- `brv curate`
|
|
229
|
+
- `brv push` (auto-skips confirmation)
|
|
230
|
+
- `brv pull`
|
|
231
|
+
|
|
232
|
+
### Output Formats
|
|
233
|
+
|
|
234
|
+
Use `--format` to control output:
|
|
235
|
+
- `text` (default): Human-readable text output
|
|
236
|
+
- `json`: NDJSON (newline-delimited JSON) for machine parsing
|
|
237
|
+
|
|
238
|
+
### CI/CD Examples
|
|
239
|
+
|
|
240
|
+
**Initialize a project in CI:**
|
|
241
|
+
```bash
|
|
242
|
+
brv login --api-key $BRV_API_KEY
|
|
243
|
+
brv init --headless --team "my-team" --space "my-space" --format json
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Push context tree after tests pass:**
|
|
247
|
+
```bash
|
|
248
|
+
brv push --headless --format json -y
|
|
153
249
|
```
|
|
154
250
|
|
|
155
|
-
|
|
251
|
+
**Query context in a script:**
|
|
252
|
+
```bash
|
|
253
|
+
brv query "What are the API endpoints?" --headless --format json
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### JSON Output Structure
|
|
257
|
+
|
|
258
|
+
JSON output uses NDJSON format with message types:
|
|
259
|
+
- `log`: Progress messages
|
|
260
|
+
- `output`: Main output content
|
|
261
|
+
- `error`: Error messages
|
|
262
|
+
- `warning`: Warning messages
|
|
263
|
+
- `result`: Final operation result
|
|
156
264
|
|
|
157
265
|
## What is Context Tree?
|
|
158
266
|
|
|
@@ -348,7 +456,7 @@ The model browser shows:
|
|
|
348
456
|
**Options:**
|
|
349
457
|
- `-y, --yes`: Skip confirmation prompt
|
|
350
458
|
|
|
351
|
-
**Note:** Sessions are stateful and auto-resume after restart. Use `/new` to start fresh—this clears conversation history but does NOT affect the context tree.
|
|
459
|
+
**Note:** Sessions are stateful and auto-resume after restart (retained for 30 days). Use `/new` to start fresh—this clears conversation history but does NOT affect the context tree.
|
|
352
460
|
|
|
353
461
|
### Project Setup
|
|
354
462
|
|
|
@@ -368,16 +476,29 @@ The model browser shows:
|
|
|
368
476
|
|
|
369
477
|
## Authentication
|
|
370
478
|
|
|
371
|
-
ByteRover CLI
|
|
479
|
+
ByteRover CLI supports two authentication methods to suit different workflows.
|
|
480
|
+
|
|
481
|
+
### Authentication Methods
|
|
482
|
+
|
|
483
|
+
**1. OAuth 2.0 (Interactive)**
|
|
484
|
+
- Use `/login` in the REPL
|
|
485
|
+
- Opens browser for secure OAuth flow with PKCE
|
|
486
|
+
- Best for: Local development, interactive use
|
|
487
|
+
|
|
488
|
+
**2. API Key (Non-interactive)**
|
|
489
|
+
- Use `brv login --api-key <key>`
|
|
490
|
+
- No browser required
|
|
491
|
+
- Best for: CI/CD, automation, headless environments
|
|
492
|
+
- Get your key at [app.byterover.dev/settings/keys](https://app.byterover.dev/settings/keys)
|
|
372
493
|
|
|
373
|
-
### How
|
|
494
|
+
### How OAuth Works
|
|
374
495
|
|
|
375
496
|
1. Run `/login` in the REPL to start authentication
|
|
376
497
|
2. Your browser opens to the ByteRover authorization page
|
|
377
498
|
3. After successful login, tokens are securely stored in your system keychain
|
|
378
499
|
4. All subsequent commands automatically use your stored credentials
|
|
379
500
|
|
|
380
|
-
### Security
|
|
501
|
+
### Security Features
|
|
381
502
|
|
|
382
503
|
- **PKCE flow**: Prevents authorization code interception attacks
|
|
383
504
|
- **System keychain**: Tokens stored in macOS Keychain, Windows Credential Manager, or Linux Secret Service
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when headless mode encounters a prompt that cannot be handled.
|
|
3
|
+
* Provides detailed information about what prompt was required and available choices.
|
|
4
|
+
*/
|
|
5
|
+
export declare class HeadlessPromptError extends Error {
|
|
6
|
+
readonly availableChoices?: string[];
|
|
7
|
+
readonly code = "HEADLESS_PROMPT_REQUIRED";
|
|
8
|
+
readonly promptMessage: string;
|
|
9
|
+
readonly promptType: string;
|
|
10
|
+
constructor(promptType: string, promptMessage: string, availableChoices?: string[]);
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when headless mode encounters a prompt that cannot be handled.
|
|
3
|
+
* Provides detailed information about what prompt was required and available choices.
|
|
4
|
+
*/
|
|
5
|
+
export class HeadlessPromptError extends Error {
|
|
6
|
+
availableChoices;
|
|
7
|
+
code = 'HEADLESS_PROMPT_REQUIRED';
|
|
8
|
+
promptMessage;
|
|
9
|
+
promptType;
|
|
10
|
+
constructor(promptType, promptMessage, availableChoices) {
|
|
11
|
+
const choicesInfo = availableChoices?.length ? ` Available choices: ${availableChoices.join(', ')}` : '';
|
|
12
|
+
super(`Headless mode cannot handle ${promptType} prompt: "${promptMessage}".${choicesInfo}`);
|
|
13
|
+
this.name = 'HeadlessPromptError';
|
|
14
|
+
this.promptType = promptType;
|
|
15
|
+
this.promptMessage = promptMessage;
|
|
16
|
+
this.availableChoices = availableChoices;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -3,7 +3,6 @@ import type { PresignedUrlsResponse } from '../domain/entities/presigned-urls-re
|
|
|
3
3
|
* Parameters for requesting presigned URLs.
|
|
4
4
|
*/
|
|
5
5
|
export type GetPresignedUrlsParams = {
|
|
6
|
-
accessToken: string;
|
|
7
6
|
branch: string;
|
|
8
7
|
fileNames: string[];
|
|
9
8
|
sessionKey: string;
|
|
@@ -14,7 +13,6 @@ export type GetPresignedUrlsParams = {
|
|
|
14
13
|
* Parameters for confirming upload completion.
|
|
15
14
|
*/
|
|
16
15
|
export type ConfirmUploadParams = {
|
|
17
|
-
accessToken: string;
|
|
18
16
|
requestId: string;
|
|
19
17
|
sessionKey: string;
|
|
20
18
|
spaceId: string;
|
|
@@ -6,7 +6,6 @@ import type { Space } from '../domain/entities/space.js';
|
|
|
6
6
|
export interface ISpaceService {
|
|
7
7
|
/**
|
|
8
8
|
* Fetches spaces accessible to the authenticated user within a specific team.
|
|
9
|
-
* @param accessToken The OAuth access token for authentication
|
|
10
9
|
* @param sessionKey The session key for tracking the user session
|
|
11
10
|
* @param teamId The team ID to filter spaces by
|
|
12
11
|
* @param option Optional pagination options
|
|
@@ -17,7 +16,7 @@ export interface ISpaceService {
|
|
|
17
16
|
* - spaces: Array of Space entities
|
|
18
17
|
* - total: Total number of spaces available (across all pages)
|
|
19
18
|
*/
|
|
20
|
-
getSpaces: (
|
|
19
|
+
getSpaces: (sessionKey: string, teamId: string, option?: {
|
|
21
20
|
fetchAll?: boolean;
|
|
22
21
|
limit?: number;
|
|
23
22
|
offset?: number;
|
|
@@ -6,7 +6,6 @@ import type { Team } from '../domain/entities/team.js';
|
|
|
6
6
|
export interface ITeamService {
|
|
7
7
|
/**
|
|
8
8
|
* Fetches teams where the authenticated user is a member.
|
|
9
|
-
* @param accessToken The OAuth access token for authentication
|
|
10
9
|
* @param sessionKey The session key for tracking the user session
|
|
11
10
|
* @param option Optional filtering and pagination options
|
|
12
11
|
* @param option.limit Maximum number of teams to fetch in a single request
|
|
@@ -17,7 +16,7 @@ export interface ITeamService {
|
|
|
17
16
|
* - teams: Array of Team entities
|
|
18
17
|
* - total: Total number of teams available (across all pages)
|
|
19
18
|
*/
|
|
20
|
-
getTeams: (
|
|
19
|
+
getTeams: (sessionKey: string, option?: {
|
|
21
20
|
fetchAll?: boolean;
|
|
22
21
|
isActive?: boolean;
|
|
23
22
|
limit?: number;
|
|
@@ -6,9 +6,8 @@ import type { User } from '../domain/entities/user.js';
|
|
|
6
6
|
export interface IUserService {
|
|
7
7
|
/**
|
|
8
8
|
* Fetches the current authenticated user's information.
|
|
9
|
-
* @param accessToken The OAuth access token for authentication
|
|
10
9
|
* @param sessionKey The session key for tracking the user session
|
|
11
10
|
* @returns A promise that resolves to the User entity
|
|
12
11
|
*/
|
|
13
|
-
getCurrentUser: (
|
|
12
|
+
getCurrentUser: (sessionKey: string) => Promise<User>;
|
|
14
13
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
export interface InitUseCaseRunOptions {
|
|
2
|
+
force: boolean;
|
|
3
|
+
format?: 'json' | 'text';
|
|
4
|
+
/** Space ID for headless mode (skips interactive selection) */
|
|
5
|
+
spaceId?: string;
|
|
6
|
+
/** Team ID for headless mode (skips interactive selection) */
|
|
7
|
+
teamId?: string;
|
|
8
|
+
}
|
|
1
9
|
export interface IInitUseCase {
|
|
2
|
-
run(options:
|
|
3
|
-
force: boolean;
|
|
4
|
-
}): Promise<void>;
|
|
10
|
+
run(options: InitUseCaseRunOptions): Promise<void>;
|
|
5
11
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export interface PushUseCaseRunOptions {
|
|
2
|
+
branch: string;
|
|
3
|
+
format?: 'json' | 'text';
|
|
4
|
+
skipConfirmation: boolean;
|
|
5
|
+
}
|
|
1
6
|
export interface IPushUseCase {
|
|
2
|
-
run(options:
|
|
3
|
-
branch: string;
|
|
4
|
-
skipConfirmation: boolean;
|
|
5
|
-
}): Promise<void>;
|
|
7
|
+
run(options: PushUseCaseRunOptions): Promise<void>;
|
|
6
8
|
}
|
|
@@ -39,7 +39,7 @@ export interface SessionLLMConfig {
|
|
|
39
39
|
temperature?: number;
|
|
40
40
|
verbose?: boolean;
|
|
41
41
|
}
|
|
42
|
-
export type { CipherAgentServices, SessionManagerConfig, SessionServices } from '../../../core/interfaces/cipher/cipher-services.js';
|
|
42
|
+
export type { CipherAgentServices, SessionManagerConfig, SessionServices, } from '../../../core/interfaces/cipher/cipher-services.js';
|
|
43
43
|
/**
|
|
44
44
|
* Creates shared services for CipherAgent.
|
|
45
45
|
* These services are singletons shared across all sessions.
|
|
@@ -232,7 +232,6 @@ export function createSessionServices(sessionId, sharedServices, httpConfig, llm
|
|
|
232
232
|
// Use HTTP backend service (default) with generator pattern
|
|
233
233
|
// Step 1: Create HTTP service
|
|
234
234
|
const httpService = new ByteRoverLlmHttpService({
|
|
235
|
-
accessToken: httpConfig.accessToken,
|
|
236
235
|
apiBaseUrl: httpConfig.apiBaseUrl,
|
|
237
236
|
projectId: httpConfig.projectId,
|
|
238
237
|
region: httpConfig.region,
|
|
@@ -31,7 +31,6 @@ export class ByteRoverLlmHttpService {
|
|
|
31
31
|
*/
|
|
32
32
|
constructor(config) {
|
|
33
33
|
this.config = {
|
|
34
|
-
accessToken: config.accessToken,
|
|
35
34
|
apiBaseUrl: config.apiBaseUrl,
|
|
36
35
|
projectId: config.projectId ?? 'byterover',
|
|
37
36
|
region: config.region ?? 'us-east1',
|
|
@@ -109,7 +108,7 @@ export class ByteRoverLlmHttpService {
|
|
|
109
108
|
*/
|
|
110
109
|
async callHttpGenerate(request) {
|
|
111
110
|
const url = `${this.config.apiBaseUrl}/api/llm/generate`;
|
|
112
|
-
const httpClient = new AuthenticatedHttpClient(this.config.
|
|
111
|
+
const httpClient = new AuthenticatedHttpClient(this.config.sessionKey);
|
|
113
112
|
const httpResponse = await httpClient.post(url, request, {
|
|
114
113
|
timeout: this.config.timeout,
|
|
115
114
|
});
|
|
@@ -15,7 +15,7 @@ export class HttpCogitPullService {
|
|
|
15
15
|
async pull(params) {
|
|
16
16
|
const baseUrl = `${this.config.apiBaseUrl}/organizations/${params.teamId}/projects/${params.spaceId}/git/snapshot`;
|
|
17
17
|
const url = `${baseUrl}?branch=${encodeURIComponent(params.branch)}`;
|
|
18
|
-
const httpClient = new AuthenticatedHttpClient(params.
|
|
18
|
+
const httpClient = new AuthenticatedHttpClient(params.sessionKey);
|
|
19
19
|
try {
|
|
20
20
|
const response = await httpClient.get(url, {
|
|
21
21
|
timeout: this.config.timeout,
|
|
@@ -94,7 +94,6 @@ export class HttpCogitPushService {
|
|
|
94
94
|
// Directly use axios here because of the work around to get current SHA from CoGit's error response
|
|
95
95
|
const response = await axios.post(params.url, requestBody, {
|
|
96
96
|
headers: {
|
|
97
|
-
Authorization: `Bearer ${params.accessToken}`,
|
|
98
97
|
'x-byterover-session-id': params.sessionKey,
|
|
99
98
|
},
|
|
100
99
|
timeout: this.config.timeout,
|
|
@@ -3,7 +3,6 @@ import type { HttpRequestConfig, IHttpClient } from '../../core/interfaces/i-htt
|
|
|
3
3
|
* HTTP client implementation that automatically adds authentication headers to all requests.
|
|
4
4
|
*
|
|
5
5
|
* This client wraps axios and automatically includes:
|
|
6
|
-
* - Authorization: Bearer {accessToken}
|
|
7
6
|
* - x-byterover-session-id: {sessionKey}
|
|
8
7
|
*
|
|
9
8
|
* Usage:
|
|
@@ -13,9 +12,8 @@ import type { HttpRequestConfig, IHttpClient } from '../../core/interfaces/i-htt
|
|
|
13
12
|
* ```
|
|
14
13
|
*/
|
|
15
14
|
export declare class AuthenticatedHttpClient implements IHttpClient {
|
|
16
|
-
private readonly accessToken;
|
|
17
15
|
private readonly sessionKey;
|
|
18
|
-
constructor(
|
|
16
|
+
constructor(sessionKey: string);
|
|
19
17
|
/**
|
|
20
18
|
* Performs an HTTP GET request with authentication headers.
|
|
21
19
|
* @param url The URL to request
|
|
@@ -3,7 +3,6 @@ import axios, { isAxiosError } from 'axios';
|
|
|
3
3
|
* HTTP client implementation that automatically adds authentication headers to all requests.
|
|
4
4
|
*
|
|
5
5
|
* This client wraps axios and automatically includes:
|
|
6
|
-
* - Authorization: Bearer {accessToken}
|
|
7
6
|
* - x-byterover-session-id: {sessionKey}
|
|
8
7
|
*
|
|
9
8
|
* Usage:
|
|
@@ -13,10 +12,8 @@ import axios, { isAxiosError } from 'axios';
|
|
|
13
12
|
* ```
|
|
14
13
|
*/
|
|
15
14
|
export class AuthenticatedHttpClient {
|
|
16
|
-
accessToken;
|
|
17
15
|
sessionKey;
|
|
18
|
-
constructor(
|
|
19
|
-
this.accessToken = accessToken;
|
|
16
|
+
constructor(sessionKey) {
|
|
20
17
|
this.sessionKey = sessionKey;
|
|
21
18
|
}
|
|
22
19
|
/**
|
|
@@ -66,7 +63,6 @@ export class AuthenticatedHttpClient {
|
|
|
66
63
|
*/
|
|
67
64
|
buildHeaders(customHeaders) {
|
|
68
65
|
return {
|
|
69
|
-
Authorization: `Bearer ${this.accessToken}`,
|
|
70
66
|
'x-byterover-session-id': this.sessionKey,
|
|
71
67
|
...customHeaders,
|
|
72
68
|
};
|
|
@@ -16,7 +16,7 @@ export class HttpMemoryRetrievalService {
|
|
|
16
16
|
}
|
|
17
17
|
async retrieve(params) {
|
|
18
18
|
try {
|
|
19
|
-
const httpClient = new AuthenticatedHttpClient(params.
|
|
19
|
+
const httpClient = new AuthenticatedHttpClient(params.sessionKey);
|
|
20
20
|
// Build query parameters
|
|
21
21
|
const queryParams = this.buildQueryParams(params);
|
|
22
22
|
const response = await httpClient.get(`${this.config.apiBaseUrl}/retrieve?${queryParams}`, {
|
|
@@ -18,7 +18,7 @@ export class HttpMemoryStorageService {
|
|
|
18
18
|
}
|
|
19
19
|
async confirmUpload(params) {
|
|
20
20
|
try {
|
|
21
|
-
const httpClient = new AuthenticatedHttpClient(params.
|
|
21
|
+
const httpClient = new AuthenticatedHttpClient(params.sessionKey);
|
|
22
22
|
const url = `${this.config.apiBaseUrl}/organizations/${params.teamId}/projects/${params.spaceId}/memory-processing/confirm-upload`;
|
|
23
23
|
const requestBody = {
|
|
24
24
|
request_id: params.requestId,
|
|
@@ -33,7 +33,7 @@ export class HttpMemoryStorageService {
|
|
|
33
33
|
}
|
|
34
34
|
async getPresignedUrls(params) {
|
|
35
35
|
try {
|
|
36
|
-
const httpClient = new AuthenticatedHttpClient(params.
|
|
36
|
+
const httpClient = new AuthenticatedHttpClient(params.sessionKey);
|
|
37
37
|
const url = `${this.config.apiBaseUrl}/organizations/${params.teamId}/projects/${params.spaceId}/memory-processing/presigned-urls`;
|
|
38
38
|
const requestBody = {
|
|
39
39
|
branch: params.branch,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InlineAgent - Ephemeral in-process CipherAgent for headless commands.
|
|
3
|
+
*
|
|
4
|
+
* Used by `brv curate --headless` and `brv query --headless` to execute tasks
|
|
5
|
+
* without requiring a running REPL instance or Transport/Socket.IO infrastructure.
|
|
6
|
+
*
|
|
7
|
+
* Exposes a `transportClient` property (ITransportClient) so use cases can use it
|
|
8
|
+
* as a drop-in replacement for SocketIOTransportClient.
|
|
9
|
+
*
|
|
10
|
+
* Lifecycle:
|
|
11
|
+
* 1. InlineAgent.create() — loads auth, config, starts CipherAgent
|
|
12
|
+
* 2. Use case gets inlineAgent.transportClient and calls on()/request() as normal
|
|
13
|
+
* 3. transportClient.disconnect() — stops CipherAgent and cleans up
|
|
14
|
+
*/
|
|
15
|
+
import type { ITransportClient } from '../../core/interfaces/transport/i-transport-client.js';
|
|
16
|
+
/**
|
|
17
|
+
* Ephemeral in-process CipherAgent for headless CLI commands.
|
|
18
|
+
*
|
|
19
|
+
* Creates and owns a CipherAgent, and exposes an ITransportClient that
|
|
20
|
+
* use cases interact with exactly like a SocketIOTransportClient.
|
|
21
|
+
*/
|
|
22
|
+
export declare class InlineAgent {
|
|
23
|
+
readonly transportClient: ITransportClient;
|
|
24
|
+
private constructor();
|
|
25
|
+
/**
|
|
26
|
+
* Async factory — loads auth/config, creates and starts CipherAgent.
|
|
27
|
+
*
|
|
28
|
+
* @throws NotAuthenticatedError if no auth token or token is expired
|
|
29
|
+
* @throws Error if no project config (.brv/config.json) exists
|
|
30
|
+
*/
|
|
31
|
+
static create(): Promise<InlineAgent>;
|
|
32
|
+
}
|