@serkanalgur/opencode-nexus 1.0.3 → 1.0.5
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/tui.js +201 -209
- package/package.json +1 -1
package/dist/tui.js
CHANGED
|
@@ -62,9 +62,6 @@ function createContext(defaultValue) {
|
|
|
62
62
|
defaultValue
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
function useContext(context) {
|
|
66
|
-
return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
|
|
67
|
-
}
|
|
68
65
|
function children(fn) {
|
|
69
66
|
const memo = createMemo(() => resolveChildren(fn()));
|
|
70
67
|
memo.toArray = () => {
|
|
@@ -109,12 +106,6 @@ var SuspenseContext = createContext();
|
|
|
109
106
|
|
|
110
107
|
// node_modules/@opencode/plugin/dist/tui/solid.js
|
|
111
108
|
var PluginContext = createContext();
|
|
112
|
-
function usePlugin() {
|
|
113
|
-
const context = useContext(PluginContext);
|
|
114
|
-
if (!context)
|
|
115
|
-
throw new Error("PluginContextProvider is missing");
|
|
116
|
-
return context;
|
|
117
|
-
}
|
|
118
109
|
// src/config.ts
|
|
119
110
|
var DEFAULT_CONFIG = {
|
|
120
111
|
models: {
|
|
@@ -34140,113 +34131,184 @@ function jsx(type, props = {}) {
|
|
|
34140
34131
|
function jsxDEV(type, props = {}) {
|
|
34141
34132
|
return jsx(type, props);
|
|
34142
34133
|
}
|
|
34134
|
+
function Fragment(props) {
|
|
34135
|
+
return props.children ?? null;
|
|
34136
|
+
}
|
|
34143
34137
|
// src/tui.tsx
|
|
34144
|
-
|
|
34145
|
-
|
|
34146
|
-
|
|
34147
|
-
|
|
34148
|
-
|
|
34149
|
-
|
|
34150
|
-
|
|
34151
|
-
|
|
34152
|
-
|
|
34138
|
+
var tui_default = define({
|
|
34139
|
+
id: "nexus.cli",
|
|
34140
|
+
setup(context) {
|
|
34141
|
+
const configManager = new NexusConfigManager;
|
|
34142
|
+
const handleModelSelect = async (role) => {
|
|
34143
|
+
if (!configManager.getRoles().includes(role)) {
|
|
34144
|
+
context.ui.toast.show({
|
|
34145
|
+
title: "Nexus",
|
|
34146
|
+
message: `Unknown role: ${role}. Valid: ${configManager.getRoles().join(", ")}`,
|
|
34147
|
+
variant: "error"
|
|
34148
|
+
});
|
|
34149
|
+
return;
|
|
34150
|
+
}
|
|
34151
|
+
const location = context.location ?? context.data.location.default();
|
|
34152
|
+
await context.data.location.model.sync(location);
|
|
34153
|
+
const availableModels = context.data.location.model.list(location) ?? [];
|
|
34154
|
+
const options = availableModels.map((m) => ({
|
|
34155
|
+
title: m.name || m.id,
|
|
34156
|
+
value: `${m.providerID}/${m.id}`,
|
|
34157
|
+
description: m.providerID
|
|
34158
|
+
}));
|
|
34159
|
+
options.push({
|
|
34160
|
+
title: "Use default",
|
|
34161
|
+
value: "",
|
|
34162
|
+
description: "Reset to default model"
|
|
34153
34163
|
});
|
|
34154
|
-
|
|
34155
|
-
|
|
34156
|
-
|
|
34157
|
-
|
|
34158
|
-
|
|
34159
|
-
const options = availableModels.map((m) => ({
|
|
34160
|
-
title: m.name || m.id,
|
|
34161
|
-
value: `${m.providerID}/${m.id}`,
|
|
34162
|
-
description: m.providerID
|
|
34163
|
-
}));
|
|
34164
|
-
options.push({
|
|
34165
|
-
title: "Use default",
|
|
34166
|
-
value: "",
|
|
34167
|
-
description: "Reset to default model"
|
|
34168
|
-
});
|
|
34169
|
-
const current = configManager.getModelForRole(role);
|
|
34170
|
-
const selected = await context.ui.dialog.select({
|
|
34171
|
-
title: `${configManager.getRoleDisplayName(role)} Model`,
|
|
34172
|
-
current: current || "",
|
|
34173
|
-
options
|
|
34174
|
-
});
|
|
34175
|
-
if (selected !== null && selected !== undefined) {
|
|
34176
|
-
configManager.setModel(role, selected);
|
|
34177
|
-
context.ui.toast.show({
|
|
34178
|
-
title: "Nexus",
|
|
34179
|
-
message: `${role} → ${selected || "default"}`,
|
|
34180
|
-
variant: "success"
|
|
34164
|
+
const current = configManager.getModelForRole(role);
|
|
34165
|
+
const selected = await context.ui.dialog.select({
|
|
34166
|
+
title: `${configManager.getRoleDisplayName(role)} Model`,
|
|
34167
|
+
current: current || "",
|
|
34168
|
+
options
|
|
34181
34169
|
});
|
|
34182
|
-
|
|
34183
|
-
|
|
34184
|
-
const handleConfigDialog = async () => {
|
|
34185
|
-
const config = configManager.getConfig();
|
|
34186
|
-
const budgetStr = await context.ui.dialog.prompt({
|
|
34187
|
-
title: "Max Total Budget ($)",
|
|
34188
|
-
placeholder: String(config.budget.maxTotalCost)
|
|
34189
|
-
});
|
|
34190
|
-
if (budgetStr !== null && budgetStr !== undefined) {
|
|
34191
|
-
const budget = parseFloat(budgetStr);
|
|
34192
|
-
if (!isNaN(budget) && budget > 0) {
|
|
34193
|
-
configManager.updateStorageConfig({
|
|
34194
|
-
budget: { ...config.budget, maxTotalCost: budget }
|
|
34195
|
-
});
|
|
34170
|
+
if (selected !== null && selected !== undefined) {
|
|
34171
|
+
configManager.setModel(role, selected);
|
|
34196
34172
|
context.ui.toast.show({
|
|
34197
34173
|
title: "Nexus",
|
|
34198
|
-
message:
|
|
34174
|
+
message: `${role} → ${selected || "default"}`,
|
|
34199
34175
|
variant: "success"
|
|
34200
34176
|
});
|
|
34201
34177
|
}
|
|
34202
|
-
}
|
|
34203
|
-
|
|
34204
|
-
|
|
34205
|
-
|
|
34206
|
-
|
|
34207
|
-
|
|
34208
|
-
|
|
34209
|
-
|
|
34210
|
-
|
|
34211
|
-
|
|
34212
|
-
|
|
34213
|
-
|
|
34214
|
-
|
|
34215
|
-
|
|
34216
|
-
|
|
34217
|
-
|
|
34218
|
-
|
|
34219
|
-
|
|
34220
|
-
|
|
34221
|
-
|
|
34222
|
-
|
|
34223
|
-
|
|
34224
|
-
|
|
34225
|
-
|
|
34226
|
-
|
|
34227
|
-
|
|
34228
|
-
|
|
34229
|
-
|
|
34230
|
-
|
|
34231
|
-
|
|
34232
|
-
|
|
34233
|
-
|
|
34234
|
-
|
|
34178
|
+
};
|
|
34179
|
+
const handleConfigDialog = async () => {
|
|
34180
|
+
const config = configManager.getConfig();
|
|
34181
|
+
const budgetStr = await context.ui.dialog.prompt({
|
|
34182
|
+
title: "Max Total Budget ($)",
|
|
34183
|
+
placeholder: String(config.budget.maxTotalCost)
|
|
34184
|
+
});
|
|
34185
|
+
if (budgetStr !== null && budgetStr !== undefined) {
|
|
34186
|
+
const budget = parseFloat(budgetStr);
|
|
34187
|
+
if (!isNaN(budget) && budget > 0) {
|
|
34188
|
+
configManager.updateStorageConfig({
|
|
34189
|
+
budget: { ...config.budget, maxTotalCost: budget }
|
|
34190
|
+
});
|
|
34191
|
+
context.ui.toast.show({
|
|
34192
|
+
title: "Nexus",
|
|
34193
|
+
message: `Budget updated: $${budget}`,
|
|
34194
|
+
variant: "success"
|
|
34195
|
+
});
|
|
34196
|
+
}
|
|
34197
|
+
}
|
|
34198
|
+
};
|
|
34199
|
+
const handleFullConfig = async () => {
|
|
34200
|
+
for (const role of configManager.getRoles()) {
|
|
34201
|
+
await handleModelSelect(role);
|
|
34202
|
+
}
|
|
34203
|
+
await handleConfigDialog();
|
|
34204
|
+
context.ui.toast.show({
|
|
34205
|
+
title: "Nexus",
|
|
34206
|
+
message: "Configuration complete!",
|
|
34207
|
+
variant: "success"
|
|
34208
|
+
});
|
|
34209
|
+
};
|
|
34210
|
+
context.ui.slot({
|
|
34211
|
+
append: "app",
|
|
34212
|
+
render: () => {
|
|
34213
|
+
context.keymap.layer(() => ({
|
|
34214
|
+
mode: "global",
|
|
34215
|
+
priority: 10,
|
|
34216
|
+
commands: [
|
|
34217
|
+
{
|
|
34218
|
+
id: "nexus",
|
|
34219
|
+
title: "Nexus Configuration",
|
|
34220
|
+
group: "Nexus",
|
|
34221
|
+
bind: "ctrl+n",
|
|
34222
|
+
palette: true,
|
|
34223
|
+
slash: { name: "nexus", aliases: [], arguments: true },
|
|
34224
|
+
enabled: () => true,
|
|
34225
|
+
suggested: true,
|
|
34226
|
+
run: async (input) => {
|
|
34227
|
+
if (input) {
|
|
34228
|
+
const parts = input.split(" ");
|
|
34229
|
+
const cmd = parts[0];
|
|
34230
|
+
switch (cmd) {
|
|
34231
|
+
case "config":
|
|
34232
|
+
case "c":
|
|
34233
|
+
await handleFullConfig();
|
|
34234
|
+
break;
|
|
34235
|
+
case "status":
|
|
34236
|
+
case "s":
|
|
34237
|
+
context.ui.toast.show({
|
|
34238
|
+
title: "Nexus Status",
|
|
34239
|
+
message: configManager.getSummary(),
|
|
34240
|
+
variant: "info",
|
|
34241
|
+
duration: 8000
|
|
34242
|
+
});
|
|
34243
|
+
break;
|
|
34244
|
+
case "model":
|
|
34245
|
+
case "m":
|
|
34246
|
+
if (parts[1]) {
|
|
34247
|
+
await handleModelSelect(parts[1]);
|
|
34248
|
+
} else {
|
|
34249
|
+
const role = await context.ui.dialog.select({
|
|
34250
|
+
title: "Select Agent Role",
|
|
34251
|
+
options: configManager.getRoles().map((r) => ({
|
|
34252
|
+
title: configManager.getRoleDisplayName(r),
|
|
34253
|
+
value: r,
|
|
34254
|
+
description: `Current: ${configManager.getModelForRole(r)}`
|
|
34255
|
+
}))
|
|
34256
|
+
});
|
|
34257
|
+
if (role) {
|
|
34258
|
+
await handleModelSelect(role);
|
|
34259
|
+
}
|
|
34260
|
+
}
|
|
34261
|
+
break;
|
|
34262
|
+
case "reset":
|
|
34263
|
+
const confirmed = await context.ui.dialog.confirm({
|
|
34264
|
+
title: "Reset Configuration",
|
|
34265
|
+
message: "Reset all Nexus settings to defaults?",
|
|
34266
|
+
label: { confirm: "Reset", cancel: "Cancel" }
|
|
34267
|
+
});
|
|
34268
|
+
if (confirmed) {
|
|
34269
|
+
configManager.resetToDefaults();
|
|
34270
|
+
context.ui.toast.show({
|
|
34271
|
+
title: "Nexus",
|
|
34272
|
+
message: "Configuration reset to defaults",
|
|
34273
|
+
variant: "success"
|
|
34274
|
+
});
|
|
34275
|
+
}
|
|
34276
|
+
break;
|
|
34277
|
+
default:
|
|
34278
|
+
context.ui.toast.show({
|
|
34279
|
+
title: "Nexus",
|
|
34280
|
+
message: "Commands: config, status, model <role>, reset",
|
|
34281
|
+
variant: "info"
|
|
34282
|
+
});
|
|
34283
|
+
}
|
|
34284
|
+
} else {
|
|
34285
|
+
await handleFullConfig();
|
|
34286
|
+
}
|
|
34287
|
+
}
|
|
34288
|
+
},
|
|
34289
|
+
{
|
|
34290
|
+
id: "nexus.config",
|
|
34291
|
+
title: "Nexus Configuration",
|
|
34292
|
+
group: "Nexus",
|
|
34293
|
+
palette: true,
|
|
34294
|
+
slash: { name: "nexus-config", aliases: ["nc"], arguments: true },
|
|
34295
|
+
enabled: () => true,
|
|
34296
|
+
suggested: true,
|
|
34297
|
+
run: async () => {
|
|
34235
34298
|
await handleFullConfig();
|
|
34236
|
-
|
|
34237
|
-
|
|
34238
|
-
|
|
34239
|
-
|
|
34240
|
-
|
|
34241
|
-
|
|
34242
|
-
|
|
34243
|
-
|
|
34244
|
-
|
|
34245
|
-
|
|
34246
|
-
|
|
34247
|
-
|
|
34248
|
-
|
|
34249
|
-
await handleModelSelect(parts[1]);
|
|
34299
|
+
}
|
|
34300
|
+
},
|
|
34301
|
+
{
|
|
34302
|
+
id: "nexus.model",
|
|
34303
|
+
title: "Select Agent Model",
|
|
34304
|
+
group: "Nexus",
|
|
34305
|
+
palette: true,
|
|
34306
|
+
slash: { name: "nexus-model", aliases: ["nm"], arguments: true },
|
|
34307
|
+
enabled: () => true,
|
|
34308
|
+
suggested: true,
|
|
34309
|
+
run: async (input) => {
|
|
34310
|
+
if (input) {
|
|
34311
|
+
await handleModelSelect(input);
|
|
34250
34312
|
} else {
|
|
34251
34313
|
const role = await context.ui.dialog.select({
|
|
34252
34314
|
title: "Select Agent Role",
|
|
@@ -34260,8 +34322,33 @@ function NexusKeymapSlot() {
|
|
|
34260
34322
|
await handleModelSelect(role);
|
|
34261
34323
|
}
|
|
34262
34324
|
}
|
|
34263
|
-
|
|
34264
|
-
|
|
34325
|
+
}
|
|
34326
|
+
},
|
|
34327
|
+
{
|
|
34328
|
+
id: "nexus.status",
|
|
34329
|
+
title: "Nexus Status",
|
|
34330
|
+
group: "Nexus",
|
|
34331
|
+
palette: true,
|
|
34332
|
+
slash: { name: "nexus-status", aliases: ["ns"], arguments: true },
|
|
34333
|
+
enabled: () => true,
|
|
34334
|
+
suggested: true,
|
|
34335
|
+
run: async () => {
|
|
34336
|
+
context.ui.toast.show({
|
|
34337
|
+
title: "Nexus Status",
|
|
34338
|
+
message: configManager.getSummary(),
|
|
34339
|
+
variant: "info",
|
|
34340
|
+
duration: 8000
|
|
34341
|
+
});
|
|
34342
|
+
}
|
|
34343
|
+
},
|
|
34344
|
+
{
|
|
34345
|
+
id: "nexus.reset",
|
|
34346
|
+
title: "Reset Nexus Config",
|
|
34347
|
+
group: "Nexus",
|
|
34348
|
+
palette: true,
|
|
34349
|
+
slash: { name: "nexus-reset", aliases: [], arguments: true },
|
|
34350
|
+
enabled: () => true,
|
|
34351
|
+
run: async () => {
|
|
34265
34352
|
const confirmed = await context.ui.dialog.confirm({
|
|
34266
34353
|
title: "Reset Configuration",
|
|
34267
34354
|
message: "Reset all Nexus settings to defaults?",
|
|
@@ -34275,108 +34362,13 @@ function NexusKeymapSlot() {
|
|
|
34275
34362
|
variant: "success"
|
|
34276
34363
|
});
|
|
34277
34364
|
}
|
|
34278
|
-
|
|
34279
|
-
default:
|
|
34280
|
-
context.ui.toast.show({
|
|
34281
|
-
title: "Nexus",
|
|
34282
|
-
message: "Commands: config, status, model <role>, reset",
|
|
34283
|
-
variant: "info"
|
|
34284
|
-
});
|
|
34285
|
-
}
|
|
34286
|
-
} else {
|
|
34287
|
-
await handleFullConfig();
|
|
34288
|
-
}
|
|
34289
|
-
}
|
|
34290
|
-
},
|
|
34291
|
-
{
|
|
34292
|
-
id: "nexus.config",
|
|
34293
|
-
title: "Nexus Configuration",
|
|
34294
|
-
group: "Nexus",
|
|
34295
|
-
palette: true,
|
|
34296
|
-
slash: { name: "nexus-config", aliases: ["nc"], arguments: true },
|
|
34297
|
-
enabled: () => true,
|
|
34298
|
-
suggested: true,
|
|
34299
|
-
run: async () => {
|
|
34300
|
-
await handleFullConfig();
|
|
34301
|
-
}
|
|
34302
|
-
},
|
|
34303
|
-
{
|
|
34304
|
-
id: "nexus.model",
|
|
34305
|
-
title: "Select Agent Model",
|
|
34306
|
-
group: "Nexus",
|
|
34307
|
-
palette: true,
|
|
34308
|
-
slash: { name: "nexus-model", aliases: ["nm"], arguments: true },
|
|
34309
|
-
enabled: () => true,
|
|
34310
|
-
suggested: true,
|
|
34311
|
-
run: async (input) => {
|
|
34312
|
-
if (input) {
|
|
34313
|
-
await handleModelSelect(input);
|
|
34314
|
-
} else {
|
|
34315
|
-
const role = await context.ui.dialog.select({
|
|
34316
|
-
title: "Select Agent Role",
|
|
34317
|
-
options: configManager.getRoles().map((r) => ({
|
|
34318
|
-
title: configManager.getRoleDisplayName(r),
|
|
34319
|
-
value: r,
|
|
34320
|
-
description: `Current: ${configManager.getModelForRole(r)}`
|
|
34321
|
-
}))
|
|
34322
|
-
});
|
|
34323
|
-
if (role) {
|
|
34324
|
-
await handleModelSelect(role);
|
|
34365
|
+
}
|
|
34325
34366
|
}
|
|
34326
|
-
|
|
34327
|
-
|
|
34328
|
-
|
|
34329
|
-
|
|
34330
|
-
id: "nexus.status",
|
|
34331
|
-
title: "Nexus Status",
|
|
34332
|
-
group: "Nexus",
|
|
34333
|
-
palette: true,
|
|
34334
|
-
slash: { name: "nexus-status", aliases: ["ns"], arguments: true },
|
|
34335
|
-
enabled: () => true,
|
|
34336
|
-
suggested: true,
|
|
34337
|
-
run: async () => {
|
|
34338
|
-
context.ui.toast.show({
|
|
34339
|
-
title: "Nexus Status",
|
|
34340
|
-
message: configManager.getSummary(),
|
|
34341
|
-
variant: "info",
|
|
34342
|
-
duration: 8000
|
|
34343
|
-
});
|
|
34344
|
-
}
|
|
34345
|
-
},
|
|
34346
|
-
{
|
|
34347
|
-
id: "nexus.reset",
|
|
34348
|
-
title: "Reset Nexus Config",
|
|
34349
|
-
group: "Nexus",
|
|
34350
|
-
palette: true,
|
|
34351
|
-
slash: { name: "nexus-reset", aliases: [], arguments: true },
|
|
34352
|
-
enabled: () => true,
|
|
34353
|
-
run: async () => {
|
|
34354
|
-
const confirmed = await context.ui.dialog.confirm({
|
|
34355
|
-
title: "Reset Configuration",
|
|
34356
|
-
message: "Reset all Nexus settings to defaults?",
|
|
34357
|
-
label: { confirm: "Reset", cancel: "Cancel" }
|
|
34358
|
-
});
|
|
34359
|
-
if (confirmed) {
|
|
34360
|
-
configManager.resetToDefaults();
|
|
34361
|
-
context.ui.toast.show({
|
|
34362
|
-
title: "Nexus",
|
|
34363
|
-
message: "Configuration reset to defaults",
|
|
34364
|
-
variant: "success"
|
|
34365
|
-
});
|
|
34366
|
-
}
|
|
34367
|
-
}
|
|
34367
|
+
],
|
|
34368
|
+
bindings: ["nexus"]
|
|
34369
|
+
}));
|
|
34370
|
+
return /* @__PURE__ */ jsxDEV(Fragment, {}, undefined, false, undefined, this);
|
|
34368
34371
|
}
|
|
34369
|
-
],
|
|
34370
|
-
bindings: ["nexus"]
|
|
34371
|
-
}));
|
|
34372
|
-
return null;
|
|
34373
|
-
}
|
|
34374
|
-
var tui_default = define({
|
|
34375
|
-
id: "nexus.cli",
|
|
34376
|
-
setup(context) {
|
|
34377
|
-
context.ui.slot({
|
|
34378
|
-
append: "app",
|
|
34379
|
-
render: () => /* @__PURE__ */ jsxDEV(NexusKeymapSlot, {}, undefined, false, undefined, this)
|
|
34380
34372
|
});
|
|
34381
34373
|
context.ui.toast.show({
|
|
34382
34374
|
title: "⚡ Nexus Loaded",
|