@vellumai/cli 0.5.14 → 0.5.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/cli",
3
- "version": "0.5.14",
3
+ "version": "0.5.15",
4
4
  "description": "CLI tools for vellum-assistant",
5
5
  "type": "module",
6
6
  "exports": {
@@ -110,11 +110,36 @@ export async function wake(): Promise<void> {
110
110
  }
111
111
  }
112
112
 
113
- // Reuse the lockfile-persisted signing key so client actor tokens survive
114
- // daemon/gateway restarts. Generate and persist a new one only on first wake.
115
- let signingKey = resources.signingKey;
113
+ // Resolve the signing key. The gateway persists its own copy to disk at
114
+ // <instanceDir>/.vellum/protected/actor-token-signing-key. That on-disk key
115
+ // is the source of truth because it is what the gateway actually used to sign
116
+ // existing actor tokens. Prefer it over the lockfile value so that tokens
117
+ // survive upgrades and any scenario where the two diverge.
118
+ //
119
+ // NOTE: Removal of this legacy key path read is blocked on removing all use
120
+ // of the signing key from the assistant daemon. Until then, the on-disk key
121
+ // must remain the authoritative source.
122
+ const legacyKeyPath = join(
123
+ resources.instanceDir,
124
+ ".vellum",
125
+ "protected",
126
+ "actor-token-signing-key",
127
+ );
128
+ let signingKey: string | undefined;
129
+ if (existsSync(legacyKeyPath)) {
130
+ try {
131
+ const raw = readFileSync(legacyKeyPath);
132
+ if (raw.length === 32) {
133
+ signingKey = raw.toString("hex");
134
+ }
135
+ } catch {
136
+ // Ignore — fall through to lockfile or generate.
137
+ }
138
+ }
116
139
  if (!signingKey) {
117
- signingKey = generateLocalSigningKey();
140
+ signingKey = resources.signingKey ?? generateLocalSigningKey();
141
+ }
142
+ if (signingKey !== resources.signingKey) {
118
143
  entry.resources = { ...resources, signingKey };
119
144
  saveAssistantEntry(entry);
120
145
  }