@vetala/vetala 0.1.0-dev → 0.2.1-dev
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/README.md +31 -1
- package/dist/src/agent.d.ts +12 -1
- package/dist/src/agent.js +92 -14
- package/dist/src/agent.js.map +1 -1
- package/dist/src/app-meta.d.ts +3 -0
- package/dist/src/app-meta.js +4 -0
- package/dist/src/app-meta.js.map +1 -0
- package/dist/src/cli.js +28 -10
- package/dist/src/cli.js.map +1 -1
- package/dist/src/config.d.ts +10 -1
- package/dist/src/config.js +160 -67
- package/dist/src/config.js.map +1 -1
- package/dist/src/edit-history.d.ts +4 -0
- package/dist/src/edit-history.js +77 -0
- package/dist/src/edit-history.js.map +1 -0
- package/dist/src/edits/diff.d.ts +1 -0
- package/dist/src/edits/diff.js +176 -0
- package/dist/src/edits/diff.js.map +1 -0
- package/dist/src/ink/command-suggestions.js +1 -0
- package/dist/src/ink/command-suggestions.js.map +1 -1
- package/dist/src/ink/ink-terminal-ui.d.ts +2 -2
- package/dist/src/ink/ink-terminal-ui.js +7 -3
- package/dist/src/ink/ink-terminal-ui.js.map +1 -1
- package/dist/src/ink/repl-app.d.ts +3 -2
- package/dist/src/ink/repl-app.js +419 -111
- package/dist/src/ink/repl-app.js.map +1 -1
- package/dist/src/process-utils.d.ts +1 -0
- package/dist/src/process-utils.js +3 -1
- package/dist/src/process-utils.js.map +1 -1
- package/dist/src/providers/catalog.d.ts +29 -0
- package/dist/src/providers/catalog.js +121 -0
- package/dist/src/providers/catalog.js.map +1 -0
- package/dist/src/providers/index.d.ts +9 -0
- package/dist/src/providers/index.js +11 -0
- package/dist/src/providers/index.js.map +1 -0
- package/dist/src/providers/openai-compatible-client.d.ts +23 -0
- package/dist/src/providers/openai-compatible-client.js +183 -0
- package/dist/src/providers/openai-compatible-client.js.map +1 -0
- package/dist/src/repl.d.ts +2 -1
- package/dist/src/repl.js +1 -1
- package/dist/src/repl.js.map +1 -1
- package/dist/src/runtime-profile.d.ts +16 -0
- package/dist/src/runtime-profile.js +112 -0
- package/dist/src/runtime-profile.js.map +1 -0
- package/dist/src/search-provider.d.ts +6 -1
- package/dist/src/search-provider.js +257 -0
- package/dist/src/search-provider.js.map +1 -1
- package/dist/src/session-store.d.ts +5 -3
- package/dist/src/session-store.js +75 -4
- package/dist/src/session-store.js.map +1 -1
- package/dist/src/terminal-ui.d.ts +3 -1
- package/dist/src/terminal-ui.js +13 -3
- package/dist/src/terminal-ui.js.map +1 -1
- package/dist/src/tools/filesystem.js +141 -143
- package/dist/src/tools/filesystem.js.map +1 -1
- package/dist/src/tools/index.js +2 -0
- package/dist/src/tools/index.js.map +1 -1
- package/dist/src/tools/repo-search.d.ts +23 -0
- package/dist/src/tools/repo-search.js +221 -0
- package/dist/src/tools/repo-search.js.map +1 -0
- package/dist/src/tools/shell.js +26 -3
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/timing.d.ts +2 -0
- package/dist/src/tools/timing.js +58 -0
- package/dist/src/tools/timing.js.map +1 -0
- package/dist/src/tools/web.js +70 -5
- package/dist/src/tools/web.js.map +1 -1
- package/dist/src/types.d.ts +89 -17
- package/dist/src/update-notifier.d.ts +41 -0
- package/dist/src/update-notifier.js +145 -0
- package/dist/src/update-notifier.js.map +1 -0
- package/package.json +13 -2
- package/terminal.png +0 -0
package/dist/src/types.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type ChatRole = "system" | "user" | "assistant" | "tool";
|
|
2
2
|
export type ApprovalScope = "once" | "session" | "deny";
|
|
3
3
|
export type ReasoningEffort = "low" | "medium" | "high";
|
|
4
|
+
export type ProviderName = "sarvam" | "openrouter";
|
|
5
|
+
export type SearchProviderName = "disabled" | "duckduckgo" | "stack_overflow" | "brave" | "bing";
|
|
4
6
|
export interface ToolCallFunction {
|
|
5
7
|
name: string;
|
|
6
8
|
arguments: string;
|
|
@@ -31,9 +33,24 @@ export interface SessionApprovals {
|
|
|
31
33
|
outOfTreeRoots: string[];
|
|
32
34
|
webAccess: boolean;
|
|
33
35
|
}
|
|
36
|
+
export interface RuntimeHostProfile {
|
|
37
|
+
platform: NodeJS.Platform;
|
|
38
|
+
arch: string;
|
|
39
|
+
release: string;
|
|
40
|
+
osVersion: string;
|
|
41
|
+
shell: string;
|
|
42
|
+
terminalProgram: string;
|
|
43
|
+
terminalType: string;
|
|
44
|
+
colorSupport: string;
|
|
45
|
+
stdinIsTTY: boolean;
|
|
46
|
+
stdoutIsTTY: boolean;
|
|
47
|
+
columns: number | null;
|
|
48
|
+
rows: number | null;
|
|
49
|
+
}
|
|
34
50
|
export interface SessionState {
|
|
35
51
|
id: string;
|
|
36
52
|
workspaceRoot: string;
|
|
53
|
+
provider: ProviderName;
|
|
37
54
|
model: string;
|
|
38
55
|
createdAt: string;
|
|
39
56
|
updatedAt: string;
|
|
@@ -42,10 +59,12 @@ export interface SessionState {
|
|
|
42
59
|
referencedFiles: string[];
|
|
43
60
|
readFiles: string[];
|
|
44
61
|
pinnedSkills: string[];
|
|
62
|
+
edits: FileEdit[];
|
|
45
63
|
}
|
|
46
64
|
export interface SessionListItem {
|
|
47
65
|
id: string;
|
|
48
66
|
workspaceRoot: string;
|
|
67
|
+
provider: ProviderName;
|
|
49
68
|
model: string;
|
|
50
69
|
createdAt: string;
|
|
51
70
|
updatedAt: string;
|
|
@@ -54,6 +73,7 @@ export interface SessionMetaRecord {
|
|
|
54
73
|
type: "meta";
|
|
55
74
|
id: string;
|
|
56
75
|
workspaceRoot: string;
|
|
76
|
+
provider?: ProviderName;
|
|
57
77
|
model: string;
|
|
58
78
|
createdAt: string;
|
|
59
79
|
}
|
|
@@ -78,6 +98,7 @@ export interface SessionReadRecord {
|
|
|
78
98
|
}
|
|
79
99
|
export interface SessionModelRecord {
|
|
80
100
|
type: "model";
|
|
101
|
+
provider?: ProviderName;
|
|
81
102
|
model: string;
|
|
82
103
|
timestamp: string;
|
|
83
104
|
}
|
|
@@ -87,23 +108,59 @@ export interface SessionSkillRecord {
|
|
|
87
108
|
skillName?: string;
|
|
88
109
|
timestamp: string;
|
|
89
110
|
}
|
|
90
|
-
export
|
|
111
|
+
export interface FileEdit {
|
|
112
|
+
id: string;
|
|
113
|
+
path: string;
|
|
114
|
+
beforeContent: string | null;
|
|
115
|
+
afterContent: string;
|
|
116
|
+
summary: string;
|
|
117
|
+
timestamp: string;
|
|
118
|
+
revertedAt?: string | null;
|
|
119
|
+
}
|
|
120
|
+
export interface SessionEditRecord {
|
|
121
|
+
type: "edit";
|
|
122
|
+
edit: FileEdit;
|
|
123
|
+
}
|
|
124
|
+
export interface SessionEditRevertRecord {
|
|
125
|
+
type: "edit_revert";
|
|
126
|
+
editId: string;
|
|
127
|
+
timestamp: string;
|
|
128
|
+
}
|
|
129
|
+
export type SessionRecord = SessionMetaRecord | SessionMessageRecord | SessionApprovalRecord | SessionReferenceRecord | SessionReadRecord | SessionModelRecord | SessionSkillRecord | SessionEditRecord | SessionEditRevertRecord;
|
|
130
|
+
export interface ProviderSavedAuth {
|
|
131
|
+
mode: "bearer" | "subscription_key";
|
|
132
|
+
sha256: string;
|
|
133
|
+
value?: string;
|
|
134
|
+
}
|
|
135
|
+
export interface ProviderFileConfig {
|
|
136
|
+
defaultModel?: string;
|
|
137
|
+
baseUrl?: string;
|
|
138
|
+
savedAuth?: ProviderSavedAuth;
|
|
139
|
+
}
|
|
91
140
|
export interface FileConfig {
|
|
141
|
+
defaultProvider?: ProviderName;
|
|
92
142
|
defaultModel?: string;
|
|
93
143
|
reasoningEffort?: ReasoningEffort | null;
|
|
94
144
|
baseUrl?: string;
|
|
145
|
+
providers?: Partial<Record<ProviderName, ProviderFileConfig>>;
|
|
95
146
|
searchProvider?: {
|
|
96
|
-
name?:
|
|
147
|
+
name?: SearchProviderName;
|
|
97
148
|
};
|
|
98
149
|
trustedWorkspaces?: string[];
|
|
99
|
-
savedAuth?:
|
|
100
|
-
mode: "bearer" | "subscription_key";
|
|
101
|
-
sha256: string;
|
|
102
|
-
value?: string;
|
|
103
|
-
};
|
|
150
|
+
savedAuth?: ProviderSavedAuth;
|
|
104
151
|
}
|
|
105
152
|
export type AuthSource = "env" | "session" | "stored" | "stored_hash" | "missing";
|
|
153
|
+
export interface ProviderRuntimeConfig {
|
|
154
|
+
name: ProviderName;
|
|
155
|
+
baseUrl: string;
|
|
156
|
+
defaultModel: string;
|
|
157
|
+
authMode: "bearer" | "subscription_key" | "missing";
|
|
158
|
+
authValue: string | undefined;
|
|
159
|
+
authFingerprint: string | undefined;
|
|
160
|
+
authSource: AuthSource;
|
|
161
|
+
}
|
|
106
162
|
export interface EffectiveConfig {
|
|
163
|
+
defaultProvider: ProviderName;
|
|
107
164
|
authMode: "bearer" | "subscription_key" | "missing";
|
|
108
165
|
authValue: string | undefined;
|
|
109
166
|
authFingerprint: string | undefined;
|
|
@@ -113,8 +170,9 @@ export interface EffectiveConfig {
|
|
|
113
170
|
reasoningEffort: ReasoningEffort | null;
|
|
114
171
|
configPath: string;
|
|
115
172
|
dataPath: string;
|
|
116
|
-
searchProviderName:
|
|
173
|
+
searchProviderName: SearchProviderName;
|
|
117
174
|
trustedWorkspaces: string[];
|
|
175
|
+
providers: Record<ProviderName, ProviderRuntimeConfig>;
|
|
118
176
|
}
|
|
119
177
|
export type ApprovalKind = "path_access" | "write_file" | "replace_in_file" | "run_shell" | "web_access";
|
|
120
178
|
export interface ApprovalRequest {
|
|
@@ -157,6 +215,14 @@ export interface ToolContext {
|
|
|
157
215
|
hasRead(path: string): boolean;
|
|
158
216
|
registerRead(path: string): Promise<void>;
|
|
159
217
|
};
|
|
218
|
+
edits: {
|
|
219
|
+
recordEdit(edit: {
|
|
220
|
+
path: string;
|
|
221
|
+
beforeContent: string | null;
|
|
222
|
+
afterContent: string;
|
|
223
|
+
summary: string;
|
|
224
|
+
}): Promise<FileEdit>;
|
|
225
|
+
};
|
|
160
226
|
paths: {
|
|
161
227
|
resolve(inputPath: string): string;
|
|
162
228
|
ensureReadable(inputPath: string): Promise<string>;
|
|
@@ -172,7 +238,7 @@ export interface ToolSpec {
|
|
|
172
238
|
readOnly: boolean;
|
|
173
239
|
execute(rawArgs: unknown, context: ToolContext): Promise<ToolResult>;
|
|
174
240
|
}
|
|
175
|
-
export interface
|
|
241
|
+
export interface ToolDefinition {
|
|
176
242
|
type: "function";
|
|
177
243
|
function: {
|
|
178
244
|
name: string;
|
|
@@ -180,27 +246,27 @@ export interface SarvamToolDefinition {
|
|
|
180
246
|
parameters?: Record<string, unknown>;
|
|
181
247
|
};
|
|
182
248
|
}
|
|
183
|
-
export interface
|
|
249
|
+
export interface ChatCompletionRequest {
|
|
184
250
|
messages: ChatMessage[];
|
|
185
251
|
model: string;
|
|
186
252
|
stream?: boolean;
|
|
187
253
|
temperature?: number;
|
|
188
254
|
reasoning_effort?: ReasoningEffort | null;
|
|
189
|
-
tools?:
|
|
255
|
+
tools?: ToolDefinition[];
|
|
190
256
|
tool_choice?: "none" | "auto" | "required";
|
|
191
257
|
}
|
|
192
|
-
export interface
|
|
258
|
+
export interface ChatCompletionMessage {
|
|
193
259
|
role: "assistant";
|
|
194
260
|
content: string | null;
|
|
195
261
|
tool_calls?: ToolCall[] | null;
|
|
196
262
|
}
|
|
197
|
-
export interface
|
|
263
|
+
export interface ChatCompletionResponse {
|
|
198
264
|
id: string;
|
|
199
265
|
model: string;
|
|
200
266
|
choices: Array<{
|
|
201
267
|
finish_reason: string;
|
|
202
268
|
index: number;
|
|
203
|
-
message:
|
|
269
|
+
message: ChatCompletionMessage;
|
|
204
270
|
}>;
|
|
205
271
|
usage?: {
|
|
206
272
|
prompt_tokens: number;
|
|
@@ -208,7 +274,7 @@ export interface SarvamChatCompletionResponse {
|
|
|
208
274
|
total_tokens: number;
|
|
209
275
|
} | null;
|
|
210
276
|
}
|
|
211
|
-
export interface
|
|
277
|
+
export interface StreamDeltaToolCall {
|
|
212
278
|
index: number;
|
|
213
279
|
id?: string;
|
|
214
280
|
type?: "function";
|
|
@@ -217,7 +283,7 @@ export interface SarvamStreamDeltaToolCall {
|
|
|
217
283
|
arguments?: string;
|
|
218
284
|
};
|
|
219
285
|
}
|
|
220
|
-
export interface
|
|
286
|
+
export interface StreamChunk {
|
|
221
287
|
id?: string;
|
|
222
288
|
choices?: Array<{
|
|
223
289
|
index: number;
|
|
@@ -225,10 +291,16 @@ export interface SarvamStreamChunk {
|
|
|
225
291
|
delta?: {
|
|
226
292
|
role?: "assistant";
|
|
227
293
|
content?: string | null;
|
|
228
|
-
tool_calls?:
|
|
294
|
+
tool_calls?: StreamDeltaToolCall[];
|
|
229
295
|
};
|
|
230
296
|
}>;
|
|
231
297
|
}
|
|
298
|
+
export type SarvamToolDefinition = ToolDefinition;
|
|
299
|
+
export type SarvamChatCompletionRequest = ChatCompletionRequest;
|
|
300
|
+
export type SarvamChatCompletionMessage = ChatCompletionMessage;
|
|
301
|
+
export type SarvamChatCompletionResponse = ChatCompletionResponse;
|
|
302
|
+
export type SarvamStreamDeltaToolCall = StreamDeltaToolCall;
|
|
303
|
+
export type SarvamStreamChunk = StreamChunk;
|
|
232
304
|
export interface StreamedAssistantTurn {
|
|
233
305
|
content: string;
|
|
234
306
|
toolCalls: ToolCall[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type CommandOutput } from "./process-utils.js";
|
|
2
|
+
export interface AvailableAppUpdate {
|
|
3
|
+
currentVersion: string;
|
|
4
|
+
latestVersion: string;
|
|
5
|
+
installCommand: string;
|
|
6
|
+
source: "cache" | "network";
|
|
7
|
+
}
|
|
8
|
+
export interface AppUpdateStore {
|
|
9
|
+
get(key: string): unknown;
|
|
10
|
+
set(key: string, value: unknown): void;
|
|
11
|
+
delete(key: string): void;
|
|
12
|
+
}
|
|
13
|
+
export interface AppUpdateNotifier {
|
|
14
|
+
update?: {
|
|
15
|
+
latest: string;
|
|
16
|
+
current: string;
|
|
17
|
+
type?: string;
|
|
18
|
+
name: string;
|
|
19
|
+
};
|
|
20
|
+
config?: AppUpdateStore;
|
|
21
|
+
fetchInfo(): Promise<{
|
|
22
|
+
latest: string;
|
|
23
|
+
current: string;
|
|
24
|
+
type?: string;
|
|
25
|
+
name: string;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
export interface CheckForAppUpdateOptions {
|
|
29
|
+
currentVersion?: string;
|
|
30
|
+
now?: Date;
|
|
31
|
+
force?: boolean;
|
|
32
|
+
notifier?: AppUpdateNotifier;
|
|
33
|
+
}
|
|
34
|
+
export interface SnoozeAppUpdateOptions {
|
|
35
|
+
now?: Date;
|
|
36
|
+
durationMs?: number;
|
|
37
|
+
notifier?: AppUpdateNotifier;
|
|
38
|
+
}
|
|
39
|
+
export declare function checkForAppUpdate(options?: CheckForAppUpdateOptions): Promise<AvailableAppUpdate | null>;
|
|
40
|
+
export declare function snoozeAppUpdate(latestVersion: string, options?: SnoozeAppUpdateOptions): Promise<void>;
|
|
41
|
+
export declare function installAppUpdate(latestVersion: string): Promise<CommandOutput>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import updateNotifier from "update-notifier";
|
|
2
|
+
import { APP_VERSION } from "./app-meta.js";
|
|
3
|
+
import { runExecFile } from "./process-utils.js";
|
|
4
|
+
const PACKAGE_NAME = "@vetala/vetala";
|
|
5
|
+
const UPDATE_CHECK_INTERVAL_MS = 12 * 60 * 60 * 1000;
|
|
6
|
+
const UPDATE_SNOOZE_MS = 24 * 60 * 60 * 1000;
|
|
7
|
+
const UPDATE_INSTALL_TIMEOUT_MS = 5 * 60 * 1000;
|
|
8
|
+
const LAST_CHECK_KEY = "vetalaUpdateLastCheck";
|
|
9
|
+
const STORED_UPDATE_KEY = "vetalaStoredUpdate";
|
|
10
|
+
const SNOOZED_VERSION_KEY = "vetalaSnoozedVersion";
|
|
11
|
+
const SNOOZED_UNTIL_KEY = "vetalaSnoozedUntil";
|
|
12
|
+
export async function checkForAppUpdate(options = {}) {
|
|
13
|
+
const now = options.now ?? new Date();
|
|
14
|
+
const currentVersion = options.currentVersion ?? APP_VERSION;
|
|
15
|
+
const notifier = options.notifier ?? createAppUpdateNotifier(currentVersion);
|
|
16
|
+
const cachedUpdate = readStoredUpdate(notifier.config, currentVersion) ?? normalizeUpdateInfo(notifier.update);
|
|
17
|
+
const cachedResult = cachedUpdate && hasAvailableUpdate(cachedUpdate) && !isSnoozed(notifier.config, cachedUpdate.latest, now)
|
|
18
|
+
? buildAvailableUpdate(currentVersion, cachedUpdate.latest, "cache")
|
|
19
|
+
: null;
|
|
20
|
+
const shouldRefresh = options.force || shouldRefreshUpdateInfo(notifier.config, now);
|
|
21
|
+
if (!shouldRefresh) {
|
|
22
|
+
return cachedResult;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const fetchedUpdate = normalizeUpdateInfo(await notifier.fetchInfo());
|
|
26
|
+
recordUpdateCheck(notifier.config, now);
|
|
27
|
+
if (!fetchedUpdate || !hasAvailableUpdate(fetchedUpdate)) {
|
|
28
|
+
clearStoredUpdate(notifier.config);
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
writeStoredUpdate(notifier.config, fetchedUpdate);
|
|
32
|
+
if (isSnoozed(notifier.config, fetchedUpdate.latest, now)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return buildAvailableUpdate(currentVersion, fetchedUpdate.latest, "network");
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return cachedResult;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export async function snoozeAppUpdate(latestVersion, options = {}) {
|
|
42
|
+
const notifier = options.notifier ?? createAppUpdateNotifier(APP_VERSION);
|
|
43
|
+
const store = notifier.config;
|
|
44
|
+
if (!store) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const now = options.now ?? new Date();
|
|
48
|
+
const durationMs = options.durationMs ?? UPDATE_SNOOZE_MS;
|
|
49
|
+
store.set(SNOOZED_VERSION_KEY, latestVersion);
|
|
50
|
+
store.set(SNOOZED_UNTIL_KEY, new Date(now.getTime() + durationMs).toISOString());
|
|
51
|
+
}
|
|
52
|
+
export async function installAppUpdate(latestVersion) {
|
|
53
|
+
const npmExecutable = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
54
|
+
return runExecFile(npmExecutable, ["install", "-g", `${PACKAGE_NAME}@${latestVersion}`], {
|
|
55
|
+
cwd: process.cwd(),
|
|
56
|
+
timeoutMs: UPDATE_INSTALL_TIMEOUT_MS
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function createAppUpdateNotifier(currentVersion) {
|
|
60
|
+
return updateNotifier({
|
|
61
|
+
pkg: {
|
|
62
|
+
name: PACKAGE_NAME,
|
|
63
|
+
version: currentVersion
|
|
64
|
+
},
|
|
65
|
+
updateCheckInterval: UPDATE_CHECK_INTERVAL_MS,
|
|
66
|
+
shouldNotifyInNpmScript: true
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function buildAvailableUpdate(currentVersion, latestVersion, source) {
|
|
70
|
+
return {
|
|
71
|
+
currentVersion,
|
|
72
|
+
latestVersion,
|
|
73
|
+
installCommand: `npm install -g ${PACKAGE_NAME}@${latestVersion}`,
|
|
74
|
+
source
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function normalizeUpdateInfo(value) {
|
|
78
|
+
if (value === null || typeof value !== "object") {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const candidate = value;
|
|
82
|
+
if (typeof candidate.latest !== "string" || typeof candidate.current !== "string") {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
const normalized = {
|
|
86
|
+
latest: candidate.latest,
|
|
87
|
+
current: candidate.current,
|
|
88
|
+
name: typeof candidate.name === "string" ? candidate.name : PACKAGE_NAME
|
|
89
|
+
};
|
|
90
|
+
if (typeof candidate.type === "string") {
|
|
91
|
+
normalized.type = candidate.type;
|
|
92
|
+
}
|
|
93
|
+
return normalized;
|
|
94
|
+
}
|
|
95
|
+
function hasAvailableUpdate(update) {
|
|
96
|
+
return update.type !== "latest" && update.latest !== update.current;
|
|
97
|
+
}
|
|
98
|
+
function readStoredUpdate(store, currentVersion) {
|
|
99
|
+
if (!store) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const stored = normalizeUpdateInfo(store.get(STORED_UPDATE_KEY));
|
|
103
|
+
if (!stored || stored.current !== currentVersion || !hasAvailableUpdate(stored)) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return stored;
|
|
107
|
+
}
|
|
108
|
+
function writeStoredUpdate(store, update) {
|
|
109
|
+
store?.set(STORED_UPDATE_KEY, update);
|
|
110
|
+
}
|
|
111
|
+
function clearStoredUpdate(store) {
|
|
112
|
+
store?.delete(STORED_UPDATE_KEY);
|
|
113
|
+
}
|
|
114
|
+
function shouldRefreshUpdateInfo(store, now) {
|
|
115
|
+
if (!store) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
const lastChecked = store.get(LAST_CHECK_KEY);
|
|
119
|
+
if (typeof lastChecked !== "string") {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
const timestamp = Date.parse(lastChecked);
|
|
123
|
+
return !Number.isFinite(timestamp) || now.getTime() - timestamp >= UPDATE_CHECK_INTERVAL_MS;
|
|
124
|
+
}
|
|
125
|
+
function recordUpdateCheck(store, now) {
|
|
126
|
+
store?.set(LAST_CHECK_KEY, now.toISOString());
|
|
127
|
+
}
|
|
128
|
+
function isSnoozed(store, latestVersion, now) {
|
|
129
|
+
if (!store) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
const snoozedVersion = store.get(SNOOZED_VERSION_KEY);
|
|
133
|
+
const snoozedUntil = store.get(SNOOZED_UNTIL_KEY);
|
|
134
|
+
if (snoozedVersion !== latestVersion || typeof snoozedUntil !== "string") {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
const until = Date.parse(snoozedUntil);
|
|
138
|
+
const active = Number.isFinite(until) && until > now.getTime();
|
|
139
|
+
if (!active) {
|
|
140
|
+
store.delete(SNOOZED_VERSION_KEY);
|
|
141
|
+
store.delete(SNOOZED_UNTIL_KEY);
|
|
142
|
+
}
|
|
143
|
+
return active;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=update-notifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-notifier.js","sourceRoot":"","sources":["../../src/update-notifier.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAsB,MAAM,oBAAoB,CAAC;AAErE,MAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,MAAM,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACrD,MAAM,gBAAgB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC7C,MAAM,yBAAyB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAChD,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAC/C,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAC/C,MAAM,mBAAmB,GAAG,sBAAsB,CAAC;AACnD,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AA8C/C,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,UAAoC,EAAE;IAEtC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;IACtC,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,WAAW,CAAC;IAC7D,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAC7E,MAAM,YAAY,GAAG,gBAAgB,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,CA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KAAK,CAAC,YAAY,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAE/D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAClC,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vetala/vetala",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1-dev",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Terminal-first AI coding CLI with tools, memory, and local skills.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"ai",
|
|
9
|
+
"cli",
|
|
10
|
+
"terminal",
|
|
11
|
+
"tui",
|
|
12
|
+
"coding-assistant",
|
|
13
|
+
"developer-tools",
|
|
14
|
+
"openrouter",
|
|
15
|
+
"typescript"
|
|
16
|
+
],
|
|
7
17
|
"repository": {
|
|
8
18
|
"type": "git",
|
|
9
19
|
"url": "git+https://github.com/bymehul/vetala.git"
|
|
@@ -46,7 +56,8 @@
|
|
|
46
56
|
"ink-spinner": "^5.0.0",
|
|
47
57
|
"ink-text-input": "^6.0.0",
|
|
48
58
|
"ora": "^9.3.0",
|
|
49
|
-
"react": "^19.0.0"
|
|
59
|
+
"react": "^19.0.0",
|
|
60
|
+
"update-notifier": "^7.3.1"
|
|
50
61
|
},
|
|
51
62
|
"devDependencies": {
|
|
52
63
|
"@types/node": "^24.0.0",
|
package/terminal.png
CHANGED
|
Binary file
|