@vypdev/copilot 3.3.0 → 3.5.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.
Files changed (86) hide show
  1. package/README.md +33 -5
  2. package/action.yml +85 -109
  3. package/build/api/index.js +4737 -1506
  4. package/build/api/src/api.d.ts +60 -14
  5. package/build/api/src/application/errors/application_error.d.ts +10 -0
  6. package/build/api/src/application/ports/bugbot_context_ports.d.ts +20 -7
  7. package/build/api/src/application/ports/bugbot_finding_publication_ports.d.ts +4 -4
  8. package/build/api/src/application/ports/bugbot_finding_resolution_ports.d.ts +4 -4
  9. package/build/api/src/application/ports/bugbot_issue_read_ports.d.ts +3 -0
  10. package/build/api/src/application/ports/bugbot_issue_write_ports.d.ts +12 -0
  11. package/build/api/src/application/ports/bugbot_pull_request_read_ports.d.ts +3 -17
  12. package/build/api/src/application/ports/bugbot_pull_request_resolution_ports.d.ts +7 -1
  13. package/build/api/src/application/ports/bugbot_pull_request_write_ports.d.ts +6 -1
  14. package/build/api/src/application/ports/bugbot_reconciliation_ports.d.ts +18 -0
  15. package/build/api/src/application/ports/bugbot_review_navigation_ports.d.ts +13 -0
  16. package/build/api/src/application/ports/bugbot_rule_ports.d.ts +1 -1
  17. package/build/api/src/application/ports/bugbot_scm_ports.d.ts +14 -0
  18. package/build/api/src/application/ports/bugbot_telemetry_ports.d.ts +27 -2
  19. package/build/api/src/application/ports/message_catalog_ports.d.ts +17 -0
  20. package/build/api/src/application/ports/pull_request_review_comment_ports.d.ts +31 -2
  21. package/build/api/src/data/model/application_error.d.ts +82 -0
  22. package/build/api/src/data/model/result.d.ts +3 -4
  23. package/build/api/src/domain/agent.d.ts +6 -5
  24. package/build/api/src/domain/branch_sync_validation.d.ts +4 -0
  25. package/build/api/src/domain/bugbot/context.d.ts +68 -0
  26. package/build/api/src/domain/bugbot/finding.d.ts +61 -0
  27. package/build/api/src/domain/bugbot/review_projection.d.ts +33 -0
  28. package/build/api/src/domain/bugbot/review_state.d.ts +29 -0
  29. package/build/api/src/domain/message_catalog.d.ts +35 -0
  30. package/build/api/src/tooling/bugbot_analytics.d.ts +2 -1
  31. package/build/cli/index.js +93317 -71617
  32. package/build/github_action/index.js +79616 -63218
  33. package/build/web/assets/index-2NVaAtP1.js +3 -0
  34. package/build/web/assets/index-FN-aja4Y.css +1 -0
  35. package/build/web/index.html +14 -0
  36. package/package.json +35 -22
  37. package/scripts/install-git-hooks.cjs +38 -14
  38. package/setup/ISSUE_TEMPLATE/hotfix.yml +1 -1
  39. package/setup/ISSUE_TEMPLATE/release.yml +1 -1
  40. package/setup/pull_request_template.md +9 -135
  41. package/setup/source-workflows/copilot_pull_request_approval.yml +55 -0
  42. package/setup/workflows/agent-cli-provisioning.yml +37 -13
  43. package/setup/workflows/copilot_close_inactive_issues.yml +4 -4
  44. package/setup/workflows/copilot_commit.yml +16 -16
  45. package/setup/workflows/copilot_credential_health.yml +0 -20
  46. package/setup/workflows/copilot_deployment_orchestration.yml +91 -0
  47. package/setup/workflows/copilot_issue.yml +15 -19
  48. package/setup/workflows/copilot_issue_comment.yml +17 -19
  49. package/setup/workflows/copilot_pull_request.yml +21 -22
  50. package/setup/workflows/copilot_pull_request_approval.yml +51 -0
  51. package/setup/workflows/copilot_pull_request_comment.yml +17 -19
  52. package/setup/workflows/copilot_pull_request_merge_queue.yml +20 -0
  53. package/setup/workflows/copilot_pull_request_review_state.yml +109 -0
  54. package/setup/workflows/hotfix_workflow.yml +157 -168
  55. package/setup/workflows/release_workflow.yml +157 -168
  56. package/build/api/src/application/usecases/steps/commit/bugbot/types.d.ts +0 -112
  57. package/build/api/src/data/model/agent.d.ts +0 -2
  58. package/build/api/src/data/model/ai.d.ts +0 -28
  59. package/build/api/src/data/model/branch_configuration.d.ts +0 -6
  60. package/build/api/src/data/model/branches.d.ts +0 -12
  61. package/build/api/src/data/model/commit.d.ts +0 -8
  62. package/build/api/src/data/model/config.d.ts +0 -30
  63. package/build/api/src/data/model/emoji.d.ts +0 -5
  64. package/build/api/src/data/model/execution.d.ts +0 -75
  65. package/build/api/src/data/model/execution_components.d.ts +0 -43
  66. package/build/api/src/data/model/execution_inputs.d.ts +0 -94
  67. package/build/api/src/data/model/hotfix.d.ts +0 -7
  68. package/build/api/src/data/model/images.d.ts +0 -27
  69. package/build/api/src/data/model/issue.d.ts +0 -27
  70. package/build/api/src/data/model/issue_types.d.ts +0 -30
  71. package/build/api/src/data/model/labels.d.ts +0 -60
  72. package/build/api/src/data/model/locale.d.ts +0 -6
  73. package/build/api/src/data/model/project_detail.d.ts +0 -15
  74. package/build/api/src/data/model/projects.d.ts +0 -14
  75. package/build/api/src/data/model/pull_request.d.ts +0 -32
  76. package/build/api/src/data/model/recommendation_state.d.ts +0 -6
  77. package/build/api/src/data/model/release.d.ts +0 -6
  78. package/build/api/src/data/model/single_action.d.ts +0 -43
  79. package/build/api/src/data/model/size_threshold.d.ts +0 -6
  80. package/build/api/src/data/model/size_thresholds.d.ts +0 -10
  81. package/build/api/src/data/model/tokens.d.ts +0 -4
  82. package/build/api/src/data/model/welcome.d.ts +0 -5
  83. package/build/api/src/data/model/workflows.d.ts +0 -5
  84. package/build/api/src/domain/bugbot/review_command.d.ts +0 -16
  85. package/build/api/src/domain/copilot_lifecycle.d.ts +0 -42
  86. package/build/api/src/domain/pull_request_description.d.ts +0 -13
