mediaxg 0.1.0 → 2.0.0
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/cli.js +48 -7
- package/docs/commands.md +2 -1
- package/docs/providers.md +15 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -50150,10 +50150,12 @@ class CommandRegistry {
|
|
|
50150
50150
|
};
|
|
50151
50151
|
}
|
|
50152
50152
|
const definition = match.definition;
|
|
50153
|
-
|
|
50153
|
+
const activeSubcommand = definition.subcommands?.find((subcommand) => subcommand.name === parsed.args?.[0]);
|
|
50154
|
+
if (options.generationActive && (!definition.availableDuringGeneration || activeSubcommand?.availableDuringGeneration === false)) {
|
|
50155
|
+
const commandName = activeSubcommand ? `/${definition.name} ${activeSubcommand.name}` : `/${definition.name}`;
|
|
50154
50156
|
return {
|
|
50155
50157
|
ok: false,
|
|
50156
|
-
error:
|
|
50158
|
+
error: `${commandName} is not available while a response is generating. Press Esc to cancel first.`
|
|
50157
50159
|
};
|
|
50158
50160
|
}
|
|
50159
50161
|
try {
|
|
@@ -52555,24 +52557,39 @@ function createProviderCommands(app) {
|
|
|
52555
52557
|
name: "provider",
|
|
52556
52558
|
category: "providers",
|
|
52557
52559
|
description: "Show the active provider and configured providers",
|
|
52558
|
-
usage: "/provider [list|status]",
|
|
52560
|
+
usage: "/provider [list|status|delete <provider-id> [--yes]]",
|
|
52559
52561
|
subcommands: [
|
|
52560
52562
|
{ name: "list", description: "List configured providers with credential status" },
|
|
52561
|
-
{ name: "status", description: "Validate credentials with a live call (network)" }
|
|
52563
|
+
{ name: "status", description: "Validate credentials with a live call (network)" },
|
|
52564
|
+
{
|
|
52565
|
+
name: "delete",
|
|
52566
|
+
description: "Remove provider state (requires --yes; cancel generation first)",
|
|
52567
|
+
usage: "/provider delete <provider-id> [--yes]",
|
|
52568
|
+
availableDuringGeneration: false
|
|
52569
|
+
}
|
|
52570
|
+
],
|
|
52571
|
+
examples: [
|
|
52572
|
+
"/provider",
|
|
52573
|
+
"/provider list",
|
|
52574
|
+
"/provider status",
|
|
52575
|
+
"/provider delete xkiro",
|
|
52576
|
+
"/provider delete xkiro --yes"
|
|
52562
52577
|
],
|
|
52563
|
-
examples: ["/provider", "/provider list", "/provider status"],
|
|
52564
52578
|
availableDuringGeneration: true,
|
|
52565
|
-
handler: async ({ args }) => {
|
|
52579
|
+
handler: async ({ args, flags }) => {
|
|
52566
52580
|
const sub = args[0];
|
|
52567
52581
|
if (sub === "status") {
|
|
52568
52582
|
return providerStatus(app);
|
|
52569
52583
|
}
|
|
52584
|
+
if (sub === "delete") {
|
|
52585
|
+
return providerDelete(app, args.slice(1), flags["yes"] === true);
|
|
52586
|
+
}
|
|
52570
52587
|
if (sub === "list" || sub === undefined) {
|
|
52571
52588
|
return providerList(app);
|
|
52572
52589
|
}
|
|
52573
52590
|
return {
|
|
52574
52591
|
ok: false,
|
|
52575
|
-
error: `Unknown subcommand: /provider ${sub}. Usage: /provider [list|status]
|
|
52592
|
+
error: `Unknown subcommand: /provider ${sub}. ` + "Usage: /provider [list|status|delete <provider-id> [--yes]]"
|
|
52576
52593
|
};
|
|
52577
52594
|
}
|
|
52578
52595
|
},
|
|
@@ -52722,6 +52739,30 @@ Re-run to confirm: /disconnect ${providerId} --forget --yes`
|
|
|
52722
52739
|
}
|
|
52723
52740
|
];
|
|
52724
52741
|
}
|
|
52742
|
+
async function providerDelete(app, args, confirmed) {
|
|
52743
|
+
const usage = "Usage: /provider delete <provider-id> [--yes]";
|
|
52744
|
+
const providerId = args[0];
|
|
52745
|
+
if (!providerId || args.length > 1) {
|
|
52746
|
+
return { ok: false, error: usage };
|
|
52747
|
+
}
|
|
52748
|
+
const provider = app.getProviderConfig(providerId);
|
|
52749
|
+
if (!provider) {
|
|
52750
|
+
return {
|
|
52751
|
+
ok: false,
|
|
52752
|
+
error: `Provider not configured: ${providerId}
|
|
52753
|
+
` + `Configured providers: ${app.config.providers.map((p) => p.id).join(", ") || "(none)"}`
|
|
52754
|
+
};
|
|
52755
|
+
}
|
|
52756
|
+
if (!confirmed) {
|
|
52757
|
+
const commandId = /\s/.test(providerId) ? `"${providerId}"` : providerId;
|
|
52758
|
+
return {
|
|
52759
|
+
ok: true,
|
|
52760
|
+
output: `This removes provider "${providerId}" from configuration, any matching file-stored credential, ` + `its model cache, and its active provider/model selection if selected. Environment variables are left untouched.
|
|
52761
|
+
` + `Re-run to confirm: /provider delete ${commandId} --yes`
|
|
52762
|
+
};
|
|
52763
|
+
}
|
|
52764
|
+
return connectResultToCommandResult(await disconnectProvider(app, providerId, { forget: true }));
|
|
52765
|
+
}
|
|
52725
52766
|
function connectResultToCommandResult(result) {
|
|
52726
52767
|
const body = [result.message, ...result.warnings.map((w) => `Warning: ${w}`)].join(`
|
|
52727
52768
|
`);
|
package/docs/commands.md
CHANGED
|
@@ -10,7 +10,8 @@ mediaXG uses slash commands. Type `/help` for the full list.
|
|
|
10
10
|
|
|
11
11
|
## Models and providers
|
|
12
12
|
|
|
13
|
-
- `/models`, `/model <id>`, `/provider`, `/connect`, `/disconnect`, `/auth`
|
|
13
|
+
- `/models`, `/model <id>`, `/provider [list|status]`, `/connect`, `/disconnect`, `/auth`
|
|
14
|
+
- `/provider delete <provider-id> [--yes]` shows the removal details first; repeat with `--yes` to confirm.
|
|
14
15
|
|
|
15
16
|
## Sessions
|
|
16
17
|
|
package/docs/providers.md
CHANGED
|
@@ -14,6 +14,21 @@ Credential references resolve from environment variables first, then from
|
|
|
14
14
|
The file store is not encrypted, and OS keychain integration is not currently
|
|
15
15
|
implemented. Secrets are never logged or written to session files.
|
|
16
16
|
|
|
17
|
+
## Removing a provider
|
|
18
|
+
|
|
19
|
+
Run `/provider delete <provider-id>` to review what will be removed. This first
|
|
20
|
+
step does not change state. Repeat the exact command shown with `--yes` to remove
|
|
21
|
+
the provider configuration, any matching file-stored credential, its cached
|
|
22
|
+
models, and its active provider/model selection if selected. For example:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
/provider delete xkiro
|
|
26
|
+
/provider delete xkiro --yes
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Credentials provided through environment variables are not removed. Delete
|
|
30
|
+
those variables from your shell or environment configuration separately.
|
|
31
|
+
|
|
17
32
|
## Model discovery
|
|
18
33
|
|
|
19
34
|
`/models` lists discovered models per provider (with caching and staleness
|