vibeusage 0.3.0 → 0.3.1
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 +13 -7
- package/node_modules/@insforge/sdk/LICENSE +201 -201
- package/node_modules/@insforge/sdk/README.md +326 -259
- package/node_modules/@insforge/sdk/dist/index.d.mts +377 -182
- package/node_modules/@insforge/sdk/dist/index.d.ts +377 -182
- package/node_modules/@insforge/sdk/dist/index.js +1172 -677
- package/node_modules/@insforge/sdk/dist/index.js.map +1 -1
- package/node_modules/@insforge/sdk/dist/index.mjs +1171 -677
- package/node_modules/@insforge/sdk/dist/index.mjs.map +1 -1
- package/node_modules/@insforge/sdk/package.json +68 -68
- package/node_modules/@insforge/shared-schemas/dist/ai-api.schema.d.ts +1120 -43
- package/node_modules/@insforge/shared-schemas/dist/ai-api.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/ai-api.schema.js +179 -5
- package/node_modules/@insforge/shared-schemas/dist/ai-api.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/ai.schema.d.ts +25 -25
- package/node_modules/@insforge/shared-schemas/dist/ai.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/ai.schema.js +2 -2
- package/node_modules/@insforge/shared-schemas/dist/ai.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/auth-api.schema.d.ts +197 -51
- package/node_modules/@insforge/shared-schemas/dist/auth-api.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/auth-api.schema.js +87 -23
- package/node_modules/@insforge/shared-schemas/dist/auth-api.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/auth.schema.d.ts +32 -3
- package/node_modules/@insforge/shared-schemas/dist/auth.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/auth.schema.js +21 -3
- package/node_modules/@insforge/shared-schemas/dist/auth.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/cloud-events.schema.d.ts +380 -0
- package/node_modules/@insforge/shared-schemas/dist/cloud-events.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/cloud-events.schema.js +74 -0
- package/node_modules/@insforge/shared-schemas/dist/cloud-events.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/database-api.schema.d.ts +13 -13
- package/node_modules/@insforge/shared-schemas/dist/database-api.schema.js +1 -1
- package/node_modules/@insforge/shared-schemas/dist/database-api.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/deployments-api.schema.d.ts +735 -0
- package/node_modules/@insforge/shared-schemas/dist/deployments-api.schema.d.ts.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/deployments-api.schema.js +209 -0
- package/node_modules/@insforge/shared-schemas/dist/deployments-api.schema.js.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/deployments.schema.d.ts +37 -0
- package/node_modules/@insforge/shared-schemas/dist/deployments.schema.d.ts.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/deployments.schema.js +25 -0
- package/node_modules/@insforge/shared-schemas/dist/deployments.schema.js.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/docs.schema.d.ts +5 -1
- package/node_modules/@insforge/shared-schemas/dist/docs.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/docs.schema.js +34 -4
- package/node_modules/@insforge/shared-schemas/dist/docs.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/email-api.schema.js +1 -1
- package/node_modules/@insforge/shared-schemas/dist/email-api.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/functions-api.schema.d.ts +186 -6
- package/node_modules/@insforge/shared-schemas/dist/functions-api.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/functions-api.schema.js +21 -2
- package/node_modules/@insforge/shared-schemas/dist/functions-api.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/functions.schema.d.ts +5 -5
- package/node_modules/@insforge/shared-schemas/dist/functions.schema.js +1 -1
- package/node_modules/@insforge/shared-schemas/dist/functions.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/index.d.ts +24 -18
- package/node_modules/@insforge/shared-schemas/dist/index.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/index.js +24 -18
- package/node_modules/@insforge/shared-schemas/dist/index.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/logs-api.schema.js +1 -1
- package/node_modules/@insforge/shared-schemas/dist/logs-api.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/logs.schema.d.ts +43 -0
- package/node_modules/@insforge/shared-schemas/dist/logs.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/logs.schema.js +11 -0
- package/node_modules/@insforge/shared-schemas/dist/logs.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/metadata.schema.d.ts +229 -172
- package/node_modules/@insforge/shared-schemas/dist/metadata.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/metadata.schema.js +27 -7
- package/node_modules/@insforge/shared-schemas/dist/metadata.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/rate-limit-api.schema.d.ts +51 -0
- package/node_modules/@insforge/shared-schemas/dist/rate-limit-api.schema.d.ts.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/rate-limit-api.schema.js +31 -0
- package/node_modules/@insforge/shared-schemas/dist/rate-limit-api.schema.js.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/rate-limit.schema.d.ts +31 -0
- package/node_modules/@insforge/shared-schemas/dist/rate-limit.schema.d.ts.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/rate-limit.schema.js +12 -0
- package/node_modules/@insforge/shared-schemas/dist/rate-limit.schema.js.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/realtime-api.schema.d.ts +39 -20
- package/node_modules/@insforge/shared-schemas/dist/realtime-api.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/realtime-api.schema.js +5 -1
- package/node_modules/@insforge/shared-schemas/dist/realtime-api.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/realtime.schema.d.ts +12 -4
- package/node_modules/@insforge/shared-schemas/dist/realtime.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/realtime.schema.js +6 -0
- package/node_modules/@insforge/shared-schemas/dist/realtime.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/schedules-api.schema.d.ts +287 -0
- package/node_modules/@insforge/shared-schemas/dist/schedules-api.schema.d.ts.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/schedules-api.schema.js +81 -0
- package/node_modules/@insforge/shared-schemas/dist/schedules-api.schema.js.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/schedules.schema.d.ts +77 -0
- package/node_modules/@insforge/shared-schemas/dist/schedules.schema.d.ts.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/schedules.schema.js +36 -0
- package/node_modules/@insforge/shared-schemas/dist/schedules.schema.js.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/secrets-api.schema.d.ts +113 -0
- package/node_modules/@insforge/shared-schemas/dist/secrets-api.schema.d.ts.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/secrets-api.schema.js +31 -0
- package/node_modules/@insforge/shared-schemas/dist/secrets-api.schema.js.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/secrets.schema.d.ts +31 -0
- package/node_modules/@insforge/shared-schemas/dist/secrets.schema.d.ts.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/secrets.schema.js +13 -0
- package/node_modules/@insforge/shared-schemas/dist/secrets.schema.js.map +1 -0
- package/node_modules/@insforge/shared-schemas/dist/storage-api.schema.d.ts +27 -2
- package/node_modules/@insforge/shared-schemas/dist/storage-api.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/storage-api.schema.js +9 -1
- package/node_modules/@insforge/shared-schemas/dist/storage-api.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/storage.schema.d.ts +17 -0
- package/node_modules/@insforge/shared-schemas/dist/storage.schema.d.ts.map +1 -1
- package/node_modules/@insforge/shared-schemas/dist/storage.schema.js +6 -0
- package/node_modules/@insforge/shared-schemas/dist/storage.schema.js.map +1 -1
- package/node_modules/@insforge/shared-schemas/package.json +2 -1
- package/package.json +2 -2
- package/src/commands/status.js +22 -0
- package/src/commands/sync.js +33 -22
- package/src/lib/diagnostics.js +34 -0
- package/src/lib/doctor.js +23 -0
- package/src/lib/insforge-client.js +13 -9
- package/src/lib/opencode-sqlite.js +113 -0
- package/src/lib/opencode-usage-audit.js +3 -2
- package/src/lib/rollout.js +227 -1
- package/src/lib/vibeusage-api.js +2 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const secretSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
key: z.ZodString;
|
|
5
|
+
isActive: z.ZodBoolean;
|
|
6
|
+
isReserved: z.ZodBoolean;
|
|
7
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
8
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
9
|
+
createdAt: z.ZodString;
|
|
10
|
+
updatedAt: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
id: string;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
key: string;
|
|
16
|
+
expiresAt: string | null;
|
|
17
|
+
isActive: boolean;
|
|
18
|
+
isReserved: boolean;
|
|
19
|
+
lastUsedAt: string | null;
|
|
20
|
+
}, {
|
|
21
|
+
id: string;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
key: string;
|
|
25
|
+
expiresAt: string | null;
|
|
26
|
+
isActive: boolean;
|
|
27
|
+
isReserved: boolean;
|
|
28
|
+
lastUsedAt: string | null;
|
|
29
|
+
}>;
|
|
30
|
+
export type SecretSchema = z.infer<typeof secretSchema>;
|
|
31
|
+
//# sourceMappingURL=secrets.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.schema.d.ts","sourceRoot":"","sources":["../src/secrets.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;EASvB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Secret metadata (without value - for listing)
|
|
3
|
+
export const secretSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
key: z.string(),
|
|
6
|
+
isActive: z.boolean(),
|
|
7
|
+
isReserved: z.boolean(),
|
|
8
|
+
lastUsedAt: z.string().nullable(),
|
|
9
|
+
expiresAt: z.string().nullable(),
|
|
10
|
+
createdAt: z.string(),
|
|
11
|
+
updatedAt: z.string(),
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=secrets.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.schema.js","sourceRoot":"","sources":["../src/secrets.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;IACvB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC"}
|
|
@@ -104,16 +104,16 @@ export declare const uploadStrategyResponseSchema: z.ZodObject<{
|
|
|
104
104
|
expiresAt: z.ZodOptional<z.ZodDate>;
|
|
105
105
|
}, "strip", z.ZodTypeAny, {
|
|
106
106
|
key: string;
|
|
107
|
-
method: "presigned" | "direct";
|
|
108
107
|
uploadUrl: string;
|
|
108
|
+
method: "presigned" | "direct";
|
|
109
109
|
confirmRequired: boolean;
|
|
110
110
|
expiresAt?: Date | undefined;
|
|
111
111
|
fields?: Record<string, string> | undefined;
|
|
112
112
|
confirmUrl?: string | undefined;
|
|
113
113
|
}, {
|
|
114
114
|
key: string;
|
|
115
|
-
method: "presigned" | "direct";
|
|
116
115
|
uploadUrl: string;
|
|
116
|
+
method: "presigned" | "direct";
|
|
117
117
|
confirmRequired: boolean;
|
|
118
118
|
expiresAt?: Date | undefined;
|
|
119
119
|
fields?: Record<string, string> | undefined;
|
|
@@ -155,6 +155,29 @@ export declare const confirmUploadRequestSchema: z.ZodObject<{
|
|
|
155
155
|
contentType?: string | undefined;
|
|
156
156
|
etag?: string | undefined;
|
|
157
157
|
}>;
|
|
158
|
+
export declare const updateStorageConfigRequestSchema: z.ZodObject<{
|
|
159
|
+
maxFileSizeMb: z.ZodNumber;
|
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
maxFileSizeMb: number;
|
|
162
|
+
}, {
|
|
163
|
+
maxFileSizeMb: number;
|
|
164
|
+
}>;
|
|
165
|
+
export declare const getStorageConfigResponseSchema: z.ZodObject<{
|
|
166
|
+
id: z.ZodString;
|
|
167
|
+
maxFileSizeMb: z.ZodNumber;
|
|
168
|
+
createdAt: z.ZodString;
|
|
169
|
+
updatedAt: z.ZodString;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
id: string;
|
|
172
|
+
createdAt: string;
|
|
173
|
+
updatedAt: string;
|
|
174
|
+
maxFileSizeMb: number;
|
|
175
|
+
}, {
|
|
176
|
+
id: string;
|
|
177
|
+
createdAt: string;
|
|
178
|
+
updatedAt: string;
|
|
179
|
+
maxFileSizeMb: number;
|
|
180
|
+
}>;
|
|
158
181
|
export type CreateBucketRequest = z.infer<typeof createBucketRequestSchema>;
|
|
159
182
|
export type UpdateBucketRequest = z.infer<typeof updateBucketRequestSchema>;
|
|
160
183
|
export type ListObjectsResponseSchema = z.infer<typeof listObjectsResponseSchema>;
|
|
@@ -163,4 +186,6 @@ export type UploadStrategyResponse = z.infer<typeof uploadStrategyResponseSchema
|
|
|
163
186
|
export type DownloadStrategyRequest = z.infer<typeof downloadStrategyRequestSchema>;
|
|
164
187
|
export type DownloadStrategyResponse = z.infer<typeof downloadStrategyResponseSchema>;
|
|
165
188
|
export type ConfirmUploadRequest = z.infer<typeof confirmUploadRequestSchema>;
|
|
189
|
+
export type UpdateStorageConfigRequest = z.infer<typeof updateStorageConfigRequestSchema>;
|
|
190
|
+
export type GetStorageConfigResponse = z.infer<typeof getStorageConfigResponseSchema>;
|
|
166
191
|
//# sourceMappingURL=storage-api.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-api.schema.d.ts","sourceRoot":"","sources":["../src/storage-api.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,yBAAyB;;;;;;;;;EAGpC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;EAEpC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOpC,CAAC;AAGH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;EAItC,CAAC;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+1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { storageFileSchema } from './storage.schema';
|
|
2
|
+
import { storageConfigSchema, storageFileSchema } from './storage.schema.js';
|
|
3
3
|
export const createBucketRequestSchema = z.object({
|
|
4
4
|
bucketName: z.string().min(1, 'Bucket name cannot be empty'),
|
|
5
5
|
isPublic: z.boolean().default(true),
|
|
@@ -46,4 +46,12 @@ export const confirmUploadRequestSchema = z.object({
|
|
|
46
46
|
contentType: z.string().optional(),
|
|
47
47
|
etag: z.string().optional(),
|
|
48
48
|
});
|
|
49
|
+
export const updateStorageConfigRequestSchema = z.object({
|
|
50
|
+
maxFileSizeMb: z
|
|
51
|
+
.number()
|
|
52
|
+
.int()
|
|
53
|
+
.min(1, 'Must be at least 1 MB')
|
|
54
|
+
.max(200, 'Must be at most 200 MB'),
|
|
55
|
+
});
|
|
56
|
+
export const getStorageConfigResponseSchema = storageConfigSchema;
|
|
49
57
|
//# sourceMappingURL=storage-api.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-api.schema.js","sourceRoot":"","sources":["../src/storage-api.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"storage-api.schema.js","sourceRoot":"","sources":["../src/storage-api.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7E,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,6BAA6B,CAAC;IAC5D,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAA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>;
|
|
37
|
+
export declare const storageConfigSchema: z.ZodObject<{
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
maxFileSizeMb: z.ZodNumber;
|
|
40
|
+
createdAt: z.ZodString;
|
|
41
|
+
updatedAt: z.ZodString;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
id: string;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
updatedAt: string;
|
|
46
|
+
maxFileSizeMb: number;
|
|
47
|
+
}, {
|
|
48
|
+
id: string;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
maxFileSizeMb: number;
|
|
52
|
+
}>;
|
|
37
53
|
export type StorageFileSchema = z.infer<typeof storageFileSchema>;
|
|
38
54
|
export type StorageBucketSchema = z.infer<typeof storageBucketSchema>;
|
|
55
|
+
export type StorageConfigSchema = z.infer<typeof storageConfigSchema>;
|
|
39
56
|
//# sourceMappingURL=storage.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.schema.d.ts","sourceRoot":"","sources":["../src/storage.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"storage.schema.d.ts","sourceRoot":"","sources":["../src/storage.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -12,4 +12,10 @@ export const storageBucketSchema = z.object({
|
|
|
12
12
|
public: z.boolean(),
|
|
13
13
|
createdAt: z.string(),
|
|
14
14
|
});
|
|
15
|
+
export const storageConfigSchema = z.object({
|
|
16
|
+
id: z.string().uuid(),
|
|
17
|
+
maxFileSizeMb: z.number().int().positive(),
|
|
18
|
+
createdAt: z.string(),
|
|
19
|
+
updatedAt: z.string(),
|
|
20
|
+
});
|
|
15
21
|
//# sourceMappingURL=storage.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.schema.js","sourceRoot":"","sources":["../src/storage.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"storage.schema.js","sourceRoot":"","sources":["../src/storage.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACrB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC1C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@insforge/shared-schemas",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.47",
|
|
4
4
|
"author": "Insforge",
|
|
5
5
|
"description": "Shared TypeScript schemas for InsForge frontend and backend",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "tsc",
|
|
22
22
|
"typecheck": "tsc --noEmit",
|
|
23
|
+
"prepare": "npm run build",
|
|
23
24
|
"prepublishOnly": "npm run build"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibeusage",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Codex CLI token usage tracker (macOS-first, notify-driven).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"validate:ui-hardcode": "node scripts/ops/validate-ui-hardcode.cjs"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@insforge/sdk": "
|
|
44
|
+
"@insforge/sdk": "1.2.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@sourcegraph/scip-typescript": "^0.3.6",
|
package/src/commands/status.js
CHANGED
|
@@ -28,6 +28,9 @@ async function cmdStatus(argv = []) {
|
|
|
28
28
|
const throttlePath = path.join(trackerDir, "sync.throttle");
|
|
29
29
|
const uploadThrottlePath = path.join(trackerDir, "upload.throttle.json");
|
|
30
30
|
const autoRetryPath = path.join(trackerDir, "auto.retry.json");
|
|
31
|
+
const xdgDataHome = process.env.XDG_DATA_HOME || path.join(home, ".local", "share");
|
|
32
|
+
const opencodeHome = process.env.OPENCODE_HOME || path.join(xdgDataHome, "opencode");
|
|
33
|
+
const opencodeDbPath = path.join(opencodeHome, "opencode.db");
|
|
31
34
|
|
|
32
35
|
const config = await readJson(configPath);
|
|
33
36
|
const cursors = await readJson(cursorsPath);
|
|
@@ -79,6 +82,15 @@ async function cmdStatus(argv = []) {
|
|
|
79
82
|
const opencodeProbe = probeByName.get("opencode");
|
|
80
83
|
const openclawSessionProbe = probeByName.get("openclaw-session");
|
|
81
84
|
const openclawLegacyProbe = probeByName.get("openclaw-legacy");
|
|
85
|
+
const opencodeDbPresent = Boolean((await safeStat(opencodeDbPath))?.isFile?.());
|
|
86
|
+
const opencodeSqliteState =
|
|
87
|
+
cursors?.opencodeSqlite && typeof cursors.opencodeSqlite === "object"
|
|
88
|
+
? cursors.opencodeSqlite
|
|
89
|
+
: {};
|
|
90
|
+
const opencodeSqliteReader =
|
|
91
|
+
typeof opencodeSqliteState.lastStatus === "string" && opencodeSqliteState.lastStatus.trim()
|
|
92
|
+
? opencodeSqliteState.lastStatus.trim()
|
|
93
|
+
: "never_checked";
|
|
82
94
|
|
|
83
95
|
process.stdout.write(
|
|
84
96
|
[
|
|
@@ -100,6 +112,8 @@ async function cmdStatus(argv = []) {
|
|
|
100
112
|
`- Claude hooks: ${renderIntegrationStatus(descriptors.get("claude"), claudeProbe)}`,
|
|
101
113
|
`- Gemini hooks: ${renderIntegrationStatus(descriptors.get("gemini"), geminiProbe)}`,
|
|
102
114
|
`- Opencode plugin: ${renderIntegrationStatus(descriptors.get("opencode"), opencodeProbe)}`,
|
|
115
|
+
`- OpenCode SQLite DB: ${opencodeDbPresent ? "present" : "missing"}`,
|
|
116
|
+
`- OpenCode SQLite reader: ${opencodeSqliteReader}`,
|
|
103
117
|
`- OpenClaw session plugin: ${renderIntegrationStatus(
|
|
104
118
|
descriptors.get("openclaw-session"),
|
|
105
119
|
openclawSessionProbe,
|
|
@@ -181,6 +195,14 @@ async function safeStatSize(p) {
|
|
|
181
195
|
}
|
|
182
196
|
}
|
|
183
197
|
|
|
198
|
+
async function safeStat(p) {
|
|
199
|
+
try {
|
|
200
|
+
return await fs.stat(p);
|
|
201
|
+
} catch (_e) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
184
206
|
async function safeReadText(p) {
|
|
185
207
|
try {
|
|
186
208
|
return await fs.readFile(p, "utf8");
|
package/src/commands/sync.js
CHANGED
|
@@ -68,6 +68,7 @@ async function cmdSync(argv) {
|
|
|
68
68
|
const xdgDataHome = process.env.XDG_DATA_HOME || path.join(home, ".local", "share");
|
|
69
69
|
const opencodeHome = process.env.OPENCODE_HOME || path.join(xdgDataHome, "opencode");
|
|
70
70
|
const opencodeStorageDir = path.join(opencodeHome, "storage");
|
|
71
|
+
const opencodeDbPath = path.join(opencodeHome, "opencode.db");
|
|
71
72
|
|
|
72
73
|
// OpenClaw session-plugin integration: allow a plugin-triggered sync to request incremental parsing
|
|
73
74
|
// for a single session jsonl. We still parse all regular sources so model/source attribution stays
|
|
@@ -195,29 +196,28 @@ async function cmdSync(argv) {
|
|
|
195
196
|
|
|
196
197
|
const opencodeFiles = await listOpencodeMessageFiles(opencodeStorageDir);
|
|
197
198
|
let opencodeResult = { filesProcessed: 0, eventsAggregated: 0, bucketsQueued: 0 };
|
|
198
|
-
if (opencodeFiles.length > 0) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
opencodeResult = await parseOpencodeIncremental({
|
|
205
|
-
messageFiles: opencodeFiles,
|
|
206
|
-
cursors,
|
|
207
|
-
queuePath,
|
|
208
|
-
projectQueuePath,
|
|
209
|
-
onProgress: (p) => {
|
|
210
|
-
if (!progress?.enabled) return;
|
|
211
|
-
const pct = p.total > 0 ? p.index / p.total : 1;
|
|
212
|
-
progress.update(
|
|
213
|
-
`Parsing Opencode ${renderBar(pct)} ${formatNumber(p.index)}/${formatNumber(
|
|
214
|
-
p.total,
|
|
215
|
-
)} files | buckets ${formatNumber(p.bucketsQueued)}`,
|
|
216
|
-
);
|
|
217
|
-
},
|
|
218
|
-
source: "opencode",
|
|
219
|
-
});
|
|
199
|
+
if (progress?.enabled && opencodeFiles.length > 0) {
|
|
200
|
+
progress.start(
|
|
201
|
+
`Parsing Opencode ${renderBar(0)} 0/${formatNumber(opencodeFiles.length)} files | buckets 0`,
|
|
202
|
+
);
|
|
220
203
|
}
|
|
204
|
+
opencodeResult = await parseOpencodeIncremental({
|
|
205
|
+
messageFiles: opencodeFiles,
|
|
206
|
+
opencodeDbPath,
|
|
207
|
+
cursors,
|
|
208
|
+
queuePath,
|
|
209
|
+
projectQueuePath,
|
|
210
|
+
onProgress: (p) => {
|
|
211
|
+
if (!progress?.enabled) return;
|
|
212
|
+
const pct = p.total > 0 ? p.index / p.total : 1;
|
|
213
|
+
progress.update(
|
|
214
|
+
`Parsing Opencode ${renderBar(pct)} ${formatNumber(p.index)}/${formatNumber(
|
|
215
|
+
p.total,
|
|
216
|
+
)} files | buckets ${formatNumber(p.bucketsQueued)}`,
|
|
217
|
+
);
|
|
218
|
+
},
|
|
219
|
+
source: "opencode",
|
|
220
|
+
});
|
|
221
221
|
|
|
222
222
|
if (cursors?.projectHourly?.projects && projectQueuePath && projectQueueStatePath) {
|
|
223
223
|
for (const [projectKey, meta] of Object.entries(cursors.projectHourly.projects)) {
|
|
@@ -415,6 +415,17 @@ async function cmdSync(argv) {
|
|
|
415
415
|
.filter(Boolean)
|
|
416
416
|
.join("\n"),
|
|
417
417
|
);
|
|
418
|
+
if (
|
|
419
|
+
opencodeResult.sqliteStatus === "missing-sqlite3" ||
|
|
420
|
+
opencodeResult.sqliteStatus === "query-failed"
|
|
421
|
+
) {
|
|
422
|
+
const reason = opencodeResult.sqliteErrorCode
|
|
423
|
+
? `${opencodeResult.sqliteStatus} (${opencodeResult.sqliteErrorCode})`
|
|
424
|
+
: opencodeResult.sqliteStatus;
|
|
425
|
+
process.stderr.write(
|
|
426
|
+
`Warning: OpenCode usage may be incomplete because the SQLite reader is ${reason}. Run \`vibeusage doctor\` for details.\n`,
|
|
427
|
+
);
|
|
428
|
+
}
|
|
418
429
|
}
|
|
419
430
|
} finally {
|
|
420
431
|
progress?.stop();
|
package/src/lib/diagnostics.js
CHANGED
|
@@ -11,6 +11,10 @@ async function collectTrackerDiagnostics({
|
|
|
11
11
|
codexHome = process.env.CODEX_HOME || path.join(home, ".codex"),
|
|
12
12
|
codeHome = process.env.CODE_HOME || path.join(home, ".code"),
|
|
13
13
|
} = {}) {
|
|
14
|
+
const xdgDataHome = process.env.XDG_DATA_HOME || path.join(home, ".local", "share");
|
|
15
|
+
const opencodeHome = process.env.OPENCODE_HOME || path.join(xdgDataHome, "opencode");
|
|
16
|
+
const opencodeStorageDir = path.join(opencodeHome, "storage");
|
|
17
|
+
const opencodeDbPath = path.join(opencodeHome, "opencode.db");
|
|
14
18
|
const integrationContext = await createIntegrationContext({
|
|
15
19
|
home,
|
|
16
20
|
env: {
|
|
@@ -39,6 +43,9 @@ async function collectTrackerDiagnostics({
|
|
|
39
43
|
const autoRetry = await readJson(autoRetryPath);
|
|
40
44
|
const probes = await probeIntegrations(integrationContext);
|
|
41
45
|
const probeByName = new Map(probes.map((probe) => [probe.name, probe]));
|
|
46
|
+
const opencodeSqliteCursor =
|
|
47
|
+
cursors?.opencodeSqlite && typeof cursors.opencodeSqlite === "object" ? cursors.opencodeSqlite : {};
|
|
48
|
+
const opencodeDbStat = await safeStat(opencodeDbPath);
|
|
42
49
|
|
|
43
50
|
const queueSize = await safeStatSize(queuePath);
|
|
44
51
|
const offsetBytes = Number(queueState.offset || 0);
|
|
@@ -106,6 +113,25 @@ async function collectTrackerDiagnostics({
|
|
|
106
113
|
pending_bytes: pendingBytes,
|
|
107
114
|
updated_at: typeof queueState.updatedAt === "string" ? queueState.updatedAt : null,
|
|
108
115
|
},
|
|
116
|
+
opencode: {
|
|
117
|
+
storage_dir: redactValue(opencodeStorageDir, home),
|
|
118
|
+
db_path: redactValue(opencodeDbPath, home),
|
|
119
|
+
sqlite_db_present: Boolean(opencodeDbStat?.isFile?.()),
|
|
120
|
+
sqlite_status:
|
|
121
|
+
typeof opencodeSqliteCursor.lastStatus === "string" && opencodeSqliteCursor.lastStatus.trim()
|
|
122
|
+
? opencodeSqliteCursor.lastStatus.trim()
|
|
123
|
+
: "never_checked",
|
|
124
|
+
sqlite_last_checked_at:
|
|
125
|
+
typeof opencodeSqliteCursor.lastCheckedAt === "string"
|
|
126
|
+
? opencodeSqliteCursor.lastCheckedAt
|
|
127
|
+
: null,
|
|
128
|
+
sqlite_cursor_updated_at:
|
|
129
|
+
typeof opencodeSqliteCursor.updatedAt === "string" ? opencodeSqliteCursor.updatedAt : null,
|
|
130
|
+
sqlite_error_code:
|
|
131
|
+
typeof opencodeSqliteCursor.lastErrorCode === "string"
|
|
132
|
+
? opencodeSqliteCursor.lastErrorCode
|
|
133
|
+
: null,
|
|
134
|
+
},
|
|
109
135
|
notify: {
|
|
110
136
|
last_notify: lastNotify,
|
|
111
137
|
last_openclaw_triggered_sync: lastOpenclawSync,
|
|
@@ -194,6 +220,14 @@ async function safeStatSize(p) {
|
|
|
194
220
|
}
|
|
195
221
|
}
|
|
196
222
|
|
|
223
|
+
async function safeStat(p) {
|
|
224
|
+
try {
|
|
225
|
+
return await fs.stat(p);
|
|
226
|
+
} catch (_e) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
197
231
|
async function safeReadText(p) {
|
|
198
232
|
try {
|
|
199
233
|
return await fs.readFile(p, "utf8");
|
package/src/lib/doctor.js
CHANGED
|
@@ -360,6 +360,29 @@ function buildDiagnosticsChecks(diagnostics) {
|
|
|
360
360
|
meta: { last_error: uploadError ? uploadError.message || null : null },
|
|
361
361
|
});
|
|
362
362
|
|
|
363
|
+
const opencode = diagnostics?.opencode || {};
|
|
364
|
+
const sqliteStatus =
|
|
365
|
+
typeof opencode.sqlite_status === "string" && opencode.sqlite_status.trim()
|
|
366
|
+
? opencode.sqlite_status.trim()
|
|
367
|
+
: "never_checked";
|
|
368
|
+
let opencodeStatus = "warn";
|
|
369
|
+
if (sqliteStatus === "ok") opencodeStatus = "ok";
|
|
370
|
+
else if (sqliteStatus === "missing-sqlite3" || sqliteStatus === "query-failed") {
|
|
371
|
+
opencodeStatus = "fail";
|
|
372
|
+
}
|
|
373
|
+
checks.push({
|
|
374
|
+
id: "opencode.sqlite_support",
|
|
375
|
+
status: opencodeStatus,
|
|
376
|
+
detail: `OpenCode SQLite reader ${sqliteStatus}`,
|
|
377
|
+
critical: false,
|
|
378
|
+
meta: {
|
|
379
|
+
sqlite_status: sqliteStatus,
|
|
380
|
+
sqlite_db_present: Boolean(opencode.sqlite_db_present),
|
|
381
|
+
sqlite_last_checked_at: opencode.sqlite_last_checked_at || null,
|
|
382
|
+
sqlite_error_code: opencode.sqlite_error_code || null,
|
|
383
|
+
},
|
|
384
|
+
});
|
|
385
|
+
|
|
363
386
|
return checks;
|
|
364
387
|
}
|
|
365
388
|
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
let sdkModulePromise = null;
|
|
4
|
+
|
|
5
|
+
async function loadInsforgeSdk() {
|
|
6
|
+
if (!sdkModulePromise) {
|
|
7
|
+
sdkModulePromise = import("@insforge/sdk").catch((err) => {
|
|
8
|
+
sdkModulePromise = null;
|
|
9
|
+
const wrapped = new Error("Missing dependency @insforge/sdk. Please reinstall vibeusage.");
|
|
10
|
+
wrapped.cause = err;
|
|
11
|
+
throw wrapped;
|
|
12
|
+
});
|
|
10
13
|
}
|
|
14
|
+
return sdkModulePromise;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
function getAnonKey({ env = process.env } = {}) {
|
|
@@ -45,9 +49,9 @@ function createTimeoutFetch(baseFetch) {
|
|
|
45
49
|
};
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
function createInsforgeClient({ baseUrl, accessToken } = {}) {
|
|
52
|
+
async function createInsforgeClient({ baseUrl, accessToken } = {}) {
|
|
49
53
|
if (!baseUrl) throw new Error("Missing baseUrl");
|
|
50
|
-
const { createClient } = loadInsforgeSdk();
|
|
54
|
+
const { createClient } = await loadInsforgeSdk();
|
|
51
55
|
const anonKey = getAnonKey();
|
|
52
56
|
return createClient({
|
|
53
57
|
baseUrl,
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const fs = require("node:fs/promises");
|
|
2
|
+
const cp = require("node:child_process");
|
|
3
|
+
const { promisify } = require("node:util");
|
|
4
|
+
|
|
5
|
+
const execFileAsync = promisify(cp.execFile);
|
|
6
|
+
|
|
7
|
+
function buildMessageQuery(lastTimeCreated) {
|
|
8
|
+
const since = Number.isFinite(lastTimeCreated) ? Math.max(0, Math.trunc(lastTimeCreated)) : 0;
|
|
9
|
+
return [
|
|
10
|
+
"SELECT json_object(",
|
|
11
|
+
"'id', m.id,",
|
|
12
|
+
"'session_id', m.session_id,",
|
|
13
|
+
"'time_created', m.time_created,",
|
|
14
|
+
"'role', json_extract(m.data, '$.role'),",
|
|
15
|
+
"'project_worktree', p.worktree,",
|
|
16
|
+
"'data', m.data",
|
|
17
|
+
")",
|
|
18
|
+
"FROM message m",
|
|
19
|
+
"LEFT JOIN session s ON s.id = m.session_id",
|
|
20
|
+
"LEFT JOIN project p ON p.id = s.project_id",
|
|
21
|
+
`WHERE m.time_created >= ${since}`,
|
|
22
|
+
"ORDER BY m.time_created ASC;",
|
|
23
|
+
].join(" ");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function parseMessageRows(stdout) {
|
|
27
|
+
const lines = String(stdout || "")
|
|
28
|
+
.split(/\r?\n/)
|
|
29
|
+
.map((line) => line.trim())
|
|
30
|
+
.filter(Boolean);
|
|
31
|
+
|
|
32
|
+
const rows = [];
|
|
33
|
+
for (const line of lines) {
|
|
34
|
+
try {
|
|
35
|
+
const parsed = JSON.parse(line);
|
|
36
|
+
if (!parsed || typeof parsed !== "object") continue;
|
|
37
|
+
rows.push(parsed);
|
|
38
|
+
} catch (_) {}
|
|
39
|
+
}
|
|
40
|
+
return rows;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function normalizeErrorCode(error) {
|
|
44
|
+
return typeof error?.code === "string" && error.code.trim() ? error.code.trim() : null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function readOpencodeSqliteRows({
|
|
48
|
+
dbPath,
|
|
49
|
+
lastTimeCreated = 0,
|
|
50
|
+
expectedInode = 0,
|
|
51
|
+
statFn = fs.stat,
|
|
52
|
+
execFileFn = execFileAsync,
|
|
53
|
+
}) {
|
|
54
|
+
const checkedAt = new Date().toISOString();
|
|
55
|
+
const st = await statFn(dbPath).catch(() => null);
|
|
56
|
+
if (!st || !st.isFile()) {
|
|
57
|
+
return {
|
|
58
|
+
status: "missing-db",
|
|
59
|
+
checkedAt,
|
|
60
|
+
rows: [],
|
|
61
|
+
inode: 0,
|
|
62
|
+
cursorReset: false,
|
|
63
|
+
errorCode: null,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
const inode = Number.isFinite(st.ino) ? st.ino : 0;
|
|
69
|
+
const effectiveLastTimeCreated =
|
|
70
|
+
expectedInode && inode && expectedInode !== inode ? 0 : lastTimeCreated;
|
|
71
|
+
const { stdout } = await execFileFn(
|
|
72
|
+
"sqlite3",
|
|
73
|
+
["-readonly", dbPath, buildMessageQuery(effectiveLastTimeCreated)],
|
|
74
|
+
{ maxBuffer: 64 * 1024 * 1024 },
|
|
75
|
+
);
|
|
76
|
+
return {
|
|
77
|
+
status: "ok",
|
|
78
|
+
checkedAt,
|
|
79
|
+
rows: parseMessageRows(stdout),
|
|
80
|
+
inode,
|
|
81
|
+
cursorReset: Boolean(expectedInode && inode && expectedInode !== inode),
|
|
82
|
+
errorCode: null,
|
|
83
|
+
};
|
|
84
|
+
} catch (error) {
|
|
85
|
+
const errorCode = normalizeErrorCode(error);
|
|
86
|
+
if (error && error.code === "ENOENT") {
|
|
87
|
+
return {
|
|
88
|
+
status: "missing-sqlite3",
|
|
89
|
+
checkedAt,
|
|
90
|
+
rows: [],
|
|
91
|
+
inode: Number.isFinite(st.ino) ? st.ino : 0,
|
|
92
|
+
cursorReset: false,
|
|
93
|
+
error,
|
|
94
|
+
errorCode,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
status: "query-failed",
|
|
99
|
+
checkedAt,
|
|
100
|
+
rows: [],
|
|
101
|
+
inode: Number.isFinite(st.ino) ? st.ino : 0,
|
|
102
|
+
cursorReset: false,
|
|
103
|
+
error,
|
|
104
|
+
errorCode,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
module.exports = {
|
|
110
|
+
buildMessageQuery,
|
|
111
|
+
parseMessageRows,
|
|
112
|
+
readOpencodeSqliteRows,
|
|
113
|
+
};
|
|
@@ -32,13 +32,14 @@ function addTotals(target, delta) {
|
|
|
32
32
|
|
|
33
33
|
async function buildLocalHourlyTotals({ storageDir, source = "opencode" }) {
|
|
34
34
|
const messageFiles = await listOpencodeMessageFiles(storageDir);
|
|
35
|
+
const opencodeDbPath = path.resolve(storageDir, "..", "opencode.db");
|
|
35
36
|
const queuePath = path.join(
|
|
36
37
|
os.tmpdir(),
|
|
37
38
|
`vibeusage-opencode-audit-${process.pid}-${Date.now()}.jsonl`,
|
|
38
39
|
);
|
|
39
|
-
const cursors = { version: 1, files: {}, hourly: null, opencode: null };
|
|
40
|
+
const cursors = { version: 1, files: {}, hourly: null, opencode: null, opencodeSqlite: null };
|
|
40
41
|
|
|
41
|
-
await parseOpencodeIncremental({ messageFiles, cursors, queuePath, source });
|
|
42
|
+
await parseOpencodeIncremental({ messageFiles, opencodeDbPath, cursors, queuePath, source });
|
|
42
43
|
await fs.rm(queuePath, { force: true }).catch(() => {});
|
|
43
44
|
|
|
44
45
|
const byHour = new Map();
|