@pellux/goodvibes-agent 0.1.53 → 0.1.54
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/CHANGELOG.md +7 -0
- package/docs/deployment-and-services.md +1 -0
- package/docs/release-and-publishing.md +3 -2
- package/package.json +1 -1
- package/scripts/check-bun.sh +0 -2
- package/src/input/agent-workspace.ts +88 -3
- package/src/main.ts +28 -1
- package/src/runtime/services.ts +109 -1
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to GoodVibes Agent will be recorded here.
|
|
4
4
|
|
|
5
|
+
## 0.1.54 - 2026-05-31
|
|
6
|
+
|
|
7
|
+
- dc1a290 Keep release docs version-neutral
|
|
8
|
+
- 07eb275 Stabilize Bun package install smoke
|
|
9
|
+
- d5da8fb Fix Bun global TUI launch smoke
|
|
10
|
+
- 883a11c Add exact-confirm local library delete flow
|
|
11
|
+
|
|
5
12
|
## 0.1.53 - 2026-05-31
|
|
6
13
|
|
|
7
14
|
- 77ad0cf Add local library edit workspace flow
|
|
@@ -27,6 +27,7 @@ The executable is backed by TypeScript-authored source with a Bun shebang. Packa
|
|
|
27
27
|
- `goodvibes-agent --help`
|
|
28
28
|
- `goodvibes-agent --version`
|
|
29
29
|
- `goodvibes-agent status --json`
|
|
30
|
+
- `goodvibes-agent` launches the TUI in a real PTY
|
|
30
31
|
- `goodvibes-agent smoke --json` when that command is available in the baseline being tested
|
|
31
32
|
|
|
32
33
|
## External Daemon Connection
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Release And Publishing
|
|
2
2
|
|
|
3
|
-
GoodVibes Agent
|
|
3
|
+
GoodVibes Agent's current installable public alpha version is recorded in `package.json` and `CHANGELOG.md`.
|
|
4
4
|
|
|
5
5
|
## Package Identity
|
|
6
6
|
|
|
@@ -21,7 +21,7 @@ bun run typecheck
|
|
|
21
21
|
bun run build
|
|
22
22
|
bun run package:install-check
|
|
23
23
|
bun run publish:check
|
|
24
|
-
|
|
24
|
+
bun pm pack --dry-run
|
|
25
25
|
git diff --check
|
|
26
26
|
```
|
|
27
27
|
|
|
@@ -34,6 +34,7 @@ Also run the package install smoke from a packed artifact. It must prove:
|
|
|
34
34
|
- the Bun shebang survives pack/install
|
|
35
35
|
- `goodvibes-agent --help` works
|
|
36
36
|
- `goodvibes-agent --version` reports the package version
|
|
37
|
+
- the installed TUI launches in a PTY and does not exit immediately
|
|
37
38
|
- daemon-backed commands fail clearly when the external daemon is unavailable or unauthenticated
|
|
38
39
|
- no token value is printed
|
|
39
40
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pellux/goodvibes-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.54",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Near-fork GoodVibes operator assistant with the GoodVibes TUI shell, renderer, input, fullscreen workspace, and daemon-connected Agent product brain.",
|
|
6
6
|
"type": "module",
|
package/scripts/check-bun.sh
CHANGED
|
@@ -8,8 +8,6 @@ goodvibes-agent requires Bun.
|
|
|
8
8
|
Install Bun first, then install GoodVibes Agent from the npm registry with:
|
|
9
9
|
|
|
10
10
|
bun add -g @pellux/goodvibes-agent
|
|
11
|
-
|
|
12
|
-
npm install -g @pellux/goodvibes-agent also works, but Bun must already be installed and available on PATH.
|
|
13
11
|
EOF
|
|
14
12
|
exit 1
|
|
15
13
|
fi
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { InputToken } from '@pellux/goodvibes-sdk/platform/core';
|
|
2
|
+
import type { ShellPathService } from '@/runtime/index.ts';
|
|
2
3
|
import { basename, sep } from 'node:path';
|
|
3
4
|
import type { CommandContext } from './command-registry.ts';
|
|
4
5
|
import { AgentPersonaRegistry, type AgentPersonaRecord } from '../agent/persona-registry.ts';
|
|
@@ -29,15 +30,18 @@ export type AgentWorkspaceLocalOperation =
|
|
|
29
30
|
| 'persona-use'
|
|
30
31
|
| 'persona-review'
|
|
31
32
|
| 'persona-clear'
|
|
33
|
+
| 'persona-delete'
|
|
32
34
|
| 'skill-edit'
|
|
33
35
|
| 'skill-enable'
|
|
34
36
|
| 'skill-disable'
|
|
35
37
|
| 'skill-review'
|
|
38
|
+
| 'skill-delete'
|
|
36
39
|
| 'routine-edit'
|
|
37
40
|
| 'routine-start'
|
|
38
41
|
| 'routine-enable'
|
|
39
42
|
| 'routine-disable'
|
|
40
|
-
| 'routine-review'
|
|
43
|
+
| 'routine-review'
|
|
44
|
+
| 'routine-delete';
|
|
41
45
|
|
|
42
46
|
export interface AgentWorkspaceEditorField {
|
|
43
47
|
readonly id: string;
|
|
@@ -50,7 +54,7 @@ export interface AgentWorkspaceEditorField {
|
|
|
50
54
|
|
|
51
55
|
export interface AgentWorkspaceLocalEditor {
|
|
52
56
|
readonly kind: AgentWorkspaceLocalEditorKind;
|
|
53
|
-
readonly mode: 'create' | 'update';
|
|
57
|
+
readonly mode: 'create' | 'update' | 'delete';
|
|
54
58
|
readonly recordId?: string;
|
|
55
59
|
readonly title: string;
|
|
56
60
|
readonly fields: readonly AgentWorkspaceEditorField[];
|
|
@@ -542,6 +546,7 @@ export const AGENT_WORKSPACE_CATEGORIES: readonly AgentWorkspaceCategory[] = [
|
|
|
542
546
|
{ id: 'personas-use', label: 'Use selected', detail: 'Activate the selected local persona for future main-conversation turns.', localKind: 'persona', localOperation: 'persona-use', kind: 'local-operation', safety: 'safe' },
|
|
543
547
|
{ id: 'personas-review', label: 'Review selected', detail: 'Mark the selected local persona reviewed after inspecting it.', localKind: 'persona', localOperation: 'persona-review', kind: 'local-operation', safety: 'safe' },
|
|
544
548
|
{ id: 'personas-clear', label: 'Clear active persona', detail: 'Return to the default Agent policy without deleting any persona.', localKind: 'persona', localOperation: 'persona-clear', kind: 'local-operation', safety: 'safe' },
|
|
549
|
+
{ id: 'personas-delete', label: 'Delete selected', detail: 'Open a confirmation form before deleting the selected local persona.', localKind: 'persona', localOperation: 'persona-delete', kind: 'local-operation', safety: 'safe' },
|
|
545
550
|
],
|
|
546
551
|
},
|
|
547
552
|
{
|
|
@@ -560,6 +565,7 @@ export const AGENT_WORKSPACE_CATEGORIES: readonly AgentWorkspaceCategory[] = [
|
|
|
560
565
|
{ id: 'skills-enable', label: 'Enable selected', detail: 'Enable the selected local Agent skill for future main-conversation guidance.', localKind: 'skill', localOperation: 'skill-enable', kind: 'local-operation', safety: 'safe' },
|
|
561
566
|
{ id: 'skills-disable', label: 'Disable selected', detail: 'Disable the selected local Agent skill without deleting it.', localKind: 'skill', localOperation: 'skill-disable', kind: 'local-operation', safety: 'safe' },
|
|
562
567
|
{ id: 'skills-review', label: 'Review selected', detail: 'Mark the selected local skill reviewed after inspecting it.', localKind: 'skill', localOperation: 'skill-review', kind: 'local-operation', safety: 'safe' },
|
|
568
|
+
{ id: 'skills-delete', label: 'Delete selected', detail: 'Open a confirmation form before deleting the selected local Agent skill.', localKind: 'skill', localOperation: 'skill-delete', kind: 'local-operation', safety: 'safe' },
|
|
563
569
|
],
|
|
564
570
|
},
|
|
565
571
|
{
|
|
@@ -579,6 +585,7 @@ export const AGENT_WORKSPACE_CATEGORIES: readonly AgentWorkspaceCategory[] = [
|
|
|
579
585
|
{ id: 'routines-enable', label: 'Enable selected', detail: 'Enable the selected routine for future main-conversation guidance.', localKind: 'routine', localOperation: 'routine-enable', kind: 'local-operation', safety: 'safe' },
|
|
580
586
|
{ id: 'routines-disable', label: 'Disable selected', detail: 'Disable the selected routine without deleting it.', localKind: 'routine', localOperation: 'routine-disable', kind: 'local-operation', safety: 'safe' },
|
|
581
587
|
{ id: 'routines-review', label: 'Review selected', detail: 'Mark the selected local routine reviewed after inspecting it.', localKind: 'routine', localOperation: 'routine-review', kind: 'local-operation', safety: 'safe' },
|
|
588
|
+
{ id: 'routines-delete', label: 'Delete selected', detail: 'Open a confirmation form before deleting the selected local Agent routine.', localKind: 'routine', localOperation: 'routine-delete', kind: 'local-operation', safety: 'safe' },
|
|
582
589
|
{ id: 'routines-promote', label: 'Promote to schedule', detail: 'Create an external daemon schedule from a reviewed routine only with real timing and --yes.', command: '/routines promote <id> --cron <expr> --yes', kind: 'command', safety: 'safe' },
|
|
583
590
|
{ id: 'routines-receipts', label: 'Promotion receipts', detail: 'Inspect local redacted routine schedule promotion receipts.', command: '/routines receipts', kind: 'command', safety: 'read-only' },
|
|
584
591
|
],
|
|
@@ -740,6 +747,21 @@ function createRoutineUpdateEditor(record: AgentRoutineRecord): AgentWorkspaceLo
|
|
|
740
747
|
};
|
|
741
748
|
}
|
|
742
749
|
|
|
750
|
+
function createDeleteEditor(kind: AgentWorkspaceLocalEditorKind, item: AgentWorkspaceLocalLibraryItem): AgentWorkspaceLocalEditor {
|
|
751
|
+
const label = kind[0]!.toUpperCase() + kind.slice(1);
|
|
752
|
+
return {
|
|
753
|
+
kind,
|
|
754
|
+
mode: 'delete',
|
|
755
|
+
recordId: item.id,
|
|
756
|
+
title: `Delete ${label}`,
|
|
757
|
+
selectedFieldIndex: 0,
|
|
758
|
+
message: `Type ${item.id} exactly to delete ${item.name}. This only changes the Agent-local registry.`,
|
|
759
|
+
fields: [
|
|
760
|
+
{ id: 'confirm', label: 'Confirm id', value: '', required: true, multiline: false, hint: `Type ${item.id} exactly.` },
|
|
761
|
+
],
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
|
|
743
765
|
function splitList(value: string): string[] {
|
|
744
766
|
return value.split(',').map((part) => part.trim()).filter(Boolean);
|
|
745
767
|
}
|
|
@@ -1148,6 +1170,8 @@ export class AgentWorkspace {
|
|
|
1148
1170
|
} else if (operation === 'persona-review') {
|
|
1149
1171
|
AgentPersonaRegistry.fromShellPaths(shellPaths).markReviewed(selected.id);
|
|
1150
1172
|
this.finishLocalOperation('persona', `Reviewed persona ${selected.name}`, `${selected.name} is marked reviewed.`);
|
|
1173
|
+
} else if (operation === 'persona-delete') {
|
|
1174
|
+
this.openDeleteEditor('persona', selected);
|
|
1151
1175
|
} else if (operation === 'skill-edit') {
|
|
1152
1176
|
const skill = AgentSkillRegistry.fromShellPaths(shellPaths).get(selected.id);
|
|
1153
1177
|
if (!skill) throw new Error(`Unknown skill: ${selected.id}`);
|
|
@@ -1168,6 +1192,8 @@ export class AgentWorkspace {
|
|
|
1168
1192
|
} else if (operation === 'skill-review') {
|
|
1169
1193
|
AgentSkillRegistry.fromShellPaths(shellPaths).markReviewed(selected.id);
|
|
1170
1194
|
this.finishLocalOperation('skill', `Reviewed skill ${selected.name}`, `${selected.name} is marked reviewed.`);
|
|
1195
|
+
} else if (operation === 'skill-delete') {
|
|
1196
|
+
this.openDeleteEditor('skill', selected);
|
|
1171
1197
|
} else if (operation === 'routine-edit') {
|
|
1172
1198
|
const routine = AgentRoutineRegistry.fromShellPaths(shellPaths).get(selected.id);
|
|
1173
1199
|
if (!routine) throw new Error(`Unknown routine: ${selected.id}`);
|
|
@@ -1188,9 +1214,11 @@ export class AgentWorkspace {
|
|
|
1188
1214
|
} else if (operation === 'routine-disable') {
|
|
1189
1215
|
AgentRoutineRegistry.fromShellPaths(shellPaths).setEnabled(selected.id, false);
|
|
1190
1216
|
this.finishLocalOperation('routine', `Disabled routine ${selected.name}`, `${selected.name} remains saved but is no longer injected into guidance.`);
|
|
1191
|
-
} else {
|
|
1217
|
+
} else if (operation === 'routine-review') {
|
|
1192
1218
|
AgentRoutineRegistry.fromShellPaths(shellPaths).markReviewed(selected.id);
|
|
1193
1219
|
this.finishLocalOperation('routine', `Reviewed routine ${selected.name}`, `${selected.name} is marked reviewed.`);
|
|
1220
|
+
} else {
|
|
1221
|
+
this.openDeleteEditor('routine', selected);
|
|
1194
1222
|
}
|
|
1195
1223
|
} catch (error) {
|
|
1196
1224
|
const detail = error instanceof Error ? error.message : String(error);
|
|
@@ -1221,6 +1249,17 @@ export class AgentWorkspace {
|
|
|
1221
1249
|
};
|
|
1222
1250
|
}
|
|
1223
1251
|
|
|
1252
|
+
private openDeleteEditor(kind: AgentWorkspaceLocalEditorKind, selected: AgentWorkspaceLocalLibraryItem): void {
|
|
1253
|
+
this.localEditor = createDeleteEditor(kind, selected);
|
|
1254
|
+
this.status = `Confirm deletion for ${selected.name}.`;
|
|
1255
|
+
this.lastActionResult = {
|
|
1256
|
+
kind: 'guidance',
|
|
1257
|
+
title: this.localEditor.title,
|
|
1258
|
+
detail: this.localEditor.message,
|
|
1259
|
+
safety: 'safe',
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1224
1263
|
private replaceEditorField(index: number, value: string, message: string): void {
|
|
1225
1264
|
const editor = this.localEditor;
|
|
1226
1265
|
if (!editor) return;
|
|
@@ -1265,6 +1304,10 @@ export class AgentWorkspace {
|
|
|
1265
1304
|
return;
|
|
1266
1305
|
}
|
|
1267
1306
|
try {
|
|
1307
|
+
if (editor.mode === 'delete') {
|
|
1308
|
+
this.submitLocalDeleteEditor(shellPaths, editor);
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1268
1311
|
if (editor.kind === 'persona') {
|
|
1269
1312
|
const registry = AgentPersonaRegistry.fromShellPaths(shellPaths);
|
|
1270
1313
|
if (editor.mode === 'update' && editor.recordId) {
|
|
@@ -1358,6 +1401,29 @@ export class AgentWorkspace {
|
|
|
1358
1401
|
}
|
|
1359
1402
|
}
|
|
1360
1403
|
|
|
1404
|
+
private submitLocalDeleteEditor(shellPaths: ShellPathService, editor: AgentWorkspaceLocalEditor): void {
|
|
1405
|
+
const expectedId = editor.recordId ?? '';
|
|
1406
|
+
const confirmedId = this.editorField('confirm');
|
|
1407
|
+
if (!expectedId || confirmedId !== expectedId) {
|
|
1408
|
+
this.localEditor = {
|
|
1409
|
+
...editor,
|
|
1410
|
+
message: `Deletion not confirmed. Type ${expectedId} exactly, then press Enter.`,
|
|
1411
|
+
};
|
|
1412
|
+
this.status = 'Deletion not confirmed.';
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
if (editor.kind === 'persona') {
|
|
1416
|
+
const removed = AgentPersonaRegistry.fromShellPaths(shellPaths).deletePersona(expectedId);
|
|
1417
|
+
this.finishLocalDelete(editor.kind, removed.id, removed.name);
|
|
1418
|
+
} else if (editor.kind === 'skill') {
|
|
1419
|
+
const removed = AgentSkillRegistry.fromShellPaths(shellPaths).deleteSkill(expectedId);
|
|
1420
|
+
this.finishLocalDelete(editor.kind, removed.id, removed.name);
|
|
1421
|
+
} else {
|
|
1422
|
+
const removed = AgentRoutineRegistry.fromShellPaths(shellPaths).deleteRoutine(expectedId);
|
|
1423
|
+
this.finishLocalDelete(editor.kind, removed.id, removed.name);
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1361
1427
|
private finishLocalEditor(kind: AgentWorkspaceLocalEditorKind, id: string, name: string, verb: 'Created' | 'Updated'): void {
|
|
1362
1428
|
this.localEditor = null;
|
|
1363
1429
|
const categoryId = editorCategoryId(kind);
|
|
@@ -1376,6 +1442,25 @@ export class AgentWorkspace {
|
|
|
1376
1442
|
};
|
|
1377
1443
|
this.clampSelection();
|
|
1378
1444
|
}
|
|
1445
|
+
|
|
1446
|
+
private finishLocalDelete(kind: AgentWorkspaceLocalEditorKind, id: string, name: string): void {
|
|
1447
|
+
this.localEditor = null;
|
|
1448
|
+
const categoryId = editorCategoryId(kind);
|
|
1449
|
+
const categoryIndex = this.categories.findIndex((category) => category.id === categoryId);
|
|
1450
|
+
if (categoryIndex >= 0) {
|
|
1451
|
+
this.selectedCategoryIndex = categoryIndex;
|
|
1452
|
+
this.selectedActionIndex = 0;
|
|
1453
|
+
}
|
|
1454
|
+
this.runtimeSnapshot = this.context ? buildAgentWorkspaceRuntimeSnapshot(this.context) : this.runtimeSnapshot;
|
|
1455
|
+
this.status = `Deleted ${kind}: ${name}.`;
|
|
1456
|
+
this.lastActionResult = {
|
|
1457
|
+
kind: 'refreshed',
|
|
1458
|
+
title: `Deleted ${kind}`,
|
|
1459
|
+
detail: `${name} (${id}) was removed from the Agent-local ${categoryId} registry.`,
|
|
1460
|
+
safety: 'safe',
|
|
1461
|
+
};
|
|
1462
|
+
this.clampSelection();
|
|
1463
|
+
}
|
|
1379
1464
|
}
|
|
1380
1465
|
|
|
1381
1466
|
export function handleAgentWorkspaceToken(
|
package/src/main.ts
CHANGED
|
@@ -767,4 +767,31 @@ async function main() {
|
|
|
767
767
|
|
|
768
768
|
}
|
|
769
769
|
|
|
770
|
-
|
|
770
|
+
function formatFatalStartupError(error: unknown): string {
|
|
771
|
+
if (error instanceof Error) {
|
|
772
|
+
return error.stack ?? error.message;
|
|
773
|
+
}
|
|
774
|
+
if (typeof error === 'string') {
|
|
775
|
+
return error;
|
|
776
|
+
}
|
|
777
|
+
try {
|
|
778
|
+
return JSON.stringify(error);
|
|
779
|
+
} catch {
|
|
780
|
+
return String(error);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
main().catch((err: unknown) => {
|
|
785
|
+
const detail = formatFatalStartupError(err);
|
|
786
|
+
try {
|
|
787
|
+
logger.error('Fatal error', { error: detail });
|
|
788
|
+
} catch {
|
|
789
|
+
// Startup diagnostics must never hide the original launch failure.
|
|
790
|
+
}
|
|
791
|
+
try {
|
|
792
|
+
process.stderr.write(`goodvibes-agent failed to launch:\n${detail}\n`);
|
|
793
|
+
} catch {
|
|
794
|
+
// Ignore secondary stderr failures during process teardown.
|
|
795
|
+
}
|
|
796
|
+
process.exit(1);
|
|
797
|
+
});
|
package/src/runtime/services.ts
CHANGED
|
@@ -136,6 +136,114 @@ function ensureConfiguredModelIsRoutable(providerRegistry: ProviderRegistry, con
|
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
const PROVIDER_STARTUP_PLACEHOLDER_API_KEY = 'goodvibes-agent-startup-placeholder';
|
|
140
|
+
|
|
141
|
+
type ProviderRegistryConstructionOptions = ConstructorParameters<typeof ProviderRegistry>[0];
|
|
142
|
+
|
|
143
|
+
type ProviderStartupEnv = {
|
|
144
|
+
readonly providerId: string;
|
|
145
|
+
readonly envVars: readonly string[];
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
type MutableApiKeyProvider = {
|
|
149
|
+
apiKey: string;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
type MutableConfiguredProvider = {
|
|
153
|
+
configured: boolean;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const PROVIDER_STARTUP_PLACEHOLDER_ENVS: readonly ProviderStartupEnv[] = [
|
|
157
|
+
{ providerId: 'openai', envVars: ['OPENAI_API_KEY', 'OPENAI_KEY'] },
|
|
158
|
+
{ providerId: 'inceptionlabs', envVars: ['INCEPTION_API_KEY'] },
|
|
159
|
+
{ providerId: 'openrouter', envVars: ['OPENROUTER_API_KEY'] },
|
|
160
|
+
{ providerId: 'aihubmix', envVars: ['AIHUBMIX_API_KEY'] },
|
|
161
|
+
{ providerId: 'groq', envVars: ['GROQ_API_KEY'] },
|
|
162
|
+
{ providerId: 'cerebras', envVars: ['CEREBRAS_API_KEY'] },
|
|
163
|
+
{ providerId: 'mistral', envVars: ['MISTRAL_API_KEY'] },
|
|
164
|
+
{ providerId: 'ollama-cloud', envVars: ['OLLAMA_CLOUD_API_KEY', 'OLLAMA_API_KEY'] },
|
|
165
|
+
{ providerId: 'huggingface', envVars: ['HF_API_KEY', 'HUGGINGFACE_API_KEY', 'HF_TOKEN'] },
|
|
166
|
+
{ providerId: 'nvidia', envVars: ['NVIDIA_API_KEY'] },
|
|
167
|
+
{ providerId: 'llm7', envVars: ['LLM7_API_KEY'] },
|
|
168
|
+
{ providerId: 'deepseek', envVars: ['DEEPSEEK_API_KEY'] },
|
|
169
|
+
{ providerId: 'fireworks', envVars: ['FIREWORKS_API_KEY'] },
|
|
170
|
+
{ providerId: 'microsoft-foundry', envVars: ['AZURE_OPENAI_API_KEY'] },
|
|
171
|
+
{ providerId: 'moonshot', envVars: ['MOONSHOT_API_KEY'] },
|
|
172
|
+
{ providerId: 'qianfan', envVars: ['QIANFAN_API_KEY'] },
|
|
173
|
+
{ providerId: 'qwen', envVars: ['QWEN_API_KEY', 'DASHSCOPE_API_KEY', 'MODELSTUDIO_API_KEY'] },
|
|
174
|
+
{ providerId: 'sglang', envVars: ['SGLANG_API_KEY'] },
|
|
175
|
+
{ providerId: 'stepfun', envVars: ['STEPFUN_API_KEY'] },
|
|
176
|
+
{ providerId: 'together', envVars: ['TOGETHER_API_KEY'] },
|
|
177
|
+
{ providerId: 'venice', envVars: ['VENICE_API_KEY'] },
|
|
178
|
+
{ providerId: 'volcengine', envVars: ['VOLCANO_ENGINE_API_KEY'] },
|
|
179
|
+
{ providerId: 'xai', envVars: ['XAI_API_KEY'] },
|
|
180
|
+
{ providerId: 'xiaomi', envVars: ['XIAOMI_API_KEY'] },
|
|
181
|
+
{ providerId: 'zai', envVars: ['ZAI_API_KEY', 'Z_AI_API_KEY'] },
|
|
182
|
+
{ providerId: 'cloudflare-ai-gateway', envVars: ['CLOUDFLARE_AI_GATEWAY_API_KEY'] },
|
|
183
|
+
{ providerId: 'vercel-ai-gateway', envVars: ['AI_GATEWAY_API_KEY'] },
|
|
184
|
+
{ providerId: 'litellm', envVars: ['LITELLM_API_KEY'] },
|
|
185
|
+
{ providerId: 'copilot-proxy', envVars: ['COPILOT_PROXY_API_KEY'] },
|
|
186
|
+
];
|
|
187
|
+
|
|
188
|
+
function hasMutableApiKeyProvider(value: unknown): value is MutableApiKeyProvider {
|
|
189
|
+
if (typeof value !== 'object' || value === null) return false;
|
|
190
|
+
const candidate = value as { readonly apiKey?: unknown };
|
|
191
|
+
return typeof candidate.apiKey === 'string';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function hasMutableConfiguredProvider(value: unknown): value is MutableConfiguredProvider {
|
|
195
|
+
if (typeof value !== 'object' || value === null) return false;
|
|
196
|
+
const candidate = value as { readonly configured?: unknown };
|
|
197
|
+
return typeof candidate.configured === 'boolean';
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function hasAnyConfiguredEnv(envVars: readonly string[]): boolean {
|
|
201
|
+
return envVars.some((envVar) => {
|
|
202
|
+
const value = process.env[envVar];
|
|
203
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function createLaunchTolerantProviderRegistry(options: ProviderRegistryConstructionOptions): ProviderRegistry {
|
|
208
|
+
const placeholders = PROVIDER_STARTUP_PLACEHOLDER_ENVS
|
|
209
|
+
.filter((entry) => !hasAnyConfiguredEnv(entry.envVars))
|
|
210
|
+
.map((entry) => ({ providerId: entry.providerId, envVar: entry.envVars[0] }))
|
|
211
|
+
.filter((entry): entry is { readonly providerId: string; readonly envVar: string } => typeof entry.envVar === 'string');
|
|
212
|
+
|
|
213
|
+
if (placeholders.length === 0) {
|
|
214
|
+
return new ProviderRegistry(options);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const previousValues = new Map<string, string | undefined>();
|
|
218
|
+
for (const placeholder of placeholders) {
|
|
219
|
+
previousValues.set(placeholder.envVar, process.env[placeholder.envVar]);
|
|
220
|
+
process.env[placeholder.envVar] = PROVIDER_STARTUP_PLACEHOLDER_API_KEY;
|
|
221
|
+
}
|
|
222
|
+
let providerRegistry: ProviderRegistry;
|
|
223
|
+
try {
|
|
224
|
+
providerRegistry = new ProviderRegistry(options);
|
|
225
|
+
} finally {
|
|
226
|
+
for (const [envVar, previousValue] of previousValues) {
|
|
227
|
+
if (previousValue === undefined) {
|
|
228
|
+
delete process.env[envVar];
|
|
229
|
+
} else {
|
|
230
|
+
process.env[envVar] = previousValue;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
for (const placeholder of placeholders) {
|
|
236
|
+
const provider = providerRegistry.get(placeholder.providerId);
|
|
237
|
+
if (hasMutableApiKeyProvider(provider) && provider.apiKey === PROVIDER_STARTUP_PLACEHOLDER_API_KEY) {
|
|
238
|
+
provider.apiKey = '';
|
|
239
|
+
}
|
|
240
|
+
if (hasMutableConfiguredProvider(provider)) {
|
|
241
|
+
provider.configured = false;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return providerRegistry;
|
|
245
|
+
}
|
|
246
|
+
|
|
139
247
|
export interface RuntimeServicesOptions {
|
|
140
248
|
readonly runtimeBus: RuntimeEventBus;
|
|
141
249
|
readonly runtimeStore: RuntimeStore;
|
|
@@ -285,7 +393,7 @@ export function createRuntimeServices(options: RuntimeServicesOptions): RuntimeS
|
|
|
285
393
|
const modelLimitsService = new ModelLimitsService({
|
|
286
394
|
cachePath: shellPaths.resolveUserPath(GOODVIBES_AGENT_SURFACE_ROOT, 'model-limits.json'),
|
|
287
395
|
});
|
|
288
|
-
const providerRegistry =
|
|
396
|
+
const providerRegistry = createLaunchTolerantProviderRegistry({
|
|
289
397
|
configManager,
|
|
290
398
|
subscriptionManager,
|
|
291
399
|
secretsManager,
|
package/src/version.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { join } from 'node:path';
|
|
|
6
6
|
// The prebuild script updates the fallback value before compilation.
|
|
7
7
|
// Uses import.meta.dir (Bun) to locate package.json relative to this file,
|
|
8
8
|
// which is correct regardless of the process working directory.
|
|
9
|
-
let _version = '0.1.
|
|
9
|
+
let _version = '0.1.54';
|
|
10
10
|
let _sdkVersion = '0.33.35';
|
|
11
11
|
try {
|
|
12
12
|
const pkg = JSON.parse(readFileSync(join(import.meta.dir, '..', 'package.json'), 'utf-8')) as {
|