@miniaxolotl/grove-server 1.11.23 → 1.11.28
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/bootstrap.js +54 -1
- package/dist/bootstrap.js.map +4 -4
- package/dist/migrate.js +54 -1
- package/dist/migrate.js.map +4 -4
- package/dist/server.js +761 -290
- package/dist/server.js.map +4 -4
- package/dist/telemetry-build.json +1 -1
- package/dist/worker.js +265 -101
- package/dist/worker.js.map +4 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"enabled":true,"revision":"
|
|
1
|
+
{"enabled":true,"revision":"d6b98466a41776dca9beb1ab0d039dc1029d8b79","version":"1.11.28","component":"api"}
|
package/dist/worker.js
CHANGED
|
@@ -18,7 +18,7 @@ var __export = (target2, all2) => {
|
|
|
18
18
|
var define_GROVE_TELEMETRY_default;
|
|
19
19
|
var init_define_GROVE_TELEMETRY = __esm({
|
|
20
20
|
"<define:__GROVE_TELEMETRY__>"() {
|
|
21
|
-
define_GROVE_TELEMETRY_default = { enabled: true, revision: "
|
|
21
|
+
define_GROVE_TELEMETRY_default = { enabled: true, revision: "d6b98466a41776dca9beb1ab0d039dc1029d8b79", version: "1.11.28", component: "api", key: "phc_AqVrjhk7W2X2pFjyngY7uWxcSSRREfJhgr8mBmKbXYEh", cliDsn: "https://3f6d0711b5890dea4ce8e6ccf2a1a7fd@o4511632209346560.ingest.us.sentry.io/4512290791620608", apiDsn: "https://4524e8910e318110277babdfe818999b@o4511632209346560.ingest.us.sentry.io/4512290791489536" };
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
|
|
@@ -450,7 +450,7 @@ var init_share_durations = __esm({
|
|
|
450
450
|
});
|
|
451
451
|
|
|
452
452
|
// lib/shared/src/sharing.ts
|
|
453
|
-
import { z as
|
|
453
|
+
import { z as z25 } from "zod";
|
|
454
454
|
var shareTokenSchema, shareDurationSchema, shareMutationSchema, shareEnableSchema, shareScopeSchema, publicShareQuerySchema, notebook, publicNoteSchema, publicShareSchema;
|
|
455
455
|
var init_sharing = __esm({
|
|
456
456
|
"lib/shared/src/sharing.ts"() {
|
|
@@ -460,8 +460,8 @@ var init_sharing = __esm({
|
|
|
460
460
|
init_search();
|
|
461
461
|
init_limits();
|
|
462
462
|
init_share_durations();
|
|
463
|
-
shareTokenSchema =
|
|
464
|
-
shareDurationSchema =
|
|
463
|
+
shareTokenSchema = z25.string().regex(/^gsh_[A-Za-z0-9_-]{43}$/);
|
|
464
|
+
shareDurationSchema = z25.enum([
|
|
465
465
|
"1h",
|
|
466
466
|
"4h",
|
|
467
467
|
"1d",
|
|
@@ -469,45 +469,45 @@ var init_sharing = __esm({
|
|
|
469
469
|
"2w",
|
|
470
470
|
"1mo"
|
|
471
471
|
]);
|
|
472
|
-
shareMutationSchema =
|
|
472
|
+
shareMutationSchema = z25.object({
|
|
473
473
|
operationId: operationSchema,
|
|
474
|
-
expectedVersion:
|
|
474
|
+
expectedVersion: z25.number().int().positive()
|
|
475
475
|
}).strict();
|
|
476
476
|
shareEnableSchema = shareMutationSchema.extend({
|
|
477
|
-
expectedVersion:
|
|
478
|
-
expectedTargetVersion:
|
|
479
|
-
includeDescendants:
|
|
477
|
+
expectedVersion: z25.number().int().min(0),
|
|
478
|
+
expectedTargetVersion: z25.number().int().positive(),
|
|
479
|
+
includeDescendants: z25.boolean().default(false),
|
|
480
480
|
duration: shareDurationSchema.nullable().optional()
|
|
481
481
|
});
|
|
482
482
|
shareScopeSchema = shareMutationSchema.extend({
|
|
483
|
-
includeDescendants:
|
|
483
|
+
includeDescendants: z25.boolean().optional(),
|
|
484
484
|
duration: shareDurationSchema.nullable().optional()
|
|
485
485
|
}).refine(
|
|
486
486
|
(value) => value.includeDescendants !== void 0 || value.duration !== void 0,
|
|
487
487
|
"Choose a sharing setting to change"
|
|
488
488
|
);
|
|
489
|
-
publicShareQuerySchema =
|
|
490
|
-
cursor:
|
|
491
|
-
limit:
|
|
489
|
+
publicShareQuerySchema = z25.object({
|
|
490
|
+
cursor: z25.string().max(SHARE_CURSOR_MAX).optional(),
|
|
491
|
+
limit: z25.coerce.number().int().min(1).max(100).default(30)
|
|
492
492
|
}).strict();
|
|
493
|
-
notebook =
|
|
494
|
-
publicNoteSchema =
|
|
493
|
+
notebook = z25.object({ id: uuidSchema, name: z25.string() }).strict();
|
|
494
|
+
publicNoteSchema = z25.object({
|
|
495
495
|
id: uuidSchema,
|
|
496
|
-
title:
|
|
497
|
-
content:
|
|
498
|
-
updatedAt:
|
|
499
|
-
linkedNoteIds:
|
|
496
|
+
title: z25.string(),
|
|
497
|
+
content: z25.string(),
|
|
498
|
+
updatedAt: z25.string(),
|
|
499
|
+
linkedNoteIds: z25.array(uuidSchema)
|
|
500
500
|
}).strict();
|
|
501
|
-
publicShareSchema =
|
|
502
|
-
kind:
|
|
501
|
+
publicShareSchema = z25.object({
|
|
502
|
+
kind: z25.enum(["note", "notebook"]),
|
|
503
503
|
root: notebook,
|
|
504
504
|
notebook: notebook.nullable(),
|
|
505
505
|
note: publicNoteSchema.nullable(),
|
|
506
|
-
notebooks:
|
|
507
|
-
notes:
|
|
506
|
+
notebooks: z25.array(notebook),
|
|
507
|
+
notes: z25.array(
|
|
508
508
|
publicNoteSchema.pick({ id: true, title: true, updatedAt: true })
|
|
509
509
|
),
|
|
510
|
-
nextCursor:
|
|
510
|
+
nextCursor: z25.string().nullable()
|
|
511
511
|
}).strict();
|
|
512
512
|
}
|
|
513
513
|
});
|
|
@@ -2606,6 +2606,32 @@ var dailyNotes = {
|
|
|
2606
2606
|
}
|
|
2607
2607
|
};
|
|
2608
2608
|
|
|
2609
|
+
// lib/database/src/cache-retention-migration.ts
|
|
2610
|
+
init_define_GROVE_TELEMETRY();
|
|
2611
|
+
var cacheRetention = {
|
|
2612
|
+
name: "20261118_043_cache_retention",
|
|
2613
|
+
async up(db) {
|
|
2614
|
+
const { rows } = await db.raw(
|
|
2615
|
+
"SELECT pg_get_functiondef('grove_schedule_cleanup()'::regprocedure) AS definition"
|
|
2616
|
+
);
|
|
2617
|
+
const definition2 = rows[0].definition;
|
|
2618
|
+
const anchor = "OR EXISTS(SELECT 1 FROM rate_buckets r";
|
|
2619
|
+
if (definition2.split(anchor).length !== 2)
|
|
2620
|
+
throw new Error("Unsupported retention scheduler baseline");
|
|
2621
|
+
await db.raw(
|
|
2622
|
+
definition2.replace(
|
|
2623
|
+
anchor,
|
|
2624
|
+
`OR EXISTS(SELECT 1 FROM ai_cache c WHERE c.account_id=a.id AND c.expires_at<=now())
|
|
2625
|
+
OR EXISTS(SELECT 1 FROM ai_provider_backoff b WHERE b.account_id=a.id AND b.retry_at<now()-interval '1 day')
|
|
2626
|
+
${anchor}`
|
|
2627
|
+
)
|
|
2628
|
+
);
|
|
2629
|
+
},
|
|
2630
|
+
async down() {
|
|
2631
|
+
throw new Error("Use a forward migration");
|
|
2632
|
+
}
|
|
2633
|
+
};
|
|
2634
|
+
|
|
2609
2635
|
// lib/database/src/writing-allowance-migration.ts
|
|
2610
2636
|
init_define_GROVE_TELEMETRY();
|
|
2611
2637
|
var writingAllowance = {
|
|
@@ -4834,6 +4860,33 @@ var aiPreferences = {
|
|
|
4834
4860
|
}
|
|
4835
4861
|
};
|
|
4836
4862
|
|
|
4863
|
+
// lib/database/src/proofing-migration.ts
|
|
4864
|
+
init_define_GROVE_TELEMETRY();
|
|
4865
|
+
var proofingConsents = {
|
|
4866
|
+
name: "20261118_044_proofing_consent",
|
|
4867
|
+
async up(db) {
|
|
4868
|
+
await db.raw(`CREATE TABLE proofing_consents (
|
|
4869
|
+
account_id uuid NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,
|
|
4870
|
+
scope text NOT NULL CHECK(scope='grove-note-editor'),
|
|
4871
|
+
version integer NOT NULL CHECK(version>0),
|
|
4872
|
+
generation uuid NOT NULL,
|
|
4873
|
+
automatic boolean NOT NULL,
|
|
4874
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
4875
|
+
revoked_at timestamptz,
|
|
4876
|
+
CHECK(revoked_at IS NULL OR NOT automatic),
|
|
4877
|
+
PRIMARY KEY(account_id,scope)
|
|
4878
|
+
);
|
|
4879
|
+
ALTER TABLE proofing_consents ENABLE ROW LEVEL SECURITY;
|
|
4880
|
+
ALTER TABLE proofing_consents FORCE ROW LEVEL SECURITY;
|
|
4881
|
+
CREATE POLICY tenant ON proofing_consents USING(account_id=nullif(current_setting('grove.account_id',true),'')::uuid);
|
|
4882
|
+
GRANT SELECT, INSERT, UPDATE ON proofing_consents TO grove_runtime;
|
|
4883
|
+
GRANT SELECT, DELETE ON proofing_consents TO grove_worker;`);
|
|
4884
|
+
},
|
|
4885
|
+
async down() {
|
|
4886
|
+
throw new Error("Use a forward migration");
|
|
4887
|
+
}
|
|
4888
|
+
};
|
|
4889
|
+
|
|
4837
4890
|
// lib/database/src/queue-migration.ts
|
|
4838
4891
|
init_define_GROVE_TELEMETRY();
|
|
4839
4892
|
|
|
@@ -6346,7 +6399,9 @@ var migrations = [
|
|
|
6346
6399
|
nativeSharing,
|
|
6347
6400
|
billingTrial,
|
|
6348
6401
|
writingAllowance,
|
|
6349
|
-
dailyNotes
|
|
6402
|
+
dailyNotes,
|
|
6403
|
+
cacheRetention,
|
|
6404
|
+
proofingConsents
|
|
6350
6405
|
];
|
|
6351
6406
|
var migrationSource = {
|
|
6352
6407
|
getMigrations: async () => migrations,
|
|
@@ -6466,6 +6521,12 @@ async function probeDatabase(db) {
|
|
|
6466
6521
|
);
|
|
6467
6522
|
await db.raw("SELECT policy, version FROM writing_consents LIMIT 0");
|
|
6468
6523
|
await db.raw("SELECT connection_id FROM writing_cancellations LIMIT 0");
|
|
6524
|
+
await db.raw(
|
|
6525
|
+
"SELECT account_id, local_date, memory_id FROM daily_notes LIMIT 0"
|
|
6526
|
+
);
|
|
6527
|
+
await db.raw(
|
|
6528
|
+
"SELECT scope, version, generation, automatic, revoked_at FROM proofing_consents LIMIT 0"
|
|
6529
|
+
);
|
|
6469
6530
|
}
|
|
6470
6531
|
var MemoryModel = class extends Model {
|
|
6471
6532
|
static tableName = "memories";
|
|
@@ -21918,14 +21979,16 @@ async function owned2(trx, id2) {
|
|
|
21918
21979
|
return row;
|
|
21919
21980
|
}
|
|
21920
21981
|
async function expireDocumentDrafts(trx) {
|
|
21921
|
-
const
|
|
21982
|
+
const limit = 20;
|
|
21983
|
+
const expired = trx("document_import_batches").select("id").where("expiresAt", "<=", trx.fn.now()).where({ draftsCleared: false }).whereIn("status", ["uploading", "preparing", "ready", "cancelled"]).orderBy("id").limit(limit);
|
|
21922
21984
|
await trx("document_import_files").whereIn("batchId", expired).where({ originalReady: false }).whereNotNull("staging").update({ staging: null });
|
|
21923
21985
|
await trx("document_import_notes").whereIn("batchId", expired).whereNull("memoryId").whereNot("content", "[Expired import draft]").update({
|
|
21924
21986
|
content: "[Expired import draft]",
|
|
21925
21987
|
included: false,
|
|
21926
21988
|
suggestion: null
|
|
21927
21989
|
});
|
|
21928
|
-
await trx("document_import_batches").whereIn("id", expired).update({ draftsCleared: true });
|
|
21990
|
+
const processed = await trx("document_import_batches").whereIn("id", expired).update({ draftsCleared: true });
|
|
21991
|
+
return { processed, fullPage: processed === limit };
|
|
21929
21992
|
}
|
|
21930
21993
|
function documentImportHandlers(service, extract, store) {
|
|
21931
21994
|
const document_prepare = async (task, signal) => {
|
|
@@ -22126,8 +22189,9 @@ var available = (q) => q.whereNull("removedAt").where(
|
|
|
22126
22189
|
(sub) => sub.where("accepted", true).orWhere("expiresAt", ">", q.client.raw("now()"))
|
|
22127
22190
|
);
|
|
22128
22191
|
async function expireConversationDocuments(trx) {
|
|
22129
|
-
const
|
|
22130
|
-
|
|
22192
|
+
const limit = 25;
|
|
22193
|
+
const docs = await trx("conversation_documents").where({ accepted: false }).whereNull("removedAt").where("expiresAt", "<=", trx.fn.now()).orderBy("id").limit(limit).select("id", "conversationId");
|
|
22194
|
+
if (!docs.length) return { processed: 0, fullPage: false };
|
|
22131
22195
|
await trx("conversation_document_chunks").whereIn(
|
|
22132
22196
|
"documentId",
|
|
22133
22197
|
docs.map((d) => d.id)
|
|
@@ -22145,6 +22209,7 @@ async function expireConversationDocuments(trx) {
|
|
|
22145
22209
|
"id",
|
|
22146
22210
|
docs.map((d) => d.conversationId)
|
|
22147
22211
|
).increment("documentsVersion", 1);
|
|
22212
|
+
return { processed: docs.length, fullPage: docs.length === limit };
|
|
22148
22213
|
}
|
|
22149
22214
|
async function documentSnapshot(trx, conversationId, query) {
|
|
22150
22215
|
const chat = await documentChat(trx, conversationId);
|
|
@@ -25503,6 +25568,7 @@ function cleanupHandlers(db, deleteIdentity, cancelBilling) {
|
|
|
25503
25568
|
return rows.length;
|
|
25504
25569
|
};
|
|
25505
25570
|
const count2 = await deleteBatch(table);
|
|
25571
|
+
const proofing = table === "notebook_expiries" ? await deleteBatch("proofing_consents") : 0;
|
|
25506
25572
|
const daily = table === "notebook_expiries" ? await deleteBatch("daily_notes") : 0;
|
|
25507
25573
|
const research = table === "inference_usage" ? await trx("research_account_usage").select("day").limit(batchSize) : [];
|
|
25508
25574
|
if (research.length)
|
|
@@ -25515,7 +25581,7 @@ function cleanupHandlers(db, deleteIdentity, cancelBilling) {
|
|
|
25515
25581
|
cursor: {
|
|
25516
25582
|
stage: count2 === batchSize || daily === batchSize || research.length === batchSize || cache === batchSize ? stage : stage + 1
|
|
25517
25583
|
},
|
|
25518
|
-
processed: Number(task.processed) + count2 + daily + research.length + cache
|
|
25584
|
+
processed: Number(task.processed) + count2 + daily + proofing + research.length + cache
|
|
25519
25585
|
};
|
|
25520
25586
|
});
|
|
25521
25587
|
return;
|
|
@@ -25545,8 +25611,8 @@ function cleanupHandlers(db, deleteIdentity, cancelBilling) {
|
|
|
25545
25611
|
const retention_cleanup = async (task, signal) => {
|
|
25546
25612
|
await taskTransaction(db, task, async (trx) => {
|
|
25547
25613
|
signal.throwIfAborted();
|
|
25548
|
-
await expireDocumentDrafts(trx);
|
|
25549
|
-
await expireConversationDocuments(trx);
|
|
25614
|
+
const drafts = await expireDocumentDrafts(trx);
|
|
25615
|
+
const uploads = await expireConversationDocuments(trx);
|
|
25550
25616
|
const writingExpired = await expireWriting(trx);
|
|
25551
25617
|
const expired = await trx("memories").where("purgeAt", "<=", trx.fn.now()).select("id").orderBy("id").limit(batchSize);
|
|
25552
25618
|
if (expired.length) {
|
|
@@ -25562,8 +25628,8 @@ function cleanupHandlers(db, deleteIdentity, cancelBilling) {
|
|
|
25562
25628
|
await trx("rate_buckets").whereIn("minute", buckets).delete();
|
|
25563
25629
|
const cache = await pruneCache(trx, true);
|
|
25564
25630
|
return {
|
|
25565
|
-
processed: Number(task.processed) + expired.length + cache + writingExpired,
|
|
25566
|
-
complete: expired.length < batchSize && buckets.length < batchSize && writingExpired < batchSize && cache < batchSize
|
|
25631
|
+
processed: Number(task.processed) + expired.length + cache + writingExpired + drafts.processed + uploads.processed,
|
|
25632
|
+
complete: !drafts.fullPage && !uploads.fullPage && expired.length < batchSize && buckets.length < batchSize && writingExpired < batchSize && cache < batchSize
|
|
25567
25633
|
};
|
|
25568
25634
|
});
|
|
25569
25635
|
};
|
|
@@ -25883,6 +25949,104 @@ function speechHandlers(service, providers, store, readSource, db = service.db,
|
|
|
25883
25949
|
return { speech_transcribe: execute2, speech_synthesize: execute2 };
|
|
25884
25950
|
}
|
|
25885
25951
|
|
|
25952
|
+
// lib/memory/src/proofing-consents.ts
|
|
25953
|
+
init_define_GROVE_TELEMETRY();
|
|
25954
|
+
init_contracts();
|
|
25955
|
+
|
|
25956
|
+
// lib/shared/src/proofing-contract.ts
|
|
25957
|
+
init_define_GROVE_TELEMETRY();
|
|
25958
|
+
import { z as z22 } from "zod";
|
|
25959
|
+
|
|
25960
|
+
// lib/shared/src/writing-settings.ts
|
|
25961
|
+
init_define_GROVE_TELEMETRY();
|
|
25962
|
+
import { z as z21 } from "zod";
|
|
25963
|
+
|
|
25964
|
+
// lib/shared/src/writing-markdown.ts
|
|
25965
|
+
init_define_GROVE_TELEMETRY();
|
|
25966
|
+
|
|
25967
|
+
// lib/shared/src/writing-settings.ts
|
|
25968
|
+
var writingRules = [
|
|
25969
|
+
"brackets",
|
|
25970
|
+
"quotes",
|
|
25971
|
+
"articles",
|
|
25972
|
+
"repetition",
|
|
25973
|
+
"spacing",
|
|
25974
|
+
"capitalization",
|
|
25975
|
+
"redundancy",
|
|
25976
|
+
"agreement",
|
|
25977
|
+
"plurals",
|
|
25978
|
+
"confusion"
|
|
25979
|
+
];
|
|
25980
|
+
var personalWordLimit = 1e3;
|
|
25981
|
+
var ruleSchema = z21.object({
|
|
25982
|
+
brackets: z21.boolean().default(true),
|
|
25983
|
+
quotes: z21.boolean().default(true),
|
|
25984
|
+
articles: z21.boolean().default(true),
|
|
25985
|
+
repetition: z21.boolean().default(true),
|
|
25986
|
+
spacing: z21.boolean().default(true),
|
|
25987
|
+
capitalization: z21.boolean().default(true),
|
|
25988
|
+
redundancy: z21.boolean().default(true),
|
|
25989
|
+
agreement: z21.boolean().default(true),
|
|
25990
|
+
plurals: z21.boolean().default(true),
|
|
25991
|
+
confusion: z21.boolean().default(true)
|
|
25992
|
+
}).strict();
|
|
25993
|
+
var writingSettingsSchema = z21.object({
|
|
25994
|
+
language: z21.literal("en").default("en"),
|
|
25995
|
+
enabled: z21.boolean().default(true),
|
|
25996
|
+
spelling: z21.boolean().default(true),
|
|
25997
|
+
grammar: z21.boolean().default(true),
|
|
25998
|
+
aiRewrites: z21.boolean().default(true),
|
|
25999
|
+
automatic: z21.boolean().default(true),
|
|
26000
|
+
highlights: z21.boolean().default(true),
|
|
26001
|
+
rules: ruleSchema.default(() => ruleSchema.parse({})),
|
|
26002
|
+
words: z21.array(
|
|
26003
|
+
z21.string().min(1).max(80).regex(/^[\p{L}\p{M}]+(?:['’‐‑-][\p{L}\p{M}]+)*$/u)
|
|
26004
|
+
).max(personalWordLimit).default([])
|
|
26005
|
+
}).strict();
|
|
26006
|
+
var writingPatchSchema = z21.object({
|
|
26007
|
+
language: z21.literal("en").optional(),
|
|
26008
|
+
enabled: z21.boolean().optional(),
|
|
26009
|
+
spelling: z21.boolean().optional(),
|
|
26010
|
+
grammar: z21.boolean().optional(),
|
|
26011
|
+
aiRewrites: z21.boolean().optional(),
|
|
26012
|
+
automatic: z21.boolean().optional(),
|
|
26013
|
+
highlights: z21.boolean().optional(),
|
|
26014
|
+
rules: z21.partialRecord(z21.enum(writingRules), z21.boolean()).optional(),
|
|
26015
|
+
words: writingSettingsSchema.shape.words.removeDefault().optional()
|
|
26016
|
+
}).strict();
|
|
26017
|
+
|
|
26018
|
+
// lib/shared/src/proofing-contract.ts
|
|
26019
|
+
var consentFields = z22.strictObject({
|
|
26020
|
+
enabled: z22.boolean(),
|
|
26021
|
+
automatic: z22.boolean()
|
|
26022
|
+
});
|
|
26023
|
+
var validConsent = (value) => value.enabled || !value.automatic;
|
|
26024
|
+
var proofingConsentSchema = consentFields.refine(validConsent);
|
|
26025
|
+
var proofingConsentStatusSchema = consentFields.extend({ available: z22.boolean().optional() }).refine(validConsent);
|
|
26026
|
+
var rule = z22.enum(["spelling", ...writingRules]);
|
|
26027
|
+
var proofingCheckSchema = z22.strictObject({
|
|
26028
|
+
text: z22.string().min(1).max(1500).refine(
|
|
26029
|
+
(text5) => !/[\r\n]\s*[\r\n]|\u2029/u.test(text5.replaceAll("\r\n", "\n")) && !/[\p{Cs}]/u.test(text5)
|
|
26030
|
+
),
|
|
26031
|
+
revision: z22.int().nonnegative(),
|
|
26032
|
+
rules: z22.record(rule, z22.boolean())
|
|
26033
|
+
});
|
|
26034
|
+
var proofingResultSchema = z22.strictObject({
|
|
26035
|
+
revision: z22.int().nonnegative(),
|
|
26036
|
+
complete: z22.boolean(),
|
|
26037
|
+
issues: z22.array(
|
|
26038
|
+
z22.strictObject({
|
|
26039
|
+
id: z22.string().max(80),
|
|
26040
|
+
rule,
|
|
26041
|
+
message: rule,
|
|
26042
|
+
from: z22.int().nonnegative(),
|
|
26043
|
+
to: z22.int().max(1500),
|
|
26044
|
+
original: z22.string().max(160),
|
|
26045
|
+
replacements: z22.array(z22.string().max(100)).max(3)
|
|
26046
|
+
})
|
|
26047
|
+
).max(50)
|
|
26048
|
+
});
|
|
26049
|
+
|
|
25886
26050
|
// lib/memory/src/exports.ts
|
|
25887
26051
|
init_define_GROVE_TELEMETRY();
|
|
25888
26052
|
import { randomUUID as randomUUID11, createHash as createHash16 } from "node:crypto";
|
|
@@ -26402,13 +26566,13 @@ init_contracts();
|
|
|
26402
26566
|
|
|
26403
26567
|
// lib/shared/src/jobs.ts
|
|
26404
26568
|
init_define_GROVE_TELEMETRY();
|
|
26405
|
-
import { z as
|
|
26569
|
+
import { z as z24 } from "zod";
|
|
26406
26570
|
|
|
26407
26571
|
// lib/shared/src/web-capture.ts
|
|
26408
26572
|
init_define_GROVE_TELEMETRY();
|
|
26409
26573
|
init_contracts();
|
|
26410
26574
|
init_limits();
|
|
26411
|
-
import { z as
|
|
26575
|
+
import { z as z23 } from "zod";
|
|
26412
26576
|
var trackingParameters = /* @__PURE__ */ new Set([
|
|
26413
26577
|
"utm_source",
|
|
26414
26578
|
"utm_medium",
|
|
@@ -26449,37 +26613,37 @@ function normalizeWebUrl(input) {
|
|
|
26449
26613
|
throw new Error("Invalid source URL: too long");
|
|
26450
26614
|
return normalized;
|
|
26451
26615
|
}
|
|
26452
|
-
var webCaptureSchema =
|
|
26453
|
-
url:
|
|
26616
|
+
var webCaptureSchema = z23.object({
|
|
26617
|
+
url: z23.string().max(WEB_URL_MAX).transform((value, ctx) => {
|
|
26454
26618
|
try {
|
|
26455
26619
|
return normalizeWebUrl(value);
|
|
26456
26620
|
} catch {
|
|
26457
26621
|
ctx.addIssue({ code: "custom", message: "Invalid source URL" });
|
|
26458
|
-
return
|
|
26622
|
+
return z23.NEVER;
|
|
26459
26623
|
}
|
|
26460
26624
|
}),
|
|
26461
|
-
title:
|
|
26625
|
+
title: z23.string().max(300).refine((value) => !containsControlCharacters(value), {
|
|
26462
26626
|
message: "Source title must be a single line"
|
|
26463
26627
|
}),
|
|
26464
|
-
capturedAt:
|
|
26628
|
+
capturedAt: z23.iso.datetime()
|
|
26465
26629
|
}).strict();
|
|
26466
|
-
var browserCaptureRequestSchema =
|
|
26467
|
-
operationId:
|
|
26468
|
-
id:
|
|
26469
|
-
expectedVersion:
|
|
26470
|
-
editSession:
|
|
26630
|
+
var browserCaptureRequestSchema = z23.object({
|
|
26631
|
+
operationId: z23.uuid(),
|
|
26632
|
+
id: z23.uuid().optional(),
|
|
26633
|
+
expectedVersion: z23.number().int().positive().optional(),
|
|
26634
|
+
editSession: z23.uuid().optional(),
|
|
26471
26635
|
content: rememberSchema.shape.content,
|
|
26472
|
-
projectId:
|
|
26473
|
-
capture:
|
|
26636
|
+
projectId: z23.uuid().nullable(),
|
|
26637
|
+
capture: z23.literal("explicit"),
|
|
26474
26638
|
provenance: webCaptureSchema.optional()
|
|
26475
26639
|
}).strict().refine(
|
|
26476
26640
|
(input) => Boolean(input.id) === Boolean(input.expectedVersion),
|
|
26477
26641
|
"Updates require both id and expectedVersion"
|
|
26478
26642
|
);
|
|
26479
|
-
var browserPageRequestSchema =
|
|
26643
|
+
var browserPageRequestSchema = z23.object({
|
|
26480
26644
|
url: webCaptureSchema.shape.url,
|
|
26481
|
-
projectId:
|
|
26482
|
-
cursor:
|
|
26645
|
+
projectId: z23.uuid().nullable(),
|
|
26646
|
+
cursor: z23.string().max(2048).optional()
|
|
26483
26647
|
}).strict();
|
|
26484
26648
|
|
|
26485
26649
|
// lib/shared/src/jobs.ts
|
|
@@ -26490,22 +26654,22 @@ var queueLanes = [
|
|
|
26490
26654
|
"maintenance",
|
|
26491
26655
|
"bulk"
|
|
26492
26656
|
];
|
|
26493
|
-
var exportRequestSchema =
|
|
26494
|
-
id:
|
|
26495
|
-
projectId:
|
|
26496
|
-
includeDescendants:
|
|
26497
|
-
includeMedia:
|
|
26657
|
+
var exportRequestSchema = z24.object({
|
|
26658
|
+
id: z24.uuid(),
|
|
26659
|
+
projectId: z24.uuid().optional(),
|
|
26660
|
+
includeDescendants: z24.boolean().default(false),
|
|
26661
|
+
includeMedia: z24.boolean().optional()
|
|
26498
26662
|
}).strict();
|
|
26499
|
-
var importRecordSchema =
|
|
26500
|
-
sourceId:
|
|
26501
|
-
content:
|
|
26502
|
-
projectId:
|
|
26663
|
+
var importRecordSchema = z24.object({
|
|
26664
|
+
sourceId: z24.string().min(1).max(200),
|
|
26665
|
+
content: z24.string().min(1).max(6e3),
|
|
26666
|
+
projectId: z24.uuid().nullable().default(null),
|
|
26503
26667
|
webCapture: webCaptureSchema.optional()
|
|
26504
26668
|
}).strict();
|
|
26505
|
-
var importRequestSchema =
|
|
26506
|
-
id:
|
|
26507
|
-
source:
|
|
26508
|
-
records:
|
|
26669
|
+
var importRequestSchema = z24.object({
|
|
26670
|
+
id: z24.uuid(),
|
|
26671
|
+
source: z24.string().regex(/^[a-zA-Z0-9._-]{1,100}$/),
|
|
26672
|
+
records: z24.array(importRecordSchema).min(1).max(100)
|
|
26509
26673
|
}).strict();
|
|
26510
26674
|
|
|
26511
26675
|
// lib/memory/src/imports.ts
|
|
@@ -26635,16 +26799,16 @@ init_contracts();
|
|
|
26635
26799
|
|
|
26636
26800
|
// lib/shared/src/conversation-history.ts
|
|
26637
26801
|
init_define_GROVE_TELEMETRY();
|
|
26638
|
-
import { z as
|
|
26639
|
-
var conversationHistorySchema =
|
|
26640
|
-
query:
|
|
26641
|
-
after:
|
|
26802
|
+
import { z as z26 } from "zod";
|
|
26803
|
+
var conversationHistorySchema = z26.object({
|
|
26804
|
+
query: z26.string().trim().max(200).default(""),
|
|
26805
|
+
after: z26.string().max(2048).optional()
|
|
26642
26806
|
}).strict();
|
|
26643
|
-
var conversationHistoryCursorSchema =
|
|
26644
|
-
owner:
|
|
26645
|
-
query:
|
|
26646
|
-
id:
|
|
26647
|
-
at:
|
|
26807
|
+
var conversationHistoryCursorSchema = z26.object({
|
|
26808
|
+
owner: z26.uuid(),
|
|
26809
|
+
query: z26.string(),
|
|
26810
|
+
id: z26.uuid(),
|
|
26811
|
+
at: z26.iso.datetime()
|
|
26648
26812
|
});
|
|
26649
26813
|
|
|
26650
26814
|
// lib/memory/src/tools.ts
|
|
@@ -26654,11 +26818,11 @@ init_contracts();
|
|
|
26654
26818
|
// lib/shared/src/notebook-lifecycle.ts
|
|
26655
26819
|
init_define_GROVE_TELEMETRY();
|
|
26656
26820
|
init_contracts();
|
|
26657
|
-
import { z as
|
|
26658
|
-
var notebookLifecycleSchema =
|
|
26821
|
+
import { z as z27 } from "zod";
|
|
26822
|
+
var notebookLifecycleSchema = z27.object({
|
|
26659
26823
|
operationId: operationSchema,
|
|
26660
|
-
expectedVersion:
|
|
26661
|
-
fingerprint:
|
|
26824
|
+
expectedVersion: z27.number().int().positive(),
|
|
26825
|
+
fingerprint: z27.string().regex(/^[a-f0-9]{64}$/)
|
|
26662
26826
|
}).strict();
|
|
26663
26827
|
|
|
26664
26828
|
// lib/memory/src/system-admin.ts
|
|
@@ -26668,39 +26832,39 @@ init_contracts();
|
|
|
26668
26832
|
// lib/shared/src/system-admin.ts
|
|
26669
26833
|
init_define_GROVE_TELEMETRY();
|
|
26670
26834
|
init_contracts();
|
|
26671
|
-
import { z as
|
|
26672
|
-
var adminChangeSchema =
|
|
26835
|
+
import { z as z28 } from "zod";
|
|
26836
|
+
var adminChangeSchema = z28.object({
|
|
26673
26837
|
accountId: uuidSchema,
|
|
26674
26838
|
operationId: uuidSchema,
|
|
26675
|
-
expectedVersion:
|
|
26676
|
-
role:
|
|
26677
|
-
access:
|
|
26678
|
-
reason:
|
|
26839
|
+
expectedVersion: z28.number().int().min(0),
|
|
26840
|
+
role: z28.enum(["user", "system_admin"]),
|
|
26841
|
+
access: z28.enum(["default", "pro", "unlimited"]),
|
|
26842
|
+
reason: z28.string().trim().min(3).max(300)
|
|
26679
26843
|
}).strict();
|
|
26680
|
-
var adminSettingsSchema =
|
|
26681
|
-
captureEnabled:
|
|
26682
|
-
recallEnabled:
|
|
26683
|
-
suspended:
|
|
26684
|
-
supportNote:
|
|
26844
|
+
var adminSettingsSchema = z28.object({
|
|
26845
|
+
captureEnabled: z28.boolean(),
|
|
26846
|
+
recallEnabled: z28.boolean(),
|
|
26847
|
+
suspended: z28.boolean(),
|
|
26848
|
+
supportNote: z28.string().max(500)
|
|
26685
26849
|
}).strict();
|
|
26686
|
-
var adminSupportSchema =
|
|
26850
|
+
var adminSupportSchema = z28.object({
|
|
26687
26851
|
accountId: uuidSchema,
|
|
26688
26852
|
operationId: uuidSchema,
|
|
26689
|
-
expectedVersion:
|
|
26853
|
+
expectedVersion: z28.number().int().min(0),
|
|
26690
26854
|
expectedSettings: adminSettingsSchema,
|
|
26691
26855
|
settings: adminSettingsSchema,
|
|
26692
|
-
reason:
|
|
26856
|
+
reason: z28.string().trim().min(3).max(300)
|
|
26693
26857
|
}).strict();
|
|
26694
|
-
var adminTrialResetSchema =
|
|
26858
|
+
var adminTrialResetSchema = z28.object({
|
|
26695
26859
|
accountId: uuidSchema,
|
|
26696
26860
|
operationId: uuidSchema,
|
|
26697
|
-
reason:
|
|
26861
|
+
reason: z28.string().trim().min(3).max(300)
|
|
26698
26862
|
}).strict();
|
|
26699
|
-
var adminDetailsSchema =
|
|
26700
|
-
var adminBrowseSchema =
|
|
26701
|
-
var adminUsageReportSchema =
|
|
26702
|
-
from:
|
|
26703
|
-
to:
|
|
26863
|
+
var adminDetailsSchema = z28.object({ accountId: uuidSchema }).strict();
|
|
26864
|
+
var adminBrowseSchema = z28.object({ after: uuidSchema.optional() }).strict();
|
|
26865
|
+
var adminUsageReportSchema = z28.object({
|
|
26866
|
+
from: z28.iso.date().optional(),
|
|
26867
|
+
to: z28.iso.date().optional(),
|
|
26704
26868
|
after: uuidSchema.optional()
|
|
26705
26869
|
}).strict().superRefine((input, ctx) => {
|
|
26706
26870
|
if (!!input.from !== !!input.to || input.from && input.to && (input.from > input.to || Date.parse(input.to) - Date.parse(input.from) > 365 * 864e5))
|
|
@@ -30245,7 +30409,7 @@ function s3Media(client, bucket, spacesLifecycleVerified = false) {
|
|
|
30245
30409
|
{ abortSignal: signal }
|
|
30246
30410
|
);
|
|
30247
30411
|
if (lifecycle.Rules?.some(
|
|
30248
|
-
(
|
|
30412
|
+
(rule2) => rule2.Status === "Enabled" && (rule2.Expiration || rule2.NoncurrentVersionExpiration)
|
|
30249
30413
|
))
|
|
30250
30414
|
throw new Error("media_bucket_must_not_expire_source");
|
|
30251
30415
|
} catch (error3) {
|
|
@@ -30603,8 +30767,8 @@ This is a transactional account notification.`,
|
|
|
30603
30767
|
// packages/api/src/broker.ts
|
|
30604
30768
|
init_define_GROVE_TELEMETRY();
|
|
30605
30769
|
import amqp from "amqplib";
|
|
30606
|
-
import { z as
|
|
30607
|
-
var envelope =
|
|
30770
|
+
import { z as z29 } from "zod";
|
|
30771
|
+
var envelope = z29.object({ kind: z29.enum(["memory", "email", "task"]), id: z29.uuid() }).strict();
|
|
30608
30772
|
var queueName = (lane) => `grove.jobs.v2.${lane}`;
|
|
30609
30773
|
var limits = {
|
|
30610
30774
|
"x-message-ttl": 36e5,
|