ur-agent 1.37.0 → 1.37.1
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.md +2 -0
- package/dist/cli.js +143 -67
- package/docs/CONFIGURATION.md +2 -0
- package/docs/IDE.md +9 -2
- package/docs/providers.md +2 -0
- package/extensions/vscode-ur-inline-diffs/README.md +11 -2
- package/extensions/vscode-ur-inline-diffs/media/ur.svg +3 -4
- package/extensions/vscode-ur-inline-diffs/out/extension.js +367 -129
- package/extensions/vscode-ur-inline-diffs/package.json +41 -2
- package/package.json +1 -1
|
@@ -34,7 +34,7 @@ __export(extension_exports, {
|
|
|
34
34
|
deactivate: () => deactivate
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(extension_exports);
|
|
37
|
-
var
|
|
37
|
+
var vscode17 = __toESM(require("vscode"));
|
|
38
38
|
|
|
39
39
|
// src/actions/actions.ts
|
|
40
40
|
var vscode = __toESM(require("vscode"));
|
|
@@ -107,8 +107,6 @@ function writeBundleMetadata(root, bundle) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// src/diffs/treeProvider.ts
|
|
110
|
-
var fs2 = __toESM(require("node:fs"));
|
|
111
|
-
var path2 = __toESM(require("node:path"));
|
|
112
110
|
var vscode3 = __toESM(require("vscode"));
|
|
113
111
|
|
|
114
112
|
// src/util/format.ts
|
|
@@ -184,16 +182,6 @@ var DiffTreeItem = class extends vscode3.TreeItem {
|
|
|
184
182
|
};
|
|
185
183
|
}
|
|
186
184
|
};
|
|
187
|
-
var ActionItem = class extends vscode3.TreeItem {
|
|
188
|
-
constructor(label, description, icon, command, tooltip) {
|
|
189
|
-
super(label, vscode3.TreeItemCollapsibleState.None);
|
|
190
|
-
this.contextValue = "urAction";
|
|
191
|
-
this.description = description;
|
|
192
|
-
this.iconPath = new vscode3.ThemeIcon(icon);
|
|
193
|
-
this.tooltip = tooltip ?? `${label}${description ? ` \u2014 ${description}` : ""}`;
|
|
194
|
-
this.command = command;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
185
|
var InfoItem = class extends vscode3.TreeItem {
|
|
198
186
|
constructor(label, description, icon = "info") {
|
|
199
187
|
super(label, vscode3.TreeItemCollapsibleState.None);
|
|
@@ -226,21 +214,7 @@ var DiffTreeProvider = class {
|
|
|
226
214
|
const manifest = loadManifest(root);
|
|
227
215
|
const diffs = manifest.diffs.slice().sort((a, b) => String(b.createdAt).localeCompare(String(a.createdAt)));
|
|
228
216
|
if (diffs.length === 0) {
|
|
229
|
-
return [
|
|
230
|
-
new InfoItem(
|
|
231
|
-
"Ready for inline review",
|
|
232
|
-
fs2.existsSync(manifestPath(root)) ? "No pending diff bundles" : "No diff bundles captured yet",
|
|
233
|
-
"pass"
|
|
234
|
-
),
|
|
235
|
-
new ActionItem("Show UR status", "Provider, model, plugins", "pulse", {
|
|
236
|
-
command: "urInlineDiffs.status",
|
|
237
|
-
title: "Show UR Status"
|
|
238
|
-
}),
|
|
239
|
-
new ActionItem("Refresh", path2.relative(root, manifestPath(root)), "refresh", {
|
|
240
|
-
command: "urInlineDiffs.refresh",
|
|
241
|
-
title: "Refresh Inline Diffs"
|
|
242
|
-
})
|
|
243
|
-
];
|
|
217
|
+
return [];
|
|
244
218
|
}
|
|
245
219
|
return diffs.map((bundle) => new DiffTreeItem(bundle));
|
|
246
220
|
}
|
|
@@ -396,7 +370,7 @@ var ActionsTreeProvider = class {
|
|
|
396
370
|
}
|
|
397
371
|
if (!element) {
|
|
398
372
|
if (this.diffs.length === 0 && this.backgroundTasks.length === 0) {
|
|
399
|
-
return [
|
|
373
|
+
return [];
|
|
400
374
|
}
|
|
401
375
|
return [
|
|
402
376
|
new SectionItem("diffs", "Diff Bundles", this.diffs.length),
|
|
@@ -607,7 +581,7 @@ function errorMessage2(error) {
|
|
|
607
581
|
}
|
|
608
582
|
|
|
609
583
|
// src/context/ideContext.ts
|
|
610
|
-
var
|
|
584
|
+
var path2 = __toESM(require("node:path"));
|
|
611
585
|
function formatAttachmentLabel(attachment) {
|
|
612
586
|
if (attachment.kind === "file") return `@${attachment.file.path}`;
|
|
613
587
|
const { path: filePath, startLine, endLine } = attachment.selection;
|
|
@@ -646,12 +620,12 @@ function languageIdToFence(languageId) {
|
|
|
646
620
|
return FENCE_OVERRIDES[languageId] ?? languageId;
|
|
647
621
|
}
|
|
648
622
|
function captureEditorSnapshot() {
|
|
649
|
-
const
|
|
650
|
-
const workspaceRoot2 =
|
|
651
|
-
const editor =
|
|
623
|
+
const vscode18 = require("vscode");
|
|
624
|
+
const workspaceRoot2 = vscode18.workspace.workspaceFolders?.[0]?.uri.fsPath;
|
|
625
|
+
const editor = vscode18.window.activeTextEditor;
|
|
652
626
|
if (!editor) return { workspaceRoot: workspaceRoot2 };
|
|
653
627
|
const absolutePath = editor.document.uri.fsPath;
|
|
654
|
-
const relativePath = workspaceRoot2 ?
|
|
628
|
+
const relativePath = workspaceRoot2 ? path2.relative(workspaceRoot2, absolutePath) : absolutePath;
|
|
655
629
|
const activeFile = { path: relativePath, languageId: editor.document.languageId };
|
|
656
630
|
const selection = editor.selection;
|
|
657
631
|
if (selection.isEmpty) return { workspaceRoot: workspaceRoot2, activeFile };
|
|
@@ -668,39 +642,39 @@ function captureEditorSnapshot() {
|
|
|
668
642
|
|
|
669
643
|
// src/sessions/sessionStore.ts
|
|
670
644
|
var import_node_crypto = require("node:crypto");
|
|
671
|
-
var
|
|
672
|
-
var
|
|
645
|
+
var fs2 = __toESM(require("node:fs"));
|
|
646
|
+
var path3 = __toESM(require("node:path"));
|
|
673
647
|
var SESSION_ID_PATTERN = /^[a-zA-Z0-9-]{1,128}$/;
|
|
674
648
|
var TITLE_MAX_LENGTH = 60;
|
|
675
649
|
var DEFAULT_TITLE = "New Chat";
|
|
676
650
|
function chatRoot(root) {
|
|
677
|
-
return
|
|
651
|
+
return path3.join(root, ".ur", "ide", "chat");
|
|
678
652
|
}
|
|
679
653
|
function manifestPath2(root) {
|
|
680
|
-
return
|
|
654
|
+
return path3.join(chatRoot(root), "manifest.json");
|
|
681
655
|
}
|
|
682
656
|
function isValidSessionId(id) {
|
|
683
657
|
return SESSION_ID_PATTERN.test(id);
|
|
684
658
|
}
|
|
685
659
|
function sessionFilePath(root, id) {
|
|
686
660
|
if (!isValidSessionId(id)) return null;
|
|
687
|
-
const sessionsDir =
|
|
688
|
-
const target =
|
|
689
|
-
const resolvedDir =
|
|
690
|
-
const resolvedTarget =
|
|
661
|
+
const sessionsDir = path3.join(chatRoot(root), "sessions");
|
|
662
|
+
const target = path3.join(sessionsDir, `${id}.json`);
|
|
663
|
+
const resolvedDir = path3.resolve(sessionsDir) + path3.sep;
|
|
664
|
+
const resolvedTarget = path3.resolve(target);
|
|
691
665
|
if (!resolvedTarget.startsWith(resolvedDir)) return null;
|
|
692
666
|
return target;
|
|
693
667
|
}
|
|
694
668
|
function readJson2(file, fallback) {
|
|
695
669
|
try {
|
|
696
|
-
return JSON.parse(
|
|
670
|
+
return JSON.parse(fs2.readFileSync(file, "utf8"));
|
|
697
671
|
} catch {
|
|
698
672
|
return fallback;
|
|
699
673
|
}
|
|
700
674
|
}
|
|
701
675
|
function writeJson2(file, value) {
|
|
702
|
-
|
|
703
|
-
|
|
676
|
+
fs2.mkdirSync(path3.dirname(file), { recursive: true });
|
|
677
|
+
fs2.writeFileSync(file, `${JSON.stringify(value, null, 2)}
|
|
704
678
|
`);
|
|
705
679
|
}
|
|
706
680
|
function readManifest(root) {
|
|
@@ -743,7 +717,7 @@ function listSessions(root, options = {}) {
|
|
|
743
717
|
}
|
|
744
718
|
function readSession(root, id) {
|
|
745
719
|
const file = sessionFilePath(root, id);
|
|
746
|
-
if (!file || !
|
|
720
|
+
if (!file || !fs2.existsSync(file)) return null;
|
|
747
721
|
return readJson2(file, null);
|
|
748
722
|
}
|
|
749
723
|
function appendMessage(root, id, message) {
|
|
@@ -1214,6 +1188,8 @@ function buildRunWorkflowPrompt() {
|
|
|
1214
1188
|
|
|
1215
1189
|
// src/chat/chatController.ts
|
|
1216
1190
|
var ChatController = class {
|
|
1191
|
+
_onDidChangeState = new vscode6.EventEmitter();
|
|
1192
|
+
onDidChangeState = this._onDidChangeState.event;
|
|
1217
1193
|
panel;
|
|
1218
1194
|
record;
|
|
1219
1195
|
attachments = [];
|
|
@@ -1228,6 +1204,7 @@ var ChatController = class {
|
|
|
1228
1204
|
this.record = createSession(root);
|
|
1229
1205
|
this.attachments = [];
|
|
1230
1206
|
this.status = "idle";
|
|
1207
|
+
this._onDidChangeState.fire();
|
|
1231
1208
|
this.ensurePanel();
|
|
1232
1209
|
this.syncFullState();
|
|
1233
1210
|
}
|
|
@@ -1273,6 +1250,9 @@ var ChatController = class {
|
|
|
1273
1250
|
addSelectionToChat() {
|
|
1274
1251
|
this.stageAttachment("selection");
|
|
1275
1252
|
}
|
|
1253
|
+
isRequestRunning() {
|
|
1254
|
+
return this.status === "running";
|
|
1255
|
+
}
|
|
1276
1256
|
async explainSelection() {
|
|
1277
1257
|
await this.runEditorAction(buildExplainPrompt);
|
|
1278
1258
|
}
|
|
@@ -1299,6 +1279,7 @@ var ChatController = class {
|
|
|
1299
1279
|
dispose() {
|
|
1300
1280
|
this.turnHandle?.cancel();
|
|
1301
1281
|
this.denyAllPending("Extension is shutting down.");
|
|
1282
|
+
this._onDidChangeState.dispose();
|
|
1302
1283
|
}
|
|
1303
1284
|
// --- internals ---
|
|
1304
1285
|
requireWorkspaceRoot() {
|
|
@@ -1377,6 +1358,7 @@ var ChatController = class {
|
|
|
1377
1358
|
this.record.messages.push(userMessage);
|
|
1378
1359
|
this.panel?.post({ type: "messageAppended", message: userMessage });
|
|
1379
1360
|
this.status = "running";
|
|
1361
|
+
this._onDidChangeState.fire();
|
|
1380
1362
|
this.panel?.post({ type: "statusChanged", status: this.status });
|
|
1381
1363
|
const resumeSessionId = this.record.session.cliSessionId;
|
|
1382
1364
|
this.turnHandle = runUrTurn(
|
|
@@ -1448,6 +1430,7 @@ var ChatController = class {
|
|
|
1448
1430
|
} else {
|
|
1449
1431
|
this.status = "idle";
|
|
1450
1432
|
}
|
|
1433
|
+
this._onDidChangeState.fire();
|
|
1451
1434
|
this.panel?.post({ type: "statusChanged", status: this.status });
|
|
1452
1435
|
}
|
|
1453
1436
|
resolvePermission(requestId, decision) {
|
|
@@ -1503,20 +1486,100 @@ var ChatController = class {
|
|
|
1503
1486
|
}
|
|
1504
1487
|
};
|
|
1505
1488
|
|
|
1489
|
+
// src/chat/chatTreeProvider.ts
|
|
1490
|
+
var vscode7 = __toESM(require("vscode"));
|
|
1491
|
+
var ActionItem = class extends vscode7.TreeItem {
|
|
1492
|
+
constructor(label, description, icon, command, tooltip) {
|
|
1493
|
+
super(label, vscode7.TreeItemCollapsibleState.None);
|
|
1494
|
+
this.contextValue = "urChatAction";
|
|
1495
|
+
this.description = description;
|
|
1496
|
+
this.iconPath = new vscode7.ThemeIcon(icon);
|
|
1497
|
+
this.tooltip = tooltip ?? `${label}${description ? ` - ${description}` : ""}`;
|
|
1498
|
+
this.command = command;
|
|
1499
|
+
}
|
|
1500
|
+
};
|
|
1501
|
+
var InfoItem3 = class extends vscode7.TreeItem {
|
|
1502
|
+
constructor(label, description, icon = "comment-discussion") {
|
|
1503
|
+
super(label, vscode7.TreeItemCollapsibleState.None);
|
|
1504
|
+
this.contextValue = "urInfo";
|
|
1505
|
+
this.description = description;
|
|
1506
|
+
this.iconPath = new vscode7.ThemeIcon(icon);
|
|
1507
|
+
this.tooltip = `${label}${description ? ` - ${description}` : ""}`;
|
|
1508
|
+
}
|
|
1509
|
+
};
|
|
1510
|
+
var ChatTreeProvider = class {
|
|
1511
|
+
constructor(chat) {
|
|
1512
|
+
this.chat = chat;
|
|
1513
|
+
}
|
|
1514
|
+
chat;
|
|
1515
|
+
_onDidChangeTreeData = new vscode7.EventEmitter();
|
|
1516
|
+
onDidChangeTreeData = this._onDidChangeTreeData.event;
|
|
1517
|
+
refresh() {
|
|
1518
|
+
this._onDidChangeTreeData.fire();
|
|
1519
|
+
}
|
|
1520
|
+
getTreeItem(item) {
|
|
1521
|
+
return item;
|
|
1522
|
+
}
|
|
1523
|
+
getChildren() {
|
|
1524
|
+
const snapshot = captureEditorSnapshot();
|
|
1525
|
+
const items = [
|
|
1526
|
+
new InfoItem3("Start a UR chat", "Ask about this workspace or attach editor context."),
|
|
1527
|
+
new ActionItem("New Chat", "Start a fresh UR session", "comment-add", {
|
|
1528
|
+
command: "urInlineDiffs.chat.new",
|
|
1529
|
+
title: "New Chat"
|
|
1530
|
+
}),
|
|
1531
|
+
new ActionItem("Open Chat", "Resume an existing session", "comment", {
|
|
1532
|
+
command: "urInlineDiffs.chat.open",
|
|
1533
|
+
title: "Open Chat"
|
|
1534
|
+
}),
|
|
1535
|
+
new ActionItem("Pick Model", "Choose provider and model", "symbol-variable", {
|
|
1536
|
+
command: "urInlineDiffs.pickModel",
|
|
1537
|
+
title: "Pick Model"
|
|
1538
|
+
})
|
|
1539
|
+
];
|
|
1540
|
+
if (snapshot.activeFile) {
|
|
1541
|
+
items.push(
|
|
1542
|
+
new ActionItem("Add Current File to Chat", snapshot.activeFile.path, "file-add", {
|
|
1543
|
+
command: "urInlineDiffs.chat.addFile",
|
|
1544
|
+
title: "Add Current File to Chat"
|
|
1545
|
+
})
|
|
1546
|
+
);
|
|
1547
|
+
}
|
|
1548
|
+
if (snapshot.selection) {
|
|
1549
|
+
const lineRange = snapshot.selection.startLine === snapshot.selection.endLine ? `${snapshot.selection.path}:${snapshot.selection.startLine}` : `${snapshot.selection.path}:${snapshot.selection.startLine}-${snapshot.selection.endLine}`;
|
|
1550
|
+
items.push(
|
|
1551
|
+
new ActionItem("Add Selection to Chat", lineRange, "selection", {
|
|
1552
|
+
command: "urInlineDiffs.chat.addSelection",
|
|
1553
|
+
title: "Add Selection to Chat"
|
|
1554
|
+
})
|
|
1555
|
+
);
|
|
1556
|
+
}
|
|
1557
|
+
if (this.chat.isRequestRunning()) {
|
|
1558
|
+
items.push(
|
|
1559
|
+
new ActionItem("Cancel Current Chat Request", "Stop the running request", "stop-circle", {
|
|
1560
|
+
command: "urInlineDiffs.chat.cancel",
|
|
1561
|
+
title: "Cancel Current Chat Request"
|
|
1562
|
+
})
|
|
1563
|
+
);
|
|
1564
|
+
}
|
|
1565
|
+
return items;
|
|
1566
|
+
}
|
|
1567
|
+
};
|
|
1568
|
+
|
|
1506
1569
|
// src/diffs/actions.ts
|
|
1507
1570
|
var import_node_child_process3 = require("node:child_process");
|
|
1508
|
-
var
|
|
1571
|
+
var fs3 = __toESM(require("node:fs"));
|
|
1509
1572
|
var import_node_util2 = require("node:util");
|
|
1510
|
-
var
|
|
1573
|
+
var vscode8 = __toESM(require("vscode"));
|
|
1511
1574
|
var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process3.execFile);
|
|
1512
1575
|
async function commentDiff(item, provider) {
|
|
1513
1576
|
const root = workspaceRoot();
|
|
1514
1577
|
const bundle = item?.bundle;
|
|
1515
1578
|
if (!root || !bundle) {
|
|
1516
|
-
|
|
1579
|
+
vscode8.window.showWarningMessage("No UR inline diff selected.");
|
|
1517
1580
|
return;
|
|
1518
1581
|
}
|
|
1519
|
-
const text = await
|
|
1582
|
+
const text = await vscode8.window.showInputBox({
|
|
1520
1583
|
title: `Comment on ${bundle.id}`,
|
|
1521
1584
|
prompt: "Comment text",
|
|
1522
1585
|
ignoreFocusOut: true
|
|
@@ -1525,7 +1588,7 @@ async function commentDiff(item, provider) {
|
|
|
1525
1588
|
const manifest = loadManifest(root);
|
|
1526
1589
|
const manifestBundle = manifest.diffs.find((diff) => diff.id === bundle.id);
|
|
1527
1590
|
if (!manifestBundle) {
|
|
1528
|
-
|
|
1591
|
+
vscode8.window.showErrorMessage(`UR inline diff not found: ${bundle.id}`);
|
|
1529
1592
|
return;
|
|
1530
1593
|
}
|
|
1531
1594
|
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -1535,21 +1598,21 @@ async function commentDiff(item, provider) {
|
|
|
1535
1598
|
writeManifest(root, manifest);
|
|
1536
1599
|
writeBundleMetadata(root, manifestBundle);
|
|
1537
1600
|
provider.refresh();
|
|
1538
|
-
|
|
1601
|
+
vscode8.window.showInformationMessage(`Added UR comment to ${bundle.id}.`);
|
|
1539
1602
|
}
|
|
1540
1603
|
async function applyDiff(item, provider) {
|
|
1541
1604
|
const root = workspaceRoot();
|
|
1542
1605
|
const bundle = item?.bundle;
|
|
1543
1606
|
if (!root || !bundle) {
|
|
1544
|
-
|
|
1607
|
+
vscode8.window.showWarningMessage("No UR inline diff selected.");
|
|
1545
1608
|
return;
|
|
1546
1609
|
}
|
|
1547
1610
|
const patch = patchPath(root, bundle);
|
|
1548
|
-
if (!
|
|
1549
|
-
|
|
1611
|
+
if (!fs3.existsSync(patch)) {
|
|
1612
|
+
vscode8.window.showErrorMessage(`UR patch file missing for ${bundle.id}.`);
|
|
1550
1613
|
return;
|
|
1551
1614
|
}
|
|
1552
|
-
const choice = await
|
|
1615
|
+
const choice = await vscode8.window.showWarningMessage(
|
|
1553
1616
|
`Apply UR patch ${bundle.id} to your working tree? This modifies ${bundle.files?.length ?? 0} file(s).`,
|
|
1554
1617
|
{ modal: true },
|
|
1555
1618
|
"Apply"
|
|
@@ -1558,21 +1621,21 @@ async function applyDiff(item, provider) {
|
|
|
1558
1621
|
try {
|
|
1559
1622
|
await execFileAsync2("git", ["apply", "--whitespace=nowarn", patch], { cwd: root, shell: false });
|
|
1560
1623
|
} catch (error) {
|
|
1561
|
-
|
|
1624
|
+
vscode8.window.showErrorMessage(`Failed to apply UR patch ${bundle.id}: ${processErrorMessage(error)}`);
|
|
1562
1625
|
return;
|
|
1563
1626
|
}
|
|
1564
1627
|
try {
|
|
1565
1628
|
const { stdout } = await runUrCli(["ide", "diff", "approve", bundle.id], { cwd: root });
|
|
1566
1629
|
provider.refresh();
|
|
1567
1630
|
if (isNotFoundResult(stdout)) {
|
|
1568
|
-
|
|
1631
|
+
vscode8.window.showWarningMessage(
|
|
1569
1632
|
`Applied ${bundle.id} to disk, but no matching diff record was found to mark it approved.`
|
|
1570
1633
|
);
|
|
1571
1634
|
return;
|
|
1572
1635
|
}
|
|
1573
|
-
|
|
1636
|
+
vscode8.window.showInformationMessage(`Applied UR patch ${bundle.id}.`);
|
|
1574
1637
|
} catch (error) {
|
|
1575
|
-
|
|
1638
|
+
vscode8.window.showErrorMessage(
|
|
1576
1639
|
`Applied ${bundle.id} to disk, but failed to record approval: ${errorMessage(error)}`
|
|
1577
1640
|
);
|
|
1578
1641
|
}
|
|
@@ -1581,25 +1644,25 @@ async function rejectDiff(item, provider) {
|
|
|
1581
1644
|
const root = workspaceRoot();
|
|
1582
1645
|
const bundle = item?.bundle;
|
|
1583
1646
|
if (!root || !bundle) {
|
|
1584
|
-
|
|
1647
|
+
vscode8.window.showWarningMessage("No UR inline diff selected.");
|
|
1585
1648
|
return;
|
|
1586
1649
|
}
|
|
1587
1650
|
try {
|
|
1588
1651
|
const { stdout } = await runUrCli(["ide", "diff", "reject", bundle.id], { cwd: root });
|
|
1589
1652
|
provider.refresh();
|
|
1590
1653
|
if (isNotFoundResult(stdout)) {
|
|
1591
|
-
|
|
1654
|
+
vscode8.window.showErrorMessage(`UR inline diff not found: ${bundle.id}`);
|
|
1592
1655
|
return;
|
|
1593
1656
|
}
|
|
1594
|
-
|
|
1657
|
+
vscode8.window.showInformationMessage(`Rejected UR patch ${bundle.id} (no files changed).`);
|
|
1595
1658
|
} catch (error) {
|
|
1596
|
-
|
|
1659
|
+
vscode8.window.showErrorMessage(errorMessage(error));
|
|
1597
1660
|
}
|
|
1598
1661
|
}
|
|
1599
1662
|
async function showStatus(channel) {
|
|
1600
1663
|
const root = workspaceRoot();
|
|
1601
1664
|
if (!root) {
|
|
1602
|
-
|
|
1665
|
+
vscode8.window.showWarningMessage("Open a workspace folder to query UR status.");
|
|
1603
1666
|
return;
|
|
1604
1667
|
}
|
|
1605
1668
|
channel.clear();
|
|
@@ -1617,7 +1680,7 @@ function isNotFoundResult(stdout) {
|
|
|
1617
1680
|
}
|
|
1618
1681
|
|
|
1619
1682
|
// src/diffs/webview.ts
|
|
1620
|
-
var
|
|
1683
|
+
var vscode9 = __toESM(require("vscode"));
|
|
1621
1684
|
function renderDiffHtml(root, bundle) {
|
|
1622
1685
|
const patch = readPatch(root, bundle);
|
|
1623
1686
|
const comments = bundle.comments ?? [];
|
|
@@ -1665,36 +1728,200 @@ async function openDiff(item) {
|
|
|
1665
1728
|
const root = workspaceRoot();
|
|
1666
1729
|
const bundle = item?.bundle;
|
|
1667
1730
|
if (!root || !bundle) {
|
|
1668
|
-
|
|
1731
|
+
vscode9.window.showWarningMessage("No UR inline diff selected.");
|
|
1669
1732
|
return;
|
|
1670
1733
|
}
|
|
1671
|
-
const panel =
|
|
1734
|
+
const panel = vscode9.window.createWebviewPanel("urInlineDiff", `UR ${bundle.id}`, vscode9.ViewColumn.Active, {
|
|
1672
1735
|
enableScripts: false
|
|
1673
1736
|
});
|
|
1674
1737
|
const latest = loadBundleMetadata(root, bundle);
|
|
1675
1738
|
panel.webview.html = renderDiffHtml(root, latest);
|
|
1676
1739
|
}
|
|
1677
1740
|
|
|
1741
|
+
// src/model/modelPicker.ts
|
|
1742
|
+
var vscode10 = __toESM(require("vscode"));
|
|
1743
|
+
function isRecord2(value) {
|
|
1744
|
+
return typeof value === "object" && value !== null;
|
|
1745
|
+
}
|
|
1746
|
+
function parseProviderList(raw) {
|
|
1747
|
+
try {
|
|
1748
|
+
const data = JSON.parse(raw);
|
|
1749
|
+
if (!Array.isArray(data)) return [];
|
|
1750
|
+
return data.flatMap((entry) => {
|
|
1751
|
+
if (!isRecord2(entry) || typeof entry.id !== "string" || typeof entry.name !== "string") return [];
|
|
1752
|
+
return [
|
|
1753
|
+
{
|
|
1754
|
+
id: entry.id,
|
|
1755
|
+
name: entry.name,
|
|
1756
|
+
accessTypeLabel: typeof entry.accessTypeLabel === "string" ? entry.accessTypeLabel : void 0,
|
|
1757
|
+
providerKind: typeof entry.providerKind === "string" ? entry.providerKind : void 0,
|
|
1758
|
+
runtimeBackend: typeof entry.runtimeBackend === "string" ? entry.runtimeBackend : void 0
|
|
1759
|
+
}
|
|
1760
|
+
];
|
|
1761
|
+
});
|
|
1762
|
+
} catch {
|
|
1763
|
+
return [];
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
function parseProviderModels(raw) {
|
|
1767
|
+
try {
|
|
1768
|
+
const data = JSON.parse(raw);
|
|
1769
|
+
if (!isRecord2(data) || typeof data.provider !== "string" || !Array.isArray(data.models)) return void 0;
|
|
1770
|
+
const source = data.source === "live" || data.source === "cache" || data.source === "static" ? data.source : "static";
|
|
1771
|
+
return {
|
|
1772
|
+
provider: data.provider,
|
|
1773
|
+
source,
|
|
1774
|
+
warning: typeof data.warning === "string" ? data.warning : void 0,
|
|
1775
|
+
models: data.models.flatMap((model) => {
|
|
1776
|
+
if (!isRecord2(model) || typeof model.id !== "string") return [];
|
|
1777
|
+
return [
|
|
1778
|
+
{
|
|
1779
|
+
id: model.id,
|
|
1780
|
+
displayName: typeof model.displayName === "string" ? model.displayName : void 0,
|
|
1781
|
+
description: typeof model.description === "string" ? model.description : void 0,
|
|
1782
|
+
isDefault: Boolean(model.isDefault)
|
|
1783
|
+
}
|
|
1784
|
+
];
|
|
1785
|
+
})
|
|
1786
|
+
};
|
|
1787
|
+
} catch {
|
|
1788
|
+
return void 0;
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
function parseProviderStatus(raw) {
|
|
1792
|
+
try {
|
|
1793
|
+
const data = JSON.parse(raw);
|
|
1794
|
+
if (!isRecord2(data)) return {};
|
|
1795
|
+
return {
|
|
1796
|
+
provider: typeof data.provider === "string" ? data.provider : void 0,
|
|
1797
|
+
model: typeof data.model === "string" ? data.model : void 0
|
|
1798
|
+
};
|
|
1799
|
+
} catch {
|
|
1800
|
+
return {};
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
function parseIdeStatus(raw) {
|
|
1804
|
+
try {
|
|
1805
|
+
const data = JSON.parse(raw);
|
|
1806
|
+
if (!isRecord2(data)) return {};
|
|
1807
|
+
const provider = isRecord2(data.provider) ? data.provider : {};
|
|
1808
|
+
return {
|
|
1809
|
+
model: typeof provider.model === "string" ? provider.model : void 0
|
|
1810
|
+
};
|
|
1811
|
+
} catch {
|
|
1812
|
+
return {};
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
function selectionError(error) {
|
|
1816
|
+
if (error instanceof Error) return error.message;
|
|
1817
|
+
return String(error);
|
|
1818
|
+
}
|
|
1819
|
+
async function pickProviderModel(cwd) {
|
|
1820
|
+
if (!cwd) {
|
|
1821
|
+
vscode10.window.showWarningMessage("Open a workspace folder to pick a UR model.");
|
|
1822
|
+
return;
|
|
1823
|
+
}
|
|
1824
|
+
const [{ stdout: providerStdout }, statusResult, ideStatusResult] = await Promise.all([
|
|
1825
|
+
runUrCliCapture(["provider", "list", "--json"], { cwd }),
|
|
1826
|
+
runUrCliCapture(["provider", "status", "--json"], { cwd }).catch(() => ({ stdout: "" })),
|
|
1827
|
+
runUrCliCapture(["ide", "status", "--json"], { cwd }).catch(() => ({ stdout: "" }))
|
|
1828
|
+
]);
|
|
1829
|
+
const providers = parseProviderList(providerStdout);
|
|
1830
|
+
if (providers.length === 0) {
|
|
1831
|
+
vscode10.window.showWarningMessage("No UR providers were reported by `ur provider list`.");
|
|
1832
|
+
return;
|
|
1833
|
+
}
|
|
1834
|
+
const providerStatus = parseProviderStatus(statusResult.stdout);
|
|
1835
|
+
const ideStatus = parseIdeStatus(ideStatusResult.stdout);
|
|
1836
|
+
const status = { provider: providerStatus.provider, model: providerStatus.model ?? ideStatus.model };
|
|
1837
|
+
const pickedProvider = await vscode10.window.showQuickPick(
|
|
1838
|
+
providers.map((provider) => ({
|
|
1839
|
+
label: provider.name,
|
|
1840
|
+
description: provider.id === status.provider ? "current" : provider.id,
|
|
1841
|
+
detail: [provider.accessTypeLabel, provider.providerKind, provider.runtimeBackend].filter(Boolean).join(" \xB7 "),
|
|
1842
|
+
provider
|
|
1843
|
+
})),
|
|
1844
|
+
{
|
|
1845
|
+
title: "UR: Pick Model",
|
|
1846
|
+
placeHolder: "Choose a provider first"
|
|
1847
|
+
}
|
|
1848
|
+
);
|
|
1849
|
+
if (!pickedProvider) return;
|
|
1850
|
+
let modelsStdout = "";
|
|
1851
|
+
try {
|
|
1852
|
+
const result = await runUrCliCapture(["provider", "models", pickedProvider.provider.id, "--json"], { cwd });
|
|
1853
|
+
modelsStdout = result.stdout;
|
|
1854
|
+
} catch (error) {
|
|
1855
|
+
vscode10.window.showWarningMessage(
|
|
1856
|
+
`UR could not list models for ${pickedProvider.provider.name}: ${selectionError(error)}`
|
|
1857
|
+
);
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
const modelResult = parseProviderModels(modelsStdout);
|
|
1861
|
+
if (!modelResult || modelResult.models.length === 0) {
|
|
1862
|
+
vscode10.window.showWarningMessage(
|
|
1863
|
+
modelResult?.warning ?? `No models are available for ${pickedProvider.provider.name}. Run "ur provider doctor ${pickedProvider.provider.id}" to troubleshoot.`
|
|
1864
|
+
);
|
|
1865
|
+
return;
|
|
1866
|
+
}
|
|
1867
|
+
if (modelResult.warning) {
|
|
1868
|
+
vscode10.window.showWarningMessage(modelResult.warning);
|
|
1869
|
+
}
|
|
1870
|
+
const pickedModel = await vscode10.window.showQuickPick(
|
|
1871
|
+
modelResult.models.map((model) => ({
|
|
1872
|
+
label: model.displayName ?? model.id,
|
|
1873
|
+
description: [
|
|
1874
|
+
model.id === status.model ? "current" : model.id,
|
|
1875
|
+
model.isDefault ? "default" : "",
|
|
1876
|
+
modelResult.source
|
|
1877
|
+
].filter(Boolean).join(" \xB7 "),
|
|
1878
|
+
detail: model.description,
|
|
1879
|
+
model
|
|
1880
|
+
})),
|
|
1881
|
+
{
|
|
1882
|
+
title: `UR: Pick Model for ${pickedProvider.provider.name}`,
|
|
1883
|
+
placeHolder: "Choose a model for this provider"
|
|
1884
|
+
}
|
|
1885
|
+
);
|
|
1886
|
+
if (!pickedModel) return;
|
|
1887
|
+
try {
|
|
1888
|
+
const { stdout } = await runUrCliCapture(
|
|
1889
|
+
["provider", "select-model", pickedProvider.provider.id, pickedModel.model.id, "--json"],
|
|
1890
|
+
{ cwd }
|
|
1891
|
+
);
|
|
1892
|
+
const parsed = JSON.parse(stdout);
|
|
1893
|
+
if (parsed.ok) {
|
|
1894
|
+
vscode10.window.showInformationMessage(
|
|
1895
|
+
`UR model set to ${parsed.model ?? pickedModel.model.id} for ${parsed.provider ?? pickedProvider.provider.id}.`
|
|
1896
|
+
);
|
|
1897
|
+
return;
|
|
1898
|
+
}
|
|
1899
|
+
vscode10.window.showErrorMessage(parsed.message ?? "UR could not save the selected model.");
|
|
1900
|
+
} catch (error) {
|
|
1901
|
+
vscode10.window.showErrorMessage(`UR could not save the selected model: ${selectionError(error)}`);
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1678
1905
|
// src/misc/quickCommands.ts
|
|
1679
|
-
var
|
|
1906
|
+
var vscode11 = __toESM(require("vscode"));
|
|
1680
1907
|
var UR_DOCS_URL = "https://github.com/Maitham16/UR#readme";
|
|
1681
1908
|
async function openSettings() {
|
|
1682
|
-
await
|
|
1909
|
+
await vscode11.commands.executeCommand("workbench.action.openSettings", "UR");
|
|
1683
1910
|
}
|
|
1684
1911
|
async function openDocs() {
|
|
1685
|
-
await
|
|
1912
|
+
await vscode11.env.openExternal(vscode11.Uri.parse(UR_DOCS_URL));
|
|
1686
1913
|
}
|
|
1687
1914
|
async function openArtifacts() {
|
|
1688
1915
|
const root = workspaceRoot();
|
|
1689
1916
|
if (!root) {
|
|
1690
|
-
|
|
1917
|
+
vscode11.window.showWarningMessage("Open a workspace folder to view UR artifacts.");
|
|
1691
1918
|
return;
|
|
1692
1919
|
}
|
|
1693
|
-
const uri =
|
|
1920
|
+
const uri = vscode11.Uri.joinPath(vscode11.Uri.file(root), ".ur");
|
|
1694
1921
|
try {
|
|
1695
|
-
await
|
|
1922
|
+
await vscode11.commands.executeCommand("revealInExplorer", uri);
|
|
1696
1923
|
} catch {
|
|
1697
|
-
|
|
1924
|
+
vscode11.window.showInformationMessage("No .ur directory yet \u2014 it is created the first time UR runs in this workspace.");
|
|
1698
1925
|
}
|
|
1699
1926
|
}
|
|
1700
1927
|
async function runSpecAction(chat) {
|
|
@@ -1705,7 +1932,7 @@ async function runWorkflowAction(chat) {
|
|
|
1705
1932
|
}
|
|
1706
1933
|
|
|
1707
1934
|
// src/options/agentOptionsPanel.ts
|
|
1708
|
-
var
|
|
1935
|
+
var vscode12 = __toESM(require("vscode"));
|
|
1709
1936
|
|
|
1710
1937
|
// src/options/agentOptions.ts
|
|
1711
1938
|
function ids(options) {
|
|
@@ -1793,7 +2020,7 @@ function deriveMultimodalSupport(providerId) {
|
|
|
1793
2020
|
// src/options/providerOptionsLoader.ts
|
|
1794
2021
|
var PROVIDER_KINDS = ["ur-native", "subscription-cli", "subscription-placeholder"];
|
|
1795
2022
|
var ACCESS_TYPES = ["subscription", "api", "local", "server"];
|
|
1796
|
-
function
|
|
2023
|
+
function isRecord3(value) {
|
|
1797
2024
|
return typeof value === "object" && value !== null;
|
|
1798
2025
|
}
|
|
1799
2026
|
function parseProviderListJson(raw) {
|
|
@@ -1806,7 +2033,7 @@ function parseProviderListJson(raw) {
|
|
|
1806
2033
|
if (!Array.isArray(data)) return [];
|
|
1807
2034
|
const options = [];
|
|
1808
2035
|
for (const entry of data) {
|
|
1809
|
-
if (!
|
|
2036
|
+
if (!isRecord3(entry)) continue;
|
|
1810
2037
|
if (typeof entry.id !== "string" || typeof entry.name !== "string") continue;
|
|
1811
2038
|
const providerKind = PROVIDER_KINDS.includes(entry.providerKind) ? entry.providerKind : "subscription-placeholder";
|
|
1812
2039
|
const accessType = ACCESS_TYPES.includes(entry.accessType) ? entry.accessType : "api";
|
|
@@ -1918,10 +2145,10 @@ var AgentOptionsPanel = class _AgentOptionsPanel {
|
|
|
1918
2145
|
}
|
|
1919
2146
|
static createOrShow(onRefresh) {
|
|
1920
2147
|
if (_AgentOptionsPanel.current && !_AgentOptionsPanel.current.disposed) {
|
|
1921
|
-
_AgentOptionsPanel.current.panel.reveal(
|
|
2148
|
+
_AgentOptionsPanel.current.panel.reveal(vscode12.ViewColumn.Active);
|
|
1922
2149
|
return _AgentOptionsPanel.current;
|
|
1923
2150
|
}
|
|
1924
|
-
const panel =
|
|
2151
|
+
const panel = vscode12.window.createWebviewPanel("urAgentOptions", "UR Agent Options", vscode12.ViewColumn.Active, {
|
|
1925
2152
|
enableScripts: true
|
|
1926
2153
|
});
|
|
1927
2154
|
const instance = new _AgentOptionsPanel(panel, onRefresh);
|
|
@@ -1939,7 +2166,7 @@ var AgentOptionsPanel = class _AgentOptionsPanel {
|
|
|
1939
2166
|
};
|
|
1940
2167
|
async function showAgentOptions(cwd) {
|
|
1941
2168
|
if (!cwd) {
|
|
1942
|
-
|
|
2169
|
+
vscode12.window.showWarningMessage("Open a workspace folder to view UR agent options.");
|
|
1943
2170
|
return;
|
|
1944
2171
|
}
|
|
1945
2172
|
let panel;
|
|
@@ -1956,7 +2183,7 @@ async function showAgentOptions(cwd) {
|
|
|
1956
2183
|
// src/review/reviewDiff.ts
|
|
1957
2184
|
var import_node_child_process4 = require("node:child_process");
|
|
1958
2185
|
var import_node_util3 = require("node:util");
|
|
1959
|
-
var
|
|
2186
|
+
var vscode13 = __toESM(require("vscode"));
|
|
1960
2187
|
|
|
1961
2188
|
// src/review/reviewPrompt.ts
|
|
1962
2189
|
var LARGE_DIFF_THRESHOLD = 2e4;
|
|
@@ -1980,22 +2207,22 @@ async function captureGitDiff(cwd) {
|
|
|
1980
2207
|
async function reviewCurrentDiff(chat) {
|
|
1981
2208
|
const root = workspaceRoot();
|
|
1982
2209
|
if (!root) {
|
|
1983
|
-
|
|
2210
|
+
vscode13.window.showWarningMessage("Open a workspace folder to review a diff.");
|
|
1984
2211
|
return;
|
|
1985
2212
|
}
|
|
1986
2213
|
let diff;
|
|
1987
2214
|
try {
|
|
1988
2215
|
diff = await captureGitDiff(root);
|
|
1989
2216
|
} catch (error) {
|
|
1990
|
-
|
|
2217
|
+
vscode13.window.showErrorMessage(`Could not read the current git diff: ${processErrorMessage(error)}`);
|
|
1991
2218
|
return;
|
|
1992
2219
|
}
|
|
1993
2220
|
if (!diff.trim()) {
|
|
1994
|
-
|
|
2221
|
+
vscode13.window.showInformationMessage("No changes to review (working tree matches HEAD).");
|
|
1995
2222
|
return;
|
|
1996
2223
|
}
|
|
1997
2224
|
if (diff.length > LARGE_DIFF_THRESHOLD) {
|
|
1998
|
-
const choice = await
|
|
2225
|
+
const choice = await vscode13.window.showWarningMessage(
|
|
1999
2226
|
`The current diff is large (${diff.length.toLocaleString()} characters). Send it to UR for review?`,
|
|
2000
2227
|
{ modal: true },
|
|
2001
2228
|
"Send"
|
|
@@ -2006,7 +2233,7 @@ async function reviewCurrentDiff(chat) {
|
|
|
2006
2233
|
}
|
|
2007
2234
|
|
|
2008
2235
|
// src/search/searchQuickPick.ts
|
|
2009
|
-
var
|
|
2236
|
+
var vscode14 = __toESM(require("vscode"));
|
|
2010
2237
|
|
|
2011
2238
|
// src/search/actionRegistry.ts
|
|
2012
2239
|
var ACTION_REGISTRY = [
|
|
@@ -2020,6 +2247,7 @@ var ACTION_REGISTRY = [
|
|
|
2020
2247
|
{ id: "providerStatus", label: "Provider Status", commandId: "urInlineDiffs.status", description: "Show provider, model, and plugin status" },
|
|
2021
2248
|
{ id: "agentStatus", label: "Agent Status", commandId: "urInlineDiffs.agentStatus", description: "Open the UR agent status card" },
|
|
2022
2249
|
{ id: "agentOptions", label: "Agent Options", commandId: "urInlineDiffs.agentOptions", description: "Open curated provider recommendations" },
|
|
2250
|
+
{ id: "pickModel", label: "Pick Model", commandId: "urInlineDiffs.pickModel", description: "Choose a provider-scoped UR model" },
|
|
2023
2251
|
{ id: "openSettings", label: "Open Settings", commandId: "urInlineDiffs.openSettings", description: "Open VS Code settings filtered to UR" },
|
|
2024
2252
|
{ id: "openDocs", label: "Open Docs", commandId: "urInlineDiffs.openDocs", description: "Open the UR documentation" },
|
|
2025
2253
|
{ id: "openArtifacts", label: "Open Artifacts", commandId: "urInlineDiffs.openArtifacts", description: "Reveal the .ur workspace directory" },
|
|
@@ -2035,26 +2263,26 @@ async function showSearchActions() {
|
|
|
2035
2263
|
detail: action.description,
|
|
2036
2264
|
commandId: action.commandId
|
|
2037
2265
|
}));
|
|
2038
|
-
const picked = await
|
|
2266
|
+
const picked = await vscode14.window.showQuickPick(items, {
|
|
2039
2267
|
title: "UR: Search Actions",
|
|
2040
2268
|
placeHolder: "Search UR actions",
|
|
2041
2269
|
matchOnDetail: true
|
|
2042
2270
|
});
|
|
2043
2271
|
if (!picked) return;
|
|
2044
|
-
await
|
|
2272
|
+
await vscode14.commands.executeCommand(picked.commandId);
|
|
2045
2273
|
}
|
|
2046
2274
|
|
|
2047
2275
|
// src/status/statusPanel.ts
|
|
2048
|
-
var
|
|
2276
|
+
var vscode15 = __toESM(require("vscode"));
|
|
2049
2277
|
|
|
2050
2278
|
// src/status/statusData.ts
|
|
2051
|
-
function
|
|
2279
|
+
function isRecord4(value) {
|
|
2052
2280
|
return typeof value === "object" && value !== null;
|
|
2053
2281
|
}
|
|
2054
2282
|
function safeParseRecord(raw) {
|
|
2055
2283
|
try {
|
|
2056
2284
|
const parsed = JSON.parse(raw);
|
|
2057
|
-
return
|
|
2285
|
+
return isRecord4(parsed) ? parsed : {};
|
|
2058
2286
|
} catch {
|
|
2059
2287
|
return {};
|
|
2060
2288
|
}
|
|
@@ -2067,8 +2295,8 @@ function asKnownBoolean(value) {
|
|
|
2067
2295
|
}
|
|
2068
2296
|
function parseIdeStatusJson(raw, fallbackWorkspaceRoot = "") {
|
|
2069
2297
|
const data = safeParseRecord(raw);
|
|
2070
|
-
const acpRaw =
|
|
2071
|
-
const providerRaw =
|
|
2298
|
+
const acpRaw = isRecord4(data.acp) ? data.acp : {};
|
|
2299
|
+
const providerRaw = isRecord4(data.provider) ? data.provider : {};
|
|
2072
2300
|
return {
|
|
2073
2301
|
workspaceRoot: typeof data.workspaceRoot === "string" && data.workspaceRoot ? data.workspaceRoot : fallbackWorkspaceRoot,
|
|
2074
2302
|
acp: {
|
|
@@ -2214,10 +2442,10 @@ var StatusPanel = class _StatusPanel {
|
|
|
2214
2442
|
}
|
|
2215
2443
|
static createOrShow(onRefresh) {
|
|
2216
2444
|
if (_StatusPanel.current && !_StatusPanel.current.disposed) {
|
|
2217
|
-
_StatusPanel.current.panel.reveal(
|
|
2445
|
+
_StatusPanel.current.panel.reveal(vscode15.ViewColumn.Active);
|
|
2218
2446
|
return _StatusPanel.current;
|
|
2219
2447
|
}
|
|
2220
|
-
const panel =
|
|
2448
|
+
const panel = vscode15.window.createWebviewPanel("urAgentStatus", "UR Agent Status", vscode15.ViewColumn.Active, {
|
|
2221
2449
|
enableScripts: true
|
|
2222
2450
|
});
|
|
2223
2451
|
const instance = new _StatusPanel(panel, onRefresh);
|
|
@@ -2235,7 +2463,7 @@ var StatusPanel = class _StatusPanel {
|
|
|
2235
2463
|
};
|
|
2236
2464
|
async function showAgentStatus(cwd) {
|
|
2237
2465
|
if (!cwd) {
|
|
2238
|
-
|
|
2466
|
+
vscode15.window.showWarningMessage("Open a workspace folder to view UR agent status.");
|
|
2239
2467
|
return;
|
|
2240
2468
|
}
|
|
2241
2469
|
let panel;
|
|
@@ -2250,7 +2478,7 @@ async function showAgentStatus(cwd) {
|
|
|
2250
2478
|
}
|
|
2251
2479
|
|
|
2252
2480
|
// src/verify/runVerifier.ts
|
|
2253
|
-
var
|
|
2481
|
+
var vscode16 = __toESM(require("vscode"));
|
|
2254
2482
|
|
|
2255
2483
|
// src/verify/verifierPrompt.ts
|
|
2256
2484
|
function buildVerifierPrompt() {
|
|
@@ -2265,7 +2493,7 @@ function buildVerifierPrompt() {
|
|
|
2265
2493
|
async function runVerifier(chat) {
|
|
2266
2494
|
const root = workspaceRoot();
|
|
2267
2495
|
if (!root) {
|
|
2268
|
-
|
|
2496
|
+
vscode16.window.showWarningMessage("Open a workspace folder to run the UR verifier.");
|
|
2269
2497
|
return;
|
|
2270
2498
|
}
|
|
2271
2499
|
await chat.runStructuredPrompt(buildVerifierPrompt());
|
|
@@ -2275,16 +2503,21 @@ async function runVerifier(chat) {
|
|
|
2275
2503
|
function activate(context) {
|
|
2276
2504
|
const diffTreeProvider = new DiffTreeProvider();
|
|
2277
2505
|
const actionsTreeProvider = new ActionsTreeProvider();
|
|
2278
|
-
const channel =
|
|
2279
|
-
const
|
|
2506
|
+
const channel = vscode17.window.createOutputChannel("UR");
|
|
2507
|
+
const chat = new ChatController();
|
|
2508
|
+
const chatTreeProvider = new ChatTreeProvider(chat);
|
|
2509
|
+
const chatTree = vscode17.window.createTreeView("urChat", {
|
|
2510
|
+
treeDataProvider: chatTreeProvider,
|
|
2511
|
+
showCollapseAll: false
|
|
2512
|
+
});
|
|
2513
|
+
const diffTree = vscode17.window.createTreeView("urInlineDiffs", {
|
|
2280
2514
|
treeDataProvider: diffTreeProvider,
|
|
2281
2515
|
showCollapseAll: false
|
|
2282
2516
|
});
|
|
2283
|
-
const actionsTree =
|
|
2517
|
+
const actionsTree = vscode17.window.createTreeView("urActions", {
|
|
2284
2518
|
treeDataProvider: actionsTreeProvider,
|
|
2285
2519
|
showCollapseAll: false
|
|
2286
2520
|
});
|
|
2287
|
-
const chat = new ChatController();
|
|
2288
2521
|
const bothDiffViews = {
|
|
2289
2522
|
refresh: () => {
|
|
2290
2523
|
diffTreeProvider.refresh();
|
|
@@ -2293,35 +2526,40 @@ function activate(context) {
|
|
|
2293
2526
|
};
|
|
2294
2527
|
context.subscriptions.push(
|
|
2295
2528
|
channel,
|
|
2529
|
+
chatTree,
|
|
2296
2530
|
diffTree,
|
|
2297
2531
|
actionsTree,
|
|
2298
2532
|
chat,
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2533
|
+
chat.onDidChangeState(() => chatTreeProvider.refresh()),
|
|
2534
|
+
vscode17.window.onDidChangeActiveTextEditor(() => chatTreeProvider.refresh()),
|
|
2535
|
+
vscode17.window.onDidChangeTextEditorSelection(() => chatTreeProvider.refresh()),
|
|
2536
|
+
vscode17.commands.registerCommand("urInlineDiffs.refresh", () => diffTreeProvider.refresh()),
|
|
2537
|
+
vscode17.commands.registerCommand("urInlineDiffs.open", (item) => openDiff(item)),
|
|
2538
|
+
vscode17.commands.registerCommand("urInlineDiffs.comment", (item) => commentDiff(item, bothDiffViews)),
|
|
2539
|
+
vscode17.commands.registerCommand("urInlineDiffs.apply", (item) => applyDiff(item, bothDiffViews)),
|
|
2540
|
+
vscode17.commands.registerCommand("urInlineDiffs.reject", (item) => rejectDiff(item, bothDiffViews)),
|
|
2541
|
+
vscode17.commands.registerCommand("urInlineDiffs.status", () => showStatus(channel)),
|
|
2542
|
+
vscode17.commands.registerCommand("urInlineDiffs.chat.new", () => chat.newChat()),
|
|
2543
|
+
vscode17.commands.registerCommand("urInlineDiffs.chat.open", () => chat.openChat()),
|
|
2544
|
+
vscode17.commands.registerCommand("urInlineDiffs.chat.cancel", () => chat.cancelCurrentRequest()),
|
|
2545
|
+
vscode17.commands.registerCommand("urInlineDiffs.chat.addFile", () => chat.addCurrentFileToChat()),
|
|
2546
|
+
vscode17.commands.registerCommand("urInlineDiffs.chat.addSelection", () => chat.addSelectionToChat()),
|
|
2547
|
+
vscode17.commands.registerCommand("urInlineDiffs.chat.explainSelection", () => chat.explainSelection()),
|
|
2548
|
+
vscode17.commands.registerCommand("urInlineDiffs.chat.fixSelection", () => chat.fixSelection()),
|
|
2549
|
+
vscode17.commands.registerCommand("urInlineDiffs.chat.generateTests", () => chat.generateTestsForSelection()),
|
|
2550
|
+
vscode17.commands.registerCommand("urInlineDiffs.agentStatus", () => showAgentStatus(workspaceRoot())),
|
|
2551
|
+
vscode17.commands.registerCommand("urInlineDiffs.agentOptions", () => showAgentOptions(workspaceRoot())),
|
|
2552
|
+
vscode17.commands.registerCommand("urInlineDiffs.reviewCurrentDiff", () => reviewCurrentDiff(chat)),
|
|
2553
|
+
vscode17.commands.registerCommand("urInlineDiffs.runVerifier", () => runVerifier(chat)),
|
|
2554
|
+
vscode17.commands.registerCommand("urInlineDiffs.searchActions", () => showSearchActions()),
|
|
2555
|
+
vscode17.commands.registerCommand("urInlineDiffs.pickModel", () => pickProviderModel(workspaceRoot())),
|
|
2556
|
+
vscode17.commands.registerCommand("urInlineDiffs.openSettings", () => openSettings()),
|
|
2557
|
+
vscode17.commands.registerCommand("urInlineDiffs.openDocs", () => openDocs()),
|
|
2558
|
+
vscode17.commands.registerCommand("urInlineDiffs.openArtifacts", () => openArtifacts()),
|
|
2559
|
+
vscode17.commands.registerCommand("urInlineDiffs.runSpec", () => runSpecAction(chat)),
|
|
2560
|
+
vscode17.commands.registerCommand("urInlineDiffs.runWorkflow", () => runWorkflowAction(chat)),
|
|
2561
|
+
vscode17.commands.registerCommand("urActions.refresh", () => actionsTreeProvider.refresh()),
|
|
2562
|
+
vscode17.commands.registerCommand("urActions.openBackgroundLog", (item) => openBackgroundLog(item))
|
|
2325
2563
|
);
|
|
2326
2564
|
}
|
|
2327
2565
|
function deactivate() {
|