@withone/cli 1.47.11 → 1.48.0
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/dist/{chunk-VW7J2RQW.js → chunk-2TWFL3CS.js} +2 -2
- package/dist/{chunk-OADHUAEU.js → chunk-BHAEEALR.js} +2 -2
- package/dist/{chunk-TXTRXV74.js → chunk-BV2NYIA7.js} +1 -1
- package/dist/{chunk-QV3Y5N5G.js → chunk-H2PP5XEQ.js} +2 -2
- package/dist/{chunk-HS5AHQ4V.js → chunk-M326Y5X6.js} +2 -2
- package/dist/{chunk-PLMFRFTT.js → chunk-QE6Z676D.js} +2 -2
- package/dist/{chunk-K6MWE2ZH.js → chunk-SO323PZP.js} +20 -8
- package/dist/{embedding-NVFDR5PK.js → embedding-K2CFCLXI.js} +2 -2
- package/dist/{flow-runner-KBTX5XYX.js → flow-runner-IBB42ED2.js} +2 -2
- package/dist/index.js +52 -29
- package/dist/{migrate-UDEANXEZ.js → migrate-CO4LQVY6.js} +5 -5
- package/dist/{runtime-B5GCQ34P.js → runtime-V4PXJJUV.js} +3 -3
- package/dist/{schema-DXHEU47V.js → schema-UC4LBV5V.js} +4 -4
- package/dist/sql-CBZQHP4R.js +12 -0
- package/package.json +1 -1
- package/dist/sql-W3ZUOUNR.js +0 -12
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-44CV5IMX.js";
|
|
5
5
|
import {
|
|
6
6
|
getCacheTtl
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SO323PZP.js";
|
|
8
8
|
|
|
9
9
|
// src/lib/flow-runner.ts
|
|
10
10
|
import fs3 from "fs";
|
|
@@ -2319,7 +2319,7 @@ async function executeSubflowStep(step, context, api, permissions, allowedAction
|
|
|
2319
2319
|
if (flowStack.includes(resolvedKey)) {
|
|
2320
2320
|
throw new Error(`Circular flow detected: ${[...flowStack, resolvedKey].join(" \u2192 ")}`);
|
|
2321
2321
|
}
|
|
2322
|
-
const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-
|
|
2322
|
+
const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-IBB42ED2.js");
|
|
2323
2323
|
const { flow: subFlow, rootDir: subRootDir } = loadFlowWithMeta2(resolvedKey);
|
|
2324
2324
|
const subContext = await executeFlow(
|
|
2325
2325
|
subFlow,
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
getMemoryConfig,
|
|
6
6
|
getMemoryConfigOrDefault,
|
|
7
7
|
updateMemoryConfig
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BV2NYIA7.js";
|
|
9
9
|
import {
|
|
10
10
|
getOpenAiApiKey
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SO323PZP.js";
|
|
12
12
|
|
|
13
13
|
// src/lib/memory/schema.ts
|
|
14
14
|
var SCHEMA_VERSION = "2.1.0";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
isAgentMode,
|
|
4
4
|
json,
|
|
5
5
|
requireMemoryInit
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-M326Y5X6.js";
|
|
7
7
|
import {
|
|
8
8
|
getBackend
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BHAEEALR.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/mem/sql.ts
|
|
12
12
|
async function memSqlCommand(sql) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getMemoryConfigOrDefault
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BV2NYIA7.js";
|
|
4
4
|
import {
|
|
5
5
|
getOpenAiApiKey,
|
|
6
6
|
readConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SO323PZP.js";
|
|
8
8
|
|
|
9
9
|
// src/lib/output.ts
|
|
10
10
|
import * as p from "@clack/prompts";
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
note,
|
|
7
7
|
okJson,
|
|
8
8
|
requireMemoryInit
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-M326Y5X6.js";
|
|
10
10
|
import {
|
|
11
11
|
getBackend,
|
|
12
12
|
upsertRecord
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BHAEEALR.js";
|
|
14
14
|
|
|
15
15
|
// src/commands/mem/migrate.ts
|
|
16
16
|
import fs4 from "fs";
|
|
@@ -318,13 +318,6 @@ function appendUsageLog(line) {
|
|
|
318
318
|
} catch {
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
function readUsageLog() {
|
|
322
|
-
try {
|
|
323
|
-
return fs.readFileSync(usageLogFile(), "utf-8").split("\n").filter(Boolean).slice(-USAGE_LOG_MAX);
|
|
324
|
-
} catch {
|
|
325
|
-
return [];
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
321
|
function writeUsageLog(lines) {
|
|
329
322
|
try {
|
|
330
323
|
if (lines.length === 0) {
|
|
@@ -337,6 +330,25 @@ function writeUsageLog(lines) {
|
|
|
337
330
|
} catch {
|
|
338
331
|
}
|
|
339
332
|
}
|
|
333
|
+
function claimUsageLog() {
|
|
334
|
+
const src = usageLogFile();
|
|
335
|
+
const tmp = `${src}.claim.${process.pid}.${randomUUID()}`;
|
|
336
|
+
try {
|
|
337
|
+
fs.renameSync(src, tmp);
|
|
338
|
+
} catch {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
try {
|
|
342
|
+
return fs.readFileSync(tmp, "utf-8").split("\n").filter(Boolean).slice(-USAGE_LOG_MAX);
|
|
343
|
+
} catch {
|
|
344
|
+
return [];
|
|
345
|
+
} finally {
|
|
346
|
+
try {
|
|
347
|
+
fs.rmSync(tmp, { force: true });
|
|
348
|
+
} catch {
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
340
352
|
function readUsageState() {
|
|
341
353
|
try {
|
|
342
354
|
return JSON.parse(fs.readFileSync(usageStateFile(), "utf-8"));
|
|
@@ -384,8 +396,8 @@ export {
|
|
|
384
396
|
readAnalyticsQueue,
|
|
385
397
|
writeAnalyticsQueue,
|
|
386
398
|
appendUsageLog,
|
|
387
|
-
readUsageLog,
|
|
388
399
|
writeUsageLog,
|
|
400
|
+
claimUsageLog,
|
|
389
401
|
readUsageState,
|
|
390
402
|
writeUsageState
|
|
391
403
|
};
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
stripStepsAlias,
|
|
13
13
|
summarizeFlowInputs,
|
|
14
14
|
walkSteps
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2TWFL3CS.js";
|
|
16
16
|
import "./chunk-44CV5IMX.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-SO323PZP.js";
|
|
18
18
|
export {
|
|
19
19
|
FlowRunner,
|
|
20
20
|
collectStepTypes,
|
package/dist/index.js
CHANGED
|
@@ -31,10 +31,10 @@ import {
|
|
|
31
31
|
validateActionInput,
|
|
32
32
|
walkSteps,
|
|
33
33
|
writeCache
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-2TWFL3CS.js";
|
|
35
35
|
import {
|
|
36
36
|
memSqlCommand
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-H2PP5XEQ.js";
|
|
38
38
|
import {
|
|
39
39
|
countRecords,
|
|
40
40
|
deleteDatabase,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
upsertRecords,
|
|
60
60
|
writeDraftProfile,
|
|
61
61
|
writeProfile
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-QE6Z676D.js";
|
|
63
63
|
import {
|
|
64
64
|
getByDotPath
|
|
65
65
|
} from "./chunk-44CV5IMX.js";
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
semanticSearchUpgradeLine,
|
|
84
84
|
setAgentMode,
|
|
85
85
|
silenceWarningsInAgentMode
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-M326Y5X6.js";
|
|
87
87
|
import {
|
|
88
88
|
SCHEMA_VERSION,
|
|
89
89
|
addRecord,
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
listBackendPlugins,
|
|
94
94
|
loadBackendFromConfig,
|
|
95
95
|
upsertRecord
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-BHAEEALR.js";
|
|
97
97
|
import {
|
|
98
98
|
DEFAULT_MEMORY_CONFIG,
|
|
99
99
|
defaultSearchableText,
|
|
@@ -103,10 +103,11 @@ import {
|
|
|
103
103
|
memoryConfigExists,
|
|
104
104
|
setOpenAiApiKey,
|
|
105
105
|
updateMemoryConfig
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-BV2NYIA7.js";
|
|
107
107
|
import {
|
|
108
108
|
appendAnalyticsQueue,
|
|
109
109
|
appendUsageLog,
|
|
110
|
+
claimUsageLog,
|
|
110
111
|
configExists,
|
|
111
112
|
ensureWhoAmI,
|
|
112
113
|
getAccessControl,
|
|
@@ -127,7 +128,6 @@ import {
|
|
|
127
128
|
readConfig,
|
|
128
129
|
readGlobalConfig,
|
|
129
130
|
readProjectConfig,
|
|
130
|
-
readUsageLog,
|
|
131
131
|
readUsageState,
|
|
132
132
|
resolveConfig,
|
|
133
133
|
telemetryNoticeShown,
|
|
@@ -138,7 +138,7 @@ import {
|
|
|
138
138
|
writeConfig,
|
|
139
139
|
writeUsageLog,
|
|
140
140
|
writeUsageState
|
|
141
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-SO323PZP.js";
|
|
142
142
|
|
|
143
143
|
// src/cli.ts
|
|
144
144
|
import { createRequire as createRequire3 } from "module";
|
|
@@ -6062,7 +6062,7 @@ async function syncModel(api, profile, options) {
|
|
|
6062
6062
|
updateModelState(platform, model, { status: "failed", pagesProcessed, lastCursor }),
|
|
6063
6063
|
(async () => {
|
|
6064
6064
|
try {
|
|
6065
|
-
const { getBackend: getBackend2 } = await import("./runtime-
|
|
6065
|
+
const { getBackend: getBackend2 } = await import("./runtime-V4PXJJUV.js");
|
|
6066
6066
|
const backend = await getBackend2();
|
|
6067
6067
|
await Promise.race([
|
|
6068
6068
|
backend.close(),
|
|
@@ -6417,7 +6417,7 @@ async function syncModel(api, profile, options) {
|
|
|
6417
6417
|
db.exec(`DROP TABLE IF EXISTS _seen_ids`);
|
|
6418
6418
|
}
|
|
6419
6419
|
if (options.toMemory !== false) {
|
|
6420
|
-
const backend = await (await import("./runtime-
|
|
6420
|
+
const backend = await (await import("./runtime-V4PXJJUV.js")).getBackend();
|
|
6421
6421
|
const type = `${platform}/${model}`;
|
|
6422
6422
|
const existing = await backend.listKeysByType(type);
|
|
6423
6423
|
const sourcePrefix = `${type}:`;
|
|
@@ -6497,7 +6497,7 @@ async function syncModel(api, profile, options) {
|
|
|
6497
6497
|
let statusCounts;
|
|
6498
6498
|
if (options.toMemory !== false) {
|
|
6499
6499
|
try {
|
|
6500
|
-
const backend = await (await import("./runtime-
|
|
6500
|
+
const backend = await (await import("./runtime-V4PXJJUV.js")).getBackend();
|
|
6501
6501
|
const typeName = `${platform}/${model}`;
|
|
6502
6502
|
const [active, archived] = await Promise.all([
|
|
6503
6503
|
backend.count(typeName, { status: "active" }),
|
|
@@ -8130,7 +8130,7 @@ ${result.total} results`);
|
|
|
8130
8130
|
}
|
|
8131
8131
|
}
|
|
8132
8132
|
async function syncSqlCommand(platformModel, sql) {
|
|
8133
|
-
const { syncSqlCommand: runSyncSql } = await import("./sql-
|
|
8133
|
+
const { syncSqlCommand: runSyncSql } = await import("./sql-CBZQHP4R.js");
|
|
8134
8134
|
await runSyncSql(platformModel, sql);
|
|
8135
8135
|
}
|
|
8136
8136
|
async function syncDeleteCommand(platformModel, options) {
|
|
@@ -8208,7 +8208,7 @@ async function syncDeleteCommand(platformModel, options) {
|
|
|
8208
8208
|
async function maybeAutoMigrateLegacy(platform, models) {
|
|
8209
8209
|
const dbSize = getDatabaseSize(platform);
|
|
8210
8210
|
if (!dbSize || dbSize === "0 B") return;
|
|
8211
|
-
const { getBackend: getBackend2 } = await import("./runtime-
|
|
8211
|
+
const { getBackend: getBackend2 } = await import("./runtime-V4PXJJUV.js");
|
|
8212
8212
|
const backend = await getBackend2();
|
|
8213
8213
|
let memoryHasData = false;
|
|
8214
8214
|
for (const model of models) {
|
|
@@ -8224,7 +8224,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
|
|
|
8224
8224
|
` detected legacy .one/sync/data/${platform}.db (${dbSize}) \u2014 auto-migrating into memory before sync.
|
|
8225
8225
|
`
|
|
8226
8226
|
);
|
|
8227
|
-
const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-
|
|
8227
|
+
const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-CO4LQVY6.js");
|
|
8228
8228
|
await memMigrateCommand3({ platform, yes: true });
|
|
8229
8229
|
return;
|
|
8230
8230
|
}
|
|
@@ -8233,7 +8233,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
|
|
|
8233
8233
|
initialValue: true
|
|
8234
8234
|
});
|
|
8235
8235
|
if (p7.isCancel(shouldMigrate) || !shouldMigrate) return;
|
|
8236
|
-
const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-
|
|
8236
|
+
const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-CO4LQVY6.js");
|
|
8237
8237
|
await memMigrateCommand2({ platform, yes: true });
|
|
8238
8238
|
}
|
|
8239
8239
|
async function syncSuggestSearchableCommand(platformModel, options = {}) {
|
|
@@ -8294,7 +8294,7 @@ async function syncSuggestSearchableCommand(platformModel, options = {}) {
|
|
|
8294
8294
|
async function syncListCommand(platform) {
|
|
8295
8295
|
const profiles = listProfiles(platform);
|
|
8296
8296
|
const state = await readSyncState();
|
|
8297
|
-
const { getBackend: getBackend2 } = await import("./runtime-
|
|
8297
|
+
const { getBackend: getBackend2 } = await import("./runtime-V4PXJJUV.js");
|
|
8298
8298
|
const backend = await getBackend2();
|
|
8299
8299
|
const syncs = await Promise.all(profiles.map(async (p10) => {
|
|
8300
8300
|
const modelState = state[p10.platform]?.[p10.model];
|
|
@@ -8569,7 +8569,7 @@ function registerSyncSubcommands(sync) {
|
|
|
8569
8569
|
await syncSqlCommand(platformModel, sql);
|
|
8570
8570
|
});
|
|
8571
8571
|
sync.command("schema <platform/model>").description("Inspect the JSON structure of synced records (field paths, types, examples) \u2014 useful before writing `sync sql` queries").action(async (platformModel) => {
|
|
8572
|
-
const { syncSchemaCommand } = await import("./schema-
|
|
8572
|
+
const { syncSchemaCommand } = await import("./schema-UC4LBV5V.js");
|
|
8573
8573
|
await syncSchemaCommand(platformModel);
|
|
8574
8574
|
});
|
|
8575
8575
|
sync.command("delete <platform/model>").description('Delete records from local sync data (e.g. one sync delete notion/pages --id "abc-123")').option("--id <value>", "Delete record by ID").option("--where <conditions>", 'Delete records matching conditions (e.g. "status=archived")').option("--where-sql <predicate>", `Delete using a raw SQL WHERE clause (e.g. "json_extract(data, '$.type') = 'promotion'")`).option("--yes", "Skip confirmation prompt").action(async (platformModel, options) => {
|
|
@@ -9216,7 +9216,7 @@ async function memDoctorCommand() {
|
|
|
9216
9216
|
}
|
|
9217
9217
|
if (cfg.embedding.provider === "openai") {
|
|
9218
9218
|
try {
|
|
9219
|
-
const { embed: embed2 } = await import("./embedding-
|
|
9219
|
+
const { embed: embed2 } = await import("./embedding-K2CFCLXI.js");
|
|
9220
9220
|
const result = await embed2("connectivity check");
|
|
9221
9221
|
checks.push({
|
|
9222
9222
|
name: "OpenAI embedding provider reachable",
|
|
@@ -11086,7 +11086,7 @@ async function logoutCommand() {
|
|
|
11086
11086
|
|
|
11087
11087
|
// src/lib/analytics.ts
|
|
11088
11088
|
import { createRequire as createRequire2 } from "module";
|
|
11089
|
-
import { randomUUID } from "crypto";
|
|
11089
|
+
import { randomUUID, createHash } from "crypto";
|
|
11090
11090
|
import pc13 from "picocolors";
|
|
11091
11091
|
var require3 = createRequire2(import.meta.url);
|
|
11092
11092
|
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com";
|
|
@@ -11129,6 +11129,9 @@ function isTelemetryDisabled() {
|
|
|
11129
11129
|
function distinctId() {
|
|
11130
11130
|
return getWhoAmI()?.user?.id ?? getDeviceId();
|
|
11131
11131
|
}
|
|
11132
|
+
function isAuthenticated() {
|
|
11133
|
+
return !!getWhoAmI()?.user || !!getApiKey();
|
|
11134
|
+
}
|
|
11132
11135
|
function baseProperties() {
|
|
11133
11136
|
return {
|
|
11134
11137
|
$lib: "one-cli",
|
|
@@ -11137,7 +11140,8 @@ function baseProperties() {
|
|
|
11137
11140
|
env: envName(),
|
|
11138
11141
|
os: process.platform,
|
|
11139
11142
|
arch: process.arch,
|
|
11140
|
-
node_version: process.versions.node
|
|
11143
|
+
node_version: process.versions.node,
|
|
11144
|
+
authenticated: isAuthenticated()
|
|
11141
11145
|
};
|
|
11142
11146
|
}
|
|
11143
11147
|
function personSet() {
|
|
@@ -11182,7 +11186,8 @@ function capture(event, properties = {}, opts = {}) {
|
|
|
11182
11186
|
return;
|
|
11183
11187
|
}
|
|
11184
11188
|
const did = opts.distinctId ?? distinctId();
|
|
11185
|
-
const props = { ...baseProperties(), ...properties
|
|
11189
|
+
const props = { ...baseProperties(), ...properties };
|
|
11190
|
+
if (props.$insert_id === void 0) props.$insert_id = randomUUID();
|
|
11186
11191
|
if (did === distinctId()) {
|
|
11187
11192
|
const set = personSet();
|
|
11188
11193
|
if (set) props.$set = set;
|
|
@@ -11200,13 +11205,30 @@ var ROLLUP_MAX_BATCH = 500;
|
|
|
11200
11205
|
function utcDay(ts) {
|
|
11201
11206
|
return new Date(ts).toISOString().slice(0, 10);
|
|
11202
11207
|
}
|
|
11208
|
+
var PRE_AUTH_COMMANDS = /* @__PURE__ */ new Set([
|
|
11209
|
+
"init",
|
|
11210
|
+
"login",
|
|
11211
|
+
"logout",
|
|
11212
|
+
"guide",
|
|
11213
|
+
"platforms",
|
|
11214
|
+
"onboard",
|
|
11215
|
+
"config",
|
|
11216
|
+
"update",
|
|
11217
|
+
"help"
|
|
11218
|
+
]);
|
|
11219
|
+
function shouldRecord(commandPath2) {
|
|
11220
|
+
if (isAuthenticated()) return true;
|
|
11221
|
+
return PRE_AUTH_COMMANDS.has(commandPath2.split(" ")[0]);
|
|
11222
|
+
}
|
|
11203
11223
|
function recordCommand(command) {
|
|
11204
11224
|
if (isTelemetryDisabled()) {
|
|
11205
11225
|
writeUsageLog([]);
|
|
11206
11226
|
return;
|
|
11207
11227
|
}
|
|
11228
|
+
const cmdPath = commandPath(command);
|
|
11229
|
+
if (!shouldRecord(cmdPath)) return;
|
|
11208
11230
|
const did = distinctId();
|
|
11209
|
-
const entry = { ts: Date.now(), command:
|
|
11231
|
+
const entry = { ts: Date.now(), command: cmdPath, agent: isAgentMode(), did };
|
|
11210
11232
|
appendUsageLog(JSON.stringify(entry));
|
|
11211
11233
|
const today = utcDay(entry.ts);
|
|
11212
11234
|
const state = readUsageState();
|
|
@@ -11219,8 +11241,10 @@ function flushUsageRollups(opts = {}) {
|
|
|
11219
11241
|
writeUsageLog([]);
|
|
11220
11242
|
return;
|
|
11221
11243
|
}
|
|
11244
|
+
const lines = claimUsageLog();
|
|
11245
|
+
if (!lines || lines.length === 0) return;
|
|
11222
11246
|
const entries = [];
|
|
11223
|
-
for (const line of
|
|
11247
|
+
for (const line of lines) {
|
|
11224
11248
|
try {
|
|
11225
11249
|
const e = JSON.parse(line);
|
|
11226
11250
|
if (e && typeof e.ts === "number" && typeof e.command === "string" && typeof e.did === "string") {
|
|
@@ -11229,10 +11253,7 @@ function flushUsageRollups(opts = {}) {
|
|
|
11229
11253
|
} catch {
|
|
11230
11254
|
}
|
|
11231
11255
|
}
|
|
11232
|
-
if (entries.length === 0)
|
|
11233
|
-
writeUsageLog([]);
|
|
11234
|
-
return;
|
|
11235
|
-
}
|
|
11256
|
+
if (entries.length === 0) return;
|
|
11236
11257
|
const currentDid = entries[entries.length - 1].did;
|
|
11237
11258
|
const now = Date.now();
|
|
11238
11259
|
const groups = /* @__PURE__ */ new Map();
|
|
@@ -11248,7 +11269,7 @@ function flushUsageRollups(opts = {}) {
|
|
|
11248
11269
|
if (due) emitRollup(did, group);
|
|
11249
11270
|
else kept.push(...group);
|
|
11250
11271
|
}
|
|
11251
|
-
|
|
11272
|
+
for (const e of kept) appendUsageLog(JSON.stringify(e));
|
|
11252
11273
|
}
|
|
11253
11274
|
function emitRollup(did, group) {
|
|
11254
11275
|
const byCommand = {};
|
|
@@ -11257,6 +11278,7 @@ function emitRollup(did, group) {
|
|
|
11257
11278
|
byCommand[e.command] = (byCommand[e.command] ?? 0) + 1;
|
|
11258
11279
|
if (e.agent) agentCount += 1;
|
|
11259
11280
|
}
|
|
11281
|
+
const insertId = createHash("sha1").update(`${did}|${group.map((e) => `${e.ts}:${e.command}:${e.agent ? 1 : 0}`).join("|")}`).digest("hex");
|
|
11260
11282
|
capture(
|
|
11261
11283
|
"CLI Usage Rollup",
|
|
11262
11284
|
{
|
|
@@ -11265,7 +11287,8 @@ function emitRollup(did, group) {
|
|
|
11265
11287
|
agent_count: agentCount,
|
|
11266
11288
|
human_count: group.length - agentCount,
|
|
11267
11289
|
window_start: new Date(group[0].ts).toISOString(),
|
|
11268
|
-
window_end: new Date(group[group.length - 1].ts).toISOString()
|
|
11290
|
+
window_end: new Date(group[group.length - 1].ts).toISOString(),
|
|
11291
|
+
$insert_id: insertId
|
|
11269
11292
|
},
|
|
11270
11293
|
{ distinctId: did, timestamp: new Date(group[group.length - 1].ts).toISOString() }
|
|
11271
11294
|
);
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
dotPathToJsonbExpr,
|
|
4
4
|
memMigrateCommand,
|
|
5
5
|
reviveStringifiedJson
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QE6Z676D.js";
|
|
7
7
|
import "./chunk-44CV5IMX.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-M326Y5X6.js";
|
|
9
|
+
import "./chunk-BHAEEALR.js";
|
|
10
|
+
import "./chunk-BV2NYIA7.js";
|
|
11
|
+
import "./chunk-SO323PZP.js";
|
|
12
12
|
export {
|
|
13
13
|
buildIdentityMap,
|
|
14
14
|
dotPathToJsonbExpr,
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
getBackend,
|
|
5
5
|
resetBackendSingleton,
|
|
6
6
|
upsertRecord
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-BHAEEALR.js";
|
|
8
|
+
import "./chunk-BV2NYIA7.js";
|
|
9
|
+
import "./chunk-SO323PZP.js";
|
|
10
10
|
export {
|
|
11
11
|
addRecord,
|
|
12
12
|
closeBackendIfCached,
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
note,
|
|
4
4
|
okJson,
|
|
5
5
|
requireMemoryInit
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-M326Y5X6.js";
|
|
7
7
|
import {
|
|
8
8
|
getBackend
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-BHAEEALR.js";
|
|
10
|
+
import "./chunk-BV2NYIA7.js";
|
|
11
|
+
import "./chunk-SO323PZP.js";
|
|
12
12
|
|
|
13
13
|
// src/lib/memory/sync/schema.ts
|
|
14
14
|
import pc from "picocolors";
|
package/package.json
CHANGED
package/dist/sql-W3ZUOUNR.js
DELETED