@vellumai/assistant 0.5.12 → 0.5.13
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/Dockerfile +41 -9
- package/node_modules/@vellumai/ces-contracts/src/index.ts +7 -0
- package/node_modules/@vellumai/ces-contracts/src/rpc.ts +5 -0
- package/openapi.yaml +1 -1
- package/package.json +1 -1
- package/src/__tests__/first-greeting.test.ts +7 -0
- package/src/__tests__/navigate-settings-tab.test.ts +6 -2
- package/src/__tests__/platform.test.ts +3 -168
- package/src/__tests__/skill-feature-flags.test.ts +8 -0
- package/src/__tests__/skill-secret-handling-guard.test.ts +212 -0
- package/src/__tests__/token-estimator-accuracy.benchmark.test.ts +1 -1
- package/src/cli/commands/platform/__tests__/connect.test.ts +224 -0
- package/src/cli/commands/platform/__tests__/disconnect.test.ts +237 -0
- package/src/cli/commands/platform/__tests__/status.test.ts +246 -0
- package/src/config/bundled-skills/messaging/SKILL.md +1 -1
- package/src/config/bundled-skills/settings/TOOLS.json +5 -3
- package/src/config/bundled-skills/settings/tools/navigate-settings-tab.ts +4 -2
- package/src/config/feature-flag-registry.json +1 -1
- package/src/credential-execution/client.ts +14 -2
- package/src/daemon/first-greeting.ts +6 -1
- package/src/daemon/lifecycle.ts +13 -8
- package/src/index.ts +0 -12
- package/src/memory/conversation-queries.ts +6 -6
- package/src/memory/journal-memory.ts +8 -2
- package/src/prompts/journal-context.ts +4 -1
- package/src/prompts/system-prompt.ts +11 -0
- package/src/runtime/http-server.ts +7 -15
- package/src/runtime/migrations/rebind-secrets-screen.ts +2 -2
- package/src/runtime/routes/secret-routes.ts +9 -2
- package/src/tools/browser/browser-manager.ts +2 -2
- package/src/util/platform.ts +1 -91
package/src/util/platform.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
chmodSync,
|
|
3
|
-
existsSync,
|
|
4
|
-
mkdirSync,
|
|
5
|
-
readFileSync,
|
|
6
|
-
} from "node:fs";
|
|
1
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
7
2
|
import { homedir } from "node:os";
|
|
8
3
|
import { join } from "node:path";
|
|
9
4
|
|
|
@@ -44,90 +39,6 @@ export function getClipboardCommand(): string | null {
|
|
|
44
39
|
return null;
|
|
45
40
|
}
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Resolve the instance data directory from the lockfile.
|
|
50
|
-
*
|
|
51
|
-
* Checks both ~/.vellum.lock.json (current) and ~/.vellum.lockfile.json
|
|
52
|
-
* (legacy) to support installs that haven't migrated the filename.
|
|
53
|
-
*
|
|
54
|
-
* Reads the lockfile from homedir() directly (NOT via readLockfile() which
|
|
55
|
-
* depends on BASE_DATA_DIR) to avoid circular dependency — this function is
|
|
56
|
-
* called at CLI bootstrap before BASE_DATA_DIR is set.
|
|
57
|
-
*
|
|
58
|
-
* Resolution:
|
|
59
|
-
* - If activeAssistant matches a local assistant, returns its instanceDir.
|
|
60
|
-
* - If there is exactly one local assistant and no activeAssistant, returns
|
|
61
|
-
* its instanceDir (auto-select).
|
|
62
|
-
* - Returns undefined in all other cases (no lockfile, no local assistants,
|
|
63
|
-
* multiple local assistants with no active selection, malformed JSON).
|
|
64
|
-
*
|
|
65
|
-
* Synchronous (uses readFileSync) since it runs at bootstrap before any async
|
|
66
|
-
* context. Never throws — catches all errors and returns undefined for
|
|
67
|
-
* graceful degradation.
|
|
68
|
-
*/
|
|
69
|
-
export function resolveInstanceDataDir(): string | undefined {
|
|
70
|
-
try {
|
|
71
|
-
const home = homedir();
|
|
72
|
-
const candidates = [
|
|
73
|
-
join(home, ".vellum.lock.json"),
|
|
74
|
-
join(home, ".vellum.lockfile.json"),
|
|
75
|
-
];
|
|
76
|
-
|
|
77
|
-
let raw: unknown;
|
|
78
|
-
for (const lockPath of candidates) {
|
|
79
|
-
if (!existsSync(lockPath)) continue;
|
|
80
|
-
try {
|
|
81
|
-
const parsed = JSON.parse(readFileSync(lockPath, "utf-8"));
|
|
82
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
83
|
-
raw = parsed;
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
} catch {
|
|
87
|
-
// Malformed JSON; try next candidate
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return undefined;
|
|
91
|
-
const lockData = raw as Record<string, unknown>;
|
|
92
|
-
|
|
93
|
-
const assistants = lockData.assistants as
|
|
94
|
-
| Array<Record<string, unknown>>
|
|
95
|
-
| undefined;
|
|
96
|
-
if (!Array.isArray(assistants)) return undefined;
|
|
97
|
-
|
|
98
|
-
const localAssistants = assistants.filter(
|
|
99
|
-
(a) => a.cloud === "local" || a.cloud === undefined,
|
|
100
|
-
);
|
|
101
|
-
if (localAssistants.length === 0) return undefined;
|
|
102
|
-
|
|
103
|
-
const activeAssistant = lockData.activeAssistant as string | undefined;
|
|
104
|
-
|
|
105
|
-
if (activeAssistant) {
|
|
106
|
-
const match = localAssistants.find(
|
|
107
|
-
(a) => a.assistantId === activeAssistant,
|
|
108
|
-
);
|
|
109
|
-
if (match) {
|
|
110
|
-
const resources = match.resources as
|
|
111
|
-
| Record<string, unknown>
|
|
112
|
-
| undefined;
|
|
113
|
-
return resources?.instanceDir as string | undefined;
|
|
114
|
-
}
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (localAssistants.length === 1) {
|
|
119
|
-
const resources = localAssistants[0].resources as
|
|
120
|
-
| Record<string, unknown>
|
|
121
|
-
| undefined;
|
|
122
|
-
return resources?.instanceDir as string | undefined;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return undefined;
|
|
126
|
-
} catch {
|
|
127
|
-
return undefined;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
42
|
/**
|
|
132
43
|
* Normalize an assistant ID to its canonical form for DB operations.
|
|
133
44
|
*
|
|
@@ -147,7 +58,6 @@ export function normalizeAssistantId(assistantId: string): string {
|
|
|
147
58
|
return assistantId;
|
|
148
59
|
}
|
|
149
60
|
|
|
150
|
-
|
|
151
61
|
/**
|
|
152
62
|
* Returns the root ~/.vellum directory. User-facing files (config, prompt
|
|
153
63
|
* files, skills) and runtime files (socket, PID) live here.
|