byterover-cli 2.5.2 → 2.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/.env.production +7 -0
- package/LICENSE +44 -0
- package/bin/dev.js +8 -1
- package/bin/run.js +8 -1
- package/dist/server/config/environment.d.ts +0 -19
- package/dist/server/config/environment.js +29 -38
- package/dist/server/constants.d.ts +0 -9
- package/dist/server/constants.js +0 -12
- package/dist/server/core/domain/errors/auth-error.d.ts +0 -6
- package/dist/server/core/domain/errors/auth-error.js +0 -12
- package/dist/server/core/domain/errors/task-error.d.ts +0 -3
- package/dist/server/core/domain/errors/task-error.js +0 -8
- package/dist/server/core/domain/errors/transport-error.d.ts +0 -31
- package/dist/server/core/domain/errors/transport-error.js +0 -50
- package/dist/server/infra/connectors/rules/rules-connector-config.d.ts +0 -4
- package/dist/server/infra/http/models-dev-client.d.ts +0 -4
- package/dist/server/infra/http/models-dev-client.js +0 -6
- package/dist/server/infra/http/openrouter-api-client.d.ts +0 -8
- package/dist/server/infra/http/openrouter-api-client.js +0 -13
- package/dist/server/infra/http/provider-model-fetcher-registry.d.ts +0 -5
- package/dist/server/infra/http/provider-model-fetcher-registry.js +0 -7
- package/dist/server/infra/provider/env-provider-detector.d.ts +0 -20
- package/dist/server/infra/provider/env-provider-detector.js +0 -27
- package/dist/server/infra/storage/file-provider-config-store.d.ts +0 -4
- package/dist/server/infra/storage/file-provider-config-store.js +0 -6
- package/dist/server/utils/file-content-reader.d.ts +2 -1
- package/dist/server/utils/file-helpers.d.ts +0 -24
- package/dist/server/utils/file-helpers.js +0 -81
- package/dist/server/utils/process-logger.d.ts +0 -13
- package/dist/server/utils/process-logger.js +1 -78
- package/node_modules/@campfirein/brv-transport-client/LICENSE +95 -0
- package/node_modules/@campfirein/brv-transport-client/README.md +3 -4
- package/node_modules/@campfirein/brv-transport-client/package.json +2 -2
- package/oclif.manifest.json +132 -132
- package/package.json +5 -3
- package/dist/server/core/domain/entities/bullet.d.ts +0 -51
- package/dist/server/core/domain/entities/bullet.js +0 -94
- package/dist/server/core/domain/entities/memory.d.ts +0 -55
- package/dist/server/core/domain/entities/memory.js +0 -90
- package/dist/server/core/domain/entities/playbook.d.ts +0 -80
- package/dist/server/core/domain/entities/playbook.js +0 -214
- package/dist/server/core/domain/entities/presigned-url.d.ts +0 -9
- package/dist/server/core/domain/entities/presigned-url.js +0 -18
- package/dist/server/core/domain/entities/presigned-urls-response.d.ts +0 -10
- package/dist/server/core/domain/entities/presigned-urls-response.js +0 -18
- package/dist/server/core/domain/entities/retrieve-result.d.ts +0 -35
- package/dist/server/core/domain/entities/retrieve-result.js +0 -35
- package/dist/server/core/domain/errors/headless-prompt-error.d.ts +0 -11
- package/dist/server/core/domain/errors/headless-prompt-error.js +0 -18
- package/dist/server/core/interfaces/services/i-legacy-rule-detector.d.ts +0 -56
- package/dist/server/core/interfaces/services/i-legacy-rule-detector.js +0 -1
- package/dist/server/core/interfaces/services/i-memory-retrieval-service.d.ts +0 -39
- package/dist/server/core/interfaces/services/i-memory-retrieval-service.js +0 -1
- package/dist/server/core/interfaces/services/i-memory-storage-service.d.ts +0 -53
- package/dist/server/core/interfaces/services/i-memory-storage-service.js +0 -1
- package/dist/server/core/interfaces/services/i-terminal.d.ts +0 -146
- package/dist/server/core/interfaces/services/i-terminal.js +0 -1
- package/dist/server/core/interfaces/services/i-workspace-detector-service.d.ts +0 -8
- package/dist/server/core/interfaces/services/i-workspace-detector-service.js +0 -1
- package/dist/server/core/interfaces/storage/i-onboarding-preference-store.d.ts +0 -20
- package/dist/server/core/interfaces/storage/i-onboarding-preference-store.js +0 -1
- package/dist/server/infra/connectors/rules/legacy-rule-detector.d.ts +0 -21
- package/dist/server/infra/connectors/rules/legacy-rule-detector.js +0 -106
- package/dist/server/infra/memory/http-memory-retrieval-service.d.ts +0 -18
- package/dist/server/infra/memory/http-memory-retrieval-service.js +0 -64
- package/dist/server/infra/memory/http-memory-storage-service.d.ts +0 -18
- package/dist/server/infra/memory/http-memory-storage-service.js +0 -72
- package/dist/server/infra/memory/memory-to-playbook-mapper.d.ts +0 -33
- package/dist/server/infra/memory/memory-to-playbook-mapper.js +0 -51
- package/dist/server/infra/storage/file-onboarding-preference-store.d.ts +0 -10
- package/dist/server/infra/storage/file-onboarding-preference-store.js +0 -45
- package/dist/server/infra/terminal/headless-terminal.d.ts +0 -91
- package/dist/server/infra/terminal/headless-terminal.js +0 -211
- package/dist/server/infra/workspace/workspace-detector-service.d.ts +0 -57
- package/dist/server/infra/workspace/workspace-detector-service.js +0 -165
- package/dist/server/utils/crash-log.d.ts +0 -14
- package/dist/server/utils/crash-log.js +0 -19
- package/dist/server/utils/emoji-helpers.d.ts +0 -38
- package/dist/server/utils/emoji-helpers.js +0 -42
- package/dist/server/utils/error-handler.d.ts +0 -51
- package/dist/server/utils/error-handler.js +0 -169
- package/dist/server/utils/oclif-error-helpers.d.ts +0 -40
- package/dist/server/utils/oclif-error-helpers.js +0 -46
- package/dist/server/utils/tool-display-formatter.d.ts +0 -53
- package/dist/server/utils/tool-display-formatter.js +0 -257
package/.env.production
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
BRV_API_BASE_URL=https://iam.byterover.dev/api/v1
|
|
2
|
+
BRV_AUTHORIZATION_URL=https://iam.byterover.dev/api/v1/oidc/authorize
|
|
3
|
+
BRV_COGIT_API_BASE_URL=https://v3-cgit.byterover.dev/api/v1
|
|
4
|
+
BRV_ISSUER_URL=https://iam.byterover.dev/api/v1/oidc
|
|
5
|
+
BRV_LLM_API_BASE_URL=https://llm.byterover.dev
|
|
6
|
+
BRV_TOKEN_URL=https://iam.byterover.dev/api/v1/oidc/token
|
|
7
|
+
BRV_WEB_APP_URL=https://app.byterover.dev
|
package/LICENSE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Elastic License 2.0 (ELv2)
|
|
2
|
+
|
|
3
|
+
Acceptance
|
|
4
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
5
|
+
|
|
6
|
+
Copyright License
|
|
7
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below.
|
|
8
|
+
|
|
9
|
+
Limitations
|
|
10
|
+
You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
|
|
11
|
+
|
|
12
|
+
You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
|
|
13
|
+
|
|
14
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor's trademarks is subject to applicable law.
|
|
15
|
+
|
|
16
|
+
Patents
|
|
17
|
+
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
18
|
+
|
|
19
|
+
Notices
|
|
20
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
21
|
+
|
|
22
|
+
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
23
|
+
|
|
24
|
+
No Other Rights
|
|
25
|
+
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
26
|
+
|
|
27
|
+
Termination
|
|
28
|
+
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
29
|
+
|
|
30
|
+
No Liability
|
|
31
|
+
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
|
|
32
|
+
|
|
33
|
+
Definitions
|
|
34
|
+
The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
|
|
35
|
+
|
|
36
|
+
_you_ refers to the individual or entity agreeing to these terms.
|
|
37
|
+
|
|
38
|
+
_your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
39
|
+
|
|
40
|
+
_your licenses_ are all the licenses granted to you for the software under these terms.
|
|
41
|
+
|
|
42
|
+
_use_ means anything you do with the software requiring one of your licenses.
|
|
43
|
+
|
|
44
|
+
_trademark_ means trademarks, service marks, and similar rights.
|
package/bin/dev.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --import tsx --no-warnings
|
|
2
2
|
|
|
3
|
+
import {execute} from '@oclif/core'
|
|
4
|
+
import {config as loadEnv} from 'dotenv'
|
|
5
|
+
import {resolve} from 'node:path'
|
|
6
|
+
|
|
3
7
|
process.env.BRV_ENV = 'development'
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
10
|
+
const root = resolve(import.meta.dirname, '..')
|
|
11
|
+
loadEnv({path: resolve(root, '.env.development')})
|
|
12
|
+
|
|
6
13
|
|
|
7
14
|
// Inject default command 'main' (represents logic of a single 'brv' run) when no args provided
|
|
8
15
|
// process.argv = ['node', 'bin/dev.js', ...userArgs]
|
package/bin/run.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import {execute} from '@oclif/core'
|
|
4
|
+
import {config as loadEnv} from 'dotenv'
|
|
5
|
+
import {resolve} from 'node:path'
|
|
6
|
+
|
|
3
7
|
process.env.BRV_ENV = 'production'
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
10
|
+
const root = resolve(import.meta.dirname, '..')
|
|
11
|
+
loadEnv({path: resolve(root, '.env.production'), quiet: true})
|
|
12
|
+
|
|
6
13
|
|
|
7
14
|
// Inject default command 'main' (represents logic of a single 'brv' run) when no args provided
|
|
8
15
|
// process.argv = ['node', 'brv', ...userArgs]
|
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Environment types supported by the CLI.
|
|
3
3
|
*/
|
|
4
4
|
type Environment = 'development' | 'production';
|
|
5
|
-
/**
|
|
6
|
-
* Current environment - set at runtime by the launcher scripts.
|
|
7
|
-
* - `./bin/dev.js` sets BRV_ENV=development
|
|
8
|
-
* - `./bin/run.js` sets BRV_ENV=production
|
|
9
|
-
*/
|
|
10
5
|
export declare const ENVIRONMENT: Environment;
|
|
11
6
|
/**
|
|
12
7
|
* Environment-specific configuration.
|
|
@@ -19,24 +14,10 @@ type EnvironmentConfig = {
|
|
|
19
14
|
hubRegistryUrl: string;
|
|
20
15
|
issuerUrl: string;
|
|
21
16
|
llmApiBaseUrl: string;
|
|
22
|
-
memoraApiBaseUrl: string;
|
|
23
17
|
scopes: string[];
|
|
24
18
|
tokenUrl: string;
|
|
25
19
|
webAppUrl: string;
|
|
26
20
|
};
|
|
27
|
-
/**
|
|
28
|
-
* Configuration for each environment.
|
|
29
|
-
* These values are bundled at build time.
|
|
30
|
-
*/
|
|
31
|
-
export declare const ENV_CONFIG: Record<Environment, EnvironmentConfig>;
|
|
32
|
-
/**
|
|
33
|
-
* Get the configuration for the current environment.
|
|
34
|
-
* @returns The environment configuration.
|
|
35
|
-
*/
|
|
36
21
|
export declare const getCurrentConfig: () => EnvironmentConfig;
|
|
37
|
-
/**
|
|
38
|
-
* Check if the current environment is development.
|
|
39
|
-
* @returns True if in development mode, false otherwise.
|
|
40
|
-
*/
|
|
41
22
|
export declare const isDevelopment: () => boolean;
|
|
42
23
|
export {};
|
|
@@ -1,48 +1,39 @@
|
|
|
1
|
+
const isEnvironment = (value) => value === 'development' || value === 'production';
|
|
1
2
|
/**
|
|
2
3
|
* Current environment - set at runtime by the launcher scripts.
|
|
3
4
|
* - `./bin/dev.js` sets BRV_ENV=development
|
|
4
5
|
* - `./bin/run.js` sets BRV_ENV=production
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
+
const envValue = process.env.BRV_ENV;
|
|
8
|
+
export const ENVIRONMENT = isEnvironment(envValue) ? envValue : 'development';
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
9
|
-
* These values are bundled at build time.
|
|
10
|
+
* Non-infrastructure config that stays in source (same across envs or not sensitive).
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
hubRegistryUrl: 'https://hub.byterover.dev/r/registry.json',
|
|
18
|
-
issuerUrl: 'https://dev-beta-iam.byterover.dev/api/v1/oidc',
|
|
19
|
-
llmApiBaseUrl: 'https://dev-beta-llm.byterover.dev',
|
|
20
|
-
memoraApiBaseUrl: 'https://dev-beta-memora-retrieve.byterover.dev/api/v3',
|
|
21
|
-
scopes: ['read', 'write', 'debug'],
|
|
22
|
-
tokenUrl: 'https://dev-beta-iam.byterover.dev/api/v1/oidc/token',
|
|
23
|
-
webAppUrl: 'https://dev-beta-app.byterover.dev',
|
|
24
|
-
},
|
|
25
|
-
production: {
|
|
26
|
-
apiBaseUrl: 'https://iam.byterover.dev/api/v1',
|
|
27
|
-
authorizationUrl: 'https://iam.byterover.dev/api/v1/oidc/authorize',
|
|
28
|
-
clientId: 'byterover-cli-client',
|
|
29
|
-
cogitApiBaseUrl: 'https://v3-cgit.byterover.dev/api/v1',
|
|
30
|
-
hubRegistryUrl: 'https://hub.byterover.dev/r/registry.json',
|
|
31
|
-
issuerUrl: 'https://iam.byterover.dev/api/v1/oidc',
|
|
32
|
-
llmApiBaseUrl: 'https://llm.byterover.dev',
|
|
33
|
-
memoraApiBaseUrl: 'https://beta-memora-retrieve.byterover.dev/api/v3',
|
|
34
|
-
scopes: ['read', 'write'],
|
|
35
|
-
tokenUrl: 'https://iam.byterover.dev/api/v1/oidc/token',
|
|
36
|
-
webAppUrl: 'https://app.byterover.dev',
|
|
12
|
+
const DEFAULTS = {
|
|
13
|
+
clientId: 'byterover-cli-client',
|
|
14
|
+
hubRegistryUrl: 'https://hub.byterover.dev/r/registry.json',
|
|
15
|
+
scopes: {
|
|
16
|
+
development: ['read', 'write', 'debug'],
|
|
17
|
+
production: ['read', 'write'],
|
|
37
18
|
},
|
|
38
19
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
20
|
+
const readRequiredEnv = (name) => {
|
|
21
|
+
const value = process.env[name];
|
|
22
|
+
if (!value) {
|
|
23
|
+
throw new Error(`Missing required environment variable: ${name}. Ensure .env files are loaded via dotenv.`);
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
};
|
|
27
|
+
export const getCurrentConfig = () => ({
|
|
28
|
+
apiBaseUrl: readRequiredEnv('BRV_API_BASE_URL'),
|
|
29
|
+
authorizationUrl: readRequiredEnv('BRV_AUTHORIZATION_URL'),
|
|
30
|
+
clientId: DEFAULTS.clientId,
|
|
31
|
+
cogitApiBaseUrl: readRequiredEnv('BRV_COGIT_API_BASE_URL'),
|
|
32
|
+
hubRegistryUrl: DEFAULTS.hubRegistryUrl,
|
|
33
|
+
issuerUrl: readRequiredEnv('BRV_ISSUER_URL'),
|
|
34
|
+
llmApiBaseUrl: readRequiredEnv('BRV_LLM_API_BASE_URL'),
|
|
35
|
+
scopes: [...DEFAULTS.scopes[ENVIRONMENT]],
|
|
36
|
+
tokenUrl: readRequiredEnv('BRV_TOKEN_URL'),
|
|
37
|
+
webAppUrl: readRequiredEnv('BRV_WEB_APP_URL'),
|
|
38
|
+
});
|
|
48
39
|
export const isDevelopment = () => ENVIRONMENT === 'development';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
export declare const BRV_DIR = ".brv";
|
|
2
|
-
export declare const BLOBS_DIR = "blobs";
|
|
3
2
|
export declare const PROJECT_CONFIG_FILE = "config.json";
|
|
4
3
|
export declare const BRV_CONFIG_VERSION = "0.0.1";
|
|
5
4
|
export declare const GLOBAL_CONFIG_DIR = "brv";
|
|
6
5
|
export declare const GLOBAL_CONFIG_FILE = "config.json";
|
|
7
6
|
export declare const GLOBAL_CONFIG_VERSION = "0.0.1";
|
|
8
7
|
export declare const GLOBAL_DATA_DIR = "brv";
|
|
9
|
-
export declare const ACE_DIR = "ace";
|
|
10
8
|
export declare const PROJECT = "byterover";
|
|
11
9
|
export declare const CONTEXT_TREE_DIR = "context-tree";
|
|
12
10
|
export declare const CONTEXT_TREE_BACKUP_DIR = "context-tree-backup";
|
|
@@ -21,16 +19,9 @@ export declare const SNAPSHOT_FILE = ".snapshot.json";
|
|
|
21
19
|
*/
|
|
22
20
|
export declare const DEFAULT_BRANCH = "main";
|
|
23
21
|
export declare const TRANSPORT_HOST = "127.0.0.1";
|
|
24
|
-
export declare const TRANSPORT_REQUEST_TIMEOUT_MS = 10000;
|
|
25
22
|
export declare const TRANSPORT_SPACE_SWITCH_TIMEOUT_MS = 60000;
|
|
26
|
-
export declare const TRANSPORT_ROOM_TIMEOUT_MS = 2000;
|
|
27
|
-
export declare const TRANSPORT_CONNECT_TIMEOUT_MS = 3000;
|
|
28
|
-
export declare const TRANSPORT_RECONNECTION_DELAY_MS = 50;
|
|
29
|
-
export declare const TRANSPORT_RECONNECTION_DELAY_MAX_MS = 1000;
|
|
30
|
-
export declare const TRANSPORT_RECONNECTION_ATTEMPTS = 30;
|
|
31
23
|
export declare const TRANSPORT_PING_INTERVAL_MS = 5000;
|
|
32
24
|
export declare const TRANSPORT_PING_TIMEOUT_MS = 10000;
|
|
33
|
-
export declare const TRANSPORT_DEFAULT_TRANSPORTS: ('polling' | 'websocket')[];
|
|
34
25
|
export declare const DEFAULT_LLM_MODEL = "gemini-3-flash-preview";
|
|
35
26
|
export declare const PROJECT_ROOM_PREFIX = "project:";
|
|
36
27
|
export declare const PROJECT_ROOM_SUFFIX = ":broadcast";
|
package/dist/server/constants.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const BRV_DIR = '.brv';
|
|
2
|
-
export const BLOBS_DIR = 'blobs';
|
|
3
2
|
export const PROJECT_CONFIG_FILE = 'config.json';
|
|
4
3
|
export const BRV_CONFIG_VERSION = '0.0.1';
|
|
5
4
|
// Global config constants (user-level, stored in XDG config directory)
|
|
@@ -9,8 +8,6 @@ export const GLOBAL_CONFIG_VERSION = '0.0.1';
|
|
|
9
8
|
// Global data directory name (for XDG_DATA_HOME - secrets, credentials, cache)
|
|
10
9
|
// Same value as GLOBAL_CONFIG_DIR but different semantic purpose
|
|
11
10
|
export const GLOBAL_DATA_DIR = 'brv';
|
|
12
|
-
// ACE directory structure constants
|
|
13
|
-
export const ACE_DIR = 'ace';
|
|
14
11
|
export const PROJECT = 'byterover';
|
|
15
12
|
// Context Tree directory structure constants
|
|
16
13
|
export const CONTEXT_TREE_DIR = 'context-tree';
|
|
@@ -27,18 +24,9 @@ export const SNAPSHOT_FILE = '.snapshot.json';
|
|
|
27
24
|
export const DEFAULT_BRANCH = 'main';
|
|
28
25
|
// Transport layer constants (optimized for localhost real-time)
|
|
29
26
|
export const TRANSPORT_HOST = '127.0.0.1'; // Use IP address for better sandbox compatibility
|
|
30
|
-
export const TRANSPORT_REQUEST_TIMEOUT_MS = 10_000; // 10s - most operations complete quickly
|
|
31
27
|
export const TRANSPORT_SPACE_SWITCH_TIMEOUT_MS = 60_000; // 60s - includes cogit pull + merge
|
|
32
|
-
export const TRANSPORT_ROOM_TIMEOUT_MS = 2000; // 2s - room ops are instant on localhost
|
|
33
|
-
export const TRANSPORT_CONNECT_TIMEOUT_MS = 3000; // 3s - 127.0.0.1 connects in <10ms
|
|
34
|
-
export const TRANSPORT_RECONNECTION_DELAY_MS = 50; // 50ms - ultra aggressive start
|
|
35
|
-
export const TRANSPORT_RECONNECTION_DELAY_MAX_MS = 1000; // 1s cap - fail fast, retry fast
|
|
36
|
-
export const TRANSPORT_RECONNECTION_ATTEMPTS = 30; // More attempts with faster retry
|
|
37
28
|
export const TRANSPORT_PING_INTERVAL_MS = 5000; // 5s ping - reasonable for local communication
|
|
38
29
|
export const TRANSPORT_PING_TIMEOUT_MS = 10_000; // 10s timeout - avoid false disconnects during GC/load
|
|
39
|
-
// WebSocket-only transport to avoid HTTP polling issues in sandboxed environments (Cursor, etc.)
|
|
40
|
-
// HTTP polling may be blocked by IDE sandboxes causing "xhr poll error"
|
|
41
|
-
export const TRANSPORT_DEFAULT_TRANSPORTS = ['websocket'];
|
|
42
30
|
// LLM Model defaults
|
|
43
31
|
export const DEFAULT_LLM_MODEL = 'gemini-3-flash-preview';
|
|
44
32
|
// Project room naming convention
|
|
@@ -2,9 +2,3 @@ export declare class AuthenticationError extends Error {
|
|
|
2
2
|
readonly code?: string;
|
|
3
3
|
constructor(message: string, code?: string);
|
|
4
4
|
}
|
|
5
|
-
export declare class TokenExpiredError extends Error {
|
|
6
|
-
constructor(message?: string);
|
|
7
|
-
}
|
|
8
|
-
export declare class InvalidTokenError extends Error {
|
|
9
|
-
constructor(message?: string);
|
|
10
|
-
}
|
|
@@ -6,15 +6,3 @@ export class AuthenticationError extends Error {
|
|
|
6
6
|
this.code = code;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
export class TokenExpiredError extends Error {
|
|
10
|
-
constructor(message = 'Token has expired') {
|
|
11
|
-
super(message);
|
|
12
|
-
this.name = 'TokenExpiredError';
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export class InvalidTokenError extends Error {
|
|
16
|
-
constructor(message = 'Token is invalid') {
|
|
17
|
-
super(message);
|
|
18
|
-
this.name = 'InvalidTokenError';
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -57,9 +57,6 @@ export declare class AgentNotAvailableError extends TaskError {
|
|
|
57
57
|
export declare class AgentDisconnectedError extends TaskError {
|
|
58
58
|
constructor();
|
|
59
59
|
}
|
|
60
|
-
export declare class AgentNotInitializedError extends TaskError {
|
|
61
|
-
constructor(reason?: string);
|
|
62
|
-
}
|
|
63
60
|
export declare class NotAuthenticatedError extends TaskError {
|
|
64
61
|
constructor();
|
|
65
62
|
}
|
|
@@ -121,14 +121,6 @@ export class AgentDisconnectedError extends TaskError {
|
|
|
121
121
|
this.name = 'AgentDisconnectedError';
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
export class AgentNotInitializedError extends TaskError {
|
|
125
|
-
constructor(reason) {
|
|
126
|
-
super(reason
|
|
127
|
-
? `Agent failed to initialize: ${reason}`
|
|
128
|
-
: "Agent failed to initialize. Run 'brv restart' to force a clean restart.", TaskErrorCode.AGENT_NOT_INITIALIZED);
|
|
129
|
-
this.name = 'AgentNotInitializedError';
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
124
|
export class NotAuthenticatedError extends TaskError {
|
|
133
125
|
constructor() {
|
|
134
126
|
super('Not authenticated. Cloud sync features (push/pull/space) require login — local query and curate work without authentication.', TaskErrorCode.NOT_AUTHENTICATED);
|
|
@@ -4,20 +4,6 @@
|
|
|
4
4
|
export declare class TransportError extends Error {
|
|
5
5
|
constructor(message: string);
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Error thrown when connection to server fails.
|
|
9
|
-
*/
|
|
10
|
-
export declare class TransportConnectionError extends TransportError {
|
|
11
|
-
readonly originalError?: Error;
|
|
12
|
-
readonly url: string;
|
|
13
|
-
constructor(url: string, originalError?: Error);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Error thrown when client is not connected to server.
|
|
17
|
-
*/
|
|
18
|
-
export declare class TransportNotConnectedError extends TransportError {
|
|
19
|
-
constructor(operation?: string);
|
|
20
|
-
}
|
|
21
7
|
/**
|
|
22
8
|
* Error thrown when server is not started.
|
|
23
9
|
*/
|
|
@@ -53,20 +39,3 @@ export declare class TransportRequestError extends TransportError {
|
|
|
53
39
|
readonly event: string;
|
|
54
40
|
constructor(event: string, message?: string);
|
|
55
41
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Error thrown when room operations fail.
|
|
58
|
-
*/
|
|
59
|
-
export declare class TransportRoomError extends TransportError {
|
|
60
|
-
readonly operation: 'join' | 'leave';
|
|
61
|
-
readonly room: string;
|
|
62
|
-
constructor(room: string, operation: 'join' | 'leave');
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Error thrown when room operation times out.
|
|
66
|
-
*/
|
|
67
|
-
export declare class TransportRoomTimeoutError extends TransportError {
|
|
68
|
-
readonly operation: 'join' | 'leave';
|
|
69
|
-
readonly room: string;
|
|
70
|
-
readonly timeoutMs: number;
|
|
71
|
-
constructor(room: string, operation: 'join' | 'leave', timeoutMs: number);
|
|
72
|
-
}
|
|
@@ -7,28 +7,6 @@ export class TransportError extends Error {
|
|
|
7
7
|
this.name = 'TransportError';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Error thrown when connection to server fails.
|
|
12
|
-
*/
|
|
13
|
-
export class TransportConnectionError extends TransportError {
|
|
14
|
-
originalError;
|
|
15
|
-
url;
|
|
16
|
-
constructor(url, originalError) {
|
|
17
|
-
super(`Connection failed to ${url}${originalError ? `: ${originalError.message}` : ''}`);
|
|
18
|
-
this.name = 'TransportConnectionError';
|
|
19
|
-
this.url = url;
|
|
20
|
-
this.originalError = originalError;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Error thrown when client is not connected to server.
|
|
25
|
-
*/
|
|
26
|
-
export class TransportNotConnectedError extends TransportError {
|
|
27
|
-
constructor(operation = 'operation') {
|
|
28
|
-
super(`Not connected to server. Cannot perform: ${operation}`);
|
|
29
|
-
this.name = 'TransportNotConnectedError';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
10
|
/**
|
|
33
11
|
* Error thrown when server is not started.
|
|
34
12
|
*/
|
|
@@ -84,31 +62,3 @@ export class TransportRequestError extends TransportError {
|
|
|
84
62
|
this.event = event;
|
|
85
63
|
}
|
|
86
64
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Error thrown when room operations fail.
|
|
89
|
-
*/
|
|
90
|
-
export class TransportRoomError extends TransportError {
|
|
91
|
-
operation;
|
|
92
|
-
room;
|
|
93
|
-
constructor(room, operation) {
|
|
94
|
-
super(`Failed to ${operation} room '${room}'`);
|
|
95
|
-
this.name = 'TransportRoomError';
|
|
96
|
-
this.room = room;
|
|
97
|
-
this.operation = operation;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Error thrown when room operation times out.
|
|
102
|
-
*/
|
|
103
|
-
export class TransportRoomTimeoutError extends TransportError {
|
|
104
|
-
operation;
|
|
105
|
-
room;
|
|
106
|
-
timeoutMs;
|
|
107
|
-
constructor(room, operation, timeoutMs) {
|
|
108
|
-
super(`${operation === 'join' ? 'Join' : 'Leave'} room '${room}' timed out after ${timeoutMs}ms`);
|
|
109
|
-
this.name = 'TransportRoomTimeoutError';
|
|
110
|
-
this.room = room;
|
|
111
|
-
this.operation = operation;
|
|
112
|
-
this.timeoutMs = timeoutMs;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Uses the OpenRouter REST API: https://openrouter.ai/api/v1
|
|
9
9
|
*/
|
|
10
|
-
import type { ProviderDefinition } from '../../core/domain/entities/provider-registry.js';
|
|
11
10
|
/**
|
|
12
11
|
* OpenRouter model from the /models endpoint.
|
|
13
12
|
* Based on: https://openrouter.ai/docs#models
|
|
@@ -135,13 +134,6 @@ export declare class OpenRouterApiClient {
|
|
|
135
134
|
*/
|
|
136
135
|
private normalizeModel;
|
|
137
136
|
}
|
|
138
|
-
/**
|
|
139
|
-
* Creates an OpenRouterApiClient configured from a provider definition.
|
|
140
|
-
*
|
|
141
|
-
* @param provider - Provider definition from the registry
|
|
142
|
-
* @returns Configured OpenRouterApiClient
|
|
143
|
-
*/
|
|
144
|
-
export declare function createOpenRouterApiClient(provider: ProviderDefinition): OpenRouterApiClient;
|
|
145
137
|
/**
|
|
146
138
|
* Gets or creates the singleton OpenRouter API client.
|
|
147
139
|
*/
|
|
@@ -137,19 +137,6 @@ export class OpenRouterApiClient {
|
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
/**
|
|
141
|
-
* Creates an OpenRouterApiClient configured from a provider definition.
|
|
142
|
-
*
|
|
143
|
-
* @param provider - Provider definition from the registry
|
|
144
|
-
* @returns Configured OpenRouterApiClient
|
|
145
|
-
*/
|
|
146
|
-
export function createOpenRouterApiClient(provider) {
|
|
147
|
-
return new OpenRouterApiClient({
|
|
148
|
-
baseUrl: provider.baseUrl || DEFAULT_BASE_URL,
|
|
149
|
-
httpReferer: provider.headers['HTTP-Referer'],
|
|
150
|
-
xTitle: provider.headers['X-Title'],
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
140
|
/**
|
|
154
141
|
* Singleton instance of the OpenRouter API client.
|
|
155
142
|
*/
|
|
@@ -12,11 +12,6 @@ import type { IProviderModelFetcher } from '../../core/interfaces/i-provider-mod
|
|
|
12
12
|
* @returns IProviderModelFetcher instance, or undefined if provider doesn't support model fetching
|
|
13
13
|
*/
|
|
14
14
|
export declare function getModelFetcher(providerId: string): Promise<IProviderModelFetcher | undefined>;
|
|
15
|
-
/**
|
|
16
|
-
* Clear all cached fetcher instances.
|
|
17
|
-
* Useful for testing or when provider configs change.
|
|
18
|
-
*/
|
|
19
|
-
export declare function clearModelFetcherCache(): void;
|
|
20
15
|
/**
|
|
21
16
|
* Validate an API key for a specific provider.
|
|
22
17
|
* Convenience function that gets the right fetcher and validates.
|
|
@@ -93,13 +93,6 @@ export async function getModelFetcher(providerId) {
|
|
|
93
93
|
}
|
|
94
94
|
return fetcher;
|
|
95
95
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Clear all cached fetcher instances.
|
|
98
|
-
* Useful for testing or when provider configs change.
|
|
99
|
-
*/
|
|
100
|
-
export function clearModelFetcherCache() {
|
|
101
|
-
fetchers.clear();
|
|
102
|
-
}
|
|
103
96
|
/**
|
|
104
97
|
* Validate an API key for a specific provider.
|
|
105
98
|
* Convenience function that gets the right fetcher and validates.
|
|
@@ -4,26 +4,6 @@
|
|
|
4
4
|
* Detects LLM providers from environment variables.
|
|
5
5
|
* Used to auto-connect providers when API keys are found in the environment.
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
8
|
-
* A detected provider from the environment.
|
|
9
|
-
*/
|
|
10
|
-
export interface DetectedProvider {
|
|
11
|
-
/** The API key value from the environment */
|
|
12
|
-
apiKey: string;
|
|
13
|
-
/** The environment variable name that was found */
|
|
14
|
-
envVar: string;
|
|
15
|
-
/** The provider ID (e.g., 'anthropic', 'openai') */
|
|
16
|
-
providerId: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Detect providers from environment variables.
|
|
20
|
-
*
|
|
21
|
-
* Scans all providers in the registry for their `envVars` configuration
|
|
22
|
-
* and checks if any of those environment variables are set.
|
|
23
|
-
*
|
|
24
|
-
* @returns Array of detected providers with their API keys
|
|
25
|
-
*/
|
|
26
|
-
export declare function detectProvidersFromEnv(): DetectedProvider[];
|
|
27
7
|
/**
|
|
28
8
|
* Check if a specific provider has an API key set via environment variable.
|
|
29
9
|
*
|
|
@@ -5,33 +5,6 @@
|
|
|
5
5
|
* Used to auto-connect providers when API keys are found in the environment.
|
|
6
6
|
*/
|
|
7
7
|
import { PROVIDER_REGISTRY } from '../../core/domain/entities/provider-registry.js';
|
|
8
|
-
/**
|
|
9
|
-
* Detect providers from environment variables.
|
|
10
|
-
*
|
|
11
|
-
* Scans all providers in the registry for their `envVars` configuration
|
|
12
|
-
* and checks if any of those environment variables are set.
|
|
13
|
-
*
|
|
14
|
-
* @returns Array of detected providers with their API keys
|
|
15
|
-
*/
|
|
16
|
-
export function detectProvidersFromEnv() {
|
|
17
|
-
const detected = [];
|
|
18
|
-
for (const provider of Object.values(PROVIDER_REGISTRY)) {
|
|
19
|
-
if (!provider.envVars || provider.envVars.length === 0)
|
|
20
|
-
continue;
|
|
21
|
-
for (const envVar of provider.envVars) {
|
|
22
|
-
const value = process.env[envVar];
|
|
23
|
-
if (value && value.trim().length > 0) {
|
|
24
|
-
detected.push({
|
|
25
|
-
apiKey: value.trim(),
|
|
26
|
-
envVar,
|
|
27
|
-
providerId: provider.id,
|
|
28
|
-
});
|
|
29
|
-
break; // Only take the first matching env var per provider
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return detected;
|
|
34
|
-
}
|
|
35
8
|
/**
|
|
36
9
|
* Check if a specific provider has an API key set via environment variable.
|
|
37
10
|
*
|
|
@@ -80,7 +80,3 @@ export declare class FileProviderConfigStore implements IProviderConfigStore {
|
|
|
80
80
|
*/
|
|
81
81
|
write(config: ProviderConfig): Promise<void>;
|
|
82
82
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Creates a file-based provider config store instance.
|
|
85
|
-
*/
|
|
86
|
-
export declare function createProviderConfigStore(): IProviderConfigStore;
|
|
@@ -26,7 +26,7 @@ export interface FileReadResult {
|
|
|
26
26
|
/**
|
|
27
27
|
* Configuration options for file reading.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
interface FileContentReaderConfig {
|
|
30
30
|
/** Maximum content length per file in characters (default: 40000) */
|
|
31
31
|
maxContentLength?: number;
|
|
32
32
|
/** Maximum lines to read for text files (default: 2000) */
|
|
@@ -79,3 +79,4 @@ export declare class FileContentReader {
|
|
|
79
79
|
* Factory function to create a FileContentReader instance.
|
|
80
80
|
*/
|
|
81
81
|
export declare function createFileContentReader(documentParser?: IDocumentParserService): FileContentReader;
|
|
82
|
+
export {};
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Finds the most recent file in a directory by modification time.
|
|
3
|
-
* @param directory - Absolute path to directory to search
|
|
4
|
-
* @returns Absolute path to the most recent file
|
|
5
|
-
* @throws Error if directory is empty or doesn't exist
|
|
6
|
-
*/
|
|
7
|
-
export declare function findLatestFile(directory: string): Promise<string>;
|
|
8
|
-
/**
|
|
9
|
-
* Removes all files from a directory while preserving the directory itself.
|
|
10
|
-
* Returns the number of files removed.
|
|
11
|
-
* Silently succeeds if directory doesn't exist.
|
|
12
|
-
* @param dirPath - Absolute path to directory to clear
|
|
13
|
-
* @returns Number of files removed
|
|
14
|
-
*/
|
|
15
|
-
export declare function clearDirectory(dirPath: string): Promise<number>;
|
|
16
1
|
/**
|
|
17
2
|
* Sanitizes a folder path by replacing all special characters with a hyphen.
|
|
18
3
|
* @param folderName - The folder path need to sanitize
|
|
@@ -33,12 +18,3 @@ export declare function sanitizeFolderName(folderName: string): string;
|
|
|
33
18
|
* ```
|
|
34
19
|
*/
|
|
35
20
|
export declare function toSnakeCase(name: string): string;
|
|
36
|
-
/**
|
|
37
|
-
* Lists all immediate children (files and directories) of the given directory,
|
|
38
|
-
* and, for each child folder, shows its own immediate children.
|
|
39
|
-
* @param dirPath The directory path whose children to list.
|
|
40
|
-
* @returns An object where keys are child names, and values are:
|
|
41
|
-
* - for files: undefined
|
|
42
|
-
* - for directories: an array of their immediate children
|
|
43
|
-
*/
|
|
44
|
-
export declare function listDirectoryChildren(dirPath?: string): Record<string, string[] | undefined>;
|