@bridgebrew/sessions 0.0.28 → 0.0.34
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/browser/branch-actions.tsx +2 -2
- package/browser/changes.tsx +25 -11
- package/browser/children.tsx +1 -1
- package/browser/conversation.tsx +2 -2
- package/browser/gallery.tsx +1 -1
- package/browser/index.tsx +42 -14
- package/browser/media-origins.tsx +1 -1
- package/browser/mobile.tsx +15 -6
- package/browser/subagents.tsx +1 -1
- package/git.ts +3 -2
- package/listing.ts +7 -2
- package/package.json +5 -4
- package/server.ts +8 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// A session's branch from its page (research-083): its Git button (`@
|
|
1
|
+
// A session's branch from its page (research-083): its Git button (`@bridgebrew/session-ui/git-actions`) acts on its branch's
|
|
2
2
|
// folder, and archiving the branch's last session offers to delete that folder (never one with work not committed or not pushed; the git branch
|
|
3
3
|
// stays). Both go through the project plugin's Branches routes (`/<slug>/api/project/branches/…`, bridgebrew/bridge#557),
|
|
4
4
|
// as the Branches screen does: the same checks, the owner's page.
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
useBranch,
|
|
22
22
|
type BranchesAnswer,
|
|
23
23
|
type BranchesRoute,
|
|
24
|
-
} from '@
|
|
24
|
+
} from '@bridgebrew/session-ui/git-actions';
|
|
25
25
|
|
|
26
26
|
/** The project plugin's Branches route of project `node` in workspace `slug`, or one of its actions. */
|
|
27
27
|
export const branchesRoute: BranchesRoute = (slug, node, action) =>
|
package/browser/changes.tsx
CHANGED
|
@@ -102,14 +102,7 @@ const fileNamed = <T extends { path: string }>(files: T[], wanted: string, repos
|
|
|
102
102
|
files.find(({ path }) => wanted.endsWith(`/${path}`)) ??
|
|
103
103
|
files.find(({ path }) => path.endsWith(`/${wanted}`));
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
session,
|
|
107
|
-
known,
|
|
108
|
-
focus,
|
|
109
|
-
post,
|
|
110
|
-
onChanged,
|
|
111
|
-
onOpen,
|
|
112
|
-
}: {
|
|
105
|
+
interface DetailsProps {
|
|
113
106
|
session: Details;
|
|
114
107
|
known: string[];
|
|
115
108
|
/** The file to show (a tool call's change counts asked for it), again at each new `at`. */
|
|
@@ -117,15 +110,36 @@ export function SessionDetails({
|
|
|
117
110
|
post: Post;
|
|
118
111
|
onChanged: () => void;
|
|
119
112
|
onOpen: (id: string) => void;
|
|
120
|
-
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** The nested repositories the last commit of `session` left out (plugins#145). */
|
|
116
|
+
type LeftOut = { session: string; paths: string[] } | undefined;
|
|
117
|
+
|
|
118
|
+
/** The details panel of one session: drawn afresh for each (plugins#61), so nothing of the previous one (changes,
|
|
119
|
+
* files picked, message, a commit to confirm, a tag being typed, the diff open) shows under the next, and its late
|
|
120
|
+
* answers land nowhere. The last commit's nested repositories outlive the switch, kept for their own session. */
|
|
121
|
+
export function SessionDetails(props: DetailsProps) {
|
|
122
|
+
const [left, setLeft] = React.useState<LeftOut>();
|
|
123
|
+
return <SessionPanel key={props.session.id} {...props} left={left} setLeft={setLeft} />;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function SessionPanel({
|
|
127
|
+
session,
|
|
128
|
+
known,
|
|
129
|
+
focus,
|
|
130
|
+
post,
|
|
131
|
+
onChanged,
|
|
132
|
+
onOpen,
|
|
133
|
+
left,
|
|
134
|
+
setLeft,
|
|
135
|
+
}: DetailsProps & { left: LeftOut; setLeft: (left: LeftOut) => void }) {
|
|
121
136
|
const [changes, setChanges] = React.useState<Changes | null>();
|
|
122
137
|
const [outside, setOutside] = React.useState(false);
|
|
123
138
|
const [error, setError] = React.useState('');
|
|
124
139
|
const [picked, setPicked] = React.useState<Set<string>>(new Set());
|
|
125
140
|
const [message, setMessage] = React.useState('');
|
|
126
141
|
const [committing, setCommitting] = React.useState(false);
|
|
127
|
-
|
|
128
|
-
const [left, setLeft] = React.useState<{ session: string; paths: string[] }>();
|
|
142
|
+
// Another session's are not shown.
|
|
129
143
|
const leftOut = left?.session === session.id ? left.paths : [];
|
|
130
144
|
/** Other sessions share the picked files: Commit asks again before it takes their changes. */
|
|
131
145
|
const [confirming, setConfirming] = React.useState(false);
|
package/browser/children.tsx
CHANGED
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
cn,
|
|
30
30
|
formatDate,
|
|
31
31
|
} from '@bridge/ui';
|
|
32
|
-
import { oneLine } from '@
|
|
32
|
+
import { oneLine } from '@bridgebrew/session-ui/one-line';
|
|
33
33
|
import { Elapsed, Spinner, duration } from './elapsed.tsx';
|
|
34
34
|
import type { ChildState } from '../listing.ts';
|
|
35
35
|
|
package/browser/conversation.tsx
CHANGED
|
@@ -43,8 +43,8 @@ import {
|
|
|
43
43
|
outputMedia,
|
|
44
44
|
viewedImage,
|
|
45
45
|
type Attached,
|
|
46
|
-
} from '@
|
|
47
|
-
import { oneLine } from '@
|
|
46
|
+
} from '@bridgebrew/session-ui/media';
|
|
47
|
+
import { oneLine } from '@bridgebrew/session-ui/one-line';
|
|
48
48
|
import { cutText } from '../text.ts';
|
|
49
49
|
import type { PluginComponent } from '../views/library.ts';
|
|
50
50
|
import type { ViewComponentRenderer, ViewTools } from './views/view.tsx';
|
package/browser/gallery.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
TooltipTrigger,
|
|
16
16
|
formatDate,
|
|
17
17
|
} from '@bridge/ui';
|
|
18
|
-
import { blobUrl, ImageViewer, type Pinned, type Viewed } from '@
|
|
18
|
+
import { blobUrl, ImageViewer, type Pinned, type Viewed } from '@bridgebrew/session-ui/media';
|
|
19
19
|
|
|
20
20
|
/** Where the gallery looks: a node and everything below it, or one session of it. */
|
|
21
21
|
export interface Scope {
|
package/browser/index.tsx
CHANGED
|
@@ -109,9 +109,9 @@ import type { Context } from 'cordis';
|
|
|
109
109
|
import type {} from '@bridge/ui-renderer/client';
|
|
110
110
|
import type { ViewComponentRenderer } from './views/view.tsx';
|
|
111
111
|
import { SessionDetails } from './changes.tsx';
|
|
112
|
-
import { SessionPrompt } from '@
|
|
113
|
-
import { shownModel, type HarnessModels, type PickerModel } from '@
|
|
114
|
-
import { ProviderMark, providerOf } from '@
|
|
112
|
+
import { SessionPrompt } from '@bridgebrew/session-ui/prompt';
|
|
113
|
+
import { shownModel, type HarnessModels, type PickerModel } from '@bridgebrew/session-ui/model-picker';
|
|
114
|
+
import { ProviderMark, providerOf } from '@bridgebrew/session-ui/providers';
|
|
115
115
|
import {
|
|
116
116
|
Conversation,
|
|
117
117
|
DecisionDock,
|
|
@@ -126,7 +126,7 @@ import {
|
|
|
126
126
|
type Stored,
|
|
127
127
|
} from './conversation.tsx';
|
|
128
128
|
import { Questions, type Question } from './questions.tsx';
|
|
129
|
-
import { GalleryPins, type Attached, type Pinned, type Viewed } from '@
|
|
129
|
+
import { GalleryPins, type Attached, type Pinned, type Viewed } from '@bridgebrew/session-ui/media';
|
|
130
130
|
import { GalleryDialog, type Scope } from './gallery.tsx';
|
|
131
131
|
import { BranchActions, CleanupDialog, cleanupOf, type Cleanup } from './branch-actions.tsx';
|
|
132
132
|
import { PullRequestPill, type SessionPullRequest } from './pull-request.tsx';
|
|
@@ -143,6 +143,7 @@ import {
|
|
|
143
143
|
import { SubagentView } from './subagent-view.tsx';
|
|
144
144
|
import {
|
|
145
145
|
acquire,
|
|
146
|
+
back,
|
|
146
147
|
childState as childStateOf,
|
|
147
148
|
claimMark,
|
|
148
149
|
inbox,
|
|
@@ -1434,14 +1435,32 @@ function Sessions({
|
|
|
1434
1435
|
);
|
|
1435
1436
|
};
|
|
1436
1437
|
const setListing = (change: (was: Listing) => Listing) => latest.current.store?.patch(change);
|
|
1437
|
-
|
|
1438
|
-
|
|
1438
|
+
/** Whether the archived list is wanted (shown, or its first read on the way), and the last read asked: the answer
|
|
1439
|
+
* of an older read, or one after Hide, is dropped (plugins#150). */
|
|
1440
|
+
const archivedWanted = React.useRef(false);
|
|
1441
|
+
const archivedRead = React.useRef(0);
|
|
1442
|
+
const loadArchived = () => {
|
|
1443
|
+
archivedWanted.current = true;
|
|
1444
|
+
const run = ++archivedRead.current;
|
|
1445
|
+
return workspace
|
|
1439
1446
|
.fetch(forWorktree(`${api}?archived=1`, shownWorktree(workspace)), { headers })
|
|
1440
1447
|
.then(readJson)
|
|
1441
|
-
.then((body) =>
|
|
1442
|
-
|
|
1448
|
+
.then((body) => {
|
|
1449
|
+
if (run === archivedRead.current) setArchived((body as Listing).sessions);
|
|
1450
|
+
}, report);
|
|
1451
|
+
};
|
|
1452
|
+
const hideArchived = () => {
|
|
1453
|
+
archivedWanted.current = false;
|
|
1454
|
+
archivedRead.current += 1;
|
|
1443
1455
|
setArchived(undefined);
|
|
1444
|
-
}
|
|
1456
|
+
};
|
|
1457
|
+
React.useEffect(hideArchived, [node]);
|
|
1458
|
+
// Archived or restored elsewhere (another window, the phone): the live listing gains or loses a session, and the
|
|
1459
|
+
// archived list wanted is read again (plugins#150).
|
|
1460
|
+
const listed = listing?.sessions.map((each) => each.id).join('\n');
|
|
1461
|
+
React.useEffect(() => {
|
|
1462
|
+
if (archivedWanted.current) void loadArchived();
|
|
1463
|
+
}, [listed]);
|
|
1445
1464
|
// The session shown, for the shared listing: not polled (its own stream lists again), not counted unread.
|
|
1446
1465
|
React.useEffect(() => store?.watch(current), [store, current]);
|
|
1447
1466
|
|
|
@@ -2040,7 +2059,7 @@ function Sessions({
|
|
|
2040
2059
|
if (undoable.current === entry) undoable.current = null;
|
|
2041
2060
|
dismiss(id);
|
|
2042
2061
|
void run().then(
|
|
2043
|
-
() => Promise.all([load(),
|
|
2062
|
+
() => Promise.all([load(), archivedWanted.current && loadArchived()]),
|
|
2044
2063
|
failed('Could not undo'),
|
|
2045
2064
|
);
|
|
2046
2065
|
},
|
|
@@ -2100,7 +2119,7 @@ function Sessions({
|
|
|
2100
2119
|
);
|
|
2101
2120
|
else if (action === 'archive')
|
|
2102
2121
|
offerUndo('Session archived', each.title, () => triage(each.id, 'restore').then(back));
|
|
2103
|
-
await Promise.all([load(), (
|
|
2122
|
+
await Promise.all([load(), (archivedWanted.current || action === 'restore') && loadArchived()]);
|
|
2104
2123
|
// Its branch's last session archived (research-083): its folder may go too, asked.
|
|
2105
2124
|
const branch = each.branch;
|
|
2106
2125
|
if (
|
|
@@ -2258,7 +2277,11 @@ function Sessions({
|
|
|
2258
2277
|
promptHandle.current?.openModels();
|
|
2259
2278
|
} else if (event.code === 'BracketLeft' || event.code === 'BracketRight') {
|
|
2260
2279
|
event.preventDefault();
|
|
2261
|
-
|
|
2280
|
+
// An open child has no row: it steps from its listed ancestor's (bounded, should a parent loop).
|
|
2281
|
+
let from = current;
|
|
2282
|
+
for (let hop = 0; hop < kin.size && from && !ordered.some((each) => each.id === from); hop++)
|
|
2283
|
+
from = kin.get(from)?.parent;
|
|
2284
|
+
const index = ordered.findIndex((each) => each.id === from);
|
|
2262
2285
|
const step = event.code === 'BracketLeft' ? -1 : 1;
|
|
2263
2286
|
const to = ordered[index < 0 ? (step > 0 ? 0 : ordered.length - 1) : index + step];
|
|
2264
2287
|
if (to) choose(to.id);
|
|
@@ -2429,7 +2452,12 @@ function Sessions({
|
|
|
2429
2452
|
stamp={
|
|
2430
2453
|
each.snoozedUntil
|
|
2431
2454
|
? snoozeWakeLabel(each.snoozedUntil)
|
|
2432
|
-
:
|
|
2455
|
+
: // Active, folded: the time the inbox orders it by (plugins#61).
|
|
2456
|
+
ago(
|
|
2457
|
+
folding && shelf === 'active' && depth === 0
|
|
2458
|
+
? back(each)
|
|
2459
|
+
: (each.updatedAt ?? each.createdAt),
|
|
2460
|
+
)
|
|
2433
2461
|
}
|
|
2434
2462
|
worktreeName={
|
|
2435
2463
|
// A child names its worktree in every list; a top row in the workspace's own (research-045).
|
|
@@ -2876,7 +2904,7 @@ function Sessions({
|
|
|
2876
2904
|
<Button
|
|
2877
2905
|
size="sm"
|
|
2878
2906
|
className="justify-start text-muted"
|
|
2879
|
-
onClick={() => (archived ?
|
|
2907
|
+
onClick={() => (archived ? hideArchived() : void loadArchived())}
|
|
2880
2908
|
>
|
|
2881
2909
|
<Icon name="archive" size={14} />
|
|
2882
2910
|
{archived ? 'Hide archived' : 'Show archived'}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The external origins the host declared for the page (`GET /_bridge/host/origins`): one fetch per page, then the same
|
|
2
2
|
// sets for every conversation. Any failure gives none, so a remote image or video stays a link.
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { mediaOrigins } from '@
|
|
4
|
+
import { mediaOrigins } from '@bridgebrew/session-ui/media';
|
|
5
5
|
import { readJson } from '@bridge/ui';
|
|
6
6
|
|
|
7
7
|
type Origins = ReturnType<typeof mediaOrigins>;
|
package/browser/mobile.tsx
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { Badge, Button, EmptyState, Icon, cn, readJson } from '@bridge/ui';
|
|
9
9
|
import type { Context } from 'cordis';
|
|
10
|
-
import { SessionPrompt } from '@
|
|
11
|
-
import type { Attached } from '@
|
|
10
|
+
import { SessionPrompt } from '@bridgebrew/session-ui/prompt';
|
|
11
|
+
import type { Attached } from '@bridgebrew/session-ui/media';
|
|
12
12
|
import {
|
|
13
13
|
Conversation,
|
|
14
14
|
DecisionDock,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
type Listing,
|
|
35
35
|
type Session,
|
|
36
36
|
} from './index.tsx';
|
|
37
|
-
import { inbox, lineage } from '../listing.ts';
|
|
37
|
+
import { back, inbox, lineage } from '../listing.ts';
|
|
38
38
|
import type { Lineage } from './children.tsx';
|
|
39
39
|
import { answerBody, type Answer } from '../answers.ts';
|
|
40
40
|
|
|
@@ -117,7 +117,8 @@ export function MobileSessions({
|
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
/** `stamp`: the time the row is ordered by, when not its last message's. */
|
|
121
|
+
function Row({ each, stamp, onOpen }: { each: Session; stamp?: string; onOpen: () => void }) {
|
|
121
122
|
const state = stateOf(each);
|
|
122
123
|
const needs = state === 'Needs you' || state === 'Your call';
|
|
123
124
|
return (
|
|
@@ -148,7 +149,9 @@ function Row({ each, onOpen }: { each: Session; onOpen: () => void }) {
|
|
|
148
149
|
{state}
|
|
149
150
|
</span>
|
|
150
151
|
) : null}
|
|
151
|
-
<span className="shrink-0 text-xs text-muted">
|
|
152
|
+
<span className="shrink-0 text-xs text-muted">
|
|
153
|
+
{ago(stamp ?? each.updatedAt ?? each.createdAt)}
|
|
154
|
+
</span>
|
|
152
155
|
</span>
|
|
153
156
|
<span className="truncate text-sm text-secondary">{each.preview ?? 'No messages yet'}</span>
|
|
154
157
|
</button>
|
|
@@ -277,7 +280,13 @@ function MobileList({
|
|
|
277
280
|
{isOpen && (
|
|
278
281
|
<>
|
|
279
282
|
{rows.map((each) => (
|
|
280
|
-
<Row
|
|
283
|
+
<Row
|
|
284
|
+
key={each.id}
|
|
285
|
+
each={each}
|
|
286
|
+
// Active, folded: the time the inbox orders it by (plugins#61).
|
|
287
|
+
stamp={folding && key === 'active' ? back(each) : undefined}
|
|
288
|
+
onOpen={() => ctx.screen.open(each.id)}
|
|
289
|
+
/>
|
|
281
290
|
))}
|
|
282
291
|
{rows.length < sessions.length && (
|
|
283
292
|
<Button
|
package/browser/subagents.tsx
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// `<session>~<sub-agent>` (`subagentItem`, `itemParts`), a history entry as any link.
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import { Button, Card, Icon, ScreenLink, type FollowTarget, cn, formatDate } from '@bridge/ui';
|
|
14
|
-
import { oneLine } from '@
|
|
14
|
+
import { oneLine } from '@bridgebrew/session-ui/one-line';
|
|
15
15
|
import { Elapsed, duration } from './elapsed.tsx';
|
|
16
16
|
import { LineageContext, StatusMark } from './children.tsx';
|
|
17
17
|
import type { ChildState } from '../listing.ts';
|
package/git.ts
CHANGED
|
@@ -127,9 +127,10 @@ export const typedBranch = (answer: string) => {
|
|
|
127
127
|
: undefined;
|
|
128
128
|
};
|
|
129
129
|
|
|
130
|
-
/** `name`, else `name-2`, `name-3`…: the first that no branch of the repository at `folder` has.
|
|
130
|
+
/** `name`, else `name-2`, `name-3`…: the first that no branch of the repository at `folder` has. Each read as its full
|
|
131
|
+
* name, not git's short form (`heads/<name>` beside a tag of the same name: plugins#198). */
|
|
131
132
|
export const freeBranch = async (run: Run, folder: string, name: string) => {
|
|
132
|
-
const { stdout } = await run(folder, ['branch', '--list', '--format=%(refname:
|
|
133
|
+
const { stdout } = await run(folder, ['branch', '--list', '--format=%(refname:lstrip=2)']);
|
|
133
134
|
const taken = new Set(stdout.split('\n'));
|
|
134
135
|
let free = name;
|
|
135
136
|
for (let n = 2; taken.has(free); n++) free = `${name}-${n}`;
|
package/listing.ts
CHANGED
|
@@ -244,6 +244,13 @@ export interface Inboxed {
|
|
|
244
244
|
pullRequest?: { watching?: true | undefined } | undefined;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
+
/** When a session came back to the user: the later of its turn's end and its last message sent. The inbox orders
|
|
248
|
+
* Active by it, and an Active row shows it (plugins#61). */
|
|
249
|
+
export const back = (each: Pick<Inboxed, 'createdAt' | 'updatedAt' | 'lastTurn'>) => {
|
|
250
|
+
const sent = each.updatedAt ?? each.createdAt;
|
|
251
|
+
return each.lastTurn && each.lastTurn.endedAt > sent ? each.lastTurn.endedAt : sent;
|
|
252
|
+
};
|
|
253
|
+
|
|
247
254
|
/** The inbox (bridge#210): of the Active sessions, the ones working fold into Working (a turn running, a message the
|
|
248
255
|
* user queued, held by a restart until it runs, a question sent to another session and not answered yet, or its pull
|
|
249
256
|
* request watched, research-086: its agent waits for news), newest sent first (`updatedAt`: the user's last message); the others
|
|
@@ -251,8 +258,6 @@ export interface Inboxed {
|
|
|
251
258
|
* ended or they were last sent work. */
|
|
252
259
|
export function inbox<S extends Inboxed>(sessions: S[]): { active: S[]; working: S[] } {
|
|
253
260
|
const sent = (each: S) => each.updatedAt ?? each.createdAt;
|
|
254
|
-
const back = (each: S) =>
|
|
255
|
-
each.lastTurn && each.lastTurn.endedAt > sent(each) ? each.lastTurn.endedAt : sent(each);
|
|
256
261
|
const working = sessions.filter(
|
|
257
262
|
(each) =>
|
|
258
263
|
!each.waiting &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bridgebrew/sessions",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Conversations with agents, in the workspace or in a project, through the Profile.",
|
|
6
6
|
"keywords": [
|
|
@@ -1005,7 +1005,8 @@
|
|
|
1005
1005
|
},
|
|
1006
1006
|
"bodies": {
|
|
1007
1007
|
"/sessions/write": 524288
|
|
1008
|
-
}
|
|
1008
|
+
},
|
|
1009
|
+
"placement": "workspace"
|
|
1009
1010
|
},
|
|
1010
1011
|
"scripts": {
|
|
1011
1012
|
"test": "node ../bridge/node_modules/vitest/vitest.mjs run --config vitest.config.ts",
|
|
@@ -1014,19 +1015,19 @@
|
|
|
1014
1015
|
"typecheck": "bridge plugin check ."
|
|
1015
1016
|
},
|
|
1016
1017
|
"dependencies": {
|
|
1018
|
+
"@bridgebrew/session-ui": "0.0.1",
|
|
1017
1019
|
"@openuidev/lang-core": "1.0.1",
|
|
1018
1020
|
"react-markdown": "10.1.0",
|
|
1019
1021
|
"remark-gfm": "4.0.1",
|
|
1020
1022
|
"zod": "4.6.5"
|
|
1021
1023
|
},
|
|
1022
1024
|
"peerDependencies": {
|
|
1023
|
-
"@bridge/session-ui": ">=0.0.1",
|
|
1024
1025
|
"@bridge/ui": ">=0.0.1",
|
|
1025
1026
|
"cordis": "4.0.0-rc.11",
|
|
1026
1027
|
"react": "19.3.0"
|
|
1027
1028
|
},
|
|
1028
1029
|
"releaseStage": "dev",
|
|
1029
1030
|
"engines": {
|
|
1030
|
-
"bridge": ">=0.0.1-nightly.
|
|
1031
|
+
"bridge": ">=0.0.1-nightly.20261119.2"
|
|
1031
1032
|
}
|
|
1032
1033
|
}
|
package/server.ts
CHANGED
|
@@ -4524,9 +4524,12 @@ export async function apply(ctx: Context, config?: unknown) {
|
|
|
4524
4524
|
if (value.branch?.temporary) return undefined;
|
|
4525
4525
|
const folder = await sessionFolder(node, value);
|
|
4526
4526
|
if (folder === undefined) return undefined;
|
|
4527
|
-
|
|
4527
|
+
// Its branch's own name (empty when detached), never git's short form: `heads/<name>` beside a tag (plugins#198).
|
|
4528
|
+
const head = await run(folder, ['branch', '--show-current']);
|
|
4528
4529
|
const branch = head.code === 0 ? head.stdout.trim() : '';
|
|
4529
|
-
|
|
4530
|
+
// A branch with no commit yet (unborn, orphan) has no pull request of its own.
|
|
4531
|
+
if (!branch || (await run(folder, ['rev-parse', '--verify', '--quiet', 'HEAD'])).code !== 0)
|
|
4532
|
+
return undefined;
|
|
4530
4533
|
// The branch's upstream remote, else `origin`, else the only one (as the host's Branches, plugins#148).
|
|
4531
4534
|
const tracked = (await run(folder, ['config', '--get', `branch.${branch}.remote`])).stdout.trim();
|
|
4532
4535
|
const names = (await run(folder, ['remote'])).stdout.split('\n').filter(Boolean);
|
|
@@ -4539,9 +4542,10 @@ export async function apply(ctx: Context, config?: unknown) {
|
|
|
4539
4542
|
: undefined;
|
|
4540
4543
|
if (name === undefined) return undefined;
|
|
4541
4544
|
// The default branch: no pull request of its own.
|
|
4542
|
-
|
|
4545
|
+
// Read as a full ref: a local branch named `<remote>/main` makes the short form `remotes/<remote>/main`.
|
|
4546
|
+
const base = (await run(folder, ['symbolic-ref', `refs/remotes/${name}/HEAD`])).stdout
|
|
4543
4547
|
.trim()
|
|
4544
|
-
.slice(name
|
|
4548
|
+
.slice(`refs/remotes/${name}/`.length);
|
|
4545
4549
|
if (branch === base || branch === 'main' || branch === 'master') return undefined;
|
|
4546
4550
|
const remote = await run(folder, ['remote', 'get-url', name]);
|
|
4547
4551
|
return remote.code === 0 && remote.stdout.trim()
|