signetai 0.204.4 → 0.205.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp-stdio.js +342 -26
- package/native-manifest.json +14 -14
- package/package.json +6 -6
package/dist/mcp-stdio.js
CHANGED
|
@@ -49062,6 +49062,303 @@ class DreamingBacklogTokenCache {
|
|
|
49062
49062
|
}
|
|
49063
49063
|
}
|
|
49064
49064
|
|
|
49065
|
+
// ../../platform/daemon/src/pipeline/dreaming-live-events.ts
|
|
49066
|
+
var DREAMING_LIVE_MAX_EVENTS = 256;
|
|
49067
|
+
var DREAMING_LIVE_MAX_SUBSCRIBERS = 16;
|
|
49068
|
+
var DREAMING_LIVE_MAX_PASSES = 32;
|
|
49069
|
+
var DREAMING_LIVE_MAX_EVENT_CHARS = 48000;
|
|
49070
|
+
var DREAMING_LIVE_MAX_RAW_CHARS = 16000;
|
|
49071
|
+
var DREAMING_LIVE_TERMINAL_RETENTION_MS = 10 * 60000;
|
|
49072
|
+
function nowIso() {
|
|
49073
|
+
return new Date().toISOString();
|
|
49074
|
+
}
|
|
49075
|
+
function asRecord(value) {
|
|
49076
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? { ...value } : {};
|
|
49077
|
+
}
|
|
49078
|
+
function safeJson(value) {
|
|
49079
|
+
try {
|
|
49080
|
+
const json2 = JSON.stringify(value);
|
|
49081
|
+
return json2 === undefined ? "null" : json2;
|
|
49082
|
+
} catch (error51) {
|
|
49083
|
+
return JSON.stringify({ serializationError: error51 instanceof Error ? error51.message : String(error51) });
|
|
49084
|
+
}
|
|
49085
|
+
}
|
|
49086
|
+
function truncatedJsonValue(serialized, maxChars) {
|
|
49087
|
+
const base = { truncated: true, originalChars: serialized.length };
|
|
49088
|
+
let preview = serialized.slice(0, Math.max(0, maxChars - safeJson(base).length - 16));
|
|
49089
|
+
let result = { ...base, preview };
|
|
49090
|
+
while (safeJson(result).length > maxChars && preview.length > 0) {
|
|
49091
|
+
preview = preview.slice(0, Math.max(0, preview.length - Math.max(1, Math.ceil(preview.length / 10))));
|
|
49092
|
+
result = { ...base, preview };
|
|
49093
|
+
}
|
|
49094
|
+
return result;
|
|
49095
|
+
}
|
|
49096
|
+
function boundDreamingLiveValue(value, maxChars = DREAMING_LIVE_MAX_RAW_CHARS) {
|
|
49097
|
+
const json2 = safeJson(value);
|
|
49098
|
+
if (json2.length <= maxChars)
|
|
49099
|
+
return value;
|
|
49100
|
+
return truncatedJsonValue(json2, maxChars);
|
|
49101
|
+
}
|
|
49102
|
+
function boundString(value, maxChars) {
|
|
49103
|
+
return value.length <= maxChars ? value : `${value.slice(0, maxChars)}…`;
|
|
49104
|
+
}
|
|
49105
|
+
function boundMetadataString(value, maxChars = 512) {
|
|
49106
|
+
return boundString(value, maxChars);
|
|
49107
|
+
}
|
|
49108
|
+
function boundNullableMetadataString(value, maxChars) {
|
|
49109
|
+
return value == null ? null : boundString(value, maxChars);
|
|
49110
|
+
}
|
|
49111
|
+
function boundEventData(value) {
|
|
49112
|
+
const data = {};
|
|
49113
|
+
for (const [key, rawValue] of Object.entries(value)) {
|
|
49114
|
+
if (key === "raw") {
|
|
49115
|
+
data[key] = boundDreamingLiveValue(rawValue, DREAMING_LIVE_MAX_RAW_CHARS);
|
|
49116
|
+
} else if (typeof rawValue === "string") {
|
|
49117
|
+
data[key] = boundString(rawValue, 12000);
|
|
49118
|
+
} else {
|
|
49119
|
+
data[key] = boundDreamingLiveValue(rawValue, 12000);
|
|
49120
|
+
}
|
|
49121
|
+
}
|
|
49122
|
+
const serialized = safeJson(data);
|
|
49123
|
+
if (serialized.length <= DREAMING_LIVE_MAX_EVENT_CHARS)
|
|
49124
|
+
return data;
|
|
49125
|
+
const compact = {};
|
|
49126
|
+
for (const [key, rawValue] of Object.entries(data)) {
|
|
49127
|
+
if (key === "raw") {
|
|
49128
|
+
compact[key] = boundDreamingLiveValue(rawValue, 4000);
|
|
49129
|
+
} else if (typeof rawValue === "string") {
|
|
49130
|
+
compact[key] = boundString(rawValue, 2000);
|
|
49131
|
+
} else {
|
|
49132
|
+
compact[key] = boundDreamingLiveValue(rawValue, 4000);
|
|
49133
|
+
}
|
|
49134
|
+
}
|
|
49135
|
+
const compactSerialized = safeJson(compact);
|
|
49136
|
+
if (compactSerialized.length <= DREAMING_LIVE_MAX_EVENT_CHARS)
|
|
49137
|
+
return compact;
|
|
49138
|
+
return truncatedJsonValue(serialized, DREAMING_LIVE_MAX_EVENT_CHARS);
|
|
49139
|
+
}
|
|
49140
|
+
function metadataFromInput(input) {
|
|
49141
|
+
return {
|
|
49142
|
+
passId: boundMetadataString(input.passId),
|
|
49143
|
+
agentId: boundMetadataString(input.agentId),
|
|
49144
|
+
mode: boundMetadataString(input.mode),
|
|
49145
|
+
status: "running",
|
|
49146
|
+
startedAt: boundMetadataString(input.startedAt ?? nowIso(), 128),
|
|
49147
|
+
completedAt: null,
|
|
49148
|
+
summary: null,
|
|
49149
|
+
error: null
|
|
49150
|
+
};
|
|
49151
|
+
}
|
|
49152
|
+
function isTerminal2(status) {
|
|
49153
|
+
return status !== "running";
|
|
49154
|
+
}
|
|
49155
|
+
function isTerminalEvent(event) {
|
|
49156
|
+
return event.type === "pass_completed" || event.type === "pass_failed";
|
|
49157
|
+
}
|
|
49158
|
+
|
|
49159
|
+
class DreamingLiveEventHub {
|
|
49160
|
+
passes = new Map;
|
|
49161
|
+
startPass(input) {
|
|
49162
|
+
this.prune();
|
|
49163
|
+
const existing = this.passes.get(input.passId);
|
|
49164
|
+
if (existing) {
|
|
49165
|
+
existing.metadata = {
|
|
49166
|
+
...existing.metadata,
|
|
49167
|
+
agentId: boundMetadataString(input.agentId),
|
|
49168
|
+
mode: boundMetadataString(input.mode),
|
|
49169
|
+
startedAt: boundMetadataString(input.startedAt ?? existing.metadata.startedAt, 128)
|
|
49170
|
+
};
|
|
49171
|
+
existing.lastTouchedAt = Date.now();
|
|
49172
|
+
return;
|
|
49173
|
+
}
|
|
49174
|
+
if (this.passes.size >= DREAMING_LIVE_MAX_PASSES)
|
|
49175
|
+
return;
|
|
49176
|
+
const pass = {
|
|
49177
|
+
metadata: metadataFromInput(input),
|
|
49178
|
+
nextCursor: 1,
|
|
49179
|
+
events: [],
|
|
49180
|
+
subscribers: new Set,
|
|
49181
|
+
lastTouchedAt: Date.now()
|
|
49182
|
+
};
|
|
49183
|
+
this.passes.set(input.passId, pass);
|
|
49184
|
+
this.append(pass, "pass_started", {
|
|
49185
|
+
agentId: input.agentId,
|
|
49186
|
+
mode: input.mode,
|
|
49187
|
+
startedAt: pass.metadata.startedAt
|
|
49188
|
+
});
|
|
49189
|
+
}
|
|
49190
|
+
ensurePass(input) {
|
|
49191
|
+
const existing = this.passes.get(input.passId);
|
|
49192
|
+
if (!existing) {
|
|
49193
|
+
this.startPass(input);
|
|
49194
|
+
const created = this.passes.get(input.passId);
|
|
49195
|
+
if (created) {
|
|
49196
|
+
created.metadata = {
|
|
49197
|
+
...created.metadata,
|
|
49198
|
+
status: boundMetadataString(input.status ?? created.metadata.status),
|
|
49199
|
+
completedAt: boundNullableMetadataString(input.completedAt ?? created.metadata.completedAt, 128),
|
|
49200
|
+
summary: boundNullableMetadataString(input.summary ?? created.metadata.summary, 12000),
|
|
49201
|
+
error: boundNullableMetadataString(input.error ?? created.metadata.error, 12000)
|
|
49202
|
+
};
|
|
49203
|
+
this.appendRecoveredTerminal(created);
|
|
49204
|
+
}
|
|
49205
|
+
return;
|
|
49206
|
+
}
|
|
49207
|
+
if (isTerminal2(existing.metadata.status) && (input.status === undefined || input.status === "running")) {
|
|
49208
|
+
existing.lastTouchedAt = Date.now();
|
|
49209
|
+
return;
|
|
49210
|
+
}
|
|
49211
|
+
existing.metadata = {
|
|
49212
|
+
...existing.metadata,
|
|
49213
|
+
status: boundMetadataString(input.status ?? existing.metadata.status),
|
|
49214
|
+
completedAt: boundNullableMetadataString(input.completedAt ?? existing.metadata.completedAt, 128),
|
|
49215
|
+
summary: boundNullableMetadataString(input.summary ?? existing.metadata.summary, 12000),
|
|
49216
|
+
error: boundNullableMetadataString(input.error ?? existing.metadata.error, 12000)
|
|
49217
|
+
};
|
|
49218
|
+
existing.lastTouchedAt = Date.now();
|
|
49219
|
+
this.appendRecoveredTerminal(existing);
|
|
49220
|
+
}
|
|
49221
|
+
publish(passId, type, data = {}) {
|
|
49222
|
+
const pass = this.passes.get(passId);
|
|
49223
|
+
if (!pass || isTerminal2(pass.metadata.status) && type !== "pass_completed" && type !== "pass_failed")
|
|
49224
|
+
return;
|
|
49225
|
+
this.append(pass, type, data);
|
|
49226
|
+
}
|
|
49227
|
+
finish(passId, status, data = {}) {
|
|
49228
|
+
const pass = this.passes.get(passId);
|
|
49229
|
+
if (!pass)
|
|
49230
|
+
return;
|
|
49231
|
+
if (isTerminal2(pass.metadata.status))
|
|
49232
|
+
return;
|
|
49233
|
+
const completedAt = nowIso();
|
|
49234
|
+
const summary = typeof data.summary === "string" ? boundString(data.summary, 12000) : null;
|
|
49235
|
+
const error51 = typeof data.error === "string" ? boundString(data.error, 12000) : null;
|
|
49236
|
+
pass.metadata = { ...pass.metadata, status, completedAt, summary, error: error51 };
|
|
49237
|
+
this.append(pass, status === "completed" ? "pass_completed" : "pass_failed", {
|
|
49238
|
+
...data,
|
|
49239
|
+
status,
|
|
49240
|
+
completedAt,
|
|
49241
|
+
...summary === null ? {} : { summary },
|
|
49242
|
+
...error51 === null ? {} : { error: error51 }
|
|
49243
|
+
});
|
|
49244
|
+
}
|
|
49245
|
+
getSnapshot(passId) {
|
|
49246
|
+
const pass = this.passes.get(passId);
|
|
49247
|
+
if (!pass)
|
|
49248
|
+
return null;
|
|
49249
|
+
return this.snapshot(pass);
|
|
49250
|
+
}
|
|
49251
|
+
subscribe(passId, afterCursor, listener) {
|
|
49252
|
+
const pass = this.passes.get(passId);
|
|
49253
|
+
if (!pass)
|
|
49254
|
+
return null;
|
|
49255
|
+
if (pass.subscribers.size >= DREAMING_LIVE_MAX_SUBSCRIBERS) {
|
|
49256
|
+
throw new Error("Too many viewers are attached to this Dreaming pass");
|
|
49257
|
+
}
|
|
49258
|
+
pass.subscribers.add(listener);
|
|
49259
|
+
pass.lastTouchedAt = Date.now();
|
|
49260
|
+
const requested = afterCursor ?? 0;
|
|
49261
|
+
const latest = pass.nextCursor - 1;
|
|
49262
|
+
const first = pass.events[0]?.cursor ?? null;
|
|
49263
|
+
let gap = null;
|
|
49264
|
+
if (requested > latest) {
|
|
49265
|
+
gap = {
|
|
49266
|
+
requestedCursor: requested,
|
|
49267
|
+
availableFrom: first,
|
|
49268
|
+
availableTo: latest,
|
|
49269
|
+
reason: "cursor_ahead"
|
|
49270
|
+
};
|
|
49271
|
+
} else if (first !== null && requested < first - 1) {
|
|
49272
|
+
gap = {
|
|
49273
|
+
requestedCursor: requested,
|
|
49274
|
+
availableFrom: first,
|
|
49275
|
+
availableTo: latest,
|
|
49276
|
+
reason: "buffer_exhausted"
|
|
49277
|
+
};
|
|
49278
|
+
}
|
|
49279
|
+
const replay = pass.events.filter((event) => event.cursor > requested);
|
|
49280
|
+
let subscribed = true;
|
|
49281
|
+
return {
|
|
49282
|
+
snapshot: this.snapshot(pass),
|
|
49283
|
+
replay,
|
|
49284
|
+
gap,
|
|
49285
|
+
unsubscribe: () => {
|
|
49286
|
+
if (!subscribed)
|
|
49287
|
+
return;
|
|
49288
|
+
subscribed = false;
|
|
49289
|
+
pass.subscribers.delete(listener);
|
|
49290
|
+
pass.lastTouchedAt = Date.now();
|
|
49291
|
+
}
|
|
49292
|
+
};
|
|
49293
|
+
}
|
|
49294
|
+
getSubscriberCount(passId) {
|
|
49295
|
+
if (passId === undefined)
|
|
49296
|
+
return [...this.passes.values()].reduce((total, pass) => total + pass.subscribers.size, 0);
|
|
49297
|
+
return this.passes.get(passId)?.subscribers.size ?? 0;
|
|
49298
|
+
}
|
|
49299
|
+
reset() {
|
|
49300
|
+
this.passes.clear();
|
|
49301
|
+
}
|
|
49302
|
+
append(pass, type, input) {
|
|
49303
|
+
const event = {
|
|
49304
|
+
passId: pass.metadata.passId,
|
|
49305
|
+
agentId: pass.metadata.agentId,
|
|
49306
|
+
cursor: pass.nextCursor++,
|
|
49307
|
+
timestamp: nowIso(),
|
|
49308
|
+
type,
|
|
49309
|
+
data: boundEventData(asRecord(input))
|
|
49310
|
+
};
|
|
49311
|
+
pass.events.push(event);
|
|
49312
|
+
if (pass.events.length > DREAMING_LIVE_MAX_EVENTS)
|
|
49313
|
+
pass.events.splice(0, pass.events.length - DREAMING_LIVE_MAX_EVENTS);
|
|
49314
|
+
pass.lastTouchedAt = Date.now();
|
|
49315
|
+
for (const listener of [...pass.subscribers]) {
|
|
49316
|
+
try {
|
|
49317
|
+
listener(event);
|
|
49318
|
+
} catch {}
|
|
49319
|
+
}
|
|
49320
|
+
}
|
|
49321
|
+
snapshot(pass) {
|
|
49322
|
+
return {
|
|
49323
|
+
...pass.metadata,
|
|
49324
|
+
cursor: pass.nextCursor - 1,
|
|
49325
|
+
replayFrom: pass.events[0]?.cursor ?? null,
|
|
49326
|
+
replayTo: pass.events.at(-1)?.cursor ?? null
|
|
49327
|
+
};
|
|
49328
|
+
}
|
|
49329
|
+
appendRecoveredTerminal(pass) {
|
|
49330
|
+
if (!isTerminal2(pass.metadata.status) || pass.events.some((event) => isTerminalEvent(event)))
|
|
49331
|
+
return;
|
|
49332
|
+
this.append(pass, pass.metadata.status === "completed" ? "pass_completed" : "pass_failed", {
|
|
49333
|
+
status: pass.metadata.status,
|
|
49334
|
+
completedAt: pass.metadata.completedAt,
|
|
49335
|
+
...pass.metadata.summary === null ? {} : { summary: pass.metadata.summary },
|
|
49336
|
+
...pass.metadata.error === null ? {} : { error: pass.metadata.error }
|
|
49337
|
+
});
|
|
49338
|
+
}
|
|
49339
|
+
prune() {
|
|
49340
|
+
const cutoff = Date.now() - DREAMING_LIVE_TERMINAL_RETENTION_MS;
|
|
49341
|
+
for (const [passId, pass] of this.passes) {
|
|
49342
|
+
if (pass.subscribers.size === 0 && isTerminal2(pass.metadata.status) && pass.lastTouchedAt < cutoff) {
|
|
49343
|
+
this.passes.delete(passId);
|
|
49344
|
+
}
|
|
49345
|
+
}
|
|
49346
|
+
if (this.passes.size < DREAMING_LIVE_MAX_PASSES)
|
|
49347
|
+
return;
|
|
49348
|
+
const candidates2 = [...this.passes.entries()].filter(([, pass]) => pass.subscribers.size === 0).sort(([, left], [, right]) => {
|
|
49349
|
+
const leftTerminal = isTerminal2(left.metadata.status) ? 0 : 1;
|
|
49350
|
+
const rightTerminal = isTerminal2(right.metadata.status) ? 0 : 1;
|
|
49351
|
+
return leftTerminal - rightTerminal || left.lastTouchedAt - right.lastTouchedAt;
|
|
49352
|
+
});
|
|
49353
|
+
for (const [passId] of candidates2) {
|
|
49354
|
+
if (this.passes.size < DREAMING_LIVE_MAX_PASSES)
|
|
49355
|
+
break;
|
|
49356
|
+
this.passes.delete(passId);
|
|
49357
|
+
}
|
|
49358
|
+
}
|
|
49359
|
+
}
|
|
49360
|
+
var dreamingLiveEvents = new DreamingLiveEventHub;
|
|
49361
|
+
|
|
49065
49362
|
// ../../node_modules/.bun/js-tiktoken@1.0.21/node_modules/js-tiktoken/dist/chunk-VL2OQCWN.js
|
|
49066
49363
|
var import_base64_js = __toESM(require_base64_js(), 1);
|
|
49067
49364
|
var __defProp3 = Object.defineProperty;
|
|
@@ -49501,8 +49798,8 @@ async function listKnowledgeEntities(accessor, params) {
|
|
|
49501
49798
|
});
|
|
49502
49799
|
}
|
|
49503
49800
|
async function getKnowledgeEntityDetail(accessor, entityId, agentId) {
|
|
49504
|
-
|
|
49505
|
-
|
|
49801
|
+
const row = await accessor.withReadDbAsync((db) => {
|
|
49802
|
+
return db.prepare(`SELECT
|
|
49506
49803
|
e.*,
|
|
49507
49804
|
(
|
|
49508
49805
|
SELECT COUNT(*) FROM entity_aspects asp
|
|
@@ -49548,22 +49845,22 @@ async function getKnowledgeEntityDetail(accessor, entityId, agentId) {
|
|
|
49548
49845
|
FROM entities e
|
|
49549
49846
|
WHERE e.id = ? AND e.agent_id = ?
|
|
49550
49847
|
AND COALESCE(e.status, 'active') = 'active'`).get(entityId, agentId);
|
|
49551
|
-
if (!row)
|
|
49552
|
-
return null;
|
|
49553
|
-
const structuralDensity = await getStructuralDensity(accessor, entityId, agentId);
|
|
49554
|
-
const incomingDependencyCount = Number(row.incoming_dependency_count ?? 0);
|
|
49555
|
-
const outgoingDependencyCount = Number(row.outgoing_dependency_count ?? 0);
|
|
49556
|
-
return {
|
|
49557
|
-
entity: rowToEntity(row),
|
|
49558
|
-
aspectCount: Number(row.aspect_count ?? 0),
|
|
49559
|
-
attributeCount: Number(row.attribute_count ?? 0),
|
|
49560
|
-
constraintCount: Number(row.constraint_count ?? 0),
|
|
49561
|
-
dependencyCount: incomingDependencyCount + outgoingDependencyCount,
|
|
49562
|
-
structuralDensity,
|
|
49563
|
-
incomingDependencyCount,
|
|
49564
|
-
outgoingDependencyCount
|
|
49565
|
-
};
|
|
49566
49848
|
});
|
|
49849
|
+
if (!row)
|
|
49850
|
+
return null;
|
|
49851
|
+
const structuralDensity = await getStructuralDensity(accessor, entityId, agentId);
|
|
49852
|
+
const incomingDependencyCount = Number(row.incoming_dependency_count ?? 0);
|
|
49853
|
+
const outgoingDependencyCount = Number(row.outgoing_dependency_count ?? 0);
|
|
49854
|
+
return {
|
|
49855
|
+
entity: rowToEntity(row),
|
|
49856
|
+
aspectCount: Number(row.aspect_count ?? 0),
|
|
49857
|
+
attributeCount: Number(row.attribute_count ?? 0),
|
|
49858
|
+
constraintCount: Number(row.constraint_count ?? 0),
|
|
49859
|
+
dependencyCount: incomingDependencyCount + outgoingDependencyCount,
|
|
49860
|
+
structuralDensity,
|
|
49861
|
+
incomingDependencyCount,
|
|
49862
|
+
outgoingDependencyCount
|
|
49863
|
+
};
|
|
49567
49864
|
}
|
|
49568
49865
|
function readEntityAspectsWithCounts(db, entityId, agentId) {
|
|
49569
49866
|
const rows = db.prepare(`SELECT
|
|
@@ -49658,7 +49955,7 @@ async function getEntityDependenciesDetailed(accessor, params) {
|
|
|
49658
49955
|
});
|
|
49659
49956
|
}
|
|
49660
49957
|
async function getStructuralDensity(accessor, entityId, agentId) {
|
|
49661
|
-
return await accessor.withReadDbAsync(
|
|
49958
|
+
return await accessor.withReadDbAsync((db) => {
|
|
49662
49959
|
const aspects = db.prepare(`SELECT COUNT(*) as n FROM entity_aspects
|
|
49663
49960
|
WHERE entity_id = ? AND agent_id = ?`).get(entityId, agentId);
|
|
49664
49961
|
const attributes = db.prepare(`SELECT COUNT(*) as n FROM entity_attributes ea
|
|
@@ -52636,14 +52933,16 @@ async function awaitPressureClear(timeoutMs = 30000) {
|
|
|
52636
52933
|
|
|
52637
52934
|
// ../../platform/daemon/src/yielding-writes.ts
|
|
52638
52935
|
var yieldToEventLoop = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
52639
|
-
async function writeBatch(accessor, processBatch) {
|
|
52936
|
+
async function writeBatch(accessor, processBatch, label, estimatedWorkUnits) {
|
|
52640
52937
|
if (accessor.withWriteTxAsync) {
|
|
52641
|
-
return accessor.withWriteTxAsync(processBatch);
|
|
52938
|
+
return accessor.withWriteTxAsync(processBatch, { operation: `db.batch.${label}`, estimatedWorkUnits });
|
|
52642
52939
|
}
|
|
52643
52940
|
return accessor.withWriteTx(processBatch);
|
|
52644
52941
|
}
|
|
52645
52942
|
async function runWriteBatches(accessor, items, processItem, options) {
|
|
52646
52943
|
const maxPerTx = typeof options.maxPerTx === "number" && Number.isFinite(options.maxPerTx) ? Math.max(1, Math.floor(options.maxPerTx)) : 50;
|
|
52944
|
+
const maxRows = typeof options.maxRows === "number" && Number.isFinite(options.maxRows) ? Math.max(1, Math.floor(options.maxRows)) : maxPerTx;
|
|
52945
|
+
const maxBytes = typeof options.maxBytes === "number" && Number.isFinite(options.maxBytes) ? Math.max(1, options.maxBytes) : Number.POSITIVE_INFINITY;
|
|
52647
52946
|
const maxTxDurationMs = typeof options.maxTxDurationMs === "number" && Number.isFinite(options.maxTxDurationMs) ? Math.max(1, options.maxTxDurationMs) : Number.POSITIVE_INFINITY;
|
|
52648
52947
|
const yieldEvery = typeof options.yieldEvery === "number" && Number.isFinite(options.yieldEvery) ? Math.max(1, Math.floor(options.yieldEvery)) : 1;
|
|
52649
52948
|
const maxTotal = Math.min(items.length, typeof options.maxTotal === "number" && Number.isFinite(options.maxTotal) ? Math.max(0, Math.floor(options.maxTotal)) : items.length);
|
|
@@ -52651,25 +52950,35 @@ async function runWriteBatches(accessor, items, processItem, options) {
|
|
|
52651
52950
|
let processed = 0;
|
|
52652
52951
|
let batches = 0;
|
|
52653
52952
|
let paused = 0;
|
|
52953
|
+
const startedAt = performance.now();
|
|
52654
52954
|
while (processed < maxTotal) {
|
|
52655
52955
|
if (!options.skipPressure && isSystemPressureHigh()) {
|
|
52656
52956
|
paused++;
|
|
52657
52957
|
await awaitPressureClear();
|
|
52658
52958
|
}
|
|
52659
52959
|
let batch;
|
|
52960
|
+
let batchBytes = 0;
|
|
52660
52961
|
try {
|
|
52661
|
-
|
|
52662
|
-
const
|
|
52962
|
+
const committed = await writeBatch(accessor, (db) => {
|
|
52963
|
+
const startedAt2 = performance.now();
|
|
52663
52964
|
const batchResults = [];
|
|
52965
|
+
let bytes = 0;
|
|
52664
52966
|
for (const item of items.slice(processed, maxTotal)) {
|
|
52967
|
+
const estimatedBytes = options.estimateBytes?.(item) ?? 0;
|
|
52968
|
+
const itemBytes = Number.isFinite(estimatedBytes) ? Math.max(0, estimatedBytes) : 0;
|
|
52969
|
+
if (batchResults.length > 0 && bytes + itemBytes > maxBytes)
|
|
52970
|
+
break;
|
|
52665
52971
|
batchResults.push(processItem(db, item));
|
|
52666
|
-
|
|
52972
|
+
bytes += itemBytes;
|
|
52973
|
+
if (batchResults.length >= Math.min(maxPerTx, maxRows))
|
|
52667
52974
|
break;
|
|
52668
|
-
if (performance.now() -
|
|
52975
|
+
if (performance.now() - startedAt2 >= maxTxDurationMs)
|
|
52669
52976
|
break;
|
|
52670
52977
|
}
|
|
52671
|
-
return batchResults;
|
|
52672
|
-
});
|
|
52978
|
+
return { results: batchResults, bytes };
|
|
52979
|
+
}, options.label, Math.min(maxPerTx, maxRows));
|
|
52980
|
+
batch = committed.results;
|
|
52981
|
+
batchBytes = committed.bytes;
|
|
52673
52982
|
} catch (error51) {
|
|
52674
52983
|
const message = error51 instanceof Error ? error51.message : String(error51);
|
|
52675
52984
|
logger.warn("yielding-writes", `${options.label}: write batch failed after ${processed} committed items`, {
|
|
@@ -52684,6 +52993,13 @@ async function runWriteBatches(accessor, items, processItem, options) {
|
|
|
52684
52993
|
results.push(...batch);
|
|
52685
52994
|
processed += batch.length;
|
|
52686
52995
|
batches++;
|
|
52996
|
+
options.checkpoint?.({
|
|
52997
|
+
processed,
|
|
52998
|
+
batches,
|
|
52999
|
+
rows: batch.length,
|
|
53000
|
+
bytes: batchBytes,
|
|
53001
|
+
elapsedMs: performance.now() - startedAt
|
|
53002
|
+
});
|
|
52687
53003
|
if (batches % yieldEvery === 0)
|
|
52688
53004
|
await yieldToEventLoop();
|
|
52689
53005
|
}
|
package/native-manifest.json
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.205.0",
|
|
4
4
|
"assets": [
|
|
5
5
|
{
|
|
6
6
|
"name": "signet-darwin-arm64",
|
|
7
7
|
"platform": "darwin-arm64",
|
|
8
|
-
"sha256": "
|
|
9
|
-
"size":
|
|
8
|
+
"sha256": "e42ec2e6c14f508555c7d8541988c3d3665967a66bb329e375201db2f59c08f8",
|
|
9
|
+
"size": 140062624
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"name": "signet-darwin-x64",
|
|
13
13
|
"platform": "darwin-x64",
|
|
14
|
-
"sha256": "
|
|
15
|
-
"size":
|
|
14
|
+
"sha256": "9baa2a2de27cbfc4f86f7232da386b24694fb848ac0198ef10bdf42c622c6b6f",
|
|
15
|
+
"size": 144919104
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "signet-linux-arm64",
|
|
19
19
|
"platform": "linux-arm64",
|
|
20
|
-
"sha256": "
|
|
21
|
-
"size":
|
|
20
|
+
"sha256": "6334b1297b638777d4080dd7c39638f9748f11c90b556b7cbaf394b1bd03179b",
|
|
21
|
+
"size": 184508656
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
"name": "signet-linux-x64",
|
|
25
25
|
"platform": "linux-x64",
|
|
26
|
-
"sha256": "
|
|
27
|
-
"size":
|
|
26
|
+
"sha256": "72f0f586bee2ed9bc53e272890253fed89f0e4336a2590cbdf6e023c51701e36",
|
|
27
|
+
"size": 186882023
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
"name": "signet-win32-x64.exe",
|
|
31
31
|
"platform": "win32-x64",
|
|
32
|
-
"sha256": "
|
|
33
|
-
"size":
|
|
32
|
+
"sha256": "504ae86fefd1ec69f0fc3e73cde4f8fd13ffacd3bc2ef6103a673d0c6d85bdaf",
|
|
33
|
+
"size": 194954752
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
36
|
"components": {
|
|
37
37
|
"connectors": {
|
|
38
|
-
"url": "signet-connectors-0.
|
|
39
|
-
"sha256": "
|
|
40
|
-
"size":
|
|
38
|
+
"url": "signet-connectors-0.205.0.tar.gz",
|
|
39
|
+
"sha256": "d2b9c818c1bbce8e7210c9afe6c97301c7d3d0ea71acae92e24c7e0c8f05e251",
|
|
40
|
+
"size": 21943
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "signetai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.205.0",
|
|
4
4
|
"description": "Signet native CLI installer wrapper",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
67
|
"optionalDependencies": {
|
|
68
|
-
"signetai-darwin-arm64": "https://github.com/Signet-AI/signetai/releases/download/v0.
|
|
69
|
-
"signetai-darwin-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.
|
|
70
|
-
"signetai-linux-arm64": "https://github.com/Signet-AI/signetai/releases/download/v0.
|
|
71
|
-
"signetai-linux-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.
|
|
72
|
-
"signetai-win32-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.
|
|
68
|
+
"signetai-darwin-arm64": "https://github.com/Signet-AI/signetai/releases/download/v0.205.0/signetai-darwin-arm64-0.205.0.tgz",
|
|
69
|
+
"signetai-darwin-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.205.0/signetai-darwin-x64-0.205.0.tgz",
|
|
70
|
+
"signetai-linux-arm64": "https://github.com/Signet-AI/signetai/releases/download/v0.205.0/signetai-linux-arm64-0.205.0.tgz",
|
|
71
|
+
"signetai-linux-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.205.0/signetai-linux-x64-0.205.0.tgz",
|
|
72
|
+
"signetai-win32-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.205.0/signetai-win32-x64-0.205.0.tgz"
|
|
73
73
|
}
|
|
74
74
|
}
|