@codemem/core 0.31.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -31
- package/dist/index.js.map +1 -1
- package/dist/maintenance-jobs.d.ts.map +1 -1
- package/dist/ref-backfill.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This package owns the SQLite store, embedding worker interface,
|
|
5
5
|
* and type definitions shared across the codemem TS backend.
|
|
6
6
|
*/
|
|
7
|
-
export declare const VERSION = "0.31.
|
|
7
|
+
export declare const VERSION = "0.31.1";
|
|
8
8
|
export * as Api from "./api-types.js";
|
|
9
9
|
export { extractApplyPatchPaths, MUTATING_TOOL_NAMES } from "./apply-patch.js";
|
|
10
10
|
export type { CreateBetterSqliteCoordinatorAppOptions } from "./better-sqlite-coordinator-runtime.js";
|
package/dist/index.js
CHANGED
|
@@ -2367,13 +2367,15 @@ function Wr(e, t) {
|
|
|
2367
2367
|
return Object.hasOwn(e, "metadata") ? e.metadata ? JSON.stringify(e.metadata) : null : t.metadata ? JSON.stringify(t.metadata) : null;
|
|
2368
2368
|
}
|
|
2369
2369
|
function Gr(e) {
|
|
2370
|
-
|
|
2370
|
+
if (!e) return null;
|
|
2371
|
+
let t = e.status === "completed" && e.progress_total != null ? e.progress_total : e.progress_current;
|
|
2372
|
+
return {
|
|
2371
2373
|
kind: e.kind,
|
|
2372
2374
|
title: e.title,
|
|
2373
2375
|
status: e.status,
|
|
2374
2376
|
message: e.message,
|
|
2375
2377
|
progress: {
|
|
2376
|
-
current:
|
|
2378
|
+
current: t,
|
|
2377
2379
|
total: e.progress_total,
|
|
2378
2380
|
unit: e.progress_unit
|
|
2379
2381
|
},
|
|
@@ -2382,7 +2384,7 @@ function Gr(e) {
|
|
|
2382
2384
|
updated_at: e.updated_at,
|
|
2383
2385
|
finished_at: e.finished_at,
|
|
2384
2386
|
error: e.error
|
|
2385
|
-
}
|
|
2387
|
+
};
|
|
2386
2388
|
}
|
|
2387
2389
|
function Q(e, t) {
|
|
2388
2390
|
return Br(e), Gr(e.prepare("SELECT * FROM maintenance_jobs WHERE kind = ?").get(t));
|
|
@@ -12271,7 +12273,7 @@ async function wh(e, t = {}) {
|
|
|
12271
12273
|
let t = Number(Ch(e).total_backfillable ?? l ?? u);
|
|
12272
12274
|
return Yr(e, xh, {
|
|
12273
12275
|
message: d > 0 ? `Dedup-key backfill complete (${d} skipped)` : "Dedup-key backfill complete",
|
|
12274
|
-
progressCurrent:
|
|
12276
|
+
progressCurrent: t,
|
|
12275
12277
|
progressTotal: t,
|
|
12276
12278
|
metadata: {
|
|
12277
12279
|
total_backfillable: t,
|
|
@@ -15783,13 +15785,13 @@ function Ay(e) {
|
|
|
15783
15785
|
return null;
|
|
15784
15786
|
}
|
|
15785
15787
|
async function jy(e, t = {}) {
|
|
15786
|
-
let n = Q(e, Ey), r = ky(e), i = Math.max(1, t.batchSize ?? 50), a = Number(r.last_cursor_id ?? 0),
|
|
15788
|
+
let n = Q(e, Ey), r = ky(e), i = Math.max(1, t.batchSize ?? 50), a = !n || n.status === "completed" || n.status === "failed", o = a ? 0 : Number(r.last_cursor_id ?? 0), s = e.prepare(`SELECT mi.id, mi.files_read, mi.files_modified, mi.concepts
|
|
15787
15789
|
FROM memory_items mi
|
|
15788
15790
|
WHERE mi.id > ?
|
|
15789
15791
|
AND ${Dy}
|
|
15790
15792
|
ORDER BY mi.id ASC
|
|
15791
|
-
LIMIT ?`).all(
|
|
15792
|
-
if (
|
|
15793
|
+
LIMIT ?`).all(o, i);
|
|
15794
|
+
if (s.length === 0) {
|
|
15793
15795
|
if (n && n.status !== "completed") {
|
|
15794
15796
|
let t = Number(r.processed ?? 0);
|
|
15795
15797
|
Yr(e, Ey, {
|
|
@@ -15799,14 +15801,14 @@ async function jy(e, t = {}) {
|
|
|
15799
15801
|
metadata: {
|
|
15800
15802
|
...r,
|
|
15801
15803
|
remaining: 0,
|
|
15802
|
-
last_cursor_id:
|
|
15804
|
+
last_cursor_id: o
|
|
15803
15805
|
}
|
|
15804
15806
|
});
|
|
15805
15807
|
}
|
|
15806
15808
|
return !1;
|
|
15807
15809
|
}
|
|
15808
|
-
let
|
|
15809
|
-
if (
|
|
15810
|
+
let c = a ? 0 : Number(r.processed ?? 0), l = Number(r.total_backfillable ?? 0);
|
|
15811
|
+
if (a) {
|
|
15810
15812
|
let t = e.prepare(`SELECT COUNT(*) AS cnt FROM memory_items mi
|
|
15811
15813
|
WHERE ${Dy}`).get().cnt;
|
|
15812
15814
|
qr(e, {
|
|
@@ -15816,46 +15818,46 @@ async function jy(e, t = {}) {
|
|
|
15816
15818
|
progressTotal: t,
|
|
15817
15819
|
metadata: {
|
|
15818
15820
|
total_backfillable: t,
|
|
15819
|
-
processed:
|
|
15821
|
+
processed: c,
|
|
15820
15822
|
remaining: t,
|
|
15821
15823
|
last_cursor_id: 0
|
|
15822
15824
|
}
|
|
15823
|
-
}),
|
|
15825
|
+
}), l = t;
|
|
15824
15826
|
}
|
|
15825
|
-
let
|
|
15827
|
+
let u = e.prepare("INSERT OR IGNORE INTO memory_file_refs (memory_id, file_path, relation) VALUES (?, ?, ?)"), d = e.prepare("INSERT OR IGNORE INTO memory_concept_refs (memory_id, concept) VALUES (?, ?)"), f = e.transaction((e) => {
|
|
15826
15828
|
let t = Ay(e.files_read), n = Ay(e.files_modified), r = Ay(e.concepts);
|
|
15827
|
-
if (t) for (let n of t) n &&
|
|
15828
|
-
if (n) for (let t of n) t &&
|
|
15829
|
+
if (t) for (let n of t) n && u.run(e.id, n, "read");
|
|
15830
|
+
if (n) for (let t of n) t && u.run(e.id, t, "modified");
|
|
15829
15831
|
if (r) for (let t of r) {
|
|
15830
15832
|
let n = ma(t ?? "");
|
|
15831
|
-
n &&
|
|
15833
|
+
n && d.run(e.id, n);
|
|
15832
15834
|
}
|
|
15833
15835
|
});
|
|
15834
|
-
for (let e of
|
|
15835
|
-
let
|
|
15836
|
-
if (
|
|
15837
|
-
let t = Number(ky(e).total_backfillable ??
|
|
15836
|
+
for (let e of s) f(e);
|
|
15837
|
+
let p = c + s.length, m = s.length < i, h = s[s.length - 1].id;
|
|
15838
|
+
if (m) {
|
|
15839
|
+
let t = Number(ky(e).total_backfillable ?? l ?? p);
|
|
15838
15840
|
return Yr(e, Ey, {
|
|
15839
15841
|
message: "Ref backfill complete",
|
|
15840
|
-
progressCurrent:
|
|
15842
|
+
progressCurrent: t,
|
|
15841
15843
|
progressTotal: t,
|
|
15842
15844
|
metadata: {
|
|
15843
15845
|
total_backfillable: t,
|
|
15844
|
-
processed:
|
|
15846
|
+
processed: p,
|
|
15845
15847
|
remaining: 0,
|
|
15846
|
-
last_cursor_id:
|
|
15848
|
+
last_cursor_id: h
|
|
15847
15849
|
}
|
|
15848
15850
|
}), !1;
|
|
15849
15851
|
}
|
|
15850
15852
|
return Jr(e, Ey, {
|
|
15851
|
-
message: `Backfilled refs for ${
|
|
15852
|
-
progressCurrent:
|
|
15853
|
-
progressTotal:
|
|
15853
|
+
message: `Backfilled refs for ${p} of ${l} memories`,
|
|
15854
|
+
progressCurrent: p,
|
|
15855
|
+
progressTotal: l,
|
|
15854
15856
|
metadata: {
|
|
15855
|
-
total_backfillable:
|
|
15856
|
-
processed:
|
|
15857
|
-
remaining: Math.max(
|
|
15858
|
-
last_cursor_id:
|
|
15857
|
+
total_backfillable: l,
|
|
15858
|
+
processed: p,
|
|
15859
|
+
remaining: Math.max(l - p, 0),
|
|
15860
|
+
last_cursor_id: h
|
|
15859
15861
|
}
|
|
15860
15862
|
}), !0;
|
|
15861
15863
|
}
|
|
@@ -17642,7 +17644,7 @@ function Qx(e, t = "local") {
|
|
|
17642
17644
|
}
|
|
17643
17645
|
//#endregion
|
|
17644
17646
|
//#region src/index.ts
|
|
17645
|
-
var $x = "0.31.
|
|
17647
|
+
var $x = "0.31.1";
|
|
17646
17648
|
//#endregion
|
|
17647
17649
|
export { ke as Api, V as BetterSqliteCoordinatorStore, Ft as CODEMEM_CONFIG_ENV_OVERRIDES, xh as DEDUP_KEY_BACKFILL_JOB, R as DEFAULT_COORDINATOR_DB_PATH, En as DEFAULT_DB_PATH, Wl as DEFAULT_SCOPE_MEMBERSHIP_CACHE_MAX_AGE_MS, zb as DEFAULT_SERVICE_TYPE, Su as DEFAULT_SYNC_SCOPE_ID, o as DEFAULT_TIME_WINDOW_S, Th as DedupKeyBackfillRunner, si as INJECTION_EVAL_SCENARIO_PACKS, yv as LEGACY_SHARED_REVIEW_SCOPE_ID, Ti as LOCAL_DEFAULT_SCOPE_ID, rb as LOCAL_SYNC_CAPABILITY, zg as LOW_SIGNAL_TOOLS, Sr as MAPPABLE_CLAUDE_HOOK_EVENTS, Cn as MIN_COMPATIBLE_SCHEMA, Ae as MUTATING_TOOL_NAMES, bf as MemoryStore, yp as ObserverAuthAdapter, Hp as ObserverAuthError, pm as ObserverClient, Ey as REF_BACKFILL_JOB, mg as RICH_TIER_DEFAULTS, Ty as RawEventSweeper, My as RefBackfillRunner, Sn as SCHEMA_VERSION, bv as SCOPE_BACKFILL_JOB, n as SCOPE_MEMBERSHIP_REVOCATION_LIMITATION, Ny as SESSION_CONTEXT_BACKFILL_JOB, fr as SIGNATURE_VERSION, pg as SIMPLE_TIER_DEFAULTS, qy as SUMMARY_DEDUP_BACKFILL_JOB, tb as SYNC_CAPABILITIES, nb as SYNC_CAPABILITY_HEADER, Kx as SYNC_SCOPE_QUERY_PARAM, Iv as ScopeBackfillRunner, Ky as SessionContextBackfillRunner, eb as SummaryDedupBackfillRunner, Gx as SyncRetentionRunner, p_ as TRIVIAL_REQUESTS, sb as VECTOR_MODEL_MIGRATION_JOB, $x as VERSION, kb as VectorModelMigrationRunner, Qo as _resetEmbeddingClient, Jx as addSyncScopeToBoundary, vl as addressDedupeKey, ex as advertiseMdns, Om as aiBackfillStructuredContent, gy as analyzeProjectScopeMappingChangeGuardrails, Lb as applyBootstrapSnapshot, Zd as applyReplicationOps, zn as assertSchemaReady, ep as backfillMemoryDedupKeys, Yf as backfillNarrativeFromBody, Jd as backfillReplicationOps, Mv as backfillScopeIds, zf as backfillTagsText, ks as backfillVectors, hn as bootstrapSchema, Zg as budgetToolEvents, _r as buildAuthHeaders, bl as buildBaseUrl, pr as buildCanonicalRequest, mp as buildCodexHeaders, Ji as buildFilterClauses, Yi as buildFilterClausesWithContext, Ih as buildImportKey, zr as buildIngestPayloadFromHook, qc as buildMemoryPack, Yc as buildMemoryPackAsync, Jc as buildMemoryPackTrace, Xc as buildMemoryPackTraceAsync, d_ as buildObserverPrompt, Rr as buildRawEventEnvelopeFromHook, tv as buildSessionContext, v_ as buildTranscript, cd as bulkPruneReplicationOpsByAgeCutoff, mi as canonicalMemoryKind, ji as canonicalWorkspaceIdentity, Uu as chunkOpsBySize, Xo as chunkText, Cv as classifyLegacyMemoryScope, J_ as cleanOrphanSessions, yr as cleanupNonces, ha as clearMemoryRefs, Zu as clockTuple, Af as compareMemoryRoleReports, Yr as completeMaintenanceJob, Mn as connect, Xe as connectCoordinator, Ox as consecutiveConnectivityFailures, qm as coordinatorArchiveGroupAction, Gm as coordinatorCreateGroupAction, ch as coordinatorCreateInviteAction, Zm as coordinatorCreateScopeAction, ah as coordinatorDisableDeviceAction, oh as coordinatorEnableDeviceAction, jl as coordinatorEnabled, nh as coordinatorEnrollDeviceAction, eh as coordinatorGrantScopeMembershipAction, lh as coordinatorImportInviteAction, fh as coordinatorListBootstrapGrantsAction, rh as coordinatorListDevicesAction, Ym as coordinatorListGroupsAction, uh as coordinatorListJoinRequestsAction, $m as coordinatorListScopeMembershipsAction, Xm as coordinatorListScopesAction, sh as coordinatorRemoveDeviceAction, ih as coordinatorRenameDeviceAction, Km as coordinatorRenameGroupAction, dh as coordinatorReviewJoinRequestAction, ph as coordinatorRevokeBootstrapGrantAction, th as coordinatorRevokeScopeMembershipAction, Hl as coordinatorStatusSnapshot, Jm as coordinatorUnarchiveGroupAction, Qm as coordinatorUpdateScopeAction, br as createBetterSqliteCoordinatorApp, c as createCoordinatorApp, Bl as createCoordinatorReciprocalApproval, cx as cursorAdvances, Kf as deactivateLowSignalMemories, Gf as deactivateLowSignalObservations, Tg as decideExtractionReplayTier, s as decodeInvitePayload, qf as dedupNearDuplicateMemories, Wo as dedupeOrderedIds, bh as deleteCoordinatorGroupPreference, xy as deleteProjectScopeSettingsMapping, __ as deriveRequest, xu as deriveTags, tx as discoverPeersViaMdns, ts as embedTexts, t as encodeInvitePayload, dr as ensureDeviceIdentity, Zr as ensureMaintenanceJobsSchema, yn as ensureSchemaBootstrapped, Tv as ensureScopeBackfillScopes, Xl as ensureScopeMembershipCacheStateTable, Bs as estimateTokens, dg as evaluateSessionExtractionItems, Wg as eventToToolEvent, Ga as expandQuery, Jo as explain, e as explainScopeMembershipRevocation, Gh as exportMemories, Kg as extractAdapterEvent, je as extractApplyPatchPaths, y_ as extractAssistantMessages, b_ as extractAssistantUsage, r as extractInvitePayload, Jf as extractNarrativeFromBody, lp as extractOAuthAccess, fp as extractOAuthAccountId, pp as extractOAuthExpires, x_ as extractPrompts, up as extractProviderApiKey, Xu as extractReplicationOps, Gg as extractToolEvents, Xr as failMaintenanceJob, Ab as fetchAllSnapshotPages, Rl as fetchCoordinatorStalePeers, bu as fileTags, jd as filterReplicationOpsForSync, Ad as filterReplicationOpsForSyncWithStatus, va as findByConcept, _a as findByFile, i as fingerprintPublicKey, g_ as firstSentence, rv as flushRawEvents, Un as fromJson, Wn as fromJsonStrict, sr as generateKeypair, _u as getCachedScopeAuthorization, Lt as getCodememConfigPath, Ht as getCodememEnvOverrides, _h as getCoordinatorGroupPreference, es as getEmbeddingClient, rg as getExtractionBenchmarkProfile, oi as getInjectionEvalScenarioByPrompt, ci as getInjectionEvalScenarioPack, li as getInjectionEvalScenarioPrompts, Q as getMaintenanceJob, kf as getMemoryRoleReport, Wt as getOpenCodeProviderConfig, sn as getProviderApiKey, an as getProviderBaseUrl, on as getProviderHeaders, rn as getProviderOptions, ri as getRawEventRelinkPlan, ni as getRawEventRelinkReport, jf as getRawEventStatus, Nf as getReliabilityMetrics, qu as getReplicationCursor, Rn as getSchemaVersion, Cs as getSemanticIndexDiagnostics, fg as getSessionExtractionEval, ug as getSessionExtractionEvalScenario, di as getSummaryMetadata, Nx as getSyncDaemonPhase, Ru as getSyncResetState, At as getWorkspaceCodememConfigPath, jt as getWorkspaceScopedCodememConfigPath, P_ as hasMeaningfulObservation, Sh as hasPendingDedupKeyBackfill, Oy as hasPendingRefBackfill, kv as hasPendingScopeBackfill, Uy as hasPendingSessionContextBackfill, Yy as hasPendingSummaryDedupBackfill, ad as hasUnsyncedSharedMemoryChanges, Yo as hashText, tg as importMemories, K_ as ingest, Y_ as ingestMain, ii as initDatabase, Xx as initTestSchema, Zx as insertTestSession, l as inviteLink, Dx as isConnectivityError, Ln as isEmbeddingDisabled, Bg as isInternalMemoryTool, Hf as isLowSignalObservation, Qu as isNewerClock, Mg as isSensitiveFieldName, fi as isSummaryLikeMemory, h_ as isTrivialRequest, qa as kindBonus, gu as listCachedScopesForDevice, Jt as listConfiguredOpenCodeProviders, vh as listCoordinatorGroupPreferences, Ul as listCoordinatorJoinRequests, zl as listCoordinatorReciprocalApprovals, Gt as listCustomProviders, ig as listExtractionBenchmarkProfiles, Wd as listInboundScopeRejections, Kr as listMaintenanceJobs, Yt as listObserverProviderOptions, _y as listProjectScopeCandidates, vy as listProjectScopeInventory, dy as listProjectScopeSettingsMappings, uy as listSharingDomainSettingsScopes, id as loadMemorySnapshotPageForPeer, Vp as loadObserverConfig, Dt as loadOpenCodeConfig, op as loadOpenCodeOAuthCache, Vb as loadPeerAddresses, rr as loadPrivateKey, er as loadPrivateKeyKeychain, nr as loadPublicKey, rd as loadReplicationOpsForPeer, nd as loadReplicationOpsSince, In as loadSqliteVec, Pl as lookupCoordinatorPeers, Ir as mapClaudeHookPayload, nx as mdnsAddressesForPeer, Jb as mdnsEnabled, yl as mergeAddresses, Lh as mergeSummaryMetadata, jn as migrateLegacyDbPath, qd as migrateLegacyImportKeys, ob as negotiateSyncCapability, C_ as normalizeAdapterEvents, _l as normalizeAddress, ma as normalizeConcept, S_ as normalizeEventsForSessionContext, Vf as normalizeObservation, Dr as normalizeProjectLabel, m_ as normalizeRequestText, ab as normalizeSyncCapability, yu as normalizeTag, Vg as normalizeToolName, N_ as parseObserverResponse, Sa as parsePositiveMemoryId, xa as parseStrictInteger, qx as parseSyncScopeRequest, kx as peerBackoffSeconds, Sd as peerCanSyncPrivateOpByPersonalScopeGrant, yd as personalScopeGrantStatusForPeer, ld as planReplicationOpsAgePrune, ga as populateMemoryRefs, dp as probeAvailableCredentials, qg as projectAdapterToolEvent, yi as projectBasename, xi as projectClause, bi as projectColumnClause, Si as projectMatchesFilter, od as pruneReplicationOps, sd as pruneReplicationOpsUntilCaughtUp, Pf as rawEventsGate, gp as readAuthFile, Rt as readCodememConfigFile, zt as readCodememConfigFileAtPath, Al as readCoordinatorSyncConfig, Kh as readImportPayload, Pt as readWorkspaceCodememConfigFile, yy as reassignProjectScopeInventoryProject, Ka as recencyScore, vr as recordNonce, Wb as recordPeerSuccess, $u as recordReplicationOp, Ub as recordSyncAttempt, rp as redactText, hu as refreshConfiguredScopeMembershipCache, mu as refreshScopeMembershipCache, Ll as refreshStoredCoordinatorPeerAddresses, Nl as registerCoordinatorPresence, Hd as rejectInboundScopeFailures, Cp as renderObserverHeaders, _v as replayBatchExtraction, vv as replayBatchExtractionWithTierRouting, xd as replicationOpRequiresPersonalScopeAuthorization, xl as requestJson, Lo as rerankResults, Zt as resolveBuiltInProviderDefaultModel, Xt as resolveBuiltInProviderFromModel, Qt as resolveBuiltInProviderModel, It as resolveCodememConfigPath, cn as resolveCustomProviderDefaultModel, $t as resolveCustomProviderFromModel, ln as resolveCustomProviderModel, Dn as resolveDbPath, Ar as resolveHookProject, tr as resolveKeyPaths, sp as resolveOAuthProvider, en as resolvePlaceholder, wi as resolveProject, Bi as resolveProjectScope, Mf as retryRawEventFailures, hp as runAuthCommand, wh as runDedupKeyBackfillPass, jy as runRefBackfillPass, Fv as runScopeBackfillPass, Wy as runSessionContextBackfillPass, $y as runSummaryDedupBackfillPass, Lx as runSyncDaemon, Cx as runSyncPass, Ob as runVectorMigrationPass, Fg as sanitizePayload, Rg as sanitizeToolOutput, Im as scanSecretsRetroactive, H as schema, a as scopeMembershipEpochStatus, Ro as search, Qx as seedMixedScopeFixture, Bb as selectDialAddresses, As as semanticSearch, rs as serializeFloat32, Kb as setPeerLocalActorClaim, Gb as setPeerProjectFilter, Ju as setReplicationCursor, Mx as setSyncDaemonError, jx as setSyncDaemonOk, Px as setSyncDaemonPhase, zu as setSyncResetState, Ax as shouldSkipOfflinePeer, mr as signRequest, qr as startMaintenanceJob, $n as storePrivateKeyKeychain, Os as storeVectors, Tt as stripJsonComments, kg as stripPrivate, Ng as stripPrivateObj, Et as stripTrailingCommas, Ud as summarizeInboundScopeRejections, Ix as syncDaemonTick, Sx as syncOnce, xx as syncPassPreflight, _d as syncProjectAllowedByFilters, Yx as syncScopeResetRequiredPayload, vd as syncVisibilityAllowed, X as tableExists, Ho as timeline, Z as toJson, Gn as toJsonNullable, Jr as updateMaintenanceJob, Hb as updatePeerAddresses, iu as upsertCachedScopeMemberships, yh as upsertCoordinatorGroupPreference, by as upsertProjectScopeSettingsMapping, ai as vacuumDatabase, ur as validateExistingKeypair, hr as verifySignature, Bt as writeCodememConfigFile, Vt as writeWorkspaceCodememConfigFile };
|
|
17648
17650
|
|