@remnic/core 9.16.2 → 9.17.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.
Files changed (211) hide show
  1. package/dist/access-admin-ops-surface.d.ts +8 -8
  2. package/dist/access-boundary.d.ts +8 -8
  3. package/dist/access-cli.js +8 -8
  4. package/dist/access-http.d.ts +8 -8
  5. package/dist/access-identity-continuity-surface.d.ts +6 -6
  6. package/dist/access-lcm-surface.d.ts +8 -8
  7. package/dist/access-mcp.d.ts +8 -8
  8. package/dist/access-memory-search-fanout.d.ts +2 -2
  9. package/dist/{access-namespace-preflight-DwhEFYy3.d.ts → access-namespace-preflight-_yxq3PYy.d.ts} +1 -1
  10. package/dist/access-namespace-preflight.d.ts +3 -3
  11. package/dist/access-observe-write-surface.d.ts +8 -8
  12. package/dist/access-operations.d.ts +8 -8
  13. package/dist/access-recall-concurrency.d.ts +8 -8
  14. package/dist/access-recall-response.d.ts +8 -8
  15. package/dist/access-recall-surface.d.ts +8 -8
  16. package/dist/{access-service-CSq1Wp2Z.d.ts → access-service-CSm242ks.d.ts} +6 -6
  17. package/dist/access-service.d.ts +8 -8
  18. package/dist/access-surface-catalog.d.ts +8 -8
  19. package/dist/action-confidence.d.ts +1 -1
  20. package/dist/active-memory-bridge.d.ts +1 -1
  21. package/dist/active-recall.d.ts +1 -1
  22. package/dist/active-recall.js +2 -2
  23. package/dist/{auto-sync-UZG3XQZ5.js → auto-sync-IH3G25MT.js} +2 -2
  24. package/dist/behavior-learner.d.ts +1 -1
  25. package/dist/behavior-signals.d.ts +1 -1
  26. package/dist/bootstrap.d.ts +6 -6
  27. package/dist/briefing.d.ts +2 -2
  28. package/dist/buffer-surprise-report.d.ts +1 -1
  29. package/dist/buffer.d.ts +2 -2
  30. package/dist/bulk-import/index.d.ts +3 -3
  31. package/dist/calibration.d.ts +1 -1
  32. package/dist/capabilities.d.ts +1 -1
  33. package/dist/{catalog-B9uga4sG.d.ts → catalog-9qLG_2OV.d.ts} +1 -1
  34. package/dist/causal-behavior.d.ts +1 -1
  35. package/dist/causal-consolidation.d.ts +1 -1
  36. package/dist/causal-trajectory-graph.d.ts +1 -1
  37. package/dist/{chunk-5EKOBRCA.js → chunk-BCNVNUQG.js} +2 -2
  38. package/dist/{chunk-V6LYAXGW.js → chunk-F7BWFIDK.js} +2 -2
  39. package/dist/{chunk-BTK2PIFL.js → chunk-GBT4TFV7.js} +2 -2
  40. package/dist/{chunk-JOCXI2O5.js → chunk-K2B2TMF3.js} +2 -2
  41. package/dist/{chunk-GSQASASV.js → chunk-MONWCSVL.js} +65 -4
  42. package/dist/chunk-MONWCSVL.js.map +1 -0
  43. package/dist/{chunk-VLIY55Q5.js → chunk-TXXP7WAM.js} +4 -4
  44. package/dist/{chunk-YHURQ3M5.js → chunk-UH7VNQ7O.js} +268 -5
  45. package/dist/chunk-UH7VNQ7O.js.map +1 -0
  46. package/dist/{chunk-5SB7SC2G.js → chunk-UX3ZXN34.js} +3 -1
  47. package/dist/{cli-DYLGXxuu.d.ts → cli-BLZHYY2A.d.ts} +5 -5
  48. package/dist/cli.d.ts +10 -10
  49. package/dist/cli.js +5 -5
  50. package/dist/compounding/engine.d.ts +2 -2
  51. package/dist/compounding/preference-consolidator.d.ts +1 -1
  52. package/dist/compression-optimizer.d.ts +1 -1
  53. package/dist/config.d.ts +1 -1
  54. package/dist/config.js +2 -2
  55. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  56. package/dist/connectors/codex-materialize.d.ts +1 -1
  57. package/dist/connectors/index.d.ts +1 -1
  58. package/dist/consolidation-provenance-check.d.ts +2 -2
  59. package/dist/consolidation-undo.d.ts +2 -2
  60. package/dist/contradiction/index.d.ts +2 -2
  61. package/dist/conversation-index/backend.d.ts +1 -1
  62. package/dist/conversation-index/chunker.d.ts +1 -1
  63. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  64. package/dist/conversation-index/indexer.d.ts +1 -1
  65. package/dist/conversation-index/search.d.ts +1 -1
  66. package/dist/day-summary.d.ts +1 -1
  67. package/dist/delinearize.d.ts +1 -1
  68. package/dist/direct-answer-wiring.d.ts +1 -1
  69. package/dist/direct-answer.d.ts +1 -1
  70. package/dist/embedding-fallback.d.ts +1 -1
  71. package/dist/enrichment/index.d.ts +1 -1
  72. package/dist/entity-retrieval.d.ts +2 -2
  73. package/dist/entity-schema.d.ts +1 -1
  74. package/dist/explicit-capture.d.ts +6 -6
  75. package/dist/extraction-faithfulness.d.ts +1 -1
  76. package/dist/extraction-judge-telemetry.d.ts +1 -1
  77. package/dist/extraction-judge-training.d.ts +1 -1
  78. package/dist/extraction-judge.d.ts +1 -1
  79. package/dist/extraction.d.ts +1 -1
  80. package/dist/fallback-llm.d.ts +1 -1
  81. package/dist/graph-dashboard-diff.d.ts +1 -1
  82. package/dist/graph-dashboard-key.d.ts +1 -1
  83. package/dist/graph-dashboard-parser.d.ts +1 -1
  84. package/dist/graph-edge-reinforcement.d.ts +1 -1
  85. package/dist/graph-snapshot.d.ts +1 -1
  86. package/dist/graph.d.ts +1 -1
  87. package/dist/importance.d.ts +1 -1
  88. package/dist/importers/index.d.ts +1 -1
  89. package/dist/in-flight-reads.d.ts +1 -1
  90. package/dist/index.d.ts +98 -23
  91. package/dist/index.js +14 -8
  92. package/dist/intent.d.ts +1 -1
  93. package/dist/lcm/engine.d.ts +1 -1
  94. package/dist/lcm/index.d.ts +1 -1
  95. package/dist/lcm/tools.d.ts +1 -1
  96. package/dist/lifecycle.d.ts +1 -1
  97. package/dist/live-connectors-runner.d.ts +1 -1
  98. package/dist/local-llm.d.ts +1 -1
  99. package/dist/local-model-endpoint.d.ts +1 -1
  100. package/dist/maintenance/memory-governance.d.ts +1 -1
  101. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  102. package/dist/mcp-memory-inspector-app.d.ts +8 -8
  103. package/dist/memory-action-policy.d.ts +1 -1
  104. package/dist/memory-cache.d.ts +1 -1
  105. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  106. package/dist/memory-projection-store.d.ts +1 -1
  107. package/dist/memory-provenance.d.ts +1 -1
  108. package/dist/memory-worth-outcomes.d.ts +2 -2
  109. package/dist/models-json.d.ts +1 -1
  110. package/dist/namespaces/migrate.d.ts +3 -3
  111. package/dist/namespaces/principal.d.ts +1 -1
  112. package/dist/namespaces/search.d.ts +1 -1
  113. package/dist/namespaces/storage.d.ts +3 -3
  114. package/dist/native-knowledge.d.ts +1 -1
  115. package/dist/offline-sync-impression-drain.d.ts +1 -1
  116. package/dist/operator-toolkit.d.ts +2 -2
  117. package/dist/operator-toolkit.js +3 -3
  118. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  119. package/dist/orchestration/maintenance.d.ts +3 -3
  120. package/dist/orchestration/maintenance.js +2 -2
  121. package/dist/{orchestrator-BHx-DWCa.d.ts → orchestrator-CplS9U3U.d.ts} +5 -5
  122. package/dist/orchestrator.d.ts +6 -6
  123. package/dist/orchestrator.js +8 -8
  124. package/dist/patterns-cli.d.ts +1 -1
  125. package/dist/{pipeline-DDHSE876.d.ts → pipeline-DB4CbFqo.d.ts} +1 -1
  126. package/dist/policy-runtime.d.ts +1 -1
  127. package/dist/proactive-contention.d.ts +1 -1
  128. package/dist/provenance.d.ts +1 -1
  129. package/dist/{qmd-C4WVh6BM.d.ts → qmd-BxZmOLHq.d.ts} +1 -1
  130. package/dist/qmd-preflight.d.ts +2 -2
  131. package/dist/qmd-recall-cache.d.ts +1 -1
  132. package/dist/qmd.d.ts +2 -2
  133. package/dist/recall-concurrency-config.d.ts +1 -1
  134. package/dist/recall-disclosure-escalation.d.ts +1 -1
  135. package/dist/recall-explain-renderer.d.ts +1 -1
  136. package/dist/recall-memory-map.d.ts +1 -1
  137. package/dist/recall-planner-llm.d.ts +1 -1
  138. package/dist/recall-state.d.ts +1 -1
  139. package/dist/recall-tag-filter.d.ts +1 -1
  140. package/dist/recall-timings.d.ts +1 -1
  141. package/dist/recall-xray-cli.d.ts +1 -1
  142. package/dist/recall-xray-renderer.d.ts +1 -1
  143. package/dist/recall-xray.d.ts +1 -1
  144. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  145. package/dist/replay/normalizers/claude.d.ts +1 -1
  146. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  147. package/dist/replay/normalizers/shared.d.ts +1 -1
  148. package/dist/replay/runner.d.ts +1 -1
  149. package/dist/replay/types.d.ts +1 -1
  150. package/dist/resolve-auth-token.d.ts +1 -1
  151. package/dist/resume-bundles.js +3 -3
  152. package/dist/retrieval-agents.d.ts +2 -2
  153. package/dist/retrieval-tiers.d.ts +1 -1
  154. package/dist/routing/engine.d.ts +1 -1
  155. package/dist/routing/store.d.ts +1 -1
  156. package/dist/salvage-envelope.d.ts +1 -1
  157. package/dist/{scope-profiles-EqMXwzCz.d.ts → scope-profiles-NsQQo1Lt.d.ts} +1 -1
  158. package/dist/search/embed-helper.d.ts +1 -1
  159. package/dist/search/factory.d.ts +1 -1
  160. package/dist/search/index.d.ts +1 -1
  161. package/dist/search/lancedb-backend.d.ts +1 -1
  162. package/dist/search/meilisearch-backend.d.ts +1 -1
  163. package/dist/search/noop-backend.d.ts +1 -1
  164. package/dist/search/orama-backend.d.ts +1 -1
  165. package/dist/search/port.d.ts +1 -1
  166. package/dist/search/remote-backend.d.ts +1 -1
  167. package/dist/{semantic-consolidation-CYpvwmQc.d.ts → semantic-consolidation-DW85h30n.d.ts} +1 -1
  168. package/dist/semantic-consolidation.d.ts +2 -2
  169. package/dist/semantic-rule-verifier.d.ts +1 -1
  170. package/dist/session-observer-bands.d.ts +1 -1
  171. package/dist/session-observer-state.d.ts +1 -1
  172. package/dist/shared-context/manager.d.ts +1 -1
  173. package/dist/signal.d.ts +1 -1
  174. package/dist/{storage-Dxd7zVZH.d.ts → storage-o5BTAa8d.d.ts} +1 -1
  175. package/dist/storage.d.ts +2 -2
  176. package/dist/summarizer.d.ts +1 -1
  177. package/dist/summary-snapshot.d.ts +1 -1
  178. package/dist/temporal-supersession.d.ts +2 -2
  179. package/dist/temporal-timeline-recall.d.ts +1 -1
  180. package/dist/temporal-validity.d.ts +1 -1
  181. package/dist/threading.d.ts +1 -1
  182. package/dist/tier-migration.d.ts +2 -2
  183. package/dist/tier-routing.d.ts +1 -1
  184. package/dist/topics.d.ts +1 -1
  185. package/dist/transcript.d.ts +1 -1
  186. package/dist/trust-score-stage.d.ts +1 -1
  187. package/dist/trust-score.d.ts +1 -1
  188. package/dist/{types-OUCJALBK.d.ts → types-V3dT-pen.d.ts} +14 -2
  189. package/dist/types.d.ts +1 -1
  190. package/dist/utility-runtime.d.ts +1 -1
  191. package/dist/write-envelope.d.ts +1 -1
  192. package/package.json +2 -2
  193. package/src/activity/config.test.ts +42 -4
  194. package/src/activity/config.ts +83 -8
  195. package/src/activity/index.ts +5 -3
  196. package/src/activity/memory-gen.test.ts +436 -0
  197. package/src/activity/memory-gen.ts +409 -0
  198. package/src/activity/runner.test.ts +3 -0
  199. package/src/activity/scheduler.test.ts +3 -0
  200. package/src/activity/sync-registration.test.ts +2 -1
  201. package/src/activity/types.ts +15 -1
  202. package/src/config.test.ts +7 -0
  203. package/dist/chunk-GSQASASV.js.map +0 -1
  204. package/dist/chunk-YHURQ3M5.js.map +0 -1
  205. /package/dist/{auto-sync-UZG3XQZ5.js.map → auto-sync-IH3G25MT.js.map} +0 -0
  206. /package/dist/{chunk-5EKOBRCA.js.map → chunk-BCNVNUQG.js.map} +0 -0
  207. /package/dist/{chunk-V6LYAXGW.js.map → chunk-F7BWFIDK.js.map} +0 -0
  208. /package/dist/{chunk-BTK2PIFL.js.map → chunk-GBT4TFV7.js.map} +0 -0
  209. /package/dist/{chunk-JOCXI2O5.js.map → chunk-K2B2TMF3.js.map} +0 -0
  210. /package/dist/{chunk-VLIY55Q5.js.map → chunk-TXXP7WAM.js.map} +0 -0
  211. /package/dist/{chunk-5SB7SC2G.js.map → chunk-UX3ZXN34.js.map} +0 -0
