@agimon-ai/po-git 0.0.0-alpha.65 → 0.0.0-alpha.67
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/apiContracts.cjs +4 -1
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.mjs +4 -1
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/extensions/native.mjs +4 -1
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +8 -4
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +8 -4
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +38 -8
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{worktreeOperations-CP2lYxrI.mjs → worktreeOperations-B3E4JY4H.mjs} +143 -23
- package/dist/worktreeOperations-B3E4JY4H.mjs.map +1 -0
- package/dist/{worktreeOperations-C1ygq-Na.cjs → worktreeOperations-CD7s0YnO.cjs} +142 -22
- package/dist/worktreeOperations-CD7s0YnO.cjs.map +1 -0
- package/package.json +8 -8
- package/dist/worktreeOperations-C1ygq-Na.cjs.map +0 -1
- package/dist/worktreeOperations-CP2lYxrI.mjs.map +0 -1
package/dist/extensions/web.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createApiClient, defineActivityGroup, defineChannelFile, defineFill, defineGlobalStore, defineLeaderBinding, defineRepositorySettingsPanel, defineSessionStore, defineToolRenderer, defineWebLifecycle, defineWebPlugin, sessionApiAddress } from "@agimon-ai/po-core/web";
|
|
2
|
-
import { ArrowRightIcon, BranchIcon, Button, CheckIcon, ChevronDownIcon, ChevronUpIcon, Dialog, DialogContent, DialogTitle, DiffView, Dot, DropdownMenuItem, EmptyState, Input, MessageIcon, MessageItem, MessageItemBody, ReviewCommentDraft, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, SettingsActions, SettingsCard, SettingsNote, SettingsRow, SettingsRowDescription, SettingsRowText, SettingsRowTitle, SettingsSection, SettingsSectionDescription, SettingsSectionHeader, SettingsSectionTitle, ShieldIcon, Spinner, StatusBadge, Tabs, TabsContent, TabsList, TabsTrigger, buildReviewPrompt } from "@agimon-ai/po-web-components";
|
|
2
|
+
import { ArrowRightIcon, BranchIcon, Button, CheckIcon, ChevronDownIcon, ChevronUpIcon, CodeBlock, Dialog, DialogContent, DialogTitle, DiffView, Dot, DropdownMenuItem, EmptyState, Input, MessageIcon, MessageItem, MessageItemBody, ReviewCommentDraft, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, SettingsActions, SettingsCard, SettingsNote, SettingsRow, SettingsRowDescription, SettingsRowText, SettingsRowTitle, SettingsSection, SettingsSectionDescription, SettingsSectionHeader, SettingsSectionTitle, ShieldIcon, Spinner, StatusBadge, Tabs, TabsContent, TabsList, TabsTrigger, buildReviewPrompt } from "@agimon-ai/po-web-components";
|
|
3
3
|
import { createElement, useCallback, useEffect, useEffectEvent, useId, useRef, useState } from "react";
|
|
4
4
|
import { browserTransport } from "@agimon-ai/po-web-security/browser";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -55,6 +55,10 @@ const api = createApiClient({
|
|
|
55
55
|
sessionAddress: sessionApiAddress
|
|
56
56
|
});
|
|
57
57
|
//#endregion
|
|
58
|
+
//#region src/constants/git.ts
|
|
59
|
+
/** Installs the rift CLI. Shown to the person to copy, and named in the error an agent reads. */
|
|
60
|
+
const RIFT_INSTALL_COMMAND = "npm install -g rift-snapshot";
|
|
61
|
+
//#endregion
|
|
58
62
|
//#region src/extensions/workspaces/(frontend)/_lib/newSessionForm.ts
|
|
59
63
|
const MAX_LISTED = 200;
|
|
60
64
|
/** Local branches first, then remote-only ones, filtered by a case-insensitive substring. */
|
|
@@ -120,7 +124,7 @@ function Field$1({ label, children }) {
|
|
|
120
124
|
});
|
|
121
125
|
}
|
|
122
126
|
/** Inline presentation also lets story capture inspect content, rather than a portal-only root. */
|
|
123
|
-
function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", initialForm, busy = false, error = "", onClose, onCreate }) {
|
|
127
|
+
function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", initialForm, busy = false, error = "", riftMissing = false, onClose, onCreate }) {
|
|
124
128
|
const [form, setForm] = useState({
|
|
125
129
|
mode: "existing",
|
|
126
130
|
newBranch: "",
|
|
@@ -320,7 +324,16 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
320
324
|
className: "text-sm leading-relaxed text-po-dim",
|
|
321
325
|
children: "Runs in its own worktree, so this checkout stays as it is."
|
|
322
326
|
}) : null,
|
|
323
|
-
|
|
327
|
+
riftMissing ? /* @__PURE__ */ jsxs("div", {
|
|
328
|
+
"data-testid": "rift-install-notice",
|
|
329
|
+
role: "alert",
|
|
330
|
+
className: "flex flex-col gap-2 rounded-md border border-po-edge-magenta bg-po-tint-magenta px-3 py-3 text-sm text-po-hi",
|
|
331
|
+
children: [/* @__PURE__ */ jsx("p", { children: "This repository uses Rift, and its CLI is not installed here. Run these in the repository root, then try again." }), /* @__PURE__ */ jsx(CodeBlock, {
|
|
332
|
+
text: `${RIFT_INSTALL_COMMAND}
|
|
333
|
+
rift init`,
|
|
334
|
+
className: "language-bash"
|
|
335
|
+
})]
|
|
336
|
+
}) : error ? /* @__PURE__ */ jsx("p", {
|
|
324
337
|
"data-testid": "new-session-error",
|
|
325
338
|
role: "alert",
|
|
326
339
|
className: "rounded-md border border-po-edge-red bg-po-tint-red p-3 text-sm text-po-red",
|
|
@@ -342,7 +355,7 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
342
355
|
title: problem,
|
|
343
356
|
disabled: busy || loading || problem !== void 0,
|
|
344
357
|
onClick: submit,
|
|
345
|
-
children: busy ? mode === "plain" ? "Creating session..." : "Creating worktree..." : "Create session"
|
|
358
|
+
children: busy ? mode === "plain" ? "Creating session..." : "Creating worktree..." : riftMissing ? "Try again" : "Create session"
|
|
346
359
|
})]
|
|
347
360
|
})
|
|
348
361
|
]
|
|
@@ -360,6 +373,7 @@ function GitNewSessionDialog({ newSession }) {
|
|
|
360
373
|
const [branches, setBranches] = useState(null);
|
|
361
374
|
const [loadError, setLoadError] = useState("");
|
|
362
375
|
const [error, setError] = useState("");
|
|
376
|
+
const [riftMissing, setRiftMissing] = useState(false);
|
|
363
377
|
const [busy, setBusy] = useState(false);
|
|
364
378
|
const workspaceId = newSession?.workspaceId;
|
|
365
379
|
const request = useEffectEvent((input) => newSession?.requestWithStepUp(input));
|
|
@@ -387,6 +401,7 @@ function GitNewSessionDialog({ newSession }) {
|
|
|
387
401
|
if (busy || formProblem$1(state) !== void 0) return;
|
|
388
402
|
setBusy(true);
|
|
389
403
|
setError("");
|
|
404
|
+
setRiftMissing(false);
|
|
390
405
|
const body = createRequest(state);
|
|
391
406
|
let failure;
|
|
392
407
|
try {
|
|
@@ -399,6 +414,7 @@ function GitNewSessionDialog({ newSession }) {
|
|
|
399
414
|
});
|
|
400
415
|
const answer = await response.json().catch(() => void 0);
|
|
401
416
|
failure = response.ok ? await newSession.openCreated(answer.sessionId) : errorOf$1(answer, response.status);
|
|
417
|
+
setRiftMissing(!response.ok && answer?.code === "rift_missing");
|
|
402
418
|
}
|
|
403
419
|
} catch {
|
|
404
420
|
failure = "The cockpit is unreachable.";
|
|
@@ -425,6 +441,7 @@ function GitNewSessionDialog({ newSession }) {
|
|
|
425
441
|
loadError,
|
|
426
442
|
busy,
|
|
427
443
|
error,
|
|
444
|
+
riftMissing,
|
|
428
445
|
onClose: newSession.close,
|
|
429
446
|
onCreate: (state) => void submit(state)
|
|
430
447
|
})]
|
|
@@ -942,7 +959,10 @@ function optionalText$1(value) {
|
|
|
942
959
|
}
|
|
943
960
|
function optionalErrorTarget$1(value) {
|
|
944
961
|
if (!isRecord$2(value)) return void 0;
|
|
945
|
-
if (value.action === "create") return
|
|
962
|
+
if (value.action === "create") return value.riftMissing === true ? {
|
|
963
|
+
action: "create",
|
|
964
|
+
riftMissing: true
|
|
965
|
+
} : { action: "create" };
|
|
946
966
|
if (value.action === "close" && typeof value.id === "string" && value.id !== "") return {
|
|
947
967
|
action: "close",
|
|
948
968
|
id: value.id
|
|
@@ -1068,6 +1088,7 @@ function WorktreeCreateForm({ sessionId, sessionReservationId, onCancel, onReque
|
|
|
1068
1088
|
onBaseChange: setBaseRef,
|
|
1069
1089
|
busy: session.pending !== void 0,
|
|
1070
1090
|
error: session.errorTarget?.action === "create" ? session.error : void 0,
|
|
1091
|
+
riftMissing: session.errorTarget?.action === "create" && session.errorTarget.riftMissing === true,
|
|
1071
1092
|
onCancel,
|
|
1072
1093
|
onCreate: () => {
|
|
1073
1094
|
if (sessionId !== null) {
|
|
@@ -1082,7 +1103,7 @@ function WorktreeCreateForm({ sessionId, sessionReservationId, onCancel, onReque
|
|
|
1082
1103
|
disabled: sessionId === null
|
|
1083
1104
|
});
|
|
1084
1105
|
}
|
|
1085
|
-
function WorktreeCreateView({ branch, baseRef, onBranchChange, onBaseChange, busy = false, error, onCancel, onCreate, disabled = false }) {
|
|
1106
|
+
function WorktreeCreateView({ branch, baseRef, onBranchChange, onBaseChange, busy = false, error, riftMissing = false, onCancel, onCreate, disabled = false }) {
|
|
1086
1107
|
const id = useId();
|
|
1087
1108
|
return /* @__PURE__ */ jsxs("div", {
|
|
1088
1109
|
className: "rounded-lg border border-po-border-soft bg-po-panel p-5 text-po-text shadow-sm",
|
|
@@ -1122,7 +1143,16 @@ function WorktreeCreateView({ branch, baseRef, onBranchChange, onBaseChange, bus
|
|
|
1122
1143
|
"aria-invalid": !!error,
|
|
1123
1144
|
"aria-describedby": error ? `${id}-error` : void 0
|
|
1124
1145
|
}),
|
|
1125
|
-
|
|
1146
|
+
riftMissing ? /* @__PURE__ */ jsxs("div", {
|
|
1147
|
+
"data-testid": "rift-install-notice",
|
|
1148
|
+
role: "alert",
|
|
1149
|
+
className: "flex flex-col gap-2 rounded-md border border-po-edge-magenta bg-po-tint-magenta px-3 py-3 text-sm text-po-hi",
|
|
1150
|
+
children: [/* @__PURE__ */ jsx("p", { children: "This repository uses Rift, and its CLI is not installed here. Run these in the repository root, then try again." }), /* @__PURE__ */ jsx(CodeBlock, {
|
|
1151
|
+
text: `${RIFT_INSTALL_COMMAND}
|
|
1152
|
+
rift init`,
|
|
1153
|
+
className: "language-bash"
|
|
1154
|
+
})]
|
|
1155
|
+
}) : error && /* @__PURE__ */ jsx("p", {
|
|
1126
1156
|
id: `${id}-error`,
|
|
1127
1157
|
role: "alert",
|
|
1128
1158
|
"data-testid": "git-worktree-error",
|
|
@@ -1163,7 +1193,7 @@ function WorktreeCreateView({ branch, baseRef, onBranchChange, onBaseChange, bus
|
|
|
1163
1193
|
children: [busy && /* @__PURE__ */ jsx(Spinner, {
|
|
1164
1194
|
className: "size-3",
|
|
1165
1195
|
label: "Creating worktree"
|
|
1166
|
-
}), busy ? "Creating worktree..." : "Create worktree"]
|
|
1196
|
+
}), busy ? "Creating worktree..." : riftMissing ? "Try again" : "Create worktree"]
|
|
1167
1197
|
})]
|
|
1168
1198
|
})]
|
|
1169
1199
|
})
|