@pellux/goodvibes-agent 0.1.52 → 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 CHANGED
@@ -2,6 +2,17 @@
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
+
12
+ ## 0.1.53 - 2026-05-31
13
+
14
+ - 77ad0cf Add local library edit workspace flow
15
+
5
16
  ## 0.1.52 - 2026-05-31
6
17
 
7
18
  - e543fa5 Add selected local library actions
@@ -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 `0.1.9` is the current installable public alpha release.
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
- npm pack --dry-run
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.52",
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",
@@ -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';
@@ -25,16 +26,22 @@ export type AgentWorkspaceActionKind = 'command' | 'guidance' | 'workspace' | 'e
25
26
  export type AgentWorkspaceLocalEditorKind = 'persona' | 'skill' | 'routine';
26
27
 
27
28
  export type AgentWorkspaceLocalOperation =
29
+ | 'persona-edit'
28
30
  | 'persona-use'
29
31
  | 'persona-review'
30
32
  | 'persona-clear'
33
+ | 'persona-delete'
34
+ | 'skill-edit'
31
35
  | 'skill-enable'
32
36
  | 'skill-disable'
33
37
  | 'skill-review'
38
+ | 'skill-delete'
39
+ | 'routine-edit'
34
40
  | 'routine-start'
35
41
  | 'routine-enable'
36
42
  | 'routine-disable'
37
- | 'routine-review';
43
+ | 'routine-review'
44
+ | 'routine-delete';
38
45
 
