@deepseek-ai/dsh-experimental-client-ui-forge 0.2.3-alpha.1 → 0.2.3-alpha.3
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.i18n.yaml +8 -8
- package/README.md +29 -12
- package/README.zh.md +29 -12
- package/lib/client.js +21 -16
- package/lib/client.js.map +1 -1
- package/lib/index.js +874 -170
- package/lib/typert.host.js +831 -156
- package/lib/typert.remote-client.d.ts +29 -11
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +727 -134
- package/lib/types/client/ActionToast.d.ts +1 -1
- package/lib/types/client/ActionToast.d.ts.map +1 -1
- package/lib/types/client/ActionToast.js.map +1 -1
- package/lib/types/client/AttentionIndicator.d.ts +1 -1
- package/lib/types/client/AttentionIndicator.d.ts.map +1 -1
- package/lib/types/client/BaseMenu.d.ts +6 -4
- package/lib/types/client/BaseMenu.d.ts.map +1 -1
- package/lib/types/client/BaseMenu.js.map +1 -1
- package/lib/types/client/BranchPicker.d.ts +84 -0
- package/lib/types/client/BranchPicker.d.ts.map +1 -0
- package/lib/types/client/BranchPicker.js.map +1 -0
- package/lib/types/client/ChangeRequestCard.d.ts +21 -12
- package/lib/types/client/ChangeRequestCard.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestCard.js.map +1 -1
- package/lib/types/client/ChangeRequestOverview.d.ts +12 -6
- package/lib/types/client/ChangeRequestOverview.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestOverview.js.map +1 -1
- package/lib/types/client/ChangeRequestsSection.d.ts +5 -3
- package/lib/types/client/ChangeRequestsSection.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestsSection.js.map +1 -1
- package/lib/types/client/ChangedFiles.d.ts +1 -1
- package/lib/types/client/ChangedFiles.d.ts.map +1 -1
- package/lib/types/client/ChangedFiles.js.map +1 -1
- package/lib/types/client/ChangesLoading.d.ts +1 -1
- package/lib/types/client/ChangesLoading.d.ts.map +1 -1
- package/lib/types/client/ChangesTab.d.ts +15 -7
- package/lib/types/client/ChangesTab.d.ts.map +1 -1
- package/lib/types/client/ChangesTab.js.map +1 -1
- package/lib/types/client/ChangesTabTitle.d.ts +1 -1
- package/lib/types/client/ChangesTabTitle.d.ts.map +1 -1
- package/lib/types/client/ChangesTabTitle.js.map +1 -1
- package/lib/types/client/CommitMenu.d.ts +3 -3
- package/lib/types/client/CommitMenu.d.ts.map +1 -1
- package/lib/types/client/CommitMenu.js.map +1 -1
- package/lib/types/client/DiffFile.d.ts +16 -2
- package/lib/types/client/DiffFile.d.ts.map +1 -1
- package/lib/types/client/DiffFile.js.map +1 -1
- package/lib/types/client/EnvironmentRows.d.ts +6 -6
- package/lib/types/client/EnvironmentRows.d.ts.map +1 -1
- package/lib/types/client/EnvironmentRows.js.map +1 -1
- package/lib/types/client/FileLabel.js.map +1 -1
- package/lib/types/client/HeadMenu.d.ts +35 -0
- package/lib/types/client/HeadMenu.d.ts.map +1 -0
- package/lib/types/client/HeadMenu.js.map +1 -0
- package/lib/types/client/HostSettings.d.ts +33 -0
- package/lib/types/client/HostSettings.d.ts.map +1 -0
- package/lib/types/client/HostSettings.js.map +1 -0
- package/lib/types/client/LensFilter.d.ts +2 -2
- package/lib/types/client/LensFilter.d.ts.map +1 -1
- package/lib/types/client/LensFilter.js.map +1 -1
- package/lib/types/client/ReasonButton.js.map +1 -1
- package/lib/types/client/RefreshGlyph.js.map +1 -1
- package/lib/types/client/ReviewComposer.d.ts +1 -1
- package/lib/types/client/ReviewComposer.d.ts.map +1 -1
- package/lib/types/client/ReviewComposer.js.map +1 -1
- package/lib/types/client/ReviewControls.d.ts +1 -1
- package/lib/types/client/ReviewControls.d.ts.map +1 -1
- package/lib/types/client/ReviewControls.js.map +1 -1
- package/lib/types/client/ReviewThread.d.ts +1 -1
- package/lib/types/client/ReviewThread.d.ts.map +1 -1
- package/lib/types/client/ReviewThread.js.map +1 -1
- package/lib/types/client/ReviewThreads.d.ts +4 -2
- package/lib/types/client/ReviewThreads.d.ts.map +1 -1
- package/lib/types/client/ReviewThreads.js.map +1 -1
- package/lib/types/client/SessionHoverForge.d.ts +1 -1
- package/lib/types/client/SessionHoverForge.d.ts.map +1 -1
- package/lib/types/client/SessionHoverForge.js.map +1 -1
- package/lib/types/client/SessionRowForge.d.ts +1 -1
- package/lib/types/client/SessionRowForge.d.ts.map +1 -1
- package/lib/types/client/SessionRowForge.js.map +1 -1
- package/lib/types/client/SubmitReview.d.ts +1 -1
- package/lib/types/client/SubmitReview.d.ts.map +1 -1
- package/lib/types/client/SubmitReview.js.map +1 -1
- package/lib/types/client/ThreadList.d.ts +3 -1
- package/lib/types/client/ThreadList.d.ts.map +1 -1
- package/lib/types/client/ThreadList.js.map +1 -1
- package/lib/types/client/ViewOptionsMenu.d.ts +1 -1
- package/lib/types/client/ViewOptionsMenu.d.ts.map +1 -1
- package/lib/types/client/ViewOptionsMenu.js.map +1 -1
- package/lib/types/client/WorktreeNameDialog.d.ts +1 -1
- package/lib/types/client/WorktreeNameDialog.d.ts.map +1 -1
- package/lib/types/client/WorktreeNameDialog.js.map +1 -1
- package/lib/types/client/WorktreeProgress.d.ts +1 -1
- package/lib/types/client/WorktreeProgress.d.ts.map +1 -1
- package/lib/types/client/WorktreeProgress.js.map +1 -1
- package/lib/types/client/WorktreeSettings.d.ts +1 -1
- package/lib/types/client/WorktreeSettings.d.ts.map +1 -1
- package/lib/types/client/WorktreeSettings.js.map +1 -1
- package/lib/types/client/WorktreeToggle.d.ts +1 -1
- package/lib/types/client/WorktreeToggle.d.ts.map +1 -1
- package/lib/types/client/WorktreeToggle.js.map +1 -1
- package/lib/types/client/annotations.d.ts +1 -1
- package/lib/types/client/annotations.d.ts.map +1 -1
- package/lib/types/client/branch-search.d.ts +1 -1
- package/lib/types/client/branch-search.d.ts.map +1 -1
- package/lib/types/client/branch-search.js.map +1 -1
- package/lib/types/client/changes-address.d.ts +1 -1
- package/lib/types/client/changes-address.d.ts.map +1 -1
- package/lib/types/client/changes-service.d.ts +1 -1
- package/lib/types/client/changes-service.d.ts.map +1 -1
- package/lib/types/client/changes-store.d.ts +18 -2
- package/lib/types/client/changes-store.d.ts.map +1 -1
- package/lib/types/client/changes-store.js.map +1 -1
- package/lib/types/client/checkout.d.ts +1 -1
- package/lib/types/client/checkout.d.ts.map +1 -1
- package/lib/types/client/code-selection.d.ts.map +1 -1
- package/lib/types/client/code-selection.js.map +1 -1
- package/lib/types/client/forge-copy.d.ts +8 -1
- package/lib/types/client/forge-copy.d.ts.map +1 -1
- package/lib/types/client/forge-copy.js.map +1 -1
- package/lib/types/client/format.d.ts +1 -1
- package/lib/types/client/format.d.ts.map +1 -1
- package/lib/types/client/format.js.map +1 -1
- package/lib/types/client/glyphs.d.ts +23 -1
- package/lib/types/client/glyphs.d.ts.map +1 -1
- package/lib/types/client/glyphs.js.map +1 -1
- package/lib/types/client/highlight-context.d.ts +1 -1
- package/lib/types/client/highlight-context.d.ts.map +1 -1
- package/lib/types/client/host-settings-form.d.ts +69 -0
- package/lib/types/client/host-settings-form.d.ts.map +1 -0
- package/lib/types/client/host-settings-form.js.map +1 -0
- package/lib/types/client/host-sign-in.d.ts +31 -0
- package/lib/types/client/host-sign-in.d.ts.map +1 -0
- package/lib/types/client/host-sign-in.js.map +1 -0
- package/lib/types/client/local-writes.d.ts +47 -0
- package/lib/types/client/local-writes.d.ts.map +1 -0
- package/lib/types/client/local-writes.js.map +1 -0
- package/lib/types/client/locales.d.ts +106 -9
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/locales.js.map +1 -1
- package/lib/types/client/mount.d.ts +15 -1
- package/lib/types/client/mount.d.ts.map +1 -1
- package/lib/types/client/mount.js.map +1 -1
- package/lib/types/client/review-page/ReviewActivity.d.ts +44 -0
- package/lib/types/client/review-page/ReviewActivity.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewActivity.js.map +1 -0
- package/lib/types/client/review-page/ReviewChat.d.ts +1 -1
- package/lib/types/client/review-page/ReviewChat.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewChat.js.map +1 -1
- package/lib/types/client/review-page/ReviewDetail.d.ts +23 -9
- package/lib/types/client/review-page/ReviewDetail.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewDetail.js.map +1 -1
- package/lib/types/client/review-page/ReviewLabels.d.ts +1 -1
- package/lib/types/client/review-page/ReviewLabels.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewLabels.js.map +1 -1
- package/lib/types/client/review-page/ReviewList.d.ts +10 -8
- package/lib/types/client/review-page/ReviewList.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewList.js.map +1 -1
- package/lib/types/client/review-page/ReviewNav.d.ts +1 -1
- package/lib/types/client/review-page/ReviewNav.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewPage.d.ts +15 -12
- package/lib/types/client/review-page/ReviewPage.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewPage.js.map +1 -1
- package/lib/types/client/review-page/ReviewSkeleton.d.ts +26 -0
- package/lib/types/client/review-page/ReviewSkeleton.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewSkeleton.js.map +1 -0
- package/lib/types/client/review-page/ReviewStatus.d.ts +5 -3
- package/lib/types/client/review-page/ReviewStatus.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewStatus.js.map +1 -1
- package/lib/types/client/review-page/review-activity.d.ts +37 -0
- package/lib/types/client/review-page/review-activity.d.ts.map +1 -0
- package/lib/types/client/review-page/review-activity.js.map +1 -0
- package/lib/types/client/review-page/review-lists.d.ts +48 -13
- package/lib/types/client/review-page/review-lists.d.ts.map +1 -1
- package/lib/types/client/review-page/review-lists.js.map +1 -1
- package/lib/types/client/review-page/review-mount.d.ts +3 -1
- package/lib/types/client/review-page/review-mount.d.ts.map +1 -1
- package/lib/types/client/review-page/review-mount.js.map +1 -1
- package/lib/types/client/review-page/review-store.d.ts +18 -8
- package/lib/types/client/review-page/review-store.d.ts.map +1 -1
- package/lib/types/client/review-page/review-store.js.map +1 -1
- package/lib/types/client/review-queue.d.ts +1 -1
- package/lib/types/client/review-queue.d.ts.map +1 -1
- package/lib/types/client/review-queue.js.map +1 -1
- package/lib/types/client/review-threads.d.ts +1 -1
- package/lib/types/client/review-threads.d.ts.map +1 -1
- package/lib/types/client/review.d.ts +12 -1
- package/lib/types/client/review.d.ts.map +1 -1
- package/lib/types/client/review.js.map +1 -1
- package/lib/types/client/row-form-labels.d.ts +12 -0
- package/lib/types/client/row-form-labels.d.ts.map +1 -0
- package/lib/types/client/row-form-labels.js.map +1 -0
- package/lib/types/client/session-list.d.ts +1 -1
- package/lib/types/client/session-list.d.ts.map +1 -1
- package/lib/types/client/slots.d.ts +1 -1
- package/lib/types/client/slots.d.ts.map +1 -1
- package/lib/types/client/source.d.ts +1 -1
- package/lib/types/client/source.d.ts.map +1 -1
- package/lib/types/client/status.d.ts +7 -0
- package/lib/types/client/status.d.ts.map +1 -1
- package/lib/types/client/status.js.map +1 -1
- package/lib/types/client/worktree-settings-form.d.ts +1 -1
- package/lib/types/client/worktree-settings-form.d.ts.map +1 -1
- package/lib/types/client/worktree-settings-form.js.map +1 -1
- package/lib/types/diff.d.ts.map +1 -1
- package/lib/types/diff.js.map +1 -1
- package/lib/types/git.d.ts +22 -0
- package/lib/types/git.d.ts.map +1 -1
- package/lib/types/git.js.map +1 -1
- package/lib/types/index.d.ts +113 -25
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/local-diff.d.ts +81 -23
- package/lib/types/local-diff.d.ts.map +1 -1
- package/lib/types/local-diff.js.map +1 -1
- package/lib/types/local-write.d.ts +44 -0
- package/lib/types/local-write.d.ts.map +1 -0
- package/lib/types/local-write.js.map +1 -0
- package/lib/types/parse.d.ts +12 -3
- package/lib/types/parse.d.ts.map +1 -1
- package/lib/types/parse.js.map +1 -1
- package/lib/types/restore.d.ts +12 -0
- package/lib/types/restore.d.ts.map +1 -0
- package/lib/types/restore.js.map +1 -0
- package/lib/types/types.d.ts +106 -8
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/viewer-lists.d.ts +22 -13
- package/lib/types/viewer-lists.d.ts.map +1 -1
- package/lib/types/viewer-lists.js.map +1 -1
- package/package.json +60 -58
- package/src/client/ActionToast.tsx +2 -2
- package/src/client/AttentionIndicator.tsx +1 -1
- package/src/client/BaseMenu.module.css +12 -3
- package/src/client/BaseMenu.tsx +25 -88
- package/src/client/BranchPicker.tsx +161 -0
- package/src/client/ChangeRequestCard.tsx +138 -44
- package/src/client/ChangeRequestOverview.tsx +21 -9
- package/src/client/ChangeRequestsSection.tsx +12 -6
- package/src/client/ChangedFiles.tsx +2 -2
- package/src/client/ChangesLoading.tsx +1 -1
- package/src/client/ChangesTab.module.css +95 -16
- package/src/client/ChangesTab.tsx +190 -72
- package/src/client/ChangesTabTitle.tsx +2 -2
- package/src/client/CommitMenu.tsx +7 -5
- package/src/client/DiffFile.tsx +67 -11
- package/src/client/EnvironmentRows.tsx +21 -17
- package/src/client/FileLabel.tsx +1 -1
- package/src/client/Forge.module.css +28 -1
- package/src/client/HeadMenu.tsx +69 -0
- package/src/client/HostSettings.module.css +194 -0
- package/src/client/HostSettings.tsx +192 -0
- package/src/client/LensFilter.tsx +2 -2
- package/src/client/ReasonButton.tsx +1 -1
- package/src/client/RefreshGlyph.tsx +1 -1
- package/src/client/ReviewComposer.tsx +2 -2
- package/src/client/ReviewControls.tsx +10 -3
- package/src/client/ReviewThread.tsx +2 -2
- package/src/client/ReviewThreads.tsx +7 -4
- package/src/client/SessionHoverForge.tsx +2 -2
- package/src/client/SessionRowForge.tsx +2 -2
- package/src/client/SubmitReview.tsx +2 -2
- package/src/client/ThreadList.tsx +6 -3
- package/src/client/ViewOptionsMenu.tsx +2 -2
- package/src/client/WorktreeNameDialog.tsx +2 -2
- package/src/client/WorktreeProgress.tsx +2 -2
- package/src/client/WorktreeSettings.tsx +4 -11
- package/src/client/WorktreeToggle.tsx +2 -2
- package/src/client/annotations.ts +1 -1
- package/src/client/branch-search.tsx +2 -2
- package/src/client/changes-address.ts +1 -1
- package/src/client/changes-service.ts +1 -1
- package/src/client/changes-store.ts +49 -5
- package/src/client/checkout.ts +1 -1
- package/src/client/code-selection.ts +3 -1
- package/src/client/forge-copy.ts +11 -1
- package/src/client/format.ts +2 -2
- package/src/client/glyphs.tsx +50 -5
- package/src/client/highlight-context.ts +1 -1
- package/src/client/host-settings-form.ts +115 -0
- package/src/client/host-sign-in.ts +46 -0
- package/src/client/local-writes.ts +129 -0
- package/src/client/locales.ts +841 -65
- package/src/client/mount.ts +56 -7
- package/src/client/review-page/ReviewActivity.tsx +405 -0
- package/src/client/review-page/ReviewChat.tsx +2 -2
- package/src/client/review-page/ReviewDetail.tsx +201 -64
- package/src/client/review-page/ReviewLabels.tsx +2 -2
- package/src/client/review-page/ReviewList.tsx +153 -136
- package/src/client/review-page/ReviewNav.tsx +1 -1
- package/src/client/review-page/ReviewPage.module.css +490 -13
- package/src/client/review-page/ReviewPage.tsx +44 -21
- package/src/client/review-page/ReviewSkeleton.tsx +108 -0
- package/src/client/review-page/ReviewStatus.tsx +14 -9
- package/src/client/review-page/review-activity.ts +64 -0
- package/src/client/review-page/review-lists.ts +85 -22
- package/src/client/review-page/review-mount.ts +24 -7
- package/src/client/review-page/review-store.ts +24 -7
- package/src/client/review-queue.ts +7 -3
- package/src/client/review-threads.ts +1 -1
- package/src/client/review.ts +20 -2
- package/src/client/row-form-labels.ts +17 -0
- package/src/client/session-list.ts +1 -1
- package/src/client/slots.ts +1 -1
- package/src/client/source.ts +1 -1
- package/src/client/status.ts +20 -0
- package/src/client/worktree-settings-form.ts +1 -1
- package/src/diff.ts +8 -5
- package/src/git.ts +31 -1
- package/src/index.ts +241 -50
- package/src/local-diff.ts +151 -48
- package/src/local-write.ts +159 -0
- package/src/parse.ts +26 -4
- package/src/restore.ts +15 -0
- package/src/types.ts +97 -12
- package/src/viewer-lists.ts +124 -48
package/src/index.ts
CHANGED
|
@@ -6,11 +6,12 @@ import type { Agent } from '@deepseek-ai/dsh-agent'
|
|
|
6
6
|
import type {} from '@deepseek-ai/dsh-api-remote-access'
|
|
7
7
|
import { changeRequestKey } from '@deepseek-ai/dsh-experimental-forge'
|
|
8
8
|
import type {
|
|
9
|
-
BranchUpdateMethod, ChangeRequestDescription, ChangeRequestKey, ChangeRequestRef,
|
|
10
|
-
|
|
9
|
+
AutoMergeRequest, BranchUpdateMethod, ChangeRequestActivity, ChangeRequestDescription, ChangeRequestKey, ChangeRequestRef,
|
|
10
|
+
ChangeRequestReviewer,
|
|
11
|
+
ChangeRequestSnapshot, ChangeRequestUpdate, ForgeActionFailure, ForgeCommitList,
|
|
11
12
|
ForgeFailure,
|
|
12
|
-
ForgeLineComment, ForgeRerunRequest, ForgeReviewChange, ForgeReviewData, ForgeReviewerCandidate, ForgeReviewRequest,
|
|
13
|
-
ForgeReviewWrite, ForgeReviewWriteResult, ForgeViewedFiles, ForgeViewedRequest, MergeMethod,
|
|
13
|
+
ForgeLineComment, ForgeReadiness, ForgeRerunRequest, ForgeReviewChange, ForgeReviewData, ForgeReviewerCandidate, ForgeReviewRequest,
|
|
14
|
+
ForgeReviewResult, ForgeReviewWrite, ForgeReviewWriteResult, ForgeViewedFiles, ForgeViewedRequest, MergeMethod,
|
|
14
15
|
} from '@deepseek-ai/dsh-experimental-forge'
|
|
15
16
|
import type { SessionChangeRequest } from '@deepseek-ai/dsh-experimental-forge-session'
|
|
16
17
|
import type { WorktreeCleanup } from '@deepseek-ai/dsh-experimental-worktree/types'
|
|
@@ -19,18 +20,19 @@ import type { Session, SessionEvent, SessionId, UserMessage } from '@deepseek-ai
|
|
|
19
20
|
import type { ProjectionHandle } from '@deepseek-ai/dsh-session-projection'
|
|
20
21
|
import type {} from '@deepseek-ai/dsh-session-projection-cache'
|
|
21
22
|
import type {} from '@deepseek-ai/dsh-session-query'
|
|
22
|
-
import { MAX_TIMER_DELAY_MS } from '@deepseek-ai/dsh-timeout'
|
|
23
|
+
import { deadline, MAX_TIMER_DELAY_MS } from '@deepseek-ai/dsh-timeout'
|
|
23
24
|
import { Remote, RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol'
|
|
24
25
|
import { assertNever } from '@deepseek-ai/dsh-util-values'
|
|
25
26
|
import { gitIn, hasBranch, inspectCheckout } from './git.ts'
|
|
26
27
|
import type { Inspection } from './git.ts'
|
|
27
|
-
import { branchNameProblem } from './branch-name.ts'
|
|
28
|
+
import { branchNameProblem, LOCAL_REF_PREFIX } from './branch-name.ts'
|
|
28
29
|
import { parseDiff } from './diff.ts'
|
|
29
30
|
import {
|
|
30
|
-
aheadOf, BaseMissing,
|
|
31
|
-
localCommits, localDiff, localOldText, localText, NoForkPoint,
|
|
31
|
+
aheadOf, baseBranches, BaseMissing, branchTip, branchWorktrees, chosenForkPoint, CommitsMissing, CommitsNotLinear, DiffTooLarge,
|
|
32
|
+
FilterConfigError, forkPoint, HeadMissing, localCommits, localDiff, localOldText, localText, NoForkPoint, sessionHead,
|
|
32
33
|
} from './local-diff.ts'
|
|
33
|
-
import type { ForkPoint } from './local-diff.ts'
|
|
34
|
+
import type { ForkPoint, SessionHead } from './local-diff.ts'
|
|
35
|
+
import { LocalChangesStale, LocalPathReplaced, localWrite } from './local-write.ts'
|
|
34
36
|
import { LensCache, LensFailed, lensFrames, LensRegistry, LensWithdrawn, runLens } from './lenses.ts'
|
|
35
37
|
import type { LensSubject } from './lenses.ts'
|
|
36
38
|
import { lensVersion } from './lens-version.ts'
|
|
@@ -45,8 +47,9 @@ import { Reader, ViewerLists } from './viewer-lists.ts'
|
|
|
45
47
|
import type { KeptPanel, PanelConfig } from './panel.ts'
|
|
46
48
|
import type {
|
|
47
49
|
Config, ForgeBaseBranches, ForgeChangeRequestDiff, ForgeChangeRequestStatesFrame, ForgeCommitRange, ForgeDiffFile,
|
|
48
|
-
ForgeReviewChangeRequest, ForgeReviewCountFrame, ForgeReviewFrame,
|
|
50
|
+
ForgeReviewChangeRequest, ForgeReviewCountFrame, ForgeReviewFrame, ForgeReviewRepository,
|
|
49
51
|
ForgeExtensionState, ForgeLens, ForgeLensFrame, ForgeLensRequest, ForgeLocalCommits, ForgeLocalDiff, ForgeLocalScope,
|
|
52
|
+
ForgeLocalWrite, ForgeLocalWriteResult,
|
|
50
53
|
ForgeMissingWorktree, ForgePanelState, ForgeSessionWorktree, ForgeWorktreeBases, ForgeWorktreeState,
|
|
51
54
|
} from './types.ts'
|
|
52
55
|
import { forgeWorktreeProjection, messageOf, within, WORKTREE_RECORD, WorktreeCreations } from './worktree.ts'
|
|
@@ -61,6 +64,23 @@ declare module '@deepseek-ai/cordis' {
|
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
|
|
67
|
+
/** What a local read targets. */
|
|
68
|
+
interface LocalTarget {
|
|
69
|
+
/** The checkout Git runs in: the Session's own, or the worktree that has the head branch checked out. */
|
|
70
|
+
readonly inspection: Inspection
|
|
71
|
+
/** The worktree the Session created, while the read targets its own checkout; it fixes the automatic fork point. */
|
|
72
|
+
readonly created: ForgeSessionWorktree | null
|
|
73
|
+
/** `HEAD` for the checkout's working tree, or the verified ref of a head branch read from its commits. */
|
|
74
|
+
readonly tip: string
|
|
75
|
+
/** Top-level directory of the head branch's worktree, or null for the Session's own checkout and a head read from its commits. */
|
|
76
|
+
readonly worktree: string | null
|
|
77
|
+
/**
|
|
78
|
+
* The Session's own HEAD, which a head branch is compared with while no base branch is chosen; null for the
|
|
79
|
+
* Session's own checkout, and while its checked-out branch has no commit.
|
|
80
|
+
*/
|
|
81
|
+
readonly against: SessionHead | null
|
|
82
|
+
}
|
|
83
|
+
|
|
64
84
|
/** A change request a read or action addresses, with its latest polling result. */
|
|
65
85
|
interface ChangeRequestTarget {
|
|
66
86
|
readonly ref: ChangeRequestRef
|
|
@@ -196,6 +216,7 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
196
216
|
sources: () => ctx.forge.viewerSources(),
|
|
197
217
|
list: async (forge, query, signal) => await ctx.forge.listForViewer(forge, query, signal),
|
|
198
218
|
count: async (forge, host, signal) => await ctx.forge.countForViewer(forge, host, signal),
|
|
219
|
+
signIn: async (forge, host, signal) => (await ctx.forge.readiness({ forge, host }, signal)).signIn?.command ?? null,
|
|
199
220
|
report: (error) => { ctx.logger.warn(`forge-panel: reading a review list failed: ${String(error)}`) },
|
|
200
221
|
}, {
|
|
201
222
|
listIntervalMs: resolved.reviewListIntervalMs,
|
|
@@ -287,15 +308,17 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
287
308
|
/**
|
|
288
309
|
* Stream the review page's lists of the signed-in user's open change requests on every host a provider lists them on:
|
|
289
310
|
* the lists read so far first, then a frame after each read settles. Readers of one repository scope share one
|
|
290
|
-
* reader, which reads every `reviewListIntervalMs` while some stream lasts and
|
|
291
|
-
*
|
|
292
|
-
*
|
|
311
|
+
* reader, which reads each host every `reviewListIntervalMs` while some stream lasts and reads a host whose read failed
|
|
312
|
+
* again later each time, up to `reviewMaxBackoffMs`, without delaying the other hosts; nothing is read while no stream
|
|
313
|
+
* lasts. The stream ends when `signal` aborts or the Remote stops.
|
|
314
|
+
* @param repository - one repository to list in, read on its host only, or null for every repository the user can
|
|
315
|
+
* read on every host.
|
|
293
316
|
* @param signal - ends the stream.
|
|
294
317
|
* @returns frames, each complete.
|
|
295
318
|
*/
|
|
296
319
|
@Remote({ mode: 'stream' })
|
|
297
320
|
async *reviewLists(
|
|
298
|
-
repository:
|
|
321
|
+
repository: ForgeReviewRepository | null, signal: AbortSignal,
|
|
299
322
|
): AsyncIterable<ForgeReviewFrame> {
|
|
300
323
|
yield* this.viewerLists.lists(repository, signal)
|
|
301
324
|
}
|
|
@@ -323,6 +346,28 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
323
346
|
this.viewerLists.refresh()
|
|
324
347
|
}
|
|
325
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Report whether a provider reaches one of its hosts with the Host's current credentials, for the host list on the
|
|
351
|
+
* Plugins page of that provider's row. The read names no Session, so, like the review page reads, only callers that
|
|
352
|
+
* may use the Host's code host credentials reach it.
|
|
353
|
+
* @param forge - forge family of a registered provider, such as `gitlab`.
|
|
354
|
+
* @param host - host name as the provider's configuration lists it.
|
|
355
|
+
* @param signal - request cancellation.
|
|
356
|
+
* @returns the provider's readiness for the host; `unavailable` with the reason when no provider serves the family,
|
|
357
|
+
* the probe fails, or it runs past `readinessTimeoutMs`.
|
|
358
|
+
*/
|
|
359
|
+
@Remote
|
|
360
|
+
async hostReadiness(forge: string, host: string, signal: AbortSignal): Promise<ForgeReadiness> {
|
|
361
|
+
signal.throwIfAborted()
|
|
362
|
+
try {
|
|
363
|
+
using timeout = deadline(signal, this.config.readinessTimeoutMs, 'FORGE_PANEL_READINESS_TIMEOUT')
|
|
364
|
+
return await this.home.forge.readiness({ forge, host: host.toLowerCase() }, timeout.signal)
|
|
365
|
+
} catch (error) {
|
|
366
|
+
signal.throwIfAborted()
|
|
367
|
+
return { state: 'unavailable', message: messageOf(error), signIn: null }
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
326
371
|
/**
|
|
327
372
|
* Poll one change request the review page shows at once; its stream reports the result.
|
|
328
373
|
* @param url - web URL of the change request.
|
|
@@ -391,6 +436,41 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
391
436
|
return result
|
|
392
437
|
}
|
|
393
438
|
|
|
439
|
+
/**
|
|
440
|
+
* Read the activity of a change request for the review page: its comments, submitted reviews, commits, and changes
|
|
441
|
+
* of state.
|
|
442
|
+
* @param url - web URL of the change request.
|
|
443
|
+
* @param signal - request cancellation.
|
|
444
|
+
* @returns the activity, or null when the change request's provider reads none.
|
|
445
|
+
* @throws `forgePanel/unrecognized-url` when no provider serves the URL; `forgePanel/activity-failed` with the
|
|
446
|
+
* host's reason when the host does not provide it.
|
|
447
|
+
*/
|
|
448
|
+
@Remote
|
|
449
|
+
async reviewActivity(url: string, signal: AbortSignal): Promise<ChangeRequestActivity | null> {
|
|
450
|
+
signal.throwIfAborted()
|
|
451
|
+
const result = await this.home.forge.readActivity(this.served(url).ref, signal)
|
|
452
|
+
if (!('code' in result)) return result
|
|
453
|
+
if (result.code === 'unsupported') return null
|
|
454
|
+
throw new RemoteError('forgePanel/activity-failed', result.message, {})
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Add a comment to the conversation of a change request the review page shows.
|
|
459
|
+
* @param url - web URL of the change request.
|
|
460
|
+
* @param body - Markdown source of the comment.
|
|
461
|
+
* @param signal - request cancellation.
|
|
462
|
+
* @throws `forgePanel/unrecognized-url` when no provider serves the URL; `forgePanel/action-failed` when `body` is
|
|
463
|
+
* blank, or with the host's reason; `forgePanel/action-unknown` when the host's answer did not confirm the comment.
|
|
464
|
+
*/
|
|
465
|
+
@Remote
|
|
466
|
+
async reviewComment(url: string, body: string, signal: AbortSignal): Promise<void> {
|
|
467
|
+
signal.throwIfAborted()
|
|
468
|
+
const { ref } = this.served(url)
|
|
469
|
+
if (body.trim() === '') throw new RemoteError('forgePanel/action-failed', 'The comment is empty', {})
|
|
470
|
+
const failure = await this.home.forge.addComment(ref, body, signal)
|
|
471
|
+
if (failure !== undefined) throw actionError(failure)
|
|
472
|
+
}
|
|
473
|
+
|
|
394
474
|
/**
|
|
395
475
|
* Read every check of a change request the review page shows.
|
|
396
476
|
* @param url - web URL of the change request.
|
|
@@ -560,6 +640,22 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
560
640
|
if (failure !== undefined) throw actionError(failure)
|
|
561
641
|
}
|
|
562
642
|
|
|
643
|
+
/**
|
|
644
|
+
* Turn the code host's automatic merge of a change request the review page shows on, while its head is still the
|
|
645
|
+
* request's `headSha`, or off.
|
|
646
|
+
* @param url - web URL of the change request.
|
|
647
|
+
* @param request - on with the merge method and the head commit the user confirmed, or off.
|
|
648
|
+
* @param signal - request cancellation.
|
|
649
|
+
* @throws `forgePanel/unrecognized-url` when no provider serves the URL; `forgePanel/stale-head`,
|
|
650
|
+
* `forgePanel/action-failed`, or `forgePanel/action-unknown` with the host's reason.
|
|
651
|
+
*/
|
|
652
|
+
@Remote
|
|
653
|
+
async reviewSetAutoMerge(url: string, request: AutoMergeRequest, signal: AbortSignal): Promise<void> {
|
|
654
|
+
signal.throwIfAborted()
|
|
655
|
+
const failure = await this.home.forge.setAutoMerge(this.served(url).ref, request, signal)
|
|
656
|
+
if (failure !== undefined) throw actionError(failure)
|
|
657
|
+
}
|
|
658
|
+
|
|
563
659
|
/**
|
|
564
660
|
* Rerun the failed checks of a change request the review page shows.
|
|
565
661
|
* @param url - web URL of the change request.
|
|
@@ -674,21 +770,26 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
674
770
|
}
|
|
675
771
|
|
|
676
772
|
/**
|
|
677
|
-
* List the branches the `branch` scope
|
|
773
|
+
* List the branches the `branch` scope can compare with, for the Session's current checkout or for a head branch
|
|
774
|
+
* read in its place.
|
|
678
775
|
* @param session - Session whose checkout is read.
|
|
776
|
+
* @param head - full ref of the branch the scope reads in place of the checked-out one, or null for the checkout.
|
|
679
777
|
* @param query - text the branch names must contain, ignoring case; empty for every branch.
|
|
680
778
|
* @param signal - request cancellation.
|
|
681
779
|
* @returns the automatic fork point and at most `maxBranches` remote-tracking and local branches each,
|
|
682
|
-
* most recently committed first, without the
|
|
683
|
-
*
|
|
780
|
+
* most recently committed first, without the branch the scope shows and, for a head, without the Session's
|
|
781
|
+
* checked-out branch, which the automatic fork point compares with; a local branch that a worktree has checked
|
|
782
|
+
* out names that worktree's directory.
|
|
783
|
+
* @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/head-missing` when the head does not exist; the
|
|
784
|
+
* Git error when Git fails or the listed refs exceed `maxDiffBytes`.
|
|
684
785
|
*/
|
|
685
786
|
@Remote
|
|
686
|
-
async diffBases(session: Session, query: string, signal: AbortSignal): Promise<ForgeBaseBranches> {
|
|
787
|
+
async diffBases(session: Session, head: string | null, query: string, signal: AbortSignal): Promise<ForgeBaseBranches> {
|
|
687
788
|
signal.throwIfAborted()
|
|
688
|
-
const inspection = await this.
|
|
789
|
+
const { inspection, created, tip, against } = await this.localTarget(session, head, false, signal)
|
|
689
790
|
// A search can match any branch, so every ref is listed; a repository's refs can far exceed other short Git output.
|
|
690
791
|
const git = gitIn(this.home, { ...this.config, maxOutputBytes: this.config.maxDiffBytes }, session, inspection.checkout.root, signal)
|
|
691
|
-
return await baseBranches(git, inspection,
|
|
792
|
+
return await baseBranches(git, inspection, created, query, this.config.maxBranches, tip, against)
|
|
692
793
|
}
|
|
693
794
|
|
|
694
795
|
/* oxlint-disable typescript/require-await -- async keeps a refused or cancelled request a rejection, as Remote callers expect */
|
|
@@ -749,13 +850,15 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
749
850
|
}
|
|
750
851
|
|
|
751
852
|
/**
|
|
752
|
-
* Read the changes one scope covers in the checkout of the Session's
|
|
753
|
-
*
|
|
853
|
+
* Read the changes one scope covers in the checkout of the Session's current directory, or for the head branch the
|
|
854
|
+
* scope names: in the worktree that has it checked out, else from its commits. Git uses the Session's sandbox policy.
|
|
754
855
|
* @param session - Session whose checkout is read.
|
|
755
856
|
* @param scope - which changes to read.
|
|
756
857
|
* @param signal - request cancellation.
|
|
757
|
-
* @returns the files, the base of the `branch` scope,
|
|
758
|
-
* @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/
|
|
858
|
+
* @returns the files, the base of the `branch` scope, the untracked files left out, and the worktree read for a head.
|
|
859
|
+
* @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/head-missing` when the head the scope names
|
|
860
|
+
* does not exist; `forgePanel/no-working-tree` for another scope than `branch` whose head no worktree has checked
|
|
861
|
+
* out; `forgePanel/base-missing` when the base branch
|
|
759
862
|
* chosen for the `branch` scope does not exist; `forgePanel/no-fork-point` for the `branch` scope without
|
|
760
863
|
* a fork point; `forgePanel/commits-missing` when chosen commits are not between the fork point and HEAD in order;
|
|
761
864
|
* `forgePanel/commits-not-linear` when a chosen commit's first parent is not the commit listed before it;
|
|
@@ -765,54 +868,88 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
765
868
|
@Remote
|
|
766
869
|
async localDiff(session: Session, scope: ForgeLocalScope, signal: AbortSignal): Promise<ForgeLocalDiff> {
|
|
767
870
|
signal.throwIfAborted()
|
|
768
|
-
const
|
|
871
|
+
const target = await this.localTarget(session, scope.head ?? null, scope.kind !== 'branch', signal)
|
|
872
|
+
const { inspection, created, tip, worktree, against } = target
|
|
769
873
|
const root = inspection.checkout.root
|
|
770
874
|
const git = gitIn(this.home, this.config, session, root, signal)
|
|
771
|
-
const created = this.worktreeState(session).created
|
|
772
875
|
const fork = scope.kind !== 'branch' ? null
|
|
773
|
-
: await diffing(scope.base === null ? forkPoint(git, inspection, created) : chosenForkPoint(git, scope.base))
|
|
774
|
-
|
|
876
|
+
: await diffing(scope.base === null ? forkPoint(git, inspection, created, tip, against) : chosenForkPoint(git, scope.base, tip))
|
|
877
|
+
const diff = await diffing(localDiff(this.home, this.config, session, root, fork, scope, this.layers, signal, tip))
|
|
878
|
+
return worktree === null ? diff : { ...diff, worktree }
|
|
775
879
|
}
|
|
776
880
|
|
|
777
881
|
/**
|
|
778
|
-
* List the commits of the `branch` scope of the Session's current checkout
|
|
779
|
-
* several of instead of the whole scope.
|
|
882
|
+
* List the commits of the `branch` scope of the Session's current checkout or of a head branch read in its place,
|
|
883
|
+
* which the changes view can show one or several of instead of the whole scope.
|
|
780
884
|
* @param session - Session whose checkout is read.
|
|
885
|
+
* @param head - full ref of the branch the scope reads in place of the checked-out one, or null for the checkout.
|
|
781
886
|
* @param base - the base ref of the `branch` scope, or null for its automatic fork point.
|
|
782
887
|
* @param signal - request cancellation.
|
|
783
|
-
* @returns the newest `maxCommits` commits between the fork point and HEAD, oldest first, and
|
|
784
|
-
* @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/
|
|
785
|
-
* exist; `forgePanel/no-fork-point` without a fork point;
|
|
888
|
+
* @returns the newest `maxCommits` commits between the fork point and the shown HEAD or branch, oldest first, and its commit.
|
|
889
|
+
* @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/head-missing` when the head does not exist;
|
|
890
|
+
* `forgePanel/base-missing` when the base branch does not exist; `forgePanel/no-fork-point` without a fork point;
|
|
891
|
+
* the Git error when Git fails or the listing exceeds `maxDiffBytes`.
|
|
786
892
|
*/
|
|
787
893
|
@Remote
|
|
788
|
-
async localCommits(session: Session, base: string | null, signal: AbortSignal): Promise<ForgeLocalCommits> {
|
|
894
|
+
async localCommits(session: Session, head: string | null, base: string | null, signal: AbortSignal): Promise<ForgeLocalCommits> {
|
|
789
895
|
signal.throwIfAborted()
|
|
790
|
-
const inspection = await this.
|
|
896
|
+
const { inspection, created, tip, against } = await this.localTarget(session, head, false, signal)
|
|
791
897
|
const git = gitIn(this.home, { ...this.config, maxOutputBytes: this.config.maxDiffBytes }, session, inspection.checkout.root, signal)
|
|
792
|
-
const
|
|
793
|
-
const fork = await diffing(base === null ? forkPoint(git, inspection, created) : chosenForkPoint(git, base))
|
|
898
|
+
const fork = await diffing(base === null ? forkPoint(git, inspection, created, tip, against) : chosenForkPoint(git, base, tip))
|
|
794
899
|
if (fork === null) throw new RemoteError('forgePanel/no-fork-point', 'The checkout has no fork point to compare its branch with', {})
|
|
795
|
-
return await localCommits(git, fork, this.config.maxCommits)
|
|
900
|
+
return await localCommits(git, fork, this.config.maxCommits, tip)
|
|
796
901
|
}
|
|
797
902
|
|
|
798
903
|
/**
|
|
799
904
|
* Read the new side of one changed file in a scope, which supplies the
|
|
800
905
|
* unchanged lines between its hunks: the index for `staged`, the last chosen commit for chosen commits of
|
|
801
|
-
* the `branch` scope, else the working tree.
|
|
906
|
+
* the `branch` scope, the branch for a head read from its commits, else the working tree of the checkout the scope reads.
|
|
802
907
|
* @param session - Session whose checkout is read.
|
|
803
908
|
* @param scope - the scope the diff was read in.
|
|
804
909
|
* @param path - path relative to the checkout's top-level directory, as the diff names it.
|
|
805
910
|
* @param signal - request cancellation.
|
|
806
911
|
* @returns the text.
|
|
807
|
-
* @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/
|
|
912
|
+
* @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/head-missing` and `forgePanel/no-working-tree`
|
|
913
|
+
* as for {@link ForgePanelController.localDiff}; `forgePanel/diff-too-large` over `maxDiffBytes`;
|
|
808
914
|
* `forgePanel/commits-missing` for a chosen commit that is not a full object name; an error for a path outside
|
|
809
915
|
* the checkout, binary content, or a failed read.
|
|
810
916
|
*/
|
|
811
917
|
@Remote
|
|
812
918
|
async localText(session: Session, scope: ForgeLocalScope, path: string, signal: AbortSignal): Promise<string> {
|
|
919
|
+
signal.throwIfAborted()
|
|
920
|
+
const { inspection, tip } = await this.localTarget(session, scope.head ?? null, scope.kind !== 'branch', signal)
|
|
921
|
+
return await diffing(localText(this.home, this.config, session, inspection.checkout.root, scope, path, signal, tip))
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Stage, unstage, or restore whole files in the checkout of the Session's current directory, or return index
|
|
926
|
+
* entries to the tree an earlier write reported. The caller's press authorizes the write, so Git runs without the
|
|
927
|
+
* Session's sandbox policy and under any access mode. The Session's panel inspects the checkout again afterwards,
|
|
928
|
+
* whether or not the write succeeded.
|
|
929
|
+
* @param session - Session whose checkout is written.
|
|
930
|
+
* @param write - the write; `stage` and `restore` name each file with the digest of the change the reader saw.
|
|
931
|
+
* @param signal - request cancellation.
|
|
932
|
+
* @returns the index before a `stage` or `unstage` as a tree, for undoing it.
|
|
933
|
+
* @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/local-stale` before anything is written when a
|
|
934
|
+
* file's unstaged change is not the one the reader saw; `forgePanel/local-path-replaced` before anything is written
|
|
935
|
+
* when a deleted file's path holds a directory; the errors of {@link ForgePanelController.localDiff} for the
|
|
936
|
+
* `unstaged` scope; an error for a path outside the checkout, a tree that is not a full object name, a restore of a
|
|
937
|
+
* submodule or of a file without index content, or a Git failure.
|
|
938
|
+
*/
|
|
939
|
+
@Remote
|
|
940
|
+
async localWrite(session: Session, write: ForgeLocalWrite, signal: AbortSignal): Promise<ForgeLocalWriteResult> {
|
|
813
941
|
signal.throwIfAborted()
|
|
814
942
|
const inspection = await this.checkoutOf(session, signal)
|
|
815
|
-
|
|
943
|
+
try {
|
|
944
|
+
return await diffing(localWrite(this.home, this.config, session, inspection.checkout.root, write, this.layers, signal))
|
|
945
|
+
} catch (error) {
|
|
946
|
+
if (error instanceof LocalChangesStale) throw new RemoteError('forgePanel/local-stale', error.message, {}, { cause: error })
|
|
947
|
+
if (error instanceof LocalPathReplaced) throw new RemoteError('forgePanel/local-path-replaced', error.message, {}, { cause: error })
|
|
948
|
+
throw error
|
|
949
|
+
} finally {
|
|
950
|
+
// A failed write can have changed the paths of its earlier commands.
|
|
951
|
+
this.panels.get(session)?.reinspect()
|
|
952
|
+
}
|
|
816
953
|
}
|
|
817
954
|
|
|
818
955
|
/**
|
|
@@ -1121,6 +1258,25 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
1121
1258
|
if (failure !== undefined) throw actionError(failure)
|
|
1122
1259
|
}
|
|
1123
1260
|
|
|
1261
|
+
/**
|
|
1262
|
+
* Turn the code host's automatic merge of a change request of a Session on, while its head is still the request's
|
|
1263
|
+
* `headSha`, or off; the change request is polled again once the host answers.
|
|
1264
|
+
* @param session - Session the change request is bound to.
|
|
1265
|
+
* @param url - binding URL of the change request.
|
|
1266
|
+
* @param request - on with the merge method and the head commit the user confirmed, or off.
|
|
1267
|
+
* @param signal - request cancellation.
|
|
1268
|
+
* @throws `forgePanel/not-bound` unless the URL is a visible binding of the Session that a provider serves;
|
|
1269
|
+
* `forgePanel/stale-head` when the head moved past the request's `headSha`; `forgePanel/action-failed` with the
|
|
1270
|
+
* host's reason when the host refuses otherwise, cannot be reached, or sets no automatic merge;
|
|
1271
|
+
* `forgePanel/action-unknown` when the host's answer did not confirm the change.
|
|
1272
|
+
*/
|
|
1273
|
+
@Remote
|
|
1274
|
+
async setAutoMerge(session: Session, url: string, request: AutoMergeRequest, signal: AbortSignal): Promise<void> {
|
|
1275
|
+
signal.throwIfAborted()
|
|
1276
|
+
const failure = await this.home.forge.setAutoMerge(this.bound(session, url).ref, request, signal)
|
|
1277
|
+
if (failure !== undefined) throw actionError(failure)
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1124
1280
|
/**
|
|
1125
1281
|
* Rerun the failed checks of a change request of a Session while its head is still the commit whose checks the user
|
|
1126
1282
|
* saw; the change request is polled again once the host answers.
|
|
@@ -1436,6 +1592,39 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
1436
1592
|
throw readError(attributes)
|
|
1437
1593
|
}
|
|
1438
1594
|
|
|
1595
|
+
/**
|
|
1596
|
+
* Resolve what a local read targets: the Session's own checkout with the worktree it created; for a head branch,
|
|
1597
|
+
* the worktree of the repository that has it checked out, read as a checkout; or, when none has, the verified
|
|
1598
|
+
* branch itself, read from its commits. A head branch also carries the Session's own HEAD, which is what it is
|
|
1599
|
+
* compared with while no base branch is chosen.
|
|
1600
|
+
* @param working - whether the read needs a working tree, as every scope but `branch` does.
|
|
1601
|
+
* @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/head-missing` when the branch does not exist;
|
|
1602
|
+
* `forgePanel/no-working-tree` when `working` and no worktree has the branch checked out.
|
|
1603
|
+
*/
|
|
1604
|
+
private async localTarget(session: Session, head: string | null, working: boolean, signal: AbortSignal): Promise<LocalTarget> {
|
|
1605
|
+
const own = await this.checkoutOf(session, signal)
|
|
1606
|
+
const ownTarget: LocalTarget = {
|
|
1607
|
+
inspection: own, created: this.worktreeState(session).created, tip: 'HEAD', worktree: null, against: null,
|
|
1608
|
+
}
|
|
1609
|
+
if (head === null) return ownTarget
|
|
1610
|
+
// Worktree paths are as long as the directories users choose, so the listing takes the larger limit.
|
|
1611
|
+
const git = gitIn(this.home, { ...this.config, maxOutputBytes: this.config.maxDiffBytes }, session, own.checkout.root, signal)
|
|
1612
|
+
const tip = await diffing(branchTip(git, head))
|
|
1613
|
+
const against = await sessionHead(git, own.checkout)
|
|
1614
|
+
// Only a local branch can be checked out; a remote-tracking one is always read from its commits.
|
|
1615
|
+
const directory = head.startsWith(LOCAL_REF_PREFIX) ? (await branchWorktrees(git)).get(head) : undefined
|
|
1616
|
+
// The directory is as Git's listing spells it, which can be cut short or name one that is gone, so the read
|
|
1617
|
+
// confirms that a checkout of the branch in this repository is there.
|
|
1618
|
+
const inspection = directory === undefined || await this.home.fs.lstat(directory, undefined, signal) === undefined ? undefined
|
|
1619
|
+
: await inspectCheckout(this.home, this.config, session, directory, signal)
|
|
1620
|
+
if (inspection?.commonDir === own.commonDir && inspection.checkout.branch === head.slice(LOCAL_REF_PREFIX.length)) {
|
|
1621
|
+
return inspection.checkout.root === own.checkout.root ? ownTarget
|
|
1622
|
+
: { inspection, created: null, tip: 'HEAD', worktree: inspection.checkout.root, against }
|
|
1623
|
+
}
|
|
1624
|
+
if (working) throw new RemoteError('forgePanel/no-working-tree', 'No worktree has the branch checked out, so it has no working tree', {})
|
|
1625
|
+
return { inspection: own, created: null, tip, worktree: null, against }
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1439
1628
|
/** Inspect the checkout of the Session's current directory, which local diffs read. */
|
|
1440
1629
|
private async checkoutOf(session: Session, signal: AbortSignal): Promise<Inspection> {
|
|
1441
1630
|
const inspection = await inspectCheckout(this.home, this.config, session, this.home.workingDirectory.get(session), signal)
|
|
@@ -1638,7 +1827,7 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
1638
1827
|
try {
|
|
1639
1828
|
running = agent.runMaintenance(async (signal) => { await work(agent, signal) })
|
|
1640
1829
|
} catch (error) {
|
|
1641
|
-
throw new RemoteError('forgePanel/session-busy',
|
|
1830
|
+
throw new RemoteError('forgePanel/session-busy', `The Session is busy: ${messageOf(error)}`, {}, { cause: error })
|
|
1642
1831
|
}
|
|
1643
1832
|
await running
|
|
1644
1833
|
}
|
|
@@ -1707,13 +1896,14 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
1707
1896
|
session: Session, source: ForgeLensRequest['source'], signal: AbortSignal,
|
|
1708
1897
|
): Promise<LensSubject & { readonly key: string }> {
|
|
1709
1898
|
if (source.kind === 'local') {
|
|
1710
|
-
const inspection = await this.checkoutOf(session, signal)
|
|
1711
|
-
const root = inspection.checkout.root
|
|
1712
1899
|
const { scope } = source
|
|
1900
|
+
const target = await this.localTarget(session, scope.head ?? null, scope.kind !== 'branch', signal)
|
|
1901
|
+
const { inspection, created, tip, against } = target
|
|
1902
|
+
const root = inspection.checkout.root
|
|
1713
1903
|
const fork: ForkPoint | null = scope.kind !== 'branch' ? null : await diffing(scope.base === null
|
|
1714
|
-
? forkPoint(gitIn(this.home, this.config, session, root, signal), inspection,
|
|
1715
|
-
: chosenForkPoint(gitIn(this.home, this.config, session, root, signal), scope.base))
|
|
1716
|
-
const { files } = await diffing(localDiff(this.home, this.config, session, root, fork, scope, this.layers, signal))
|
|
1904
|
+
? forkPoint(gitIn(this.home, this.config, session, root, signal), inspection, created, tip, against)
|
|
1905
|
+
: chosenForkPoint(gitIn(this.home, this.config, session, root, signal), scope.base, tip))
|
|
1906
|
+
const { files } = await diffing(localDiff(this.home, this.config, session, root, fork, scope, this.layers, signal, tip))
|
|
1717
1907
|
return {
|
|
1718
1908
|
key: JSON.stringify(['local', session.id, scope]),
|
|
1719
1909
|
source: { kind: 'local', scope },
|
|
@@ -1721,7 +1911,7 @@ export class ForgePanelController extends TypertRemoteService {
|
|
|
1721
1911
|
read: async (side, file, inner) => {
|
|
1722
1912
|
if (file.binary || (side === 'old' ? file.status === 'added' : file.status === 'deleted')) return null
|
|
1723
1913
|
return side === 'new'
|
|
1724
|
-
? await diffing(localText(this.home, this.config, session, root, scope, file.path, inner))
|
|
1914
|
+
? await diffing(localText(this.home, this.config, session, root, scope, file.path, inner, tip))
|
|
1725
1915
|
: await diffing(localOldText(this.home, this.config, session, root, scope, fork, file.previousPath ?? file.path, inner))
|
|
1726
1916
|
},
|
|
1727
1917
|
}
|
|
@@ -1877,8 +2067,8 @@ function reviewError(failure: ForgeFailure): RemoteError {
|
|
|
1877
2067
|
}
|
|
1878
2068
|
|
|
1879
2069
|
/**
|
|
1880
|
-
* Settle a diff read, reporting its size limit, its filter configuration, a missing fork point, a missing base branch,
|
|
1881
|
-
* commits that are not on the branch as Remote errors.
|
|
2070
|
+
* Settle a diff read, reporting its size limit, its filter configuration, a missing fork point, a missing base branch, a missing
|
|
2071
|
+
* head, and chosen commits that are not on the branch as Remote errors.
|
|
1882
2072
|
* @param reading - the read.
|
|
1883
2073
|
* @returns what the read returned.
|
|
1884
2074
|
*/
|
|
@@ -1890,6 +2080,7 @@ async function diffing<T>(reading: Promise<T>): Promise<T> {
|
|
|
1890
2080
|
if (error instanceof DiffTooLarge) throw new RemoteError('forgePanel/diff-too-large', error.message, {}, { cause: error })
|
|
1891
2081
|
if (error instanceof NoForkPoint) throw new RemoteError('forgePanel/no-fork-point', error.message, {}, { cause: error })
|
|
1892
2082
|
if (error instanceof BaseMissing) throw new RemoteError('forgePanel/base-missing', error.message, {}, { cause: error })
|
|
2083
|
+
if (error instanceof HeadMissing) throw new RemoteError('forgePanel/head-missing', error.message, {}, { cause: error })
|
|
1893
2084
|
if (error instanceof CommitsMissing) throw new RemoteError('forgePanel/commits-missing', error.message, {}, { cause: error })
|
|
1894
2085
|
if (error instanceof CommitsNotLinear) throw new RemoteError('forgePanel/commits-not-linear', error.message, {}, { cause: error })
|
|
1895
2086
|
throw error
|