@@ -1,16 +1,18 @@
1
1
  import {
2
2
  WEARABLE_SOURCE_PREFIX,
3
+ computeTrustScore,
4
+ decideSmart,
3
5
  defaultTimezone,
4
6
  loadSyncState,
5
7
  syncWearableSource,
6
8
  wearableSourceLabel
7
- } from "./chunk-5SB7SC2G.js";
9
+ } from "./chunk-UX3ZXN34.js";
8
10
  import {
9
11
  CompressionGuidelineCoordinator
10
12
  } from "./chunk-JECBQBEX.js";
11
13
  import {
12
14
  MaintenanceScheduler
13
- } from "./chunk-V6LYAXGW.js";
15
+ } from "./chunk-F7BWFIDK.js";
14
16
  import {
15
17
  runPeerProfileReasoner
16
18
  } from "./chunk-I74SUMNI.js";
@@ -238,7 +240,7 @@ import {
238
240
  import {
239
241
  runNamespaceMaintenanceFanout,
240
242
  summarizeNamespaceMaintenanceHealth
241
- } from "./chunk-BTK2PIFL.js";
243
+ } from "./chunk-GBT4TFV7.js";
242
244
  import {
243
245
  NamespaceCatalog,
244
246
  planNamespaceMaintenance
@@ -305,6 +307,9 @@ import {
305
307
  loadCorrectionsFile,
306
308
  saveCorrectionsFile
307
309
  } from "./chunk-NDAH7BJ5.js";
310
+ import {
311
+ activityDayWindow
312
+ } from "./chunk-MONWCSVL.js";
308
313
  import {
309
314
  buildRecallQueryPolicy
310
315
  } from "./chunk-LBJBNWS2.js";
@@ -13415,7 +13420,7 @@ var OrchestratorInitCoordinator = class {
13415
13420
  if (signal.aborted) return;
13416
13421
  if (!this.deps.wearablesAutoSyncHandle && this.deps.config.wearables.enabled && this.deps.config.wearables.autoSyncEnabled && Object.values(this.deps.config.wearables.sources).some((source) => source.enabled)) {
13417
13422
  try {
13418
- const { startWearablesAutoSync } = await import("./auto-sync-UZG3XQZ5.js");
13423
+ const { startWearablesAutoSync } = await import("./auto-sync-IH3G25MT.js");
13419
13424
  if (signal.aborted) return;
13420
13425
  this.deps.wearablesAutoSyncHandle = startWearablesAutoSync(
13421
13426
  {
@@ -22926,6 +22931,262 @@ function publisherForConnector(connectorId) {
22926
22931
  return publisherFor(hostIdForConnector(connectorId));
22927
22932
  }
22928
22933
 
22934
+ // src/activity/memory-gen.ts
22935
+ var ACTIVITY_ALLOWED_CATEGORIES = {
22936
+ decision: true,
22937
+ commitment: true,
22938
+ preference: true,
22939
+ moment: true
22940
+ };
22941
+ var FIRST_PERSON = /\b(?:i|we|my|our|i['’]ve|we['’]ve)\b/i;
22942
+ var ATTRIBUTION_SPEAKER = String.raw`(?!(?:i|we|us|me|my|our)\b)[A-Za-z][\w.'’-]*`;
22943
+ var SPEECH_VERB = String.raw`(?:said|says|wrote|writes|posted|typed|asked|replied|messaged|commented|noted|announced|added|responded|mentioned|told)`;
22944
+ var VERB_ATTRIBUTION = new RegExp(String.raw`^\s*${ATTRIBUTION_SPEAKER}\s+${SPEECH_VERB}\b`, "i");
22945
+ var LABEL_ATTRIBUTION = new RegExp(
22946
+ String.raw`^\s*(${ATTRIBUTION_SPEAKER}(?:\s+[A-Za-z][\w.'’-]*){0,3})\s*:\s*`,
22947
+ "i"
22948
+ );
22949
+ var LABEL_NAMES_SENDER = /\b(?:from|by)\s+[A-Z][a-z]/;
22950
+ var NON_SENDER_LABELS = {
22951
+ note: true,
22952
+ notes: true,
22953
+ todo: true,
22954
+ fixme: true,
22955
+ reminder: true,
22956
+ update: true,
22957
+ updates: true,
22958
+ warning: true,
22959
+ info: true,
22960
+ tip: true,
22961
+ tips: true,
22962
+ summary: true,
22963
+ status: true,
22964
+ tldr: true,
22965
+ fyi: true,
22966
+ idea: true,
22967
+ goal: true,
22968
+ goals: true,
22969
+ plan: true,
22970
+ plans: true,
22971
+ action: true,
22972
+ actions: true,
22973
+ context: true,
22974
+ question: true
22975
+ };
22976
+ var TRUST_ATTRIBUTE_KEYS = {
22977
+ trustscore: true,
22978
+ trustdecision: true,
22979
+ judgeverdict: true
22980
+ };
22981
+ function isEligibleActivityFact(fact) {
22982
+ if (ACTIVITY_ALLOWED_CATEGORIES[fact.category] !== true) return false;
22983
+ if (!FIRST_PERSON.test(fact.content)) return false;
22984
+ if (VERB_ATTRIBUTION.test(fact.content)) return false;
22985
+ const label = LABEL_ATTRIBUTION.exec(fact.content);
22986
+ if (label !== null) {
22987
+ const labelText = label[1].trim();
22988
+ const firstToken = labelText.split(/\s+/)[0].toLowerCase();
22989
+ if (NON_SENDER_LABELS[firstToken] !== true || LABEL_NAMES_SENDER.test(labelText)) return false;
22990
+ }
22991
+ return true;
22992
+ }
22993
+ function composeSalvagedActivityEnvelope(input, ctx) {
22994
+ const envelope = composeMemoryEnvelope(input, ctx, { salvage: true });
22995
+ if (envelope.salvageNotes.length > 0) {
22996
+ log.warn(`activity write salvaged invalid fields: ${envelope.salvageNotes.join("; ")}`);
22997
+ }
22998
+ return envelope;
22999
+ }
23000
+ async function generateActivityMemories(date, digestBody, config, deps) {
23001
+ const result = {
23002
+ created: 0,
23003
+ promoted: 0,
23004
+ demoted: 0,
23005
+ pendingReview: 0,
23006
+ rejectedDisplayedContent: 0,
23007
+ rejectedByJudge: 0,
23008
+ skipped: 0
23009
+ };
23010
+ if (config.extractionMode !== "smart" || digestBody.trim().length === 0) return result;
23011
+ const { startUtc, endUtc } = activityDayWindow(date, config.timezone);
23012
+ let extracted;
23013
+ try {
23014
+ extracted = await deps.extract(digestBody);
23015
+ } catch (err) {
23016
+ log.warn(
23017
+ `activity extraction failed; skipping the day's memory pass: ${err instanceof Error ? err.message : String(err)}`
23018
+ );
23019
+ return result;
23020
+ }
23021
+ if (extracted.extractionFailure !== void 0) {
23022
+ log.warn(
23023
+ `activity extraction reported a failure; skipping the day's memory pass: ${extracted.extractionFailure}`
23024
+ );
23025
+ return result;
23026
+ }
23027
+ const candidates = extracted.facts.filter((fact) => {
23028
+ if (!isEligibleActivityFact(fact)) {
23029
+ result.rejectedDisplayedContent += 1;
23030
+ return false;
23031
+ }
23032
+ const importance = scoreImportance(fact.content, fact.category, fact.tags);
23033
+ if (!Number.isFinite(fact.confidence) || fact.confidence < config.minConfidence || !isAboveImportanceThreshold(importance.level, config.minImportance)) {
23034
+ result.skipped += 1;
23035
+ return false;
23036
+ }
23037
+ return true;
23038
+ });
23039
+ let verdicts;
23040
+ try {
23041
+ verdicts = await deps.judge(candidates.map((fact) => ({
23042
+ text: fact.content,
23043
+ category: fact.category,
23044
+ confidence: fact.confidence,
23045
+ tags: fact.tags,
23046
+ importanceLevel: scoreImportance(fact.content, fact.category, fact.tags).level
23047
+ })));
23048
+ } catch (err) {
23049
+ log.warn(
23050
+ `activity extraction judge unavailable; using trust scoring only: ${err instanceof Error ? err.message : String(err)}`
23051
+ );
23052
+ verdicts = /* @__PURE__ */ new Map();
23053
+ }
23054
+ const strongestByKey = /* @__PURE__ */ new Map();
23055
+ for (let index = 0; index < candidates.length; index += 1) {
23056
+ const fact = candidates[index];
23057
+ const verdict = verdicts.get(index);
23058
+ const verdictKind = verdict === void 0 ? void 0 : getVerdictKind(verdict);
23059
+ const trust = computeTrustScore({
23060
+ extractionConfidence: fact.confidence,
23061
+ sourceTrust: config.sourceTrust,
23062
+ judgeVerdict: verdictKind,
23063
+ evidence: { corroboratedBySources: [] }
23064
+ });
23065
+ const decision = decideSmart(trust, verdictKind, {
23066
+ autoApproveTrust: config.autoApproveTrust,
23067
+ reviewTrust: config.reviewTrust
23068
+ });
23069
+ const key = fact.content.trim().toLowerCase();
23070
+ const scored = {
23071
+ fact,
23072
+ key,
23073
+ trust,
23074
+ verdictKind,
23075
+ decision,
23076
+ importance: scoreImportance(fact.content, fact.category, fact.tags)
23077
+ };
23078
+ const prev = strongestByKey.get(key);
23079
+ if (prev === void 0) {
23080
+ strongestByKey.set(key, scored);
23081
+ } else {
23082
+ result.skipped += 1;
23083
+ const rankOf = (outcome) => outcome === "active" ? 2 : outcome === "review" ? 1 : 0;
23084
+ const curRank = rankOf(scored.decision.outcome);
23085
+ const prevRank = rankOf(prev.decision.outcome);
23086
+ if (curRank > prevRank || curRank === prevRank && trust > prev.trust) {
23087
+ strongestByKey.set(key, scored);
23088
+ }
23089
+ }
23090
+ }
23091
+ const writable = [];
23092
+ for (const scored of strongestByKey.values()) {
23093
+ const existing = await deps.writer.findActivityMemoryByContent(scored.key, startUtc, endUtc);
23094
+ if (existing !== null) {
23095
+ if (existing.status === "pending_review") {
23096
+ if (scored.decision.outcome === "drop" && scored.decision.reason === "judge-rejected") {
23097
+ if (await deps.writer.demoteActivityMemory(existing.id, {
23098
+ trustScore: scored.trust.toFixed(3),
23099
+ trustDecision: "demoted-by-rejection",
23100
+ judgeVerdict: "reject"
23101
+ })) {
23102
+ result.demoted += 1;
23103
+ continue;
23104
+ }
23105
+ } else if (scored.decision.outcome === "active") {
23106
+ if (await deps.writer.promoteActivityMemory(
23107
+ existing.id,
23108
+ {
23109
+ trustScore: scored.trust.toFixed(3),
23110
+ trustDecision: "promoted-by-reassessment",
23111
+ ...scored.verdictKind !== void 0 ? { judgeVerdict: scored.verdictKind } : {}
23112
+ },
23113
+ scored.trust
23114
+ )) {
23115
+ result.promoted += 1;
23116
+ continue;
23117
+ }
23118
+ }
23119
+ }
23120
+ result.skipped += 1;
23121
+ continue;
23122
+ }
23123
+ if (scored.decision.outcome === "drop") {
23124
+ if (scored.decision.reason === "judge-rejected") result.rejectedByJudge += 1;
23125
+ else result.skipped += 1;
23126
+ continue;
23127
+ }
23128
+ writable.push({
23129
+ fact: scored.fact,
23130
+ key: scored.key,
23131
+ status: scored.decision.outcome === "active" ? "active" : "pending_review",
23132
+ trust: scored.trust,
23133
+ trustDecision: scored.decision.reason,
23134
+ ...scored.verdictKind !== void 0 ? { judgeVerdict: scored.verdictKind } : {},
23135
+ importance: scored.importance
23136
+ });
23137
+ }
23138
+ writable.sort((a, b) => {
23139
+ if (a.trust !== b.trust) return b.trust - a.trust;
23140
+ return a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
23141
+ });
23142
+ const alreadyWritten = config.maxMemoriesPerDay > 0 ? await deps.writer.countActivityMemoriesForDay(startUtc, endUtc) : 0;
23143
+ let remaining = config.maxMemoriesPerDay > 0 ? Math.max(0, config.maxMemoriesPerDay - alreadyWritten) : Number.POSITIVE_INFINITY;
23144
+ for (const entry of writable) {
23145
+ if (remaining <= 0) {
23146
+ result.skipped += 1;
23147
+ continue;
23148
+ }
23149
+ const structuredAttributes = {
23150
+ trustScore: entry.trust.toFixed(3),
23151
+ trustDecision: entry.trustDecision,
23152
+ ...entry.judgeVerdict !== void 0 ? { judgeVerdict: entry.judgeVerdict } : {}
23153
+ };
23154
+ for (const [key, value] of Object.entries(entry.fact.structuredAttributes ?? {})) {
23155
+ if (TRUST_ATTRIBUTE_KEYS[key.trim().toLowerCase()] !== true) structuredAttributes[key] = value;
23156
+ }
23157
+ const envelope = composeSalvagedActivityEnvelope(
23158
+ {
23159
+ content: entry.fact.content,
23160
+ category: entry.fact.category,
23161
+ tags: [...entry.fact.tags, "activity"],
23162
+ entityRef: entry.fact.entityRef,
23163
+ // Persist the decision-derived trust as confidence; extractor attributes
23164
+ // ride along, with trust score/decision + judge verdict added last so
23165
+ // downstream sees the active/pending rationale (wearable-path parity).
23166
+ confidence: entry.trust,
23167
+ validAt: startUtc,
23168
+ structuredAttributes,
23169
+ sourceConnector: "activity",
23170
+ sourceReason: "screen activity digest"
23171
+ },
23172
+ { source: "activity", now: deps.now }
23173
+ );
23174
+ const write = await deps.writer.writeSealedMemory(envelope, {
23175
+ status: entry.status,
23176
+ contentHashSource: entry.key,
23177
+ importance: entry.importance
23178
+ });
23179
+ if (write.tombstoneBlocked) {
23180
+ result.skipped += 1;
23181
+ continue;
23182
+ }
23183
+ if (entry.status === "active") result.created += 1;
23184
+ else result.pendingReview += 1;
23185
+ remaining -= 1;
23186
+ }
23187
+ return result;
23188
+ }
23189
+
22929
23190
  // src/meetings/detect.ts
22930
23191
  import { createHash as createHash9 } from "crypto";
22931
23192
  var DEFAULT_MEETING_APP_PATTERNS = [
@@ -24180,6 +24441,8 @@ export {
24180
24441
  ensureBuiltInWearableConnectors,
24181
24442
  WearablesService,
24182
24443
  locateTranscriptPath,
24444
+ isEligibleActivityFact,
24445
+ generateActivityMemories,
24183
24446
  DEFAULT_MEETING_APP_PATTERNS,
24184
24447
  DEFAULT_MEETINGS_DETECTION_CONFIG,
24185
24448
  meetingId,
@@ -24199,4 +24462,4 @@ export {
24199
24462
  blendGraphExpandedRecallScore,
24200
24463
  Orchestrator
24201
24464
  };
24202
- //# sourceMappingURL=chunk-YHURQ3M5.js.map
24465
+ //# sourceMappingURL=chunk-UH7VNQ7O.js.map