@@ -1,35 +1,81 @@
1
- import type { Execution } from './data/model/execution';
1
+ import type { Result } from './data/model/result';
2
+ import type { AgentConfiguration } from './domain/agent';
2
3
  import type { FindingsQueryPort } from './application/ports/agent_findings_ports';
3
- import type { BugbotContextPorts } from './application/ports/bugbot_context_ports';
4
- import type { BugbotFindingPublicationPorts } from './application/ports/bugbot_finding_publication_ports';
5
- import type { BugbotFindingResolutionPorts } from './application/ports/bugbot_finding_resolution_ports';
4
+ import type { BugbotScmPorts } from './application/ports/bugbot_scm_ports';
6
5
  import type { BugbotTelemetryPort } from './application/ports/bugbot_telemetry_ports';
7
- import type { BugbotReviewCommandOverrides } from './domain/bugbot/review_command';
8
- export interface BugbotScmGateway {
9
- readonly context: BugbotContextPorts;
10
- readonly publication: BugbotFindingPublicationPorts;
11
- readonly resolution: BugbotFindingResolutionPorts;
6
+ import type { BugbotReviewConfiguration } from './domain/bugbot/review_configuration';
7
+ import type { MessageCatalogResolutionPort } from './application/ports/message_catalog_ports';
8
+ export type { MessageCatalogResolutionPort } from './application/ports/message_catalog_ports';
9
+ /** Already-bound SCM authority for exactly one repository. */
10
+ export interface BugbotScmGateway extends BugbotScmPorts {
11
+ readonly repository: {
12
+ readonly owner: string;
13
+ readonly name: string;
14
+ };
12
15
  readonly telemetry?: BugbotTelemetryPort;
13
16
  }
17
+ export type BugbotMinimumSeverity = 'info' | 'low' | 'medium' | 'high';
18
+ export type BugbotReviewTarget = {
19
+ readonly kind: 'pull-request';
20
+ readonly number: number;
21
+ readonly head: string;
22
+ readonly base?: string;
23
+ readonly linkedIssueNumber?: number;
24
+ readonly action?: 'opened' | 'reopened' | 'synchronize';
25
+ readonly expectedHeadSha?: string;
26
+ readonly before?: string;
27
+ readonly draft?: boolean;
28
+ } | {
29
+ readonly kind: 'branch';
30
+ readonly branch: string;
31
+ readonly base?: string;
32
+ readonly issueNumber?: number;
33
+ readonly before?: string;
34
+ readonly after?: string;
35
+ };
36
+ /** Sole supported request for the programmatic Bugbot review entry point. */
37
+ export interface BugbotReviewRequest {
38
+ readonly target: BugbotReviewTarget;
39
+ readonly agent: AgentConfiguration;
40
+ readonly configuration?: Partial<BugbotReviewConfiguration>;
41
+ readonly ignoreFiles?: readonly string[];
42
+ readonly minimumSeverity?: BugbotMinimumSeverity;
43
+ readonly commentLimit?: number;
44
+ readonly authenticatedUser?: string;
45
+ readonly locale?: {
46
+ readonly issue?: string;
47
+ readonly pullRequest?: string;
48
+ };
49
+ }
14
50
  /** Provider-neutral programmatic entry point. Consumers supply agent and SCM adapters. */
15
51
  export declare class BugbotReviewService {
16
52
  private readonly useCase;
17
- constructor(agent: FindingsQueryPort, scm: BugbotScmGateway);
18
- review(execution: Execution, options?: BugbotReviewCommandOverrides): Promise<import("./data/model/result").Result[]>;
53
+ private readonly repository;
54
+ constructor(agent: FindingsQueryPort, scm: BugbotScmGateway, catalogResolver?: MessageCatalogResolutionPort);
55
+ review(request: BugbotReviewRequest): Promise<readonly Result[]>;
19
56
  }
20
57
  export { evaluateBugbotFindings, evaluateBugbotQualityGate } from './tooling/bugbot_quality_eval';
21
58
  export { evaluateBugbotBenchmark, loadBugbotBenchmark, loadBugbotPredictions } from './tooling/bugbot_benchmark';
22
59
  export { buildBugbotAnalytics, parseBugbotTelemetry } from './tooling/bugbot_analytics';
23
60
  export { buildSemanticFindingFingerprint, buildFindingFingerprint } from './domain/bugbot/finding_identity';
24
61
  export { normalizeBugbotReviewConfiguration, resolveBugbotReviewEffort } from './domain/bugbot/review_configuration';
25
- export { Execution } from './data/model/execution';
26
- export { Ai } from './data/model/ai';
62
+ export { BUGBOT_FINDING_STATES, classifyBugbotFindingState, countActionableBugbotFindings, countBugbotFindingStates, isBugbotActionableState, isBugbotCleanState, } from './domain/bugbot/review_state';
63
+ export { buildBugbotReviewProjection } from './domain/bugbot/review_projection';
64
+ export { ApplicationError } from './application/errors/application_error';
65
+ export type { ApplicationErrorCode, ApplicationErrorKind, ApplicationErrorPublicRecord, } from './application/errors/application_error';
66
+ export type { AgentConfiguration } from './domain/agent';
27
67
  export type { FindingsQueryPort } from './application/ports/agent_findings_ports';
28
68
  export type { BugbotContextPorts } from './application/ports/bugbot_context_ports';
29
69
  export type { BugbotFindingPublicationPorts } from './application/ports/bugbot_finding_publication_ports';
30
70
  export type { BugbotFindingResolutionPorts } from './application/ports/bugbot_finding_resolution_ports';
71
+ export type { BugbotScmPorts } from './application/ports/bugbot_scm_ports';
72
+ export type { BugbotPresentationMutationPorts, BugbotReconciliationSnapshotPorts, } from './application/ports/bugbot_reconciliation_ports';
31
73
  export type { BugbotTelemetryPort } from './application/ports/bugbot_telemetry_ports';
74
+ export type { BugbotReviewNavigation } from './application/ports/bugbot_review_navigation_ports';
32
75
  export type { Result } from './data/model/result';
33
- export type { BugbotFinding } from './application/usecases/steps/commit/bugbot/types';
76
+ export type { BugbotFinding } from './domain/bugbot/finding';
34
77
  export type { BugbotReviewConfiguration } from './domain/bugbot/review_configuration';
35
78
  export type { BugbotReviewTelemetrySnapshot } from './application/ports/bugbot_telemetry_ports';
79
+ export type { BugbotFindingState, BugbotFindingStateCounts, BugbotFindingEvidence, BugbotResolvedFindingState, } from './domain/bugbot/review_state';
80
+ export type { BugbotProjectedFinding, BugbotProjectionOutcome, BugbotReviewProjection, } from './domain/bugbot/review_projection';
81
+ export type { PullRequestReviewReference, PullRequestReviewSummary, } from './application/ports/pull_request_review_comment_ports';
@@ -0,0 +1,10 @@
1
+ import { ApplicationError as SemanticApplicationError, type ApplicationErrorCode, type SemanticApplicationErrorOptions } from '../../data/model/application_error';
2
+ export { APPLICATION_ERROR_METADATA, APPLICATION_ERROR_RECOVERY_IDS, type ApplicationErrorCode, type ApplicationErrorKind, type ApplicationErrorPublicRecord, type ApplicationErrorRecovery, type ApplicationErrorRecoveryId, } from '../../data/model/application_error';
3
+ export interface ApplicationErrorOptions extends Omit<SemanticApplicationErrorOptions, 'correlationId'> {
4
+ readonly correlationId?: string;
5
+ }
6
+ /** Creates a semantic error and owns correlation identity outside the pure model. */
7
+ export declare class ApplicationError extends SemanticApplicationError {
8
+ constructor(code: ApplicationErrorCode, message: string, options?: ApplicationErrorOptions);
9
+ }
10
+ export declare function toApplicationError(error: unknown, code: ApplicationErrorCode, message: string, options?: Omit<ApplicationErrorOptions, 'cause'>): ApplicationError;
@@ -1,9 +1,22 @@
1
- import type { BugbotIssueReadPort } from './bugbot_issue_read_ports';
2
- import type { BugbotPullRequestReadPort } from './bugbot_pull_request_read_ports';
3
1
  import type { BugbotRuleFileQueryPort } from './bugbot_rule_ports';
4
- export interface BugbotContextPorts {
5
- issue: BugbotIssueReadPort;
6
- pullRequest: BugbotPullRequestReadPort;
7
- /** Optional for compatibility with embedders that do not expose a workspace. */
8
- rules?: BugbotRuleFileQueryPort;
2
+ import type { BugbotPullRequestIdentity, BugbotSourceCoverage } from '../../domain/bugbot/context';
3
+ import type { PullRequestReviewDiffSnapshot } from './bugbot_pull_request_read_ports';
4
+ import type { BugbotIssueComment } from './bugbot_issue_read_ports';
5
+ import type { PullRequestReviewComment, PullRequestReviewThreadState } from './pull_request_review_comment_ports';
6
+ export interface BoundedBugbotRead<T> {
7
+ readonly value: T;
8
+ readonly coverage: BugbotSourceCoverage;
9
9
  }
10
+ export interface BoundBugbotContextReadPorts {
11
+ getPullRequest(pullRequestNumber: number): Promise<BugbotPullRequestIdentity>;
12
+ findOpenPullRequestsByExactHead(headOwner: string, headRef: string): Promise<readonly BugbotPullRequestIdentity[]>;
13
+ listIssueComments(issueNumber: number): Promise<BoundedBugbotRead<readonly BugbotIssueComment[]>>;
14
+ listPullRequestReviewComments(pullRequestNumber: number): Promise<BoundedBugbotRead<readonly PullRequestReviewComment[]>>;
15
+ listPullRequestReviewThreadStates(pullRequestNumber: number): Promise<BoundedBugbotRead<Readonly<Record<string, PullRequestReviewThreadState>>>>;
16
+ getReviewDiffSnapshot(pullRequestNumber: number): Promise<BoundedBugbotRead<PullRequestReviewDiffSnapshot>>;
17
+ getPullRequestHeadSha(pullRequestNumber: number): Promise<string | undefined>;
18
+ getPullRequestReviewCommentBody(pullRequestNumber: number, commentId: number): Promise<string | null>;
19
+ loadRules(paths: readonly string[], revision?: string): ReturnType<BugbotRuleFileQueryPort['loadRules']>;
20
+ }
21
+ /** Repository-bound, credential-free context reads exposed to Bugbot use cases. */
22
+ export type BugbotContextPorts = BoundBugbotContextReadPorts;
@@ -1,7 +1,7 @@
1
- import type { BugbotIssueCommentWritePort } from "./bugbot_issue_write_ports";
2
- import type { BugbotPullRequestWritePort } from "./bugbot_pull_request_write_ports";
1
+ import type { BoundBugbotIssueCommentWritePort } from "./bugbot_issue_write_ports";
2
+ import type { BoundBugbotPullRequestWritePort } from "./bugbot_pull_request_write_ports";
3
3
  /** Minimum capabilities needed to publish or refresh findings. */
4
4
  export interface BugbotFindingPublicationPorts {
5
- issueComments: BugbotIssueCommentWritePort;
6
- pullRequestComments: BugbotPullRequestWritePort;
5
+ issueComments: BoundBugbotIssueCommentWritePort;
6
+ pullRequestComments: BoundBugbotPullRequestWritePort;
7
7
  }
@@ -1,6 +1,6 @@
1
- import type { BugbotIssueCommentUpdatePort } from "./bugbot_issue_write_ports";
2
- import type { BugbotPullRequestResolutionPort } from "./bugbot_pull_request_resolution_ports";
1
+ import type { BoundBugbotIssueCommentUpdatePort } from "./bugbot_issue_write_ports";
2
+ import type { BoundBugbotPullRequestResolutionPort } from "./bugbot_pull_request_resolution_ports";
3
3
  export interface BugbotFindingResolutionPorts {
4
- issueComments: BugbotIssueCommentUpdatePort;
5
- pullRequestComments: BugbotPullRequestResolutionPort;
4
+ issueComments: BoundBugbotIssueCommentUpdatePort;
5
+ pullRequestComments: BoundBugbotPullRequestResolutionPort;
6
6
  }
@@ -4,6 +4,9 @@ export interface BugbotIssueComment {
4
4
  user?: {
5
5
  login?: string;
6
6
  };
7
+ /** Provider-authenticated author classification; never inferred from the login. */
8
+ isAutomatedAuthor?: boolean;
9
+ createdAt?: string;
7
10
  }
8
11
  export interface BugbotIssueReadPort {
9
12
  listIssueComments(owner: string, repository: string, issueNumber: number, token: string): Promise<BugbotIssueComment[]>;
@@ -10,3 +10,15 @@ export interface BugbotIssueCommentUpdatePort {
10
10
  }
11
11
  export interface BugbotIssueCommentWritePort extends BugbotIssueCommentCreatePort, BugbotIssueCommentUpdatePort {
12
12
  }
13
+ export interface BoundBugbotIssueCommentCreatePort {
14
+ addComment(issueNumber: number, comment: string, options?: {
15
+ commitSha?: string;
16
+ }): Promise<void>;
17
+ }
18
+ export interface BoundBugbotIssueCommentUpdatePort {
19
+ updateComment(issueNumber: number, commentId: number, comment: string, options?: {
20
+ commitSha?: string;
21
+ }): Promise<void>;
22
+ }
23
+ export interface BoundBugbotIssueCommentWritePort extends BoundBugbotIssueCommentCreatePort, BoundBugbotIssueCommentUpdatePort {
24
+ }
@@ -1,4 +1,4 @@
1
- import type { PullRequestReviewComment } from "./pull_request_review_comment_ports";
1
+ import type { PullRequestReviewComment, PullRequestReviewThreadState } from "./pull_request_review_comment_ports";
2
2
  export interface PullRequestDiffLocation {
3
3
  line: number;
4
4
  side: "LEFT" | "RIGHT";
@@ -22,26 +22,12 @@ export interface PullRequestReviewDiffSnapshot {
22
22
  }>;
23
23
  }
24
24
  export interface BugbotPullRequestQueryPort {
25
- getHeadBranchForIssue(owner: string, repository: string, issueNumber: number, token: string): Promise<string | undefined>;
26
25
  getPullRequestReviewCommentBody(owner: string, repository: string, pullNumber: number, commentId: number, token: string): Promise<string | null>;
27
26
  }
28
27
  export interface BugbotPullRequestReadPort extends BugbotPullRequestQueryPort {
29
- getOpenPullRequestNumbersByHeadBranch(owner: string, repository: string, branch: string, token: string): Promise<number[]>;
30
28
  listPullRequestReviewComments(owner: string, repository: string, pullNumber: number, token: string): Promise<PullRequestReviewComment[]>;
31
29
  getPullRequestHeadSha(owner: string, repository: string, pullNumber: number, token: string): Promise<string | undefined>;
32
- getChangedFiles(owner: string, repository: string, pullNumber: number, token: string): Promise<Array<{
33
- filename: string;
34
- status: string;
35
- }>>;
36
- getFilesWithFirstDiffLine(owner: string, repository: string, pullNumber: number, token: string): Promise<Array<{
37
- path: string;
38
- firstLine: number;
39
- }>>;
40
- getFilesWithDiffLocations?(owner: string, repository: string, pullNumber: number, token: string): Promise<Array<{
41
- path: string;
42
- locations: PullRequestDiffLocation[];
43
- }>>;
44
30
  /** Loads all diff projections from one paginated GitHub request. */
45
- getReviewDiffSnapshot?(owner: string, repository: string, pullNumber: number, token: string): Promise<PullRequestReviewDiffSnapshot>;
46
- listPullRequestReviewThreadStates?(owner: string, repository: string, pullNumber: number, token: string): Promise<Record<string, boolean>>;
31
+ getReviewDiffSnapshot(owner: string, repository: string, pullNumber: number, token: string): Promise<PullRequestReviewDiffSnapshot>;
32
+ listPullRequestReviewThreadStates(owner: string, repository: string, pullNumber: number, token: string): Promise<Record<string, PullRequestReviewThreadState>>;
47
33
  }
@@ -1,3 +1,9 @@
1
- import type { PullRequestReviewCommentListQueryPort, PullRequestReviewCommentUpdatePort, PullRequestReviewThreadCommandPort } from "./pull_request_review_comment_ports";
1
+ import type { PullRequestReviewComment, PullRequestReviewCommentListQueryPort, PullRequestReviewCommentUpdatePort, PullRequestReviewThreadCommandPort } from "./pull_request_review_comment_ports";
2
2
  export interface BugbotPullRequestResolutionPort extends PullRequestReviewCommentListQueryPort, PullRequestReviewCommentUpdatePort, PullRequestReviewThreadCommandPort {
3
3
  }
4
+ export interface BoundBugbotPullRequestResolutionPort {
5
+ listPullRequestReviewComments(pullRequestNumber: number): Promise<PullRequestReviewComment[]>;
6
+ updatePullRequestReviewComment(commentIdentity: string, body: string): Promise<void>;
7
+ resolvePullRequestReviewThread(pullRequestNumber: number, commentIdentity: string): Promise<void>;
8
+ unresolvePullRequestReviewThread(pullRequestNumber: number, commentIdentity: string): Promise<void>;
9
+ }
@@ -1,4 +1,9 @@
1
- import type { PullRequestReviewCommentCommandPort, PullRequestReviewThreadCommandPort } from "./pull_request_review_comment_ports";
1
+ import type { PullRequestReviewCommentDraft, PullRequestReviewReference, PullRequestReviewCommentCommandPort, PullRequestReviewThreadCommandPort } from "./pull_request_review_comment_ports";
2
2
  /** Publication may refresh a comment and reopen its thread when a finding returns. */
3
3
  export interface BugbotPullRequestWritePort extends PullRequestReviewCommentCommandPort, Pick<PullRequestReviewThreadCommandPort, "unresolvePullRequestReviewThread"> {
4
4
  }
5
+ export interface BoundBugbotPullRequestWritePort {
6
+ createReviewWithComments(pullRequestNumber: number, commitId: string, body: string, comments: PullRequestReviewCommentDraft[]): Promise<PullRequestReviewReference | undefined>;
7
+ updatePullRequestReviewComment(commentIdentity: string, body: string): Promise<void>;
8
+ unresolvePullRequestReviewThread(pullRequestNumber: number, commentIdentity: string): Promise<void>;
9
+ }
@@ -0,0 +1,18 @@
1
+ import type { BugbotIssueComment } from './bugbot_issue_read_ports';
2
+ import type { BoundBugbotIssueCommentWritePort } from './bugbot_issue_write_ports';
3
+ import type { BugbotReviewNavigation } from './bugbot_review_navigation_ports';
4
+ import type { PullRequestReviewComment, PullRequestReviewSummary, PullRequestReviewThreadState } from './pull_request_review_comment_ports';
5
+ /** Repository-bound reads required to acquire one coherent final Bugbot snapshot. */
6
+ export interface BugbotReconciliationSnapshotPorts {
7
+ listIssueComments(issueNumber: number): Promise<BugbotIssueComment[]>;
8
+ listPullRequestReviewComments(pullRequestNumber: number): Promise<PullRequestReviewComment[]>;
9
+ listPullRequestReviewThreadStates(pullRequestNumber: number): Promise<Record<string, PullRequestReviewThreadState>>;
10
+ listPullRequestReviews(pullRequestNumber: number): Promise<PullRequestReviewSummary[]>;
11
+ getPullRequestHeadSha(pullRequestNumber: number): Promise<string | undefined>;
12
+ navigationForPullRequest(pullRequestNumber: number, headSha: string): BugbotReviewNavigation;
13
+ }
14
+ /** Repository-bound presentation mutations; credentials never enter the use case. */
15
+ export interface BugbotPresentationMutationPorts {
16
+ readonly comments: BoundBugbotIssueCommentWritePort;
17
+ updatePullRequestReview(pullRequestNumber: number, reviewIdentity: string, body: string): Promise<void>;
18
+ }
@@ -0,0 +1,13 @@
1
+ /** Provider-owned, user-facing navigation for one verified Bugbot projection. */
2
+ export interface BugbotReviewNavigation {
3
+ readonly pullRequestUrl: string;
4
+ readonly commitUrl: string;
5
+ readonly runUrl?: string;
6
+ }
7
+ /**
8
+ * Keeps provider URL construction outside the use case and presentation policy.
9
+ * Implementations must return trusted, absolute HTTPS URLs only.
10
+ */
11
+ export interface BugbotReviewNavigationPort {
12
+ forPullRequest(owner: string, repository: string, pullRequestNumber: number, headSha: string): BugbotReviewNavigation;
13
+ }
@@ -5,7 +5,7 @@ export interface BugbotReviewRule {
5
5
  readonly content: string;
6
6
  }
7
7
  export interface BugbotRuleFileQueryPort {
8
- loadRules(changedFiles: readonly string[]): Promise<readonly BugbotReviewRule[]>;
8
+ loadRules(changedFiles: readonly string[], revision?: string): Promise<readonly BugbotReviewRule[]>;
9
9
  }
10
10
  export interface BugbotLearnedRuleCommandPort {
11
11
  rememberRule(rule: string): Promise<'created' | 'existing'>;
@@ -0,0 +1,14 @@
1
+ import type { BugbotContextPorts } from './bugbot_context_ports';
2
+ import type { BugbotFindingPublicationPorts } from './bugbot_finding_publication_ports';
3
+ import type { BugbotFindingResolutionPorts } from './bugbot_finding_resolution_ports';
4
+ import type { BugbotPresentationMutationPorts, BugbotReconciliationSnapshotPorts } from './bugbot_reconciliation_ports';
5
+ /** Complete repository-bound SCM surface consumed by one Bugbot review. */
6
+ export interface BugbotScmPorts {
7
+ readonly context: BugbotContextPorts;
8
+ readonly publication: BugbotFindingPublicationPorts;
9
+ readonly resolution: BugbotFindingResolutionPorts;
10
+ readonly reconciliation: {
11
+ readonly snapshot: BugbotReconciliationSnapshotPorts;
12
+ readonly presentation: BugbotPresentationMutationPorts;
13
+ };
14
+ }
@@ -1,8 +1,10 @@
1
- export type BugbotReviewOutcome = 'completed' | 'no-findings' | 'dry-run' | 'superseded' | 'skipped' | 'failed';
1
+ export type BugbotReviewOutcome = 'completed' | 'no-findings' | 'partial' | 'dry-run' | 'superseded' | 'skipped' | 'failed';
2
2
  export interface BugbotReviewTelemetrySnapshot {
3
3
  readonly schemaVersion: 1;
4
4
  readonly reviewId: string;
5
5
  readonly repository: string;
6
+ readonly repositoryId?: number;
7
+ readonly triggerKind: string;
6
8
  readonly pullRequestNumber?: number;
7
9
  readonly headSha?: string;
8
10
  readonly publicationMode: 'publish' | 'dry-run';
@@ -19,11 +21,34 @@ export interface BugbotReviewTelemetrySnapshot {
19
21
  readonly changedFiles: number;
20
22
  readonly changedLines: number;
21
23
  readonly rulesLoaded: number;
24
+ readonly contextSelectionReason?: "event" | "exact-head" | "none";
25
+ readonly contextCandidateBucket?: "0" | "1" | "2+";
26
+ readonly contextCoverageStatus?: "complete" | "partial";
27
+ readonly contextCoverage?: Readonly<Record<string, {
28
+ readonly status: "complete" | "partial";
29
+ readonly pagesFetched: number;
30
+ readonly itemsFetched: number;
31
+ readonly itemsRetained: number;
32
+ readonly omittedItems: number;
33
+ readonly truncatedItems: number;
34
+ readonly limitReached: boolean;
35
+ readonly providerLimitReached?: boolean;
36
+ }>>;
37
+ readonly contextLogicalProviderReads: number;
38
+ readonly contextRawProviderRequests: number;
39
+ readonly contextConcurrencyLimit: 2;
40
+ readonly analysisPartitions?: number;
41
+ readonly completedAnalysisPartitions?: number;
42
+ readonly analysisDiffFragments?: number;
43
+ readonly analysisAssignedFiles?: number;
44
+ readonly maximumAnalysisConcurrency?: number;
45
+ readonly failedAnalysisPartitionOrdinal?: number;
46
+ readonly failedAnalysisPartitionCategory?: string;
22
47
  readonly candidateFindings: number;
23
48
  readonly publishedFindings: number;
24
49
  readonly overflowFindings: number;
25
50
  readonly resolvedFindings: number;
26
- readonly findingStates?: Readonly<Record<'open' | 'fixed' | 'obsolete' | 'dismissed' | 'reopened', number>>;
51
+ readonly findingStates?: Readonly<Partial<Record<import('../../domain/bugbot/review_state').BugbotFindingState, number>>>;
27
52
  readonly outcome: BugbotReviewOutcome;
28
53
  readonly errorCategory?: string;
29
54
  }
@@ -0,0 +1,17 @@
1
+ import type { AgentConfiguration } from '../../domain/agent';
2
+ import type { CatalogMessage, MessageCatalogDefinition, ResolvedMessageCatalog, CatalogResolutionObservation } from '../../domain/message_catalog';
3
+ export interface MessageCatalogResolutionRequest<Id extends string> {
4
+ readonly targetLocale: string;
5
+ readonly ids: readonly Id[];
6
+ readonly sourceCatalog: MessageCatalogDefinition<Id>;
7
+ readonly bundledCatalogs: readonly MessageCatalogDefinition<Id>[];
8
+ readonly configuration?: Readonly<AgentConfiguration>;
9
+ }
10
+ export interface MessageCatalogResolutionPort {
11
+ resolve<Id extends string>(request: MessageCatalogResolutionRequest<Id>): Promise<ResolvedMessageCatalog<Id>>;
12
+ observations?(): readonly CatalogResolutionObservation[];
13
+ }
14
+ export interface DynamicMessageCatalogResponse<Id extends string> {
15
+ readonly targetLocale: string;
16
+ readonly messages: Readonly<Record<Id, CatalogMessage>>;
17
+ }
@@ -7,6 +7,25 @@ export type PullRequestReviewComment = {
7
7
  path?: string;
8
8
  line?: number;
9
9
  authorLogin?: string;
10
+ /** Provider-authenticated author classification; never inferred from the login. */
11
+ isAutomatedAuthor?: boolean;
12
+ createdAt?: string;
13
+ /** Opaque identity of the submitted review that owns this comment. */
14
+ parentReviewIdentity?: string;
15
+ /** Safe provider URL for user-facing navigation. */
16
+ url?: string;
17
+ };
18
+ export type PullRequestReviewSummary = {
19
+ /** Lossless opaque provider identity used by mutations. */
20
+ identity: string;
21
+ body: string | null;
22
+ authorLogin?: string;
23
+ commitId?: string;
24
+ url?: string;
25
+ };
26
+ export type PullRequestReviewReference = {
27
+ identity: string;
28
+ url?: string;
10
29
  };
11
30
  export type PullRequestReviewCommentDraft = {
12
31
  path: string;
@@ -26,18 +45,28 @@ export interface PullRequestReviewCommentBodyQueryPort {
26
45
  export interface PullRequestReviewCommentQueryPort extends PullRequestReviewCommentListQueryPort, PullRequestReviewCommentBodyQueryPort {
27
46
  }
28
47
  export interface PullRequestReviewCommentCreatePort {
29
- createReviewWithComments(owner: string, repository: string, pullRequestNumber: number, commitId: string, body: string, comments: PullRequestReviewCommentDraft[], token: string): Promise<void>;
48
+ createReviewWithComments(owner: string, repository: string, pullRequestNumber: number, commitId: string, body: string, comments: PullRequestReviewCommentDraft[], token: string): Promise<PullRequestReviewReference | undefined>;
30
49
  }
31
50
  export interface PullRequestReviewCommentUpdatePort {
32
51
  updatePullRequestReviewComment(owner: string, repository: string, commentIdentity: string, body: string, token: string): Promise<void>;
33
52
  }
34
53
  export interface PullRequestReviewCommentCommandPort extends PullRequestReviewCommentCreatePort, PullRequestReviewCommentUpdatePort {
35
54
  }
55
+ export interface PullRequestReviewSummaryQueryPort {
56
+ listPullRequestReviews(owner: string, repository: string, pullRequestNumber: number, token: string): Promise<PullRequestReviewSummary[]>;
57
+ }
58
+ export interface PullRequestReviewSummaryUpdatePort {
59
+ updatePullRequestReview(owner: string, repository: string, pullRequestNumber: number, reviewIdentity: string, body: string, token: string): Promise<void>;
60
+ }
36
61
  export interface PullRequestReviewThreadCommandPort {
37
62
  resolvePullRequestReviewThread(owner: string, repository: string, pullRequestNumber: number, commentIdentity: string, token: string): Promise<void>;
38
63
  unresolvePullRequestReviewThread(owner: string, repository: string, pullRequestNumber: number, commentIdentity: string, token: string): Promise<void>;
39
64
  }
40
65
  export interface PullRequestReviewThreadStateQueryPort {
41
66
  /** Maps review-comment node identities to their parent thread resolution state. */
42
- listPullRequestReviewThreadStates(owner: string, repository: string, pullRequestNumber: number, token: string): Promise<Record<string, boolean>>;
67
+ listPullRequestReviewThreadStates(owner: string, repository: string, pullRequestNumber: number, token: string): Promise<Record<string, PullRequestReviewThreadState>>;
68
+ }
69
+ export interface PullRequestReviewThreadState {
70
+ resolved: boolean;
71
+ resolvedByLogin?: string;
43
72
  }
@@ -0,0 +1,82 @@
1
+ import { type BranchSyncValidationCode } from '../../domain/branch_sync_validation';
2
+ export type ApplicationErrorKind = 'configuration' | 'authorization' | 'provider' | 'agent' | 'validation' | 'workflow' | 'unknown';
3
+ export type ApplicationErrorCode = 'configuration.invalid' | 'configuration.unsupported' | 'authorization.denied' | 'authorization.credential-invalid' | 'provider.not-found' | 'provider.conflict' | 'provider.rate-limited' | 'provider.unavailable' | 'provider.contract-invalid' | 'agent.policy-rejected' | 'agent.failed' | 'locale.output-invalid' | 'locale.translation-failed' | 'validation.invalid-input' | 'workflow.invalid-event' | 'workflow.stale' | 'workflow.cancelled' | 'workflow.failed' | 'workflow.presentation-pending' | 'timeout' | 'unexpected';
4
+ export declare const APPLICATION_ERROR_RECOVERY_IDS: readonly ["pull-request-link-restored", "pull-request-link-base-retained", "pull-request-link-reference-retained", "pull-request-link-base-and-reference-retained", "managed-branch-enrichment-failed", "inactivity-explanation-failed", "bugbot-review-blocks-pending", "branch-sync-agent-disabled", "branch-sync-fixer-unavailable", "branch-sync-resolution-invalid", "sdd-draft-size-exceeded", "sdd-draft-format-invalid", "workspace-changes-rejected"];
5
+ export type ApplicationErrorRecoveryId = typeof APPLICATION_ERROR_RECOVERY_IDS[number];
6
+ interface ApplicationErrorRecoveryVariables {
7
+ readonly 'pull-request-link-restored': Readonly<Record<string, never>>;
8
+ readonly 'pull-request-link-base-retained': Readonly<Record<string, never>>;
9
+ readonly 'pull-request-link-reference-retained': Readonly<Record<string, never>>;
10
+ readonly 'pull-request-link-base-and-reference-retained': Readonly<Record<string, never>>;
11
+ readonly 'managed-branch-enrichment-failed': Readonly<{
12
+ branchName: string;
13
+ }>;
14
+ readonly 'inactivity-explanation-failed': Readonly<{
15
+ issueNumber: number;
16
+ }>;
17
+ readonly 'bugbot-review-blocks-pending': Readonly<{
18
+ pendingCount: number;
19
+ }>;
20
+ readonly 'branch-sync-agent-disabled': Readonly<{
21
+ command: '/copilot sync-branch';
22
+ }>;
23
+ readonly 'branch-sync-fixer-unavailable': Readonly<{
24
+ command: '/copilot sync-branch';
25
+ }>;
26
+ readonly 'branch-sync-resolution-invalid': Readonly<{
27
+ validationCode: BranchSyncValidationCode;
28
+ command: '/copilot sync-branch';
29
+ }>;
30
+ readonly 'sdd-draft-size-exceeded': Readonly<Record<string, never>>;
31
+ readonly 'sdd-draft-format-invalid': Readonly<Record<string, never>>;
32
+ readonly 'workspace-changes-rejected': Readonly<Record<string, never>>;
33
+ }
34
+ export type ApplicationErrorRecovery = {
35
+ readonly [Id in ApplicationErrorRecoveryId]: Readonly<{
36
+ id: Id;
37
+ variables: ApplicationErrorRecoveryVariables[Id];
38
+ }>;
39
+ }[ApplicationErrorRecoveryId];
40
+ interface ApplicationErrorMetadata {
41
+ readonly kind: ApplicationErrorKind;
42
+ readonly retryable: boolean;
43
+ readonly impact: string;
44
+ readonly action: string;
45
+ readonly retainedState: string;
46
+ }
47
+ export declare const APPLICATION_ERROR_METADATA: Readonly<Record<ApplicationErrorCode, ApplicationErrorMetadata>>;
48
+ export interface SemanticApplicationErrorOptions {
49
+ readonly retryable?: boolean;
50
+ readonly recovery?: ApplicationErrorRecovery;
51
+ readonly correlationId: string;
52
+ readonly cause?: unknown;
53
+ }
54
+ export interface ApplicationErrorPublicRecord {
55
+ readonly name: 'ApplicationError';
56
+ readonly message: string;
57
+ readonly code: ApplicationErrorCode;
58
+ readonly kind: ApplicationErrorKind;
59
+ readonly retryable: boolean;
60
+ readonly impact: string;
61
+ readonly action: string;
62
+ readonly retainedState: string;
63
+ readonly correlationId: string;
64
+ readonly recovery?: ApplicationErrorRecovery;
65
+ }
66
+ export declare function isApplicationErrorCorrelationId(value: string): boolean;
67
+ /** Semantic error contract whose public fields are safe to serialize and present. */
68
+ export declare class ApplicationError extends Error {
69
+ #private;
70
+ readonly name: 'ApplicationError';
71
+ readonly code: ApplicationErrorCode;
72
+ readonly kind: ApplicationErrorKind;
73
+ readonly retryable: boolean;
74
+ readonly impact: string;
75
+ readonly action: string;
76
+ readonly retainedState: string;
77
+ readonly correlationId: string;
78
+ readonly recovery?: ApplicationErrorRecovery;
79
+ constructor(code: ApplicationErrorCode, message: string, options: SemanticApplicationErrorOptions);
80
+ toJSON(): ApplicationErrorPublicRecord;
81
+ }
82
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { ApplicationError } from './application_error';
1
2
  export type ResultStepFormat = 'plain' | 'markdown';
2
3
  export interface ResultInput {
3
4
  id?: string;
@@ -6,9 +7,7 @@ export interface ResultInput {
6
7
  steps?: string[];
7
8
  payload?: unknown;
8
9
  reminders?: string[];
9
- errors?: unknown[];
10
- /** Compatibility input while callers migrate to the plural property. */
11
- error?: unknown;
10
+ errors?: readonly ApplicationError[];
12
11
  stepFormat?: ResultStepFormat;
13
12
  }
14
13
  export declare function getResultPayload(payload: unknown): Record<string, unknown> | undefined;
@@ -19,7 +18,7 @@ export declare class Result {
19
18
  steps: string[];
20
19
  payload: unknown;
21
20
  reminders: string[];
22
- errors: Error[];
21
+ readonly errors: readonly ApplicationError[];
23
22
  stepFormat: ResultStepFormat;
24
23
  constructor(data: ResultInput);
25
24
  }
@@ -3,18 +3,19 @@ export type AgentTask = 'findings' | 'fixer' | 'planner' | 'reviewer' | 'tester'
3
3
  export type AgentCapability = AgentTask | 'language';
4
4
  export declare const DEFAULT_AGENT_PROVIDER: AgentProvider;
5
5
  export declare const DEFAULT_MODEL_PROVIDER = "openai";
6
- export declare const DEFAULT_AGENT_MODEL = "gpt-5.6-luna";
6
+ export declare const DEFAULT_AGENT_MODEL = "gpt-6-luna";
7
+ export declare const AGENT_EXECUTABLE_BASENAMES: Readonly<Record<AgentProvider, string>>;
7
8
  /**
8
- * Agent configuration is the provider-neutral contract shared by the action,
9
- * CLI and infrastructure adapters. Provider-specific command flags are
10
- * derived at the boundary instead of being assembled by callers.
9
+ * Agent configuration is the provider-neutral contract shared by entrypoints
10
+ * and the execution planner. Provider argv and authority are never supplied by
11
+ * callers; each provider policy reconstructs them from these structured facts.
11
12
  */
12
13
  export interface AgentConfiguration {
13
14
  provider: AgentProvider;
14
15
  modelProvider?: string;
15
16
  model: string;
16
17
  effort?: string;
17
- command?: string;
18
+ executable?: string;
18
19
  }
19
20
  export interface AgentTaskConfiguration {
20
21
  findings: AgentConfiguration;
@@ -0,0 +1,4 @@
1
+ /** Closed diagnostic vocabulary; workspace paths and provider output stay private. */
2
+ export declare const BRANCH_SYNC_VALIDATION_CODES: readonly ["merge-state-mismatch", "head-changed", "merge-parent-changed", "unresolved-conflicts", "unexpected-paths", "unstaged-changes", "protected-index-changed", "sdd-catalog-invalid", "communication-budget-invalid", "staging-failed", "whitespace-or-conflict-markers", "parent-head-changed", "working-head-changed", "unclassified"];
3
+ export type BranchSyncValidationCode = typeof BRANCH_SYNC_VALIDATION_CODES[number];
4
+ export declare function admittedBranchSyncValidationCode(value: unknown): BranchSyncValidationCode;