@knowsuchagency/fulcrum 2.8.2 → 2.9.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/README.md +5 -5
- package/bin/fulcrum.js +32 -153
- package/dist/assets/{index-TyeuSbkG.css → index-Lj1lLJpw.css} +1 -1
- package/dist/assets/{index-BfBfuxBH.js → index-dMSLbxmc.js} +166 -165
- package/dist/index.html +2 -2
- package/drizzle/0054_remove_actionable_events.sql +1 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/server/index.js +242 -541
package/server/index.js
CHANGED
|
@@ -2344,9 +2344,6 @@ params: ${params}`);
|
|
|
2344
2344
|
});
|
|
2345
2345
|
|
|
2346
2346
|
// node_modules/drizzle-orm/sql/functions/aggregate.js
|
|
2347
|
-
function count(expression) {
|
|
2348
|
-
return sql`count(${expression || sql.raw("*")})`.mapWith(Number);
|
|
2349
|
-
}
|
|
2350
2347
|
function max(expression) {
|
|
2351
2348
|
return sql`max(${expression})`.mapWith(is(expression, Column) ? expression : String);
|
|
2352
2349
|
}
|
|
@@ -4378,10 +4375,9 @@ __export(exports_schema, {
|
|
|
4378
4375
|
caldavCalendars: () => caldavCalendars,
|
|
4379
4376
|
artifacts: () => artifacts,
|
|
4380
4377
|
apps: () => apps,
|
|
4381
|
-
appServices: () => appServices
|
|
4382
|
-
actionableEvents: () => actionableEvents
|
|
4378
|
+
appServices: () => appServices
|
|
4383
4379
|
});
|
|
4384
|
-
var tasks, taskRelationships, taskDependencies, taskLinks, taskAttachments, projectLinks, projectAttachments, terminalTabs, terminals, terminalViewState, repositories, apps, appServices, deployments, tunnels, projects, projectRepositories, tags, taskTags, projectTags, chatSessions, chatMessages, artifacts, systemMetrics, messagingConnections, messagingSessionMappings, emailAuthorizedThreads, channelMessages,
|
|
4380
|
+
var tasks, taskRelationships, taskDependencies, taskLinks, taskAttachments, projectLinks, projectAttachments, terminalTabs, terminals, terminalViewState, repositories, apps, appServices, deployments, tunnels, projects, projectRepositories, tags, taskTags, projectTags, chatSessions, chatMessages, artifacts, systemMetrics, messagingConnections, messagingSessionMappings, emailAuthorizedThreads, channelMessages, sweepRuns, caldavCalendars, caldavEvents, memories;
|
|
4385
4381
|
var init_schema = __esm(() => {
|
|
4386
4382
|
init_sqlite_core();
|
|
4387
4383
|
tasks = sqliteTable("tasks", {
|
|
@@ -4690,19 +4686,6 @@ var init_schema = __esm(() => {
|
|
|
4690
4686
|
messageTimestamp: text("message_timestamp").notNull(),
|
|
4691
4687
|
createdAt: text("created_at").notNull()
|
|
4692
4688
|
});
|
|
4693
|
-
actionableEvents = sqliteTable("actionable_events", {
|
|
4694
|
-
id: text("id").primaryKey(),
|
|
4695
|
-
sourceChannel: text("source_channel").notNull(),
|
|
4696
|
-
sourceId: text("source_id").notNull(),
|
|
4697
|
-
sourceMetadata: text("source_metadata", { mode: "json" }).$type(),
|
|
4698
|
-
status: text("status").notNull().default("pending"),
|
|
4699
|
-
linkedTaskId: text("linked_task_id"),
|
|
4700
|
-
summary: text("summary"),
|
|
4701
|
-
actionLog: text("action_log", { mode: "json" }).$type(),
|
|
4702
|
-
createdAt: text("created_at").notNull(),
|
|
4703
|
-
updatedAt: text("updated_at").notNull(),
|
|
4704
|
-
lastEvaluatedAt: text("last_evaluated_at")
|
|
4705
|
-
});
|
|
4706
4689
|
sweepRuns = sqliteTable("sweep_runs", {
|
|
4707
4690
|
id: text("id").primaryKey(),
|
|
4708
4691
|
type: text("type").notNull(),
|
|
@@ -8336,15 +8319,15 @@ function destroyTerminalAndBroadcast(terminalId) {
|
|
|
8336
8319
|
function killClaudeInTerminalsForWorktree(worktreePath) {
|
|
8337
8320
|
const manager = getPTYManager();
|
|
8338
8321
|
const terminals2 = manager.listTerminals();
|
|
8339
|
-
let
|
|
8322
|
+
let count = 0;
|
|
8340
8323
|
for (const terminal of terminals2) {
|
|
8341
8324
|
if (terminal.cwd === worktreePath) {
|
|
8342
8325
|
if (manager.killClaudeInTerminal(terminal.id)) {
|
|
8343
|
-
|
|
8326
|
+
count++;
|
|
8344
8327
|
}
|
|
8345
8328
|
}
|
|
8346
8329
|
}
|
|
8347
|
-
return
|
|
8330
|
+
return count;
|
|
8348
8331
|
}
|
|
8349
8332
|
var ptyManager = null, broadcastFn = null;
|
|
8350
8333
|
var init_pty_instance = __esm(() => {
|
|
@@ -9641,8 +9624,8 @@ var require_Node = __commonJS((exports) => {
|
|
|
9641
9624
|
};
|
|
9642
9625
|
const res = toJS.toJS(this, "", ctx);
|
|
9643
9626
|
if (typeof onAnchor === "function")
|
|
9644
|
-
for (const { count
|
|
9645
|
-
onAnchor(res2,
|
|
9627
|
+
for (const { count, res: res2 } of ctx.anchors.values())
|
|
9628
|
+
onAnchor(res2, count);
|
|
9646
9629
|
return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
|
|
9647
9630
|
}
|
|
9648
9631
|
}
|
|
@@ -9740,13 +9723,13 @@ var require_Alias = __commonJS((exports) => {
|
|
|
9740
9723
|
const anchor = anchors2 && source && anchors2.get(source);
|
|
9741
9724
|
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
9742
9725
|
} else if (identity.isCollection(node)) {
|
|
9743
|
-
let
|
|
9726
|
+
let count = 0;
|
|
9744
9727
|
for (const item of node.items) {
|
|
9745
9728
|
const c = getAliasCount(doc, item, anchors2);
|
|
9746
|
-
if (c >
|
|
9747
|
-
|
|
9729
|
+
if (c > count)
|
|
9730
|
+
count = c;
|
|
9748
9731
|
}
|
|
9749
|
-
return
|
|
9732
|
+
return count;
|
|
9750
9733
|
} else if (identity.isPair(node)) {
|
|
9751
9734
|
const kc = getAliasCount(doc, node.key, anchors2);
|
|
9752
9735
|
const vc = getAliasCount(doc, node.value, anchors2);
|
|
@@ -12475,8 +12458,8 @@ var require_Document = __commonJS((exports) => {
|
|
|
12475
12458
|
};
|
|
12476
12459
|
const res = toJS.toJS(this.contents, jsonArg ?? "", ctx);
|
|
12477
12460
|
if (typeof onAnchor === "function")
|
|
12478
|
-
for (const { count
|
|
12479
|
-
onAnchor(res2,
|
|
12461
|
+
for (const { count, res: res2 } of ctx.anchors.values())
|
|
12462
|
+
onAnchor(res2, count);
|
|
12480
12463
|
return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
|
|
12481
12464
|
}
|
|
12482
12465
|
toJSON(jsonArg, onAnchor) {
|
|
@@ -12546,12 +12529,12 @@ var require_errors = __commonJS((exports) => {
|
|
|
12546
12529
|
lineStr = prev + lineStr;
|
|
12547
12530
|
}
|
|
12548
12531
|
if (/[^ ]/.test(lineStr)) {
|
|
12549
|
-
let
|
|
12532
|
+
let count = 1;
|
|
12550
12533
|
const end = error.linePos[1];
|
|
12551
12534
|
if (end?.line === line && end.col > col) {
|
|
12552
|
-
|
|
12535
|
+
count = Math.max(1, Math.min(end.col - col, 80 - ci));
|
|
12553
12536
|
}
|
|
12554
|
-
const pointer = " ".repeat(ci) + "^".repeat(
|
|
12537
|
+
const pointer = " ".repeat(ci) + "^".repeat(count);
|
|
12555
12538
|
error.message += `:
|
|
12556
12539
|
|
|
12557
12540
|
${lineStr}
|
|
@@ -44590,20 +44573,20 @@ var require_resolve = __commonJS((exports) => {
|
|
|
44590
44573
|
return false;
|
|
44591
44574
|
}
|
|
44592
44575
|
function countKeys(schema2) {
|
|
44593
|
-
let
|
|
44576
|
+
let count = 0;
|
|
44594
44577
|
for (const key in schema2) {
|
|
44595
44578
|
if (key === "$ref")
|
|
44596
44579
|
return Infinity;
|
|
44597
|
-
|
|
44580
|
+
count++;
|
|
44598
44581
|
if (SIMPLE_INLINED.has(key))
|
|
44599
44582
|
continue;
|
|
44600
44583
|
if (typeof schema2[key] == "object") {
|
|
44601
|
-
(0, util_1.eachItem)(schema2[key], (sch) =>
|
|
44584
|
+
(0, util_1.eachItem)(schema2[key], (sch) => count += countKeys(sch));
|
|
44602
44585
|
}
|
|
44603
|
-
if (
|
|
44586
|
+
if (count === Infinity)
|
|
44604
44587
|
return Infinity;
|
|
44605
44588
|
}
|
|
44606
|
-
return
|
|
44589
|
+
return count;
|
|
44607
44590
|
}
|
|
44608
44591
|
function getFullPath(resolver, id = "", normalize3) {
|
|
44609
44592
|
if (normalize3 !== false)
|
|
@@ -47536,8 +47519,8 @@ var require_contains = __commonJS((exports) => {
|
|
|
47536
47519
|
cxt.result(valid, () => cxt.reset());
|
|
47537
47520
|
function validateItemsWithCount() {
|
|
47538
47521
|
const schValid = gen.name("_valid");
|
|
47539
|
-
const
|
|
47540
|
-
validateItems(schValid, () => gen.if(schValid, () => checkLimits(
|
|
47522
|
+
const count = gen.let("count", 0);
|
|
47523
|
+
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));
|
|
47541
47524
|
}
|
|
47542
47525
|
function validateItems(_valid, block) {
|
|
47543
47526
|
gen.forRange("i", 0, len, (i) => {
|
|
@@ -47550,16 +47533,16 @@ var require_contains = __commonJS((exports) => {
|
|
|
47550
47533
|
block();
|
|
47551
47534
|
});
|
|
47552
47535
|
}
|
|
47553
|
-
function checkLimits(
|
|
47554
|
-
gen.code((0, codegen_1._)`${
|
|
47536
|
+
function checkLimits(count) {
|
|
47537
|
+
gen.code((0, codegen_1._)`${count}++`);
|
|
47555
47538
|
if (max2 === undefined) {
|
|
47556
|
-
gen.if((0, codegen_1._)`${
|
|
47539
|
+
gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true).break());
|
|
47557
47540
|
} else {
|
|
47558
|
-
gen.if((0, codegen_1._)`${
|
|
47541
|
+
gen.if((0, codegen_1._)`${count} > ${max2}`, () => gen.assign(valid, false).break());
|
|
47559
47542
|
if (min === 1)
|
|
47560
47543
|
gen.assign(valid, true);
|
|
47561
47544
|
else
|
|
47562
|
-
gen.if((0, codegen_1._)`${
|
|
47545
|
+
gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true));
|
|
47563
47546
|
}
|
|
47564
47547
|
}
|
|
47565
47548
|
}
|
|
@@ -50903,20 +50886,20 @@ var require_resolve2 = __commonJS((exports) => {
|
|
|
50903
50886
|
return false;
|
|
50904
50887
|
}
|
|
50905
50888
|
function countKeys(schema2) {
|
|
50906
|
-
let
|
|
50889
|
+
let count = 0;
|
|
50907
50890
|
for (const key in schema2) {
|
|
50908
50891
|
if (key === "$ref")
|
|
50909
50892
|
return Infinity;
|
|
50910
|
-
|
|
50893
|
+
count++;
|
|
50911
50894
|
if (SIMPLE_INLINED.has(key))
|
|
50912
50895
|
continue;
|
|
50913
50896
|
if (typeof schema2[key] == "object") {
|
|
50914
|
-
(0, util_1.eachItem)(schema2[key], (sch) =>
|
|
50897
|
+
(0, util_1.eachItem)(schema2[key], (sch) => count += countKeys(sch));
|
|
50915
50898
|
}
|
|
50916
|
-
if (
|
|
50899
|
+
if (count === Infinity)
|
|
50917
50900
|
return Infinity;
|
|
50918
50901
|
}
|
|
50919
|
-
return
|
|
50902
|
+
return count;
|
|
50920
50903
|
}
|
|
50921
50904
|
function getFullPath(resolver, id = "", normalize3) {
|
|
50922
50905
|
if (normalize3 !== false)
|
|
@@ -53169,8 +53152,8 @@ var require_contains2 = __commonJS((exports) => {
|
|
|
53169
53152
|
cxt.result(valid, () => cxt.reset());
|
|
53170
53153
|
function validateItemsWithCount() {
|
|
53171
53154
|
const schValid = gen.name("_valid");
|
|
53172
|
-
const
|
|
53173
|
-
validateItems(schValid, () => gen.if(schValid, () => checkLimits(
|
|
53155
|
+
const count = gen.let("count", 0);
|
|
53156
|
+
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));
|
|
53174
53157
|
}
|
|
53175
53158
|
function validateItems(_valid, block) {
|
|
53176
53159
|
gen.forRange("i", 0, len, (i) => {
|
|
@@ -53183,16 +53166,16 @@ var require_contains2 = __commonJS((exports) => {
|
|
|
53183
53166
|
block();
|
|
53184
53167
|
});
|
|
53185
53168
|
}
|
|
53186
|
-
function checkLimits(
|
|
53187
|
-
gen.code((0, codegen_1._)`${
|
|
53169
|
+
function checkLimits(count) {
|
|
53170
|
+
gen.code((0, codegen_1._)`${count}++`);
|
|
53188
53171
|
if (max2 === undefined) {
|
|
53189
|
-
gen.if((0, codegen_1._)`${
|
|
53172
|
+
gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true).break());
|
|
53190
53173
|
} else {
|
|
53191
|
-
gen.if((0, codegen_1._)`${
|
|
53174
|
+
gen.if((0, codegen_1._)`${count} > ${max2}`, () => gen.assign(valid, false).break());
|
|
53192
53175
|
if (min === 1)
|
|
53193
53176
|
gen.assign(valid, true);
|
|
53194
53177
|
else
|
|
53195
|
-
gen.if((0, codegen_1._)`${
|
|
53178
|
+
gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true));
|
|
53196
53179
|
}
|
|
53197
53180
|
}
|
|
53198
53181
|
}
|
|
@@ -60092,20 +60075,20 @@ var init_sdk = __esm(() => {
|
|
|
60092
60075
|
return false;
|
|
60093
60076
|
}
|
|
60094
60077
|
function countKeys(schema2) {
|
|
60095
|
-
let
|
|
60078
|
+
let count = 0;
|
|
60096
60079
|
for (const key in schema2) {
|
|
60097
60080
|
if (key === "$ref")
|
|
60098
60081
|
return Infinity;
|
|
60099
|
-
|
|
60082
|
+
count++;
|
|
60100
60083
|
if (SIMPLE_INLINED.has(key))
|
|
60101
60084
|
continue;
|
|
60102
60085
|
if (typeof schema2[key] == "object") {
|
|
60103
|
-
(0, util_1.eachItem)(schema2[key], (sch) =>
|
|
60086
|
+
(0, util_1.eachItem)(schema2[key], (sch) => count += countKeys(sch));
|
|
60104
60087
|
}
|
|
60105
|
-
if (
|
|
60088
|
+
if (count === Infinity)
|
|
60106
60089
|
return Infinity;
|
|
60107
60090
|
}
|
|
60108
|
-
return
|
|
60091
|
+
return count;
|
|
60109
60092
|
}
|
|
60110
60093
|
function getFullPath(resolver, id = "", normalize3) {
|
|
60111
60094
|
if (normalize3 !== false)
|
|
@@ -62957,8 +62940,8 @@ var init_sdk = __esm(() => {
|
|
|
62957
62940
|
cxt.result(valid, () => cxt.reset());
|
|
62958
62941
|
function validateItemsWithCount() {
|
|
62959
62942
|
const schValid = gen.name("_valid");
|
|
62960
|
-
const
|
|
62961
|
-
validateItems(schValid, () => gen.if(schValid, () => checkLimits(
|
|
62943
|
+
const count = gen.let("count", 0);
|
|
62944
|
+
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));
|
|
62962
62945
|
}
|
|
62963
62946
|
function validateItems(_valid, block) {
|
|
62964
62947
|
gen.forRange("i", 0, len, (i) => {
|
|
@@ -62971,16 +62954,16 @@ var init_sdk = __esm(() => {
|
|
|
62971
62954
|
block();
|
|
62972
62955
|
});
|
|
62973
62956
|
}
|
|
62974
|
-
function checkLimits(
|
|
62975
|
-
gen.code((0, codegen_1._)`${
|
|
62957
|
+
function checkLimits(count) {
|
|
62958
|
+
gen.code((0, codegen_1._)`${count}++`);
|
|
62976
62959
|
if (max2 === undefined) {
|
|
62977
|
-
gen.if((0, codegen_1._)`${
|
|
62960
|
+
gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true).break());
|
|
62978
62961
|
} else {
|
|
62979
|
-
gen.if((0, codegen_1._)`${
|
|
62962
|
+
gen.if((0, codegen_1._)`${count} > ${max2}`, () => gen.assign(valid, false).break());
|
|
62980
62963
|
if (min === 1)
|
|
62981
62964
|
gen.assign(valid, true);
|
|
62982
62965
|
else
|
|
62983
|
-
gen.if((0, codegen_1._)`${
|
|
62966
|
+
gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true));
|
|
62984
62967
|
}
|
|
62985
62968
|
}
|
|
62986
62969
|
}
|
|
@@ -71029,12 +71012,9 @@ You have access to Fulcrum's MCP tools. Use them proactively to help users.
|
|
|
71029
71012
|
|
|
71030
71013
|
**Assistant Tools (Proactive Agent):**
|
|
71031
71014
|
- \`message\` - Send a message to a channel (email, whatsapp)
|
|
71032
|
-
- \`create_actionable_event\` - Track something noticed (message, request)
|
|
71033
|
-
- \`list_actionable_events\` - Review your event memory
|
|
71034
|
-
- \`get_actionable_event\` - Get event details
|
|
71035
|
-
- \`update_actionable_event\` - Update event status, link to task
|
|
71036
|
-
- \`get_assistant_stats\` - Get event counts and last sweep times
|
|
71037
71015
|
- \`get_last_sweep\` - Check when last sweep ran
|
|
71016
|
+
- Use \`memory_store\` with tag \`actionable\` to track things that need attention
|
|
71017
|
+
- Use \`memory_search\` to review tracked items (search for tags \`actionable\` or \`monitoring\`)
|
|
71038
71018
|
|
|
71039
71019
|
**Memory Tools:**
|
|
71040
71020
|
- \`memory_store\` - Store a piece of knowledge in persistent memory with optional tags
|
|
@@ -71351,7 +71331,7 @@ Fulcrum is your digital concierge - a personal command center where you track ev
|
|
|
71351
71331
|
- send_notification
|
|
71352
71332
|
- memory_store, memory_search (persistent knowledge across sessions)
|
|
71353
71333
|
- message (send to email/WhatsApp - concierge mode)
|
|
71354
|
-
-
|
|
71334
|
+
- memory_store with tag \`actionable\` (track things needing attention - concierge mode)
|
|
71355
71335
|
|
|
71356
71336
|
**Remember:** When users need external services (email, cloud, APIs), guide them on what credentials to provide - don't say "Fulcrum can't do that."`;
|
|
71357
71337
|
}
|
|
@@ -81505,14 +81485,14 @@ var require_Messages = __commonJS((exports, module) => {
|
|
|
81505
81485
|
[DjsErrorCodes.ShardingInProcess]: "Shards are still being spawned.",
|
|
81506
81486
|
[DjsErrorCodes.ShardingInvalidEvalBroadcast]: "Script to evaluate must be a function",
|
|
81507
81487
|
[DjsErrorCodes.ShardingShardNotFound]: (id) => `Shard ${id} could not be found.`,
|
|
81508
|
-
[DjsErrorCodes.ShardingAlreadySpawned]: (
|
|
81488
|
+
[DjsErrorCodes.ShardingAlreadySpawned]: (count) => `Already spawned ${count} shards.`,
|
|
81509
81489
|
[DjsErrorCodes.ShardingProcessExists]: (id) => `Shard ${id} already has an active process.`,
|
|
81510
81490
|
[DjsErrorCodes.ShardingWorkerExists]: (id) => `Shard ${id} already has an active worker.`,
|
|
81511
81491
|
[DjsErrorCodes.ShardingReadyTimeout]: (id) => `Shard ${id}'s Client took too long to become ready.`,
|
|
81512
81492
|
[DjsErrorCodes.ShardingReadyDisconnected]: (id) => `Shard ${id}'s Client disconnected before becoming ready.`,
|
|
81513
81493
|
[DjsErrorCodes.ShardingReadyDied]: (id) => `Shard ${id}'s process exited before its Client became ready.`,
|
|
81514
81494
|
[DjsErrorCodes.ShardingNoChildExists]: (id) => `Shard ${id} has no active process or worker.`,
|
|
81515
|
-
[DjsErrorCodes.ShardingShardMiscalculation]: (shard, guild,
|
|
81495
|
+
[DjsErrorCodes.ShardingShardMiscalculation]: (shard, guild, count) => `Calculated invalid shard ${shard} for guild ${guild} with ${count} shards.`,
|
|
81516
81496
|
[DjsErrorCodes.ColorRange]: "Color must be within the range 0 - 16777215 (0xFFFFFF).",
|
|
81517
81497
|
[DjsErrorCodes.ColorConvert]: (color) => `Unable to convert "${color}" to a number.`,
|
|
81518
81498
|
[DjsErrorCodes.InviteOptionsMissingChannel]: "A valid guild channel must be provided when GuildScheduledEvent is EXTERNAL.",
|
|
@@ -83682,7 +83662,7 @@ var require_GuildChannel = __commonJS((exports, module) => {
|
|
|
83682
83662
|
get position() {
|
|
83683
83663
|
const selfIsCategory = this.type === ChannelType.GuildCategory;
|
|
83684
83664
|
const types4 = getSortableGroupTypes(this.type);
|
|
83685
|
-
let
|
|
83665
|
+
let count = 0;
|
|
83686
83666
|
for (const channel of this.guild.channels.cache.values()) {
|
|
83687
83667
|
if (!types4.includes(channel.type))
|
|
83688
83668
|
continue;
|
|
@@ -83690,12 +83670,12 @@ var require_GuildChannel = __commonJS((exports, module) => {
|
|
|
83690
83670
|
continue;
|
|
83691
83671
|
if (this.rawPosition === channel.rawPosition) {
|
|
83692
83672
|
if (Snowflake.compare(channel.id, this.id) === -1)
|
|
83693
|
-
|
|
83673
|
+
count++;
|
|
83694
83674
|
} else if (this.rawPosition > channel.rawPosition) {
|
|
83695
|
-
|
|
83675
|
+
count++;
|
|
83696
83676
|
}
|
|
83697
83677
|
}
|
|
83698
|
-
return
|
|
83678
|
+
return count;
|
|
83699
83679
|
}
|
|
83700
83680
|
permissionsFor(memberOrRole, checkAdmin = true) {
|
|
83701
83681
|
const member = this.guild.members.resolve(memberOrRole);
|
|
@@ -113554,14 +113534,14 @@ var require__stream_writable = __commonJS((exports, module) => {
|
|
|
113554
113534
|
var buffer = new Array(l);
|
|
113555
113535
|
var holder = state.corkedRequestsFree;
|
|
113556
113536
|
holder.entry = entry;
|
|
113557
|
-
var
|
|
113537
|
+
var count = 0;
|
|
113558
113538
|
var allBuffers = true;
|
|
113559
113539
|
while (entry) {
|
|
113560
|
-
buffer[
|
|
113540
|
+
buffer[count] = entry;
|
|
113561
113541
|
if (!entry.isBuf)
|
|
113562
113542
|
allBuffers = false;
|
|
113563
113543
|
entry = entry.next;
|
|
113564
|
-
|
|
113544
|
+
count += 1;
|
|
113565
113545
|
}
|
|
113566
113546
|
buffer.allBuffers = allBuffers;
|
|
113567
113547
|
doWrite(stream3, state, true, state.length, buffer, "", holder.finish);
|
|
@@ -116395,9 +116375,9 @@ var require_util6 = __commonJS((exports, module) => {
|
|
|
116395
116375
|
function isIdentifier(str) {
|
|
116396
116376
|
return rident.test(str);
|
|
116397
116377
|
}
|
|
116398
|
-
function filledRange(
|
|
116399
|
-
var ret2 = new Array(
|
|
116400
|
-
for (var i = 0;i <
|
|
116378
|
+
function filledRange(count, prefix, suffix) {
|
|
116379
|
+
var ret2 = new Array(count);
|
|
116380
|
+
for (var i = 0;i < count; ++i) {
|
|
116401
116381
|
ret2[i] = prefix + i + suffix;
|
|
116402
116382
|
}
|
|
116403
116383
|
return ret2;
|
|
@@ -119530,9 +119510,9 @@ var require_promisify = __commonJS((exports, module) => {
|
|
|
119530
119510
|
var newParameterCount = Math.max(0, parameterCount(fn) - 1);
|
|
119531
119511
|
var argumentOrder = switchCaseArgumentOrder(newParameterCount);
|
|
119532
119512
|
var shouldProxyThis = typeof callback === "string" || receiver2 === THIS;
|
|
119533
|
-
function generateCallForArgumentCount(
|
|
119534
|
-
var args = argumentSequence(
|
|
119535
|
-
var comma =
|
|
119513
|
+
function generateCallForArgumentCount(count) {
|
|
119514
|
+
var args = argumentSequence(count).join(", ");
|
|
119515
|
+
var comma = count > 0 ? ", " : "";
|
|
119536
119516
|
var ret;
|
|
119537
119517
|
if (shouldProxyThis) {
|
|
119538
119518
|
ret = `ret = callback.call(this, {{args}}, nodeback); break;
|
|
@@ -120078,8 +120058,8 @@ var require_some = __commonJS((exports, module) => {
|
|
|
120078
120058
|
SomePromiseArray.prototype.howMany = function() {
|
|
120079
120059
|
return this._howMany;
|
|
120080
120060
|
};
|
|
120081
|
-
SomePromiseArray.prototype.setHowMany = function(
|
|
120082
|
-
this._howMany =
|
|
120061
|
+
SomePromiseArray.prototype.setHowMany = function(count) {
|
|
120062
|
+
this._howMany = count;
|
|
120083
120063
|
};
|
|
120084
120064
|
SomePromiseArray.prototype._promiseFulfilled = function(value) {
|
|
120085
120065
|
this._addFulfilled(value);
|
|
@@ -120137,8 +120117,8 @@ var require_some = __commonJS((exports, module) => {
|
|
|
120137
120117
|
SomePromiseArray.prototype._canPossiblyFulfill = function() {
|
|
120138
120118
|
return this.length() - this._rejected();
|
|
120139
120119
|
};
|
|
120140
|
-
SomePromiseArray.prototype._getRangeError = function(
|
|
120141
|
-
var message = "Input array must contain at least " + this._howMany + " items but contains only " +
|
|
120120
|
+
SomePromiseArray.prototype._getRangeError = function(count) {
|
|
120121
|
+
var message = "Input array must contain at least " + this._howMany + " items but contains only " + count + " items";
|
|
120142
120122
|
return new RangeError2(message);
|
|
120143
120123
|
};
|
|
120144
120124
|
SomePromiseArray.prototype._resolveEmptyArray = function() {
|
|
@@ -122494,21 +122474,21 @@ var require_parseDate = __commonJS((exports) => {
|
|
|
122494
122474
|
dec: 11
|
|
122495
122475
|
};
|
|
122496
122476
|
function parseDigits(token, minDigits, maxDigits, trailingOK) {
|
|
122497
|
-
let
|
|
122498
|
-
while (
|
|
122499
|
-
const c = token.charCodeAt(
|
|
122477
|
+
let count = 0;
|
|
122478
|
+
while (count < token.length) {
|
|
122479
|
+
const c = token.charCodeAt(count);
|
|
122500
122480
|
if (c <= 47 || c >= 58) {
|
|
122501
122481
|
break;
|
|
122502
122482
|
}
|
|
122503
|
-
|
|
122483
|
+
count++;
|
|
122504
122484
|
}
|
|
122505
|
-
if (
|
|
122485
|
+
if (count < minDigits || count > maxDigits) {
|
|
122506
122486
|
return;
|
|
122507
122487
|
}
|
|
122508
|
-
if (!trailingOK &&
|
|
122488
|
+
if (!trailingOK && count != token.length) {
|
|
122509
122489
|
return;
|
|
122510
122490
|
}
|
|
122511
|
-
return parseInt(token.slice(0,
|
|
122491
|
+
return parseInt(token.slice(0, count), 10);
|
|
122512
122492
|
}
|
|
122513
122493
|
function parseTime(token) {
|
|
122514
122494
|
const parts = token.split(":");
|
|
@@ -129745,10 +129725,10 @@ var require_utils6 = __commonJS((exports, module) => {
|
|
|
129745
129725
|
"aes-256-cbc": { key: 32, iv: 16 }
|
|
129746
129726
|
};
|
|
129747
129727
|
var PKCS5_SALT_LEN = 8;
|
|
129748
|
-
function opensslKeyDeriv(cipher, salt, passphrase,
|
|
129728
|
+
function opensslKeyDeriv(cipher, salt, passphrase, count) {
|
|
129749
129729
|
assert4.buffer(salt, "salt");
|
|
129750
129730
|
assert4.buffer(passphrase, "passphrase");
|
|
129751
|
-
assert4.number(
|
|
129731
|
+
assert4.number(count, "iteration count");
|
|
129752
129732
|
var clen = CIPHER_LEN[cipher];
|
|
129753
129733
|
assert4.object(clen, "supported cipher");
|
|
129754
129734
|
salt = salt.slice(0, PKCS5_SALT_LEN);
|
|
@@ -129761,7 +129741,7 @@ var require_utils6 = __commonJS((exports, module) => {
|
|
|
129761
129741
|
bufs.push(passphrase);
|
|
129762
129742
|
bufs.push(salt);
|
|
129763
129743
|
D = Buffer3.concat(bufs);
|
|
129764
|
-
for (var j = 0;j <
|
|
129744
|
+
for (var j = 0;j < count; ++j)
|
|
129765
129745
|
D = crypto5.createHash("md5").update(D).digest();
|
|
129766
129746
|
material = Buffer3.concat([material, D]);
|
|
129767
129747
|
D_prev = D;
|
|
@@ -133098,7 +133078,7 @@ var require_bcrypt_pbkdf = __commonJS((exports, module) => {
|
|
|
133098
133078
|
}
|
|
133099
133079
|
}
|
|
133100
133080
|
function bcrypt_pbkdf(pass, passlen, salt, saltlen, key, keylen, rounds) {
|
|
133101
|
-
var sha2pass = new Uint8Array(64), sha2salt = new Uint8Array(64), out = new Uint8Array(BCRYPT_HASHSIZE), tmpout = new Uint8Array(BCRYPT_HASHSIZE), countsalt = new Uint8Array(saltlen + 4), i, j, amt, stride, dest,
|
|
133081
|
+
var sha2pass = new Uint8Array(64), sha2salt = new Uint8Array(64), out = new Uint8Array(BCRYPT_HASHSIZE), tmpout = new Uint8Array(BCRYPT_HASHSIZE), countsalt = new Uint8Array(saltlen + 4), i, j, amt, stride, dest, count, origkeylen = keylen;
|
|
133102
133082
|
if (rounds < 1)
|
|
133103
133083
|
return -1;
|
|
133104
133084
|
if (passlen === 0 || saltlen === 0 || keylen === 0 || keylen > out.byteLength * out.byteLength || saltlen > 1 << 20)
|
|
@@ -133108,11 +133088,11 @@ var require_bcrypt_pbkdf = __commonJS((exports, module) => {
|
|
|
133108
133088
|
for (i = 0;i < saltlen; i++)
|
|
133109
133089
|
countsalt[i] = salt[i];
|
|
133110
133090
|
crypto_hash_sha512(sha2pass, pass, passlen);
|
|
133111
|
-
for (
|
|
133112
|
-
countsalt[saltlen + 0] =
|
|
133113
|
-
countsalt[saltlen + 1] =
|
|
133114
|
-
countsalt[saltlen + 2] =
|
|
133115
|
-
countsalt[saltlen + 3] =
|
|
133091
|
+
for (count = 1;keylen > 0; count++) {
|
|
133092
|
+
countsalt[saltlen + 0] = count >>> 24;
|
|
133093
|
+
countsalt[saltlen + 1] = count >>> 16;
|
|
133094
|
+
countsalt[saltlen + 2] = count >>> 8;
|
|
133095
|
+
countsalt[saltlen + 3] = count;
|
|
133116
133096
|
crypto_hash_sha512(sha2salt, countsalt, saltlen + 4);
|
|
133117
133097
|
bcrypt_hash(sha2pass, sha2salt, tmpout);
|
|
133118
133098
|
for (i = out.byteLength;i--; )
|
|
@@ -133125,7 +133105,7 @@ var require_bcrypt_pbkdf = __commonJS((exports, module) => {
|
|
|
133125
133105
|
}
|
|
133126
133106
|
amt = Math.min(amt, keylen);
|
|
133127
133107
|
for (i = 0;i < amt; i++) {
|
|
133128
|
-
dest = i * stride + (
|
|
133108
|
+
dest = i * stride + (count - 1);
|
|
133129
133109
|
if (dest >= origkeylen)
|
|
133130
133110
|
break;
|
|
133131
133111
|
key[dest] = out[i];
|
|
@@ -153238,21 +153218,21 @@ var require_cookie3 = __commonJS((exports) => {
|
|
|
153238
153218
|
`.replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
|
|
153239
153219
|
var IP_V6_REGEX_OBJECT = new RegExp(`^${IP_V6_REGEX}$`);
|
|
153240
153220
|
function parseDigits(token, minDigits, maxDigits, trailingOK) {
|
|
153241
|
-
let
|
|
153242
|
-
while (
|
|
153243
|
-
const c = token.charCodeAt(
|
|
153221
|
+
let count = 0;
|
|
153222
|
+
while (count < token.length) {
|
|
153223
|
+
const c = token.charCodeAt(count);
|
|
153244
153224
|
if (c <= 47 || c >= 58) {
|
|
153245
153225
|
break;
|
|
153246
153226
|
}
|
|
153247
|
-
|
|
153227
|
+
count++;
|
|
153248
153228
|
}
|
|
153249
|
-
if (
|
|
153229
|
+
if (count < minDigits || count > maxDigits) {
|
|
153250
153230
|
return null;
|
|
153251
153231
|
}
|
|
153252
|
-
if (!trailingOK &&
|
|
153232
|
+
if (!trailingOK && count != token.length) {
|
|
153253
153233
|
return null;
|
|
153254
153234
|
}
|
|
153255
|
-
return parseInt(token.substr(0,
|
|
153235
|
+
return parseInt(token.substr(0, count), 10);
|
|
153256
153236
|
}
|
|
153257
153237
|
function parseTime(token) {
|
|
153258
153238
|
const parts = token.split(":");
|
|
@@ -181704,15 +181684,15 @@ var require_lower_bound = __commonJS((exports) => {
|
|
|
181704
181684
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
181705
181685
|
function lowerBound(array5, value, comparator) {
|
|
181706
181686
|
let first = 0;
|
|
181707
|
-
let
|
|
181708
|
-
while (
|
|
181709
|
-
const step =
|
|
181687
|
+
let count = array5.length;
|
|
181688
|
+
while (count > 0) {
|
|
181689
|
+
const step = count / 2 | 0;
|
|
181710
181690
|
let it = first + step;
|
|
181711
181691
|
if (comparator(array5[it], value) <= 0) {
|
|
181712
181692
|
first = ++it;
|
|
181713
|
-
|
|
181693
|
+
count -= step + 1;
|
|
181714
181694
|
} else {
|
|
181715
|
-
|
|
181695
|
+
count = step;
|
|
181716
181696
|
}
|
|
181717
181697
|
}
|
|
181718
181698
|
return first;
|
|
@@ -182098,11 +182078,11 @@ var require_retry_operation = __commonJS((exports, module) => {
|
|
|
182098
182078
|
for (var i = 0;i < this._errors.length; i++) {
|
|
182099
182079
|
var error47 = this._errors[i];
|
|
182100
182080
|
var message = error47.message;
|
|
182101
|
-
var
|
|
182102
|
-
counts[message] =
|
|
182103
|
-
if (
|
|
182081
|
+
var count = (counts[message] || 0) + 1;
|
|
182082
|
+
counts[message] = count;
|
|
182083
|
+
if (count >= mainErrorCount) {
|
|
182104
182084
|
mainError = error47;
|
|
182105
|
-
mainErrorCount =
|
|
182085
|
+
mainErrorCount = count;
|
|
182106
182086
|
}
|
|
182107
182087
|
}
|
|
182108
182088
|
return mainError;
|
|
@@ -281356,8 +281336,8 @@ var require_elf = __commonJS((exports, module) => {
|
|
|
281356
281336
|
}
|
|
281357
281337
|
const offset = elf.readUInt32LE(32);
|
|
281358
281338
|
const size = elf.readUInt16LE(54);
|
|
281359
|
-
const
|
|
281360
|
-
for (let i = 0;i <
|
|
281339
|
+
const count = elf.readUInt16LE(56);
|
|
281340
|
+
for (let i = 0;i < count; i++) {
|
|
281361
281341
|
const headerOffset = offset + i * size;
|
|
281362
281342
|
const type = elf.readUInt32LE(headerOffset);
|
|
281363
281343
|
if (type === 3) {
|
|
@@ -295593,8 +295573,8 @@ var init_DsdiffParser = __esm(() => {
|
|
|
295593
295573
|
}
|
|
295594
295574
|
case "CMPR": {
|
|
295595
295575
|
const compressionIdCode = (await this.tokenizer.readToken(FourCcToken)).trim();
|
|
295596
|
-
const
|
|
295597
|
-
const compressionName = await this.tokenizer.readToken(new StringType(
|
|
295576
|
+
const count = await this.tokenizer.readToken(UINT8);
|
|
295577
|
+
const compressionName = await this.tokenizer.readToken(new StringType(count, "ascii"));
|
|
295598
295578
|
if (compressionIdCode === "DSD") {
|
|
295599
295579
|
this.metadata.setFormat("lossless", true);
|
|
295600
295580
|
this.metadata.setFormat("bitsPerSample", 1);
|
|
@@ -300865,8 +300845,8 @@ var createSignalIdentity = (wid, accountSignatureKey) => {
|
|
|
300865
300845
|
}
|
|
300866
300846
|
}
|
|
300867
300847
|
return extracted;
|
|
300868
|
-
}, getNextPreKeys = async ({ creds, keys },
|
|
300869
|
-
const { newPreKeys, lastPreKeyId, preKeysRange } = generateOrGetPreKeys(creds,
|
|
300848
|
+
}, getNextPreKeys = async ({ creds, keys }, count) => {
|
|
300849
|
+
const { newPreKeys, lastPreKeyId, preKeysRange } = generateOrGetPreKeys(creds, count);
|
|
300870
300850
|
const update2 = {
|
|
300871
300851
|
nextPreKeyId: Math.max(lastPreKeyId + 1, creds.nextPreKeyId),
|
|
300872
300852
|
firstUnuploadedPreKeyId: Math.max(creds.firstUnuploadedPreKeyId, lastPreKeyId + 1)
|
|
@@ -300874,9 +300854,9 @@ var createSignalIdentity = (wid, accountSignatureKey) => {
|
|
|
300874
300854
|
await keys.set({ "pre-key": newPreKeys });
|
|
300875
300855
|
const preKeys = await getPreKeys(keys, preKeysRange[0], preKeysRange[0] + preKeysRange[1]);
|
|
300876
300856
|
return { update: update2, preKeys };
|
|
300877
|
-
}, getNextPreKeysNode = async (state,
|
|
300857
|
+
}, getNextPreKeysNode = async (state, count) => {
|
|
300878
300858
|
const { creds } = state;
|
|
300879
|
-
const { update: update2, preKeys } = await getNextPreKeys(state,
|
|
300859
|
+
const { update: update2, preKeys } = await getNextPreKeys(state, count);
|
|
300880
300860
|
const node = {
|
|
300881
300861
|
tag: "iq",
|
|
300882
300862
|
attrs: {
|
|
@@ -304166,11 +304146,11 @@ var shorthandToMilliseconds = (shorthand) => {
|
|
|
304166
304146
|
}
|
|
304167
304147
|
this._count--;
|
|
304168
304148
|
}
|
|
304169
|
-
setCount(
|
|
304149
|
+
setCount(count) {
|
|
304170
304150
|
if (!this._enabled) {
|
|
304171
304151
|
return;
|
|
304172
304152
|
}
|
|
304173
|
-
this._count =
|
|
304153
|
+
this._count = count;
|
|
304174
304154
|
}
|
|
304175
304155
|
roughSizeOfString(value) {
|
|
304176
304156
|
return value.length * 2;
|
|
@@ -306386,15 +306366,15 @@ var init_p_timeout = __esm(() => {
|
|
|
306386
306366
|
// node_modules/p-queue/dist/lower-bound.js
|
|
306387
306367
|
function lowerBound(array5, value, comparator) {
|
|
306388
306368
|
let first = 0;
|
|
306389
|
-
let
|
|
306390
|
-
while (
|
|
306391
|
-
const step = Math.trunc(
|
|
306369
|
+
let count = array5.length;
|
|
306370
|
+
while (count > 0) {
|
|
306371
|
+
const step = Math.trunc(count / 2);
|
|
306392
306372
|
let it = first + step;
|
|
306393
306373
|
if (comparator(array5[it], value) <= 0) {
|
|
306394
306374
|
first = ++it;
|
|
306395
|
-
|
|
306375
|
+
count -= step + 1;
|
|
306396
306376
|
} else {
|
|
306397
|
-
|
|
306377
|
+
count = step;
|
|
306398
306378
|
}
|
|
306399
306379
|
}
|
|
306400
306380
|
return first;
|
|
@@ -306885,15 +306865,15 @@ var init_dist10 = __esm(() => {
|
|
|
306885
306865
|
}
|
|
306886
306866
|
return;
|
|
306887
306867
|
}
|
|
306888
|
-
let
|
|
306868
|
+
let count;
|
|
306889
306869
|
if (this.#strict) {
|
|
306890
306870
|
const now = Date.now();
|
|
306891
306871
|
this.#cleanupStrictTicks(now);
|
|
306892
|
-
|
|
306872
|
+
count = this.#getActiveTicksCount();
|
|
306893
306873
|
} else {
|
|
306894
|
-
|
|
306874
|
+
count = this.#intervalCount;
|
|
306895
306875
|
}
|
|
306896
|
-
const shouldBeRateLimited =
|
|
306876
|
+
const shouldBeRateLimited = count >= this.#intervalCap;
|
|
306897
306877
|
if (shouldBeRateLimited !== previous) {
|
|
306898
306878
|
this.#rateLimitedInInterval = shouldBeRateLimited;
|
|
306899
306879
|
this.emit(shouldBeRateLimited ? "rateLimit" : "rateLimitCleared");
|
|
@@ -315548,7 +315528,7 @@ var import_boom11, makeSocket = (config4) => {
|
|
|
315548
315528
|
};
|
|
315549
315529
|
let uploadPreKeysPromise = null;
|
|
315550
315530
|
let lastUploadTime = 0;
|
|
315551
|
-
const uploadPreKeys = async (
|
|
315531
|
+
const uploadPreKeys = async (count = MIN_PREKEY_COUNT, retryCount = 0) => {
|
|
315552
315532
|
if (retryCount === 0) {
|
|
315553
315533
|
const timeSinceLastUpload = Date.now() - lastUploadTime;
|
|
315554
315534
|
if (timeSinceLastUpload < MIN_UPLOAD_INTERVAL) {
|
|
@@ -315561,24 +315541,24 @@ var import_boom11, makeSocket = (config4) => {
|
|
|
315561
315541
|
await uploadPreKeysPromise;
|
|
315562
315542
|
}
|
|
315563
315543
|
const uploadLogic = async () => {
|
|
315564
|
-
logger3.info({ count
|
|
315544
|
+
logger3.info({ count, retryCount }, "uploading pre-keys");
|
|
315565
315545
|
const node = await keys.transaction(async () => {
|
|
315566
|
-
logger3.debug({ requestedCount:
|
|
315567
|
-
const { update: update2, node: node2 } = await getNextPreKeysNode({ creds, keys },
|
|
315546
|
+
logger3.debug({ requestedCount: count }, "generating pre-keys with requested count");
|
|
315547
|
+
const { update: update2, node: node2 } = await getNextPreKeysNode({ creds, keys }, count);
|
|
315568
315548
|
ev.emit("creds.update", update2);
|
|
315569
315549
|
return node2;
|
|
315570
315550
|
}, creds?.me?.id || "upload-pre-keys");
|
|
315571
315551
|
try {
|
|
315572
315552
|
await query2(node);
|
|
315573
|
-
logger3.info({ count
|
|
315553
|
+
logger3.info({ count }, "uploaded pre-keys successfully");
|
|
315574
315554
|
lastUploadTime = Date.now();
|
|
315575
315555
|
} catch (uploadError) {
|
|
315576
|
-
logger3.error({ uploadError: uploadError.toString(), count
|
|
315556
|
+
logger3.error({ uploadError: uploadError.toString(), count }, "Failed to upload pre-keys to server");
|
|
315577
315557
|
if (retryCount < 3) {
|
|
315578
315558
|
const backoffDelay = Math.min(1000 * Math.pow(2, retryCount), 1e4);
|
|
315579
315559
|
logger3.info(`Retrying pre-key upload in ${backoffDelay}ms`);
|
|
315580
315560
|
await new Promise((resolve6) => setTimeout(resolve6, backoffDelay));
|
|
315581
|
-
return uploadPreKeys(
|
|
315561
|
+
return uploadPreKeys(count, retryCount + 1);
|
|
315582
315562
|
}
|
|
315583
315563
|
throw uploadError;
|
|
315584
315564
|
}
|
|
@@ -315604,16 +315584,16 @@ var import_boom11, makeSocket = (config4) => {
|
|
|
315604
315584
|
};
|
|
315605
315585
|
const uploadPreKeysToServerIfRequired = async () => {
|
|
315606
315586
|
try {
|
|
315607
|
-
let
|
|
315587
|
+
let count = 0;
|
|
315608
315588
|
const preKeyCount = await getAvailablePreKeysOnServer();
|
|
315609
315589
|
if (preKeyCount === 0)
|
|
315610
|
-
|
|
315590
|
+
count = INITIAL_PREKEY_COUNT;
|
|
315611
315591
|
else
|
|
315612
|
-
|
|
315592
|
+
count = MIN_PREKEY_COUNT;
|
|
315613
315593
|
const { exists: currentPreKeyExists, currentPreKeyId } = await verifyCurrentPreKeyExists();
|
|
315614
315594
|
logger3.info(`${preKeyCount} pre-keys found on server`);
|
|
315615
315595
|
logger3.info(`Current prekey ID: ${currentPreKeyId}, exists in storage: ${currentPreKeyExists}`);
|
|
315616
|
-
const lowServerCount = preKeyCount <=
|
|
315596
|
+
const lowServerCount = preKeyCount <= count;
|
|
315617
315597
|
const missingCurrentPreKey = !currentPreKeyExists && currentPreKeyId > 0;
|
|
315618
315598
|
const shouldUpload = lowServerCount || missingCurrentPreKey;
|
|
315619
315599
|
if (shouldUpload) {
|
|
@@ -315623,7 +315603,7 @@ var import_boom11, makeSocket = (config4) => {
|
|
|
315623
315603
|
if (missingCurrentPreKey)
|
|
315624
315604
|
reasons.push(`current prekey ${currentPreKeyId} missing from storage`);
|
|
315625
315605
|
logger3.info(`Uploading PreKeys due to: ${reasons.join(", ")}`);
|
|
315626
|
-
await uploadPreKeys(
|
|
315606
|
+
await uploadPreKeys(count);
|
|
315627
315607
|
} else {
|
|
315628
315608
|
logger3.info(`PreKey validation passed - Server: ${preKeyCount}, Current prekey ${currentPreKeyId} exists`);
|
|
315629
315609
|
}
|
|
@@ -317373,9 +317353,9 @@ var parseNewsletterCreateResponse = (response) => {
|
|
|
317373
317353
|
]
|
|
317374
317354
|
});
|
|
317375
317355
|
},
|
|
317376
|
-
newsletterFetchMessages: async (jid,
|
|
317356
|
+
newsletterFetchMessages: async (jid, count, since, after) => {
|
|
317377
317357
|
const messageUpdateAttrs = {
|
|
317378
|
-
count:
|
|
317358
|
+
count: count.toString()
|
|
317379
317359
|
};
|
|
317380
317360
|
if (typeof since === "number") {
|
|
317381
317361
|
messageUpdateAttrs.since = since.toString();
|
|
@@ -318335,7 +318315,7 @@ var import_boom15, makeMessagesRecvSocket = (config4) => {
|
|
|
318335
318315
|
});
|
|
318336
318316
|
const identityAssertDebounce = new index_default({ stdTTL: 5, useClones: false });
|
|
318337
318317
|
let sendActiveReceipts = false;
|
|
318338
|
-
const fetchMessageHistory = async (
|
|
318318
|
+
const fetchMessageHistory = async (count, oldestMsgKey, oldestMsgTimestamp) => {
|
|
318339
318319
|
if (!authState.creds.me?.id) {
|
|
318340
318320
|
throw new import_boom15.Boom("Not authenticated");
|
|
318341
318321
|
}
|
|
@@ -318345,7 +318325,7 @@ var import_boom15, makeMessagesRecvSocket = (config4) => {
|
|
|
318345
318325
|
oldestMsgFromMe: oldestMsgKey.fromMe,
|
|
318346
318326
|
oldestMsgId: oldestMsgKey.id,
|
|
318347
318327
|
oldestMsgTimestampMs: oldestMsgTimestamp,
|
|
318348
|
-
onDemandMsgCount:
|
|
318328
|
+
onDemandMsgCount: count
|
|
318349
318329
|
},
|
|
318350
318330
|
peerDataOperationRequestType: proto.Message.PeerDataOperationRequestType.HISTORY_SYNC_ON_DEMAND
|
|
318351
318331
|
};
|
|
@@ -318677,9 +318657,9 @@ var import_boom15, makeMessagesRecvSocket = (config4) => {
|
|
|
318677
318657
|
const from = node.attrs.from;
|
|
318678
318658
|
if (from === S_WHATSAPP_NET) {
|
|
318679
318659
|
const countChild = getBinaryNodeChild(node, "count");
|
|
318680
|
-
const
|
|
318681
|
-
const shouldUploadMorePreKeys =
|
|
318682
|
-
logger3.debug({ count
|
|
318660
|
+
const count = +countChild.attrs.value;
|
|
318661
|
+
const shouldUploadMorePreKeys = count < MIN_PREKEY_COUNT;
|
|
318662
|
+
logger3.debug({ count, shouldUploadMorePreKeys }, "recv pre-key count");
|
|
318683
318663
|
if (shouldUploadMorePreKeys) {
|
|
318684
318664
|
await uploadPreKeys();
|
|
318685
318665
|
}
|
|
@@ -322161,19 +322141,19 @@ var require_chunkstream = __commonJS((exports, module) => {
|
|
|
322161
322141
|
ChunkStream.prototype._processRead = function(read) {
|
|
322162
322142
|
this._reads.shift();
|
|
322163
322143
|
let pos = 0;
|
|
322164
|
-
let
|
|
322144
|
+
let count = 0;
|
|
322165
322145
|
let data = Buffer.alloc(read.length);
|
|
322166
322146
|
while (pos < read.length) {
|
|
322167
|
-
let buf = this._buffers[
|
|
322147
|
+
let buf = this._buffers[count++];
|
|
322168
322148
|
let len = Math.min(buf.length, read.length - pos);
|
|
322169
322149
|
buf.copy(data, pos, 0, len);
|
|
322170
322150
|
pos += len;
|
|
322171
322151
|
if (len !== buf.length) {
|
|
322172
|
-
this._buffers[--
|
|
322152
|
+
this._buffers[--count] = buf.slice(len);
|
|
322173
322153
|
}
|
|
322174
322154
|
}
|
|
322175
|
-
if (
|
|
322176
|
-
this._buffers.splice(0,
|
|
322155
|
+
if (count > 0) {
|
|
322156
|
+
this._buffers.splice(0, count);
|
|
322177
322157
|
}
|
|
322178
322158
|
this._buffered -= read.length;
|
|
322179
322159
|
read.func.call(this, data);
|
|
@@ -322845,12 +322825,12 @@ var require_bitmapper = __commonJS((exports) => {
|
|
|
322845
322825
|
}
|
|
322846
322826
|
}
|
|
322847
322827
|
return {
|
|
322848
|
-
get: function(
|
|
322849
|
-
while (leftOver.length <
|
|
322828
|
+
get: function(count) {
|
|
322829
|
+
while (leftOver.length < count) {
|
|
322850
322830
|
split();
|
|
322851
322831
|
}
|
|
322852
|
-
let returner = leftOver.slice(0,
|
|
322853
|
-
leftOver = leftOver.slice(
|
|
322832
|
+
let returner = leftOver.slice(0, count);
|
|
322833
|
+
leftOver = leftOver.slice(count);
|
|
322854
322834
|
return returner;
|
|
322855
322835
|
},
|
|
322856
322836
|
resetAfterLine: function() {
|
|
@@ -331964,8 +331944,8 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
331964
331944
|
return deprecate;
|
|
331965
331945
|
}
|
|
331966
331946
|
function eehaslisteners(emitter, type) {
|
|
331967
|
-
var
|
|
331968
|
-
return
|
|
331947
|
+
var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type);
|
|
331948
|
+
return count > 0;
|
|
331969
331949
|
}
|
|
331970
331950
|
function isignored(namespace) {
|
|
331971
331951
|
if (process.noDeprecation) {
|
|
@@ -353762,15 +353742,15 @@ var require_urlencoded = __commonJS((exports, module) => {
|
|
|
353762
353742
|
};
|
|
353763
353743
|
}
|
|
353764
353744
|
function parameterCount(body, limit2) {
|
|
353765
|
-
let
|
|
353745
|
+
let count = 0;
|
|
353766
353746
|
let index = -1;
|
|
353767
353747
|
do {
|
|
353768
|
-
|
|
353769
|
-
if (
|
|
353748
|
+
count++;
|
|
353749
|
+
if (count > limit2)
|
|
353770
353750
|
return;
|
|
353771
353751
|
index = body.indexOf("&", index + 1);
|
|
353772
353752
|
} while (index !== -1);
|
|
353773
|
-
return
|
|
353753
|
+
return count;
|
|
353774
353754
|
}
|
|
353775
353755
|
});
|
|
353776
353756
|
|
|
@@ -356578,13 +356558,13 @@ var require_mediaType = __commonJS((exports, module) => {
|
|
|
356578
356558
|
return spec.q > 0;
|
|
356579
356559
|
}
|
|
356580
356560
|
function quoteCount(string8) {
|
|
356581
|
-
var
|
|
356561
|
+
var count = 0;
|
|
356582
356562
|
var index = 0;
|
|
356583
356563
|
while ((index = string8.indexOf('"', index)) !== -1) {
|
|
356584
|
-
|
|
356564
|
+
count++;
|
|
356585
356565
|
index++;
|
|
356586
356566
|
}
|
|
356587
|
-
return
|
|
356567
|
+
return count;
|
|
356588
356568
|
}
|
|
356589
356569
|
function splitKeyValuePair(str) {
|
|
356590
356570
|
var index = str.indexOf("=");
|
|
@@ -357899,8 +357879,8 @@ var require_send = __commonJS((exports, module) => {
|
|
|
357899
357879
|
}
|
|
357900
357880
|
}
|
|
357901
357881
|
function hasListeners(emitter, type) {
|
|
357902
|
-
var
|
|
357903
|
-
return
|
|
357882
|
+
var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type);
|
|
357883
|
+
return count > 0;
|
|
357904
357884
|
}
|
|
357905
357885
|
function normalizeList(val, name) {
|
|
357906
357886
|
var list = [].concat(val || []);
|
|
@@ -408269,15 +408249,15 @@ var init_imap_flow = __esm(() => {
|
|
|
408269
408249
|
if (!untagged || !untagged.command || isNaN(untagged.command)) {
|
|
408270
408250
|
return;
|
|
408271
408251
|
}
|
|
408272
|
-
let
|
|
408273
|
-
if (
|
|
408252
|
+
let count = Number(untagged.command);
|
|
408253
|
+
if (count === this.mailbox.exists) {
|
|
408274
408254
|
return;
|
|
408275
408255
|
}
|
|
408276
408256
|
let prevCount = this.mailbox.exists;
|
|
408277
|
-
this.mailbox.exists =
|
|
408257
|
+
this.mailbox.exists = count;
|
|
408278
408258
|
this.emit("exists", {
|
|
408279
408259
|
path: this.mailbox.path,
|
|
408280
|
-
count
|
|
408260
|
+
count,
|
|
408281
408261
|
prevCount
|
|
408282
408262
|
});
|
|
408283
408263
|
}
|
|
@@ -411430,15 +411410,15 @@ ${context.metadata?.threadId ? `**Thread ID**: ${context.metadata.threadId}` : "
|
|
|
411430
411410
|
|
|
411431
411411
|
2. **Take appropriate action(s)**:
|
|
411432
411412
|
- **Simple conversations**: Just use \`message\` to reply - no tracking needed for "hi", "thanks", general questions
|
|
411433
|
-
- **Actionable requests**:
|
|
411434
|
-
- **Spam/newsletters**: Silently ignore (no response
|
|
411413
|
+
- **Actionable requests**: Store a memory (via \`memory_store\`) with tag \`actionable\`, optionally create a Fulcrum task
|
|
411414
|
+
- **Spam/newsletters**: Silently ignore (no response)
|
|
411435
411415
|
|
|
411436
411416
|
## Important
|
|
411437
411417
|
|
|
411438
|
-
- **You don't need to
|
|
411439
|
-
- Simple greetings, questions, and conversations can be answered directly without any
|
|
411418
|
+
- **You don't need to store a memory for every message** - only for things that need tracking/follow-up
|
|
411419
|
+
- Simple greetings, questions, and conversations can be answered directly without any memory tracking
|
|
411440
411420
|
- For replies, use the \`message\` tool with: channel="${context.channel}", to="${context.sender}"${context.metadata?.messageId ? `, replyToMessageId="${context.metadata.messageId}"` : ""}
|
|
411441
|
-
- Only
|
|
411421
|
+
- Only store memories with tag \`actionable\` for requests, reminders, or things you need to remember
|
|
411442
411422
|
- Spam, newsletters, and automated notifications should be ignored (no response)
|
|
411443
411423
|
|
|
411444
411424
|
${formattingGuide}`;
|
|
@@ -411462,13 +411442,11 @@ ${context.metadata?.isGroup ? `**Group Chat**: yes` : ""}
|
|
|
411462
411442
|
|
|
411463
411443
|
Silently analyze this message and decide if it needs to be tracked:
|
|
411464
411444
|
|
|
411465
|
-
1. **Actionable requests directed at the user** (deadlines, meetings, tasks) \u2192
|
|
411466
|
-
2. **Important information** (confirmations, updates about ongoing matters) \u2192
|
|
411445
|
+
1. **Actionable requests directed at the user** (deadlines, meetings, tasks) \u2192 Store a memory with tag \`actionable\`
|
|
411446
|
+
2. **Important information** (confirmations, updates about ongoing matters) \u2192 Store a memory with tag \`monitoring\`
|
|
411467
411447
|
3. **Casual messages, spam, or irrelevant content** \u2192 Do nothing
|
|
411468
411448
|
|
|
411469
|
-
|
|
411470
|
-
- \`pending\` - Needs attention/action
|
|
411471
|
-
- \`monitoring\` - Worth tracking but no immediate action needed
|
|
411449
|
+
Use \`memory_store\` to persist important observations. Include the source channel as the \`source\` field (e.g., "channel:${context.channel}").
|
|
411472
411450
|
|
|
411473
411451
|
**Remember: NO responses. Observe only.**`;
|
|
411474
411452
|
}
|
|
@@ -411481,32 +411459,31 @@ You are performing your hourly sweep.
|
|
|
411481
411459
|
|
|
411482
411460
|
**Context:**
|
|
411483
411461
|
- Last sweep completed: ${context.lastSweepTime ?? "never"}
|
|
411484
|
-
-
|
|
411462
|
+
- Memories tagged 'actionable': ${context.actionableMemoryCount}
|
|
411485
411463
|
- Open Fulcrum tasks (TO_DO + IN_PROGRESS + IN_REVIEW): ${context.openTaskCount}
|
|
411486
411464
|
|
|
411487
411465
|
## Your Task
|
|
411488
411466
|
|
|
411489
|
-
1. **Review actionable
|
|
411490
|
-
-
|
|
411491
|
-
-
|
|
411492
|
-
-
|
|
411493
|
-
- Events that should be linked to tasks
|
|
411467
|
+
1. **Review actionable memories** - use \`memory_search\` to find memories tagged \`actionable\` or \`monitoring\` and check for:
|
|
411468
|
+
- Items that have been resolved (delete the memory or remove the tag)
|
|
411469
|
+
- Patterns or connections between tracked items
|
|
411470
|
+
- Items that should be linked to tasks
|
|
411494
411471
|
|
|
411495
411472
|
2. **Review Fulcrum tasks** - use \`list_tasks\` to get tasks that are TO_DO, IN_PROGRESS, or IN_REVIEW:
|
|
411496
411473
|
- Any that need attention or follow-up?
|
|
411497
|
-
- Any related to
|
|
411474
|
+
- Any related to tracked memories?
|
|
411498
411475
|
- Any blocked or overdue?
|
|
411499
411476
|
|
|
411500
411477
|
3. **Catch up** - if you find messages that weren't properly handled:
|
|
411501
|
-
-
|
|
411478
|
+
- Store memories with tag \`actionable\` for missed items
|
|
411502
411479
|
- Take action if still relevant
|
|
411503
411480
|
|
|
411504
|
-
4. **Update your records** -
|
|
411481
|
+
4. **Update your records** - delete resolved memories or update their tags
|
|
411505
411482
|
|
|
411506
411483
|
## Output
|
|
411507
411484
|
|
|
411508
411485
|
After completing your sweep, provide a brief summary of:
|
|
411509
|
-
-
|
|
411486
|
+
- Memories reviewed and actions taken
|
|
411510
411487
|
- Tasks updated or created
|
|
411511
411488
|
- Any patterns noticed
|
|
411512
411489
|
- Items requiring user attention`;
|
|
@@ -411631,7 +411608,7 @@ async function handleIncomingMessage(msg) {
|
|
|
411631
411608
|
channelType: msg.channelType,
|
|
411632
411609
|
senderId: msg.senderId
|
|
411633
411610
|
});
|
|
411634
|
-
await
|
|
411611
|
+
await processObserveOnlyMessage(msg);
|
|
411635
411612
|
return;
|
|
411636
411613
|
}
|
|
411637
411614
|
if (COMMANDS.RESET.some((cmd) => content.toLowerCase() === cmd)) {
|
|
@@ -411848,7 +411825,7 @@ function splitMessage(content, maxLength) {
|
|
|
411848
411825
|
}
|
|
411849
411826
|
return parts;
|
|
411850
411827
|
}
|
|
411851
|
-
async function
|
|
411828
|
+
async function processObserveOnlyMessage(msg) {
|
|
411852
411829
|
const observeSessionKey = `observe-${msg.connectionId}`;
|
|
411853
411830
|
const { session: session3 } = getOrCreateSession(msg.connectionId, observeSessionKey, "Observer");
|
|
411854
411831
|
const context = {
|
|
@@ -411872,7 +411849,7 @@ async function processForActionableEvents(msg) {
|
|
|
411872
411849
|
for await (const event of stream3) {
|
|
411873
411850
|
if (event.type === "error") {
|
|
411874
411851
|
const errorMsg = event.data.message;
|
|
411875
|
-
log2.messaging.error("
|
|
411852
|
+
log2.messaging.error("Error in observe-only message processing", { error: errorMsg });
|
|
411876
411853
|
}
|
|
411877
411854
|
}
|
|
411878
411855
|
} catch (err) {
|
|
@@ -421843,8 +421820,8 @@ app2.post("/:id/kill-claude", (c) => {
|
|
|
421843
421820
|
return c.json({ success: true, terminalsAffected: 0 });
|
|
421844
421821
|
}
|
|
421845
421822
|
try {
|
|
421846
|
-
const
|
|
421847
|
-
return c.json({ success: true, terminalsAffected:
|
|
421823
|
+
const count = killClaudeInTerminalsForWorktree(task.worktreePath);
|
|
421824
|
+
return c.json({ success: true, terminalsAffected: count });
|
|
421848
421825
|
} catch {
|
|
421849
421826
|
return c.json({ success: true, terminalsAffected: 0 });
|
|
421850
421827
|
}
|
|
@@ -423350,17 +423327,17 @@ app4.post("/edit", async (c) => {
|
|
|
423350
423327
|
return c.json({ error: "Path is not a file" }, 400);
|
|
423351
423328
|
}
|
|
423352
423329
|
const content = fs10.readFileSync(resolvedPath, "utf-8");
|
|
423353
|
-
let
|
|
423330
|
+
let count = 0;
|
|
423354
423331
|
let index = 0;
|
|
423355
423332
|
while ((index = content.indexOf(old_string, index)) !== -1) {
|
|
423356
|
-
|
|
423333
|
+
count++;
|
|
423357
423334
|
index += old_string.length;
|
|
423358
423335
|
}
|
|
423359
|
-
if (
|
|
423336
|
+
if (count === 0) {
|
|
423360
423337
|
return c.json({ error: "String not found in file" }, 400);
|
|
423361
423338
|
}
|
|
423362
|
-
if (
|
|
423363
|
-
return c.json({ error: `String found ${
|
|
423339
|
+
if (count > 1) {
|
|
423340
|
+
return c.json({ error: `String found ${count} times, provide more context to make it unique` }, 400);
|
|
423364
423341
|
}
|
|
423365
423342
|
const newContent = content.replace(old_string, new_string);
|
|
423366
423343
|
fs10.writeFileSync(resolvedPath, newContent, "utf-8");
|
|
@@ -455723,8 +455700,8 @@ function az_default() {
|
|
|
455723
455700
|
};
|
|
455724
455701
|
}
|
|
455725
455702
|
// node_modules/zod/v4/locales/be.js
|
|
455726
|
-
function getBelarusianPlural(
|
|
455727
|
-
const absCount = Math.abs(
|
|
455703
|
+
function getBelarusianPlural(count, one, few, many) {
|
|
455704
|
+
const absCount = Math.abs(count);
|
|
455728
455705
|
const lastDigit = absCount % 10;
|
|
455729
455706
|
const lastTwoDigits = absCount % 100;
|
|
455730
455707
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -459474,8 +459451,8 @@ function pt_default() {
|
|
|
459474
459451
|
};
|
|
459475
459452
|
}
|
|
459476
459453
|
// node_modules/zod/v4/locales/ru.js
|
|
459477
|
-
function getRussianPlural(
|
|
459478
|
-
const absCount = Math.abs(
|
|
459454
|
+
function getRussianPlural(count, one, few, many) {
|
|
459455
|
+
const absCount = Math.abs(count);
|
|
459479
459456
|
const lastDigit = absCount % 10;
|
|
459480
459457
|
const lastTwoDigits = absCount % 100;
|
|
459481
459458
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -464310,6 +464287,13 @@ var toolRegistry = [
|
|
|
464310
464287
|
keywords: ["tags", "categories", "filter", "search", "discover"],
|
|
464311
464288
|
defer_loading: false
|
|
464312
464289
|
},
|
|
464290
|
+
{
|
|
464291
|
+
name: "delete_tag",
|
|
464292
|
+
description: "Delete a tag from the database and all its associations",
|
|
464293
|
+
category: "tasks",
|
|
464294
|
+
keywords: ["tag", "delete", "remove", "cleanup"],
|
|
464295
|
+
defer_loading: false
|
|
464296
|
+
},
|
|
464313
464297
|
{
|
|
464314
464298
|
name: "list_task_attachments",
|
|
464315
464299
|
description: "List all file attachments for a task",
|
|
@@ -464471,41 +464455,6 @@ var toolRegistry = [
|
|
|
464471
464455
|
keywords: ["message", "send", "reply", "email", "whatsapp", "communicate", "respond"],
|
|
464472
464456
|
defer_loading: false
|
|
464473
464457
|
},
|
|
464474
|
-
{
|
|
464475
|
-
name: "create_actionable_event",
|
|
464476
|
-
description: "Create an actionable event to track something noticed",
|
|
464477
|
-
category: "assistant",
|
|
464478
|
-
keywords: ["event", "actionable", "track", "remember", "log", "decision", "memory"],
|
|
464479
|
-
defer_loading: false
|
|
464480
|
-
},
|
|
464481
|
-
{
|
|
464482
|
-
name: "list_actionable_events",
|
|
464483
|
-
description: "List actionable events by status or channel",
|
|
464484
|
-
category: "assistant",
|
|
464485
|
-
keywords: ["event", "actionable", "list", "pending", "review", "memory"],
|
|
464486
|
-
defer_loading: false
|
|
464487
|
-
},
|
|
464488
|
-
{
|
|
464489
|
-
name: "get_actionable_event",
|
|
464490
|
-
description: "Get details of a specific actionable event",
|
|
464491
|
-
category: "assistant",
|
|
464492
|
-
keywords: ["event", "actionable", "get", "details", "history"],
|
|
464493
|
-
defer_loading: false
|
|
464494
|
-
},
|
|
464495
|
-
{
|
|
464496
|
-
name: "update_actionable_event",
|
|
464497
|
-
description: "Update an actionable event status or link to a task",
|
|
464498
|
-
category: "assistant",
|
|
464499
|
-
keywords: ["event", "actionable", "update", "status", "link", "task", "log"],
|
|
464500
|
-
defer_loading: false
|
|
464501
|
-
},
|
|
464502
|
-
{
|
|
464503
|
-
name: "get_assistant_stats",
|
|
464504
|
-
description: "Get assistant statistics: event counts by status and last sweep times",
|
|
464505
|
-
category: "assistant",
|
|
464506
|
-
keywords: ["assistant", "stats", "statistics", "events", "sweep", "summary"],
|
|
464507
|
-
defer_loading: false
|
|
464508
|
-
},
|
|
464509
464458
|
{
|
|
464510
464459
|
name: "get_last_sweep",
|
|
464511
464460
|
description: "Get information about the last sweep run of a type",
|
|
@@ -465036,9 +464985,9 @@ var registerTaskTools = (server, client) => {
|
|
|
465036
464985
|
}
|
|
465037
464986
|
}
|
|
465038
464987
|
}
|
|
465039
|
-
let tags2 = Array.from(tagCounts.entries()).map(([name,
|
|
464988
|
+
let tags2 = Array.from(tagCounts.entries()).map(([name, count]) => ({
|
|
465040
464989
|
name,
|
|
465041
|
-
count
|
|
464990
|
+
count
|
|
465042
464991
|
}));
|
|
465043
464992
|
if (search) {
|
|
465044
464993
|
const searchLower = search.toLowerCase();
|
|
@@ -465050,6 +464999,16 @@ var registerTaskTools = (server, client) => {
|
|
|
465050
464999
|
return handleToolError(err);
|
|
465051
465000
|
}
|
|
465052
465001
|
});
|
|
465002
|
+
server.tool("delete_tag", "Delete a tag from the database. This removes the tag and all its associations with tasks and projects.", {
|
|
465003
|
+
tag: exports_external.string().describe("The exact name of the tag to delete")
|
|
465004
|
+
}, async ({ tag }) => {
|
|
465005
|
+
try {
|
|
465006
|
+
await client.deleteTag(tag);
|
|
465007
|
+
return formatSuccess({ deleted: tag });
|
|
465008
|
+
} catch (err) {
|
|
465009
|
+
return handleToolError(err);
|
|
465010
|
+
}
|
|
465011
|
+
});
|
|
465053
465012
|
server.tool("list_tasks_by_due_date", "List tasks within a date range based on due date", {
|
|
465054
465013
|
startDate: exports_external.optional(exports_external.string()).describe("Start date (YYYY-MM-DD), inclusive"),
|
|
465055
465014
|
endDate: exports_external.optional(exports_external.string()).describe("End date (YYYY-MM-DD), inclusive"),
|
|
@@ -465938,10 +465897,9 @@ var registerEmailTools = (server, client) => {
|
|
|
465938
465897
|
});
|
|
465939
465898
|
};
|
|
465940
465899
|
|
|
465941
|
-
// cli/src/mcp/tools/assistant
|
|
465942
|
-
var ActionableEventStatusSchema = exports_external.enum(["pending", "acted_upon", "dismissed", "monitoring"]);
|
|
465900
|
+
// cli/src/mcp/tools/assistant.ts
|
|
465943
465901
|
var ChannelSchema = exports_external.enum(["email", "whatsapp", "discord", "telegram", "slack", "all"]);
|
|
465944
|
-
var
|
|
465902
|
+
var registerAssistantTools = (server, client) => {
|
|
465945
465903
|
server.tool("message", "Send a message to a messaging channel (email, WhatsApp, etc.). Use this to reply to messages or send proactive communications.", {
|
|
465946
465904
|
channel: ChannelSchema.describe("Target channel: email, whatsapp, discord, telegram, slack, or all"),
|
|
465947
465905
|
to: exports_external.string().describe("Recipient (email address, phone number, or channel ID)"),
|
|
@@ -465964,79 +465922,6 @@ var registerAssistantEventTools = (server, client) => {
|
|
|
465964
465922
|
return handleToolError(err);
|
|
465965
465923
|
}
|
|
465966
465924
|
});
|
|
465967
|
-
server.tool("create_actionable_event", "Create an actionable event to track something noticed (message, request, etc.). Use this to log decisions and maintain memory of things that need attention.", {
|
|
465968
|
-
source_channel: ChannelSchema.exclude(["all"]).describe("Channel where the event originated"),
|
|
465969
|
-
source_id: exports_external.string().describe("ID of the source message/email"),
|
|
465970
|
-
source_metadata: exports_external.optional(exports_external.record(exports_external.string(), exports_external.any())).describe("Additional context (sender, subject, etc.)"),
|
|
465971
|
-
summary: exports_external.optional(exports_external.string()).describe("AI-generated description of what this event is about"),
|
|
465972
|
-
status: exports_external.optional(ActionableEventStatusSchema).describe("Event status (default: pending)"),
|
|
465973
|
-
linked_task_id: exports_external.optional(exports_external.string()).describe("Fulcrum task ID if this event relates to a task")
|
|
465974
|
-
}, async ({ source_channel, source_id, source_metadata, summary, status, linked_task_id }) => {
|
|
465975
|
-
try {
|
|
465976
|
-
const result = await client.createActionableEvent({
|
|
465977
|
-
sourceChannel: source_channel,
|
|
465978
|
-
sourceId: source_id,
|
|
465979
|
-
sourceMetadata: source_metadata,
|
|
465980
|
-
summary,
|
|
465981
|
-
status,
|
|
465982
|
-
linkedTaskId: linked_task_id
|
|
465983
|
-
});
|
|
465984
|
-
return formatSuccess(result);
|
|
465985
|
-
} catch (err) {
|
|
465986
|
-
return handleToolError(err);
|
|
465987
|
-
}
|
|
465988
|
-
});
|
|
465989
|
-
server.tool("list_actionable_events", "List actionable events. Use this to review what needs attention, check for patterns, or avoid creating duplicates.", {
|
|
465990
|
-
status: exports_external.optional(ActionableEventStatusSchema).describe("Filter by status"),
|
|
465991
|
-
source_channel: exports_external.optional(exports_external.string()).describe("Filter by source channel"),
|
|
465992
|
-
limit: exports_external.optional(exports_external.number()).describe("Maximum events to return (default: 50)")
|
|
465993
|
-
}, async ({ status, source_channel, limit: limit2 }) => {
|
|
465994
|
-
try {
|
|
465995
|
-
const result = await client.listActionableEvents({
|
|
465996
|
-
status,
|
|
465997
|
-
channel: source_channel,
|
|
465998
|
-
limit: limit2 ?? 50
|
|
465999
|
-
});
|
|
466000
|
-
return formatSuccess(result);
|
|
466001
|
-
} catch (err) {
|
|
466002
|
-
return handleToolError(err);
|
|
466003
|
-
}
|
|
466004
|
-
});
|
|
466005
|
-
server.tool("get_actionable_event", "Get details of a specific actionable event including its action log and linked task.", {
|
|
466006
|
-
id: exports_external.string().describe("Event ID")
|
|
466007
|
-
}, async ({ id }) => {
|
|
466008
|
-
try {
|
|
466009
|
-
const result = await client.getActionableEvent(id);
|
|
466010
|
-
return formatSuccess(result);
|
|
466011
|
-
} catch (err) {
|
|
466012
|
-
return handleToolError(err);
|
|
466013
|
-
}
|
|
466014
|
-
});
|
|
466015
|
-
server.tool("update_actionable_event", "Update an actionable event status, link it to a task, or add to its action log. Use action_log_entry to record decisions/actions taken.", {
|
|
466016
|
-
id: exports_external.string().describe("Event ID"),
|
|
466017
|
-
status: exports_external.optional(ActionableEventStatusSchema).describe("New status"),
|
|
466018
|
-
linked_task_id: exports_external.optional(exports_external.string()).describe("Link to a Fulcrum task (use empty string to unlink)"),
|
|
466019
|
-
action_log_entry: exports_external.optional(exports_external.string()).describe('Action to log (e.g., "Replied with project update")')
|
|
466020
|
-
}, async ({ id, status, linked_task_id, action_log_entry }) => {
|
|
466021
|
-
try {
|
|
466022
|
-
const result = await client.updateActionableEvent(id, {
|
|
466023
|
-
status,
|
|
466024
|
-
linkedTaskId: linked_task_id === "" ? null : linked_task_id,
|
|
466025
|
-
actionLogEntry: action_log_entry
|
|
466026
|
-
});
|
|
466027
|
-
return formatSuccess(result);
|
|
466028
|
-
} catch (err) {
|
|
466029
|
-
return handleToolError(err);
|
|
466030
|
-
}
|
|
466031
|
-
});
|
|
466032
|
-
server.tool("get_assistant_stats", "Get assistant statistics: event counts by status and last sweep times. Useful for understanding workload and activity.", {}, async () => {
|
|
466033
|
-
try {
|
|
466034
|
-
const result = await client.getAssistantStats();
|
|
466035
|
-
return formatSuccess(result);
|
|
466036
|
-
} catch (err) {
|
|
466037
|
-
return handleToolError(err);
|
|
466038
|
-
}
|
|
466039
|
-
});
|
|
466040
465925
|
server.tool("get_last_sweep", "Get information about the last sweep run of a specific type. Useful for context about what was last reviewed.", {
|
|
466041
465926
|
type: exports_external.enum(["hourly", "morning_ritual", "evening_ritual"]).describe("Type of sweep")
|
|
466042
465927
|
}, async ({ type }) => {
|
|
@@ -466191,7 +466076,7 @@ function registerTools(server, client) {
|
|
|
466191
466076
|
registerSettingsTools(server, client);
|
|
466192
466077
|
registerBackupTools(server, client);
|
|
466193
466078
|
registerEmailTools(server, client);
|
|
466194
|
-
|
|
466079
|
+
registerAssistantTools(server, client);
|
|
466195
466080
|
registerCaldavTools(server, client);
|
|
466196
466081
|
registerMemoryTools(server, client);
|
|
466197
466082
|
}
|
|
@@ -466492,6 +466377,13 @@ class FulcrumClient {
|
|
|
466492
466377
|
method: "DELETE"
|
|
466493
466378
|
});
|
|
466494
466379
|
}
|
|
466380
|
+
async deleteTag(tagName) {
|
|
466381
|
+
const allTags = await this.fetch("/api/tags");
|
|
466382
|
+
const tag = allTags.find((t) => t.name === tagName);
|
|
466383
|
+
if (!tag)
|
|
466384
|
+
throw new ApiError(404, "Tag not found");
|
|
466385
|
+
return this.fetch(`/api/tags/${tag.id}`, { method: "DELETE" });
|
|
466386
|
+
}
|
|
466495
466387
|
async setTaskDueDate(taskId, dueDate) {
|
|
466496
466388
|
return this.fetch(`/api/tasks/${taskId}/due-date`, {
|
|
466497
466389
|
method: "PATCH",
|
|
@@ -466782,39 +466674,6 @@ class FulcrumClient {
|
|
|
466782
466674
|
body: JSON.stringify({ uids, limit: limit2 })
|
|
466783
466675
|
});
|
|
466784
466676
|
}
|
|
466785
|
-
async listActionableEvents(options) {
|
|
466786
|
-
const params = new URLSearchParams;
|
|
466787
|
-
if (options?.status)
|
|
466788
|
-
params.set("status", options.status);
|
|
466789
|
-
if (options?.channel)
|
|
466790
|
-
params.set("channel", options.channel);
|
|
466791
|
-
if (options?.limit)
|
|
466792
|
-
params.set("limit", String(options.limit));
|
|
466793
|
-
if (options?.offset)
|
|
466794
|
-
params.set("offset", String(options.offset));
|
|
466795
|
-
const query = params.toString();
|
|
466796
|
-
return this.fetch(`/api/assistant/events${query ? `?${query}` : ""}`);
|
|
466797
|
-
}
|
|
466798
|
-
async getActionableEvent(id) {
|
|
466799
|
-
return this.fetch(`/api/assistant/events/${id}`);
|
|
466800
|
-
}
|
|
466801
|
-
async createActionableEvent(data) {
|
|
466802
|
-
return this.fetch("/api/assistant/events", {
|
|
466803
|
-
method: "POST",
|
|
466804
|
-
body: JSON.stringify(data)
|
|
466805
|
-
});
|
|
466806
|
-
}
|
|
466807
|
-
async updateActionableEvent(id, updates) {
|
|
466808
|
-
return this.fetch(`/api/assistant/events/${id}`, {
|
|
466809
|
-
method: "PATCH",
|
|
466810
|
-
body: JSON.stringify(updates)
|
|
466811
|
-
});
|
|
466812
|
-
}
|
|
466813
|
-
async deleteActionableEvent(id) {
|
|
466814
|
-
return this.fetch(`/api/assistant/events/${id}`, {
|
|
466815
|
-
method: "DELETE"
|
|
466816
|
-
});
|
|
466817
|
-
}
|
|
466818
466677
|
async listSweepRuns(options) {
|
|
466819
466678
|
const params = new URLSearchParams;
|
|
466820
466679
|
if (options?.type)
|
|
@@ -466906,9 +466765,6 @@ class FulcrumClient {
|
|
|
466906
466765
|
async deleteMemory(id) {
|
|
466907
466766
|
return this.fetch(`/api/memory/${id}`, { method: "DELETE" });
|
|
466908
466767
|
}
|
|
466909
|
-
async getAssistantStats() {
|
|
466910
|
-
return this.fetch("/api/assistant/stats");
|
|
466911
|
-
}
|
|
466912
466768
|
}
|
|
466913
466769
|
|
|
466914
466770
|
// server/routes/mcp.ts
|
|
@@ -466922,7 +466778,7 @@ mcpRoutes.all("/", async (c) => {
|
|
|
466922
466778
|
});
|
|
466923
466779
|
const server = new McpServer({
|
|
466924
466780
|
name: "fulcrum",
|
|
466925
|
-
version: "2.
|
|
466781
|
+
version: "2.9.0"
|
|
466926
466782
|
});
|
|
466927
466783
|
const client = new FulcrumClient(`http://localhost:${port}`);
|
|
466928
466784
|
registerTools(server, client);
|
|
@@ -469038,7 +468894,6 @@ chatRoutes.delete("/:sessionId", async (c) => {
|
|
|
469038
468894
|
var chat_default = chatRoutes;
|
|
469039
468895
|
|
|
469040
468896
|
// server/routes/assistant.ts
|
|
469041
|
-
init_nanoid();
|
|
469042
468897
|
init_db2();
|
|
469043
468898
|
init_schema();
|
|
469044
468899
|
init_drizzle_orm();
|
|
@@ -469246,113 +469101,6 @@ assistantRoutes.delete("/documents/:sessionId", async (c) => {
|
|
|
469246
469101
|
return c.json({ error: message }, 500);
|
|
469247
469102
|
}
|
|
469248
469103
|
});
|
|
469249
|
-
assistantRoutes.get("/events", async (c) => {
|
|
469250
|
-
const status = c.req.query("status");
|
|
469251
|
-
const channel = c.req.query("channel");
|
|
469252
|
-
const limit2 = parseInt(c.req.query("limit") || "50");
|
|
469253
|
-
const offset = parseInt(c.req.query("offset") || "0");
|
|
469254
|
-
try {
|
|
469255
|
-
const conditions2 = [];
|
|
469256
|
-
if (status) {
|
|
469257
|
-
conditions2.push(eq(actionableEvents.status, status));
|
|
469258
|
-
}
|
|
469259
|
-
if (channel) {
|
|
469260
|
-
conditions2.push(eq(actionableEvents.sourceChannel, channel));
|
|
469261
|
-
}
|
|
469262
|
-
const whereClause = conditions2.length > 0 ? and(...conditions2) : undefined;
|
|
469263
|
-
const events = db2.select().from(actionableEvents).where(whereClause).orderBy(desc(actionableEvents.createdAt)).limit(limit2).offset(offset).all();
|
|
469264
|
-
const [{ total }] = db2.select({ total: count() }).from(actionableEvents).where(whereClause).all();
|
|
469265
|
-
return c.json({ events, total });
|
|
469266
|
-
} catch (err) {
|
|
469267
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
469268
|
-
return c.json({ error: message }, 500);
|
|
469269
|
-
}
|
|
469270
|
-
});
|
|
469271
|
-
assistantRoutes.get("/events/:id", async (c) => {
|
|
469272
|
-
const id = c.req.param("id");
|
|
469273
|
-
try {
|
|
469274
|
-
const event = db2.select().from(actionableEvents).where(eq(actionableEvents.id, id)).get();
|
|
469275
|
-
if (!event) {
|
|
469276
|
-
return c.json({ error: "Event not found" }, 404);
|
|
469277
|
-
}
|
|
469278
|
-
let linkedTask = null;
|
|
469279
|
-
if (event.linkedTaskId) {
|
|
469280
|
-
linkedTask = db2.select().from(tasks).where(eq(tasks.id, event.linkedTaskId)).get();
|
|
469281
|
-
}
|
|
469282
|
-
return c.json({ ...event, linkedTask });
|
|
469283
|
-
} catch (err) {
|
|
469284
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
469285
|
-
return c.json({ error: message }, 500);
|
|
469286
|
-
}
|
|
469287
|
-
});
|
|
469288
|
-
assistantRoutes.post("/events", async (c) => {
|
|
469289
|
-
const body = await c.req.json();
|
|
469290
|
-
if (!body.sourceChannel || !body.sourceId) {
|
|
469291
|
-
return c.json({ error: "sourceChannel and sourceId are required" }, 400);
|
|
469292
|
-
}
|
|
469293
|
-
try {
|
|
469294
|
-
const now = new Date().toISOString();
|
|
469295
|
-
const event = {
|
|
469296
|
-
id: nanoid(),
|
|
469297
|
-
sourceChannel: body.sourceChannel,
|
|
469298
|
-
sourceId: body.sourceId,
|
|
469299
|
-
sourceMetadata: body.sourceMetadata,
|
|
469300
|
-
summary: body.summary,
|
|
469301
|
-
status: body.status || "pending",
|
|
469302
|
-
linkedTaskId: body.linkedTaskId,
|
|
469303
|
-
actionLog: [],
|
|
469304
|
-
createdAt: now,
|
|
469305
|
-
updatedAt: now
|
|
469306
|
-
};
|
|
469307
|
-
db2.insert(actionableEvents).values(event).run();
|
|
469308
|
-
return c.json(event, 201);
|
|
469309
|
-
} catch (err) {
|
|
469310
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
469311
|
-
return c.json({ error: message }, 500);
|
|
469312
|
-
}
|
|
469313
|
-
});
|
|
469314
|
-
assistantRoutes.patch("/events/:id", async (c) => {
|
|
469315
|
-
const id = c.req.param("id");
|
|
469316
|
-
const body = await c.req.json();
|
|
469317
|
-
try {
|
|
469318
|
-
const existing = db2.select().from(actionableEvents).where(eq(actionableEvents.id, id)).get();
|
|
469319
|
-
if (!existing) {
|
|
469320
|
-
return c.json({ error: "Event not found" }, 404);
|
|
469321
|
-
}
|
|
469322
|
-
const now = new Date().toISOString();
|
|
469323
|
-
const updates = { updatedAt: now };
|
|
469324
|
-
if (body.status !== undefined) {
|
|
469325
|
-
updates.status = body.status;
|
|
469326
|
-
}
|
|
469327
|
-
if (body.linkedTaskId !== undefined) {
|
|
469328
|
-
updates.linkedTaskId = body.linkedTaskId;
|
|
469329
|
-
}
|
|
469330
|
-
if (body.actionLogEntry) {
|
|
469331
|
-
const existingLog = existing.actionLog || [];
|
|
469332
|
-
updates.actionLog = [...existingLog, { timestamp: now, action: body.actionLogEntry }];
|
|
469333
|
-
}
|
|
469334
|
-
db2.update(actionableEvents).set(updates).where(eq(actionableEvents.id, id)).run();
|
|
469335
|
-
const updated = db2.select().from(actionableEvents).where(eq(actionableEvents.id, id)).get();
|
|
469336
|
-
return c.json(updated);
|
|
469337
|
-
} catch (err) {
|
|
469338
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
469339
|
-
return c.json({ error: message }, 500);
|
|
469340
|
-
}
|
|
469341
|
-
});
|
|
469342
|
-
assistantRoutes.delete("/events/:id", async (c) => {
|
|
469343
|
-
const id = c.req.param("id");
|
|
469344
|
-
try {
|
|
469345
|
-
const existing = db2.select().from(actionableEvents).where(eq(actionableEvents.id, id)).get();
|
|
469346
|
-
if (!existing) {
|
|
469347
|
-
return c.json({ error: "Event not found" }, 404);
|
|
469348
|
-
}
|
|
469349
|
-
db2.delete(actionableEvents).where(eq(actionableEvents.id, id)).run();
|
|
469350
|
-
return c.json({ success: true });
|
|
469351
|
-
} catch (err) {
|
|
469352
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
469353
|
-
return c.json({ error: message }, 500);
|
|
469354
|
-
}
|
|
469355
|
-
});
|
|
469356
469104
|
assistantRoutes.get("/sweeps", async (c) => {
|
|
469357
469105
|
const type = c.req.query("type");
|
|
469358
469106
|
const limit2 = parseInt(c.req.query("limit") || "20");
|
|
@@ -469388,57 +469136,6 @@ assistantRoutes.get("/sweeps/:id", async (c) => {
|
|
|
469388
469136
|
return c.json({ error: message }, 500);
|
|
469389
469137
|
}
|
|
469390
469138
|
});
|
|
469391
|
-
assistantRoutes.get("/stats", async (c) => {
|
|
469392
|
-
try {
|
|
469393
|
-
const eventCounts = db2.select({
|
|
469394
|
-
status: actionableEvents.status,
|
|
469395
|
-
count: count()
|
|
469396
|
-
}).from(actionableEvents).groupBy(actionableEvents.status).all();
|
|
469397
|
-
const eventStats = {
|
|
469398
|
-
pending: 0,
|
|
469399
|
-
actedUpon: 0,
|
|
469400
|
-
dismissed: 0,
|
|
469401
|
-
monitoring: 0,
|
|
469402
|
-
total: 0
|
|
469403
|
-
};
|
|
469404
|
-
for (const row of eventCounts) {
|
|
469405
|
-
const cnt = Number(row.count);
|
|
469406
|
-
eventStats.total += cnt;
|
|
469407
|
-
if (row.status === "pending")
|
|
469408
|
-
eventStats.pending = cnt;
|
|
469409
|
-
else if (row.status === "acted_upon")
|
|
469410
|
-
eventStats.actedUpon = cnt;
|
|
469411
|
-
else if (row.status === "dismissed")
|
|
469412
|
-
eventStats.dismissed = cnt;
|
|
469413
|
-
else if (row.status === "monitoring")
|
|
469414
|
-
eventStats.monitoring = cnt;
|
|
469415
|
-
}
|
|
469416
|
-
const lastSweeps = {
|
|
469417
|
-
hourly: null,
|
|
469418
|
-
morningRitual: null,
|
|
469419
|
-
eveningRitual: null
|
|
469420
|
-
};
|
|
469421
|
-
const latestSweeps = db2.select({
|
|
469422
|
-
type: sweepRuns.type,
|
|
469423
|
-
completedAt: sql`MAX(${sweepRuns.completedAt})`.as("completedAt")
|
|
469424
|
-
}).from(sweepRuns).where(eq(sweepRuns.status, "completed")).groupBy(sweepRuns.type).all();
|
|
469425
|
-
for (const sweep of latestSweeps) {
|
|
469426
|
-
if (sweep.type === "hourly")
|
|
469427
|
-
lastSweeps.hourly = sweep.completedAt;
|
|
469428
|
-
else if (sweep.type === "morning_ritual")
|
|
469429
|
-
lastSweeps.morningRitual = sweep.completedAt;
|
|
469430
|
-
else if (sweep.type === "evening_ritual")
|
|
469431
|
-
lastSweeps.eveningRitual = sweep.completedAt;
|
|
469432
|
-
}
|
|
469433
|
-
return c.json({
|
|
469434
|
-
events: eventStats,
|
|
469435
|
-
lastSweeps
|
|
469436
|
-
});
|
|
469437
|
-
} catch (err) {
|
|
469438
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
469439
|
-
return c.json({ error: message }, 500);
|
|
469440
|
-
}
|
|
469441
|
-
});
|
|
469442
469139
|
var assistant_default = assistantRoutes;
|
|
469443
469140
|
|
|
469444
469141
|
// server/routes/messaging.ts
|
|
@@ -472778,7 +472475,7 @@ async function searchMemories(input) {
|
|
|
472778
472475
|
SELECT 1 FROM json_each(m.tags) je
|
|
472779
472476
|
WHERE je.value IN ${input.tags}
|
|
472780
472477
|
)
|
|
472781
|
-
ORDER BY bm25(memories_fts)
|
|
472478
|
+
ORDER BY bm25(memories_fts) * (1.0 / (1.0 + (julianday('now') - julianday(m.created_at))))
|
|
472782
472479
|
LIMIT ${limit2}`);
|
|
472783
472480
|
return results2.map((r) => ({
|
|
472784
472481
|
...r,
|
|
@@ -472789,7 +472486,7 @@ async function searchMemories(input) {
|
|
|
472789
472486
|
FROM memories_fts fts
|
|
472790
472487
|
JOIN memories m ON m.rowid = fts.rowid
|
|
472791
472488
|
WHERE memories_fts MATCH ${ftsQuery}
|
|
472792
|
-
ORDER BY bm25(memories_fts)
|
|
472489
|
+
ORDER BY bm25(memories_fts) * (1.0 / (1.0 + (julianday('now') - julianday(m.created_at))))
|
|
472793
472490
|
LIMIT ${limit2}`);
|
|
472794
472491
|
return results.map((r) => ({
|
|
472795
472492
|
...r,
|
|
@@ -473166,18 +472863,18 @@ async function runHourlySweep() {
|
|
|
473166
472863
|
const run2 = createSweepRun("hourly");
|
|
473167
472864
|
try {
|
|
473168
472865
|
const lastSweep = getLastSweepRun("hourly");
|
|
473169
|
-
const
|
|
472866
|
+
const actionableMemoryCount = countActionableMemories();
|
|
473170
472867
|
const openTaskCount = countOpenTasks();
|
|
473171
472868
|
log2.assistant.info("Running hourly sweep", {
|
|
473172
472869
|
runId: run2.id,
|
|
473173
|
-
|
|
472870
|
+
actionableMemories: actionableMemoryCount,
|
|
473174
472871
|
openTasks: openTaskCount
|
|
473175
472872
|
});
|
|
473176
472873
|
const { session: session3 } = getOrCreateSession(SWEEP_SESSION_PREFIX, "sweep-agent", "Assistant Sweep");
|
|
473177
472874
|
const prompt = `Perform your hourly sweep. Last sweep: ${lastSweep?.completedAt ?? "never"}`;
|
|
473178
472875
|
const systemPrompt = getSweepSystemPrompt({
|
|
473179
472876
|
lastSweepTime: lastSweep?.completedAt ?? null,
|
|
473180
|
-
|
|
472877
|
+
actionableMemoryCount,
|
|
473181
472878
|
openTaskCount
|
|
473182
472879
|
});
|
|
473183
472880
|
let eventsProcessed = 0;
|
|
@@ -473191,7 +472888,7 @@ async function runHourlySweep() {
|
|
|
473191
472888
|
if (event.type === "message:complete") {
|
|
473192
472889
|
const content = event.data.content;
|
|
473193
472890
|
summary = content;
|
|
473194
|
-
const processedMatch = content.match(/(\d+)\s*
|
|
472891
|
+
const processedMatch = content.match(/(\d+)\s*memories?\s*(reviewed|processed)/i);
|
|
473195
472892
|
if (processedMatch)
|
|
473196
472893
|
eventsProcessed = parseInt(processedMatch[1]);
|
|
473197
472894
|
const tasksMatch = content.match(/(\d+)\s*tasks?\s*(updated|created)/i);
|
|
@@ -473319,8 +473016,12 @@ function failSweepRun(id, error47) {
|
|
|
473319
473016
|
function getLastSweepRun(type) {
|
|
473320
473017
|
return db2.select().from(sweepRuns).where(eq(sweepRuns.type, type)).orderBy(desc(sweepRuns.startedAt)).limit(1).get() ?? null;
|
|
473321
473018
|
}
|
|
473322
|
-
function
|
|
473323
|
-
const result = db2.
|
|
473019
|
+
function countActionableMemories() {
|
|
473020
|
+
const [result] = db2.all(sql`SELECT COUNT(*) as count FROM memories m
|
|
473021
|
+
WHERE EXISTS (
|
|
473022
|
+
SELECT 1 FROM json_each(m.tags) je
|
|
473023
|
+
WHERE je.value = 'actionable'
|
|
473024
|
+
)`);
|
|
473324
473025
|
return result?.count ?? 0;
|
|
473325
473026
|
}
|
|
473326
473027
|
function countOpenTasks() {
|