byterover-cli 0.1.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 +781 -0
- package/bin/dev.cmd +4 -0
- package/bin/dev.js +7 -0
- package/bin/run.cmd +4 -0
- package/bin/run.js +7 -0
- package/dist/commands/add.d.ts +60 -0
- package/dist/commands/add.js +230 -0
- package/dist/commands/clear.d.ts +13 -0
- package/dist/commands/clear.js +57 -0
- package/dist/commands/complete.d.ts +108 -0
- package/dist/commands/complete.js +340 -0
- package/dist/commands/gen-rules.d.ts +26 -0
- package/dist/commands/gen-rules.js +89 -0
- package/dist/commands/init.d.ts +24 -0
- package/dist/commands/init.js +135 -0
- package/dist/commands/login.d.ts +22 -0
- package/dist/commands/login.js +103 -0
- package/dist/commands/push.d.ts +33 -0
- package/dist/commands/push.js +150 -0
- package/dist/commands/retrieve.d.ts +26 -0
- package/dist/commands/retrieve.js +101 -0
- package/dist/commands/space/list.d.ts +22 -0
- package/dist/commands/space/list.js +105 -0
- package/dist/commands/space/switch.d.ts +20 -0
- package/dist/commands/space/switch.js +110 -0
- package/dist/commands/status.d.ts +22 -0
- package/dist/commands/status.js +116 -0
- package/dist/config/auth.config.d.ts +32 -0
- package/dist/config/auth.config.js +35 -0
- package/dist/config/environment.d.ts +35 -0
- package/dist/config/environment.js +39 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +12 -0
- package/dist/core/domain/entities/agent.d.ts +5 -0
- package/dist/core/domain/entities/agent.js +23 -0
- package/dist/core/domain/entities/auth-token.d.ts +43 -0
- package/dist/core/domain/entities/auth-token.js +70 -0
- package/dist/core/domain/entities/br-config.d.ts +25 -0
- package/dist/core/domain/entities/br-config.js +58 -0
- package/dist/core/domain/entities/bullet.d.ts +51 -0
- package/dist/core/domain/entities/bullet.js +94 -0
- package/dist/core/domain/entities/curator-output.d.ts +14 -0
- package/dist/core/domain/entities/curator-output.js +23 -0
- package/dist/core/domain/entities/delta-batch.d.ts +30 -0
- package/dist/core/domain/entities/delta-batch.js +52 -0
- package/dist/core/domain/entities/delta-operation.d.ts +31 -0
- package/dist/core/domain/entities/delta-operation.js +50 -0
- package/dist/core/domain/entities/event.d.ts +8 -0
- package/dist/core/domain/entities/event.js +15 -0
- package/dist/core/domain/entities/executor-output.d.ts +27 -0
- package/dist/core/domain/entities/executor-output.js +33 -0
- package/dist/core/domain/entities/memory.d.ts +55 -0
- package/dist/core/domain/entities/memory.js +90 -0
- package/dist/core/domain/entities/oauth-token-data.d.ts +13 -0
- package/dist/core/domain/entities/oauth-token-data.js +20 -0
- package/dist/core/domain/entities/playbook.d.ts +97 -0
- package/dist/core/domain/entities/playbook.js +275 -0
- package/dist/core/domain/entities/presigned-url.d.ts +9 -0
- package/dist/core/domain/entities/presigned-url.js +18 -0
- package/dist/core/domain/entities/presigned-urls-response.d.ts +10 -0
- package/dist/core/domain/entities/presigned-urls-response.js +18 -0
- package/dist/core/domain/entities/reflector-output.d.ts +38 -0
- package/dist/core/domain/entities/reflector-output.js +44 -0
- package/dist/core/domain/entities/retrieve-result.d.ts +35 -0
- package/dist/core/domain/entities/retrieve-result.js +35 -0
- package/dist/core/domain/entities/space.d.ts +24 -0
- package/dist/core/domain/entities/space.js +52 -0
- package/dist/core/domain/entities/team.d.ts +42 -0
- package/dist/core/domain/entities/team.js +89 -0
- package/dist/core/domain/entities/user.d.ts +20 -0
- package/dist/core/domain/entities/user.js +32 -0
- package/dist/core/domain/errors/ace-error.d.ts +34 -0
- package/dist/core/domain/errors/ace-error.js +53 -0
- package/dist/core/domain/errors/auth-error.d.ts +10 -0
- package/dist/core/domain/errors/auth-error.js +20 -0
- package/dist/core/domain/errors/discovery-error.d.ts +21 -0
- package/dist/core/domain/errors/discovery-error.js +33 -0
- package/dist/core/domain/errors/rule-error.d.ts +6 -0
- package/dist/core/domain/errors/rule-error.js +12 -0
- package/dist/core/interfaces/i-ace-prompt-builder.d.ts +48 -0
- package/dist/core/interfaces/i-ace-prompt-builder.js +1 -0
- package/dist/core/interfaces/i-auth-service.d.ts +35 -0
- package/dist/core/interfaces/i-auth-service.js +1 -0
- package/dist/core/interfaces/i-browser-launcher.d.ts +11 -0
- package/dist/core/interfaces/i-browser-launcher.js +1 -0
- package/dist/core/interfaces/i-bullet-content-store.d.ts +36 -0
- package/dist/core/interfaces/i-bullet-content-store.js +1 -0
- package/dist/core/interfaces/i-callback-handler.d.ts +35 -0
- package/dist/core/interfaces/i-callback-handler.js +1 -0
- package/dist/core/interfaces/i-delta-store.d.ts +15 -0
- package/dist/core/interfaces/i-delta-store.js +1 -0
- package/dist/core/interfaces/i-executor-output-store.d.ts +14 -0
- package/dist/core/interfaces/i-executor-output-store.js +1 -0
- package/dist/core/interfaces/i-file-service.d.ts +34 -0
- package/dist/core/interfaces/i-file-service.js +1 -0
- package/dist/core/interfaces/i-http-client.d.ts +33 -0
- package/dist/core/interfaces/i-http-client.js +1 -0
- package/dist/core/interfaces/i-memory-retrieval-service.d.ts +40 -0
- package/dist/core/interfaces/i-memory-retrieval-service.js +1 -0
- package/dist/core/interfaces/i-memory-storage-service.d.ts +55 -0
- package/dist/core/interfaces/i-memory-storage-service.js +1 -0
- package/dist/core/interfaces/i-oidc-discovery-service.d.ts +20 -0
- package/dist/core/interfaces/i-oidc-discovery-service.js +1 -0
- package/dist/core/interfaces/i-playbook-service.d.ts +69 -0
- package/dist/core/interfaces/i-playbook-service.js +1 -0
- package/dist/core/interfaces/i-playbook-store.d.ts +38 -0
- package/dist/core/interfaces/i-playbook-store.js +1 -0
- package/dist/core/interfaces/i-project-config-store.d.ts +26 -0
- package/dist/core/interfaces/i-project-config-store.js +1 -0
- package/dist/core/interfaces/i-reflection-store.d.ts +21 -0
- package/dist/core/interfaces/i-reflection-store.js +1 -0
- package/dist/core/interfaces/i-rule-template-service.d.ts +17 -0
- package/dist/core/interfaces/i-rule-template-service.js +4 -0
- package/dist/core/interfaces/i-rule-writer-service.d.ts +13 -0
- package/dist/core/interfaces/i-rule-writer-service.js +1 -0
- package/dist/core/interfaces/i-space-service.d.ts +28 -0
- package/dist/core/interfaces/i-space-service.js +1 -0
- package/dist/core/interfaces/i-team-service.d.ts +29 -0
- package/dist/core/interfaces/i-team-service.js +1 -0
- package/dist/core/interfaces/i-template-loader.d.ts +29 -0
- package/dist/core/interfaces/i-template-loader.js +1 -0
- package/dist/core/interfaces/i-token-store.d.ts +22 -0
- package/dist/core/interfaces/i-token-store.js +1 -0
- package/dist/core/interfaces/i-tracking-service.d.ts +21 -0
- package/dist/core/interfaces/i-tracking-service.js +1 -0
- package/dist/core/interfaces/i-user-service.d.ts +14 -0
- package/dist/core/interfaces/i-user-service.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/infra/ace/ace-file-utils.d.ts +46 -0
- package/dist/infra/ace/ace-file-utils.js +83 -0
- package/dist/infra/ace/ace-prompt-templates.d.ts +13 -0
- package/dist/infra/ace/ace-prompt-templates.js +177 -0
- package/dist/infra/ace/file-bullet-content-store.d.ts +27 -0
- package/dist/infra/ace/file-bullet-content-store.js +89 -0
- package/dist/infra/ace/file-delta-store.d.ts +9 -0
- package/dist/infra/ace/file-delta-store.js +26 -0
- package/dist/infra/ace/file-executor-output-store.d.ts +9 -0
- package/dist/infra/ace/file-executor-output-store.js +26 -0
- package/dist/infra/ace/file-playbook-store.d.ts +29 -0
- package/dist/infra/ace/file-playbook-store.js +107 -0
- package/dist/infra/ace/file-reflection-store.d.ts +10 -0
- package/dist/infra/ace/file-reflection-store.js +55 -0
- package/dist/infra/auth/oauth-service.d.ts +49 -0
- package/dist/infra/auth/oauth-service.js +126 -0
- package/dist/infra/auth/oidc-discovery-service.d.ts +51 -0
- package/dist/infra/auth/oidc-discovery-service.js +145 -0
- package/dist/infra/browser/system-browser-launcher.d.ts +10 -0
- package/dist/infra/browser/system-browser-launcher.js +18 -0
- package/dist/infra/config/file-config-store.d.ts +21 -0
- package/dist/infra/config/file-config-store.js +57 -0
- package/dist/infra/file/fs-file-service.d.ts +28 -0
- package/dist/infra/file/fs-file-service.js +57 -0
- package/dist/infra/http/authenticated-http-client.d.ts +46 -0
- package/dist/infra/http/authenticated-http-client.js +99 -0
- package/dist/infra/http/callback-handler.d.ts +13 -0
- package/dist/infra/http/callback-handler.js +24 -0
- package/dist/infra/http/callback-server.d.ts +18 -0
- package/dist/infra/http/callback-server.js +93 -0
- package/dist/infra/memory/http-memory-retrieval-service.d.ts +18 -0
- package/dist/infra/memory/http-memory-retrieval-service.js +63 -0
- package/dist/infra/memory/http-memory-storage-service.d.ts +18 -0
- package/dist/infra/memory/http-memory-storage-service.js +67 -0
- package/dist/infra/memory/memory-to-playbook-mapper.d.ts +33 -0
- package/dist/infra/memory/memory-to-playbook-mapper.js +51 -0
- package/dist/infra/playbook/file-playbook-service.d.ts +43 -0
- package/dist/infra/playbook/file-playbook-service.js +133 -0
- package/dist/infra/rule/agent-rule-config.d.ts +19 -0
- package/dist/infra/rule/agent-rule-config.js +77 -0
- package/dist/infra/rule/rule-template-service.d.ts +18 -0
- package/dist/infra/rule/rule-template-service.js +80 -0
- package/dist/infra/rule/rule-writer-service.d.ts +19 -0
- package/dist/infra/rule/rule-writer-service.js +43 -0
- package/dist/infra/space/http-space-service.d.ts +20 -0
- package/dist/infra/space/http-space-service.js +67 -0
- package/dist/infra/storage/keychain-token-store.d.ts +10 -0
- package/dist/infra/storage/keychain-token-store.js +40 -0
- package/dist/infra/team/http-team-service.d.ts +21 -0
- package/dist/infra/team/http-team-service.js +71 -0
- package/dist/infra/template/fs-template-loader.d.ts +33 -0
- package/dist/infra/template/fs-template-loader.js +62 -0
- package/dist/infra/tracking/mixpanel-tracking-service.d.ts +14 -0
- package/dist/infra/tracking/mixpanel-tracking-service.js +44 -0
- package/dist/infra/user/http-user-service.d.ts +12 -0
- package/dist/infra/user/http-user-service.js +26 -0
- package/dist/templates/README.md +103 -0
- package/dist/templates/base.md +3 -0
- package/dist/templates/sections/command-reference.md +141 -0
- package/dist/templates/sections/workflow.md +46 -0
- package/dist/utils/file-helpers.d.ts +15 -0
- package/dist/utils/file-helpers.js +45 -0
- package/oclif.manifest.json +476 -0
- package/package.json +82 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parameters for creating a Team instance
|
|
3
|
+
*/
|
|
4
|
+
interface TeamParams {
|
|
5
|
+
avatarUrl: string;
|
|
6
|
+
createdAt: Date;
|
|
7
|
+
description: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
id: string;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
name: string;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Represents a ByteRover team that contains spaces.
|
|
16
|
+
* A team is a group of users collaborating on one or more codebases.
|
|
17
|
+
*/
|
|
18
|
+
export declare class Team {
|
|
19
|
+
readonly avatarUrl: string;
|
|
20
|
+
readonly createdAt: Date;
|
|
21
|
+
readonly description: string;
|
|
22
|
+
readonly displayName: string;
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly isActive: boolean;
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly updatedAt: Date;
|
|
27
|
+
constructor(params: TeamParams);
|
|
28
|
+
/**
|
|
29
|
+
* Deserializes a team from JSON format (API response with snake_case)
|
|
30
|
+
*/
|
|
31
|
+
static fromJson(json: Record<string, unknown>): Team;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the display name for UI purposes
|
|
34
|
+
* Example: "Acme Corporation"
|
|
35
|
+
*/
|
|
36
|
+
getDisplayName(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Serializes the team to JSON format (camelCase for storage)
|
|
39
|
+
*/
|
|
40
|
+
toJson(): Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a ByteRover team that contains spaces.
|
|
3
|
+
* A team is a group of users collaborating on one or more codebases.
|
|
4
|
+
*/
|
|
5
|
+
export class Team {
|
|
6
|
+
avatarUrl;
|
|
7
|
+
createdAt;
|
|
8
|
+
description;
|
|
9
|
+
displayName;
|
|
10
|
+
id;
|
|
11
|
+
isActive;
|
|
12
|
+
name;
|
|
13
|
+
updatedAt;
|
|
14
|
+
constructor(params) {
|
|
15
|
+
if (params.id.trim().length === 0) {
|
|
16
|
+
throw new Error('Team ID cannot be empty');
|
|
17
|
+
}
|
|
18
|
+
if (params.name.trim().length === 0) {
|
|
19
|
+
throw new Error('Team name cannot be empty');
|
|
20
|
+
}
|
|
21
|
+
if (params.displayName.trim().length === 0) {
|
|
22
|
+
throw new Error('Team display name cannot be empty');
|
|
23
|
+
}
|
|
24
|
+
this.avatarUrl = params.avatarUrl;
|
|
25
|
+
this.createdAt = params.createdAt;
|
|
26
|
+
this.description = params.description;
|
|
27
|
+
this.displayName = params.displayName;
|
|
28
|
+
this.id = params.id;
|
|
29
|
+
this.isActive = params.isActive;
|
|
30
|
+
this.name = params.name;
|
|
31
|
+
this.updatedAt = params.updatedAt;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Deserializes a team from JSON format (API response with snake_case)
|
|
35
|
+
*/
|
|
36
|
+
static fromJson(json) {
|
|
37
|
+
// Validate required fields
|
|
38
|
+
if (typeof json.id !== 'string') {
|
|
39
|
+
throw new TypeError('Team JSON must have a string id field');
|
|
40
|
+
}
|
|
41
|
+
if (typeof json.name !== 'string') {
|
|
42
|
+
throw new TypeError('Team JSON must have a string name field');
|
|
43
|
+
}
|
|
44
|
+
if (typeof json.display_name !== 'string') {
|
|
45
|
+
throw new TypeError('Team JSON must have a string display_name field');
|
|
46
|
+
}
|
|
47
|
+
if (typeof json.is_active !== 'boolean') {
|
|
48
|
+
throw new TypeError('Team JSON must have a boolean is_active field');
|
|
49
|
+
}
|
|
50
|
+
if (typeof json.created_at !== 'string') {
|
|
51
|
+
throw new TypeError('Team JSON must have a string created_at field');
|
|
52
|
+
}
|
|
53
|
+
if (typeof json.updated_at !== 'string') {
|
|
54
|
+
throw new TypeError('Team JSON must have a string updated_at field');
|
|
55
|
+
}
|
|
56
|
+
return new Team({
|
|
57
|
+
avatarUrl: typeof json.avatar_url === 'string' ? json.avatar_url : '',
|
|
58
|
+
createdAt: new Date(json.created_at),
|
|
59
|
+
description: typeof json.description === 'string' ? json.description : '',
|
|
60
|
+
displayName: json.display_name,
|
|
61
|
+
id: json.id,
|
|
62
|
+
isActive: json.is_active,
|
|
63
|
+
name: json.name,
|
|
64
|
+
updatedAt: new Date(json.updated_at),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Returns the display name for UI purposes
|
|
69
|
+
* Example: "Acme Corporation"
|
|
70
|
+
*/
|
|
71
|
+
getDisplayName() {
|
|
72
|
+
return this.displayName;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Serializes the team to JSON format (camelCase for storage)
|
|
76
|
+
*/
|
|
77
|
+
toJson() {
|
|
78
|
+
return {
|
|
79
|
+
avatarUrl: this.avatarUrl,
|
|
80
|
+
createdAt: this.createdAt.toISOString(),
|
|
81
|
+
description: this.description,
|
|
82
|
+
displayName: this.displayName,
|
|
83
|
+
id: this.id,
|
|
84
|
+
isActive: this.isActive,
|
|
85
|
+
name: this.name,
|
|
86
|
+
updatedAt: this.updatedAt.toISOString(),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a user in the system.
|
|
3
|
+
*/
|
|
4
|
+
export declare class User {
|
|
5
|
+
readonly email: string;
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
constructor(email: string, id: string, name: string);
|
|
9
|
+
/**
|
|
10
|
+
* Create a User instance from a JSON object.
|
|
11
|
+
* @param json JSON object representing the User
|
|
12
|
+
* @returns An instance of User
|
|
13
|
+
*/
|
|
14
|
+
static fromJson(json: Record<string, string>): User;
|
|
15
|
+
/**
|
|
16
|
+
* Convert the User instance to a JSON object.
|
|
17
|
+
* @returns A JSON object representing the User
|
|
18
|
+
*/
|
|
19
|
+
toJson(): Record<string, string>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a user in the system.
|
|
3
|
+
*/
|
|
4
|
+
export class User {
|
|
5
|
+
email;
|
|
6
|
+
id;
|
|
7
|
+
name;
|
|
8
|
+
constructor(email, id, name) {
|
|
9
|
+
this.email = email;
|
|
10
|
+
this.id = id;
|
|
11
|
+
this.name = name;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a User instance from a JSON object.
|
|
15
|
+
* @param json JSON object representing the User
|
|
16
|
+
* @returns An instance of User
|
|
17
|
+
*/
|
|
18
|
+
static fromJson(json) {
|
|
19
|
+
return new User(json.email, json.id, json.name);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Convert the User instance to a JSON object.
|
|
23
|
+
* @returns A JSON object representing the User
|
|
24
|
+
*/
|
|
25
|
+
toJson() {
|
|
26
|
+
return {
|
|
27
|
+
email: this.email,
|
|
28
|
+
id: this.id,
|
|
29
|
+
name: this.name,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error for ACE operations
|
|
3
|
+
*/
|
|
4
|
+
export declare class AceError extends Error {
|
|
5
|
+
readonly code?: string;
|
|
6
|
+
constructor(message: string, code?: string);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Error when a bullet is not found
|
|
10
|
+
*/
|
|
11
|
+
export declare class BulletNotFoundError extends AceError {
|
|
12
|
+
readonly bulletId: string;
|
|
13
|
+
constructor(bulletId: string);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Error when a playbook is not found
|
|
17
|
+
*/
|
|
18
|
+
export declare class PlaybookNotFoundError extends AceError {
|
|
19
|
+
readonly playbookPath: string;
|
|
20
|
+
constructor(playbookPath: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Error when delta operation fails
|
|
24
|
+
*/
|
|
25
|
+
export declare class DeltaOperationError extends AceError {
|
|
26
|
+
readonly operation: string;
|
|
27
|
+
constructor(operation: string, message: string);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Error when playbook validation fails
|
|
31
|
+
*/
|
|
32
|
+
export declare class PlaybookValidationError extends AceError {
|
|
33
|
+
constructor(message: string);
|
|
34
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error for ACE operations
|
|
3
|
+
*/
|
|
4
|
+
export class AceError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
constructor(message, code) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'AceError';
|
|
9
|
+
this.code = code;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Error when a bullet is not found
|
|
14
|
+
*/
|
|
15
|
+
export class BulletNotFoundError extends AceError {
|
|
16
|
+
bulletId;
|
|
17
|
+
constructor(bulletId) {
|
|
18
|
+
super(`Bullet not found: ${bulletId}`, 'BULLET_NOT_FOUND');
|
|
19
|
+
this.name = 'BulletNotFoundError';
|
|
20
|
+
this.bulletId = bulletId;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error when a playbook is not found
|
|
25
|
+
*/
|
|
26
|
+
export class PlaybookNotFoundError extends AceError {
|
|
27
|
+
playbookPath;
|
|
28
|
+
constructor(playbookPath) {
|
|
29
|
+
super(`Playbook not found: ${playbookPath}`, 'PLAYBOOK_NOT_FOUND');
|
|
30
|
+
this.name = 'PlaybookNotFoundError';
|
|
31
|
+
this.playbookPath = playbookPath;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Error when delta operation fails
|
|
36
|
+
*/
|
|
37
|
+
export class DeltaOperationError extends AceError {
|
|
38
|
+
operation;
|
|
39
|
+
constructor(operation, message) {
|
|
40
|
+
super(`Delta operation failed (${operation}): ${message}`, 'DELTA_OPERATION_FAILED');
|
|
41
|
+
this.name = 'DeltaOperationError';
|
|
42
|
+
this.operation = operation;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Error when playbook validation fails
|
|
47
|
+
*/
|
|
48
|
+
export class PlaybookValidationError extends AceError {
|
|
49
|
+
constructor(message) {
|
|
50
|
+
super(`Playbook validation failed: ${message}`, 'PLAYBOOK_VALIDATION_FAILED');
|
|
51
|
+
this.name = 'PlaybookValidationError';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class AuthenticationError extends Error {
|
|
2
|
+
readonly code?: string;
|
|
3
|
+
constructor(message: string, code?: string);
|
|
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
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class AuthenticationError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
constructor(message, code) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = 'AuthenticationError';
|
|
6
|
+
this.code = code;
|
|
7
|
+
}
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error for OIDC discovery failures.
|
|
3
|
+
*/
|
|
4
|
+
export declare class DiscoveryError extends Error {
|
|
5
|
+
readonly attemptCount?: number;
|
|
6
|
+
readonly issuerUrl: string;
|
|
7
|
+
constructor(message: string, issuerUrl: string, attemptCount?: number);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Error thrown when discovery request times out.
|
|
11
|
+
*/
|
|
12
|
+
export declare class DiscoveryTimeoutError extends DiscoveryError {
|
|
13
|
+
constructor(issuerUrl: string, timeoutMs: number, attemptCount?: number);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Error thrown when discovery encounters a network error.
|
|
17
|
+
*/
|
|
18
|
+
export declare class DiscoveryNetworkError extends DiscoveryError {
|
|
19
|
+
readonly originalError?: Error;
|
|
20
|
+
constructor(issuerUrl: string, originalError?: Error, attemptCount?: number);
|
|
21
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error for OIDC discovery failures.
|
|
3
|
+
*/
|
|
4
|
+
export class DiscoveryError extends Error {
|
|
5
|
+
attemptCount;
|
|
6
|
+
issuerUrl;
|
|
7
|
+
constructor(message, issuerUrl, attemptCount) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'DiscoveryError';
|
|
10
|
+
this.issuerUrl = issuerUrl;
|
|
11
|
+
this.attemptCount = attemptCount;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Error thrown when discovery request times out.
|
|
16
|
+
*/
|
|
17
|
+
export class DiscoveryTimeoutError extends DiscoveryError {
|
|
18
|
+
constructor(issuerUrl, timeoutMs, attemptCount) {
|
|
19
|
+
super(`OIDC discovery timed out after ${timeoutMs}ms for issuer: ${issuerUrl}`, issuerUrl, attemptCount);
|
|
20
|
+
this.name = 'DiscoveryTimeoutError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error thrown when discovery encounters a network error.
|
|
25
|
+
*/
|
|
26
|
+
export class DiscoveryNetworkError extends DiscoveryError {
|
|
27
|
+
originalError;
|
|
28
|
+
constructor(issuerUrl, originalError, attemptCount) {
|
|
29
|
+
super(`Network error during OIDC discovery for issuer: ${issuerUrl}${originalError ? `: ${originalError.message}` : ''}`, issuerUrl, attemptCount);
|
|
30
|
+
this.name = 'DiscoveryNetworkError';
|
|
31
|
+
this.originalError = originalError;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class RuleError extends Error {
|
|
2
|
+
constructor(message) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = 'RuleError';
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class RuleExistsError extends RuleError {
|
|
8
|
+
constructor(message = 'Rule already exists') {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'RuleExistsError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ExecutorOutput } from '../domain/entities/executor-output.js';
|
|
2
|
+
import type { Playbook } from '../domain/entities/playbook.js';
|
|
3
|
+
import type { ReflectorOutput } from '../domain/entities/reflector-output.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for building a reflector prompt
|
|
6
|
+
*/
|
|
7
|
+
export interface ReflectorPromptParams {
|
|
8
|
+
executorOutput: ExecutorOutput;
|
|
9
|
+
feedback: string;
|
|
10
|
+
groundTruth?: string;
|
|
11
|
+
playbook: Playbook;
|
|
12
|
+
task: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Port for building prompts for ACE pipeline
|
|
16
|
+
* This abstraction allows different prompt strategies for different roles of coding agent
|
|
17
|
+
*/
|
|
18
|
+
export interface IAcePromptBuilder {
|
|
19
|
+
/**
|
|
20
|
+
* Builds the curator prompt for updating the playbook.
|
|
21
|
+
* The curator transforms reflections into structured playbook updates.
|
|
22
|
+
*
|
|
23
|
+
* @param reflection The reflector's analysis and insights
|
|
24
|
+
* @param playbook The current playbook to update
|
|
25
|
+
* @param questionContext Context about what task was being solved
|
|
26
|
+
* @returns A prompt string ready for the coding agent
|
|
27
|
+
*/
|
|
28
|
+
buildCuratorPrompt: (reflection: ReflectorOutput, playbook: Playbook, questionContext: string) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Builds the executor (generator) prompt for coding agents.
|
|
31
|
+
* The executor uses the playbook to solve tasks with context-aware reasoning.
|
|
32
|
+
*
|
|
33
|
+
* @param task The task or question to solve
|
|
34
|
+
* @param context Additional context about the task (e.g., file contents, error messages)
|
|
35
|
+
* @param playbook The knowledge playbook containing strategies and lessons
|
|
36
|
+
* @param recentReflections Recent reflection summaries to avoid repeating mistakes
|
|
37
|
+
* @returns A prompt string ready for the coding aqgent
|
|
38
|
+
*/
|
|
39
|
+
buildExecutorPrompt: (task: string, context: string, playbook: Playbook, recentReflections: string[]) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Builds the reflector prompt for analyzing execution results.
|
|
42
|
+
* The reflector identifies errors, root causes, and key insights.
|
|
43
|
+
*
|
|
44
|
+
* @param params The reflector prompt parameters
|
|
45
|
+
* @returns A prompt string ready for the coding agent
|
|
46
|
+
*/
|
|
47
|
+
buildReflectorPrompt: (params: ReflectorPromptParams) => string;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { OAuthTokenData } from '../domain/entities/oauth-token-data.js';
|
|
2
|
+
/**
|
|
3
|
+
* Authorization context containing the URL and state for OAuth flow.
|
|
4
|
+
* The code_verifier is managed internally by the auth service.
|
|
5
|
+
*/
|
|
6
|
+
export type AuthorizationContext = {
|
|
7
|
+
authUrl: string;
|
|
8
|
+
state: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Interface for authentication services.
|
|
12
|
+
*/
|
|
13
|
+
export interface IAuthService {
|
|
14
|
+
/**
|
|
15
|
+
* Exchanges an authorization code for OAuth token data.
|
|
16
|
+
* @param code The authorization code to exchange.
|
|
17
|
+
* @param context The authorization context from initiateAuthorization (contains state for verifier lookup).
|
|
18
|
+
* @param redirectUri The redirect URI used in the authorization request (must match for OAuth 2.0 compliance).
|
|
19
|
+
* @returns The OAuth token data (without user information).
|
|
20
|
+
*/
|
|
21
|
+
exchangeCodeForToken: (code: string, context: AuthorizationContext, redirectUri: string) => Promise<OAuthTokenData>;
|
|
22
|
+
/**
|
|
23
|
+
* Initiates the authorization flow by generating PKCE parameters and building the authorization URL.
|
|
24
|
+
* The code_verifier is generated and stored internally by the service.
|
|
25
|
+
* @param redirectUri The redirect URI where authorization codes will be received.
|
|
26
|
+
* @returns Authorization context containing the URL and state for CSRF protection.
|
|
27
|
+
*/
|
|
28
|
+
initiateAuthorization: (redirectUri: string) => AuthorizationContext;
|
|
29
|
+
/**
|
|
30
|
+
* Refreshes an access token using a refresh token.
|
|
31
|
+
* @param refreshToken The refresh token to use.
|
|
32
|
+
* @returns The new OAuth token data (without user information).
|
|
33
|
+
*/
|
|
34
|
+
refreshToken: (refreshToken: string) => Promise<OAuthTokenData>;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for browser launcher implementations.
|
|
3
|
+
*/
|
|
4
|
+
export interface IBrowserLauncher {
|
|
5
|
+
/**
|
|
6
|
+
* Launches the system browser to open the specified URL.
|
|
7
|
+
* @param url The URL to open.
|
|
8
|
+
* @returns A promise that resolves when the browser has been launched.
|
|
9
|
+
*/
|
|
10
|
+
open: (url: string) => Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Port for bullet content file persistence operations.
|
|
3
|
+
* Manages individual markdown files for bullet content.
|
|
4
|
+
*/
|
|
5
|
+
export interface IBulletContentStore {
|
|
6
|
+
/**
|
|
7
|
+
* Deletes a bullet content file from storage.
|
|
8
|
+
* Does nothing if the content file doesn't exist.
|
|
9
|
+
* @param bulletId The bullet ID
|
|
10
|
+
* @param directory The project directory (defaults to current working directory)
|
|
11
|
+
*/
|
|
12
|
+
delete: (bulletId: string, directory?: string) => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Checks if a bullet content file exists.
|
|
15
|
+
* @param bulletId The bullet ID
|
|
16
|
+
* @param directory The project directory (defaults to current working directory)
|
|
17
|
+
* @returns True if content file exists, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
exists: (bulletId: string, directory?: string) => Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Loads bullet content from a markdown file.
|
|
22
|
+
* @param bulletId The bullet ID
|
|
23
|
+
* @param directory The project directory (defaults to current working directory)
|
|
24
|
+
* @returns The content, or undefined if not found
|
|
25
|
+
*/
|
|
26
|
+
load: (bulletId: string, directory?: string) => Promise<string | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Saves bullet content to a markdown file.
|
|
29
|
+
* Creates the directory structure if it doesn't exist.
|
|
30
|
+
* @param bulletId The bullet ID
|
|
31
|
+
* @param content The bullet content
|
|
32
|
+
* @param directory The project directory (defaults to current working directory)
|
|
33
|
+
* @returns The file path where content was saved
|
|
34
|
+
*/
|
|
35
|
+
save: (bulletId: string, content: string, directory?: string) => Promise<string>;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result from OAuth callback containing authorization code and state.
|
|
3
|
+
*/
|
|
4
|
+
export type CallbackResult = {
|
|
5
|
+
code: string;
|
|
6
|
+
state: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Interface for handling OAuth callback during authentication flow.
|
|
10
|
+
* Implementations manage a local HTTP server that receives OAuth redirect.
|
|
11
|
+
*/
|
|
12
|
+
export interface ICallbackHandler {
|
|
13
|
+
/**
|
|
14
|
+
* Get the current port of the callback server.
|
|
15
|
+
* @returns The port number if server is running, undefined otherwise.
|
|
16
|
+
*/
|
|
17
|
+
getPort(): number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Start the callback server.
|
|
20
|
+
* @returns Promise that resolves with the port number the server is listening on.
|
|
21
|
+
*/
|
|
22
|
+
start(): Promise<number>;
|
|
23
|
+
/**
|
|
24
|
+
* Stop the callback server.
|
|
25
|
+
* @returns Promise that resolves when the server is stopped.
|
|
26
|
+
*/
|
|
27
|
+
stop(): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Wait for OAuth callback with timeout.
|
|
30
|
+
* @param expectedState The state parameter to validate against CSRF attacks.
|
|
31
|
+
* @param timeoutMs Timeout in milliseconds.
|
|
32
|
+
* @returns Promise that resolves with the authorization code and state, or rejects on timeout or state mismatch.
|
|
33
|
+
*/
|
|
34
|
+
waitForCallback(expectedState: string, timeoutMs: number): Promise<CallbackResult>;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DeltaBatch } from '../domain/entities/delta-batch.js';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for delta batch storage operations.
|
|
4
|
+
* Implementations can be file-based (for production) or in-memory (for testing).
|
|
5
|
+
*/
|
|
6
|
+
export interface IDeltaStore {
|
|
7
|
+
/**
|
|
8
|
+
* Saves a delta batch to storage.
|
|
9
|
+
* @param deltaBatch - The delta batch to save
|
|
10
|
+
* @param hint - Optional hint to include in the filename for identification
|
|
11
|
+
* @param directory - Optional base directory (defaults to current working directory)
|
|
12
|
+
* @returns The absolute path where the delta batch was saved
|
|
13
|
+
*/
|
|
14
|
+
save(deltaBatch: DeltaBatch, hint?: string, directory?: string): Promise<string>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ExecutorOutput } from '../domain/entities/executor-output.js';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for executor output storage operations.
|
|
4
|
+
* Implementations can be file-based (for production) or in-memory (for testing).
|
|
5
|
+
*/
|
|
6
|
+
export interface IExecutorOutputStore {
|
|
7
|
+
/**
|
|
8
|
+
* Saves executor output to storage.
|
|
9
|
+
* @param output - The executor output to save
|
|
10
|
+
* @param directory - Optional base directory (defaults to current working directory)
|
|
11
|
+
* @returns The absolute path where the executor output was saved
|
|
12
|
+
*/
|
|
13
|
+
save(output: ExecutorOutput, directory?: string): Promise<string>;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write mode for file operations.
|
|
3
|
+
* - `append`: Add content to the end of the file
|
|
4
|
+
* - `overwrite`: Replace the entire file content
|
|
5
|
+
*/
|
|
6
|
+
export type WriteMode = 'append' | 'overwrite';
|
|
7
|
+
/**
|
|
8
|
+
* Interface for file service operations.
|
|
9
|
+
*/
|
|
10
|
+
export interface IFileService {
|
|
11
|
+
/**
|
|
12
|
+
* Checks if a file exists at the specified path.
|
|
13
|
+
*
|
|
14
|
+
* @param filePath The path to the file to check.
|
|
15
|
+
* @returns A promise that resolves with `true` if the file exists, `false` otherwise.
|
|
16
|
+
*/
|
|
17
|
+
exists: (filePath: string) => Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Reads content from the specified file.
|
|
20
|
+
*
|
|
21
|
+
* @param filePath The path to the file to read from.
|
|
22
|
+
* @returns A promise that resolves with the content of the file.
|
|
23
|
+
*/
|
|
24
|
+
read: (filePath: string) => Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Writes content to the specified file.
|
|
27
|
+
*
|
|
28
|
+
* @param content The content to write.
|
|
29
|
+
* @param filePath The path to the file to write to.
|
|
30
|
+
* @param mode The mode to write the content in.
|
|
31
|
+
* @returns A promise that resolves when the content has been written.
|
|
32
|
+
*/
|
|
33
|
+
write: (content: string, filePath: string, mode: WriteMode) => Promise<void>;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|