39
46
  export interface AgentWorkspaceEditorField {
40
47
  readonly id: string;
@@ -47,6 +54,8 @@ export interface AgentWorkspaceEditorField {
47
54
 
48
55
  export interface AgentWorkspaceLocalEditor {
49
56
  readonly kind: AgentWorkspaceLocalEditorKind;
57
+ readonly mode: 'create' | 'update' | 'delete';
58
+ readonly recordId?: string;
50
59
  readonly title: string;
51
60
  readonly fields: readonly AgentWorkspaceEditorField[];
52
61
  readonly selectedFieldIndex: number;
@@ -533,9 +542,11 @@ export const AGENT_WORKSPACE_CATEGORIES: readonly AgentWorkspaceCategory[] = [
533
542
  { id: 'personas-prev', label: 'Previous persona', detail: 'Move the local persona selection up without changing active state.', localKind: 'persona', selectionDelta: -1, kind: 'local-selection', safety: 'safe' },
534
543
  { id: 'personas-next', label: 'Next persona', detail: 'Move the local persona selection down without changing active state.', localKind: 'persona', selectionDelta: 1, kind: 'local-selection', safety: 'safe' },
535
544
  { id: 'personas-create', label: 'Create persona', detail: 'Open an in-workspace form for a local persona. No placeholder command is dispatched.', editorKind: 'persona', kind: 'editor', safety: 'safe' },
545
+ { id: 'personas-edit', label: 'Edit selected', detail: 'Open the selected local persona in an in-workspace editor.', localKind: 'persona', localOperation: 'persona-edit', kind: 'local-operation', safety: 'safe' },
536
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' },
537
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' },
538
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' },
539
550
  ],
540
551
  },
541
552
  {
@@ -550,9 +561,11 @@ export const AGENT_WORKSPACE_CATEGORIES: readonly AgentWorkspaceCategory[] = [
550
561
  { id: 'skills-prev', label: 'Previous skill', detail: 'Move the local skill selection up without changing enabled state.', localKind: 'skill', selectionDelta: -1, kind: 'local-selection', safety: 'safe' },
551
562
  { id: 'skills-next', label: 'Next skill', detail: 'Move the local skill selection down without changing enabled state.', localKind: 'skill', selectionDelta: 1, kind: 'local-selection', safety: 'safe' },
552
563
  { id: 'skills-create', label: 'Create skill', detail: 'Open an in-workspace form for a reusable local procedure. No placeholder command is dispatched.', editorKind: 'skill', kind: 'editor', safety: 'safe' },
564
+ { id: 'skills-edit', label: 'Edit selected', detail: 'Open the selected local Agent skill in an in-workspace editor.', localKind: 'skill', localOperation: 'skill-edit', kind: 'local-operation', safety: 'safe' },
553
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' },
554
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' },
555
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' },
556
569
  ],
557
570
  },
558
571
  {
@@ -567,10 +580,12 @@ export const AGENT_WORKSPACE_CATEGORIES: readonly AgentWorkspaceCategory[] = [
567
580
  { id: 'routines-prev', label: 'Previous routine', detail: 'Move the local routine selection up without changing enabled state.', localKind: 'routine', selectionDelta: -1, kind: 'local-selection', safety: 'safe' },
568
581
  { id: 'routines-next', label: 'Next routine', detail: 'Move the local routine selection down without changing enabled state.', localKind: 'routine', selectionDelta: 1, kind: 'local-selection', safety: 'safe' },
569
582
  { id: 'routines-create', label: 'Create routine', detail: 'Open an in-workspace form for a repeatable local workflow. No placeholder command is dispatched.', editorKind: 'routine', kind: 'editor', safety: 'safe' },
583
+ { id: 'routines-edit', label: 'Edit selected', detail: 'Open the selected local Agent routine in an in-workspace editor.', localKind: 'routine', localOperation: 'routine-edit', kind: 'local-operation', safety: 'safe' },
570
584
  { id: 'routines-start', label: 'Start selected', detail: 'Mark the selected routine started and show it as a main-conversation workflow. This creates no hidden job.', localKind: 'routine', localOperation: 'routine-start', kind: 'local-operation', safety: 'safe' },
571
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' },
572
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' },
573
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' },
574
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' },
575
590
  { id: 'routines-receipts', label: 'Promotion receipts', detail: 'Inspect local redacted routine schedule promotion receipts.', command: '/routines receipts', kind: 'command', safety: 'read-only' },
576
591
  ],
@@ -627,6 +642,7 @@ function createLocalEditor(kind: AgentWorkspaceLocalEditorKind): AgentWorkspaceL
627
642
  if (kind === 'persona') {
628
643
  return {
629
644
  kind,
645
+ mode: 'create',
630
646
  title: 'Create Persona',
631
647
  selectedFieldIndex: 0,
632
648
  message: 'Enter a local behavior profile for the serial main-conversation assistant.',
@@ -643,6 +659,7 @@ function createLocalEditor(kind: AgentWorkspaceLocalEditorKind): AgentWorkspaceL
643
659
  if (kind === 'skill') {
644
660
  return {
645
661
  kind,
662
+ mode: 'create',
646
663
  title: 'Create Skill',
647
664
  selectedFieldIndex: 0,
648
665
  message: 'Enter a reusable local procedure the assistant can apply from the main conversation.',
@@ -658,6 +675,7 @@ function createLocalEditor(kind: AgentWorkspaceLocalEditorKind): AgentWorkspaceL
658
675
  }
659
676
  return {
660
677
  kind,
678
+ mode: 'create',
661
679
  title: 'Create Routine',
662
680
  selectedFieldIndex: 0,
663
681
  message: 'Enter a repeatable workflow. It runs in the main conversation unless explicitly promoted to a daemon schedule.',
@@ -672,6 +690,78 @@ function createLocalEditor(kind: AgentWorkspaceLocalEditorKind): AgentWorkspaceL
672
690
  };
673
691
  }
674
692
 
693
+ function createPersonaUpdateEditor(record: AgentPersonaRecord, active: boolean): AgentWorkspaceLocalEditor {
694
+ return {
695
+ kind: 'persona',
696
+ mode: 'update',
697
+ recordId: record.id,
698
+ title: 'Edit Persona',
699
+ selectedFieldIndex: 0,
700
+ message: `Editing ${record.name}. Saving marks it fresh for review.`,
701
+ fields: [
702
+ { id: 'name', label: 'Name', value: record.name, required: true, multiline: false, hint: 'Short persona name.' },
703
+ { id: 'description', label: 'Description', value: record.description, required: true, multiline: false, hint: 'One-line summary of when to use it.' },
704
+ { id: 'body', label: 'Instructions', value: record.body, required: true, multiline: true, hint: 'Operating guidance. Ctrl-J inserts a new line.' },
705
+ { id: 'tags', label: 'Tags', value: record.tags.join(', '), required: false, multiline: false, hint: 'Comma-separated optional tags.' },
706
+ { id: 'triggers', label: 'Triggers', value: record.triggers.join(', '), required: false, multiline: false, hint: 'Comma-separated words that suggest this persona.' },
707
+ { id: 'activate', label: 'Active', value: active ? 'yes' : 'no', required: false, multiline: false, hint: 'yes/no. Setting no clears this persona only if it is currently active.' },
708
+ ],
709
+ };
710
+ }
711
+
712
+ function createSkillUpdateEditor(record: AgentSkillRecord): AgentWorkspaceLocalEditor {
713
+ return {
714
+ kind: 'skill',
715
+ mode: 'update',
716
+ recordId: record.id,
717
+ title: 'Edit Skill',
718
+ selectedFieldIndex: 0,
719
+ message: `Editing ${record.name}. Saving marks it fresh for review.`,
720
+ fields: [
721
+ { id: 'name', label: 'Name', value: record.name, required: true, multiline: false, hint: 'Short skill name.' },
722
+ { id: 'description', label: 'Description', value: record.description, required: true, multiline: false, hint: 'One-line summary of the procedure.' },
723
+ { id: 'procedure', label: 'Procedure', value: record.procedure, required: true, multiline: true, hint: 'Reusable steps. Ctrl-J inserts a new line.' },
724
+ { id: 'triggers', label: 'Triggers', value: record.triggers.join(', '), required: false, multiline: false, hint: 'Comma-separated words that suggest this skill.' },
725
+ { id: 'tags', label: 'Tags', value: record.tags.join(', '), required: false, multiline: false, hint: 'Comma-separated optional tags.' },
726
+ { id: 'enabled', label: 'Enabled', value: record.enabled ? 'yes' : 'no', required: false, multiline: false, hint: 'yes/no.' },
727
+ ],
728
+ };
729
+ }
730
+
731
+ function createRoutineUpdateEditor(record: AgentRoutineRecord): AgentWorkspaceLocalEditor {
732
+ return {
733
+ kind: 'routine',
734
+ mode: 'update',
735
+ recordId: record.id,
736
+ title: 'Edit Routine',
737
+ selectedFieldIndex: 0,
738
+ message: `Editing ${record.name}. Saving marks it fresh for review.`,
739
+ fields: [
740
+ { id: 'name', label: 'Name', value: record.name, required: true, multiline: false, hint: 'Short routine name.' },
741
+ { id: 'description', label: 'Description', value: record.description, required: true, multiline: false, hint: 'One-line summary of the workflow.' },
742
+ { id: 'steps', label: 'Steps', value: record.steps, required: true, multiline: true, hint: 'Workflow steps. Ctrl-J inserts a new line.' },
743
+ { id: 'triggers', label: 'Triggers', value: record.triggers.join(', '), required: false, multiline: false, hint: 'Comma-separated words that suggest this routine.' },
744
+ { id: 'tags', label: 'Tags', value: record.tags.join(', '), required: false, multiline: false, hint: 'Comma-separated optional tags.' },
745
+ { id: 'enabled', label: 'Enabled', value: record.enabled ? 'yes' : 'no', required: false, multiline: false, hint: 'yes/no.' },
746
+ ],
747
+ };
748
+ }
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
+
675
765
  function splitList(value: string): string[] {
676
766
  return value.split(',').map((part) => part.trim()).filter(Boolean);
677
767
  }
@@ -1062,12 +1152,37 @@ export class AgentWorkspace {
1062
1152
  };
1063
1153
  return;
1064
1154
  }
1065
- if (operation === 'persona-use') {
1155
+ if (operation === 'persona-edit') {
1156
+ const registry = AgentPersonaRegistry.fromShellPaths(shellPaths);
1157
+ const persona = registry.get(selected.id);
1158
+ if (!persona) throw new Error(`Unknown persona: ${selected.id}`);
1159
+ this.localEditor = createPersonaUpdateEditor(persona, registry.snapshot().activePersonaId === persona.id);
1160
+ this.status = `Editing persona: ${persona.name}.`;
1161
+ this.lastActionResult = {
1162
+ kind: 'guidance',
1163
+ title: this.localEditor.title,
1164
+ detail: this.localEditor.message,
1165
+ safety: 'safe',
1166
+ };
1167
+ } else if (operation === 'persona-use') {
1066
1168
  AgentPersonaRegistry.fromShellPaths(shellPaths).setActive(selected.id);
1067
1169
  this.finishLocalOperation('persona', `Using persona ${selected.name}`, `${selected.name} will shape future main-conversation turns.`);
1068
1170
  } else if (operation === 'persona-review') {
1069
1171
  AgentPersonaRegistry.fromShellPaths(shellPaths).markReviewed(selected.id);
1070
1172
  this.finishLocalOperation('persona', `Reviewed persona ${selected.name}`, `${selected.name} is marked reviewed.`);
1173
+ } else if (operation === 'persona-delete') {
1174
+ this.openDeleteEditor('persona', selected);
1175
+ } else if (operation === 'skill-edit') {
1176
+ const skill = AgentSkillRegistry.fromShellPaths(shellPaths).get(selected.id);
1177
+ if (!skill) throw new Error(`Unknown skill: ${selected.id}`);
1178
+ this.localEditor = createSkillUpdateEditor(skill);
1179
+ this.status = `Editing skill: ${skill.name}.`;
1180
+ this.lastActionResult = {
1181
+ kind: 'guidance',
1182
+ title: this.localEditor.title,
1183
+ detail: this.localEditor.message,
1184
+ safety: 'safe',
1185
+ };
1071
1186
  } else if (operation === 'skill-enable') {
1072
1187
  AgentSkillRegistry.fromShellPaths(shellPaths).setEnabled(selected.id, true);
1073
1188
  this.finishLocalOperation('skill', `Enabled skill ${selected.name}`, `${selected.name} can now inform main-conversation turns.`);
@@ -1077,6 +1192,19 @@ export class AgentWorkspace {
1077
1192
  } else if (operation === 'skill-review') {
1078
1193
  AgentSkillRegistry.fromShellPaths(shellPaths).markReviewed(selected.id);
1079
1194
  this.finishLocalOperation('skill', `Reviewed skill ${selected.name}`, `${selected.name} is marked reviewed.`);
1195
+ } else if (operation === 'skill-delete') {
1196
+ this.openDeleteEditor('skill', selected);
1197
+ } else if (operation === 'routine-edit') {
1198
+ const routine = AgentRoutineRegistry.fromShellPaths(shellPaths).get(selected.id);
1199
+ if (!routine) throw new Error(`Unknown routine: ${selected.id}`);
1200
+ this.localEditor = createRoutineUpdateEditor(routine);
1201
+ this.status = `Editing routine: ${routine.name}.`;
1202
+ this.lastActionResult = {
1203
+ kind: 'guidance',
1204
+ title: this.localEditor.title,
1205
+ detail: this.localEditor.message,
1206
+ safety: 'safe',
1207
+ };
1080
1208
  } else if (operation === 'routine-start') {
1081
1209
  AgentRoutineRegistry.fromShellPaths(shellPaths).markStarted(selected.id);
1082
1210
  this.finishLocalOperation('routine', `Started routine ${selected.name}`, `${selected.name} was marked started for this main-conversation workflow. No hidden job was created.`);
@@ -1086,9 +1214,11 @@ export class AgentWorkspace {
1086
1214
  } else if (operation === 'routine-disable') {
1087
1215
  AgentRoutineRegistry.fromShellPaths(shellPaths).setEnabled(selected.id, false);
1088
1216
  this.finishLocalOperation('routine', `Disabled routine ${selected.name}`, `${selected.name} remains saved but is no longer injected into guidance.`);
1089
- } else {
1217
+ } else if (operation === 'routine-review') {
1090
1218
  AgentRoutineRegistry.fromShellPaths(shellPaths).markReviewed(selected.id);
1091
1219
  this.finishLocalOperation('routine', `Reviewed routine ${selected.name}`, `${selected.name} is marked reviewed.`);
1220
+ } else {
1221
+ this.openDeleteEditor('routine', selected);
1092
1222
  }
1093
1223
  } catch (error) {
1094
1224
  const detail = error instanceof Error ? error.message : String(error);
@@ -1119,6 +1249,17 @@ export class AgentWorkspace {
1119
1249
  };
1120
1250
  }
1121
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
+
1122
1263
  private replaceEditorField(index: number, value: string, message: string): void {
1123
1264
  const editor = this.localEditor;
1124
1265
  if (!editor) return;
@@ -1163,8 +1304,27 @@ export class AgentWorkspace {
1163
1304
  return;
1164
1305
  }
1165
1306
  try {
1307
+ if (editor.mode === 'delete') {
1308
+ this.submitLocalDeleteEditor(shellPaths, editor);
1309
+ return;
1310
+ }
1166
1311
  if (editor.kind === 'persona') {
1167
1312
  const registry = AgentPersonaRegistry.fromShellPaths(shellPaths);
1313
+ if (editor.mode === 'update' && editor.recordId) {
1314
+ const wasActive = registry.snapshot().activePersonaId === editor.recordId;
1315
+ const updated = registry.update(editor.recordId, {
1316
+ name: this.editorField('name'),
1317
+ description: this.editorField('description'),
1318
+ body: this.editorField('body'),
1319
+ tags: splitList(this.editorField('tags')),
1320
+ triggers: splitList(this.editorField('triggers')),
1321
+ provenance: 'agent-workspace',
1322
+ });
1323
+ if (isAffirmative(this.editorField('activate'))) registry.setActive(updated.id);
1324
+ else if (wasActive) registry.clearActive();
1325
+ this.finishLocalEditor(editor.kind, updated.id, updated.name, 'Updated');
1326
+ return;
1327
+ }
1168
1328
  const created = registry.create({
1169
1329
  name: this.editorField('name'),
1170
1330
  description: this.editorField('description'),
@@ -1175,9 +1335,22 @@ export class AgentWorkspace {
1175
1335
  provenance: 'agent-workspace',
1176
1336
  });
1177
1337
  if (isAffirmative(this.editorField('activate'))) registry.setActive(created.id);
1178
- this.finishLocalEditor(editor.kind, created.id, created.name);
1338
+ this.finishLocalEditor(editor.kind, created.id, created.name, 'Created');
1179
1339
  } else if (editor.kind === 'skill') {
1180
1340
  const registry = AgentSkillRegistry.fromShellPaths(shellPaths);
1341
+ if (editor.mode === 'update' && editor.recordId) {
1342
+ const updated = registry.update(editor.recordId, {
1343
+ name: this.editorField('name'),
1344
+ description: this.editorField('description'),
1345
+ procedure: this.editorField('procedure'),
1346
+ triggers: splitList(this.editorField('triggers')),
1347
+ tags: splitList(this.editorField('tags')),
1348
+ provenance: 'agent-workspace',
1349
+ });
1350
+ registry.setEnabled(updated.id, isAffirmative(this.editorField('enabled')));
1351
+ this.finishLocalEditor(editor.kind, updated.id, updated.name, 'Updated');
1352
+ return;
1353
+ }
1181
1354
  const created = registry.create({
1182
1355
  name: this.editorField('name'),
1183
1356
  description: this.editorField('description'),
@@ -1188,9 +1361,22 @@ export class AgentWorkspace {
1188
1361
  source: 'user',
1189
1362
  provenance: 'agent-workspace',
1190
1363
  });
1191
- this.finishLocalEditor(editor.kind, created.id, created.name);
1364
+ this.finishLocalEditor(editor.kind, created.id, created.name, 'Created');
1192
1365
  } else {
1193
1366
  const registry = AgentRoutineRegistry.fromShellPaths(shellPaths);
1367
+ if (editor.mode === 'update' && editor.recordId) {
1368
+ const updated = registry.update(editor.recordId, {
1369
+ name: this.editorField('name'),
1370
+ description: this.editorField('description'),
1371
+ steps: this.editorField('steps'),
1372
+ triggers: splitList(this.editorField('triggers')),
1373
+ tags: splitList(this.editorField('tags')),
1374
+ provenance: 'agent-workspace',
1375
+ });
1376
+ registry.setEnabled(updated.id, isAffirmative(this.editorField('enabled')));
1377
+ this.finishLocalEditor(editor.kind, updated.id, updated.name, 'Updated');
1378
+ return;
1379
+ }
1194
1380
  const created = registry.create({
1195
1381
  name: this.editorField('name'),
1196
1382
  description: this.editorField('description'),
@@ -1201,7 +1387,7 @@ export class AgentWorkspace {
1201
1387
  source: 'user',
1202
1388
  provenance: 'agent-workspace',
1203
1389
  });
1204
- this.finishLocalEditor(editor.kind, created.id, created.name);
1390
+ this.finishLocalEditor(editor.kind, created.id, created.name, 'Created');
1205
1391
  }
1206
1392
  } catch (error) {
1207
1393
  const detail = error instanceof Error ? error.message : String(error);
@@ -1215,7 +1401,30 @@ export class AgentWorkspace {
1215
1401
  }
1216
1402
  }
1217
1403
 
1218
- private finishLocalEditor(kind: AgentWorkspaceLocalEditorKind, id: string, name: string): void {
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
+
1427
+ private finishLocalEditor(kind: AgentWorkspaceLocalEditorKind, id: string, name: string, verb: 'Created' | 'Updated'): void {
1219
1428
  this.localEditor = null;
1220
1429
  const categoryId = editorCategoryId(kind);
1221
1430
  const categoryIndex = this.categories.findIndex((category) => category.id === categoryId);
@@ -1224,15 +1433,34 @@ export class AgentWorkspace {
1224
1433
  this.selectedActionIndex = 0;
1225
1434
  }
1226
1435
  this.runtimeSnapshot = this.context ? buildAgentWorkspaceRuntimeSnapshot(this.context) : this.runtimeSnapshot;
1227
- this.status = `Created ${kind}: ${name}.`;
1436
+ this.status = `${verb} ${kind}: ${name}.`;
1228
1437
  this.lastActionResult = {
1229
1438
  kind: 'refreshed',
1230
- title: `Created ${kind}`,
1439
+ title: `${verb} ${kind}`,
1231
1440
  detail: `${name} (${id}) was saved to the Agent-local ${categoryId} registry.`,
1232
1441
  safety: 'safe',
1233
1442
  };
1234
1443
  this.clampSelection();
1235
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
+ }
1236
1464
  }
1237
1465
 
1238
1466
  export function handleAgentWorkspaceToken(
package/src/main.ts CHANGED
@@ -767,4 +767,31 @@ async function main() {
767
767
 
768
768
  }
769
769
 
770
- main().catch(err => logger.error('Fatal error', { error: err }));
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
+ });
@@ -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 = new 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.52';
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 {