@remnic/core 9.3.744 → 9.3.746
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/access-boundary.d.ts +17 -15
- package/dist/access-boundary.js +14 -15
- package/dist/access-cli.js +92 -33
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +17 -15
- package/dist/access-http.js +20 -21
- package/dist/access-mcp.d.ts +17 -15
- package/dist/access-mcp.js +18 -19
- package/dist/access-operations-batch.js +16 -17
- package/dist/access-operations.d.ts +17 -15
- package/dist/access-operations.js +17 -18
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-OT3Gk79W.d.ts → access-service-Cx16nmCv.d.ts} +3 -30
- package/dist/access-service.d.ts +7 -5
- package/dist/access-service.js +13 -14
- package/dist/access-surface-catalog.d.ts +17 -15
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/{auto-sync-XHSKKQAH.js → auto-sync-IEBKPGAM.js} +2 -2
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +6 -4
- package/dist/briefing.d.ts +1 -1
- package/dist/briefing.js +3 -3
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer.d.ts +1 -1
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{catalog-CX0CjOaf.d.ts → catalog-D_ZDxu8Y.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +4 -4
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-WPLRJ4XM.js → chunk-24YDB5QP.js} +2098 -230
- package/dist/chunk-24YDB5QP.js.map +1 -0
- package/dist/{chunk-6XG3NQRC.js → chunk-3IJGF6K2.js} +2 -2
- package/dist/{chunk-U5WVRMCA.js → chunk-5IN26V6W.js} +2 -2
- package/dist/{chunk-XEADGIAA.js → chunk-DIHCFJVV.js} +7 -7
- package/dist/{chunk-C7LDPZJJ.js → chunk-EHYB325U.js} +227 -227
- package/dist/chunk-EHYB325U.js.map +1 -0
- package/dist/{chunk-E7RGJQWP.js → chunk-HIHCB2S6.js} +2 -2
- package/dist/{chunk-JFCS6PQU.js → chunk-JHQUIH3W.js} +5 -5
- package/dist/{chunk-MXDG6SRH.js → chunk-JRDPT6DA.js} +2 -2
- package/dist/{chunk-BYLC4DKI.js → chunk-KMNYXLPL.js} +2 -2
- package/dist/{chunk-TQPSOTC7.js → chunk-L4N7SVNN.js} +8 -10
- package/dist/{chunk-TQPSOTC7.js.map → chunk-L4N7SVNN.js.map} +1 -1
- package/dist/{chunk-DYK27X7V.js → chunk-LMFS64GY.js} +3 -3
- package/dist/{chunk-FWXLKH2H.js → chunk-NVYF5OB6.js} +3 -3
- package/dist/{chunk-G5FP7VSQ.js → chunk-P4FW3ZU5.js} +58 -60
- package/dist/{chunk-G5FP7VSQ.js.map → chunk-P4FW3ZU5.js.map} +1 -1
- package/dist/{chunk-SODQQCAZ.js → chunk-PJE6D3NH.js} +10362 -4909
- package/dist/chunk-PJE6D3NH.js.map +1 -0
- package/dist/{chunk-56F6EAQ6.js → chunk-Q3X7GUAQ.js} +2 -2
- package/dist/{chunk-7N7S2RKF.js → chunk-R2OAN6IP.js} +2 -2
- package/dist/{chunk-CHELXDTO.js → chunk-RB6A7OUN.js} +2 -2
- package/dist/{chunk-3EA5LIFJ.js → chunk-SIV3JZPP.js} +2 -2
- package/dist/{chunk-IP5SANO2.js → chunk-UIKZZ242.js} +2 -2
- package/dist/{chunk-UGFPGWJB.js → chunk-URQLO7BX.js} +2 -2
- package/dist/{chunk-5UNSGRCR.js → chunk-WK3NK6SP.js} +162 -16
- package/dist/chunk-WK3NK6SP.js.map +1 -0
- package/dist/{chunk-VE54E6RP.js → chunk-WWVXXSLF.js} +4 -6
- package/dist/{chunk-VE54E6RP.js.map → chunk-WWVXXSLF.js.map} +1 -1
- package/dist/{chunk-WO22UEM3.js → chunk-XTEWVF3C.js} +2 -2
- package/dist/{chunk-FCQ7ZYCQ.js → chunk-ZGAJB74V.js} +2 -2
- package/dist/{chunk-NBP3YHHS.js → chunk-ZGZNLRKF.js} +2 -2
- package/dist/{chunk-C7C5WIIF.js → chunk-ZPZ4VVLT.js} +2 -2
- package/dist/{cli-BQiTZ7Zs.d.ts → cli-D1y3vooB.d.ts} +3 -3
- package/dist/cli.d.ts +9 -7
- package/dist/cli.js +44 -46
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +3 -3
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +3 -3
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +3 -3
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/contradiction/index.d.ts +1 -1
- package/dist/contradiction/index.js +4 -4
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +3 -3
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +6 -4
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/graph-dashboard-diff.d.ts +1 -1
- package/dist/graph-dashboard-key.d.ts +1 -1
- package/dist/graph-dashboard-parser.d.ts +1 -1
- package/dist/graph-edge-reinforcement.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index.d.ts +12 -10
- package/dist/index.js +271 -5362
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +3 -3
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
- package/dist/maintenance/rebuild-memory-projection.js +4 -4
- package/dist/mcp-memory-inspector-app.d.ts +16 -14
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +1 -1
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +2 -2
- package/dist/namespaces/migrate.js +4 -4
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/storage.d.ts +2 -2
- package/dist/namespaces/storage.js +3 -3
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +10 -11
- package/dist/orchestration/compression-guideline-coordinator.d.ts +1 -1
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +5 -5
- package/dist/{orchestrator-BPQGHpJz.d.ts → orchestrator-CnCE3Hvq.d.ts} +180 -12
- package/dist/orchestrator.d.ts +6 -4
- package/dist/orchestrator.js +119 -16
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray.d.ts +1 -1
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/index.d.ts +1 -1
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-ByzGwC9c.d.ts → semantic-consolidation-D3aSiu9t.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +4 -4
- package/dist/semantic-rule-promotion.js +3 -3
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +3 -3
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +2 -2
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/temporal-supersession.d.ts +1 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +1 -1
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +1 -1
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-5Jik3r4G.d.ts → types-CZm6rx9-.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +3 -3
- package/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/orchestration/consolidation-run.ts +633 -0
- package/src/orchestration/extraction-persist.ts +2785 -0
- package/src/orchestration/extraction-run.ts +874 -0
- package/src/orchestrator.ts +206 -3815
- package/dist/chunk-5UNSGRCR.js.map +0 -1
- package/dist/chunk-A2KKLCOS.js +0 -1889
- package/dist/chunk-A2KKLCOS.js.map +0 -1
- package/dist/chunk-AVBT5WEW.js +0 -153
- package/dist/chunk-AVBT5WEW.js.map +0 -1
- package/dist/chunk-C7LDPZJJ.js.map +0 -1
- package/dist/chunk-SODQQCAZ.js.map +0 -1
- package/dist/chunk-WPLRJ4XM.js.map +0 -1
- /package/dist/{auto-sync-XHSKKQAH.js.map → auto-sync-IEBKPGAM.js.map} +0 -0
- /package/dist/{chunk-6XG3NQRC.js.map → chunk-3IJGF6K2.js.map} +0 -0
- /package/dist/{chunk-U5WVRMCA.js.map → chunk-5IN26V6W.js.map} +0 -0
- /package/dist/{chunk-XEADGIAA.js.map → chunk-DIHCFJVV.js.map} +0 -0
- /package/dist/{chunk-E7RGJQWP.js.map → chunk-HIHCB2S6.js.map} +0 -0
- /package/dist/{chunk-JFCS6PQU.js.map → chunk-JHQUIH3W.js.map} +0 -0
- /package/dist/{chunk-MXDG6SRH.js.map → chunk-JRDPT6DA.js.map} +0 -0
- /package/dist/{chunk-BYLC4DKI.js.map → chunk-KMNYXLPL.js.map} +0 -0
- /package/dist/{chunk-DYK27X7V.js.map → chunk-LMFS64GY.js.map} +0 -0
- /package/dist/{chunk-FWXLKH2H.js.map → chunk-NVYF5OB6.js.map} +0 -0
- /package/dist/{chunk-56F6EAQ6.js.map → chunk-Q3X7GUAQ.js.map} +0 -0
- /package/dist/{chunk-7N7S2RKF.js.map → chunk-R2OAN6IP.js.map} +0 -0
- /package/dist/{chunk-CHELXDTO.js.map → chunk-RB6A7OUN.js.map} +0 -0
- /package/dist/{chunk-3EA5LIFJ.js.map → chunk-SIV3JZPP.js.map} +0 -0
- /package/dist/{chunk-IP5SANO2.js.map → chunk-UIKZZ242.js.map} +0 -0
- /package/dist/{chunk-UGFPGWJB.js.map → chunk-URQLO7BX.js.map} +0 -0
- /package/dist/{chunk-WO22UEM3.js.map → chunk-XTEWVF3C.js.map} +0 -0
- /package/dist/{chunk-FCQ7ZYCQ.js.map → chunk-ZGAJB74V.js.map} +0 -0
- /package/dist/{chunk-NBP3YHHS.js.map → chunk-ZGZNLRKF.js.map} +0 -0
- /package/dist/{chunk-C7C5WIIF.js.map → chunk-ZPZ4VVLT.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager,
|
|
3
3
|
normalizeEntityName
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JHQUIH3W.js";
|
|
5
5
|
import {
|
|
6
6
|
serializeMutations
|
|
7
7
|
} from "./chunk-LTJAMRGI.js";
|
|
@@ -956,4 +956,4 @@ export {
|
|
|
956
956
|
resolveBriefingSaveDir,
|
|
957
957
|
briefingFilename
|
|
958
958
|
};
|
|
959
|
-
//# sourceMappingURL=chunk-
|
|
959
|
+
//# sourceMappingURL=chunk-3IJGF6K2.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-ZFXCQPNO.js";
|
|
5
5
|
import {
|
|
6
6
|
StorageManager
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JHQUIH3W.js";
|
|
8
8
|
import {
|
|
9
9
|
MutationSerializer
|
|
10
10
|
} from "./chunk-LTJAMRGI.js";
|
|
@@ -339,4 +339,4 @@ export {
|
|
|
339
339
|
resolveNamespaceStorageRoot,
|
|
340
340
|
NamespaceStorageRouter
|
|
341
341
|
};
|
|
342
|
-
//# sourceMappingURL=chunk-
|
|
342
|
+
//# sourceMappingURL=chunk-5IN26V6W.js.map
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
runGraphEdgeDecayMaintenanceAcrossNamespaces
|
|
6
6
|
} from "./chunk-ZQNCHPTZ.js";
|
|
7
|
+
import {
|
|
8
|
+
runContradictionScan
|
|
9
|
+
} from "./chunk-EEKDRAWX.js";
|
|
7
10
|
import {
|
|
8
11
|
executeResolution,
|
|
9
12
|
isValidResolutionVerb
|
|
10
13
|
} from "./chunk-DJECGBBM.js";
|
|
11
|
-
import {
|
|
12
|
-
runContradictionScan
|
|
13
|
-
} from "./chunk-EEKDRAWX.js";
|
|
14
14
|
import {
|
|
15
15
|
isDefaultReviewNamespace,
|
|
16
16
|
listPairs
|
|
@@ -21,16 +21,16 @@ import {
|
|
|
21
21
|
} from "./chunk-T4WDJPEZ.js";
|
|
22
22
|
import {
|
|
23
23
|
defineOperation
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-KMNYXLPL.js";
|
|
25
25
|
import {
|
|
26
26
|
EngramAccessInputError
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-24YDB5QP.js";
|
|
28
28
|
import {
|
|
29
29
|
projectTagProjectId
|
|
30
30
|
} from "./chunk-W3M34XT4.js";
|
|
31
31
|
import {
|
|
32
32
|
validateBriefingFormat
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-3IJGF6K2.js";
|
|
34
34
|
import {
|
|
35
35
|
resolvePrincipal
|
|
36
36
|
} from "./chunk-PE6XR4GG.js";
|
|
@@ -417,4 +417,4 @@ defineOperation({ name: "offline_sync_snapshot_stream", description: "SSE stream
|
|
|
417
417
|
defineOperation({ name: "graph_events", description: "SSE graph events.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: "sse" } }) });
|
|
418
418
|
defineOperation({ name: "chat_message", description: "Chat message.", schema: strictSchema({ message: S.str, chatSessionId: S.str }), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
|
|
419
419
|
defineOperation({ name: "chat_events", description: "SSE chat events.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: "sse" } }) });
|
|
420
|
-
//# sourceMappingURL=chunk-
|
|
420
|
+
//# sourceMappingURL=chunk-DIHCFJVV.js.map
|
|
@@ -30,6 +30,224 @@ import {
|
|
|
30
30
|
serializeDayTranscript
|
|
31
31
|
} from "./chunk-M7XQSUBB.js";
|
|
32
32
|
|
|
33
|
+
// src/wearables/cleanup.ts
|
|
34
|
+
var MERGE_GAP_MS = 3e4;
|
|
35
|
+
var FILLER_TOKENS = ["um", "uh", "uhm", "umm", "uhh", "erm", "hmm", "mhm"];
|
|
36
|
+
var FILLER_PATTERN = new RegExp(
|
|
37
|
+
// Leading/trailing punctuation around the filler collapses with it so
|
|
38
|
+
// "Um, so we should" -> "so we should" rather than ", so we should".
|
|
39
|
+
`(?:^|\\s)(?:${FILLER_TOKENS.join("|")})[,.]?(?=\\s|$)`,
|
|
40
|
+
"gi"
|
|
41
|
+
);
|
|
42
|
+
function cleanConversation(conversation, settings) {
|
|
43
|
+
let segments = conversation.segments.map((segment) => ({ ...segment }));
|
|
44
|
+
let droppedSegments = 0;
|
|
45
|
+
let mergedSegments = 0;
|
|
46
|
+
if (settings.stripFillers) {
|
|
47
|
+
for (const segment of segments) {
|
|
48
|
+
segment.text = stripFillerTokens(segment.text);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (settings.collapseRepeats) {
|
|
52
|
+
for (const segment of segments) {
|
|
53
|
+
segment.text = collapseImmediateRepeats(segment.text);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
for (const segment of segments) {
|
|
57
|
+
segment.text = normalizeWhitespace(segment.text);
|
|
58
|
+
}
|
|
59
|
+
if (settings.dropLowQuality) {
|
|
60
|
+
const kept = [];
|
|
61
|
+
for (const segment of segments) {
|
|
62
|
+
if (isLowQualitySegment(segment.text)) {
|
|
63
|
+
droppedSegments += 1;
|
|
64
|
+
} else {
|
|
65
|
+
kept.push(segment);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
segments = kept;
|
|
69
|
+
} else {
|
|
70
|
+
const kept = segments.filter((segment) => segment.text.length > 0);
|
|
71
|
+
droppedSegments += segments.length - kept.length;
|
|
72
|
+
segments = kept;
|
|
73
|
+
}
|
|
74
|
+
if (settings.mergeSameSpeaker) {
|
|
75
|
+
const merged = [];
|
|
76
|
+
for (const segment of segments) {
|
|
77
|
+
const previous = merged[merged.length - 1];
|
|
78
|
+
if (previous && canMerge(previous, segment)) {
|
|
79
|
+
previous.text = `${previous.text} ${segment.text}`.trim();
|
|
80
|
+
if (segment.endIso) previous.endIso = segment.endIso;
|
|
81
|
+
mergedSegments += 1;
|
|
82
|
+
} else {
|
|
83
|
+
merged.push(segment);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
segments = merged;
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
conversation: { ...conversation, segments },
|
|
90
|
+
droppedSegments,
|
|
91
|
+
mergedSegments
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function canMerge(previous, next) {
|
|
95
|
+
if (previous.speakerKey !== next.speakerKey) return false;
|
|
96
|
+
const previousEnd = previous.endIso ? Date.parse(previous.endIso) : NaN;
|
|
97
|
+
const nextStart = next.startIso ? Date.parse(next.startIso) : NaN;
|
|
98
|
+
if (Number.isNaN(previousEnd) || Number.isNaN(nextStart)) return true;
|
|
99
|
+
return nextStart - previousEnd <= MERGE_GAP_MS;
|
|
100
|
+
}
|
|
101
|
+
function stripFillerTokens(text) {
|
|
102
|
+
return normalizeWhitespace(text.replace(FILLER_PATTERN, " "));
|
|
103
|
+
}
|
|
104
|
+
function collapseImmediateRepeats(text) {
|
|
105
|
+
const words = text.split(/\s+/).filter((word) => word.length > 0);
|
|
106
|
+
if (words.length < 2) return text.trim();
|
|
107
|
+
const out = [];
|
|
108
|
+
let index = 0;
|
|
109
|
+
while (index < words.length) {
|
|
110
|
+
out.push(words[index]);
|
|
111
|
+
index += 1;
|
|
112
|
+
let matched = true;
|
|
113
|
+
while (matched) {
|
|
114
|
+
matched = false;
|
|
115
|
+
for (let size = 4; size >= 1; size--) {
|
|
116
|
+
if (out.length < size || index + size > words.length) continue;
|
|
117
|
+
const tail = out.slice(-size).join(" ").toLowerCase();
|
|
118
|
+
if (!/\p{L}/u.test(tail)) continue;
|
|
119
|
+
const ahead = words.slice(index, index + size).join(" ").toLowerCase();
|
|
120
|
+
if (tail === ahead) {
|
|
121
|
+
index += size;
|
|
122
|
+
matched = true;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return out.join(" ");
|
|
129
|
+
}
|
|
130
|
+
function isLowQualitySegment(text) {
|
|
131
|
+
const trimmed = text.trim();
|
|
132
|
+
if (trimmed.length === 0) return true;
|
|
133
|
+
if (/^(.)\1{4,}$/.test(trimmed)) return true;
|
|
134
|
+
const letters = trimmed.replace(/[^\p{L}\p{N}]/gu, "");
|
|
135
|
+
if (letters.length === 0) return true;
|
|
136
|
+
if (trimmed.length >= 12 && letters.length / trimmed.length < 0.3) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
const words = trimmed.toLowerCase().split(/\s+/);
|
|
140
|
+
if (words.length >= 5) {
|
|
141
|
+
const unique = new Set(words);
|
|
142
|
+
if (unique.size === 1) return true;
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
function normalizeWhitespace(text) {
|
|
147
|
+
return text.replace(/\s+/g, " ").trim();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// src/wearables/sync-state.ts
|
|
151
|
+
import { promises as fsPromises } from "fs";
|
|
152
|
+
import * as path from "path";
|
|
153
|
+
var MAX_TRACKED_NATIVE_IDS = 5e3;
|
|
154
|
+
var MAX_TRACKED_DAY_HASHES = 800;
|
|
155
|
+
function syncStateFilePath(memoryDir) {
|
|
156
|
+
return path.join(memoryDir, "state", "wearables", "sync.json");
|
|
157
|
+
}
|
|
158
|
+
function emptySyncState() {
|
|
159
|
+
return { version: 1, sources: {} };
|
|
160
|
+
}
|
|
161
|
+
async function loadSyncState(memoryDir) {
|
|
162
|
+
const filePath = syncStateFilePath(memoryDir);
|
|
163
|
+
let raw;
|
|
164
|
+
try {
|
|
165
|
+
raw = await fsPromises.readFile(filePath, "utf-8");
|
|
166
|
+
} catch (err) {
|
|
167
|
+
if (err.code === "ENOENT") {
|
|
168
|
+
return emptySyncState();
|
|
169
|
+
}
|
|
170
|
+
throw err;
|
|
171
|
+
}
|
|
172
|
+
let parsed;
|
|
173
|
+
try {
|
|
174
|
+
parsed = JSON.parse(raw);
|
|
175
|
+
} catch {
|
|
176
|
+
return emptySyncState();
|
|
177
|
+
}
|
|
178
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed) || typeof parsed.sources !== "object" || parsed.sources === null) {
|
|
179
|
+
return emptySyncState();
|
|
180
|
+
}
|
|
181
|
+
return { version: 1, sources: parsed.sources };
|
|
182
|
+
}
|
|
183
|
+
async function saveSyncState(memoryDir, state) {
|
|
184
|
+
const filePath = syncStateFilePath(memoryDir);
|
|
185
|
+
await fsPromises.mkdir(path.dirname(filePath), { recursive: true });
|
|
186
|
+
const tmpPath = `${filePath}.tmp-${process.pid}-${Date.now().toString(36)}`;
|
|
187
|
+
await fsPromises.writeFile(
|
|
188
|
+
tmpPath,
|
|
189
|
+
`${JSON.stringify(state, null, 2)}
|
|
190
|
+
`,
|
|
191
|
+
"utf-8"
|
|
192
|
+
);
|
|
193
|
+
try {
|
|
194
|
+
await fsPromises.rename(tmpPath, filePath);
|
|
195
|
+
} catch (err) {
|
|
196
|
+
await fsPromises.unlink(tmpPath).catch(() => void 0);
|
|
197
|
+
throw err;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function updateSourceSyncState(state, sourceId, update) {
|
|
201
|
+
const previous = state.sources[sourceId];
|
|
202
|
+
const mergedHashes = {
|
|
203
|
+
...previous?.dayHashes ?? {},
|
|
204
|
+
...update.dayHashes
|
|
205
|
+
};
|
|
206
|
+
const hashKeys = Object.keys(mergedHashes).sort();
|
|
207
|
+
while (hashKeys.length > MAX_TRACKED_DAY_HASHES) {
|
|
208
|
+
const oldest = hashKeys.shift();
|
|
209
|
+
if (oldest === void 0) break;
|
|
210
|
+
delete mergedHashes[oldest];
|
|
211
|
+
}
|
|
212
|
+
const mergedMemoryHashes = {
|
|
213
|
+
...previous?.memoryDayHashes ?? {},
|
|
214
|
+
...update.memoryDayHashes ?? {}
|
|
215
|
+
};
|
|
216
|
+
for (const day of update.clearMemoryDays ?? []) {
|
|
217
|
+
if (!(day in (update.memoryDayHashes ?? {}))) {
|
|
218
|
+
delete mergedMemoryHashes[day];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const memoryHashKeys = Object.keys(mergedMemoryHashes).sort();
|
|
222
|
+
while (memoryHashKeys.length > MAX_TRACKED_DAY_HASHES) {
|
|
223
|
+
const oldest = memoryHashKeys.shift();
|
|
224
|
+
if (oldest === void 0) break;
|
|
225
|
+
delete mergedMemoryHashes[oldest];
|
|
226
|
+
}
|
|
227
|
+
const mergedNativeIds = [
|
|
228
|
+
...previous?.importedNativeMemoryIds ?? [],
|
|
229
|
+
...update.importedNativeMemoryIds ?? []
|
|
230
|
+
];
|
|
231
|
+
const dedupedNativeIds = [...new Set(mergedNativeIds)];
|
|
232
|
+
const boundedNativeIds = dedupedNativeIds.length > MAX_TRACKED_NATIVE_IDS ? dedupedNativeIds.slice(dedupedNativeIds.length - MAX_TRACKED_NATIVE_IDS) : dedupedNativeIds;
|
|
233
|
+
const sortedDays = [...update.days].sort();
|
|
234
|
+
const latestDay = sortedDays[sortedDays.length - 1];
|
|
235
|
+
const lastDateSynced = latestDay !== void 0 && (!previous || previous.lastDateSynced < latestDay) ? latestDay : previous?.lastDateSynced ?? latestDay ?? "";
|
|
236
|
+
return {
|
|
237
|
+
version: 1,
|
|
238
|
+
sources: {
|
|
239
|
+
...state.sources,
|
|
240
|
+
[sourceId]: {
|
|
241
|
+
lastSyncAt: update.syncedAt,
|
|
242
|
+
lastDateSynced,
|
|
243
|
+
dayHashes: mergedHashes,
|
|
244
|
+
memoryDayHashes: mergedMemoryHashes,
|
|
245
|
+
importedNativeMemoryIds: boundedNativeIds
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
33
251
|
// src/wearables/trust.ts
|
|
34
252
|
var TRUST_JUDGE_ACCEPT_BOOST = 0.15;
|
|
35
253
|
var TRUST_CROSS_SOURCE_BOOST = 0.15;
|
|
@@ -543,224 +761,6 @@ async function importNativeMemories(sourceId, memories, alreadyImportedIds, sett
|
|
|
543
761
|
return { imported, tombstoneBlocked, importedIds, warnings };
|
|
544
762
|
}
|
|
545
763
|
|
|
546
|
-
// src/wearables/cleanup.ts
|
|
547
|
-
var MERGE_GAP_MS = 3e4;
|
|
548
|
-
var FILLER_TOKENS = ["um", "uh", "uhm", "umm", "uhh", "erm", "hmm", "mhm"];
|
|
549
|
-
var FILLER_PATTERN = new RegExp(
|
|
550
|
-
// Leading/trailing punctuation around the filler collapses with it so
|
|
551
|
-
// "Um, so we should" -> "so we should" rather than ", so we should".
|
|
552
|
-
`(?:^|\\s)(?:${FILLER_TOKENS.join("|")})[,.]?(?=\\s|$)`,
|
|
553
|
-
"gi"
|
|
554
|
-
);
|
|
555
|
-
function cleanConversation(conversation, settings) {
|
|
556
|
-
let segments = conversation.segments.map((segment) => ({ ...segment }));
|
|
557
|
-
let droppedSegments = 0;
|
|
558
|
-
let mergedSegments = 0;
|
|
559
|
-
if (settings.stripFillers) {
|
|
560
|
-
for (const segment of segments) {
|
|
561
|
-
segment.text = stripFillerTokens(segment.text);
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
if (settings.collapseRepeats) {
|
|
565
|
-
for (const segment of segments) {
|
|
566
|
-
segment.text = collapseImmediateRepeats(segment.text);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
for (const segment of segments) {
|
|
570
|
-
segment.text = normalizeWhitespace(segment.text);
|
|
571
|
-
}
|
|
572
|
-
if (settings.dropLowQuality) {
|
|
573
|
-
const kept = [];
|
|
574
|
-
for (const segment of segments) {
|
|
575
|
-
if (isLowQualitySegment(segment.text)) {
|
|
576
|
-
droppedSegments += 1;
|
|
577
|
-
} else {
|
|
578
|
-
kept.push(segment);
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
segments = kept;
|
|
582
|
-
} else {
|
|
583
|
-
const kept = segments.filter((segment) => segment.text.length > 0);
|
|
584
|
-
droppedSegments += segments.length - kept.length;
|
|
585
|
-
segments = kept;
|
|
586
|
-
}
|
|
587
|
-
if (settings.mergeSameSpeaker) {
|
|
588
|
-
const merged = [];
|
|
589
|
-
for (const segment of segments) {
|
|
590
|
-
const previous = merged[merged.length - 1];
|
|
591
|
-
if (previous && canMerge(previous, segment)) {
|
|
592
|
-
previous.text = `${previous.text} ${segment.text}`.trim();
|
|
593
|
-
if (segment.endIso) previous.endIso = segment.endIso;
|
|
594
|
-
mergedSegments += 1;
|
|
595
|
-
} else {
|
|
596
|
-
merged.push(segment);
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
segments = merged;
|
|
600
|
-
}
|
|
601
|
-
return {
|
|
602
|
-
conversation: { ...conversation, segments },
|
|
603
|
-
droppedSegments,
|
|
604
|
-
mergedSegments
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
function canMerge(previous, next) {
|
|
608
|
-
if (previous.speakerKey !== next.speakerKey) return false;
|
|
609
|
-
const previousEnd = previous.endIso ? Date.parse(previous.endIso) : NaN;
|
|
610
|
-
const nextStart = next.startIso ? Date.parse(next.startIso) : NaN;
|
|
611
|
-
if (Number.isNaN(previousEnd) || Number.isNaN(nextStart)) return true;
|
|
612
|
-
return nextStart - previousEnd <= MERGE_GAP_MS;
|
|
613
|
-
}
|
|
614
|
-
function stripFillerTokens(text) {
|
|
615
|
-
return normalizeWhitespace(text.replace(FILLER_PATTERN, " "));
|
|
616
|
-
}
|
|
617
|
-
function collapseImmediateRepeats(text) {
|
|
618
|
-
const words = text.split(/\s+/).filter((word) => word.length > 0);
|
|
619
|
-
if (words.length < 2) return text.trim();
|
|
620
|
-
const out = [];
|
|
621
|
-
let index = 0;
|
|
622
|
-
while (index < words.length) {
|
|
623
|
-
out.push(words[index]);
|
|
624
|
-
index += 1;
|
|
625
|
-
let matched = true;
|
|
626
|
-
while (matched) {
|
|
627
|
-
matched = false;
|
|
628
|
-
for (let size = 4; size >= 1; size--) {
|
|
629
|
-
if (out.length < size || index + size > words.length) continue;
|
|
630
|
-
const tail = out.slice(-size).join(" ").toLowerCase();
|
|
631
|
-
if (!/\p{L}/u.test(tail)) continue;
|
|
632
|
-
const ahead = words.slice(index, index + size).join(" ").toLowerCase();
|
|
633
|
-
if (tail === ahead) {
|
|
634
|
-
index += size;
|
|
635
|
-
matched = true;
|
|
636
|
-
break;
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
return out.join(" ");
|
|
642
|
-
}
|
|
643
|
-
function isLowQualitySegment(text) {
|
|
644
|
-
const trimmed = text.trim();
|
|
645
|
-
if (trimmed.length === 0) return true;
|
|
646
|
-
if (/^(.)\1{4,}$/.test(trimmed)) return true;
|
|
647
|
-
const letters = trimmed.replace(/[^\p{L}\p{N}]/gu, "");
|
|
648
|
-
if (letters.length === 0) return true;
|
|
649
|
-
if (trimmed.length >= 12 && letters.length / trimmed.length < 0.3) {
|
|
650
|
-
return true;
|
|
651
|
-
}
|
|
652
|
-
const words = trimmed.toLowerCase().split(/\s+/);
|
|
653
|
-
if (words.length >= 5) {
|
|
654
|
-
const unique = new Set(words);
|
|
655
|
-
if (unique.size === 1) return true;
|
|
656
|
-
}
|
|
657
|
-
return false;
|
|
658
|
-
}
|
|
659
|
-
function normalizeWhitespace(text) {
|
|
660
|
-
return text.replace(/\s+/g, " ").trim();
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
// src/wearables/sync-state.ts
|
|
664
|
-
import { promises as fsPromises } from "fs";
|
|
665
|
-
import * as path from "path";
|
|
666
|
-
var MAX_TRACKED_NATIVE_IDS = 5e3;
|
|
667
|
-
var MAX_TRACKED_DAY_HASHES = 800;
|
|
668
|
-
function syncStateFilePath(memoryDir) {
|
|
669
|
-
return path.join(memoryDir, "state", "wearables", "sync.json");
|
|
670
|
-
}
|
|
671
|
-
function emptySyncState() {
|
|
672
|
-
return { version: 1, sources: {} };
|
|
673
|
-
}
|
|
674
|
-
async function loadSyncState(memoryDir) {
|
|
675
|
-
const filePath = syncStateFilePath(memoryDir);
|
|
676
|
-
let raw;
|
|
677
|
-
try {
|
|
678
|
-
raw = await fsPromises.readFile(filePath, "utf-8");
|
|
679
|
-
} catch (err) {
|
|
680
|
-
if (err.code === "ENOENT") {
|
|
681
|
-
return emptySyncState();
|
|
682
|
-
}
|
|
683
|
-
throw err;
|
|
684
|
-
}
|
|
685
|
-
let parsed;
|
|
686
|
-
try {
|
|
687
|
-
parsed = JSON.parse(raw);
|
|
688
|
-
} catch {
|
|
689
|
-
return emptySyncState();
|
|
690
|
-
}
|
|
691
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed) || typeof parsed.sources !== "object" || parsed.sources === null) {
|
|
692
|
-
return emptySyncState();
|
|
693
|
-
}
|
|
694
|
-
return { version: 1, sources: parsed.sources };
|
|
695
|
-
}
|
|
696
|
-
async function saveSyncState(memoryDir, state) {
|
|
697
|
-
const filePath = syncStateFilePath(memoryDir);
|
|
698
|
-
await fsPromises.mkdir(path.dirname(filePath), { recursive: true });
|
|
699
|
-
const tmpPath = `${filePath}.tmp-${process.pid}-${Date.now().toString(36)}`;
|
|
700
|
-
await fsPromises.writeFile(
|
|
701
|
-
tmpPath,
|
|
702
|
-
`${JSON.stringify(state, null, 2)}
|
|
703
|
-
`,
|
|
704
|
-
"utf-8"
|
|
705
|
-
);
|
|
706
|
-
try {
|
|
707
|
-
await fsPromises.rename(tmpPath, filePath);
|
|
708
|
-
} catch (err) {
|
|
709
|
-
await fsPromises.unlink(tmpPath).catch(() => void 0);
|
|
710
|
-
throw err;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
function updateSourceSyncState(state, sourceId, update) {
|
|
714
|
-
const previous = state.sources[sourceId];
|
|
715
|
-
const mergedHashes = {
|
|
716
|
-
...previous?.dayHashes ?? {},
|
|
717
|
-
...update.dayHashes
|
|
718
|
-
};
|
|
719
|
-
const hashKeys = Object.keys(mergedHashes).sort();
|
|
720
|
-
while (hashKeys.length > MAX_TRACKED_DAY_HASHES) {
|
|
721
|
-
const oldest = hashKeys.shift();
|
|
722
|
-
if (oldest === void 0) break;
|
|
723
|
-
delete mergedHashes[oldest];
|
|
724
|
-
}
|
|
725
|
-
const mergedMemoryHashes = {
|
|
726
|
-
...previous?.memoryDayHashes ?? {},
|
|
727
|
-
...update.memoryDayHashes ?? {}
|
|
728
|
-
};
|
|
729
|
-
for (const day of update.clearMemoryDays ?? []) {
|
|
730
|
-
if (!(day in (update.memoryDayHashes ?? {}))) {
|
|
731
|
-
delete mergedMemoryHashes[day];
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
const memoryHashKeys = Object.keys(mergedMemoryHashes).sort();
|
|
735
|
-
while (memoryHashKeys.length > MAX_TRACKED_DAY_HASHES) {
|
|
736
|
-
const oldest = memoryHashKeys.shift();
|
|
737
|
-
if (oldest === void 0) break;
|
|
738
|
-
delete mergedMemoryHashes[oldest];
|
|
739
|
-
}
|
|
740
|
-
const mergedNativeIds = [
|
|
741
|
-
...previous?.importedNativeMemoryIds ?? [],
|
|
742
|
-
...update.importedNativeMemoryIds ?? []
|
|
743
|
-
];
|
|
744
|
-
const dedupedNativeIds = [...new Set(mergedNativeIds)];
|
|
745
|
-
const boundedNativeIds = dedupedNativeIds.length > MAX_TRACKED_NATIVE_IDS ? dedupedNativeIds.slice(dedupedNativeIds.length - MAX_TRACKED_NATIVE_IDS) : dedupedNativeIds;
|
|
746
|
-
const sortedDays = [...update.days].sort();
|
|
747
|
-
const latestDay = sortedDays[sortedDays.length - 1];
|
|
748
|
-
const lastDateSynced = latestDay !== void 0 && (!previous || previous.lastDateSynced < latestDay) ? latestDay : previous?.lastDateSynced ?? latestDay ?? "";
|
|
749
|
-
return {
|
|
750
|
-
version: 1,
|
|
751
|
-
sources: {
|
|
752
|
-
...state.sources,
|
|
753
|
-
[sourceId]: {
|
|
754
|
-
lastSyncAt: update.syncedAt,
|
|
755
|
-
lastDateSynced,
|
|
756
|
-
dayHashes: mergedHashes,
|
|
757
|
-
memoryDayHashes: mergedMemoryHashes,
|
|
758
|
-
importedNativeMemoryIds: boundedNativeIds
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
};
|
|
762
|
-
}
|
|
763
|
-
|
|
764
764
|
// src/wearables/pipeline.ts
|
|
765
765
|
var PAGE_SAFETY_CEILING = 1e4;
|
|
766
766
|
var DEFAULT_SYNC_DAYS = 2;
|
|
@@ -1154,14 +1154,6 @@ function defaultTimezone() {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
|
|
1156
1156
|
export {
|
|
1157
|
-
memoryStatusForMode,
|
|
1158
|
-
WEARABLE_SOURCE_PREFIX,
|
|
1159
|
-
wearableSourceLabel,
|
|
1160
|
-
wearableDayTag,
|
|
1161
|
-
buildExtractionTurns,
|
|
1162
|
-
generateWearableMemories,
|
|
1163
|
-
writeDailyDigestMemory,
|
|
1164
|
-
importNativeMemories,
|
|
1165
1157
|
cleanConversation,
|
|
1166
1158
|
stripFillerTokens,
|
|
1167
1159
|
collapseImmediateRepeats,
|
|
@@ -1171,9 +1163,17 @@ export {
|
|
|
1171
1163
|
loadSyncState,
|
|
1172
1164
|
saveSyncState,
|
|
1173
1165
|
updateSourceSyncState,
|
|
1166
|
+
memoryStatusForMode,
|
|
1167
|
+
WEARABLE_SOURCE_PREFIX,
|
|
1168
|
+
wearableSourceLabel,
|
|
1169
|
+
wearableDayTag,
|
|
1170
|
+
buildExtractionTurns,
|
|
1171
|
+
generateWearableMemories,
|
|
1172
|
+
writeDailyDigestMemory,
|
|
1173
|
+
importNativeMemories,
|
|
1174
1174
|
dateInTimezone,
|
|
1175
1175
|
resolveSyncDates,
|
|
1176
1176
|
syncWearableSource,
|
|
1177
1177
|
defaultTimezone
|
|
1178
1178
|
};
|
|
1179
|
-
//# sourceMappingURL=chunk-
|
|
1179
|
+
//# sourceMappingURL=chunk-EHYB325U.js.map
|