@junctionpanel/server 0.1.69 → 0.1.71
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/dist/server/client/daemon-client.d.ts +3 -0
- package/dist/server/client/daemon-client.d.ts.map +1 -1
- package/dist/server/client/daemon-client.js +67 -6
- package/dist/server/client/daemon-client.js.map +1 -1
- package/dist/server/server/agent/agent-storage.d.ts +35 -28
- package/dist/server/server/agent/agent-storage.d.ts.map +1 -1
- package/dist/server/server/session.d.ts.map +1 -1
- package/dist/server/server/session.js +69 -19
- package/dist/server/server/session.js.map +1 -1
- package/dist/server/shared/messages.d.ts +2005 -1604
- package/dist/server/shared/messages.d.ts.map +1 -1
- package/dist/server/shared/messages.js +5 -4
- package/dist/server/shared/messages.js.map +1 -1
- package/dist/server/utils/checkout-git.d.ts +65 -4
- package/dist/server/utils/checkout-git.d.ts.map +1 -1
- package/dist/server/utils/checkout-git.js +572 -92
- package/dist/server/utils/checkout-git.js.map +1 -1
- package/package.json +2 -2
|
@@ -23,7 +23,7 @@ import { listDirectoryEntries, readExplorerFile, getDownloadableFileInfo, isWork
|
|
|
23
23
|
import { slugify, validateBranchSlug, listJunctionWorktrees, deleteJunctionWorktree, isJunctionOwnedWorktreeCwd, resolveJunctionWorktreeRootForCwd, createInRepoWorktree, attachInRepoWorktree, restoreInRepoWorktree, } from '../utils/worktree.js';
|
|
24
24
|
import { readJunctionWorktreeMetadata } from '../utils/worktree-metadata.js';
|
|
25
25
|
import { runAsyncWorktreeBootstrap } from './worktree-bootstrap.js';
|
|
26
|
-
import { getCheckoutDiff, getCheckoutStatus, getCheckoutStatusLite, listBranchSuggestions, NotGitRepoError, MergeConflictError, MergeFromBaseConflictError, commitChanges, mergeToBase, mergeFromBase, pushCurrentBranch, createPullRequest, getPullRequestFailureLogs, getPullRequestStatus, searchPullRequests, listGitRemotes, mergePullRequest, resolveMergeToBaseOperationCwd, resolveBaseRefWithSource, } from '../utils/checkout-git.js';
|
|
26
|
+
import { getCheckoutDiff, getCheckoutStatus, getCheckoutStatusLite, listBranchSuggestions, NotGitRepoError, MergeConflictError, MergeFromBaseConflictError, commitChanges, mergeToBase, mergeFromBase, pushCurrentBranch, createPullRequest, getPullRequestFailureLogs, getPullRequestSnapshot, getPullRequestStatus, invalidatePullRequestCache, searchPullRequests, listGitRemotes, mergePullRequest, resolveMergeToBaseOperationCwd, resolveBaseRefWithSource, } from '../utils/checkout-git.js';
|
|
27
27
|
import { getProjectIcon } from '../utils/project-icon.js';
|
|
28
28
|
import { expandTilde } from '../utils/path.js';
|
|
29
29
|
import { searchHomeDirectories, searchWorkspaceEntries, searchWorkspaceEntriesAtGitRef, searchGitRepositories, checkIsGitRepo, } from '../utils/directory-suggestions.js';
|
|
@@ -58,6 +58,8 @@ const WORKSPACE_STATUS_WATCH_DEBOUNCE_MS = 250;
|
|
|
58
58
|
const WORKSPACE_STATUS_GIT_REFRESH_MS = 3000;
|
|
59
59
|
const WORKSPACE_STATUS_PR_ACTIVE_REFRESH_MS = 15000;
|
|
60
60
|
const WORKSPACE_STATUS_PR_PASSIVE_REFRESH_MS = 60000;
|
|
61
|
+
const WORKSPACE_STATUS_PR_ACTIVE_CACHE_MAX_AGE_MS = WORKSPACE_STATUS_PR_ACTIVE_REFRESH_MS;
|
|
62
|
+
const WORKSPACE_STATUS_PR_PASSIVE_CACHE_MAX_AGE_MS = 3 * 60000;
|
|
61
63
|
const PROVIDER_CHILD_THREADS_REFRESH_DEBOUNCE_MS = 250;
|
|
62
64
|
const PROVIDER_CHILD_THREADS_PERSISTED_LIST_INITIAL_LIMIT = 500;
|
|
63
65
|
const PROVIDER_CHILD_THREADS_PERSISTED_LIST_MAX_LIMIT = 50000;
|
|
@@ -3274,11 +3276,21 @@ export class Session {
|
|
|
3274
3276
|
};
|
|
3275
3277
|
}
|
|
3276
3278
|
}
|
|
3277
|
-
async resolveWorkspacePullRequestSnapshot(cwd, remoteName) {
|
|
3279
|
+
async resolveWorkspacePullRequestSnapshot(cwd, remoteName, options) {
|
|
3278
3280
|
try {
|
|
3279
|
-
const
|
|
3280
|
-
|
|
3281
|
-
|
|
3281
|
+
const detailLevel = options?.detailLevel ?? 'detail';
|
|
3282
|
+
const prStatus = detailLevel === 'detail'
|
|
3283
|
+
? await getPullRequestStatus(expandTilde(cwd), {
|
|
3284
|
+
remoteName,
|
|
3285
|
+
maxAgeMs: options?.maxAgeMs,
|
|
3286
|
+
forceRefresh: options?.forceRefresh,
|
|
3287
|
+
})
|
|
3288
|
+
: await getPullRequestSnapshot(expandTilde(cwd), {
|
|
3289
|
+
remoteName,
|
|
3290
|
+
detailLevel,
|
|
3291
|
+
maxAgeMs: options?.maxAgeMs,
|
|
3292
|
+
forceRefresh: options?.forceRefresh,
|
|
3293
|
+
});
|
|
3282
3294
|
return {
|
|
3283
3295
|
pullRequest: prStatus.status,
|
|
3284
3296
|
pullRequestError: null,
|
|
@@ -3743,6 +3755,9 @@ export class Session {
|
|
|
3743
3755
|
scheduleWorkspaceStatusTargetRefresh(target, options) {
|
|
3744
3756
|
const includePr = options?.includePr ?? false;
|
|
3745
3757
|
const shouldDebounce = options?.debounce ?? true;
|
|
3758
|
+
if (includePr && options?.bumpPrGeneration) {
|
|
3759
|
+
target.prRefreshGeneration += 1;
|
|
3760
|
+
}
|
|
3746
3761
|
if (!shouldDebounce) {
|
|
3747
3762
|
void this.refreshWorkspaceStatusTarget(target, { includePr });
|
|
3748
3763
|
return;
|
|
@@ -3795,7 +3810,13 @@ export class Session {
|
|
|
3795
3810
|
githubFeaturesEnabled = false;
|
|
3796
3811
|
}
|
|
3797
3812
|
else if (includePr) {
|
|
3798
|
-
const prSnapshot = await this.resolveWorkspacePullRequestSnapshot(target.cwd, target.remoteName
|
|
3813
|
+
const prSnapshot = await this.resolveWorkspacePullRequestSnapshot(target.cwd, target.remoteName, {
|
|
3814
|
+
detailLevel: fullGit ? 'detail' : 'summary',
|
|
3815
|
+
maxAgeMs: fullGit
|
|
3816
|
+
? WORKSPACE_STATUS_PR_ACTIVE_CACHE_MAX_AGE_MS
|
|
3817
|
+
: WORKSPACE_STATUS_PR_PASSIVE_CACHE_MAX_AGE_MS,
|
|
3818
|
+
forceRefresh: gitIdentityChanged,
|
|
3819
|
+
});
|
|
3799
3820
|
pullRequest = prSnapshot.pullRequest;
|
|
3800
3821
|
pullRequestError = prSnapshot.pullRequestError;
|
|
3801
3822
|
githubFeaturesEnabled = prSnapshot.githubFeaturesEnabled;
|
|
@@ -3829,6 +3850,7 @@ export class Session {
|
|
|
3829
3850
|
const previousHasLoadedPullRequest = target.hasLoadedPullRequest;
|
|
3830
3851
|
const includePr = target.refreshIncludesPr
|
|
3831
3852
|
|| (hasExplicitIncludePr ? Boolean(options?.includePr) : !target.latestPayload);
|
|
3853
|
+
const prRefreshGeneration = includePr ? target.prRefreshGeneration : null;
|
|
3832
3854
|
target.refreshQueued = false;
|
|
3833
3855
|
target.refreshIncludesPr = false;
|
|
3834
3856
|
const snapshot = await this.computeWorkspaceStatusSnapshot(target, {
|
|
@@ -3838,6 +3860,15 @@ export class Session {
|
|
|
3838
3860
|
if (!this.hasWorkspaceStatusTarget(target)) {
|
|
3839
3861
|
return;
|
|
3840
3862
|
}
|
|
3863
|
+
const newerPrRefreshQueued = includePr
|
|
3864
|
+
&& (prRefreshGeneration !== target.prRefreshGeneration
|
|
3865
|
+
|| target.refreshQueued
|
|
3866
|
+
|| target.refreshIncludesPr);
|
|
3867
|
+
if (newerPrRefreshQueued) {
|
|
3868
|
+
target.refreshQueued = true;
|
|
3869
|
+
target.refreshIncludesPr = true;
|
|
3870
|
+
continue;
|
|
3871
|
+
}
|
|
3841
3872
|
const activeSubscribersPresent = this.workspaceStatusHasActiveSubscribers(target);
|
|
3842
3873
|
const gitIdentityChanged = this.workspaceStatusGitIdentityChanged(target.latestPayload, snapshot.git);
|
|
3843
3874
|
const needsPrReplay = (!includePr && target.refreshIncludesPr)
|
|
@@ -3890,6 +3921,7 @@ export class Session {
|
|
|
3890
3921
|
refreshPromise: null,
|
|
3891
3922
|
refreshQueued: false,
|
|
3892
3923
|
refreshIncludesPr: false,
|
|
3924
|
+
prRefreshGeneration: 0,
|
|
3893
3925
|
latestPayload: null,
|
|
3894
3926
|
latestFingerprint: null,
|
|
3895
3927
|
hasLoadedPullRequest: false,
|
|
@@ -3946,7 +3978,7 @@ export class Session {
|
|
|
3946
3978
|
this.updateWorkspaceStatusGitPolling(target);
|
|
3947
3979
|
this.updateWorkspaceStatusPrPolling(target);
|
|
3948
3980
|
const fullGit = this.workspaceStatusHasActiveSubscribers(target);
|
|
3949
|
-
const includePr = fullGit;
|
|
3981
|
+
const includePr = fullGit || !target.latestPayload;
|
|
3950
3982
|
const previousFingerprint = target.latestFingerprint;
|
|
3951
3983
|
const hadExistingSubscribers = target.subscriptions.size > 1;
|
|
3952
3984
|
const snapshot = target.latestPayload
|
|
@@ -3990,6 +4022,7 @@ export class Session {
|
|
|
3990
4022
|
}
|
|
3991
4023
|
this.scheduleWorkspaceStatusTargetRefresh(target, {
|
|
3992
4024
|
includePr: options?.includePr,
|
|
4025
|
+
bumpPrGeneration: options?.bumpPrGeneration,
|
|
3993
4026
|
debounce: false,
|
|
3994
4027
|
});
|
|
3995
4028
|
}
|
|
@@ -4680,13 +4713,18 @@ export class Session {
|
|
|
4680
4713
|
}
|
|
4681
4714
|
}
|
|
4682
4715
|
async handleCheckoutPrStatusRequest(msg) {
|
|
4683
|
-
const
|
|
4716
|
+
const cwd = expandTilde(msg.cwd);
|
|
4717
|
+
const { requestId } = msg;
|
|
4684
4718
|
try {
|
|
4685
|
-
const prStatus = await getPullRequestStatus(cwd, {
|
|
4719
|
+
const prStatus = await getPullRequestStatus(cwd, {
|
|
4720
|
+
remoteName: msg.remoteName,
|
|
4721
|
+
maxAgeMs: WORKSPACE_STATUS_PR_ACTIVE_CACHE_MAX_AGE_MS,
|
|
4722
|
+
forceRefresh: true,
|
|
4723
|
+
});
|
|
4686
4724
|
this.emit({
|
|
4687
4725
|
type: 'checkout_pr_status_response',
|
|
4688
4726
|
payload: {
|
|
4689
|
-
cwd,
|
|
4727
|
+
cwd: msg.cwd,
|
|
4690
4728
|
status: prStatus.status,
|
|
4691
4729
|
githubFeaturesEnabled: prStatus.githubFeaturesEnabled,
|
|
4692
4730
|
error: null,
|
|
@@ -4698,7 +4736,7 @@ export class Session {
|
|
|
4698
4736
|
this.emit({
|
|
4699
4737
|
type: 'checkout_pr_status_response',
|
|
4700
4738
|
payload: {
|
|
4701
|
-
cwd,
|
|
4739
|
+
cwd: msg.cwd,
|
|
4702
4740
|
status: null,
|
|
4703
4741
|
githubFeaturesEnabled: true,
|
|
4704
4742
|
error: this.toCheckoutError(error),
|
|
@@ -4741,13 +4779,18 @@ export class Session {
|
|
|
4741
4779
|
}
|
|
4742
4780
|
}
|
|
4743
4781
|
async handleCheckoutPrFailureLogsRequest(msg) {
|
|
4744
|
-
const
|
|
4782
|
+
const cwd = expandTilde(msg.cwd);
|
|
4783
|
+
const { requestId } = msg;
|
|
4745
4784
|
try {
|
|
4746
|
-
const result = await this.runWorkspaceGitRead(cwd, () => getPullRequestFailureLogs(cwd, {
|
|
4785
|
+
const result = await this.runWorkspaceGitRead(cwd, () => getPullRequestFailureLogs(cwd, {
|
|
4786
|
+
remoteName: msg.remoteName,
|
|
4787
|
+
maxAgeMs: WORKSPACE_STATUS_PR_ACTIVE_CACHE_MAX_AGE_MS,
|
|
4788
|
+
forceRefresh: true,
|
|
4789
|
+
}));
|
|
4747
4790
|
this.emit({
|
|
4748
4791
|
type: 'checkout_pr_failure_logs_response',
|
|
4749
4792
|
payload: {
|
|
4750
|
-
cwd,
|
|
4793
|
+
cwd: msg.cwd,
|
|
4751
4794
|
logs: result.logs,
|
|
4752
4795
|
githubFeaturesEnabled: result.githubFeaturesEnabled,
|
|
4753
4796
|
error: null,
|
|
@@ -4759,7 +4802,7 @@ export class Session {
|
|
|
4759
4802
|
this.emit({
|
|
4760
4803
|
type: 'checkout_pr_failure_logs_response',
|
|
4761
4804
|
payload: {
|
|
4762
|
-
cwd,
|
|
4805
|
+
cwd: msg.cwd,
|
|
4763
4806
|
logs: null,
|
|
4764
4807
|
githubFeaturesEnabled: true,
|
|
4765
4808
|
error: this.toCheckoutError(error),
|
|
@@ -4769,17 +4812,24 @@ export class Session {
|
|
|
4769
4812
|
}
|
|
4770
4813
|
}
|
|
4771
4814
|
async handleCheckoutPrMergeRequest(msg) {
|
|
4772
|
-
const
|
|
4815
|
+
const cwd = expandTilde(msg.cwd);
|
|
4816
|
+
const { requestId } = msg;
|
|
4773
4817
|
try {
|
|
4774
4818
|
await mergePullRequest(cwd, {
|
|
4775
4819
|
method: msg.method ?? 'squash',
|
|
4776
4820
|
remoteName: msg.remoteName,
|
|
4821
|
+
maxAgeMs: WORKSPACE_STATUS_PR_ACTIVE_CACHE_MAX_AGE_MS,
|
|
4822
|
+
forceRefresh: true,
|
|
4823
|
+
});
|
|
4824
|
+
invalidatePullRequestCache(cwd, { remoteName: msg.remoteName });
|
|
4825
|
+
this.scheduleWorkspaceStatusRefreshForCwd(cwd, {
|
|
4826
|
+
includePr: true,
|
|
4827
|
+
bumpPrGeneration: true,
|
|
4777
4828
|
});
|
|
4778
|
-
this.scheduleWorkspaceStatusRefreshForCwd(cwd, { includePr: true });
|
|
4779
4829
|
this.emit({
|
|
4780
4830
|
type: 'checkout_pr_merge_response',
|
|
4781
4831
|
payload: {
|
|
4782
|
-
cwd,
|
|
4832
|
+
cwd: msg.cwd,
|
|
4783
4833
|
success: true,
|
|
4784
4834
|
error: null,
|
|
4785
4835
|
requestId,
|
|
@@ -4790,7 +4840,7 @@ export class Session {
|
|
|
4790
4840
|
this.emit({
|
|
4791
4841
|
type: 'checkout_pr_merge_response',
|
|
4792
4842
|
payload: {
|
|
4793
|
-
cwd,
|
|
4843
|
+
cwd: msg.cwd,
|
|
4794
4844
|
success: false,
|
|
4795
4845
|
error: this.toCheckoutError(error),
|
|
4796
4846
|
requestId,
|